* Makefile: Build the make-map.exe in Mono.Unix.Native; add /nowarn:0618 to
authorJonathan Pryor <jpryor@novell.com>
Tue, 20 Sep 2005 15:30:44 +0000 (15:30 -0000)
committerJonathan Pryor <jpryor@novell.com>
Tue, 20 Sep 2005 15:30:44 +0000 (15:30 -0000)
    the build, so that we don't see dozens of warnings about using [Obsolete]
    code.
  * Mono.Unix.Native: directory added
  * Mono.Posix.dll.sources: Add Mono.Unix.Native/*.cs sources.

  * Mono.Unix/CdeclFunction.cs: [Obsolete]d by Mono.Unix.Native.CdeclFunction.
  * Mono.Unix/make-map.cs: Remove.
  * Mono.Unix/Stdlib.cs: [Obsolete] the types; use the Mono.Unix.Native.*
    types instead.
  * Mono.Unix/StdioFileStream.cs: Add GC.KeepAlive statements to prevent
    premature GC's (FxCop suggestion).
  * Mono.Unix/Syscall.cs: Remove [Map] attribute from all types;
    [CLSCompliant(false)]
    work; [Obsolete] all types and suggest using the Mono.Unix.Native.*
    replacements; remove [IncludeAttribute] -- superseded by
    Mono.Unix.Native/Syscall.cs's [HeaderAttribte] for CLS compliance.
  * Mono.Unix/UnixConvert.cs: [Obsolete]d by Mono.Unix.Native.NativeConvert.
  * Mono.Unix/UnixDirectory.cs, Mono.Unix/UnixDriveInfo.cs,
    Mono.Unix/UnixEnvironment.cs, Mono.Unix/UnixGroup.cs,
    Mono.Unix/UnixGroupInfo.cs, Mono.Unix/UnixSymbolicLinkInfo.cs,
    Mono.Unix/UnixUser.cs, Mono.Unix/UnixUserInfo.cs:
    Add [CLSCompliant(false)] as necessary.
  * Mono.Unix/UnixFile.cs, Mono.Unix/UnixDirectory.cs,
    Mono.Unix/UnixFileInfo.cs, Mono.Unix/UnixFileSystemInfo.cs:
    [CLSCompliant(false)], addition of method overloads for [Obsolete]d types,
    warn about changing return types.
  * Mono.Unix/UnixProcess.cs, Mono.Unix/UnixStream.cs:
    Add [CLSCompliant(false)] as necessary, and warn about changing property types.

  * Mono.Unix.Native/ChangeLog: Started.
  * Mono.Unix.Native/CdeclFunction.cs: Copied from ../Mono.Unix; change namespace.
  * Mono.Unix.Native/HeaderAttribute.cs: Added
  * Mono.Unix.Native/make-map.cs: Copied from ../Mono.Unix; sort type and
    member names in output (makes for a more stable svn history, as
    types/members won't change position anymore within generated code);
    look for HeaderAttribute not IncludeAttribute for getting headers &
    #defines; generate NativeConvert partial class.
  * Mono.Unix.Native/NativeConvert.cs: Copied from ../Mono.Unix; change
    namespace; turn into a partial class; Remove generated code (generated
    code is in NativeConvert.generated.cs).
  * Mono.Unix.Native/NativeConvert.generated.cs: Added
  * Mono.Unix.Native/Stdlib.cs: Copied from ../Mono.Unix; change namespace;
    rename Error to Errno (as Error is a "reserved word" in FxCop);
    [CLSCompliant(false)] support.
  * Mono.Unix.Native/Syscall.cs: Use HeaderAttribute, not IncludeAttribute,
    for CLS compliance; add [CLSCompliant(false)] as needed; use NativeConvert,
    not UnixConvert.

svn path=/trunk/mcs/; revision=50299

1758 files changed:
ChangeLog
Makefile.am
README
data/browscap.ini
docs/exception-handling.txt [new file with mode: 0644]
libatomic_ops/AUTHORS [new file with mode: 0644]
libatomic_ops/COPYING [new file with mode: 0644]
libatomic_ops/ChangeLog [new file with mode: 0644]
libatomic_ops/INSTALL [new file with mode: 0644]
libatomic_ops/Makefile.am [new file with mode: 0644]
libatomic_ops/Makefile.in [new file with mode: 0644]
libatomic_ops/NEWS [new file with mode: 0644]
libatomic_ops/README [new file with mode: 0644]
libatomic_ops/aclocal.m4 [new file with mode: 0644]
libatomic_ops/compile [new file with mode: 0755]
libatomic_ops/config.guess [new file with mode: 0755]
libatomic_ops/config.sub [new file with mode: 0755]
libatomic_ops/configure [new file with mode: 0755]
libatomic_ops/configure.ac [new file with mode: 0644]
libatomic_ops/depcomp [new file with mode: 0755]
libatomic_ops/doc/COPYING [new file with mode: 0644]
libatomic_ops/doc/LICENSING.txt [new file with mode: 0644]
libatomic_ops/doc/Makefile.am [new file with mode: 0644]
libatomic_ops/doc/Makefile.in [new file with mode: 0644]
libatomic_ops/doc/README.txt [new file with mode: 0644]
libatomic_ops/doc/README_malloc.txt [new file with mode: 0644]
libatomic_ops/doc/README_stack.txt [new file with mode: 0644]
libatomic_ops/doc/README_win32.txt [new file with mode: 0644]
libatomic_ops/install-sh [new file with mode: 0755]
libatomic_ops/missing [new file with mode: 0755]
libatomic_ops/mkinstalldirs [new file with mode: 0755]
libatomic_ops/src/Makefile.am [new file with mode: 0644]
libatomic_ops/src/Makefile.in [new file with mode: 0644]
libatomic_ops/src/Makefile.msft [new file with mode: 0644]
libatomic_ops/src/atomic_ops.c [new file with mode: 0644]
libatomic_ops/src/atomic_ops.h [new file with mode: 0755]
libatomic_ops/src/atomic_ops/Makefile.am [new file with mode: 0644]
libatomic_ops/src/atomic_ops/Makefile.in [new file with mode: 0644]
libatomic_ops/src/atomic_ops/generalize-small.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/generalize-small.template [new file with mode: 0644]
libatomic_ops/src/atomic_ops/generalize.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/Makefile.am [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/Makefile.in [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/README [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/acquire_release_volatile.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/aligned_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/all_acquire_release_volatile.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/all_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/char_acquire_release_volatile.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/char_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/emul_cas.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/alpha.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/cris.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/hppa.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/ia64.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/m68k.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/powerpc.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/s390.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/generic_pthread.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/hpc/hppa.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/hpc/ia64.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/ibmc/powerpc.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/icc/ia64.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/int_acquire_release_volatile.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/int_aligned_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/int_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/msftc/x86.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/ordered.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/ordered_except_wr.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/short_acquire_release_volatile.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/short_aligned_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/short_atomic_load_store.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_char.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops_malloc.c [new file with mode: 0644]
libatomic_ops/src/atomic_ops_malloc.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops_stack.c [new file with mode: 0644]
libatomic_ops/src/atomic_ops_stack.h [new file with mode: 0644]
libatomic_ops/src/atomic_ops_sysdeps.S [new file with mode: 0644]
libatomic_ops/src/config.h.in [new file with mode: 0644]
libatomic_ops/tests/Makefile.am [new file with mode: 0644]
libatomic_ops/tests/Makefile.in [new file with mode: 0644]
libatomic_ops/tests/list_atomic.template [new file with mode: 0644]
libatomic_ops/tests/run_parallel.inc [new file with mode: 0644]
libatomic_ops/tests/test_atomic.c [new file with mode: 0644]
libatomic_ops/tests/test_atomic.template [new file with mode: 0644]
libatomic_ops/tests/test_atomic_include.h [new file with mode: 0644]
libatomic_ops/tests/test_malloc.c [new file with mode: 0644]
libatomic_ops/tests/test_stack.c [new file with mode: 0644]
mcs/ChangeLog
mcs/Makefile
mcs/bmcs/ecore.cs
mcs/bmcs/generic.cs
mcs/build/ChangeLog
mcs/build/profiles/basic.make
mcs/build/profiles/default.make
mcs/build/profiles/net_1_1_bootstrap.make
mcs/class/Commons.Xml.Relaxng/Commons.Xml.Nvdl/ChangeLog
mcs/class/Commons.Xml.Relaxng/Commons.Xml.Nvdl/NvdlCompileContext.cs
mcs/class/Commons.Xml.Relaxng/Commons.Xml.Nvdl/NvdlStructures.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ArrayBase.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ArrayDesc.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/BinaryEncoding.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/BlobBase.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/BlobParameterBuffer.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Charset.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/CharsetCollection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DatabaseParameterBuffer.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbDataType.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbField.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbStatementType.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbValue.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Descriptor.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/EventParameterBuffer.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/GlobalizationHelper.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IDatabase.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IServiceManager.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ITransaction.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscCodes.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscError.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscErrorCollection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscException.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscHelper.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ParameterBuffer.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/RemoteEvent.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Resources/isc_error_msg.resources
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Resources/isc_error_msg.txt
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ServiceParameterBuffer.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/StatementBase.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/StringCollection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TransactionParameterBuffer.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TypeDecoder.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TypeEncoder.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TypeHelper.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/ArrayDescMarshal.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/ArrayDescMarshaler.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FbClient.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesArray.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesBlob.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesConnection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesDatabase.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesServiceManager.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesStatement.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesTransaction.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/XSQLDA.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/XsqldaMarshaler.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird.dll.resources
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird.snk
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/ClientFactory.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbCharacterSets.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbCheckConstraints.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbChecksByTable.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbCollations.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbColumnPrivileges.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDbSchema.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDbSchemaFactory.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbForeignKeys.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbFunctions.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbGenerators.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbIndexes.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbPrimaryKeys.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbProcedurePrivileges.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbProcedures.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbRestrictions.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbRoles.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTableConstraints.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTablePrivileges.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTables.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTriggers.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbUniqueKeys.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbViewPrivileges.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbViews.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCharset.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCommand.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCommandBuilder.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCommandBuilderBehavior.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionInternal.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionPool.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionString.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDataAdapter.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDataReader.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDatabaseInfo.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDbSchemaType.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDbType.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbError.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbErrorCollection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbException.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbInfoMessageEventArgs.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbParameter.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbParameterCollection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRemoteEvent.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRemoteEventEventArgs.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRowUpdatedEventArgs.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRowUpdatingEventArgs.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbTransaction.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbTransactionOptions.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/CommandExecutedEventArgs.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/CommandExecutingEventArgs.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/FbScript.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/SqlStatementType.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/StringParser.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbBackup.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbBackupFile.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbBackupFlags.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbConfiguration.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbDatabasesInfo.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbLog.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbRestore.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbRestoreFlags.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbSecurity.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbServerConfig.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbServerProperties.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbService.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbServiceState.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbShutdownMode.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbStatistical.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbStatisticalFlags.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbUserData.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbValidation.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbValidationFlags.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/ServiceOutputEventArgs.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsArray.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsBlob.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsConnection.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsDatabase.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsEventManager.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsResponse.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsServiceManager.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsStatement.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsTransaction.cs
mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/XdrStream.cs
mcs/class/FirebirdSql.Data.Firebird/Makefile
mcs/class/FirebirdSql.Data.Firebird/changelog.txt
mcs/class/FirebirdSql.Data.Firebird/license.html
mcs/class/FirebirdSql.Data.Firebird/license.txt
mcs/class/FirebirdSql.Data.Firebird/readme.txt
mcs/class/I18N/CJK/CP50221.cs
mcs/class/I18N/CJK/ChangeLog
mcs/class/I18N/CJK/GB18030Encoding.cs
mcs/class/I18N/Common/ChangeLog
mcs/class/I18N/Common/Handlers.cs
mcs/class/Makefile
mcs/class/Managed.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/SWF.csproj
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charset.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ClassDelegate.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Color.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/DestinationDelegate.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Font.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeyStruct.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Major.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Minor.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/README [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTFException.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Style.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleElement.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleType.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TokenClass.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj.user [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/test.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDialog.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridDrawingLogic.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/IRootGridEntry.cs [new file with mode: 0755]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeIcon.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertiesTab.cs [new file with mode: 0755]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridCommands.cs [new file with mode: 0755]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridTextBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TODO [deleted file]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeNice.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolTip.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/lang.cs [deleted file]
mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ImageListTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelPropertyTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelTest.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxEventTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MonthCalendarTest.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PictureBoxTest.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ProgressBarTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/StatusBarTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TestImageIndexConverter.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolBarTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeViewTest.cs
mcs/class/Managed.Windows.Forms/resources/ChangeLog
mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resources.prebuilt
mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resx
mcs/class/Microsoft.Build.Engine/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Makefile [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BatchingImpl.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildEngine.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroupCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildProperty.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroupCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildSettings.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildWhen.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeType.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/DirectoryScanner.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/EventSource.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Expression.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/FileLogger.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GlobalEngineAccessor.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/HostLogger.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItem.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItemGroup.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItemGroupCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildProperty.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildPropertyGroup.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildPropertyGroupCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ICultureStringUtilities.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IEngine.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IGlobalEngineAccessor.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IHostFeedback.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IHostLogger.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ILangSecurityLevelChecker.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IProject.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITarget.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITargetCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITaskElement.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportedProject.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InternalLoggerException.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InvalidProjectFileException.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ItemPropertyGroupingBase.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ItemReference.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MetadataReference.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MonoTODOAttribute.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ProcessingPass.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ProjectFileEncoding.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/PropertyPosition.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/PropertyReference.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/SolutionParser.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TargetCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskDatabase.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskElement.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskEngineAssemblyResolver.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Utilities.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/WriteHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Xml.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/conditions.jay [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.mdp [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.mds [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.targets [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InternalLoggerExceptionTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mds [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Makefile [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mdp [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mds [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.targets [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/AnyEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildErrorEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildErrorEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildFinishedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildFinishedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildMessageEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildMessageEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStartedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStartedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStatusEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStatusEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildWarningEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildWarningEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/CustomBuildEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/CustomBuildEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IBuildEngine.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IEventSource.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ILogger.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITask.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITaskItem.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoadInSeparateAppDomainAttribute.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoggerException.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoggerVerbosity.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/MessageImportance.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/MonoTODOAttribute.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/OutputAttribute.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectFinishedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectFinishedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectStartedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectStartedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/RequiredAttribute.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetFinishedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetFinishedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetStartedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetStartedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskFinishedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskFinishedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskStartedEventArgs.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskStartedEventHandler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework_test.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Mono.XBuild.Shared/AssemblyLoadInfo.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Mono.XBuild.Shared/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework.Test.mdp [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework.Test.mds [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildErrorEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildFinishedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildMessageEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildStartedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildWarningEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/CustomBuildEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/LoggerExceptionTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ProjectFinishedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ProjectStartedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TargetFinishedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TargetStartedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TaskFinishedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TaskStartedEventArgsTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Makefile [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/ICscHostObject.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/IVbcHostObject.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.mdp [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.mds [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.targets [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AL.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AppDomainIsolatedTaskExtension.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CommandLineBuilderExtension.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Copy.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CreateItem.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CreateProperty.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Csc.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Delete.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Error.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Exec.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/FindUnderPath.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GenerateResource.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GenerateTrustInfo.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetFrameworkPath.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetFrameworkSdkPath.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MakeDir.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ManagedCompiler.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Message.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MonoTODOAttribute.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ReadLinesFromFile.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RegisterAssembly.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RemoveDir.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/SignFile.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/TaskExtension.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ToolTaskExtension.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Touch.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/UnregisterAssembly.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Warning.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/WriteLinesToFile.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceReader.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceWriter.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceReader.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceWriter.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Makefile [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.mdp [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.mds [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.targets [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/AppDomainIsolatedTask.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/CommandLineBuilder.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ConcurrentLoggingHelper.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Logger.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/MonoTODOAttribute.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Task.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TaskItem.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TaskLoggingHelper.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities_test.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities.Test.mdp [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities.Test.mds [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities/TaskItemTest.cs [new file with mode: 0644]
mcs/class/Microsoft.JScript/ChangeLog
mcs/class/Microsoft.JScript/Makefile
mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/ChangeLog
mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/VsaEngine.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
mcs/class/Microsoft.JScript/Microsoft.JScript/CodeGenerator.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/Import.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/In.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/LateBinding.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/ObjectPrototype.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/Relational.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/ScriptBlock.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/SemanticAnalizer.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
mcs/class/Microsoft.JScript/Microsoft.Vsa/BaseVsaEngine.cs
mcs/class/Microsoft.JScript/Microsoft.Vsa/ChangeLog
mcs/class/Microsoft.JScript/Test/Mozilla/ChangeLog
mcs/class/Microsoft.JScript/Test/Mozilla/mjs-most.fail
mcs/class/Microsoft.JScript/Test/Mozilla/mjs-most.tests
mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs
mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs
mcs/class/Microsoft.VisualBasic/Test/standalone/6877.vb
mcs/class/Microsoft.VisualBasic/Test/standalone/6961.vb
mcs/class/Microsoft.VisualBasic/Test/standalone/6964.vb
mcs/class/Microsoft.Web.Atlas/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/ChangeLog [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Makefile [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Atlas.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Atlas_test.dll.sources [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Services/ScriptHandlerFactory.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Services/ScriptModule.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ActivationType.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Button.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ClickBehavior.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DataSourceDropTarget.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DragDropList.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DragMode.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DraggableListItem.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Filter.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/FloatingBehavior.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/HoverBehavior.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/MapStyle.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Option.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/PositioningMode.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/PropertyFilter.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Script.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ScriptManager.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Action.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionMemberConverter.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionSequence.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionTargetConverter.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Behavior.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BehaviorCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Binding.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingDirection.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IDConverter.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptComponent.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptObject.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/InvokeMethodAction.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponent.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentBase.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptControl.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEvent.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEventCollection.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEventDescriptor.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptMemberDescriptor.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptMethodDescriptor.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptPropertyDescriptor.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTextWriter.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptType.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTypeDescriptor.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/SetPropertyAction.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/TransformScriptEvent.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Microsoft.Web/VisibilityMode.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/ClickBehaviorTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DataSourceDropTargetTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DragDropListTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DraggableListItemTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/FloatingBehaviorTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/HoverBehaviorTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/LabelTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/ListViewTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/OptionTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/PropertyFilterTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/TextBoxTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ActionTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/BindingTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/InvokeMethodActionTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptComponentBaseTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptEventDescriptorTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptEventTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptMethodDescriptorTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptPropertyDescriptorTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptTypeDescriptorTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/SetPropertyActionTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/standalone/HelloWorld/HelloWorld.aspx [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/standalone/HelloWorld/HelloWorldService.asmx [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/standalone/script_samples/inheritance.html [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/Test/standalone/script_samples/interfaces.html [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/resources/AtlasControls.js [new file with mode: 0644]
mcs/class/Microsoft.Web.Atlas/resources/AtlasCore.js [new file with mode: 0644]
mcs/class/Mono.C5/Builder.cs
mcs/class/Mono.Cairo/ChangeLog
mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
mcs/class/Mono.Cairo/Mono.Cairo/Graphics.cs
mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs
mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs
mcs/class/Mono.Cairo/Samples/gtk/Graphics.cs [new file with mode: 0644]
mcs/class/Mono.Cairo/Samples/gtk/circles.cs
mcs/class/Mono.Cairo/Samples/gtk/clip_img.cs
mcs/class/Mono.Cairo/Samples/gtk/fillstroke.cs
mcs/class/Mono.Cairo/Samples/gtk/gradient.cs
mcs/class/Mono.Cairo/Samples/gtk/image.cs
mcs/class/Mono.Cairo/Samples/gtk/image_pattern.cs
mcs/class/Mono.Cairo/Samples/gtk/sysdraw.cs
mcs/class/Mono.Cairo/Samples/png/arc.cs
mcs/class/Mono.Cairo/Samples/png/arcneg.cs
mcs/class/Mono.Cairo/Samples/png/circles.cs
mcs/class/Mono.Cairo/Samples/png/clip.cs
mcs/class/Mono.Cairo/Samples/png/clip_img.cs
mcs/class/Mono.Cairo/Samples/png/curve_rect.cs
mcs/class/Mono.Cairo/Samples/png/curve_to.cs
mcs/class/Mono.Cairo/Samples/png/fillstroke.cs
mcs/class/Mono.Cairo/Samples/png/gradient.cs
mcs/class/Mono.Cairo/Samples/png/image.cs
mcs/class/Mono.Cairo/Samples/png/image_pattern.cs
mcs/class/Mono.Cairo/Samples/png/pattern_fill.cs
mcs/class/Mono.Cairo/Samples/png/text.cs
mcs/class/Mono.Cairo/Samples/win32/arc.cs [new file with mode: 0644]
mcs/class/Mono.Cairo/Samples/win32/compile.sh [new file with mode: 0755]
mcs/class/Mono.Cairo/Samples/x11/arc.cs
mcs/class/Mono.Cairo/Samples/x11/arcneg.cs
mcs/class/Mono.Cairo/Samples/x11/clip.cs
mcs/class/Mono.Cairo/Samples/x11/clip_img.cs
mcs/class/Mono.Cairo/Samples/x11/curve_rect.cs
mcs/class/Mono.Cairo/Samples/x11/curve_to.cs
mcs/class/Mono.Cairo/Samples/x11/fillstroke.cs
mcs/class/Mono.Cairo/Samples/x11/gradient.cs
mcs/class/Mono.Cairo/Samples/x11/image.cs
mcs/class/Mono.Cairo/Samples/x11/image_pattern.cs
mcs/class/Mono.Cairo/Samples/x11/text.cs
mcs/class/Mono.CompilerServices.SymbolWriter/ChangeLog
mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolWriter.cs
mcs/class/Mono.CompilerServices.SymbolWriter/SymbolWriterImpl.cs
mcs/class/Mono.Posix/Makefile
mcs/class/Mono.Posix/Mono.Posix.dll.sources
mcs/class/Mono.Posix/Mono.Unix.Native/CdeclFunction.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix.Native/ChangeLog [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix.Native/HeaderAttribute.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.generated.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix.Native/Stdlib.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix.Native/make-map.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix/CdeclFunction.cs
mcs/class/Mono.Posix/Mono.Unix/ChangeLog
mcs/class/Mono.Posix/Mono.Unix/StdioFileStream.cs
mcs/class/Mono.Posix/Mono.Unix/Stdlib.cs
mcs/class/Mono.Posix/Mono.Unix/Syscall.cs
mcs/class/Mono.Posix/Mono.Unix/UnixConvert.cs
mcs/class/Mono.Posix/Mono.Unix/UnixDirectory.cs
mcs/class/Mono.Posix/Mono.Unix/UnixDirectoryInfo.cs
mcs/class/Mono.Posix/Mono.Unix/UnixDriveInfo.cs
mcs/class/Mono.Posix/Mono.Unix/UnixEnvironment.cs
mcs/class/Mono.Posix/Mono.Unix/UnixFile.cs
mcs/class/Mono.Posix/Mono.Unix/UnixFileInfo.cs
mcs/class/Mono.Posix/Mono.Unix/UnixFileSystemInfo.cs
mcs/class/Mono.Posix/Mono.Unix/UnixGroup.cs
mcs/class/Mono.Posix/Mono.Unix/UnixGroupInfo.cs
mcs/class/Mono.Posix/Mono.Unix/UnixProcess.cs
mcs/class/Mono.Posix/Mono.Unix/UnixStream.cs
mcs/class/Mono.Posix/Mono.Unix/UnixSymbolicLinkInfo.cs
mcs/class/Mono.Posix/Mono.Unix/UnixUser.cs
mcs/class/Mono.Posix/Mono.Unix/UnixUserInfo.cs
mcs/class/Mono.Posix/Mono.Unix/make-map.cs [deleted file]
mcs/class/Mono.Security/Makefile
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs [new file with mode: 0755]
mcs/class/Mono.Security/Mono.Security.X509/ChangeLog
mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs
mcs/class/Mono.Security/Mono.Security.dll.sources
mcs/class/Novell.Directory.Ldap/ChangeLog
mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.vmwcsproj
mcs/class/PEAPI/ChangeLog
mcs/class/PEAPI/Code.cs [new file with mode: 0644]
mcs/class/PEAPI/Metadata.cs [new file with mode: 0644]
mcs/class/PEAPI/PEAPI.cs
mcs/class/PEAPI/PEAPI.dll.sources
mcs/class/System.Configuration/Makefile
mcs/class/System.Data/ChangeLog
mcs/class/System.Data/Makefile
mcs/class/System.Data/System.Data.Common/ChangeLog
mcs/class/System.Data/System.Data.Common/DataContainer.cs
mcs/class/System.Data/System.Data.OleDb.jvm/ChangeLog
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConvert.cs
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbParameter.cs
mcs/class/System.Data/System.Data.OleDb/ChangeLog
mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs
mcs/class/System.Data/System.Data.OleDb/TestGDA.cs [deleted file]
mcs/class/System.Data/System.Data.OleDb/TestOleDb.cs [deleted file]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDBCommand.cs
mcs/class/System.Data/System.Data.ProviderBase.jvm/ChangeLog
mcs/class/System.Data/System.Data.SqlClient.jvm/ChangeLog
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConvert.cs
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameter.cs
mcs/class/System.Data/System.Data.SqlTypes/ChangeLog
mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs
mcs/class/System.Data/System.Data.vmwcsproj
mcs/class/System.Data/System.Data/ChangeLog
mcs/class/System.Data/System.Data/DataTable.cs
mcs/class/System.Data/System.Data/DataView.cs
mcs/class/System.Data/Test/ProviderTests/ChangeLog
mcs/class/System.Data/Test/ProviderTests/Common/ChangeLog
mcs/class/System.Data/Test/ProviderTests/Common/DataProvider.cs [new file with mode: 0644]
mcs/class/System.Data/Test/ProviderTests/Makefile
mcs/class/System.Data/Test/ProviderTests/System.Data.Connected.Tests.dll.sources
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/ChangeLog
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlCommandTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs [new file with mode: 0644]
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataAdapterTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataReaderTest.cs
mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog
mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql
mcs/class/System.Data/Test/ProviderTests/sql/sqlserver.sql
mcs/class/System.Data/Test/ProviderTests/sql/sybase.sql [new file with mode: 0644]
mcs/class/System.Data/Test/System.Data/ChangeLog
mcs/class/System.Data/Test/System.Data/DataViewTest.cs
mcs/class/System.Data/Test/TestGDA.cs [new file with mode: 0644]
mcs/class/System.Data/Test/TestOleDb.cs [new file with mode: 0644]
mcs/class/System.Data/jay.bat [new file with mode: 0755]
mcs/class/System.DirectoryServices/ChangeLog
mcs/class/System.DirectoryServices/System.DirectoryServices.vmwcsproj
mcs/class/System.Drawing/ChangeLog
mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfiguration.cs [new file with mode: 0644]
mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfigurationCollection.cs [new file with mode: 0644]
mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfigurationHandler.cs [new file with mode: 0644]
mcs/class/System.Drawing/Makefile
mcs/class/System.Drawing/Samples/System.Drawing/ChangeLog
mcs/class/System.Drawing/Samples/System.Drawing/clipping.cs [new file with mode: 0644]
mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs
mcs/class/System.Drawing/System.Drawing.Design/ChangeLog
mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs
mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs
mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs
mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs
mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs
mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCollection.cs
mcs/class/System.Drawing/System.Drawing.Design/UITypeEditor.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
mcs/class/System.Drawing/System.Drawing.Drawing2D/ExtendedGeneralPath.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/GeneralPathIterator.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.jvm.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs
mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodec.jvm.cs [new file with mode: 0644]
mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs
mcs/class/System.Drawing/System.Drawing.Printing/ChangeLog
mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterException.cs
mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs
mcs/class/System.Drawing/System.Drawing.vmwcsproj
mcs/class/System.Drawing/System.Drawing/AdvancedStroke.jvm.cs
mcs/class/System.Drawing/System.Drawing/Bitmap.cs
mcs/class/System.Drawing/System.Drawing/Bitmap.jvm.cs
mcs/class/System.Drawing/System.Drawing/Brush.jvm.cs
mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs
mcs/class/System.Drawing/System.Drawing/Graphics.cs
mcs/class/System.Drawing/System.Drawing/Graphics.jvm.cs
mcs/class/System.Drawing/System.Drawing/Image.cs
mcs/class/System.Drawing/System.Drawing/Image.jvm.cs
mcs/class/System.Drawing/System.Drawing/ImageConverter.cs
mcs/class/System.Drawing/System.Drawing/Pen.jvm.cs
mcs/class/System.Drawing/System.Drawing/PlainImage.jvm.cs [new file with mode: 0644]
mcs/class/System.Drawing/System.Drawing/PlainImageCollection.jvm.cs [new file with mode: 0644]
mcs/class/System.Drawing/System.Drawing/RectangleF.cs
mcs/class/System.Drawing/System.Drawing/Region.jvm.cs
mcs/class/System.Drawing/System.Drawing/StrokeFactory.jvm.cs
mcs/class/System.Drawing/System.Drawing/TextureBrush.jvm.cs
mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs
mcs/class/System.Drawing/System.Drawing/carbonFunctions.cs
mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
mcs/class/System.Drawing/System.Drawing_test.dll.sources
mcs/class/System.Drawing/Test/ChangeLog
mcs/class/System.Drawing/Test/DrawingTest/DrawingTestHelper/ChangeLog
mcs/class/System.Drawing/Test/DrawingTest/DrawingTestHelper/DrawingTest.cs
mcs/class/System.Drawing/Test/DrawingTest/DrawingTestHelper/PDComparer.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/DrawingTest/Test/ChangeLog
mcs/class/System.Drawing/Test/DrawingTest/Test/Graphics.cs
mcs/class/System.Drawing/Test/DrawingTest/Test/GraphicsPath.cs
mcs/class/System.Drawing/Test/DrawingTest/Test/GraphicsPathIterator.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/CategoryNameCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/ChangeLog [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/PaintValueEventArgsCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/PropertyValueUIItemCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxComponentsCreatedEventArgsCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxComponentsCreatingEventArgsCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxItemCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxItemCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Design/UITypeEditorCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/ChangeLog
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestBlend.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestColorBlend.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestHatchBrush.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestMatrix.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/ChangeLog
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestBmpCodec.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestColorMatrix.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestImageAttributes.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestImageCodecInfo.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestJpegCodec.cs
mcs/class/System.Drawing/Test/System.Drawing.Printing/ChangeLog
mcs/class/System.Drawing/Test/System.Drawing.Printing/PrintingPermissionTest.cs
mcs/class/System.Drawing/Test/System.Drawing/BitmapCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
mcs/class/System.Drawing/Test/System.Drawing/ColorConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/ColorTranslator.cs
mcs/class/System.Drawing/Test/System.Drawing/GraphicsCas.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs
mcs/class/System.Drawing/Test/System.Drawing/TestBrushes.cs
mcs/class/System.Drawing/Test/System.Drawing/TestColor.cs
mcs/class/System.Drawing/Test/System.Drawing/TestFont.cs
mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs
mcs/class/System.Drawing/Test/System.Drawing/TestIconConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing/TestImageConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestImageFormatConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestPens.cs
mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
mcs/class/System.Drawing/Test/System.Drawing/TestPointConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestPointF.cs
mcs/class/System.Drawing/Test/System.Drawing/TestRectangle.cs
mcs/class/System.Drawing/Test/System.Drawing/TestRectangleConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestRectangleF.cs
mcs/class/System.Drawing/Test/System.Drawing/TestRegion.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSize.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSizeConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSizeF.cs
mcs/class/System.Drawing/Test/System.Drawing/TestStringFormat.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSystemBrushes.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSystemPens.cs
mcs/class/System.Drawing/Test/Test.dotnet.csproj
mcs/class/System.Drawing/Test/Test.vmwcsproj
mcs/class/System.Drawing/Test/resources/indexed.png [new file with mode: 0644]
mcs/class/System.Security/Makefile
mcs/class/System.Web/ChangeLog
mcs/class/System.Web/Hacking.FAQ
mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.Caching/Cache.cs
mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
mcs/class/System.Web/System.Web.Caching/ChangeLog
mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.Configuration/AdapterDictionary.cs
mcs/class/System.Web/System.Web.Configuration/AuthorizationRuleAction.cs
mcs/class/System.Web/System.Web.Configuration/BuildProvider.cs
mcs/class/System.Web/System.Web.Configuration/BuildProviderCollection.cs
mcs/class/System.Web/System.Web.Configuration/ChangeLog
mcs/class/System.Web/System.Web.Configuration/CodeSubDirectoriesCollection.cs
mcs/class/System.Web/System.Web.Configuration/CodeSubDirectory.cs
mcs/class/System.Web/System.Web.Configuration/CompilationConfiguration.cs
mcs/class/System.Web/System.Web.Configuration/CustomErrorsMode.cs
mcs/class/System.Web/System.Web.Configuration/FormsAuthenticationConfiguration.cs
mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs
mcs/class/System.Web/System.Web.Configuration/ProcessModelComAuthenticationLevel.cs
mcs/class/System.Web/System.Web.Configuration/ProcessModelComImpersonationLevel.cs
mcs/class/System.Web/System.Web.Configuration/ProcessModelLogLevel.cs
mcs/class/System.Web/System.Web.Configuration/WebApplicationLevel.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
mcs/class/System.Web/System.Web.Handlers/ChangeLog
mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs
mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
mcs/class/System.Web/System.Web.Hosting/ChangeLog
mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs
mcs/class/System.Web/System.Web.Hosting/ServletWorkerRequest.jvm.cs
mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
mcs/class/System.Web/System.Web.J2EE/BaseHttpServlet.cs
mcs/class/System.Web/System.Web.J2EE/BaseStaticHttpServlet.cs
mcs/class/System.Web/System.Web.J2EE/ChangeLog
mcs/class/System.Web/System.Web.J2EE/PageMapper.cs
mcs/class/System.Web/System.Web.J2EE/SessionListener.cs
mcs/class/System.Web/System.Web.Mail/ChangeLog
mcs/class/System.Web/System.Web.Mail/MailAttachment.cs
mcs/class/System.Web/System.Web.Mail/MailEncoding.cs
mcs/class/System.Web/System.Web.Mail/MailFormat.cs
mcs/class/System.Web/System.Web.Mail/MailMessage.cs
mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs
mcs/class/System.Web/System.Web.Mail/MailPriority.cs
mcs/class/System.Web/System.Web.Mail/SmtpClient.cs
mcs/class/System.Web/System.Web.Mail/SmtpMail.cs
mcs/class/System.Web/System.Web.Security/ChangeLog
mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs
mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs
mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs
mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs
mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
mcs/class/System.Web/System.Web.Security/FormsIdentity.cs
mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs
mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs
mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs
mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs
mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs
mcs/class/System.Web/System.Web.SessionState/ChangeLog
mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
mcs/class/System.Web/System.Web.SessionState/HttpSessionState.jvm.cs
mcs/class/System.Web/System.Web.SessionState/IHttpSessionState.cs
mcs/class/System.Web/System.Web.SessionState/ISessionStateItemCollection.cs
mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs
mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
mcs/class/System.Web/System.Web.SessionState/StateRuntime.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputPassword.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputReset.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputSubmit.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlLink.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlMeta.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbCollection.cs
mcs/class/System.Web/System.Web.UI.WebControls/BaseDataBoundControl.cs
mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs
mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs
mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
mcs/class/System.Web/System.Web.UI.WebControls/HotSpot.cs
mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs
mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs
mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
mcs/class/System.Web/System.Web.UI.WebControls/Parameter.cs
mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs
mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs
mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/TreeNode.cs
mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
mcs/class/System.Web/System.Web.UI/AttributeCollection.cs
mcs/class/System.Web/System.Web.UI/BaseParser.cs
mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs
mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs
mcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs
mcs/class/System.Web/System.Web.UI/Control.cs
mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
mcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs
mcs/class/System.Web/System.Web.UI/ControlCachePolicy.cs
mcs/class/System.Web/System.Web.UI/ControlCollection.cs
mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs
mcs/class/System.Web/System.Web.UI/DataBinder.cs
mcs/class/System.Web/System.Web.UI/DataBinding.cs
mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs
mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs
mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs
mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs
mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs
mcs/class/System.Web/System.Web.UI/DesignerDataBoundLiteralControl.cs
mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs
mcs/class/System.Web/System.Web.UI/Html32TextWriter.cs
mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
mcs/class/System.Web/System.Web.UI/IStyleSheet.cs
mcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs
mcs/class/System.Web/System.Web.UI/LiteralControl.cs
mcs/class/System.Web/System.Web.UI/LosFormatter.cs
mcs/class/System.Web/System.Web.UI/MinimizableAttributeTypeConverter.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/ObjectConverter.cs
mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs
mcs/class/System.Web/System.Web.UI/Page.cs
mcs/class/System.Web/System.Web.UI/PageParser.cs
mcs/class/System.Web/System.Web.UI/Pair.cs
mcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs
mcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs
mcs/class/System.Web/System.Web.UI/PartialCachingControl.cs
mcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs
mcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs
mcs/class/System.Web/System.Web.UI/PropertyConverter.cs
mcs/class/System.Web/System.Web.UI/RootBuilder.cs
mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
mcs/class/System.Web/System.Web.UI/StateBag.cs
mcs/class/System.Web/System.Web.UI/StateItem.cs
mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs
mcs/class/System.Web/System.Web.UI/SupportsEventValidationAttribute.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs
mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs
mcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs
mcs/class/System.Web/System.Web.UI/TemplateControl.cs
mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
mcs/class/System.Web/System.Web.UI/TemplateParser.cs
mcs/class/System.Web/System.Web.UI/ThemeableAttribute.cs
mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs
mcs/class/System.Web/System.Web.UI/Triplet.cs
mcs/class/System.Web/System.Web.UI/UrlPropertyAttribute.cs
mcs/class/System.Web/System.Web.UI/UserControl.cs
mcs/class/System.Web/System.Web.UI/UserControlControlBuilder.cs
mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs
mcs/class/System.Web/System.Web.UI/ValidatorCollection.cs
mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs
mcs/class/System.Web/System.Web.UI/WebServiceParser.cs
mcs/class/System.Web/System.Web.Util/ChangeLog
mcs/class/System.Web/System.Web.Util/IWebObjectFactory.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.Util/IWebPropertyAccessor.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.Util/Transactions.cs
mcs/class/System.Web/System.Web.Util/WorkItem.cs
mcs/class/System.Web/System.Web.dll.sources
mcs/class/System.Web/System.Web.vmwcsproj
mcs/class/System.Web/System.Web/BrowserCapabilities.cs
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpApplication.cs
mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
mcs/class/System.Web/System.Web/HttpApplicationState.cs
mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs
mcs/class/System.Web/System.Web/HttpCachePolicy.cs
mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
mcs/class/System.Web/System.Web/HttpClientCertificate.cs
mcs/class/System.Web/System.Web/HttpCompileException.cs
mcs/class/System.Web/System.Web/HttpContext.cs
mcs/class/System.Web/System.Web/HttpCookie.cs
mcs/class/System.Web/System.Web/HttpCookieCollection.cs
mcs/class/System.Web/System.Web/HttpException.cs
mcs/class/System.Web/System.Web/HttpFileCollection.cs
mcs/class/System.Web/System.Web/HttpModuleCollection.cs
mcs/class/System.Web/System.Web/HttpMultipartContentParser.cs [deleted file]
mcs/class/System.Web/System.Web/HttpParseException.cs
mcs/class/System.Web/System.Web/HttpPostedFile.cs
mcs/class/System.Web/System.Web/HttpRequest.cs
mcs/class/System.Web/System.Web/HttpRequestPriority.cs
mcs/class/System.Web/System.Web/HttpRequestValidationException.cs
mcs/class/System.Web/System.Web/HttpResponse.cs
mcs/class/System.Web/System.Web/HttpResponseStream.cs
mcs/class/System.Web/System.Web/HttpResponseSubstitutionCallback.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpRuntime.cs
mcs/class/System.Web/System.Web/HttpServerUtility.cs
mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
mcs/class/System.Web/System.Web/HttpUnhandledException.cs
mcs/class/System.Web/System.Web/HttpUtility.cs
mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
mcs/class/System.Web/System.Web/HttpWriter.cs
mcs/class/System.Web/System.Web/ProcessInfo.cs
mcs/class/System.Web/System.Web/ProcessModelInfo.cs
mcs/class/System.Web/System.Web/ServerVariablesCollection.cs
mcs/class/System.Web/System.Web/TraceContext.cs
mcs/class/System.Web/System.Web/TraceContextEventArgs.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/TraceContextEventHandler.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/WebCategoryAttribute.cs
mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs
mcs/class/System.Web/System.Web_test.dll.sources
mcs/class/System.Web/Test/Cas/AspNetHostingMinimal.cs
mcs/class/System.Web/Test/Cas/AspNetHostingPermissionHelper.cs
mcs/class/System.Web/Test/Cas/ChangeLog
mcs/class/System.Web/Test/System.Web.Caching/CacheCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Caching/CacheDependencyCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Caching/ChangeLog [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Configuration/ChangeLog [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Configuration/HttpCapabilitiesBaseCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Handlers/ChangeLog [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Handlers/TraceHandlerCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Hosting/AppDomainFactoryCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Hosting/ApplicationHostCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Hosting/ChangeLog
mcs/class/System.Web/Test/System.Web.Hosting/ISAPIRuntimeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Hosting/SimpleWorkerRequestCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Hosting/SimpleWorkerRequestTest.cs
mcs/class/System.Web/Test/System.Web.Mail/ChangeLog [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Mail/MailAttachmentCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Mail/MailMessageCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Mail/SmtpMailCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/ChangeLog
mcs/class/System.Web/Test/System.Web.Security/DefaultAuthenticationEventArgsCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/DefaultAuthenticationModuleCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/FileAuthorizationModuleCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationEventArgsCas.cs
mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationModuleCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationTicketCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/FormsIdentityCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/FormsIdentityTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/PassportAuthenticationEventArgsCas.cs
mcs/class/System.Web/Test/System.Web.Security/PassportAuthenticationModuleCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/PassportIdentityCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/UrlAuthorizationModuleCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Security/WindowsAuthenticationEventArgsCas.cs
mcs/class/System.Web/Test/System.Web.Security/WindowsAuthenticationModuleCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.SessionState/ChangeLog [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.SessionState/SessionStateModuleCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.SessionState/StateRuntimeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/ChangeLog
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlAnchorCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlAnchorTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlButtonCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlContainerControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlFormCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlFormTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlImageCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputButtonCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputButtonTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputCheckBoxCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputCheckBoxTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputControlTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputFileCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputFileTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputHiddenCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputPasswordCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputPasswordTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputRadioButtonCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputRadioButtonTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputResetCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputResetTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputSubmitCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputSubmitTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputTextCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputTextTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlLinkCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlLinkTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlMetaCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlMetaTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlSelectCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTableCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTableCellCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTableRowCas.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTableRowTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTableTest.cs
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTextAreaCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.WebControls/BaseDataBoundControlTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.WebControls/CalendarTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/Test/System.Web.UI.WebControls/DataBoundControlTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.WebControls/DataGridTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.WebControls/ListControlTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/ListItemTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI.WebControls/RadioButtonListTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/StyleTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/TableCellTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/TableStyleTest.cs
mcs/class/System.Web/Test/System.Web.UI/AttributeCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/BaseParserCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ChangeLog
mcs/class/System.Web/Test/System.Web.UI/CompiledTemplateBuilderCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ConstructorNeedsTagAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ControlBuilderAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ControlBuilderCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ControlCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/CssStyleCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DataBinderCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DataBindingCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DataBindingCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DataBindingHandlerAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DataBoundLiteralControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DesignTimeParseDataCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DesignTimeTemplateParserCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/DesignerDataBoundLiteralControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/EmptyCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/Html32TextWriterCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/HtmlTextWriterCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ImageClickEventArgsCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/LiteralControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/LosFormatterCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/MinimizableAttributeTypeConverterTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ObjectConverterCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ObjectTagBuilderCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/PageCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/PairCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ParseChildrenAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/PartialCachingAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/PersistChildrenAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/PersistenceModeAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/PropertyConverterCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/RootBuilderCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/StateBagCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/StateItemCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/StaticPartialCachingControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/TagPrefixAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/TemplateBuilderCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/TemplateContainerAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/TemplateControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/TestUrlPropertyAttribute.cs
mcs/class/System.Web/Test/System.Web.UI/ToolboxDataAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/TripletCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/UserControlCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/UserControlControlBuilderCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ValidationPropertyAttributeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.UI/ValidatorCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Util/ChangeLog [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web.Util/TransactionsCas.cs [new file with mode: 0755]
mcs/class/System.Web/Test/System.Web.Util/WorkItemCas.cs [new file with mode: 0755]
mcs/class/System.Web/Test/System.Web/ChangeLog
mcs/class/System.Web/Test/System.Web/HttpApplicationCas.cs [new file with mode: 0755]
mcs/class/System.Web/Test/System.Web/HttpApplicationStateCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpBrowserCapabilitiesCas.cs [new file with mode: 0755]
mcs/class/System.Web/Test/System.Web/HttpCachePolicyCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpCacheVaryByHeadersCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpCacheVaryByParamsCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpClientCertificateCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpCompileExceptionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpContextCas.cs
mcs/class/System.Web/Test/System.Web/HttpCookieCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpCookieCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpExceptionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpFileCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpModuleCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpParseExceptionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpRequestCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
mcs/class/System.Web/Test/System.Web/HttpRequestValidationExceptionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpResponseCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpRuntimeCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpServerUtilityCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpStaticObjectsCollectionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpUnhandledExceptionCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpUtilityCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpWorkerRequestCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/HttpWorkerRequestTest.cs
mcs/class/System.Web/Test/System.Web/HttpWriterCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/ProcessInfoCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/ProcessModelInfoCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/System.Web/TraceContextCas.cs [new file with mode: 0644]
mcs/class/System.Web/Test/jsunit-tests/customvalidator/nofunc.aspx [new file with mode: 0644]
mcs/class/System.Web/Test/jsunit-tests/index.html
mcs/class/System.Web/Test/standalone/datagrid/datagrid-column-style.aspx [new file with mode: 0644]
mcs/class/System.Web/Test/standalone/htmlform/disabledcontrols.aspx [new file with mode: 0644]
mcs/class/System.Web/Test/standalone/htmlselect/datasourceid.aspx [new file with mode: 0644]
mcs/class/System.Web/Test/standalone/htmlselect/iran.xml [new file with mode: 0644]
mcs/class/System.Web/Test/standalone/validators/login.aspx [new file with mode: 0644]
mcs/class/System.Web/browscap.ini.diff [new file with mode: 0644]
mcs/class/System.Web/resources/ChangeLog
mcs/class/System.Web/resources/WebUIValidation.js
mcs/class/System.Web/resources/webform.js
mcs/class/System.XML/ChangeLog
mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs
mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs
mcs/class/System.XML/System.XML.vmwcsproj
mcs/class/System.XML/System.Xml.Xsl/ChangeLog
mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs
mcs/class/System.XML/System.Xml/ChangeLog
mcs/class/System.XML/System.Xml/XmlTextReader.cs
mcs/class/System.XML/System.Xml/XmlTextWriter.cs
mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
mcs/class/System.XML/Test/System.Xml.Xsl/MsxslScriptTests.cs
mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
mcs/class/System.XML/Test/System.Xml/ChangeLog
mcs/class/System.XML/Test/System.Xml/W3C/ChangeLog
mcs/class/System.XML/Test/System.Xml/W3C/Makefile
mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs
mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
mcs/class/System.XML/Test/XmlFiles/76102.xml [new file with mode: 0644]
mcs/class/System.XML/Test/XmlFiles/ChangeLog
mcs/class/System.XML/jay.bat [new file with mode: 0755]
mcs/class/System.Xml.XLinq/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Xml.XLinq/Assembly/ChangeLog [new file with mode: 0644]
mcs/class/System.Xml.XLinq/ChangeLog [new file with mode: 0644]
mcs/class/System.Xml.XLinq/Makefile [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq.dll.sources [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq/ChangeLog [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq/System.Xml.XLinq.cs [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq/XAttribute.cs [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq/XElementSequence.cs [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq/XIterators.cs [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq/XName.cs [new file with mode: 0644]
mcs/class/System.Xml.XLinq/System.Xml.XLinq/XUtil.cs [new file with mode: 0644]
mcs/class/System/ChangeLog
mcs/class/System/System.Collections.Generic/ChangeLog
mcs/class/System/System.Collections.Generic/LinkedList.cs [new file with mode: 0644]
mcs/class/System/System.Collections.Generic/LinkedListNode.cs [new file with mode: 0644]
mcs/class/System/System.ComponentModel/ChangeLog
mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs
mcs/class/System/System.ComponentModel/TypeConverter.cs
mcs/class/System/System.ComponentModel/TypeDescriptor.cs
mcs/class/System/System.Configuration/ChangeLog
mcs/class/System/System.Configuration/ProviderBase.cs [deleted file]
mcs/class/System/System.Configuration/SettingsAttributeDictionary.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsBase.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsContext.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsProperty.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsPropertyCollection.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsPropertyValue.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsPropertyValueCollection.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsProvider.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsProviderCollection.cs [new file with mode: 0644]
mcs/class/System/System.Configuration/SettingsSerializeAs.cs [new file with mode: 0644]
mcs/class/System/System.IO/InvalidDataException.cs [new file with mode: 0644]
mcs/class/System/System.dll.sources
mcs/class/System/System/InvalidDataException.cs [deleted file]
mcs/class/System/System_test.dll.sources
mcs/class/System/Test/ChangeLog
mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog
mcs/class/System/Test/Microsoft.VisualBasic/VBCodeProviderTest.cs
mcs/class/System/Test/System.Collections.Generic/ChangeLog
mcs/class/System/Test/System.Collections.Generic/LinkedListTest.cs [new file with mode: 0644]
mcs/class/System/Test/System.ComponentModel/ChangeLog
mcs/class/System/Test/System.ComponentModel/PropertyDescriptorCollectionTests.cs [new file with mode: 0644]
mcs/class/System/Test/System.ComponentModel/TypeConverterTests.cs [new file with mode: 0644]
mcs/class/System/Test/System.Configuration/SettingsPropertyTest.cs [new file with mode: 0644]
mcs/class/corlib/Mono.Globalization.Unicode/ChangeLog
mcs/class/corlib/Mono.Globalization.Unicode/SimpleCollator.cs
mcs/class/corlib/Mono.Security.X509/ChangeLog
mcs/class/corlib/Mono.Security.X509/X509Certificate.cs
mcs/class/corlib/System.Collections.Generic/Dictionary.cs
mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs
mcs/class/corlib/System.Collections/Hashtable.cs
mcs/class/corlib/System.Collections/IHashCodeProvider.cs
mcs/class/corlib/System.IO/BinaryReader.cs
mcs/class/corlib/System.IO/ChangeLog
mcs/class/corlib/System.IO/MonoIO.cs
mcs/class/corlib/System.IO/MonoIOError.cs
mcs/class/corlib/System.Reflection.Emit/ChangeLog
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs
mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
mcs/class/corlib/System.Reflection/Assembly.cs
mcs/class/corlib/System.Reflection/AssemblyName.cs
mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/GenericParameterAttributes.cs
mcs/class/corlib/System.Reflection/MethodBase.cs
mcs/class/corlib/System.Reflection/MethodInfo.cs
mcs/class/corlib/System.Reflection/Module.cs
mcs/class/corlib/System.Reflection/MonoMethod.cs
mcs/class/corlib/System.Reflection/TypeDelegator.cs
mcs/class/corlib/System.Security/ChangeLog
mcs/class/corlib/System.Security/SecurityManager.cs
mcs/class/corlib/System.Threading/ChangeLog
mcs/class/corlib/System.Threading/Thread.cs
mcs/class/corlib/System.Threading/Timer.cs
mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/DateTime.cs
mcs/class/corlib/System/Environment.cs
mcs/class/corlib/System/MissingFieldException.cs
mcs/class/corlib/System/MissingMethodException.cs
mcs/class/corlib/System/MonoCustomAttrs.cs
mcs/class/corlib/System/MonoType.cs
mcs/class/corlib/System/TimeZone.cs
mcs/class/corlib/System/Type.cs
mcs/class/corlib/System/TypeLoadException.cs
mcs/class/corlib/Test/System.Collections.Generic/DictionaryTest.cs
mcs/class/corlib/Test/System.Globalization/ChangeLog
mcs/class/corlib/Test/System.Globalization/CompareInfoTest.cs
mcs/class/corlib/Test/System.IO/ChangeLog
mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs
mcs/class/corlib/Test/System/ChangeLog
mcs/class/corlib/Test/System/DateTimeTest.cs
mcs/errors/CS0619-43-lib.cs [new file with mode: 0644]
mcs/errors/ChangeLog
mcs/errors/Makefile
mcs/errors/cs0019-11.cs [new file with mode: 0644]
mcs/errors/cs0019-7.cs
mcs/errors/cs0149.cs
mcs/errors/cs0246-13.cs
mcs/errors/cs0619-43.cs [new file with mode: 0644]
mcs/errors/cs0619-44.cs [new file with mode: 0644]
mcs/errors/cs0619-45.cs [new file with mode: 0644]
mcs/errors/cs0619-46.cs [new file with mode: 0644]
mcs/errors/cs0665-2.cs
mcs/errors/cs0665.cs
mcs/errors/cs1548-2.cs
mcs/errors/cs1548-3.cs
mcs/errors/cs1548.cs
mcs/errors/cs1606.cs
mcs/errors/cs1674-2.cs [new file with mode: 0644]
mcs/errors/cs1674.cs
mcs/errors/cs3005-1.cs
mcs/errors/cs3005-10.cs
mcs/errors/cs3005-11.cs
mcs/errors/cs3005-12.cs
mcs/errors/cs3005-13.cs
mcs/errors/cs3005-14.cs
mcs/errors/cs3005-15.cs
mcs/errors/cs3005-17.cs
mcs/errors/cs3005-18.cs
mcs/errors/cs3005-2.cs
mcs/errors/cs3005-20.cs
mcs/errors/cs3005-21.cs
mcs/errors/cs3005-22.cs
mcs/errors/cs3005-23.cs
mcs/errors/cs3005-3.cs
mcs/errors/cs3005-4.cs
mcs/errors/cs3005-5.cs
mcs/errors/cs3005-6.cs
mcs/errors/cs3005-7.cs
mcs/errors/cs3005-8.cs
mcs/errors/cs3005-9.cs
mcs/errors/cs3005.cs
mcs/errors/gcs0019.cs
mcs/errors/gcs0080.cs
mcs/errors/gcs0102.cs
mcs/errors/gcs0208-2.cs [new file with mode: 0644]
mcs/errors/gcs0208-3.cs [new file with mode: 0644]
mcs/errors/gcs0208-4.cs [new file with mode: 0644]
mcs/errors/gcs0208.cs
mcs/errors/gcs0246-2.cs
mcs/errors/gcs0246-3.cs
mcs/errors/gcs0246-5.cs
mcs/errors/gcs0246-6.cs
mcs/errors/gcs0246-7.cs
mcs/errors/gcs0246.cs
mcs/errors/gcs0304.cs
mcs/errors/gcs0309-2.cs
mcs/errors/gcs0309-3.cs
mcs/errors/gcs0309-5.cs [new file with mode: 0644]
mcs/errors/gcs0309.cs
mcs/errors/gcs0310-2.cs
mcs/errors/gcs0310-3.cs
mcs/errors/gcs0310.cs
mcs/errors/gcs0405.cs
mcs/errors/gcs0411-2.cs
mcs/errors/gcs0411-3.cs
mcs/errors/gcs0411-4.cs
mcs/errors/gcs0411-5.cs
mcs/errors/gcs0411-6.cs
mcs/errors/gcs0411-7.cs
mcs/errors/gcs0411.cs
mcs/errors/gcs0417.cs
mcs/errors/gcs0452.cs
mcs/errors/gcs0453.cs
mcs/errors/gcs0698.cs
mcs/errors/known-issues-gmcs
mcs/errors/known-issues-mcs
mcs/gmcs/ChangeLog
mcs/gmcs/Makefile
mcs/gmcs/anonymous.cs
mcs/gmcs/assign.cs
mcs/gmcs/attribute.cs
mcs/gmcs/cfold.cs
mcs/gmcs/class.cs
mcs/gmcs/codegen.cs
mcs/gmcs/const.cs
mcs/gmcs/constant.cs
mcs/gmcs/convert.cs
mcs/gmcs/cs-parser.jay
mcs/gmcs/cs-tokenizer.cs
mcs/gmcs/decl.cs
mcs/gmcs/delegate.cs
mcs/gmcs/doc.cs
mcs/gmcs/driver.cs
mcs/gmcs/ecore.cs
mcs/gmcs/enum.cs
mcs/gmcs/expression.cs
mcs/gmcs/flowanalysis.cs
mcs/gmcs/generic.cs
mcs/gmcs/iterators.cs
mcs/gmcs/literal.cs
mcs/gmcs/location.cs
mcs/gmcs/namespace.cs
mcs/gmcs/report.cs
mcs/gmcs/statement.cs
mcs/gmcs/support.cs
mcs/gmcs/symbolwriter.cs
mcs/gmcs/tree.cs
mcs/gmcs/typemanager.cs
mcs/ilasm/codegen/ChangeLog
mcs/ilasm/codegen/CodeGen.cs
mcs/ilasm/codegen/DeclSecurity.cs
mcs/ilasm/codegen/ExternTable.cs
mcs/ilasm/codegen/ExternTypeRef.cs
mcs/ilasm/codegen/MethodDef.cs
mcs/ilasm/codegen/TypeDef.cs
mcs/ilasm/parser/ChangeLog
mcs/ilasm/parser/ILParser.jay
mcs/ilasm/tests/ChangeLog
mcs/ilasm/tests/test-perm_fail-1.il [new file with mode: 0644]
mcs/ilasm/tests/test-perm_fail-2.il [new file with mode: 0644]
mcs/ilasm/tests/test-perm_fail-3.il [new file with mode: 0644]
mcs/ilasm/tests/test-perm_fail-4.il [new file with mode: 0644]
mcs/ilasm/tests/test-perm_pass-1.il [new file with mode: 0644]
mcs/jay/ChangeLog
mcs/jay/jay.vcproj [new file with mode: 0755]
mcs/mbas/ChangeLog
mcs/mbas/Test/rerrors/Test/Changelog
mcs/mbas/Test/rerrors/Test/Error.vb [new file with mode: 0644]
mcs/mbas/Test/rerrors/rerrors_btest.dll.sources
mcs/mbas/Test/tests/statements/ChangeLog
mcs/mbas/Test/tests/statements/Error.vb [new file with mode: 0644]
mcs/mbas/block.cs
mcs/mbas/mb-parser.jay
mcs/mbas/statement.cs
mcs/mcs/ChangeLog
mcs/mcs/attribute.cs
mcs/mcs/cfold.cs
mcs/mcs/class.cs
mcs/mcs/compiler.csproj
mcs/mcs/constant.cs
mcs/mcs/convert.cs
mcs/mcs/cs-parser.jay
mcs/mcs/driver.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/iterators.cs
mcs/mcs/literal.cs
mcs/mcs/location.cs
mcs/mcs/mcs.exe.sources
mcs/mcs/statement.cs
mcs/mcs/symbolwriter.cs
mcs/mcs/typemanager.cs
mcs/tests/ChangeLog
mcs/tests/gtest-197.cs [new file with mode: 0644]
mcs/tests/gtest-198.cs [new file with mode: 0644]
mcs/tests/gtest-199.cs [new file with mode: 0644]
mcs/tests/gtest-200.cs [new file with mode: 0644]
mcs/tests/gtest-201.cs [new file with mode: 0644]
mcs/tests/known-issues-gmcs
mcs/tests/known-issues-mcs
mcs/tests/test-453.cs [new file with mode: 0644]
mcs/tests/test-454.cs [new file with mode: 0644]
mcs/tests/test-455.cs [new file with mode: 0644]
mcs/tools/compiler-tester/ChangeLog
mcs/tools/compiler-tester/compiler-tester.cs
mcs/tools/gacutil/ChangeLog
mcs/tools/gacutil/driver.cs
mcs/tools/macpack/ChangeLog
mcs/tools/macpack/LOADER
mcs/tools/mjs/ChangeLog
mcs/tools/mjs/Makefile
mcs/tools/mjs/mjs.cs
mcs/tools/mono-shlib-cop/ChangeLog
mcs/tools/mono-shlib-cop/mono-shlib-cop.cs
mcs/tools/monop/ChangeLog
mcs/tools/monop/outline.cs
mcs/tools/security/certview/CertificateFormatter.cs
mcs/tools/security/certview/ChangeLog
mcs/tools/security/certview/Makefile
mcs/tools/security/certview/TODO
mcs/tools/security/certview/certview.glade
mcs/tools/security/certview/gcertview.cs
mcs/tools/soapsuds/ChangeLog
mcs/tools/soapsuds/soapsuds.cs
mcs/tools/xbuild/AssemblyInfo.cs [new file with mode: 0644]
mcs/tools/xbuild/ChangeLog [new file with mode: 0644]
mcs/tools/xbuild/CommandLineException.cs [new file with mode: 0644]
mcs/tools/xbuild/LoggerInfo.cs [new file with mode: 0644]
mcs/tools/xbuild/MSBuild/Microsoft.Build.Commontypes.xsd [new file with mode: 0644]
mcs/tools/xbuild/MSBuild/Microsoft.Build.Core.xsd [new file with mode: 0644]
mcs/tools/xbuild/Main.cs [new file with mode: 0644]
mcs/tools/xbuild/Makefile [new file with mode: 0644]
mcs/tools/xbuild/Microsoft.Build.xsd [new file with mode: 0644]
mcs/tools/xbuild/Microsoft.Common.tasks [new file with mode: 0644]
mcs/tools/xbuild/Parameters.cs [new file with mode: 0644]
mcs/tools/xbuild/README [new file with mode: 0644]
mcs/tools/xbuild/XBuild.targets [new file with mode: 0644]
mcs/tools/xbuild/tests/AL/AL.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/ChangeLog [new file with mode: 0644]
mcs/tools/xbuild/tests/Copy/Copy.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Delete/Delete.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Error/Error.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Exec/Exec.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/FindUnderPath/FindUnderPath.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/GenerateResource/GenerateResource.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/GenerateResource/Sample.resx [new file with mode: 0644]
mcs/tools/xbuild/tests/MSBuild/MSBuild.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/MakeDir/MakeDir.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Message/Message.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/ReadLinesFromFile/ReadLinesFromFile.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/ReadLinesFromFile/file [new file with mode: 0644]
mcs/tools/xbuild/tests/RemoveDir/RemoveDir.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/SignFile/SignFile.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Touch/Touch.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Warning/Warning.csproj [new file with mode: 0644]
mcs/tools/xbuild/tests/WriteLinesToFile/WriteLinesToFile.csproj [new file with mode: 0644]
mcs/tools/xbuild/xbuild.exe.sources [new file with mode: 0644]
mcs/tools/xbuild/xbuild.mdp [new file with mode: 0644]
mcs/tools/xbuild/xbuild.mds [new file with mode: 0644]
mcs/tools/xbuild/xbuild.rsp [new file with mode: 0644]
mono/arch/ChangeLog
mono/arch/ia64/ia64-codegen.h
mono/dis/ChangeLog
mono/dis/get.c
mono/dis/main.c
mono/dis/monodis.1
mono/docscripts/monoapi.source
mono/io-layer/ChangeLog
mono/io-layer/io.c
mono/metadata/ChangeLog
mono/metadata/appdomain.c
mono/metadata/assembly.c
mono/metadata/assembly.h
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/culture-info.h
mono/metadata/debug-mono-symfile.h
mono/metadata/decimal.c
mono/metadata/domain.c
mono/metadata/exception.c
mono/metadata/exception.h
mono/metadata/icall.c
mono/metadata/loader.c
mono/metadata/marshal.c
mono/metadata/metadata-internals.h
mono/metadata/metadata.c
mono/metadata/mono-debug-debugger.c
mono/metadata/mono-debug-debugger.h
mono/metadata/mono-debug.c
mono/metadata/object.c
mono/metadata/reflection.c
mono/metadata/reflection.h
mono/metadata/security-manager.c
mono/metadata/security-manager.h
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/mini/ChangeLog
mono/mini/Makefile.am
mono/mini/aot.c
mono/mini/cpu-amd64.md
mono/mini/cpu-arm.md
mono/mini/cpu-ia64.md
mono/mini/cpu-pentium.md
mono/mini/exceptions-amd64.c
mono/mini/exceptions-ia64.c
mono/mini/exceptions-x86.c
mono/mini/inssel-amd64.brg
mono/mini/inssel-arm.brg
mono/mini/inssel-ia64.brg
mono/mini/inssel-long.brg
mono/mini/inssel.brg
mono/mini/ldscript.mono [new file with mode: 0644]
mono/mini/mini-amd64.c
mono/mini/mini-amd64.h
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-codegen.c
mono/mini/mini-exceptions.c
mono/mini/mini-ia64.c
mono/mini/mini-ia64.h
mono/mini/mini-ops.h
mono/mini/mini-x86.c
mono/mini/mini-x86.h
mono/mini/mini.c
mono/mini/mini.h
mono/mini/objects.cs
mono/mini/regalloc.c
mono/mini/tramp-amd64.c
mono/mini/tramp-ia64.c
mono/tests/ChangeLog
mono/tests/Makefile.am
mono/tests/custom-attr.cs
mono/tests/libtest.c
mono/tests/load-exceptions.cs [new file with mode: 0644]
mono/tests/load-missing.il [new file with mode: 0644]
mono/tests/pinvoke3.cs
mono/tests/t-missing.cs [new file with mode: 0644]
mono/tests/test-driver
mono/utils/ChangeLog
mono/utils/mono-codeman.c
mono/utils/mono-compiler.h
runtime/Makefile.am

index 7c0fd07954651346b33c3698555f6a766a288ada..0561c190dbf995a79209ea29f0640156b0c7158f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2005-09-19  Zoltan Varga  <vargaz@gmail.com>
+
+       * docs/exception-handling.txt: Add section about libunwind.
+       
+       * docs/exception-handling.txt: New file.
+
+2005-09-16  Raja R Harinath  <rharinath@novell.com>
+
+       * runtime/Makefile.am (all-local, install-exec, uninstall)
+       (mcs-do-test-profiles, mcs-do-run-test-profiles, mcs-compileall):
+       Don't call semdel-wrapper.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * data/browscap.ini: Add the ecmascriptversion/w3cdomversion
+       attributes required for ASP.Net client side validation to the
+       capabilities for Mozilla 1.[78], IE 5.5 & 6.0, Safari, and Firefox
+       0.9 & 1.0 browsers.
+
 2005-08-26  Zoltan Varga  <vargaz@gmail.com>
 
        * configure.in: Add ability to cross-compile from linux to win32.
index 2e992141553dc6a8d291fc04cbf88e0d67491b73..49c871120a66d605c05d05363f565f33c304dfb8 100644 (file)
@@ -18,7 +18,7 @@ dist-hook:
 
 pkgconfigdir = $(libdir)/pkgconfig
 if JIT_SUPPORTED
-pkgconfig_DATA= mono.pc mint.pc
+pkgconfig_DATA= mono.pc mint.pc dotnet.pc
 else
 pkgconfig_DATA= mint.pc
 endif
diff --git a/README b/README
index 9b18f536b9b3dd84a881c607f0d1341b5957c701..098b033916e89f3e2bdcbb6604aa6000286d1b72 100644 (file)
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 
 This is Mono.
 
-1. Installation
-2. Using Mono
-3. Directory Roadmap
+       1. Installation
+       2. Using Mono
+       3. Directory Roadmap
 
 1. Compilation and Installation
 ===============================
@@ -141,8 +141,6 @@ This is Mono.
        * runtime engine
 
                mono program.exe
-         or
-               mint program.exe
 
        * C# compiler
 
@@ -158,9 +156,6 @@ This is Mono.
 3. Directory Roadmap
 ====================
 
-       doc/
-               Contains the web site contents.
-
        docs/
                Technical documents about the Mono runtime.
 
index fa814fe1b80c3a97b275d6b7d004d8a3a77aae70..5cffa0d083b8dd119d366efd6bcbe1a7a5bbcf28 100644 (file)
@@ -4958,6 +4958,8 @@ parent=Safari
 version=1.3
 majorver=1
 minorver=3
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 [Mozilla/5.0 (Macintosh; U; PPC Mac OS X; *) AppleWebKit/* (*) Safari/412*]
 parent=Safari
@@ -12398,6 +12400,8 @@ crawler=False
 stripper=False
 wap=False
 netclr=False
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.0
 
@@ -12424,6 +12428,8 @@ crawler=False
 stripper=False
 wap=False
 netclr=False
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 [Mozilla/5.0 (Macintosh; *; PPC Mac OS X Mach-O; *rv:*) Gecko/* Firefox/1.0*]
 parent=Firefox 1.0
@@ -12469,6 +12475,9 @@ platform=Linux
 parent=Firefox 1.0
 platform=Linux
 
+[Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050725 Firefox/1.0.6 (Ubuntu package 1.0.6)]
+parent=Firefox 1.0
+
 [Mozilla/5.0 (X11; *; OpenBSD*; *rv:*) Gecko/* Firefox/1.0*]
 parent=Firefox 1.0
 platform=OpenBSD
@@ -12713,6 +12722,8 @@ crawler=False
 stripper=False
 wap=False
 netclr=False
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; StarOffice 5.0
 
@@ -12999,6 +13010,8 @@ crawler=False
 stripper=False
 wap=False
 netclr=False
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.8
 
@@ -13025,6 +13038,8 @@ crawler=False
 stripper=False
 wap=False
 netclr=False
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 1.5
 
@@ -13278,6 +13293,8 @@ wap=False
 netclr=False
 AK=False
 SK=False
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 6.0
 
@@ -13306,6 +13323,8 @@ wap=False
 netclr=False
 AK=False
 SK=False
+ecmascriptversion=1.3
+w3cdomversion=1.0
 
 [Mozilla/?.0 (compatible; MSIE 6.0*;*Windows NT 5.2*)*]
 parent=IE 6.0
diff --git a/docs/exception-handling.txt b/docs/exception-handling.txt
new file mode 100644 (file)
index 0000000..fb77dbb
--- /dev/null
@@ -0,0 +1,261 @@
+
+                 Exception Handling In the Mono Runtime
+                 --------------------------------------
+
+Introduction
+------------
+
+  There are many types of exceptions which the runtime needs to handle. These
+are:
+- exceptions thrown from managed code using the 'throw' or 'rethrow' CIL
+  instructions.
+- exceptions thrown by some IL instructions like InvalidCastException thrown
+  by the 'castclass' CIL instruction.
+- exceptions thrown by runtime code
+- synchronous signals received while in managed code
+- synchronous signals received while in native code
+- asynchronous signals
+
+Since exception handling is very arch dependent, parts of the exception 
+handling code reside in the arch specific exceptions-<ARCH>.c files. The
+architecture independent parts are in mini-exceptions.c. The different
+exception types listed above are generated in different parts of the runtime,
+but ultimately, they all end up in the mono_handle_exception () function in
+mini-exceptions.c.
+
+Exceptions throw programmatically from managed code
+---------------------------------------------------
+
+These exceptions are thrown from managed code using 'throw' or 'rethrow' CIL
+instructions. The JIT compiler will translate them to a call to a helper
+function called 'mono_arch_throw/rethrow_exception'. These helper functions do 
+not exist at compile time, they are created  dynamically at run time by the 
+code in the exceptions-<ARCH>.c files. They perform various stack 
+manipulation magic, then call a helper function usually named throw_exception (), which does further processing in C code, then calls mono_handle_exception ()
+to do the rest.
+
+Exceptions thrown implicitly from managed code
+----------------------------------------------
+
+These exceptions are thrown by some IL instructions when something goes wrong.
+When the JIT needs to throw such an exception, it emits a forward conditional 
+branch and remembers its position, along with the exception which needs to
+be emitted. This is usually done in macros named EMIT_COND_SYSTEM_EXCEPTION in
+the mini-<ARCH>.c files. After the machine code for the method is emitted, the
+JIT calls the arch dependent mono_arch_emit_exceptions () function which will
+add the exception throwing code to the end of the method, and patches up the
+previous forward branches so they will point to this code. This has the
+advantage that the rarely-executed exception throwing code is kept separate
+from the method body, leading to better icache performance.
+The exception throwing code braches to the dynamically generated 
+mono_arch_throw_corlib_exception helper function, which will create the 
+proper exception object, does some stack manipulation, then calls 
+throw_exception ().
+
+Exceptions thrown by runtime code
+---------------------------------
+
+These exceptions are usually thrown by the implementations of InternalCalls
+(icalls). First an appropriate exception object is created with the help of
+various helper functions in metadata/exception.c, which has a separate helper
+function for allocating each kind of exception object used by the runtime code.
+Then the mono_raise_exception () function is called to actually throw the
+exception. That function never returns.
+
+An example:
+   if (something_is_wrong)
+         mono_raise_exception (mono_get_exception_index_out_of_range ());
+
+mono_raise_exception () simply passes the exception to the JIT side through
+an API, where it will be received by helper created by mono_arch_throw_exception (). From now on, it is treated as an exception thrown from managed code.
+
+Synchronous signals
+-------------------
+
+For performance reasons, the runtime does not do same checks required by the
+CLI spec. Instead, it relies on the CPU to do them. The two main checks which
+are omitted are null-pointer checks, and arithmetic checks. When a null
+pointer is dereferenced by JITted code, the CPU will notify the kernel through
+an interrupt, and the kernel will send a SIGSEGV signal to the process. The
+runtime installs a signal handler for SIGSEGV, which is 
+sigsegv_signal_handler () in mini.c. The signal handler creates the appropriate
+exception object and calls mono_handle_exception () with it. Arithmetic 
+exceptions like division by zero are handled similarly.
+
+Synchronous signals in native code
+----------------------------------
+
+Receiving a signal such as SIGSEGV while in native code means something very
+bad has happened. Despite this, the current runtime code treats such signals
+the same as when they are received while in managed code, ie. it constructs
+a NullPointerException and attempts to handle it. Note that there are two
+kinds of native code which can be the source of the signal:
+- code inside the runtime
+- code inside a native library loaded by an application, ie. libgtk+
+
+Stack overflow checking
+-----------------------
+
+  Stack overflow exceptions need special handling. When a thread overflows its
+stack, the kernel sends it a normal SIGSEGV signal, but the signal handler
+tries to execute on the same as the thread leading to a further SIGSEGV which
+will terminate the thread. A solution is to use an alternative signal stack
+supported by UNIX operating systems through the sigaltstack (2) system call.
+When a thread starts up, the runtime will install an altstack using the
+mono_setup_altstack () function in mini-exceptions.c. When a SIGSEGV is
+received, the signal handler checks whenever the fault address is near the
+bottom of the threads normal stack. If it is, a StackOverflowException is 
+created instead of a NullPointerException. This exception is handled like
+any other exception, with some minor differences.
+  Working sigaltstack support is very much os/kernel/libc dependent, so it is
+disabled by default.
+
+Asynchronous signals
+--------------------
+
+  Async signals are used by the runtime to notify a thread that it needs to
+change its state somehow. Currently, it is used for implementing 
+thread abort/suspend/resume.
+
+  Handling async signals correctly is a very hard problem, since the receiving
+thread can be in basically any state upon receipt of the signal. It can
+execute managed code, native code, it can hold various managed/native locks, or
+it can be in a process of acquiring them, it can be starting up, shutting down
+etc. Most of the C APIs used by the runtime are not asynch-signal safe, 
+meaning it is not safe to call them from an async signal handler. In 
+particular, the pthread locking functions are not async-safe, so if a
+signal handler interrupted code which was in the process of acquiring a lock,
+and the signal handler tries to acquire a lock, the thread will deadlock.
+Unfortunately, the current signal handling code does acquire locks, so 
+sometimes it does deadlock.
+
+When receiving an async signal, the signal handler first tries to determine
+whenever the thread was executing managed code when it was interrupted. If
+it did, then it is safe to interrupt it, so a ThreadAbortException is 
+constructed and thrown. If the thread was executing native code, then it is
+generally not safe to interrupt it. In this case, the runtime sets a flag
+then returns from the signal handler. That flag is checked every time the
+runtime returns from native code to managed code, and the exception is thrown
+then. Also, a platform specific mechanism is used to cause the thread to
+interrupt any blocking operation it might be doing.
+
+The async signal handler is in sigusr1_signal_handler () in mini.c, while
+the logic which determines whenever an exception is safe to be thrown is in
+mono_thread_request_interruption ().
+
+Stack unwinding during exception handling
+-----------------------------------------
+
+The execution state of a thread during exception handling is stored in an
+arch-specific structure called MonoContext. This structure contains the values
+of all the CPU registers relevant during exception handling, which
+usually means:
+- IP (instruction pointer)
+- SP (stack pointer)
+- FP (frame pointer)
+- callee saved registers
+
+Callee saved registers are the registers which are required by any procedure
+to be saved/restored before/after using them. They are usually defined by
+each platforms ABI (Application Binary Interface). For example, on x86, they
+are EBX, ESI and EDI.
+
+The code which calls mono_handle_exception () is required to construct the
+initial MonoContext. How this is done depends on the caller. For exceptions 
+thrown from managed code, the mono_arch_throw_exception helper function
+saves the values of the required registers and passes them to throw_exception (), which will save them in the MonoContext structure. For exceptions thrown from
+signal handlers, the MonoContext stucture is initialized from the signal info 
+received from the kernel.
+
+During exception handling, the runtime needs to 'unwind' the stack, i.e.
+given the state of the thread at a stack frame, construct the state at its
+callers. Since this is platform specific, it is done by a platform specific
+function called mono_arch_find_jit_info ().
+
+Two kinds of stack frames need handling:
+- Managed frames are easier. The JIT will store some information about each
+  managed method, like which callee-saved registers it uses. Based on this
+  information, mono_arch_find_jit_info () can find the values of the registers
+  on the thread stack, and restore them.
+- Native frames are problematic, since we have no information about how to
+  unwind through them. Some compilers generate unwind information for code,
+  some don't. Also, there is no general purpose library to obtain and decode
+  this unwind information. So the runtime uses a different solution. When
+  managed code needs to call into native code, it does through a 
+  managed->native wrapper function, which is generated by the JIT. This
+  function is responsible for saving the machine state into a per-thread 
+  structure called MonoLMF (Last Managed Frame). These LMF structures are
+  stored on the threads stack, and are linked together using one of their 
+  fields. When the unwinder encounters a native frame, it simply pops 
+  one entry of the LMF 'stack', and uses it to restore the frame state to the
+  moment before control passed to native code. In effect, all successive native
+  frames are skipped together.
+
+Problems/future work
+--------------------
+
+1. Async signal safety
+----------------------
+
+The current async signal handling code is not async safe, so it can and does
+deadlock in practice. It needs to be rewritten to avoid taking locks at least
+until it can determine that it was interrupting managed code.
+
+Another problem is the managed stack frame unwinding code. It blindly assumes
+that if the IP points into a managed frame, then all the callee saved
+registers + the stack pointer are saved on the stack. This is not true if 
+the thread was interrupted while executing the method prolog/epilog.
+
+2. Raising exceptions from native code
+--------------------------------------
+
+Currently, exceptions are raised by calling mono_raise_exception () in
+the middle of runtime code. This has two problems:
+- No cleanup is done, ie. if the caller of the function which throws an
+  exception has taken locks, or allocated memory, that is not cleaned up. For
+  this reason, it is only safe to call mono_raise_exception () 'very close' to
+  managed code, ie. in the icall functions themselves.
+- To allow mono_raise_exception () to unwind through native code, we need to
+  save the LMF structures which can add a lot of overhead even in the common
+  case when no exception is thrown. So this is not zero-cost exception handling.
+
+  An alternative might be to use a JNI style set-pending-exception API. 
+Runtime code could call mono_set_pending_exception (), then return to its
+caller with an error indication allowing the caller to clean up. When execution
+returns to managed code, then managed->native wrapper could check whenever
+there is a pending exception and throw it if neccesary. Since we already check
+for pending thread interruption, this would have no overhead, allowing us
+to drop the LMF saving/restoring code, or significant parts of it.
+
+3. Signals received while in native code
+----------------------------------------
+
+Receiving a SIGSEGV while in native code should be seen as a catastrophic 
+error, and the runtime should abort the process immediately after trying to
+print some diagnostics. This is how SIGSEGVs are handled in all other 
+production VMs. This is also a requirement for dropping LMF support.
+
+4. libunwind
+------------
+
+There is an OSS project called libunwind which is a standalone stack unwinding
+library. It is currently in development, but it is used by default by gcc on
+ia64 for its stack unwinding. The mono runtime also uses it on ia64. It has
+several advantages in relation to our current unwinding code:
+- it has a platform independent API, i.e. the same unwinding code can be used
+  on multiple platforms.
+- it can generate unwind tables which are correct at every instruction, i.e.
+  can be used for unwinding from async signals.
+- given sufficient unwind info generated by a C compiler, it can unwind through
+  C code.
+- most of its API is async-safe
+- it implements the gcc C++ exception handling API, so in theory it can
+  be used to implement mixed-language exception handling (i.e. C++ exception
+  caught in mono, mono exception caught in C++).
+- it is MIT licensed
+
+The biggest problem with libuwind is its platform support. ia64 support is
+complete/well tested, while support for other platforms is missing/incomplete.
+
+http://www.hpl.hp.com/research/linux/libunwind/
+
diff --git a/libatomic_ops/AUTHORS b/libatomic_ops/AUTHORS
new file mode 100644 (file)
index 0000000..b770890
--- /dev/null
@@ -0,0 +1,4 @@
+Originally written by Hans Boehm, with some platform-dependent code
+imported from the Boehm-Demers-Weiser GC, where it was contributed
+by many others.
+
diff --git a/libatomic_ops/COPYING b/libatomic_ops/COPYING
new file mode 100644 (file)
index 0000000..d60c31a
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, 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 software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, 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 redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+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 give any other recipients of the Program a copy of this License
+along with the Program.
+
+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 Program or any portion
+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+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 Program, 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 Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) 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; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, 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 executable.  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.
+
+If distribution of executable or 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 counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program 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.
+
+  5. 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 Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program 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.
+
+  7. 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 Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program 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 Program.
+
+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.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program 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.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the 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 Program
+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 Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, 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
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  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 program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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; either version 2 of the License, or
+    (at your option) any later version.
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/libatomic_ops/ChangeLog b/libatomic_ops/ChangeLog
new file mode 100644 (file)
index 0000000..af8055b
--- /dev/null
@@ -0,0 +1,78 @@
+2005-03-21 Hans Boehm <Hans.Boehm@hp.com>
+       Fix various acquire_release_volatile.h files to reflect the fact
+       that both icc and gcc seem to reorder ordinary memory accesses around
+       volatile accesses early in the compilation. Modify the acquire
+       release test to catch this problem (with high probablity, and only on
+       a multiprocessor).
+
+2005-03        Hans Boehm <Hans.Boehm@hp.com>
+       Fixes for recently introduced bugs.  Update x86 and x86-64 assembly
+       syntax to deal with complaints by some recent gcc versions.
+       
+2005-02        Hans Boehm <Hans.Boehm@hp.com>
+       Added libatomic_ops_gpl library with support for mostly
+       lock-free stack and malloc().
+
+2005-01 Ian Wienand <ianw@gelato.unsw.edu.au>, Al Stone <ahs3@debian.org>,
+       Hans Boehm <Hans.Boehm@hp.com>
+       Use autoconf, automake, starting with code from Debian package.
+       Don't use libtool.
+
+2005-01        Hans Boehm <Hans.Boehm@hp.com>
+       * test_and_set_t_is_ao_t.h, test_and_set_t_is_char.h, others:
+       Change most platforms to use byte-wide test-and-set locations.
+       
+2005-01        Hans Boehm <Hans.Boehm@hp.com>
+       * ao_t_is_int.h: Add to trivially support int-wide operations
+       on platforms with int-sized pointers.
+
+2004-12        Hans Boehm <Hans.Boehm@hp.com>
+       * gcc/powerpc.h: First serious attempt to support PowerPC (with
+       help from Maged Michael and others).
+
+2004-12        Hans Boehm <Hans.Boehm@hp.com>
+       * sunc/sparc.[hS]: Added minimal supprt for the Sun SPARC compiler.
+       * atomic_ops_sysdeps.S: Add support for platforms that require
+       out-of-line assmebly code.
+
+2004-10 Hans Boehm <Hans.Boehm@hp.com>
+       More work on char, short, int sized data.  Add both
+       compare_double_and_swap_double and compare_and_swap_double.
+       Typically each platform will provide at most one of these.
+
+2004-07-02 Ranko Zivojnovic
+       Replace both instances of AO_HAVE_NOP_FULL with AO_HAVE_nop_full.
+
+2004-06 Hans Boehm <Hans.Boehm@hp.com>
+       Start to add atomic_ops primitives for different sized data.
+
+2003-12-18  Hans Boehm  <Hans.Boehm@hp.com>
+       * atomic_ops/sysdeps/acquire_release_volatile.h, atomic_ops.h:
+       Fix support for ecc on IA64.  Remove compiler_barrier workaround
+       for gcc 3.4 and later.
+
+2003-12-17  Hans Boehm  <Hans.Boehm@hp.com>
+       * atomic_ops/sysdeps/hpc/{ia64.h,hppa.h},
+       atomic_ops/sysdeps/msftc/x86.h, Makefile, Makefile.atomic_ops,
+       Makefile.atomic_ops.msft, atomic_ops.h: Add initial support
+       for atomic_ops for VC++/Windows/X86 and HP/UX with the HP
+       compiler on PA_RISC and IA64.
+
+2003-12-09  Hans Boehm  <Hans.Boehm@hp.com>
+
+       * many: Install under "atomic_ops" instead of "ao".
+       Change atomic_ops include file structure.  Auxiliary include
+       files are all under include/atomic_ops.
+       Fix (hopefully) "make dist" in atomic_ops distribution.
+       Renamed various types to end in _t, though the old versions
+       are still defined for backward compatibility.
+
+2003-12-08  Carlos O'Donell  <carlos@baldric.uwo.ca>
+
+       * ao_sysdeps/gcc/hppa.h: Define AO_CLEAR macro. Change 
+       AO_pa_clearable_loc type. Add __ldcw, and __ldcw_align
+       helper macros. AO_test_and_set_full uses helper macros.
+
+
+Started sometime after version 0.4 release.  Currently the format is
+informal.  Eventually should become more GNU-like.
diff --git a/libatomic_ops/INSTALL b/libatomic_ops/INSTALL
new file mode 100644 (file)
index 0000000..ab8c872
--- /dev/null
@@ -0,0 +1,14 @@
+The configuration and build scripts for this package were generated by
+automake/autoconf.  "configure --prefix=<install dir>; make; make install"
+in this directory should work.
+
+Note that much of the content of this library is in the header files.
+
+However two small libraries are built and installed:
+
+- libatomic_ops.a is a support library, which is not needed on some platforms.
+  This is intended to be usable, under some mild restrictions, in free or
+  proprietary code, as are all the header files.  See doc/LICENSING.txt.
+- libatomic_ops_gpl.a contains some higher level facilities.  This code is
+  currently covered by the GPL.  The contents currently correspond to
+  the headers atomic_ops_stack.h and atomic_ops_malloc.h.
diff --git a/libatomic_ops/Makefile.am b/libatomic_ops/Makefile.am
new file mode 100644 (file)
index 0000000..da64dc2
--- /dev/null
@@ -0,0 +1,3 @@
+SUBDIRS = src doc tests
+
+#distclean-local:
diff --git a/libatomic_ops/Makefile.in b/libatomic_ops/Makefile.in
new file mode 100644 (file)
index 0000000..8766159
--- /dev/null
@@ -0,0 +1,563 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
+       ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
+       install-sh missing mkinstalldirs
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NEED_ASM_FALSE = @NEED_ASM_FALSE@
+NEED_ASM_TRUE = @NEED_ASM_TRUE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PICFLAG = @PICFLAG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+SUBDIRS = src doc tests
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+       @:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(srcdir) && $(AUTOMAKE) --gnu  \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @set fnord $$MAKEFLAGS; amf=$$2; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @set fnord $$MAKEFLAGS; amf=$$2; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       mkdir $(distdir)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+       -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r $(distdir)
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       $(am__remove_distdir)
+
+dist-tarZ: distdir
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__remove_distdir)
+
+dist-shar: distdir
+       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       $(am__remove_distdir)
+
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+dist dist-all: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/_build
+       mkdir $(distdir)/_inst
+       chmod a-w $(distdir)
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && cd $(distdir)/_build \
+         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+       $(am__remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+       @cd $(distuninstallcheck_dir) \
+       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+       check-am clean clean-generic clean-recursive ctags \
+       ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+       dist-tarZ dist-zip distcheck distclean distclean-generic \
+       distclean-recursive distclean-tags distcleancheck distdir \
+       distuninstallcheck dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       maintainer-clean-recursive mostlyclean mostlyclean-generic \
+       mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+       uninstall uninstall-am uninstall-info-am
+
+
+#distclean-local:
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libatomic_ops/NEWS b/libatomic_ops/NEWS
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/libatomic_ops/README b/libatomic_ops/README
new file mode 100644 (file)
index 0000000..81aa8b7
--- /dev/null
@@ -0,0 +1,13 @@
+This package provides semi-portable access to hardware provided
+atomic memory operations.  These might allow you to write code:
+
+- That does more interesting things in signal handlers.
+- Makes more effective use of multiprocessors by allowing you to write
+  clever lock-free code.  Note that such code is very difficult to get
+  right, and will unavoidably be less portable than lock-based code.  It
+  ia also not always faster than lock-based code.  But it may occasionally
+  be a large performance win.
+- To experiment with new and much better thread programming paradigms, etc.
+
+For details and licensing restrictions see the files in the doc
+subdirectory.
diff --git a/libatomic_ops/aclocal.m4 b/libatomic_ops/aclocal.m4
new file mode 100644 (file)
index 0000000..2cfa0ef
--- /dev/null
@@ -0,0 +1,1076 @@
+# generated automatically by aclocal 1.9.3 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+#                                                        -*- Autoconf -*-
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Generated from amversion.in; do not edit by hand.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION([1.9.3])])
+
+# Figure out how to run the assembler.             -*- Autoconf -*-
+
+# serial 3
+
+# Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# AM_PROG_AS
+# ----------
+AC_DEFUN([AM_PROG_AS],
+[# By default we simply use the C compiler to build assembly code.
+AC_REQUIRE([AC_PROG_CC])
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
+AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
+])
+
+# AM_AUX_DIR_EXPAND
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                              -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 6
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# serial 7                                             -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.   -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+#   Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 7
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                            -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 11
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+#                                                          -*- Autoconf -*-
+# Copyright (C) 2003  Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+#  -*- Autoconf -*-
+
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004  Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 1
+
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/libatomic_ops/compile b/libatomic_ops/compile
new file mode 100755 (executable)
index 0000000..3d21703
--- /dev/null
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2004-10-12.08
+
+# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# 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; either version 2, or (at your option)
+# any later version.
+#
+# 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit 0
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit 0
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we strip `-o arg' only if arg is an object.
+       eat=1
+       case $2 in
+         *.o | *.obj)
+           ofile=$2
+           ;;
+         *)
+           set x "$@" -o "$2"
+           shift
+           ;;
+       esac
+       ;;
+      *.c)
+       cfile=$1
+       set x "$@" "$1"
+       shift
+       ;;
+      *)
+       set x "$@" "$1"
+       shift
+       ;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/libatomic_ops/config.guess b/libatomic_ops/config.guess
new file mode 100755 (executable)
index 0000000..77c7cba
--- /dev/null
@@ -0,0 +1,1441 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+timestamp='2004-08-13'
+
+# This file 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit 0 ;;
+    amd64:OpenBSD:*:*)
+       echo x86_64-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    amiga:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    cats:OpenBSD:*:*)
+       echo arm-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    hp300:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    luna88k:OpenBSD:*:*)
+       echo m88k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mac68k:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    macppc:OpenBSD:*:*)
+       echo powerpc-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+       echo m88k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+       echo powerpc-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sgi:OpenBSD:*:*)
+       echo mips64-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sun3:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    *:OpenBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit 0 ;;
+    macppc:MirBSD:*:*)
+       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+       exit 0 ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit 0 ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit 0 ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit 0 ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit 0 ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+       exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit 0 ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit 0 ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7 && exit 0 ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit 0 ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit 0 ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit 0 ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit 0 ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit 0 ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c \
+         && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+         && exit 0
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit 0 ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit 0 ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit 0 ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit 0 ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit 0 ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit 0 ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+       exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit 0 ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+               echo rs6000-ibm-aix3.2.5
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit 0 ;;
+    *:AIX:*:[45])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           # avoid double evaluation of $set_cc_for_build
+           test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+       echo unknown-hitachi-hiuxwe2
+       exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit 0 ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit 0 ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit 0 ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:FreeBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit 0 ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit 0 ;;
+    i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit 0 ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit 0 ;;
+    x86:Interix*:[34]*)
+       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+       exit 0 ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit 0 ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit 0 ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit 0 ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit 0 ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit 0 ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit 0 ;;
+    arm*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux-gnu
+       exit 0 ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit 0 ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit 0 ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit 0 ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    x86_64:Linux:*:*)
+       echo x86_64-unknown-linux-gnu
+       exit 0 ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit 0 ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit 0 ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit 0 ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #ifdef __INTEL_COMPILER
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+       test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit 0 ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit 0 ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit 0 ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit 0 ;;
+       i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit 0 ;;
+    i*86:*:5:[78]*)
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit 0 ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit 0 ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit 0 ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit 0 ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit 0 ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit 0 ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit 0 ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit 0 ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit 0 ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit 0 ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit 0 ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit 0 ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit 0 ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           *86) UNAME_PROCESSOR=i686 ;;
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit 0 ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit 0 ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit 0 ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit 0 ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit 0 ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit 0 ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit 0 ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit 0 ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit 0 ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit 0 ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+       exit 0 ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit 0 ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms && exit 0 ;;
+           I*) echo ia64-dec-vms && exit 0 ;;
+           V*) echo vax-dec-vms && exit 0 ;;
+       esac
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit 0 ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit 0 ;;
+    c34*)
+       echo c34-convex-bsd
+       exit 0 ;;
+    c38*)
+       echo c38-convex-bsd
+       exit 0 ;;
+    c4*)
+       echo c4-convex-bsd
+       exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/libatomic_ops/config.sub b/libatomic_ops/config.sub
new file mode 100755 (executable)
index 0000000..ac6de98
--- /dev/null
@@ -0,0 +1,1552 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+timestamp='2004-06-24'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | m32r | m32rle | m68000 | m68k | m88k | mcore \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | msp430 \
+       | ns16k | ns32k \
+       | openrisc | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+       | strongarm \
+       | tahoe | thumb | tic4x | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xscale | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* \
+       | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | msp430-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+       | xtensa-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16c)
+               basic_machine=cr16c-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       or32 | or32-*)
+               basic_machine=or32-unknown
+               os=-coff
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+        -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+        -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/libatomic_ops/configure b/libatomic_ops/configure
new file mode 100755 (executable)
index 0000000..e3a2dcd
--- /dev/null
@@ -0,0 +1,5609 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for libatomic_ops 1.0.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='libatomic_ops'
+PACKAGE_TARNAME='libatomic_ops'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='libatomic_ops 1.0'
+PACKAGE_BUGREPORT=''
+
+ac_unique_file="src/atomic_ops.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar RANLIB ac_ct_RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS CCASFLAGS CPP EGREP PICFLAG NEED_ASM_TRUE NEED_ASM_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+             localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CCAS_set=${CCAS+set}
+ac_env_CCAS_value=$CCAS
+ac_cv_env_CCAS_set=${CCAS+set}
+ac_cv_env_CCAS_value=$CCAS
+ac_env_CCASFLAGS_set=${CCASFLAGS+set}
+ac_env_CCASFLAGS_value=$CCASFLAGS
+ac_cv_env_CCASFLAGS_set=${CCASFLAGS+set}
+ac_cv_env_CCASFLAGS_value=$CCASFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures libatomic_ops 1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                         [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                         [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of libatomic_ops 1.0:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CCAS        assembler compiler command (defaults to CC)
+  CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+          test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd "$ac_popdir"
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+libatomic_ops configure 1.0
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by libatomic_ops $as_me 1.0, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+       echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+       ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+  ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+am__api_version="1.9"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='libatomic_ops'
+ VERSION='1.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+
+          ac_config_headers="$ac_config_headers src/config.h"
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+       ;;
+    conftest.$ac_ext )
+       # This is the source file.
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       # FIXME: I believe we export ac_cv_exeext for Libtool,
+       # but it would be cool to find out if it's true.  Does anybody
+       # maintain Libtool? --akim.
+       export ac_cv_exeext
+       break;;
+    * )
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         export ac_cv_exeext
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+          ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+# By default we simply use the C compiler to build assembly code.
+
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+
+
+
+
+# Checks for functions.
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+for ac_header in stdlib.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to the libatomic_ops lists.  ##
+## ---------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_func in getpagesize
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+echo "$as_me:$LINENO: checking for working mmap" >&5
+echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_mmap_fixed_mapped=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propagated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#if !STDC_HEADERS && !HAVE_STDLIB_H
+char *malloc ();
+#endif
+
+/* This mess was copied from the GNU getpagesize.h.  */
+#if !HAVE_GETPAGESIZE
+/* Assume that all systems that can run configure have sys/param.h.  */
+# if !HAVE_SYS_PARAM_H
+#  define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  if HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192  /* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+int
+main ()
+{
+  char *data, *data2, *data3;
+  int i, pagesize;
+  int fd;
+
+  pagesize = getpagesize ();
+
+  /* First, make a file with some known garbage in it. */
+  data = (char *) malloc (pagesize);
+  if (!data)
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftest.mmap", 0600);
+  if (fd < 0)
+    exit (1);
+  if (write (fd, data, pagesize) != pagesize)
+    exit (1);
+  close (fd);
+
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftest.mmap", O_RDWR);
+  if (fd < 0)
+    exit (1);
+  data2 = (char *) malloc (2 * pagesize);
+  if (!data2)
+    exit (1);
+  data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+                    MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      exit (1);
+
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = (char *) malloc (pagesize);
+  if (!data3)
+    exit (1);
+  if (read (fd, data3, pagesize) != pagesize)
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      exit (1);
+  close (fd);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_mmap_fixed_mapped=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MMAP 1
+_ACEOF
+
+fi
+rm -f conftest.mmap
+
+
+# Checks for header files.
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# AC_CHECK_HEADERS([ ])
+
+# Determine PIC flag, adjust default CFLAGS
+need_asm=false
+PICFLAG=
+echo "$as_me:$LINENO: checking Determining PIC compiler flag" >&5
+echo $ECHO_N "checking Determining PIC compiler flag... $ECHO_C" >&6
+if test "$GCC" = yes; then
+  echo "$as_me:$LINENO: result: -fPIC" >&5
+echo "${ECHO_T}-fPIC" >&6
+  PICFLAG=-fPIC
+else
+  case "$host" in
+    *-*-hpux*)
+      echo "$as_me:$LINENO: result: \"+Z\"" >&5
+echo "${ECHO_T}\"+Z\"" >&6
+      PICFLAG="+Z"
+      if test "$GCC" != yes; then
+        CFLAGS="$CFLAGS +O2 -mt"
+      fi
+      ;;
+    *-*-solaris*)
+      echo "$as_me:$LINENO: result: -Kpic" >&5
+echo "${ECHO_T}-Kpic" >&6
+      PICFLAG=-Kpic
+      if test "$GCC" != yes; then
+        CFLAGS="$CFLAGS -O"
+        need_asm=true
+      fi
+      ;;
+    *-*-linux*)
+      echo "$as_me:$LINENO: result: -fPIC" >&5
+echo "${ECHO_T}-fPIC" >&6
+      PICFLAG=-fPIC
+      # Any Linux compiler had better be gcc compatible.
+      ;;
+    *)
+      echo "$as_me:$LINENO: result: \"<none>\"" >&5
+echo "${ECHO_T}\"<none>\"" >&6
+      ;;
+  esac
+fi
+CFLAGS="$CFLAGS -DNDEBUG"
+
+
+
+
+
+
+if test x$need_asm = xtrue; then
+  NEED_ASM_TRUE=
+  NEED_ASM_FALSE='#'
+else
+  NEED_ASM_TRUE='#'
+  NEED_ASM_FALSE=
+fi
+
+
+                                                            ac_config_files="$ac_config_files Makefile src/Makefile src/atomic_ops/Makefile src/atomic_ops/sysdeps/Makefile doc/Makefile tests/Makefile"
+
+          ac_config_commands="$ac_config_commands default"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${NEED_ASM_TRUE}" && test -z "${NEED_ASM_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"NEED_ASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"NEED_ASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by libatomic_ops $as_me 1.0, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                  instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+libatomic_ops config.status 1.0
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+PICFLAG=${PICFLAG}
+CC=${CC}
+DEFS=${DEFS}
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+  "src/atomic_ops/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/atomic_ops/Makefile" ;;
+  "src/atomic_ops/sysdeps/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/atomic_ops/sysdeps/Makefile" ;;
+  "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+  "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+  "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@CCAS@,$CCAS,;t t
+s,@CCASFLAGS@,$CCASFLAGS,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@PICFLAG@,$PICFLAG,;t t
+s,@NEED_ASM_TRUE@,$NEED_ASM_TRUE,;t t
+s,@NEED_ASM_FALSE@,$NEED_ASM_FALSE,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([   ]*\)#\([        ]*define[       ][      ]*\)'
+ac_dB='[        ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        # Do quote $f, to prevent DOS paths from being IFS'd.
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[      ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[    ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[     ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[     ]*#[    ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[     ]*#[    ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X$ac_file : 'X\(//\)[^/]' \| \
+        X$ac_file : 'X\(//\)$' \| \
+        X$ac_file : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_dest" : 'X\(//\)[^/]' \| \
+        X"$ac_dest" : 'X\(//\)$' \| \
+        X"$ac_dest" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+    default )  ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/libatomic_ops/configure.ac b/libatomic_ops/configure.ac
new file mode 100644 (file)
index 0000000..00e878e
--- /dev/null
@@ -0,0 +1,66 @@
+# Process this file with autoconf to produce a configure script.
+AC_INIT([libatomic_ops],[1.0])
+AC_CANONICAL_TARGET([])
+AC_CONFIG_SRCDIR(src/atomic_ops.c)
+AM_INIT_AUTOMAKE
+AC_PROG_RANLIB
+
+AM_CONFIG_HEADER(src/config.h)
+
+# Checks for programs.
+AC_PROG_CC
+AM_PROG_AS
+
+# Checks for functions.
+AC_FUNC_MMAP
+
+# Checks for header files.
+AC_HEADER_STDC
+# AC_CHECK_HEADERS([ ])
+
+# Determine PIC flag, adjust default CFLAGS
+need_asm=false
+PICFLAG=
+AC_MSG_CHECKING(Determining PIC compiler flag)
+if test "$GCC" = yes; then
+  AC_MSG_RESULT(-fPIC)
+  PICFLAG=-fPIC
+else
+  case "$host" in
+    *-*-hpux*)
+      AC_MSG_RESULT("+Z")
+      PICFLAG="+Z"
+      if test "$GCC" != yes; then
+        CFLAGS="$CFLAGS +O2 -mt"
+      fi
+      ;;
+    *-*-solaris*)
+      AC_MSG_RESULT(-Kpic)
+      PICFLAG=-Kpic
+      if test "$GCC" != yes; then
+        CFLAGS="$CFLAGS -O"
+        need_asm=true
+      fi
+      ;;
+    *-*-linux*)
+      AC_MSG_RESULT(-fPIC)
+      PICFLAG=-fPIC
+      # Any Linux compiler had better be gcc compatible.
+      ;;
+    *)
+      AC_MSG_RESULT("<none>")
+      ;;
+  esac
+fi
+CFLAGS="$CFLAGS -DNDEBUG"
+
+AC_SUBST(PICFLAG)
+AC_SUBST(DEFS)
+
+AM_CONDITIONAL(NEED_ASM, test x$need_asm = xtrue)
+
+AC_CONFIG_FILES([Makefile src/Makefile src/atomic_ops/Makefile src/atomic_ops/sysdeps/Makefile doc/Makefile tests/Makefile])
+AC_CONFIG_COMMANDS([default],[[]],[[PICFLAG=${PICFLAG}
+CC=${CC}
+DEFS=${DEFS}]])
+AC_OUTPUT
diff --git a/libatomic_ops/depcomp b/libatomic_ops/depcomp
new file mode 100755 (executable)
index 0000000..3480ce4
--- /dev/null
@@ -0,0 +1,436 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+if test -z "$depfile"; then
+   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
+   dir=`echo "$object" | sed 's,/.*$,/,'`
+   if test "$dir" = "$object"; then
+      dir=
+   fi
+   # FIXME: should be _deps on DOS.
+   depfile="$dir.deps/$base"
+fi
+
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+
+   base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'`
+   tmpdepfile1="$base.o.d"
+   tmpdepfile2="$base.d"
+   if test "$libtool" = yes; then
+      "$@" -Wc,-MD
+   else
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[  ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  test -z "$dashmflag" && dashmflag=-M
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*) # this is libtool, let us make it quiet
+      for arg
+      do # cycle over the arguments
+        case "$arg" in
+       "--mode=compile")
+         # insert --quiet before "--mode=compile"
+         set fnord "$@" --quiet
+         shift # fnord
+         ;;
+       esac
+       set fnord "$@" "$arg"
+       shift # fnord
+       shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" $dashmflag | sed 's:^[^:]*\:[         ]*:'"$object"'\: :' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  # X makedepend
+  (
+    shift
+    cleared=no
+    for arg in "$@"; do
+      case $cleared in no)
+        set ""; shift
+       cleared=yes
+      esac
+      case "$arg" in
+        -D*|-I*)
+         set fnord "$@" "$arg"; shift;;
+       -*)
+         ;;
+       *)
+         set fnord "$@" "$arg"; shift;;
+      esac
+    done
+    obj_suffix="`echo $object | sed 's/^.*\././'`"
+    touch "$tmpdepfile"
+    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+       "--mode=compile")
+         # insert --quiet before "--mode=compile"
+         set fnord "$@" --quiet
+         shift # fnord
+         ;;
+       esac
+       set fnord "$@" "$arg"
+       shift # fnord
+       shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+       "--mode=compile")
+         # insert --quiet before "--mode=compile"
+         set fnord "$@" --quiet
+         shift # fnord
+         ;;
+       esac
+       set fnord "$@" "$arg"
+       shift # fnord
+       shift # "$arg"
+      done
+      ;;
+    esac
+    for arg
+    do
+      case "$arg" in
+      "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+       set fnord "$@"
+       shift
+       shift
+       ;;
+      *)
+       set fnord "$@" "$arg"
+       shift
+       shift
+       ;;
+      esac
+    done
+    "$@" -E |
+    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
diff --git a/libatomic_ops/doc/COPYING b/libatomic_ops/doc/COPYING
new file mode 100644 (file)
index 0000000..d60c31a
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, 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 software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, 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 redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+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 give any other recipients of the Program a copy of this License
+along with the Program.
+
+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 Program or any portion
+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+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 Program, 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 Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) 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; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, 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 executable.  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.
+
+If distribution of executable or 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 counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program 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.
+
+  5. 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 Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program 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.
+
+  7. 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 Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program 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 Program.
+
+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.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program 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.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the 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 Program
+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 Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, 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
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  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 program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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; either version 2 of the License, or
+    (at your option) any later version.
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/libatomic_ops/doc/LICENSING.txt b/libatomic_ops/doc/LICENSING.txt
new file mode 100644 (file)
index 0000000..1ae0e93
--- /dev/null
@@ -0,0 +1,64 @@
+Our intent is to make it easy to use libatomic_ops, in
+both free and proprietary software.  Hence most code that we expect to be
+linked into a client application is covered by an MIT-style license.
+
+A few library routines are covered by the GNU General Public License.
+These are put into a separate library, libatomic_ops_gpl.a .
+
+The low-level part of the library is mostly covered by the following
+license:
+
+----------------------------------------
+
+Copyright (c) ...
+
+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. 
+
+--------------------------------
+
+A few files in the sysdeps directory were inherited in part from the
+Boehm-Demers-Weiser conservative garbage collector, and are covered by
+its license, which is similar in spirit:
+
+--------------------------------
+
+Copyright (c) ...
+
+THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+
+Permission is hereby granted to use or copy this program
+for any purpose,  provided the above notices are retained on all copies.
+Permission to modify the code and to distribute modified code is granted,
+provided the above notices are retained, and a notice that the code was
+modified is included with the above copyright notice.
+
+----------------------------------
+
+A few files are covered by the GNU General Public License.  (See file
+"COPYING".) This applies only to test code, sample applications,
+and the libatomic_ops_gpl portion of the library.
+Thus libatomic_ops_gpl should generally not be linked into proprietary code.
+(This distinction was motivated by patent considerations.)
+
+It is possible that the license of the GPL pieces may be changed for
+future versions to make them more consistent with the rest of the package.
+If you submit patches, and have strong preferences about licensing, please
+express them.
+
diff --git a/libatomic_ops/doc/Makefile.am b/libatomic_ops/doc/Makefile.am
new file mode 100644 (file)
index 0000000..ce212d0
--- /dev/null
@@ -0,0 +1,3 @@
+# installed documentation
+#
+dist_pkgdata_DATA=COPYING LICENSING.txt README.txt COPYING README_stack.txt README_malloc.txt README_win32.txt
diff --git a/libatomic_ops/doc/Makefile.in b/libatomic_ops/doc/Makefile.in
new file mode 100644 (file)
index 0000000..f0eb954
--- /dev/null
@@ -0,0 +1,329 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = doc
+DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in COPYING
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkgdatadir)"
+dist_pkgdataDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_pkgdata_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NEED_ASM_FALSE = @NEED_ASM_FALSE@
+NEED_ASM_TRUE = @NEED_ASM_TRUE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PICFLAG = @PICFLAG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+
+# installed documentation
+#
+dist_pkgdata_DATA = COPYING LICENSING.txt README.txt COPYING README_stack.txt README_malloc.txt README_win32.txt
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
+       @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
+         $(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
+       done
+
+uninstall-dist_pkgdataDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
+         rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+       for dir in "$(DESTDIR)$(pkgdatadir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_pkgdataDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-dist_pkgdataDATA install-exec install-exec-am \
+       install-info install-info-am install-man install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+       pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-dist_pkgdataDATA uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libatomic_ops/doc/README.txt b/libatomic_ops/doc/README.txt
new file mode 100644 (file)
index 0000000..2bc59e1
--- /dev/null
@@ -0,0 +1,226 @@
+Usage:
+
+0) If possible, do this on a multiprocessor, especially if you are planning
+on modifying or enhancing the package.  It will work on a uniprocessor,
+but the tests are much more likely to pass in the presence of serious problems.
+
+1) Type ./configure --prefix=<install dir>; make; make check
+in the directory containing unpacked source.  The usual GNU build machinery
+is used, except that only static, but position-independent, libraries
+are normally built.  On Windows, read README_win32.txt instead.
+
+2) Applications should include atomic_ops.h.  Nearly all operations
+are implemented by header files included from it.  It is sometimes
+necessary, and always recommended to also link against libatomic_ops.a.
+To use the almost non-blocking stack or malloc implementations,
+see the corresponding README files, and also link against libatomic_gpl.a
+before linking against libatomic_ops.a.
+
+OVERVIEW:
+Atomic_ops.h defines a large collection of operations, each one of which is
+a combination of an (optional) atomic memory operation, and a memory barrier.
+Also defines associated feature-test macros to determine whether a particular
+operation is available on the current target hardware (either directly or
+by synthesis).  This is an attempt to replace various existing files with
+similar goals, since they usually do not handle differences in memory
+barrier styles with sufficient generality.
+
+If this is included after defining AO_REQUIRE_CAS, then the package
+will make an attempt to emulate compare-and-swap in a way that (at least
+on Linux) should still be async-signal-safe.  As a result, most other
+atomic operations will then be defined using the compare-and-swap
+emulation.  This emulation is slow, since it needs to disable signals.
+And it needs to block in case of contention.  If you care about performance
+on a platform that can't directly provide compare-and-swap, there are
+probably better alternatives.  But this allows easy ports to some such
+platforms (e.g. PA_RISC).  The option is ignored if compare-and-swap
+can be implemented directly.
+
+If atomic_ops.h is included after defining AO_USE_PTHREAD_DEFS, then all
+atomic operations will be emulated with pthread locking.  This is NOT
+async-signal-safe.  And it is slow.  It is intended primarily for debugging
+of the atomic_ops package itself.
+
+Note that the implementation reflects our understanding of real processor
+behavior.  This occasionally diverges from the documented behavior.  (E.g.
+the documented X86 behavior seems to be weak enough that it is impractical
+to use.  Current real implementations appear to be much better behaved.)
+We of course are in no position to guarantee that future processors
+(even HPs) will continue to behave this way, though we hope they will.
+
+This is a work in progress.  Corrections/additions for other platforms are
+greatly appreciated.  It passes rudimentary tests on X86, Itanium, and
+Alpha.
+
+OPERATIONS:
+
+Most operations operate on values of type AO_t, which are unsigned integers
+whose size matches that of pointers on the given architecture.  Exceptions
+are:
+
+- AO_test_and_set operates on AO_TS_t, which is whatever size the hardware
+supports with good performance.  In some cases this is the length of a cache line.
+In some cases it is a byte.  In many cases it is equivalent to AO_t.
+
+- A few operations are implemented on smaller or larger size integers.
+Such operations are indicated by the appropriate prefix:
+
+AO_char_... Operates on unsigned char values.
+AO_short_... Operates on unsigned short values.
+AO_int_... Operates on unsigned int values.
+
+(Currently a very limited selection of these is implemented.  We're
+working on it.)
+
+The defined operations are all of the form AO_[<size>_]<op><barrier>(<args>).
+
+The <op> component specifies an atomic memory operation.  It may be
+one of the following, where the corresponding argument and result types
+are also specified:
+
+void nop()
+       No atomic operation.  The barrier may still be useful.
+AO_t load(volatile AO_t * addr)
+       Atomic load of *addr.
+void store(volatile AO_t * addr, AO_t new_val)
+       Atomically store new_val to *addr.
+AO_t fetch_and_add(volatile AO_t *addr, AO_t incr)
+       Atomically add incr to *addr, and return the original value of *addr.
+AO_t fetch_and_add1(volatile AO_t *addr)
+       Equivalent to AO_fetch_and_add(addr, 1).
+AO_t fetch_and_sub1(volatile AO_t *addr)
+       Equivalent to AO_fetch_and_add(addr, (AO_t)(-1)).
+void or(volatile AO_t *addr, AO_t incr)
+       Atomically or incr into *addr.
+int compare_and_swap(volatile AO_t * addr, AO_t old_val, AO_t new_val)
+       Atomically compare *addr to old_val, and replace *addr by new_val
+       if the first comparison succeeds.  Returns nonzero if the comparison
+       succeeded and *addr was updated.
+AO_TS_VAL_t test_and_set(volatile AO_TS_t * addr)
+       Atomically read the binary value at *addr, and set it.  AO_TS_VAL_t
+       is an enumeration type which includes the two values AO_TS_SET and
+       and AO_TS_CLEAR.  An AO_TS_t location is capable of holding an
+       AO_TS_VAL_t, but may be much larger, as dictated by hardware
+       constraints.  Test_and_set logically sets the value to AO_TS_SET.
+       It may be reset to AO_TS_CLEAR with the AO_CLEAR(AO_TS_t *) macro.
+       AO_TS_t locations should be initialized to AO_TS_INITIALIZER.
+       The values of AO_TS_SET and AO_TS_CLEAR are hardware dependent.
+       (On PA-RISC, AO_TS_SET is zero!)
+
+Test_and_set is a more limited version of compare_and_swap.  Its only
+advantage is that it is more easily implementable on some hardware.  It
+should thus be used if only binary test-and-set functionality is needed.
+
+If available, we also provide compare_and_swap operations that operate
+on wider values.  Since standard data types for double width values
+may not be available, these explicitly take pairs of arguments for the
+new and/or old value.  Unfortunately, there are two common variants,
+neither of which can easily and efficiently emulate the other.
+The first performs a comparison against the entire value being replaced,
+where the second replaces a double-width replacement, but performs
+a single-width comparison:
+
+int compare_double_and_swap_double(volatile AO_double_t * addr,
+                                  AO_t old_val1, AO_t old_val2,
+                                  AO_t new_val1, AO_t new_val2);
+
+int compare_and_swap_double(volatile AO_double_t * addr,
+                           AO_t old_val1,
+                           AO_t new_val1, AO_t new_val2);
+
+where AO_double_t is a structure containing AO_val1 and AO_val2 fields,
+both of type AO_t.  For compare_and_swap_double, we compare against
+the val1 field.  AO_double_t exists only if AO_HAVE_double_t
+is defined.
+
+ORDERING CONSTRAINTS:
+
+Each operation name also includes a suffix that specifies the associated
+ordering semantics.  The ordering constraint limits reordering of this
+operation with repsect to other atomic operations and ordinary memory
+references.  The current implementation assumes that all memory references
+are to ordinary cacheable memory; the ordering guarantee is with respect
+to other threads or processes, not I/O devices.  (Whether or not this
+distinction is important is platform-dependent.)
+
+Ordering suffixes are one of the following:
+
+<none>: No memory barrier.  A plain AO_nop() really does nothing.
+_release: Earlier operations must become visible to other threads
+         before the atomic operation.
+_acquire: Later operations must become visible after this operation.
+_read: Subsequent reads must become visible after reads included in
+       the atomic operation or preceding it.  Rarely useful for clients?
+_write: Earlier writes become visible before writes during or after
+        the atomic operation.  Rarely useful for clients?
+_full: Ordered with respect to both earlier and later memops.
+_release_write: Ordered with respect to earlier writes.  This is
+               normally implemented as either a _write or _release
+               barrier.
+_dd_acquire_read: Ordered with respect to later reads that are data
+              dependent on this one.  This is needed on
+              a pointer read, which is later dereferenced to read a
+              second value, with the expectation that the second
+              read is ordered after the first one.  On most architectures,
+              this is equivalent to no barrier.
+_release_read: Ordered with respect to earlier reads.  Useful for
+              implementing read locks.  Can be implemented as _release,
+              but not as _read, since _read groups the current operation
+              with the earlier ones.
+
+We assume that if a store is data-dependent on an a previous load, then
+the two are always implicitly ordered.
+
+It is possible to test whether AO_<op><barrier> is available on the
+current platform by checking whether AO_HAVE_<op>_<barrier> is defined
+as a macro.
+
+Note that we generally don't implement operations that are either
+meaningless (e.g. AO_nop_acquire, AO_nop_release) or which appear to
+have no clear use (e.g. AO_load_release, AO_store_acquire, AO_load_write,
+AO_store_read).  On some platforms (e.g. PA-RISC) many operations
+will remain undefined unless AO_REQUIRE_CAS is defined before including
+the package.
+
+When typed in the package build directory, the following command
+will print operations that are unimplemented on the platform:
+
+make test_atomic; ./test_atomic
+
+The following command generates a file "list_atomic.i" containing the
+macro expansions of all implemented operations on the platform:
+
+make list_atomic.i
+
+Future directions:
+
+We expect the list of memory barrier types to remain more or less fixed.
+However, it is likely that the list of underlying atomic operations will
+grow.  It would also be useful to support double-wide and narrower operations
+when available.
+
+Example:
+
+If you want to initialize an object, and then "publish" a pointer to it
+in a global location p, such that other threads reading the new value of
+p are guaranteed to see an initialized object, it suffices to use
+AO_release_write(p, ...) to write the pointer to the object, and to
+retrieve it in other threads with AO_acquire_read(p).
+
+Platform notes:
+
+All X86: We quietly assume 486 or better.
+
+Windows:
+Currently AO_REQUIRE_CAS is not supported.
+
+Microsoft compilers:
+Define AO_ASSUME_WINDOWS98 to get access to hardware compare-and-swap
+functionality.  This relies on the InterlockedCompareExchange() function
+which was apparently not supported in Windows95.  (There may be a better
+way to get access to this.)  Currently only X86(32 bit) is supported for
+Windows.
+
+Gcc on x86:
+Define AO_USE_PENTIUM4_INSTRS to use the Pentium 4 mfence instruction.
+Currently this is appears to be of marginal benefit.
diff --git a/libatomic_ops/doc/README_malloc.txt b/libatomic_ops/doc/README_malloc.txt
new file mode 100644 (file)
index 0000000..680b3e2
--- /dev/null
@@ -0,0 +1,57 @@
+The libatomic_ops_gpl includes a simple almost-lock-free malloc implementation.
+
+This is intended as a safe way to allocate memory from a signal handler,
+or to allocate memory in the context of a library that does not know what
+thread library it will be used with.  In either case locking is impossible.
+
+Note that the operations are only guaranteed to be 1-lock-free, i.e. a
+single blocked thread will not prevent progress, but multiple blocked
+threads may.  To safely use these operations in a signal handler,
+the handler should be non-reentrant, i.e. it should not be interruptable
+by another handler using these operations.  Furthermore use outside
+of signal handlers in a multithreaded application should be protected
+by a lock, so that at most one invocation may be interrupted by a signal.
+The header will define the macro "AO_MALLOC_IS_LOCK_FREE" on platforms
+on which malloc is completely lock-free, and hence these restrictions
+do not apply.
+
+In the presence of threads, but absence of contention, the time performance
+of this package should be as good, or slightly better than, most system
+malloc implementations.  Its space performance
+is theoretically optimal (to within a constant factor), but probably
+quite poor in practice.  In particular, no attempt is made to
+coalesce free small memory blocks.  Something like Doug Lea's malloc is
+likely to use significantly less memory for complex applications.
+
+Perfomance on platforms without an efficient compare-and-swap implementation
+will be poor.
+
+This package was not designed for processor-scalability in the face of
+high allocation rates.  If all threads happen to allocate different-sized
+objects, you might get lucky.  Otherwise expect contention and false-sharing
+problems.  If this is an issue, something like Maged Michael's algorithm
+(PLDI 2004) would be technically a far better choice.  If you are concerned
+only with scalablity, and not signal-safety, you might also consider
+using Hoard instead.  We have seen a factor of 3 to 4 slowdown from the
+standard glibc malloc implementation with contention, even when the
+performance without contention was faster.  (To make the implementation
+more scalable, one would need to replicate at least the free list headers,
+so that concurrent access is possible without cache conflicts.)
+
+Unfortunately there is no portable async-signal-safe way to obtain large
+chunks of memory from the OS.  Based on reading of the source code,
+mmap-based allocation appears safe under Linux, and probably BSD variants.
+It is probably unsafe for operating systems built on Mach, such as
+Apple's Darwin.  Without use of mmap, the allocator is
+limited to a fixed size, statically preallocated heap (2MB by default),
+and will fail to allocate objects above a certain size (just under 64K
+by default).  Use of mmap to circumvent these limitations requires an
+explicit call.
+
+The entire interface to the AO_malloc package currently consists of:
+
+#include <atomic_ops_malloc.h> /* includes atomic_ops.h */
+
+void *AO_malloc(size_t sz);
+void AO_free(void *p);
+void AO_malloc_enable_mmap(void);
diff --git a/libatomic_ops/doc/README_stack.txt b/libatomic_ops/doc/README_stack.txt
new file mode 100644 (file)
index 0000000..98ff87c
--- /dev/null
@@ -0,0 +1,78 @@
+Note that the AO_stack implementation is licensed under the GPL,
+unlike the lower level routines.
+
+The header file atomic_ops_stack.h defines a linked stack abstraction.
+Stacks may be accessed by multiple concurrent threads.  The implementation
+is 1-lock-free, i.e. it will continue to make progress if at most one
+thread becomes inactive while operating on the data structure.
+
+(The implementation can be built to be N-lock-free for any given N.  But that
+seems to rarely be useful, especially since larger N involve some slowdown.)
+
+This makes it safe to access these data structures from non-reentrant
+signal handlers, provided at most one non-signal-handler thread is
+accessing the data structure at once.  This latter condition can be
+ensured by acquiring an ordinary lock around the non-hndler accesses
+to the data structure.
+
+For details see:
+
+Hans-J. Boehm, "An Almost Non-Blocking Stack", PODC 2004,
+http://portal.acm.org/citation.cfm?doid=1011767.1011774, or
+http://www.hpl.hp.com/techreports/2004/HPL-2004-105.html
+(This is not exactly the implementation described there, since the
+interface was cleaned up in the interim.  But it should perform
+very similarly.)
+
+We use a fully lock-free implementation when the underlying hardware
+makes that less expensive, i.e. when we have a double-wide compare-and-swap
+operation available.  (The fully lock-free implementation uses an AO_t-
+sized version count, and assumes it does not wrap during the time any
+given operation is active.  This seems reasonably safe on 32-bit hardware,
+and very safe on 64-bit hardware.) If a fully lock-free implementation
+is used, the macro AO_STACK_IS_LOCK_FREE will be defined.
+
+The implementation is interesting only because it allows reuse of
+existing nodes.  This is necessary, for example, to implement a memory
+allocator.
+
+Since we want to leave the precise stack node type up to the client,
+we insist only that each stack node contains a link field of type AO_t.
+When a new node is pushed on the stack, the push operation expects to be
+passed the pointer to this link field, which will then be overwritten by
+this link field.  Similarly, the pop operation returns a pointer to the
+link field of the object that previously was on the top of the stack.
+
+The cleanest way to use these routines is probably to define the stack node
+type with an initial AO_t link field, so that the conversion between the
+link-field pointer and the stack element pointer is just a compile-time
+cast.  But other possibilities exist.  (This would be cleaner in C++ with
+templates.)
+
+A stack is represented by an AO_stack_t structure.  (This is normally
+2 or 3 times the size of a pointer.)  It may be statically initialized
+by setting it to AO_STACK_INITIALIZER, or dynamically initialized to
+an empty stack with AO_stack_init.  There are only three operations for
+accessing stacks:
+
+void AO_stack_init(AO_stack_t *list);
+void AO_stack_push_release(AO_stack_t *list, AO_t *new_element);
+AO_t * AO_stack_pop_acquire(volatile AO_stack_t *list);
+
+We require that the objects pushed as list elements remain addressable
+as long as any push or pop operation are in progress.  (It is OK for an object
+to be "pop"ped off a stack and "deallocated" with a concurrent "pop" on
+the same stack still in progress, but only if "deallocation" leaves the
+object addressable.  The second "pop" may still read the object, but
+the value it reads will not matter.)
+
+We require that the headers (AO_stack objects) remain allocated and
+valid as long as any operations on them are still in-flight.
+
+We also provide macros AO_REAL_HEAD_PTR that converts an AO_stack_t
+to a pointer to the link field in the next element, and AO_REAL_NEXT_PTR
+that converts a link field to a real, dereferencable, pointer to the link field
+in the next element.  This is intended only for debugging, or to traverse
+the list after modification has ceased.  There is otherwise no guarantee that
+walking a stack using this macro will produce any kind of consistent
+picture of the data structure.
diff --git a/libatomic_ops/doc/README_win32.txt b/libatomic_ops/doc/README_win32.txt
new file mode 100644 (file)
index 0000000..0fe6f88
--- /dev/null
@@ -0,0 +1,28 @@
+Most of the atomic_ops functionality is available under Win32 with
+the Microsoft tools, but the build process currently is considerably more
+primitive than on Linux/Unix platforms.
+
+To build:
+
+1) Go to the src directory in the distribution.
+2) Make sure the Microsoft command-line tools (e.g. nmake) are available.
+3) Run "nmake -f Makefile.msft".  This should run some tests, which
+may print warnings about the types of the "Interlocked" functions.
+I haven't been able to make all versions of VC++ happy.  If you know
+how to, please send a patch.
+4) To compile applications, you will need to retain or copy the following
+pieces from the resulting src directory contents:
+       "atomic_ops.h" - Header file defining low-level primitives.  This
+                        includes files from:
+       "atomic_ops"- Subdirectory containing implementation header files.
+       "atomic_ops_stack.h" - Header file describing almost lock-free stack.
+       "atomic_ops_malloc.h" - Header file describing almost lock-free malloc.
+       "libatomic_ops_gpl.lib" - Library containing implementation of the
+                                 above two.  The atomic_ops.h implementation
+                                 is entirely in the header files in Win32.
+
+Most clients of atomic_ops.h will need to define AO_ASSUME_WINDOWS98 before
+including it.  Compare_and_swap is otherwise not available.
+
+Note that the library is covered by the GNU General Public License, while
+the top 2 of these pieces allow use in proprietary code.
diff --git a/libatomic_ops/install-sh b/libatomic_ops/install-sh
new file mode 100755 (executable)
index 0000000..d4744f0
--- /dev/null
@@ -0,0 +1,269 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+#
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# 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
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+       -c) instcmd="$cpprog"
+           shift
+           continue;;
+
+       -d) dir_arg=true
+           shift
+           continue;;
+
+       -m) chmodcmd="$chmodprog $2"
+           shift
+           shift
+           continue;;
+
+       -o) chowncmd="$chownprog $2"
+           shift
+           shift
+           continue;;
+
+       -g) chgrpcmd="$chgrpprog $2"
+           shift
+           shift
+           continue;;
+
+       -s) stripcmd="$stripprog"
+           shift
+           continue;;
+
+       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+           shift
+           continue;;
+
+       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+           shift
+           continue;;
+
+       *)  if [ x"$src" = x ]
+           then
+               src=$1
+           else
+               # this colon is to work around a 386BSD /bin/sh bug
+               :
+               dst=$1
+           fi
+           shift
+           continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+       echo "install:  no input file specified"
+       exit 1
+else
+       true
+fi
+
+if [ x"$dir_arg" != x ]; then
+       dst=$src
+       src=""
+       
+       if [ -d $dst ]; then
+               instcmd=:
+               chmodcmd=""
+       else
+               instcmd=mkdir
+       fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+       if [ -f $src -o -d $src ]
+       then
+               true
+       else
+               echo "install:  $src does not exist"
+               exit 1
+       fi
+       
+       if [ x"$dst" = x ]
+       then
+               echo "install:  no destination specified"
+               exit 1
+       else
+               true
+       fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+       if [ -d $dst ]
+       then
+               dst="$dst"/`basename $src`
+       else
+               true
+       fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='   
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+       pathcomp="${pathcomp}${1}"
+       shift
+
+       if [ ! -d "${pathcomp}" ] ;
+        then
+               $mkdirprog "${pathcomp}"
+       else
+               true
+       fi
+
+       pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+       $doit $instcmd $dst &&
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+       if [ x"$transformarg" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               dstfile=`basename $dst $transformbasename | 
+                       sed $transformarg`$transformbasename
+       fi
+
+# don't allow the sed command to completely eliminate the filename
+
+       if [ x"$dstfile" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               true
+       fi
+
+# Make a temp file name in the proper directory.
+
+       dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+       $doit $instcmd $src $dsttmp &&
+
+       trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+       $doit $rmcmd -f $dstdir/$dstfile &&
+       $doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff --git a/libatomic_ops/missing b/libatomic_ops/missing
new file mode 100755 (executable)
index 0000000..dd58370
--- /dev/null
@@ -0,0 +1,336 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing 0.4 - GNU automake"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal*)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1Help2man' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+       # We have makeinfo, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  tar)
+    shift
+    if test -n "$run"; then
+      echo 1>&2 "ERROR: \`tar' requires --run"
+      exit 1
+    fi
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar ${1+"$@"} && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar ${1+"$@"} && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" ${1+"$@"} && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" ${1+"$@"} && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/libatomic_ops/mkinstalldirs b/libatomic_ops/mkinstalldirs
new file mode 100755 (executable)
index 0000000..4f58503
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+         errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/libatomic_ops/src/Makefile.am b/libatomic_ops/src/Makefile.am
new file mode 100644 (file)
index 0000000..7ca41ff
--- /dev/null
@@ -0,0 +1,16 @@
+SUBDIRS=atomic_ops
+
+AM_CFLAGS=@PICFLAG@
+
+include_HEADERS=atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h
+lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a
+if NEED_ASM
+libatomic_ops_a_SOURCES = atomic_ops.c atomic_ops_sysdeps.S
+else
+libatomic_ops_a_SOURCES = atomic_ops.c
+endif
+
+libatomic_ops_gpl_a_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c
+
+EXTRA_DIST=Makefile.msft
+
diff --git a/libatomic_ops/src/Makefile.in b/libatomic_ops/src/Makefile.in
new file mode 100644 (file)
index 0000000..81e8023
--- /dev/null
@@ -0,0 +1,597 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(libatomic_ops_a_SOURCES) $(libatomic_ops_gpl_a_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(srcdir)/config.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libatomic_ops_a_AR = $(AR) $(ARFLAGS)
+libatomic_ops_a_LIBADD =
+am__libatomic_ops_a_SOURCES_DIST = atomic_ops.c atomic_ops_sysdeps.S
+@NEED_ASM_FALSE@am_libatomic_ops_a_OBJECTS = atomic_ops.$(OBJEXT)
+@NEED_ASM_TRUE@am_libatomic_ops_a_OBJECTS = atomic_ops.$(OBJEXT) \
+@NEED_ASM_TRUE@        atomic_ops_sysdeps.$(OBJEXT)
+libatomic_ops_a_OBJECTS = $(am_libatomic_ops_a_OBJECTS)
+libatomic_ops_gpl_a_AR = $(AR) $(ARFLAGS)
+libatomic_ops_gpl_a_LIBADD =
+am_libatomic_ops_gpl_a_OBJECTS = atomic_ops_stack.$(OBJEXT) \
+       atomic_ops_malloc.$(OBJEXT)
+libatomic_ops_gpl_a_OBJECTS = $(am_libatomic_ops_gpl_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libatomic_ops_a_SOURCES) $(libatomic_ops_gpl_a_SOURCES)
+DIST_SOURCES = $(am__libatomic_ops_a_SOURCES_DIST) \
+       $(libatomic_ops_gpl_a_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NEED_ASM_FALSE = @NEED_ASM_FALSE@
+NEED_ASM_TRUE = @NEED_ASM_TRUE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PICFLAG = @PICFLAG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+SUBDIRS = atomic_ops
+AM_CFLAGS = @PICFLAG@
+include_HEADERS = atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h
+lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a
+@NEED_ASM_FALSE@libatomic_ops_a_SOURCES = atomic_ops.c
+@NEED_ASM_TRUE@libatomic_ops_a_SOURCES = atomic_ops.c atomic_ops_sysdeps.S
+libatomic_ops_gpl_a_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c
+EXTRA_DIST = Makefile.msft
+all: config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .S .c .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+config.h: stamp-h1
+       @if test ! -f $@; then \
+         rm -f stamp-h1; \
+         $(MAKE) stamp-h1; \
+       else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+       @rm -f stamp-h1
+       cd $(top_builddir) && $(SHELL) ./config.status src/config.h
+$(srcdir)/config.h.in:  $(am__configure_deps) 
+       cd $(top_srcdir) && $(AUTOHEADER)
+       rm -f stamp-h1
+       touch $@
+
+distclean-hdr:
+       -rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+           $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+       @$(POST_INSTALL)
+       @list='$(lib_LIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           p=$(am__strip_dir) \
+           echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+           $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+         else :; fi; \
+       done
+
+uninstall-libLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+         rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+
+clean-libLIBRARIES:
+       -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libatomic_ops.a: $(libatomic_ops_a_OBJECTS) $(libatomic_ops_a_DEPENDENCIES) 
+       -rm -f libatomic_ops.a
+       $(libatomic_ops_a_AR) libatomic_ops.a $(libatomic_ops_a_OBJECTS) $(libatomic_ops_a_LIBADD)
+       $(RANLIB) libatomic_ops.a
+libatomic_ops_gpl.a: $(libatomic_ops_gpl_a_OBJECTS) $(libatomic_ops_gpl_a_DEPENDENCIES) 
+       -rm -f libatomic_ops_gpl.a
+       $(libatomic_ops_gpl_a_AR) libatomic_ops_gpl.a $(libatomic_ops_gpl_a_OBJECTS) $(libatomic_ops_gpl_a_LIBADD)
+       $(RANLIB) libatomic_ops_gpl.a
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops_malloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops_stack.Po@am__quote@
+
+.S.o:
+       $(CCASCOMPILE) -c $<
+
+.S.obj:
+       $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-includeHEADERS: $(include_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+       @list='$(include_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+         $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+       done
+
+uninstall-includeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(include_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+         rm -f "$(DESTDIR)$(includedir)/$$f"; \
+       done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @set fnord $$MAKEFLAGS; amf=$$2; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @set fnord $$MAKEFLAGS; amf=$$2; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LIBRARIES) $(HEADERS) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-exec-am: install-libLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-info-am \
+       uninstall-libLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+       clean clean-generic clean-libLIBRARIES clean-recursive ctags \
+       ctags-recursive distclean distclean-compile distclean-generic \
+       distclean-hdr distclean-recursive distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-exec install-exec-am \
+       install-includeHEADERS install-info install-info-am \
+       install-libLIBRARIES install-man install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic maintainer-clean-recursive \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+       uninstall uninstall-am uninstall-includeHEADERS \
+       uninstall-info-am uninstall-libLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libatomic_ops/src/Makefile.msft b/libatomic_ops/src/Makefile.msft
new file mode 100644 (file)
index 0000000..5b93d27
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2003-2005 Hewlett-Packard Developlment Company, L.P.
+# 
+# The really trivial win32/VC++ Makefile.  Note that atomic_ops.c isn't useful.
+# And we rely on a pre-built test_atomic_include.h and generalize-small.h,
+# since we can't rely on sed.
+# Win32 clients only need to include the header files.
+# To install, copy atomic_ops.h and the atomic_ops/... tree to your favorite
+# include directory.
+
+#MY_CPU=X86
+#CPU=$(MY_CPU)
+#!include <ntwin32.mak>
+
+LIB_OBJS=atomic_ops_stack.obj atomic_ops_malloc.obj
+
+all: check
+
+atomic_ops_stack.obj:
+       cl -O2 -c -DAO_ASSUME_WINDOWS98 atomic_ops_stack.c
+
+atomic_ops_malloc.obj:
+       cl -O2 -c -DAO_ASSUME_WINDOWS98 atomic_ops_malloc.c
+
+test_atomic: ..\tests\test_atomic.c ..\tests\test_atomic_include.h
+       cl -O2 -I. -DAO_ASSUME_WINDOWS98 ..\tests\test_atomic.c -o test_atomic
+
+test_atomic_w95: ..\tests\test_atomic.c ..\tests\test_atomic_include.h
+       cl -O2 -I. ..\tests\test_atomic.c -o test_atomic_w95
+
+test_malloc: ..\tests\test_malloc.c ..\tests\test_atomic_include.h \
+            libatomic_ops_gpl.lib 
+       cl -O2 -DAO_ASSUME_WINDOWS98 -I. ..\tests\test_malloc.c -o test_malloc libatomic_ops_gpl.lib
+
+libatomic_ops_gpl.lib: $(LIB_OBJS)
+       lib /MACHINE:i386 /out:libatomic_ops_gpl.lib $(LIB_OBJS)
+
+check:  test_atomic test_atomic_w95 test_malloc
+       echo The following will print lots of \"Missing ...\" messages.
+       test_atomic_w95
+       echo The following will print some \"Missing ...\" messages.
+       test_atomic
+       test_malloc
+
+
diff --git a/libatomic_ops/src/atomic_ops.c b/libatomic_ops/src/atomic_ops.c
new file mode 100644 (file)
index 0000000..f01b8d2
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/*
+ * Initialized data and out-of-line functions to support atomic_ops.h
+ * go here.  Currently this is needed only for pthread-based atomics
+ * emulation, or for compare-and-swap emulation.
+ * Pthreads emulation isn't useful on a native Windows platform, and
+ * cas emulation is not needed.  Thus we skip this on Windows.
+ */
+
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
+#endif
+
+#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__BORLANDC__)
+
+#undef AO_REQUIRE_CAS
+
+#include <pthread.h>
+#include <signal.h>
+#ifdef _HPUX_SOURCE
+# include <sys/time.h>
+#else
+# include <sys/select.h>
+#endif
+#include "atomic_ops.h"  /* Without cas emulation! */
+
+#ifndef AO_HAVE_double_t
+# include "atomic_ops/sysdeps/standard_ao_double_t.h"
+#endif
+
+/*
+ * Lock for pthreads-based implementation.
+ */
+
+pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/*
+ * Out of line compare-and-swap emulation based on test and set.
+ * 
+ * We use a small table of locks for different compare_and_swap locations.
+ * Before we update perform a compare-and-swap, we grap the corresponding
+ * lock.  Different locations may hash to the same lock, but since we
+ * never acquire more than one lock at a time, this can't deadlock.
+ * We explicitly disable signals while we perform this operation.
+ *
+ * FIXME: We should probably also suppport emulation based on Lamport
+ * locks, since we may not have test_and_set either.
+ */
+#define AO_HASH_SIZE 16
+
+#define AO_HASH(x) (((unsigned long)(x) >> 12) & (AO_HASH_SIZE-1))
+
+AO_TS_t AO_locks[AO_HASH_SIZE] = {
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+       AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+};
+
+static AO_T dummy = 1;
+
+/* Spin for 2**n units. */
+void AO_spin(int n)
+{
+  int i;
+  AO_T j = AO_load(&dummy);
+
+  for (i = 0; i < (2 << n); ++i)
+    {
+       j *= 5;
+       j -= 4;
+    }
+  AO_store(&dummy, j);
+}
+
+void AO_pause(int n)
+{
+    if (n < 12)
+      AO_spin(n);
+    else
+      {
+        struct timeval tv;
+
+       /* Short async-signal-safe sleep. */
+       tv.tv_sec = 0;
+       tv.tv_usec = (n > 28? 100000 : (1 << (n - 12)));
+       select(0, 0, 0, 0, &tv);
+      }
+}
+
+static void lock_ool(volatile AO_TS_t *l)
+{
+  int i = 0;
+
+  while (AO_test_and_set_acquire(l) == AO_TS_SET)
+    AO_pause(++i);
+}
+
+AO_INLINE void lock(volatile AO_TS_t *l)
+{
+  if (AO_test_and_set_acquire(l) == AO_TS_SET)
+    lock_ool(l);
+}
+
+AO_INLINE void unlock(volatile AO_TS_t *l)
+{
+  AO_CLEAR(l);
+}
+
+static sigset_t all_sigs;
+
+static volatile AO_t initialized = 0;
+
+static volatile AO_TS_t init_lock = AO_TS_INITIALIZER;
+
+int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old,
+                                 AO_t new_val)
+{
+  AO_TS_t *my_lock = AO_locks + AO_HASH(addr);
+  sigset_t old_sigs;
+  int result;
+
+  if (!AO_load_acquire(&initialized))
+    {
+      lock(&init_lock);
+      if (!initialized) sigfillset(&all_sigs);
+      unlock(&init_lock);
+      AO_store_release(&initialized, 1);
+    }
+  sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs);
+       /* Neither sigprocmask nor pthread_sigmask is 100%      */
+       /* guaranteed to work here.  Sigprocmask is not         */
+       /* guaranteed be thread safe, and pthread_sigmask       */
+       /* is not async-signal-safe.  Under linuxthreads,       */
+       /* sigprocmask may block some pthreads-internal         */
+       /* signals.  So long as we do that for short periods,   */
+       /* we should be OK.                                     */
+  lock(my_lock);
+  if (*addr == old)
+    {
+      *addr = new_val;
+      result = 1;
+    }
+  else
+    result = 0;
+  unlock(my_lock);
+  sigprocmask(SIG_SETMASK, &old_sigs, NULL);
+  return result;
+}
+
+int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr,
+                                               AO_t old_val1, AO_t old_val2,
+                                               AO_t new_val1, AO_t new_val2)
+{
+  AO_TS_t *my_lock = AO_locks + AO_HASH(addr);
+  sigset_t old_sigs;
+  int result;
+
+  if (!AO_load_acquire(&initialized))
+    {
+      lock(&init_lock);
+      if (!initialized) sigfillset(&all_sigs);
+      unlock(&init_lock);
+      AO_store_release(&initialized, 1);
+    }
+  sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs);
+       /* Neither sigprocmask nor pthread_sigmask is 100%      */
+       /* guaranteed to work here.  Sigprocmask is not         */
+       /* guaranteed be thread safe, and pthread_sigmask       */
+       /* is not async-signal-safe.  Under linuxthreads,       */
+       /* sigprocmask may block some pthreads-internal         */
+       /* signals.  So long as we do that for short periods,   */
+       /* we should be OK.                                     */
+  lock(my_lock);
+  if (addr -> AO_val1 == old_val1 && addr -> AO_val2 == old_val2)
+    {
+      addr -> AO_val1 = new_val1;
+      addr -> AO_val2 = new_val2;
+      result = 1;
+    }
+  else
+    result = 0;
+  unlock(my_lock);
+  sigprocmask(SIG_SETMASK, &old_sigs, NULL);
+  return result;
+}
+
+void AO_store_full_emulation(volatile AO_t *addr, AO_t val)
+{
+  AO_TS_t *my_lock = AO_locks + AO_HASH(addr);
+  lock(my_lock);
+  *addr = val;
+  unlock(my_lock);
+}
+
+#else /* Non-posix platform */
+
+int AO_non_posix_implementation_is_entirely_in_headers;
+
+#endif
diff --git a/libatomic_ops/src/atomic_ops.h b/libatomic_ops/src/atomic_ops.h
new file mode 100755 (executable)
index 0000000..a77bfd6
--- /dev/null
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */ 
+
+#ifndef ATOMIC_OPS_H
+
+#define ATOMIC_OPS_H
+
+#include <assert.h>
+
+/* We define various atomic operations on memory in a          */
+/* machine-specific way.  Unfortunately, this is complicated   */
+/* by the fact that these may or may not be combined with      */
+/* various memory barriers.  Thus the actual operations we     */
+/* define have the form AO_<atomic-op>_<barrier>, for all      */
+/* plausible combinations of <atomic-op> and <barrier>.                */
+/* This of course results in a mild combinatorial explosion.   */
+/* To deal with it, we try to generate derived                 */
+/* definitions for as many of the combinations as we can, as   */
+/* automatically as possible.                                  */
+/*                                                             */
+/* Our assumption throughout is that the programmer will       */
+/* specify the least demanding operation and memory barrier    */
+/* that will guarantee correctness for the implementation.     */
+/* Our job is to find the least expensive way to implement it  */
+/* on the applicable hardware.  In many cases that will        */
+/* involve, for example, a stronger memory barrier, or a       */
+/* combination of hardware primitives.                         */
+/*                                                             */
+/* Conventions:                                                        */
+/* "plain" atomic operations are not guaranteed to include     */
+/* a barrier.  The suffix in the name specifies the barrier    */
+/* type.  Suffixes are:                                                */
+/* _release: Earlier operations may not be delayed past it.    */
+/* _acquire: Later operations may not move ahead of it.                */
+/* _read: Subsequent reads must follow this operation and      */
+/*       preceding reads.                                      */
+/* _write: Earlier writes precede both this operation and      */
+/*       later writes.                                         */
+/* _full: Ordered with respect to both earlier and later memops.*/
+/* _release_write: Ordered with respect to earlier writes.     */
+/* _acquire_read: Ordered with repsect to later reads.         */
+/*                                                             */
+/* Currently we try to define the following atomic memory      */
+/* operations, in combination with the above barriers:         */
+/* AO_nop                                                      */
+/* AO_load                                                     */
+/* AO_store                                                    */
+/* AO_test_and_set (binary)                                    */
+/* AO_fetch_and_add                                            */
+/* AO_fetch_and_add1                                           */
+/* AO_fetch_and_sub1                                           */
+/* AO_or                                                       */
+/* AO_compare_and_swap                                         */
+/*                                                             */
+/* Note that atomicity guarantees are valid only if both       */
+/* readers and writers use AO_ operations to access the        */
+/* shared value, while ordering constraints are intended to    */
+/* apply all memory operations.         If a location can potentially  */
+/* be accessed simultaneously from multiple threads, and one of        */
+/* those accesses may be a write access, then all such         */
+/* accesses to that location should be through AO_ primitives. */
+/* However if AO_ operations enforce sufficient ordering to    */
+/* ensure that a location x cannot be accessed concurrently,   */
+/* or can only be read concurrently, then x can be accessed    */
+/* via ordinary references and assignments.                    */
+/*                                                             */
+/* Compare_and_exchange takes an address and an expected old   */
+/* value and a new value, and returns an int.  Nonzero                 */
+/* indicates that it succeeded.                                        */
+/* Test_and_set takes an address, atomically replaces it by    */
+/* AO_TS_SET, and returns the prior value.                     */
+/* An AO_TS_t clear location can be reset with the             */
+/* AO_CLEAR macro, which normally uses AO_store_release.       */
+/* AO_fetch_and_add takes an address and an AO_t increment     */
+/* value.  The AO_fetch_and_add1 and AO_fetch_and_sub1 variants        */
+/* are provided, since they allow faster implementations on    */
+/* some hardware. AO_or atomically ors an AO_t value into a    */
+/* memory location, but does not provide access to the original.*/
+/*                                                             */
+/* We expect this list to grow slowly over time.               */
+/*                                                             */
+/* Note that AO_nop_full is a full memory barrier.             */
+/*                                                             */
+/* Note that if some data is initialized with                  */
+/*     data.x = ...; data.y = ...; ...                         */
+/*     AO_store_release_write(&data_is_initialized, 1)         */
+/* then data is guaranteed to be initialized after the test    */
+/*     if (AO_load_release_read(&data_is_initialized)) ...     */
+/* succeeds.  Furthermore, this should generate near-optimal   */
+/* code on all common platforms.                               */
+/*                                                             */
+/* All operations operate on unsigned AO_t, which              */
+/* is the natural word size, and usually unsigned long.                */
+/* It is possible to check whether a particular operation op   */
+/* is available on a particular platform by checking whether   */
+/* AO_HAVE_op is defined.  We make heavy use of these macros   */
+/* internally.                                                 */
+
+/* The rest of this file basically has three sections:         */
+/*                                                             */
+/* Some utility and default definitions.                       */
+/*                                                             */
+/* The architecture dependent section:                         */
+/* This defines atomic operations that have direct hardware    */
+/* support on a particular platform, mostly by uncluding the   */
+/* appropriate compiler- and hardware-dependent file.                  */
+/*                                                             */
+/* The synthesis section:                                      */
+/* This tries to define other atomic operations in terms of    */
+/* those that are explicitly available on the platform.                */
+/* This section is hardware independent.                       */
+/* We make no attempt to synthesize operations in ways that    */
+/* effectively introduce locks, except for the debugging/demo  */
+/* pthread-based implementation at the beginning.  A more      */
+/* relistic implementation that falls back to locks could be   */
+/* added as a higher layer.  But that would sacrifice          */
+/* usability from signal handlers.                             */
+/* The synthesis section is implemented almost entirely in     */
+/* atomic_ops_generalize.h.                                    */
+
+/* Some common defaults.  Overridden for some architectures.   */
+#define AO_t unsigned long
+       /* Could conceivably be redefined below if/when we add  */
+       /* win64 support.                                       */
+
+/* The test_and_set primitive returns an AO_TS_VAL_t value.    */
+/* AO_TS_t is the type of an in-memory test-and-set location.  */
+
+#define AO_TS_INITIALIZER (AO_t)AO_TS_CLEAR
+
+/* Platform-dependent stuff:                                   */
+#if defined(__GNUC__) || defined(_MSC_VER) || defined(__INTEL_COMPILER)
+# define AO_INLINE static __inline
+#else
+# define AO_INLINE static
+#endif
+
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+# define AO_compiler_barrier() __asm__ __volatile__("" : : : "memory")
+#elif defined(_MSC_VER)
+# define AO_compiler_barrier() __asm { }
+#elif defined(__INTEL_COMPILER)
+# define AO_compiler_barrier() __memory_barrier() /* Too strong? IA64-only? */
+#elif defined(_HPUX_SOURCE)
+# if defined(__ia64)
+#   include <machine/sys/inline.h>
+#   define AO_compiler_barrier() _Asm_sched_fence()
+# else
+    /* FIXME - We dont know how to do this.  This is a guess.  */
+    /* And probably a bad one.                                 */
+    static volatile int AO_barrier_dummy;
+#   define AO_compiler_barrier() AO_barrier_dummy = AO_barrier_dummy
+# endif
+#else
+  /* We conjecture that the following usually gives us the right       */
+  /* semantics or an error.                                            */
+# define AO_compiler_barrier() asm("")
+#endif
+
+#if defined(AO_USE_PTHREAD_DEFS)
+# include "atomic_ops/sysdeps/generic_pthread.h"
+#endif /* AO_USE_PTHREAD_DEFS */
+
+#if defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS) \
+    && !defined(__INTEL_COMPILER)
+# if defined(__i386__)
+#   include "atomic_ops/sysdeps/gcc/x86.h"
+# endif /* __i386__ */
+# if defined(__x86_64__)
+#   include "atomic_ops/sysdeps/gcc/x86_64.h"
+# endif /* __i386__ */
+# if defined(__ia64__)
+#   include "atomic_ops/sysdeps/gcc/ia64.h"
+#   define AO_GENERALIZE_TWICE
+# endif /* __ia64__ */
+# if defined(__hppa__)
+#   include "atomic_ops/sysdeps/gcc/hppa.h"
+#   define AO_CAN_EMUL_CAS
+# endif /* __hppa__ */
+# if defined(__alpha__)
+#   include "atomic_ops/sysdeps/gcc/alpha.h"
+#   define AO_GENERALIZE_TWICE
+# endif /* __alpha__ */
+# if defined(__s390__)
+#   include "atomic_ops/sysdeps/gcc/s390.h"
+# endif /* __s390__ */
+# if defined(__sparc__)
+#   include "atomic_ops/sysdeps/gcc/sparc.h"
+#   define AO_CAN_EMUL_CAS
+# endif /* __sparc__ */
+# if defined(__m68k__)
+#   include "atomic_ops/sysdeps/gcc/m68k.h"
+# endif /* __m68k__ */
+# if defined(__powerpc__) || defined(__ppc__)
+#   include "atomic_ops/sysdeps/gcc/powerpc.h"
+# endif /* __powerpc__ */
+# if defined(__arm__) && !defined(AO_USE_PTHREAD_DEFS)
+#   include "atomic_ops/sysdeps/gcc/arm.h"
+# endif /* __arm__ */
+# if defined(__cris__) || defined(CRIS)
+#   include "atomic_ops/sysdeps/gcc/cris.h"
+# endif
+#endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
+
+#if defined(__INTEL_COMPILER) && !defined(AO_USE_PTHREAD_DEFS)
+# if defined(__ia64__)
+#   include "atomic_ops/sysdeps/icc/ia64.h"
+#   define AO_GENERALIZE_TWICE
+# endif
+#endif
+
+#if defined(_HPUX_SOURCE) && !defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS)
+# if defined(__ia64)
+#   include "atomic_ops/sysdeps/hpc/ia64.h"
+#   define AO_GENERALIZE_TWICE
+# else
+#   include "atomic_ops/sysdeps/hpc/hppa.h"
+#   define AO_CAN_EMUL_CAS
+# endif
+#endif
+
+#if !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) \
+    && !defined(AO_USE_PTHREAD_DEFS)
+#   include "atomic_ops/sysdeps/sunc/sparc.h"
+#   define AO_CAN_EMUL_CAS
+#endif
+
+#if defined(_MSC_VER)
+# if _M_IX86 >= 400
+#   include "atomic_ops/sysdeps/msftc/x86.h"
+# endif
+#endif
+
+#if defined(AO_REQUIRE_CAS) && !defined(AO_HAVE_compare_and_swap) \
+    && !defined(AO_HAVE_compare_and_swap_full) \
+    && !defined(AO_HAVE_compare_and_swap_acquire)
+# if defined(AO_CAN_EMUL_CAS)
+#   include "atomic_ops/sysdeps/emul_cas.h"
+# else
+#  error Cannot implement AO_compare_and_swap_full on this architecture.
+# endif
+#endif         /* AO_REQUIRE_CAS && !AO_HAVE_compare_and_swap ... */
+
+/* The most common way to clear a test-and-set location                */
+/* at the end of a critical section.                           */
+#if AO_AO_TS_T && !defined(AO_CLEAR)
+# define AO_CLEAR(addr) AO_store_release((AO_TS_t *)addr, AO_TS_CLEAR)
+#endif
+#if AO_CHAR_TS_T && !defined(AO_CLEAR)
+# define AO_CLEAR(addr) AO_char_store_release((AO_TS_t *)addr, AO_TS_CLEAR)
+#endif
+
+/*
+ * The generalization section.
+ * Theoretically this should repeatedly include atomic_ops_generalize.h.
+ * In fact, we observe that this converges after a small fixed number
+ * of iterations, usually one.
+ */
+#include "atomic_ops/generalize.h"
+#ifdef AO_GENERALIZE_TWICE
+# include "atomic_ops/generalize.h"
+#endif
+
+/* For compatibility with version 0.4 and earlier      */
+#define AO_TS_T AO_TS_t
+#define AO_T AO_t
+#define AO_TS_VAL AO_TS_VAL_t
+
+#endif /* ATOMIC_OPS_H */
diff --git a/libatomic_ops/src/atomic_ops/Makefile.am b/libatomic_ops/src/atomic_ops/Makefile.am
new file mode 100644 (file)
index 0000000..a710df0
--- /dev/null
@@ -0,0 +1,12 @@
+SUBDIRS=sysdeps
+
+EXTRA_DIST=generalize-small.template
+
+#Private Headers
+private_HEADERS=generalize.h generalize-small.h
+privatedir=${includedir}/atomic_ops/
+
+generalize-small.h: generalize-small.template
+       sed -e s:XSIZE:byte:g -e s:XCTYPE:char:g $? > $@
+       sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@
+       sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@
diff --git a/libatomic_ops/src/atomic_ops/Makefile.in b/libatomic_ops/src/atomic_ops/Makefile.in
new file mode 100644 (file)
index 0000000..d236333
--- /dev/null
@@ -0,0 +1,480 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src/atomic_ops
+DIST_COMMON = $(private_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(privatedir)"
+privateHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(private_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NEED_ASM_FALSE = @NEED_ASM_FALSE@
+NEED_ASM_TRUE = @NEED_ASM_TRUE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PICFLAG = @PICFLAG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+SUBDIRS = sysdeps
+EXTRA_DIST = generalize-small.template
+
+#Private Headers
+private_HEADERS = generalize.h generalize-small.h
+privatedir = ${includedir}/atomic_ops/
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/atomic_ops/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  src/atomic_ops/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-privateHEADERS: $(private_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(privatedir)" || $(mkdir_p) "$(DESTDIR)$(privatedir)"
+       @list='$(private_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(privateHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(privatedir)/$$f'"; \
+         $(privateHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(privatedir)/$$f"; \
+       done
+
+uninstall-privateHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(private_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(privatedir)/$$f'"; \
+         rm -f "$(DESTDIR)$(privatedir)/$$f"; \
+       done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @set fnord $$MAKEFLAGS; amf=$$2; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @set fnord $$MAKEFLAGS; amf=$$2; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(privatedir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-privateHEADERS
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-privateHEADERS
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+       clean clean-generic clean-recursive ctags ctags-recursive \
+       distclean distclean-generic distclean-recursive distclean-tags \
+       distdir dvi dvi-am html html-am info info-am install \
+       install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-privateHEADERS install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic maintainer-clean-recursive \
+       mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
+       pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+       uninstall-info-am uninstall-privateHEADERS
+
+
+generalize-small.h: generalize-small.template
+       sed -e s:XSIZE:byte:g -e s:XCTYPE:char:g $? > $@
+       sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@
+       sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libatomic_ops/src/atomic_ops/generalize-small.h b/libatomic_ops/src/atomic_ops/generalize-small.h
new file mode 100644 (file)
index 0000000..4e45a0d
--- /dev/null
@@ -0,0 +1,1725 @@
+/* char_load */
+#if defined(AO_HAVE_char_load_acquire) && !defined(AO_HAVE_char_load)
+#  define AO_char_load(addr) AO_char_load_acquire(addr)
+#  define AO_HAVE_char_load
+#endif
+
+#if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_acquire)
+#  define AO_char_load_acquire(addr) AO_char_load_full(addr)
+#  define AO_HAVE_char_load_acquire
+#endif
+
+#if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_read)
+#  define AO_char_load_read(addr) AO_char_load_full(addr)
+#  define AO_HAVE_char_load_read
+#endif
+
+#if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_acquire)
+#  define AO_char_load_acquire_read(addr) AO_char_load_acquire(addr)
+#  define AO_HAVE_char_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_char_load_acquire)
+   AO_INLINE unsigned char
+   AO_char_load_acquire(volatile unsigned char *addr)
+   {
+     unsigned char result = AO_char_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_char_load_acquire
+#endif
+
+#if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_read) && \
+    !defined(AO_HAVE_char_load_read)
+   AO_INLINE unsigned char
+   AO_char_load_read(volatile unsigned char *addr)
+   {
+     unsigned char result = AO_char_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_read();
+     return result;
+   }
+#  define AO_HAVE_char_load_read
+#endif
+
+#if defined(AO_HAVE_char_load_acquire) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_char_load_full)
+#  define AO_char_load_full(addr) (AO_nop_full(), AO_char_load_acquire(addr))
+#  define AO_HAVE_char_load_full
+#endif
+#if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_read)
+#  define AO_char_load_acquire_read(addr) AO_char_load_read(addr)
+#  define AO_HAVE_char_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_char_load_acquire_read) && !defined(AO_HAVE_char_load)
+#  define AO_char_load(addr) AO_char_load_acquire_read(addr)
+#  define AO_HAVE_char_load
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_char_load_acquire_read)
+#    define AO_char_load_dd_acquire_read(addr) \
+       AO_char_load_acquire_read(addr)
+#    define AO_HAVE_char_load_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_char_load)
+#    define AO_char_load_dd_acquire_read(addr) \
+       AO_char_load(addr)
+#    define AO_HAVE_char_load_dd_acquire_read
+#  endif
+#endif
+
+
+/* char_store */
+
+#if defined(AO_HAVE_char_store_release) && !defined(AO_HAVE_char_store)
+#  define AO_char_store(addr, val) AO_char_store_release(addr,val)
+#  define AO_HAVE_char_store
+#endif
+
+#if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_release)
+#  define AO_char_store_release(addr,val) AO_char_store_full(addr,val)
+#  define AO_HAVE_char_store_release
+#endif
+
+#if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_write)
+#  define AO_char_store_write(addr,val) AO_char_store_full(addr,val)
+#  define AO_HAVE_char_store_write
+#endif
+
+#if defined(AO_HAVE_char_store_release) && \
+       !defined(AO_HAVE_char_store_release_write)
+#  define AO_char_store_release_write(addr, val) \
+       AO_char_store_release(addr,val)
+#  define AO_HAVE_char_store_release_write
+#endif
+
+#if defined(AO_HAVE_char_store_write) && !defined(AO_HAVE_char_store)
+#  define AO_char_store(addr, val) AO_char_store_write(addr,val)
+#  define AO_HAVE_char_store
+#endif
+
+#if defined(AO_HAVE_char_store) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_char_store_release)
+#  define AO_char_store_release(addr,val) \
+       (AO_nop_full(), AO_char_store(addr,val))
+#  define AO_HAVE_char_store_release
+#endif
+
+#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_char_store) && \
+     !defined(AO_HAVE_char_store_write)
+#  define AO_char_store_write(addr, val) \
+       (AO_nop_write(), AO_char_store(addr,val))
+#  define AO_HAVE_char_store_write
+#endif
+
+#if defined(AO_HAVE_char_store_write) && \
+     !defined(AO_HAVE_char_store_release_write)
+#  define AO_char_store_release_write(addr, val) AO_char_store_write(addr,val)
+#  define AO_HAVE_char_store_release_write
+#endif
+
+#if defined(AO_HAVE_char_store_release) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_char_store_full)
+#  define AO_char_store_full(addr, val) \
+       (AO_char_store_release(addr, val), AO_nop_full())
+#  define AO_HAVE_char_store_full
+#endif
+
+
+/* char_fetch_and_add */
+#if defined(AO_HAVE_char_compare_and_swap_full) && \
+    !defined(AO_HAVE_char_fetch_and_add_full)
+   AO_INLINE AO_t
+   AO_char_fetch_and_add_full(volatile unsigned char *addr,
+                              unsigned char incr)
+   {
+     unsigned char old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_char_compare_and_swap_full(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_char_fetch_and_add_full
+#endif
+
+#if defined(AO_HAVE_char_compare_and_swap_acquire) && \
+    !defined(AO_HAVE_char_fetch_and_add_acquire)
+   AO_INLINE AO_t
+   AO_char_fetch_and_add_acquire(volatile unsigned char *addr,
+                                 unsigned char incr)
+   {
+     unsigned char old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_char_compare_and_swap_acquire(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_char_fetch_and_add_acquire
+#endif
+
+#if defined(AO_HAVE_char_compare_and_swap_release) && \
+    !defined(AO_HAVE_char_fetch_and_add_release)
+   AO_INLINE AO_t
+   AO_char_fetch_and_add_release(volatile unsigned char *addr,
+                                 unsigned char incr)
+   {
+     unsigned char old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_char_compare_and_swap_release(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_char_fetch_and_add_release
+#endif
+
+#if defined(AO_HAVE_char_fetch_and_add_full)
+#  if !defined(AO_HAVE_char_fetch_and_add_release)
+#    define AO_char_fetch_and_add_release(addr, val) \
+        AO_char_fetch_and_add_full(addr, val)
+#    define AO_HAVE_char_fetch_and_add_release
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_add_acquire)
+#    define AO_char_fetch_and_add_acquire(addr, val) \
+        AO_char_fetch_and_add_full(addr, val)
+#    define AO_HAVE_char_fetch_and_add_acquire
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_add_write)
+#    define AO_char_fetch_and_add_write(addr, val) \
+        AO_char_fetch_and_add_full(addr, val)
+#    define AO_HAVE_char_fetch_and_add_write
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_add_read)
+#    define AO_char_fetch_and_add_read(addr, val) \
+        AO_char_fetch_and_add_full(addr, val)
+#    define AO_HAVE_char_fetch_and_add_read
+#  endif
+#endif /* AO_HAVE_char_fetch_and_add_full */
+
+#if !defined(AO_HAVE_char_fetch_and_add) && \
+    defined(AO_HAVE_char_fetch_and_add_release)
+#  define AO_char_fetch_and_add(addr, val) \
+       AO_char_fetch_and_add_release(addr, val)
+#  define AO_HAVE_char_fetch_and_add
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add) && \
+    defined(AO_HAVE_char_fetch_and_add_acquire)
+#  define AO_char_fetch_and_add(addr, val) \
+       AO_char_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_char_fetch_and_add
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add) && \
+    defined(AO_HAVE_char_fetch_and_add_write)
+#  define AO_char_fetch_and_add(addr, val) \
+       AO_char_fetch_and_add_write(addr, val)
+#  define AO_HAVE_char_fetch_and_add
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add) && \
+    defined(AO_HAVE_char_fetch_and_add_read)
+#  define AO_char_fetch_and_add(addr, val) \
+       AO_char_fetch_and_add_read(addr, val)
+#  define AO_HAVE_char_fetch_and_add
+#endif
+
+#if defined(AO_HAVE_char_fetch_and_add_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_char_fetch_and_add_full)
+#  define AO_char_fetch_and_add_full(addr, val) \
+       (AO_nop_full(), AO_char_fetch_and_add_acquire(addr, val))
+#endif
+
+#if !defined(AO_HAVE_char_fetch_and_add_release_write) && \
+    defined(AO_HAVE_char_fetch_and_add_write)
+#  define AO_char_fetch_and_add_release_write(addr, val) \
+       AO_char_fetch_and_add_write(addr, val)
+#  define AO_HAVE_char_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add_release_write) && \
+    defined(AO_HAVE_char_fetch_and_add_release)
+#  define AO_char_fetch_and_add_release_write(addr, val) \
+       AO_char_fetch_and_add_release(addr, val)
+#  define AO_HAVE_char_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_char_fetch_and_add_read)
+#  define AO_char_fetch_and_add_acquire_read(addr, val) \
+       AO_char_fetch_and_add_read(addr, val)
+#  define AO_HAVE_char_fetch_and_add_acquire_read
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_char_fetch_and_add_acquire)
+#  define AO_char_fetch_and_add_acquire_read(addr, val) \
+       AO_char_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_char_fetch_and_add_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_char_fetch_and_add_acquire_read)
+#    define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_char_fetch_and_add_acquire_read(addr, val)
+#    define AO_HAVE_char_fetch_and_add_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_char_fetch_and_add)
+#    define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_char_fetch_and_add(addr, val)
+#    define AO_HAVE_char_fetch_and_add_dd_acquire_read
+#  endif
+#endif
+  
+/* char_fetch_and_add1 */
+
+#if defined(AO_HAVE_char_fetch_and_add_full) &&\
+    !defined(AO_HAVE_char_fetch_and_add1_full)
+#  define AO_char_fetch_and_add1_full(addr) \
+       AO_char_fetch_and_add_full(addr,1)
+#  define AO_HAVE_char_fetch_and_add1_full
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_release) &&\
+    !defined(AO_HAVE_char_fetch_and_add1_release)
+#  define AO_char_fetch_and_add1_release(addr) \
+       AO_char_fetch_and_add_release(addr,1)
+#  define AO_HAVE_char_fetch_and_add1_release
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_char_fetch_and_add1_acquire)
+#  define AO_char_fetch_and_add1_acquire(addr) \
+       AO_char_fetch_and_add_acquire(addr,1)
+#  define AO_HAVE_char_fetch_and_add1_acquire
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_write) &&\
+    !defined(AO_HAVE_char_fetch_and_add1_write)
+#  define AO_char_fetch_and_add1_write(addr) \
+       AO_char_fetch_and_add_write(addr,1)
+#  define AO_HAVE_char_fetch_and_add1_write
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_read) &&\
+    !defined(AO_HAVE_char_fetch_and_add1_read)
+#  define AO_char_fetch_and_add1_read(addr) \
+       AO_char_fetch_and_add_read(addr,1)
+#  define AO_HAVE_char_fetch_and_add1_read
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_char_fetch_and_add1_release_write)
+#  define AO_char_fetch_and_add1_release_write(addr) \
+       AO_char_fetch_and_add_release_write(addr,1)
+#  define AO_HAVE_char_fetch_and_add1_release_write
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_char_fetch_and_add1_acquire_read)
+#  define AO_char_fetch_and_add1_acquire_read(addr) \
+       AO_char_fetch_and_add_acquire_read(addr,1)
+#  define AO_HAVE_char_fetch_and_add1_acquire_read
+#endif
+#if defined(AO_HAVE_char_fetch_and_add) &&\
+    !defined(AO_HAVE_char_fetch_and_add1)
+#  define AO_char_fetch_and_add1(addr) \
+       AO_char_fetch_and_add(addr,1)
+#  define AO_HAVE_char_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_char_fetch_and_add1_full)
+#  if !defined(AO_HAVE_char_fetch_and_add1_release)
+#    define AO_char_fetch_and_add1_release(addr) \
+        AO_char_fetch_and_add1_full(addr)
+#    define AO_HAVE_char_fetch_and_add1_release
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_add1_acquire)
+#    define AO_char_fetch_and_add1_acquire(addr) \
+        AO_char_fetch_and_add1_full(addr)
+#    define AO_HAVE_char_fetch_and_add1_acquire
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_add1_write)
+#    define AO_char_fetch_and_add1_write(addr) \
+        AO_char_fetch_and_add1_full(addr)
+#    define AO_HAVE_char_fetch_and_add1_write
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_add1_read)
+#    define AO_char_fetch_and_add1_read(addr) \
+        AO_char_fetch_and_add1_full(addr)
+#    define AO_HAVE_char_fetch_and_add1_read
+#  endif
+#endif /* AO_HAVE_char_fetch_and_add1_full */
+
+#if !defined(AO_HAVE_char_fetch_and_add1) && \
+    defined(AO_HAVE_char_fetch_and_add1_release)
+#  define AO_char_fetch_and_add1(addr) \
+       AO_char_fetch_and_add1_release(addr)
+#  define AO_HAVE_char_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add1) && \
+    defined(AO_HAVE_char_fetch_and_add1_acquire)
+#  define AO_char_fetch_and_add1(addr) \
+       AO_char_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_char_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add1) && \
+    defined(AO_HAVE_char_fetch_and_add1_write)
+#  define AO_char_fetch_and_add1(addr) \
+       AO_char_fetch_and_add1_write(addr)
+#  define AO_HAVE_char_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add1) && \
+    defined(AO_HAVE_char_fetch_and_add1_read)
+#  define AO_char_fetch_and_add1(addr) \
+       AO_char_fetch_and_add1_read(addr)
+#  define AO_HAVE_char_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_char_fetch_and_add1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_char_fetch_and_add1_full)
+#  define AO_char_fetch_and_add1_full(addr) \
+       (AO_nop_full(), AO_char_fetch_and_add1_acquire(addr))
+#  define AO_HAVE_char_fetch_and_add1_full
+#endif
+
+#if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_char_fetch_and_add1_write)
+#  define AO_char_fetch_and_add1_release_write(addr) \
+       AO_char_fetch_and_add1_write(addr)
+#  define AO_HAVE_char_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_char_fetch_and_add1_release)
+#  define AO_char_fetch_and_add1_release_write(addr) \
+       AO_char_fetch_and_add1_release(addr)
+#  define AO_HAVE_char_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_char_fetch_and_add1_read)
+#  define AO_char_fetch_and_add1_acquire_read(addr) \
+       AO_char_fetch_and_add1_read(addr)
+#  define AO_HAVE_char_fetch_and_add1_acquire_read
+#endif
+#if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_char_fetch_and_add1_acquire)
+#  define AO_char_fetch_and_add1_acquire_read(addr) \
+       AO_char_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_char_fetch_and_add1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
+#    define AO_char_fetch_and_add1_dd_acquire_read(addr) \
+       AO_char_fetch_and_add1_acquire_read(addr)
+#    define AO_HAVE_char_fetch_and_add1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_char_fetch_and_add1)
+#    define AO_char_fetch_and_add1_dd_acquire_read(addr) \
+       AO_char_fetch_and_add1(addr)
+#    define AO_HAVE_char_fetch_and_add1_dd_acquire_read
+#  endif
+#endif
+
+/* char_fetch_and_sub1 */
+
+#if defined(AO_HAVE_char_fetch_and_add_full) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1_full)
+#  define AO_char_fetch_and_sub1_full(addr) \
+       AO_char_fetch_and_add_full(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1_full
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_release) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1_release)
+#  define AO_char_fetch_and_sub1_release(addr) \
+       AO_char_fetch_and_add_release(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1_release
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1_acquire)
+#  define AO_char_fetch_and_sub1_acquire(addr) \
+       AO_char_fetch_and_add_acquire(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1_acquire
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_write) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1_write)
+#  define AO_char_fetch_and_sub1_write(addr) \
+       AO_char_fetch_and_add_write(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1_write
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_read) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1_read)
+#  define AO_char_fetch_and_sub1_read(addr) \
+       AO_char_fetch_and_add_read(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1_read
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1_release_write)
+#  define AO_char_fetch_and_sub1_release_write(addr) \
+       AO_char_fetch_and_add_release_write(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1_release_write
+#endif
+#if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
+#  define AO_char_fetch_and_sub1_acquire_read(addr) \
+       AO_char_fetch_and_add_acquire_read(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1_acquire_read
+#endif
+#if defined(AO_HAVE_char_fetch_and_add) &&\
+    !defined(AO_HAVE_char_fetch_and_sub1)
+#  define AO_char_fetch_and_sub1(addr) \
+       AO_char_fetch_and_add(addr,(unsigned char)(-1))
+#  define AO_HAVE_char_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_char_fetch_and_sub1_full)
+#  if !defined(AO_HAVE_char_fetch_and_sub1_release)
+#    define AO_char_fetch_and_sub1_release(addr) \
+        AO_char_fetch_and_sub1_full(addr)
+#    define AO_HAVE_char_fetch_and_sub1_release
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_sub1_acquire)
+#    define AO_char_fetch_and_sub1_acquire(addr) \
+        AO_char_fetch_and_sub1_full(addr)
+#    define AO_HAVE_char_fetch_and_sub1_acquire
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_sub1_write)
+#    define AO_char_fetch_and_sub1_write(addr) \
+        AO_char_fetch_and_sub1_full(addr)
+#    define AO_HAVE_char_fetch_and_sub1_write
+#  endif
+#  if !defined(AO_HAVE_char_fetch_and_sub1_read)
+#    define AO_char_fetch_and_sub1_read(addr) \
+        AO_char_fetch_and_sub1_full(addr)
+#    define AO_HAVE_char_fetch_and_sub1_read
+#  endif
+#endif /* AO_HAVE_char_fetch_and_sub1_full */
+
+#if !defined(AO_HAVE_char_fetch_and_sub1) && \
+    defined(AO_HAVE_char_fetch_and_sub1_release)
+#  define AO_char_fetch_and_sub1(addr) \
+       AO_char_fetch_and_sub1_release(addr)
+#  define AO_HAVE_char_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_char_fetch_and_sub1) && \
+    defined(AO_HAVE_char_fetch_and_sub1_acquire)
+#  define AO_char_fetch_and_sub1(addr) \
+       AO_char_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_char_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_char_fetch_and_sub1) && \
+    defined(AO_HAVE_char_fetch_and_sub1_write)
+#  define AO_char_fetch_and_sub1(addr) \
+       AO_char_fetch_and_sub1_write(addr)
+#  define AO_HAVE_char_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_char_fetch_and_sub1) && \
+    defined(AO_HAVE_char_fetch_and_sub1_read)
+#  define AO_char_fetch_and_sub1(addr) \
+       AO_char_fetch_and_sub1_read(addr)
+#  define AO_HAVE_char_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_char_fetch_and_sub1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_char_fetch_and_sub1_full)
+#  define AO_char_fetch_and_sub1_full(addr) \
+       (AO_nop_full(), AO_char_fetch_and_sub1_acquire(addr))
+#  define AO_HAVE_char_fetch_and_sub1_full
+#endif
+
+#if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_char_fetch_and_sub1_write)
+#  define AO_char_fetch_and_sub1_release_write(addr) \
+       AO_char_fetch_and_sub1_write(addr)
+#  define AO_HAVE_char_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_char_fetch_and_sub1_release)
+#  define AO_char_fetch_and_sub1_release_write(addr) \
+       AO_char_fetch_and_sub1_release(addr)
+#  define AO_HAVE_char_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_char_fetch_and_sub1_read)
+#  define AO_char_fetch_and_sub1_acquire_read(addr) \
+       AO_char_fetch_and_sub1_read(addr)
+#  define AO_HAVE_char_fetch_and_sub1_acquire_read
+#endif
+#if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_char_fetch_and_sub1_acquire)
+#  define AO_char_fetch_and_sub1_acquire_read(addr) \
+       AO_char_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_char_fetch_and_sub1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
+#    define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_char_fetch_and_sub1_acquire_read(addr)
+#    define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_char_fetch_and_sub1)
+#    define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_char_fetch_and_sub1(addr)
+#    define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
+#  endif
+#endif
+
+/* short_load */
+#if defined(AO_HAVE_short_load_acquire) && !defined(AO_HAVE_short_load)
+#  define AO_short_load(addr) AO_short_load_acquire(addr)
+#  define AO_HAVE_short_load
+#endif
+
+#if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_acquire)
+#  define AO_short_load_acquire(addr) AO_short_load_full(addr)
+#  define AO_HAVE_short_load_acquire
+#endif
+
+#if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_read)
+#  define AO_short_load_read(addr) AO_short_load_full(addr)
+#  define AO_HAVE_short_load_read
+#endif
+
+#if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_acquire)
+#  define AO_short_load_acquire_read(addr) AO_short_load_acquire(addr)
+#  define AO_HAVE_short_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_short_load_acquire)
+   AO_INLINE unsigned short
+   AO_short_load_acquire(volatile unsigned short *addr)
+   {
+     unsigned short result = AO_short_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_short_load_acquire
+#endif
+
+#if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_read) && \
+    !defined(AO_HAVE_short_load_read)
+   AO_INLINE unsigned short
+   AO_short_load_read(volatile unsigned short *addr)
+   {
+     unsigned short result = AO_short_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_read();
+     return result;
+   }
+#  define AO_HAVE_short_load_read
+#endif
+
+#if defined(AO_HAVE_short_load_acquire) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_short_load_full)
+#  define AO_short_load_full(addr) (AO_nop_full(), AO_short_load_acquire(addr))
+#  define AO_HAVE_short_load_full
+#endif
+#if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_read)
+#  define AO_short_load_acquire_read(addr) AO_short_load_read(addr)
+#  define AO_HAVE_short_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_short_load_acquire_read) && !defined(AO_HAVE_short_load)
+#  define AO_short_load(addr) AO_short_load_acquire_read(addr)
+#  define AO_HAVE_short_load
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_short_load_acquire_read)
+#    define AO_short_load_dd_acquire_read(addr) \
+       AO_short_load_acquire_read(addr)
+#    define AO_HAVE_short_load_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_short_load)
+#    define AO_short_load_dd_acquire_read(addr) \
+       AO_short_load(addr)
+#    define AO_HAVE_short_load_dd_acquire_read
+#  endif
+#endif
+
+
+/* short_store */
+
+#if defined(AO_HAVE_short_store_release) && !defined(AO_HAVE_short_store)
+#  define AO_short_store(addr, val) AO_short_store_release(addr,val)
+#  define AO_HAVE_short_store
+#endif
+
+#if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_release)
+#  define AO_short_store_release(addr,val) AO_short_store_full(addr,val)
+#  define AO_HAVE_short_store_release
+#endif
+
+#if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_write)
+#  define AO_short_store_write(addr,val) AO_short_store_full(addr,val)
+#  define AO_HAVE_short_store_write
+#endif
+
+#if defined(AO_HAVE_short_store_release) && \
+       !defined(AO_HAVE_short_store_release_write)
+#  define AO_short_store_release_write(addr, val) \
+       AO_short_store_release(addr,val)
+#  define AO_HAVE_short_store_release_write
+#endif
+
+#if defined(AO_HAVE_short_store_write) && !defined(AO_HAVE_short_store)
+#  define AO_short_store(addr, val) AO_short_store_write(addr,val)
+#  define AO_HAVE_short_store
+#endif
+
+#if defined(AO_HAVE_short_store) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_short_store_release)
+#  define AO_short_store_release(addr,val) \
+       (AO_nop_full(), AO_short_store(addr,val))
+#  define AO_HAVE_short_store_release
+#endif
+
+#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_short_store) && \
+     !defined(AO_HAVE_short_store_write)
+#  define AO_short_store_write(addr, val) \
+       (AO_nop_write(), AO_short_store(addr,val))
+#  define AO_HAVE_short_store_write
+#endif
+
+#if defined(AO_HAVE_short_store_write) && \
+     !defined(AO_HAVE_short_store_release_write)
+#  define AO_short_store_release_write(addr, val) AO_short_store_write(addr,val)
+#  define AO_HAVE_short_store_release_write
+#endif
+
+#if defined(AO_HAVE_short_store_release) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_short_store_full)
+#  define AO_short_store_full(addr, val) \
+       (AO_short_store_release(addr, val), AO_nop_full())
+#  define AO_HAVE_short_store_full
+#endif
+
+
+/* short_fetch_and_add */
+#if defined(AO_HAVE_short_compare_and_swap_full) && \
+    !defined(AO_HAVE_short_fetch_and_add_full)
+   AO_INLINE AO_t
+   AO_short_fetch_and_add_full(volatile unsigned short *addr,
+                              unsigned short incr)
+   {
+     unsigned short old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_short_compare_and_swap_full(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_short_fetch_and_add_full
+#endif
+
+#if defined(AO_HAVE_short_compare_and_swap_acquire) && \
+    !defined(AO_HAVE_short_fetch_and_add_acquire)
+   AO_INLINE AO_t
+   AO_short_fetch_and_add_acquire(volatile unsigned short *addr,
+                                 unsigned short incr)
+   {
+     unsigned short old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_short_compare_and_swap_acquire(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_short_fetch_and_add_acquire
+#endif
+
+#if defined(AO_HAVE_short_compare_and_swap_release) && \
+    !defined(AO_HAVE_short_fetch_and_add_release)
+   AO_INLINE AO_t
+   AO_short_fetch_and_add_release(volatile unsigned short *addr,
+                                 unsigned short incr)
+   {
+     unsigned short old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_short_compare_and_swap_release(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_short_fetch_and_add_release
+#endif
+
+#if defined(AO_HAVE_short_fetch_and_add_full)
+#  if !defined(AO_HAVE_short_fetch_and_add_release)
+#    define AO_short_fetch_and_add_release(addr, val) \
+        AO_short_fetch_and_add_full(addr, val)
+#    define AO_HAVE_short_fetch_and_add_release
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_add_acquire)
+#    define AO_short_fetch_and_add_acquire(addr, val) \
+        AO_short_fetch_and_add_full(addr, val)
+#    define AO_HAVE_short_fetch_and_add_acquire
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_add_write)
+#    define AO_short_fetch_and_add_write(addr, val) \
+        AO_short_fetch_and_add_full(addr, val)
+#    define AO_HAVE_short_fetch_and_add_write
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_add_read)
+#    define AO_short_fetch_and_add_read(addr, val) \
+        AO_short_fetch_and_add_full(addr, val)
+#    define AO_HAVE_short_fetch_and_add_read
+#  endif
+#endif /* AO_HAVE_short_fetch_and_add_full */
+
+#if !defined(AO_HAVE_short_fetch_and_add) && \
+    defined(AO_HAVE_short_fetch_and_add_release)
+#  define AO_short_fetch_and_add(addr, val) \
+       AO_short_fetch_and_add_release(addr, val)
+#  define AO_HAVE_short_fetch_and_add
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add) && \
+    defined(AO_HAVE_short_fetch_and_add_acquire)
+#  define AO_short_fetch_and_add(addr, val) \
+       AO_short_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_short_fetch_and_add
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add) && \
+    defined(AO_HAVE_short_fetch_and_add_write)
+#  define AO_short_fetch_and_add(addr, val) \
+       AO_short_fetch_and_add_write(addr, val)
+#  define AO_HAVE_short_fetch_and_add
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add) && \
+    defined(AO_HAVE_short_fetch_and_add_read)
+#  define AO_short_fetch_and_add(addr, val) \
+       AO_short_fetch_and_add_read(addr, val)
+#  define AO_HAVE_short_fetch_and_add
+#endif
+
+#if defined(AO_HAVE_short_fetch_and_add_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_short_fetch_and_add_full)
+#  define AO_short_fetch_and_add_full(addr, val) \
+       (AO_nop_full(), AO_short_fetch_and_add_acquire(addr, val))
+#endif
+
+#if !defined(AO_HAVE_short_fetch_and_add_release_write) && \
+    defined(AO_HAVE_short_fetch_and_add_write)
+#  define AO_short_fetch_and_add_release_write(addr, val) \
+       AO_short_fetch_and_add_write(addr, val)
+#  define AO_HAVE_short_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add_release_write) && \
+    defined(AO_HAVE_short_fetch_and_add_release)
+#  define AO_short_fetch_and_add_release_write(addr, val) \
+       AO_short_fetch_and_add_release(addr, val)
+#  define AO_HAVE_short_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_short_fetch_and_add_read)
+#  define AO_short_fetch_and_add_acquire_read(addr, val) \
+       AO_short_fetch_and_add_read(addr, val)
+#  define AO_HAVE_short_fetch_and_add_acquire_read
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_short_fetch_and_add_acquire)
+#  define AO_short_fetch_and_add_acquire_read(addr, val) \
+       AO_short_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_short_fetch_and_add_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_short_fetch_and_add_acquire_read)
+#    define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_short_fetch_and_add_acquire_read(addr, val)
+#    define AO_HAVE_short_fetch_and_add_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_short_fetch_and_add)
+#    define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_short_fetch_and_add(addr, val)
+#    define AO_HAVE_short_fetch_and_add_dd_acquire_read
+#  endif
+#endif
+  
+/* short_fetch_and_add1 */
+
+#if defined(AO_HAVE_short_fetch_and_add_full) &&\
+    !defined(AO_HAVE_short_fetch_and_add1_full)
+#  define AO_short_fetch_and_add1_full(addr) \
+       AO_short_fetch_and_add_full(addr,1)
+#  define AO_HAVE_short_fetch_and_add1_full
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_release) &&\
+    !defined(AO_HAVE_short_fetch_and_add1_release)
+#  define AO_short_fetch_and_add1_release(addr) \
+       AO_short_fetch_and_add_release(addr,1)
+#  define AO_HAVE_short_fetch_and_add1_release
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_short_fetch_and_add1_acquire)
+#  define AO_short_fetch_and_add1_acquire(addr) \
+       AO_short_fetch_and_add_acquire(addr,1)
+#  define AO_HAVE_short_fetch_and_add1_acquire
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_write) &&\
+    !defined(AO_HAVE_short_fetch_and_add1_write)
+#  define AO_short_fetch_and_add1_write(addr) \
+       AO_short_fetch_and_add_write(addr,1)
+#  define AO_HAVE_short_fetch_and_add1_write
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_read) &&\
+    !defined(AO_HAVE_short_fetch_and_add1_read)
+#  define AO_short_fetch_and_add1_read(addr) \
+       AO_short_fetch_and_add_read(addr,1)
+#  define AO_HAVE_short_fetch_and_add1_read
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_short_fetch_and_add1_release_write)
+#  define AO_short_fetch_and_add1_release_write(addr) \
+       AO_short_fetch_and_add_release_write(addr,1)
+#  define AO_HAVE_short_fetch_and_add1_release_write
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_short_fetch_and_add1_acquire_read)
+#  define AO_short_fetch_and_add1_acquire_read(addr) \
+       AO_short_fetch_and_add_acquire_read(addr,1)
+#  define AO_HAVE_short_fetch_and_add1_acquire_read
+#endif
+#if defined(AO_HAVE_short_fetch_and_add) &&\
+    !defined(AO_HAVE_short_fetch_and_add1)
+#  define AO_short_fetch_and_add1(addr) \
+       AO_short_fetch_and_add(addr,1)
+#  define AO_HAVE_short_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_short_fetch_and_add1_full)
+#  if !defined(AO_HAVE_short_fetch_and_add1_release)
+#    define AO_short_fetch_and_add1_release(addr) \
+        AO_short_fetch_and_add1_full(addr)
+#    define AO_HAVE_short_fetch_and_add1_release
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_add1_acquire)
+#    define AO_short_fetch_and_add1_acquire(addr) \
+        AO_short_fetch_and_add1_full(addr)
+#    define AO_HAVE_short_fetch_and_add1_acquire
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_add1_write)
+#    define AO_short_fetch_and_add1_write(addr) \
+        AO_short_fetch_and_add1_full(addr)
+#    define AO_HAVE_short_fetch_and_add1_write
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_add1_read)
+#    define AO_short_fetch_and_add1_read(addr) \
+        AO_short_fetch_and_add1_full(addr)
+#    define AO_HAVE_short_fetch_and_add1_read
+#  endif
+#endif /* AO_HAVE_short_fetch_and_add1_full */
+
+#if !defined(AO_HAVE_short_fetch_and_add1) && \
+    defined(AO_HAVE_short_fetch_and_add1_release)
+#  define AO_short_fetch_and_add1(addr) \
+       AO_short_fetch_and_add1_release(addr)
+#  define AO_HAVE_short_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add1) && \
+    defined(AO_HAVE_short_fetch_and_add1_acquire)
+#  define AO_short_fetch_and_add1(addr) \
+       AO_short_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_short_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add1) && \
+    defined(AO_HAVE_short_fetch_and_add1_write)
+#  define AO_short_fetch_and_add1(addr) \
+       AO_short_fetch_and_add1_write(addr)
+#  define AO_HAVE_short_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add1) && \
+    defined(AO_HAVE_short_fetch_and_add1_read)
+#  define AO_short_fetch_and_add1(addr) \
+       AO_short_fetch_and_add1_read(addr)
+#  define AO_HAVE_short_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_short_fetch_and_add1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_short_fetch_and_add1_full)
+#  define AO_short_fetch_and_add1_full(addr) \
+       (AO_nop_full(), AO_short_fetch_and_add1_acquire(addr))
+#  define AO_HAVE_short_fetch_and_add1_full
+#endif
+
+#if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_short_fetch_and_add1_write)
+#  define AO_short_fetch_and_add1_release_write(addr) \
+       AO_short_fetch_and_add1_write(addr)
+#  define AO_HAVE_short_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_short_fetch_and_add1_release)
+#  define AO_short_fetch_and_add1_release_write(addr) \
+       AO_short_fetch_and_add1_release(addr)
+#  define AO_HAVE_short_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_short_fetch_and_add1_read)
+#  define AO_short_fetch_and_add1_acquire_read(addr) \
+       AO_short_fetch_and_add1_read(addr)
+#  define AO_HAVE_short_fetch_and_add1_acquire_read
+#endif
+#if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_short_fetch_and_add1_acquire)
+#  define AO_short_fetch_and_add1_acquire_read(addr) \
+       AO_short_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_short_fetch_and_add1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
+#    define AO_short_fetch_and_add1_dd_acquire_read(addr) \
+       AO_short_fetch_and_add1_acquire_read(addr)
+#    define AO_HAVE_short_fetch_and_add1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_short_fetch_and_add1)
+#    define AO_short_fetch_and_add1_dd_acquire_read(addr) \
+       AO_short_fetch_and_add1(addr)
+#    define AO_HAVE_short_fetch_and_add1_dd_acquire_read
+#  endif
+#endif
+
+/* short_fetch_and_sub1 */
+
+#if defined(AO_HAVE_short_fetch_and_add_full) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1_full)
+#  define AO_short_fetch_and_sub1_full(addr) \
+       AO_short_fetch_and_add_full(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1_full
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_release) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1_release)
+#  define AO_short_fetch_and_sub1_release(addr) \
+       AO_short_fetch_and_add_release(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1_release
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1_acquire)
+#  define AO_short_fetch_and_sub1_acquire(addr) \
+       AO_short_fetch_and_add_acquire(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1_acquire
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_write) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1_write)
+#  define AO_short_fetch_and_sub1_write(addr) \
+       AO_short_fetch_and_add_write(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1_write
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_read) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1_read)
+#  define AO_short_fetch_and_sub1_read(addr) \
+       AO_short_fetch_and_add_read(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1_read
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1_release_write)
+#  define AO_short_fetch_and_sub1_release_write(addr) \
+       AO_short_fetch_and_add_release_write(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1_release_write
+#endif
+#if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
+#  define AO_short_fetch_and_sub1_acquire_read(addr) \
+       AO_short_fetch_and_add_acquire_read(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1_acquire_read
+#endif
+#if defined(AO_HAVE_short_fetch_and_add) &&\
+    !defined(AO_HAVE_short_fetch_and_sub1)
+#  define AO_short_fetch_and_sub1(addr) \
+       AO_short_fetch_and_add(addr,(unsigned short)(-1))
+#  define AO_HAVE_short_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_short_fetch_and_sub1_full)
+#  if !defined(AO_HAVE_short_fetch_and_sub1_release)
+#    define AO_short_fetch_and_sub1_release(addr) \
+        AO_short_fetch_and_sub1_full(addr)
+#    define AO_HAVE_short_fetch_and_sub1_release
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_sub1_acquire)
+#    define AO_short_fetch_and_sub1_acquire(addr) \
+        AO_short_fetch_and_sub1_full(addr)
+#    define AO_HAVE_short_fetch_and_sub1_acquire
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_sub1_write)
+#    define AO_short_fetch_and_sub1_write(addr) \
+        AO_short_fetch_and_sub1_full(addr)
+#    define AO_HAVE_short_fetch_and_sub1_write
+#  endif
+#  if !defined(AO_HAVE_short_fetch_and_sub1_read)
+#    define AO_short_fetch_and_sub1_read(addr) \
+        AO_short_fetch_and_sub1_full(addr)
+#    define AO_HAVE_short_fetch_and_sub1_read
+#  endif
+#endif /* AO_HAVE_short_fetch_and_sub1_full */
+
+#if !defined(AO_HAVE_short_fetch_and_sub1) && \
+    defined(AO_HAVE_short_fetch_and_sub1_release)
+#  define AO_short_fetch_and_sub1(addr) \
+       AO_short_fetch_and_sub1_release(addr)
+#  define AO_HAVE_short_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_short_fetch_and_sub1) && \
+    defined(AO_HAVE_short_fetch_and_sub1_acquire)
+#  define AO_short_fetch_and_sub1(addr) \
+       AO_short_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_short_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_short_fetch_and_sub1) && \
+    defined(AO_HAVE_short_fetch_and_sub1_write)
+#  define AO_short_fetch_and_sub1(addr) \
+       AO_short_fetch_and_sub1_write(addr)
+#  define AO_HAVE_short_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_short_fetch_and_sub1) && \
+    defined(AO_HAVE_short_fetch_and_sub1_read)
+#  define AO_short_fetch_and_sub1(addr) \
+       AO_short_fetch_and_sub1_read(addr)
+#  define AO_HAVE_short_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_short_fetch_and_sub1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_short_fetch_and_sub1_full)
+#  define AO_short_fetch_and_sub1_full(addr) \
+       (AO_nop_full(), AO_short_fetch_and_sub1_acquire(addr))
+#  define AO_HAVE_short_fetch_and_sub1_full
+#endif
+
+#if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_short_fetch_and_sub1_write)
+#  define AO_short_fetch_and_sub1_release_write(addr) \
+       AO_short_fetch_and_sub1_write(addr)
+#  define AO_HAVE_short_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_short_fetch_and_sub1_release)
+#  define AO_short_fetch_and_sub1_release_write(addr) \
+       AO_short_fetch_and_sub1_release(addr)
+#  define AO_HAVE_short_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_short_fetch_and_sub1_read)
+#  define AO_short_fetch_and_sub1_acquire_read(addr) \
+       AO_short_fetch_and_sub1_read(addr)
+#  define AO_HAVE_short_fetch_and_sub1_acquire_read
+#endif
+#if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_short_fetch_and_sub1_acquire)
+#  define AO_short_fetch_and_sub1_acquire_read(addr) \
+       AO_short_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_short_fetch_and_sub1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
+#    define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_short_fetch_and_sub1_acquire_read(addr)
+#    define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_short_fetch_and_sub1)
+#    define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_short_fetch_and_sub1(addr)
+#    define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
+#  endif
+#endif
+
+/* int_load */
+#if defined(AO_HAVE_int_load_acquire) && !defined(AO_HAVE_int_load)
+#  define AO_int_load(addr) AO_int_load_acquire(addr)
+#  define AO_HAVE_int_load
+#endif
+
+#if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_acquire)
+#  define AO_int_load_acquire(addr) AO_int_load_full(addr)
+#  define AO_HAVE_int_load_acquire
+#endif
+
+#if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_read)
+#  define AO_int_load_read(addr) AO_int_load_full(addr)
+#  define AO_HAVE_int_load_read
+#endif
+
+#if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_acquire)
+#  define AO_int_load_acquire_read(addr) AO_int_load_acquire(addr)
+#  define AO_HAVE_int_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_int_load_acquire)
+   AO_INLINE unsigned int
+   AO_int_load_acquire(volatile unsigned int *addr)
+   {
+     unsigned int result = AO_int_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_int_load_acquire
+#endif
+
+#if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_read) && \
+    !defined(AO_HAVE_int_load_read)
+   AO_INLINE unsigned int
+   AO_int_load_read(volatile unsigned int *addr)
+   {
+     unsigned int result = AO_int_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_read();
+     return result;
+   }
+#  define AO_HAVE_int_load_read
+#endif
+
+#if defined(AO_HAVE_int_load_acquire) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_int_load_full)
+#  define AO_int_load_full(addr) (AO_nop_full(), AO_int_load_acquire(addr))
+#  define AO_HAVE_int_load_full
+#endif
+#if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_read)
+#  define AO_int_load_acquire_read(addr) AO_int_load_read(addr)
+#  define AO_HAVE_int_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_int_load_acquire_read) && !defined(AO_HAVE_int_load)
+#  define AO_int_load(addr) AO_int_load_acquire_read(addr)
+#  define AO_HAVE_int_load
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_int_load_acquire_read)
+#    define AO_int_load_dd_acquire_read(addr) \
+       AO_int_load_acquire_read(addr)
+#    define AO_HAVE_int_load_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_int_load)
+#    define AO_int_load_dd_acquire_read(addr) \
+       AO_int_load(addr)
+#    define AO_HAVE_int_load_dd_acquire_read
+#  endif
+#endif
+
+
+/* int_store */
+
+#if defined(AO_HAVE_int_store_release) && !defined(AO_HAVE_int_store)
+#  define AO_int_store(addr, val) AO_int_store_release(addr,val)
+#  define AO_HAVE_int_store
+#endif
+
+#if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_release)
+#  define AO_int_store_release(addr,val) AO_int_store_full(addr,val)
+#  define AO_HAVE_int_store_release
+#endif
+
+#if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_write)
+#  define AO_int_store_write(addr,val) AO_int_store_full(addr,val)
+#  define AO_HAVE_int_store_write
+#endif
+
+#if defined(AO_HAVE_int_store_release) && \
+       !defined(AO_HAVE_int_store_release_write)
+#  define AO_int_store_release_write(addr, val) \
+       AO_int_store_release(addr,val)
+#  define AO_HAVE_int_store_release_write
+#endif
+
+#if defined(AO_HAVE_int_store_write) && !defined(AO_HAVE_int_store)
+#  define AO_int_store(addr, val) AO_int_store_write(addr,val)
+#  define AO_HAVE_int_store
+#endif
+
+#if defined(AO_HAVE_int_store) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_int_store_release)
+#  define AO_int_store_release(addr,val) \
+       (AO_nop_full(), AO_int_store(addr,val))
+#  define AO_HAVE_int_store_release
+#endif
+
+#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_int_store) && \
+     !defined(AO_HAVE_int_store_write)
+#  define AO_int_store_write(addr, val) \
+       (AO_nop_write(), AO_int_store(addr,val))
+#  define AO_HAVE_int_store_write
+#endif
+
+#if defined(AO_HAVE_int_store_write) && \
+     !defined(AO_HAVE_int_store_release_write)
+#  define AO_int_store_release_write(addr, val) AO_int_store_write(addr,val)
+#  define AO_HAVE_int_store_release_write
+#endif
+
+#if defined(AO_HAVE_int_store_release) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_int_store_full)
+#  define AO_int_store_full(addr, val) \
+       (AO_int_store_release(addr, val), AO_nop_full())
+#  define AO_HAVE_int_store_full
+#endif
+
+
+/* int_fetch_and_add */
+#if defined(AO_HAVE_int_compare_and_swap_full) && \
+    !defined(AO_HAVE_int_fetch_and_add_full)
+   AO_INLINE AO_t
+   AO_int_fetch_and_add_full(volatile unsigned int *addr,
+                              unsigned int incr)
+   {
+     unsigned int old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_int_compare_and_swap_full(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_int_fetch_and_add_full
+#endif
+
+#if defined(AO_HAVE_int_compare_and_swap_acquire) && \
+    !defined(AO_HAVE_int_fetch_and_add_acquire)
+   AO_INLINE AO_t
+   AO_int_fetch_and_add_acquire(volatile unsigned int *addr,
+                                 unsigned int incr)
+   {
+     unsigned int old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_int_compare_and_swap_acquire(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_int_fetch_and_add_acquire
+#endif
+
+#if defined(AO_HAVE_int_compare_and_swap_release) && \
+    !defined(AO_HAVE_int_fetch_and_add_release)
+   AO_INLINE AO_t
+   AO_int_fetch_and_add_release(volatile unsigned int *addr,
+                                 unsigned int incr)
+   {
+     unsigned int old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_int_compare_and_swap_release(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_int_fetch_and_add_release
+#endif
+
+#if defined(AO_HAVE_int_fetch_and_add_full)
+#  if !defined(AO_HAVE_int_fetch_and_add_release)
+#    define AO_int_fetch_and_add_release(addr, val) \
+        AO_int_fetch_and_add_full(addr, val)
+#    define AO_HAVE_int_fetch_and_add_release
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_add_acquire)
+#    define AO_int_fetch_and_add_acquire(addr, val) \
+        AO_int_fetch_and_add_full(addr, val)
+#    define AO_HAVE_int_fetch_and_add_acquire
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_add_write)
+#    define AO_int_fetch_and_add_write(addr, val) \
+        AO_int_fetch_and_add_full(addr, val)
+#    define AO_HAVE_int_fetch_and_add_write
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_add_read)
+#    define AO_int_fetch_and_add_read(addr, val) \
+        AO_int_fetch_and_add_full(addr, val)
+#    define AO_HAVE_int_fetch_and_add_read
+#  endif
+#endif /* AO_HAVE_int_fetch_and_add_full */
+
+#if !defined(AO_HAVE_int_fetch_and_add) && \
+    defined(AO_HAVE_int_fetch_and_add_release)
+#  define AO_int_fetch_and_add(addr, val) \
+       AO_int_fetch_and_add_release(addr, val)
+#  define AO_HAVE_int_fetch_and_add
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add) && \
+    defined(AO_HAVE_int_fetch_and_add_acquire)
+#  define AO_int_fetch_and_add(addr, val) \
+       AO_int_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_int_fetch_and_add
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add) && \
+    defined(AO_HAVE_int_fetch_and_add_write)
+#  define AO_int_fetch_and_add(addr, val) \
+       AO_int_fetch_and_add_write(addr, val)
+#  define AO_HAVE_int_fetch_and_add
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add) && \
+    defined(AO_HAVE_int_fetch_and_add_read)
+#  define AO_int_fetch_and_add(addr, val) \
+       AO_int_fetch_and_add_read(addr, val)
+#  define AO_HAVE_int_fetch_and_add
+#endif
+
+#if defined(AO_HAVE_int_fetch_and_add_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_int_fetch_and_add_full)
+#  define AO_int_fetch_and_add_full(addr, val) \
+       (AO_nop_full(), AO_int_fetch_and_add_acquire(addr, val))
+#endif
+
+#if !defined(AO_HAVE_int_fetch_and_add_release_write) && \
+    defined(AO_HAVE_int_fetch_and_add_write)
+#  define AO_int_fetch_and_add_release_write(addr, val) \
+       AO_int_fetch_and_add_write(addr, val)
+#  define AO_HAVE_int_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add_release_write) && \
+    defined(AO_HAVE_int_fetch_and_add_release)
+#  define AO_int_fetch_and_add_release_write(addr, val) \
+       AO_int_fetch_and_add_release(addr, val)
+#  define AO_HAVE_int_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_int_fetch_and_add_read)
+#  define AO_int_fetch_and_add_acquire_read(addr, val) \
+       AO_int_fetch_and_add_read(addr, val)
+#  define AO_HAVE_int_fetch_and_add_acquire_read
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_int_fetch_and_add_acquire)
+#  define AO_int_fetch_and_add_acquire_read(addr, val) \
+       AO_int_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_int_fetch_and_add_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_int_fetch_and_add_acquire_read)
+#    define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_int_fetch_and_add_acquire_read(addr, val)
+#    define AO_HAVE_int_fetch_and_add_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_int_fetch_and_add)
+#    define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_int_fetch_and_add(addr, val)
+#    define AO_HAVE_int_fetch_and_add_dd_acquire_read
+#  endif
+#endif
+  
+/* int_fetch_and_add1 */
+
+#if defined(AO_HAVE_int_fetch_and_add_full) &&\
+    !defined(AO_HAVE_int_fetch_and_add1_full)
+#  define AO_int_fetch_and_add1_full(addr) \
+       AO_int_fetch_and_add_full(addr,1)
+#  define AO_HAVE_int_fetch_and_add1_full
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_release) &&\
+    !defined(AO_HAVE_int_fetch_and_add1_release)
+#  define AO_int_fetch_and_add1_release(addr) \
+       AO_int_fetch_and_add_release(addr,1)
+#  define AO_HAVE_int_fetch_and_add1_release
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_int_fetch_and_add1_acquire)
+#  define AO_int_fetch_and_add1_acquire(addr) \
+       AO_int_fetch_and_add_acquire(addr,1)
+#  define AO_HAVE_int_fetch_and_add1_acquire
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_write) &&\
+    !defined(AO_HAVE_int_fetch_and_add1_write)
+#  define AO_int_fetch_and_add1_write(addr) \
+       AO_int_fetch_and_add_write(addr,1)
+#  define AO_HAVE_int_fetch_and_add1_write
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_read) &&\
+    !defined(AO_HAVE_int_fetch_and_add1_read)
+#  define AO_int_fetch_and_add1_read(addr) \
+       AO_int_fetch_and_add_read(addr,1)
+#  define AO_HAVE_int_fetch_and_add1_read
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_int_fetch_and_add1_release_write)
+#  define AO_int_fetch_and_add1_release_write(addr) \
+       AO_int_fetch_and_add_release_write(addr,1)
+#  define AO_HAVE_int_fetch_and_add1_release_write
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_int_fetch_and_add1_acquire_read)
+#  define AO_int_fetch_and_add1_acquire_read(addr) \
+       AO_int_fetch_and_add_acquire_read(addr,1)
+#  define AO_HAVE_int_fetch_and_add1_acquire_read
+#endif
+#if defined(AO_HAVE_int_fetch_and_add) &&\
+    !defined(AO_HAVE_int_fetch_and_add1)
+#  define AO_int_fetch_and_add1(addr) \
+       AO_int_fetch_and_add(addr,1)
+#  define AO_HAVE_int_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_int_fetch_and_add1_full)
+#  if !defined(AO_HAVE_int_fetch_and_add1_release)
+#    define AO_int_fetch_and_add1_release(addr) \
+        AO_int_fetch_and_add1_full(addr)
+#    define AO_HAVE_int_fetch_and_add1_release
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_add1_acquire)
+#    define AO_int_fetch_and_add1_acquire(addr) \
+        AO_int_fetch_and_add1_full(addr)
+#    define AO_HAVE_int_fetch_and_add1_acquire
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_add1_write)
+#    define AO_int_fetch_and_add1_write(addr) \
+        AO_int_fetch_and_add1_full(addr)
+#    define AO_HAVE_int_fetch_and_add1_write
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_add1_read)
+#    define AO_int_fetch_and_add1_read(addr) \
+        AO_int_fetch_and_add1_full(addr)
+#    define AO_HAVE_int_fetch_and_add1_read
+#  endif
+#endif /* AO_HAVE_int_fetch_and_add1_full */
+
+#if !defined(AO_HAVE_int_fetch_and_add1) && \
+    defined(AO_HAVE_int_fetch_and_add1_release)
+#  define AO_int_fetch_and_add1(addr) \
+       AO_int_fetch_and_add1_release(addr)
+#  define AO_HAVE_int_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add1) && \
+    defined(AO_HAVE_int_fetch_and_add1_acquire)
+#  define AO_int_fetch_and_add1(addr) \
+       AO_int_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_int_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add1) && \
+    defined(AO_HAVE_int_fetch_and_add1_write)
+#  define AO_int_fetch_and_add1(addr) \
+       AO_int_fetch_and_add1_write(addr)
+#  define AO_HAVE_int_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add1) && \
+    defined(AO_HAVE_int_fetch_and_add1_read)
+#  define AO_int_fetch_and_add1(addr) \
+       AO_int_fetch_and_add1_read(addr)
+#  define AO_HAVE_int_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_int_fetch_and_add1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_int_fetch_and_add1_full)
+#  define AO_int_fetch_and_add1_full(addr) \
+       (AO_nop_full(), AO_int_fetch_and_add1_acquire(addr))
+#  define AO_HAVE_int_fetch_and_add1_full
+#endif
+
+#if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_int_fetch_and_add1_write)
+#  define AO_int_fetch_and_add1_release_write(addr) \
+       AO_int_fetch_and_add1_write(addr)
+#  define AO_HAVE_int_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_int_fetch_and_add1_release)
+#  define AO_int_fetch_and_add1_release_write(addr) \
+       AO_int_fetch_and_add1_release(addr)
+#  define AO_HAVE_int_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_int_fetch_and_add1_read)
+#  define AO_int_fetch_and_add1_acquire_read(addr) \
+       AO_int_fetch_and_add1_read(addr)
+#  define AO_HAVE_int_fetch_and_add1_acquire_read
+#endif
+#if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_int_fetch_and_add1_acquire)
+#  define AO_int_fetch_and_add1_acquire_read(addr) \
+       AO_int_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_int_fetch_and_add1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
+#    define AO_int_fetch_and_add1_dd_acquire_read(addr) \
+       AO_int_fetch_and_add1_acquire_read(addr)
+#    define AO_HAVE_int_fetch_and_add1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_int_fetch_and_add1)
+#    define AO_int_fetch_and_add1_dd_acquire_read(addr) \
+       AO_int_fetch_and_add1(addr)
+#    define AO_HAVE_int_fetch_and_add1_dd_acquire_read
+#  endif
+#endif
+
+/* int_fetch_and_sub1 */
+
+#if defined(AO_HAVE_int_fetch_and_add_full) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1_full)
+#  define AO_int_fetch_and_sub1_full(addr) \
+       AO_int_fetch_and_add_full(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1_full
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_release) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1_release)
+#  define AO_int_fetch_and_sub1_release(addr) \
+       AO_int_fetch_and_add_release(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1_release
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1_acquire)
+#  define AO_int_fetch_and_sub1_acquire(addr) \
+       AO_int_fetch_and_add_acquire(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1_acquire
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_write) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1_write)
+#  define AO_int_fetch_and_sub1_write(addr) \
+       AO_int_fetch_and_add_write(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1_write
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_read) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1_read)
+#  define AO_int_fetch_and_sub1_read(addr) \
+       AO_int_fetch_and_add_read(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1_read
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1_release_write)
+#  define AO_int_fetch_and_sub1_release_write(addr) \
+       AO_int_fetch_and_add_release_write(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1_release_write
+#endif
+#if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
+#  define AO_int_fetch_and_sub1_acquire_read(addr) \
+       AO_int_fetch_and_add_acquire_read(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1_acquire_read
+#endif
+#if defined(AO_HAVE_int_fetch_and_add) &&\
+    !defined(AO_HAVE_int_fetch_and_sub1)
+#  define AO_int_fetch_and_sub1(addr) \
+       AO_int_fetch_and_add(addr,(unsigned int)(-1))
+#  define AO_HAVE_int_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_int_fetch_and_sub1_full)
+#  if !defined(AO_HAVE_int_fetch_and_sub1_release)
+#    define AO_int_fetch_and_sub1_release(addr) \
+        AO_int_fetch_and_sub1_full(addr)
+#    define AO_HAVE_int_fetch_and_sub1_release
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_sub1_acquire)
+#    define AO_int_fetch_and_sub1_acquire(addr) \
+        AO_int_fetch_and_sub1_full(addr)
+#    define AO_HAVE_int_fetch_and_sub1_acquire
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_sub1_write)
+#    define AO_int_fetch_and_sub1_write(addr) \
+        AO_int_fetch_and_sub1_full(addr)
+#    define AO_HAVE_int_fetch_and_sub1_write
+#  endif
+#  if !defined(AO_HAVE_int_fetch_and_sub1_read)
+#    define AO_int_fetch_and_sub1_read(addr) \
+        AO_int_fetch_and_sub1_full(addr)
+#    define AO_HAVE_int_fetch_and_sub1_read
+#  endif
+#endif /* AO_HAVE_int_fetch_and_sub1_full */
+
+#if !defined(AO_HAVE_int_fetch_and_sub1) && \
+    defined(AO_HAVE_int_fetch_and_sub1_release)
+#  define AO_int_fetch_and_sub1(addr) \
+       AO_int_fetch_and_sub1_release(addr)
+#  define AO_HAVE_int_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_int_fetch_and_sub1) && \
+    defined(AO_HAVE_int_fetch_and_sub1_acquire)
+#  define AO_int_fetch_and_sub1(addr) \
+       AO_int_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_int_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_int_fetch_and_sub1) && \
+    defined(AO_HAVE_int_fetch_and_sub1_write)
+#  define AO_int_fetch_and_sub1(addr) \
+       AO_int_fetch_and_sub1_write(addr)
+#  define AO_HAVE_int_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_int_fetch_and_sub1) && \
+    defined(AO_HAVE_int_fetch_and_sub1_read)
+#  define AO_int_fetch_and_sub1(addr) \
+       AO_int_fetch_and_sub1_read(addr)
+#  define AO_HAVE_int_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_int_fetch_and_sub1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_int_fetch_and_sub1_full)
+#  define AO_int_fetch_and_sub1_full(addr) \
+       (AO_nop_full(), AO_int_fetch_and_sub1_acquire(addr))
+#  define AO_HAVE_int_fetch_and_sub1_full
+#endif
+
+#if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_int_fetch_and_sub1_write)
+#  define AO_int_fetch_and_sub1_release_write(addr) \
+       AO_int_fetch_and_sub1_write(addr)
+#  define AO_HAVE_int_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_int_fetch_and_sub1_release)
+#  define AO_int_fetch_and_sub1_release_write(addr) \
+       AO_int_fetch_and_sub1_release(addr)
+#  define AO_HAVE_int_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_int_fetch_and_sub1_read)
+#  define AO_int_fetch_and_sub1_acquire_read(addr) \
+       AO_int_fetch_and_sub1_read(addr)
+#  define AO_HAVE_int_fetch_and_sub1_acquire_read
+#endif
+#if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_int_fetch_and_sub1_acquire)
+#  define AO_int_fetch_and_sub1_acquire_read(addr) \
+       AO_int_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_int_fetch_and_sub1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
+#    define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_int_fetch_and_sub1_acquire_read(addr)
+#    define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_int_fetch_and_sub1)
+#    define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_int_fetch_and_sub1(addr)
+#    define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
+#  endif
+#endif
+
diff --git a/libatomic_ops/src/atomic_ops/generalize-small.template b/libatomic_ops/src/atomic_ops/generalize-small.template
new file mode 100644 (file)
index 0000000..b7e02b0
--- /dev/null
@@ -0,0 +1,575 @@
+/* XSIZE_load */
+#if defined(AO_HAVE_XSIZE_load_acquire) && !defined(AO_HAVE_XSIZE_load)
+#  define AO_XSIZE_load(addr) AO_XSIZE_load_acquire(addr)
+#  define AO_HAVE_XSIZE_load
+#endif
+
+#if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_acquire)
+#  define AO_XSIZE_load_acquire(addr) AO_XSIZE_load_full(addr)
+#  define AO_HAVE_XSIZE_load_acquire
+#endif
+
+#if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_read)
+#  define AO_XSIZE_load_read(addr) AO_XSIZE_load_full(addr)
+#  define AO_HAVE_XSIZE_load_read
+#endif
+
+#if !defined(AO_HAVE_XSIZE_load_acquire_read) && defined(AO_HAVE_XSIZE_load_acquire)
+#  define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_acquire(addr)
+#  define AO_HAVE_XSIZE_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_XSIZE_load_acquire)
+   AO_INLINE unsigned XCTYPE
+   AO_XSIZE_load_acquire(volatile unsigned XCTYPE *addr)
+   {
+     unsigned XCTYPE result = AO_XSIZE_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_XSIZE_load_acquire
+#endif
+
+#if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_read) && \
+    !defined(AO_HAVE_XSIZE_load_read)
+   AO_INLINE unsigned XCTYPE
+   AO_XSIZE_load_read(volatile unsigned XCTYPE *addr)
+   {
+     unsigned XCTYPE result = AO_XSIZE_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_read();
+     return result;
+   }
+#  define AO_HAVE_XSIZE_load_read
+#endif
+
+#if defined(AO_HAVE_XSIZE_load_acquire) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_XSIZE_load_full)
+#  define AO_XSIZE_load_full(addr) (AO_nop_full(), AO_XSIZE_load_acquire(addr))
+#  define AO_HAVE_XSIZE_load_full
+#endif
+#if !defined(AO_HAVE_XSIZE_load_acquire_read) && defined(AO_HAVE_XSIZE_load_read)
+#  define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_read(addr)
+#  define AO_HAVE_XSIZE_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_XSIZE_load_acquire_read) && !defined(AO_HAVE_XSIZE_load)
+#  define AO_XSIZE_load(addr) AO_XSIZE_load_acquire_read(addr)
+#  define AO_HAVE_XSIZE_load
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_XSIZE_load_acquire_read)
+#    define AO_XSIZE_load_dd_acquire_read(addr) \
+       AO_XSIZE_load_acquire_read(addr)
+#    define AO_HAVE_XSIZE_load_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_XSIZE_load)
+#    define AO_XSIZE_load_dd_acquire_read(addr) \
+       AO_XSIZE_load(addr)
+#    define AO_HAVE_XSIZE_load_dd_acquire_read
+#  endif
+#endif
+
+
+/* XSIZE_store */
+
+#if defined(AO_HAVE_XSIZE_store_release) && !defined(AO_HAVE_XSIZE_store)
+#  define AO_XSIZE_store(addr, val) AO_XSIZE_store_release(addr,val)
+#  define AO_HAVE_XSIZE_store
+#endif
+
+#if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_release)
+#  define AO_XSIZE_store_release(addr,val) AO_XSIZE_store_full(addr,val)
+#  define AO_HAVE_XSIZE_store_release
+#endif
+
+#if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_write)
+#  define AO_XSIZE_store_write(addr,val) AO_XSIZE_store_full(addr,val)
+#  define AO_HAVE_XSIZE_store_write
+#endif
+
+#if defined(AO_HAVE_XSIZE_store_release) && \
+       !defined(AO_HAVE_XSIZE_store_release_write)
+#  define AO_XSIZE_store_release_write(addr, val) \
+       AO_XSIZE_store_release(addr,val)
+#  define AO_HAVE_XSIZE_store_release_write
+#endif
+
+#if defined(AO_HAVE_XSIZE_store_write) && !defined(AO_HAVE_XSIZE_store)
+#  define AO_XSIZE_store(addr, val) AO_XSIZE_store_write(addr,val)
+#  define AO_HAVE_XSIZE_store
+#endif
+
+#if defined(AO_HAVE_XSIZE_store) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_XSIZE_store_release)
+#  define AO_XSIZE_store_release(addr,val) \
+       (AO_nop_full(), AO_XSIZE_store(addr,val))
+#  define AO_HAVE_XSIZE_store_release
+#endif
+
+#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_XSIZE_store) && \
+     !defined(AO_HAVE_XSIZE_store_write)
+#  define AO_XSIZE_store_write(addr, val) \
+       (AO_nop_write(), AO_XSIZE_store(addr,val))
+#  define AO_HAVE_XSIZE_store_write
+#endif
+
+#if defined(AO_HAVE_XSIZE_store_write) && \
+     !defined(AO_HAVE_XSIZE_store_release_write)
+#  define AO_XSIZE_store_release_write(addr, val) AO_XSIZE_store_write(addr,val)
+#  define AO_HAVE_XSIZE_store_release_write
+#endif
+
+#if defined(AO_HAVE_XSIZE_store_release) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_XSIZE_store_full)
+#  define AO_XSIZE_store_full(addr, val) \
+       (AO_XSIZE_store_release(addr, val), AO_nop_full())
+#  define AO_HAVE_XSIZE_store_full
+#endif
+
+
+/* XSIZE_fetch_and_add */
+#if defined(AO_HAVE_XSIZE_compare_and_swap_full) && \
+    !defined(AO_HAVE_XSIZE_fetch_and_add_full)
+   AO_INLINE AO_t
+   AO_XSIZE_fetch_and_add_full(volatile unsigned XCTYPE *addr,
+                              unsigned XCTYPE incr)
+   {
+     unsigned XCTYPE old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_XSIZE_compare_and_swap_full(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_XSIZE_fetch_and_add_full
+#endif
+
+#if defined(AO_HAVE_XSIZE_compare_and_swap_acquire) && \
+    !defined(AO_HAVE_XSIZE_fetch_and_add_acquire)
+   AO_INLINE AO_t
+   AO_XSIZE_fetch_and_add_acquire(volatile unsigned XCTYPE *addr,
+                                 unsigned XCTYPE incr)
+   {
+     unsigned XCTYPE old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_XSIZE_compare_and_swap_acquire(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_XSIZE_fetch_and_add_acquire
+#endif
+
+#if defined(AO_HAVE_XSIZE_compare_and_swap_release) && \
+    !defined(AO_HAVE_XSIZE_fetch_and_add_release)
+   AO_INLINE AO_t
+   AO_XSIZE_fetch_and_add_release(volatile unsigned XCTYPE *addr,
+                                 unsigned XCTYPE incr)
+   {
+     unsigned XCTYPE old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_XSIZE_compare_and_swap_release(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_XSIZE_fetch_and_add_release
+#endif
+
+#if defined(AO_HAVE_XSIZE_fetch_and_add_full)
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add_release)
+#    define AO_XSIZE_fetch_and_add_release(addr, val) \
+        AO_XSIZE_fetch_and_add_full(addr, val)
+#    define AO_HAVE_XSIZE_fetch_and_add_release
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire)
+#    define AO_XSIZE_fetch_and_add_acquire(addr, val) \
+        AO_XSIZE_fetch_and_add_full(addr, val)
+#    define AO_HAVE_XSIZE_fetch_and_add_acquire
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add_write)
+#    define AO_XSIZE_fetch_and_add_write(addr, val) \
+        AO_XSIZE_fetch_and_add_full(addr, val)
+#    define AO_HAVE_XSIZE_fetch_and_add_write
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add_read)
+#    define AO_XSIZE_fetch_and_add_read(addr, val) \
+        AO_XSIZE_fetch_and_add_full(addr, val)
+#    define AO_HAVE_XSIZE_fetch_and_add_read
+#  endif
+#endif /* AO_HAVE_XSIZE_fetch_and_add_full */
+
+#if !defined(AO_HAVE_XSIZE_fetch_and_add) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_release)
+#  define AO_XSIZE_fetch_and_add(addr, val) \
+       AO_XSIZE_fetch_and_add_release(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_acquire)
+#  define AO_XSIZE_fetch_and_add(addr, val) \
+       AO_XSIZE_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_write)
+#  define AO_XSIZE_fetch_and_add(addr, val) \
+       AO_XSIZE_fetch_and_add_write(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_read)
+#  define AO_XSIZE_fetch_and_add(addr, val) \
+       AO_XSIZE_fetch_and_add_read(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add
+#endif
+
+#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_XSIZE_fetch_and_add_full)
+#  define AO_XSIZE_fetch_and_add_full(addr, val) \
+       (AO_nop_full(), AO_XSIZE_fetch_and_add_acquire(addr, val))
+#endif
+
+#if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_write)
+#  define AO_XSIZE_fetch_and_add_release_write(addr, val) \
+       AO_XSIZE_fetch_and_add_write(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_release)
+#  define AO_XSIZE_fetch_and_add_release_write(addr, val) \
+       AO_XSIZE_fetch_and_add_release(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_read)
+#  define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \
+       AO_XSIZE_fetch_and_add_read(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add_acquire_read
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add_acquire)
+#  define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \
+       AO_XSIZE_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_XSIZE_fetch_and_add_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read)
+#    define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_XSIZE_fetch_and_add_acquire_read(addr, val)
+#    define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_XSIZE_fetch_and_add)
+#    define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_XSIZE_fetch_and_add(addr, val)
+#    define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read
+#  endif
+#endif
+  
+/* XSIZE_fetch_and_add1 */
+
+#if defined(AO_HAVE_XSIZE_fetch_and_add_full) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_full)
+#  define AO_XSIZE_fetch_and_add1_full(addr) \
+       AO_XSIZE_fetch_and_add_full(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1_full
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_release) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_release)
+#  define AO_XSIZE_fetch_and_add1_release(addr) \
+       AO_XSIZE_fetch_and_add_release(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1_release
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire)
+#  define AO_XSIZE_fetch_and_add1_acquire(addr) \
+       AO_XSIZE_fetch_and_add_acquire(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1_acquire
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_write) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_write)
+#  define AO_XSIZE_fetch_and_add1_write(addr) \
+       AO_XSIZE_fetch_and_add_write(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1_write
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_read) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_read)
+#  define AO_XSIZE_fetch_and_add1_read(addr) \
+       AO_XSIZE_fetch_and_add_read(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1_read
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write)
+#  define AO_XSIZE_fetch_and_add1_release_write(addr) \
+       AO_XSIZE_fetch_and_add_release_write(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1_release_write
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read)
+#  define AO_XSIZE_fetch_and_add1_acquire_read(addr) \
+       AO_XSIZE_fetch_and_add_acquire_read(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1_acquire_read
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_add1)
+#  define AO_XSIZE_fetch_and_add1(addr) \
+       AO_XSIZE_fetch_and_add(addr,1)
+#  define AO_HAVE_XSIZE_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_XSIZE_fetch_and_add1_full)
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add1_release)
+#    define AO_XSIZE_fetch_and_add1_release(addr) \
+        AO_XSIZE_fetch_and_add1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_add1_release
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire)
+#    define AO_XSIZE_fetch_and_add1_acquire(addr) \
+        AO_XSIZE_fetch_and_add1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_add1_acquire
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add1_write)
+#    define AO_XSIZE_fetch_and_add1_write(addr) \
+        AO_XSIZE_fetch_and_add1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_add1_write
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_add1_read)
+#    define AO_XSIZE_fetch_and_add1_read(addr) \
+        AO_XSIZE_fetch_and_add1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_add1_read
+#  endif
+#endif /* AO_HAVE_XSIZE_fetch_and_add1_full */
+
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_release)
+#  define AO_XSIZE_fetch_and_add1(addr) \
+       AO_XSIZE_fetch_and_add1_release(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_acquire)
+#  define AO_XSIZE_fetch_and_add1(addr) \
+       AO_XSIZE_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_write)
+#  define AO_XSIZE_fetch_and_add1(addr) \
+       AO_XSIZE_fetch_and_add1_write(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_read)
+#  define AO_XSIZE_fetch_and_add1(addr) \
+       AO_XSIZE_fetch_and_add1_read(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_XSIZE_fetch_and_add1_full)
+#  define AO_XSIZE_fetch_and_add1_full(addr) \
+       (AO_nop_full(), AO_XSIZE_fetch_and_add1_acquire(addr))
+#  define AO_HAVE_XSIZE_fetch_and_add1_full
+#endif
+
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_write)
+#  define AO_XSIZE_fetch_and_add1_release_write(addr) \
+       AO_XSIZE_fetch_and_add1_write(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_release)
+#  define AO_XSIZE_fetch_and_add1_release_write(addr) \
+       AO_XSIZE_fetch_and_add1_release(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_read)
+#  define AO_XSIZE_fetch_and_add1_acquire_read(addr) \
+       AO_XSIZE_fetch_and_add1_read(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1_acquire_read
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_XSIZE_fetch_and_add1_acquire)
+#  define AO_XSIZE_fetch_and_add1_acquire_read(addr) \
+       AO_XSIZE_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_XSIZE_fetch_and_add1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read)
+#    define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \
+       AO_XSIZE_fetch_and_add1_acquire_read(addr)
+#    define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_XSIZE_fetch_and_add1)
+#    define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \
+       AO_XSIZE_fetch_and_add1(addr)
+#    define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read
+#  endif
+#endif
+
+/* XSIZE_fetch_and_sub1 */
+
+#if defined(AO_HAVE_XSIZE_fetch_and_add_full) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_full)
+#  define AO_XSIZE_fetch_and_sub1_full(addr) \
+       AO_XSIZE_fetch_and_add_full(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_full
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_release) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_release)
+#  define AO_XSIZE_fetch_and_sub1_release(addr) \
+       AO_XSIZE_fetch_and_add_release(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_release
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire)
+#  define AO_XSIZE_fetch_and_sub1_acquire(addr) \
+       AO_XSIZE_fetch_and_add_acquire(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_acquire
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_write) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_write)
+#  define AO_XSIZE_fetch_and_sub1_write(addr) \
+       AO_XSIZE_fetch_and_add_write(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_write
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_read) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_read)
+#  define AO_XSIZE_fetch_and_sub1_read(addr) \
+       AO_XSIZE_fetch_and_add_read(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_read
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write)
+#  define AO_XSIZE_fetch_and_sub1_release_write(addr) \
+       AO_XSIZE_fetch_and_add_release_write(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_release_write
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read)
+#  define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \
+       AO_XSIZE_fetch_and_add_acquire_read(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read
+#endif
+#if defined(AO_HAVE_XSIZE_fetch_and_add) &&\
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1)
+#  define AO_XSIZE_fetch_and_sub1(addr) \
+       AO_XSIZE_fetch_and_add(addr,(unsigned XCTYPE)(-1))
+#  define AO_HAVE_XSIZE_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_XSIZE_fetch_and_sub1_full)
+#  if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release)
+#    define AO_XSIZE_fetch_and_sub1_release(addr) \
+        AO_XSIZE_fetch_and_sub1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_sub1_release
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire)
+#    define AO_XSIZE_fetch_and_sub1_acquire(addr) \
+        AO_XSIZE_fetch_and_sub1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_sub1_acquire
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_sub1_write)
+#    define AO_XSIZE_fetch_and_sub1_write(addr) \
+        AO_XSIZE_fetch_and_sub1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_sub1_write
+#  endif
+#  if !defined(AO_HAVE_XSIZE_fetch_and_sub1_read)
+#    define AO_XSIZE_fetch_and_sub1_read(addr) \
+        AO_XSIZE_fetch_and_sub1_full(addr)
+#    define AO_HAVE_XSIZE_fetch_and_sub1_read
+#  endif
+#endif /* AO_HAVE_XSIZE_fetch_and_sub1_full */
+
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_release)
+#  define AO_XSIZE_fetch_and_sub1(addr) \
+       AO_XSIZE_fetch_and_sub1_release(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire)
+#  define AO_XSIZE_fetch_and_sub1(addr) \
+       AO_XSIZE_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_write)
+#  define AO_XSIZE_fetch_and_sub1(addr) \
+       AO_XSIZE_fetch_and_sub1_write(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_read)
+#  define AO_XSIZE_fetch_and_sub1(addr) \
+       AO_XSIZE_fetch_and_sub1_read(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_XSIZE_fetch_and_sub1_full)
+#  define AO_XSIZE_fetch_and_sub1_full(addr) \
+       (AO_nop_full(), AO_XSIZE_fetch_and_sub1_acquire(addr))
+#  define AO_HAVE_XSIZE_fetch_and_sub1_full
+#endif
+
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_write)
+#  define AO_XSIZE_fetch_and_sub1_release_write(addr) \
+       AO_XSIZE_fetch_and_sub1_write(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_release)
+#  define AO_XSIZE_fetch_and_sub1_release_write(addr) \
+       AO_XSIZE_fetch_and_sub1_release(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_read)
+#  define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \
+       AO_XSIZE_fetch_and_sub1_read(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read
+#endif
+#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire)
+#  define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \
+       AO_XSIZE_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read)
+#    define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_XSIZE_fetch_and_sub1_acquire_read(addr)
+#    define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_XSIZE_fetch_and_sub1)
+#    define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_XSIZE_fetch_and_sub1(addr)
+#    define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read
+#  endif
+#endif
+
diff --git a/libatomic_ops/src/atomic_ops/generalize.h b/libatomic_ops/src/atomic_ops/generalize.h
new file mode 100644 (file)
index 0000000..0f42b32
--- /dev/null
@@ -0,0 +1,1292 @@
+/*
+ * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Generalize atomic operations for atomic_ops.h.
+ * Should not be included directly.
+ *
+ * We make no attempt to define useless operations, such as
+ * AO_nop_acquire
+ * AO_nop_release
+ *
+ * We have also so far neglected to define some others, which
+ * do not appear likely to be useful, e.g. stores with acquire
+ * or read barriers.
+ *
+ * This file is sometimes included twice by atomic_ops.h.
+ * All definitions include explicit checks that we are not replacing
+ * an earlier definition.  In general, more desirable expansions
+ * appear earlier so that we are more likely to use them.
+ *
+ * We only make safe generalizations, except that by default we define
+ * the ...dd_acquire_read operations to be equivalent to those without
+ * a barrier.  On platforms for which this is unsafe, the platform-specific
+ * file must define AO_NO_DD_ORDERING.
+ */
+
+#ifndef ATOMIC_OPS_H
+# error Atomic_ops_generalize.h should not be included directly.
+#endif
+
+#if AO_CHAR_TS_T
+# define AO_TS_COMPARE_AND_SWAP_FULL(a,o,n) \
+        AO_char_compare_and_swap_full(a,o,n)
+# define AO_TS_COMPARE_AND_SWAP_ACQUIRE(a,o,n) \
+        AO_char_compare_and_swap_acquire(a,o,n)
+# define AO_TS_COMPARE_AND_SWAP_RELEASE(a,o,n) \
+        AO_char_compare_and_swap_release(a,o,n)
+# define AO_TS_COMPARE_AND_SWAP(a,o,n) \
+        AO_char_compare_and_swap(a,o,n)
+#endif
+
+#if AO_AO_TS_T
+# define AO_TS_COMPARE_AND_SWAP_FULL(a,o,n) \
+        AO_compare_and_swap_full(a,o,n)
+# define AO_TS_COMPARE_AND_SWAP_ACQUIRE(a,o,n) \
+        AO_compare_and_swap_acquire(a,o,n)
+# define AO_TS_COMPARE_AND_SWAP_RELEASE(a,o,n) \
+        AO_compare_and_swap_release(a,o,n)
+# define AO_TS_COMPARE_AND_SWAP(a,o,n) \
+        AO_compare_and_swap(a,o,n)
+#endif
+
+/* Generate test_and_set_full, if necessary and possible.      */
+#if !defined(AO_HAVE_test_and_set) && \
+    !defined(AO_HAVE_test_and_set_release) && \
+    !defined(AO_HAVE_test_and_set_acquire) && \
+    !defined(AO_HAVE_test_and_set_read) && \
+    !defined(AO_HAVE_test_and_set_full)
+#  if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_full) || \
+      AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_full)
+     AO_INLINE AO_TS_VAL_t
+     AO_test_and_set_full(volatile AO_TS_t *addr)
+     {
+       if (AO_TS_COMPARE_AND_SWAP_FULL(addr, AO_TS_CLEAR, AO_TS_SET))
+         return AO_TS_CLEAR;
+       else
+         return AO_TS_SET;
+     }
+#    define AO_HAVE_test_and_set_full
+#  endif /* AO_HAVE_compare_and_swap_full */
+
+#  if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_acquire) || \
+      AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_acquire)
+     AO_INLINE AO_TS_VAL_t
+     AO_test_and_set_acquire(volatile AO_TS_t *addr)
+     {
+       if (AO_TS_COMPARE_AND_SWAP_ACQUIRE(addr, AO_TS_CLEAR, AO_TS_SET))
+         return AO_TS_CLEAR;
+       else
+         return AO_TS_SET;
+     }
+#    define AO_HAVE_test_and_set_acquire
+#  endif /* AO_HAVE_compare_and_swap_acquire */
+
+#  if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_release) || \
+      AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_release)
+     AO_INLINE AO_TS_VAL_t
+     AO_test_and_set_release(volatile AO_TS_t *addr)
+     {
+       if (AO_TS_COMPARE_AND_SWAP_RELEASE(addr, AO_TS_CLEAR, AO_TS_SET))
+         return AO_TS_CLEAR;
+       else
+         return AO_TS_SET;
+     }
+#    define AO_HAVE_test_and_set_release
+#  endif /* AO_HAVE_compare_and_swap_release */
+
+#  if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap) || \
+      AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap)
+     AO_INLINE AO_TS_VAL_t
+     AO_test_and_set(volatile AO_TS_t *addr)
+     {
+       if (AO_TS_COMPARE_AND_SWAP(addr, AO_TS_CLEAR, AO_TS_SET))
+         return AO_TS_CLEAR;
+       else
+         return AO_TS_SET;
+     }
+#    define AO_HAVE_test_and_set
+#  endif /* AO_HAVE_compare_and_swap */
+
+#  if defined(AO_HAVE_test_and_set) && defined(AO_HAVE_nop_full) \
+      && !defined(AO_HAVE_test_and_set_acquire)
+     AO_INLINE AO_TS_VAL_t
+     AO_test_and_set_acquire(volatile AO_TS_t *addr)
+     {
+       AO_TS_VAL_t result = AO_test_and_set(addr);
+       AO_nop_full();
+       return result;
+     }
+#    define AO_HAVE_test_and_set_acquire
+#  endif
+
+#endif /* No prior test and set */
+
+/* Nop */
+#if !defined(AO_HAVE_nop)
+   AO_INLINE void AO_nop(void) {}
+#  define AO_HAVE_nop
+#endif
+
+#if defined(AO_HAVE_test_and_set_full) && !defined(AO_HAVE_nop_full)
+   AO_INLINE void
+   AO_nop_full()
+   {
+     AO_TS_t dummy = AO_TS_INITIALIZER;
+     AO_test_and_set_full(&dummy);
+   }
+#  define AO_HAVE_nop_full
+#endif
+
+#if defined(AO_HAVE_nop_acquire)
+#  error AO_nop_acquire is useless: dont define.
+#endif
+#if defined(AO_HAVE_nop_release)
+#  error AO_nop_release is useless: dont define.
+#endif
+
+#if defined(AO_HAVE_nop_full) && !defined(AO_HAVE_nop_read)
+#  define AO_nop_read() AO_nop_full()
+#  define AO_HAVE_nop_read
+#endif
+
+#if defined(AO_HAVE_nop_full) && !defined(AO_HAVE_nop_write)
+#  define AO_nop_write() AO_nop_full()
+#  define AO_HAVE_nop_write
+#endif
+
+/* Load */
+#if defined(AO_HAVE_load_full) && !defined(AO_HAVE_load_acquire)
+#  define AO_load_acquire(addr) AO_load_full(addr)
+#  define AO_HAVE_load_acquire
+#endif
+
+#if defined(AO_HAVE_load_acquire) && !defined(AO_HAVE_load)
+#  define AO_load(addr) AO_load_acquire(addr)
+#  define AO_HAVE_load
+#endif
+
+#if defined(AO_HAVE_load_full) && !defined(AO_HAVE_load_read)
+#  define AO_load_read(addr) AO_load_full(addr)
+#  define AO_HAVE_load_read
+#endif
+
+#if !defined(AO_HAVE_load_acquire_read) && defined(AO_HAVE_load_acquire)
+#  define AO_load_acquire_read(addr) AO_load_acquire(addr)
+#  define AO_HAVE_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_load) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_load_acquire)
+   AO_INLINE AO_t
+   AO_load_acquire(volatile AO_t *addr)
+   {
+     AO_t result = AO_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_load_acquire
+#endif
+
+#if defined(AO_HAVE_load) && defined(AO_HAVE_nop_read) && \
+    !defined(AO_HAVE_load_read)
+   AO_INLINE AO_t
+   AO_load_read(volatile AO_t *addr)
+   {
+     AO_t result = AO_load(addr);
+     /* Acquire barrier would be useless, since the load could be delayed  */
+     /* beyond it.                                                        */
+     AO_nop_read();
+     return result;
+   }
+#  define AO_HAVE_load_read
+#endif
+
+#if defined(AO_HAVE_load_acquire) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_load_full)
+#  define AO_load_full(addr) (AO_nop_full(), AO_load_acquire(addr))
+#  define AO_HAVE_load_full
+#endif
+#if !defined(AO_HAVE_load_acquire_read) && defined(AO_HAVE_load_read)
+#  define AO_load_acquire_read(addr) AO_load_read(addr)
+#  define AO_HAVE_load_acquire_read
+#endif
+
+#if defined(AO_HAVE_load_acquire_read) && !defined(AO_HAVE_load)
+#  define AO_load(addr) AO_load_acquire_read(addr)
+#  define AO_HAVE_load
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_load_acquire_read)
+#    define AO_load_dd_acquire_read(addr) AO_load_acquire_read(addr)
+#    define AO_HAVE_load_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_load)
+#    define AO_load_dd_acquire_read(addr) AO_load(addr)
+#    define AO_HAVE_load_dd_acquire_read
+#  endif
+#endif
+
+
+/* Store */
+
+#if defined(AO_HAVE_store_full) && !defined(AO_HAVE_store_release)
+#  define AO_store_release(addr,val) AO_store_full(addr,val)
+#  define AO_HAVE_store_release
+#endif
+
+#if defined(AO_HAVE_store_release) && !defined(AO_HAVE_store)
+#  define AO_store(addr, val) AO_store_release(addr,val)
+#  define AO_HAVE_store
+#endif
+
+#if defined(AO_HAVE_store_full) && !defined(AO_HAVE_store_write)
+#  define AO_store_write(addr,val) AO_store_full(addr,val)
+#  define AO_HAVE_store_write
+#endif
+
+#if defined(AO_HAVE_store_release) && !defined(AO_HAVE_store_release_write)
+#  define AO_store_release_write(addr, val) AO_store_release(addr,val)
+#  define AO_HAVE_store_release_write
+#endif
+
+#if defined(AO_HAVE_store_write) && !defined(AO_HAVE_store)
+#  define AO_store(addr, val) AO_store_write(addr,val)
+#  define AO_HAVE_store
+#endif
+
+#if defined(AO_HAVE_store) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_store_release)
+#  define AO_store_release(addr,val) (AO_nop_full(), AO_store(addr,val))
+#  define AO_HAVE_store_release
+#endif
+
+#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_store) && \
+     !defined(AO_HAVE_store_write)
+#  define AO_store_write(addr, val) (AO_nop_write(), AO_store(addr,val))
+#  define AO_HAVE_store_write
+#endif
+
+#if defined(AO_HAVE_store_write) && !defined(AO_HAVE_store_release_write)
+#  define AO_store_release_write(addr, val) AO_store_write(addr,val)
+#  define AO_HAVE_store_release_write
+#endif
+
+#if defined(AO_HAVE_store_release) && defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_store_full)
+#  define AO_store_full(addr, val) (AO_store_release(addr, val), AO_nop_full())
+#  define AO_HAVE_store_full
+#endif
+
+  
+/* Fetch_and_add */
+/* We first try to implement fetch_and_add variants in terms   */
+/* of the corresponding compare_and_swap variants to minimize  */
+/* adding barriers.                                            */
+#if defined(AO_HAVE_compare_and_swap_full) && \
+    !defined(AO_HAVE_fetch_and_add_full)
+   AO_INLINE AO_t
+   AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr)
+   {
+     AO_t old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_compare_and_swap_full(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_fetch_and_add_full
+#endif
+
+#if defined(AO_HAVE_compare_and_swap_acquire) && \
+    !defined(AO_HAVE_fetch_and_add_acquire)
+   AO_INLINE AO_t
+   AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr)
+   {
+     AO_t old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_compare_and_swap_acquire(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_fetch_and_add_acquire
+#endif
+
+#if defined(AO_HAVE_compare_and_swap_release) && \
+    !defined(AO_HAVE_fetch_and_add_release)
+   AO_INLINE AO_t
+   AO_fetch_and_add_release(volatile AO_t *addr, AO_t incr)
+   {
+     AO_t old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_compare_and_swap_release(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_fetch_and_add_release
+#endif
+
+#if defined(AO_HAVE_compare_and_swap) && \
+    !defined(AO_HAVE_fetch_and_add)
+   AO_INLINE AO_t
+   AO_fetch_and_add(volatile AO_t *addr, AO_t incr)
+   {
+     AO_t old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_compare_and_swap(addr, old, old+incr));
+     return old;
+   }
+#  define AO_HAVE_fetch_and_add
+#endif
+
+#if defined(AO_HAVE_fetch_and_add_full)
+#  if !defined(AO_HAVE_fetch_and_add_release)
+#    define AO_fetch_and_add_release(addr, val) \
+        AO_fetch_and_add_full(addr, val)
+#    define AO_HAVE_fetch_and_add_release
+#  endif
+#  if !defined(AO_HAVE_fetch_and_add_acquire)
+#    define AO_fetch_and_add_acquire(addr, val) \
+        AO_fetch_and_add_full(addr, val)
+#    define AO_HAVE_fetch_and_add_acquire
+#  endif
+#  if !defined(AO_HAVE_fetch_and_add_write)
+#    define AO_fetch_and_add_write(addr, val) \
+        AO_fetch_and_add_full(addr, val)
+#    define AO_HAVE_fetch_and_add_write
+#  endif
+#  if !defined(AO_HAVE_fetch_and_add_read)
+#    define AO_fetch_and_add_read(addr, val) \
+        AO_fetch_and_add_full(addr, val)
+#    define AO_HAVE_fetch_and_add_read
+#  endif
+#endif /* AO_HAVE_fetch_and_add_full */
+
+#if !defined(AO_HAVE_fetch_and_add) && \
+    defined(AO_HAVE_fetch_and_add_release)
+#  define AO_fetch_and_add(addr, val) \
+       AO_fetch_and_add_release(addr, val)
+#  define AO_HAVE_fetch_and_add
+#endif
+#if !defined(AO_HAVE_fetch_and_add) && \
+    defined(AO_HAVE_fetch_and_add_acquire)
+#  define AO_fetch_and_add(addr, val) \
+       AO_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_fetch_and_add
+#endif
+#if !defined(AO_HAVE_fetch_and_add) && \
+    defined(AO_HAVE_fetch_and_add_write)
+#  define AO_fetch_and_add(addr, val) \
+       AO_fetch_and_add_write(addr, val)
+#  define AO_HAVE_fetch_and_add
+#endif
+#if !defined(AO_HAVE_fetch_and_add) && \
+    defined(AO_HAVE_fetch_and_add_read)
+#  define AO_fetch_and_add(addr, val) \
+       AO_fetch_and_add_read(addr, val)
+#  define AO_HAVE_fetch_and_add
+#endif
+
+#if defined(AO_HAVE_fetch_and_add_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_fetch_and_add_full)
+#  define AO_fetch_and_add_full(addr, val) \
+       (AO_nop_full(), AO_fetch_and_add_acquire(addr, val))
+#  define AO_HAVE_fetch_and_add_full
+#endif
+
+#if !defined(AO_HAVE_fetch_and_add_release_write) && \
+    defined(AO_HAVE_fetch_and_add_write)
+#  define AO_fetch_and_add_release_write(addr, val) \
+       AO_fetch_and_add_write(addr, val)
+#  define AO_HAVE_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_fetch_and_add_release_write) && \
+    defined(AO_HAVE_fetch_and_add_release)
+#  define AO_fetch_and_add_release_write(addr, val) \
+       AO_fetch_and_add_release(addr, val)
+#  define AO_HAVE_fetch_and_add_release_write
+#endif
+#if !defined(AO_HAVE_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_fetch_and_add_read)
+#  define AO_fetch_and_add_acquire_read(addr, val) \
+       AO_fetch_and_add_read(addr, val)
+#  define AO_HAVE_fetch_and_add_acquire_read
+#endif
+#if !defined(AO_HAVE_fetch_and_add_acquire_read) && \
+    defined(AO_HAVE_fetch_and_add_acquire)
+#  define AO_fetch_and_add_acquire_read(addr, val) \
+       AO_fetch_and_add_acquire(addr, val)
+#  define AO_HAVE_fetch_and_add_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_fetch_and_add_acquire_read)
+#    define AO_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_fetch_and_add_acquire_read(addr, val)
+#    define AO_HAVE_fetch_and_add_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_fetch_and_add)
+#    define AO_fetch_and_add_dd_acquire_read(addr, val) \
+       AO_fetch_and_add(addr, val)
+#    define AO_HAVE_fetch_and_add_dd_acquire_read
+#  endif
+#endif
+  
+/* Fetch_and_add1 */
+
+#if defined(AO_HAVE_fetch_and_add_full) &&\
+    !defined(AO_HAVE_fetch_and_add1_full)
+#  define AO_fetch_and_add1_full(addr) AO_fetch_and_add_full(addr,1)
+#  define AO_HAVE_fetch_and_add1_full
+#endif
+#if defined(AO_HAVE_fetch_and_add_release) &&\
+    !defined(AO_HAVE_fetch_and_add1_release)
+#  define AO_fetch_and_add1_release(addr) AO_fetch_and_add_release(addr,1)
+#  define AO_HAVE_fetch_and_add1_release
+#endif
+#if defined(AO_HAVE_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_fetch_and_add1_acquire)
+#  define AO_fetch_and_add1_acquire(addr) AO_fetch_and_add_acquire(addr,1)
+#  define AO_HAVE_fetch_and_add1_acquire
+#endif
+#if defined(AO_HAVE_fetch_and_add_write) &&\
+    !defined(AO_HAVE_fetch_and_add1_write)
+#  define AO_fetch_and_add1_write(addr) AO_fetch_and_add_write(addr,1)
+#  define AO_HAVE_fetch_and_add1_write
+#endif
+#if defined(AO_HAVE_fetch_and_add_read) &&\
+    !defined(AO_HAVE_fetch_and_add1_read)
+#  define AO_fetch_and_add1_read(addr) AO_fetch_and_add_read(addr,1)
+#  define AO_HAVE_fetch_and_add1_read
+#endif
+#if defined(AO_HAVE_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_fetch_and_add1_release_write)
+#  define AO_fetch_and_add1_release_write(addr) \
+       AO_fetch_and_add_release_write(addr,1)
+#  define AO_HAVE_fetch_and_add1_release_write
+#endif
+#if defined(AO_HAVE_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_fetch_and_add1_acquire_read)
+#  define AO_fetch_and_add1_acquire_read(addr) \
+       AO_fetch_and_add_acquire_read(addr,1)
+#  define AO_HAVE_fetch_and_add1_acquire_read
+#endif
+#if defined(AO_HAVE_fetch_and_add) &&\
+    !defined(AO_HAVE_fetch_and_add1)
+#  define AO_fetch_and_add1(addr) \
+       AO_fetch_and_add(addr,1)
+#  define AO_HAVE_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_fetch_and_add1_full)
+#  if !defined(AO_HAVE_fetch_and_add1_release)
+#    define AO_fetch_and_add1_release(addr) \
+        AO_fetch_and_add1_full(addr)
+#    define AO_HAVE_fetch_and_add1_release
+#  endif
+#  if !defined(AO_HAVE_fetch_and_add1_acquire)
+#    define AO_fetch_and_add1_acquire(addr) \
+        AO_fetch_and_add1_full(addr)
+#    define AO_HAVE_fetch_and_add1_acquire
+#  endif
+#  if !defined(AO_HAVE_fetch_and_add1_write)
+#    define AO_fetch_and_add1_write(addr) \
+        AO_fetch_and_add1_full(addr)
+#    define AO_HAVE_fetch_and_add1_write
+#  endif
+#  if !defined(AO_HAVE_fetch_and_add1_read)
+#    define AO_fetch_and_add1_read(addr) \
+        AO_fetch_and_add1_full(addr)
+#    define AO_HAVE_fetch_and_add1_read
+#  endif
+#endif /* AO_HAVE_fetch_and_add1_full */
+
+#if !defined(AO_HAVE_fetch_and_add1) && \
+    defined(AO_HAVE_fetch_and_add1_release)
+#  define AO_fetch_and_add1(addr) \
+       AO_fetch_and_add1_release(addr)
+#  define AO_HAVE_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_fetch_and_add1) && \
+    defined(AO_HAVE_fetch_and_add1_acquire)
+#  define AO_fetch_and_add1(addr) \
+       AO_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_fetch_and_add1) && \
+    defined(AO_HAVE_fetch_and_add1_write)
+#  define AO_fetch_and_add1(addr) \
+       AO_fetch_and_add1_write(addr)
+#  define AO_HAVE_fetch_and_add1
+#endif
+#if !defined(AO_HAVE_fetch_and_add1) && \
+    defined(AO_HAVE_fetch_and_add1_read)
+#  define AO_fetch_and_add1(addr) \
+       AO_fetch_and_add1_read(addr)
+#  define AO_HAVE_fetch_and_add1
+#endif
+
+#if defined(AO_HAVE_fetch_and_add1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_fetch_and_add1_full)
+#  define AO_fetch_and_add1_full(addr) \
+       (AO_nop_full(), AO_fetch_and_add1_acquire(addr))
+#  define AO_HAVE_fetch_and_add1_full
+#endif
+
+#if !defined(AO_HAVE_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_fetch_and_add1_write)
+#  define AO_fetch_and_add1_release_write(addr) \
+       AO_fetch_and_add1_write(addr)
+#  define AO_HAVE_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_fetch_and_add1_release_write) && \
+    defined(AO_HAVE_fetch_and_add1_release)
+#  define AO_fetch_and_add1_release_write(addr) \
+       AO_fetch_and_add1_release(addr)
+#  define AO_HAVE_fetch_and_add1_release_write
+#endif
+#if !defined(AO_HAVE_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_fetch_and_add1_read)
+#  define AO_fetch_and_add1_acquire_read(addr) \
+       AO_fetch_and_add1_read(addr)
+#  define AO_HAVE_fetch_and_add1_acquire_read
+#endif
+#if !defined(AO_HAVE_fetch_and_add1_acquire_read) && \
+    defined(AO_HAVE_fetch_and_add1_acquire)
+#  define AO_fetch_and_add1_acquire_read(addr) \
+       AO_fetch_and_add1_acquire(addr)
+#  define AO_HAVE_fetch_and_add1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_fetch_and_add1_acquire_read)
+#    define AO_fetch_and_add1_dd_acquire_read(addr) \
+       AO_fetch_and_add1_acquire_read(addr)
+#    define AO_HAVE_fetch_and_add1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_fetch_and_add1)
+#    define AO_fetch_and_add1_dd_acquire_read(addr) AO_fetch_and_add1(addr)
+#    define AO_HAVE_fetch_and_add1_dd_acquire_read
+#  endif
+#endif
+
+/* Fetch_and_sub1 */
+
+#if defined(AO_HAVE_fetch_and_add_full) &&\
+    !defined(AO_HAVE_fetch_and_sub1_full)
+#  define AO_fetch_and_sub1_full(addr) AO_fetch_and_add_full(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1_full
+#endif
+#if defined(AO_HAVE_fetch_and_add_release) &&\
+    !defined(AO_HAVE_fetch_and_sub1_release)
+#  define AO_fetch_and_sub1_release(addr) \
+       AO_fetch_and_add_release(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1_release
+#endif
+#if defined(AO_HAVE_fetch_and_add_acquire) &&\
+    !defined(AO_HAVE_fetch_and_sub1_acquire)
+#  define AO_fetch_and_sub1_acquire(addr) \
+       AO_fetch_and_add_acquire(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1_acquire
+#endif
+#if defined(AO_HAVE_fetch_and_add_write) &&\
+    !defined(AO_HAVE_fetch_and_sub1_write)
+#  define AO_fetch_and_sub1_write(addr) \
+       AO_fetch_and_add_write(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1_write
+#endif
+#if defined(AO_HAVE_fetch_and_add_read) &&\
+    !defined(AO_HAVE_fetch_and_sub1_read)
+#  define AO_fetch_and_sub1_read(addr) \
+       AO_fetch_and_add_read(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1_read
+#endif
+#if defined(AO_HAVE_fetch_and_add_release_write) &&\
+    !defined(AO_HAVE_fetch_and_sub1_release_write)
+#  define AO_fetch_and_sub1_release_write(addr) \
+       AO_fetch_and_add_release_write(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1_release_write
+#endif
+#if defined(AO_HAVE_fetch_and_add_acquire_read) &&\
+    !defined(AO_HAVE_fetch_and_sub1_acquire_read)
+#  define AO_fetch_and_sub1_acquire_read(addr) \
+       AO_fetch_and_add_acquire_read(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1_acquire_read
+#endif
+#if defined(AO_HAVE_fetch_and_add) &&\
+    !defined(AO_HAVE_fetch_and_sub1)
+#  define AO_fetch_and_sub1(addr) \
+       AO_fetch_and_add(addr,(AO_t)(-1))
+#  define AO_HAVE_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_fetch_and_sub1_full)
+#  if !defined(AO_HAVE_fetch_and_sub1_release)
+#    define AO_fetch_and_sub1_release(addr) \
+        AO_fetch_and_sub1_full(addr)
+#    define AO_HAVE_fetch_and_sub1_release
+#  endif
+#  if !defined(AO_HAVE_fetch_and_sub1_acquire)
+#    define AO_fetch_and_sub1_acquire(addr) \
+        AO_fetch_and_sub1_full(addr)
+#    define AO_HAVE_fetch_and_sub1_acquire
+#  endif
+#  if !defined(AO_HAVE_fetch_and_sub1_write)
+#    define AO_fetch_and_sub1_write(addr) \
+        AO_fetch_and_sub1_full(addr)
+#    define AO_HAVE_fetch_and_sub1_write
+#  endif
+#  if !defined(AO_HAVE_fetch_and_sub1_read)
+#    define AO_fetch_and_sub1_read(addr) \
+        AO_fetch_and_sub1_full(addr)
+#    define AO_HAVE_fetch_and_sub1_read
+#  endif
+#endif /* AO_HAVE_fetch_and_sub1_full */
+
+#if !defined(AO_HAVE_fetch_and_sub1) && \
+    defined(AO_HAVE_fetch_and_sub1_release)
+#  define AO_fetch_and_sub1(addr) \
+       AO_fetch_and_sub1_release(addr)
+#  define AO_HAVE_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_fetch_and_sub1) && \
+    defined(AO_HAVE_fetch_and_sub1_acquire)
+#  define AO_fetch_and_sub1(addr) \
+       AO_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_fetch_and_sub1) && \
+    defined(AO_HAVE_fetch_and_sub1_write)
+#  define AO_fetch_and_sub1(addr) \
+       AO_fetch_and_sub1_write(addr)
+#  define AO_HAVE_fetch_and_sub1
+#endif
+#if !defined(AO_HAVE_fetch_and_sub1) && \
+    defined(AO_HAVE_fetch_and_sub1_read)
+#  define AO_fetch_and_sub1(addr) \
+       AO_fetch_and_sub1_read(addr)
+#  define AO_HAVE_fetch_and_sub1
+#endif
+
+#if defined(AO_HAVE_fetch_and_sub1_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_fetch_and_sub1_full)
+#  define AO_fetch_and_sub1_full(addr) \
+       (AO_nop_full(), AO_fetch_and_sub1_acquire(addr))
+#  define AO_HAVE_fetch_and_sub1_full
+#endif
+
+#if !defined(AO_HAVE_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_fetch_and_sub1_write)
+#  define AO_fetch_and_sub1_release_write(addr) \
+       AO_fetch_and_sub1_write(addr)
+#  define AO_HAVE_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_fetch_and_sub1_release_write) && \
+    defined(AO_HAVE_fetch_and_sub1_release)
+#  define AO_fetch_and_sub1_release_write(addr) \
+       AO_fetch_and_sub1_release(addr)
+#  define AO_HAVE_fetch_and_sub1_release_write
+#endif
+#if !defined(AO_HAVE_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_fetch_and_sub1_read)
+#  define AO_fetch_and_sub1_acquire_read(addr) \
+       AO_fetch_and_sub1_read(addr)
+#  define AO_HAVE_fetch_and_sub1_acquire_read
+#endif
+#if !defined(AO_HAVE_fetch_and_sub1_acquire_read) && \
+    defined(AO_HAVE_fetch_and_sub1_acquire)
+#  define AO_fetch_and_sub1_acquire_read(addr) \
+       AO_fetch_and_sub1_acquire(addr)
+#  define AO_HAVE_fetch_and_sub1_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_fetch_and_sub1_acquire_read)
+#    define AO_fetch_and_sub1_dd_acquire_read(addr) \
+       AO_fetch_and_sub1_acquire_read(addr)
+#    define AO_HAVE_fetch_and_sub1_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_fetch_and_sub1)
+#    define AO_fetch_and_sub1_dd_acquire_read(addr) AO_fetch_and_sub1(addr)
+#    define AO_HAVE_fetch_and_sub1_dd_acquire_read
+#  endif
+#endif
+
+/* Atomic or */
+#if defined(AO_HAVE_compare_and_swap_full) && \
+    !defined(AO_HAVE_or_full)
+   AO_INLINE void
+   AO_or_full(volatile AO_t *addr, AO_t incr)
+   {
+     AO_t old;
+     do
+       {
+         old = *addr;
+       }
+     while (!AO_compare_and_swap_full(addr, old, (old | incr)));
+   }
+#  define AO_HAVE_or_full
+#endif
+
+#if defined(AO_HAVE_or_full)
+#  if !defined(AO_HAVE_or_release)
+#    define AO_or_release(addr, val) \
+        AO_or_full(addr, val)
+#    define AO_HAVE_or_release
+#  endif
+#  if !defined(AO_HAVE_or_acquire)
+#    define AO_or_acquire(addr, val) \
+        AO_or_full(addr, val)
+#    define AO_HAVE_or_acquire
+#  endif
+#  if !defined(AO_HAVE_or_write)
+#    define AO_or_write(addr, val) \
+        AO_or_full(addr, val)
+#    define AO_HAVE_or_write
+#  endif
+#  if !defined(AO_HAVE_or_read)
+#    define AO_or_read(addr, val) \
+        AO_or_full(addr, val)
+#    define AO_HAVE_or_read
+#  endif
+#endif /* AO_HAVE_or_full */
+
+#if !defined(AO_HAVE_or) && \
+    defined(AO_HAVE_or_release)
+#  define AO_or(addr, val) \
+       AO_or_release(addr, val)
+#  define AO_HAVE_or
+#endif
+#if !defined(AO_HAVE_or) && \
+    defined(AO_HAVE_or_acquire)
+#  define AO_or(addr, val) \
+       AO_or_acquire(addr, val)
+#  define AO_HAVE_or
+#endif
+#if !defined(AO_HAVE_or) && \
+    defined(AO_HAVE_or_write)
+#  define AO_or(addr, val) \
+       AO_or_write(addr, val)
+#  define AO_HAVE_or
+#endif
+#if !defined(AO_HAVE_or) && \
+    defined(AO_HAVE_or_read)
+#  define AO_or(addr, val) \
+       AO_or_read(addr, val)
+#  define AO_HAVE_or
+#endif
+
+#if defined(AO_HAVE_or_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_or_full)
+#  define AO_or_full(addr, val) \
+       (AO_nop_full(), AO_or_acquire(addr, val))
+#endif
+
+#if !defined(AO_HAVE_or_release_write) && \
+    defined(AO_HAVE_or_write)
+#  define AO_or_release_write(addr, val) \
+       AO_or_write(addr, val)
+#  define AO_HAVE_or_release_write
+#endif
+#if !defined(AO_HAVE_or_release_write) && \
+    defined(AO_HAVE_or_release)
+#  define AO_or_release_write(addr, val) \
+       AO_or_release(addr, val)
+#  define AO_HAVE_or_release_write
+#endif
+#if !defined(AO_HAVE_or_acquire_read) && \
+    defined(AO_HAVE_or_read)
+#  define AO_or_acquire_read(addr, val) \
+       AO_or_read(addr, val)
+#  define AO_HAVE_or_acquire_read
+#endif
+#if !defined(AO_HAVE_or_acquire_read) && \
+    defined(AO_HAVE_or_acquire)
+#  define AO_or_acquire_read(addr, val) \
+       AO_or_acquire(addr, val)
+#  define AO_HAVE_or_acquire_read
+#endif
+
+/* dd_aquire_read is meaningless.      */
+  
+/* Test_and_set */
+  
+#if defined(AO_HAVE_test_and_set_full)
+#  if !defined(AO_HAVE_test_and_set_release)
+#    define AO_test_and_set_release(addr) \
+        AO_test_and_set_full(addr)
+#    define AO_HAVE_test_and_set_release
+#  endif
+#  if !defined(AO_HAVE_test_and_set_acquire)
+#    define AO_test_and_set_acquire(addr) \
+        AO_test_and_set_full(addr)
+#    define AO_HAVE_test_and_set_acquire
+#  endif
+#  if !defined(AO_HAVE_test_and_set_write)
+#    define AO_test_and_set_write(addr) \
+        AO_test_and_set_full(addr)
+#    define AO_HAVE_test_and_set_write
+#  endif
+#  if !defined(AO_HAVE_test_and_set_read)
+#    define AO_test_and_set_read(addr) \
+        AO_test_and_set_full(addr)
+#    define AO_HAVE_test_and_set_read
+#  endif
+#endif /* AO_HAVE_test_and_set_full */
+
+#if !defined(AO_HAVE_test_and_set) && \
+    defined(AO_HAVE_test_and_set_release)
+#  define AO_test_and_set(addr) \
+       AO_test_and_set_release(addr)
+#  define AO_HAVE_test_and_set
+#endif
+#if !defined(AO_HAVE_test_and_set) && \
+    defined(AO_HAVE_test_and_set_acquire)
+#  define AO_test_and_set(addr) \
+       AO_test_and_set_acquire(addr)
+#  define AO_HAVE_test_and_set
+#endif
+#if !defined(AO_HAVE_test_and_set) && \
+    defined(AO_HAVE_test_and_set_write)
+#  define AO_test_and_set(addr) \
+       AO_test_and_set_write(addr)
+#  define AO_HAVE_test_and_set
+#endif
+#if !defined(AO_HAVE_test_and_set) && \
+    defined(AO_HAVE_test_and_set_read)
+#  define AO_test_and_set(addr) \
+       AO_test_and_set_read(addr)
+#  define AO_HAVE_test_and_set
+#endif
+
+#if defined(AO_HAVE_test_and_set_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_test_and_set_full)
+#  define AO_test_and_set_full(addr) \
+       (AO_nop_full(), AO_test_and_set_acquire(addr))
+#  define AO_HAVE_test_and_set_full
+#endif
+
+#if !defined(AO_HAVE_test_and_set_release_write) && \
+    defined(AO_HAVE_test_and_set_write)
+#  define AO_test_and_set_release_write(addr) \
+       AO_test_and_set_write(addr)
+#  define AO_HAVE_test_and_set_release_write
+#endif
+#if !defined(AO_HAVE_test_and_set_release_write) && \
+    defined(AO_HAVE_test_and_set_release)
+#  define AO_test_and_set_release_write(addr) \
+       AO_test_and_set_release(addr)
+#  define AO_HAVE_test_and_set_release_write
+#endif
+#if !defined(AO_HAVE_test_and_set_acquire_read) && \
+    defined(AO_HAVE_test_and_set_read)
+#  define AO_test_and_set_acquire_read(addr) \
+       AO_test_and_set_read(addr)
+#  define AO_HAVE_test_and_set_acquire_read
+#endif
+#if !defined(AO_HAVE_test_and_set_acquire_read) && \
+    defined(AO_HAVE_test_and_set_acquire)
+#  define AO_test_and_set_acquire_read(addr) \
+       AO_test_and_set_acquire(addr)
+#  define AO_HAVE_test_and_set_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_test_and_set_acquire_read)
+#    define AO_test_and_set_dd_acquire_read(addr) \
+       AO_test_and_set_acquire_read(addr)
+#    define AO_HAVE_test_and_set_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_test_and_set)
+#    define AO_test_and_set_dd_acquire_read(addr) AO_test_and_set(addr)
+#    define AO_HAVE_test_and_set_dd_acquire_read
+#  endif
+#endif
+
+/* Compare_and_swap */
+#if defined(AO_HAVE_compare_and_swap) && defined(AO_HAVE_nop_full)\
+    && !defined(AO_HAVE_compare_and_swap_acquire)
+   AO_INLINE int
+   AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val)
+   {
+     int result = AO_compare_and_swap(addr, old, new_val);
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_compare_and_swap_acquire
+#endif
+#if defined(AO_HAVE_compare_and_swap) && defined(AO_HAVE_nop_full)\
+    && !defined(AO_HAVE_compare_and_swap_release)
+#  define AO_compare_and_swap_release(addr, old, new_val) \
+       (AO_nop_full(), AO_compare_and_swap(addr, old, new_val))
+#  define AO_HAVE_compare_and_swap_release
+#endif
+#if defined(AO_HAVE_compare_and_swap_full)
+#  if !defined(AO_HAVE_compare_and_swap_release)
+#    define AO_compare_and_swap_release(addr, old, new_val) \
+        AO_compare_and_swap_full(addr, old, new_val)
+#    define AO_HAVE_compare_and_swap_release
+#  endif
+#  if !defined(AO_HAVE_compare_and_swap_acquire)
+#    define AO_compare_and_swap_acquire(addr, old, new_val) \
+        AO_compare_and_swap_full(addr, old, new_val)
+#    define AO_HAVE_compare_and_swap_acquire
+#  endif
+#  if !defined(AO_HAVE_compare_and_swap_write)
+#    define AO_compare_and_swap_write(addr, old, new_val) \
+        AO_compare_and_swap_full(addr, old, new_val)
+#    define AO_HAVE_compare_and_swap_write
+#  endif
+#  if !defined(AO_HAVE_compare_and_swap_read)
+#    define AO_compare_and_swap_read(addr, old, new_val) \
+        AO_compare_and_swap_full(addr, old, new_val)
+#    define AO_HAVE_compare_and_swap_read
+#  endif
+#endif /* AO_HAVE_compare_and_swap_full */
+
+#if !defined(AO_HAVE_compare_and_swap) && \
+    defined(AO_HAVE_compare_and_swap_release)
+#  define AO_compare_and_swap(addr, old, new_val) \
+       AO_compare_and_swap_release(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap
+#endif
+#if !defined(AO_HAVE_compare_and_swap) && \
+    defined(AO_HAVE_compare_and_swap_acquire)
+#  define AO_compare_and_swap(addr, old, new_val) \
+       AO_compare_and_swap_acquire(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap
+#endif
+#if !defined(AO_HAVE_compare_and_swap) && \
+    defined(AO_HAVE_compare_and_swap_write)
+#  define AO_compare_and_swap(addr, old, new_val) \
+       AO_compare_and_swap_write(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap
+#endif
+#if !defined(AO_HAVE_compare_and_swap) && \
+    defined(AO_HAVE_compare_and_swap_read)
+#  define AO_compare_and_swap(addr, old, new_val) \
+       AO_compare_and_swap_read(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap
+#endif
+
+#if defined(AO_HAVE_compare_and_swap_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_compare_and_swap_full)
+#  define AO_compare_and_swap_full(addr, old, new_val) \
+       (AO_nop_full(), AO_compare_and_swap_acquire(addr, old, new_val))
+#  define AO_HAVE_compare_and_swap_full
+#endif
+
+#if !defined(AO_HAVE_compare_and_swap_release_write) && \
+    defined(AO_HAVE_compare_and_swap_write)
+#  define AO_compare_and_swap_release_write(addr, old, new_val) \
+       AO_compare_and_swap_write(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap_release_write
+#endif
+#if !defined(AO_HAVE_compare_and_swap_release_write) && \
+    defined(AO_HAVE_compare_and_swap_release)
+#  define AO_compare_and_swap_release_write(addr, old, new_val) \
+       AO_compare_and_swap_release(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap_release_write
+#endif
+#if !defined(AO_HAVE_compare_and_swap_acquire_read) && \
+    defined(AO_HAVE_compare_and_swap_read)
+#  define AO_compare_and_swap_acquire_read(addr, old, new_val) \
+       AO_compare_and_swap_read(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap_acquire_read
+#endif
+#if !defined(AO_HAVE_compare_and_swap_acquire_read) && \
+    defined(AO_HAVE_compare_and_swap_acquire)
+#  define AO_compare_and_swap_acquire_read(addr, old, new_val) \
+       AO_compare_and_swap_acquire(addr, old, new_val)
+#  define AO_HAVE_compare_and_swap_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_compare_and_swap_acquire_read)
+#    define AO_compare_and_swap_dd_acquire_read(addr, old, new_val) \
+       AO_compare_and_swap_acquire_read(addr, old, new_val)
+#    define AO_HAVE_compare_and_swap_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_compare_and_swap)
+#    define AO_compare_and_swap_dd_acquire_read(addr, old, new_val) \
+       AO_compare_and_swap(addr, old, new_val)
+#    define AO_HAVE_compare_and_swap_dd_acquire_read
+#  endif
+#endif
+
+#include "generalize-small.h"
+
+/* Compare_double_and_swap_double */
+#if defined(AO_HAVE_compare_double_and_swap_double) && defined(AO_HAVE_nop_full)\
+    && !defined(AO_HAVE_compare_double_and_swap_double_acquire)
+   AO_INLINE int
+   AO_compare_double_and_swap_double_acquire(volatile AO_double_t *addr,
+                                            AO_t o1, AO_t o2,
+                                            AO_t n1, AO_t n2)
+   {
+     int result = AO_compare_double_and_swap_double(addr, o1, o2, n1, n2);
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_compare_double_and_swap_double_acquire
+#endif
+#if defined(AO_HAVE_compare_double_and_swap_double) \
+    && defined(AO_HAVE_nop_full)\
+    && !defined(AO_HAVE_compare_double_and_swap_double_release)
+#  define AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) \
+       (AO_nop_full(), AO_compare_double_and_swap_double(addr, o1, o2, n1, n2))
+#  define AO_HAVE_compare_double_and_swap_double_release
+#endif
+#if defined(AO_HAVE_compare_double_and_swap_double_full)
+#  if !defined(AO_HAVE_compare_double_and_swap_double_release)
+#    define AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) \
+        AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2)
+#    define AO_HAVE_compare_double_and_swap_double_release
+#  endif
+#  if !defined(AO_HAVE_compare_double_and_swap_double_acquire)
+#    define AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2) \
+        AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2)
+#    define AO_HAVE_compare_double_and_swap_double_acquire
+#  endif
+#  if !defined(AO_HAVE_compare_double_and_swap_double_write)
+#    define AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2) \
+        AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2)
+#    define AO_HAVE_compare_double_and_swap_double_write
+#  endif
+#  if !defined(AO_HAVE_compare_double_and_swap_double_read)
+#    define AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2) \
+        AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2)
+#    define AO_HAVE_compare_double_and_swap_double_read
+#  endif
+#endif /* AO_HAVE_compare_double_and_swap_double_full */
+
+#if !defined(AO_HAVE_compare_double_and_swap_double) && \
+    defined(AO_HAVE_compare_double_and_swap_double_release)
+#  define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double
+#endif
+#if !defined(AO_HAVE_compare_double_and_swap_double) && \
+    defined(AO_HAVE_compare_double_and_swap_double_acquire)
+#  define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double
+#endif
+#if !defined(AO_HAVE_compare_double_and_swap_double) && \
+    defined(AO_HAVE_compare_double_and_swap_double_write)
+#  define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double
+#endif
+#if !defined(AO_HAVE_compare_double_and_swap_double) && \
+    defined(AO_HAVE_compare_double_and_swap_double_read)
+#  define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double
+#endif
+
+#if defined(AO_HAVE_compare_double_and_swap_double_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_compare_double_and_swap_double_full)
+#  define AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) \
+       (AO_nop_full(), AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2))
+#  define AO_HAVE_compare_double_and_swap_double_full
+#endif
+
+#if !defined(AO_HAVE_compare_double_and_swap_double_release_write) && \
+    defined(AO_HAVE_compare_double_and_swap_double_write)
+#  define AO_compare_double_and_swap_double_release_write(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double_release_write
+#endif
+#if !defined(AO_HAVE_compare_double_and_swap_double_release_write) && \
+    defined(AO_HAVE_compare_double_and_swap_double_release)
+#  define AO_compare_double_and_swap_double_release_write(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double_release_write
+#endif
+#if !defined(AO_HAVE_compare_double_and_swap_double_acquire_read) && \
+    defined(AO_HAVE_compare_double_and_swap_double_read)
+#  define AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double_acquire_read
+#endif
+#if !defined(AO_HAVE_compare_double_and_swap_double_acquire_read) && \
+    defined(AO_HAVE_compare_double_and_swap_double_acquire)
+#  define AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2)
+#  define AO_HAVE_compare_double_and_swap_double_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_compare_double_and_swap_double_acquire_read)
+#    define AO_compare_double_and_swap_double_dd_acquire_read(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2)
+#    define AO_HAVE_compare_double_and_swap_double_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_compare_double_and_swap_double)
+#    define AO_compare_double_and_swap_double_dd_acquire_read(addr, o1, o2, n1, n2) \
+       AO_compare_double_and_swap_double(addr, o1, o2, n1, n2)
+#    define AO_HAVE_compare_double_and_swap_double_dd_acquire_read
+#  endif
+#endif
+
+/* Compare_and_swap_double */
+#if defined(AO_HAVE_compare_and_swap_double) && defined(AO_HAVE_nop_full)\
+    && !defined(AO_HAVE_compare_and_swap_double_acquire)
+   AO_INLINE int
+   AO_compare_and_swap_double_acquire(volatile AO_double_t *addr,
+                                            AO_t o1, AO_t o2,
+                                            AO_t n1, AO_t n2)
+   {
+     int result = AO_compare_and_swap_double(addr, o1, n1, n2);
+     AO_nop_full();
+     return result;
+   }
+#  define AO_HAVE_compare_and_swap_double_acquire
+#endif
+#if defined(AO_HAVE_compare_and_swap_double) \
+    && defined(AO_HAVE_nop_full)\
+    && !defined(AO_HAVE_compare_and_swap_double_release)
+#  define AO_compare_and_swap_double_release(addr, o1, n1, n2) \
+       (AO_nop_full(), AO_compare_and_swap_double(addr, o1, n1, n2))
+#  define AO_HAVE_compare_and_swap_double_release
+#endif
+#if defined(AO_HAVE_compare_and_swap_double_full)
+#  if !defined(AO_HAVE_compare_and_swap_double_release)
+#    define AO_compare_and_swap_double_release(addr, o1, n1, n2) \
+        AO_compare_and_swap_double_full(addr, o1, n1, n2)
+#    define AO_HAVE_compare_and_swap_double_release
+#  endif
+#  if !defined(AO_HAVE_compare_and_swap_double_acquire)
+#    define AO_compare_and_swap_double_acquire(addr, o1, n1, n2) \
+        AO_compare_and_swap_double_full(addr, o1, n1, n2)
+#    define AO_HAVE_compare_and_swap_double_acquire
+#  endif
+#  if !defined(AO_HAVE_compare_and_swap_double_write)
+#    define AO_compare_and_swap_double_write(addr, o1, n1, n2) \
+        AO_compare_and_swap_double_full(addr, o1, n1, n2)
+#    define AO_HAVE_compare_and_swap_double_write
+#  endif
+#  if !defined(AO_HAVE_compare_and_swap_double_read)
+#    define AO_compare_and_swap_double_read(addr, o1, n1, n2) \
+        AO_compare_and_swap_double_full(addr, o1, n1, n2)
+#    define AO_HAVE_compare_and_swap_double_read
+#  endif
+#endif /* AO_HAVE_compare_and_swap_double_full */
+
+#if !defined(AO_HAVE_compare_and_swap_double) && \
+    defined(AO_HAVE_compare_and_swap_double_release)
+#  define AO_compare_and_swap_double(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_release(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double
+#endif
+#if !defined(AO_HAVE_compare_and_swap_double) && \
+    defined(AO_HAVE_compare_and_swap_double_acquire)
+#  define AO_compare_and_swap_double(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_acquire(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double
+#endif
+#if !defined(AO_HAVE_compare_and_swap_double) && \
+    defined(AO_HAVE_compare_and_swap_double_write)
+#  define AO_compare_and_swap_double(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_write(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double
+#endif
+#if !defined(AO_HAVE_compare_and_swap_double) && \
+    defined(AO_HAVE_compare_and_swap_double_read)
+#  define AO_compare_and_swap_double(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_read(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double
+#endif
+
+#if defined(AO_HAVE_compare_and_swap_double_acquire) &&\
+    defined(AO_HAVE_nop_full) && \
+    !defined(AO_HAVE_compare_and_swap_double_full)
+#  define AO_compare_and_swap_double_full(addr, o1, n1, n2) \
+       (AO_nop_full(), AO_compare_and_swap_double_acquire(addr, o1, n1, n2))
+#  define AO_HAVE_compare_and_swap_double_full
+#endif
+
+#if !defined(AO_HAVE_compare_and_swap_double_release_write) && \
+    defined(AO_HAVE_compare_and_swap_double_write)
+#  define AO_compare_and_swap_double_release_write(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_write(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double_release_write
+#endif
+#if !defined(AO_HAVE_compare_and_swap_double_release_write) && \
+    defined(AO_HAVE_compare_and_swap_double_release)
+#  define AO_compare_and_swap_double_release_write(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_release(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double_release_write
+#endif
+#if !defined(AO_HAVE_compare_and_swap_double_acquire_read) && \
+    defined(AO_HAVE_compare_and_swap_double_read)
+#  define AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_read(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double_acquire_read
+#endif
+#if !defined(AO_HAVE_compare_and_swap_double_acquire_read) && \
+    defined(AO_HAVE_compare_and_swap_double_acquire)
+#  define AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_acquire(addr, o1, n1, n2)
+#  define AO_HAVE_compare_and_swap_double_acquire_read
+#endif
+
+#ifdef AO_NO_DD_ORDERING
+#  if defined(AO_HAVE_compare_and_swap_double_acquire_read)
+#    define AO_compare_and_swap_double_dd_acquire_read(addr, o1, n1, n2) \
+       AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2)
+#    define AO_HAVE_compare_and_swap_double_dd_acquire_read
+#  endif
+#else
+#  if defined(AO_HAVE_compare_and_swap_double)
+#    define AO_compare_and_swap_double_dd_acquire_read(addr, o1, n1, n2) \
+       AO_compare_and_swap_double(addr, o1, n1, n2)
+#    define AO_HAVE_compare_and_swap_double_dd_acquire_read
+#  endif
+#endif
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/Makefile.am b/libatomic_ops/src/atomic_ops/sysdeps/Makefile.am
new file mode 100644 (file)
index 0000000..5234381
--- /dev/null
@@ -0,0 +1,45 @@
+#General sysdep utility headers, followed by the arch-specific ones
+nobase_sysdep_HEADERS= generic_pthread.h \
+         atomic_load_store.h \
+         aligned_atomic_load_store.h \
+         acquire_release_volatile.h \
+         char_acquire_release_volatile.h \
+         char_atomic_load_store.h \
+         short_acquire_release_volatile.h \
+         short_aligned_atomic_load_store.h \
+         short_atomic_load_store.h \
+         int_acquire_release_volatile.h \
+         int_aligned_atomic_load_store.h \
+         int_atomic_load_store.h \
+         all_acquire_release_volatile.h \
+         all_aligned_atomic_load_store.h \
+         all_atomic_load_store.h \
+         ordered_except_wr.h \
+         ordered.h \
+         ao_t_is_int.h \
+         test_and_set_t_is_ao_t.h \
+         test_and_set_t_is_char.h \
+         emul_cas.h \
+         standard_ao_double_t.h \
+         README \
+       \
+         gcc/alpha.h gcc/arm.h gcc/x86.h \
+         gcc/hppa.h gcc/ia64.h \
+         gcc/powerpc.h gcc/sparc.h \
+         gcc/hppa.h gcc/m68k.h gcc/s390.h \
+         gcc/ia64.h gcc/x86_64.h gcc/cris.h \
+       \
+         icc/ia64.h \
+       \
+         msftc/x86.h \
+       \
+         hpc/ia64.h hpc/hppa.h \
+       \
+         sunc/sparc.h \
+       \
+         ibmc/powerpc.h
+
+sysdepdir= ${includedir}/atomic_ops/sysdeps
+
+# A few architectures require special .S files
+EXTRA_DIST = sunc/sparc.S
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/Makefile.in b/libatomic_ops/src/atomic_ops/sysdeps/Makefile.in
new file mode 100644 (file)
index 0000000..91d0789
--- /dev/null
@@ -0,0 +1,419 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src/atomic_ops/sysdeps
+DIST_COMMON = README $(nobase_sysdep_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sysdepdir)"
+nobase_sysdepHEADERS_INSTALL = $(install_sh_DATA)
+HEADERS = $(nobase_sysdep_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NEED_ASM_FALSE = @NEED_ASM_FALSE@
+NEED_ASM_TRUE = @NEED_ASM_TRUE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PICFLAG = @PICFLAG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+
+#General sysdep utility headers, followed by the arch-specific ones
+nobase_sysdep_HEADERS = generic_pthread.h \
+         atomic_load_store.h \
+         aligned_atomic_load_store.h \
+         acquire_release_volatile.h \
+         char_acquire_release_volatile.h \
+         char_atomic_load_store.h \
+         short_acquire_release_volatile.h \
+         short_aligned_atomic_load_store.h \
+         short_atomic_load_store.h \
+         int_acquire_release_volatile.h \
+         int_aligned_atomic_load_store.h \
+         int_atomic_load_store.h \
+         all_acquire_release_volatile.h \
+         all_aligned_atomic_load_store.h \
+         all_atomic_load_store.h \
+         ordered_except_wr.h \
+         ordered.h \
+         ao_t_is_int.h \
+         test_and_set_t_is_ao_t.h \
+         test_and_set_t_is_char.h \
+         emul_cas.h \
+         standard_ao_double_t.h \
+         README \
+       \
+         gcc/alpha.h gcc/arm.h gcc/x86.h \
+         gcc/hppa.h gcc/ia64.h \
+         gcc/powerpc.h gcc/sparc.h \
+         gcc/hppa.h gcc/m68k.h gcc/s390.h \
+         gcc/ia64.h gcc/x86_64.h gcc/cris.h \
+       \
+         icc/ia64.h \
+       \
+         msftc/x86.h \
+       \
+         hpc/ia64.h hpc/hppa.h \
+       \
+         sunc/sparc.h \
+       \
+         ibmc/powerpc.h
+
+sysdepdir = ${includedir}/atomic_ops/sysdeps
+
+# A few architectures require special .S files
+EXTRA_DIST = sunc/sparc.S
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/atomic_ops/sysdeps/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  src/atomic_ops/sysdeps/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-nobase_sysdepHEADERS: $(nobase_sysdep_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(sysdepdir)" || $(mkdir_p) "$(DESTDIR)$(sysdepdir)"
+       @$(am__vpath_adj_setup) \
+       list='$(nobase_sysdep_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         $(am__vpath_adj) \
+         echo " $(nobase_sysdepHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sysdepdir)/$$f'"; \
+         $(nobase_sysdepHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sysdepdir)/$$f"; \
+       done
+
+uninstall-nobase_sysdepHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @$(am__vpath_adj_setup) \
+       list='$(nobase_sysdep_HEADERS)'; for p in $$list; do \
+         $(am__vpath_adj) \
+         echo " rm -f '$(DESTDIR)$(sysdepdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(sysdepdir)/$$f"; \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(mkdir_p) $(distdir)/gcc $(distdir)/hpc $(distdir)/ibmc $(distdir)/icc $(distdir)/msftc $(distdir)/sunc
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(sysdepdir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nobase_sysdepHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nobase_sysdepHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       ctags distclean distclean-generic distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-exec install-exec-am \
+       install-info install-info-am install-man \
+       install-nobase_sysdepHEADERS install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+       pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am \
+       uninstall-nobase_sysdepHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/README b/libatomic_ops/src/atomic_ops/sysdeps/README
new file mode 100644 (file)
index 0000000..605699f
--- /dev/null
@@ -0,0 +1,7 @@
+There are two kinds of entities in this directory:
+
+- Subdirectories corresponding to specific compilers (or compiler/OS combinations).
+  Each of these includes one or more architecture-specific headers.
+
+- More generic header files corresponding to a particular ordering and/or
+  atomicity property that might be shared by multiple hardware platforms.
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/acquire_release_volatile.h
new file mode 100644 (file)
index 0000000..1a387d3
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+/*
+ * This file adds definitions appropriate for environments in which an AO_t
+ * volatile load has acquire semantics, and an AO_t volatile store has release
+ * semantics.  This is arguably supposed to be true with the standard Itanium
+ * software conventions.
+ */
+
+/*
+ * Empirically gcc/ia64 does some reordering of ordinary operations around volatiles
+ * even when we think it shouldn't.  Gcc 3.3 and earlier could reorder a volatile store
+ * with another store.  As of March 2005, gcc pre-4 reused previously computed
+ * common subexpressions across a volatile load.
+ * Hence we now add compiler barriers for gcc.
+ */
+#if !defined(AO_GCC_BARRIER)
+#  if defined(__GNUC__)
+#    define AO_GCC_BARRIER() AO_compiler_barrier()
+#  else
+#    define AO_GCC_BARRIER()
+#  endif
+#endif
+
+AO_INLINE AO_t
+AO_load_acquire(volatile AO_t *p)
+{
+  AO_t result = *p;
+  /* A normal volatile load generates an ld.acq                */
+  AO_GCC_BARRIER();
+  return result;
+}
+#define AO_HAVE_load_acquire
+
+AO_INLINE void
+AO_store_release(volatile AO_t *p, AO_t val)
+{
+  AO_GCC_BARRIER();
+  /* A normal volatile store generates an st.rel       */
+  *p = val;
+}
+#define AO_HAVE_store_release
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/aligned_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/aligned_atomic_load_store.h
new file mode 100644 (file)
index 0000000..e69c0dd
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Definitions for architecturs on which loads and stores of AO_t are
+ * atomic fo all legal alignments.
+ */
+
+AO_INLINE AO_t
+AO_load(volatile AO_t *addr)
+{
+  assert(((unsigned long)addr & (sizeof(AO_t) - 1)) == 0);
+  /* Cast away the volatile for architectures where            */
+  /* volatile adds barrier semantics.                          */
+  return *(AO_t *)addr;
+}
+
+#define AO_HAVE_load
+
+AO_INLINE void
+AO_store(volatile AO_t *addr, AO_t new_val)
+{
+  assert(((unsigned long)addr & (sizeof(AO_t) - 1)) == 0);
+  (*(AO_t *)addr) = new_val;
+}
+
+#define AO_HAVE_store
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/all_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/all_acquire_release_volatile.h
new file mode 100644 (file)
index 0000000..6787387
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/*
+ * Describes architectures on which volatile AO_t, unsigned char, unsigned
+ * short, and unsigned int loads and stores have acquire/release semantics for
+ * all normally legal alignments.
+ */
+#include "acquire_release_volatile.h"
+#include "char_acquire_release_volatile.h"
+#include "short_acquire_release_volatile.h"
+#include "int_acquire_release_volatile.h"
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h
new file mode 100644 (file)
index 0000000..b9f7247
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/*
+ * Describes architectures on which AO_t, unsigned char, unsigned short,
+ * and unsigned int loads and strores are atomic for all normally legal alignments.
+ */
+#include "aligned_atomic_load_store.h"
+#include "char_atomic_load_store.h"
+#include "short_aligned_atomic_load_store.h"
+#include "int_aligned_atomic_load_store.h"
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/all_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/all_atomic_load_store.h
new file mode 100644 (file)
index 0000000..d0ebe08
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/*
+ * Describes architectures on which AO_t, unsigned char, unsigned short,
+ * and unsigned int loads and strores are atomic for all normally legal
+ * alignments.
+ */
+#include "atomic_load_store.h"
+#include "char_atomic_load_store.h"
+#include "short_atomic_load_store.h"
+#include "int_atomic_load_store.h"
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.h b/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.h
new file mode 100644 (file)
index 0000000..18156c8
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/*
+ * Inclusion of this file signifies that AO_t is in fact int.  Hence
+ * any AO_... operations can also server as AO_int_... operations.
+ * We currently define only the more important ones here, and allow for
+ * the normal generalization process to define the others.
+ * We should probably add others in the future.
+ */
+
+#if defined(AO_HAVE_compare_and_swap_full) && \
+    !defined(AO_HAVE_int_compare_and_swap_full)
+#  define AO_int_compare_and_swap_full(addr, old, new_val) \
+               AO_compare_and_swap_full((volatile AO_t *)addr, \
+                                        (AO_t) old, (AO_t)new_val)
+#  define AO_HAVE_int_compare_and_swap_full
+# endif
+
+#if defined(AO_HAVE_compare_and_swap_acquire) && \
+    !defined(AO_HAVE_int_compare_and_swap_acquire)
+#  define AO_int_compare_and_swap_acquire(addr, old, new_val) \
+               AO_compare_and_swap_acquire((volatile AO_t *)addr, \
+                                           (AO_t) old, (AO_t)new_val)
+#  define AO_HAVE_int_compare_and_swap_acquire
+# endif
+
+#if defined(AO_HAVE_compare_and_swap_release) && \
+    !defined(AO_HAVE_int_compare_and_swap_release)
+#  define AO_int_compare_and_swap_release(addr, old, new_val) \
+               AO_compare_and_swap_release((volatile AO_t *)addr, \
+                                        (AO_t) old, (AO_t)new_val)
+#  define AO_HAVE_int_compare_and_swap_release
+# endif
+
+#if defined(AO_HAVE_compare_and_swap_write) && \
+    !defined(AO_HAVE_int_compare_and_swap_write)
+#  define AO_int_compare_and_swap_write(addr, old, new_val) \
+               AO_compare_and_swap_write((volatile AO_t *)addr, \
+                                         (AO_t) old, (AO_t)new_val)
+#  define AO_HAVE_int_compare_and_swap_write
+# endif
+
+#if defined(AO_HAVE_compare_and_swap_read) && \
+    !defined(AO_HAVE_int_compare_and_swap_read)
+#  define AO_int_compare_and_swap_read(addr, old, new_val) \
+               AO_compare_and_swap_read((volatile AO_t *)addr, \
+                                        (AO_t) old, (AO_t)new_val)
+#  define AO_HAVE_int_compare_and_swap_read
+# endif
+
+#if defined(AO_HAVE_compare_and_swap) && \
+    !defined(AO_HAVE_int_compare_and_swap)
+#  define AO_int_compare_and_swap(addr, old, new_val) \
+               AO_compare_and_swap((volatile AO_t *)addr, \
+                                   (AO_t) old, (AO_t)new_val)
+#  define AO_HAVE_int_compare_and_swap
+# endif
+
+#if defined(AO_HAVE_load_acquire) && \
+    !defined(AO_HAVE_int_load_acquire)
+#  define AO_int_load_acquire(addr) (int)AO_load_acquire((volatile AO_t *)addr)
+#  define AO_HAVE_int_load_acquire
+# endif
+
+#if defined(AO_HAVE_store_release) && \
+    !defined(AO_HAVE_int_store_release)
+#  define AO_int_store_release(addr, val) \
+       AO_store_release((volatile AO_t *)addr, (AO_t)val)
+#  define AO_HAVE_int_store_release
+# endif
+
+#if defined(AO_HAVE_fetch_and_add_full) && \
+    !defined(AO_HAVE_int_fetch_and_add_full)
+#  define AO_int_fetch_and_add_full(addr, incr) \
+       (int)AO_fetch_and_add_full((volatile AO_t *)addr, (AO_t)incr)
+#  define AO_HAVE_int_fetch_and_add_full
+# endif
+
+#if defined(AO_HAVE_fetch_and_add1_acquire) && \
+    !defined(AO_HAVE_int_fetch_and_add1_acquire)
+#  define AO_int_fetch_and_add1_acquire(addr) \
+       (int)AO_fetch_and_add1_acquire((volatile AO_t *)addr)
+#  define AO_HAVE_int_fetch_and_add1_acquire
+# endif
+
+#if defined(AO_HAVE_fetch_and_add1_release) && \
+    !defined(AO_HAVE_int_fetch_and_add1_release)
+#  define AO_int_fetch_and_add1_release(addr) \
+       (int)AO_fetch_and_add1_release((volatile AO_t *)addr)
+#  define AO_HAVE_int_fetch_and_add1_release
+# endif
+
+#if defined(AO_HAVE_fetch_and_sub1_acquire) && \
+    !defined(AO_HAVE_int_fetch_and_sub1_acquire)
+#  define AO_int_fetch_and_sub1_acquire(addr) \
+       (int)AO_fetch_and_sub1_acquire((volatile AO_t *)addr)
+#  define AO_HAVE_int_fetch_and_sub1_acquire
+# endif
+
+#if defined(AO_HAVE_fetch_and_sub1_release) && \
+    !defined(AO_HAVE_int_fetch_and_sub1_release)
+#  define AO_int_fetch_and_sub1_release(addr) \
+       (int)AO_fetch_and_sub1_release((volatile AO_t *)addr)
+#  define AO_HAVE_int_fetch_and_sub1_release
+# endif
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/atomic_load_store.h
new file mode 100644 (file)
index 0000000..68c5179
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Definitions for architecturs on which loads and stores of AO_t are
+ * atomic fo all legal alignments.
+ */
+
+AO_INLINE AO_t
+AO_load(volatile AO_t *addr)
+{
+  /* Cast away the volatile for architectures like IA64 where  */
+  /* volatile adds barrier semantics.                          */
+  return (*(AO_t *)addr);
+}
+
+#define AO_HAVE_load
+
+AO_INLINE void
+AO_store(volatile AO_t *addr, AO_t new_val)
+{
+  (*(AO_t *)addr) = new_val;
+}
+
+#define AO_HAVE_store
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/char_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/char_acquire_release_volatile.h
new file mode 100644 (file)
index 0000000..37aa021
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+/*
+ * This file adds definitions appropriate for environments in which an unsigned char
+ * volatile load has acquire semantics, and an unsigned char volatile store has release
+ * semantics.  This is true with the standard Itanium ABI.
+ */
+#if !defined(AO_GCC_BARRIER)
+#  if defined(__GNUC__)
+#    define AO_GCC_BARRIER() AO_compiler_barrier()
+#  else
+#    define AO_GCC_BARRIER()
+#  endif
+#endif
+
+AO_INLINE unsigned char
+AO_char_load_acquire(volatile unsigned char *p)
+{
+  unsigned char result = *p;
+  /* A normal volatile load generates an ld.acq                */
+  AO_GCC_BARRIER();
+  return result;
+}
+#define AO_HAVE_char_load_acquire
+
+AO_INLINE void
+AO_char_store_release(volatile unsigned char *p, unsigned char val)
+{
+  AO_GCC_BARRIER();
+  /* A normal volatile store generates an st.rel       */
+  *p = val;
+}
+#define AO_HAVE_char_store_release
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/char_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/char_atomic_load_store.h
new file mode 100644 (file)
index 0000000..6eb0978
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Definitions for architecturs on which loads and stores of unsigned char are
+ * atomic for all legal alignments.
+ */
+
+AO_INLINE unsigned char
+AO_char_load(volatile unsigned char *addr)
+{
+  /* Cast away the volatile for architectures like IA64 where  */
+  /* volatile adds barrier semantics.                          */
+  return (*(unsigned char *)addr);
+}
+
+#define AO_HAVE_char_load
+
+AO_INLINE void
+AO_char_store(volatile unsigned char *addr, unsigned char new_val)
+{
+  (*(unsigned char *)addr) = new_val;
+}
+
+#define AO_HAVE_char_store
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/emul_cas.h b/libatomic_ops/src/atomic_ops/sysdeps/emul_cas.h
new file mode 100644 (file)
index 0000000..4187f9f
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ * 
+ * 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. 
+ */
+
+/*
+ * Ensure, if at all possible, that AO_compare_and_swap_full() is
+ * available.  The emulation should be brute-force signal-safe, even
+ * though it actually blocks.
+ * Including this file will generate an error if AO_compare_and_swap_full()
+ * cannot be made available.
+ * This will be included from platform-specific atomic_ops files
+ * id appropriate, and if AO_FORCE_CAS is defined.  It should not be
+ * included directly, especially since it affects the implementation
+ * of other atomic update primitives.
+ * The implementation assumes that only AO_store_XXX and AO_test_and_set_XXX
+ * variants are defined, and that AO_test_and_set_XXX is not used to
+ * operate on compare_and_swap locations.
+ */
+
+#if !defined(ATOMIC_OPS_H)
+#  error This file should not be included directly.
+#endif
+
+#ifndef AO_HAVE_double_t
+# include "standard_ao_double_t.h"
+#endif
+
+int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old,
+                                 AO_t new_val);
+
+int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr,
+                                               AO_t old_val1, AO_t old_val2,
+                                               AO_t new_val1, AO_t new_val2);
+
+void AO_store_full_emulation(volatile AO_t *addr, AO_t val);
+
+#define AO_compare_and_swap_full(addr, old, newval) \
+       AO_compare_and_swap_emulation(addr, old, newval)
+#define AO_HAVE_compare_and_swap_full
+
+#ifndef AO_HAVE_compare_double_and_swap_double
+# define AO_compare_double_and_swap_double_full(addr, old1, old2, \
+                                               newval1, newval2) \
+        AO_compare_double_and_swap_double_emulation(addr, old1, old2, \
+                                                    newval1, newval2)
+# define AO_HAVE_compare_double_and_swap_double_full
+#endif
+
+#undef AO_store
+#undef AO_HAVE_store
+#undef AO_store_write
+#undef AO_HAVE_store_write
+#undef AO_store_release
+#undef AO_HAVE_store_release
+#undef AO_store_full
+#undef AO_HAVE_store_full
+#define AO_store_full(addr, val) AO_store_full_emulation(addr, val)
+#define AO_HAVE_store_full
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/alpha.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/alpha.h
new file mode 100644 (file)
index 0000000..90c060c
--- /dev/null
@@ -0,0 +1,68 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "../atomic_load_store.h"
+
+#include "../test_and_set_t_is_ao_t.h"
+
+#define AO_NO_DD_ORDERING
+       /* Data dependence does not imply read ordering.        */
+
+AO_INLINE void
+AO_nop_full()
+{
+  __asm__ __volatile__("mb" : : : "memory");
+}
+
+#define AO_HAVE_nop_full
+
+AO_INLINE void
+AO_nop_write()
+{
+  __asm__ __volatile__("wmb" : : : "memory");
+}
+
+#define AO_HAVE_nop_write
+
+/* mb should be used for AO_nop_read().  That's the default.   */
+
+/* We believe that ldq_l ... stq_c does not imply any memory barrier.  */
+/* We should add an explicit fetch_and_add definition.                 */
+AO_INLINE int
+AO_compare_and_swap(volatile AO_t *addr,
+                   AO_t old, AO_t new_val) 
+{
+  unsigned long was_equal;
+  unsigned long temp;
+
+  __asm__ __volatile__(
+                     "1:     ldq_l %0,%1\n"
+                     "       cmpeq %0,%4,%2\n"
+                    "       mov %3,%0\n"
+                     "       beq %2,2f\n"
+                     "       stq_c %0,%1\n"
+                     "       beq %0,1b\n"
+                     "2:\n"
+                     :"=&r" (temp), "=m" (*addr), "=&r" (was_equal)
+                     : "r" (new_val), "Ir" (old)
+                    :"memory");
+  return was_equal;
+}
+
+#define AO_HAVE_compare_and_swap
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h
new file mode 100644 (file)
index 0000000..e10ffa0
--- /dev/null
@@ -0,0 +1,42 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* FIXME.  Very incomplete.  No support for 64 bits.   */
+
+#include "../all_atomic_load_store.h"
+
+#include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal */
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr) {
+  int oldval;
+  int temp = 1; /* locked value */
+
+         __asm__ __volatile__ (
+          "     l     %0,0(%2)\n"
+          "0:   cs    %0,%1,0(%2)\n"
+          "     jl    0b"
+          : "=&d" (ret)
+          : "d" (1), "a" (addr)
+          : "cc", "memory");
+  return oldval;
+}
+
+#define AO_HAVE_test_and_set_full
+
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/cris.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/cris.h
new file mode 100644 (file)
index 0000000..3864905
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ *
+ * Most of this code originally comes from Hans-Peter Nilsson.  It is included
+ * here with his permission.
+ *
+ * This version has not been tested.  It was coped here from a GC
+ * patch so that we wouldn't lose the code in the upgrade to gc7.
+ */ 
+
+#include "../all_atomic_load_store.h"
+
+#include "../ordered.h"  /* There are no multiprocessor implementations. */
+
+#include "../test_and_set_t_is_ao_t.h"
+
+/*
+ * The architecture apparently supports an "f" flag which is
+ * set on preemption.  This essentially gives us load-locked,
+ * store-conditional primitives, though I'm not quite sure how
+ * this would work on a hypothetical multiprocessor.  -HB
+ *
+ * For details, see
+ * http://developer.axis.com/doc/hardware/etrax100lx/prog_man/
+ *      1_architectural_description.pdf
+ *
+ * Presumably many other primitives (notably CAS, including the double-
+ * width versions) could be implemented in this manner, if someone got
+ * around to it.
+ */
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr) {
+    /* Ripped from linuxthreads/sysdeps/cris/pt-machine.h */
+    register unsigned long int ret;
+
+    /* Note the use of a dummy output of *addr to expose the write.  The
+       memory barrier is to stop *other* writes being moved past this code.  */
+      __asm__ __volatile__("clearf\n"
+                          "0:\n\t"
+                          "movu.b [%2],%0\n\t"
+                          "ax\n\t"
+                          "move.b %3,[%2]\n\t"
+                          "bwf 0b\n\t"
+                          "clearf"
+                          : "=&r" (ret), "=m" (*addr)
+                          : "r" (addr), "r" ((int) 1), "m" (*addr)
+                          : "memory");
+    return ret;
+}
+
+#define AO_HAVE_test_and_set_full
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/hppa.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/hppa.h
new file mode 100644 (file)
index 0000000..3349a38
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ *
+ * Modified by Carlos O'Donell <carlos@baldric.uwo.ca>, 2003
+ *     - Added self-aligning lock.
+ * 
+ */ 
+
+#include "../all_atomic_load_store.h"
+
+/* Some architecture set descriptions include special "ordered" memory */
+/* operations.  As far as we can tell, no existing processors actually */
+/* require those.  Nor does it appear likely that future processors    */
+/* will.                                                               */
+#include "../ordered.h"
+
+/* GCC will not guarantee the alignment we need, use four lock words   */
+/* and select the correctly aligned datum. See the glibc 2.3.2         */
+/* linuxthread port for the original implementation.                   */
+struct AO_pa_clearable_loc {
+  int data[4];
+};
+
+#undef AO_TS_INITIALIZER
+#define AO_TS_t struct AO_pa_clearable_loc
+#define AO_TS_INITIALIZER {1,1,1,1}
+/* Switch meaning of set and clear, since we only have an atomic clear */
+/* instruction.                                                                */
+typedef enum {AO_PA_TS_set = 0, AO_PA_TS_clear = 1} AO_PA_TS_val;
+#define AO_TS_VAL_t AO_PA_TS_val
+#define AO_TS_CLEAR AO_PA_TS_clear
+#define AO_TS_SET AO_PA_TS_set
+
+/* The hppa only has one atomic read and modify memory operation,      */
+/* load and clear, so hppa spinlocks must use zero to signify that     */
+/* someone is holding the lock.  The address used for the ldcw         */
+/* semaphore must be 16-byte aligned.                                  */
+
+#define __ldcw(a) ({ \
+  volatile unsigned int __ret;                                 \
+  __asm__ __volatile__("ldcw 0(%2),%0"                         \
+                      : "=r" (__ret), "=m" (*(a)) : "r" (a));  \
+  __ret;                                                       \
+})
+
+/* Because malloc only guarantees 8-byte alignment for malloc'd data,  */
+/* and GCC only guarantees 8-byte alignment for stack locals, we can't */
+/* be assured of 16-byte alignment for atomic lock data even if we     */
+/* specify "__attribute ((aligned(16)))" in the type declaration.  So, */
+/* we use a struct containing an array of four ints for the atomic lock        */
+/* type and dynamically select the 16-byte aligned int from the array  */
+/* for the semaphore.                                                  */
+#define __PA_LDCW_ALIGNMENT 16
+#define __ldcw_align(a) ({ \
+  unsigned long __ret = (unsigned long) a;                     \
+  __ret += __PA_LDCW_ALIGNMENT - 1;                                    \
+  __ret &= ~(__PA_LDCW_ALIGNMENT - 1);                                 \
+  (volatile unsigned int *) __ret;                                     \
+})
+
+/* Works on PA 1.1 and PA 2.0 systems */
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t * addr)
+{
+  volatile unsigned int *a = __ldcw_align (addr);
+  return __ldcw (a);
+} 
+
+AO_INLINE void
+AO_pa_clear(volatile AO_TS_t * addr)
+{
+  volatile unsigned int *a = __ldcw_align (addr);
+  AO_compiler_barrier();
+  *a = 1;
+}
+#define AO_CLEAR(addr) AO_pa_clear(addr)
+
+#define AO_HAVE_test_and_set_full
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/ia64.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/ia64.h
new file mode 100644 (file)
index 0000000..522eaee
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+#include "../all_atomic_load_store.h"
+
+#include "../acquire_release_volatile.h"
+
+#include "../test_and_set_t_is_char.h"
+
+#ifdef _ILP32
+  /* 32-bit HP/UX code.        */
+  /* This requires pointer "swizzling".  Pointers need to be expanded  */
+  /* to 64 bits using the addp4 instruction before use.  This makes it */
+  /* hard to share code, but we try anyway.                            */
+# define AO_LEN "4"
+  /* We assume that addr always appears in argument position 1 in asm  */
+  /* code.  If it is clobbered due to swizzling, we also need it in    */
+  /* second position.  Any later arguments are referenced symbolically,        */
+  /* so that we don't have to worry about their position.  This requires*/
+  /* gcc 3.1, but you shouldn't be using anything older than that on   */
+  /* IA64 anyway.                                                      */
+  /* The AO_MASK macro is a workaround for the fact that HP/UX gcc     */
+  /* appears to otherwise store 64-bit pointers in ar.ccv, i.e. it     */
+  /* doesn't appear to clear high bits in a pointer value we pass into */
+  /* assembly code, even if it is supposedly of type AO_t.             */
+# define AO_IN_ADDR "1"(addr)
+# define AO_OUT_ADDR , "=r"(addr)
+# define AO_SWIZZLE "addp4 %1=0,%1;;\n"
+# define AO_MASK(ptr) __asm__("zxt4 %1=%1": "=r"(ptr) : "0"(ptr));
+#else
+# define AO_LEN "8"
+# define AO_IN_ADDR "r"(addr)
+# define AO_OUT_ADDR
+# define AO_SWIZZLE
+# define AO_MASK(ptr)
+#endif
+
+AO_INLINE void
+AO_nop_full()
+{
+  __asm__ __volatile__("mf" : : : "memory");
+}
+#define AO_HAVE_nop_full
+
+AO_INLINE AO_t
+AO_fetch_and_add1_acquire (volatile AO_t *addr)
+{
+  AO_t result;
+
+  __asm__ __volatile__ (AO_SWIZZLE
+                       "fetchadd" AO_LEN ".acq %0=[%1],1":
+                       "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory");
+  return result;
+}
+#define AO_HAVE_fetch_and_add1_acquire
+
+AO_INLINE AO_t
+AO_fetch_and_add1_release (volatile AO_t *addr)
+{
+  AO_t result;
+
+  __asm__ __volatile__ (AO_SWIZZLE
+                       "fetchadd" AO_LEN ".rel %0=[%1],1":
+                       "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory");
+  return result;
+}
+
+#define AO_HAVE_fetch_and_add1_release
+
+AO_INLINE AO_t
+AO_fetch_and_sub1_acquire (volatile AO_t *addr)
+{
+  AO_t result;
+
+  __asm__ __volatile__ (AO_SWIZZLE
+                       "fetchadd" AO_LEN ".acq %0=[%1],-1":
+                       "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory");
+  return result;
+}
+
+#define AO_HAVE_fetch_and_sub1_acquire
+
+AO_INLINE AO_t
+AO_fetch_and_sub1_release (volatile AO_t *addr)
+{
+  AO_t result;
+
+  __asm__ __volatile__ (AO_SWIZZLE
+                       "fetchadd" AO_LEN ".rel %0=[%1],-1":
+                       "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory");
+  return result;
+}
+
+#define AO_HAVE_fetch_and_sub1_release
+
+#ifndef _ILP32
+
+AO_INLINE unsigned int
+AO_int_fetch_and_add1_acquire (volatile unsigned int *addr)
+{
+  unsigned int result;
+
+  __asm__ __volatile__ ("fetchadd4.acq %0=[%1],1":
+                       "=r" (result): AO_IN_ADDR :"memory");
+  return result;
+}
+#define AO_HAVE_int_fetch_and_add1_acquire
+
+AO_INLINE unsigned int
+AO_int_fetch_and_add1_release (volatile unsigned int *addr)
+{
+  unsigned int result;
+
+  __asm__ __volatile__ ("fetchadd4.rel %0=[%1],1":
+                       "=r" (result): AO_IN_ADDR :"memory");
+  return result;
+}
+
+#define AO_HAVE_int_fetch_and_add1_release
+
+AO_INLINE unsigned int
+AO_int_fetch_and_sub1_acquire (volatile unsigned int *addr)
+{
+  unsigned int result;
+
+  __asm__ __volatile__ ("fetchadd4.acq %0=[%1],-1":
+                       "=r" (result): AO_IN_ADDR :"memory");
+  return result;
+}
+
+#define AO_HAVE_int_fetch_and_sub1_acquire
+
+AO_INLINE unsigned int
+AO_int_fetch_and_sub1_release (volatile unsigned int *addr)
+{
+  unsigned int result;
+
+  __asm__ __volatile__ ("fetchadd4.rel %0=[%1],-1":
+                       "=r" (result): AO_IN_ADDR :"memory");
+  return result;
+}
+
+#define AO_HAVE_int_fetch_and_sub1_release
+
+#endif /* !_ILP32 */
+
+AO_INLINE int
+AO_compare_and_swap_acquire(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  AO_t oldval;
+  AO_MASK(old);
+  __asm__ __volatile__(AO_SWIZZLE
+                      "mov ar.ccv=%[old] ;; cmpxchg" AO_LEN
+                      ".acq %0=[%1],%[new_val],ar.ccv"
+                      : "=r"(oldval) AO_OUT_ADDR
+                      : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"(old)
+                      : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_compare_and_swap_acquire
+
+AO_INLINE int
+AO_compare_and_swap_release(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  AO_t oldval;
+  AO_MASK(old);
+  __asm__ __volatile__(AO_SWIZZLE
+                      "mov ar.ccv=%[old] ;; cmpxchg" AO_LEN
+                      ".rel %0=[%1],%[new_val],ar.ccv"
+                      : "=r"(oldval) AO_OUT_ADDR
+                      : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"(old)
+                      : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_compare_and_swap_release
+
+AO_INLINE int
+AO_char_compare_and_swap_acquire(volatile unsigned char *addr,
+                                unsigned char old, unsigned char new_val) 
+{
+  unsigned char oldval;
+  __asm__ __volatile__(AO_SWIZZLE
+              "mov ar.ccv=%[old] ;; cmpxchg1.acq %0=[%1],%[new_val],ar.ccv"
+              : "=r"(oldval) AO_OUT_ADDR
+              : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old)
+              : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_char_compare_and_swap_acquire
+
+AO_INLINE int
+AO_char_compare_and_swap_release(volatile unsigned char *addr,
+                                unsigned char old, unsigned char new_val) 
+{
+  unsigned char oldval;
+  __asm__ __volatile__(AO_SWIZZLE
+               "mov ar.ccv=%[old] ;; cmpxchg1.rel %0=[%1],%[new_val],ar.ccv"
+               : "=r"(oldval) AO_OUT_ADDR
+               : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old)
+               : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_char_compare_and_swap_release
+
+AO_INLINE int
+AO_short_compare_and_swap_acquire(volatile unsigned short *addr,
+                                 unsigned short old, unsigned short new_val) 
+{
+  unsigned short oldval;
+  __asm__ __volatile__(AO_SWIZZLE
+               "mov ar.ccv=%[old] ;; cmpxchg2.acq %0=[%1],%[new_val],ar.ccv"
+               : "=r"(oldval) AO_OUT_ADDR
+               : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old)
+               : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_short_compare_and_swap_acquire
+
+AO_INLINE int
+AO_short_compare_and_swap_release(volatile unsigned short *addr,
+                                 unsigned short old, unsigned short new_val) 
+{
+  unsigned short oldval;
+  __asm__ __volatile__(AO_SWIZZLE
+               "mov ar.ccv=%[old] ;; cmpxchg2.rel %0=[%1],%[new_val],ar.ccv"
+               : "=r"(oldval) AO_OUT_ADDR
+               : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old)
+               : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_short_compare_and_swap_release
+
+#ifndef _ILP32
+
+AO_INLINE int
+AO_int_compare_and_swap_acquire(volatile unsigned int *addr,
+                               unsigned int old, unsigned int new_val) 
+{
+  unsigned int oldval;
+  __asm__ __volatile__("mov ar.ccv=%3 ;; cmpxchg4.acq %0=[%1],%2,ar.ccv"
+                      : "=r"(oldval)
+                      : AO_IN_ADDR, "r"(new_val), "r"((AO_t)old) : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_int_compare_and_swap_acquire
+
+AO_INLINE int
+AO_int_compare_and_swap_release(volatile unsigned int *addr,
+                               unsigned int old, unsigned int new_val) 
+{
+  unsigned int oldval;
+  __asm__ __volatile__("mov ar.ccv=%3 ;; cmpxchg4.rel %0=[%1],%2,ar.ccv"
+                      : "=r"(oldval)
+                      : AO_IN_ADDR, "r"(new_val), "r"((AO_t)old) : "memory");
+  return (oldval == old);
+}
+
+#define AO_HAVE_int_compare_and_swap_release
+
+#endif /* !_ILP32 */
+
+/* FIXME: Add compare_and_swap_double as soon as there is widely       */
+/* available hardware that implements it.                              */
+
+/* FIXME: Add compare_double_and_swap_double for the _ILP32 case.      */
+
+#ifdef _ILP32
+# include "../ao_t_is_int.h"
+#endif
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/m68k.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/m68k.h
new file mode 100644 (file)
index 0000000..9e7f70a
--- /dev/null
@@ -0,0 +1,45 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* FIXME.  Very incomplete.  */
+#include "../all_aligned_atomic_load_store.h"
+
+/* Are there any m68k multiprocessors still around?    */
+/* AFAIK, Alliants were sequentially consistent.       */
+#include "../ordered.h"
+
+#include "../test_and_set_t_is_ao_t.h"
+
+/* Contributed by Tony Mantler or new.  Should be changed to MIT license? */
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr) {
+  int oldval;
+
+  /* The return value is semi-phony. */
+  /* 'tas' sets bit 7 while the return */
+  /* value pretends bit 0 was set */
+  __asm__ __volatile__(
+                 "tas %1@; sne %0; negb %0"
+                 : "=d" (oldval)
+                 : "a" (addr) : "memory");
+   return oldval;
+}
+
+#define AO_HAVE_test_and_set_full
+
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/powerpc.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/powerpc.h
new file mode 100644 (file)
index 0000000..5f33e71
--- /dev/null
@@ -0,0 +1,201 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* FIXME.  Incomplete.  No support for 64 bits.                                */
+/* Memory model documented at http://www-106.ibm.com/developerworks/   */
+/* eserver/articles/archguide.html and (clearer)                       */
+/* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */
+/* There appears to be no implicit ordering between any kind of                */
+/* independent memory references.                                      */
+/* Architecture enforces some ordering based on control dependence.    */
+/* I don't know if that could help.                                    */
+/* Data-dependent loads are always ordered.                            */
+/* Based on the above references, eieio is intended for use on         */
+/* uncached memory, which we don't support.  It does not order loads   */
+/* from cached memory.                                                 */
+/* Thanks to Maged Michael, Doug Lea, and Roger Hoover for helping to  */
+/* track some of this down and correcting my misunderstandings. -HB    */
+
+#include "../all_aligned_atomic_load_store.h"
+
+#include "../test_and_set_t_is_ao_t.h"
+       /* There seems to be no byte equivalent of lwarx, so this       */
+       /* may really be what we want, at least in the 32-bit case.     */
+
+AO_INLINE void
+AO_nop_full()
+{
+  __asm__ __volatile__("sync" : : : "memory");
+}
+
+#define AO_HAVE_nop_full
+
+/* lwsync apparently works for everything but a StoreLoad barrier.     */
+AO_INLINE void
+AO_lwsync()
+{
+  __asm__ __volatile__("lwsync" : : : "memory");
+}
+
+#define AO_nop_write() AO_lwsync()
+#define AO_HAVE_nop_write
+
+#define AO_nop_read() AO_lwsync()
+#define AO_HAVE_nop_read
+
+/* We explicitly specify load_acquire, since it is important, and can  */
+/* be implemented relatively cheaply.  It could be implemented         */
+/* with an ordinary load followed by a lwsync.  But the general wisdom */
+/* seems to be that a data dependent branch followed by an isync is    */
+/* cheaper.  And the documentation is fairly explicit that this also   */
+/* has acquire semantics.                                              */
+AO_INLINE AO_t
+AO_load_acquire(volatile AO_t *addr)
+{
+  int cr;
+  AO_t result;
+
+  /* FIXME: We should get gcc to allocate one of the condition */
+  /* registers.  I always got "impossible constraint" when I   */
+  /* tried the "y" constraint.                                 */
+  __asm__ __volatile__ (
+    "lwz %0,%1\n"
+    "cmpw cr7,%0,%0\n"
+    "bne- cr7,1f\n"
+    "1: isync\n"
+    : "=r" (result)
+    : "m"(*addr) : "memory", "cc");
+  return result;
+}
+
+#define AO_HAVE_load_acquire
+
+/* We explicitly specify store_release, since it relies        */
+/* on the fact that lwsync is also a LoadStore barrier.                */
+AO_INLINE void
+AO_store_release(volatile AO_t *addr, AO_t value)
+{
+  AO_lwsync();
+  *addr = value;
+}
+
+#define AO_HAVE_load_acquire
+
+/* This is similar to the code in the garbage collector.  Deleting     */
+/* this and having it synthesized from compare_and_swap would probably */
+/* only cost us a load immediate instruction.                          */
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set(volatile AO_TS_t *addr) {
+  int oldval;
+  int temp = 1; /* locked value */
+
+  __asm__ __volatile__(
+               "1:lwarx %0,0,%1\n"   /* load and reserve               */
+               "cmpwi %0, 0\n"       /* if load is                     */
+               "bne 2f\n"            /*   non-zero, return already set */
+               "stwcx. %2,0,%1\n"    /* else store conditional         */
+               "bne- 1b\n"           /* retry if lost reservation      */
+               "2:\n"                /* oldval is zero if we set       */
+              : "=&r"(oldval)
+              : "r"(addr), "r"(temp)
+              : "memory", "cc");
+
+  return oldval;
+}
+
+#define AO_have_test_and_set
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_acquire(volatile AO_TS_t *addr) {
+  AO_TS_VAL_t result = AO_test_and_set(addr);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_test_and_set_acquire
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_release(volatile AO_TS_t *addr) {
+  AO_lwsync();
+  return AO_test_and_set(addr);
+}
+
+#define AO_HAVE_test_and_set_release
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr) {
+  AO_TS_VAL_t result;
+  AO_lwsync();
+  result = AO_test_and_set(addr);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_test_and_set_full
+
+AO_INLINE int
+AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) {
+  AO_t oldval;
+  int result = 0;
+
+  __asm__ __volatile__(
+               "1:lwarx %0,0,%2\n"   /* load and reserve              */
+               "cmpw %0, %4\n"      /* if load is not equal to         */
+               "bne 2f\n"            /*   old, fail                    */
+               "stwcx. %3,0,%2\n"    /* else store conditional         */
+               "bne- 1b\n"           /* retry if lost reservation      */
+              "li %1,1\n"           /* result = 1;                     */
+               "2:\n"
+              : "=&r"(oldval), "=&r"(result)
+              : "r"(addr), "r"(new_val), "r"(old), "1"(result)
+              : "memory", "cc");
+
+  return result;
+}
+
+#define AO_HAVE_compare_and_swap
+
+AO_INLINE int
+AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) {
+  int result = AO_compare_and_swap(addr, old, new_val);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_compare_and_swap_acquire
+
+AO_INLINE int
+AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) {
+  AO_lwsync();
+  return AO_compare_and_swap(addr, old, new_val);
+}
+
+#define AO_HAVE_compare_and_swap_release
+
+AO_INLINE int
+AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) {
+  AO_t result;
+  AO_lwsync();
+  result = AO_compare_and_swap(addr, old, new_val);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_compare_and_swap_full
+
+/* FIXME: We should also implement fetch_and_add and or primitives     */
+/* directly.                                                           */
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/s390.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/s390.h
new file mode 100644 (file)
index 0000000..7cb9986
--- /dev/null
@@ -0,0 +1,63 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* FIXME: untested.                                            */
+/* The relevant documentation appears to be at                 */
+/* http://publibz.boulder.ibm.com/epubs/pdf/dz9zr003.pdf       */
+/* around page 5-96.  Apparently:                              */
+/* - Memory references in general are atomic only for a single         */
+/*   byte.  But it appears that the most common load/store     */
+/*   instructions also guarantee atomicity for aligned                 */
+/*   operands of standard types.  WE FOOLISHLY ASSUME that     */
+/*   compilers only generate those.  If that turns out to be   */
+/*   wrong, we need inline assembly code for AO_load and       */
+/*   AO_store.                                                 */
+/* - A store followed by a load is unordered since the store   */
+/*   may be delayed.  Otherwise everything is ordered.         */
+/* - There is a hardware compare-and-swap (CS) instruction.    */
+
+#include "ordered_except_wr.h"
+#include "all_aligned_atomic_load_store.h"
+
+#include "../test_and_set_t_is_ao_t.h"
+/* FIXME: Is there a way to do byte-sized test-and-set?        */
+
+/* FIXME: AO_nop_full should probably be implemented directly. */
+/* It appears that certain BCR instructions have that effect.  */
+/* Presumably they're cheaper than CS?                         */
+
+AO_INLINE AO_t AO_compare_and_swap_full(volatile AO_t *addr,
+                                               AO_t old, AO_t new_val)
+{
+  int retval;
+  __asm__ __volatile__ (
+# ifndef __s390x__
+    "     cs  %1,%2,0(%3)\n"
+# else
+    "     csg %1,%2,0(%3)\n"
+# endif
+  "     ipm %0\n"
+  "     srl %0,28\n"
+  : "=&d" (retval), "+d" (old)
+  : "d" (new_val), "a" (addr)
+  : "cc", "memory");
+  return retval == 0;
+}
+
+#define AO_HAVE_compare_and_swap_full
+
+/* FIXME: Add double-wide compare-and-swap for 32-bit executables.     */
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h
new file mode 100644 (file)
index 0000000..4850855
--- /dev/null
@@ -0,0 +1,46 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* FIXME.  Very incomplete.  No support for sparc64.   */
+/* Non-ancient SPARCs provide compare-and-swap (casa). */
+/* We should make that available.                      */
+
+#include "../all_atomic_load_store.h"
+
+/* Real SPARC code uses TSO:                           */
+#include "../ordered_except_wr.h"
+
+/* Test_and_set location is just a byte.                */
+#include "../test_and_set_t_is_char.h"
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr) {
+  int oldval;
+
+   __asm__ __volatile__("ldstub %1,%0"
+                       : "=r"(oldval), "=m"(*addr)
+                       : "m"(*addr) : "memory");
+   return oldval;
+}
+
+#define AO_HAVE_test_and_set_full
+
+/* FIXME: This needs to be extended for SPARC v8 and v9.       */
+/* SPARC V8 also has swap.  V9 has CAS.                                */
+/* There are barriers like membar #LoadStore.                  */
+/* CASA (32-bit) and CASXA(64-bit) instructions were           */
+/* added in V9.                                                        */
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h
new file mode 100644 (file)
index 0000000..19d2274
--- /dev/null
@@ -0,0 +1,153 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ * Some of the machine specific code was borrowed from our GC distribution.
+ */
+
+/* The following really assume we have a 486 or better.  Unfortunately */
+/* gcc doesn't define a suitable feature test macro based on command   */
+/* line options.                                                       */
+/* We should perhaps test dynamically.                                 */
+
+#include "../all_aligned_atomic_load_store.h"
+
+/* Real X86 implementations, except for some old WinChips, appear      */
+/* to enforce ordering between memory operations, EXCEPT that a later  */
+/* read can pass earlier writes, presumably due to the visible         */
+/* presence of store buffers.                                          */
+/* We ignore both the WinChips, and the fact that the official specs   */
+/* seem to be much weaker (and arguably too weak to be usable).                */
+
+#include "../ordered_except_wr.h"
+
+#include "../test_and_set_t_is_char.h"
+
+#include "../standard_ao_double_t.h"
+
+#if defined(AO_USE_PENTIUM4_INSTRS)
+AO_INLINE void
+AO_nop_full()
+{
+  __asm__ __volatile__("mfence" : : : "memory");
+}
+
+#define AO_HAVE_nop_full
+
+#else
+
+/* We could use the cpuid instruction.  But that seems to be slower    */
+/* than the default implementation based on test_and_set_full.  Thus   */
+/* we omit that bit of misinformation here.                            */
+
+#endif
+
+/* As far as we can tell, the lfence and sfence instructions are not   */
+/* currently needed or useful for cached memory accesses.              */
+
+/* Really only works for 486 and later */
+AO_INLINE AO_t
+AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
+{
+  AO_t result;
+
+  __asm__ __volatile__ ("lock; xaddl %0, %1" :
+                       "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
+                       : "memory");
+  return result;
+}
+
+#define AO_HAVE_fetch_and_add_full
+
+AO_INLINE unsigned char
+AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr)
+{
+  unsigned char result;
+
+  __asm__ __volatile__ ("lock; xaddb %0, %1" :
+                       "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
+                       : "memory");
+  return result;
+}
+
+#define AO_HAVE_char_fetch_and_add_full
+
+AO_INLINE unsigned short
+AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr)
+{
+  unsigned short result;
+
+  __asm__ __volatile__ ("lock; xaddw %0, %1" :
+                       "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
+                       : "memory");
+  return result;
+}
+
+#define AO_HAVE_short_fetch_and_add_full
+
+/* Really only works for 486 and later */
+AO_INLINE void
+AO_or_full (volatile AO_t *p, AO_t incr)
+{
+  __asm__ __volatile__ ("lock; orl %1, %0" :
+                       "=m" (*p) : "r" (incr), "m" (*p) : "memory");
+}
+
+#define AO_HAVE_or_full
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr)
+{
+  unsigned char oldval;
+  /* Note: the "xchg" instruction does not need a "lock" prefix */
+  __asm__ __volatile__("xchgb %0, %1"
+               : "=r"(oldval), "=m"(*addr)
+               : "0"(0xff), "m"(*addr) : "memory");
+  return (AO_TS_VAL_t)oldval;
+}
+
+#define AO_HAVE_test_and_set_full
+
+/* Returns nonzero if the comparison succeeded. */
+AO_INLINE int
+AO_compare_and_swap_full(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  char result;
+  __asm__ __volatile__("lock; cmpxchgl %3, %0; setz %1"
+                      : "=m"(*addr), "=q"(result)
+                      : "m"(*addr), "r" (new_val), "a"(old) : "memory");
+  return (int) result;
+}
+
+#define AO_HAVE_compare_and_swap_full
+
+/* Returns nonzero if the comparison succeeded. */
+/* Really requires at least a Pentium.         */
+AO_INLINE int
+AO_compare_double_and_swap_double_full(volatile AO_double_t *addr,
+                                      AO_t old_val1, AO_t old_val2,
+                                      AO_t new_val1, AO_t new_val2) 
+{
+  char result;
+  __asm__ __volatile__("lock; cmpxchg8b %0; setz %1"
+                      : "=m"(*addr), "=q"(result)
+                      : "m"(*addr), "d" (old_val1), "a" (old_val2),
+                        "c" (new_val1), "b" (new_val2) : "memory");
+  return (int) result;
+}
+
+#define AO_HAVE_double_compare_and_swap_full
+
+#include "../ao_t_is_int.h"
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h
new file mode 100644 (file)
index 0000000..356476f
--- /dev/null
@@ -0,0 +1,147 @@
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ * Some of the machine specific code was borrowed from our GC distribution.
+ */
+
+/* The following really assume we have a 486 or better.  Unfortunately */
+/* gcc doesn't define a suitable feature test macro based on command   */
+/* line options.                                                       */
+/* We should perhaps test dynamically.                                 */
+
+#include "../all_aligned_atomic_load_store.h"
+
+/* Real X86 implementations, except for some old WinChips, appear      */
+/* to enforce ordering between memory operations, EXCEPT that a later  */
+/* read can pass earlier writes, presumably due to the visible         */
+/* presence of store buffers.                                          */
+/* We ignore both the WinChips, and the fact that the official specs   */
+/* seem to be much weaker (and arguably too weak to be usable).                */
+
+#include "../ordered_except_wr.h"
+
+#include "../test_and_set_t_is_char.h"
+
+#if defined(AO_USE_PENTIUM4_INSTRS)
+AO_INLINE void
+AO_nop_full()
+{
+  __asm__ __volatile__("mfence" : : : "memory");
+}
+
+#define AO_HAVE_nop_full
+
+#else
+
+/* We could use the cpuid instruction.  But that seems to be slower    */
+/* than the default implementation based on test_and_set_full.  Thus   */
+/* we omit that bit of misinformation here.                            */
+
+#endif
+
+/* As far as we can tell, the lfence and sfence instructions are not   */
+/* currently needed or useful for cached memory accesses.              */
+
+/* Really only works for 486 and later */
+AO_INLINE AO_t
+AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
+{
+  AO_t result;
+
+  __asm__ __volatile__ ("lock; xaddq %0, %1" :
+                       "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
+                       : "memory");
+  return result;
+}
+
+#define AO_HAVE_fetch_and_add_full
+
+AO_INLINE unsigned char
+AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr)
+{
+  unsigned char result;
+
+  __asm__ __volatile__ ("lock; xaddb %0, %1" :
+                       "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
+                       : "memory");
+  return result;
+}
+
+#define AO_HAVE_char_fetch_and_add_full
+
+AO_INLINE unsigned short
+AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr)
+{
+  unsigned short result;
+
+  __asm__ __volatile__ ("lock; xaddw %0, %1" :
+                       "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
+                       : "memory");
+  return result;
+}
+
+#define AO_HAVE_short_fetch_and_add_full
+
+AO_INLINE unsigned short
+AO_int_fetch_and_add_full (volatile unsigned int *p, unsigned int incr)
+{
+  unsigned int result;
+
+  __asm__ __volatile__ ("lock; xaddl %0, %1" :
+                       "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
+                       : "memory");
+  return result;
+}
+
+#define AO_HAVE_int_fetch_and_add_full
+
+/* Really only works for 486 and later */
+AO_INLINE void
+AO_or_full (volatile AO_t *p, AO_t incr)
+{
+  __asm__ __volatile__ ("lock; orq %1, %0" :
+                       "=m" (*p) : "r" (incr), "m" (*p) : "memory");
+}
+
+#define AO_HAVE_or_full
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr)
+{
+  unsigned char oldval;
+  /* Note: the "xchg" instruction does not need a "lock" prefix */
+  __asm__ __volatile__("xchgb %0, %1"
+               : "=r"(oldval), "=m"(*addr)
+               : "0"(0xff), "m"(*addr) : "memory");
+  return (AO_TS_VAL_t)oldval;
+}
+
+#define AO_HAVE_test_and_set_full
+
+/* Returns nonzero if the comparison succeeded. */
+AO_INLINE int
+AO_compare_and_swap_full(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  char result;
+  __asm__ __volatile__("lock; cmpxchgq %3, %0; setz %1"
+                      : "=m"(*addr), "=q"(result)
+                      : "m"(*addr), "r" (new_val), "a"(old) : "memory");
+  return (int) result;
+}
+
+#define AO_HAVE_compare_and_swap_full
+
+/* FIXME: The Intel version has a 16byte CAS instruction.      */
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/generic_pthread.h b/libatomic_ops/src/atomic_ops/sysdeps/generic_pthread.h
new file mode 100644 (file)
index 0000000..8d17c0a
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ * 
+ * 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. 
+ */
+
+/* The following is useful primarily for debugging and documentation.  */
+/* We define various atomic operations by acquiring a global pthread   */
+/* lock.  The resulting implementation will perform poorly, but should */
+/* be correct unless it is used from signal handlers.                  */
+/* We assume that all pthread operations act like full memory barriers.        */
+/* (We believe that is the intent of the specification.)               */
+
+#include <pthread.h>
+
+#include "test_and_set_t_is_ao_t.h"
+       /* This is not necessarily compatible with the native           */
+       /* implementation.  But those can't be safely mixed anyway.     */
+
+/* We define only the full barrier variants, and count on the          */
+/* generalization section below to fill in the rest.                   */
+extern pthread_mutex_t AO_pt_lock;
+
+AO_INLINE void
+AO_nop_full()
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  pthread_mutex_unlock(&AO_pt_lock);
+}
+
+#define AO_HAVE_nop_full
+
+AO_INLINE AO_t
+AO_load_full(volatile AO_t *addr)
+{
+  AO_t result;
+  pthread_mutex_lock(&AO_pt_lock);
+  result = *addr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return result;
+}
+
+#define AO_HAVE_load_full
+
+AO_INLINE void
+AO_store_full(volatile AO_t *addr, AO_t val)
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  *addr = val;
+  pthread_mutex_unlock(&AO_pt_lock);
+}
+
+#define AO_HAVE_store_full
+
+AO_INLINE unsigned char
+AO_char_load_full(volatile unsigned char *addr)
+{
+  unsigned char result;
+  pthread_mutex_lock(&AO_pt_lock);
+  result = *addr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return result;
+}
+
+#define AO_HAVE_char_load_full
+
+AO_INLINE void
+AO_char_store_full(volatile unsigned char *addr, unsigned char val)
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  *addr = val;
+  pthread_mutex_unlock(&AO_pt_lock);
+}
+
+#define AO_HAVE_char_store_full
+
+AO_INLINE unsigned short
+AO_short_load_full(volatile unsigned short *addr)
+{
+  unsigned short result;
+  pthread_mutex_lock(&AO_pt_lock);
+  result = *addr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return result;
+}
+
+#define AO_HAVE_short_load_full
+
+AO_INLINE void
+AO_short_store_full(volatile unsigned short *addr, unsigned short val)
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  *addr = val;
+  pthread_mutex_unlock(&AO_pt_lock);
+}
+
+#define AO_HAVE_short_store_full
+
+AO_INLINE unsigned int
+AO_int_load_full(volatile unsigned int *addr)
+{
+  unsigned int result;
+  pthread_mutex_lock(&AO_pt_lock);
+  result = *addr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return result;
+}
+
+#define AO_HAVE_int_load_full
+
+AO_INLINE void
+AO_int_store_full(volatile unsigned int *addr, unsigned int val)
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  *addr = val;
+  pthread_mutex_unlock(&AO_pt_lock);
+}
+
+#define AO_HAVE_int_store_full
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr)
+{
+  AO_TS_VAL_t result;
+  pthread_mutex_lock(&AO_pt_lock);
+  result = (AO_TS_VAL_t)(*addr);
+  *addr = AO_TS_SET;
+  pthread_mutex_unlock(&AO_pt_lock);
+  assert(result == AO_TS_SET || result == AO_TS_CLEAR);
+  return result;
+}
+
+#define AO_HAVE_test_and_set_full
+
+AO_INLINE AO_t
+AO_fetch_and_add_full(volatile AO_t *p, AO_t incr)
+{
+  AO_t tmp;
+
+  pthread_mutex_lock(&AO_pt_lock);
+  tmp = *p;
+  *p = tmp + incr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return tmp;
+}
+
+#define AO_HAVE_fetch_and_add_full
+
+AO_INLINE unsigned char
+AO_char_fetch_and_add_full(volatile unsigned char *p, unsigned char incr)
+{
+  unsigned char tmp;
+
+  pthread_mutex_lock(&AO_pt_lock);
+  tmp = *p;
+  *p = tmp + incr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return tmp;
+}
+
+#define AO_HAVE_char_fetch_and_add_full
+
+AO_INLINE unsigned short
+AO_short_fetch_and_add_full(volatile unsigned short *p, unsigned short incr)
+{
+  unsigned short tmp;
+
+  pthread_mutex_lock(&AO_pt_lock);
+  tmp = *p;
+  *p = tmp + incr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return tmp;
+}
+
+#define AO_HAVE_short_fetch_and_add_full
+
+AO_INLINE unsigned int
+AO_int_fetch_and_add_full(volatile unsigned int *p, unsigned int incr)
+{
+  unsigned int tmp;
+
+  pthread_mutex_lock(&AO_pt_lock);
+  tmp = *p;
+  *p = tmp + incr;
+  pthread_mutex_unlock(&AO_pt_lock);
+  return tmp;
+}
+
+#define AO_HAVE_int_fetch_and_add_full
+
+AO_INLINE void
+AO_or_full(volatile AO_t *p, AO_t incr)
+{
+  AO_t tmp;
+
+  pthread_mutex_lock(&AO_pt_lock);
+  tmp = *p;
+  *p = (tmp | incr);
+  pthread_mutex_unlock(&AO_pt_lock);
+}
+
+#define AO_HAVE_or_full
+
+AO_INLINE int
+AO_compare_and_swap_full(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  if (*addr == old)
+    {
+      *addr = new_val;
+      pthread_mutex_unlock(&AO_pt_lock);
+      return 1;
+    }
+  else
+    pthread_mutex_unlock(&AO_pt_lock);
+    return 0;
+}
+
+#define AO_HAVE_compare_and_swap_full
+
+/* Unlike real architectures, we define both double-width CAS variants. */
+
+typedef struct {
+       AO_t AO_val1;
+       AO_t AO_val2;
+} AO_double_t;
+
+#define AO_HAVE_double_t
+
+AO_INLINE int
+AO_compare_double_and_swap_double_full(volatile AO_double_t *addr,
+                                      AO_t old1, AO_t old2,
+                                      AO_t new1, AO_t new2) 
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  if (addr -> AO_val1 == old1 && addr -> AO_val2 == old2)
+    {
+      addr -> AO_val1 = new1;
+      addr -> AO_val2 = new2;
+      pthread_mutex_unlock(&AO_pt_lock);
+      return 1;
+    }
+  else
+    pthread_mutex_unlock(&AO_pt_lock);
+    return 0;
+}
+
+#define AO_HAVE_compare_double_and_swap_double_full
+
+AO_INLINE int
+AO_compare_and_swap_double_full(volatile AO_double_t *addr,
+                               AO_t old1,
+                               AO_t new1, AO_t new2) 
+{
+  pthread_mutex_lock(&AO_pt_lock);
+  if (addr -> AO_val1 == old1)
+    {
+      addr -> AO_val1 = new1;
+      addr -> AO_val2 = new2;
+      pthread_mutex_unlock(&AO_pt_lock);
+      return 1;
+    }
+  else
+    pthread_mutex_unlock(&AO_pt_lock);
+    return 0;
+}
+
+#define AO_HAVE_compare_and_swap_double_full
+
+/* We can't use hardware loads and stores, since they don't    */
+/* interact correctly with atomic updates.                     */
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/hpc/hppa.h b/libatomic_ops/src/atomic_ops/sysdeps/hpc/hppa.h
new file mode 100644 (file)
index 0000000..80bd94c
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ * 
+ * Derived from the corresponsing header file for gcc.
+ * 
+ */ 
+
+#include "../atomic_load_store.h"
+
+/* Some architecture set descriptions include special "ordered" memory */
+/* operations.  As far as we can tell, no existing processors actually */
+/* require those.  Nor does it appear likely that future processors    */
+/* will.                                                               */
+/* FIXME:                                                              */
+/* The PA emulator on Itanium may obey weaker restrictions.            */
+/* There should be a mode in which we don't assume sequential          */
+/* consistency here.                                                   */
+#include "../ordered.h"
+
+#include <machine/inline.h>
+
+/* GCC will not guarantee the alignment we need, use four lock words   */
+/* and select the correctly aligned datum. See the glibc 2.3.2         */
+/* linuxthread port for the original implementation.                   */
+struct AO_pa_clearable_loc {
+  int data[4];
+};
+
+#undef AO_TS_INITIALIZER
+#define AO_TS_t struct AO_pa_clearable_loc
+#define AO_TS_INITIALIZER {1,1,1,1}
+/* Switch meaning of set and clear, since we only have an atomic clear */
+/* instruction.                                                                */
+typedef enum {AO_PA_TS_set = 0, AO_PA_TS_clear = 1} AO_PA_TS_val;
+#define AO_TS_VAL_t AO_PA_TS_val
+#define AO_TS_CLEAR AO_PA_TS_clear
+#define AO_TS_SET AO_PA_TS_set
+
+/* The hppa only has one atomic read and modify memory operation,      */
+/* load and clear, so hppa spinlocks must use zero to signify that     */
+/* someone is holding the lock.  The address used for the ldcw         */
+/* semaphore must be 16-byte aligned.                                  */
+
+#define __ldcw(a, ret)  \
+  _LDCWX(0 /* index */, 0 /* s */, a /* base */, ret);
+
+/* Because malloc only guarantees 8-byte alignment for malloc'd data,  */
+/* and GCC only guarantees 8-byte alignment for stack locals, we can't */
+/* be assured of 16-byte alignment for atomic lock data even if we     */
+/* specify "__attribute ((aligned(16)))" in the type declaration.  So, */
+/* we use a struct containing an array of four ints for the atomic lock        */
+/* type and dynamically select the 16-byte aligned int from the array  */
+/* for the semaphore.                                                  */
+#define __PA_LDCW_ALIGNMENT 16
+
+#define __ldcw_align(a, ret) { \
+  ret = (unsigned long) a;                     \
+  ret += __PA_LDCW_ALIGNMENT - 1;                                      \
+  ret &= ~(__PA_LDCW_ALIGNMENT - 1);                                   \
+}
+
+/* Works on PA 1.1 and PA 2.0 systems */
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t * addr)
+{
+  register unsigned int ret;
+  register unsigned long a;
+  __ldcw_align (addr, a);
+  __ldcw (a, ret);
+  return ret;
+} 
+
+AO_INLINE void
+AO_pa_clear(volatile AO_TS_t * addr)
+{
+  unsigned long a;
+  __ldcw_align (addr,a);
+  AO_compiler_barrier();
+  *(volatile unsigned int *)a = 1;
+}
+#define AO_CLEAR(addr) AO_pa_clear(addr)
+
+#define AO_HAVE_test_and_set_full
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/hpc/ia64.h b/libatomic_ops/src/atomic_ops/sysdeps/hpc/ia64.h
new file mode 100644 (file)
index 0000000..72552d5
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+/*
+ * This file specifies Itanimum primitives for use with the HP compiler
+ * unde HP/UX.  We use intrinsics instead of the inline assembly code in the
+ * gcc file.
+ */
+
+#include "../atomic_load_store.h"
+
+#include "../acquire_release_volatile.h"
+
+#include "../test_and_set_t_is_char.h"
+
+#include <machine/sys/inline.h>
+
+#ifdef __LP64__
+# define AO_T_FASIZE _FASZ_D
+# define AO_T_SIZE _SZ_D
+#else
+# define AO_T_FASIZE _FASZ_W
+# define AO_T_SIZE _SZ_W
+#endif
+
+AO_INLINE void
+AO_nop_full()
+{
+  _Asm_mf();
+}
+#define AO_HAVE_nop_full
+
+AO_INLINE AO_t
+AO_fetch_and_add1_acquire (volatile AO_t *p)
+{
+  return _Asm_fetchadd(AO_T_FASIZE, _SEM_ACQ, p, 1,
+                      _LDHINT_NONE, _DOWN_MEM_FENCE);
+}
+#define AO_HAVE_fetch_and_add1_acquire
+
+AO_INLINE AO_t
+AO_fetch_and_add1_release (volatile AO_t *p)
+{
+  return _Asm_fetchadd(AO_T_FASIZE, _SEM_REL, p, 1,
+                      _LDHINT_NONE, _UP_MEM_FENCE);
+}
+
+#define AO_HAVE_fetch_and_add1_release
+
+AO_INLINE AO_t
+AO_fetch_and_sub1_acquire (volatile AO_t *p)
+{
+  return _Asm_fetchadd(AO_T_FASIZE, _SEM_ACQ, p, -1,
+                      _LDHINT_NONE, _DOWN_MEM_FENCE);
+}
+
+#define AO_HAVE_fetch_and_sub1_acquire
+
+AO_INLINE AO_t
+AO_fetch_and_sub1_release (volatile AO_t *p)
+{
+  return _Asm_fetchadd(AO_T_FASIZE, _SEM_REL, p, -1,
+                      _LDHINT_NONE, _UP_MEM_FENCE);
+}
+
+#define AO_HAVE_fetch_and_sub1_release
+
+AO_INLINE int
+AO_compare_and_swap_acquire(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  AO_t oldval;
+
+  _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE);
+  oldval = _Asm_cmpxchg(AO_T_SIZE, _SEM_ACQ, addr,
+                       new_val, _LDHINT_NONE, _DOWN_MEM_FENCE);
+  return (oldval == old);
+}
+
+#define AO_HAVE_compare_and_swap_acquire
+
+AO_INLINE int
+AO_compare_and_swap_release(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  AO_t oldval;
+  _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE);
+  oldval = _Asm_cmpxchg(AO_T_SIZE, _SEM_REL, addr,
+                       new_val, _LDHINT_NONE, _UP_MEM_FENCE);
+  /* Hopefully the compiler knows not to reorder the above two? */
+  return (oldval == old);
+}
+
+#define AO_HAVE_compare_and_swap_release
+
+AO_INLINE int
+AO_char_compare_and_swap_acquire(volatile unsigned char *addr,
+                                unsigned char old, unsigned char new_val) 
+{
+  unsigned char oldval;
+
+  _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE);
+  oldval = _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr,
+                       new_val, _LDHINT_NONE, _DOWN_MEM_FENCE);
+  return (oldval == old);
+}
+
+#define AO_HAVE_char_compare_and_swap_acquire
+
+AO_INLINE int
+AO_char_compare_and_swap_release(volatile unsigned char *addr,
+                                unsigned char old, unsigned char new_val) 
+{
+  insigned char oldval;
+  _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE);
+  oldval = _Asm_cmpxchg(_SZ_B, _SEM_REL, addr,
+                       new_val, _LDHINT_NONE, _UP_MEM_FENCE);
+  /* Hopefully the compiler knows not to reorder the above two? */
+  return (oldval == old);
+}
+
+#define AO_HAVE_char_compare_and_swap_release
+
+AO_INLINE int
+AO_short_compare_and_swap_acquire(volatile unsigned short *addr,
+                                unsigned short old, unsigned short new_val) 
+{
+  unsigned short oldval;
+
+  _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE);
+  oldval = _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr,
+                       new_val, _LDHINT_NONE, _DOWN_MEM_FENCE);
+  return (oldval == old);
+}
+
+#define AO_HAVE_short_compare_and_swap_acquire
+
+AO_INLINE int
+AO_short_compare_and_swap_release(volatile unsigned short *addr,
+                                unsigned short old, unsigned short new_val) 
+{
+  insigned short oldval;
+  _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE);
+  oldval = _Asm_cmpxchg(_SZ_B, _SEM_REL, addr,
+                       new_val, _LDHINT_NONE, _UP_MEM_FENCE);
+  /* Hopefully the compiler knows not to reorder the above two? */
+  return (oldval == old);
+}
+
+#define AO_HAVE_short_compare_and_swap_release
+
+#ifndef __LP64__
+# include "ao_t_is_int.h"
+#endif
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/ibmc/powerpc.h b/libatomic_ops/src/atomic_ops/sysdeps/ibmc/powerpc.h
new file mode 100644 (file)
index 0000000..d1f9c50
--- /dev/null
@@ -0,0 +1,126 @@
+/* FIXME.  This is only a placeholder for the AIX compiler.            */
+/* It doesn't work.  Please send a patch.                              */
+/* Memory model documented at http://www-106.ibm.com/developerworks/   */
+/* eserver/articles/archguide.html and (clearer)                       */
+/* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */
+/* There appears to be no implicit ordering between any kind of                */
+/* independent memory references.                                      */
+/* Architecture enforces some ordering based on control dependence.    */
+/* I don't know if that could help.                                    */
+/* Data-dependent loads are always ordered.                            */
+/* Based on the above references, eieio is intended for use on         */
+/* uncached memory, which we don't support.  It does not order loads   */
+/* from cached memory.                                                 */
+/* Thanks to Maged Michael, Doug Lea, and Roger Hoover for helping to  */
+/* track some of this down and correcting my misunderstandings. -HB    */
+
+#include "../all_aligned_atomic_load_store.h"
+
+void AO_sync(void);
+#pragma mc_func AO_sync { "7c0004ac" }
+
+void AO_lwsync(void);
+#pragma mc_func AO_lwsync { "7c2004ac" }
+
+#define AO_nop_write() AO_lwsync()
+#define AO_HAVE_nop_write
+
+#define AO_nop_read() AO_lwsync()
+#define AO_HAVE_nop_read
+
+/* We explicitly specify load_acquire and store_release, since these   */
+/* rely on the fact that lwsync is also a LoadStore barrier.           */
+AO_INLINE AO_t
+AO_load_acquire(volatile AO_t *addr)
+{
+  AO_t result = *addr;
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_load_acquire
+
+AO_INLINE void
+AO_store_release(volatile AO_t *addr, AO_t value)
+{
+  AO_lwsync();
+  *addr = value;
+}
+
+#define AO_HAVE_load_acquire
+
+/* This is similar to the code in the garbage collector.  Deleting     */
+/* this and having it synthesized from compare_and_swap would probably */
+/* only cost us a load immediate instruction.                          */
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set(volatile AO_TS_t *addr) {
+# error Implement me
+}
+
+#define AO_have_test_and_set
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_acquire(volatile AO_TS_t *addr) {
+  AO_TS_VAL_t result = AO_test_and_set(addr);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_test_and_set_acquire
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_release(volatile AO_TS_t *addr) {
+  AO_lwsync();
+  return AO_test_and_set(addr);
+}
+
+#define AO_HAVE_test_and_set_release
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr) {
+  AO_TS_VAL_t result;
+  AO_lwsync();
+  result = AO_test_and_set(addr);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_test_and_set_full
+
+AO_INLINE AO_t
+AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) {
+# error Implement me
+}
+
+#define AO_HAVE_compare_and_swap
+
+AO_INLINE AO_t
+AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) {
+  AO_t result = AO_compare_and_swap(addr, old, new_val);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_compare_and_swap_acquire
+
+AO_INLINE AO_t
+AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) {
+  AO_lwsync();
+  return AO_compare_and_swap(addr, old, new_val);
+}
+
+#define AO_HAVE_compare_and_swap_release
+
+AO_INLINE AO_t
+AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) {
+  AO_t result;
+  AO_lwsync();
+  result = AO_compare_and_swap(addr, old, new_val);
+  AO_lwsync();
+  return result;
+}
+
+#define AO_HAVE_compare_and_swap_full
+
+/* FIXME: We should also implement fetch_and_add and or primitives     */
+/* directly.                                                           */
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/icc/ia64.h b/libatomic_ops/src/atomic_ops/sysdeps/icc/ia64.h
new file mode 100644 (file)
index 0000000..358ddda
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+/*
+ * This file specifies Itanimum primitives for use with the Intel (ecc)
+ * compiler.  We use intrinsics instead of the inline assembly code in the
+ * gcc file.
+ */
+
+#include "../all_atomic_load_store.h"
+
+#include "../test_and_set_t_is_char.h"
+
+#include <ia64intrin.h>
+
+/* The acquire release semantics of volatile can be turned off.  And volatile  */
+/* operations in icc9 don't imply ordering with respect to other nonvolatile   */
+/* operations.                                                                 */
+
+#define AO_INTEL_PTR_t void *
+
+AO_INLINE AO_t
+AO_load_acquire(volatile AO_t *p)
+{
+  return (AO_t)(__ld8_acq((AO_INTEL_PTR_t)p));
+}
+#define AO_HAVE_load_acquire
+
+AO_INLINE void
+AO_store_release(volatile AO_t *p, AO_t val)
+{
+  __st8_rel((AO_INTEL_PTR_t)p, (__int64)val);
+}
+#define AO_HAVE_store_release
+
+AO_INLINE unsigned char
+AO_char_load_acquire(volatile unsigned char *p)
+{
+  /* A normal volatile load generates an ld.acq                */
+  return (__ld1_acq((AO_INTEL_PTR_t)p));
+}
+#define AO_HAVE_char_load_acquire
+
+AO_INLINE void
+AO_char_store_release(volatile unsigned char *p, unsigned char val)
+{
+  __st1_rel((AO_INTEL_PTR_t)p, val);
+}
+#define AO_HAVE_char_store_release
+
+AO_INLINE unsigned short
+AO_short_load_acquire(volatile unsigned short *p)
+{
+  /* A normal volatile load generates an ld.acq                */
+  return (__ld2_acq((AO_INTEL_PTR_t)p));
+}
+#define AO_HAVE_short_load_acquire
+
+AO_INLINE void
+AO_short_store_release(volatile unsigned short *p, unsigned short val)
+{
+  __st2_rel((AO_INTEL_PTR_t)p, val);
+}
+#define AO_HAVE_short_store_release
+
+AO_INLINE unsigned int
+AO_int_load_acquire(volatile unsigned int *p)
+{
+  /* A normal volatile load generates an ld.acq                */
+  return (__ld4_acq((AO_INTEL_PTR_t)p));
+}
+#define AO_HAVE_int_load_acquire
+
+AO_INLINE void
+AO_int_store_release(volatile unsigned int *p, unsigned int val)
+{
+  __st4_rel((AO_INTEL_PTR_t)p, val);
+}
+#define AO_HAVE_int_store_release
+
+AO_INLINE void
+AO_nop_full()
+{
+  __mf();
+}
+#define AO_HAVE_nop_full
+
+AO_INLINE AO_t
+AO_fetch_and_add1_acquire (volatile AO_t *p)
+{
+  return __fetchadd8_acq((unsigned __int64 *)p, 1);
+}
+#define AO_HAVE_fetch_and_add1_acquire
+
+AO_INLINE AO_t
+AO_fetch_and_add1_release (volatile AO_t *p)
+{
+  return __fetchadd8_rel((unsigned __int64 *)p, 1);
+}
+
+#define AO_HAVE_fetch_and_add1_release
+
+AO_INLINE AO_t
+AO_fetch_and_sub1_acquire (volatile AO_t *p)
+{
+  return __fetchadd8_acq((unsigned __int64 *)p, -1);
+}
+
+#define AO_HAVE_fetch_and_sub1_acquire
+
+AO_INLINE AO_t
+AO_fetch_and_sub1_release (volatile AO_t *p)
+{
+  return __fetchadd8_rel((unsigned __int64 *)p, -1);
+}
+
+#define AO_HAVE_fetch_and_sub1_release
+
+AO_INLINE int
+AO_compare_and_swap_acquire(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  AO_t oldval;
+  oldval = _InterlockedCompareExchange64_acq(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_compare_and_swap_acquire
+
+AO_INLINE int
+AO_compare_and_swap_release(volatile AO_t *addr,
+                            AO_t old, AO_t new_val) 
+{
+  AO_t oldval;
+  oldval = _InterlockedCompareExchange64_rel(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_compare_and_swap_release
+
+AO_INLINE int
+AO_char_compare_and_swap_acquire(volatile unsigned char *addr,
+                                unsigned char old, unsigned char new_val) 
+{
+  unsigned char oldval;
+  oldval = _InterlockedCompareExchange8_acq(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_char_compare_and_swap_acquire
+
+AO_INLINE int
+AO_char_compare_and_swap_release(volatile unsigned char *addr,
+                           unsigned char old, unsigned char new_val) 
+{
+  unsigned char oldval;
+  oldval = _InterlockedCompareExchange8_rel(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_char_compare_and_swap_release
+
+AO_INLINE int
+AO_short_compare_and_swap_acquire(volatile unsigned short *addr,
+                                unsigned short old, unsigned short new_val) 
+{
+  unsigned short oldval;
+  oldval = _InterlockedCompareExchange16_acq(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_short_compare_and_swap_acquire
+
+AO_INLINE int
+AO_short_compare_and_swap_release(volatile unsigned short *addr,
+                           unsigned short old, unsigned short new_val) 
+{
+  unsigned short oldval;
+  oldval = _InterlockedCompareExchange16_rel(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_short_compare_and_swap_release
+
+AO_INLINE int
+AO_int_compare_and_swap_acquire(volatile unsigned int *addr,
+                                unsigned int old, unsigned int new_val) 
+{
+  unsigned int oldval;
+  oldval = _InterlockedCompareExchange_acq(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_int_compare_and_swap_acquire
+
+AO_INLINE int
+AO_int_compare_and_swap_release(volatile unsigned int *addr,
+                           unsigned int old, unsigned int new_val) 
+{
+  unsigned int oldval;
+  oldval = _InterlockedCompareExchange_rel(addr, new_val, old);
+  return (oldval == old);
+}
+
+#define AO_HAVE_int_compare_and_swap_release
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/int_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/int_acquire_release_volatile.h
new file mode 100644 (file)
index 0000000..e0a6ed0
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+/*
+ * This file adds definitions appropriate for environments in which an unsigned
+ * int volatile load has acquire semantics, and an unsigned short volatile
+ * store has release semantics.  This is true with the standard Itanium ABI.
+ */
+#if !defined(AO_GCC_BARRIER)
+#  if defined(__GNUC__)
+#    define AO_GCC_BARRIER() AO_compiler_barrier()
+#  else
+#    define AO_GCC_BARRIER()
+#  endif
+#endif
+
+AO_INLINE unsigned int
+AO_int_load_acquire(volatile unsigned int *p)
+{
+  unsigned int result = *p;
+  /* A normal volatile load generates an ld.acq                */
+  AO_GCC_BARRIER();
+  return result;
+}
+#define AO_HAVE_int_load_acquire
+
+AO_INLINE void
+AO_int_store_release(volatile unsigned int *p, unsigned int val)
+{
+  AO_GCC_BARRIER();
+  /* A normal volatile store generates an st.rel       */
+  *p = val;
+}
+#define AO_HAVE_int_store_release
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/int_aligned_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/int_aligned_atomic_load_store.h
new file mode 100644 (file)
index 0000000..fa59656
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Definitions for architecturs on which loads and stores of unsigned int are
+ * atomic fo all legal alignments.
+ */
+
+AO_INLINE unsigned int
+AO_int_load(volatile unsigned int *addr)
+{
+  assert(((unsigned long)addr & (sizeof(unsigned int) - 1)) == 0);
+  /* Cast away the volatile for architectures like IA64 where  */
+  /* volatile adds barrier semantics.                          */
+  return (*(unsigned int *)addr);
+}
+
+#define AO_HAVE_int_load
+
+AO_INLINE void
+AO_int_store(volatile unsigned int *addr, unsigned int new_val)
+{
+  assert(((unsigned long)addr & (sizeof(unsigned int) - 1)) == 0);
+  (*(unsigned int *)addr) = new_val;
+}
+
+#define AO_HAVE_int_store
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/int_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/int_atomic_load_store.h
new file mode 100644 (file)
index 0000000..b2a4813
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Definitions for architecturs on which loads and stores of unsigned int are
+ * atomic for all legal alignments.
+ */
+
+AO_INLINE unsigned int
+AO_int_load(volatile unsigned int *addr)
+{
+  /* Cast away the volatile for architectures like IA64 where  */
+  /* volatile adds barrier semantics.                          */
+  return (*(unsigned int *)addr);
+}
+
+#define AO_HAVE_int_load
+
+AO_INLINE void
+AO_int_store(volatile unsigned int *addr, unsigned int new_val)
+{
+  (*(unsigned int *)addr) = new_val;
+}
+
+#define AO_HAVE_int_store
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86.h b/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86.h
new file mode 100644 (file)
index 0000000..eac112c
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/* The following really assume we have a 486 or better. */
+/* If ASSUME_WINDOWS98 is defined, we assume Windows 98 or newer.      */
+
+#include "../aligned_atomic_load_store.h"
+
+/* Real X86 implementations, except for some old WinChips, appear      */
+/* to enforce ordering between memory operations, EXCEPT that a later  */
+/* read can pass earlier writes, presumably due to the visible         */
+/* presence of store buffers.                                          */
+/* We ignore both the WinChips, and the fact that the official specs   */
+/* seem to be much weaker (and arguably too weak to be usable).                */
+
+#include "../ordered_except_wr.h"
+
+#include "../test_and_set_t_is_ao_t.h"
+       /* We should use byte-sized test-and-set locations, as with     */
+       /* gcc.  But I couldn't find the appropriate compiler           */
+       /* intrinsic.   - HB                                            */
+
+#include <windows.h>
+
+/* As far as we can tell, the lfence and sfence instructions are not   */
+/* currently needed or useful for cached memory accesses.              */
+
+AO_INLINE AO_t
+AO_fetch_and_add1_full (volatile AO_t *p)
+{
+  return InterlockedIncrement((LONG volatile *)p) - 1;
+}
+
+#define AO_HAVE_fetch_and_add1_full
+
+AO_INLINE AO_t
+AO_fetch_and_sub1_full (volatile AO_t *p)
+{
+  return InterlockedDecrement((LONG volatile *)p) + 1;
+}
+
+#define AO_HAVE_fetch_and_sub1_full
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr)
+{
+  return (AO_TS_VAL_t) InterlockedExchange((LONG volatile *)addr,
+                                          (LONG)AO_TS_SET);
+}
+
+#define AO_HAVE_test_and_set_full
+
+#ifdef AO_ASSUME_WINDOWS98
+/* Returns nonzero if the comparison succeeded. */
+AO_INLINE int
+AO_compare_and_swap_full(volatile AO_t *addr,
+                        AO_t old, AO_t new_val) 
+{
+# if 0
+    /* Use the pointer variant, since that should always have the right size. */
+    /* This seems to fail with VC++ 6 on Win2000 because the routine isn't    */
+    /* actually there.                                                       */
+    return InterlockedCompareExchangePointer((PVOID volatile *)addr,
+                                            (PVOID)new_val, (PVOID) old)
+          == (PVOID)old;
+# endif
+    /* FIXME - This is nearly useless on win64.                        */
+    /* Use InterlockedCompareExchange64 for win64?             */
+    return InterlockedCompareExchange((DWORD volatile *)addr,
+                                     (DWORD)new_val, (DWORD) old)
+          == (DWORD)old;
+}
+
+#define AO_HAVE_compare_and_swap_full
+#endif /* ASSUME_WINDOWS98 */
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/ordered.h b/libatomic_ops/src/atomic_ops/sysdeps/ordered.h
new file mode 100644 (file)
index 0000000..2bcd8d8
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * These are common definitions for architectures that provide processor
+ * ordered memory operations.
+ */
+
+#include "ordered_except_wr.h"
+
+AO_INLINE void
+AO_nop_full()
+{
+  AO_compiler_barrier();
+}
+
+#define AO_HAVE_nop_full
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/ordered_except_wr.h b/libatomic_ops/src/atomic_ops/sysdeps/ordered_except_wr.h
new file mode 100644 (file)
index 0000000..b984f0d
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * These are common definitions for architectures that provide processor
+ * ordered memory operations except that a later read may pass an
+ * earlier write.  Real x86 implementations seem to be in this category,
+ * except apparently for some IDT WinChips, which we ignore.
+ */
+
+AO_INLINE void
+AO_nop_write()
+{
+  AO_compiler_barrier();
+  /* sfence according to Intel docs.  Pentium 3 and up.        */
+  /* Unnecessary for cached accesses?                  */
+}
+
+#define AO_HAVE_NOP_WRITE
+
+AO_INLINE void
+AO_nop_read()
+{
+  AO_compiler_barrier();
+}
+
+#define AO_HAVE_NOP_READ
+
+#ifdef AO_HAVE_load
+
+AO_INLINE AO_t
+AO_load_read(volatile AO_t *addr)
+{
+  AO_t result = AO_load(addr);
+  AO_compiler_barrier();
+  return result;
+}
+#define AO_HAVE_load_read
+
+#define AO_load_acquire(addr) AO_load_read(addr)
+#define AO_HAVE_load_acquire
+
+#endif /* AO_HAVE_load */
+
+#ifdef AO_HAVE_char_load
+
+AO_INLINE AO_t
+AO_char_load_read(volatile unsigned char *addr)
+{
+  AO_t result = AO_char_load(addr);
+  AO_compiler_barrier();
+  return result;
+}
+#define AO_HAVE_char_load_read
+
+#define AO_char_load_acquire(addr) AO_char_load_read(addr)
+#define AO_HAVE_char_load_acquire
+
+#endif /* AO_HAVE_char_load */
+
+#ifdef AO_HAVE_short_load
+
+AO_INLINE AO_t
+AO_short_load_read(volatile unsigned short *addr)
+{
+  AO_t result = AO_short_load(addr);
+  AO_compiler_barrier();
+  return result;
+}
+#define AO_HAVE_short_load_read
+
+#define AO_short_load_acquire(addr) AO_short_load_read(addr)
+#define AO_HAVE_short_load_acquire
+
+#endif /* AO_HAVE_short_load */
+
+#ifdef AO_HAVE_int_load
+
+AO_INLINE AO_t
+AO_int_load_read(volatile unsigned int *addr)
+{
+  AO_t result = AO_int_load(addr);
+  AO_compiler_barrier();
+  return result;
+}
+#define AO_HAVE_int_load_read
+
+#define AO_int_load_acquire(addr) AO_int_load_read(addr)
+#define AO_HAVE_int_load_acquire
+
+#endif /* AO_HAVE_int_load */
+
+#if defined(AO_HAVE_store)
+
+AO_INLINE void
+AO_store_write(volatile AO_t *addr, AO_t val)
+{
+  AO_compiler_barrier();
+  AO_store(addr, val);
+}
+# define AO_HAVE_store_write
+
+# define AO_store_release(addr, val) AO_store_write(addr, val)
+# define AO_HAVE_store_release
+
+#endif /* AO_HAVE_store */
+
+#if defined(AO_HAVE_char_store)
+
+AO_INLINE void
+AO_char_store_write(volatile unsigned char *addr, unsigned char val)
+{
+  AO_compiler_barrier();
+  AO_char_store(addr, val);
+}
+# define AO_HAVE_char_store_write
+
+# define AO_char_store_release(addr, val) AO_char_store_write(addr, val)
+# define AO_HAVE_char_store_release
+
+#endif /* AO_HAVE_char_store */
+
+#if defined(AO_HAVE_short_store)
+
+AO_INLINE void
+AO_short_store_write(volatile unsigned short *addr, unsigned short val)
+{
+  AO_compiler_barrier();
+  AO_short_store(addr, val);
+}
+# define AO_HAVE_short_store_write
+
+# define AO_short_store_release(addr, val) AO_short_store_write(addr, val)
+# define AO_HAVE_short_store_release
+
+#endif /* AO_HAVE_short_store */
+
+#if defined(AO_HAVE_int_store)
+
+AO_INLINE void
+AO_int_store_write(volatile unsigned int *addr, unsigned int val)
+{
+  AO_compiler_barrier();
+  AO_int_store(addr, val);
+}
+# define AO_HAVE_int_store_write
+
+# define AO_int_store_release(addr, val) AO_int_store_write(addr, val)
+# define AO_HAVE_int_store_release
+
+#endif /* AO_HAVE_int_store */
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/short_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/short_acquire_release_volatile.h
new file mode 100644 (file)
index 0000000..035ada7
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+/*
+ * This file adds definitions appropriate for environments in which an unsigned short
+ * volatile load has acquire semantics, and an unsigned short volatile store has release
+ * semantics.  This is true with the standard Itanium ABI.
+ */
+#if !defined(AO_GCC_BARRIER)
+#  if defined(__GNUC__)
+#    define AO_GCC_BARRIER() AO_compiler_barrier()
+#  else
+#    define AO_GCC_BARRIER()
+#  endif
+#endif
+
+AO_INLINE unsigned short
+AO_short_load_acquire(volatile unsigned short *p)
+{
+  unsigned short result = *p;
+  /* A normal volatile load generates an ld.acq                */
+  AO_GCC_BARRIER();
+  return result;
+}
+#define AO_HAVE_short_load_acquire
+
+AO_INLINE void
+AO_short_store_release(volatile unsigned short *p, unsigned short val)
+{
+  AO_GCC_BARRIER();
+  /* A normal volatile store generates an st.rel       */
+  *p = val;
+}
+#define AO_HAVE_short_store_release
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/short_aligned_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/short_aligned_atomic_load_store.h
new file mode 100644 (file)
index 0000000..54ed757
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Definitions for architecturs on which loads and stores of unsigned short are
+ * atomic fo all legal alignments.
+ */
+
+AO_INLINE unsigned short
+AO_short_load(volatile unsigned short *addr)
+{
+  assert(((unsigned long)addr & (sizeof(unsigned short) - 1)) == 0);
+  /* Cast away the volatile for architectures like IA64 where  */
+  /* volatile adds barrier semantics.                          */
+  return (*(unsigned short *)addr);
+}
+
+#define AO_HAVE_short_load
+
+AO_INLINE void
+AO_short_store(volatile unsigned short *addr, unsigned short new_val)
+{
+  assert(((unsigned long)addr & (sizeof(unsigned short) - 1)) == 0);
+  (*(unsigned short *)addr) = new_val;
+}
+
+#define AO_HAVE_short_store
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/short_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/short_atomic_load_store.h
new file mode 100644 (file)
index 0000000..f1b5281
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * Definitions for architecturs on which loads and stores of unsigned short are
+ * atomic for all legal alignments.
+ */
+
+AO_INLINE unsigned short
+AO_short_load(volatile unsigned short *addr)
+{
+  /* Cast away the volatile for architectures like IA64 where  */
+  /* volatile adds barrier semantics.                          */
+  return (*(unsigned short *)addr);
+}
+
+#define AO_HAVE_short_load
+
+AO_INLINE void
+AO_short_store(volatile unsigned short *addr, unsigned short new_val)
+{
+  (*(unsigned short *)addr) = new_val;
+}
+
+#define AO_HAVE_short_store
+
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h b/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h
new file mode 100644 (file)
index 0000000..1d08fc7
--- /dev/null
@@ -0,0 +1,8 @@
+typedef union {
+    unsigned long long AO_whole;
+    struct {AO_t AO_v1; AO_t AO_v2;} AO_parts;
+} AO_double_t;
+#define AO_HAVE_double_t
+#define AO_val1 AO_parts.AO_v1
+#define AO_val2 AO_parts.AO_v2
+
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S b/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S
new file mode 100644 (file)
index 0000000..81f0ef0
--- /dev/null
@@ -0,0 +1,5 @@
+       .seg    "text"
+       .globl  AO_test_and_set_full
+AO_test_and_set_full:
+       retl
+         ldstub        [%o0],%o0
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.h b/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.h
new file mode 100644 (file)
index 0000000..3578722
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. 
+ */
+
+#include "../all_atomic_load_store.h"
+
+/* Real SPARC code uses TSO:                            */
+#include "../ordered_except_wr.h"
+
+/* Test_and_set location is just a byte.               */
+#include "../test_and_set_t_is_char.h"
+
+extern AO_TS_VAL_t
+AO_test_and_set_full(volatile AO_TS_t *addr);
+/* Implemented in separate .S file, for now.   */
+
+#define AO_HAVE_test_and_set_full
+
+/* FIXME: Like the gcc version, this needs to be extended for V8       */
+/* and V9.                                                             */
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h b/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h
new file mode 100644 (file)
index 0000000..663bccf
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * These are common definitions for architectures on which test_and_set
+ * operates on pointer-sized quantities, the "clear" value contains
+ * all zeroes, and the "set" value contains all ones.
+ * This can be used if test_and_set is synthesized from compare_and_swap.
+ */
+typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; 
+#define AO_TS_VAL_t AO_TS_val
+#define AO_TS_CLEAR AO_TS_clear
+#define AO_TS_SET AO_TS_set
+
+#define AO_TS_t AO_t
+
+#define AO_AO_TS_T 1
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_char.h b/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_char.h
new file mode 100644 (file)
index 0000000..bde0f21
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */ 
+
+/*
+ * These are common definitions for architectures on which test_and_set
+ * operates on byte sized quantities, the "clear" value contains
+ * all zeroes, and the "set" value contains all ones.
+ */
+
+#define AO_TS_t unsigned char
+typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val;
+#define AO_TS_VAL_t AO_BYTE_TS_val
+#define AO_TS_CLEAR AO_BYTE_TS_clear
+#define AO_TS_SET AO_BYTE_TS_set
+
+#define AO_CHAR_TS_T 1
+
+
+
diff --git a/libatomic_ops/src/atomic_ops_malloc.c b/libatomic_ops/src/atomic_ops_malloc.c
new file mode 100644 (file)
index 0000000..dff4908
--- /dev/null
@@ -0,0 +1,288 @@
+/*  
+ * Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+ * Original Author: Hans Boehm
+ *
+ * This file may be redistributed and/or modified under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2, or (at your option) any later version.
+ * 
+ * It 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 in the
+ * file doc/COPYING for more details.
+ */
+
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
+#endif
+
+#define AO_REQUIRE_CAS
+#include "atomic_ops_stack.h"
+#include <string.h>    /* for ffs, which is assumed reentrant. */
+#include <stdlib.h>
+#ifdef AO_TRACE_MALLOC
+# include <stdio.h>
+# include <pthread.h>
+#endif
+
+/*
+ * We round up each allocation request to the next power of two
+ * minus one word.
+ * We keep one stack of free objects for each size.  Each object
+ * has an initial word (offset -sizeof(AO_t) from the visible pointer)
+ * which contains either
+ *     The binary log of the object size in bytes (small objects)
+ *     The object size (a multiple of CHUNK_SIZE) for large objects.
+ * The second case only arises if mmap-based allocation is supported.
+ * We align the user-visible part of each object on a GRANULARITY
+ * byte boundary.  That means that the actual (hidden) start of
+ * the object starts a word before this boundary.
+ */
+
+#ifndef LOG_MAX_SIZE
+# define LOG_MAX_SIZE 16
+       /* We assume that 2**LOG_MAX_SIZE is a multiple of page size. */
+#endif
+
+#ifndef ALIGNMENT
+# define ALIGNMENT 16
+       /* Assumed to be at least sizeof(AO_t).         */
+#endif
+
+#define CHUNK_SIZE (1 << LOG_MAX_SIZE)
+
+#ifndef AO_INITIAL_HEAP_SIZE
+#  define AO_INITIAL_HEAP_SIZE (2*(LOG_MAX_SIZE+1)*CHUNK_SIZE)
+#endif
+
+char AO_initial_heap[AO_INITIAL_HEAP_SIZE];
+
+static volatile AO_t initial_heap_ptr = (AO_t)AO_initial_heap;
+static volatile char *initial_heap_lim = AO_initial_heap + AO_INITIAL_HEAP_SIZE;
+
+#if defined(HAVE_MMAP)
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+static volatile AO_t mmap_enabled = 0;
+
+void
+AO_malloc_enable_mmap(void)
+{
+  AO_store(&mmap_enabled, 1);
+}
+
+static char *get_mmaped(size_t sz)
+{
+  char * result;
+
+  assert(!(sz & (CHUNK_SIZE - 1)));
+  if (!mmap_enabled) return 0;
+# if defined(MAP_ANONYMOUS)
+    result = mmap(0, sz, PROT_READ | PROT_WRITE,
+                 MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+# elif defined(MAP_ANON)
+    result = mmap(0, sz, PROT_READ | PROT_WRITE,
+                 MAP_PRIVATE | MAP_ANON, -1, 0);
+# else
+    {
+      int zero_fd = open("/dev/zero", O_RDONLY);
+      result = mmap(0, sz, PROT_READ | PROT_WRITE,
+                   MAP_PRIVATE, zero_fd, 0);
+      close(zero_fd);
+    }
+# endif
+  if (result == MAP_FAILED) result = 0;
+  return result;
+}
+
+/* Allocate an object of size (incl. header) of size > CHUNK_SIZE.     */
+/* sz includes space for an AO_t-sized header.                         */
+static char *
+AO_malloc_large(size_t sz)
+{
+ char * result;
+ /* The header will force us to waste ALIGNMENT bytes, incl. header.   */
+   sz += ALIGNMENT;
+ /* Round to multiple of CHUNK_SIZE.   */
+   sz = (sz + CHUNK_SIZE - 1) & ~(CHUNK_SIZE - 1);
+ result = get_mmaped(sz);
+ if (result == 0) return 0;
+ result += ALIGNMENT;
+ ((AO_t *)result)[-1] = (AO_t)sz;
+ return result;
+}
+
+static void
+AO_free_large(char * p)
+{
+  AO_t sz = ((AO_t *)p)[-1];
+  if (munmap(p - ALIGNMENT, (size_t)sz) != 0)
+    abort();  /* Programmer error.  Not really async-signal-safe, but ... */
+}
+  
+
+#else /*  No MMAP */
+
+void
+AO_malloc_enable_mmap(void)
+{
+}
+
+static char *get_mmaped(size_t sz)
+{
+  return 0;
+}
+
+static char *
+AO_malloc_large(size_t sz)
+{
+  return 0;
+}
+
+static void
+AO_free_large(char * p)
+{
+  abort();  /* Programmer error.  Not really async-signal-safe, but ... */
+}
+
+#endif /* No MMAP */
+
+static char *
+get_chunk(void)
+{
+  char *initial_ptr;
+  char *my_chunk_ptr;
+  char * my_lim;
+
+retry:
+  initial_ptr = (char *)AO_load(&initial_heap_ptr);
+  my_chunk_ptr = (char *)(((AO_t)initial_ptr + (ALIGNMENT - 1))
+                         & ~(ALIGNMENT - 1));
+  if (initial_ptr != my_chunk_ptr)
+    {
+      /* Align correctly.  If this fails, someone else did it for us.  */
+      AO_compare_and_swap_acquire(&initial_heap_ptr, (AO_t)initial_ptr,
+                                 (AO_t)my_chunk_ptr);
+    }
+  my_lim = my_chunk_ptr + CHUNK_SIZE;
+  if (my_lim <= initial_heap_lim)
+    {
+      if (!AO_compare_and_swap(&initial_heap_ptr, (AO_t)my_chunk_ptr,
+                                                 (AO_t)my_lim))
+        goto retry;
+      return my_chunk_ptr;
+    }
+  /* We failed.  The initial heap is used up.  */
+  my_chunk_ptr = get_mmaped(CHUNK_SIZE);
+  assert (!((AO_t)my_chunk_ptr & (ALIGNMENT-1)));
+  return my_chunk_ptr;
+}
+
+/* Object free lists.  Ith entry corresponds to objects        */
+/* of total size 2**i bytes.                                   */
+AO_stack_t AO_free_list[LOG_MAX_SIZE+1];
+
+/* Chunk free list, linked through first word in chunks.       */
+/* All entries of size CHUNK_SIZE.                             */
+AO_stack_t AO_chunk_free_list;
+
+/* Break up the chunk, and add it to the object free list for  */
+/* the given size.  Sz must be a power of two.                 */
+/* We have exclusive access to chunk.                          */
+static void
+add_chunk_as(void * chunk, size_t sz, unsigned log_sz)
+{
+  char *first = (char *)chunk + ALIGNMENT - sizeof(AO_t);
+  char *limit = (char *)chunk + CHUNK_SIZE - sz;
+  char *next, *p;
+
+  for (p = first; p <= limit; p = next) {
+    next = p + sz;
+    AO_stack_push(AO_free_list+log_sz, (AO_t *)p);
+  }
+}
+
+static int msbs[16] = {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4};
+
+/* Return the position of the most significant set bit in the  */
+/* argument.                                                   */
+/* We follow the conventions of ffs(), i.e. the least          */
+/* significant bit is number one.                              */
+int msb(size_t s)
+{
+  int result = 0;
+  if ((s & 0xff) != s) {
+    /* The following shift often generates warnings on 32-bit arch's   */
+    /* That's OK, because it will never be executed there.             */
+    if (sizeof(size_t) > 4 && (s >> 32) != 0)
+      {
+       s >>= 32;
+       result += 32;
+      }
+    if ((s >> 16) != 0)
+      {
+       s >>= 16;
+       result += 16;
+      }
+    if ((s >> 8) != 0)
+      {
+       s >>= 8;
+       result += 8;
+      }
+  }
+  if (s > 15)
+    {
+      s >>= 4;
+      result += 4;
+    }
+  result += msbs[s];
+  return result;
+}
+
+void *
+AO_malloc(size_t sz)
+{
+  AO_t *result;
+  size_t adj_sz = sz + sizeof(AO_t);
+  int log_sz;
+  if (sz > CHUNK_SIZE)
+    return AO_malloc_large(sz);
+  log_sz = msb(adj_sz-1);
+  result = AO_stack_pop(AO_free_list+log_sz);
+  while (0 == result) {
+    void * chunk = get_chunk();
+    if (0 == chunk) return 0;
+    adj_sz = 1 << log_sz;
+    add_chunk_as(chunk, adj_sz, log_sz);
+    result = AO_stack_pop(AO_free_list+log_sz);
+  }
+  *result = log_sz;
+# ifdef AO_TRACE_MALLOC
+    fprintf(stderr, "%x: AO_malloc(%lu) = %p\n",
+                   (int)pthread_self(), (unsigned long)sz, result+1);
+# endif
+  return result + 1;
+}
+
+void
+AO_free(void *p)
+{
+  char *base = (char *)p - sizeof(AO_t);
+  int log_sz;
+
+  if (0 == p) return;
+  log_sz = *(AO_t *)base;
+# ifdef AO_TRACE_MALLOC
+    fprintf(stderr, "%x: AO_free(%p sz:%lu)\n", (int)pthread_self(), p,
+                   (unsigned long)
+                     (log_sz > LOG_MAX_SIZE? log_sz : (1 << log_sz)));
+# endif
+  if (log_sz > LOG_MAX_SIZE)
+    AO_free_large(p);
+  else
+    AO_stack_push(AO_free_list+log_sz, (AO_t *)base);
+}
diff --git a/libatomic_ops/src/atomic_ops_malloc.h b/libatomic_ops/src/atomic_ops_malloc.h
new file mode 100644 (file)
index 0000000..c55d27c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/* Almost lock-free malloc implementation based on stack implementation. */
+/* See README.malloc file for detailed usage rules.                     */
+
+#ifndef AO_ATOMIC_H
+#define AO_ATOMIC_H
+
+#include <stdlib.h>    /* For size_t */
+
+#include "atomic_ops_stack.h"
+
+#ifdef AO_STACK_IS_LOCK_FREE
+# define AO_MALLOC_IS_LOCK_FREE
+#endif
+
+void AO_free(void *);
+
+void * AO_malloc(size_t);
+
+/* Allow use of mmpa to grow the heap.  No-op on some platforms.       */
+void AO_malloc_enable_mmap(void);
+
+#endif /* !AO_ATOMIC_H */
diff --git a/libatomic_ops/src/atomic_ops_stack.c b/libatomic_ops/src/atomic_ops_stack.c
new file mode 100644 (file)
index 0000000..c3df101
--- /dev/null
@@ -0,0 +1,302 @@
+/*  
+ * Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+ * Original Author: Hans Boehm
+ *
+ * This file may be redistributed and/or modified under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2, or (at your option) any later version.
+ * 
+ * It 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 in the
+ * file doc/COPYING for more details.
+ */
+
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#define AO_REQUIRE_CAS
+#include "atomic_ops_stack.h"
+
+#if defined(_MSC_VER) \
+    || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
+  /* AO_pause not defined elsewhere */
+  /* FIXME: At least AO_spin should be factored out.   */
+#include <windows.h>
+
+AO_t dummy;
+
+/* Spin for 2**n units. */
+static void AO_spin(int n)
+{
+  int i;
+  AO_T j = AO_load(&dummy);
+
+  for (i = 0; i < (2 << n); ++i)
+    {
+       j *= 5;
+       j -= 4;
+    }
+  AO_store(&dummy, j);
+}
+
+void AO_pause(int n)
+{
+    if (n < 12)
+      AO_spin(n);
+    else
+      {
+        DWORD msecs;
+
+       /* Short async-signal-safe sleep. */
+       msecs = (n > 18? 100 : (1 << (n - 12)));
+       Sleep(msecs);
+      }
+}
+
+#else 
+
+/* AO_pause is available elsewhere */
+
+extern void AO_pause(int);
+
+#endif
+
+#ifdef AO_USE_ALMOST_LOCK_FREE
+
+/* LIFO linked lists based on compare-and-swap.  We need to avoid      */
+/* the case of a node deleton and reinsertion while I'm deleting       */
+/* it, since that may cause my CAS to succeed eventhough the next      */
+/* pointer is now wrong.  Our solution is not fully lock-free, but it  */
+/* is good enough for signal handlers, provided we have a suitably low */
+/* bound on the number of recursive signal handler reentries.                  */
+/* A list consists of a first pointer and a blacklist                  */
+/* of pointer values that are currently being removed.  No list element        */
+/* on the blacklist may be inserted.  If we would otherwise do so, we  */
+/* are allowed to insert a variant that differs only in the least      */
+/* significant, ignored, bits.  If the list is full, we wait.          */
+
+/* Crucial observation: A particular padded pointer x (i.e. pointer    */
+/* plus arbitrary low order bits) can never be newly inserted into     */
+/* a list while it's in the corresponding auxiliary data structure.    */
+
+/* The second argument is a pointer to the link field of the element   */
+/* to be inserted.                                                     */
+/* Both list headers and link fields contain "perturbed" pointers, i.e.        */
+/* pointers with extra bits "or"ed into the low order bits.            */
+void
+AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x,
+                                  AO_stack_aux *a)
+{
+  int i;
+  AO_t x_bits = (AO_t)x;
+  AO_t next;
+  
+  /* No deletions of x can start here, since x is not currently in the */
+  /* list.                                                             */
+ retry:
+# if AO_BL_SIZE == 2
+  {
+    /* Start all loads as close to concurrently as possible. */
+    AO_t entry1 = AO_load(a -> AO_stack_bl);
+    AO_t entry2 = AO_load(a -> AO_stack_bl + 1);
+    if (entry1 == x_bits || entry2 == x_bits)
+      {
+       /* Entry is currently being removed.  Change it a little.     */
+         ++x_bits;
+         if ((x_bits & AO_BIT_MASK) == 0)
+           /* Version count overflowed;         */
+           /* EXTREMELY unlikely, but possible. */
+           x_bits = (AO_t)x;
+       goto retry;
+      }
+  }
+# else
+    for (i = 0; i < AO_BL_SIZE; ++i)
+      {
+        if (AO_load(a -> AO_stack_bl + i) == x_bits)
+          {
+           /* Entry is currently being removed.  Change it a little.     */
+             ++x_bits;
+             if ((x_bits & AO_BIT_MASK) == 0)
+               /* Version count overflowed;         */
+               /* EXTREMELY unlikely, but possible. */
+               x_bits = (AO_t)x;
+           goto retry;
+          }
+      }
+# endif
+  /* x_bits is not currently being deleted */
+  do
+    {
+      next = AO_load(list);
+      *x = next;
+    }
+  while(!AO_compare_and_swap_release(list, next, x_bits));
+}
+
+/*
+ * I concluded experimentally that checking a value first before
+ * performing a compare-and-swap is usually beneficial on X86, but
+ * slows things down appreciably with contention on Itanium.
+ * ince the Itanium behavior makes more sense to me (more cache line
+ * movement unless we're mostly reading, but back-off should guard
+ * against that), we take Itanium as the default.  Measurements on
+ * other multiprocessor architectures would be useful.  (On a uniprocessor,
+ * the initial check is almost certainly a very small loss.) - HB
+ */
+#ifdef __i386__
+# define PRECHECK(a) (a) == 0 &&
+#else
+# define PRECHECK(a)
+#endif
+
+AO_t *
+AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a)
+{
+  unsigned i;
+  int j = 0;
+  AO_t first;
+  AO_t * first_ptr;
+  AO_t next;
+
+ retry:
+  first = AO_load(list);
+  if (0 == first) return 0;
+  /* Insert first into aux black list.                                 */
+  /* This may spin if more than AO_BL_SIZE removals using auxiliary    */
+  /* structure a are currently in progress.                            */
+  for (i = 0; ; )
+    {
+      if (PRECHECK(a -> AO_stack_bl[i])
+         AO_compare_and_swap_acquire(a->AO_stack_bl+i, 0, first))
+        break;
+      ++i;
+      if ( i >= AO_BL_SIZE )
+       {
+         i = 0;
+         AO_pause(++j);
+       }
+    }
+  assert(i >= 0 && i < AO_BL_SIZE);
+  assert(a -> AO_stack_bl[i] == first);
+  /* First is on the auxiliary black list.  It may be removed by       */
+  /* another thread before we get to it, but a new insertion of x      */
+  /* cannot be started here.                                           */
+  /* Only we can remove it from the black list.                                */
+  /* We need to make sure that first is still the first entry on the   */
+  /* list.  Otherwise it's possible that a reinsertion of it was       */
+  /* already started before we added the black list entry.             */
+  if (first != AO_load(list)) {
+    AO_store_release(a->AO_stack_bl+i, 0);
+    goto retry;
+  }
+  first_ptr = AO_REAL_NEXT_PTR(first);
+  next = AO_load(first_ptr);
+  if (!AO_compare_and_swap_release(list, first, next)) {
+    AO_store_release(a->AO_stack_bl+i, 0);
+    goto retry;
+  }
+  assert(*list != first);
+  /* Since we never insert an entry on the black list, this cannot have        */
+  /* succeeded unless first remained on the list while we were running.        */
+  /* Thus its next link cannot have changed out from under us, and we  */
+  /* removed exactly one entry and preserved the rest of the list.     */
+  /* Note that it is quite possible that an additional entry was       */
+  /* inserted and removed while we were running; this is OK since the  */
+  /* part of the list following first must have remained unchanged, and        */
+  /* first must again have been at the head of the list when the       */
+  /* compare_and_swap succeeded.                                       */
+  AO_store_release(a->AO_stack_bl+i, 0);
+  return first_ptr;
+}
+
+#else /* ! USE_ALMOST_LOCK_FREE */
+
+/* Better names for fields in AO_stack_t */
+#define ptr AO_val2
+#define version AO_val1
+
+#if defined(AO_HAVE_compare_double_and_swap_double)
+
+void AO_stack_push_release(AO_stack_t *list, AO_t *element)
+{
+    AO_t next;
+
+    do {
+      next = AO_load(&(list -> ptr));
+      *element = next;
+    } while (!AO_compare_and_swap_release
+                   ( &(list -> ptr), next, (AO_t) element));
+    /* This uses a narrow CAS here, an old optimization suggested      */
+    /* by Treiber.  Pop is still safe, since we run into the ABA       */
+    /* problem only if there were both interveining "pop"s and "push"es.*/
+    /* Inthat case we still see a change inthe version number.         */
+}
+
+AO_t *AO_stack_pop_acquire(AO_stack_t *list)
+{
+    AO_t *cptr;
+    AO_t next;
+    AO_t cversion;
+
+    do {
+      /* Version must be loaded first. */
+      cversion = AO_load_acquire(&(list -> version));
+      cptr = (AO_t *)AO_load(&(list -> ptr));
+      if (cptr == 0) return 0;
+      next = *cptr;
+    } while (!AO_compare_double_and_swap_double_release
+                   (list, cversion, (AO_t) cptr, cversion+1, (AO_t) next));
+    return cptr;
+}
+
+
+#elif defined(AO_HAVE_compare_and_swap_double)
+
+/* Needed for future IA64 processors.  No current clients? */
+
+#error Untested!  Probably doesnt work.
+
+/* We have a wide CAS, but only does an AO_t-wide comparison.  */
+/* We can't use the Treiber optimization, since we only check  */
+/* for an unchanged version number, not an unchanged pointer.  */
+void AO_stack_push_release(AO_stack_t *list, AO_t *element)
+{
+    AO_t version;
+    AO_t next_ptr;
+
+    do {
+      /* Again version must be loaded first, for different reason.     */
+      version = AO_load_acquire(&(list -> version));
+      next_ptr = AO_load(&(list -> ptr));
+      *element = next_ptr;
+    } while (!AO_compare_and_swap_double_release(
+                          list, version,
+                          version+1, (AO_t) element));
+}
+
+AO_t *AO_stack_pop_acquire(AO_stack_t *list)
+{
+    AO_t *cptr;
+    AO_t next;
+    AO_t cversion;
+
+    do {
+      cversion = AO_load_acquire(&(list -> version));
+      cptr = (AO_t *)AO_load(&(list -> ptr));
+      if (cptr == 0) return 0;
+      next = *cptr;
+    } while (!AO_compare_double_and_swap_double_release
+                   (list, cversion, (AO_t) cptr, cversion+1, next));
+    return cptr;
+}
+
+
+#endif /* AO_HAVE_compare_and_swap_double */
+
+#endif /* ! USE_ALMOST_LOCK_FREE */
diff --git a/libatomic_ops/src/atomic_ops_stack.h b/libatomic_ops/src/atomic_ops_stack.h
new file mode 100644 (file)
index 0000000..f0c789b
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * The implementation of the routines described here is covered by the GPL.
+ * This header file is covered by the following license:
+ */
+
+/*
+ * Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+ * 
+ * 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. 
+ */
+
+/* Almost lock-free LIFO linked lists (linked stacks). */
+#ifndef AO_STACK_H
+#define AO_STACK_H
+
+#include "atomic_ops.h"
+
+#if !defined(AO_HAVE_compare_double_and_swap_double) \
+    && !defined(AO_HAVE_compare_double_and_swap) \
+    && defined(AO_HAVE_compare_and_swap)
+# define AO_USE_ALMOST_LOCK_FREE
+#else
+  /* If we have no compare-and-swap operation defined, we assume       */
+  /* that we will actually be using CAS emulation.  If we do that,     */
+  /* it's cheaper to use the version-based implementation.             */
+# define AO_STACK_IS_LOCK_FREE
+#endif
+
+/*
+ * These are not guaranteed to be completely lock-free.
+ * List insertion may spin under extremely unlikely conditions.
+ * It cannot deadlock due to recursive reentry unless AO_list_remove
+ * is called while at least AO_BL_SIZE activations of 
+ * AO_list_remove are currently active in the same thread, i.e.
+ * we must have at least AO_BL_SIZE recursive signal handler
+ * invocations.
+ *
+ * All operations take an AO_list_aux argument.  It is safe to
+ * share a single AO_list_aux structure among all lists, but that
+ * may increase contention.  Any given list must always be accessed
+ * with the same AO_list_aux structure.
+ *
+ * We make some machine-dependent assumptions:
+ *   - We have a compare-and-swap operation.
+ *   - At least _AO_N_BITS low order bits in pointers are
+ *     zero and normally unused.
+ *   - size_t and pointers have the same size.
+ *
+ * We do use a fully lock-free implementation if double-width
+ * compare-and-swap operations are available.
+ */
+
+#ifdef AO_USE_ALMOST_LOCK_FREE
+/* The number of low order pointer bits we can use for a small */
+/* version number.                                             */
+# if defined(__LP64__) || defined(_LP64) || defined(_WIN64)
+   /* WIN64 isn't really supported yet.        */
+#  define AO_N_BITS 3
+# else
+#  define AO_N_BITS 2
+# endif
+
+# define AO_BIT_MASK ((1 << AO_N_BITS) - 1)
+/*
+ * AO_stack_aux should be treated as opaque.
+ * It is fully defined here, so it can be allocated, and to facilitate
+ * debugging.
+ */
+#ifndef AO_BL_SIZE
+#  define AO_BL_SIZE 2
+#endif
+
+#if AO_BL_SIZE > (1 << AO_N_BITS)
+#  error AO_BL_SIZE too big
+#endif
+
+typedef struct AO__stack_aux {
+  volatile AO_t AO_stack_bl[AO_BL_SIZE];
+} AO_stack_aux;
+
+/* The stack implementation knows only about the lecation of   */
+/* link fields in nodes, and nothing about the rest of the     */
+/* stack elements.  Link fields hold an AO_t, which is not     */
+/* necessarily a real pointer.  This converts the AO_t to a    */
+/* real (AO_t *) which is either o, or points at the link      */
+/* field in the next node.                                     */
+#define AO_REAL_NEXT_PTR(x) (AO_t *)((x) & ~AO_BIT_MASK)
+
+/* The following two routines should not normally be used directly.    */
+/* We make them visible here for the rare cases in which it makes sense        */
+/* to share the an AO_stack_aux between stacks.                                */
+void
+AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x,
+                                 AO_stack_aux *);
+
+AO_t *
+AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux *);
+
+/* And now AO_stack_t for the real interface:                          */
+
+typedef struct AO__stack {
+  volatile AO_t AO_ptr;
+  AO_stack_aux AO_aux;
+} AO_stack_t;
+
+#define AO_STACK_INITIALIZER {0}
+
+AO_INLINE void AO_stack_init(AO_stack_t *list)
+{
+# if AO_BL_SIZE == 2
+    list -> AO_aux.AO_stack_bl[0] = 0;
+    list -> AO_aux.AO_stack_bl[1] = 0;
+# else
+    int i;
+    for (i = 0; i < AO_BL_SIZE; ++i)
+      list -> AO_aux.AO_stack_bl[i] = 0;
+# endif
+  list -> AO_ptr = 0;
+}
+
+/* Convert an AO_stack_t to a pointer to the link field in     */
+/* the first element.                                          */
+#define AO_REAL_HEAD_PTR(x) AO_REAL_NEXT_PTR((x).AO_ptr)
+
+#define AO_stack_push_release(l, e) \
+       AO_stack_push_explicit_aux_release(&((l)->AO_ptr), e, &((l)->AO_aux))
+#define AO_HAVE_stack_push_release
+
+#define AO_stack_pop_acquire(l) \
+       AO_stack_pop_explicit_aux_acquire(&((l)->AO_ptr), &((l)->AO_aux))
+#define AO_HAVE_stack_pop_acquire
+
+# else /* Use fully non-blocking data structure, wide CAS      */
+
+#ifndef AO_HAVE_double_t
+  /* Can happen if we're using CAS emulation, since we don't want to   */
+  /* force that here, in case other atomic_ops clients don't want it.  */
+# include "atomic_ops/sysdeps/standard_ao_double_t.h"
+#endif
+
+typedef volatile AO_double_t AO_stack_t;
+/* AO_val1 is version, AO_val2 is pointer.     */
+
+#define AO_STACK_INITIALIZER {0}
+
+AO_INLINE void AO_stack_init(AO_stack_t *list)
+{
+  list -> AO_val1 = 0;
+  list -> AO_val2 = 0;
+}
+
+#define AO_REAL_HEAD_PTR(x) (AO_t *)((x).AO_val2)
+#define AO_REAL_NEXT_PTR(x) (AO_t *)(x)
+
+void AO_stack_push_release(AO_stack_t *list, AO_t *new_element);
+#define AO_HAVE_stack_push_release
+AO_t * AO_stack_pop_acquire(AO_stack_t *list);
+#define AO_HAVE_stack_pop_acquire
+
+#endif /* Wide CAS case */
+
+#if defined(AO_HAVE_stack_push_release) && !defined(AO_HAVE_stack_push)
+# define AO_stack_push(l, e) AO_stack_push_release(l, e)
+# define AO_HAVE_stack_push
+#endif
+
+#if defined(AO_HAVE_stack_pop_acquire) && !defined(AO_HAVE_stack_pop)
+# define AO_stack_pop(l) AO_stack_pop_acquire(l)
+# define AO_HAVE_stack_pop
+#endif
+
+#endif /* !AO_STACK_H */
diff --git a/libatomic_ops/src/atomic_ops_sysdeps.S b/libatomic_ops/src/atomic_ops_sysdeps.S
new file mode 100644 (file)
index 0000000..f586f23
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * Include the appropriate system-dependent assembly file, if any.
+ * This is used only if the platform supports neither inline assembly
+ * code, nor appropriate compiler intrinsics.
+ */
+
+#if !defined(__GNUC__) && (defined(sparc) || defined(__sparc))
+#  include "atomic_ops/sysdeps/sunc/sparc.S"
+#endif
diff --git a/libatomic_ops/src/config.h.in b/libatomic_ops/src/config.h.in
new file mode 100644 (file)
index 0000000..5b61fbd
--- /dev/null
@@ -0,0 +1,58 @@
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
diff --git a/libatomic_ops/tests/Makefile.am b/libatomic_ops/tests/Makefile.am
new file mode 100644 (file)
index 0000000..0f186cc
--- /dev/null
@@ -0,0 +1,51 @@
+EXTRA_DIST=test_atomic.template list_atomic.template run_parallel.inc \
+          test_atomic_include.h
+# We distribute test_atomic_include.h, since it's hard to regenerate
+# on Windows without sed.
+
+BUILT_SOURCES = test_atomic_include.h list_atomic.i
+CLEANFILES = test_atomic_include.h list_atomic.c list_atomic.i
+
+AM_CPPFLAGS=-I$(srcdir)/../src
+
+TESTS=test_atomic test_atomic_pthreads test_stack test_malloc
+
+#create the test_atomic test program
+check_PROGRAMS=test_atomic test_atomic_pthreads test_stack test_malloc
+
+test_atomic_SOURCES=test_atomic.c
+test_atomic_LDADD=-lpthread ../src/libatomic_ops.a
+
+test_atomic_pthreads_SOURCES=test_atomic.c 
+test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS)
+test_atomic_pthreads_LDADD=-lpthread ../src/libatomic_ops.a
+
+test_stack_SOURCES=test_stack.c 
+test_stack_LDADD=-lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a 
+
+test_malloc_SOURCES=test_malloc.c 
+test_malloc_LDADD=-lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a 
+
+test_atomic_include.h: test_atomic.template
+       sed -e s/XX// $? > $@
+       sed -e s/XX/_release/ $? >> $@
+       sed -e s/XX/_acquire/ $? >> $@
+       sed -e s/XX/_read/ $? >> $@
+       sed -e s/XX/_write/ $? >> $@
+       sed -e s/XX/_full/ $? >> $@
+       sed -e s/XX/_release_write/ $? >> $@
+       sed -e s/XX/_acquire_read/ $? >> $@
+
+list_atomic.c: list_atomic.template
+       echo "#include \"atomic_ops.h\" " > $@
+       sed -e s/XX// $? >> $@
+       sed -e s/XX/_release/ $? >> $@
+       sed -e s/XX/_acquire/ $? >> $@
+       sed -e s/XX/_read/ $? >> $@
+       sed -e s/XX/_write/ $? >> $@
+       sed -e s/XX/_full/ $? >> $@
+       sed -e s/XX/_release_write/ $? >> $@
+       sed -e s/XX/_acquire_read/ $? >> $@
+
+list_atomic.i: list_atomic.c
+       $(COMPILE) $? -E > list_atomic.i
diff --git a/libatomic_ops/tests/Makefile.in b/libatomic_ops/tests/Makefile.in
new file mode 100644 (file)
index 0000000..6823633
--- /dev/null
@@ -0,0 +1,547 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) $(test_malloc_SOURCES) $(test_stack_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+check_PROGRAMS = test_atomic$(EXEEXT) test_atomic_pthreads$(EXEEXT) \
+       test_stack$(EXEEXT) test_malloc$(EXEEXT)
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+am_test_atomic_OBJECTS = test_atomic.$(OBJEXT)
+test_atomic_OBJECTS = $(am_test_atomic_OBJECTS)
+test_atomic_DEPENDENCIES = ../src/libatomic_ops.a
+am_test_atomic_pthreads_OBJECTS =  \
+       test_atomic_pthreads-test_atomic.$(OBJEXT)
+test_atomic_pthreads_OBJECTS = $(am_test_atomic_pthreads_OBJECTS)
+test_atomic_pthreads_DEPENDENCIES = ../src/libatomic_ops.a
+am_test_malloc_OBJECTS = test_malloc.$(OBJEXT)
+test_malloc_OBJECTS = $(am_test_malloc_OBJECTS)
+test_malloc_DEPENDENCIES = ../src/libatomic_ops_gpl.a \
+       ../src/libatomic_ops.a
+am_test_stack_OBJECTS = test_stack.$(OBJEXT)
+test_stack_OBJECTS = $(am_test_stack_OBJECTS)
+test_stack_DEPENDENCIES = ../src/libatomic_ops_gpl.a \
+       ../src/libatomic_ops.a
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \
+       $(test_malloc_SOURCES) $(test_stack_SOURCES)
+DIST_SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \
+       $(test_malloc_SOURCES) $(test_stack_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NEED_ASM_FALSE = @NEED_ASM_FALSE@
+NEED_ASM_TRUE = @NEED_ASM_TRUE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PICFLAG = @PICFLAG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = test_atomic.template list_atomic.template run_parallel.inc \
+          test_atomic_include.h
+
+# We distribute test_atomic_include.h, since it's hard to regenerate
+# on Windows without sed.
+BUILT_SOURCES = test_atomic_include.h list_atomic.i
+CLEANFILES = test_atomic_include.h list_atomic.c list_atomic.i
+AM_CPPFLAGS = -I$(srcdir)/../src
+TESTS = test_atomic test_atomic_pthreads test_stack test_malloc
+test_atomic_SOURCES = test_atomic.c
+test_atomic_LDADD = -lpthread ../src/libatomic_ops.a
+test_atomic_pthreads_SOURCES = test_atomic.c 
+test_atomic_pthreads_CPPFLAGS = -DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS)
+test_atomic_pthreads_LDADD = -lpthread ../src/libatomic_ops.a
+test_stack_SOURCES = test_stack.c 
+test_stack_LDADD = -lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a 
+test_malloc_SOURCES = test_malloc.c 
+test_malloc_LDADD = -lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a 
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  tests/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+       -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+test_atomic$(EXEEXT): $(test_atomic_OBJECTS) $(test_atomic_DEPENDENCIES) 
+       @rm -f test_atomic$(EXEEXT)
+       $(LINK) $(test_atomic_LDFLAGS) $(test_atomic_OBJECTS) $(test_atomic_LDADD) $(LIBS)
+test_atomic_pthreads$(EXEEXT): $(test_atomic_pthreads_OBJECTS) $(test_atomic_pthreads_DEPENDENCIES) 
+       @rm -f test_atomic_pthreads$(EXEEXT)
+       $(LINK) $(test_atomic_pthreads_LDFLAGS) $(test_atomic_pthreads_OBJECTS) $(test_atomic_pthreads_LDADD) $(LIBS)
+test_malloc$(EXEEXT): $(test_malloc_OBJECTS) $(test_malloc_DEPENDENCIES) 
+       @rm -f test_malloc$(EXEEXT)
+       $(LINK) $(test_malloc_LDFLAGS) $(test_malloc_OBJECTS) $(test_malloc_LDADD) $(LIBS)
+test_stack$(EXEEXT): $(test_stack_OBJECTS) $(test_stack_DEPENDENCIES) 
+       @rm -f test_stack$(EXEEXT)
+       $(LINK) $(test_stack_LDFLAGS) $(test_stack_OBJECTS) $(test_stack_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_atomic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_atomic_pthreads-test_atomic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_malloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stack.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+test_atomic_pthreads-test_atomic.o: test_atomic.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_atomic_pthreads-test_atomic.o -MD -MP -MF "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" -c -o test_atomic_pthreads-test_atomic.o `test -f 'test_atomic.c' || echo '$(srcdir)/'`test_atomic.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" "$(DEPDIR)/test_atomic_pthreads-test_atomic.Po"; else rm -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='test_atomic.c' object='test_atomic_pthreads-test_atomic.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_atomic_pthreads-test_atomic.o `test -f 'test_atomic.c' || echo '$(srcdir)/'`test_atomic.c
+
+test_atomic_pthreads-test_atomic.obj: test_atomic.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_atomic_pthreads-test_atomic.obj -MD -MP -MF "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" -c -o test_atomic_pthreads-test_atomic.obj `if test -f 'test_atomic.c'; then $(CYGPATH_W) 'test_atomic.c'; else $(CYGPATH_W) '$(srcdir)/test_atomic.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" "$(DEPDIR)/test_atomic_pthreads-test_atomic.Po"; else rm -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='test_atomic.c' object='test_atomic_pthreads-test_atomic.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_atomic_pthreads-test_atomic.obj `if test -f 'test_atomic.c'; then $(CYGPATH_W) 'test_atomic.c'; else $(CYGPATH_W) '$(srcdir)/test_atomic.c'; fi`
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+       srcdir=$(srcdir); export srcdir; \
+       list='$(TESTS)'; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *" $$tst "*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               echo "XPASS: $$tst"; \
+             ;; \
+             *) \
+               echo "PASS: $$tst"; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *" $$tst "*) \
+               xfail=`expr $$xfail + 1`; \
+               echo "XFAIL: $$tst"; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               echo "FAIL: $$tst"; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             echo "SKIP: $$tst"; \
+           fi; \
+         done; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="All $$all tests passed"; \
+           else \
+             banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all tests failed"; \
+           else \
+             banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           skipped="($$skip tests were not run)"; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         echo "$$dashes"; \
+         echo "$$banner"; \
+         test -z "$$skipped" || echo "$$skipped"; \
+         test -z "$$report" || echo "$$report"; \
+         echo "$$dashes"; \
+         test "$$failed" -eq 0; \
+       else :; fi
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile
+installdirs:
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+       clean-checkPROGRAMS clean-generic ctags distclean \
+       distclean-compile distclean-generic distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-exec install-exec-am \
+       install-info install-info-am install-man install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-info-am
+
+
+test_atomic_include.h: test_atomic.template
+       sed -e s/XX// $? > $@
+       sed -e s/XX/_release/ $? >> $@
+       sed -e s/XX/_acquire/ $? >> $@
+       sed -e s/XX/_read/ $? >> $@
+       sed -e s/XX/_write/ $? >> $@
+       sed -e s/XX/_full/ $? >> $@
+       sed -e s/XX/_release_write/ $? >> $@
+       sed -e s/XX/_acquire_read/ $? >> $@
+
+list_atomic.c: list_atomic.template
+       echo "#include \"atomic_ops.h\" " > $@
+       sed -e s/XX// $? >> $@
+       sed -e s/XX/_release/ $? >> $@
+       sed -e s/XX/_acquire/ $? >> $@
+       sed -e s/XX/_read/ $? >> $@
+       sed -e s/XX/_write/ $? >> $@
+       sed -e s/XX/_full/ $? >> $@
+       sed -e s/XX/_release_write/ $? >> $@
+       sed -e s/XX/_acquire_read/ $? >> $@
+
+list_atomic.i: list_atomic.c
+       $(COMPILE) $? -E > list_atomic.i
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libatomic_ops/tests/list_atomic.template b/libatomic_ops/tests/list_atomic.template
new file mode 100644 (file)
index 0000000..a3d36e3
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* This generates a compilable program.  But it is really meant to be  */
+/* be used only with cc -E, to inspect the expensions generated by     */
+/* primitives.                                                         */
+
+/* The result will not link or run.                                    */
+
+void list_atomicXX(void)
+{
+  AO_T *addr, val, newval, oldval;
+  AO_TS_T tsaddr;
+  long incr;
+
+# if defined(AO_HAVE_nopXX)
+    "AO_nopXX(): ";
+    AO_nopXX();
+# else
+    "No AO_nopXX";
+# endif
+# if defined(AO_HAVE_loadXX)
+    "AO_loadXX(addr):";
+    AO_loadXX(addr);
+# else
+    "No AO_loadXX";
+# endif
+# if defined(AO_HAVE_storeXX)
+    "AO_storeXX(addr, val):";
+    AO_storeXX(addr, val);
+# else
+    "No AO_storeXX";
+# endif
+# if defined(AO_HAVE_test_and_setXX)
+    "AO_test_and_setXX(tsaddr):";
+    AO_test_and_setXX(tsaddr);
+# else
+    "No AO_test_and_setXX";
+# endif
+# if defined(AO_HAVE_fetch_and_add1XX)
+    "AO_fetch_and_add1XX(addr):";
+    AO_fetch_and_add1XX(addr);
+# else
+    "No AO_fetch_and_add1XX";
+# endif
+# if defined(AO_HAVE_fetch_and_sub1XX)
+    "AO_fetch_and_sub1XX(addr):";
+    AO_fetch_and_sub1XX(addr);
+# else
+    "No AO_fetch_and_sub1XX";
+# endif
+# if defined(AO_HAVE_fetch_and_addXX)
+    "AO_fetch_and_addXX(addr, incr):";
+    AO_fetch_and_addXX(addr, incr);
+# else
+    "No AO_fetch_and_addXX";
+# endif
+# if defined(AO_HAVE_compare_and_swapXX)
+    "AO_compare_and_swapXX(addr, oldval, newval):";
+    AO_compare_and_swapXX(addr, oldval, newval);
+# else
+    "No AO_compare_and_swapXX";
+# endif
+}
+
+
+    
diff --git a/libatomic_ops/tests/run_parallel.inc b/libatomic_ops/tests/run_parallel.inc
new file mode 100644 (file)
index 0000000..39308d5
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+#if defined(_MSC_VER) || \
+    defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) || \
+    defined(_WIN32_WINCE)
+#  define USE_WINTHREADS
+#else
+#  define USE_PTHREADS
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef USE_PTHREADS
+# include <pthread.h>
+#endif
+
+#ifdef USE_WINTHREADS
+# include <windows.h>
+#endif
+
+#include "atomic_ops.h"
+
+typedef void * (* thr_func)(void *);
+
+typedef int (* test_func)(void);       /* Returns != 0 on success */
+
+#ifdef USE_PTHREADS
+void * run_parallel(int nthreads, thr_func f1, test_func t, char *name)
+{
+  pthread_attr_t attr;
+  pthread_t thr[100];
+  int i;
+  int code;
+
+  fprintf(stderr, "Testing %s\n", name);
+  if (nthreads > 100) 
+    {
+      fprintf(stderr, "run_parallel: requested too many threads\n");
+      abort();
+    }
+
+# ifdef _HPUX_SOURCE
+   /* Default stack size is too small, especially with the 64 bit ABI */
+   /* Increase it.                                                    */
+    if (pthread_default_stacksize_np(1024*1024, 0) != 0) {
+      fprintf(stderr, "pthread_default_stacksize_np failed. "
+                     "OK after first call.\n");
+    }
+# endif
+
+  pthread_attr_init(&attr);
+
+  for (i = 0; i < nthreads; ++i)
+    {
+      if ((code = pthread_create(thr + i, &attr, f1, (void *)(long)i)) != 0)
+       {
+         perror("Thread creation failed");
+         fprintf(stderr, "Pthread_create returned %d, thread %d\n", code, i);
+         abort();
+        }
+    }
+  for (i = 0; i < nthreads; ++i)
+    {
+      if ((code = pthread_join(thr[i], NULL)) != 0)
+       {
+         perror("Thread join failed");
+         fprintf(stderr, "Pthread_join returned %d, thread %d\n", code, i);
+         abort();
+        }
+    }
+  if (t())
+    {
+      fprintf(stderr, "Succeeded\n");
+    }
+  else
+    {
+      fprintf(stderr, "Failed\n");
+      abort();
+    }
+  return 0;
+}
+#endif /* USE_PTHREADS */
+
+#ifdef USE_WINTHREADS
+
+struct tramp_args {
+  thr_func fn;
+  long arg;
+};
+
+DWORD WINAPI tramp(LPVOID param)
+{
+  struct tramp_args *args = (struct tramp_args *)param;
+
+  return (DWORD)(args -> fn)((LPVOID)(args -> arg));
+}
+
+void * run_parallel(int nthreads, thr_func f1, test_func t, char *name)
+{
+  HANDLE thr[100];
+  struct tramp_args args[100];
+  int i;
+  DWORD code;
+
+  fprintf(stderr, "Testing %s\n", name);
+  if (nthreads > 100) 
+    {
+      fprintf(stderr, "run_parallel: requested too many threads\n");
+      abort();
+    }
+
+  for (i = 0; i < nthreads; ++i)
+    {
+      args[i].fn = f1;
+      args[i].arg = i;
+      if ((thr[i] = CreateThread(NULL, 0, tramp, (LPVOID)(args+i), 0, NULL))
+         == NULL)
+       {
+         perror("Thread creation failed");
+         fprintf(stderr, "CreateThread failed with %d, thread %d\n",
+                         GetLastError(), i);
+         abort();
+        }
+    }
+  for (i = 0; i < nthreads; ++i)
+    {
+      if ((code = WaitForSingleObject(thr[i], INFINITE)) != WAIT_OBJECT_0)
+       {
+         perror("Thread join failed");
+         fprintf(stderr, "WaitForSingleObject returned %d, thread %d\n",
+                         code, i);
+         abort();
+        }
+    }
+  if (t())
+    {
+      fprintf(stderr, "Succeeded\n");
+    }
+  else
+    {
+      fprintf(stderr, "Failed\n");
+      abort();
+    }
+  return 0;
+}
+#endif /* USE_WINTHREADS */
+
diff --git a/libatomic_ops/tests/test_atomic.c b/libatomic_ops/tests/test_atomic.c
new file mode 100644 (file)
index 0000000..03da5f2
--- /dev/null
@@ -0,0 +1,183 @@
+/*  
+ * Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P.
+ * Original Author: Hans Boehm
+ *
+ * This file may be redistributed and/or modified under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2, or (at your option) any later version.
+ * 
+ * It 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 in the
+ * file doc/COPYING for more details.
+ */
+
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
+#endif
+
+
+#include "run_parallel.inc"
+
+#include "test_atomic_include.h"
+
+#ifdef AO_USE_PTHREAD_DEFS
+# define NITERS 100000
+#else
+# define NITERS 10000000
+#endif
+
+#if defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1)
+
+AO_t counter = 0;
+
+void * add1sub1_thr(void * id)
+{
+  int me = (int)(long)id;
+
+  int i;
+
+  for (i = 0; i < NITERS; ++i)
+    if (me & 1)
+      AO_fetch_and_sub1(&counter);
+    else
+      AO_fetch_and_add1(&counter);
+
+  return 0;
+}
+
+int add1sub1_test(void)
+{
+  return counter == 0;
+}
+
+#endif /* defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1) */
+
+#if defined(AO_HAVE_store_release_write) && defined(AO_HAVE_load_acquire_read)
+
+/* Invariant: counter1 >= counter2 */
+AO_t counter1 = 0;
+AO_t counter2 = 0;
+
+void * acqrel_thr(void *id)
+{
+  int me = (int)(long)id;
+
+  int i;
+
+  for (i = 0; i < NITERS; ++i)
+    if (me & 1)
+      {
+        AO_t my_counter1;
+       if (me != 1)
+         fprintf(stderr, "acqrel test: too many threads\n");
+       my_counter1 = AO_load(&counter1);
+       AO_store(&counter1, my_counter1 + 1);
+       AO_store_release_write(&counter2, my_counter1 + 1);
+      }
+    else
+      {
+       AO_t my_counter1a, my_counter2a;
+       AO_t my_counter1b, my_counter2b;
+
+       my_counter2a = AO_load_acquire_read(&counter2);
+       my_counter1a = AO_load(&counter1);
+       /* Redo this, to make sure that the second load of counter1     */
+       /* is not viewed as a common subexpression.                     */
+       my_counter2b = AO_load_acquire_read(&counter2);
+       my_counter1b = AO_load(&counter1);
+       if (my_counter1a < my_counter2a)
+         {
+           fprintf(stderr, "Saw release store out of order: %lu < %lu\n",
+                   (unsigned long)my_counter1a, (unsigned long)my_counter2a);
+           abort();
+         }
+       if (my_counter1b < my_counter2b)
+         {
+           fprintf(stderr,
+                   "Saw release store out of order (bad CSE?): %lu < %lu\n",
+                   (unsigned long)my_counter1b, (unsigned long)my_counter2b);
+           abort();
+         }
+      }
+
+  return 0;
+}
+
+int acqrel_test(void)
+{
+  return counter1 == NITERS && counter2 == NITERS;
+}
+
+#endif /* AO_HAVE_store_release_write && AO_HAVE_load_acquire_read */
+
+#if defined(AO_HAVE_test_and_set_acquire)
+
+AO_TS_T lock = AO_TS_INITIALIZER;
+
+unsigned long locked_counter;
+volatile unsigned long junk = 13;
+
+void * test_and_set_thr(void * id)
+{
+  unsigned long i;
+
+  for (i = 0; i < NITERS/10; ++i)
+    {
+      while (AO_test_and_set_acquire(&lock) != AO_TS_CLEAR);
+      ++locked_counter;
+      if (locked_counter != 1)
+        {
+          fprintf(stderr, "Test and set failure 1, counter = %ld\n",
+                     locked_counter);
+          abort();
+        }
+      locked_counter *= 2;
+      locked_counter -= 1;
+      locked_counter *= 5;
+      locked_counter -= 4;
+      if (locked_counter != 1)
+        {
+          fprintf(stderr, "Test and set failure 2, counter = %ld\n",
+                     locked_counter);
+          abort();
+        }
+      --locked_counter;
+      AO_CLEAR(&lock);
+      /* Spend a bit of time outside the lock. */
+        junk *= 17;
+        junk *= 17;
+    }
+  return 0;
+}
+
+int test_and_set_test(void)
+{
+  return locked_counter == 0;
+}
+
+#endif /* defined(AO_HAVE_test_and_set_acquire) */
+
+int main()
+{
+  test_atomic();
+  test_atomic_acquire();
+  test_atomic_release();
+  test_atomic_read();
+  test_atomic_write();
+  test_atomic_full();
+  test_atomic_release_write();
+  test_atomic_acquire_read();
+# if defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1)
+    run_parallel(4, add1sub1_thr, add1sub1_test, "add1/sub1");
+# endif
+# if defined(AO_HAVE_store_release_write) && defined(AO_HAVE_load_acquire_read)
+    run_parallel(3, acqrel_thr, acqrel_test,
+                "store_release_write/load_acquire_read");
+# endif
+# if defined(AO_HAVE_test_and_set_acquire)
+    run_parallel(5, test_and_set_thr, test_and_set_test,
+                "test_and_set");
+# endif
+  return 0;
+}
diff --git a/libatomic_ops/tests/test_atomic.template b/libatomic_ops/tests/test_atomic.template
new file mode 100644 (file)
index 0000000..f80eac8
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: XX)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "XX")
+
+void test_atomicXX(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_setXX)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nopXX)
+    AO_nopXX();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_storeXX)
+    AO_storeXX(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_loadXX)
+    TA_assert(AO_loadXX(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_setXX)
+    assert(AO_test_and_setXX(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_setXX(&z) == AO_TS_SET);
+    assert(AO_test_and_setXX(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_addXX)
+    TA_assert(AO_fetch_and_addXX(&x, 42) == 13);
+    TA_assert(AO_fetch_and_addXX(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1XX)
+    TA_assert(AO_fetch_and_add1XX(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1XX)
+    TA_assert(AO_fetch_and_sub1XX(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_storeXX)
+    AO_short_storeXX(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_loadXX)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_addXX)
+    TA_assert(AO_short_fetch_and_addXX(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_addXX(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1XX)
+    TA_assert(AO_short_fetch_and_add1XX(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1XX)
+    TA_assert(AO_short_fetch_and_sub1XX(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_storeXX)
+    AO_char_storeXX(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_loadXX)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_addXX)
+    TA_assert(AO_char_fetch_and_addXX(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_addXX(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1XX)
+    TA_assert(AO_char_fetch_and_add1XX(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1XX)
+    TA_assert(AO_char_fetch_and_sub1XX(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_storeXX)
+    AO_int_storeXX(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_loadXX)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_addXX)
+    TA_assert(AO_int_fetch_and_addXX(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_addXX(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1XX)
+    TA_assert(AO_int_fetch_and_add1XX(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1XX)
+    TA_assert(AO_int_fetch_and_sub1XX(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swapXX)
+    TA_assert(!AO_compare_and_swapXX(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swapXX(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_orXX)
+    AO_orXX(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_doubleXX)
+    TA_assert(!AO_compare_double_and_swap_doubleXX(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_doubleXX(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_doubleXX(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_doubleXX)
+    TA_assert(!AO_compare_and_swap_doubleXX(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_doubleXX(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_doubleXX(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
diff --git a/libatomic_ops/tests/test_atomic_include.h b/libatomic_ops/tests/test_atomic_include.h
new file mode 100644 (file)
index 0000000..c9970ab
--- /dev/null
@@ -0,0 +1,1624 @@
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: )\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "")
+
+void test_atomic(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop)
+    AO_nop();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store)
+    AO_store(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load)
+    TA_assert(AO_load(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set)
+    assert(AO_test_and_set(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set(&z) == AO_TS_SET);
+    assert(AO_test_and_set(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add)
+    TA_assert(AO_fetch_and_add(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1)
+    TA_assert(AO_fetch_and_add1(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1)
+    TA_assert(AO_fetch_and_sub1(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store)
+    AO_short_store(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add)
+    TA_assert(AO_short_fetch_and_add(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1)
+    TA_assert(AO_short_fetch_and_add1(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1)
+    TA_assert(AO_short_fetch_and_sub1(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store)
+    AO_char_store(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add)
+    TA_assert(AO_char_fetch_and_add(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1)
+    TA_assert(AO_char_fetch_and_add1(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1)
+    TA_assert(AO_char_fetch_and_sub1(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store)
+    AO_int_store(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add)
+    TA_assert(AO_int_fetch_and_add(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1)
+    TA_assert(AO_int_fetch_and_add1(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1)
+    TA_assert(AO_int_fetch_and_sub1(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap)
+    TA_assert(!AO_compare_and_swap(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or)
+    AO_or(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double)
+    TA_assert(!AO_compare_double_and_swap_double(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double)
+    TA_assert(!AO_compare_and_swap_double(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "_release")
+
+void test_atomic_release(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set_release)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop_release)
+    AO_nop_release();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store_release)
+    AO_store_release(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load_release)
+    TA_assert(AO_load_release(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set_release)
+    assert(AO_test_and_set_release(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set_release(&z) == AO_TS_SET);
+    assert(AO_test_and_set_release(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add_release)
+    TA_assert(AO_fetch_and_add_release(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add_release(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1_release)
+    TA_assert(AO_fetch_and_add1_release(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1_release)
+    TA_assert(AO_fetch_and_sub1_release(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store_release)
+    AO_short_store_release(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load_release)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add_release)
+    TA_assert(AO_short_fetch_and_add_release(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add_release(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1_release)
+    TA_assert(AO_short_fetch_and_add1_release(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1_release)
+    TA_assert(AO_short_fetch_and_sub1_release(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store_release)
+    AO_char_store_release(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load_release)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add_release)
+    TA_assert(AO_char_fetch_and_add_release(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add_release(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1_release)
+    TA_assert(AO_char_fetch_and_add1_release(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1_release)
+    TA_assert(AO_char_fetch_and_sub1_release(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store_release)
+    AO_int_store_release(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load_release)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add_release)
+    TA_assert(AO_int_fetch_and_add_release(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add_release(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1_release)
+    TA_assert(AO_int_fetch_and_add1_release(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1_release)
+    TA_assert(AO_int_fetch_and_sub1_release(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap_release)
+    TA_assert(!AO_compare_and_swap_release(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap_release(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or_release)
+    AO_or_release(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double_release)
+    TA_assert(!AO_compare_double_and_swap_double_release(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double_release(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double_release(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double_release)
+    TA_assert(!AO_compare_and_swap_double_release(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double_release(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double_release(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "_acquire")
+
+void test_atomic_acquire(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set_acquire)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop_acquire)
+    AO_nop_acquire();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store_acquire)
+    AO_store_acquire(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load_acquire)
+    TA_assert(AO_load_acquire(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set_acquire)
+    assert(AO_test_and_set_acquire(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
+    assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add_acquire)
+    TA_assert(AO_fetch_and_add_acquire(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add_acquire(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1_acquire)
+    TA_assert(AO_fetch_and_add1_acquire(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1_acquire)
+    TA_assert(AO_fetch_and_sub1_acquire(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store_acquire)
+    AO_short_store_acquire(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load_acquire)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add_acquire)
+    TA_assert(AO_short_fetch_and_add_acquire(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add_acquire(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1_acquire)
+    TA_assert(AO_short_fetch_and_add1_acquire(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1_acquire)
+    TA_assert(AO_short_fetch_and_sub1_acquire(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store_acquire)
+    AO_char_store_acquire(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load_acquire)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add_acquire)
+    TA_assert(AO_char_fetch_and_add_acquire(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add_acquire(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1_acquire)
+    TA_assert(AO_char_fetch_and_add1_acquire(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1_acquire)
+    TA_assert(AO_char_fetch_and_sub1_acquire(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store_acquire)
+    AO_int_store_acquire(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load_acquire)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add_acquire)
+    TA_assert(AO_int_fetch_and_add_acquire(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add_acquire(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1_acquire)
+    TA_assert(AO_int_fetch_and_add1_acquire(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1_acquire)
+    TA_assert(AO_int_fetch_and_sub1_acquire(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap_acquire)
+    TA_assert(!AO_compare_and_swap_acquire(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap_acquire(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or_acquire)
+    AO_or_acquire(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double_acquire)
+    TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double_acquire(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double_acquire(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double_acquire)
+    TA_assert(!AO_compare_and_swap_double_acquire(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double_acquire(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double_acquire(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "_read")
+
+void test_atomic_read(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set_read)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop_read)
+    AO_nop_read();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store_read)
+    AO_store_read(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load_read)
+    TA_assert(AO_load_read(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set_read)
+    assert(AO_test_and_set_read(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set_read(&z) == AO_TS_SET);
+    assert(AO_test_and_set_read(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add_read)
+    TA_assert(AO_fetch_and_add_read(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add_read(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1_read)
+    TA_assert(AO_fetch_and_add1_read(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1_read)
+    TA_assert(AO_fetch_and_sub1_read(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store_read)
+    AO_short_store_read(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load_read)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add_read)
+    TA_assert(AO_short_fetch_and_add_read(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add_read(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1_read)
+    TA_assert(AO_short_fetch_and_add1_read(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1_read)
+    TA_assert(AO_short_fetch_and_sub1_read(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store_read)
+    AO_char_store_read(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load_read)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add_read)
+    TA_assert(AO_char_fetch_and_add_read(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add_read(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1_read)
+    TA_assert(AO_char_fetch_and_add1_read(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1_read)
+    TA_assert(AO_char_fetch_and_sub1_read(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store_read)
+    AO_int_store_read(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load_read)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add_read)
+    TA_assert(AO_int_fetch_and_add_read(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add_read(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1_read)
+    TA_assert(AO_int_fetch_and_add1_read(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1_read)
+    TA_assert(AO_int_fetch_and_sub1_read(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap_read)
+    TA_assert(!AO_compare_and_swap_read(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap_read(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or_read)
+    AO_or_read(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double_read)
+    TA_assert(!AO_compare_double_and_swap_double_read(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double_read(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double_read(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double_read)
+    TA_assert(!AO_compare_and_swap_double_read(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double_read(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double_read(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "_write")
+
+void test_atomic_write(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set_write)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop_write)
+    AO_nop_write();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store_write)
+    AO_store_write(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load_write)
+    TA_assert(AO_load_write(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set_write)
+    assert(AO_test_and_set_write(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set_write(&z) == AO_TS_SET);
+    assert(AO_test_and_set_write(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add_write)
+    TA_assert(AO_fetch_and_add_write(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add_write(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1_write)
+    TA_assert(AO_fetch_and_add1_write(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1_write)
+    TA_assert(AO_fetch_and_sub1_write(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store_write)
+    AO_short_store_write(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load_write)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add_write)
+    TA_assert(AO_short_fetch_and_add_write(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add_write(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1_write)
+    TA_assert(AO_short_fetch_and_add1_write(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1_write)
+    TA_assert(AO_short_fetch_and_sub1_write(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store_write)
+    AO_char_store_write(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load_write)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add_write)
+    TA_assert(AO_char_fetch_and_add_write(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add_write(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1_write)
+    TA_assert(AO_char_fetch_and_add1_write(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1_write)
+    TA_assert(AO_char_fetch_and_sub1_write(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store_write)
+    AO_int_store_write(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load_write)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add_write)
+    TA_assert(AO_int_fetch_and_add_write(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add_write(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1_write)
+    TA_assert(AO_int_fetch_and_add1_write(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1_write)
+    TA_assert(AO_int_fetch_and_sub1_write(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap_write)
+    TA_assert(!AO_compare_and_swap_write(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap_write(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or_write)
+    AO_or_write(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double_write)
+    TA_assert(!AO_compare_double_and_swap_double_write(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double_write(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double_write(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double_write)
+    TA_assert(!AO_compare_and_swap_double_write(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double_write(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double_write(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "_full")
+
+void test_atomic_full(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set_full)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop_full)
+    AO_nop_full();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store_full)
+    AO_store_full(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load_full)
+    TA_assert(AO_load_full(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set_full)
+    assert(AO_test_and_set_full(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set_full(&z) == AO_TS_SET);
+    assert(AO_test_and_set_full(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add_full)
+    TA_assert(AO_fetch_and_add_full(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add_full(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1_full)
+    TA_assert(AO_fetch_and_add1_full(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1_full)
+    TA_assert(AO_fetch_and_sub1_full(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store_full)
+    AO_short_store_full(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load_full)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add_full)
+    TA_assert(AO_short_fetch_and_add_full(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add_full(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1_full)
+    TA_assert(AO_short_fetch_and_add1_full(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1_full)
+    TA_assert(AO_short_fetch_and_sub1_full(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store_full)
+    AO_char_store_full(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load_full)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add_full)
+    TA_assert(AO_char_fetch_and_add_full(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add_full(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1_full)
+    TA_assert(AO_char_fetch_and_add1_full(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1_full)
+    TA_assert(AO_char_fetch_and_sub1_full(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store_full)
+    AO_int_store_full(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load_full)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add_full)
+    TA_assert(AO_int_fetch_and_add_full(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add_full(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1_full)
+    TA_assert(AO_int_fetch_and_add1_full(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1_full)
+    TA_assert(AO_int_fetch_and_sub1_full(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap_full)
+    TA_assert(!AO_compare_and_swap_full(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap_full(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or_full)
+    AO_or_full(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double_full)
+    TA_assert(!AO_compare_double_and_swap_double_full(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double_full(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double_full(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double_full)
+    TA_assert(!AO_compare_and_swap_double_full(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double_full(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double_full(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "_release_write")
+
+void test_atomic_release_write(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set_release_write)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop_release_write)
+    AO_nop_release_write();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store_release_write)
+    AO_store_release_write(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load_release_write)
+    TA_assert(AO_load_release_write(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set_release_write)
+    assert(AO_test_and_set_release_write(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
+    assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add_release_write)
+    TA_assert(AO_fetch_and_add_release_write(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add_release_write(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1_release_write)
+    TA_assert(AO_fetch_and_add1_release_write(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1_release_write)
+    TA_assert(AO_fetch_and_sub1_release_write(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store_release_write)
+    AO_short_store_release_write(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load_release_write)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add_release_write)
+    TA_assert(AO_short_fetch_and_add_release_write(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add_release_write(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1_release_write)
+    TA_assert(AO_short_fetch_and_add1_release_write(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1_release_write)
+    TA_assert(AO_short_fetch_and_sub1_release_write(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store_release_write)
+    AO_char_store_release_write(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load_release_write)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add_release_write)
+    TA_assert(AO_char_fetch_and_add_release_write(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add_release_write(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1_release_write)
+    TA_assert(AO_char_fetch_and_add1_release_write(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1_release_write)
+    TA_assert(AO_char_fetch_and_sub1_release_write(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store_release_write)
+    AO_int_store_release_write(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load_release_write)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add_release_write)
+    TA_assert(AO_int_fetch_and_add_release_write(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add_release_write(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1_release_write)
+    TA_assert(AO_int_fetch_and_add1_release_write(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1_release_write)
+    TA_assert(AO_int_fetch_and_sub1_release_write(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap_release_write)
+    TA_assert(!AO_compare_and_swap_release_write(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap_release_write(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or_release_write)
+    AO_or_release_write(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double_release_write)
+    TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double_release_write(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double_release_write(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double_release_write)
+    TA_assert(!AO_compare_and_swap_double_release_write(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double_release_write(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double_release_write(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
+/*
+ * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
+ *
+ * This file is covered by the GNU general public license, version 2.
+ * see doc/COPYING for details.
+ */
+
+/* Some basic sanity tests.  These do not test the barrier semantics. */
+
+#undef TA_assert
+#define TA_assert(e) \
+  if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \
+                   __FILE__, __LINE__), exit(1); }
+
+#undef MISSING
+#define MISSING(name) \
+  fprintf(stderr, "Missing: %s\n", #name "_acquire_read")
+
+void test_atomic_acquire_read(void)
+{
+  AO_t x;
+  unsigned char b;
+  unsigned short s;
+  unsigned int zz;
+# if defined(AO_HAVE_test_and_set_acquire_read)
+    AO_TS_t z = AO_TS_INITIALIZER;
+# endif
+# if defined(AO_HAVE_double_t)
+    AO_double_t w;
+    w.AO_val1 = 0;
+    w.AO_val2 = 0;
+# endif
+
+# if defined(AO_HAVE_nop_acquire_read)
+    AO_nop_acquire_read();
+# else
+    MISSING(AO_nop);
+# endif
+# if defined(AO_HAVE_store_acquire_read)
+    AO_store_acquire_read(&x, 13);
+    TA_assert (x == 13);
+# else
+    MISSING(AO_store);
+    x = 13;
+# endif
+# if defined(AO_HAVE_load_acquire_read)
+    TA_assert(AO_load_acquire_read(&x) == 13);
+# else
+    MISSING(AO_load);
+# endif
+# if defined(AO_HAVE_test_and_set_acquire_read)
+    assert(AO_test_and_set_acquire_read(&z) == AO_TS_CLEAR);
+    assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
+    assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
+    AO_CLEAR(&z);
+# else
+    MISSING(AO_test_and_set);
+# endif
+# if defined(AO_HAVE_fetch_and_add_acquire_read)
+    TA_assert(AO_fetch_and_add_acquire_read(&x, 42) == 13);
+    TA_assert(AO_fetch_and_add_acquire_read(&x, -42) == 55);
+# else
+    MISSING(AO_fetch_and_add);
+# endif
+# if defined(AO_HAVE_fetch_and_add1_acquire_read)
+    TA_assert(AO_fetch_and_add1_acquire_read(&x) == 13);
+# else
+    MISSING(AO_fetch_and_add1);
+    ++x;
+# endif
+# if defined(AO_HAVE_fetch_and_sub1_acquire_read)
+    TA_assert(AO_fetch_and_sub1_acquire_read(&x) == 14);
+# else
+    MISSING(AO_fetch_and_sub1);
+    --x;
+# endif
+# if defined(AO_HAVE_short_store_acquire_read)
+    AO_short_store_acquire_read(&s, 13);
+# else
+    MISSING(AO_short_store);
+    s = 13;
+# endif
+# if defined(AO_HAVE_short_load_acquire_read)
+    TA_assert(AO_short_load(&s) == 13);
+# else
+    MISSING(AO_short_load);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add_acquire_read)
+    TA_assert(AO_short_fetch_and_add_acquire_read(&s, 42) == 13);
+    TA_assert(AO_short_fetch_and_add_acquire_read(&s, -42) == 55);
+# else
+    MISSING(AO_short_fetch_and_add);
+# endif
+# if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
+    TA_assert(AO_short_fetch_and_add1_acquire_read(&s) == 13);
+# else
+    MISSING(AO_short_fetch_and_add1);
+    ++s;
+# endif
+# if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
+    TA_assert(AO_short_fetch_and_sub1_acquire_read(&s) == 14);
+# else
+    MISSING(AO_short_fetch_and_sub1);
+    --s;
+# endif
+# if defined(AO_HAVE_char_store_acquire_read)
+    AO_char_store_acquire_read(&b, 13);
+# else
+    MISSING(AO_char_store);
+    b = 13;
+# endif
+# if defined(AO_HAVE_char_load_acquire_read)
+    TA_assert(AO_char_load(&b) == 13);
+# else
+    MISSING(AO_char_load);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add_acquire_read)
+    TA_assert(AO_char_fetch_and_add_acquire_read(&b, 42) == 13);
+    TA_assert(AO_char_fetch_and_add_acquire_read(&b, -42) == 55);
+# else
+    MISSING(AO_char_fetch_and_add);
+# endif
+# if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
+    TA_assert(AO_char_fetch_and_add1_acquire_read(&b) == 13);
+# else
+    MISSING(AO_char_fetch_and_add1);
+    ++b;
+# endif
+# if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
+    TA_assert(AO_char_fetch_and_sub1_acquire_read(&b) == 14);
+# else
+    MISSING(AO_char_fetch_and_sub1);
+    --b;
+# endif
+# if defined(AO_HAVE_int_store_acquire_read)
+    AO_int_store_acquire_read(&zz, 13);
+# else
+    MISSING(AO_int_store);
+    zz = 13;
+# endif
+# if defined(AO_HAVE_int_load_acquire_read)
+    TA_assert(AO_int_load(&zz) == 13);
+# else
+    MISSING(AO_int_load);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add_acquire_read)
+    TA_assert(AO_int_fetch_and_add_acquire_read(&zz, 42) == 13);
+    TA_assert(AO_int_fetch_and_add_acquire_read(&zz, -42) == 55);
+# else
+    MISSING(AO_int_fetch_and_add);
+# endif
+# if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
+    TA_assert(AO_int_fetch_and_add1_acquire_read(&zz) == 13);
+# else
+    MISSING(AO_int_fetch_and_add1);
+    ++zz;
+# endif
+# if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
+    TA_assert(AO_int_fetch_and_sub1_acquire_read(&zz) == 14);
+# else
+    MISSING(AO_int_fetch_and_sub1);
+    --zz;
+# endif
+# if defined(AO_HAVE_compare_and_swap_acquire_read)
+    TA_assert(!AO_compare_and_swap_acquire_read(&x, 14, 42));
+    TA_assert(x == 13);
+    TA_assert(AO_compare_and_swap_acquire_read(&x, 13, 42));
+    TA_assert(x == 42);
+# else
+    MISSING(AO_compare_and_swap);
+# endif
+# if defined(AO_HAVE_or_acquire_read)
+    AO_or_acquire_read(&x, 66);
+    TA_assert(x == 106);
+# else
+    MISSING(AO_or);
+    x |= 34;
+# endif
+# if defined(AO_HAVE_compare_double_and_swap_double_acquire_read)
+    TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 0, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 12, 13, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+    w.AO_val1 = 0; w.AO_val2 = 0;
+# else
+    MISSING(AO_compare_double_and_swap_double);
+# endif
+# if defined(AO_HAVE_compare_and_swap_double_acquire_read)
+    TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 17, 12, 13));
+    TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
+    TA_assert(AO_compare_and_swap_double_acquire_read(&w, 0, 12, 13));
+    TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
+    TA_assert(AO_compare_and_swap_double_acquire_read(&w, 12, 17, 42));
+    TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
+# else
+    MISSING(AO_compare_and_swap_double);
+# endif
+}
+
+
+    
diff --git a/libatomic_ops/tests/test_malloc.c b/libatomic_ops/tests/test_malloc.c
new file mode 100644 (file)
index 0000000..4026e62
--- /dev/null
@@ -0,0 +1,182 @@
+/*  
+ * Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+ * Original Author: Hans Boehm
+ *
+ * This file may be redistributed and/or modified under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2, or (at your option) any later version.
+ * 
+ * It 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 in the
+ * file doc/COPYING for more details.
+ */
+
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
+#endif
+
+#include "run_parallel.inc"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "atomic_ops_malloc.h"
+#define MAX_NTHREADS 100
+#define N_REVERSALS 1000 /* must be even */
+#define LENGTH 1000
+
+#ifdef USE_STANDARD_MALLOC
+# define AO_malloc(n) malloc(n)
+# define AO_free(p) free(p)
+# define AO_malloc_enable_mmap() 
+#endif
+
+typedef struct list_node {
+       struct list_node *next;
+       int data;
+} ln;
+
+ln *cons(int d, ln *tail)
+{
+  static size_t extra = 0;
+  size_t my_extra = extra;
+  ln *result;
+  int * extras;
+  int i;
+
+  if (my_extra > 100) 
+    extra = my_extra = 0;
+  else
+    ++extra;
+  result = AO_malloc(sizeof(ln) + sizeof(int)*my_extra);
+  if (result == 0)
+    {
+      fprintf(stderr, "Out of memory\n");
+       /* Normal for more than about 10 threads without mmap? */
+      abort();
+    }
+
+  result -> data = d;
+  result -> next = tail;
+  extras = (int *)(result+1);
+  for (i = 0; i < my_extra; ++i) extras[i] = 42;
+  return result;
+}
+
+void print_list(ln *l)
+{
+  ln *p;
+
+  for (p = l; p != 0; p = p -> next)
+    {
+      fprintf(stderr, "%d, ", p -> data);
+    }
+  fprintf(stderr, "\n");
+}
+
+/* Check that l contains numbers from m to n inclusive in ascending order */
+void check_list(ln *l, int m, int n)
+{
+  ln *p;
+  int i;
+
+  for (p = l, i = m; p != 0; p = p -> next, ++i)
+    {
+      if (i != p -> data)
+       {
+         fprintf(stderr, "Found %d, expected %d\n", p -> data, i);
+         abort();
+       }
+    }
+}
+
+/* Create a list of integers from m to n */
+ln *
+make_list(int m, int n)
+{
+  if (m > n) return 0;
+  return cons(m, make_list(m+1, n));
+}
+
+/* Reverse list x, and concatenate it to y, deallocating no longer needed */
+/* nodes in x.                                                           */
+ln *
+reverse(ln *x, ln *y)
+{
+  ln * result;
+
+  if (x == 0) return y;
+  result = reverse(x -> next, cons(x -> data, y));
+  AO_free(x);
+  return result;
+}
+
+int dummy_test(void) { return 1; }
+
+#define LARGE 200000
+
+void * run_one_test(void * arg) {
+  ln * x = make_list(1, LENGTH);
+  int i;
+  char *p = AO_malloc(LARGE);
+  char *q;
+
+  if (0 == p) {
+    fprintf(stderr, "AO_malloc(%d) failed: This is normal without mmap\n",
+           LARGE);
+    AO_free(p);
+  } else {
+    p[0] = p[LARGE/2] = p[LARGE-1] = 'a';
+    q = AO_malloc(LARGE);
+    q[0] = q[LARGE/2] = q[LARGE-1] = 'b';
+    if (p[0] != 'a' || p[LARGE/2] != 'a' || p[LARGE-1] != 'a') {
+      fprintf(stderr, "First large allocation smashed\n");
+      abort();
+    }
+    AO_free(p);
+    if (q[0] != 'b' || q[LARGE/2] != 'b' || q[LARGE-1] != 'b') {
+      fprintf(stderr, "Second large allocation smashed\n");
+      abort();
+    }
+    AO_free(q);
+  }
+# if 0 /* enable for debugging */
+    x = reverse(x, 0);
+    print_list(x);
+    x = reverse(x, 0);
+    print_list(x);
+# endif
+  for (i = 0; i < N_REVERSALS; ++i) {
+    x = reverse(x, 0);
+  }
+  check_list(x, 1, LENGTH);
+  return 0;
+}
+
+int main(int argc, char **argv) {
+    int nthreads;
+    int exper_n;
+
+    if (1 == argc) {
+#     if !defined(HAVE_MMAP)
+       nthreads = 3;
+#     else
+        nthreads = 10;
+#     endif
+    } else if (2 == argc) {
+      nthreads = atoi(argv[1]);
+      if (nthreads < 1 || nthreads > MAX_NTHREADS) {
+       fprintf(stderr, "Invalid # of threads argument\n");
+       exit(1);
+      }
+    } else {
+      fprintf(stderr, "Usage: %s [# of threads]\n", argv[0]);
+      exit(1);
+    }
+    printf("Performing %d reversals of %d element lists in %d threads\n",
+          N_REVERSALS, LENGTH, nthreads);
+    AO_malloc_enable_mmap();
+    run_parallel(nthreads, run_one_test, dummy_test, "AO_malloc/AO_free");
+    return 0;
+}
+
diff --git a/libatomic_ops/tests/test_stack.c b/libatomic_ops/tests/test_stack.c
new file mode 100644 (file)
index 0000000..29cdbd8
--- /dev/null
@@ -0,0 +1,232 @@
+/*  
+ * Copyright (c) 2005 Hewlett-Packard Development Company, L.P.
+ * Original Author: Hans Boehm
+ *
+ * This file may be redistributed and/or modified under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2, or (at your option) any later version.
+ * 
+ * It 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 in the
+ * file doc/COPYING for more details.
+ */
+
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
+#endif
+
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "atomic_ops.h"
+#include "atomic_ops_stack.h"
+#define MAX_NTHREADS 100
+
+#ifndef NO_TIMES
+#include <time.h>
+#include <sys/time.h>
+/* Need 64-bit long long support */
+long long
+get_msecs(void)
+{
+  struct timeval tv;
+
+  gettimeofday(&tv, 0);
+  return (long long)tv.tv_sec * 1000 + tv.tv_usec/1000;
+}
+#else
+# define get_msecs() 0
+#endif
+
+typedef struct le {
+    AO_t next;
+    int data;
+} list_element;
+
+AO_stack_t the_list = AO_STACK_INITIALIZER;
+
+void add_elements(int n)
+{
+  list_element * le;
+  if (n == 0) return;
+  add_elements(n-1);
+  le = malloc(sizeof(list_element));
+  le -> data = n;
+  AO_stack_push(&the_list, (AO_t *)le);
+}
+
+void print_list()
+{
+  list_element *p;
+
+  for (p = (list_element *)AO_REAL_HEAD_PTR(the_list);
+       p != 0;
+       p = (list_element *)AO_REAL_NEXT_PTR(p -> next))
+    printf("%d\n", p -> data);
+}
+
+static char marks[MAX_NTHREADS * MAX_NTHREADS];
+
+void check_list(int n)
+{
+  list_element *p;
+  int i;
+
+  for (i = 1; i <= n; ++i) marks[i] = 0;
+  for (p = (list_element *)AO_REAL_HEAD_PTR(the_list);
+       p != 0;
+       p = (list_element *)AO_REAL_NEXT_PTR(p -> next))
+    {
+      if (p -> data > n || p -> data <= 0)
+        fprintf(stderr, "Found erroneous list element %d\n", p -> data);
+      if (marks[p -> data] != 0)
+        fprintf(stderr, "Found duplicate list element %d\n", p -> data);
+      marks[p -> data] = 1;
+    }
+  for (i = 1; i <= n; ++i)
+    if (marks[i] != 1)
+      fprintf(stderr, "Missing list element %d\n", i);
+}
+     
+volatile AO_t ops_performed = 0;
+
+#define LIMIT 1000000
+       /* Total number of push/pop ops in all threads per test. */
+
+#ifdef AO_HAVE_fetch_and_add
+# define fetch_and_add(addr, val) AO_fetch_and_add(addr, val)
+#else
+  /* Fake it.  This is really quite unacceptable for timing    */
+  /* purposes.  But as a correctness test, it should be OK.    */
+  AO_INLINE AO_t fetch_and_add(volatile AO_t * addr, AO_t val)
+  {
+    AO_t result = AO_load(addr);
+    AO_store(addr, result + val);
+    return result;
+  }
+#endif
+
+void * run_one_test(void * arg)
+{
+  list_element * t[MAX_NTHREADS + 1];
+  list_element * aux; 
+  long index = (long)arg;
+  int i;
+  int j = 0;
+
+# ifdef VERBOSE
+    printf("starting thread %d\n", index);
+# endif
+  while (fetch_and_add(&ops_performed, index + 1) + index + 1 < LIMIT)
+    {
+      for (i = 0; i < index + 1; ++i)
+        {
+          t[i] = (list_element *)AO_stack_pop(&the_list);
+          if (0 == t[i])
+           {
+              fprintf(stderr, "FAILED\n");
+              abort();
+            }
+        }
+      for (i = 0; i < index + 1; ++i)
+        {
+          AO_stack_push(&the_list, (AO_t *)t[i]);
+        }
+      j += (index + 1);
+    }
+# ifdef VERBOSE
+    printf("finished thread %d: %d total ops\n", index, j);
+# endif
+  return 0;
+}
+
+#define N_EXPERIMENTS 1
+
+unsigned long times[MAX_NTHREADS + 1][N_EXPERIMENTS];
+
+int main(int argc, char **argv)
+{
+  int nthreads;
+  int max_nthreads;
+  int exper_n;
+
+  if (1 == argc)
+    max_nthreads = 4;
+  else if (2 == argc)
+    {
+      max_nthreads = atoi(argv[1]);
+      if (max_nthreads < 1 || max_nthreads > MAX_NTHREADS)
+        {
+         fprintf(stderr, "Invalid max # of threads argument\n");
+         exit(1);
+        }
+    }
+  else
+    {
+      fprintf(stderr, "Usage: %s [max # of threads]\n");
+      exit(1);
+    }
+  for (exper_n = 0; exper_n < N_EXPERIMENTS; ++ exper_n)
+    for (nthreads = 1; nthreads <= max_nthreads; ++nthreads)
+      {
+        int i;
+        pthread_t thread[MAX_NTHREADS];
+        int list_length = nthreads*(nthreads+1)/2;
+        long long start_time;
+  
+        add_elements(list_length);
+  #     ifdef VERBOSE
+          printf("Initial list (nthreads = %d):\n", nthreads);
+          print_list();
+  #     endif
+        ops_performed = 0;
+        start_time = get_msecs();
+        for (i = 1; i < nthreads; ++i) {
+       int code;
+  
+          if ((code = pthread_create(thread+i, 0, run_one_test,
+           (void *)(long)i)) != 0) {
+             fprintf(stderr, "Thread creation failed %u\n", code);
+            exit(1);
+          }
+        }
+        /* We use the main thread to run one test.  This allows gprof  */
+        /* profiling to work, for example.                             */
+          run_one_test(0);
+        for (i = 1; i < nthreads; ++i) {
+         int code;
+          if ((code = pthread_join(thread[i], 0)) != 0) {
+           fprintf(stderr, "Thread join failed %u\n", code);
+          }
+        }
+        times[nthreads][exper_n] = (unsigned long)(get_msecs() - start_time);
+  #     ifdef VERBOSE
+          printf("%d %lu\n", nthreads,
+                            (unsigned long)(get_msecs() - start_time));
+          printf("final list (should be reordered initial list):\n");
+          print_list();
+  #     endif
+        check_list(list_length);
+        while ((list_element *)AO_stack_pop(&the_list));
+      }
+# ifndef NO_TIMES
+    for (nthreads = 1; nthreads <= max_nthreads; ++nthreads)
+      {
+        unsigned long sum = 0;
+
+        printf("About %d pushes + %d pops in %d threads:",
+               LIMIT, LIMIT, nthreads);
+        for (exper_n = 0; exper_n < N_EXPERIMENTS; ++exper_n)
+         {
+#           if defined(VERBOSE)
+             printf("[%lu] ", times[nthreads][exper_n]);
+#          endif
+           sum += times[nthreads][exper_n];
+          }
+        printf(" %lu msecs\n", (sum + N_EXPERIMENTS/2)/N_EXPERIMENTS);
+      }
+# endif /* NO_TIMES */
+  return 0;
+}
+
index 409dbd0c6ab6187d6f2ea544c431cd285273a26e..b25f72b2434fb0b006d7c63ba4f24f29798f917a 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-06  Raja R Harinath  <rharinath@novell.com>
+
+       * Makefile (bootstrap): Remove special handling on Win32.
+
 2005-07-11  Raja R Harinath  <rharinath@novell.com>
 
        * Makefile (centum_tests): Add System.Messaging and
index 146edba8950c4b439f2d89e7fcf31a67439f114a..da0a1cfca7a28718dac9d4c91cdc2607f7a38fa3 100644 (file)
@@ -74,9 +74,7 @@ _boot_ = all clean install
 $(_boot_:%=profile-do--net_2_0--%):           profile-do--net_2_0--%:           profile-do--net_2_0_bootstrap--%
 $(_boot_:%=profile-do--net_2_0_bootstrap--%): profile-do--net_2_0_bootstrap--%: profile-do--default--%
 $(_boot_:%=profile-do--default--%):           profile-do--default--%:           profile-do--net_1_1_bootstrap--%
-ifeq (linux, $(PLATFORM))
 $(_boot_:%=profile-do--net_1_1_bootstrap--%): profile-do--net_1_1_bootstrap--%: profile-do--basic--%
-endif
 
 testcorlib:
        @cd class/corlib && $(MAKE) test run-test
index 51ca97ab8f19dc831396befd7e65866feed728a4..5557605ecfe79b02544524f33aedee850d6a4d2b 100644 (file)
@@ -2992,7 +2992,7 @@ namespace Mono.CSharp {
                                if (gen_params.Length != atypes.Length)
                                        continue;
 
-                               list.Add (mi.BindGenericParameters (atypes));
+                               list.Add (mi.MakeGenericMethod (atypes));
                        }
 
                        if (list.Count > 0) {
index c737f85ac78e79ce5875d91d58bcc3121536b3be..1f641368957eca9ca5486117e060adc9fa6dcfa2 100644 (file)
@@ -33,7 +33,7 @@ namespace Mono.CSharp {
                }
 
                public bool HasValueTypeConstraint {
-                       get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; }
+                       get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
                }
 
                public virtual bool HasClassConstraint {
@@ -195,7 +195,7 @@ namespace Mono.CSharp {
                                        if (sc == SpecialConstraint.ReferenceType)
                                                attrs |= GenericParameterAttributes.ReferenceTypeConstraint;
                                        else
-                                               attrs |= GenericParameterAttributes.ValueTypeConstraint;
+                                               attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint;
                                        continue;
                                }
 
@@ -1733,7 +1733,7 @@ namespace Mono.CSharp {
                        if (tc != null)
                                return tc.IsGeneric ? tc.CountTypeParameters : 0;
                        else
-                               return t.HasGenericArguments ? t.GetGenericArguments ().Length : 0;
+                               return t.IsGenericType ? t.GetGenericArguments ().Length : 0;
                }
 
                public static Type[] GetTypeArguments (Type t)
@@ -2171,7 +2171,7 @@ namespace Mono.CSharp {
                                if (infered_types [i] == null)
                                        return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = ((MethodInfo)method).MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2241,7 +2241,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = ((MethodInfo)method).MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2269,7 +2269,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = ((MethodInfo)method).MakeGenericMethod (infered_types);
                        return true;
                }
 
index 37d0ae640c8bf496741476fdcf02fb1aadbf8213..e5a5954398c10415e6d9f2496293ca693757579e 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-12  Raja R Harinath  <rharinath@novell.com>
+
+       * profiles/basic.make (do-profile-check): Quote sed expression.
+
+2005-09-06  Raja R Harinath  <rharinath@novell.com>
+
+       * profiles/net_1_1_bootstrap.make: Remove special-handling on Win32.
+       * profiles/default.make: Likewise.
+
 2005-08-26  Kornél Pál  <kornelpal@hotmail.com>
 
        * Makefile: Added Consts.cs.in. Removed MonoVersion.cs.
index 6e52f9f9a1256ee16f012a403426a7579aeea4ec..b048d9311aa79a028f5e6a57bcf27d5902b6cd3a 100644 (file)
@@ -39,7 +39,7 @@ do-profile-check:
                monolite_corlib_version=`$(with_mono_path_monolite) $(ILDISASM) $(topdir)/class/lib/monolite/mscorlib.dll | sed -n 's,.*mono_corlib_version.*int32.*(\([^)]*\)),\1,p'`; \
                source_corlib_version=`sed -n 's,.*mono_corlib_version.*=[^0-9]*\([0-9]*\)[^0-9]*$$,\1,p' $(topdir)/class/corlib/System/Environment.cs`; \
                case $$monolite_corlib_version in \
-               0x* | 0X*) monolite_corlib_version=`echo $$monolite_corlib_version | sed s,^0[xX],,`; \
+               0x* | 0X*) monolite_corlib_version=`echo $$monolite_corlib_version | sed 's,^0[xX],,'`; \
                  monolite_corlib_version=`(echo 16; echo i; echo $$monolite_corlib_version; echo p) | dc` ;; esac ; \
                if test x$$monolite_corlib_version = x$$source_corlib_version; then \
                    echo "*** Falling back to using pre-compiled binaries.  Be warned, this may not work." 1>&2 ; \
index b1cfa4b921842b20560764da068d3d99378dd795..f0ebaafce9a37c5ebc24e4f67d7f13d1f00c5f2f 100644 (file)
 # run the compiler; /r: flags are by default loaded from whatever's
 # in the MONO_PATH too).
 
-ifdef PLATFORM_MONO_NATIVE
 BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/net_1_1_bootstrap/mcs.exe
 MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
 MBAS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MBAS)
-else
-BOOTSTRAP_MCS = $(EXTERNAL_MCS)
-MCS = $(PLATFORM_RUNTIME) $(EXTERNAL_MCS) /lib:$(topdir)/class/lib/$(PROFILE)
-MBAS = $(PLATFORM_RUNTIME) $(EXTERNAL_MBAS) /lib:$(topdir)/class/lib/$(PROFILE)
-endif
 
 # nuttzing!
 
index 5b0746c438733a8982391110ae8deb811dfbb4b7..0e5737fde646be6688db76698842c057ecc9ed4d 100644 (file)
@@ -1,14 +1,8 @@
 # -*- makefile -*-
 
-ifdef PLATFORM_MONO_NATIVE
-BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/basic:$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/basic/mcs.exe
-MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(INTERNAL_MCS)
-MBAS = MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(INTERNAL_MBAS)
-else
-BOOTSTRAP_MCS = $(EXTERNAL_MCS)
-MCS = $(PLATFORM_RUNTIME) $(EXTERNAL_MCS) /lib:$(topdir)/class/lib/$(PROFILE)
-MBAS = $(PLATFORM_RUNTIME) $(EXTERNAL_MBAS) /lib:$(topdir)/class/lib/$(PROFILE)
-endif
+BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/basic$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/basic/mcs.exe
+MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
+MBAS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MBAS)
 
 NO_SIGN_ASSEMBLY = yes
 NO_TEST = yes
index f67533048ae2fe63bcff75cfb155e8a7e18617b6..894c45b149e9cdc20bbfd20773da75bf6bfe1b47 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-11  Atsushi Enomoto <atsushi@ximian.com>
+
+       * NvdlCompileContext.cs : make this internal.
+       * NvdlStructures.cs : surpress default constructor.
+         Make debug stuff internal.
+
 2005-04-11  Atsushi Enomoto <atsushi@ximian.com>
 
        * NvdlRelaxngSupport.cs : added PlanAtt validation support.
index 7ef8e1c3a5296bf91157374ae3031cb46a9c3d69..fa009714e99cc8c63284ebec4461b5d9eed4b814 100644 (file)
@@ -6,7 +6,7 @@ using Commons.Xml;
 
 namespace Commons.Xml.Nvdl
 {
-       public class NvdlCompileContext
+       internal class NvdlCompileContext
        {
                NvdlRules rules;
                NvdlConfig config;
index 00a02acc8840ba602f8a0c0372060449a1e261f4..66b016b5b82df652cd998a6d5a1be7d6ef645cca 100644 (file)
@@ -12,6 +12,8 @@ namespace Commons.Xml.Nvdl
 {
        public class Nvdl
        {
+               private Nvdl () {}
+
                public const string Namespace = "http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0";
                public const string BuiltInValidationNamespace = "http://purl.oclc.org/dsdl/nvdl/ns/predefinedSchema/1.0";
 
@@ -25,7 +27,7 @@ namespace Commons.Xml.Nvdl
                        Console.WriteLine (e.Message);
                }
 
-               public static NvdlMessageEventHandler HandlePrintMessage =
+               internal static NvdlMessageEventHandler HandlePrintMessage =
                        new NvdlMessageEventHandler (OnDefaultEvent);
 
                readonly static NvdlConfig defaultConfig;
@@ -45,7 +47,7 @@ namespace Commons.Xml.Nvdl
                        new char [] {' ', '\r', '\n', '\t'};
 
                // See 6.4.12.
-               public static bool NSMatches (string n1, int i1, string w1,
+               internal static bool NSMatches (string n1, int i1, string w1,
                        string n2, int i2, string w2)
                {
                        // quick check
index ff0dd1aa9d2287dbb465a2909eeb288c0c7aca3e..c397bf2284a4916c87cbdadc79aca1cba7312d98 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Text;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal abstract class ArrayBase\r
-       {\r
-               #region Fields\r
-\r
-               private ArrayDesc       descriptor;\r
-               private string          tableName;\r
-               private string          fieldName;\r
-               private string          rdbFieldName;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public ArrayDesc Descriptor\r
-               {\r
-                       get { return this.descriptor; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Abstract Properties\r
-\r
-               public abstract long Handle\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               public abstract IDatabase DB\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               public abstract ITransaction Transaction\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               protected ArrayBase(ArrayDesc descriptor)\r
-               {\r
-                       this.tableName  = descriptor.RelationName;\r
-                       this.fieldName  = descriptor.FieldName;\r
-                       this.descriptor = descriptor;\r
-               }\r
-\r
-               protected ArrayBase(string tableName, string fieldName)\r
-               {\r
-                       this.tableName          = tableName;\r
-                       this.fieldName          = fieldName;\r
-                       this.rdbFieldName       = String.Empty;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Abstract Methods\r
-\r
-               public abstract byte[] GetSlice(int slice_length);\r
-               public abstract void PutSlice(System.Array source_array, int slice_length);\r
-\r
-               #endregion\r
-\r
-               #region Protected Abstract Methods\r
-\r
-               protected abstract System.Array DecodeSlice(byte[] slice);\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public Array Read()\r
-               {\r
-                       byte[] slice = this.GetSlice(this.GetSliceLength(true));\r
-\r
-                       return this.DecodeSlice(slice);\r
-               }\r
-\r
-               public void Write(System.Array sourceArray)\r
-               {\r
-                       this.SetDesc(sourceArray);\r
-                       this.PutSlice(sourceArray, this.GetSliceLength(false));\r
-               }\r
-\r
-               public void SetDesc(System.Array sourceArray)\r
-               {\r
-                       this.descriptor.Dimensions = (short)sourceArray.Rank;\r
-\r
-                       for (int i = 0; i < sourceArray.Rank; i++)\r
-                       {\r
-                               int lb = this.descriptor.Bounds[i].LowerBound;\r
-                               int ub = sourceArray.GetLength(i) - 1 + lb;\r
-\r
-                               this.descriptor.Bounds[i].UpperBound = ub;\r
-                       }\r
-               }\r
-\r
-               public void LookupBounds()\r
-               {\r
-                       this.LookupDesc();\r
-\r
-                       StatementBase lookup = this.DB.CreateStatement(this.Transaction);\r
-\r
-                       lookup.Prepare(this.GetArrayBounds());\r
-                       lookup.Execute();\r
-\r
-                       int i = 0;\r
-                       this.descriptor.Bounds = new ArrayBound[16];\r
-                       DbValue[] values;\r
-\r
-                       while ((values = lookup.Fetch()) != null)\r
-                       {\r
-                               this.descriptor.Bounds[i].LowerBound = values[0].GetInt32();\r
-                               this.descriptor.Bounds[i].UpperBound = values[1].GetInt32();\r
-\r
-                               i++;\r
-                       }\r
-\r
-                       lookup.Release();\r
-                       lookup = null;\r
-               }\r
-\r
-               public void LookupDesc()\r
-               {\r
-                       // Initializa array descriptor information\r
-                       this.descriptor = new ArrayDesc();\r
-\r
-                       // Create statement for retrieve information\r
-                       StatementBase lookup = this.DB.CreateStatement(this.Transaction);\r
-\r
-                       lookup.Prepare(this.GetArrayDesc());\r
-                       lookup.Execute();\r
-\r
-                       DbValue[] values = lookup.Fetch();\r
-                       if (values != null && values.Length > 0)\r
-                       {\r
-                               this.descriptor.RelationName    = tableName;\r
-                               this.descriptor.FieldName               = fieldName;\r
-                               this.descriptor.DataType                = values[0].GetByte();\r
-                               this.descriptor.Scale                   = values[1].GetInt16();\r
-                               this.descriptor.Length                  = values[2].GetInt16();\r
-                               this.descriptor.Dimensions              = values[3].GetInt16();\r
-                               this.descriptor.Flags                   = 0;\r
-\r
-                               this.rdbFieldName = values[4].GetString().Trim();\r
-                       }\r
-                       else\r
-                       {\r
-                               throw new InvalidOperationException();\r
-                       }\r
-\r
-                       lookup.Release();\r
-                       lookup = null;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected int GetSliceLength(bool read)\r
-               {\r
-                       int length = 0;\r
-                       int elements = 0;\r
-\r
-                       for (int i = 0; i < this.descriptor.Dimensions; i++)\r
-                       {\r
-                               ArrayBound bound = this.descriptor.Bounds[i];\r
-\r
-                               elements += (bound.UpperBound - bound.LowerBound) + 1;\r
-                       }\r
-\r
-                       length = elements * this.descriptor.Length;\r
-\r
-                       switch (this.descriptor.DataType)\r
-                       {\r
-                               case IscCodes.blr_varying:\r
-                               case IscCodes.blr_varying2:\r
-                                       length += elements * 2;\r
-                                       break;\r
-                       }\r
-\r
-                       return length;\r
-               }\r
-\r
-               protected Type GetSystemType()\r
-               {\r
-                       Type systemType;\r
-\r
-                       switch (this.descriptor.DataType)\r
-                       {\r
-                               case IscCodes.blr_text:\r
-                               case IscCodes.blr_text2:\r
-                               case IscCodes.blr_cstring:\r
-                               case IscCodes.blr_cstring2:\r
-                                       // Char\r
-                                       systemType = typeof(System.String);\r
-                                       break;\r
-\r
-                               case IscCodes.blr_varying:\r
-                               case IscCodes.blr_varying2:\r
-                                       // VarChar\r
-                                       systemType = typeof(System.String);\r
-                                       break;\r
-\r
-                               case IscCodes.blr_short:\r
-                                       // Short/Smallint\r
-                                       if (this.descriptor.Scale < 0)\r
-                                       {\r
-                                               systemType = typeof(System.Decimal);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               systemType = typeof(System.Int16);\r
-                                       }\r
-                                       break;\r
-\r
-                               case IscCodes.blr_long:\r
-                                       // Integer\r
-                                       if (this.descriptor.Scale < 0)\r
-                                       {\r
-                                               systemType = typeof(System.Decimal);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               systemType = typeof(System.Int32);\r
-                                       }\r
-                                       break;\r
-\r
-                               case IscCodes.blr_float:\r
-                                       // Float\r
-                                       systemType = typeof(System.Single);\r
-                                       break;\r
-\r
-                               case IscCodes.blr_double:\r
-                               case IscCodes.blr_d_float:\r
-                                       // Double\r
-                                       systemType = typeof(System.Double);\r
-                                       break;\r
-\r
-                               case IscCodes.blr_quad:\r
-                               case IscCodes.blr_int64:\r
-                                       // Long/Quad\r
-                                       if (this.descriptor.Scale < 0)\r
-                                       {\r
-                                               systemType = typeof(System.Decimal);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               systemType = typeof(System.Int64);\r
-                                       }\r
-                                       break;\r
-\r
-                               case IscCodes.blr_timestamp:\r
-                                       // Timestamp\r
-                                       systemType = typeof(System.DateTime);\r
-                                       break;\r
-\r
-                               case IscCodes.blr_sql_time:\r
-                                       // Time\r
-                                       systemType = typeof(System.DateTime);\r
-                                       break;\r
-\r
-                               case IscCodes.blr_sql_date:\r
-                                       // Date\r
-                                       systemType = typeof(System.DateTime);\r
-                                       break;\r
-\r
-                               default:\r
-                                       throw new NotSupportedException("Unknown data type");\r
-                       }\r
-\r
-                       return systemType;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private string GetArrayDesc()\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               "SELECT Y.RDB$FIELD_TYPE, Y.RDB$FIELD_SCALE, Y.RDB$FIELD_LENGTH, Y.RDB$DIMENSIONS, X.RDB$FIELD_SOURCE " +\r
-                               "FROM RDB$RELATION_FIELDS X, RDB$FIELDS Y " +\r
-                               "WHERE X.RDB$FIELD_SOURCE = Y.RDB$FIELD_NAME ");\r
-\r
-                       if (this.tableName != null && this.tableName.Length != 0)\r
-                       {\r
-                               sql.AppendFormat(\r
-                                       CultureInfo.CurrentCulture, " AND X.RDB$RELATION_NAME = '{0}'", tableName);\r
-                       }\r
-\r
-                       if (this.fieldName != null && this.fieldName.Length != 0)\r
-                       {\r
-                               sql.AppendFormat(\r
-                                       CultureInfo.CurrentCulture, " AND X.RDB$FIELD_NAME = '{0}'", fieldName);\r
-                       }\r
-\r
-                       return sql.ToString();\r
-               }\r
-\r
-               private string GetArrayBounds()\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-\r
-                       sql.Append("SELECT X.RDB$LOWER_BOUND, X.RDB$UPPER_BOUND FROM RDB$FIELD_DIMENSIONS X ");\r
-\r
-                       if (this.fieldName != null && this.fieldName.Length != 0)\r
-                       {\r
-                               sql.AppendFormat(\r
-                                       CultureInfo.CurrentCulture, "WHERE X.RDB$FIELD_NAME = '{0}'", rdbFieldName);\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY X.RDB$DIMENSION");\r
-\r
-                       return sql.ToString();\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Common
+{
+       internal abstract class ArrayBase
+       {
+               #region Fields
+
+               private ArrayDesc       descriptor;
+               private string          tableName;
+               private string          fieldName;
+               private string          rdbFieldName;
+
+               #endregion
+
+               #region Properties
+
+               public ArrayDesc Descriptor
+               {
+                       get { return this.descriptor; }
+               }
+
+               #endregion
+
+               #region Abstract Properties
+
+               public abstract long Handle
+               {
+                       get;
+                       set;
+               }
+
+               public abstract IDatabase DB
+               {
+                       get;
+                       set;
+               }
+
+               public abstract ITransaction Transaction
+               {
+                       get;
+                       set;
+               }
+
+               #endregion
+
+               #region Constructors
+
+               protected ArrayBase(ArrayDesc descriptor)
+               {
+                       this.tableName  = descriptor.RelationName;
+                       this.fieldName  = descriptor.FieldName;
+                       this.descriptor = descriptor;
+               }
+
+               protected ArrayBase(string tableName, string fieldName)
+               {
+                       this.tableName          = tableName;
+                       this.fieldName          = fieldName;
+                       this.rdbFieldName       = String.Empty;
+               }
+
+               #endregion
+
+               #region Abstract Methods
+
+               public abstract byte[] GetSlice(int slice_length);
+               public abstract void PutSlice(System.Array source_array, int slice_length);
+
+               #endregion
+
+               #region Protected Abstract Methods
+
+               protected abstract System.Array DecodeSlice(byte[] slice);
+
+               #endregion
+
+               #region Methods
+
+               public Array Read()
+               {
+                       byte[] slice = this.GetSlice(this.GetSliceLength(true));
+
+                       return this.DecodeSlice(slice);
+               }
+
+               public void Write(System.Array sourceArray)
+               {
+                       this.SetDesc(sourceArray);
+                       this.PutSlice(sourceArray, this.GetSliceLength(false));
+               }
+
+               public void SetDesc(System.Array sourceArray)
+               {
+                       this.descriptor.Dimensions = (short)sourceArray.Rank;
+
+                       for (int i = 0; i < sourceArray.Rank; i++)
+                       {
+                               int lb = this.descriptor.Bounds[i].LowerBound;
+                               int ub = sourceArray.GetLength(i) - 1 + lb;
+
+                               this.descriptor.Bounds[i].UpperBound = ub;
+                       }
+               }
+
+               public void LookupBounds()
+               {
+                       this.LookupDesc();
+
+                       StatementBase lookup = this.DB.CreateStatement(this.Transaction);
+
+                       lookup.Prepare(this.GetArrayBounds());
+                       lookup.Execute();
+
+                       int i = 0;
+                       this.descriptor.Bounds = new ArrayBound[16];
+                       DbValue[] values;
+
+                       while ((values = lookup.Fetch()) != null)
+                       {
+                               this.descriptor.Bounds[i].LowerBound = values[0].GetInt32();
+                               this.descriptor.Bounds[i].UpperBound = values[1].GetInt32();
+
+                               i++;
+                       }
+
+                       lookup.Release();
+                       lookup = null;
+               }
+
+               public void LookupDesc()
+               {
+                       // Initializa array descriptor information
+                       this.descriptor = new ArrayDesc();
+
+                       // Create statement for retrieve information
+                       StatementBase lookup = this.DB.CreateStatement(this.Transaction);
+
+                       lookup.Prepare(this.GetArrayDesc());
+                       lookup.Execute();
+
+                       DbValue[] values = lookup.Fetch();
+                       if (values != null && values.Length > 0)
+                       {
+                               this.descriptor.RelationName    = tableName;
+                               this.descriptor.FieldName               = fieldName;
+                               this.descriptor.DataType                = values[0].GetByte();
+                               this.descriptor.Scale                   = values[1].GetInt16();
+                               this.descriptor.Length                  = values[2].GetInt16();
+                               this.descriptor.Dimensions              = values[3].GetInt16();
+                               this.descriptor.Flags                   = 0;
+
+                               this.rdbFieldName = values[4].GetString().Trim();
+                       }
+                       else
+                       {
+                               throw new InvalidOperationException();
+                       }
+
+                       lookup.Release();
+                       lookup = null;
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected int GetSliceLength(bool read)
+               {
+                       int length = 0;
+                       int elements = 0;
+
+                       for (int i = 0; i < this.descriptor.Dimensions; i++)
+                       {
+                               ArrayBound bound = this.descriptor.Bounds[i];
+
+                               elements += (bound.UpperBound - bound.LowerBound) + 1;
+                       }
+
+                       length = elements * this.descriptor.Length;
+
+                       switch (this.descriptor.DataType)
+                       {
+                               case IscCodes.blr_varying:
+                               case IscCodes.blr_varying2:
+                                       length += elements * 2;
+                                       break;
+                       }
+
+                       return length;
+               }
+
+               protected Type GetSystemType()
+               {
+                       Type systemType;
+
+                       switch (this.descriptor.DataType)
+                       {
+                               case IscCodes.blr_text:
+                               case IscCodes.blr_text2:
+                               case IscCodes.blr_cstring:
+                               case IscCodes.blr_cstring2:
+                                       // Char
+                                       systemType = typeof(System.String);
+                                       break;
+
+                               case IscCodes.blr_varying:
+                               case IscCodes.blr_varying2:
+                                       // VarChar
+                                       systemType = typeof(System.String);
+                                       break;
+
+                               case IscCodes.blr_short:
+                                       // Short/Smallint
+                                       if (this.descriptor.Scale < 0)
+                                       {
+                                               systemType = typeof(System.Decimal);
+                                       }
+                                       else
+                                       {
+                                               systemType = typeof(System.Int16);
+                                       }
+                                       break;
+
+                               case IscCodes.blr_long:
+                                       // Integer
+                                       if (this.descriptor.Scale < 0)
+                                       {
+                                               systemType = typeof(System.Decimal);
+                                       }
+                                       else
+                                       {
+                                               systemType = typeof(System.Int32);
+                                       }
+                                       break;
+
+                               case IscCodes.blr_float:
+                                       // Float
+                                       systemType = typeof(System.Single);
+                                       break;
+
+                               case IscCodes.blr_double:
+                               case IscCodes.blr_d_float:
+                                       // Double
+                                       systemType = typeof(System.Double);
+                                       break;
+
+                               case IscCodes.blr_quad:
+                               case IscCodes.blr_int64:
+                                       // Long/Quad
+                                       if (this.descriptor.Scale < 0)
+                                       {
+                                               systemType = typeof(System.Decimal);
+                                       }
+                                       else
+                                       {
+                                               systemType = typeof(System.Int64);
+                                       }
+                                       break;
+
+                               case IscCodes.blr_timestamp:
+                                       // Timestamp
+                                       systemType = typeof(System.DateTime);
+                                       break;
+
+                               case IscCodes.blr_sql_time:
+                                       // Time
+                                       systemType = typeof(System.DateTime);
+                                       break;
+
+                               case IscCodes.blr_sql_date:
+                                       // Date
+                                       systemType = typeof(System.DateTime);
+                                       break;
+
+                               default:
+                                       throw new NotSupportedException("Unknown data type");
+                       }
+
+                       return systemType;
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private string GetArrayDesc()
+               {
+                       StringBuilder sql = new StringBuilder();
+
+                       sql.Append(
+                               "SELECT Y.RDB$FIELD_TYPE, Y.RDB$FIELD_SCALE, Y.RDB$FIELD_LENGTH, Y.RDB$DIMENSIONS, X.RDB$FIELD_SOURCE " +
+                               "FROM RDB$RELATION_FIELDS X, RDB$FIELDS Y " +
+                               "WHERE X.RDB$FIELD_SOURCE = Y.RDB$FIELD_NAME ");
+
+                       if (this.tableName != null && this.tableName.Length != 0)
+                       {
+                               sql.AppendFormat(
+                                       CultureInfo.CurrentCulture, " AND X.RDB$RELATION_NAME = '{0}'", tableName);
+                       }
+
+                       if (this.fieldName != null && this.fieldName.Length != 0)
+                       {
+                               sql.AppendFormat(
+                                       CultureInfo.CurrentCulture, " AND X.RDB$FIELD_NAME = '{0}'", fieldName);
+                       }
+
+                       return sql.ToString();
+               }
+
+               private string GetArrayBounds()
+               {
+                       StringBuilder sql = new StringBuilder();
+
+                       sql.Append("SELECT X.RDB$LOWER_BOUND, X.RDB$UPPER_BOUND FROM RDB$FIELD_DIMENSIONS X ");
+
+                       if (this.fieldName != null && this.fieldName.Length != 0)
+                       {
+                               sql.AppendFormat(
+                                       CultureInfo.CurrentCulture, "WHERE X.RDB$FIELD_NAME = '{0}'", rdbFieldName);
+                       }
+
+                       sql.Append(" ORDER BY X.RDB$DIMENSION");
+
+                       return sql.ToString();
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index c8cdc11adbe12012d1cbe00ec24fe29a09156b08..27780b29e592d0d452297b77e5ab2892037d4e44 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Runtime.InteropServices;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal struct ArrayDesc\r
-       {\r
-               #region Fields\r
-\r
-               private byte    dataType;\r
-               private short   scale;\r
-               private short   length;\r
-               private string  fieldName;\r
-               private string  relationName;\r
-               private short   dimensions;\r
-               private short   flags;\r
-               private ArrayBound[] bounds;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public byte DataType\r
-               {\r
-                       get { return this.dataType; }\r
-                       set { this.dataType = value; }\r
-               }\r
-\r
-               // Scale for numeric datatypes\r
-               public short Scale\r
-               {\r
-                       get { return this.scale; }\r
-                       set { this.scale = value; }\r
-               }\r
-\r
-               // Legth in bytes of each array element\r
-               public short Length\r
-               {\r
-                       get { return this.length; }\r
-                       set { this.length = value; }\r
-               }\r
-\r
-               // Column name - 32\r
-               public string FieldName\r
-               {\r
-                       get { return this.fieldName; }\r
-                       set { this.fieldName = value; }\r
-               }\r
-\r
-               // Table name -32\r
-               public string RelationName\r
-               {\r
-                       get { return this.relationName; }\r
-                       set { this.relationName = value; }\r
-               }\r
-\r
-               // Number of array dimensions \r
-               public short Dimensions\r
-               {\r
-                       get { return this.dimensions; }\r
-                       set { this.dimensions = value; }\r
-               }\r
-\r
-               // Specifies wheter array is to be accesed in\r
-               // row mayor or column-mayor order\r
-               public short Flags\r
-               {\r
-                       get { return this.flags; }\r
-                       set { this.flags = value; }\r
-               }\r
-\r
-               // Lower and upper bounds for each dimension - 16\r
-               public ArrayBound[] Bounds\r
-               {\r
-                       get { return this.bounds; }\r
-                       set { this.bounds = value; }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-\r
-       internal struct ArrayBound\r
-       {\r
-               #region Fields\r
-\r
-               private int lowerBound;\r
-               private int upperBound;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int LowerBound\r
-               {\r
-                       get { return this.lowerBound; }\r
-                       set { this.lowerBound = value; }\r
-               }\r
-\r
-               public int UpperBound\r
-               {\r
-                       get { return this.upperBound; }\r
-                       set { this.upperBound = value; }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace FirebirdSql.Data.Common
+{
+       internal struct ArrayDesc
+       {
+               #region Fields
+
+               private byte    dataType;
+               private short   scale;
+               private short   length;
+               private string  fieldName;
+               private string  relationName;
+               private short   dimensions;
+               private short   flags;
+               private ArrayBound[] bounds;
+
+               #endregion
+
+               #region Properties
+
+               public byte DataType
+               {
+                       get { return this.dataType; }
+                       set { this.dataType = value; }
+               }
+
+               // Scale for numeric datatypes
+               public short Scale
+               {
+                       get { return this.scale; }
+                       set { this.scale = value; }
+               }
+
+               // Legth in bytes of each array element
+               public short Length
+               {
+                       get { return this.length; }
+                       set { this.length = value; }
+               }
+
+               // Column name - 32
+               public string FieldName
+               {
+                       get { return this.fieldName; }
+                       set { this.fieldName = value; }
+               }
+
+               // Table name -32
+               public string RelationName
+               {
+                       get { return this.relationName; }
+                       set { this.relationName = value; }
+               }
+
+               // Number of array dimensions 
+               public short Dimensions
+               {
+                       get { return this.dimensions; }
+                       set { this.dimensions = value; }
+               }
+
+               // Specifies wheter array is to be accesed in
+               // row mayor or column-mayor order
+               public short Flags
+               {
+                       get { return this.flags; }
+                       set { this.flags = value; }
+               }
+
+               // Lower and upper bounds for each dimension - 16
+               public ArrayBound[] Bounds
+               {
+                       get { return this.bounds; }
+                       set { this.bounds = value; }
+               }
+
+               #endregion
+       }
+
+       internal struct ArrayBound
+       {
+               #region Fields
+
+               private int lowerBound;
+               private int upperBound;
+
+               #endregion
+
+               #region Properties
+
+               public int LowerBound
+               {
+                       get { return this.lowerBound; }
+                       set { this.lowerBound = value; }
+               }
+
+               public int UpperBound
+               {
+                       get { return this.upperBound; }
+                       set { this.upperBound = value; }
+               }
+
+               #endregion
+       }
+}
index 2ea124f66bc02a93ba3fef822e3a99ab3eba15c8..1b6bac54ced600fed92b360deb56b07cafa4128f 100644 (file)
-/*\r
- *  BinaryEncoding handler for .Net.  This class implements\r
- *     a symmetric encoding that will convert string to byte[]\r
- *  and byte[] to string without any character set\r
- *  transliteration.\r
- *\r
- *  The contents of this file were written by jimb\r
- *  at connectedsw.com on Dec 9, 2004.  It is placed in\r
- *  the Public Domain and may be used as you see fit.\r
- */\r
-\r
-using System;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal class BinaryEncoding : Encoding\r
-       {\r
-               #region Static Methods\r
-\r
-               public static string BytesToString(byte[] byteArray)\r
-               {\r
-                       // This code isn't great because it requires a double copy,\r
-                       // but it requires unsafe code to solve the problem efficiently.\r
-                       char[] charArray = new char[byteArray.GetLength(0)];\r
-                       Array.Copy(byteArray, charArray, byteArray.Length);\r
-\r
-                       return new string(charArray);\r
-               }\r
-\r
-               static void Validate(object data, int dataLength, int index, int count)\r
-               {\r
-                       if (data == null)\r
-                       {\r
-                               throw new ArgumentNullException();\r
-                       }\r
-\r
-                       if (index < 0 || count < 0 || dataLength - index < count)\r
-                       {\r
-                               throw new ArgumentOutOfRangeException();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public override int GetByteCount(char[] chars, int index, int count)\r
-               {\r
-                       Validate(chars, chars.Length, index, count);\r
-\r
-                       return count;\r
-               }\r
-\r
-               public override int GetByteCount(string chars)\r
-               {\r
-                       return chars.Length;\r
-               }\r
-\r
-               public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int index)\r
-               {\r
-                       Validate(chars, chars.Length, charIndex, charCount);\r
-\r
-                       if (index < 0 || index > bytes.Length)\r
-                       {\r
-                               throw new ArgumentOutOfRangeException();\r
-                       }\r
-                       if (bytes.Length - index < charCount)\r
-                       {\r
-                               throw new ArgumentException();\r
-                       }\r
-\r
-                       int charEnd = charIndex + charCount;\r
-                       while (charIndex < charEnd)\r
-                       {\r
-                               bytes[index++] = (byte)chars[charIndex++];\r
-                       }\r
-\r
-                       return charCount;\r
-               }\r
-\r
-               public override int GetBytes(string chars, int charIndex, int charCount, byte[] bytes, int index)\r
-               {\r
-                       Validate(chars, chars.Length, charIndex, charCount);\r
-\r
-                       if (index < 0 || index > bytes.Length)\r
-                       {\r
-                               throw new ArgumentOutOfRangeException();\r
-                       }\r
-                       if (bytes.Length - index < charCount)\r
-                       {\r
-                               throw new ArgumentException();\r
-                       }\r
-\r
-                       int charEnd = charIndex + charCount;\r
-                       while (charIndex < charEnd)\r
-                       {\r
-                               bytes[index++] = (byte)chars[charIndex++];\r
-                       }\r
-\r
-                       return charCount;\r
-               }\r
-\r
-               public override int GetCharCount(byte[] bytes, int index, int count)\r
-               {\r
-                       Validate(bytes, bytes.Length, index, count);\r
-\r
-                       return (count);\r
-               }\r
-\r
-               public override int GetChars(byte[] bytes, int index, int count, char[] chars, int charIndex)\r
-               {\r
-                       Validate(bytes, bytes.Length, index, count);\r
-\r
-                       if (charIndex < 0 || charIndex > chars.Length)\r
-                       {\r
-                               throw new ArgumentOutOfRangeException();\r
-                       }\r
-                       if (chars.Length - charIndex < count)\r
-                       {\r
-                               throw new ArgumentException();\r
-                       }\r
-\r
-                       int byteEnd = index + count;\r
-                       while (index < byteEnd)\r
-                       {\r
-                               chars[charIndex++] = (char)bytes[index++];\r
-                       }\r
-\r
-                       return count;\r
-               }\r
-\r
-#if (!NETCF)\r
-       \r
-        public override string GetString(byte[] bytes)\r
-               {\r
-                       return BytesToString(bytes);\r
-               }\r
-\r
-#endif\r
-\r
-               public override string GetString(byte[] bytes, int index, int count)\r
-               {\r
-                       Validate(bytes, bytes.Length, index, count);\r
-\r
-                       return BytesToString(bytes);\r
-               }\r
-\r
-               public override int GetMaxByteCount(int charCount)\r
-               {\r
-                       return charCount;\r
-               }\r
-\r
-               public override int GetMaxCharCount(int count)\r
-               {\r
-                       return count;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  BinaryEncoding handler for .Net.  This class implements
+ *     a symmetric encoding that will convert string to byte[]
+ *  and byte[] to string without any character set
+ *  transliteration.
+ *
+ *  The contents of this file were written by jimb
+ *  at connectedsw.com on Dec 9, 2004.  It is placed in
+ *  the Public Domain and may be used as you see fit.
+ */
+
+using System;
+using System.Text;
+
+namespace FirebirdSql.Data.Common
+{
+       internal class BinaryEncoding : Encoding
+       {
+               #region Static Methods
+
+               public static string BytesToString(byte[] byteArray)
+               {
+                       // This code isn't great because it requires a double copy,
+                       // but it requires unsafe code to solve the problem efficiently.
+                       char[] charArray = new char[byteArray.GetLength(0)];
+                       Array.Copy(byteArray, charArray, byteArray.Length);
+
+                       return new string(charArray);
+               }
+
+               static void Validate(object data, int dataLength, int index, int count)
+               {
+                       if (data == null)
+                       {
+                               throw new ArgumentNullException();
+                       }
+
+                       if (index < 0 || count < 0 || dataLength - index < count)
+                       {
+                               throw new ArgumentOutOfRangeException();
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public override int GetByteCount(char[] chars, int index, int count)
+               {
+                       Validate(chars, chars.Length, index, count);
+
+                       return count;
+               }
+
+               public override int GetByteCount(string chars)
+               {
+                       return chars.Length;
+               }
+
+               public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int index)
+               {
+                       Validate(chars, chars.Length, charIndex, charCount);
+
+                       if (index < 0 || index > bytes.Length)
+                       {
+                               throw new ArgumentOutOfRangeException();
+                       }
+                       if (bytes.Length - index < charCount)
+                       {
+                               throw new ArgumentException();
+                       }
+
+                       int charEnd = charIndex + charCount;
+                       while (charIndex < charEnd)
+                       {
+                               bytes[index++] = (byte)chars[charIndex++];
+                       }
+
+                       return charCount;
+               }
+
+               public override int GetBytes(string chars, int charIndex, int charCount, byte[] bytes, int index)
+               {
+                       Validate(chars, chars.Length, charIndex, charCount);
+
+                       if (index < 0 || index > bytes.Length)
+                       {
+                               throw new ArgumentOutOfRangeException();
+                       }
+                       if (bytes.Length - index < charCount)
+                       {
+                               throw new ArgumentException();
+                       }
+
+                       int charEnd = charIndex + charCount;
+                       while (charIndex < charEnd)
+                       {
+                               bytes[index++] = (byte)chars[charIndex++];
+                       }
+
+                       return charCount;
+               }
+
+               public override int GetCharCount(byte[] bytes, int index, int count)
+               {
+                       Validate(bytes, bytes.Length, index, count);
+
+                       return (count);
+               }
+
+               public override int GetChars(byte[] bytes, int index, int count, char[] chars, int charIndex)
+               {
+                       Validate(bytes, bytes.Length, index, count);
+
+                       if (charIndex < 0 || charIndex > chars.Length)
+                       {
+                               throw new ArgumentOutOfRangeException();
+                       }
+                       if (chars.Length - charIndex < count)
+                       {
+                               throw new ArgumentException();
+                       }
+
+                       int byteEnd = index + count;
+                       while (index < byteEnd)
+                       {
+                               chars[charIndex++] = (char)bytes[index++];
+                       }
+
+                       return count;
+               }
+
+#if (!NETCF)
+       
+        public override string GetString(byte[] bytes)
+               {
+                       return BytesToString(bytes);
+               }
+
+#endif
+
+               public override string GetString(byte[] bytes, int index, int count)
+               {
+                       Validate(bytes, bytes.Length, index, count);
+
+                       return BytesToString(bytes);
+               }
+
+               public override int GetMaxByteCount(int charCount)
+               {
+                       return charCount;
+               }
+
+               public override int GetMaxCharCount(int count)
+               {
+                       return count;
+               }
+
+               #endregion
+       }
+}
index 79cd84f1fc4d296ca62e0a368d9d119d5f0680e3..b828e8d386d057ccb0b3c579108c12678f96b5d2 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Text;\r
-using System.IO;\r
-using System.Collections;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal abstract class BlobBase\r
-       {\r
-               #region Fields\r
-\r
-               private int             rblFlags;\r
-               private Charset charset;\r
-               private int             segmentSize;\r
-\r
-               #endregion\r
-\r
-               #region Protected Fields\r
-\r
-               protected long  blobId;\r
-               protected int   blobHandle;\r
-               protected int   position;\r
-               protected ITransaction transaction;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int Handle\r
-               {\r
-                       get { return this.blobHandle; }\r
-               }\r
-\r
-               public long Id\r
-               {\r
-                       get { return this.blobId; }\r
-               }\r
-\r
-               public bool EOF\r
-               {\r
-                       get { return (this.rblFlags & IscCodes.RBL_eof_pending) != 0; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Properties\r
-\r
-               protected int SegmentSize\r
-               {\r
-                       get { return this.segmentSize; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Abstract Properties\r
-\r
-               public abstract IDatabase DB\r
-               {\r
-                       get;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               protected BlobBase(IDatabase db)\r
-               {\r
-                       this.segmentSize = db.PacketSize;\r
-                       this.charset = db.Charset;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Abstract Methods\r
-\r
-               protected abstract void Create();\r
-               protected abstract void Open();\r
-               protected abstract byte[] GetSegment();\r
-               protected abstract void PutSegment(byte[] buffer);\r
-               protected abstract void Seek(int position);\r
-               protected abstract void GetBlobInfo();\r
-               protected abstract void Close();\r
-               protected abstract void Cancel();\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public string ReadString()\r
-               {\r
-                       byte[] buffer = this.Read();\r
-                       return this.charset.GetString(buffer, 0, buffer.Length);\r
-               }\r
-\r
-               public byte[] Read()\r
-               {\r
-                       MemoryStream ms = new MemoryStream();\r
-\r
-                       try\r
-                       {\r
-                               this.Open();\r
-\r
-                               while (!EOF)\r
-                               {\r
-                                       byte[] segment = this.GetSegment();\r
-                                       ms.Write(segment, 0, segment.Length);\r
-                               }\r
-\r
-                               this.Close();\r
-                       }\r
-                       catch (Exception)\r
-                       {\r
-                               // Cancel the blob and rethrow the exception\r
-                               this.Cancel();\r
-\r
-                               throw;\r
-                       }\r
-\r
-                       return ms.ToArray();\r
-               }\r
-\r
-               public void Write(string data)\r
-               {\r
-                       this.Write(this.charset.GetBytes(data));\r
-               }\r
-\r
-               public void Write(byte[] buffer)\r
-               {\r
-                       this.Write(buffer, 0, buffer.Length);\r
-               }\r
-\r
-               public void Write(byte[] buffer, int index, int count)\r
-               {\r
-                       try\r
-                       {\r
-                               this.Create();\r
-\r
-                               byte[] tmpBuffer = null;\r
-\r
-                               int length      = count;\r
-                               int offset      = index;\r
-                               int chunk       = length >= this.segmentSize ? this.segmentSize : length;\r
-\r
-                               tmpBuffer = new byte[chunk];\r
-\r
-                               while (length > 0)\r
-                               {\r
-                                       if (chunk > length)\r
-                                       {\r
-                                               chunk = (int)length;\r
-                                               tmpBuffer = new byte[chunk];\r
-                                       }\r
-\r
-                                       Array.Copy(buffer, offset, tmpBuffer, 0, chunk);\r
-                                       this.PutSegment(tmpBuffer);\r
-\r
-                                       offset += chunk;\r
-                                       length -= chunk;\r
-                               }\r
-\r
-                               this.Close();\r
-                       }\r
-                       catch (Exception)\r
-                       {\r
-                               // Cancel the blob and rethrow the exception\r
-                               this.Cancel();\r
-\r
-                               throw;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected void RblAddValue(int rblValue)\r
-               {\r
-                       this.rblFlags |= rblValue;\r
-               }\r
-\r
-               protected void RblRemoveValue(int rblValue)\r
-               {\r
-                       this.rblFlags &= ~rblValue;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Text;
+using System.IO;
+using System.Collections;
+
+namespace FirebirdSql.Data.Common
+{
+       internal abstract class BlobBase
+       {
+               #region Fields
+
+               private int             rblFlags;
+               private Charset charset;
+               private int             segmentSize;
+
+               #endregion
+
+               #region Protected Fields
+
+               protected long  blobId;
+               protected int   blobHandle;
+               protected int   position;
+               protected ITransaction transaction;
+
+               #endregion
+
+               #region Properties
+
+               public int Handle
+               {
+                       get { return this.blobHandle; }
+               }
+
+               public long Id
+               {
+                       get { return this.blobId; }
+               }
+
+               public bool EOF
+               {
+                       get { return (this.rblFlags & IscCodes.RBL_eof_pending) != 0; }
+               }
+
+               #endregion
+
+               #region Protected Properties
+
+               protected int SegmentSize
+               {
+                       get { return this.segmentSize; }
+               }
+
+               #endregion
+
+               #region Abstract Properties
+
+               public abstract IDatabase DB
+               {
+                       get;
+               }
+
+               #endregion
+
+               #region Constructors
+
+               protected BlobBase(IDatabase db)
+               {
+                       this.segmentSize = db.PacketSize;
+                       this.charset = db.Charset;
+               }
+
+               #endregion
+
+               #region Protected Abstract Methods
+
+               protected abstract void Create();
+               protected abstract void Open();
+               protected abstract byte[] GetSegment();
+               protected abstract void PutSegment(byte[] buffer);
+               protected abstract void Seek(int position);
+               protected abstract void GetBlobInfo();
+               protected abstract void Close();
+               protected abstract void Cancel();
+
+               #endregion
+
+               #region Methods
+
+               public string ReadString()
+               {
+                       byte[] buffer = this.Read();
+                       return this.charset.GetString(buffer, 0, buffer.Length);
+               }
+
+               public byte[] Read()
+               {
+                       MemoryStream ms = new MemoryStream();
+
+                       try
+                       {
+                               this.Open();
+
+                               while (!EOF)
+                               {
+                                       byte[] segment = this.GetSegment();
+                                       ms.Write(segment, 0, segment.Length);
+                               }
+
+                               this.Close();
+                       }
+                       catch (Exception)
+                       {
+                               // Cancel the blob and rethrow the exception
+                               this.Cancel();
+
+                               throw;
+                       }
+
+                       return ms.ToArray();
+               }
+
+               public void Write(string data)
+               {
+                       this.Write(this.charset.GetBytes(data));
+               }
+
+               public void Write(byte[] buffer)
+               {
+                       this.Write(buffer, 0, buffer.Length);
+               }
+
+               public void Write(byte[] buffer, int index, int count)
+               {
+                       try
+                       {
+                               this.Create();
+
+                               byte[] tmpBuffer = null;
+
+                               int length      = count;
+                               int offset      = index;
+                               int chunk       = length >= this.segmentSize ? this.segmentSize : length;
+
+                               tmpBuffer = new byte[chunk];
+
+                               while (length > 0)
+                               {
+                                       if (chunk > length)
+                                       {
+                                               chunk = (int)length;
+                                               tmpBuffer = new byte[chunk];
+                                       }
+
+                                       Array.Copy(buffer, offset, tmpBuffer, 0, chunk);
+                                       this.PutSegment(tmpBuffer);
+
+                                       offset += chunk;
+                                       length -= chunk;
+                               }
+
+                               this.Close();
+                       }
+                       catch (Exception)
+                       {
+                               // Cancel the blob and rethrow the exception
+                               this.Cancel();
+
+                               throw;
+                       }
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected void RblAddValue(int rblValue)
+               {
+                       this.rblFlags |= rblValue;
+               }
+
+               protected void RblRemoveValue(int rblValue)
+               {
+                       this.rblFlags &= ~rblValue;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 5b99bec2821569fde6343b94e2a037cd5fa042a8..02c9792d298f10f4ecb3d9d6e9fda7aded1dd709 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class BlobParameterBuffer : ParameterBuffer\r
-       {\r
-               #region Constructors\r
-\r
-               public BlobParameterBuffer(bool isLittleEndian) : base(isLittleEndian)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class BlobParameterBuffer : ParameterBuffer
+       {
+               #region Constructors
+
+               public BlobParameterBuffer(bool isLittleEndian) : base(isLittleEndian)
+               {
+               }
+
+               #endregion
+       }
+}
index 4b84a3177fbf4eb9f620713ecb3c86f1e908edd3..3f5be47a46b6d320258090749b10bff0f4dc5ecf 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class Charset\r
-       {\r
-               #region Static Fields\r
-\r
-               private readonly static CharsetCollection supportedCharsets = Charset.InitializeSupportedCharsets();\r
-\r
-               #endregion\r
-\r
-               #region Static Properties\r
-\r
-               public static CharsetCollection SupportedCharsets\r
-               {\r
-                       get { return Charset.supportedCharsets; }\r
-               }\r
-\r
-               public static Charset DefaultCharset\r
-               {\r
-                       get { return Charset.SupportedCharsets[0]; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private int             id;\r
-               private int             bytesPerCharacter;\r
-               private string  name;\r
-               private string  systemName;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int ID\r
-               {\r
-                       get { return this.id; }\r
-               }\r
-\r
-               public string Name\r
-               {\r
-                       get { return this.name; }\r
-               }\r
-\r
-               public int BytesPerCharacter\r
-               {\r
-                       get { return this.bytesPerCharacter; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public Charset(\r
-                       int id, string name, int bytesPerCharacter, string systemName)\r
-               {\r
-                       this.id                                 = id;\r
-                       this.name                               = name;\r
-                       this.bytesPerCharacter  = bytesPerCharacter;\r
-                       this.systemName                 = systemName;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public byte[] GetBytes(string s)\r
-               {\r
-                       return this.GetEncoding().GetBytes(s);\r
-               }\r
-\r
-               public int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)\r
-               {\r
-                       return this.GetEncoding().GetBytes(s, charIndex, charCount, bytes, byteIndex);\r
-               }\r
-\r
-               public string GetString(byte[] buffer)\r
-               {\r
-                       return this.GetString(buffer, 0, buffer.Length);\r
-               }\r
-\r
-               public string GetString(byte[] buffer, int index, int count)\r
-               {\r
-                       return this.GetEncoding().GetString(buffer, index, count);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private Encoding GetEncoding()\r
-               {\r
-                       switch (this.systemName)\r
-                       {\r
-                               case "NONE":\r
-                                       return Encoding.Default;\r
-\r
-                               case "OCTETS":\r
-                                       return new BinaryEncoding();\r
-\r
-                               default:\r
-                                       return Encoding.GetEncoding(this.systemName);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               public static CharsetCollection InitializeSupportedCharsets()\r
-               {\r
-                       CharsetCollection charsets = new CharsetCollection();\r
-\r
-                       // NONE\r
-                       Charset.Add(charsets, 0, "NONE", 1, "NONE");\r
-                       // OCTETS\r
-                       Charset.Add(charsets, 1, "OCTETS", 1, "OCTETS");\r
-                       // American Standard Code for Information Interchange   \r
-                       Charset.Add(charsets, 2, "ASCII", 1, "ascii");\r
-                       // Eight-bit Unicode Transformation Format\r
-                       Charset.Add(charsets, 3, "UNICODE_FSS", 3, "UTF-8");\r
-                       // Shift-JIS, Japanese\r
-                       Charset.Add(charsets, 5, "SJIS_0208", 2, "shift_jis");\r
-                       // JIS X 0201, 0208, 0212, EUC encoding, Japanese\r
-                       Charset.Add(charsets, 6, "EUCJ_0208", 2, "euc-jp");\r
-                       // Windows Japanese     \r
-                       Charset.Add(charsets, 7, "ISO2022-JP", 2, "iso-2022-jp");\r
-                       // MS-DOS United States, Australia, New Zealand, South Africa   \r
-                       Charset.Add(charsets, 10, "DOS437", 1, "IBM437");\r
-                       // MS-DOS Latin-1                               \r
-                       Charset.Add(charsets, 11, "DOS850", 1, "ibm850");\r
-                       // MS-DOS Nordic        \r
-                       Charset.Add(charsets, 12, "DOS865", 1, "IBM865");\r
-                       // MS-DOS Portuguese    \r
-                       Charset.Add(charsets, 13, "DOS860", 1, "IBM860");\r
-                       // MS-DOS Canadian French       \r
-                       Charset.Add(charsets, 14, "DOS863", 1, "IBM863");\r
-                       // ISO 8859-1, Latin alphabet No. 1\r
-                       Charset.Add(charsets, 21, "ISO8859_1", 1, "iso-8859-1");\r
-                       // ISO 8859-2, Latin alphabet No. 2\r
-                       Charset.Add(charsets, 22, "ISO8859_2", 1, "iso-8859-2");\r
-                       // Windows Korean       \r
-                       Charset.Add(charsets, 44, "KSC_5601", 2, "ks_c_5601-1987");\r
-                       // MS-DOS Icelandic     \r
-                       Charset.Add(charsets, 47, "DOS861", 1, "ibm861");\r
-                       // Windows Eastern European\r
-                       Charset.Add(charsets, 51, "WIN1250", 1, "windows-1250");\r
-                       // Windows Cyrillic\r
-                       Charset.Add(charsets, 52, "WIN1251", 1, "windows-1251");\r
-                       // Windows Latin-1\r
-                       Charset.Add(charsets, 53, "WIN1252", 1, "windows-1252");\r
-                       // Windows Greek\r
-                       Charset.Add(charsets, 54, "WIN1253", 1, "windows-1253");\r
-                       // Windows Turkish\r
-                       Charset.Add(charsets, 55, "WIN1254", 1, "windows-1254");\r
-                       // Big5, Traditional Chinese\r
-                       Charset.Add(charsets, 56, "BIG_5", 2, "big5");\r
-                       // GB2312, EUC encoding, Simplified Chinese     \r
-                       Charset.Add(charsets, 57, "GB_2312", 2, "gb2312");\r
-                       // Windows Hebrew\r
-                       Charset.Add(charsets, 58, "WIN1255", 1, "windows-1255");\r
-                       // Windows Arabic       \r
-                       Charset.Add(charsets, 59, "WIN1256", 1, "windows-1256");\r
-                       // Windows Baltic       \r
-                       Charset.Add(charsets, 60, "WIN1257", 1, "windows-1257");\r
-\r
-            return charsets;\r
-               }\r
-\r
-               private static void Add(\r
-                       CharsetCollection charsets, int id, string charset, int bytesPerCharacter, string systemName)\r
-               {\r
-                       charsets.Add(\r
-                                       id,\r
-                                       charset,\r
-                                       bytesPerCharacter,\r
-                                       systemName);\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Text;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class Charset
+       {
+               #region Static Fields
+
+               private readonly static CharsetCollection supportedCharsets = Charset.InitializeSupportedCharsets();
+
+               #endregion
+
+               #region Static Properties
+
+               public static CharsetCollection SupportedCharsets
+               {
+                       get { return Charset.supportedCharsets; }
+               }
+
+               public static Charset DefaultCharset
+               {
+                       get { return Charset.SupportedCharsets[0]; }
+               }
+
+               #endregion
+
+               #region Fields
+
+               private int             id;
+               private int             bytesPerCharacter;
+               private string  name;
+               private string  systemName;
+
+               #endregion
+
+               #region Properties
+
+               public int ID
+               {
+                       get { return this.id; }
+               }
+
+               public string Name
+               {
+                       get { return this.name; }
+               }
+
+               public int BytesPerCharacter
+               {
+                       get { return this.bytesPerCharacter; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public Charset(
+                       int id, string name, int bytesPerCharacter, string systemName)
+               {
+                       this.id                                 = id;
+                       this.name                               = name;
+                       this.bytesPerCharacter  = bytesPerCharacter;
+                       this.systemName                 = systemName;
+               }
+
+               #endregion
+
+               #region Methods
+
+               public byte[] GetBytes(string s)
+               {
+                       return this.GetEncoding().GetBytes(s);
+               }
+
+               public int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
+               {
+                       return this.GetEncoding().GetBytes(s, charIndex, charCount, bytes, byteIndex);
+               }
+
+               public string GetString(byte[] buffer)
+               {
+                       return this.GetString(buffer, 0, buffer.Length);
+               }
+
+               public string GetString(byte[] buffer, int index, int count)
+               {
+                       return this.GetEncoding().GetString(buffer, index, count);
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private Encoding GetEncoding()
+               {
+                       switch (this.systemName)
+                       {
+                               case "NONE":
+                                       return Encoding.Default;
+
+                               case "OCTETS":
+                                       return new BinaryEncoding();
+
+                               default:
+                                       return Encoding.GetEncoding(this.systemName);
+                       }
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               public static CharsetCollection InitializeSupportedCharsets()
+               {
+                       CharsetCollection charsets = new CharsetCollection();
+
+                       // NONE
+                       Charset.Add(charsets, 0, "NONE", 1, "NONE");
+                       // OCTETS
+                       Charset.Add(charsets, 1, "OCTETS", 1, "OCTETS");
+                       // American Standard Code for Information Interchange   
+                       Charset.Add(charsets, 2, "ASCII", 1, "ascii");
+                       // Eight-bit Unicode Transformation Format
+                       Charset.Add(charsets, 3, "UNICODE_FSS", 3, "UTF-8");
+                       // Shift-JIS, Japanese
+                       Charset.Add(charsets, 5, "SJIS_0208", 2, "shift_jis");
+                       // JIS X 0201, 0208, 0212, EUC encoding, Japanese
+                       Charset.Add(charsets, 6, "EUCJ_0208", 2, "euc-jp");
+                       // Windows Japanese     
+                       Charset.Add(charsets, 7, "ISO2022-JP", 2, "iso-2022-jp");
+                       // MS-DOS United States, Australia, New Zealand, South Africa   
+                       Charset.Add(charsets, 10, "DOS437", 1, "IBM437");
+                       // MS-DOS Latin-1                               
+                       Charset.Add(charsets, 11, "DOS850", 1, "ibm850");
+                       // MS-DOS Nordic        
+                       Charset.Add(charsets, 12, "DOS865", 1, "IBM865");
+                       // MS-DOS Portuguese    
+                       Charset.Add(charsets, 13, "DOS860", 1, "IBM860");
+                       // MS-DOS Canadian French       
+                       Charset.Add(charsets, 14, "DOS863", 1, "IBM863");
+                       // ISO 8859-1, Latin alphabet No. 1
+                       Charset.Add(charsets, 21, "ISO8859_1", 1, "iso-8859-1");
+                       // ISO 8859-2, Latin alphabet No. 2
+                       Charset.Add(charsets, 22, "ISO8859_2", 1, "iso-8859-2");
+                       // Windows Korean       
+                       Charset.Add(charsets, 44, "KSC_5601", 2, "ks_c_5601-1987");
+                       // MS-DOS Icelandic     
+                       Charset.Add(charsets, 47, "DOS861", 1, "ibm861");
+                       // Windows Eastern European
+                       Charset.Add(charsets, 51, "WIN1250", 1, "windows-1250");
+                       // Windows Cyrillic
+                       Charset.Add(charsets, 52, "WIN1251", 1, "windows-1251");
+                       // Windows Latin-1
+                       Charset.Add(charsets, 53, "WIN1252", 1, "windows-1252");
+                       // Windows Greek
+                       Charset.Add(charsets, 54, "WIN1253", 1, "windows-1253");
+                       // Windows Turkish
+                       Charset.Add(charsets, 55, "WIN1254", 1, "windows-1254");
+                       // Big5, Traditional Chinese
+                       Charset.Add(charsets, 56, "BIG_5", 2, "big5");
+                       // GB2312, EUC encoding, Simplified Chinese     
+                       Charset.Add(charsets, 57, "GB_2312", 2, "gb2312");
+                       // Windows Hebrew
+                       Charset.Add(charsets, 58, "WIN1255", 1, "windows-1255");
+                       // Windows Arabic       
+                       Charset.Add(charsets, 59, "WIN1256", 1, "windows-1256");
+                       // Windows Baltic       
+                       Charset.Add(charsets, 60, "WIN1257", 1, "windows-1257");
+
+            return charsets;
+               }
+
+               private static void Add(
+                       CharsetCollection charsets, int id, string charset, int bytesPerCharacter, string systemName)
+               {
+                       charsets.Add(
+                                       id,
+                                       charset,
+                                       bytesPerCharacter,
+                                       systemName);
+               }
+
+               #endregion
+       }
+}
index 9463367d744184047cabcc66ed60b65243bbbcd0..b92adce8b40cba83079ac3d028b11f6cbf246f2f 100644 (file)
@@ -1,96 +1,96 @@
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Text;\r
-using System.Collections;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class CharsetCollection : CollectionBase\r
-       {\r
-               #region Indexers\r
-\r
-               public Charset this[int index]\r
-               {\r
-                       get { return (Charset)this.List[index]; }\r
-               }\r
-\r
-               public Charset this[string name]\r
-               {\r
-                       get { return (Charset)this[this.IndexOf(name)]; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public int IndexOf(int id)\r
-               {\r
-                       int index = 0;\r
-\r
-                       foreach (Charset item in this)\r
-                       {\r
-                               if (item.ID == id)\r
-                               {\r
-                                       return index;\r
-                               }\r
-                               index++;\r
-                       }\r
-\r
-                       return -1;\r
-               }\r
-\r
-               public int IndexOf(string name)\r
-               {\r
-                       int index = 0;\r
-\r
-                       foreach (Charset item in this)\r
-                       {\r
-                               if (GlobalizationHelper.CultureAwareCompare(item.Name, name))\r
-                               {\r
-                                       return index;\r
-                               }\r
-                               index++;\r
-                       }\r
-\r
-                       return -1;\r
-               }\r
-\r
-               internal Charset Add(\r
-                       int             id,\r
-                       string  charset,\r
-                       int             bytesPerCharacter,\r
-                       string  systemCharset)\r
-               {\r
-                       Charset charSet = new Charset(\r
-                               id, charset, bytesPerCharacter, systemCharset);\r
-\r
-                       return this.Add(charSet);\r
-               }\r
-\r
-               internal Charset Add(Charset charset)\r
-               {\r
-                       this.List.Add(charset);\r
-\r
-                       return charset;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Text;
+using System.Collections;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class CharsetCollection : CollectionBase
+       {
+               #region Indexers
+
+               public Charset this[int index]
+               {
+                       get { return (Charset)this.List[index]; }
+               }
+
+               public Charset this[string name]
+               {
+                       get { return (Charset)this[this.IndexOf(name)]; }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public int IndexOf(int id)
+               {
+                       int index = 0;
+
+                       foreach (Charset item in this)
+                       {
+                               if (item.ID == id)
+                               {
+                                       return index;
+                               }
+                               index++;
+                       }
+
+                       return -1;
+               }
+
+               public int IndexOf(string name)
+               {
+                       int index = 0;
+
+                       foreach (Charset item in this)
+                       {
+                               if (GlobalizationHelper.CultureAwareCompare(item.Name, name))
+                               {
+                                       return index;
+                               }
+                               index++;
+                       }
+
+                       return -1;
+               }
+
+               internal Charset Add(
+                       int             id,
+                       string  charset,
+                       int             bytesPerCharacter,
+                       string  systemCharset)
+               {
+                       Charset charSet = new Charset(
+                               id, charset, bytesPerCharacter, systemCharset);
+
+                       return this.Add(charSet);
+               }
+
+               internal Charset Add(Charset charset)
+               {
+                       this.List.Add(charset);
+
+                       return charset;
+               }
+
+               #endregion
+       }
+}
index 78ebf3ad82f4a3d9f6a0c9ca47bebc3f92cb943c..f1f707d38fa6036e8f296c026440327ed11c3df2 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-using System.Net;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class DatabaseParameterBuffer : ParameterBuffer\r
-       {\r
-               #region Constructors\r
-\r
-               public DatabaseParameterBuffer() : base()\r
-               {\r
-               }\r
-\r
-               public DatabaseParameterBuffer(bool isLittleEndian) : base(isLittleEndian)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void Append(int type, byte value)\r
-               {\r
-                       this.WriteByte(type);\r
-                       this.WriteByte(1);\r
-                       this.Write(value);\r
-               }\r
-\r
-               public void Append(int type, short value)\r
-               {\r
-                       this.WriteByte(type);\r
-                       this.WriteByte(2);\r
-                       this.Write(value);\r
-               }\r
-\r
-               public void Append(int type, int value)\r
-               {\r
-                       this.WriteByte(type);\r
-                       this.WriteByte((byte)4);\r
-                       this.Write(value);\r
-               }\r
-\r
-               public void Append(int type, string content)\r
-               {\r
-                       this.Append(type, Encoding.Default.GetBytes(content));\r
-               }\r
-\r
-               public void Append(int type, byte[] buffer)\r
-               {\r
-                       this.WriteByte(type);\r
-                       this.WriteByte(buffer.Length);\r
-                       this.Write(buffer);\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Net;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class DatabaseParameterBuffer : ParameterBuffer
+       {
+               #region Constructors
+
+               public DatabaseParameterBuffer() : base()
+               {
+               }
+
+               public DatabaseParameterBuffer(bool isLittleEndian) : base(isLittleEndian)
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void Append(int type, byte value)
+               {
+                       this.WriteByte(type);
+                       this.WriteByte(1);
+                       this.Write(value);
+               }
+
+               public void Append(int type, short value)
+               {
+                       this.WriteByte(type);
+                       this.WriteByte(2);
+                       this.Write(value);
+               }
+
+               public void Append(int type, int value)
+               {
+                       this.WriteByte(type);
+                       this.WriteByte((byte)4);
+                       this.Write(value);
+               }
+
+               public void Append(int type, string content)
+               {
+                       this.Append(type, Encoding.Default.GetBytes(content));
+               }
+
+               public void Append(int type, byte[] buffer)
+               {
+                       this.WriteByte(type);
+                       this.WriteByte(buffer.Length);
+                       this.Write(buffer);
+               }
+
+               #endregion
+       }
+}
index a24a726eccc49472d33ca4ce5733d219e35452ed..5419727b0aacd146c977bb4b7a1330967ee6fd94 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal enum DbDataType\r
-       {\r
-               Array,\r
-               BigInt,\r
-               Binary,\r
-               Char,\r
-               Date,\r
-               Decimal,\r
-               Double,\r
-               Float,\r
-               Guid,\r
-               Integer,\r
-               Numeric,\r
-               SmallInt,\r
-               Text,\r
-               Time,\r
-               TimeStamp,\r
-               VarChar\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Common
+{
+       internal enum DbDataType
+       {
+               Array,
+               BigInt,
+               Binary,
+               Char,
+               Date,
+               Decimal,
+               Double,
+               Float,
+               Guid,
+               Integer,
+               Numeric,
+               SmallInt,
+               Text,
+               Time,
+               TimeStamp,
+               VarChar
+       }
 }
\ No newline at end of file
index 2cf27b5f3592db468e70d65480227c1c313b3fa0..bb5fbd665380e93efb1f1fb14c304f7e135a5669 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class DbField\r
-       {\r
-               #region Fields\r
-\r
-               private short           dataType;\r
-               private short           numericScale;\r
-               private short           subType;\r
-               private short           length;\r
-               private short           nullFlag;\r
-               private string          name;\r
-               private string          relation;\r
-               private string          owner;\r
-               private string          alias;\r
-               private int                     charCount;\r
-               private DbValue         dbValue;\r
-               private Charset         charset;\r
-               private ArrayBase       arrayHandle;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public DbDataType DbDataType\r
-               {\r
-                       get { return this.GetDbDataType(); }\r
-               }\r
-\r
-               public int SqlType\r
-               {\r
-                       get { return this.dataType & ~1; }\r
-               }\r
-\r
-               public short DataType\r
-               {\r
-                       get { return this.dataType; }\r
-                       set { this.dataType = value; }\r
-               }\r
-\r
-               public short NumericScale\r
-               {\r
-                       get { return this.numericScale; }\r
-                       set { this.numericScale = value; }\r
-               }\r
-\r
-               public short SubType\r
-               {\r
-                       get { return this.subType; }\r
-                       set\r
-                       {\r
-                               this.subType = value;\r
-                               if (this.IsCharacter())\r
-                               {\r
-                                       // Bits 0-7 of sqlsubtype is charset_id (127 is a special value -\r
-                                       // current attachment charset).\r
-                                       // Bits 8-17 hold collation_id for this value.\r
-                                       byte[] cs = BitConverter.GetBytes(value);\r
-\r
-                                       int index = Charset.SupportedCharsets.IndexOf(cs[0]);\r
-                                       if (index != -1)\r
-                                       {\r
-                                               this.charset = Charset.SupportedCharsets[index];\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               this.charset = Charset.SupportedCharsets[0];\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public short Length\r
-               {\r
-                       get { return this.length; }\r
-                       set\r
-                       {\r
-                               this.length = value;\r
-                               if (this.IsCharacter())\r
-                               {\r
-                                       this.charCount = this.length / this.charset.BytesPerCharacter;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public short NullFlag\r
-               {\r
-                       get { return this.nullFlag; }\r
-                       set { this.nullFlag = value; }\r
-               }\r
-\r
-               public string Name\r
-               {\r
-                       get { return this.name; }\r
-                       set { this.name = value.Trim(); }\r
-               }\r
-\r
-               public string Relation\r
-               {\r
-                       get { return this.relation; }\r
-                       set { this.relation = value.Trim(); }\r
-               }\r
-\r
-               public string Owner\r
-               {\r
-                       get { return this.owner; }\r
-                       set { this.owner = value.Trim(); }\r
-               }\r
-\r
-               public string Alias\r
-               {\r
-                       get { return this.alias; }\r
-                       set { this.alias = value.Trim(); }\r
-               }\r
-\r
-               public Charset Charset\r
-               {\r
-                       get { return this.charset; }\r
-               }\r
-\r
-               public int CharCount\r
-               {\r
-                       get { return this.charCount; }\r
-               }\r
-\r
-               public ArrayBase ArrayHandle\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.IsArray())\r
-                               {\r
-                                       return this.arrayHandle;\r
-                               }\r
-                               else\r
-                               {\r
-                                       throw new IscException("Field is not an array type");\r
-                               }\r
-                       }\r
-\r
-                       set\r
-                       {\r
-                               if (this.IsArray())\r
-                               {\r
-                                       this.arrayHandle = value;\r
-                               }\r
-                               else\r
-                               {\r
-                                       throw new IscException("Field is not an array type");\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public DbValue DbValue\r
-               {\r
-                       get { return this.dbValue; }\r
-               }\r
-\r
-               public object Value\r
-               {\r
-                       get { return this.dbValue.Value; }\r
-                       set { this.dbValue.Value = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public DbField()\r
-               {\r
-                       this.charCount  = -1;\r
-                       this.name               = String.Empty;\r
-                       this.relation   = String.Empty;\r
-                       this.owner              = String.Empty;\r
-                       this.alias              = String.Empty;\r
-                       this.dbValue    = new DbValue(this, DBNull.Value);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public bool IsNumeric()\r
-               {\r
-                       if (this.dataType == 0)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       switch (this.DbDataType)\r
-                       {\r
-                               case DbDataType.SmallInt:\r
-                               case DbDataType.Integer:\r
-                               case DbDataType.BigInt:\r
-                               case DbDataType.Numeric:\r
-                               case DbDataType.Decimal:\r
-                               case DbDataType.Float:\r
-                               case DbDataType.Double:\r
-                                       return true;\r
-\r
-                               default:\r
-                                       return false;\r
-                       }\r
-               }\r
-\r
-               public bool IsDecimal()\r
-               {\r
-                       if (this.dataType == 0)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       switch (this.DbDataType)\r
-                       {\r
-                               case DbDataType.Numeric:\r
-                               case DbDataType.Decimal:\r
-                                       return true;\r
-\r
-                               default:\r
-                                       return false;\r
-                       }\r
-               }\r
-\r
-               public bool IsLong()\r
-               {\r
-                       if (this.dataType == 0)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       switch (this.DbDataType)\r
-                       {\r
-                               case DbDataType.Binary:\r
-                               case DbDataType.Text:\r
-                                       return true;\r
-\r
-                               default:\r
-                                       return false;\r
-                       }\r
-               }\r
-\r
-               public bool IsCharacter()\r
-               {\r
-                       if (this.dataType == 0)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       switch (this.DbDataType)\r
-                       {\r
-                               case DbDataType.Char:\r
-                               case DbDataType.VarChar:\r
-                               case DbDataType.Text:\r
-                                       return true;\r
-\r
-                               default:\r
-                                       return false;\r
-                       }\r
-               }\r
-\r
-               public bool IsArray()\r
-               {\r
-                       if (this.dataType == 0)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       switch (this.DbDataType)\r
-                       {\r
-                               case DbDataType.Array:\r
-                                       return true;\r
-\r
-                               default:\r
-                                       return false;\r
-                       }\r
-               }\r
-\r
-               public bool IsAliased()\r
-               {\r
-                       return (this.Name != this.Alias) ? true : false;\r
-               }\r
-\r
-               public bool IsExpression()\r
-               {\r
-                       return this.Name.Length == 0 ? true : false;\r
-               }\r
-\r
-               public int GetSize()\r
-               {\r
-                       if (this.IsLong())\r
-                       {\r
-                               return System.Int32.MaxValue;\r
-                       }\r
-                       else\r
-                       {\r
-                               if (this.IsCharacter())\r
-                               {\r
-                                       return this.CharCount;\r
-                               }\r
-                               else\r
-                               {\r
-                                       return this.Length;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public bool AllowDBNull()\r
-               {\r
-                       return ((this.DataType & 1) == 1);\r
-               }\r
-\r
-               public void SetValue(byte[] buffer)\r
-               {\r
-                       if (buffer == null || this.NullFlag == -1)\r
-                       {\r
-                               this.Value = System.DBNull.Value;\r
-                       }\r
-                       else\r
-                       {\r
-                               switch (this.SqlType)\r
-                               {\r
-                                       case IscCodes.SQL_TEXT:\r
-                                       case IscCodes.SQL_VARYING:\r
-                                               if (this.DbDataType == DbDataType.Guid)\r
-                                               {\r
-                                                       this.Value = new Guid(buffer);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       string s = this.Charset.GetString(buffer, 0, buffer.Length);\r
-\r
-                                                       if ((this.Length % this.Charset.BytesPerCharacter) == 0 &&\r
-                                                               s.Length > this.CharCount)\r
-                                                       {\r
-                                                               s = s.Substring(0, this.CharCount);\r
-                                                       }\r
-\r
-                                                       this.Value = s;\r
-                                               }\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_SHORT:\r
-                                               if (this.numericScale < 0)\r
-                                               {\r
-                                                       this.Value = TypeDecoder.DecodeDecimal(\r
-                                                               BitConverter.ToInt16(buffer, 0),\r
-                                                               this.numericScale,\r
-                                                               this.dataType);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       this.Value = BitConverter.ToInt16(buffer, 0);\r
-                                               }\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_LONG:\r
-                                               if (this.NumericScale < 0)\r
-                                               {\r
-                                                       this.Value = TypeDecoder.DecodeDecimal(\r
-                                                               BitConverter.ToInt32(buffer, 0),\r
-                                                               this.numericScale,\r
-                                                               this.dataType);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       this.Value = BitConverter.ToInt32(buffer, 0);\r
-                                               }\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_FLOAT:\r
-                                               this.Value = BitConverter.ToSingle(buffer, 0);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_DOUBLE:\r
-                                       case IscCodes.SQL_D_FLOAT:\r
-                                               this.Value = BitConverter.ToDouble(buffer, 0);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_QUAD:\r
-                                       case IscCodes.SQL_INT64:\r
-                                       case IscCodes.SQL_BLOB:\r
-                                       case IscCodes.SQL_ARRAY:\r
-                                               if (this.NumericScale < 0)\r
-                                               {\r
-                                                       this.Value = TypeDecoder.DecodeDecimal(\r
-                                                               BitConverter.ToInt64(buffer, 0),\r
-                                                               this.numericScale,\r
-                                                               this.dataType);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       this.Value = BitConverter.ToInt64(buffer, 0);\r
-                                               }\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_TIMESTAMP:\r
-                                               DateTime date = TypeDecoder.DecodeDate(\r
-                                                       BitConverter.ToInt32(buffer, 0));\r
-\r
-                                               DateTime time = TypeDecoder.DecodeTime(\r
-                                                       BitConverter.ToInt32(buffer, 4));\r
-\r
-                                               this.Value = new System.DateTime(\r
-                                                       date.Year, date.Month, date.Day,\r
-                                                       time.Hour, time.Minute, time.Second, time.Millisecond);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_TYPE_TIME:\r
-                                               this.Value = TypeDecoder.DecodeTime(BitConverter.ToInt32(buffer, 0));\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_TYPE_DATE:\r
-                                               this.Value = TypeDecoder.DecodeDate(BitConverter.ToInt32(buffer, 0));\r
-                                               break;\r
-\r
-                                       default:\r
-                                               throw new NotSupportedException("Unknown data type");\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void FixNull()\r
-               {\r
-                       if (this.NullFlag == -1 && this.dbValue.IsDBNull())\r
-                       {\r
-                               switch (this.DbDataType)\r
-                               {\r
-                                       case DbDataType.Char:\r
-                                       case DbDataType.VarChar:\r
-                                               this.Value = String.Empty;\r
-                                               break;\r
-\r
-                                       case DbDataType.Guid:\r
-                                               this.Value = Guid.Empty;\r
-                                               break;\r
-\r
-                                       case DbDataType.SmallInt:\r
-                                               this.Value = (short)0;\r
-                                               break;\r
-\r
-                                       case DbDataType.Integer:\r
-                                               this.Value = (int)0;\r
-                                               break;\r
-\r
-                                       case DbDataType.BigInt:\r
-                                       case DbDataType.Binary:\r
-                                       case DbDataType.Array:\r
-                                       case DbDataType.Text:\r
-                                               this.Value = (long)0;\r
-                                               break;\r
-\r
-                                       case DbDataType.Numeric:\r
-                                       case DbDataType.Decimal:\r
-                                               this.Value = (decimal)0;\r
-                                               break;\r
-\r
-                                       case DbDataType.Float:\r
-                                               this.Value = (float)0;\r
-                                               break;\r
-\r
-                                       case DbDataType.Double:\r
-                                               this.Value = (double)0;\r
-                                               break;\r
-\r
-                                       case DbDataType.Date:\r
-                                       case DbDataType.Time:\r
-                                       case DbDataType.TimeStamp:\r
-                                               this.Value = new System.DateTime(0 * 10000L + 621355968000000000);\r
-                                               break;\r
-\r
-                                       default:\r
-                                               throw new IscException("Unknown sql data type: " + this.DataType);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public Type GetSystemType()\r
-               {\r
-                       switch (this.DbDataType)\r
-                       {\r
-                               case DbDataType.Char:\r
-                               case DbDataType.VarChar:\r
-                               case DbDataType.Text:\r
-                                       return Type.GetType("System.String");\r
-\r
-                               case DbDataType.SmallInt:\r
-                                       return Type.GetType("System.Int16");\r
-\r
-                               case DbDataType.Integer:\r
-                                       return Type.GetType("System.Int32");\r
-\r
-                               case DbDataType.BigInt:\r
-                                       return Type.GetType("System.Int64");\r
-\r
-                               case DbDataType.Numeric:\r
-                               case DbDataType.Decimal:\r
-                                       return Type.GetType("System.Decimal");\r
-\r
-                               case DbDataType.Float:\r
-                                       return Type.GetType("System.Single");\r
-\r
-                               case DbDataType.Guid:\r
-                                       return Type.GetType("System.Guid");\r
-\r
-                               case DbDataType.Double:\r
-                                       return Type.GetType("System.Double");\r
-\r
-                               case DbDataType.Date:\r
-                               case DbDataType.Time:\r
-                               case DbDataType.TimeStamp:\r
-                                       return Type.GetType("System.DateTime");\r
-\r
-                               case DbDataType.Binary:\r
-                                       return typeof(byte[]);\r
-\r
-                               case DbDataType.Array:\r
-                                       return Type.GetType("System.Array");\r
-\r
-                               default:\r
-                                       throw new SystemException("Invalid data type");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private DbDataType GetDbDataType()\r
-               {\r
-                       // Special case for Guid handling\r
-                       if (this.SqlType == IscCodes.SQL_TEXT && this.Length == 16 &&\r
-                               (this.Charset != null && this.Charset.Name == "OCTETS"))\r
-                       {\r
-                               return DbDataType.Guid;\r
-                       }\r
-\r
-                       switch (this.SqlType)\r
-                       {\r
-                               case IscCodes.SQL_TEXT:\r
-                                       return DbDataType.Char;\r
-\r
-                               case IscCodes.SQL_VARYING:\r
-                                       return DbDataType.VarChar;\r
-\r
-                               case IscCodes.SQL_SHORT:\r
-                                       if (this.subType == 2)\r
-                                       {\r
-                                               return DbDataType.Decimal;\r
-                                       }\r
-                    else if (subType == 1)\r
-                    {\r
-                        return DbDataType.Numeric;\r
-                    }\r
-                    else\r
-                                       {\r
-                                               return DbDataType.SmallInt;\r
-                                       }\r
-\r
-                               case IscCodes.SQL_LONG:\r
-                                       if (this.subType == 2)\r
-                                       {\r
-                                               return DbDataType.Decimal;\r
-                                       }\r
-                    else if (subType == 1)\r
-                    {\r
-                        return DbDataType.Numeric;\r
-                    }\r
-                    else\r
-                                       {\r
-                                               return DbDataType.Integer;\r
-                                       }\r
-\r
-                               case IscCodes.SQL_QUAD:\r
-                               case IscCodes.SQL_INT64:\r
-                                       if (this.subType == 2)\r
-                                       {\r
-                                               return DbDataType.Decimal;\r
-                                       }\r
-                    else if (subType == 1)\r
-                    {\r
-                        return DbDataType.Numeric;\r
-                    }\r
-                    else\r
-                                       {\r
-                                               return DbDataType.BigInt;\r
-                                       }\r
-\r
-                               case IscCodes.SQL_FLOAT:\r
-                                       return DbDataType.Float;\r
-\r
-                               case IscCodes.SQL_DOUBLE:\r
-                               case IscCodes.SQL_D_FLOAT:\r
-                                       if (this.subType == 2)\r
-                                       {\r
-                                               return DbDataType.Decimal;\r
-                                       }\r
-                    else if (subType == 1)\r
-                    {\r
-                        return DbDataType.Numeric;\r
-                    }\r
-                    else\r
-                                       {\r
-                                               return DbDataType.Double;\r
-                                       }\r
-\r
-                               case IscCodes.SQL_BLOB:\r
-                                       if (this.subType == 1)\r
-                                       {\r
-                                               return DbDataType.Text;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               return DbDataType.Binary;\r
-                                       }\r
-\r
-                               case IscCodes.SQL_TIMESTAMP:\r
-                                       return DbDataType.TimeStamp;\r
-\r
-                               case IscCodes.SQL_TYPE_TIME:\r
-                                       return DbDataType.Time;\r
-\r
-                               case IscCodes.SQL_TYPE_DATE:\r
-                                       return DbDataType.Date;\r
-\r
-                               case IscCodes.SQL_ARRAY:\r
-                                       return DbDataType.Array;\r
-\r
-                               default:\r
-                                       throw new SystemException("Invalid data type");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Text;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class DbField
+       {
+               #region Fields
+
+               private short           dataType;
+               private short           numericScale;
+               private short           subType;
+               private short           length;
+               private short           nullFlag;
+               private string          name;
+               private string          relation;
+               private string          owner;
+               private string          alias;
+               private int                     charCount;
+               private DbValue         dbValue;
+               private Charset         charset;
+               private ArrayBase       arrayHandle;
+
+               #endregion
+
+               #region Properties
+
+               public DbDataType DbDataType
+               {
+                       get { return this.GetDbDataType(); }
+               }
+
+               public int SqlType
+               {
+                       get { return this.dataType & ~1; }
+               }
+
+               public short DataType
+               {
+                       get { return this.dataType; }
+                       set { this.dataType = value; }
+               }
+
+               public short NumericScale
+               {
+                       get { return this.numericScale; }
+                       set { this.numericScale = value; }
+               }
+
+               public short SubType
+               {
+                       get { return this.subType; }
+                       set
+                       {
+                               this.subType = value;
+                               if (this.IsCharacter())
+                               {
+                                       // Bits 0-7 of sqlsubtype is charset_id (127 is a special value -
+                                       // current attachment charset).
+                                       // Bits 8-17 hold collation_id for this value.
+                                       byte[] cs = BitConverter.GetBytes(value);
+
+                                       int index = Charset.SupportedCharsets.IndexOf(cs[0]);
+                                       if (index != -1)
+                                       {
+                                               this.charset = Charset.SupportedCharsets[index];
+                                       }
+                                       else
+                                       {
+                                               this.charset = Charset.SupportedCharsets[0];
+                                       }
+                               }
+                       }
+               }
+
+               public short Length
+               {
+                       get { return this.length; }
+                       set
+                       {
+                               this.length = value;
+                               if (this.IsCharacter())
+                               {
+                                       this.charCount = this.length / this.charset.BytesPerCharacter;
+                               }
+                       }
+               }
+
+               public short NullFlag
+               {
+                       get { return this.nullFlag; }
+                       set { this.nullFlag = value; }
+               }
+
+               public string Name
+               {
+                       get { return this.name; }
+                       set { this.name = value.Trim(); }
+               }
+
+               public string Relation
+               {
+                       get { return this.relation; }
+                       set { this.relation = value.Trim(); }
+               }
+
+               public string Owner
+               {
+                       get { return this.owner; }
+                       set { this.owner = value.Trim(); }
+               }
+
+               public string Alias
+               {
+                       get { return this.alias; }
+                       set { this.alias = value.Trim(); }
+               }
+
+               public Charset Charset
+               {
+                       get { return this.charset; }
+               }
+
+               public int CharCount
+               {
+                       get { return this.charCount; }
+               }
+
+               public ArrayBase ArrayHandle
+               {
+                       get
+                       {
+                               if (this.IsArray())
+                               {
+                                       return this.arrayHandle;
+                               }
+                               else
+                               {
+                                       throw new IscException("Field is not an array type");
+                               }
+                       }
+
+                       set
+                       {
+                               if (this.IsArray())
+                               {
+                                       this.arrayHandle = value;
+                               }
+                               else
+                               {
+                                       throw new IscException("Field is not an array type");
+                               }
+                       }
+               }
+
+               public DbValue DbValue
+               {
+                       get { return this.dbValue; }
+               }
+
+               public object Value
+               {
+                       get { return this.dbValue.Value; }
+                       set { this.dbValue.Value = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public DbField()
+               {
+                       this.charCount  = -1;
+                       this.name               = String.Empty;
+                       this.relation   = String.Empty;
+                       this.owner              = String.Empty;
+                       this.alias              = String.Empty;
+                       this.dbValue    = new DbValue(this, DBNull.Value);
+               }
+
+               #endregion
+
+               #region Methods
+
+               public bool IsNumeric()
+               {
+                       if (this.dataType == 0)
+                       {
+                               return false;
+                       }
+
+                       switch (this.DbDataType)
+                       {
+                               case DbDataType.SmallInt:
+                               case DbDataType.Integer:
+                               case DbDataType.BigInt:
+                               case DbDataType.Numeric:
+                               case DbDataType.Decimal:
+                               case DbDataType.Float:
+                               case DbDataType.Double:
+                                       return true;
+
+                               default:
+                                       return false;
+                       }
+               }
+
+               public bool IsDecimal()
+               {
+                       if (this.dataType == 0)
+                       {
+                               return false;
+                       }
+
+                       switch (this.DbDataType)
+                       {
+                               case DbDataType.Numeric:
+                               case DbDataType.Decimal:
+                                       return true;
+
+                               default:
+                                       return false;
+                       }
+               }
+
+               public bool IsLong()
+               {
+                       if (this.dataType == 0)
+                       {
+                               return false;
+                       }
+
+                       switch (this.DbDataType)
+                       {
+                               case DbDataType.Binary:
+                               case DbDataType.Text:
+                                       return true;
+
+                               default:
+                                       return false;
+                       }
+               }
+
+               public bool IsCharacter()
+               {
+                       if (this.dataType == 0)
+                       {
+                               return false;
+                       }
+
+                       switch (this.DbDataType)
+                       {
+                               case DbDataType.Char:
+                               case DbDataType.VarChar:
+                               case DbDataType.Text:
+                                       return true;
+
+                               default:
+                                       return false;
+                       }
+               }
+
+               public bool IsArray()
+               {
+                       if (this.dataType == 0)
+                       {
+                               return false;
+                       }
+
+                       switch (this.DbDataType)
+                       {
+                               case DbDataType.Array:
+                                       return true;
+
+                               default:
+                                       return false;
+                       }
+               }
+
+               public bool IsAliased()
+               {
+                       return (this.Name != this.Alias) ? true : false;
+               }
+
+               public bool IsExpression()
+               {
+                       return this.Name.Length == 0 ? true : false;
+               }
+
+               public int GetSize()
+               {
+                       if (this.IsLong())
+                       {
+                               return System.Int32.MaxValue;
+                       }
+                       else
+                       {
+                               if (this.IsCharacter())
+                               {
+                                       return this.CharCount;
+                               }
+                               else
+                               {
+                                       return this.Length;
+                               }
+                       }
+               }
+
+               public bool AllowDBNull()
+               {
+                       return ((this.DataType & 1) == 1);
+               }
+
+               public void SetValue(byte[] buffer)
+               {
+                       if (buffer == null || this.NullFlag == -1)
+                       {
+                               this.Value = System.DBNull.Value;
+                       }
+                       else
+                       {
+                               switch (this.SqlType)
+                               {
+                                       case IscCodes.SQL_TEXT:
+                                       case IscCodes.SQL_VARYING:
+                                               if (this.DbDataType == DbDataType.Guid)
+                                               {
+                                                       this.Value = new Guid(buffer);
+                                               }
+                                               else
+                                               {
+                                                       string s = this.Charset.GetString(buffer, 0, buffer.Length);
+
+                                                       if ((this.Length % this.Charset.BytesPerCharacter) == 0 &&
+                                                               s.Length > this.CharCount)
+                                                       {
+                                                               s = s.Substring(0, this.CharCount);
+                                                       }
+
+                                                       this.Value = s;
+                                               }
+                                               break;
+
+                                       case IscCodes.SQL_SHORT:
+                                               if (this.numericScale < 0)
+                                               {
+                                                       this.Value = TypeDecoder.DecodeDecimal(
+                                                               BitConverter.ToInt16(buffer, 0),
+                                                               this.numericScale,
+                                                               this.dataType);
+                                               }
+                                               else
+                                               {
+                                                       this.Value = BitConverter.ToInt16(buffer, 0);
+                                               }
+                                               break;
+
+                                       case IscCodes.SQL_LONG:
+                                               if (this.NumericScale < 0)
+                                               {
+                                                       this.Value = TypeDecoder.DecodeDecimal(
+                                                               BitConverter.ToInt32(buffer, 0),
+                                                               this.numericScale,
+                                                               this.dataType);
+                                               }
+                                               else
+                                               {
+                                                       this.Value = BitConverter.ToInt32(buffer, 0);
+                                               }
+                                               break;
+
+                                       case IscCodes.SQL_FLOAT:
+                                               this.Value = BitConverter.ToSingle(buffer, 0);
+                                               break;
+
+                                       case IscCodes.SQL_DOUBLE:
+                                       case IscCodes.SQL_D_FLOAT:
+                                               this.Value = BitConverter.ToDouble(buffer, 0);
+                                               break;
+
+                                       case IscCodes.SQL_QUAD:
+                                       case IscCodes.SQL_INT64:
+                                       case IscCodes.SQL_BLOB:
+                                       case IscCodes.SQL_ARRAY:
+                                               if (this.NumericScale < 0)
+                                               {
+                                                       this.Value = TypeDecoder.DecodeDecimal(
+                                                               BitConverter.ToInt64(buffer, 0),
+                                                               this.numericScale,
+                                                               this.dataType);
+                                               }
+                                               else
+                                               {
+                                                       this.Value = BitConverter.ToInt64(buffer, 0);
+                                               }
+                                               break;
+
+                                       case IscCodes.SQL_TIMESTAMP:
+                                               DateTime date = TypeDecoder.DecodeDate(
+                                                       BitConverter.ToInt32(buffer, 0));
+
+                                               DateTime time = TypeDecoder.DecodeTime(
+                                                       BitConverter.ToInt32(buffer, 4));
+
+                                               this.Value = new System.DateTime(
+                                                       date.Year, date.Month, date.Day,
+                                                       time.Hour, time.Minute, time.Second, time.Millisecond);
+                                               break;
+
+                                       case IscCodes.SQL_TYPE_TIME:
+                                               this.Value = TypeDecoder.DecodeTime(BitConverter.ToInt32(buffer, 0));
+                                               break;
+
+                                       case IscCodes.SQL_TYPE_DATE:
+                                               this.Value = TypeDecoder.DecodeDate(BitConverter.ToInt32(buffer, 0));
+                                               break;
+
+                                       default:
+                                               throw new NotSupportedException("Unknown data type");
+                               }
+                       }
+               }
+
+               public void FixNull()
+               {
+                       if (this.NullFlag == -1 && this.dbValue.IsDBNull())
+                       {
+                               switch (this.DbDataType)
+                               {
+                                       case DbDataType.Char:
+                                       case DbDataType.VarChar:
+                                               this.Value = String.Empty;
+                                               break;
+
+                                       case DbDataType.Guid:
+                                               this.Value = Guid.Empty;
+                                               break;
+
+                                       case DbDataType.SmallInt:
+                                               this.Value = (short)0;
+                                               break;
+
+                                       case DbDataType.Integer:
+                                               this.Value = (int)0;
+                                               break;
+
+                                       case DbDataType.BigInt:
+                                       case DbDataType.Binary:
+                                       case DbDataType.Array:
+                                       case DbDataType.Text:
+                                               this.Value = (long)0;
+                                               break;
+
+                                       case DbDataType.Numeric:
+                                       case DbDataType.Decimal:
+                                               this.Value = (decimal)0;
+                                               break;
+
+                                       case DbDataType.Float:
+                                               this.Value = (float)0;
+                                               break;
+
+                                       case DbDataType.Double:
+                                               this.Value = (double)0;
+                                               break;
+
+                                       case DbDataType.Date:
+                                       case DbDataType.Time:
+                                       case DbDataType.TimeStamp:
+                                               this.Value = new System.DateTime(0 * 10000L + 621355968000000000);
+                                               break;
+
+                                       default:
+                                               throw new IscException("Unknown sql data type: " + this.DataType);
+                               }
+                       }
+               }
+
+               public Type GetSystemType()
+               {
+                       switch (this.DbDataType)
+                       {
+                               case DbDataType.Char:
+                               case DbDataType.VarChar:
+                               case DbDataType.Text:
+                                       return Type.GetType("System.String");
+
+                               case DbDataType.SmallInt:
+                                       return Type.GetType("System.Int16");
+
+                               case DbDataType.Integer:
+                                       return Type.GetType("System.Int32");
+
+                               case DbDataType.BigInt:
+                                       return Type.GetType("System.Int64");
+
+                               case DbDataType.Numeric:
+                               case DbDataType.Decimal:
+                                       return Type.GetType("System.Decimal");
+
+                               case DbDataType.Float:
+                                       return Type.GetType("System.Single");
+
+                               case DbDataType.Guid:
+                                       return Type.GetType("System.Guid");
+
+                               case DbDataType.Double:
+                                       return Type.GetType("System.Double");
+
+                               case DbDataType.Date:
+                               case DbDataType.Time:
+                               case DbDataType.TimeStamp:
+                                       return Type.GetType("System.DateTime");
+
+                               case DbDataType.Binary:
+                                       return typeof(byte[]);
+
+                               case DbDataType.Array:
+                                       return Type.GetType("System.Array");
+
+                               default:
+                                       throw new SystemException("Invalid data type");
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private DbDataType GetDbDataType()
+               {
+                       // Special case for Guid handling
+                       if (this.SqlType == IscCodes.SQL_TEXT && this.Length == 16 &&
+                               (this.Charset != null && this.Charset.Name == "OCTETS"))
+                       {
+                               return DbDataType.Guid;
+                       }
+
+                       switch (this.SqlType)
+                       {
+                               case IscCodes.SQL_TEXT:
+                                       return DbDataType.Char;
+
+                               case IscCodes.SQL_VARYING:
+                                       return DbDataType.VarChar;
+
+                               case IscCodes.SQL_SHORT:
+                                       if (this.subType == 2)
+                                       {
+                                               return DbDataType.Decimal;
+                                       }
+                    else if (subType == 1)
+                    {
+                        return DbDataType.Numeric;
+                    }
+                    else
+                                       {
+                                               return DbDataType.SmallInt;
+                                       }
+
+                               case IscCodes.SQL_LONG:
+                                       if (this.subType == 2)
+                                       {
+                                               return DbDataType.Decimal;
+                                       }
+                    else if (subType == 1)
+                    {
+                        return DbDataType.Numeric;
+                    }
+                    else
+                                       {
+                                               return DbDataType.Integer;
+                                       }
+
+                               case IscCodes.SQL_QUAD:
+                               case IscCodes.SQL_INT64:
+                                       if (this.subType == 2)
+                                       {
+                                               return DbDataType.Decimal;
+                                       }
+                    else if (subType == 1)
+                    {
+                        return DbDataType.Numeric;
+                    }
+                    else
+                                       {
+                                               return DbDataType.BigInt;
+                                       }
+
+                               case IscCodes.SQL_FLOAT:
+                                       return DbDataType.Float;
+
+                               case IscCodes.SQL_DOUBLE:
+                               case IscCodes.SQL_D_FLOAT:
+                                       if (this.subType == 2)
+                                       {
+                                               return DbDataType.Decimal;
+                                       }
+                    else if (subType == 1)
+                    {
+                        return DbDataType.Numeric;
+                    }
+                    else
+                                       {
+                                               return DbDataType.Double;
+                                       }
+
+                               case IscCodes.SQL_BLOB:
+                                       if (this.subType == 1)
+                                       {
+                                               return DbDataType.Text;
+                                       }
+                                       else
+                                       {
+                                               return DbDataType.Binary;
+                                       }
+
+                               case IscCodes.SQL_TIMESTAMP:
+                                       return DbDataType.TimeStamp;
+
+                               case IscCodes.SQL_TYPE_TIME:
+                                       return DbDataType.Time;
+
+                               case IscCodes.SQL_TYPE_DATE:
+                                       return DbDataType.Date;
+
+                               case IscCodes.SQL_ARRAY:
+                                       return DbDataType.Array;
+
+                               default:
+                                       throw new SystemException("Invalid data type");
+                       }
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index d284718d307413632cc400a1dca4da165258f938..678911d7c27d779b180fbd2f86d0406b4dad2238 100644 (file)
@@ -1,41 +1,41 @@
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal enum DbStatementType : int\r
-       {\r
-               None            = 0,\r
-               Select          = IscCodes.isc_info_sql_stmt_select,\r
-               Insert          = IscCodes.isc_info_sql_stmt_insert,\r
-               Update          = IscCodes.isc_info_sql_stmt_update,\r
-               Delete          = IscCodes.isc_info_sql_stmt_delete,\r
-               DDL                     = IscCodes.isc_info_sql_stmt_ddl,\r
-               GetSegment      = IscCodes.isc_info_sql_stmt_get_segment,\r
-               PutSegment      = IscCodes.isc_info_sql_stmt_put_segment,\r
-               StoredProcedure = IscCodes.isc_info_sql_stmt_exec_procedure,\r
-               StartTrans      = IscCodes.isc_info_sql_stmt_start_trans,\r
-               Commit          = IscCodes.isc_info_sql_stmt_commit,\r
-               Rollback        = IscCodes.isc_info_sql_stmt_rollback,\r
-               SelectForUpdate = IscCodes.isc_info_sql_stmt_select_for_upd,\r
-               SetGenerator = IscCodes.isc_info_sql_stmt_set_generator,\r
-               SavePoint       = IscCodes.isc_info_sql_stmt_savepoint\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Common
+{
+       internal enum DbStatementType : int
+       {
+               None            = 0,
+               Select          = IscCodes.isc_info_sql_stmt_select,
+               Insert          = IscCodes.isc_info_sql_stmt_insert,
+               Update          = IscCodes.isc_info_sql_stmt_update,
+               Delete          = IscCodes.isc_info_sql_stmt_delete,
+               DDL                     = IscCodes.isc_info_sql_stmt_ddl,
+               GetSegment      = IscCodes.isc_info_sql_stmt_get_segment,
+               PutSegment      = IscCodes.isc_info_sql_stmt_put_segment,
+               StoredProcedure = IscCodes.isc_info_sql_stmt_exec_procedure,
+               StartTrans      = IscCodes.isc_info_sql_stmt_start_trans,
+               Commit          = IscCodes.isc_info_sql_stmt_commit,
+               Rollback        = IscCodes.isc_info_sql_stmt_rollback,
+               SelectForUpdate = IscCodes.isc_info_sql_stmt_select_for_upd,
+               SetGenerator = IscCodes.isc_info_sql_stmt_set_generator,
+               SavePoint       = IscCodes.isc_info_sql_stmt_savepoint
+       }
+}
index 6de9f544f4d8a5847cc7a5faf949bbb41f614a0f..b0c86d364a4bc60b1686ad647846214db23ade60 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class DbValue\r
-       {\r
-               #region Fields\r
-\r
-               private StatementBase   statement;\r
-               private DbField                 field;\r
-               private object                  value;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public DbField Field\r
-               {\r
-                       get { return this.field; }\r
-               }\r
-\r
-               public object Value\r
-               {\r
-                       get { return this.GetValue(); }\r
-                       set { this.value = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructor\r
-\r
-               public DbValue(DbField field, object value)\r
-               {\r
-                       this.field = field;\r
-                       this.value = (value == null) ? System.DBNull.Value : value;\r
-               }\r
-\r
-               public DbValue(StatementBase statement, DbField field)\r
-               {\r
-                       this.statement  = statement;\r
-                       this.field              = field;\r
-                       this.value              = field.Value;\r
-               }\r
-\r
-               public DbValue(StatementBase statement, DbField field, object value)\r
-               {\r
-                       this.statement  = statement;\r
-                       this.field              = field;\r
-                       this.value              = (value == null) ? System.DBNull.Value : value;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public bool IsDBNull()\r
-               {\r
-                       if (this.value == null || this.value == System.DBNull.Value)\r
-                       {\r
-                               return true;\r
-                       }\r
-                       else\r
-                       {\r
-                               return false;\r
-                       }\r
-               }\r
-\r
-               public string GetString()\r
-               {\r
-                       if (this.Field.DbDataType == DbDataType.Text && this.value is long)\r
-                       {\r
-                               this.value = this.GetClobData((long)this.value);\r
-                       }\r
-\r
-                       return this.value.ToString();\r
-               }\r
-\r
-               public char GetChar()\r
-               {\r
-                       return Convert.ToChar(this.value, CultureInfo.CurrentCulture);\r
-               }\r
-\r
-               public bool GetBoolean()\r
-               {\r
-                       return Convert.ToBoolean(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public byte GetByte()\r
-               {\r
-                       return Convert.ToByte(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public short GetInt16()\r
-               {\r
-                       return Convert.ToInt16(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public int GetInt32()\r
-               {\r
-                       return Convert.ToInt32(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public long GetInt64()\r
-               {\r
-                       return Convert.ToInt64(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public decimal GetDecimal()\r
-               {\r
-                       return Convert.ToDecimal(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public float GetFloat()\r
-               {\r
-                       return Convert.ToSingle(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public Guid GetGuid()\r
-               {\r
-                       if (this.Value is Guid)\r
-                       {\r
-                               return (Guid)this.Value;\r
-                       }\r
-                       else if (this.Value is byte[])\r
-                       {\r
-                               return new Guid((byte[])this.value);\r
-                       }\r
-\r
-                       throw new InvalidOperationException("Incorrect Guid value");\r
-               }\r
-\r
-               public double GetDouble()\r
-               {\r
-                       return Convert.ToDouble(this.value, CultureInfo.InvariantCulture);\r
-               }\r
-\r
-               public DateTime GetDateTime()\r
-               {\r
-                       return Convert.ToDateTime(this.value, CultureInfo.CurrentCulture.DateTimeFormat);\r
-               }\r
-\r
-               public Array GetArray()\r
-               {\r
-                       if (this.value is long)\r
-                       {\r
-                               this.value = this.GetArrayData((long)this.value);\r
-                       }\r
-\r
-                       return (Array)this.value;\r
-               }\r
-\r
-               public byte[] GetBinary()\r
-               {\r
-                       if (this.value is long)\r
-                       {\r
-                               this.value = this.GetBlobData((long)this.value);\r
-                       }\r
-                       return (byte[])this.value;\r
-               }\r
-\r
-               public int EncodeDate()\r
-               {\r
-                       return TypeEncoder.EncodeDate(this.GetDateTime());\r
-               }\r
-\r
-               public int EncodeTime()\r
-               {\r
-                       return TypeEncoder.EncodeTime(this.GetDateTime());\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private object GetValue()\r
-               {\r
-                       if (this.IsDBNull())\r
-                       {\r
-                               return System.DBNull.Value;\r
-                       }\r
-\r
-                       switch (this.field.DbDataType)\r
-                       {\r
-                               case DbDataType.Text:\r
-                                       if (this.statement == null)\r
-                                       {\r
-                                               return this.GetInt64();\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               return this.GetString();\r
-                                       }\r
-\r
-                               case DbDataType.Binary:\r
-                                       if (this.statement == null)\r
-                                       {\r
-                                               return this.GetInt64();\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               return this.GetBinary();\r
-                                       }\r
-\r
-                               case DbDataType.Array:\r
-                                       if (this.statement == null)\r
-                                       {\r
-                                               return this.GetInt64();\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               return this.GetArray();\r
-                                       }\r
-\r
-                               default:\r
-                                       return this.value;\r
-                       }\r
-               }\r
-\r
-               private string GetClobData(long blobId)\r
-               {\r
-                       BlobBase clob = this.statement.CreateBlob(blobId);\r
-\r
-                       return clob.ReadString();\r
-               }\r
-\r
-               private byte[] GetBlobData(long blobId)\r
-               {\r
-                       BlobBase blob = this.statement.CreateBlob(blobId);\r
-\r
-                       return blob.Read();\r
-               }\r
-\r
-               private Array GetArrayData(long handle)\r
-               {\r
-                       if (this.field.ArrayHandle == null)\r
-                       {\r
-                               this.field.ArrayHandle = this.statement.CreateArray(handle, this.Field.Relation, this.Field.Name);\r
-                       }\r
-\r
-                       ArrayBase gdsArray = this.statement.CreateArray(this.field.ArrayHandle.Descriptor);\r
-                       \r
-                       gdsArray.Handle                 = handle;\r
-                       gdsArray.DB                             = this.statement.DB;\r
-                       gdsArray.Transaction    = this.statement.Transaction;\r
-\r
-                       return gdsArray.Read();\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class DbValue
+       {
+               #region Fields
+
+               private StatementBase   statement;
+               private DbField                 field;
+               private object                  value;
+
+               #endregion
+
+               #region Properties
+
+               public DbField Field
+               {
+                       get { return this.field; }
+               }
+
+               public object Value
+               {
+                       get { return this.GetValue(); }
+                       set { this.value = value; }
+               }
+
+               #endregion
+
+               #region Constructor
+
+               public DbValue(DbField field, object value)
+               {
+                       this.field = field;
+                       this.value = (value == null) ? System.DBNull.Value : value;
+               }
+
+               public DbValue(StatementBase statement, DbField field)
+               {
+                       this.statement  = statement;
+                       this.field              = field;
+                       this.value              = field.Value;
+               }
+
+               public DbValue(StatementBase statement, DbField field, object value)
+               {
+                       this.statement  = statement;
+                       this.field              = field;
+                       this.value              = (value == null) ? System.DBNull.Value : value;
+               }
+
+               #endregion
+
+               #region Methods
+
+               public bool IsDBNull()
+               {
+                       if (this.value == null || this.value == System.DBNull.Value)
+                       {
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+
+               public string GetString()
+               {
+                       if (this.Field.DbDataType == DbDataType.Text && this.value is long)
+                       {
+                               this.value = this.GetClobData((long)this.value);
+                       }
+
+                       return this.value.ToString();
+               }
+
+               public char GetChar()
+               {
+                       return Convert.ToChar(this.value, CultureInfo.CurrentCulture);
+               }
+
+               public bool GetBoolean()
+               {
+                       return Convert.ToBoolean(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public byte GetByte()
+               {
+                       return Convert.ToByte(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public short GetInt16()
+               {
+                       return Convert.ToInt16(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public int GetInt32()
+               {
+                       return Convert.ToInt32(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public long GetInt64()
+               {
+                       return Convert.ToInt64(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public decimal GetDecimal()
+               {
+                       return Convert.ToDecimal(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public float GetFloat()
+               {
+                       return Convert.ToSingle(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public Guid GetGuid()
+               {
+                       if (this.Value is Guid)
+                       {
+                               return (Guid)this.Value;
+                       }
+                       else if (this.Value is byte[])
+                       {
+                               return new Guid((byte[])this.value);
+                       }
+
+                       throw new InvalidOperationException("Incorrect Guid value");
+               }
+
+               public double GetDouble()
+               {
+                       return Convert.ToDouble(this.value, CultureInfo.InvariantCulture);
+               }
+
+               public DateTime GetDateTime()
+               {
+                       return Convert.ToDateTime(this.value, CultureInfo.CurrentCulture.DateTimeFormat);
+               }
+
+               public Array GetArray()
+               {
+                       if (this.value is long)
+                       {
+                               this.value = this.GetArrayData((long)this.value);
+                       }
+
+                       return (Array)this.value;
+               }
+
+               public byte[] GetBinary()
+               {
+                       if (this.value is long)
+                       {
+                               this.value = this.GetBlobData((long)this.value);
+                       }
+                       return (byte[])this.value;
+               }
+
+               public int EncodeDate()
+               {
+                       return TypeEncoder.EncodeDate(this.GetDateTime());
+               }
+
+               public int EncodeTime()
+               {
+                       return TypeEncoder.EncodeTime(this.GetDateTime());
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private object GetValue()
+               {
+                       if (this.IsDBNull())
+                       {
+                               return System.DBNull.Value;
+                       }
+
+                       switch (this.field.DbDataType)
+                       {
+                               case DbDataType.Text:
+                                       if (this.statement == null)
+                                       {
+                                               return this.GetInt64();
+                                       }
+                                       else
+                                       {
+                                               return this.GetString();
+                                       }
+
+                               case DbDataType.Binary:
+                                       if (this.statement == null)
+                                       {
+                                               return this.GetInt64();
+                                       }
+                                       else
+                                       {
+                                               return this.GetBinary();
+                                       }
+
+                               case DbDataType.Array:
+                                       if (this.statement == null)
+                                       {
+                                               return this.GetInt64();
+                                       }
+                                       else
+                                       {
+                                               return this.GetArray();
+                                       }
+
+                               default:
+                                       return this.value;
+                       }
+               }
+
+               private string GetClobData(long blobId)
+               {
+                       BlobBase clob = this.statement.CreateBlob(blobId);
+
+                       return clob.ReadString();
+               }
+
+               private byte[] GetBlobData(long blobId)
+               {
+                       BlobBase blob = this.statement.CreateBlob(blobId);
+
+                       return blob.Read();
+               }
+
+               private Array GetArrayData(long handle)
+               {
+                       if (this.field.ArrayHandle == null)
+                       {
+                               this.field.ArrayHandle = this.statement.CreateArray(handle, this.Field.Relation, this.Field.Name);
+                       }
+
+                       ArrayBase gdsArray = this.statement.CreateArray(this.field.ArrayHandle.Descriptor);
+                       
+                       gdsArray.Handle                 = handle;
+                       gdsArray.DB                             = this.statement.DB;
+                       gdsArray.Transaction    = this.statement.Transaction;
+
+                       return gdsArray.Read();
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index c5da580256bd844bcc168f431cbbd384bc4a7852..b98aab120aeb1e4a3b47820b27de09d87a282ef7 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       /// <summary>\r
-       /// Descriptor of query input and output parameters.\r
-       /// </summary>\r
-       /// <remarks>\r
-       /// This is similar to the XSQLDA structure described \r
-       /// in the Interbase 6.0 API docs.\r
-       /// </remarks>\r
-       internal sealed class Descriptor : ICloneable\r
-       {\r
-               #region Fields\r
-\r
-               private short version;\r
-               private short count;\r
-               private short actualCount;\r
-               private DbField[] fields;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public short Version\r
-               {\r
-                       get\r
-                       {\r
-                               return this.version;\r
-                       }\r
-                       set\r
-                       {\r
-                               this.version = value;\r
-                       }\r
-               }\r
-\r
-               public short Count\r
-               {\r
-                       get { return this.count; }\r
-               }\r
-\r
-               public short ActualCount\r
-               {\r
-                       get { return this.actualCount; }\r
-                       set { this.actualCount = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Indexers\r
-\r
-               public DbField this[int index]\r
-               {\r
-                       get { return this.fields[index]; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public Descriptor(short n)\r
-               {\r
-                       this.version            = IscCodes.SQLDA_VERSION1;\r
-                       this.count                      = n;\r
-                       this.actualCount        = n;\r
-                       this.fields                     = new DbField[n];\r
-\r
-                       for (int i = 0; i < n; i++)\r
-                       {\r
-                               this.fields[i] = new DbField();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICloneable Methods\r
-\r
-               public object Clone()\r
-               {\r
-                       Descriptor descriptor = new Descriptor(this.Count);\r
-                       descriptor.Version = this.version;\r
-\r
-                       for (int i = 0; i < descriptor.Count; i++)\r
-                       {\r
-                               descriptor[i].DataType  = this.fields[i].DataType;\r
-                               descriptor[i].NumericScale = this.fields[i].NumericScale;\r
-                               descriptor[i].SubType   = this.fields[i].SubType;\r
-                               descriptor[i].Length    = this.fields[i].Length;\r
-                               descriptor[i].Value             = this.fields[i].Value;\r
-                               descriptor[i].NullFlag  = this.fields[i].NullFlag;\r
-                               descriptor[i].Name              = this.fields[i].Name;\r
-                               descriptor[i].Relation  = this.fields[i].Relation;\r
-                               descriptor[i].Owner             = this.fields[i].Owner;\r
-                               descriptor[i].Alias             = this.fields[i].Alias;\r
-                       }\r
-\r
-                       return descriptor;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void ResetValues()\r
-               {\r
-                       for (int i = 0; i < this.fields.Length; i++)\r
-                       {\r
-                               this.fields[i].Value = null;\r
-                       }\r
-               }\r
-\r
-               public byte[] ToBlrArray()\r
-               {\r
-                       MemoryStream blr = new MemoryStream();\r
-                       int par_count = this.Count * 2;\r
-\r
-                       blr.WriteByte(IscCodes.blr_version5);\r
-                       blr.WriteByte(IscCodes.blr_begin);\r
-                       blr.WriteByte(IscCodes.blr_message);\r
-                       blr.WriteByte(0);\r
-                       blr.WriteByte((byte)(par_count & 255));\r
-                       blr.WriteByte((byte)(par_count >> 8));\r
-\r
-                       for (int i = 0; i < this.fields.Length; i++)\r
-                       {\r
-                               int dtype = this.fields[i].SqlType;\r
-                               int len = this.fields[i].Length;\r
-\r
-                               switch (dtype)\r
-                               {\r
-                                       case IscCodes.SQL_VARYING:\r
-                                               blr.WriteByte(IscCodes.blr_varying);\r
-                                               blr.WriteByte((byte)(len & 255));\r
-                                               blr.WriteByte((byte)(len >> 8));\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_TEXT:\r
-                                               blr.WriteByte(IscCodes.blr_text);\r
-                                               blr.WriteByte((byte)(len & 255));\r
-                                               blr.WriteByte((byte)(len >> 8));\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_DOUBLE:\r
-                                               blr.WriteByte(IscCodes.blr_double);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_FLOAT:\r
-                                               blr.WriteByte(IscCodes.blr_float);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_D_FLOAT:\r
-                                               blr.WriteByte(IscCodes.blr_d_float);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_TYPE_DATE:\r
-                                               blr.WriteByte(IscCodes.blr_sql_date);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_TYPE_TIME:\r
-                                               blr.WriteByte(IscCodes.blr_sql_time);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_TIMESTAMP:\r
-                                               blr.WriteByte(IscCodes.blr_timestamp);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_BLOB:\r
-                                               blr.WriteByte(IscCodes.blr_quad);\r
-                                               blr.WriteByte(0);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_ARRAY:\r
-                                               blr.WriteByte(IscCodes.blr_quad);\r
-                                               blr.WriteByte(0);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_LONG:\r
-                                               blr.WriteByte(IscCodes.blr_long);\r
-                                               blr.WriteByte((byte)this.fields[i].NumericScale);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_SHORT:\r
-                                               blr.WriteByte(IscCodes.blr_short);\r
-                                               blr.WriteByte((byte)this.fields[i].NumericScale);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_INT64:\r
-                                               blr.WriteByte(IscCodes.blr_int64);\r
-                                               blr.WriteByte((byte)this.fields[i].NumericScale);\r
-                                               break;\r
-\r
-                                       case IscCodes.SQL_QUAD:\r
-                                               blr.WriteByte(IscCodes.blr_quad);\r
-                                               blr.WriteByte((byte)this.fields[i].NumericScale);\r
-                                               break;\r
-                               }\r
-\r
-                               blr.WriteByte(IscCodes.blr_short);\r
-                               blr.WriteByte(0);\r
-                       }\r
-\r
-                       blr.WriteByte(IscCodes.blr_end);\r
-                       blr.WriteByte(IscCodes.blr_eoc);\r
-\r
-                       return blr.ToArray();\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+
+namespace FirebirdSql.Data.Common
+{
+       /// <summary>
+       /// Descriptor of query input and output parameters.
+       /// </summary>
+       /// <remarks>
+       /// This is similar to the XSQLDA structure described 
+       /// in the Interbase 6.0 API docs.
+       /// </remarks>
+       internal sealed class Descriptor : ICloneable
+       {
+               #region Fields
+
+               private short version;
+               private short count;
+               private short actualCount;
+               private DbField[] fields;
+
+               #endregion
+
+               #region Properties
+
+               public short Version
+               {
+                       get
+                       {
+                               return this.version;
+                       }
+                       set
+                       {
+                               this.version = value;
+                       }
+               }
+
+               public short Count
+               {
+                       get { return this.count; }
+               }
+
+               public short ActualCount
+               {
+                       get { return this.actualCount; }
+                       set { this.actualCount = value; }
+               }
+
+               #endregion
+
+               #region Indexers
+
+               public DbField this[int index]
+               {
+                       get { return this.fields[index]; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public Descriptor(int count)
+               {
+                       this.version            = IscCodes.SQLDA_VERSION1;
+                       this.count                      = (short)count;
+                       this.actualCount        = (short)count;
+                       this.fields                     = new DbField[count];
+
+                       for (int i = 0; i < this.fields.Length; i++)
+                       {
+                               this.fields[i] = new DbField();
+                       }
+               }
+
+               #endregion
+
+               #region ICloneable Methods
+
+               public object Clone()
+               {
+                       Descriptor descriptor = new Descriptor(this.Count);
+                       descriptor.Version = this.version;
+
+                       for (int i = 0; i < descriptor.Count; i++)
+                       {
+                               descriptor[i].DataType  = this.fields[i].DataType;
+                               descriptor[i].NumericScale = this.fields[i].NumericScale;
+                               descriptor[i].SubType   = this.fields[i].SubType;
+                               descriptor[i].Length    = this.fields[i].Length;
+                               descriptor[i].Value             = this.fields[i].Value;
+                               descriptor[i].NullFlag  = this.fields[i].NullFlag;
+                               descriptor[i].Name              = this.fields[i].Name;
+                               descriptor[i].Relation  = this.fields[i].Relation;
+                               descriptor[i].Owner             = this.fields[i].Owner;
+                               descriptor[i].Alias             = this.fields[i].Alias;
+                       }
+
+                       return descriptor;
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void ResetValues()
+               {
+                       for (int i = 0; i < this.fields.Length; i++)
+                       {
+                               this.fields[i].Value = null;
+                       }
+               }
+
+               public byte[] ToBlrArray()
+               {
+                       MemoryStream blr = new MemoryStream();
+                       int par_count = this.Count * 2;
+
+                       blr.WriteByte(IscCodes.blr_version5);
+                       blr.WriteByte(IscCodes.blr_begin);
+                       blr.WriteByte(IscCodes.blr_message);
+                       blr.WriteByte(0);
+                       blr.WriteByte((byte)(par_count & 255));
+                       blr.WriteByte((byte)(par_count >> 8));
+
+                       for (int i = 0; i < this.fields.Length; i++)
+                       {
+                               int dtype = this.fields[i].SqlType;
+                               int len = this.fields[i].Length;
+
+                               switch (dtype)
+                               {
+                                       case IscCodes.SQL_VARYING:
+                                               blr.WriteByte(IscCodes.blr_varying);
+                                               blr.WriteByte((byte)(len & 255));
+                                               blr.WriteByte((byte)(len >> 8));
+                                               break;
+
+                                       case IscCodes.SQL_TEXT:
+                                               blr.WriteByte(IscCodes.blr_text);
+                                               blr.WriteByte((byte)(len & 255));
+                                               blr.WriteByte((byte)(len >> 8));
+                                               break;
+
+                                       case IscCodes.SQL_DOUBLE:
+                                               blr.WriteByte(IscCodes.blr_double);
+                                               break;
+
+                                       case IscCodes.SQL_FLOAT:
+                                               blr.WriteByte(IscCodes.blr_float);
+                                               break;
+
+                                       case IscCodes.SQL_D_FLOAT:
+                                               blr.WriteByte(IscCodes.blr_d_float);
+                                               break;
+
+                                       case IscCodes.SQL_TYPE_DATE:
+                                               blr.WriteByte(IscCodes.blr_sql_date);
+                                               break;
+
+                                       case IscCodes.SQL_TYPE_TIME:
+                                               blr.WriteByte(IscCodes.blr_sql_time);
+                                               break;
+
+                                       case IscCodes.SQL_TIMESTAMP:
+                                               blr.WriteByte(IscCodes.blr_timestamp);
+                                               break;
+
+                                       case IscCodes.SQL_BLOB:
+                                               blr.WriteByte(IscCodes.blr_quad);
+                                               blr.WriteByte(0);
+                                               break;
+
+                                       case IscCodes.SQL_ARRAY:
+                                               blr.WriteByte(IscCodes.blr_quad);
+                                               blr.WriteByte(0);
+                                               break;
+
+                                       case IscCodes.SQL_LONG:
+                                               blr.WriteByte(IscCodes.blr_long);
+                                               blr.WriteByte((byte)this.fields[i].NumericScale);
+                                               break;
+
+                                       case IscCodes.SQL_SHORT:
+                                               blr.WriteByte(IscCodes.blr_short);
+                                               blr.WriteByte((byte)this.fields[i].NumericScale);
+                                               break;
+
+                                       case IscCodes.SQL_INT64:
+                                               blr.WriteByte(IscCodes.blr_int64);
+                                               blr.WriteByte((byte)this.fields[i].NumericScale);
+                                               break;
+
+                                       case IscCodes.SQL_QUAD:
+                                               blr.WriteByte(IscCodes.blr_quad);
+                                               blr.WriteByte((byte)this.fields[i].NumericScale);
+                                               break;
+                               }
+
+                               blr.WriteByte(IscCodes.blr_short);
+                               blr.WriteByte(0);
+                       }
+
+                       blr.WriteByte(IscCodes.blr_end);
+                       blr.WriteByte(IscCodes.blr_eoc);
+
+                       return blr.ToArray();
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 2107299cbec21c30f775b70862e9d9dbb095f45f..0161ce18cb9f1d9d3078946ec694437a01e36619 100644 (file)
@@ -1,51 +1,51 @@
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class EventParameterBuffer : ParameterBuffer\r
-       {\r
-               #region Constructors\r
-\r
-               public EventParameterBuffer() : base(true)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void Append(string content, int actualCount)\r
-               {\r
-                       this.Append(Encoding.Default.GetBytes(content), actualCount);\r
-               }\r
-\r
-               public void Append(byte[] content, int actualCount)\r
-               {\r
-                       this.WriteByte(content.Length);\r
-                       this.Write(content);\r
-                       this.Write(actualCount);\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class EventParameterBuffer : ParameterBuffer
+       {
+               #region Constructors
+
+               public EventParameterBuffer() : base(true)
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void Append(string content, int actualCount)
+               {
+                       this.Append(Encoding.Default.GetBytes(content), actualCount);
+               }
+
+               public void Append(byte[] content, int actualCount)
+               {
+                       this.WriteByte(content.Length);
+                       this.Write(content);
+                       this.Write(actualCount);
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index e2505ffa7577066bf43eea82417efdccb443f0d0..4539eddffdd355cc1fd561ae9e6fa66b8603f5d6 100644 (file)
@@ -1,47 +1,47 @@
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal class GlobalizationHelper\r
-       {\r
-               #region Constructors\r
-\r
-               private GlobalizationHelper()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               public static bool CultureAwareCompare(string strA, string strB)\r
-               {\r
-                       return CultureInfo.CurrentCulture.CompareInfo.Compare(\r
-                               strA,\r
-                               strB,\r
-                               CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth |\r
-                               CompareOptions.IgnoreCase) == 0 ? true : false;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Common
+{
+       internal class GlobalizationHelper
+       {
+               #region Constructors
+
+               private GlobalizationHelper()
+               {
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               public static bool CultureAwareCompare(string strA, string strB)
+               {
+                       return CultureInfo.CurrentCulture.CompareInfo.Compare(
+                               strA,
+                               strB,
+                               CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth |
+                               CompareOptions.IgnoreCase) == 0 ? true : false;
+               }
+
+               #endregion
+       }
+}
index 79e8d49834f9c6c8356bb0cde03c46793941788d..2e63fabeb1003011bcda6b19283cf4d687b6a5d5 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       #region Delegates\r
-\r
-       internal delegate void WarningMessageCallback(IscException warning);\r
-\r
-       #endregion\r
-\r
-       internal interface IDatabase : IDisposable\r
-       {\r
-               #region Callback\r
-\r
-               WarningMessageCallback WarningMessage\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               int Handle\r
-               {\r
-                       get;\r
-               }\r
-\r
-               int TransactionCount\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               string ServerVersion\r
-               {\r
-                       get;\r
-               }\r
-\r
-               Charset Charset\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               short PacketSize\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               short Dialect\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               bool HasRemoteEventSupport\r
-               {\r
-                       get;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database);\r
-               void Detach();\r
-\r
-               void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database);\r
-               void DropDatabase();\r
-\r
-               ITransaction BeginTransaction(TransactionParameterBuffer tpb);\r
-\r
-               StatementBase CreateStatement();\r
-               StatementBase CreateStatement(ITransaction transaction);\r
-\r
-               BlobParameterBuffer CreateBlobParameterBuffer();\r
-               DatabaseParameterBuffer CreateDatabaseParameterBuffer();\r
-               EventParameterBuffer CreateEventParameterBuffer();\r
-               TransactionParameterBuffer CreateTransactionParameterBuffer();\r
-\r
-               ArrayList GetDatabaseInfo(byte[] items);\r
-               ArrayList GetDatabaseInfo(byte[] items, int bufferLength);\r
-\r
-               void CloseEventManager();\r
-               RemoteEvent CreateEvent();\r
-               void QueueEvents(RemoteEvent events);\r
-               void CancelEvents(RemoteEvent events);\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace FirebirdSql.Data.Common
+{
+       #region Delegates
+
+       internal delegate void WarningMessageCallback(IscException warning);
+
+       #endregion
+
+       internal interface IDatabase : IDisposable
+       {
+               #region Callback
+
+               WarningMessageCallback WarningMessage
+               {
+                       get;
+                       set;
+               }
+
+               #endregion
+
+               #region Properties
+
+               int Handle
+               {
+                       get;
+               }
+
+               int TransactionCount
+               {
+                       get;
+                       set;
+               }
+
+               string ServerVersion
+               {
+                       get;
+               }
+
+               Charset Charset
+               {
+                       get;
+                       set;
+               }
+
+               short PacketSize
+               {
+                       get;
+                       set;
+               }
+
+               short Dialect
+               {
+                       get;
+                       set;
+               }
+
+               bool HasRemoteEventSupport
+               {
+                       get;
+               }
+
+               #endregion
+
+               #region Methods
+
+               void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database);
+               void Detach();
+
+               void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database);
+               void DropDatabase();
+
+               ITransaction BeginTransaction(TransactionParameterBuffer tpb);
+
+               StatementBase CreateStatement();
+               StatementBase CreateStatement(ITransaction transaction);
+
+               BlobParameterBuffer CreateBlobParameterBuffer();
+               DatabaseParameterBuffer CreateDatabaseParameterBuffer();
+               EventParameterBuffer CreateEventParameterBuffer();
+               TransactionParameterBuffer CreateTransactionParameterBuffer();
+
+               ArrayList GetDatabaseInfo(byte[] items);
+               ArrayList GetDatabaseInfo(byte[] items, int bufferLength);
+
+               void CloseEventManager();
+               RemoteEvent CreateEvent();
+               void QueueEvents(RemoteEvent events);
+               void CancelEvents(RemoteEvent events);
+
+               #endregion
+       }
+}
index 32b8de935dde38d3023137f46a6a25596177cabb..1ab1529dcc6b4aac59333a6898b6187c8fdc9af7 100644 (file)
@@ -1,54 +1,54 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal interface IServiceManager\r
-       {\r
-               #region Properties\r
-\r
-               int Handle\r
-               {\r
-                       get;\r
-               }\r
-\r
-               bool IsLittleEndian\r
-               {\r
-                       get;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service);\r
-\r
-               void Detach();\r
-\r
-               void Start(ServiceParameterBuffer spb);\r
-\r
-               ServiceParameterBuffer CreateParameterBuffer();\r
-\r
-               void Query(ServiceParameterBuffer spb,\r
-                       int requestLength, byte[] requestBuffer, int bufferLength, byte[] buffer);\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Common
+{
+       internal interface IServiceManager
+       {
+               #region Properties
+
+               int Handle
+               {
+                       get;
+               }
+
+               bool IsLittleEndian
+               {
+                       get;
+               }
+
+               #endregion
+
+               #region Methods
+
+               void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service);
+
+               void Detach();
+
+               void Start(ServiceParameterBuffer spb);
+
+               ServiceParameterBuffer CreateParameterBuffer();
+
+               void Query(ServiceParameterBuffer spb,
+                       int requestLength, byte[] requestBuffer, int bufferLength, byte[] buffer);
+
+               #endregion
+       }
+}
index d67f4c4c31a67b721956b866d72c103e7ab4a745..fede8419583de404a867b6d778893df0db4415cb 100644 (file)
@@ -1,79 +1,79 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       #region Enumerations\r
-\r
-       internal enum TransactionState\r
-       {\r
-               NoTransaction,\r
-               TrasactionStarting,\r
-               TransactionStarted,\r
-               TransactionPreparing,\r
-               TransactionPrepared,\r
-               TransactionCommiting,\r
-               TransactionRollbacking\r
-       }\r
-\r
-       #endregion\r
-\r
-       #region Delegates\r
-\r
-       internal delegate void TransactionUpdateEventHandler(object sender, EventArgs e);\r
-\r
-       #endregion\r
-\r
-       internal interface ITransaction : IDisposable\r
-       {\r
-               #region Events\r
-\r
-               event TransactionUpdateEventHandler Update;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               int Handle\r
-               {\r
-                       get;\r
-               }\r
-\r
-               TransactionState State\r
-               {\r
-                       get;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               void BeginTransaction(TransactionParameterBuffer tpb);\r
-               void Commit();\r
-               void CommitRetaining();\r
-               void Rollback();\r
-               void RollbackRetaining();\r
-               // void Prepare();\r
-               // void Prepare(byte[] buffer);\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+
+namespace FirebirdSql.Data.Common
+{
+       #region Enumerations
+
+       internal enum TransactionState
+       {
+               NoTransaction,
+               TrasactionStarting,
+               TransactionStarted,
+               TransactionPreparing,
+               TransactionPrepared,
+               TransactionCommiting,
+               TransactionRollbacking
+       }
+
+       #endregion
+
+       #region Delegates
+
+       internal delegate void TransactionUpdateEventHandler(object sender, EventArgs e);
+
+       #endregion
+
+       internal interface ITransaction : IDisposable
+       {
+               #region Events
+
+               event TransactionUpdateEventHandler Update;
+
+               #endregion
+
+               #region Properties
+
+               int Handle
+               {
+                       get;
+               }
+
+               TransactionState State
+               {
+                       get;
+               }
+
+               #endregion
+
+               #region Methods
+
+               void BeginTransaction(TransactionParameterBuffer tpb);
+               void Commit();
+               void CommitRetaining();
+               void Rollback();
+               void RollbackRetaining();
+               // void Prepare();
+               // void Prepare(byte[] buffer);
+
+               #endregion
+       }
+}
index 2555ee95701f34f1f6feedf60d88a7b146be3ced..5fa63ef0a4844c87dc0d6ba0e4fff6a740698fd5 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- * \r
- *     This file was originally ported from Jaybird\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class IscCodes\r
-       {\r
-               #region Constructors\r
-\r
-               private IscCodes()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region General\r
-\r
-               public const int SQLDA_VERSION1 = 1;\r
-               public const int SQL_DIALECT_V5 = 1;\r
-               public const int SQL_DIALECT_V6_TRANSITION = 2;\r
-               public const int SQL_DIALECT_V6 = 3;\r
-               public const int SQL_DIALECT_CURRENT = SQL_DIALECT_V6;\r
-\r
-               public const int DSQL_close = 1;\r
-               public const int DSQL_drop = 2;\r
-\r
-               public const int ARRAY_DESC_COLUMN_MAJOR = 1;   /* Set for FORTRAN */\r
-\r
-               public const int ISC_STATUS_LENGTH = 20;\r
-\r
-               #endregion\r
-\r
-               #region Buffer sizes\r
-\r
-               public const int BUFFER_SIZE_128 = 128;\r
-               public const int BUFFER_SIZE_256 = 256;\r
-               public const int MAX_BUFFER_SIZE = 1024;\r
-\r
-               public const int ROWS_AFFECTED_BUFFER_SIZE = 34;\r
-               public const int STATEMENT_TYPE_BUFFER_SIZE = 8;\r
-\r
-               #endregion\r
-\r
-               #region Protocol Codes\r
-\r
-               /* The protocol is defined blocks, rather than messages, to\r
-                * separate     the     protocol from the transport     layer.  \r
-                */\r
-               public const int CONNECT_VERSION2 = 2;\r
-\r
-               /* Protocol     4 is protocol 3 plus server     management functions */\r
-               public const int PROTOCOL_VERSION3 = 3;\r
-               public const int PROTOCOL_VERSION4 = 4;\r
-\r
-               /* Protocol     5 includes support for a d_float data type */\r
-               public const int PROTOCOL_VERSION5 = 5;\r
-\r
-               /* Protocol     6 includes support for cancel remote events, blob seek,\r
-                * and unknown message type     \r
-                */\r
-               public const int PROTOCOL_VERSION6 = 6;\r
-\r
-               /* Protocol     7 includes DSQL support */\r
-               public const int PROTOCOL_VERSION7 = 7;\r
-\r
-               /* Protocol     8 includes collapsing first     receive into a send, drop database,\r
-                * DSQL execute 2, DSQL execute immediate 2, DSQL insert, services,     and\r
-                * transact     request.\r
-                */\r
-               public const int PROTOCOL_VERSION8 = 8;\r
-\r
-               /* Protocol     9 includes support for SPX32\r
-                * SPX32 uses WINSOCK instead of Novell SDK\r
-                * In order     to differentiate between the old implementation\r
-                * of SPX and this one, different PROTOCOL VERSIONS     are     used \r
-                */\r
-               public const int PROTOCOL_VERSION9 = 9;\r
-\r
-               /* Protocol     10 includes     support for     warnings and removes the requirement for\r
-                * encoding     and     decoding status codes.\r
-                */\r
-               public const int PROTOCOL_VERSION10 = 10;\r
-\r
-               #endregion\r
-\r
-               #region Server Class\r
-\r
-               public const int isc_info_db_class_classic_access = 13;\r
-               public const int isc_info_db_class_server_access = 14;\r
-\r
-               #endregion\r
-\r
-               #region Operation Codes\r
-\r
-               // Operation (packet) types\r
-               public const int op_void = 0;   // Packet has been voided\r
-               public const int op_connect = 1;        // Connect to remote server\r
-               public const int op_exit = 2;   // Remote end has exitted\r
-               public const int op_accept = 3; // Server accepts connection\r
-               public const int op_reject = 4; // Server rejects connection\r
-               public const int op_protocol = 5;       // Protocol     selection\r
-               public const int op_disconnect = 6;     // Connect is going     away\r
-               public const int op_credit = 7; // Grant (buffer) credits\r
-               public const int op_continuation = 8;   // Continuation packet\r
-               public const int op_response = 9;       // Generic response     block\r
-\r
-               // Page server operations\r
-\r
-               public const int op_open_file = 10;     // Open file for page service\r
-               public const int op_create_file = 11;   // Create file for page service\r
-               public const int op_close_file = 12;    // Close file for page service\r
-               public const int op_read_page = 13;     // optionally lock and read     page\r
-               public const int op_write_page = 14;    // write page and optionally release lock\r
-               public const int op_lock = 15;  // sieze lock\r
-               public const int op_convert_lock = 16;  // convert existing     lock\r
-               public const int op_release_lock = 17;  // release existing     lock\r
-               public const int op_blocking = 18;      // blocking     lock message\r
-\r
-               // Full context server operations\r
-\r
-               public const int op_attach = 19;        // Attach database\r
-               public const int op_create = 20;        // Create database\r
-               public const int op_detach = 21;        // Detach database\r
-               public const int op_compile = 22;       // Request based operations\r
-               public const int op_start = 23;\r
-               public const int op_start_and_send = 24;\r
-               public const int op_send = 25;\r
-               public const int op_receive = 26;\r
-               public const int op_unwind = 27;\r
-               public const int op_release = 28;\r
-\r
-               public const int op_transaction = 29;   // Transaction operations\r
-               public const int op_commit = 30;\r
-               public const int op_rollback = 31;\r
-               public const int op_prepare = 32;\r
-               public const int op_reconnect = 33;\r
-\r
-               public const int op_create_blob = 34;   // Blob operations //\r
-               public const int op_open_blob = 35;\r
-               public const int op_get_segment = 36;\r
-               public const int op_put_segment = 37;\r
-               public const int op_cancel_blob = 38;\r
-               public const int op_close_blob = 39;\r
-\r
-               public const int op_info_database = 40; // Information services\r
-               public const int op_info_request = 41;\r
-               public const int op_info_transaction = 42;\r
-               public const int op_info_blob = 43;\r
-\r
-               public const int op_batch_segments = 44;        // Put a bunch of blob segments\r
-\r
-               public const int op_mgr_set_affinity = 45;      // Establish server     affinity\r
-               public const int op_mgr_clear_affinity = 46;    // Break server affinity\r
-               public const int op_mgr_report = 47;    // Report on server\r
-\r
-               public const int op_que_events = 48;    // Que event notification request\r
-               public const int op_cancel_events = 49; // Cancel event notification request\r
-               public const int op_commit_retaining = 50;      // Commit retaining     (what else)\r
-               public const int op_prepare2 = 51;      // Message form of prepare\r
-               public const int op_event = 52; // Completed event request (asynchronous)\r
-               public const int op_connect_request = 53;       // Request to establish connection\r
-               public const int op_aux_connect = 54;   // Establish auxiliary connection\r
-               public const int op_ddl = 55;   // DDL call\r
-               public const int op_open_blob2 = 56;\r
-               public const int op_create_blob2 = 57;\r
-               public const int op_get_slice = 58;\r
-               public const int op_put_slice = 59;\r
-               public const int op_slice = 60; // Successful response to public const int op_get_slice\r
-               public const int op_seek_blob = 61;     // Blob seek operation\r
-\r
-               // DSQL operations //\r
-\r
-               public const int op_allocate_statement = 62;    // allocate     a statment handle\r
-               public const int op_execute = 63;       // execute a prepared statement\r
-               public const int op_exec_immediate = 64;        // execute a statement\r
-               public const int op_fetch = 65; // fetch a record\r
-               public const int op_fetch_response = 66;        // response     for     record fetch\r
-               public const int op_free_statement = 67;        // free a statement\r
-               public const int op_prepare_statement = 68;     // prepare a statement\r
-               public const int op_set_cursor = 69;    // set a cursor name\r
-               public const int op_info_sql = 70;\r
-\r
-               public const int op_dummy = 71; // dummy packet to detect loss of client\r
-\r
-               public const int op_response_piggyback = 72;    // response     block for piggybacked messages\r
-               public const int op_start_and_receive = 73;\r
-               public const int op_start_send_and_receive = 74;\r
-\r
-               public const int op_exec_immediate2 = 75;       // execute an immediate statement with msgs\r
-               public const int op_execute2 = 76;      // execute a statement with     msgs\r
-               public const int op_insert = 77;\r
-               public const int op_sql_response = 78;  // response     from execute; exec immed; insert\r
-\r
-               public const int op_transact = 79;\r
-               public const int op_transact_response = 80;\r
-               public const int op_drop_database = 81;\r
-\r
-               public const int op_service_attach = 82;\r
-               public const int op_service_detach = 83;\r
-               public const int op_service_info = 84;\r
-               public const int op_service_start = 85;\r
-\r
-               public const int op_rollback_retaining = 86;\r
-\r
-               #endregion\r
-\r
-               #region Database Parameter Block\r
-\r
-               public const int isc_dpb_version1 = 1;\r
-               public const int isc_dpb_cdd_pathname = 1;\r
-               public const int isc_dpb_allocation = 2;\r
-               public const int isc_dpb_journal = 3;\r
-               public const int isc_dpb_page_size = 4;\r
-               public const int isc_dpb_num_buffers = 5;\r
-               public const int isc_dpb_buffer_length = 6;\r
-               public const int isc_dpb_debug = 7;\r
-               public const int isc_dpb_garbage_collect = 8;\r
-               public const int isc_dpb_verify = 9;\r
-               public const int isc_dpb_sweep = 10;\r
-               public const int isc_dpb_enable_journal = 11;\r
-               public const int isc_dpb_disable_journal = 12;\r
-               public const int isc_dpb_dbkey_scope = 13;\r
-               public const int isc_dpb_number_of_users = 14;\r
-               public const int isc_dpb_trace = 15;\r
-               public const int isc_dpb_no_garbage_collect = 16;\r
-               public const int isc_dpb_damaged = 17;\r
-               public const int isc_dpb_license = 18;\r
-               public const int isc_dpb_sys_user_name = 19;\r
-               public const int isc_dpb_encrypt_key = 20;\r
-               public const int isc_dpb_activate_shadow = 21;\r
-               public const int isc_dpb_sweep_interval = 22;\r
-               public const int isc_dpb_delete_shadow = 23;\r
-               public const int isc_dpb_force_write = 24;\r
-               public const int isc_dpb_begin_log = 25;\r
-               public const int isc_dpb_quit_log = 26;\r
-               public const int isc_dpb_no_reserve = 27;\r
-               public const int isc_dpb_user_name = 28;\r
-               public const int isc_dpb_password = 29;\r
-               public const int isc_dpb_password_enc = 30;\r
-               public const int isc_dpb_sys_user_name_enc = 31;\r
-               public const int isc_dpb_interp = 32;\r
-               public const int isc_dpb_online_dump = 33;\r
-               public const int isc_dpb_old_file_size = 34;\r
-               public const int isc_dpb_old_num_files = 35;\r
-               public const int isc_dpb_old_file = 36;\r
-               public const int isc_dpb_old_start_page = 37;\r
-               public const int isc_dpb_old_start_seqno = 38;\r
-               public const int isc_dpb_old_start_file = 39;\r
-               public const int isc_dpb_drop_walfile = 40;\r
-               public const int isc_dpb_old_dump_id = 41;\r
-               /*\r
-               public const int isc_dpb_wal_backup_dir                  = 42;\r
-               public const int isc_dpb_wal_chkptlen                    = 43;\r
-               public const int isc_dpb_wal_numbufs                     = 44;\r
-               public const int isc_dpb_wal_bufsize                     = 45;\r
-               public const int isc_dpb_wal_grp_cmt_wait                = 46;\r
-               */\r
-               public const int isc_dpb_lc_messages = 47;\r
-               public const int isc_dpb_lc_ctype = 48;\r
-               public const int isc_dpb_cache_manager = 49;\r
-               public const int isc_dpb_shutdown = 50;\r
-               public const int isc_dpb_online = 51;\r
-               public const int isc_dpb_shutdown_delay = 52;\r
-               public const int isc_dpb_reserved = 53;\r
-               public const int isc_dpb_overwrite = 54;\r
-               public const int isc_dpb_sec_attach = 55;\r
-               /*\r
-               public const int isc_dpb_disable_wal                     = 56;\r
-               */\r
-               public const int isc_dpb_connect_timeout = 57;\r
-               public const int isc_dpb_dummy_packet_interval = 58;\r
-               public const int isc_dpb_gbak_attach = 59;\r
-               public const int isc_dpb_sql_role_name = 60;\r
-               public const int isc_dpb_set_page_buffers = 61;\r
-               public const int isc_dpb_working_directory = 62;\r
-               public const int isc_dpb_sql_dialect = 63;\r
-               public const int isc_dpb_set_db_readonly = 64;\r
-               public const int isc_dpb_set_db_sql_dialect = 65;\r
-               public const int isc_dpb_gfix_attach = 66;\r
-               public const int isc_dpb_gstat_attach = 67;\r
-               public const int isc_dpb_set_db_charset = 68;\r
-\r
-               #endregion\r
-\r
-               #region Transaction     Parameter Block\r
-\r
-               public const int isc_tpb_version1 = 1;\r
-               public const int isc_tpb_version3 = 3;\r
-               public const int isc_tpb_consistency = 1;\r
-               public const int isc_tpb_concurrency = 2;\r
-               public const int isc_tpb_shared = 3;\r
-               public const int isc_tpb_protected = 4;\r
-               public const int isc_tpb_exclusive = 5;\r
-               public const int isc_tpb_wait = 6;\r
-               public const int isc_tpb_nowait = 7;\r
-               public const int isc_tpb_read = 8;\r
-               public const int isc_tpb_write = 9;\r
-               public const int isc_tpb_lock_read = 10;\r
-               public const int isc_tpb_lock_write = 11;\r
-               public const int isc_tpb_verb_time = 12;\r
-               public const int isc_tpb_commit_time = 13;\r
-               public const int isc_tpb_ignore_limbo = 14;\r
-               public const int isc_tpb_read_committed = 15;\r
-               public const int isc_tpb_autocommit = 16;\r
-               public const int isc_tpb_rec_version = 17;\r
-               public const int isc_tpb_no_rec_version = 18;\r
-               public const int isc_tpb_restart_requests = 19;\r
-               public const int isc_tpb_no_auto_undo = 20;\r
-\r
-               #endregion\r
-\r
-               #region Services Parameter Block\r
-\r
-               public const int isc_spb_version1 = 1;\r
-               public const int isc_spb_current_version = 2;\r
-               public const int isc_spb_version = isc_spb_current_version;\r
-               public const int isc_spb_user_name = isc_dpb_user_name;\r
-               public const int isc_spb_sys_user_name = isc_dpb_sys_user_name;\r
-               public const int isc_spb_sys_user_name_enc = isc_dpb_sys_user_name_enc;\r
-               public const int isc_spb_password = isc_dpb_password;\r
-               public const int isc_spb_password_enc = isc_dpb_password_enc;\r
-               public const int isc_spb_command_line = 105;\r
-               public const int isc_spb_dbname = 106;\r
-               public const int isc_spb_verbose = 107;\r
-               public const int isc_spb_options = 108;\r
-\r
-               public const int isc_spb_connect_timeout = isc_dpb_connect_timeout;\r
-               public const int isc_spb_dummy_packet_interval = isc_dpb_dummy_packet_interval;\r
-               public const int isc_spb_sql_role_name = isc_dpb_sql_role_name;\r
-\r
-               public const int isc_spb_num_att = 5;\r
-               public const int isc_spb_num_db = 6;\r
-\r
-               #endregion\r
-\r
-               #region Services Actions\r
-\r
-               public const int isc_action_svc_backup = 1;     /* Starts database backup process on the server */\r
-               public const int isc_action_svc_restore = 2;    /* Starts database restore process on the server */\r
-               public const int isc_action_svc_repair = 3;     /* Starts database repair process on the server */\r
-               public const int isc_action_svc_add_user = 4;   /* Adds a new user to the security database     */\r
-               public const int isc_action_svc_delete_user = 5;        /* Deletes a user record from the security database     */\r
-               public const int isc_action_svc_modify_user = 6;        /* Modifies     a user record in the security database */\r
-               public const int isc_action_svc_display_user = 7;       /* Displays     a user record from the security database */\r
-               public const int isc_action_svc_properties = 8; /* Sets database properties     */\r
-               public const int isc_action_svc_add_license = 9;        /* Adds a license to the license file */\r
-               public const int isc_action_svc_remove_license = 10;    /* Removes a license from the license file */\r
-               public const int isc_action_svc_db_stats = 11;  /* Retrieves database statistics */\r
-               public const int isc_action_svc_get_ib_log = 12;        /* Retrieves the InterBase log file     from the server */\r
-\r
-               #endregion\r
-\r
-               #region Services Information\r
-\r
-               public const int isc_info_svc_svr_db_info = 50; /* Retrieves the number of attachments and databases */\r
-               public const int isc_info_svc_get_license = 51; /* Retrieves all license keys and IDs from the license file     */\r
-               public const int isc_info_svc_get_license_mask = 52;    /* Retrieves a bitmask representing     licensed options on     the     server */\r
-               public const int isc_info_svc_get_config = 53;  /* Retrieves the parameters     and     values for IB_CONFIG */\r
-               public const int isc_info_svc_version = 54;     /* Retrieves the version of     the     services manager */\r
-               public const int isc_info_svc_server_version = 55;      /* Retrieves the version of     the     InterBase server */\r
-               public const int isc_info_svc_implementation = 56;      /* Retrieves the implementation of the InterBase server */\r
-               public const int isc_info_svc_capabilities = 57;        /* Retrieves a bitmask representing     the     server's capabilities */\r
-               public const int isc_info_svc_user_dbpath = 58; /* Retrieves the path to the security database in use by the server     */\r
-               public const int isc_info_svc_get_env = 59;     /* Retrieves the setting of     $INTERBASE */\r
-               public const int isc_info_svc_get_env_lock = 60;        /* Retrieves the setting of     $INTERBASE_LCK */\r
-               public const int isc_info_svc_get_env_msg = 61; /* Retrieves the setting of     $INTERBASE_MSG */\r
-               public const int isc_info_svc_line = 62;        /* Retrieves 1 line     of service output per call */\r
-               public const int isc_info_svc_to_eof = 63;      /* Retrieves as much of the     server output as will fit in the supplied buffer */\r
-               public const int isc_info_svc_timeout = 64;     /* Sets / signifies     a timeout value for     reading service information     */\r
-               public const int isc_info_svc_get_licensed_users = 65;  /* Retrieves the number of users licensed for accessing the     server */\r
-               public const int isc_info_svc_limbo_trans = 66; /* Retrieve     the     limbo transactions */\r
-               public const int isc_info_svc_running = 67;     /* Checks to see if     a service is running on an attachment */\r
-               public const int isc_info_svc_get_users = 68;   /* Returns the user     information     from isc_action_svc_display_users */\r
-\r
-               #endregion\r
-\r
-               #region Services Properties\r
-\r
-               public const int isc_spb_prp_page_buffers = 5;\r
-               public const int isc_spb_prp_sweep_interval = 6;\r
-               public const int isc_spb_prp_shutdown_db = 7;\r
-               public const int isc_spb_prp_deny_new_attachments = 9;\r
-               public const int isc_spb_prp_deny_new_transactions = 10;\r
-               public const int isc_spb_prp_reserve_space = 11;\r
-               public const int isc_spb_prp_write_mode = 12;\r
-               public const int isc_spb_prp_access_mode = 13;\r
-               public const int isc_spb_prp_set_sql_dialect = 14;\r
-\r
-               // WRITE_MODE_PARAMETERS\r
-               public const int isc_spb_prp_wm_async = 37;\r
-               public const int isc_spb_prp_wm_sync = 38;\r
-\r
-               // ACCESS_MODE_PARAMETERS\r
-               public const int isc_spb_prp_am_readonly = 39;\r
-               public const int isc_spb_prp_am_readwrite = 40;\r
-\r
-               // RESERVE_SPACE_PARAMETERS\r
-               public const int isc_spb_prp_res_use_full = 35;\r
-               public const int isc_spb_prp_res = 36;\r
-\r
-               // Option Flags         \r
-               public const int isc_spb_prp_activate = 0x0100;\r
-               public const int isc_spb_prp_db_online = 0x0200;\r
-\r
-               #endregion\r
-\r
-               #region Backup Service\r
-\r
-               public const int isc_spb_bkp_file = 5;\r
-               public const int isc_spb_bkp_factor = 6;\r
-               public const int isc_spb_bkp_length = 7;\r
-\r
-               #endregion\r
-\r
-               #region Restore Service\r
-\r
-               public const int isc_spb_res_buffers = 9;\r
-               public const int isc_spb_res_page_size = 10;\r
-               public const int isc_spb_res_length = 11;\r
-               public const int isc_spb_res_access_mode = 12;\r
-\r
-               public const int isc_spb_res_am_readonly = isc_spb_prp_am_readonly;\r
-               public const int isc_spb_res_am_readwrite = isc_spb_prp_am_readwrite;\r
-\r
-               #endregion\r
-\r
-               #region Repair Service\r
-\r
-               public const int isc_spb_rpr_commit_trans = 15;\r
-               public const int isc_spb_rpr_rollback_trans = 34;\r
-               public const int isc_spb_rpr_recover_two_phase = 17;\r
-               public const int isc_spb_tra_id = 18;\r
-               public const int isc_spb_single_tra_id = 19;\r
-               public const int isc_spb_multi_tra_id = 20;\r
-               public const int isc_spb_tra_state = 21;\r
-               public const int isc_spb_tra_state_limbo = 22;\r
-               public const int isc_spb_tra_state_commit = 23;\r
-               public const int isc_spb_tra_state_rollback = 24;\r
-               public const int isc_spb_tra_state_unknown = 25;\r
-               public const int isc_spb_tra_host_site = 26;\r
-               public const int isc_spb_tra_remote_site = 27;\r
-               public const int isc_spb_tra_db_path = 28;\r
-               public const int isc_spb_tra_advise = 29;\r
-               public const int isc_spb_tra_advise_commit = 30;\r
-               public const int isc_spb_tra_advise_rollback = 31;\r
-               public const int isc_spb_tra_advise_unknown = 33;\r
-\r
-               #endregion\r
-\r
-               #region Security Service\r
-\r
-               public const int isc_spb_sec_userid = 5;\r
-               public const int isc_spb_sec_groupid = 6;\r
-               public const int isc_spb_sec_username = 7;\r
-               public const int isc_spb_sec_password = 8;\r
-               public const int isc_spb_sec_groupname = 9;\r
-               public const int isc_spb_sec_firstname = 10;\r
-               public const int isc_spb_sec_middlename = 11;\r
-               public const int isc_spb_sec_lastname = 12;\r
-\r
-               #endregion\r
-\r
-               #region Configuration Keys\r
-\r
-               public const int ISCCFG_LOCKMEM_KEY = 0;\r
-               public const int ISCCFG_LOCKSEM_KEY = 1;\r
-               public const int ISCCFG_LOCKSIG_KEY = 2;\r
-               public const int ISCCFG_EVNTMEM_KEY = 3;\r
-               public const int ISCCFG_DBCACHE_KEY = 4;\r
-               public const int ISCCFG_PRIORITY_KEY = 5;\r
-               public const int ISCCFG_IPCMAP_KEY = 6;\r
-               public const int ISCCFG_MEMMIN_KEY = 7;\r
-               public const int ISCCFG_MEMMAX_KEY = 8;\r
-               public const int ISCCFG_LOCKORDER_KEY = 9;\r
-               public const int ISCCFG_ANYLOCKMEM_KEY = 10;\r
-               public const int ISCCFG_ANYLOCKSEM_KEY = 11;\r
-               public const int ISCCFG_ANYLOCKSIG_KEY = 12;\r
-               public const int ISCCFG_ANYEVNTMEM_KEY = 13;\r
-               public const int ISCCFG_LOCKHASH_KEY = 14;\r
-               public const int ISCCFG_DEADLOCK_KEY = 15;\r
-               public const int ISCCFG_LOCKSPIN_KEY = 16;\r
-               public const int ISCCFG_CONN_TIMEOUT_KEY = 17;\r
-               public const int ISCCFG_DUMMY_INTRVL_KEY = 18;\r
-               public const int ISCCFG_TRACE_POOLS_KEY = 19; /* Internal Use only      */\r
-               public const int ISCCFG_REMOTE_BUFFER_KEY = 20;\r
-\r
-               #endregion\r
-\r
-               #region Common Structural Codes\r
-\r
-               public const int isc_info_end = 1;\r
-               public const int isc_info_truncated = 2;\r
-               public const int isc_info_error = 3;\r
-               public const int isc_info_data_not_ready = 4;\r
-               public const int isc_info_flag_end = 127;\r
-\r
-               #endregion\r
-\r
-               #region SQL     Information\r
-\r
-               public const int isc_info_sql_select = 4;\r
-               public const int isc_info_sql_bind = 5;\r
-               public const int isc_info_sql_num_variables = 6;\r
-               public const int isc_info_sql_describe_vars = 7;\r
-               public const int isc_info_sql_describe_end = 8;\r
-               public const int isc_info_sql_sqlda_seq = 9;\r
-               public const int isc_info_sql_message_seq = 10;\r
-               public const int isc_info_sql_type = 11;\r
-               public const int isc_info_sql_sub_type = 12;\r
-               public const int isc_info_sql_scale = 13;\r
-               public const int isc_info_sql_length = 14;\r
-               public const int isc_info_sql_null_ind = 15;\r
-               public const int isc_info_sql_field = 16;\r
-               public const int isc_info_sql_relation = 17;\r
-               public const int isc_info_sql_owner = 18;\r
-               public const int isc_info_sql_alias = 19;\r
-               public const int isc_info_sql_sqlda_start = 20;\r
-               public const int isc_info_sql_stmt_type = 21;\r
-               public const int isc_info_sql_get_plan = 22;\r
-               public const int isc_info_sql_records = 23;\r
-               public const int isc_info_sql_batch_fetch = 24;\r
-\r
-               #endregion\r
-\r
-               #region Database Information\r
-\r
-               public const int isc_info_db_id = 4;\r
-               public const int isc_info_reads = 5;\r
-               public const int isc_info_writes = 6;\r
-               public const int isc_info_fetches = 7;\r
-               public const int isc_info_marks = 8;\r
-\r
-               public const int isc_info_implementation = 11;\r
-               public const int isc_info_isc_version = 12;\r
-               public const int isc_info_base_level = 13;\r
-               public const int isc_info_page_size = 14;\r
-               public const int isc_info_num_buffers = 15;\r
-               public const int isc_info_limbo = 16;\r
-               public const int isc_info_current_memory = 17;\r
-               public const int isc_info_max_memory = 18;\r
-               public const int isc_info_window_turns = 19;\r
-               public const int isc_info_license = 20;\r
-\r
-               public const int isc_info_allocation = 21;\r
-               public const int isc_info_attachment_id = 22;\r
-               public const int isc_info_read_seq_count = 23;\r
-               public const int isc_info_read_idx_count = 24;\r
-               public const int isc_info_insert_count = 25;\r
-               public const int isc_info_update_count = 26;\r
-               public const int isc_info_delete_count = 27;\r
-               public const int isc_info_backout_count = 28;\r
-               public const int isc_info_purge_count = 29;\r
-               public const int isc_info_expunge_count = 30;\r
-\r
-               public const int isc_info_sweep_interval = 31;\r
-               public const int isc_info_ods_version = 32;\r
-               public const int isc_info_ods_minor_version = 33;\r
-               public const int isc_info_no_reserve = 34;\r
-               public const int isc_info_logfile = 35;\r
-               public const int isc_info_cur_logfile_name = 36;\r
-               public const int isc_info_cur_log_part_offset = 37;\r
-               public const int isc_info_num_wal_buffers = 38;\r
-               public const int isc_info_wal_buffer_size = 39;\r
-               public const int isc_info_wal_ckpt_length = 40;\r
-\r
-               public const int isc_info_wal_cur_ckpt_interval = 41;\r
-               public const int isc_info_wal_prv_ckpt_fname = 42;\r
-               public const int isc_info_wal_prv_ckpt_poffset = 43;\r
-               public const int isc_info_wal_recv_ckpt_fname = 44;\r
-               public const int isc_info_wal_recv_ckpt_poffset = 45;\r
-               public const int isc_info_wal_grpc_wait_usecs = 47;\r
-               public const int isc_info_wal_num_io = 48;\r
-               public const int isc_info_wal_avg_io_size = 49;\r
-               public const int isc_info_wal_num_commits = 50;\r
-\r
-               public const int isc_info_wal_avg_grpc_size = 51;\r
-               public const int isc_info_forced_writes = 52;\r
-               public const int isc_info_user_names = 53;\r
-               public const int isc_info_page_errors = 54;\r
-               public const int isc_info_record_errors = 55;\r
-               public const int isc_info_bpage_errors = 56;\r
-               public const int isc_info_dpage_errors = 57;\r
-               public const int isc_info_ipage_errors = 58;\r
-               public const int isc_info_ppage_errors = 59;\r
-               public const int isc_info_tpage_errors = 60;\r
-\r
-               public const int isc_info_set_page_buffers = 61;\r
-               public const int isc_info_db_sql_dialect = 62;\r
-               public const int isc_info_db_read_only = 63;\r
-               public const int isc_info_db_size_in_pages = 64;\r
-\r
-               /* Values 65 -100 unused to     avoid conflict with     InterBase */\r
-\r
-               public const int frb_info_att_charset = 101;\r
-               public const int isc_info_db_class = 102;\r
-               public const int isc_info_firebird_version = 103;\r
-               public const int isc_info_oldest_transaction = 104;\r
-               public const int isc_info_oldest_active = 105;\r
-               public const int isc_info_oldest_snapshot = 106;\r
-               public const int isc_info_next_transaction = 107;\r
-               public const int isc_info_db_provider = 108;\r
-               public const int isc_info_active_transactions = 109;\r
-\r
-               #endregion\r
-\r
-               #region SQL     Information     Return Values\r
-\r
-               public const int isc_info_sql_stmt_select = 1;\r
-               public const int isc_info_sql_stmt_insert = 2;\r
-               public const int isc_info_sql_stmt_update = 3;\r
-               public const int isc_info_sql_stmt_delete = 4;\r
-               public const int isc_info_sql_stmt_ddl = 5;\r
-               public const int isc_info_sql_stmt_get_segment = 6;\r
-               public const int isc_info_sql_stmt_put_segment = 7;\r
-               public const int isc_info_sql_stmt_exec_procedure = 8;\r
-               public const int isc_info_sql_stmt_start_trans = 9;\r
-               public const int isc_info_sql_stmt_commit = 10;\r
-               public const int isc_info_sql_stmt_rollback = 11;\r
-               public const int isc_info_sql_stmt_select_for_upd = 12;\r
-               public const int isc_info_sql_stmt_set_generator = 13;\r
-               public const int isc_info_sql_stmt_savepoint = 14;\r
-\r
-               #endregion\r
-\r
-               #region Information     Request\r
-\r
-               public const int isc_info_number_messages = 4;\r
-               public const int isc_info_max_message = 5;\r
-               public const int isc_info_max_send = 6;\r
-               public const int isc_info_max_receive = 7;\r
-               public const int isc_info_state = 8;\r
-               public const int isc_info_message_number = 9;\r
-               public const int isc_info_message_size = 10;\r
-               public const int isc_info_request_cost = 11;\r
-               public const int isc_info_access_path = 12;\r
-               public const int isc_info_req_select_count = 13;\r
-               public const int isc_info_req_insert_count = 14;\r
-               public const int isc_info_req_update_count = 15;\r
-               public const int isc_info_req_delete_count = 16;\r
-\r
-               #endregion\r
-\r
-               #region Array Slice     Description     Language\r
-\r
-               public const int isc_sdl_version1 = 1;\r
-               public const int isc_sdl_eoc = 255;\r
-               public const int isc_sdl_relation = 2;\r
-               public const int isc_sdl_rid = 3;\r
-               public const int isc_sdl_field = 4;\r
-               public const int isc_sdl_fid = 5;\r
-               public const int isc_sdl_struct = 6;\r
-               public const int isc_sdl_variable = 7;\r
-               public const int isc_sdl_scalar = 8;\r
-               public const int isc_sdl_tiny_integer = 9;\r
-               public const int isc_sdl_short_integer = 10;\r
-               public const int isc_sdl_long_integer = 11;\r
-               public const int isc_sdl_literal = 12;\r
-               public const int isc_sdl_add = 13;\r
-               public const int isc_sdl_subtract = 14;\r
-               public const int isc_sdl_multiply = 15;\r
-               public const int isc_sdl_divide = 16;\r
-               public const int isc_sdl_negate = 17;\r
-               public const int isc_sdl_eql = 18;\r
-               public const int isc_sdl_neq = 19;\r
-               public const int isc_sdl_gtr = 20;\r
-               public const int isc_sdl_geq = 21;\r
-               public const int isc_sdl_lss = 22;\r
-               public const int isc_sdl_leq = 23;\r
-               public const int isc_sdl_and = 24;\r
-               public const int isc_sdl_or = 25;\r
-               public const int isc_sdl_not = 26;\r
-               public const int isc_sdl_while = 27;\r
-               public const int isc_sdl_assignment = 28;\r
-               public const int isc_sdl_label = 29;\r
-               public const int isc_sdl_leave = 30;\r
-               public const int isc_sdl_begin = 31;\r
-               public const int isc_sdl_end = 32;\r
-               public const int isc_sdl_do3 = 33;\r
-               public const int isc_sdl_do2 = 34;\r
-               public const int isc_sdl_do1 = 35;\r
-               public const int isc_sdl_element = 36;\r
-\r
-               #endregion\r
-\r
-               #region Blob Parametr Block\r
-\r
-               public const int isc_bpb_version1 = 1;\r
-               public const int isc_bpb_source_type = 1;\r
-               public const int isc_bpb_target_type = 2;\r
-               public const int isc_bpb_type = 3;\r
-               public const int isc_bpb_source_interp = 4;\r
-               public const int isc_bpb_target_interp = 5;\r
-               public const int isc_bpb_filter_parameter = 6;\r
-\r
-               public const int isc_bpb_type_segmented = 0;\r
-               public const int isc_bpb_type_stream = 1;\r
-\r
-               public const int RBL_eof = 1;\r
-               public const int RBL_segment = 2;\r
-               public const int RBL_eof_pending = 4;\r
-               public const int RBL_create = 8;\r
-\r
-               #endregion\r
-\r
-               #region Blob Information\r
-\r
-               public const int isc_info_blob_num_segments = 4;\r
-               public const int isc_info_blob_max_segment = 5;\r
-               public const int isc_info_blob_total_length = 6;\r
-               public const int isc_info_blob_type = 7;\r
-\r
-               #endregion\r
-\r
-               #region Event Codes\r
-\r
-               public const int P_REQ_async = 1;       // Auxiliary asynchronous port\r
-               public const int EPB_version1 = 1;\r
-\r
-               #endregion\r
-\r
-               #region Facilities\r
-\r
-               public const int JRD = 0;\r
-               public const int GFIX = 3;\r
-               public const int DSQL = 7;\r
-               public const int DYN = 8;\r
-               public const int GBAK = 12;\r
-               public const int GDEC = 18;\r
-               public const int LICENSE = 19;\r
-               public const int GSTAT = 21;\r
-\r
-               #endregion\r
-\r
-               #region Error code generation\r
-\r
-               public const int ISC_MASK = 0x14000000; // Defines the code     as a valid ISC code\r
-\r
-               #endregion\r
-\r
-               #region ISC     Error codes\r
-\r
-               public const int isc_facility = 20;\r
-               public const int isc_err_base = 335544320;\r
-               public const int isc_err_factor = 1;\r
-               public const int isc_arg_end = 0;       // end of argument list\r
-               public const int isc_arg_gds = 1;       // generic DSRI status value\r
-               public const int isc_arg_string = 2;    // string argument\r
-               public const int isc_arg_cstring = 3;   // count & string argument\r
-               public const int isc_arg_number = 4;    // numeric argument     (long)\r
-               public const int isc_arg_interpreted = 5;       // interpreted status code (string)\r
-               public const int isc_arg_vms = 6;       // VAX/VMS status code (long)\r
-               public const int isc_arg_unix = 7;      // UNIX error code\r
-               public const int isc_arg_domain = 8;    // Apollo/Domain error code\r
-               public const int isc_arg_dos = 9;       // MSDOS/OS2 error code\r
-               public const int isc_arg_mpexl = 10;    // HP MPE/XL error code\r
-               public const int isc_arg_mpexl_ipc = 11;        // HP MPE/XL IPC error code\r
-               public const int isc_arg_next_mach = 15;        // NeXT/Mach error code\r
-               public const int isc_arg_netware = 16;  // NetWare error code\r
-               public const int isc_arg_win32 = 17;    // Win32 error code\r
-               public const int isc_arg_warning = 18;  // warning argument\r
-\r
-               public const int isc_arith_except = 335544321;\r
-               public const int isc_bad_dbkey = 335544322;\r
-               public const int isc_bad_db_format = 335544323;\r
-               public const int isc_bad_db_handle = 335544324;\r
-               public const int isc_bad_dpb_content = 335544325;\r
-               public const int isc_bad_dpb_form = 335544326;\r
-               public const int isc_bad_req_handle = 335544327;\r
-               public const int isc_bad_segstr_handle = 335544328;\r
-               public const int isc_bad_segstr_id = 335544329;\r
-               public const int isc_bad_tpb_content = 335544330;\r
-               public const int isc_bad_tpb_form = 335544331;\r
-               public const int isc_bad_trans_handle = 335544332;\r
-               public const int isc_bug_check = 335544333;\r
-               public const int isc_convert_error = 335544334;\r
-               public const int isc_db_corrupt = 335544335;\r
-               public const int isc_deadlock = 335544336;\r
-               public const int isc_excess_trans = 335544337;\r
-               public const int isc_from_no_match = 335544338;\r
-               public const int isc_infinap = 335544339;\r
-               public const int isc_infona = 335544340;\r
-               public const int isc_infunk = 335544341;\r
-               public const int isc_integ_fail = 335544342;\r
-               public const int isc_invalid_blr = 335544343;\r
-               public const int isc_io_error = 335544344;\r
-               public const int isc_lock_conflict = 335544345;\r
-               public const int isc_metadata_corrupt = 335544346;\r
-               public const int isc_not_valid = 335544347;\r
-               public const int isc_no_cur_rec = 335544348;\r
-               public const int isc_no_dup = 335544349;\r
-               public const int isc_no_finish = 335544350;\r
-               public const int isc_no_meta_update = 335544351;\r
-               public const int isc_no_priv = 335544352;\r
-               public const int isc_no_recon = 335544353;\r
-               public const int isc_no_record = 335544354;\r
-               public const int isc_no_segstr_close = 335544355;\r
-               public const int isc_obsolete_metadata = 335544356;\r
-               public const int isc_open_trans = 335544357;\r
-               public const int isc_port_len = 335544358;\r
-               public const int isc_read_only_field = 335544359;\r
-               public const int isc_read_only_rel = 335544360;\r
-               public const int isc_read_only_trans = 335544361;\r
-               public const int isc_read_only_view = 335544362;\r
-               public const int isc_req_no_trans = 335544363;\r
-               public const int isc_req_sync = 335544364;\r
-               public const int isc_req_wrong_db = 335544365;\r
-               public const int isc_segment = 335544366;\r
-               public const int isc_segstr_eof = 335544367;\r
-               public const int isc_segstr_no_op = 335544368;\r
-               public const int isc_segstr_no_read = 335544369;\r
-               public const int isc_segstr_no_trans = 335544370;\r
-               public const int isc_segstr_no_write = 335544371;\r
-               public const int isc_segstr_wrong_db = 335544372;\r
-               public const int isc_sys_request = 335544373;\r
-               public const int isc_stream_eof = 335544374;\r
-               public const int isc_unavailable = 335544375;\r
-               public const int isc_unres_rel = 335544376;\r
-               public const int isc_uns_ext = 335544377;\r
-               public const int isc_wish_list = 335544378;\r
-               public const int isc_wrong_ods = 335544379;\r
-               public const int isc_wronumarg = 335544380;\r
-               public const int isc_imp_exc = 335544381;\r
-               public const int isc_random = 335544382;\r
-               public const int isc_fatal_conflict = 335544383;\r
-               public const int isc_badblk = 335544384;\r
-               public const int isc_invpoolcl = 335544385;\r
-               public const int isc_nopoolids = 335544386;\r
-               public const int isc_relbadblk = 335544387;\r
-               public const int isc_blktoobig = 335544388;\r
-               public const int isc_bufexh = 335544389;\r
-               public const int isc_syntaxerr = 335544390;\r
-               public const int isc_bufinuse = 335544391;\r
-               public const int isc_bdbincon = 335544392;\r
-               public const int isc_reqinuse = 335544393;\r
-               public const int isc_badodsver = 335544394;\r
-               public const int isc_relnotdef = 335544395;\r
-               public const int isc_fldnotdef = 335544396;\r
-               public const int isc_dirtypage = 335544397;\r
-               public const int isc_waifortra = 335544398;\r
-               public const int isc_doubleloc = 335544399;\r
-               public const int isc_nodnotfnd = 335544400;\r
-               public const int isc_dupnodfnd = 335544401;\r
-               public const int isc_locnotmar = 335544402;\r
-               public const int isc_badpagtyp = 335544403;\r
-               public const int isc_corrupt = 335544404;\r
-               public const int isc_badpage = 335544405;\r
-               public const int isc_badindex = 335544406;\r
-               public const int isc_dbbnotzer = 335544407;\r
-               public const int isc_tranotzer = 335544408;\r
-               public const int isc_trareqmis = 335544409;\r
-               public const int isc_badhndcnt = 335544410;\r
-               public const int isc_wrotpbver = 335544411;\r
-               public const int isc_wroblrver = 335544412;\r
-               public const int isc_wrodpbver = 335544413;\r
-               public const int isc_blobnotsup = 335544414;\r
-               public const int isc_badrelation = 335544415;\r
-               public const int isc_nodetach = 335544416;\r
-               public const int isc_notremote = 335544417;\r
-               public const int isc_trainlim = 335544418;\r
-               public const int isc_notinlim = 335544419;\r
-               public const int isc_traoutsta = 335544420;\r
-               public const int isc_connect_reject = 335544421;\r
-               public const int isc_dbfile = 335544422;\r
-               public const int isc_orphan = 335544423;\r
-               public const int isc_no_lock_mgr = 335544424;\r
-               public const int isc_ctxinuse = 335544425;\r
-               public const int isc_ctxnotdef = 335544426;\r
-               public const int isc_datnotsup = 335544427;\r
-               public const int isc_badmsgnum = 335544428;\r
-               public const int isc_badparnum = 335544429;\r
-               public const int isc_virmemexh = 335544430;\r
-               public const int isc_blocking_signal = 335544431;\r
-               public const int isc_lockmanerr = 335544432;\r
-               public const int isc_journerr = 335544433;\r
-               public const int isc_keytoobig = 335544434;\r
-               public const int isc_nullsegkey = 335544435;\r
-               public const int isc_sqlerr = 335544436;\r
-               public const int isc_wrodynver = 335544437;\r
-               public const int isc_funnotdef = 335544438;\r
-               public const int isc_funmismat = 335544439;\r
-               public const int isc_bad_msg_vec = 335544440;\r
-               public const int isc_bad_detach = 335544441;\r
-               public const int isc_noargacc_read = 335544442;\r
-               public const int isc_noargacc_write = 335544443;\r
-               public const int isc_read_only = 335544444;\r
-               public const int isc_ext_err = 335544445;\r
-               public const int isc_non_updatable = 335544446;\r
-               public const int isc_no_rollback = 335544447;\r
-               public const int isc_bad_sec_info = 335544448;\r
-               public const int isc_invalid_sec_info = 335544449;\r
-               public const int isc_misc_interpreted = 335544450;\r
-               public const int isc_update_conflict = 335544451;\r
-               public const int isc_unlicensed = 335544452;\r
-               public const int isc_obj_in_use = 335544453;\r
-               public const int isc_nofilter = 335544454;\r
-               public const int isc_shadow_accessed = 335544455;\r
-               public const int isc_invalid_sdl = 335544456;\r
-               public const int isc_out_of_bounds = 335544457;\r
-               public const int isc_invalid_dimension = 335544458;\r
-               public const int isc_rec_in_limbo = 335544459;\r
-               public const int isc_shadow_missing = 335544460;\r
-               public const int isc_cant_validate = 335544461;\r
-               public const int isc_cant_start_journal = 335544462;\r
-               public const int isc_gennotdef = 335544463;\r
-               public const int isc_cant_start_logging = 335544464;\r
-               public const int isc_bad_segstr_type = 335544465;\r
-               public const int isc_foreign_key = 335544466;\r
-               public const int isc_high_minor = 335544467;\r
-               public const int isc_tra_state = 335544468;\r
-               public const int isc_trans_invalid = 335544469;\r
-               public const int isc_buf_invalid = 335544470;\r
-               public const int isc_indexnotdefined = 335544471;\r
-               public const int isc_login = 335544472;\r
-               public const int isc_invalid_bookmark = 335544473;\r
-               public const int isc_bad_lock_level = 335544474;\r
-               public const int isc_relation_lock = 335544475;\r
-               public const int isc_record_lock = 335544476;\r
-               public const int isc_max_idx = 335544477;\r
-               public const int isc_jrn_enable = 335544478;\r
-               public const int isc_old_failure = 335544479;\r
-               public const int isc_old_in_progress = 335544480;\r
-               public const int isc_old_no_space = 335544481;\r
-               public const int isc_no_wal_no_jrn = 335544482;\r
-               public const int isc_num_old_files = 335544483;\r
-               public const int isc_wal_file_open = 335544484;\r
-               public const int isc_bad_stmt_handle = 335544485;\r
-               public const int isc_wal_failure = 335544486;\r
-               public const int isc_walw_err = 335544487;\r
-               public const int isc_logh_small = 335544488;\r
-               public const int isc_logh_inv_version = 335544489;\r
-               public const int isc_logh_open_flag = 335544490;\r
-               public const int isc_logh_open_flag2 = 335544491;\r
-               public const int isc_logh_diff_dbname = 335544492;\r
-               public const int isc_logf_unexpected_eof = 335544493;\r
-               public const int isc_logr_incomplete = 335544494;\r
-               public const int isc_logr_header_small = 335544495;\r
-               public const int isc_logb_small = 335544496;\r
-               public const int isc_wal_illegal_attach = 335544497;\r
-               public const int isc_wal_invalid_wpb = 335544498;\r
-               public const int isc_wal_err_rollover = 335544499;\r
-               public const int isc_no_wal = 335544500;\r
-               public const int isc_drop_wal = 335544501;\r
-               public const int isc_stream_not_defined = 335544502;\r
-               public const int isc_wal_subsys_error = 335544503;\r
-               public const int isc_wal_subsys_corrupt = 335544504;\r
-               public const int isc_no_archive = 335544505;\r
-               public const int isc_shutinprog = 335544506;\r
-               public const int isc_range_in_use = 335544507;\r
-               public const int isc_range_not_found = 335544508;\r
-               public const int isc_charset_not_found = 335544509;\r
-               public const int isc_lock_timeout = 335544510;\r
-               public const int isc_prcnotdef = 335544511;\r
-               public const int isc_prcmismat = 335544512;\r
-               public const int isc_wal_bugcheck = 335544513;\r
-               public const int isc_wal_cant_expand = 335544514;\r
-               public const int isc_codnotdef = 335544515;\r
-               public const int isc_xcpnotdef = 335544516;\r
-               public const int isc_except = 335544517;\r
-               public const int isc_cache_restart = 335544518;\r
-               public const int isc_bad_lock_handle = 335544519;\r
-               public const int isc_jrn_present = 335544520;\r
-               public const int isc_wal_err_rollover2 = 335544521;\r
-               public const int isc_wal_err_logwrite = 335544522;\r
-               public const int isc_wal_err_jrn_comm = 335544523;\r
-               public const int isc_wal_err_expansion = 335544524;\r
-               public const int isc_wal_err_setup = 335544525;\r
-               public const int isc_wal_err_ww_sync = 335544526;\r
-               public const int isc_wal_err_ww_start = 335544527;\r
-               public const int isc_shutdown = 335544528;\r
-               public const int isc_existing_priv_mod = 335544529;\r
-               public const int isc_primary_key_ref = 335544530;\r
-               public const int isc_primary_key_notnull = 335544531;\r
-               public const int isc_ref_cnstrnt_notfound = 335544532;\r
-               public const int isc_foreign_key_notfound = 335544533;\r
-               public const int isc_ref_cnstrnt_update = 335544534;\r
-               public const int isc_check_cnstrnt_update = 335544535;\r
-               public const int isc_check_cnstrnt_del = 335544536;\r
-               public const int isc_integ_index_seg_del = 335544537;\r
-               public const int isc_integ_index_seg_mod = 335544538;\r
-               public const int isc_integ_index_del = 335544539;\r
-               public const int isc_integ_index_mod = 335544540;\r
-               public const int isc_check_trig_del = 335544541;\r
-               public const int isc_check_trig_update = 335544542;\r
-               public const int isc_cnstrnt_fld_del = 335544543;\r
-               public const int isc_cnstrnt_fld_rename = 335544544;\r
-               public const int isc_rel_cnstrnt_update = 335544545;\r
-               public const int isc_constaint_on_view = 335544546;\r
-               public const int isc_invld_cnstrnt_type = 335544547;\r
-               public const int isc_primary_key_exists = 335544548;\r
-               public const int isc_systrig_update = 335544549;\r
-               public const int isc_not_rel_owner = 335544550;\r
-               public const int isc_grant_obj_notfound = 335544551;\r
-               public const int isc_grant_fld_notfound = 335544552;\r
-               public const int isc_grant_nopriv = 335544553;\r
-               public const int isc_nonsql_security_rel = 335544554;\r
-               public const int isc_nonsql_security_fld = 335544555;\r
-               public const int isc_wal_cache_err = 335544556;\r
-               public const int isc_shutfail = 335544557;\r
-               public const int isc_check_constraint = 335544558;\r
-               public const int isc_bad_svc_handle = 335544559;\r
-               public const int isc_shutwarn = 335544560;\r
-               public const int isc_wrospbver = 335544561;\r
-               public const int isc_bad_spb_form = 335544562;\r
-               public const int isc_svcnotdef = 335544563;\r
-               public const int isc_no_jrn = 335544564;\r
-               public const int isc_transliteration_failed = 335544565;\r
-               public const int isc_start_cm_for_wal = 335544566;\r
-               public const int isc_wal_ovflow_log_required = 335544567;\r
-               public const int isc_text_subtype = 335544568;\r
-               public const int isc_dsql_error = 335544569;\r
-               public const int isc_dsql_command_err = 335544570;\r
-               public const int isc_dsql_constant_err = 335544571;\r
-               public const int isc_dsql_cursor_err = 335544572;\r
-               public const int isc_dsql_datatype_err = 335544573;\r
-               public const int isc_dsql_decl_err = 335544574;\r
-               public const int isc_dsql_cursor_update_err = 335544575;\r
-               public const int isc_dsql_cursor_open_err = 335544576;\r
-               public const int isc_dsql_cursor_close_err = 335544577;\r
-               public const int isc_dsql_field_err = 335544578;\r
-               public const int isc_dsql_internal_err = 335544579;\r
-               public const int isc_dsql_relation_err = 335544580;\r
-               public const int isc_dsql_procedure_err = 335544581;\r
-               public const int isc_dsql_request_err = 335544582;\r
-               public const int isc_dsql_sqlda_err = 335544583;\r
-               public const int isc_dsql_var_count_err = 335544584;\r
-               public const int isc_dsql_stmt_handle = 335544585;\r
-               public const int isc_dsql_function_err = 335544586;\r
-               public const int isc_dsql_blob_err = 335544587;\r
-               public const int isc_collation_not_found = 335544588;\r
-               public const int isc_collation_not_for_charset = 335544589;\r
-               public const int isc_dsql_dup_option = 335544590;\r
-               public const int isc_dsql_tran_err = 335544591;\r
-               public const int isc_dsql_invalid_array = 335544592;\r
-               public const int isc_dsql_max_arr_dim_exceeded = 335544593;\r
-               public const int isc_dsql_arr_range_error = 335544594;\r
-               public const int isc_dsql_trigger_err = 335544595;\r
-               public const int isc_dsql_subselect_err = 335544596;\r
-               public const int isc_dsql_crdb_prepare_err = 335544597;\r
-               public const int isc_specify_field_err = 335544598;\r
-               public const int isc_num_field_err = 335544599;\r
-               public const int isc_col_name_err = 335544600;\r
-               public const int isc_where_err = 335544601;\r
-               public const int isc_table_view_err = 335544602;\r
-               public const int isc_distinct_err = 335544603;\r
-               public const int isc_key_field_count_err = 335544604;\r
-               public const int isc_subquery_err = 335544605;\r
-               public const int isc_expression_eval_err = 335544606;\r
-               public const int isc_node_err = 335544607;\r
-               public const int isc_command_end_err = 335544608;\r
-               public const int isc_index_name = 335544609;\r
-               public const int isc_exception_name = 335544610;\r
-               public const int isc_field_name = 335544611;\r
-               public const int isc_token_err = 335544612;\r
-               public const int isc_union_err = 335544613;\r
-               public const int isc_dsql_construct_err = 335544614;\r
-               public const int isc_field_aggregate_err = 335544615;\r
-               public const int isc_field_ref_err = 335544616;\r
-               public const int isc_order_by_err = 335544617;\r
-               public const int isc_return_mode_err = 335544618;\r
-               public const int isc_extern_func_err = 335544619;\r
-               public const int isc_alias_conflict_err = 335544620;\r
-               public const int isc_procedure_conflict_error = 335544621;\r
-               public const int isc_relation_conflict_err = 335544622;\r
-               public const int isc_dsql_domain_err = 335544623;\r
-               public const int isc_idx_seg_err = 335544624;\r
-               public const int isc_node_name_err = 335544625;\r
-               public const int isc_table_name = 335544626;\r
-               public const int isc_proc_name = 335544627;\r
-               public const int isc_idx_create_err = 335544628;\r
-               public const int isc_wal_shadow_err = 335544629;\r
-               public const int isc_dependency = 335544630;\r
-               public const int isc_idx_key_err = 335544631;\r
-               public const int isc_dsql_file_length_err = 335544632;\r
-               public const int isc_dsql_shadow_number_err = 335544633;\r
-               public const int isc_dsql_token_unk_err = 335544634;\r
-               public const int isc_dsql_no_relation_alias = 335544635;\r
-               public const int isc_indexname = 335544636;\r
-               public const int isc_no_stream_plan = 335544637;\r
-               public const int isc_stream_twice = 335544638;\r
-               public const int isc_stream_not_found = 335544639;\r
-               public const int isc_collation_requires_text = 335544640;\r
-               public const int isc_dsql_domain_not_found = 335544641;\r
-               public const int isc_index_unused = 335544642;\r
-               public const int isc_dsql_self_join = 335544643;\r
-               public const int isc_stream_bof = 335544644;\r
-               public const int isc_stream_crack = 335544645;\r
-               public const int isc_db_or_file_exists = 335544646;\r
-               public const int isc_invalid_operator = 335544647;\r
-               public const int isc_conn_lost = 335544648;\r
-               public const int isc_bad_checksum = 335544649;\r
-               public const int isc_page_type_err = 335544650;\r
-               public const int isc_ext_readonly_err = 335544651;\r
-               public const int isc_sing_select_err = 335544652;\r
-               public const int isc_psw_attach = 335544653;\r
-               public const int isc_psw_start_trans = 335544654;\r
-               public const int isc_invalid_direction = 335544655;\r
-               public const int isc_dsql_var_conflict = 335544656;\r
-               public const int isc_dsql_no_blob_array = 335544657;\r
-               public const int isc_dsql_base_table = 335544658;\r
-               public const int isc_duplicate_base_table = 335544659;\r
-               public const int isc_view_alias = 335544660;\r
-               public const int isc_index_root_page_full = 335544661;\r
-               public const int isc_dsql_blob_type_unknown = 335544662;\r
-               public const int isc_req_max_clones_exceeded = 335544663;\r
-               public const int isc_dsql_duplicate_spec = 335544664;\r
-               public const int isc_unique_key_violation = 335544665;\r
-               public const int isc_srvr_version_too_old = 335544666;\r
-               public const int isc_drdb_completed_with_errs = 335544667;\r
-               public const int isc_dsql_procedure_use_err = 335544668;\r
-               public const int isc_dsql_count_mismatch = 335544669;\r
-               public const int isc_blob_idx_err = 335544670;\r
-               public const int isc_array_idx_err = 335544671;\r
-               public const int isc_key_field_err = 335544672;\r
-               public const int isc_no_delete = 335544673;\r
-               public const int isc_del_last_field = 335544674;\r
-               public const int isc_sort_err = 335544675;\r
-               public const int isc_sort_mem_err = 335544676;\r
-               public const int isc_version_err = 335544677;\r
-               public const int isc_inval_key_posn = 335544678;\r
-               public const int isc_no_segments_err = 335544679;\r
-               public const int isc_crrp_data_err = 335544680;\r
-               public const int isc_rec_size_err = 335544681;\r
-               public const int isc_dsql_field_ref = 335544682;\r
-               public const int isc_req_depth_exceeded = 335544683;\r
-               public const int isc_no_field_access = 335544684;\r
-               public const int isc_no_dbkey = 335544685;\r
-               public const int isc_jrn_format_err = 335544686;\r
-               public const int isc_jrn_file_full = 335544687;\r
-               public const int isc_dsql_open_cursor_request = 335544688;\r
-               public const int isc_ib_error = 335544689;\r
-               public const int isc_cache_redef = 335544690;\r
-               public const int isc_cache_too_small = 335544691;\r
-               public const int isc_log_redef = 335544692;\r
-               public const int isc_log_too_small = 335544693;\r
-               public const int isc_partition_too_small = 335544694;\r
-               public const int isc_partition_not_supp = 335544695;\r
-               public const int isc_log_length_spec = 335544696;\r
-               public const int isc_precision_err = 335544697;\r
-               public const int isc_scale_nogt = 335544698;\r
-               public const int isc_expec_int = 335544699;\r
-               public const int isc_expec_long = 335544700;\r
-               public const int isc_expec_uint = 335544701;\r
-               public const int isc_like_escape_invalid = 335544702;\r
-               public const int isc_svcnoexe = 335544703;\r
-               public const int isc_net_lookup_err = 335544704;\r
-               public const int isc_service_unknown = 335544705;\r
-               public const int isc_host_unknown = 335544706;\r
-               public const int isc_grant_nopriv_on_base = 335544707;\r
-               public const int isc_dyn_fld_ambiguous = 335544708;\r
-               public const int isc_dsql_agg_ref_err = 335544709;\r
-               public const int isc_complex_view = 335544710;\r
-               public const int isc_unprepared_stmt = 335544711;\r
-               public const int isc_expec_positive = 335544712;\r
-               public const int isc_dsql_sqlda_value_err = 335544713;\r
-               public const int isc_invalid_array_id = 335544714;\r
-               public const int isc_extfile_uns_op = 335544715;\r
-               public const int isc_svc_in_use = 335544716;\r
-               public const int isc_err_stack_limit = 335544717;\r
-               public const int isc_invalid_key = 335544718;\r
-               public const int isc_net_init_error = 335544719;\r
-               public const int isc_loadlib_failure = 335544720;\r
-               public const int isc_network_error = 335544721;\r
-               public const int isc_net_connect_err = 335544722;\r
-               public const int isc_net_connect_listen_err = 335544723;\r
-               public const int isc_net_event_connect_err = 335544724;\r
-               public const int isc_net_event_listen_err = 335544725;\r
-               public const int isc_net_read_err = 335544726;\r
-               public const int isc_net_write_err = 335544727;\r
-               public const int isc_integ_index_deactivate = 335544728;\r
-               public const int isc_integ_deactivate_primary = 335544729;\r
-               public const int isc_cse_not_supported = 335544730;\r
-               public const int isc_tra_must_sweep = 335544731;\r
-               public const int isc_unsupported_network_drive = 335544732;\r
-               public const int isc_io_create_err = 335544733;\r
-               public const int isc_io_open_err = 335544734;\r
-               public const int isc_io_close_err = 335544735;\r
-               public const int isc_io_read_err = 335544736;\r
-               public const int isc_io_write_err = 335544737;\r
-               public const int isc_io_delete_err = 335544738;\r
-               public const int isc_io_access_err = 335544739;\r
-               public const int isc_udf_exception = 335544740;\r
-               public const int isc_lost_db_connection = 335544741;\r
-               public const int isc_no_write_user_priv = 335544742;\r
-               public const int isc_token_too_long = 335544743;\r
-               public const int isc_max_att_exceeded = 335544744;\r
-               public const int isc_login_same_as_role_name = 335544745;\r
-               public const int isc_reftable_requires_pk = 335544746;\r
-               public const int isc_usrname_too_long = 335544747;\r
-               public const int isc_password_too_long = 335544748;\r
-               public const int isc_usrname_required = 335544749;\r
-               public const int isc_password_required = 335544750;\r
-               public const int isc_bad_protocol = 335544751;\r
-               public const int isc_dup_usrname_found = 335544752;\r
-               public const int isc_usrname_not_found = 335544753;\r
-               public const int isc_error_adding_sec_record = 335544754;\r
-               public const int isc_error_modifying_sec_record = 335544755;\r
-               public const int isc_error_deleting_sec_record = 335544756;\r
-               public const int isc_error_updating_sec_db = 335544757;\r
-               public const int isc_sort_rec_size_err = 335544758;\r
-               public const int isc_bad_default_value = 335544759;\r
-               public const int isc_invalid_clause = 335544760;\r
-               public const int isc_too_many_handles = 335544761;\r
-               public const int isc_optimizer_blk_exc = 335544762;\r
-               public const int isc_invalid_string_constant = 335544763;\r
-               public const int isc_transitional_date = 335544764;\r
-               public const int isc_read_only_database = 335544765;\r
-               public const int isc_must_be_dialect_2_and_up = 335544766;\r
-               public const int isc_blob_filter_exception = 335544767;\r
-               public const int isc_exception_access_violation = 335544768;\r
-               public const int isc_exception_datatype_missalignment = 335544769;\r
-               public const int isc_exception_array_bounds_exceeded = 335544770;\r
-               public const int isc_exception_float_denormal_operand = 335544771;\r
-               public const int isc_exception_float_divide_by_zero = 335544772;\r
-               public const int isc_exception_float_inexact_result = 335544773;\r
-               public const int isc_exception_float_invalid_operand = 335544774;\r
-               public const int isc_exception_float_overflow = 335544775;\r
-               public const int isc_exception_float_stack_check = 335544776;\r
-               public const int isc_exception_float_underflow = 335544777;\r
-               public const int isc_exception_int_divide_by_zero = 335544778;\r
-               public const int isc_exception_int_overflow = 335544779;\r
-               public const int isc_exception_unknown = 335544780;\r
-               public const int isc_exception_stack_overflow = 335544781;\r
-               public const int isc_exception_sigsegv = 335544782;\r
-               public const int isc_exception_sigill = 335544783;\r
-               public const int isc_exception_sigbus = 335544784;\r
-               public const int isc_exception_sigfpe = 335544785;\r
-               public const int isc_ext_file_delete = 335544786;\r
-               public const int isc_ext_file_modify = 335544787;\r
-               public const int isc_adm_task_denied = 335544788;\r
-               public const int isc_extract_input_mismatch = 335544789;\r
-               public const int isc_insufficient_svc_privileges = 335544790;\r
-               public const int isc_file_in_use = 335544791;\r
-               public const int isc_service_att_err = 335544792;\r
-               public const int isc_ddl_not_allowed_by_db_sql_dial = 335544793;\r
-               public const int isc_cancelled = 335544794;\r
-               public const int isc_unexp_spb_form = 335544795;\r
-               public const int isc_sql_dialect_datatype_unsupport = 335544796;\r
-               public const int isc_svcnouser = 335544797;\r
-               public const int isc_depend_on_uncommitted_rel = 335544798;\r
-               public const int isc_svc_name_missing = 335544799;\r
-               public const int isc_too_many_contexts = 335544800;\r
-               public const int isc_datype_notsup = 335544801;\r
-               public const int isc_dialect_reset_warning = 335544802;\r
-               public const int isc_dialect_not_changed = 335544803;\r
-               public const int isc_database_create_failed = 335544804;\r
-               public const int isc_inv_dialect_specified = 335544805;\r
-               public const int isc_valid_db_dialects = 335544806;\r
-               public const int isc_sqlwarn = 335544807;\r
-               public const int isc_dtype_renamed = 335544808;\r
-               public const int isc_extern_func_dir_error = 335544809;\r
-               public const int isc_date_range_exceeded = 335544810;\r
-               public const int isc_inv_client_dialect_specified = 335544811;\r
-               public const int isc_valid_client_dialects = 335544812;\r
-               public const int isc_optimizer_between_err = 335544813;\r
-               public const int isc_service_not_supported = 335544814;\r
-               public const int isc_generator_name = 335544815;\r
-               public const int isc_udf_name = 335544816;\r
-               public const int isc_bad_limit_param = 335544817;\r
-               public const int isc_bad_skip_param = 335544818;\r
-               public const int isc_io_32bit_exceeded_err = 335544819;\r
-               public const int isc_invalid_savepoint = 335544820;\r
-               public const int isc_dsql_column_pos_err = 335544821;\r
-               public const int isc_dsql_agg_where_err = 335544822;\r
-               public const int isc_dsql_agg_group_err = 335544823;\r
-               public const int isc_dsql_agg_column_err = 335544824;\r
-               public const int isc_dsql_agg_having_err = 335544825;\r
-               public const int isc_dsql_agg_nested_err = 335544826;\r
-               public const int isc_exec_sql_invalid_arg = 335544827;\r
-               public const int isc_exec_sql_invalid_req = 335544828;\r
-               public const int isc_exec_sql_invalid_var = 335544829;\r
-               public const int isc_exec_sql_max_call_exceeded = 335544830;\r
-               public const int isc_conf_access_denied = 335544831;\r
-               public const int isc_gfix_db_name = 335740929;\r
-               public const int isc_gfix_invalid_sw = 335740930;\r
-               public const int isc_gfix_incmp_sw = 335740932;\r
-               public const int isc_gfix_replay_req = 335740933;\r
-               public const int isc_gfix_pgbuf_req = 335740934;\r
-               public const int isc_gfix_val_req = 335740935;\r
-               public const int isc_gfix_pval_req = 335740936;\r
-               public const int isc_gfix_trn_req = 335740937;\r
-               public const int isc_gfix_full_req = 335740940;\r
-               public const int isc_gfix_usrname_req = 335740941;\r
-               public const int isc_gfix_pass_req = 335740942;\r
-               public const int isc_gfix_subs_name = 335740943;\r
-               public const int isc_gfix_wal_req = 335740944;\r
-               public const int isc_gfix_sec_req = 335740945;\r
-               public const int isc_gfix_nval_req = 335740946;\r
-               public const int isc_gfix_type_shut = 335740947;\r
-               public const int isc_gfix_retry = 335740948;\r
-               public const int isc_gfix_retry_db = 335740951;\r
-               public const int isc_gfix_exceed_max = 335740991;\r
-               public const int isc_gfix_corrupt_pool = 335740992;\r
-               public const int isc_gfix_mem_exhausted = 335740993;\r
-               public const int isc_gfix_bad_pool = 335740994;\r
-               public const int isc_gfix_trn_not_valid = 335740995;\r
-               public const int isc_gfix_unexp_eoi = 335741012;\r
-               public const int isc_gfix_recon_fail = 335741018;\r
-               public const int isc_gfix_trn_unknown = 335741036;\r
-               public const int isc_gfix_mode_req = 335741038;\r
-               public const int isc_gfix_opt_SQL_dialect = 335741039;\r
-               public const int isc_dsql_dbkey_from_non_table = 336003074;\r
-               public const int isc_dsql_transitional_numeric = 336003075;\r
-               public const int isc_dsql_dialect_warning_expr = 336003076;\r
-               public const int isc_sql_db_dialect_dtype_unsupport = 336003077;\r
-               public const int isc_isc_sql_dialect_conflict_num = 336003079;\r
-               public const int isc_dsql_warning_number_ambiguous = 336003080;\r
-               public const int isc_dsql_warning_number_ambiguous1 = 336003081;\r
-               public const int isc_dsql_warn_precision_ambiguous = 336003082;\r
-               public const int isc_dsql_warn_precision_ambiguous1 = 336003083;\r
-               public const int isc_dsql_warn_precision_ambiguous2 = 336003084;\r
-               public const int isc_dyn_role_does_not_exist = 336068796;\r
-               public const int isc_dyn_no_grant_admin_opt = 336068797;\r
-               public const int isc_dyn_user_not_role_member = 336068798;\r
-               public const int isc_dyn_delete_role_failed = 336068799;\r
-               public const int isc_dyn_grant_role_to_user = 336068800;\r
-               public const int isc_dyn_inv_sql_role_name = 336068801;\r
-               public const int isc_dyn_dup_sql_role = 336068802;\r
-               public const int isc_dyn_kywd_spec_for_role = 336068803;\r
-               public const int isc_dyn_roles_not_supported = 336068804;\r
-               public const int isc_dyn_domain_name_exists = 336068812;\r
-               public const int isc_dyn_field_name_exists = 336068813;\r
-               public const int isc_dyn_dependency_exists = 336068814;\r
-               public const int isc_dyn_dtype_invalid = 336068815;\r
-               public const int isc_dyn_char_fld_too_small = 336068816;\r
-               public const int isc_dyn_invalid_dtype_conversion = 336068817;\r
-               public const int isc_dyn_dtype_conv_invalid = 336068818;\r
-               public const int isc_gbak_unknown_switch = 336330753;\r
-               public const int isc_gbak_page_size_missing = 336330754;\r
-               public const int isc_gbak_page_size_toobig = 336330755;\r
-               public const int isc_gbak_redir_ouput_missing = 336330756;\r
-               public const int isc_gbak_switches_conflict = 336330757;\r
-               public const int isc_gbak_unknown_device = 336330758;\r
-               public const int isc_gbak_no_protection = 336330759;\r
-               public const int isc_gbak_page_size_not_allowed = 336330760;\r
-               public const int isc_gbak_multi_source_dest = 336330761;\r
-               public const int isc_gbak_filename_missing = 336330762;\r
-               public const int isc_gbak_dup_inout_names = 336330763;\r
-               public const int isc_gbak_inv_page_size = 336330764;\r
-               public const int isc_gbak_db_specified = 336330765;\r
-               public const int isc_gbak_db_exists = 336330766;\r
-               public const int isc_gbak_unk_device = 336330767;\r
-               public const int isc_gbak_blob_info_failed = 336330772;\r
-               public const int isc_gbak_unk_blob_item = 336330773;\r
-               public const int isc_gbak_get_seg_failed = 336330774;\r
-               public const int isc_gbak_close_blob_failed = 336330775;\r
-               public const int isc_gbak_open_blob_failed = 336330776;\r
-               public const int isc_gbak_put_blr_gen_id_failed = 336330777;\r
-               public const int isc_gbak_unk_type = 336330778;\r
-               public const int isc_gbak_comp_req_failed = 336330779;\r
-               public const int isc_gbak_start_req_failed = 336330780;\r
-               public const int isc_gbak_rec_failed = 336330781;\r
-               public const int isc_gbak_rel_req_failed = 336330782;\r
-               public const int isc_gbak_db_info_failed = 336330783;\r
-               public const int isc_gbak_no_db_desc = 336330784;\r
-               public const int isc_gbak_db_create_failed = 336330785;\r
-               public const int isc_gbak_decomp_len_error = 336330786;\r
-               public const int isc_gbak_tbl_missing = 336330787;\r
-               public const int isc_gbak_blob_col_missing = 336330788;\r
-               public const int isc_gbak_create_blob_failed = 336330789;\r
-               public const int isc_gbak_put_seg_failed = 336330790;\r
-               public const int isc_gbak_rec_len_exp = 336330791;\r
-               public const int isc_gbak_inv_rec_len = 336330792;\r
-               public const int isc_gbak_exp_data_type = 336330793;\r
-               public const int isc_gbak_gen_id_failed = 336330794;\r
-               public const int isc_gbak_unk_rec_type = 336330795;\r
-               public const int isc_gbak_inv_bkup_ver = 336330796;\r
-               public const int isc_gbak_missing_bkup_desc = 336330797;\r
-               public const int isc_gbak_string_trunc = 336330798;\r
-               public const int isc_gbak_cant_rest_record = 336330799;\r
-               public const int isc_gbak_send_failed = 336330800;\r
-               public const int isc_gbak_no_tbl_name = 336330801;\r
-               public const int isc_gbak_unexp_eof = 336330802;\r
-               public const int isc_gbak_db_format_too_old = 336330803;\r
-               public const int isc_gbak_inv_array_dim = 336330804;\r
-               public const int isc_gbak_xdr_len_expected = 336330807;\r
-               public const int isc_gbak_open_bkup_error = 336330817;\r
-               public const int isc_gbak_open_error = 336330818;\r
-               public const int isc_gbak_missing_block_fac = 336330934;\r
-               public const int isc_gbak_inv_block_fac = 336330935;\r
-               public const int isc_gbak_block_fac_specified = 336330936;\r
-               public const int isc_gbak_missing_username = 336330940;\r
-               public const int isc_gbak_missing_password = 336330941;\r
-               public const int isc_gbak_missing_skipped_bytes = 336330952;\r
-               public const int isc_gbak_inv_skipped_bytes = 336330953;\r
-               public const int isc_gbak_err_restore_charset = 336330965;\r
-               public const int isc_gbak_err_restore_collation = 336330967;\r
-               public const int isc_gbak_read_error = 336330972;\r
-               public const int isc_gbak_write_error = 336330973;\r
-               public const int isc_gbak_db_in_use = 336330985;\r
-               public const int isc_gbak_sysmemex = 336330990;\r
-               public const int isc_gbak_restore_role_failed = 336331002;\r
-               public const int isc_gbak_role_op_missing = 336331005;\r
-               public const int isc_gbak_page_buffers_missing = 336331010;\r
-               public const int isc_gbak_page_buffers_wrong_param = 336331011;\r
-               public const int isc_gbak_page_buffers_restore = 336331012;\r
-               public const int isc_gbak_inv_size = 336331014;\r
-               public const int isc_gbak_file_outof_sequence = 336331015;\r
-               public const int isc_gbak_join_file_missing = 336331016;\r
-               public const int isc_gbak_stdin_not_supptd = 336331017;\r
-               public const int isc_gbak_stdout_not_supptd = 336331018;\r
-               public const int isc_gbak_bkup_corrupt = 336331019;\r
-               public const int isc_gbak_unk_db_file_spec = 336331020;\r
-               public const int isc_gbak_hdr_write_failed = 336331021;\r
-               public const int isc_gbak_disk_space_ex = 336331022;\r
-               public const int isc_gbak_size_lt_min = 336331023;\r
-               public const int isc_gbak_svc_name_missing = 336331025;\r
-               public const int isc_gbak_not_ownr = 336331026;\r
-               public const int isc_gbak_mode_req = 336331031;\r
-               public const int isc_gsec_cant_open_db = 336723983;\r
-               public const int isc_gsec_switches_error = 336723984;\r
-               public const int isc_gsec_no_op_spec = 336723985;\r
-               public const int isc_gsec_no_usr_name = 336723986;\r
-               public const int isc_gsec_err_add = 336723987;\r
-               public const int isc_gsec_err_modify = 336723988;\r
-               public const int isc_gsec_err_find_mod = 336723989;\r
-               public const int isc_gsec_err_rec_not_found = 336723990;\r
-               public const int isc_gsec_err_delete = 336723991;\r
-               public const int isc_gsec_err_find_del = 336723992;\r
-               public const int isc_gsec_err_find_disp = 336723996;\r
-               public const int isc_gsec_inv_param = 336723997;\r
-               public const int isc_gsec_op_specified = 336723998;\r
-               public const int isc_gsec_pw_specified = 336723999;\r
-               public const int isc_gsec_uid_specified = 336724000;\r
-               public const int isc_gsec_gid_specified = 336724001;\r
-               public const int isc_gsec_proj_specified = 336724002;\r
-               public const int isc_gsec_org_specified = 336724003;\r
-               public const int isc_gsec_fname_specified = 336724004;\r
-               public const int isc_gsec_mname_specified = 336724005;\r
-               public const int isc_gsec_lname_specified = 336724006;\r
-               public const int isc_gsec_inv_switch = 336724008;\r
-               public const int isc_gsec_amb_switch = 336724009;\r
-               public const int isc_gsec_no_op_specified = 336724010;\r
-               public const int isc_gsec_params_not_allowed = 336724011;\r
-               public const int isc_gsec_incompat_switch = 336724012;\r
-               public const int isc_gsec_inv_username = 336724044;\r
-               public const int isc_gsec_inv_pw_length = 336724045;\r
-               public const int isc_gsec_db_specified = 336724046;\r
-               public const int isc_gsec_db_admin_specified = 336724047;\r
-               public const int isc_gsec_db_admin_pw_specified = 336724048;\r
-               public const int isc_gsec_sql_role_specified = 336724049;\r
-               public const int isc_license_no_file = 336789504;\r
-               public const int isc_license_op_specified = 336789523;\r
-               public const int isc_license_op_missing = 336789524;\r
-               public const int isc_license_inv_switch = 336789525;\r
-               public const int isc_license_inv_switch_combo = 336789526;\r
-               public const int isc_license_inv_op_combo = 336789527;\r
-               public const int isc_license_amb_switch = 336789528;\r
-               public const int isc_license_inv_parameter = 336789529;\r
-               public const int isc_license_param_specified = 336789530;\r
-               public const int isc_license_param_req = 336789531;\r
-               public const int isc_license_syntx_error = 336789532;\r
-               public const int isc_license_dup_id = 336789534;\r
-               public const int isc_license_inv_id_key = 336789535;\r
-               public const int isc_license_err_remove = 336789536;\r
-               public const int isc_license_err_update = 336789537;\r
-               public const int isc_license_err_convert = 336789538;\r
-               public const int isc_license_err_unk = 336789539;\r
-               public const int isc_license_svc_err_add = 336789540;\r
-               public const int isc_license_svc_err_remove = 336789541;\r
-               public const int isc_license_eval_exists = 336789563;\r
-               public const int isc_gstat_unknown_switch = 336920577;\r
-               public const int isc_gstat_retry = 336920578;\r
-               public const int isc_gstat_wrong_ods = 336920579;\r
-               public const int isc_gstat_unexpected_eof = 336920580;\r
-               public const int isc_gstat_open_err = 336920605;\r
-               public const int isc_gstat_read_err = 336920606;\r
-               public const int isc_gstat_sysmemex = 336920607;\r
-               public const int isc_err_max = 689;\r
-\r
-               #endregion\r
-\r
-               #region BLR     Codes\r
-\r
-               public const int blr_version5 = 5;\r
-               public const int blr_begin = 2;\r
-               public const int blr_message = 4;\r
-               public const int blr_eoc = 76;\r
-               public const int blr_end = 255; /* note: defined as -1 in gds.h */\r
-\r
-               public const int blr_text = 14;\r
-               public const int blr_text2 = 15;\r
-               public const int blr_short = 7;\r
-               public const int blr_long = 8;\r
-               public const int blr_quad = 9;\r
-               public const int blr_int64 = 16;\r
-               public const int blr_float = 10;\r
-               public const int blr_double = 27;\r
-               public const int blr_d_float = 11;\r
-               public const int blr_timestamp = 35;\r
-               public const int blr_varying = 37;\r
-               public const int blr_varying2 = 38;\r
-               public const int blr_blob = 261;\r
-               public const int blr_cstring = 40;\r
-               public const int blr_cstring2 = 41;\r
-               public const int blr_blob_id = 45;\r
-               public const int blr_sql_date = 12;\r
-               public const int blr_sql_time = 13;\r
-\r
-               #endregion\r
-\r
-               #region DataType Definitions\r
-\r
-               public const int SQL_TEXT = 452;\r
-               public const int SQL_VARYING = 448;\r
-               public const int SQL_SHORT = 500;\r
-               public const int SQL_LONG = 496;\r
-               public const int SQL_FLOAT = 482;\r
-               public const int SQL_DOUBLE = 480;\r
-               public const int SQL_D_FLOAT = 530;\r
-               public const int SQL_TIMESTAMP = 510;\r
-               public const int SQL_BLOB = 520;\r
-               public const int SQL_ARRAY = 540;\r
-               public const int SQL_QUAD = 550;\r
-               public const int SQL_TYPE_TIME = 560;\r
-               public const int SQL_TYPE_DATE = 570;\r
-               public const int SQL_INT64 = 580;\r
-\r
-               // Historical alias     for     pre     V6 applications\r
-               public const int SQL_DATE = SQL_TIMESTAMP;\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ * 
+ *     This file was originally ported from Jaybird
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class IscCodes
+       {
+               #region Constructors
+
+               private IscCodes()
+               {
+               }
+
+               #endregion
+
+               #region General
+
+               public const int SQLDA_VERSION1 = 1;
+               public const int SQL_DIALECT_V5 = 1;
+               public const int SQL_DIALECT_V6_TRANSITION = 2;
+               public const int SQL_DIALECT_V6 = 3;
+               public const int SQL_DIALECT_CURRENT = SQL_DIALECT_V6;
+
+               public const int DSQL_close = 1;
+               public const int DSQL_drop = 2;
+
+               public const int ARRAY_DESC_COLUMN_MAJOR = 1;   /* Set for FORTRAN */
+
+               public const int ISC_STATUS_LENGTH = 20;
+
+               #endregion
+
+               #region Buffer sizes
+
+               public const int BUFFER_SIZE_128 = 128;
+               public const int BUFFER_SIZE_256 = 256;
+               public const int MAX_BUFFER_SIZE = 1024;
+
+               public const int ROWS_AFFECTED_BUFFER_SIZE = 34;
+               public const int STATEMENT_TYPE_BUFFER_SIZE = 8;
+
+               #endregion
+
+               #region Protocol Codes
+
+               /* The protocol is defined blocks, rather than messages, to
+                * separate     the     protocol from the transport     layer.  
+                */
+               public const int CONNECT_VERSION2 = 2;
+
+               /* Protocol     4 is protocol 3 plus server     management functions */
+               public const int PROTOCOL_VERSION3 = 3;
+               public const int PROTOCOL_VERSION4 = 4;
+
+               /* Protocol     5 includes support for a d_float data type */
+               public const int PROTOCOL_VERSION5 = 5;
+
+               /* Protocol     6 includes support for cancel remote events, blob seek,
+                * and unknown message type     
+                */
+               public const int PROTOCOL_VERSION6 = 6;
+
+               /* Protocol     7 includes DSQL support */
+               public const int PROTOCOL_VERSION7 = 7;
+
+               /* Protocol     8 includes collapsing first     receive into a send, drop database,
+                * DSQL execute 2, DSQL execute immediate 2, DSQL insert, services,     and
+                * transact     request.
+                */
+               public const int PROTOCOL_VERSION8 = 8;
+
+               /* Protocol     9 includes support for SPX32
+                * SPX32 uses WINSOCK instead of Novell SDK
+                * In order     to differentiate between the old implementation
+                * of SPX and this one, different PROTOCOL VERSIONS     are     used 
+                */
+               public const int PROTOCOL_VERSION9 = 9;
+
+               /* Protocol     10 includes     support for     warnings and removes the requirement for
+                * encoding     and     decoding status codes.
+                */
+               public const int PROTOCOL_VERSION10 = 10;
+
+               #endregion
+
+               #region Server Class
+
+               public const int isc_info_db_class_classic_access = 13;
+               public const int isc_info_db_class_server_access = 14;
+
+               #endregion
+
+               #region Operation Codes
+
+               // Operation (packet) types
+               public const int op_void = 0;   // Packet has been voided
+               public const int op_connect = 1;        // Connect to remote server
+               public const int op_exit = 2;   // Remote end has exitted
+               public const int op_accept = 3; // Server accepts connection
+               public const int op_reject = 4; // Server rejects connection
+               public const int op_protocol = 5;       // Protocol     selection
+               public const int op_disconnect = 6;     // Connect is going     away
+               public const int op_credit = 7; // Grant (buffer) credits
+               public const int op_continuation = 8;   // Continuation packet
+               public const int op_response = 9;       // Generic response     block
+
+               // Page server operations
+
+               public const int op_open_file = 10;     // Open file for page service
+               public const int op_create_file = 11;   // Create file for page service
+               public const int op_close_file = 12;    // Close file for page service
+               public const int op_read_page = 13;     // optionally lock and read     page
+               public const int op_write_page = 14;    // write page and optionally release lock
+               public const int op_lock = 15;  // sieze lock
+               public const int op_convert_lock = 16;  // convert existing     lock
+               public const int op_release_lock = 17;  // release existing     lock
+               public const int op_blocking = 18;      // blocking     lock message
+
+               // Full context server operations
+
+               public const int op_attach = 19;        // Attach database
+               public const int op_create = 20;        // Create database
+               public const int op_detach = 21;        // Detach database
+               public const int op_compile = 22;       // Request based operations
+               public const int op_start = 23;
+               public const int op_start_and_send = 24;
+               public const int op_send = 25;
+               public const int op_receive = 26;
+               public const int op_unwind = 27;
+               public const int op_release = 28;
+
+               public const int op_transaction = 29;   // Transaction operations
+               public const int op_commit = 30;
+               public const int op_rollback = 31;
+               public const int op_prepare = 32;
+               public const int op_reconnect = 33;
+
+               public const int op_create_blob = 34;   // Blob operations //
+               public const int op_open_blob = 35;
+               public const int op_get_segment = 36;
+               public const int op_put_segment = 37;
+               public const int op_cancel_blob = 38;
+               public const int op_close_blob = 39;
+
+               public const int op_info_database = 40; // Information services
+               public const int op_info_request = 41;
+               public const int op_info_transaction = 42;
+               public const int op_info_blob = 43;
+
+               public const int op_batch_segments = 44;        // Put a bunch of blob segments
+
+               public const int op_mgr_set_affinity = 45;      // Establish server     affinity
+               public const int op_mgr_clear_affinity = 46;    // Break server affinity
+               public const int op_mgr_report = 47;    // Report on server
+
+               public const int op_que_events = 48;    // Que event notification request
+               public const int op_cancel_events = 49; // Cancel event notification request
+               public const int op_commit_retaining = 50;      // Commit retaining     (what else)
+               public const int op_prepare2 = 51;      // Message form of prepare
+               public const int op_event = 52; // Completed event request (asynchronous)
+               public const int op_connect_request = 53;       // Request to establish connection
+               public const int op_aux_connect = 54;   // Establish auxiliary connection
+               public const int op_ddl = 55;   // DDL call
+               public const int op_open_blob2 = 56;
+               public const int op_create_blob2 = 57;
+               public const int op_get_slice = 58;
+               public const int op_put_slice = 59;
+               public const int op_slice = 60; // Successful response to public const int op_get_slice
+               public const int op_seek_blob = 61;     // Blob seek operation
+
+               // DSQL operations //
+
+               public const int op_allocate_statement = 62;    // allocate     a statment handle
+               public const int op_execute = 63;       // execute a prepared statement
+               public const int op_exec_immediate = 64;        // execute a statement
+               public const int op_fetch = 65; // fetch a record
+               public const int op_fetch_response = 66;        // response     for     record fetch
+               public const int op_free_statement = 67;        // free a statement
+               public const int op_prepare_statement = 68;     // prepare a statement
+               public const int op_set_cursor = 69;    // set a cursor name
+               public const int op_info_sql = 70;
+
+               public const int op_dummy = 71; // dummy packet to detect loss of client
+
+               public const int op_response_piggyback = 72;    // response     block for piggybacked messages
+               public const int op_start_and_receive = 73;
+               public const int op_start_send_and_receive = 74;
+
+               public const int op_exec_immediate2 = 75;       // execute an immediate statement with msgs
+               public const int op_execute2 = 76;      // execute a statement with     msgs
+               public const int op_insert = 77;
+               public const int op_sql_response = 78;  // response     from execute; exec immed; insert
+
+               public const int op_transact = 79;
+               public const int op_transact_response = 80;
+               public const int op_drop_database = 81;
+
+               public const int op_service_attach = 82;
+               public const int op_service_detach = 83;
+               public const int op_service_info = 84;
+               public const int op_service_start = 85;
+
+               public const int op_rollback_retaining = 86;
+
+               #endregion
+
+               #region Database Parameter Block
+
+               public const int isc_dpb_version1 = 1;
+               public const int isc_dpb_cdd_pathname = 1;
+               public const int isc_dpb_allocation = 2;
+               public const int isc_dpb_journal = 3;
+               public const int isc_dpb_page_size = 4;
+               public const int isc_dpb_num_buffers = 5;
+               public const int isc_dpb_buffer_length = 6;
+               public const int isc_dpb_debug = 7;
+               public const int isc_dpb_garbage_collect = 8;
+               public const int isc_dpb_verify = 9;
+               public const int isc_dpb_sweep = 10;
+               public const int isc_dpb_enable_journal = 11;
+               public const int isc_dpb_disable_journal = 12;
+               public const int isc_dpb_dbkey_scope = 13;
+               public const int isc_dpb_number_of_users = 14;
+               public const int isc_dpb_trace = 15;
+               public const int isc_dpb_no_garbage_collect = 16;
+               public const int isc_dpb_damaged = 17;
+               public const int isc_dpb_license = 18;
+               public const int isc_dpb_sys_user_name = 19;
+               public const int isc_dpb_encrypt_key = 20;
+               public const int isc_dpb_activate_shadow = 21;
+               public const int isc_dpb_sweep_interval = 22;
+               public const int isc_dpb_delete_shadow = 23;
+               public const int isc_dpb_force_write = 24;
+               public const int isc_dpb_begin_log = 25;
+               public const int isc_dpb_quit_log = 26;
+               public const int isc_dpb_no_reserve = 27;
+               public const int isc_dpb_user_name = 28;
+               public const int isc_dpb_password = 29;
+               public const int isc_dpb_password_enc = 30;
+               public const int isc_dpb_sys_user_name_enc = 31;
+               public const int isc_dpb_interp = 32;
+               public const int isc_dpb_online_dump = 33;
+               public const int isc_dpb_old_file_size = 34;
+               public const int isc_dpb_old_num_files = 35;
+               public const int isc_dpb_old_file = 36;
+               public const int isc_dpb_old_start_page = 37;
+               public const int isc_dpb_old_start_seqno = 38;
+               public const int isc_dpb_old_start_file = 39;
+               public const int isc_dpb_drop_walfile = 40;
+               public const int isc_dpb_old_dump_id = 41;
+               /*
+               public const int isc_dpb_wal_backup_dir                  = 42;
+               public const int isc_dpb_wal_chkptlen                    = 43;
+               public const int isc_dpb_wal_numbufs                     = 44;
+               public const int isc_dpb_wal_bufsize                     = 45;
+               public const int isc_dpb_wal_grp_cmt_wait                = 46;
+               */
+               public const int isc_dpb_lc_messages = 47;
+               public const int isc_dpb_lc_ctype = 48;
+               public const int isc_dpb_cache_manager = 49;
+               public const int isc_dpb_shutdown = 50;
+               public const int isc_dpb_online = 51;
+               public const int isc_dpb_shutdown_delay = 52;
+               public const int isc_dpb_reserved = 53;
+               public const int isc_dpb_overwrite = 54;
+               public const int isc_dpb_sec_attach = 55;
+               /*
+               public const int isc_dpb_disable_wal                     = 56;
+               */
+               public const int isc_dpb_connect_timeout = 57;
+               public const int isc_dpb_dummy_packet_interval = 58;
+               public const int isc_dpb_gbak_attach = 59;
+               public const int isc_dpb_sql_role_name = 60;
+               public const int isc_dpb_set_page_buffers = 61;
+               public const int isc_dpb_working_directory = 62;
+               public const int isc_dpb_sql_dialect = 63;
+               public const int isc_dpb_set_db_readonly = 64;
+               public const int isc_dpb_set_db_sql_dialect = 65;
+               public const int isc_dpb_gfix_attach = 66;
+               public const int isc_dpb_gstat_attach = 67;
+               public const int isc_dpb_set_db_charset = 68;
+
+               #endregion
+
+               #region Transaction     Parameter Block
+
+               public const int isc_tpb_version1 = 1;
+               public const int isc_tpb_version3 = 3;
+               public const int isc_tpb_consistency = 1;
+               public const int isc_tpb_concurrency = 2;
+               public const int isc_tpb_shared = 3;
+               public const int isc_tpb_protected = 4;
+               public const int isc_tpb_exclusive = 5;
+               public const int isc_tpb_wait = 6;
+               public const int isc_tpb_nowait = 7;
+               public const int isc_tpb_read = 8;
+               public const int isc_tpb_write = 9;
+               public const int isc_tpb_lock_read = 10;
+               public const int isc_tpb_lock_write = 11;
+               public const int isc_tpb_verb_time = 12;
+               public const int isc_tpb_commit_time = 13;
+               public const int isc_tpb_ignore_limbo = 14;
+               public const int isc_tpb_read_committed = 15;
+               public const int isc_tpb_autocommit = 16;
+               public const int isc_tpb_rec_version = 17;
+               public const int isc_tpb_no_rec_version = 18;
+               public const int isc_tpb_restart_requests = 19;
+               public const int isc_tpb_no_auto_undo = 20;
+
+               #endregion
+
+               #region Services Parameter Block
+
+               public const int isc_spb_version1 = 1;
+               public const int isc_spb_current_version = 2;
+               public const int isc_spb_version = isc_spb_current_version;
+               public const int isc_spb_user_name = isc_dpb_user_name;
+               public const int isc_spb_sys_user_name = isc_dpb_sys_user_name;
+               public const int isc_spb_sys_user_name_enc = isc_dpb_sys_user_name_enc;
+               public const int isc_spb_password = isc_dpb_password;
+               public const int isc_spb_password_enc = isc_dpb_password_enc;
+               public const int isc_spb_command_line = 105;
+               public const int isc_spb_dbname = 106;
+               public const int isc_spb_verbose = 107;
+               public const int isc_spb_options = 108;
+
+               public const int isc_spb_connect_timeout = isc_dpb_connect_timeout;
+               public const int isc_spb_dummy_packet_interval = isc_dpb_dummy_packet_interval;
+               public const int isc_spb_sql_role_name = isc_dpb_sql_role_name;
+
+               public const int isc_spb_num_att = 5;
+               public const int isc_spb_num_db = 6;
+
+               #endregion
+
+               #region Services Actions
+
+               public const int isc_action_svc_backup = 1;     /* Starts database backup process on the server */
+               public const int isc_action_svc_restore = 2;    /* Starts database restore process on the server */
+               public const int isc_action_svc_repair = 3;     /* Starts database repair process on the server */
+               public const int isc_action_svc_add_user = 4;   /* Adds a new user to the security database     */
+               public const int isc_action_svc_delete_user = 5;        /* Deletes a user record from the security database     */
+               public const int isc_action_svc_modify_user = 6;        /* Modifies     a user record in the security database */
+               public const int isc_action_svc_display_user = 7;       /* Displays     a user record from the security database */
+               public const int isc_action_svc_properties = 8; /* Sets database properties     */
+               public const int isc_action_svc_add_license = 9;        /* Adds a license to the license file */
+               public const int isc_action_svc_remove_license = 10;    /* Removes a license from the license file */
+               public const int isc_action_svc_db_stats = 11;  /* Retrieves database statistics */
+               public const int isc_action_svc_get_ib_log = 12;        /* Retrieves the InterBase log file     from the server */
+
+               #endregion
+
+               #region Services Information
+
+               public const int isc_info_svc_svr_db_info = 50; /* Retrieves the number of attachments and databases */
+               public const int isc_info_svc_get_license = 51; /* Retrieves all license keys and IDs from the license file     */
+               public const int isc_info_svc_get_license_mask = 52;    /* Retrieves a bitmask representing     licensed options on     the     server */
+               public const int isc_info_svc_get_config = 53;  /* Retrieves the parameters     and     values for IB_CONFIG */
+               public const int isc_info_svc_version = 54;     /* Retrieves the version of     the     services manager */
+               public const int isc_info_svc_server_version = 55;      /* Retrieves the version of     the     InterBase server */
+               public const int isc_info_svc_implementation = 56;      /* Retrieves the implementation of the InterBase server */
+               public const int isc_info_svc_capabilities = 57;        /* Retrieves a bitmask representing     the     server's capabilities */
+               public const int isc_info_svc_user_dbpath = 58; /* Retrieves the path to the security database in use by the server     */
+               public const int isc_info_svc_get_env = 59;     /* Retrieves the setting of     $INTERBASE */
+               public const int isc_info_svc_get_env_lock = 60;        /* Retrieves the setting of     $INTERBASE_LCK */
+               public const int isc_info_svc_get_env_msg = 61; /* Retrieves the setting of     $INTERBASE_MSG */
+               public const int isc_info_svc_line = 62;        /* Retrieves 1 line     of service output per call */
+               public const int isc_info_svc_to_eof = 63;      /* Retrieves as much of the     server output as will fit in the supplied buffer */
+               public const int isc_info_svc_timeout = 64;     /* Sets / signifies     a timeout value for     reading service information     */
+               public const int isc_info_svc_get_licensed_users = 65;  /* Retrieves the number of users licensed for accessing the     server */
+               public const int isc_info_svc_limbo_trans = 66; /* Retrieve     the     limbo transactions */
+               public const int isc_info_svc_running = 67;     /* Checks to see if     a service is running on an attachment */
+               public const int isc_info_svc_get_users = 68;   /* Returns the user     information     from isc_action_svc_display_users */
+
+               #endregion
+
+               #region Services Properties
+
+               public const int isc_spb_prp_page_buffers = 5;
+               public const int isc_spb_prp_sweep_interval = 6;
+               public const int isc_spb_prp_shutdown_db = 7;
+               public const int isc_spb_prp_deny_new_attachments = 9;
+               public const int isc_spb_prp_deny_new_transactions = 10;
+               public const int isc_spb_prp_reserve_space = 11;
+               public const int isc_spb_prp_write_mode = 12;
+               public const int isc_spb_prp_access_mode = 13;
+               public const int isc_spb_prp_set_sql_dialect = 14;
+
+               // WRITE_MODE_PARAMETERS
+               public const int isc_spb_prp_wm_async = 37;
+               public const int isc_spb_prp_wm_sync = 38;
+
+               // ACCESS_MODE_PARAMETERS
+               public const int isc_spb_prp_am_readonly = 39;
+               public const int isc_spb_prp_am_readwrite = 40;
+
+               // RESERVE_SPACE_PARAMETERS
+               public const int isc_spb_prp_res_use_full = 35;
+               public const int isc_spb_prp_res = 36;
+
+               // Option Flags         
+               public const int isc_spb_prp_activate = 0x0100;
+               public const int isc_spb_prp_db_online = 0x0200;
+
+               #endregion
+
+               #region Backup Service
+
+               public const int isc_spb_bkp_file = 5;
+               public const int isc_spb_bkp_factor = 6;
+               public const int isc_spb_bkp_length = 7;
+
+               #endregion
+
+               #region Restore Service
+
+               public const int isc_spb_res_buffers = 9;
+               public const int isc_spb_res_page_size = 10;
+               public const int isc_spb_res_length = 11;
+               public const int isc_spb_res_access_mode = 12;
+
+               public const int isc_spb_res_am_readonly = isc_spb_prp_am_readonly;
+               public const int isc_spb_res_am_readwrite = isc_spb_prp_am_readwrite;
+
+               #endregion
+
+               #region Repair Service
+
+               public const int isc_spb_rpr_commit_trans = 15;
+               public const int isc_spb_rpr_rollback_trans = 34;
+               public const int isc_spb_rpr_recover_two_phase = 17;
+               public const int isc_spb_tra_id = 18;
+               public const int isc_spb_single_tra_id = 19;
+               public const int isc_spb_multi_tra_id = 20;
+               public const int isc_spb_tra_state = 21;
+               public const int isc_spb_tra_state_limbo = 22;
+               public const int isc_spb_tra_state_commit = 23;
+               public const int isc_spb_tra_state_rollback = 24;
+               public const int isc_spb_tra_state_unknown = 25;
+               public const int isc_spb_tra_host_site = 26;
+               public const int isc_spb_tra_remote_site = 27;
+               public const int isc_spb_tra_db_path = 28;
+               public const int isc_spb_tra_advise = 29;
+               public const int isc_spb_tra_advise_commit = 30;
+               public const int isc_spb_tra_advise_rollback = 31;
+               public const int isc_spb_tra_advise_unknown = 33;
+
+               #endregion
+
+               #region Security Service
+
+               public const int isc_spb_sec_userid = 5;
+               public const int isc_spb_sec_groupid = 6;
+               public const int isc_spb_sec_username = 7;
+               public const int isc_spb_sec_password = 8;
+               public const int isc_spb_sec_groupname = 9;
+               public const int isc_spb_sec_firstname = 10;
+               public const int isc_spb_sec_middlename = 11;
+               public const int isc_spb_sec_lastname = 12;
+
+               #endregion
+
+               #region Configuration Keys
+
+               public const int ISCCFG_LOCKMEM_KEY = 0;
+               public const int ISCCFG_LOCKSEM_KEY = 1;
+               public const int ISCCFG_LOCKSIG_KEY = 2;
+               public const int ISCCFG_EVNTMEM_KEY = 3;
+               public const int ISCCFG_DBCACHE_KEY = 4;
+               public const int ISCCFG_PRIORITY_KEY = 5;
+               public const int ISCCFG_IPCMAP_KEY = 6;
+               public const int ISCCFG_MEMMIN_KEY = 7;
+               public const int ISCCFG_MEMMAX_KEY = 8;
+               public const int ISCCFG_LOCKORDER_KEY = 9;
+               public const int ISCCFG_ANYLOCKMEM_KEY = 10;
+               public const int ISCCFG_ANYLOCKSEM_KEY = 11;
+               public const int ISCCFG_ANYLOCKSIG_KEY = 12;
+               public const int ISCCFG_ANYEVNTMEM_KEY = 13;
+               public const int ISCCFG_LOCKHASH_KEY = 14;
+               public const int ISCCFG_DEADLOCK_KEY = 15;
+               public const int ISCCFG_LOCKSPIN_KEY = 16;
+               public const int ISCCFG_CONN_TIMEOUT_KEY = 17;
+               public const int ISCCFG_DUMMY_INTRVL_KEY = 18;
+               public const int ISCCFG_TRACE_POOLS_KEY = 19; /* Internal Use only      */
+               public const int ISCCFG_REMOTE_BUFFER_KEY = 20;
+
+               #endregion
+
+               #region Common Structural Codes
+
+               public const int isc_info_end = 1;
+               public const int isc_info_truncated = 2;
+               public const int isc_info_error = 3;
+               public const int isc_info_data_not_ready = 4;
+               public const int isc_info_flag_end = 127;
+
+               #endregion
+
+               #region SQL     Information
+
+               public const int isc_info_sql_select = 4;
+               public const int isc_info_sql_bind = 5;
+               public const int isc_info_sql_num_variables = 6;
+               public const int isc_info_sql_describe_vars = 7;
+               public const int isc_info_sql_describe_end = 8;
+               public const int isc_info_sql_sqlda_seq = 9;
+               public const int isc_info_sql_message_seq = 10;
+               public const int isc_info_sql_type = 11;
+               public const int isc_info_sql_sub_type = 12;
+               public const int isc_info_sql_scale = 13;
+               public const int isc_info_sql_length = 14;
+               public const int isc_info_sql_null_ind = 15;
+               public const int isc_info_sql_field = 16;
+               public const int isc_info_sql_relation = 17;
+               public const int isc_info_sql_owner = 18;
+               public const int isc_info_sql_alias = 19;
+               public const int isc_info_sql_sqlda_start = 20;
+               public const int isc_info_sql_stmt_type = 21;
+               public const int isc_info_sql_get_plan = 22;
+               public const int isc_info_sql_records = 23;
+               public const int isc_info_sql_batch_fetch = 24;
+               public const int isc_info_sql_relation_alias = 25;
+
+               #endregion
+
+               #region SQL     Information     Return Values
+
+               public const int isc_info_sql_stmt_select = 1;
+               public const int isc_info_sql_stmt_insert = 2;
+               public const int isc_info_sql_stmt_update = 3;
+               public const int isc_info_sql_stmt_delete = 4;
+               public const int isc_info_sql_stmt_ddl = 5;
+               public const int isc_info_sql_stmt_get_segment = 6;
+               public const int isc_info_sql_stmt_put_segment = 7;
+               public const int isc_info_sql_stmt_exec_procedure = 8;
+               public const int isc_info_sql_stmt_start_trans = 9;
+               public const int isc_info_sql_stmt_commit = 10;
+               public const int isc_info_sql_stmt_rollback = 11;
+               public const int isc_info_sql_stmt_select_for_upd = 12;
+               public const int isc_info_sql_stmt_set_generator = 13;
+               public const int isc_info_sql_stmt_savepoint = 14;
+
+               #endregion
+
+               #region Database Information
+
+               public const int isc_info_db_id = 4;
+               public const int isc_info_reads = 5;
+               public const int isc_info_writes = 6;
+               public const int isc_info_fetches = 7;
+               public const int isc_info_marks = 8;
+
+               public const int isc_info_implementation = 11;
+               public const int isc_info_isc_version = 12;
+               public const int isc_info_base_level = 13;
+               public const int isc_info_page_size = 14;
+               public const int isc_info_num_buffers = 15;
+               public const int isc_info_limbo = 16;
+               public const int isc_info_current_memory = 17;
+               public const int isc_info_max_memory = 18;
+               public const int isc_info_window_turns = 19;
+               public const int isc_info_license = 20;
+
+               public const int isc_info_allocation = 21;
+               public const int isc_info_attachment_id = 22;
+               public const int isc_info_read_seq_count = 23;
+               public const int isc_info_read_idx_count = 24;
+               public const int isc_info_insert_count = 25;
+               public const int isc_info_update_count = 26;
+               public const int isc_info_delete_count = 27;
+               public const int isc_info_backout_count = 28;
+               public const int isc_info_purge_count = 29;
+               public const int isc_info_expunge_count = 30;
+
+               public const int isc_info_sweep_interval = 31;
+               public const int isc_info_ods_version = 32;
+               public const int isc_info_ods_minor_version = 33;
+               public const int isc_info_no_reserve = 34;
+               public const int isc_info_logfile = 35;
+               public const int isc_info_cur_logfile_name = 36;
+               public const int isc_info_cur_log_part_offset = 37;
+               public const int isc_info_num_wal_buffers = 38;
+               public const int isc_info_wal_buffer_size = 39;
+               public const int isc_info_wal_ckpt_length = 40;
+
+               public const int isc_info_wal_cur_ckpt_interval = 41;
+               public const int isc_info_wal_prv_ckpt_fname = 42;
+               public const int isc_info_wal_prv_ckpt_poffset = 43;
+               public const int isc_info_wal_recv_ckpt_fname = 44;
+               public const int isc_info_wal_recv_ckpt_poffset = 45;
+               public const int isc_info_wal_grpc_wait_usecs = 47;
+               public const int isc_info_wal_num_io = 48;
+               public const int isc_info_wal_avg_io_size = 49;
+               public const int isc_info_wal_num_commits = 50;
+
+               public const int isc_info_wal_avg_grpc_size = 51;
+               public const int isc_info_forced_writes = 52;
+               public const int isc_info_user_names = 53;
+               public const int isc_info_page_errors = 54;
+               public const int isc_info_record_errors = 55;
+               public const int isc_info_bpage_errors = 56;
+               public const int isc_info_dpage_errors = 57;
+               public const int isc_info_ipage_errors = 58;
+               public const int isc_info_ppage_errors = 59;
+               public const int isc_info_tpage_errors = 60;
+
+               public const int isc_info_set_page_buffers = 61;
+               public const int isc_info_db_sql_dialect = 62;
+               public const int isc_info_db_read_only = 63;
+               public const int isc_info_db_size_in_pages = 64;
+
+               /* Values 65 -100 unused to     avoid conflict with     InterBase */
+
+               public const int frb_info_att_charset = 101;
+               public const int isc_info_db_class = 102;
+               public const int isc_info_firebird_version = 103;
+               public const int isc_info_oldest_transaction = 104;
+               public const int isc_info_oldest_active = 105;
+               public const int isc_info_oldest_snapshot = 106;
+               public const int isc_info_next_transaction = 107;
+               public const int isc_info_db_provider = 108;
+               public const int isc_info_active_transactions = 109;
+
+               #endregion
+
+               #region Information     Request
+
+               public const int isc_info_number_messages = 4;
+               public const int isc_info_max_message = 5;
+               public const int isc_info_max_send = 6;
+               public const int isc_info_max_receive = 7;
+               public const int isc_info_state = 8;
+               public const int isc_info_message_number = 9;
+               public const int isc_info_message_size = 10;
+               public const int isc_info_request_cost = 11;
+               public const int isc_info_access_path = 12;
+               public const int isc_info_req_select_count = 13;
+               public const int isc_info_req_insert_count = 14;
+               public const int isc_info_req_update_count = 15;
+               public const int isc_info_req_delete_count = 16;
+
+               #endregion
+
+               #region Array Slice     Description     Language
+
+               public const int isc_sdl_version1 = 1;
+               public const int isc_sdl_eoc = 255;
+               public const int isc_sdl_relation = 2;
+               public const int isc_sdl_rid = 3;
+               public const int isc_sdl_field = 4;
+               public const int isc_sdl_fid = 5;
+               public const int isc_sdl_struct = 6;
+               public const int isc_sdl_variable = 7;
+               public const int isc_sdl_scalar = 8;
+               public const int isc_sdl_tiny_integer = 9;
+               public const int isc_sdl_short_integer = 10;
+               public const int isc_sdl_long_integer = 11;
+               public const int isc_sdl_literal = 12;
+               public const int isc_sdl_add = 13;
+               public const int isc_sdl_subtract = 14;
+               public const int isc_sdl_multiply = 15;
+               public const int isc_sdl_divide = 16;
+               public const int isc_sdl_negate = 17;
+               public const int isc_sdl_eql = 18;
+               public const int isc_sdl_neq = 19;
+               public const int isc_sdl_gtr = 20;
+               public const int isc_sdl_geq = 21;
+               public const int isc_sdl_lss = 22;
+               public const int isc_sdl_leq = 23;
+               public const int isc_sdl_and = 24;
+               public const int isc_sdl_or = 25;
+               public const int isc_sdl_not = 26;
+               public const int isc_sdl_while = 27;
+               public const int isc_sdl_assignment = 28;
+               public const int isc_sdl_label = 29;
+               public const int isc_sdl_leave = 30;
+               public const int isc_sdl_begin = 31;
+               public const int isc_sdl_end = 32;
+               public const int isc_sdl_do3 = 33;
+               public const int isc_sdl_do2 = 34;
+               public const int isc_sdl_do1 = 35;
+               public const int isc_sdl_element = 36;
+
+               #endregion
+
+               #region Blob Parametr Block
+
+               public const int isc_bpb_version1 = 1;
+               public const int isc_bpb_source_type = 1;
+               public const int isc_bpb_target_type = 2;
+               public const int isc_bpb_type = 3;
+               public const int isc_bpb_source_interp = 4;
+               public const int isc_bpb_target_interp = 5;
+               public const int isc_bpb_filter_parameter = 6;
+
+               public const int isc_bpb_type_segmented = 0;
+               public const int isc_bpb_type_stream = 1;
+
+               public const int RBL_eof = 1;
+               public const int RBL_segment = 2;
+               public const int RBL_eof_pending = 4;
+               public const int RBL_create = 8;
+
+               #endregion
+
+               #region Blob Information
+
+               public const int isc_info_blob_num_segments = 4;
+               public const int isc_info_blob_max_segment = 5;
+               public const int isc_info_blob_total_length = 6;
+               public const int isc_info_blob_type = 7;
+
+               #endregion
+
+               #region Event Codes
+
+               public const int P_REQ_async = 1;       // Auxiliary asynchronous port
+               public const int EPB_version1 = 1;
+
+               #endregion
+
+               #region Facilities
+
+               public const int JRD = 0;
+               public const int GFIX = 3;
+               public const int DSQL = 7;
+               public const int DYN = 8;
+               public const int GBAK = 12;
+               public const int GDEC = 18;
+               public const int LICENSE = 19;
+               public const int GSTAT = 21;
+
+               #endregion
+
+               #region Error code generation
+
+               public const int ISC_MASK = 0x14000000; // Defines the code     as a valid ISC code
+
+               #endregion
+
+               #region ISC     Error codes
+
+               public const int isc_facility = 20;
+               public const int isc_err_base = 335544320;
+               public const int isc_err_factor = 1;
+               public const int isc_arg_end = 0;       // end of argument list
+               public const int isc_arg_gds = 1;       // generic DSRI status value
+               public const int isc_arg_string = 2;    // string argument
+               public const int isc_arg_cstring = 3;   // count & string argument
+               public const int isc_arg_number = 4;    // numeric argument     (long)
+               public const int isc_arg_interpreted = 5;       // interpreted status code (string)
+               public const int isc_arg_vms = 6;       // VAX/VMS status code (long)
+               public const int isc_arg_unix = 7;      // UNIX error code
+               public const int isc_arg_domain = 8;    // Apollo/Domain error code
+               public const int isc_arg_dos = 9;       // MSDOS/OS2 error code
+               public const int isc_arg_mpexl = 10;    // HP MPE/XL error code
+               public const int isc_arg_mpexl_ipc = 11;        // HP MPE/XL IPC error code
+               public const int isc_arg_next_mach = 15;        // NeXT/Mach error code
+               public const int isc_arg_netware = 16;  // NetWare error code
+               public const int isc_arg_win32 = 17;    // Win32 error code
+               public const int isc_arg_warning = 18;  // warning argument
+
+               public const int isc_arith_except = 335544321;
+               public const int isc_bad_dbkey = 335544322;
+               public const int isc_bad_db_format = 335544323;
+               public const int isc_bad_db_handle = 335544324;
+               public const int isc_bad_dpb_content = 335544325;
+               public const int isc_bad_dpb_form = 335544326;
+               public const int isc_bad_req_handle = 335544327;
+               public const int isc_bad_segstr_handle = 335544328;
+               public const int isc_bad_segstr_id = 335544329;
+               public const int isc_bad_tpb_content = 335544330;
+               public const int isc_bad_tpb_form = 335544331;
+               public const int isc_bad_trans_handle = 335544332;
+               public const int isc_bug_check = 335544333;
+               public const int isc_convert_error = 335544334;
+               public const int isc_db_corrupt = 335544335;
+               public const int isc_deadlock = 335544336;
+               public const int isc_excess_trans = 335544337;
+               public const int isc_from_no_match = 335544338;
+               public const int isc_infinap = 335544339;
+               public const int isc_infona = 335544340;
+               public const int isc_infunk = 335544341;
+               public const int isc_integ_fail = 335544342;
+               public const int isc_invalid_blr = 335544343;
+               public const int isc_io_error = 335544344;
+               public const int isc_lock_conflict = 335544345;
+               public const int isc_metadata_corrupt = 335544346;
+               public const int isc_not_valid = 335544347;
+               public const int isc_no_cur_rec = 335544348;
+               public const int isc_no_dup = 335544349;
+               public const int isc_no_finish = 335544350;
+               public const int isc_no_meta_update = 335544351;
+               public const int isc_no_priv = 335544352;
+               public const int isc_no_recon = 335544353;
+               public const int isc_no_record = 335544354;
+               public const int isc_no_segstr_close = 335544355;
+               public const int isc_obsolete_metadata = 335544356;
+               public const int isc_open_trans = 335544357;
+               public const int isc_port_len = 335544358;
+               public const int isc_read_only_field = 335544359;
+               public const int isc_read_only_rel = 335544360;
+               public const int isc_read_only_trans = 335544361;
+               public const int isc_read_only_view = 335544362;
+               public const int isc_req_no_trans = 335544363;
+               public const int isc_req_sync = 335544364;
+               public const int isc_req_wrong_db = 335544365;
+               public const int isc_segment = 335544366;
+               public const int isc_segstr_eof = 335544367;
+               public const int isc_segstr_no_op = 335544368;
+               public const int isc_segstr_no_read = 335544369;
+               public const int isc_segstr_no_trans = 335544370;
+               public const int isc_segstr_no_write = 335544371;
+               public const int isc_segstr_wrong_db = 335544372;
+               public const int isc_sys_request = 335544373;
+               public const int isc_stream_eof = 335544374;
+               public const int isc_unavailable = 335544375;
+               public const int isc_unres_rel = 335544376;
+               public const int isc_uns_ext = 335544377;
+               public const int isc_wish_list = 335544378;
+               public const int isc_wrong_ods = 335544379;
+               public const int isc_wronumarg = 335544380;
+               public const int isc_imp_exc = 335544381;
+               public const int isc_random = 335544382;
+               public const int isc_fatal_conflict = 335544383;
+               public const int isc_badblk = 335544384;
+               public const int isc_invpoolcl = 335544385;
+               public const int isc_nopoolids = 335544386;
+               public const int isc_relbadblk = 335544387;
+               public const int isc_blktoobig = 335544388;
+               public const int isc_bufexh = 335544389;
+               public const int isc_syntaxerr = 335544390;
+               public const int isc_bufinuse = 335544391;
+               public const int isc_bdbincon = 335544392;
+               public const int isc_reqinuse = 335544393;
+               public const int isc_badodsver = 335544394;
+               public const int isc_relnotdef = 335544395;
+               public const int isc_fldnotdef = 335544396;
+               public const int isc_dirtypage = 335544397;
+               public const int isc_waifortra = 335544398;
+               public const int isc_doubleloc = 335544399;
+               public const int isc_nodnotfnd = 335544400;
+               public const int isc_dupnodfnd = 335544401;
+               public const int isc_locnotmar = 335544402;
+               public const int isc_badpagtyp = 335544403;
+               public const int isc_corrupt = 335544404;
+               public const int isc_badpage = 335544405;
+               public const int isc_badindex = 335544406;
+               public const int isc_dbbnotzer = 335544407;
+               public const int isc_tranotzer = 335544408;
+               public const int isc_trareqmis = 335544409;
+               public const int isc_badhndcnt = 335544410;
+               public const int isc_wrotpbver = 335544411;
+               public const int isc_wroblrver = 335544412;
+               public const int isc_wrodpbver = 335544413;
+               public const int isc_blobnotsup = 335544414;
+               public const int isc_badrelation = 335544415;
+               public const int isc_nodetach = 335544416;
+               public const int isc_notremote = 335544417;
+               public const int isc_trainlim = 335544418;
+               public const int isc_notinlim = 335544419;
+               public const int isc_traoutsta = 335544420;
+               public const int isc_connect_reject = 335544421;
+               public const int isc_dbfile = 335544422;
+               public const int isc_orphan = 335544423;
+               public const int isc_no_lock_mgr = 335544424;
+               public const int isc_ctxinuse = 335544425;
+               public const int isc_ctxnotdef = 335544426;
+               public const int isc_datnotsup = 335544427;
+               public const int isc_badmsgnum = 335544428;
+               public const int isc_badparnum = 335544429;
+               public const int isc_virmemexh = 335544430;
+               public const int isc_blocking_signal = 335544431;
+               public const int isc_lockmanerr = 335544432;
+               public const int isc_journerr = 335544433;
+               public const int isc_keytoobig = 335544434;
+               public const int isc_nullsegkey = 335544435;
+               public const int isc_sqlerr = 335544436;
+               public const int isc_wrodynver = 335544437;
+               public const int isc_funnotdef = 335544438;
+               public const int isc_funmismat = 335544439;
+               public const int isc_bad_msg_vec = 335544440;
+               public const int isc_bad_detach = 335544441;
+               public const int isc_noargacc_read = 335544442;
+               public const int isc_noargacc_write = 335544443;
+               public const int isc_read_only = 335544444;
+               public const int isc_ext_err = 335544445;
+               public const int isc_non_updatable = 335544446;
+               public const int isc_no_rollback = 335544447;
+               public const int isc_bad_sec_info = 335544448;
+               public const int isc_invalid_sec_info = 335544449;
+               public const int isc_misc_interpreted = 335544450;
+               public const int isc_update_conflict = 335544451;
+               public const int isc_unlicensed = 335544452;
+               public const int isc_obj_in_use = 335544453;
+               public const int isc_nofilter = 335544454;
+               public const int isc_shadow_accessed = 335544455;
+               public const int isc_invalid_sdl = 335544456;
+               public const int isc_out_of_bounds = 335544457;
+               public const int isc_invalid_dimension = 335544458;
+               public const int isc_rec_in_limbo = 335544459;
+               public const int isc_shadow_missing = 335544460;
+               public const int isc_cant_validate = 335544461;
+               public const int isc_cant_start_journal = 335544462;
+               public const int isc_gennotdef = 335544463;
+               public const int isc_cant_start_logging = 335544464;
+               public const int isc_bad_segstr_type = 335544465;
+               public const int isc_foreign_key = 335544466;
+               public const int isc_high_minor = 335544467;
+               public const int isc_tra_state = 335544468;
+               public const int isc_trans_invalid = 335544469;
+               public const int isc_buf_invalid = 335544470;
+               public const int isc_indexnotdefined = 335544471;
+               public const int isc_login = 335544472;
+               public const int isc_invalid_bookmark = 335544473;
+               public const int isc_bad_lock_level = 335544474;
+               public const int isc_relation_lock = 335544475;
+               public const int isc_record_lock = 335544476;
+               public const int isc_max_idx = 335544477;
+               public const int isc_jrn_enable = 335544478;
+               public const int isc_old_failure = 335544479;
+               public const int isc_old_in_progress = 335544480;
+               public const int isc_old_no_space = 335544481;
+               public const int isc_no_wal_no_jrn = 335544482;
+               public const int isc_num_old_files = 335544483;
+               public const int isc_wal_file_open = 335544484;
+               public const int isc_bad_stmt_handle = 335544485;
+               public const int isc_wal_failure = 335544486;
+               public const int isc_walw_err = 335544487;
+               public const int isc_logh_small = 335544488;
+               public const int isc_logh_inv_version = 335544489;
+               public const int isc_logh_open_flag = 335544490;
+               public const int isc_logh_open_flag2 = 335544491;
+               public const int isc_logh_diff_dbname = 335544492;
+               public const int isc_logf_unexpected_eof = 335544493;
+               public const int isc_logr_incomplete = 335544494;
+               public const int isc_logr_header_small = 335544495;
+               public const int isc_logb_small = 335544496;
+               public const int isc_wal_illegal_attach = 335544497;
+               public const int isc_wal_invalid_wpb = 335544498;
+               public const int isc_wal_err_rollover = 335544499;
+               public const int isc_no_wal = 335544500;
+               public const int isc_drop_wal = 335544501;
+               public const int isc_stream_not_defined = 335544502;
+               public const int isc_wal_subsys_error = 335544503;
+               public const int isc_wal_subsys_corrupt = 335544504;
+               public const int isc_no_archive = 335544505;
+               public const int isc_shutinprog = 335544506;
+               public const int isc_range_in_use = 335544507;
+               public const int isc_range_not_found = 335544508;
+               public const int isc_charset_not_found = 335544509;
+               public const int isc_lock_timeout = 335544510;
+               public const int isc_prcnotdef = 335544511;
+               public const int isc_prcmismat = 335544512;
+               public const int isc_wal_bugcheck = 335544513;
+               public const int isc_wal_cant_expand = 335544514;
+               public const int isc_codnotdef = 335544515;
+               public const int isc_xcpnotdef = 335544516;
+               public const int isc_except = 335544517;
+               public const int isc_cache_restart = 335544518;
+               public const int isc_bad_lock_handle = 335544519;
+               public const int isc_jrn_present = 335544520;
+               public const int isc_wal_err_rollover2 = 335544521;
+               public const int isc_wal_err_logwrite = 335544522;
+               public const int isc_wal_err_jrn_comm = 335544523;
+               public const int isc_wal_err_expansion = 335544524;
+               public const int isc_wal_err_setup = 335544525;
+               public const int isc_wal_err_ww_sync = 335544526;
+               public const int isc_wal_err_ww_start = 335544527;
+               public const int isc_shutdown = 335544528;
+               public const int isc_existing_priv_mod = 335544529;
+               public const int isc_primary_key_ref = 335544530;
+               public const int isc_primary_key_notnull = 335544531;
+               public const int isc_ref_cnstrnt_notfound = 335544532;
+               public const int isc_foreign_key_notfound = 335544533;
+               public const int isc_ref_cnstrnt_update = 335544534;
+               public const int isc_check_cnstrnt_update = 335544535;
+               public const int isc_check_cnstrnt_del = 335544536;
+               public const int isc_integ_index_seg_del = 335544537;
+               public const int isc_integ_index_seg_mod = 335544538;
+               public const int isc_integ_index_del = 335544539;
+               public const int isc_integ_index_mod = 335544540;
+               public const int isc_check_trig_del = 335544541;
+               public const int isc_check_trig_update = 335544542;
+               public const int isc_cnstrnt_fld_del = 335544543;
+               public const int isc_cnstrnt_fld_rename = 335544544;
+               public const int isc_rel_cnstrnt_update = 335544545;
+               public const int isc_constaint_on_view = 335544546;
+               public const int isc_invld_cnstrnt_type = 335544547;
+               public const int isc_primary_key_exists = 335544548;
+               public const int isc_systrig_update = 335544549;
+               public const int isc_not_rel_owner = 335544550;
+               public const int isc_grant_obj_notfound = 335544551;
+               public const int isc_grant_fld_notfound = 335544552;
+               public const int isc_grant_nopriv = 335544553;
+               public const int isc_nonsql_security_rel = 335544554;
+               public const int isc_nonsql_security_fld = 335544555;
+               public const int isc_wal_cache_err = 335544556;
+               public const int isc_shutfail = 335544557;
+               public const int isc_check_constraint = 335544558;
+               public const int isc_bad_svc_handle = 335544559;
+               public const int isc_shutwarn = 335544560;
+               public const int isc_wrospbver = 335544561;
+               public const int isc_bad_spb_form = 335544562;
+               public const int isc_svcnotdef = 335544563;
+               public const int isc_no_jrn = 335544564;
+               public const int isc_transliteration_failed = 335544565;
+               public const int isc_start_cm_for_wal = 335544566;
+               public const int isc_wal_ovflow_log_required = 335544567;
+               public const int isc_text_subtype = 335544568;
+               public const int isc_dsql_error = 335544569;
+               public const int isc_dsql_command_err = 335544570;
+               public const int isc_dsql_constant_err = 335544571;
+               public const int isc_dsql_cursor_err = 335544572;
+               public const int isc_dsql_datatype_err = 335544573;
+               public const int isc_dsql_decl_err = 335544574;
+               public const int isc_dsql_cursor_update_err = 335544575;
+               public const int isc_dsql_cursor_open_err = 335544576;
+               public const int isc_dsql_cursor_close_err = 335544577;
+               public const int isc_dsql_field_err = 335544578;
+               public const int isc_dsql_internal_err = 335544579;
+               public const int isc_dsql_relation_err = 335544580;
+               public const int isc_dsql_procedure_err = 335544581;
+               public const int isc_dsql_request_err = 335544582;
+               public const int isc_dsql_sqlda_err = 335544583;
+               public const int isc_dsql_var_count_err = 335544584;
+               public const int isc_dsql_stmt_handle = 335544585;
+               public const int isc_dsql_function_err = 335544586;
+               public const int isc_dsql_blob_err = 335544587;
+               public const int isc_collation_not_found = 335544588;
+               public const int isc_collation_not_for_charset = 335544589;
+               public const int isc_dsql_dup_option = 335544590;
+               public const int isc_dsql_tran_err = 335544591;
+               public const int isc_dsql_invalid_array = 335544592;
+               public const int isc_dsql_max_arr_dim_exceeded = 335544593;
+               public const int isc_dsql_arr_range_error = 335544594;
+               public const int isc_dsql_trigger_err = 335544595;
+               public const int isc_dsql_subselect_err = 335544596;
+               public const int isc_dsql_crdb_prepare_err = 335544597;
+               public const int isc_specify_field_err = 335544598;
+               public const int isc_num_field_err = 335544599;
+               public const int isc_col_name_err = 335544600;
+               public const int isc_where_err = 335544601;
+               public const int isc_table_view_err = 335544602;
+               public const int isc_distinct_err = 335544603;
+               public const int isc_key_field_count_err = 335544604;
+               public const int isc_subquery_err = 335544605;
+               public const int isc_expression_eval_err = 335544606;
+               public const int isc_node_err = 335544607;
+               public const int isc_command_end_err = 335544608;
+               public const int isc_index_name = 335544609;
+               public const int isc_exception_name = 335544610;
+               public const int isc_field_name = 335544611;
+               public const int isc_token_err = 335544612;
+               public const int isc_union_err = 335544613;
+               public const int isc_dsql_construct_err = 335544614;
+               public const int isc_field_aggregate_err = 335544615;
+               public const int isc_field_ref_err = 335544616;
+               public const int isc_order_by_err = 335544617;
+               public const int isc_return_mode_err = 335544618;
+               public const int isc_extern_func_err = 335544619;
+               public const int isc_alias_conflict_err = 335544620;
+               public const int isc_procedure_conflict_error = 335544621;
+               public const int isc_relation_conflict_err = 335544622;
+               public const int isc_dsql_domain_err = 335544623;
+               public const int isc_idx_seg_err = 335544624;
+               public const int isc_node_name_err = 335544625;
+               public const int isc_table_name = 335544626;
+               public const int isc_proc_name = 335544627;
+               public const int isc_idx_create_err = 335544628;
+               public const int isc_wal_shadow_err = 335544629;
+               public const int isc_dependency = 335544630;
+               public const int isc_idx_key_err = 335544631;
+               public const int isc_dsql_file_length_err = 335544632;
+               public const int isc_dsql_shadow_number_err = 335544633;
+               public const int isc_dsql_token_unk_err = 335544634;
+               public const int isc_dsql_no_relation_alias = 335544635;
+               public const int isc_indexname = 335544636;
+               public const int isc_no_stream_plan = 335544637;
+               public const int isc_stream_twice = 335544638;
+               public const int isc_stream_not_found = 335544639;
+               public const int isc_collation_requires_text = 335544640;
+               public const int isc_dsql_domain_not_found = 335544641;
+               public const int isc_index_unused = 335544642;
+               public const int isc_dsql_self_join = 335544643;
+               public const int isc_stream_bof = 335544644;
+               public const int isc_stream_crack = 335544645;
+               public const int isc_db_or_file_exists = 335544646;
+               public const int isc_invalid_operator = 335544647;
+               public const int isc_conn_lost = 335544648;
+               public const int isc_bad_checksum = 335544649;
+               public const int isc_page_type_err = 335544650;
+               public const int isc_ext_readonly_err = 335544651;
+               public const int isc_sing_select_err = 335544652;
+               public const int isc_psw_attach = 335544653;
+               public const int isc_psw_start_trans = 335544654;
+               public const int isc_invalid_direction = 335544655;
+               public const int isc_dsql_var_conflict = 335544656;
+               public const int isc_dsql_no_blob_array = 335544657;
+               public const int isc_dsql_base_table = 335544658;
+               public const int isc_duplicate_base_table = 335544659;
+               public const int isc_view_alias = 335544660;
+               public const int isc_index_root_page_full = 335544661;
+               public const int isc_dsql_blob_type_unknown = 335544662;
+               public const int isc_req_max_clones_exceeded = 335544663;
+               public const int isc_dsql_duplicate_spec = 335544664;
+               public const int isc_unique_key_violation = 335544665;
+               public const int isc_srvr_version_too_old = 335544666;
+               public const int isc_drdb_completed_with_errs = 335544667;
+               public const int isc_dsql_procedure_use_err = 335544668;
+               public const int isc_dsql_count_mismatch = 335544669;
+               public const int isc_blob_idx_err = 335544670;
+               public const int isc_array_idx_err = 335544671;
+               public const int isc_key_field_err = 335544672;
+               public const int isc_no_delete = 335544673;
+               public const int isc_del_last_field = 335544674;
+               public const int isc_sort_err = 335544675;
+               public const int isc_sort_mem_err = 335544676;
+               public const int isc_version_err = 335544677;
+               public const int isc_inval_key_posn = 335544678;
+               public const int isc_no_segments_err = 335544679;
+               public const int isc_crrp_data_err = 335544680;
+               public const int isc_rec_size_err = 335544681;
+               public const int isc_dsql_field_ref = 335544682;
+               public const int isc_req_depth_exceeded = 335544683;
+               public const int isc_no_field_access = 335544684;
+               public const int isc_no_dbkey = 335544685;
+               public const int isc_jrn_format_err = 335544686;
+               public const int isc_jrn_file_full = 335544687;
+               public const int isc_dsql_open_cursor_request = 335544688;
+               public const int isc_ib_error = 335544689;
+               public const int isc_cache_redef = 335544690;
+               public const int isc_cache_too_small = 335544691;
+               public const int isc_log_redef = 335544692;
+               public const int isc_log_too_small = 335544693;
+               public const int isc_partition_too_small = 335544694;
+               public const int isc_partition_not_supp = 335544695;
+               public const int isc_log_length_spec = 335544696;
+               public const int isc_precision_err = 335544697;
+               public const int isc_scale_nogt = 335544698;
+               public const int isc_expec_int = 335544699;
+               public const int isc_expec_long = 335544700;
+               public const int isc_expec_uint = 335544701;
+               public const int isc_like_escape_invalid = 335544702;
+               public const int isc_svcnoexe = 335544703;
+               public const int isc_net_lookup_err = 335544704;
+               public const int isc_service_unknown = 335544705;
+               public const int isc_host_unknown = 335544706;
+               public const int isc_grant_nopriv_on_base = 335544707;
+               public const int isc_dyn_fld_ambiguous = 335544708;
+               public const int isc_dsql_agg_ref_err = 335544709;
+               public const int isc_complex_view = 335544710;
+               public const int isc_unprepared_stmt = 335544711;
+               public const int isc_expec_positive = 335544712;
+               public const int isc_dsql_sqlda_value_err = 335544713;
+               public const int isc_invalid_array_id = 335544714;
+               public const int isc_extfile_uns_op = 335544715;
+               public const int isc_svc_in_use = 335544716;
+               public const int isc_err_stack_limit = 335544717;
+               public const int isc_invalid_key = 335544718;
+               public const int isc_net_init_error = 335544719;
+               public const int isc_loadlib_failure = 335544720;
+               public const int isc_network_error = 335544721;
+               public const int isc_net_connect_err = 335544722;
+               public const int isc_net_connect_listen_err = 335544723;
+               public const int isc_net_event_connect_err = 335544724;
+               public const int isc_net_event_listen_err = 335544725;
+               public const int isc_net_read_err = 335544726;
+               public const int isc_net_write_err = 335544727;
+               public const int isc_integ_index_deactivate = 335544728;
+               public const int isc_integ_deactivate_primary = 335544729;
+               public const int isc_cse_not_supported = 335544730;
+               public const int isc_tra_must_sweep = 335544731;
+               public const int isc_unsupported_network_drive = 335544732;
+               public const int isc_io_create_err = 335544733;
+               public const int isc_io_open_err = 335544734;
+               public const int isc_io_close_err = 335544735;
+               public const int isc_io_read_err = 335544736;
+               public const int isc_io_write_err = 335544737;
+               public const int isc_io_delete_err = 335544738;
+               public const int isc_io_access_err = 335544739;
+               public const int isc_udf_exception = 335544740;
+               public const int isc_lost_db_connection = 335544741;
+               public const int isc_no_write_user_priv = 335544742;
+               public const int isc_token_too_long = 335544743;
+               public const int isc_max_att_exceeded = 335544744;
+               public const int isc_login_same_as_role_name = 335544745;
+               public const int isc_reftable_requires_pk = 335544746;
+               public const int isc_usrname_too_long = 335544747;
+               public const int isc_password_too_long = 335544748;
+               public const int isc_usrname_required = 335544749;
+               public const int isc_password_required = 335544750;
+               public const int isc_bad_protocol = 335544751;
+               public const int isc_dup_usrname_found = 335544752;
+               public const int isc_usrname_not_found = 335544753;
+               public const int isc_error_adding_sec_record = 335544754;
+               public const int isc_error_modifying_sec_record = 335544755;
+               public const int isc_error_deleting_sec_record = 335544756;
+               public const int isc_error_updating_sec_db = 335544757;
+               public const int isc_sort_rec_size_err = 335544758;
+               public const int isc_bad_default_value = 335544759;
+               public const int isc_invalid_clause = 335544760;
+               public const int isc_too_many_handles = 335544761;
+               public const int isc_optimizer_blk_exc = 335544762;
+               public const int isc_invalid_string_constant = 335544763;
+               public const int isc_transitional_date = 335544764;
+               public const int isc_read_only_database = 335544765;
+               public const int isc_must_be_dialect_2_and_up = 335544766;
+               public const int isc_blob_filter_exception = 335544767;
+               public const int isc_exception_access_violation = 335544768;
+               public const int isc_exception_datatype_missalignment = 335544769;
+               public const int isc_exception_array_bounds_exceeded = 335544770;
+               public const int isc_exception_float_denormal_operand = 335544771;
+               public const int isc_exception_float_divide_by_zero = 335544772;
+               public const int isc_exception_float_inexact_result = 335544773;
+               public const int isc_exception_float_invalid_operand = 335544774;
+               public const int isc_exception_float_overflow = 335544775;
+               public const int isc_exception_float_stack_check = 335544776;
+               public const int isc_exception_float_underflow = 335544777;
+               public const int isc_exception_int_divide_by_zero = 335544778;
+               public const int isc_exception_int_overflow = 335544779;
+               public const int isc_exception_unknown = 335544780;
+               public const int isc_exception_stack_overflow = 335544781;
+               public const int isc_exception_sigsegv = 335544782;
+               public const int isc_exception_sigill = 335544783;
+               public const int isc_exception_sigbus = 335544784;
+               public const int isc_exception_sigfpe = 335544785;
+               public const int isc_ext_file_delete = 335544786;
+               public const int isc_ext_file_modify = 335544787;
+               public const int isc_adm_task_denied = 335544788;
+               public const int isc_extract_input_mismatch = 335544789;
+               public const int isc_insufficient_svc_privileges = 335544790;
+               public const int isc_file_in_use = 335544791;
+               public const int isc_service_att_err = 335544792;
+               public const int isc_ddl_not_allowed_by_db_sql_dial = 335544793;
+               public const int isc_cancelled = 335544794;
+               public const int isc_unexp_spb_form = 335544795;
+               public const int isc_sql_dialect_datatype_unsupport = 335544796;
+               public const int isc_svcnouser = 335544797;
+               public const int isc_depend_on_uncommitted_rel = 335544798;
+               public const int isc_svc_name_missing = 335544799;
+               public const int isc_too_many_contexts = 335544800;
+               public const int isc_datype_notsup = 335544801;
+               public const int isc_dialect_reset_warning = 335544802;
+               public const int isc_dialect_not_changed = 335544803;
+               public const int isc_database_create_failed = 335544804;
+               public const int isc_inv_dialect_specified = 335544805;
+               public const int isc_valid_db_dialects = 335544806;
+               public const int isc_sqlwarn = 335544807;
+               public const int isc_dtype_renamed = 335544808;
+               public const int isc_extern_func_dir_error = 335544809;
+               public const int isc_date_range_exceeded = 335544810;
+               public const int isc_inv_client_dialect_specified = 335544811;
+               public const int isc_valid_client_dialects = 335544812;
+               public const int isc_optimizer_between_err = 335544813;
+               public const int isc_service_not_supported = 335544814;
+               public const int isc_generator_name = 335544815;
+               public const int isc_udf_name = 335544816;
+               public const int isc_bad_limit_param = 335544817;
+               public const int isc_bad_skip_param = 335544818;
+               public const int isc_io_32bit_exceeded_err = 335544819;
+               public const int isc_invalid_savepoint = 335544820;
+               public const int isc_dsql_column_pos_err = 335544821;
+               public const int isc_dsql_agg_where_err = 335544822;
+               public const int isc_dsql_agg_group_err = 335544823;
+               public const int isc_dsql_agg_column_err = 335544824;
+               public const int isc_dsql_agg_having_err = 335544825;
+               public const int isc_dsql_agg_nested_err = 335544826;
+               public const int isc_exec_sql_invalid_arg = 335544827;
+               public const int isc_exec_sql_invalid_req = 335544828;
+               public const int isc_exec_sql_invalid_var = 335544829;
+               public const int isc_exec_sql_max_call_exceeded = 335544830;
+               public const int isc_conf_access_denied = 335544831;
+               public const int isc_gfix_db_name = 335740929;
+               public const int isc_gfix_invalid_sw = 335740930;
+               public const int isc_gfix_incmp_sw = 335740932;
+               public const int isc_gfix_replay_req = 335740933;
+               public const int isc_gfix_pgbuf_req = 335740934;
+               public const int isc_gfix_val_req = 335740935;
+               public const int isc_gfix_pval_req = 335740936;
+               public const int isc_gfix_trn_req = 335740937;
+               public const int isc_gfix_full_req = 335740940;
+               public const int isc_gfix_usrname_req = 335740941;
+               public const int isc_gfix_pass_req = 335740942;
+               public const int isc_gfix_subs_name = 335740943;
+               public const int isc_gfix_wal_req = 335740944;
+               public const int isc_gfix_sec_req = 335740945;
+               public const int isc_gfix_nval_req = 335740946;
+               public const int isc_gfix_type_shut = 335740947;
+               public const int isc_gfix_retry = 335740948;
+               public const int isc_gfix_retry_db = 335740951;
+               public const int isc_gfix_exceed_max = 335740991;
+               public const int isc_gfix_corrupt_pool = 335740992;
+               public const int isc_gfix_mem_exhausted = 335740993;
+               public const int isc_gfix_bad_pool = 335740994;
+               public const int isc_gfix_trn_not_valid = 335740995;
+               public const int isc_gfix_unexp_eoi = 335741012;
+               public const int isc_gfix_recon_fail = 335741018;
+               public const int isc_gfix_trn_unknown = 335741036;
+               public const int isc_gfix_mode_req = 335741038;
+               public const int isc_gfix_opt_SQL_dialect = 335741039;
+               public const int isc_dsql_dbkey_from_non_table = 336003074;
+               public const int isc_dsql_transitional_numeric = 336003075;
+               public const int isc_dsql_dialect_warning_expr = 336003076;
+               public const int isc_sql_db_dialect_dtype_unsupport = 336003077;
+               public const int isc_isc_sql_dialect_conflict_num = 336003079;
+               public const int isc_dsql_warning_number_ambiguous = 336003080;
+               public const int isc_dsql_warning_number_ambiguous1 = 336003081;
+               public const int isc_dsql_warn_precision_ambiguous = 336003082;
+               public const int isc_dsql_warn_precision_ambiguous1 = 336003083;
+               public const int isc_dsql_warn_precision_ambiguous2 = 336003084;
+               public const int isc_dyn_role_does_not_exist = 336068796;
+               public const int isc_dyn_no_grant_admin_opt = 336068797;
+               public const int isc_dyn_user_not_role_member = 336068798;
+               public const int isc_dyn_delete_role_failed = 336068799;
+               public const int isc_dyn_grant_role_to_user = 336068800;
+               public const int isc_dyn_inv_sql_role_name = 336068801;
+               public const int isc_dyn_dup_sql_role = 336068802;
+               public const int isc_dyn_kywd_spec_for_role = 336068803;
+               public const int isc_dyn_roles_not_supported = 336068804;
+               public const int isc_dyn_domain_name_exists = 336068812;
+               public const int isc_dyn_field_name_exists = 336068813;
+               public const int isc_dyn_dependency_exists = 336068814;
+               public const int isc_dyn_dtype_invalid = 336068815;
+               public const int isc_dyn_char_fld_too_small = 336068816;
+               public const int isc_dyn_invalid_dtype_conversion = 336068817;
+               public const int isc_dyn_dtype_conv_invalid = 336068818;
+               public const int isc_gbak_unknown_switch = 336330753;
+               public const int isc_gbak_page_size_missing = 336330754;
+               public const int isc_gbak_page_size_toobig = 336330755;
+               public const int isc_gbak_redir_ouput_missing = 336330756;
+               public const int isc_gbak_switches_conflict = 336330757;
+               public const int isc_gbak_unknown_device = 336330758;
+               public const int isc_gbak_no_protection = 336330759;
+               public const int isc_gbak_page_size_not_allowed = 336330760;
+               public const int isc_gbak_multi_source_dest = 336330761;
+               public const int isc_gbak_filename_missing = 336330762;
+               public const int isc_gbak_dup_inout_names = 336330763;
+               public const int isc_gbak_inv_page_size = 336330764;
+               public const int isc_gbak_db_specified = 336330765;
+               public const int isc_gbak_db_exists = 336330766;
+               public const int isc_gbak_unk_device = 336330767;
+               public const int isc_gbak_blob_info_failed = 336330772;
+               public const int isc_gbak_unk_blob_item = 336330773;
+               public const int isc_gbak_get_seg_failed = 336330774;
+               public const int isc_gbak_close_blob_failed = 336330775;
+               public const int isc_gbak_open_blob_failed = 336330776;
+               public const int isc_gbak_put_blr_gen_id_failed = 336330777;
+               public const int isc_gbak_unk_type = 336330778;
+               public const int isc_gbak_comp_req_failed = 336330779;
+               public const int isc_gbak_start_req_failed = 336330780;
+               public const int isc_gbak_rec_failed = 336330781;
+               public const int isc_gbak_rel_req_failed = 336330782;
+               public const int isc_gbak_db_info_failed = 336330783;
+               public const int isc_gbak_no_db_desc = 336330784;
+               public const int isc_gbak_db_create_failed = 336330785;
+               public const int isc_gbak_decomp_len_error = 336330786;
+               public const int isc_gbak_tbl_missing = 336330787;
+               public const int isc_gbak_blob_col_missing = 336330788;
+               public const int isc_gbak_create_blob_failed = 336330789;
+               public const int isc_gbak_put_seg_failed = 336330790;
+               public const int isc_gbak_rec_len_exp = 336330791;
+               public const int isc_gbak_inv_rec_len = 336330792;
+               public const int isc_gbak_exp_data_type = 336330793;
+               public const int isc_gbak_gen_id_failed = 336330794;
+               public const int isc_gbak_unk_rec_type = 336330795;
+               public const int isc_gbak_inv_bkup_ver = 336330796;
+               public const int isc_gbak_missing_bkup_desc = 336330797;
+               public const int isc_gbak_string_trunc = 336330798;
+               public const int isc_gbak_cant_rest_record = 336330799;
+               public const int isc_gbak_send_failed = 336330800;
+               public const int isc_gbak_no_tbl_name = 336330801;
+               public const int isc_gbak_unexp_eof = 336330802;
+               public const int isc_gbak_db_format_too_old = 336330803;
+               public const int isc_gbak_inv_array_dim = 336330804;
+               public const int isc_gbak_xdr_len_expected = 336330807;
+               public const int isc_gbak_open_bkup_error = 336330817;
+               public const int isc_gbak_open_error = 336330818;
+               public const int isc_gbak_missing_block_fac = 336330934;
+               public const int isc_gbak_inv_block_fac = 336330935;
+               public const int isc_gbak_block_fac_specified = 336330936;
+               public const int isc_gbak_missing_username = 336330940;
+               public const int isc_gbak_missing_password = 336330941;
+               public const int isc_gbak_missing_skipped_bytes = 336330952;
+               public const int isc_gbak_inv_skipped_bytes = 336330953;
+               public const int isc_gbak_err_restore_charset = 336330965;
+               public const int isc_gbak_err_restore_collation = 336330967;
+               public const int isc_gbak_read_error = 336330972;
+               public const int isc_gbak_write_error = 336330973;
+               public const int isc_gbak_db_in_use = 336330985;
+               public const int isc_gbak_sysmemex = 336330990;
+               public const int isc_gbak_restore_role_failed = 336331002;
+               public const int isc_gbak_role_op_missing = 336331005;
+               public const int isc_gbak_page_buffers_missing = 336331010;
+               public const int isc_gbak_page_buffers_wrong_param = 336331011;
+               public const int isc_gbak_page_buffers_restore = 336331012;
+               public const int isc_gbak_inv_size = 336331014;
+               public const int isc_gbak_file_outof_sequence = 336331015;
+               public const int isc_gbak_join_file_missing = 336331016;
+               public const int isc_gbak_stdin_not_supptd = 336331017;
+               public const int isc_gbak_stdout_not_supptd = 336331018;
+               public const int isc_gbak_bkup_corrupt = 336331019;
+               public const int isc_gbak_unk_db_file_spec = 336331020;
+               public const int isc_gbak_hdr_write_failed = 336331021;
+               public const int isc_gbak_disk_space_ex = 336331022;
+               public const int isc_gbak_size_lt_min = 336331023;
+               public const int isc_gbak_svc_name_missing = 336331025;
+               public const int isc_gbak_not_ownr = 336331026;
+               public const int isc_gbak_mode_req = 336331031;
+               public const int isc_gsec_cant_open_db = 336723983;
+               public const int isc_gsec_switches_error = 336723984;
+               public const int isc_gsec_no_op_spec = 336723985;
+               public const int isc_gsec_no_usr_name = 336723986;
+               public const int isc_gsec_err_add = 336723987;
+               public const int isc_gsec_err_modify = 336723988;
+               public const int isc_gsec_err_find_mod = 336723989;
+               public const int isc_gsec_err_rec_not_found = 336723990;
+               public const int isc_gsec_err_delete = 336723991;
+               public const int isc_gsec_err_find_del = 336723992;
+               public const int isc_gsec_err_find_disp = 336723996;
+               public const int isc_gsec_inv_param = 336723997;
+               public const int isc_gsec_op_specified = 336723998;
+               public const int isc_gsec_pw_specified = 336723999;
+               public const int isc_gsec_uid_specified = 336724000;
+               public const int isc_gsec_gid_specified = 336724001;
+               public const int isc_gsec_proj_specified = 336724002;
+               public const int isc_gsec_org_specified = 336724003;
+               public const int isc_gsec_fname_specified = 336724004;
+               public const int isc_gsec_mname_specified = 336724005;
+               public const int isc_gsec_lname_specified = 336724006;
+               public const int isc_gsec_inv_switch = 336724008;
+               public const int isc_gsec_amb_switch = 336724009;
+               public const int isc_gsec_no_op_specified = 336724010;
+               public const int isc_gsec_params_not_allowed = 336724011;
+               public const int isc_gsec_incompat_switch = 336724012;
+               public const int isc_gsec_inv_username = 336724044;
+               public const int isc_gsec_inv_pw_length = 336724045;
+               public const int isc_gsec_db_specified = 336724046;
+               public const int isc_gsec_db_admin_specified = 336724047;
+               public const int isc_gsec_db_admin_pw_specified = 336724048;
+               public const int isc_gsec_sql_role_specified = 336724049;
+               public const int isc_license_no_file = 336789504;
+               public const int isc_license_op_specified = 336789523;
+               public const int isc_license_op_missing = 336789524;
+               public const int isc_license_inv_switch = 336789525;
+               public const int isc_license_inv_switch_combo = 336789526;
+               public const int isc_license_inv_op_combo = 336789527;
+               public const int isc_license_amb_switch = 336789528;
+               public const int isc_license_inv_parameter = 336789529;
+               public const int isc_license_param_specified = 336789530;
+               public const int isc_license_param_req = 336789531;
+               public const int isc_license_syntx_error = 336789532;
+               public const int isc_license_dup_id = 336789534;
+               public const int isc_license_inv_id_key = 336789535;
+               public const int isc_license_err_remove = 336789536;
+               public const int isc_license_err_update = 336789537;
+               public const int isc_license_err_convert = 336789538;
+               public const int isc_license_err_unk = 336789539;
+               public const int isc_license_svc_err_add = 336789540;
+               public const int isc_license_svc_err_remove = 336789541;
+               public const int isc_license_eval_exists = 336789563;
+               public const int isc_gstat_unknown_switch = 336920577;
+               public const int isc_gstat_retry = 336920578;
+               public const int isc_gstat_wrong_ods = 336920579;
+               public const int isc_gstat_unexpected_eof = 336920580;
+               public const int isc_gstat_open_err = 336920605;
+               public const int isc_gstat_read_err = 336920606;
+               public const int isc_gstat_sysmemex = 336920607;
+               public const int isc_err_max = 689;
+
+               #endregion
+
+               #region BLR     Codes
+
+               public const int blr_version5 = 5;
+               public const int blr_begin = 2;
+               public const int blr_message = 4;
+               public const int blr_eoc = 76;
+               public const int blr_end = 255; /* note: defined as -1 in gds.h */
+
+               public const int blr_text = 14;
+               public const int blr_text2 = 15;
+               public const int blr_short = 7;
+               public const int blr_long = 8;
+               public const int blr_quad = 9;
+               public const int blr_int64 = 16;
+               public const int blr_float = 10;
+               public const int blr_double = 27;
+               public const int blr_d_float = 11;
+               public const int blr_timestamp = 35;
+               public const int blr_varying = 37;
+               public const int blr_varying2 = 38;
+               public const int blr_blob = 261;
+               public const int blr_cstring = 40;
+               public const int blr_cstring2 = 41;
+               public const int blr_blob_id = 45;
+               public const int blr_sql_date = 12;
+               public const int blr_sql_time = 13;
+
+               #endregion
+
+               #region DataType Definitions
+
+               public const int SQL_TEXT = 452;
+               public const int SQL_VARYING = 448;
+               public const int SQL_SHORT = 500;
+               public const int SQL_LONG = 496;
+               public const int SQL_FLOAT = 482;
+               public const int SQL_DOUBLE = 480;
+               public const int SQL_D_FLOAT = 530;
+               public const int SQL_TIMESTAMP = 510;
+               public const int SQL_BLOB = 520;
+               public const int SQL_ARRAY = 540;
+               public const int SQL_QUAD = 550;
+               public const int SQL_TYPE_TIME = 560;
+               public const int SQL_TYPE_DATE = 570;
+               public const int SQL_INT64 = 580;
+
+               // Historical alias     for     pre     V6 applications
+               public const int SQL_DATE = SQL_TIMESTAMP;
+
+               #endregion
+       }
+}
index 572d3b30c500555b9495e0e75d1bc843271bf3f8..6de15a8bd9c4fa0235fbd0677fb9ce93d948928b 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class IscError\r
-       {\r
-               #region Fields\r
-\r
-               private string  message;\r
-               private int             type;\r
-               private int             errorCode;\r
-               private string  strParam;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public string Message\r
-               {\r
-                       get { return this.message; }\r
-                       set { this.message = value; }\r
-               }\r
-\r
-               public int ErrorCode\r
-               {\r
-                       get { return this.errorCode; }\r
-               }\r
-\r
-               public string StrParam\r
-               {\r
-                       get\r
-                       {\r
-                               switch (this.type)\r
-                               {\r
-                                       case IscCodes.isc_arg_interpreted:\r
-                                       case IscCodes.isc_arg_string:\r
-                                       case IscCodes.isc_arg_cstring:\r
-                                               return this.strParam;\r
-\r
-                                       case IscCodes.isc_arg_number:\r
-                                               return this.errorCode.ToString(CultureInfo.InvariantCulture);\r
-\r
-                                       default:\r
-                                               return String.Empty;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public int Type\r
-               {\r
-                       get { return this.type; }\r
-               }\r
-\r
-               public bool IsArgument\r
-               {\r
-                       get\r
-                       {\r
-                               switch (this.type)\r
-                               {\r
-                                       case IscCodes.isc_arg_interpreted:\r
-                                       case IscCodes.isc_arg_string:\r
-                                       case IscCodes.isc_arg_cstring:\r
-                                       case IscCodes.isc_arg_number:\r
-                                               return true;\r
-\r
-                                       default:\r
-                                               return false;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public bool IsWarning\r
-               {\r
-                       get { return this.type == IscCodes.isc_arg_warning; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal IscError(int errorCode)\r
-               {\r
-                       this.errorCode = errorCode;\r
-               }\r
-\r
-               internal IscError(int type, string strParam)\r
-               {\r
-                       this.type               = type;\r
-                       this.strParam   = strParam;\r
-               }\r
-\r
-               internal IscError(int type, int errorCode)\r
-               {\r
-                       this.type               = type;\r
-                       this.errorCode  = errorCode;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class IscError
+       {
+               #region Fields
+
+               private string  message;
+               private int             type;
+               private int             errorCode;
+               private string  strParam;
+
+               #endregion
+
+               #region Properties
+
+               public string Message
+               {
+                       get { return this.message; }
+                       set { this.message = value; }
+               }
+
+               public int ErrorCode
+               {
+                       get { return this.errorCode; }
+               }
+
+               public string StrParam
+               {
+                       get
+                       {
+                               switch (this.type)
+                               {
+                                       case IscCodes.isc_arg_interpreted:
+                                       case IscCodes.isc_arg_string:
+                                       case IscCodes.isc_arg_cstring:
+                                               return this.strParam;
+
+                                       case IscCodes.isc_arg_number:
+                                               return this.errorCode.ToString(CultureInfo.InvariantCulture);
+
+                                       default:
+                                               return String.Empty;
+                               }
+                       }
+               }
+
+               public int Type
+               {
+                       get { return this.type; }
+               }
+
+               public bool IsArgument
+               {
+                       get
+                       {
+                               switch (this.type)
+                               {
+                                       case IscCodes.isc_arg_interpreted:
+                                       case IscCodes.isc_arg_string:
+                                       case IscCodes.isc_arg_cstring:
+                                       case IscCodes.isc_arg_number:
+                                               return true;
+
+                                       default:
+                                               return false;
+                               }
+                       }
+               }
+
+               public bool IsWarning
+               {
+                       get { return this.type == IscCodes.isc_arg_warning; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               internal IscError(int errorCode)
+               {
+                       this.errorCode = errorCode;
+               }
+
+               internal IscError(int type, string strParam)
+               {
+                       this.type               = type;
+                       this.strParam   = strParam;
+               }
+
+               internal IscError(int type, int errorCode)
+               {
+                       this.type               = type;
+                       this.errorCode  = errorCode;
+               }
+
+               #endregion
+       }
+}
index 44a348938851032d4fbf3efb48b1e64a24e728ab..55dda5ca692b9073fdb7003e23b9edb2e61b11ee 100644 (file)
@@ -1,56 +1,56 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class IscErrorCollection : CollectionBase\r
-       {\r
-               #region Indexers\r
-\r
-               public IscError this[int index]\r
-               {\r
-                       get { return (IscError)this.List[index]; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public IscError Add(int type, string strParam)\r
-               {\r
-                       return this.Add(new IscError(type, strParam));\r
-               }\r
-\r
-               public IscError Add(int type, int errorCode)\r
-               {\r
-                       return this.Add(new IscError(type, errorCode));\r
-               }\r
-\r
-               public IscError Add(IscError error)\r
-               {\r
-                       this.List.Add(error);\r
-\r
-                       return error;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class IscErrorCollection : CollectionBase
+       {
+               #region Indexers
+
+               public IscError this[int index]
+               {
+                       get { return (IscError)this.List[index]; }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public IscError Add(int type, string strParam)
+               {
+                       return this.Add(new IscError(type, strParam));
+               }
+
+               public IscError Add(int type, int errorCode)
+               {
+                       return this.Add(new IscError(type, errorCode));
+               }
+
+               public IscError Add(IscError error)
+               {
+                       this.List.Add(error);
+
+                       return error;
+               }
+
+               #endregion
+       }
+}
index 1019fa069eafad6259d036938c4e56bb68adca66..0a8ebd545ec723bbe2c1d09a781ce330553d542c 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Globalization;\r
-using System.Text;\r
-using System.Reflection;\r
-using System.Resources;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class IscException : Exception\r
-       {\r
-               #region Fields\r
-\r
-               private IscErrorCollection errors;\r
-               private int errorCode;\r
-               private string message;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public IscErrorCollection Errors\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.errors == null)\r
-                               {\r
-                                       this.errors = new IscErrorCollection();\r
-                               }\r
-\r
-                               return this.errors;\r
-                       }\r
-               }\r
-\r
-               public new string Message\r
-               {\r
-                       get { return this.message; }\r
-               }\r
-\r
-               public int ErrorCode\r
-               {\r
-                       get { return this.errorCode; }\r
-               }\r
-\r
-               public bool IsWarning\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.errors.Count > 0)\r
-                               {\r
-                                       return this.errors[0].IsWarning;\r
-                               }\r
-                               else\r
-                               {\r
-                                       return false;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public IscException() : base()\r
-               {\r
-               }\r
-\r
-               public IscException(int errorCode) : base()\r
-               {\r
-                       this.Errors.Add(IscCodes.isc_arg_gds, errorCode);\r
-                       this.BuildExceptionMessage();\r
-               }\r
-\r
-               public IscException(string strParam) : base()\r
-               {\r
-                       this.Errors.Add(IscCodes.isc_arg_string, strParam);\r
-                       this.BuildExceptionMessage();\r
-               }\r
-\r
-               public IscException(int errorCode, int intparam) : base()\r
-               {\r
-                       this.Errors.Add(IscCodes.isc_arg_gds, errorCode);\r
-                       this.Errors.Add(IscCodes.isc_arg_number, intparam);\r
-                       this.BuildExceptionMessage();\r
-               }\r
-\r
-               public IscException(int type, int errorCode, string strParam) : base()\r
-               {\r
-                       this.Errors.Add(type, errorCode);\r
-                       this.Errors.Add(IscCodes.isc_arg_string, strParam);\r
-                       this.BuildExceptionMessage();\r
-               }\r
-\r
-               public IscException(int type, int errorCode, int intParam, string strParam) \r
-                       : base()\r
-               {\r
-                       this.Errors.Add(type, errorCode);\r
-                       this.Errors.Add(IscCodes.isc_arg_string, strParam);\r
-                       this.Errors.Add(IscCodes.isc_arg_number, intParam);\r
-                       this.BuildExceptionMessage();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void BuildExceptionMessage()\r
-               {\r
-                       string resources = "FirebirdSql.Data.Common.Resources.isc_error_msg";                   \r
-\r
-                       StringBuilder builder = new StringBuilder();\r
-                       ResourceManager rm = new ResourceManager(resources, Assembly.GetExecutingAssembly());\r
-\r
-                       this.errorCode = (this.Errors.Count != 0) ? this.Errors[0].ErrorCode : 0;\r
-\r
-                       for (int i = 0; i < this.Errors.Count; i++)\r
-                       {\r
-                               if (this.Errors[i].Type == IscCodes.isc_arg_gds ||\r
-                                       this.Errors[i].Type == IscCodes.isc_arg_warning)\r
-                               {\r
-                                       int code = this.Errors[i].ErrorCode;\r
-                                       string message = null;\r
-\r
-                                       try\r
-                                       {\r
-                                               message = rm.GetString(code.ToString());\r
-                                       }\r
-                                       catch\r
-                                       {\r
-                                               message = null;\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               if (message == null)\r
-                                               {\r
-                                                       message = String.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code);\r
-                                               }\r
-                                       }\r
-\r
-                                       ArrayList param = new ArrayList();\r
-\r
-                                       int index = i + 1;\r
-\r
-                                       while (index < this.Errors.Count && this.Errors[index].IsArgument)\r
-                                       {\r
-                                               param.Add(this.Errors[index++].StrParam);\r
-                                               i++;\r
-                                       }\r
-\r
-                                       object[] args = (object[])param.ToArray(typeof(object));\r
-\r
-                                       try\r
-                                       {\r
-                                               if (code == IscCodes.isc_except)\r
-                                               {\r
-                                                       // Custom exception     add     the     first argument as error code\r
-                                                       this.errorCode = Convert.ToInt32(args[0], CultureInfo.InvariantCulture);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       if (builder.Length > 0)\r
-                                                       {\r
-                                                               builder.Append("\n");\r
-                                                       }\r
-\r
-                                                       builder.AppendFormat(CultureInfo.CurrentCulture, message, args);\r
-                                               }\r
-                                       }\r
-                                       catch\r
-                                       {\r
-                                               message = String.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code);\r
-\r
-                                               builder.AppendFormat(CultureInfo.CurrentCulture, message, args);\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       // Update error collection only with the main error\r
-                       IscError mainError = new IscError(this.errorCode);\r
-                       mainError.Message = builder.ToString();\r
-\r
-                       this.errors = new IscErrorCollection();\r
-                       this.Errors.Add(mainError);\r
-\r
-                       // Update exception     message\r
-                       this.message = builder.ToString();\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Reflection;
+using System.Resources;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class IscException : Exception
+       {
+               #region Fields
+
+               private IscErrorCollection errors;
+               private int errorCode;
+               private string message;
+
+               #endregion
+
+               #region Properties
+
+               public IscErrorCollection Errors
+               {
+                       get
+                       {
+                               if (this.errors == null)
+                               {
+                                       this.errors = new IscErrorCollection();
+                               }
+
+                               return this.errors;
+                       }
+               }
+
+               public new string Message
+               {
+                       get { return this.message; }
+               }
+
+               public int ErrorCode
+               {
+                       get { return this.errorCode; }
+               }
+
+               public bool IsWarning
+               {
+                       get
+                       {
+                               if (this.errors.Count > 0)
+                               {
+                                       return this.errors[0].IsWarning;
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public IscException() : base()
+               {
+               }
+
+               public IscException(int errorCode) : base()
+               {
+                       this.Errors.Add(IscCodes.isc_arg_gds, errorCode);
+                       this.BuildExceptionMessage();
+               }
+
+               public IscException(string strParam) : base()
+               {
+                       this.Errors.Add(IscCodes.isc_arg_string, strParam);
+                       this.BuildExceptionMessage();
+               }
+
+               public IscException(int errorCode, int intparam) : base()
+               {
+                       this.Errors.Add(IscCodes.isc_arg_gds, errorCode);
+                       this.Errors.Add(IscCodes.isc_arg_number, intparam);
+                       this.BuildExceptionMessage();
+               }
+
+               public IscException(int type, int errorCode, string strParam) : base()
+               {
+                       this.Errors.Add(type, errorCode);
+                       this.Errors.Add(IscCodes.isc_arg_string, strParam);
+                       this.BuildExceptionMessage();
+               }
+
+               public IscException(int type, int errorCode, int intParam, string strParam) 
+                       : base()
+               {
+                       this.Errors.Add(type, errorCode);
+                       this.Errors.Add(IscCodes.isc_arg_string, strParam);
+                       this.Errors.Add(IscCodes.isc_arg_number, intParam);
+                       this.BuildExceptionMessage();
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void BuildExceptionMessage()
+               {
+                       string resources = "FirebirdSql.Data.Common.Resources.isc_error_msg";                   
+
+                       StringBuilder builder = new StringBuilder();
+                       ResourceManager rm = new ResourceManager(resources, Assembly.GetExecutingAssembly());
+
+                       this.errorCode = (this.Errors.Count != 0) ? this.Errors[0].ErrorCode : 0;
+
+                       for (int i = 0; i < this.Errors.Count; i++)
+                       {
+                               if (this.Errors[i].Type == IscCodes.isc_arg_gds ||
+                                       this.Errors[i].Type == IscCodes.isc_arg_warning)
+                               {
+                                       int code = this.Errors[i].ErrorCode;
+                                       string message = null;
+
+                                       try
+                                       {
+                                               message = rm.GetString(code.ToString());
+                                       }
+                                       catch
+                                       {
+                                               message = null;
+                                       }
+                                       finally
+                                       {
+                                               if (message == null)
+                                               {
+                                                       message = String.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code);
+                                               }
+                                       }
+
+                                       ArrayList param = new ArrayList();
+
+                                       int index = i + 1;
+
+                                       while (index < this.Errors.Count && this.Errors[index].IsArgument)
+                                       {
+                                               param.Add(this.Errors[index++].StrParam);
+                                               i++;
+                                       }
+
+                                       object[] args = (object[])param.ToArray(typeof(object));
+
+                                       try
+                                       {
+                                               if (code == IscCodes.isc_except)
+                                               {
+                                                       // Custom exception     add     the     first argument as error code
+                                                       this.errorCode = Convert.ToInt32(args[0], CultureInfo.InvariantCulture);
+                                               }
+                                               else
+                                               {
+                                                       if (builder.Length > 0)
+                                                       {
+                                                               builder.Append("\n");
+                                                       }
+
+                                                       builder.AppendFormat(CultureInfo.CurrentCulture, message, args);
+                                               }
+                                       }
+                                       catch
+                                       {
+                                               message = String.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code);
+
+                                               builder.AppendFormat(CultureInfo.CurrentCulture, message, args);
+                                       }
+                               }
+                       }
+
+                       // Update error collection only with the main error
+                       IscError mainError = new IscError(this.errorCode);
+                       mainError.Message = builder.ToString();
+
+                       this.errors = new IscErrorCollection();
+                       this.Errors.Add(mainError);
+
+                       // Update exception     message
+                       this.message = builder.ToString();
+               }
+
+               #endregion
+       }
+}
index a8889ab9f7c387135cdc2cabcce86da333935905..dc2d1b7d882ef762bb962edada032f76a31fa6f2 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Globalization;\r
-using System.Resources;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class IscHelper\r
-       {\r
-               #region Constructors\r
-\r
-               private IscHelper()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region General Static Methods\r
-\r
-               public static ArrayList ParseDatabaseInfo(byte[] buffer)\r
-               {\r
-                       ArrayList info = new ArrayList();\r
-\r
-                       int pos         = 0;\r
-                       int length      = 0;\r
-                       int type        = 0;\r
-\r
-                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)\r
-                       {\r
-                               length = VaxInteger(buffer, pos, 2);\r
-                               pos += 2;\r
-\r
-                               switch (type)\r
-                               {\r
-                                       //\r
-                                       // Database     characteristics\r
-                                       //\r
-                                       case IscCodes.isc_info_allocation:\r
-                                               // Number of database pages     allocated\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_base_level:\r
-                                               /* Database     version (level) number:\r
-                                                *              1 byte containing the number 1\r
-                                                *              1 byte containing the version number\r
-                                                */\r
-                                               info.Add(String.Format(CultureInfo.CurrentCulture, "{0}.{1}", buffer[pos], buffer[pos + 1]));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_db_id:\r
-                                               /* Database     file name and site name:\r
-                                                *              \95 1     byte containing the     number 2\r
-                                                *              \95 1     byte containing the     length, d, of the database file name in bytes\r
-                                                *              \95 A     string of d     bytes, containing the database file     name\r
-                                                *              \95 1     byte containing the     length, l, of the site name     in bytes\r
-                                                *              \95 A     string of l     bytes, containing the site name\r
-                                                */\r
-                                               string  dbFile          = Encoding.Default.GetString(buffer, pos + 2, buffer[pos + 1]);\r
-                                               int             sitePos         = pos + 2 + buffer[pos + 1];\r
-                                               int             siteLength      = buffer[sitePos];\r
-                                               string  siteName        = Encoding.Default.GetString(buffer, sitePos + 1, siteLength);\r
-\r
-                                               sitePos         += siteLength + 1;\r
-                                               siteLength      = buffer[sitePos];\r
-                                               siteName        += "." + Encoding.Default.GetString(buffer, sitePos + 1, siteLength);\r
-\r
-                                               info.Add(siteName + ":" + dbFile);\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_implementation:\r
-                                               /* Database     implementation number:\r
-                                                *              \95 1     byte containing a 1\r
-                                                *              \95 1     byte containing the     implementation number\r
-                                                *              \95 1     byte containing a \93class\94 number, either 1 or 12\r
-                                                */\r
-                                               info.Add(String.Format(CultureInfo.CurrentCulture, "{0}.{1}.{2}", buffer[pos], buffer[pos + 1], buffer[pos + 2]));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_no_reserve:\r
-                                               /* 0 or 1\r
-                                                *              \95 0     indicates space is reserved     on each database page for holding\r
-                                                *                      backup versions of modified     records [Default]\r
-                                                *              \95 1     indicates no space is reserved for such records\r
-                                                */\r
-                                               info.Add(buffer[pos] == 1 ? true : false);\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_ods_version:\r
-                                               /* ODS major version number\r
-                                                *              \95 Databases     with different major version numbers have different\r
-                                                *                      physical layouts; a     database engine can     only access     databases\r
-                                                *                      with a particular ODS major     version number\r
-                                                *              \95 Trying to     attach to a     database with a different ODS number\r
-                                                *                      results in an error\r
-                                                */\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_ods_minor_version:\r
-                                               /* On-disk structure (ODS) minor version number; an     increase in     a\r
-                                                * minor version number indicates a     non-structural change, one that\r
-                                                * still allows the     database to     be accessed     by database     engines with\r
-                                                * the same     major version number but possibly different     minor\r
-                                                * version numbers\r
-                                                */\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_page_size:\r
-                                               /* Number of bytes per page     of the attached database; use with\r
-                                                * isc_info_allocation to determine     the     size of the     database\r
-                                                */\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_isc_version:\r
-                                               /* Version identification string of     the     database implementation:\r
-                                                *              \95 1     byte containing the     number 1\r
-                                                *              \95 1     byte specifying the     length, n, of the following     string\r
-                                                *              \95 n     bytes containing the version identification     string\r
-                                                */\r
-                                               info.Add(Encoding.Default.GetString(buffer, pos + 2, buffer[pos + 1]));\r
-                                               break;\r
-\r
-                                       //\r
-                                       // Environmental characteristics\r
-                                       //\r
-\r
-                                       case IscCodes.isc_info_current_memory:\r
-                                               // Amount of server     memory (in bytes) currently     in use\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_forced_writes:\r
-                                               /* Number specifying the mode in which database writes are performed\r
-                                                * (0 for asynchronous, 1 for synchronous)\r
-                                                */\r
-                                               info.Add(buffer[pos] == 1 ? true : false);\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_max_memory:\r
-                                               /* Maximum amount of memory     (in     bytes) used     at one time     since the first\r
-                                                * process attached     to the database\r
-                                                */\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_num_buffers:\r
-                                               // Number of memory     buffers currently allocated\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_sweep_interval:\r
-                                               /* Number of transactions that are committed between \93sweeps\94 to\r
-                                                * remove database record versions that are     no longer needed\r
-                                                */\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       //\r
-                                       // Performance statistics\r
-                                       //\r
-\r
-                                       case IscCodes.isc_info_fetches:\r
-                                               // Number of reads from the     memory buffer cache\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_marks:\r
-                                               // Number of writes     to the memory buffer cache\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_reads:\r
-                                               // Number of page reads\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_writes:\r
-                                               // Number of page writes\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       //\r
-                                       // Database     operation counts\r
-                                       //\r
-                                       case IscCodes.isc_info_backout_count:\r
-                                               // Number of removals of a version of a record\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_delete_count:\r
-                                               // Number of database deletes since     the     database was last attached\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_expunge_count:\r
-                                               /* Number of removals of a record and all of its ancestors,     for     records\r
-                                                * whose deletions have been committed\r
-                                                */\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_insert_count:\r
-                                               // Number of inserts into the database since the database was last attached     \r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_purge_count:\r
-                                               // Number of removals of old versions of fully mature records\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_read_idx_count:\r
-                                               // Number of reads done via     an index since the database     was     last attached\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_read_seq_count:\r
-                                               /* Number of sequential sequential table scans (row     reads) done     on each \r
-                                                * table since the database     was     last attached\r
-                                                */\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_update_count:\r
-                                               // Number of database updates since     the     database was last attached\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       //\r
-                                       // Misc\r
-                                       //\r
-                                       case IscCodes.isc_info_firebird_version:\r
-                                               info.Add(Encoding.Default.GetString(buffer, pos + 2, buffer[pos + 1]));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_db_class:\r
-                                               int serverClass = VaxInteger(buffer, pos, length);\r
-                                               if (serverClass == IscCodes.isc_info_db_class_classic_access)\r
-                                               {\r
-                                                       info.Add("CLASSIC SERVER");\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       info.Add("SUPER SERVER");\r
-                                               }\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_db_read_only:\r
-                                               info.Add(buffer[pos] == 1 ? true : false);\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_db_size_in_pages:\r
-                                               // Database     size in pages.\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_oldest_transaction:\r
-                                               // Number of oldest     transaction\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_oldest_active:\r
-                                               // Number of oldest     active transaction\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_oldest_snapshot:\r
-                                               // Number of oldest     snapshot transaction\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_next_transaction:\r
-                                               // Number of next transaction\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_info_active_transactions:\r
-                                               // Number of active     transactions\r
-                                               info.Add(VaxInteger(buffer, pos, length));\r
-                                               break;\r
-\r
-                    case IscCodes.isc_info_user_names:\r
-                        // Active user name\r
-                        info.Add(Encoding.Default.GetString(buffer, pos + 1, buffer[pos]));\r
-                        break;\r
-                               }\r
-\r
-                               pos += length;\r
-                       }\r
-\r
-                       return info;\r
-               }\r
-\r
-               public static int VaxInteger(byte[] buffer, int index, int length)\r
-               {\r
-                       int newValue;\r
-                       int shift;\r
-\r
-                       newValue = shift = 0;\r
-\r
-                       int i = index;\r
-                       while (--length >= 0)\r
-                       {\r
-                               newValue += (buffer[i++] & 0xff) << shift;\r
-                               shift += 8;\r
-                       }\r
-\r
-                       return newValue;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Resources;
+using System.Text;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class IscHelper
+       {
+               #region Constructors
+
+               private IscHelper()
+               {
+               }
+
+               #endregion
+
+               #region General Static Methods
+
+               public static ArrayList ParseDatabaseInfo(byte[] buffer)
+               {
+                       ArrayList info = new ArrayList();
+
+                       int pos         = 0;
+                       int length      = 0;
+                       int type        = 0;
+
+                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)
+                       {
+                               length = VaxInteger(buffer, pos, 2);
+                               pos += 2;
+
+                               switch (type)
+                               {
+                                       //
+                                       // Database     characteristics
+                                       //
+                                       case IscCodes.isc_info_allocation:
+                                               // Number of database pages     allocated
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_base_level:
+                                               /* Database     version (level) number:
+                                                *              1 byte containing the number 1
+                                                *              1 byte containing the version number
+                                                */
+                                               info.Add(String.Format(CultureInfo.CurrentCulture, "{0}.{1}", buffer[pos], buffer[pos + 1]));
+                                               break;
+
+                                       case IscCodes.isc_info_db_id:
+                                               /* Database     file name and site name:
+                                                *              \95 1     byte containing the     number 2
+                                                *              \95 1     byte containing the     length, d, of the database file name in bytes
+                                                *              \95 A     string of d     bytes, containing the database file     name
+                                                *              \95 1     byte containing the     length, l, of the site name     in bytes
+                                                *              \95 A     string of l     bytes, containing the site name
+                                                */
+                                               string  dbFile          = Encoding.Default.GetString(buffer, pos + 2, buffer[pos + 1]);
+                                               int             sitePos         = pos + 2 + buffer[pos + 1];
+                                               int             siteLength      = buffer[sitePos];
+                                               string  siteName        = Encoding.Default.GetString(buffer, sitePos + 1, siteLength);
+
+                                               sitePos         += siteLength + 1;
+                                               siteLength      = buffer[sitePos];
+                                               siteName        += "." + Encoding.Default.GetString(buffer, sitePos + 1, siteLength);
+
+                                               info.Add(siteName + ":" + dbFile);
+                                               break;
+
+                                       case IscCodes.isc_info_implementation:
+                                               /* Database     implementation number:
+                                                *              \95 1     byte containing a 1
+                                                *              \95 1     byte containing the     implementation number
+                                                *              \95 1     byte containing a \93class\94 number, either 1 or 12
+                                                */
+                                               info.Add(String.Format(CultureInfo.CurrentCulture, "{0}.{1}.{2}", buffer[pos], buffer[pos + 1], buffer[pos + 2]));
+                                               break;
+
+                                       case IscCodes.isc_info_no_reserve:
+                                               /* 0 or 1
+                                                *              \95 0     indicates space is reserved     on each database page for holding
+                                                *                      backup versions of modified     records [Default]
+                                                *              \95 1     indicates no space is reserved for such records
+                                                */
+                                               info.Add(buffer[pos] == 1 ? true : false);
+                                               break;
+
+                                       case IscCodes.isc_info_ods_version:
+                                               /* ODS major version number
+                                                *              \95 Databases     with different major version numbers have different
+                                                *                      physical layouts; a     database engine can     only access     databases
+                                                *                      with a particular ODS major     version number
+                                                *              \95 Trying to     attach to a     database with a different ODS number
+                                                *                      results in an error
+                                                */
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_ods_minor_version:
+                                               /* On-disk structure (ODS) minor version number; an     increase in     a
+                                                * minor version number indicates a     non-structural change, one that
+                                                * still allows the     database to     be accessed     by database     engines with
+                                                * the same     major version number but possibly different     minor
+                                                * version numbers
+                                                */
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_page_size:
+                                               /* Number of bytes per page     of the attached database; use with
+                                                * isc_info_allocation to determine     the     size of the     database
+                                                */
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_isc_version:
+                                               /* Version identification string of     the     database implementation:
+                                                *              \95 1     byte containing the     number 1
+                                                *              \95 1     byte specifying the     length, n, of the following     string
+                                                *              \95 n     bytes containing the version identification     string
+                                                */
+                                               info.Add(Encoding.Default.GetString(buffer, pos + 2, buffer[pos + 1]));
+                                               break;
+
+                                       //
+                                       // Environmental characteristics
+                                       //
+
+                                       case IscCodes.isc_info_current_memory:
+                                               // Amount of server     memory (in bytes) currently     in use
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_forced_writes:
+                                               /* Number specifying the mode in which database writes are performed
+                                                * (0 for asynchronous, 1 for synchronous)
+                                                */
+                                               info.Add(buffer[pos] == 1 ? true : false);
+                                               break;
+
+                                       case IscCodes.isc_info_max_memory:
+                                               /* Maximum amount of memory     (in     bytes) used     at one time     since the first
+                                                * process attached     to the database
+                                                */
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_num_buffers:
+                                               // Number of memory     buffers currently allocated
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_sweep_interval:
+                                               /* Number of transactions that are committed between \93sweeps\94 to
+                                                * remove database record versions that are     no longer needed
+                                                */
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       //
+                                       // Performance statistics
+                                       //
+
+                                       case IscCodes.isc_info_fetches:
+                                               // Number of reads from the     memory buffer cache
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_marks:
+                                               // Number of writes     to the memory buffer cache
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_reads:
+                                               // Number of page reads
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_writes:
+                                               // Number of page writes
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       //
+                                       // Database     operation counts
+                                       //
+                                       case IscCodes.isc_info_backout_count:
+                                               // Number of removals of a version of a record
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_delete_count:
+                                               // Number of database deletes since     the     database was last attached
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_expunge_count:
+                                               /* Number of removals of a record and all of its ancestors,     for     records
+                                                * whose deletions have been committed
+                                                */
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_insert_count:
+                                               // Number of inserts into the database since the database was last attached     
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_purge_count:
+                                               // Number of removals of old versions of fully mature records
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_read_idx_count:
+                                               // Number of reads done via     an index since the database     was     last attached
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_read_seq_count:
+                                               /* Number of sequential sequential table scans (row     reads) done     on each 
+                                                * table since the database     was     last attached
+                                                */
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_update_count:
+                                               // Number of database updates since     the     database was last attached
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       //
+                                       // Misc
+                                       //
+                                       case IscCodes.isc_info_firebird_version:
+                                               info.Add(Encoding.Default.GetString(buffer, pos + 2, buffer[pos + 1]));
+                                               break;
+
+                                       case IscCodes.isc_info_db_class:
+                                               int serverClass = VaxInteger(buffer, pos, length);
+                                               if (serverClass == IscCodes.isc_info_db_class_classic_access)
+                                               {
+                                                       info.Add("CLASSIC SERVER");
+                                               }
+                                               else
+                                               {
+                                                       info.Add("SUPER SERVER");
+                                               }
+                                               break;
+
+                                       case IscCodes.isc_info_db_read_only:
+                                               info.Add(buffer[pos] == 1 ? true : false);
+                                               break;
+
+                                       case IscCodes.isc_info_db_size_in_pages:
+                                               // Database     size in pages.
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_oldest_transaction:
+                                               // Number of oldest     transaction
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_oldest_active:
+                                               // Number of oldest     active transaction
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_oldest_snapshot:
+                                               // Number of oldest     snapshot transaction
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_next_transaction:
+                                               // Number of next transaction
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                                       case IscCodes.isc_info_active_transactions:
+                                               // Number of active     transactions
+                                               info.Add(VaxInteger(buffer, pos, length));
+                                               break;
+
+                    case IscCodes.isc_info_user_names:
+                        // Active user name
+                        info.Add(Encoding.Default.GetString(buffer, pos + 1, buffer[pos]));
+                        break;
+                               }
+
+                               pos += length;
+                       }
+
+                       return info;
+               }
+
+               public static int VaxInteger(byte[] buffer, int index, int length)
+               {
+                       int newValue;
+                       int shift;
+
+                       newValue = shift = 0;
+
+                       int i = index;
+                       while (--length >= 0)
+                       {
+                               newValue += (buffer[i++] & 0xff) << shift;
+                               shift += 8;
+                       }
+
+                       return newValue;
+               }
+
+               #endregion
+       }
+}
index b30e9e63ca510cc1ddb2ec58fb940f37f2200537..32aa713989b352ce8c2f4978f028a71f70f4f08b 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-using System.Net;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal abstract class ParameterBuffer\r
-       {\r
-               #region Fields\r
-\r
-               private MemoryStream stream;\r
-               private bool isLittleEndian;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public short Length\r
-               {\r
-                       get { return (short)this.ToArray().Length; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected properties\r
-\r
-               protected bool IsLittleEndian\r
-               {\r
-                       get { return this.isLittleEndian; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               protected ParameterBuffer() : this(false)\r
-               {\r
-               }\r
-\r
-               protected ParameterBuffer(bool isLittleEndian)\r
-               {\r
-                       this.stream = new MemoryStream();\r
-                       this.isLittleEndian = isLittleEndian;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected void WriteByte(int value)\r
-               {\r
-                       this.WriteByte((byte)value);\r
-               }\r
-\r
-               protected void WriteByte(byte value)\r
-               {\r
-                       this.stream.WriteByte(value);\r
-               }\r
-\r
-               protected void Write(short value)\r
-               {\r
-                       if (!this.IsLittleEndian)\r
-                       {\r
-                               value = (short)IPAddress.NetworkToHostOrder(value);\r
-                       }\r
-\r
-                       byte[] buffer = BitConverter.GetBytes(value);\r
-\r
-                       this.stream.Write(buffer, 0, buffer.Length);\r
-               }\r
-\r
-               protected void Write(int value)\r
-               {\r
-                       if (!this.IsLittleEndian)\r
-                       {\r
-                               value = (int)IPAddress.NetworkToHostOrder(value);\r
-                       }\r
-\r
-                       byte[] buffer = BitConverter.GetBytes(value);\r
-\r
-                       this.stream.Write(buffer, 0, buffer.Length);\r
-               }\r
-\r
-               protected void Write(byte[] buffer)\r
-               {\r
-                       this.Write(buffer, 0, buffer.Length);\r
-               }\r
-\r
-               protected void Write(byte[] buffer, int offset, int count)\r
-               {\r
-                       this.stream.Write(buffer, offset, count);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public virtual void Append(int type)\r
-               {\r
-                       this.WriteByte(type);\r
-               }\r
-\r
-               public byte[] ToArray()\r
-               {\r
-                       return stream.ToArray();\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Net;
+
+namespace FirebirdSql.Data.Common
+{
+       internal abstract class ParameterBuffer
+       {
+               #region Fields
+
+               private MemoryStream stream;
+               private bool isLittleEndian;
+
+               #endregion
+
+               #region Properties
+
+               public short Length
+               {
+                       get { return (short)this.ToArray().Length; }
+               }
+
+               #endregion
+
+               #region Protected properties
+
+               protected bool IsLittleEndian
+               {
+                       get { return this.isLittleEndian; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               protected ParameterBuffer() : this(false)
+               {
+               }
+
+               protected ParameterBuffer(bool isLittleEndian)
+               {
+                       this.stream = new MemoryStream();
+                       this.isLittleEndian = isLittleEndian;
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected void WriteByte(int value)
+               {
+                       this.WriteByte((byte)value);
+               }
+
+               protected void WriteByte(byte value)
+               {
+                       this.stream.WriteByte(value);
+               }
+
+               protected void Write(short value)
+               {
+                       if (!this.IsLittleEndian)
+                       {
+                               value = (short)IPAddress.NetworkToHostOrder(value);
+                       }
+
+                       byte[] buffer = BitConverter.GetBytes(value);
+
+                       this.stream.Write(buffer, 0, buffer.Length);
+               }
+
+               protected void Write(int value)
+               {
+                       if (!this.IsLittleEndian)
+                       {
+                               value = (int)IPAddress.NetworkToHostOrder(value);
+                       }
+
+                       byte[] buffer = BitConverter.GetBytes(value);
+
+                       this.stream.Write(buffer, 0, buffer.Length);
+               }
+
+               protected void Write(byte[] buffer)
+               {
+                       this.Write(buffer, 0, buffer.Length);
+               }
+
+               protected void Write(byte[] buffer, int offset, int count)
+               {
+                       this.stream.Write(buffer, offset, count);
+               }
+
+               #endregion
+
+               #region Methods
+
+               public virtual void Append(int type)
+               {
+                       this.WriteByte(type);
+               }
+
+               public byte[] ToArray()
+               {
+                       return stream.ToArray();
+               }
+
+               #endregion
+       }
+}
index 7df8c114e8d6e0c039a0cb3955ec6563d3b2dbbf..4f55b0667116e0843474f2661b449360c0d4fb93 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections.Specialized;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       #region Delegates\r
-\r
-       internal delegate void EventCountsCallback();\r
-\r
-       #endregion\r
-\r
-       internal class RemoteEvent\r
-       {\r
-               #region Callbacks\r
-\r
-               public EventCountsCallback EventCountsCallback\r
-               {\r
-                       get { return this.eventCountsCallback; }\r
-                       set { this.eventCountsCallback = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private EventCountsCallback eventCountsCallback;\r
-               private StringCollection        events;\r
-               private IDatabase       db;\r
-               private int                     localId;\r
-               private int                     remoteId;\r
-               private bool            initialCounts;\r
-               private int[]           previousCounts;\r
-               private int[]           actualCounts;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public IDatabase Database\r
-               {\r
-                       get { return this.db; }\r
-               }\r
-\r
-               public int LocalId\r
-               {\r
-                       get { return this.localId; }\r
-                       set { this.localId = value; }\r
-               }\r
-\r
-               public int RemoteId\r
-               {\r
-                       get { return this.remoteId; }\r
-                       set { this.remoteId = value; }\r
-               }\r
-\r
-               public StringCollection Events\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.events == null)\r
-                               {\r
-                                       this.events = new StringCollection();\r
-                               }\r
-\r
-                               return this.events;\r
-                       }\r
-               }\r
-\r
-               public bool HasChanges\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.actualCounts == null && this.previousCounts == null)\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               else if (this.actualCounts != null && this.previousCounts == null)\r
-                               {\r
-                                       return true;\r
-                               }\r
-                               else if (this.actualCounts.Length != this.previousCounts.Length)\r
-                               {\r
-                                       return true;\r
-                               }\r
-\r
-                               for (int i = 0; i < this.actualCounts.Length; i++)\r
-                               {\r
-                                       if (this.actualCounts[i] != this.previousCounts[i])\r
-                                       {\r
-                                               return true;\r
-                                       }\r
-                               }\r
-\r
-                               return false;\r
-                       }\r
-               }\r
-\r
-               public int[] PreviousCounts\r
-               {\r
-                       get { return this.previousCounts; }\r
-               }\r
-\r
-               public int[] ActualCounts\r
-               {\r
-                       get { return this.actualCounts; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public RemoteEvent(IDatabase db) : this(db, 0, 0, null)\r
-               {\r
-               }\r
-\r
-               public RemoteEvent(IDatabase db, int localId, int remoteId, StringCollection events)\r
-               {\r
-                       this.db = db;\r
-                       this.localId = localId;\r
-                       this.remoteId = remoteId;\r
-                       this.events = events;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void QueueEvents()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               this.db.QueueEvents(this);\r
-                       }\r
-               }\r
-\r
-               public void CancelEvents()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               this.db.CancelEvents(this);\r
-                               this.ResetCounts();\r
-                       }\r
-               }\r
-\r
-               public void ResetCounts()\r
-               {\r
-                       this.initialCounts      = false;\r
-                       this.actualCounts       = null;\r
-                       this.previousCounts = null;\r
-               }\r
-\r
-               public void EventCounts(byte[] buffer)\r
-               {\r
-                       int pos = 1;\r
-                       Charset charset = this.db.Charset;\r
-\r
-                       if (buffer != null)\r
-                       {\r
-                               if (this.initialCounts)\r
-                               {\r
-                                       this.previousCounts = this.actualCounts;\r
-                               }\r
-\r
-                               this.actualCounts = new int[this.events.Count];\r
-\r
-                               while (pos < buffer.Length)\r
-                               {\r
-                                       int length = buffer[pos++];\r
-                                       string eventName = charset.GetString(buffer, pos, length);\r
-\r
-                                       pos += length;\r
-\r
-                                       int index = this.events.IndexOf(eventName);\r
-                                       if (index != -1)\r
-                                       {\r
-                                               this.actualCounts[index] = BitConverter.ToInt32(buffer, pos) - 1;\r
-                                       }\r
-\r
-                                       pos += 4;\r
-                               }\r
-\r
-                               if (!this.initialCounts)\r
-                               {\r
-                                       this.QueueEvents();\r
-                                       this.initialCounts = true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       if (this.EventCountsCallback != null)\r
-                                       {\r
-                                               this.EventCountsCallback();\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public EventParameterBuffer ToEpb()\r
-               {\r
-                       EventParameterBuffer epb = this.db.CreateEventParameterBuffer();\r
-\r
-                       epb.Append(IscCodes.EPB_version1);\r
-\r
-                       for (int i = 0; i < this.events.Count; i++)\r
-                       {\r
-                               if (this.actualCounts != null)\r
-                               {\r
-                                       epb.Append(this.events[i], this.actualCounts[i] + 1);\r
-                               }\r
-                               else\r
-                               {\r
-                                       epb.Append(this.events[i], 0);\r
-                               }\r
-                       }\r
-\r
-                       return epb;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections.Specialized;
+
+namespace FirebirdSql.Data.Common
+{
+       #region Delegates
+
+       internal delegate void EventCountsCallback();
+
+       #endregion
+
+       internal class RemoteEvent
+       {
+               #region Callbacks
+
+               public EventCountsCallback EventCountsCallback
+               {
+                       get { return this.eventCountsCallback; }
+                       set { this.eventCountsCallback = value; }
+               }
+
+               #endregion
+
+               #region Fields
+
+               private EventCountsCallback eventCountsCallback;
+               private StringCollection        events;
+               private IDatabase       db;
+               private int                     localId;
+               private int                     remoteId;
+               private bool            initialCounts;
+               private int[]           previousCounts;
+               private int[]           actualCounts;
+
+               #endregion
+
+               #region Properties
+
+               public IDatabase Database
+               {
+                       get { return this.db; }
+               }
+
+               public int LocalId
+               {
+                       get { return this.localId; }
+                       set { this.localId = value; }
+               }
+
+               public int RemoteId
+               {
+                       get { return this.remoteId; }
+                       set { this.remoteId = value; }
+               }
+
+               public StringCollection Events
+               {
+                       get
+                       {
+                               if (this.events == null)
+                               {
+                                       this.events = new StringCollection();
+                               }
+
+                               return this.events;
+                       }
+               }
+
+               public bool HasChanges
+               {
+                       get
+                       {
+                               if (this.actualCounts == null && this.previousCounts == null)
+                               {
+                                       return false;
+                               }
+                               else if (this.actualCounts != null && this.previousCounts == null)
+                               {
+                                       return true;
+                               }
+                               else if (this.actualCounts.Length != this.previousCounts.Length)
+                               {
+                                       return true;
+                               }
+
+                               for (int i = 0; i < this.actualCounts.Length; i++)
+                               {
+                                       if (this.actualCounts[i] != this.previousCounts[i])
+                                       {
+                                               return true;
+                                       }
+                               }
+
+                               return false;
+                       }
+               }
+
+               public int[] PreviousCounts
+               {
+                       get { return this.previousCounts; }
+               }
+
+               public int[] ActualCounts
+               {
+                       get { return this.actualCounts; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public RemoteEvent(IDatabase db) : this(db, 0, 0, null)
+               {
+               }
+
+               public RemoteEvent(IDatabase db, int localId, int remoteId, StringCollection events)
+               {
+                       this.db = db;
+                       this.localId = localId;
+                       this.remoteId = remoteId;
+                       this.events = events;
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void QueueEvents()
+               {
+                       lock (this.db)
+                       {
+                               this.db.QueueEvents(this);
+                       }
+               }
+
+               public void CancelEvents()
+               {
+                       lock (this.db)
+                       {
+                               this.db.CancelEvents(this);
+                               this.ResetCounts();
+                       }
+               }
+
+               public void ResetCounts()
+               {
+                       this.initialCounts      = false;
+                       this.actualCounts       = null;
+                       this.previousCounts = null;
+               }
+
+               public void EventCounts(byte[] buffer)
+               {
+                       int pos = 1;
+                       Charset charset = this.db.Charset;
+
+                       if (buffer != null)
+                       {
+                               if (this.initialCounts)
+                               {
+                                       this.previousCounts = this.actualCounts;
+                               }
+
+                               this.actualCounts = new int[this.events.Count];
+
+                               while (pos < buffer.Length)
+                               {
+                                       int length = buffer[pos++];
+                                       string eventName = charset.GetString(buffer, pos, length);
+
+                                       pos += length;
+
+                                       int index = this.events.IndexOf(eventName);
+                                       if (index != -1)
+                                       {
+                                               this.actualCounts[index] = BitConverter.ToInt32(buffer, pos) - 1;
+                                       }
+
+                                       pos += 4;
+                               }
+
+                               if (!this.initialCounts)
+                               {
+                                       this.QueueEvents();
+                                       this.initialCounts = true;
+                               }
+                               else
+                               {
+                                       if (this.EventCountsCallback != null)
+                                       {
+                                               this.EventCountsCallback();
+                                       }
+                               }
+                       }
+               }
+
+               public EventParameterBuffer ToEpb()
+               {
+                       EventParameterBuffer epb = this.db.CreateEventParameterBuffer();
+
+                       epb.Append(IscCodes.EPB_version1);
+
+                       for (int i = 0; i < this.events.Count; i++)
+                       {
+                               if (this.actualCounts != null)
+                               {
+                                       epb.Append(this.events[i], this.actualCounts[i] + 1);
+                               }
+                               else
+                               {
+                                       epb.Append(this.events[i], 0);
+                               }
+                       }
+
+                       return epb;
+               }
+
+               #endregion
+       }
+}
index 303078959929952669f91c73a5376b0ab77b539e..ad326f3a7e28b08e6c1d17f9032937a3114277f6 100644 (file)
Binary files a/mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Resources/isc_error_msg.resources and b/mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Resources/isc_error_msg.resources differ
index 179963fdb812d37b6f9948ad6c86813c2c56c584..1a6e4abb50297aca0b21499a1a46e9a99062783c 100644 (file)
-336265216=This is a modified text message\r
-336330769=cannot set APOLLO tape descriptor attribute for {0}\r
-336330768=cannot create APOLLO tape descriptor file {0}\r
-336330767=device type not specified\r
-336330766=database {0} already exists.  To replace it, use the -R switch\r
-336330765=REPLACE specified, but the first file {0} is a database\r
-336330764=expected page size, encountered "{0}"\r
-336330763=input and output have the same name.  Disallowed.\r
-336330762=requires both input and output filenames\r
-336330761=multiple sources or destinations specified\r
-336330760=page size is allowed only on restore or create\r
-336330759=protection is not there yet\r
-336330758=device type {0} not known\r
-336330757=conflicting switches for backup/restore\r
-336330756=redirect location for output is not specified\r
-336330755=Page size specified ({0}) greater than limit (8192 bytes)\r
-336330754=page size parameter missing\r
-336330753=found unknown switch\r
-336330752=could not locate appropriate error message\r
-336396693=the current position is on a crack\r
-336396692=illegal operation when at beginning of stream\r
-336396691=Preceding file did not specify length, so {0} must include starting page number\r
-336396690=Shadow number must be a positive integer\r
-336396689=node not supported\r
-336396688=sort error: corruption in data structure\r
-336396687=database or file exists\r
-336396684=Illegal array dimension range\r
-336396683=Inappropriate self-reference of column\r
-336396681=This operation is not defined for system tables.\r
-336396673=lock on conflicts with existing lock\r
-336396672=Object is referenced by another object\r
-336396671=Cannot modify object referenced by another object\r
-336396670=Cannot delete object referenced by another object\r
-336396663=The insert failed because a column definition includes validation constraints.\r
-336396651=duplicate specification of {0} - not supported\r
-336592999=Journal server shutdown\r
-336592998=Journal server started\r
-336592997=Journaling enabled\r
-336592996=Process sign_on\r
-336592995=Process sign_off\r
-336592994=Shutdown requested\r
-336592993=Journaling disabled\r
-336592992=Process disconnect\r
-336592991=Console disconnected\r
-336592990=Dump id for recovery\r
-335675736=Please respond with YES or NO.\r
-335675735=NO\r
-335675734=YES\r
-335675733=expected comma or ')', encountered "{0}"\r
-335675732=Overflow log specification required for this configuration\r
-335675731=minimum of {0} cache pages required\r
-335675730=Only one log configuration can be specified.\r
-336592989=Name of recovered database\r
-336592988=recover database ({0})? (y/n)\r
-336592987=enter journal directory name:\r
-336592986=Secondary file name\r
-336592985=Online dump file name\r
-336592984=continue? (y/n)?:\r
-336592983= transaction commit at: {0}\r
-336592982=applying clumps to log page {0}\r
-335675729=Cannot add and drop log file in same statement.\r
-336592981=enter new value:\r
-335675728=Minimum log length should be {0} Kbytes\r
-336592980=do you want to change this? (y/n):\r
-335675727=Total length of the partitioned log {0} must be specified\r
-335675726=log partition size too small for {0}\r
-335675725=Cannot modify log file specification.  Drop and redefine log files\r
-335675724=Partitions not supported in series of log file specification\r
-335675723=Raw devices not supported in series of log file specification\r
-335675722=Only raw devices support partitioned log files\r
-335675721=use CASCADE option to remove log files before archive is done\r
-335675720=error in reading list of log files\r
-336396628=cannot create index\r
-336396625=definition error for index {0}\r
-336396624=key size exceeds implementation restriction for index "{0}"\r
-336592979=  -s <file size>\r
-336592978=  -f <file name>\r
-336592977= <online dump options>\r
-336592976= <restore options>\r
-336592975= <disable options>\r
-336592974= <enable options>\r
-336592973=  -s <command>\r
-336592972= <console options>\r
-335675719=error in getting Write-ahead Log information\r
-336592971= <server options>\r
-335675718=error committing deletion of shared cache file\r
-336592970=error in file seek\r
-335675717=no shared cache file exists to drop\r
-335675716=error committing new shared cache file declaration\r
-335675715=a shared cache file {0} already exists\r
-335675714=a node name is not permitted in a shared cache file name\r
-335675713=error committing new Write-ahead Log declarations\r
-335675712=DYN request size limit exceeded\r
-335675711=Unexpected sort clause\r
-335675710=expected GENERATOR, encountered "{0}"\r
-336396611={0} extension error\r
-336592969=no buffers available\r
-336592968=invalid clumplet record\r
-336592967=invalid secondary database file sequence number\r
-336592966=ms_$mapl -- wrong length map\r
-336592965=invalid clump type\r
-336592964=wrong use count for buffer\r
-336592963=compress: temporary buffer is too small for page\r
-336592962=wrong clump type for transaction inventory page\r
-335675709=expected comma or right bracket, encountered "{0}"\r
-336592961=wrong clump type index root page\r
-335675708=expected ')', encountered "{0}"\r
-336592960=wrong clump type for pointer page\r
-335675707=expected ON or '(', encountered "{0}"\r
-335675706=expected ')', encountered "{0}"\r
-335675705=expected ON or '(', encountered "{0}"\r
-335675704=key length ({0}) for compound index {1} exceeds 202\r
-335675703=Set_generator requires write privilege for RDB$GENERATORS.\r
-335675702=UDF is limited to 10 parameters\r
-335675701=shadow {0} is inactive\r
-335675700=Ceasing processing.\r
-336396603=invalid ARRAY or BLOB operation\r
-336592959=wrong clump type for page inventory page\r
-336592958=wrong clump type for b-tree page\r
-336592957=b-tree node delete. wrong length\r
-336592956=b-tree node delete. wrong delta\r
-336592955=wrong clump type generator page\r
-336592954=wrong clump type for header page\r
-336592953=invalid line offset\r
-336592952=no space for segment in data page\r
-336592951=wrong clump type for data page ({0})\r
-336592950=error in processing log files\r
-335610299=There are no filters defined in any open database.\r
-335610298=Filters are not supported in any open database.\r
-335610297=Filter {0} is not defined in any open database.\r
-335610296=Filter {0} is not defined in database {1}.\r
-335610295=Filters are not supported in database {0}.\r
-335610294=References to array fields like {0} in relation {1} are not supported\r
-335610293=released block overlaps prior free block\r
-335610292=released block overlaps following free block\r
-335610291=block released twice\r
-336592949=no online dump file specified\r
-335610290=memory pool free list is incorrect\r
-336592948=failure in online dump processing\r
-336592947=invalid online dump record in journal database\r
-336592946=no space on header page\r
-336592945=write() failed in writing page\r
-336592944=lseek failed in write page\r
-336592943=unknown log record type: {0}\r
-336592942=end online dump record. file seqno ({0}) offset ({1})\r
-336592941=start online dump record. file seqno ({0}) offset ({1})\r
-336592940=clumplet records for page ({0}) - applied\r
-335610289= array\r
-335610288=Operation unlicensed for database "{0}"\r
-335610287=Could not drop database file "{0}"\r
-335610286=Unlicensed for database "{0}"\r
-335610285=database file name required on DROP DATABASE\r
-335610284=    Argument {0} is\r
-335610283=    Return argument is\r
-335610282=    Function library is {0}\r
-335610281=Function {0} in database "{1}" ({2}):\r
-336592939=clumplet records for page ({0}) - not applied\r
-335610280=Function {0} ({1}) in database "{2}" ({3}):\r
-336592938=full page record (page = {0}) - applied\r
-336592937=full page record (page = {0}) - not applied\r
-336592936=end processing log files\r
-336592935=start processing log files\r
-336592934=end processing online dump files\r
-336592933=start processing online dump files\r
-336592932=log file for recovery: {0}\r
-336592931=database "{0}" ({1}) disabled at {2}\r
-336592930=applying clumps to tip page {0}\r
-335610279=Function {0} is not defined in any open database.\r
-335610278=Function {0} is not defined in database {1}.\r
-335610277=    Function description:\r
-335610276=Functions are not supported in any open database.\r
-335610275=There are no functions defined in any open database.\r
-335610273=Functions are not supported in database {0}.\r
-335610272=Functions in database "{0}" ({1}):\r
-335610271=matching language string too long\r
-336592929=applying clumps to index root page {0}\r
-335610270=Relation {0} is missing or undefined\r
-336592928=applying clumps to pointer page {0}\r
-336592927=applying clumps to page inventory page {0}\r
-336592926=b-tree drop node. offset {0}\r
-336592925=b-tree add segment. expected after length {0}\r
-336592924=b-tree add segment before length: {0}\r
-336592923=valid b-tree btr_length: {0}\r
-336592922=b-tree add node. offset: {0}  length: {1}\r
-336592921=b-tree add node. before offset {0}\r
-336592920=applying clumps to b-tree page {0}\r
-335610269=Incompatible global field {0} already exists in target database\r
-335610268=function {0} not found in database {1}\r
-335610267=Cannot convert "{0}" to a numeric value\r
-335610266=Cannot convert from {0} to {1}\r
-335610265=Could not create QLI$PROCEDURES index\r
-335610264=Database handle {0} conflicts with an established name\r
-335610263=TABLE\r
-335610262=Dynamic DDL buffer exceeded\r
-335610261=ADD or DROP\r
-336592919=applying clumps to gen-id page {0}\r
-335610260=TO\r
-336592918=applying clumps to header page {0}\r
-336592917=applying clumps to data page {0}\r
-336592916=log file for recovery: {0}\r
-336592915=invalid time stamp on -u (use "dd-mmm-yy hh:mm:ss")\r
-336592914=time stamp required with -u (e.g., "dd-mmm-yy hh:mm:ss")\r
-336592913=no log files for recovery\r
-336592912=online dump file size must be greater than zero\r
-336592911=please retry, specifying journal database directory\r
-336592910=please retry, specifying correct journal utility\r
-335610259=FROM\r
-335610258=OPTION\r
-335610257=GRANT\r
-335610256=user name identifier\r
-335610255=table name\r
-335610254=field name\r
-335610253=ON\r
-335610252==\r
-335610251=SELECT\r
-336592909=please retry, giving a database name\r
-335610250=AS\r
-336592908=database file name ({0}) already specified\r
-336592907=  -u <until options>\r
-336592906=  -i  -run utility in interactive mode\r
-336592905=  -a <archive base name>\r
-336592904=  -j <journal directory>\r
-336592903= <utility> : -enable | -disable | -online_dump | -server | -console | -restore\r
-336592902=enter file name or <Ctrl-D> to end input:\r
-336592901=enter file size or <Ctrl-D> to end input:\r
-336592900=reading online dump parameters\r
-335610249=NULL\r
-335610248=Aggregates not allowed in view definition\r
-335610247=GROUP BY not allowed in view definition\r
-335610246=Multiple page size specifications\r
-335610245=INDEX\r
-335610244=FLOAT\r
-335610243=Database filename required in CREATE\r
-335610242=DATABASE, TABLE, or INDEX\r
-335610241= Shadow {0}, File: {1} starting at page {2}\r
-335610240=Too many WITHs\r
-335741041=dialect number required\r
-335741040=database SQL dialect must be one of '{0}'\r
-335610239=sort field\r
-335610238=TOP or BOTTOM\r
-335610237=Trigger for relation {0}:\r
-335610236= Triggers defined for this relation:\r
-335610235=System Trigger for relation {0}\r
-335741039= -sql_dialect set database dialect n\r
-335610234=No system triggers are defined\r
-335741038="read_only" or "read_write" required\r
-335610233= Source for the trigger is not available.  Trigger BLR:\r
-335741037= -mode  read_only or read_write\r
-335610232= Source for the trigger:\r
-335741036=Transaction description item unknown\r
-335610231= Description:\r
-335741035=Transaction {0} was rolled back, but prior ones were committed.\r
-335610230=Inactive\r
-335741034=Transaction {0} was committed, but prior ones were rolled back.\r
-335741033=Warning: Multidatabase transaction is in inconsistent state for recovery.\r
-335741032=  Automated recovery would rollback this transaction.\r
-335741031=  Automated recovery would commit this transaction.\r
-335741030=        Database Path: {0}\r
-335610229=Active\r
-335610228=Post-erase\r
-335610227=Pre-erase\r
-335610226=Post-modify\r
-335610225=Pre-modify\r
-335741029=        Remote Site: {0}\r
-335610224=Post-store\r
-335741028=is not found, assumed to be committed.\r
-335610223=Pre-store\r
-335741027=is not found, assumed not prepared.\r
-335610222=    {0} {1}, Sequence {2}, {3}\r
-335741026=is not available.\r
-335610221=Triggers for relation {0}:\r
-335741025=has been rolled back.\r
-335610220=lost message\r
-335741024=has been committed.\r
-335741023=has been prepared.\r
-335741022=    Transaction {0}\r
-335741021=    Host Site: {0}\r
-335741020=  Multidatabase transaction:\r
-335610219=missing message\r
-335610218=make_descriptor: not yet implemented\r
-335610217=computable: not yet implemented\r
-335610216=not yet implemented (compile_statement)\r
-335610215=compile_expression: not yet implemented\r
-335741019=Transaction {0}:\r
-335610214=cannot find database for BLOB edit\r
-335741018=failed to reconnect to a transaction in database {0}\r
-335610213=relations from multiple databases in single RSE\r
-335741017=Attach unsuccessful.\r
-335610212=EDIT argument must be a BLOB field\r
-335741016=Enter a valid path:\r
-335610211=gen_statistical: not understood\r
-335741015=Original path: {0}\r
-335610210=gen_statement: not yet implemented\r
-335741014=Could not reattach to database for transaction {0}.\r
-335741013=Commit, rollback, or neither (c, r, or n)?\r
-335741012=unexpected end of input\r
-335741011=Either commit or rollback is possible.\r
-335741010=Transaction {0}: All subtransactions have been prepared.\r
-336397085=Ambiguous column reference.\r
-336397084=Undefined name\r
-336397083=column {0} is not defined in table {1}\r
-336397082=Column does not belong to referenced table\r
-336397080=invalid ORDER BY clause\r
-335610209=gen_expression: not understood\r
-335610208=gen_descriptor: dtype not recognized\r
-335610207=Do you want to roll back your updates?\r
-335610206=END PROCEDURE\r
-335610205={0}Base field description for {1}:\r
-335741009=a proper action for transaction {0}.\r
-335610204={0} Based on field {1} of {2}{3}\r
-335741008=Insufficient information is available to determine\r
-335610203=    Edit string:   {0}\r
-335741007=A commit is necessary to preserve the two-phase commit.\r
-335610202=    Edit string:  {0}\r
-335741006=Transaction {0} has been partially committed.\r
-335610201=    Query header:\r
-335741005=A rollback of this transaction will violate two-phase commit.\r
-335610200=    Query name:  {0}\r
-335741004=Transaction {0} has already been partially committed.\r
-335741003=A rollback of transaction {0} is needed to preserve two-phase commit.\r
-335741002=A commit of transaction {0} will violate two-phase commit.\r
-335741001=Unrecognized info item {0}\r
-335741000=More limbo transactions than fit.  Try again\r
-336397069=table {0} is not defined\r
-336397058=WAL Writer error\r
-336397057=Log file header of {0} too small\r
-336397056=Invalid version of log file {0}\r
-336397055=Log file {0} not latest in the chain but open flag still set\r
-336397054=Log file {0} not closed properly; database recovery may be required\r
-336397053=Database name in the log file {0} is different\r
-336397052=Unexpected end of log file {0} at offset {1}\r
-336397051=Incomplete log record at offset {0} in log file {1}\r
-336397050=Log record header too small at offset {0} in log file {1}\r
-336397049=Cache or Log size too small\r
-336397048=Illegal attempt to attach to an uninitialized WAL segment for {0}\r
-336397047=Invalid WAL parameter block option {0}\r
-336397046=Cannot roll over to the next log file {0}\r
-336397045=database does not use Write-ahead Log\r
-336397044=WAL subsystem encountered error\r
-336397043=WAL subsystem corrupted\r
-336397042=Database {0}: WAL subsystem bug for pid {1}n{2}\r
-336397041=Could not expand the WAL segment for database {0}\r
-336397040=Unable to roll over; please see Firebird log.\r
-336397039=WAL I/O error.  Please see Firebird log.\r
-336397038=WAL writer - Journal server communication error.  Please see Firebird log.\r
-336397037=WAL buffers cannot be increased.  Please see Firebird log.\r
-336397036=WAL setup error.  Please see Firebird log.\r
-336397035=WAL writer synchronization error for the database {0}\r
-336397034=Cannot start WAL writer for the database {0}\r
-336397033=Write-ahead Log without shared cache configuration not allowed\r
-336397031=WAL defined; Cache Manager must be started first\r
-336397030=Overflow log specification required for round-robin log\r
-336397029=Write-ahead Log with shadowing configuration not allowed\r
-336397028=Cache or Log redefined\r
-336397027=Log file specification partition error\r
-336397007=table {0} is not referenced in plan\r
-336397006=the table {0} is referenced twice; use aliases to differentiate\r
-336397005=table {0} is referenced in the plan but not the from list\r
-336397004=index {0} cannot be used in the specified plan\r
-335675699=Ceasing processing because of errors.\r
-335675698=expected end_trigger or description keyword, encountered "{0}"\r
-335675697=expected trigger action, encountered "{0}"\r
-335675696=expected message keyword, encountered "{0}"\r
-335675695=A relation or view may not be defined and then deleted in a single execution of GDEF\r
-335675694=Modify data type of array {0} requires complete field specification\r
-335675693=Array indexes and size cannot be modified\r
-335675692=table {0} already exists\r
-335675691=A node name is not permitted in an external file name\r
-335675690=A non-Decnet node name is not permitted in an external file name\r
-336396599=wrong page type\r
-336789563=The evaluation license has already been used on this server.  You need to purchase a non-evaluation license.\r
-336396598=segments not allowed in expression index {0}\r
-336789562=Customized license entry created by means other than entering a certificate ID/key.\r
-336396597=new record size of {0} bytes is too big\r
-336789561=Evaluation InterBase Server license and simultaneous user license for five (5) users.\r
-336396596=maximum indexes per table ({0}) exceeded\r
-336789560=Precompiler license for Pascal.\r
-336396595=Too many concurrent executions of the same request\r
-336396594=cannot access column {0} in view {1}\r
-335675689=A node name is not permitted in a shadow, secondary, or log file name\r
-335675688=symbol {0} is too long, truncating it to {1} characters\r
-335675687=Functions cannot return arrays.\r
-335675686=unexpected end of file, semicolon missing?\r
-335675685=argument mode 'by value' requires a return mode\r
-335675684=argument mode of a return_argument must be 'by reference'\r
-335675683=nn/* Index Definitions */\r
-335675682=nn/* Generator Definitions */\r
-335675681=BLR request size limit exceeded\r
-336789559=Precompiler license for Cobol.\r
-335675680=shadow file must be AUTO or MANUAL\r
-336789558=Precompiler license for Fortran.\r
-336789557=Precompiler license for Ada.\r
-336789556=Precompiler license for C and C++.\r
-336789555=Simultaneous user license for unlimited users.\r
-336789554=Internet access license with unlimited users.\r
-336789553=InterBase server activation license and simultaneous user license for unlimited users.\r
-336789552=InterBase server activation license and simultaneous user license for five (5) users.\r
-336789551=Firebird Server: Metadata capability.\r
-336789550=Firebird Server: Remote access capability.\r
-335675679=inappropriate self-reference of field\r
-335675678=\r
-335675677=internal error during DYN pretty print\r
-335675676=internal error during DYN pretty print\r
-335675675=internal error during DYN pretty print\r
-335675674=action not implemented yet\r
-335675673=gdef: cannot open DYN output file: {0}\r
-335675672=HSH_remove failed\r
-335675671=line too long\r
-336789549=Firebird Server: Client capability\r
-335675670= unterminated quoted string\r
-336789548=InterBase Server activation license and simultaneous user licnese for one (1) user.\r
-336789547=Local InterBase activation license.\r
-336789546=Simultaneous user license for twenty (20) users.\r
-336789545=Simultaneous user license for ten (10) users.\r
-336789544=Simultaneous user license for five (5) users.\r
-336789543=Simultaneous user license for four (4) users.\r
-336789542=Simultaneous user license for one (1) user.\r
-336789541=Remove license operation failed, KEY: {0}\r
-336789540=Add license operation failed, KEY: {0} ID: {1}\r
-335675669=gds_$put_segment failed\r
-335675668=could not open scratch file\r
-335675667=fseek failed\r
-335675666=expected generator name, encountered "{0}"\r
-335675665=database version is too old for the new syntax: generators\r
-335675664=gds_$close_blob failed\r
-335675663=gds_$get_segment failed\r
-335675662=*****  BLOB option not understood ****\r
-335675661=gds_$open_blob failed\r
-336789539=Operation failed.  An unknown error occurred.\r
-335675660=***** ACL not understood *****\r
-336789538=The certificate could not be validated based on the information given.  Please recheck the ID and key information.\r
-336789537=An error occurred updating the license file.  Operation cancelled.\r
-336789536=The certificate was not removed.  The key does not exist or corresponds to a temporary evaluation license.\r
-336789535=The certificate was not added.  Invalid certificate ID / Key combination.\r
-336789534=The certificate was not added.  A duplicate ID exists in the license file.\r
-336789533=The operation was completed successfully.  Please restart the server for the changes to take effect.\r
-336789532=syntax error in command line\r
-336789531=switch requires a parameter\r
-336789530=switch does not take any parameter\r
-335675659=**** view definition {0} must be recreated ****\r
-335675658=nn/* View Definitions */\r
-335675657=**** erase trigger source for relation {0} must be recreated ****\r
-335675656=**** modify trigger source for relation {0} must be recreated ****\r
-335675655=**** store trigger source for relation {0} must be recreated ****\r
-335675654=****  trigger source for trigger {0} must be recreated ****\r
-335675653=*****  trigger type not understood ****\r
-335675652=nn/* Trigger Definitions */\r
-335675651=n/* Add Security Classes to Defined Objects */\r
-336789529=invalid parameter, no switch specified\r
-335675650=nn/* Relation Definitions */\r
-336789528=ambiguous switch\r
-336789527=illegal operation/switch combination\r
-336789526=invalid switch combination\r
-336789525=invalid switch\r
-336789524=no operation specified\r
-336789523=operation already specified\r
-336789522=InterBase License Utility Version:\r
-336789521=\r
-336789520=Copyright (c) 1985, 1994 by Borland International, Inc.\r
-335675649=nn/* Function Definitions */\r
-335675648=nn/* Filter Definitions */\r
-335675647=nn/* Global Field Definitions */\r
-335675646=n***gds_$database_info failed***\r
-335675645=\r
-335675644=**** field {0} cannot be extracted, computed source missing ***\r
-335675643=nn/* Security Class Definitions / GRANT statements */\r
-335675642=**** unable to decompile missing value ***\r
-335675641=    Version(s) for database "{0}"\r
-336789519=        Software theft is a civil and criminal offense.\r
-335675640=ddl: cannot open {0}\r
-336789518=    Processing will continue in {0} seconds.\r
-336789517=        Your {0}         {1}\r
-336789516=        Your version is "{0}"\r
-336789515=    Be prepared to provide the following information.\r
-336789514=    Pacific time (GMT + 8 hours).\r
-336789513=    between 9 am and 8 pm, Monday through Friday,\r
-336789512=    from outside the United States and Canada call (408) 431-5400,\r
-336789511=    To register this node for InterBase, call (800) 437-7367,\r
-336789510=\r
-336592899=gjrn [-z] <utility> [-debug] [-verbose] [<options>] [<database name>]\r
-336592898=Journal utility version: {0}\r
-335544839=Foreign key references are present for the record\r
-336592897=exiting journal utility due to errors\r
-335544838=Foreign key reference target does not exist\r
-336592896=gjrn::\r
-335544837=Invalid {0} parameter to SUBSTRING. Only positive integers are allowed.\r
-335544836=Concatenation overflow. Resulting string cannot exceed 32K in length.\r
-335544835=Target shutdown mode is invalid for database "{0}"\r
-335544834=Invalid cursor state: {0}\r
-335675639=action not implemented yet\r
-335544833=Physical backup is not allowed while Write-Ahead Log is in use\r
-335675638=expected OF, encountered "{0}"\r
-335544832=Cannot change difference file name while database is in backup mode\r
-335675637=expected relational operator, encountered "{0}"\r
-335544831=Access to {0} "{1}" is denied by server administrator\r
-335675636=expected IN, encountered "{0}"\r
-335544830=Too many recursion levels of EXECUTE STATEMENT\r
-335675635=expected right parenthesis, encountered "{0}"\r
-335675634=expected value expression, encountered "{0}"\r
-335675633=expected left parenthesis, encountered "{0}"\r
-335675632=expected comma or right parenthesis, encountered "{0}"\r
-335675631=expected FROM RSE clause, encountered "{0}"\r
-336789509=    by closing this window.\r
-335675630=unrecognized character in numeric string\r
-336789508=    the registered node is temporarily unavailable, you may continue\r
-336789507=    If you are using this node to demonstrate software, or because\r
-336789506=    Your node is not registered to run InterBase.n    {0}\r
-336789504=The license file does not exist or could not be opened for read\r
-335544829=Variable type (position {0}) in EXECUTE STATEMENT '{1}' INTO does not match returned column type\r
-335544828=Wrong request type in EXECUTE STATEMENT '{0}'\r
-335544827=Invalid argument in EXECUTE STATEMENT - cannot convert to string\r
-335544826=Nested aggregate functions are not allowed\r
-335544825=Invalid expression in the {0} (neither an aggregate function nor a part of the GROUP BY clause)\r
-335544824=Invalid expression in the {0} (not contained in either an aggregate function or the GROUP BY clause)\r
-335675629=too many decimal points\r
-335544823=Cannot use an aggregate function in a GROUP BY clause\r
-335675628=expected =, encountered "{0}"\r
-335544822=Cannot use an aggregate function in a WHERE clause, use HAVING instead\r
-335675627=abort code cannot exceed 255\r
-335544821=Invalid column position used in the {0} clause\r
-335675626=OVER can only be used in CROSS expressions\r
-335544820=Unable to find savepoint with name {0} in transaction context\r
-335675625=action not implemented yet\r
-335675624=action not implemented yet\r
-335675623=action not implemented yet\r
-335675622=global field {0} is not defined\r
-335675621=segment length is valid only for BLOBS\r
-335675620=subtypes are valid only for BLOBS and text\r
-335544819=File exceeded maximum size of 2GB.  Add another database file or use a 64 bit I/O version of Firebird.\r
-335544818=Invalid parameter to SKIP.  Only integers >= 0 are allowed.\r
-335544817=Invalid parameter to FIRST.  Only integers >= 0 are allowed.\r
-335544816=UDF {0}\r
-335544815=GENERATOR {0}\r
-335544814=Services functionality will be supported in a later version  of the product\r
-335675619=computed fields need data types\r
-335544813=Unsupported field type specified in BETWEEN predicate.\r
-335675618={0} is a global, not local, attribute\r
-335544812=Valid client dialects are {0}.\r
-335675617=segment_length\r
-335544811=passed client dialect {0} is not a valid dialect.\r
-335675616=sub type\r
-335544810=value exceeds the range for valid dates\r
-335675615=data type\r
-335675614=missing value\r
-335675613=valid if\r
-335675612=Attempt to change trigger type from ERASE to STORE\r
-335675611=Attempt change trigger type from MODIFY to ERASE\r
-335675610=Attempt change trigger type from MODIFY to STORE\r
-335544809=Function {0} is in {1}, which is not in a permitted directory for external functions.\r
-335544808=DATE data type is now called TIMESTAMP\r
-335544807=SQL warning code = {0}\r
-335544806=Valid database dialects are {0}.\r
-335544805=Database dialect {0} is not a valid dialect.\r
-335544804=Unable to create database {0}\r
-335675609=Attempt change trigger type from STORE to ERASE\r
-335544803=Database dialect not changed.\r
-335675608=expected FROM, encountered "{0}"\r
-335544802=Database dialect being changed from 3 to 1\r
-335675607=REVOKE privilege was not specified\r
-335544801=data type not supported for arithmetic\r
-335675606=expected ON, encountered "{0}"\r
-335544800=Too many Contexts of Relation/Procedure/Views. Maximum allowed is 127\r
-335675605=database version is too old for the new syntax: REVOKE\r
-335675604=Unrecognized privilege "{0}" or unrecognized identifier\r
-335675603=PAGE_SIZE specified ({0}) was rounded up to {1} bytes\r
-335675602=PAGE_SIZE specified ({0}) longer than limit of {1} bytes\r
-335675601=no database declared\r
-335675600=expected trailing bracket, encountered "{0}"\r
-335610199=    Query name:  {0}\r
-335610198=    Field validation:\r
-335610197=    Field is computed from:\r
-335610196=    Datatype information\r
-335610195=    Field description:\r
-335610194=    Global field {0}\r
-335610193=Field {0} in {1} {2} of database {3}\r
-335610192= {0} in relation {1}\r
-335610191=    Global field {0} is used in database {1} as :\r
-335610190=, subtype fixed\r
-335610189=, scale {0}\r
-335610188=date\r
-335610187=long floating\r
-335610186=short floating\r
-335610185=quadword binary\r
-335610184=long binary\r
-335610183=short binary\r
-335610182=null terminated text, length {0}\r
-335610181=varying text, length {0}\r
-335610180=text, length {0}\r
-336724058=z (interactive only)\r
-336724057=displaying version number:\r
-336724056=-z\r
-336724055=-database <security database>\r
-336724054=-role <database administrator SQL role name>\r
-336724053=-password <database administrator password>\r
-336724052=-user <database administrator name>\r
-336724051=available options:\r
-336724050=[ <options> ... ]\r
-335610179=, subtype {0}\r
-335610178=, subtype ACL\r
-335610177=, subtype BLR\r
-335610176=, subtype text\r
-335610175=, segment length {0}\r
-335610174=BLOB\r
-335610173=    {0} comprised of:\r
-335610172=Views in database {0}:\r
-335610171=    {0} comprised of :\r
-336724049=SQL role name already specified\r
-335610170=Views in database {0}:\r
-336724048=database administrator password already specified\r
-336724047=database administrator name already specified\r
-336724046=database already specified\r
-336724045=Warning - maximum 8 significant bytes of password used\r
-336724044=Invalid user name (maximum 31 bytes allowed)\r
-336724043=gsec error\r
-336724042=gsec - memory allocation error\r
-336724041=-lname <lastname>\r
-336724040=-mname <middlename>\r
-335610169=n    Relation {0} is a view defined as:\r
-335610168=n    View source for relation {0} is not available.  View BLR:\r
-335610167=OBSOLETE -    Store trigger for relation {0}:\r
-335610166=OBSOLETE -    Source for the store trigger is not available.  Trigger BLR:\r
-335610165=OBSOLETE -    Modify trigger for relation {0}:\r
-335610164=OBSOLETE -    Source for the modify trigger is not available.  Trigger BLR:\r
-335610163=OBSOLETE -    Erase trigger for relation {0}:\r
-335610162=OBSOLETE -    Source for the erase trigger is not available.  Trigger BLR:\r
-335610161=OBSOLETE -    Triggers for relation {0}:\r
-335610160=OBSOLETE -    Store trigger for relation {0}:\r
-336724039=-fname <firstname>\r
-336724038=-org <organizationname>\r
-336724037=-proj <projectname>\r
-336724036=-gid <uid>\r
-336724035=-uid <uid>\r
-336724034=-pw <password>\r
-336724033=available parameters:\r
-336724032=quit (interactive only)\r
-336724031=quit interactive session:\r
-336724030=help\r
-335610159=OBSOLETE -    Source for the store trigger is not available.  Trigger BLR:\r
-335610158=OBSOLETE -    Modify trigger for relation {0}:\r
-335610157=OBSOLETE -    Source for the modify trigger is not available.  Trigger BLR:\r
-335610156=OBSOLETE -    Erase trigger for relation {0}:\r
-335610155=OBSOLETE -    Source for the erase trigger is not available.  Trigger BLR:\r
-335610154=OBSOLETE - Triggers for relation {0}:\r
-335610153=    Security classes for database {0}\r
-335610152=OBSOLETE -        A store trigger is defined for {0}\r
-335610151=OBSOLETE -        A modify trigger is defined for {0}\r
-335610150=OBSOLETE -        An erase trigger is defined for {0}\r
-336724029=? (interactive only)\r
-336724028=help:\r
-336724027=modify <name> <parameter> [ <parameter> ... ]\r
-336724026=modifying a user's parameters:\r
-336724025=display <name>\r
-336724024=displaying one user:\r
-336724023=display\r
-336724022=displaying all users:\r
-336724021=delete <name>\r
-336724020=deleting a current user:\r
-335610149=    Stored in external file {0}\r
-335610148=    Security class {0}\r
-335610147=    Description:\r
-335610146=        Index {0}{1}\r
-335610145=            index {0} is NOT active\r
-335610144=        Index {0}{1}\r
-335610143=    Field description:\r
-335610142=Global fields for database {0}:\r
-335610141=Forms in database {0}\r
-335610140=    {0} is not used in any relations in database {1}\r
-336724019=add <name> [ <parameter> ... ]\r
-336724018=adding a new user:\r
-336724017=available commands:\r
-336724016=interactive usage:\r
-336724015=<command> [ <parameter> ... ]\r
-336724014=command line usage:\r
-336724013=gsec utility - maintains user password database\r
-336724012=incompatible switches specified\r
-336724011=no parameters allowed for this operation\r
-336724010=no operation specified for parameters\r
-335610139=    Query header:\r
-335610138=    Edit string:  {0}\r
-335610137=    Query name:  {0}\r
-335610136=    Field validation:\r
-335610135=    Field is computed from:\r
-335610134=    Datatype information:\r
-335610133=    Field description:\r
-335610132=Global field {0} in database {1}\r
-335610131=    Query header:\r
-335610130=    Edit string:  {0}\r
-336724009=ambiguous switch specified\r
-336724008=invalid switch specified\r
-336724007=gsec version\r
-336724006=last name already specified\r
-336724005=middle name already specified\r
-336724004=first name already specified\r
-336724003=organization already specified\r
-336724002=project already specified\r
-336724001=gid already specified\r
-336331035=closing file, committing, and finishing. {0} bytes written\r
-336724000=uid already specified\r
-336331034=restoring data only ignoring foreign key, unique, not null & other constraints\r
-336331033=just data ignore all constraints etc.\r
-336331032=setting database to read-only access\r
-336331031="read_only" or "read_write" required\r
-336331030= {0}MO(DE) <access>      "read_only" or "read_write" access\r
-335610129=    Edit string:  {0}\r
-335610128=    Query name:  {0}\r
-335610127=    Query name:  {0}\r
-335610126=    Security class {0}\r
-335610125=    Field validation:\r
-335610124=    Field is computed from:\r
-335610123=    Datatype information:\r
-335610122=    Field description:\r
-335610121=    Global field {0}\r
-335610120=Field {0} in {1} {2} of database {3}\r
-336331029=        {0}SE(RVICE)            use services manager\r
-336331028= {0}USE_(ALL_SPACE)      do not reserve space for record versions\r
-336331027=\r
-336331026=Cannot restore over current database, must be SYSDBA or owner of the existing database.\r
-336331025=service name parameter missing\r
-336331024=Warning -- free disk space exhausted for file {0}, the rest of the bytes ({1}) will be written to file {2}\r
-336331023=file size given ({0}) is less than minimum allowed ({1})\r
-336331022=free disk space exhausted\r
-336331021=can't write a header record to file {0}\r
-336331020=database file specification missing\r
-335610119= File: {0} starting at page {1}\r
-335610118=    Database description:\r
-335610117=    Database description:\r
-335610116=    Security class for database {0}\r
-335610115=Operation unlicensed for database "{0}"\r
-335610114=do not understand BLR operator {0}\r
-335610113=database info call failed\r
-335610112=No data type specified for field {0}\r
-335610111=Data type conflict with existing global field {0}\r
-335610110=field {0} not found in relation {1}\r
-336331019=backup file {0} might be corrupt\r
-336331018=standard output is not supported when using split operation\r
-336331017= standard input is not supported when using join operation\r
-336331016=can't join -- one of the files missing\r
-336331015=file {0} out of sequence\r
-336331014=size specification either missing or incorrect for file {0}\r
-336331013=Starting with volume #{0}, "{1}"\r
-336331012=page buffers is allowed only on restore or create\r
-336331011=expected page buffers, encountered "{0}"\r
-336331010=page buffers parameter missing\r
-335610109=global field {0} does not exist\r
-335610108=data type cannot be changed locally\r
-335610107=Field {0} already exists in relation {1}\r
-335610106=Unlicensed for database "{0}"\r
-335610105=Interactive metadata updates are not available on Rdb\r
-335610104=no active database for operation\r
-335610103=field {0} does not exist\r
-335610102=Index {0} does not exist in database {1}\r
-335610101=global field {0} is not defined\r
-335610100=Interactive metadata updates are not available on Rdb\r
-336331009= {0}BU(FFERS)            override page buffers default\r
-336331008=gbak: ERROR:\r
-336331007=gbak: WARNING:\r
-336331006=        {0}CO(NVERT)            backup external files as tables\r
-336331005=SQL role parameter missing\r
-336331004=        {0}RO(LE)               Firebird SQL role\r
-336331003=restoring SQL role: {0}\r
-336331002=Bad attributes for restoring SQL role\r
-336331001=writing sql role: {0}\r
-336331000=writing SQL roles\r
-336462436=Duplicate column or domain name found.\r
-335544799=The service name was not specified.\r
-335544798=You created an indirect dependency on uncommitted metadata. You must roll back the current transaction.\r
-335544797=user name and password are required while attaching to the services manager\r
-335544796=Client SQL dialect {0} does not support reference to {1} datatype\r
-335544795=unexpected item in service parameter block, expected {0}\r
-335544794=operation was cancelled\r
-335675599=expected comma between group and user ID, encountered "{0}"\r
-335544793=Metadata update statement is not allowed by the current database SQL dialect {0}\r
-335675598=expected number, encountered "{0}"\r
-335544792=Cannot attach to services manager\r
-335675597=return mode must be return_value or return_argument\r
-335544791=The file {0} is currently in use by another process.  Try again later.\r
-335675596=argument mode is by value, or by reference\r
-335544790=Service {0} requires SYSDBA permissions.  Reattach to the Service Manager using the SYSDBA account.\r
-335675595=argument mode by value not allowed for this data type\r
-335675594=expected "]", encountered "{0}"\r
-335675593=character field length must be positive\r
-335675592=expected "[", encountered "{0}"\r
-335675591=expected field sub_type, encountered "{0}"\r
-335675590=expected field sub_type, encountered "{0}"\r
-335544789=Specified EXTRACT part does not exist in input datatype\r
-335544788=Unable to perform operation.  You must be either SYSDBA or owner of the database\r
-335544787=Cannot update rows in external files.\r
-335544786=Cannot delete rows from external files.\r
-335544785=Floating Point Error. The Code caused an Arithmetic Exception or a floating point exception.\r
-335544784=Bus Error. The Code caused a system bus error.\r
-335675589=segment length must be positive\r
-335544783=Illegal Instruction. The Code attempted to perfrom an illegal operation.\r
-335675588=validation expression must be parenthesized\r
-335544782=Segmentation Fault. The code attempted to access memory without priviledges.\r
-335675587=unmatched parenthesis\r
-335544781=Stack overflow.  The resource requirements of the runtime stack have exceeded the memory available to it.\r
-335675586=COMPUTED BY expression must be parenthesized\r
-335544780=An exception occurred that does not have a description.  Exception number {0}.\r
-335675585=expected DESCRIPTION, EDIT_STRING, MISSING VALUE, SECURITY_CLASS or VALID_IF, encountered "{0}"\r
-335675584=expected field clause, encountered "{0}"\r
-335675583=data type cstring not supported for fields\r
-335675582=expected semicolon, encountered "{0}"\r
-335675581=expected comma, encountered "{0}"\r
-335675580=array size must be positive\r
-336396486=Arithmetic overflow or division by zero has occurred.\r
-336396485=Invalid insert or update value(s): object columns arenconstrained - no 2 table rows can have duplicate column values\r
-336396484=An error was found in the application program input parameters for the SQL statement.\r
-336396482=Only simple column names permitted for VIEW WITH CHECK OPTION\r
-336396481=No WHERE clause for VIEW WITH CHECK OPTION\r
-336396480=Only one table allowed for VIEW WITH CHECK OPTION\r
-335544779=Integer overflow.  The result of an integer operation caused the most significant bit of the result to carry.\r
-335544778=Integer divide by zero.  The code attempted to divide an integer value by an integer divisor of zero.\r
-335544777=Floating-point underflow.  The exponent of a floating-point operation is less than the magnitude allowed.\r
-335544776=Floating-point stack check.  The stack overflowed or underflowed as the result of a floating-point operation.\r
-335544775=Floating-point overflow.  The exponent of a floating-point operation is greater than the magnitude allowed.\r
-335544774=Floating-point invalid operand.  An indeterminant error occurred during a floating-point operation.\r
-335675579=database version is too old for the new syntax: array\r
-335544773=Floating-point inexact result.  The result of a floating-point operation cannot be represented as a deciaml fraction.\r
-335675578=expected command, encountered "{0}"\r
-335544772=Floating-point divide by zero.  The code attempted to divide a floating-point value by zero.\r
-335675577=expected object for DROP, encountered "{0}"\r
-335544771=Float denormal operand.  One of the floating-point operands is too small to represent a standard float value.\r
-335544770=Array bounds exceeded.  The code attempted to access an array element that is out of bounds.\r
-335675575=expected object for DEFINE, encountered "{0}"\r
-335675574=expected drop/modify of field or security class, encountered "{0}"\r
-335675573=A computed expression cannot be changed or added\r
-335675572=database version is too old for the new syntax: types\r
-335675571=expected message modification keyword, encountered "{0}"\r
-335675570=message number {0} exceeds 255\r
-336396479=DISTINCT, GROUP or HAVING not permitted for VIEW WITH CHECK OPTION\r
-336396478=No subqueries permitted for VIEW WITH CHECK OPTION\r
-336396477=multiple rows in singleton select\r
-336396472=external file could not be opened for output\r
-336396471=The insert, update, delete, ddl or authorization statement cannotn be executed because the transaction is inquiry only\r
-335544769=Datatype misalignment.  The attempted to read or write a value that was not stored on a memory boundary.\r
-335544768=Access violation.  The code attempted to access a virtual address without privilege to do so.\r
-335544767=A fatal exception occurred during the execution of a blob filter.\r
-335544766=SQL dialect {0} is not supported in this database\r
-335544765=attempted update on read-only database\r
-335544764=DATE must be changed to TIMESTAMP\r
-335675569=Unsuccessful attempt to modify trigger relation\r
-335544763=a string constant is delimited by double quotes\r
-335675568=expected trigger name, encountered "{0}"\r
-335544762=size of optimizer block exceeded\r
-335675567=database version is too old for the new trigger syntax\r
-335544761=too many open handles to database\r
-335675566=expected field action, encountered "{0}"\r
-335544760=invalid clause --- '{0}'\r
-335675565=A computed expression cannot be changed or added\r
-335675564=expected DESCRIPTION, encountered "{0}"\r
-335675563=database version is too old for the new syntax: ASC/DESC\r
-335675562=Security class can appear only on local field references\r
-335675561= A computed expression cannot be changed or added\r
-335675560=data type cstring not supported for fields\r
-336396468=wrong or obsolete version\r
-336396465=invalid bookmark handle\r
-336396464=invalid lock level {0}\r
-336396463=invalid lock handle\r
-336396462=Invalid statement handle\r
-336396461=invalid direction for find operation\r
-336396460=invalid key position\r
-335544759=can not define a not null column with NULL as default value\r
-335544758=sort record size of {0} bytes is too big\r
-335544757=An error occurred while updating the security database.\r
-335544756=An error occurred while attempting to delete the user record.\r
-335544755=An error occurred while attempting to modify the user record.\r
-335544754=An error occurred while attempting to add the user.\r
-335675559=expected global field name, encountered "{0}"\r
-335544753=The user name specified was not found in the security database\r
-335675558=Trigger {0} does not exist\r
-335544752=A duplicate user name was found in the security database\r
-335675557=expected STORE, MODIFY, ERASE, END_TRIGGER, encountered "{0}"\r
-335544751=The network protocol specified is invalid\r
-335675556=global field {0} already exists\r
-335544750=A password is required for this operation\r
-335675555=expected OPTION, encountered "{0}"\r
-335675554=expected GRANT, encountered "{0}"\r
-335675553=expected TO, encountered "{0}"\r
-335675552=GRANT privilege was not specified\r
-335675551=expected ON, encountered "{0}"\r
-335675550=database version is too old for the new syntax: GRANT\r
-336396459=invalid column reference\r
-336396458=column used with aggregate\r
-336396457=Attempt to define a second PRIMARY KEY for the same table\r
-336396456=FOREIGN KEY column count does not match PRIMARY KEY\r
-336396455=expression evaluation not supported\r
-336396454=refresh range number {0} not found\r
-336396453=bad checksum\r
-336396452=exception {0}\r
-336396451=restart shared cache manager\r
-336396450=database {0} shutdown in {1} seconds\r
-335544749=A username is required for this operation.\r
-335544748=The password specified is too long.  Maximum length is 8 bytes.\r
-335544747=The username entered is too long.  Maximum length is 31 bytes.\r
-335544746="REFERENCES table" without "(column)" requires PRIMARY KEY on referenced table\r
-335544745=Your login {0} is same as one of the SQL role name. Ask your database administrator to set up a valid Firebird login.\r
-335544744=Maximum user count exceeded.  Contact your database administrator.\r
-335675549=System flag value of 1 is reserved for system relations\r
-335544743=token size exceeds limit\r
-335675548=gen_trigger_name: invalid trigger type\r
-335544742=User cannot write to RDB$USER_PRIVILEGES\r
-335675547=database version is too old for the new syntax: types\r
-335544741=connection lost to database\r
-335675546=database version is too old for the new trigger syntax\r
-335544740=A fatal exception occurred during the execution of a user defined function.\r
-335675545=expected STORE, MODIFY, ERASE, or END_TRIGGER, encountered "{0}"\r
-335675544=database version is too old for the new syntax: functions\r
-335675543=database version is too old for the new syntax: filters\r
-335675542=expected FROM, COMPUTED, or qualified field, encountered "{0}"\r
-335675541=unmatched parenthesis\r
-335675540=computed by expression must be parenthesized\r
-336396449=journal file wrong format\r
-336396448=intermediate journal file full\r
-336396447=too many versions\r
-336396446=Wrong numeric type\r
-335544739=Error while trying to access file\r
-335544738=Error while trying to delete file\r
-335544737=Error while trying to write to file\r
-335544736=Error while trying to read from file\r
-335544735=Error while trying to close file\r
-335544734=Error while trying to open file\r
-335675539=data type cstring not supported for fields\r
-335544733=Error while trying to create file\r
-335675538=expected period, encountered "{0}"\r
-335544732=Access to databases on file servers is not supported.\r
-335675537=expected qualified field name, encountered "{0}"\r
-335544731=\r
-335675536=expected period, encountered "{0}"\r
-335544730=Client/Server Express not supported in this release\r
-335675535=database version is too old for the new syntax: types\r
-335675534=message number {0} exceeds 255\r
-335675533=expected STORE, MODIFY, ERASE, encountered "{0}"\r
-335675532=database version is too old for the new trigger syntax\r
-335675531=shadow number must be a positive integer\r
-335675530=expected comma or semicolon, encountered "{0}"\r
-335544729=Cannot deactivate primary index\r
-335544728=Cannot deactivate index used by an Integrity Constraint\r
-335544727=Error writing data to the connection.\r
-335544726=Error reading data from the connection.\r
-335544725=Error while listening for an incoming event connection request.\r
-335544724=Failed to establish a secondary connection for event processing.\r
-335675529=table {0} already exists\r
-335544723=Error while listening for an incoming connection.\r
-335675528=expected STORE, MODIFY, ERASE, END_TRIGGER, encountered "{0}"\r
-335544722=Failed to establish a connection.\r
-335675527=expected comma or semicolon, encountered "{0}"\r
-335544721=Unable to complete network request to host "{0}".\r
-335675526=database version is too old for the new syntax: ASC/DESC\r
-335544720=Unable to load required library {0}.\r
-335675525=database version is too old for the new syntax: ASC/DESC\r
-335675524=expected comma or semicolon, encountered "{0}"\r
-335675523=Function module name must be specified\r
-335675522=Function entry point must be specified\r
-335675521=database version is too old for the new syntax: functions\r
-335675520=Filter module name must be specified\r
-335544719=Error initializing the network software.\r
-335544718=Invalid key for find operation\r
-335544717=stack size insufficent to execute current request\r
-335544715=Operation not supported for EXTERNAL FILE table {0}\r
-335675519=Filter entry point must be specified\r
-335544714=invalid blob id\r
-335675518=expected filter name, encountered "{0}"\r
-335544713=Incorrect values within SQLDA structure\r
-335675517=database version is too old for the new syntax: filters\r
-335544712=Positive value expected\r
-335675516=Security class can appear only on local field references\r
-335544711=Attempt to execute an unprepared dynamic SQL statement.\r
-335544710=navigational stream {0} references a view with more than one base table\r
-335675515=data type required for global field\r
-335675514=PAGE_SIZE cannot be modified\r
-335675513=only SECURITY_CLASS, DESCRIPTION, and CACHE can be dropped\r
-335675512=GDEF processes only one database at a time\r
-335675511=expected symbol, encountered "{0}"\r
-335675510=expected quoted string, encountered "{0}"\r
-335544709=Invalid aggregate reference\r
-335544708=Ambiguous column reference.\r
-335544707=user does not have GRANT privileges on base table/view for operation\r
-335544706=The specified name was not found in the hosts file or Domain Name Services.\r
-335544705=Undefined service {0}/{1}.\r
-335675509=expected identifier, encountered "{0}"\r
-335544704=Failed to locate host machine.\r
-335675508=expected table name, encountered "{0}"\r
-335544703=service {0} does not have an associated executable\r
-335675507=expected number, encountered "{0}"\r
-335544702=Invalid ESCAPE sequence\r
-335675506=expected function, encountered "{0}"\r
-335544701=Unsigned short integer expected\r
-335675505=expected function, encountered "{0}"\r
-335544700=Long integer expected\r
-335675504=u0008ceasing processing\r
-335675503=no database declared\r
-335675502=relation {0} is not defined\r
-335675501=Cannot resolve field "{0}"\r
-335675500=context {0} is not defined\r
-335610099=no active database for operation\r
-335610098=metadata operation failed\r
-335610097=Index {0} is not defined in database "{1}"\r
-335610096=Field {0} is not defined in database "{1}"\r
-335610095=Field {0} is in use in database "{1}"\r
-335610094=Field {0} is in use in the following relations:\r
-335610093=Table {0} already exists\r
-335610092=Column {0} does not occur in table {1}\r
-335610091=Index {0} already exists\r
-335610090=Cannot define an index in a view\r
-335610089=global field {0} already exists\r
-335610088=show_fields: dtype not done\r
-335610087=database block not found for removal\r
-335610086=SET\r
-335610085=database handle\r
-335610084=OF\r
-335610083=left parenthesis\r
-335610082=COUNT (*)\r
-335610081=AVG, MAX, MIN, SUM, or COUNT\r
-335610080=FROM clause\r
-335610079=table name\r
-335610078=table name\r
-335610077=database name\r
-335610076=table name\r
-335610075=database name\r
-335610074=table name\r
-335610073=database name\r
-335610072=table name\r
-336461925=segment buffer length shorter than expected\r
-335610071=RELATIONS or TRIGGERS\r
-335610070=set option\r
-336461924=Row not found for fetch, update or delete, or the result of a query is an empty table.\r
-335610069=report item\r
-335610068=report writer SET option\r
-335610067=TOP or BOTTOM\r
-335610066=PROCEDURE\r
-335610065=table name\r
-335610064=expected "table_name", encountered "{0}"\r
-335610063=a database has not been readied\r
-335610062=relational operator\r
-335610061=EXISTS (SELECT * <sql rse>)\r
-335610060=database file name required on READY\r
-335610059={0} is not a table in database {1}\r
-335610058=period in qualified table name\r
-335610057=FORM\r
-335610056=positive number\r
-335610055=identifier\r
-335610054=comma between field definitions\r
-335610053=ADD, MODIFY, or DROP\r
-335610052=table name\r
-335610051=index state option\r
-335610050=quoted string\r
-336068826=Database is not in the physical backup mode\r
-336068825=Database is already in the physical backup mode\r
-336068824=Difference file is already defined\r
-335610049=ENTREE or END\r
-336068823=Difference file is not defined\r
-335610048=quoted string\r
-336068822=Generator not found\r
-335610047=right parenthesis\r
-336068821=ERASE RDB$GENERATORS failed\r
-335610046=value expression\r
-336068820=Zero length identifiers are not allowed\r
-335610045=the number of values do not match the number of fields\r
-335610044=VALUES list or SELECT clause\r
-335610043=left parenthesis\r
-335610042=comma or terminating right parenthesis\r
-335610041=left parenthesis\r
-335610040=quoted header segment\r
-336068819=unable to allocate memory from the operating system\r
-336068818=Cannot change datatype for column {0} from a character type to a non-character type.\r
-336068817=Cannot change datatype for {0}.  Conversion from base type {1} to {2} is not supported.\r
-336068816=New size specified for column {0} must be at least {1} characters.\r
-336068815=Cannot change datatype for column {0}.  Changing datatype is not supported for BLOB or ARRAY columns.\r
-336068814=Column {0} from table {1} is referenced in {2}\r
-335610039=comma\r
-336068813=Cannot rename column {0} to {1}.  A column with that name already exists in table {2}.\r
-335610038=FROM RSE clause\r
-336068812=Cannot rename domain {0} to {1}.  A domain with that name already exists.\r
-335610037=field name or asterisk expression\r
-335610036=global fields may not be based on other fields\r
-335610035=column definition clause\r
-335610034=quoted edit string\r
-335610033=ON or TO\r
-335610032=No statements issued yet\r
-335610031=]\r
-335610030=[\r
-336068804=SQL roles are not supported in on older versions of the database.  A backup and restore of the database is required.\r
-335610029=table or view name\r
-336068803=keyword {0} can not be used as a SQL role name\r
-335610028=FROM\r
-336068802=SQL role {0} already exists\r
-335610027=comma between field definitions\r
-336068801=user name {0} could not be used for SQL role\r
-335610026=table name\r
-336068800={0} is a SQL role and not a user\r
-335610025=object type for DEFINE\r
-335610024=no data type may be specified for a variable based on a field\r
-335610023=variable data type\r
-335610022={0} is not a table in database {1}\r
-335610021={0} is not a database\r
-335610020=variable definition clause\r
-335610019=quoted edit string\r
-335610018=end of command\r
-335610017=end of statement\r
-335610016=BLOB variables are not supported\r
-335610015=no databases are ready\r
-335610014=period in qualified name\r
-335610013=Expected PROCEDURE encountered "{0}"\r
-335610012=expected statement, encountered "{0}"\r
-335610011=field referenced in BASED ON cannot be resolved against readied databases\r
-335610010=unrecognized context\r
-335610009=asterisk expressions require exactly one qualifying context\r
-335610008=invalid ORDER BY ordinal\r
-335610007=No items in print list\r
-335610006=No items in print list\r
-335610005=field list required for modify\r
-335610004=no context for modify\r
-335610003=field {0} is not defined in form {1}\r
-335610002=no context for form ACCEPT statement\r
-335610001=form {0} is not defined in database "{1}"\r
-335610000=No database for form {0}\r
-336593136=Restart archiving for database {0}.\r
-336593135= {0}: restart archive for database\r
-336593134=Archive process unable to close log and/or archive files.\r
-336593133=Archive process unable to create archive file.\r
-336593132=Archive process unable to open log file.\r
-336593131=Archive process unable to attach to journal server.\r
-336593130=Error in reading page from disk.\r
-336593129=Error in closing database files. Retry recover.\r
-336593128=Error in creating or opening secondary database file.\r
-336593127=Known databases and connections:\r
-336593126=Output files queued:\r
-336593125=current output file: {0}\r
-336593124=Journaling suspended\r
-336593123=no output file\r
-336593122=unsupported journal sub-system version (expected {0}, encountered {1}) -- connection rejected\r
-336593121=Journal file sequence number {0} does not exist\r
-336593120=Optional close argument is a journal file sequence number\r
-335544699=Short integer expected\r
-335544698=Scale must be between zero and precision\r
-335544697=Precision must be from 1 to 18\r
-335544696=Total length of a partitioned log must be specified\r
-335544695=Partitions not supported in series of log file specification\r
-335544694=Log partition size too small\r
-335675499=relation {0} is not defined\r
-335544693=Log size too small\r
-335675498=bugcheck\r
-335544692=Log redefined\r
-335675497=trigger {0} is not defined\r
-335544691=Insufficient memory to allocate page buffer cache\r
-335675496=relation {0} is not defined\r
-335544690=Cache redefined\r
-335675495=global field {0} is not defined\r
-335675494=field {0} is not defined in relation {1}\r
-335675493=field {0} cannot be resolved\r
-335675492=field {0} does not exist\r
-335675491=field {0} does not exist in relation {1}\r
-335675490=Global field {0} is not defined\r
-336593119=Journal file "{0}" opened\r
-336593118=could not open journal file "{0}"-\r
-336593117=Journal server version {0}\r
-336593116=enter backup directory name: \r
-336593115=enter database name: \r
-336593114=enter journal option: \r
-336593113=Cannot open mailbox {0}\r
-336593112=unexpected end of file from server\r
-336593111=Journal server console program\r
-336593110=Checksum error in log record when reading from log file.\r
-335544689=Firebird error\r
-335544688=The prepare statement identifies a prepare statement with an open cursor\r
-335544687=intermediate journal file full\r
-335544686=journal file wrong format\r
-335544685=dbkey not available for multi-table views\r
-335544684=cannot access column {0} in view {1}\r
-335675489=object cannot be resolved\r
-335544683=request depth exceeded. (Recursive definition?)\r
-335675488=GENERATE_blr: node not supported\r
-335544682=Inappropriate self-reference of column\r
-335675487=GENERATE_blr: dtype not supported\r
-335544681=new record size of {0} bytes is too big\r
-335675486=(EXE) string_length: No defined length for BLOBS\r
-335544680=sort error: corruption in data structure\r
-335675485=gds_$put_segment failed\r
-335675484=gds_$put_segment failed\r
-335675483=symbol {0} is too long\r
-335675482=Type {0} for field {1} does not exist\r
-335675481=Trigger {0} does not exist\r
-335675480=Invalid attempt to assign trigger {0} to a new relation\r
-336593109=Journal server required for recovery to complete.\r
-336593108=Windows NT error {0}\r
-336593107=Windows NT error {0}\r
-336396387=Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements\r
-336593106=Error in updating log_transfer_status relation.\r
-336396386=Unsuccessful execution caused by a system error that precludesnsuccessful execution of subsequent statements\r
-336593105=Skipping online dumps files during a trace.\r
-336593104= {0} {1}  {2}\r
-336396384=Unsuccessful execution caused by an unavailable resource.\r
-336593103= Record Type  Number of records Total bytes\r
-336593102=Analysis of log records.\r
-336396382=the SQL statement cannot be executed\r
-336593101=Index root split.  For index ({0}) new root page {1}.\r
-336593100=Generator offset {0}.  New value {1}.\r
-335544679=segments not allowed in expression index {0}\r
-335544678=invalid key position\r
-335544677=too many versions\r
-335544676=sort error: not enough memory\r
-335544675=sort error\r
-335544674=last column in a table cannot be deleted\r
-335675479=table {0} does not exist\r
-335544673=cannot delete\r
-335675478=relation {0} is not external\r
-335544672=too few key columns found for index {0} (incorrect column name?)\r
-335675477=index {0} does not exist\r
-335544671=attempt to index array column in index {0}\r
-335675476=field {0} does not exist\r
-335544670=attempt to index BLOB column in index {0}\r
-335675475=Unauthorized attempt to change field {0} to or from BLOB\r
-335675474=field {0} does not exist\r
-335675473=(EXE) make_desc: do not understand node type\r
-335675472=TOTAL of date not supported\r
-335675471=relation {0} is used in trigger {1} but not defined\r
-335675470=field {0} is unknown in relation {1}\r
-336658541=    SET HEADING            -- toggle display of query column titles\r
-336658540=    SET PLANONLY           -- toggle display of query plan without executing\r
-336396379=operation completed with errors\r
-336396377=record from transaction {0} is stuck in limbo\r
-336396376=Unsuccessful execution caused by deadlock.\r
-336396375=deadlock\r
-335544669=count of column list and variable list do not match\r
-335544668=procedure {0} does not return any values\r
-335544667=drop database completed with errors\r
-335544666=server version too old to support all CREATE DATABASE options\r
-335544665=violation of PRIMARY or UNIQUE KEY constraint "{0}" on table "{1}"\r
-335544664=duplicate specification of {0} - not supported\r
-335675469=User privilege {0} on relation {1} for user {2} does not exist\r
-335544663=Too many concurrent executions of the same request\r
-335675468=User privilege {0} on field {1} in relation {2} nfor user {3} does not exist\r
-335544662=BLOB SUB_TYPE {0} is not defined\r
-335675467=Type {0} for field {1} does not exist\r
-335544661=cannot add index, index root page is full.\r
-335675466=Trigger message number {0} for trigger {1} does not exist\r
-336658539=There is no privilege granted in this database\r
-335544660=view {0} has more than one base table; use aliases to distinguish\r
-335675465=Trigger {0} does not exist\r
-336658538=    SET SQL DIALECT <n>    -- set sql dialect to <n>\r
-335675464=error committing deletion of shadow\r
-336658537=Incomplete string in {0}\r
-335675463=shadow {0} does not exist\r
-336658536=     [-r <rolename>] [-c <num cache buffers>] [-z] -nowarnings -noautocommit\r
-335675462=security class {0} does not exist\r
-336658535=There is no role {0} in this database\r
-335675461=table {0} does not exist\r
-336658534=               TRIGGER, VERSION, VIEW\r
-335675460=cannot drop system relation {0}\r
-336658533=Bad TIME: {0}\r
-336658530=Expected end of statement, encountered EOF\r
-336396366=Connection authorization failure.\r
-336396365=Connection not established\r
-336396364=Connection error\r
-336396362=Rollback not performed\r
-335544659=table {0} is referenced twice in view; use an alias to distinguish\r
-335544658={0} is not a valid base table of the specified view\r
-335544657=Array/BLOB/DATE data types not allowed in arithmetic\r
-335544656=variable {0} conflicts with parameter in same procedure\r
-335544655=invalid direction for find operation\r
-335544654=cannot start transaction for password database\r
-335675459={0} referenced by view {1}\r
-335544653=cannot attach to password database\r
-335675458=index {0} does not exist\r
-335544652=multiple rows in singleton select\r
-335675457=field {0} does not exist\r
-335544651=Cannot insert because the file is readonly or is on a read only medium.\r
-335675456=field {0} is used in relation {1} (local name {2}) and cannot be dropped\r
-336658529=There is no membership privilege granted on {0} in this database\r
-335544650=wrong page type\r
-335675455=function {0} does not exist\r
-336658528=There is no table, stored procedure, or role {0} in this database\r
-335675454=filter {0} does not exist\r
-336658527=There are no roles in this database\r
-335675453=field {0} does not exist in relation {1}\r
-336658526=Single isql command exceeded maximum buffer size\r
-335675452=field {0} from relation {1} is referenced in view {2}\r
-336658525=Buffers = !bnReads = !rnWrites !wnFetches = !f\r
-335675451=gds_$create_blob failed\r
-336658524=There are no check constraints on table {0} in this database\r
-335675450=gds_$close_blob failed\r
-336658523=There are no triggers in this database\r
-336658522=There is no table or trigger {0} in this database\r
-336658521=There are no triggers on table {0} in this database\r
-336658520=There are no stored procedures in this database\r
-335544649=bad checksum\r
-335544648=Connection lost to pipe server\r
-335544647=invalid comparison operator for find operation\r
-335544646=database or file exists\r
-335544645=the current position is on a crack\r
-335544644=illegal operation when at beginning of stream\r
-335675449=field {0} does not exist in relation {1} as referenced in view field {2}\r
-335544643=the table {0} is referenced twice; use aliases to differentiate\r
-335675448=field {0} already exists in relation {1}\r
-335544642=index {0} cannot be used in the specified plan\r
-335675447=table {0} already exists\r
-335544641=Specified domain or source column {0} does not exist\r
-335675446=table {0} does not exist\r
-336658519=There is no stored procedure {0} in this database\r
-335544640=Invalid use of CHARACTER SET or COLLATE\r
-335675445=Erase trigger already exists for {0}\r
-335740999=Transaction {0} is in limbo.\r
-336658518=There is no table or stored procedure {0} in this database\r
-335675444=Modify trigger already exists for {0}\r
-335740998= succeeded\r
-336658517=There is no privilege granted on stored procedure {0} in this database\r
-335675443=Store trigger already exists for {0}\r
-335740997= failed\r
-336658516=There is no privilege granted on table {0} in this database\r
-335675442=security class {0} already exists\r
-335740996=ATTACH_DATABASE: attempted attach of {0},\r
-336658515=There are no generators in this database\r
-335675441=table {0} already exists\r
-335740995=Transaction state {0} not in valid range.\r
-336658514=There is no generator {0} in this database\r
-335675440=error creating index {0}\r
-335740994=bad pool id\r
-336658513=There are no user-defined functions in this database\r
-335740993=virtual memory exhausted\r
-336658512=There is no user-defined function {0} in this database\r
-335740992=corrupt pool\r
-336658511=There are no filters in this database\r
-335740991=internal block exceeds maximum size\r
-336658510=There is no filter {0} in this database\r
-335740990=bad block type\r
-335544639=table {0} is referenced in the plan but not the from list\r
-335544638=table {0} is referenced more than once in plan; use aliases to distinguish\r
-335544637=table {0} is not referenced in plan\r
-335544636=there is no index {0} for table {1}\r
-335544635=there is no alias or table named {0} at this scope level\r
-335544634=Token unknown - line {0}, char {1}\r
-335675439=index {0} already exists\r
-335544633=Shadow number must be a positive integer\r
-335675438=combined key length ({0}) for index {1} is > 254 bytes\r
-335544632=Preceding file did not specify length, so {0} must include starting page number\r
-335675437=index {0}: field {1} in {2} is computed and cannot be a key\r
-335544631=too many keys defined for index {0}\r
-335675436=index {0}: field {1} does not exist in relation {2}\r
-336658509=There are no exceptions in this database\r
-335544630=there are {0} dependencies\r
-335675435=table {0} does not exist\r
-335740989= Number of database page errors : {0}\r
-336658508=There is no exception {0} in this database\r
-335675434={0} is a view and cannot be indexed\r
-335740988= Number of transaction page errors : {0}\r
-336658507=There are no domains in this database\r
-335675433=function {0} already exists\r
-335740987= Number of pointer page errors : {0}\r
-336658506=There is no domain {0} in this database\r
-335675432=error committing new file declarations\r
-335740986= Number of index page errors : {0}\r
-336658505=There are no indices in this database\r
-335675431=Preceding file did not specify length, so {0} must include starting page number\r
-335740985= Number of data page errors : {0}\r
-336658504=There is no table or index {0} in this database\r
-335675430=gds_$database_info failed\r
-335740984= Number of Blob page errors : {0}\r
-336658503=There are no indices on table {0} in this database\r
-335740983=n Number of record level errors : {0}\r
-336658502=There is no view {0} in this database\r
-335740982= -z  print software version number\r
-336658501=There are no views in this database\r
-335740981= -x  set debug on\r
-336658500=There is no table {0} in this database\r
-335740980= -write  write synchronously or asynchronously\r
-335544629=Write-ahead Log with shadowing configuration not allowed\r
-335544628=cannot create index {0}\r
-335544627=PROCEDURE {0}\r
-335544626=TABLE {0}\r
-335544625=A node name is not permitted in a secondary, shadow, cache or log file name\r
-335544624=segment count of 0 defined for index {0}\r
-335675429=field {0} already exists in relation {1}\r
-335544623=Illegal use of keyword VALUE\r
-335675428=error committing metadata changes\r
-335544622=alias {0} conflicts with a table in the same statement\r
-335675427=error rolling back metadata changes\r
-335544621=alias {0} conflicts with a procedure in the same statement\r
-335675426=action not implemented yet\r
-335544620=alias {0} conflicts with an alias in the same statement\r
-335675425=no database specified\r
-335740979= -validate validate database structure\r
-335675424=database version is too old to modify: use GBAK first\r
-335740978= -user  default user name\r
-335675423=GDEF unlicensed\r
-335740977= -use  use full or reserve space for versions\r
-335675422=    Version(s) for database "{0}"\r
-335740976= -tran  shutdown transaction startup\r
-335675421=Could not attach database "{0}"\r
-335740975= -two_phase perform automated two-phase recovery\r
-335675420=Could not delete file {0}\r
-335740974= -shut  shutdown <full / single / multi>\r
-335740973= -sweep  force garbage collection\r
-335740972= -rollback rollback transaction <tr / all>\r
-335740971= -quit_log quit logging for replay utility\r
-335740970= -password default password\r
-335544619= External functions cannot have more than 10 parameters\r
-335544618=Return mode by value not allowed for this data type\r
-335544617=invalid ORDER BY clause\r
-335544616=invalid column reference\r
-335544615=column used with aggregate\r
-335544614=Unsupported DSQL construct\r
-335675419=Could not release database\r
-335544613=union not supported\r
-335675418=error committing metadata changes\r
-335544612=Token unknown\r
-335675417=Could not locate database\r
-335544611=COLUMN {0}\r
-335675416=GDEF unlicensed\r
-335544610=EXCEPTION {0}\r
-335675415=    Version(s) for database "{0}"\r
-335740969= -prompt  prompt for commit/rollback (-l)\r
-335675414=    Version(s) for database "{0}"\r
-335740968= -online  database online <single / multi / normal>\r
-335675413=Could not create database "{0}"\r
-335740967= -no_update read-only validation (-v)\r
-335675412=Database "{0}" exists but cannot be opened\r
-335740966= -mend  prepare corrupt database for backup\r
-335675411=Do you want to replace it?\r
-335740965= -list  show limbo transactions\r
-335675410=Database "{0}" already exists\r
-335740964= -kill  kill all unavailable shadow files\r
-336068799={0} is not the owner of SQL role {1}\r
-335740963= -ignore  ignore checksum errors\r
-336068798=user {0} is not a member of SQL role {1}\r
-335740962= -housekeeping set sweep interval <n>\r
-336068797=user {0} has no grant admin option on SQL role {1}\r
-335740961= -force  force database shutdown\r
-336068796=SQL role {0} does not exist\r
-335740960= -full  validate record fragments (-v)\r
-336068795=column {0} from table {1} is referenced in index {2}\r
-336068794=SELECT RDB$VIEW_RELATIONS/RDB$RELATION_FIELDS/... failed in grant\r
-336068793=SELECT RDB$USER_PRIVILEGES failed in grant\r
-336068792=SELECT RDB$RELATIONS/RDB$OWNER_NAME failed in grant\r
-336068791=SELECT RDB$RELATION_FIELDS failed in grant\r
-336068790=SELECT RDB$RELATIONS failed in grant\r
-335544609=INDEX {0}\r
-335544608=Unexpected end of command\r
-335544607=gen.c: node not supported\r
-335544606=expression evaluation not supported\r
-335544605=No subqueries permitted for VIEW WITH CHECK OPTION\r
-335544604=FOREIGN KEY column count does not match PRIMARY KEY\r
-335675409=what we have here is a failure to communicate!\r
-335544603=DISTINCT, GROUP or HAVING not permitted for VIEW WITH CHECK OPTION\r
-335675408=error count exceeds limit ({0})\r
-335544602=Only one table allowed for VIEW WITH CHECK OPTION\r
-335675407={0}:{1}:\r
-335544601=No WHERE clause for VIEW WITH CHECK OPTION\r
-335675406=memory exhausted\r
-335544600=Only simple column names permitted for VIEW WITH CHECK OPTION\r
-335675405=you told me to.\r
-335740959= -disable disable WAL\r
-335675404=of errors.\r
-335740958= -cache  shutdown cache manager\r
-335675403=Ceasing processing because\r
-335740957= -commit  commit transaction <tr / all>\r
-335675402=Save changes before exiting?\r
-335740956= -buffers set page buffers <n>\r
-335675401=n1 error during input.\r
-335740955= -begin_log begin logging for replay utility\r
-335675400=nNo errors.\r
-335740954= -attach  shutdown new database attachments\r
-336068789=attempt to index a view\r
-335740953= -activate activate shadow file for database usage\r
-336068788=Table Name lookup failed\r
-335740952=Summary of validation errors\r
-335740951=please retry, giving a database name\r
-336068786=EXTERNAL FILE table not supported in this context\r
-335740950=n    qualifiers show the major option in parenthesis\r
-336068785=Can not alter a view\r
-336068784=column {0} does not exist in table/view {1}\r
-336068783=table/view {0} does not exist\r
-336068782=no {0} privilege with grant option on table/view {1}\r
-336068781=no grant option for privilege {0} on table/view {1}\r
-336068780=no {0} privilege with grant option on base table/view {1} (for column {2})\r
-335740949=plausible options are:\r
-335740948=please retry, specifying an option\r
-335740947=must specify type of shutdown\r
-335740946=numeric value between 0 and 32767 inclusive required\r
-335740945=number of seconds required\r
-335740944="wal" required\r
-336068779=no {0} privilege with grant option on table/view {1} (for column {2})\r
-335740943=subsystem name\r
-336068778=no grant option for privilege {0} on base table/view {1} (for column {2})\r
-335740942=password required\r
-336068777=no grant option for privilege {0} on table/view {1} (for column {2})\r
-335740941=user name required\r
-336068776=no grant option for privilege {0} on column {1} of base table/view {2}\r
-335740940="full" or "reserve" required\r
-336068775=no grant option for privilege {0} on column {1} of table/view {2}\r
-336068774=Cannot add file with the same name as the database or added files\r
-336068773=Shadow {0} already exists\r
-336068772=Shadow lookup failed\r
-336068771=A node name is not permitted in a table with external file definition\r
-336068770=Looking up column position failed\r
-335740939="sync" or "async" required\r
-335740938=transaction number or "all" required\r
-335740937=number of transactions per sweep required\r
-335740936=positive numeric value required\r
-335740935=numeric value required\r
-335740934=number of page buffers for cache required\r
-335740933=replay log pathname required\r
-336068768="Only one constraint allowed for a domain"\r
-335740932=incompatible switch combination\r
-336068767=Name longer than database column size\r
-335740931=gfix version {0}\r
-336068766=MODIFY DATABASE failed\r
-335740930=invalid switch {0}\r
-336068765=DEFINE SHADOW failed\r
-336068764=Shared cache lookup failed\r
-336068763=Write-ahead Log lookup failed\r
-336068762=STORE RDB$LOG_FILES failed\r
-336068761=ERASE RDB$LOG_FILES failed\r
-336068760=Write-ahead Log not found\r
-335740929=data base file name ({0}) already given\r
-336068759=Write-ahead Log already exists\r
-336068758=STORE RDB$FILES failed\r
-336068757=Shared cache file not found\r
-336068756=Shared cache file already exists\r
-336068755=Trigger {0} not found\r
-336068754=Parameter {0} in procedure {1} not found\r
-336068753=MODIFY EXCEPTION failed\r
-336068752=Exception not found\r
-336068751=ERASE EXCEPTION failed\r
-336068750=DEFINE EXCEPTION failed\r
-336396997=Column used in a PRIMARY/UNIQUE constraint must be NOT NULL.\r
-336396996=Cannot update constraints (RDB$REF_CONSTRAINTS).\r
-336396995=Cannot update constraints (RDB$CHECK_CONSTRAINTS).\r
-336396994=Cannot delete CHECK constraint entry (RDB$CHECK_CONSTRAINTS)\r
-336396993=Cannot update constraints (RDB$RELATION_CONSTRAINTS).\r
-336396992=internal gds software consistency check (invalid RDB$CONSTRAINT_TYPE)\r
-336396991=Operation violates CHECK constraint {0} on view or table\r
-336068749=MODIFY RDB$PROCEDURES failed\r
-336068748=Procedure {0} not found\r
-336068747=ERASE RDB$PROCEDURES failed\r
-336068746=ERASE RDB$PROCEDURE_PARAMETERS failed\r
-336068745=Store into system table {0} failed\r
-336068744=STORE RDB$PROCEDURE_PARAMETERS failed\r
-336068743=Procedure {0} already exists\r
-336068742=STORE RDB$PROCEDURES failed\r
-336068741=Number of referencing columns do not equal number of referenced columns\r
-336068740=Table {0} already exists\r
-336396985=Incompatible column/host variable data type\r
-336068739=Generation of constraint name failed\r
-336068738=CONSTRAINT {0} does not exist.\r
-336068737=ERASE RDB$RELATION_CONSTRAINTS failed\r
-336068736=No table specified in delete_constraint\r
-336068735=STORE RDB$REF_CONSTRAINTS failed\r
-336068734=Same set of columns cannot be used in more than one PRIMARY KEY and/or UNIQUE constraint definition\r
-336068733=Integrity Constraint lookup failed\r
-336068732=A column name is repeated in the definition of constraint: {0}\r
-336068731=Column: {0} not defined as NOT NULL - cannot be used in PRIMARY KEY/UNIQUE constraint definition\r
-336068730=STORE RDB$CHECK_CONSTRAINTS failed\r
-336396975=count of column list and variable list do not match\r
-336396974=Cannot transliterate character between character sets\r
-336068729=STORE RDB$RELATION_CONSTRAINTS failed\r
-336068728=Unknown columns in index {0}\r
-336068727=no keys for index {0}\r
-336068726=key size too big for index {0}\r
-336068725= attempt to index array column in index {0}\r
-336068724= attempt to index BLOB column in INDEX {0}\r
-336068723=CREATE VIEW failed\r
-336068722=Access to RDB$USER_PRIVILEGES failed in revoke (4)\r
-336068721=ERASE RDB$USER_PRIVILEGES failed in revoke (3)\r
-336068720=Access to RDB$USER_PRIVILEGES failed in revoke(2)\r
-336068719=ERASE RDB$USER_PRIVILEGES failed in revoke(1)\r
-336068718=unsupported DYN verb\r
-336068717=Create metadata BLOB failed\r
-336068716=Close metadata BLOB failed\r
-336068715=Write metadata BLOB failed\r
-336068714=Create metadata BLOB failed\r
-336068713=MODIFY TRIGGER MESSAGE failed\r
-336068712=unsupported DYN verb\r
-336068711=TRIGGER NAME expected\r
-336068710=MODIFY TRIGGER failed\r
-336068709=Table column not found\r
-336068708=MODIFY RDB$RELATIONS failed\r
-336068707=MODIFY RDB$RELATIONS failed\r
-336068706=drop EXTERNAL FILE not allowed\r
-336068705=add EXTERNAL FILE not allowed\r
-336068704=Local column not found\r
-336068703=MODIFY RDB$RELATION_FIELDS failed\r
-336068702=MODIFY RDB$FIELDS failed\r
-336068701=Index column not found\r
-336068700=MODIFY RDB$INDICES failed\r
-336593099=Next transaction {0}. Oldest active {1}. Oldest Interesting {2}.\r
-336593098=Next tip page {0} allocated.\r
-336593097=Continuing partial rebuild for database {0}.\r
-336593096=Starting partial rebuild for database {0}.\r
-336593095=Error in creating or opening database file.\r
-336593094=Invalid database for partial recovery.\r
-336593093=  -p <database name for partial recovery>\r
-336593092=  -a  -activate partially recovered database\r
-336593091=Target database name not specified.\r
-336593090=Error in modifying relation partial_rebuilds.\r
-336593089=Database exists or in use.\r
-336593088=Overwrite database ({0}) last log seqno ({1})? (y/n):\r
-336593087=Processing online dump file {0}.\r
-336593086=Recovering database "{0}" page size {1}.\r
-336593085=Enter full name of original database:\r
-336593084=reading log file names\r
-336593083=Online dump specified does not belong to database being recovered.\r
-336593082=Only one journal server can be active per journal database.\r
-336593081=Database not found in journal database\r
-336593080=Free slot {0} of pip page {1}\r
-336593079=Allocate slot {0} of pip page {1}\r
-336593078=Processing records for page {0}.  seqno {1}.  offset {2}.\r
-336593077=Commit transaction {0}.\r
-336593076=Secondary File: {0}.  Sequence: {1}.\r
-336593075=Error in archiving file. (id = {0}).\r
-336593074= Log archive complete.  File "{0}" (id = {1}).\r
-336593073=Database (id = {0}) not enabled with this journal server.\r
-336593072={0} ({1}/{2})\r
-336593071=Do not understand mailbox message type {0}\r
-336593070=Dos error {0}\r
-336593069=Dos error {0}\r
-336593068= {0}: display software version number\r
-336593067= {0}: display status of journal server\r
-336593066= {0}: shut down journal server\r
-336593065= {0}: set delete flag for database\r
-336593064= {0}: reset delete flag for database\r
-336593063= {0}: display help menu\r
-336593062= {0}: exit journal console program\r
-336593061= {0}: drop all files for non active database\r
-336593060= {0}: drop all files for an active database\r
-336593059= {0}: disable database\r
-336593058=Drop records for database (id = {0}).\r
-336593057=Database (id = {0}) is currently in use.\r
-336593056=Database "{0}" not enabled with this journal server.\r
-336593055=Mark database "{0}" as disabled for long-term journaling.\r
-336593054= Elapsed time = {0} seconds.\r
-336593053= Bytes applied = {0}\r
-336593052= Bytes processed = {0}\r
-336593051=Rebuild Statistics.\r
-336593050=Log file name\r
-336658499=There are no tables in this database\r
-336658497=    SET BLOB               -- turn off BLOB display\r
-336658496=               GRANT, INDEX, PROCEDURE, ROLE, SQL DIALECT, SYSTEM, TABLE,\r
-336658495=    SET NAMES <csname>     -- set name of runtime character set\r
-336658494=OUTput                     -- return output to stdout\r
-336658493=EDIT                       -- edit current command buffer and execute\r
-336658492=    SET TIME               -- toggle display of timestamp with DATE values\r
-336658491=    SET PLAN               -- toggle display of query access plan\r
-336658490=    SET WIDTH <col> [<n>]  -- set/unset print width to <n> for column <col>\r
-336593049=Error in attaching to recovered database.  Retry recovery.\r
-336593048=Error in attaching to journal database.\r
-336593047=Reset delete flag for database "{0}".\r
-336593046=Ensure files are archived for full recovery.\r
-336593045=Encountered records for files not yet archived.\r
-336593044=Must recover to a point in time after the end of online dump.\r
-336593043=Error in unlink() for file "{0}".\r
-336593042=Console connected.\r
-336593041=Removing file "{0}".\r
-336593040=:Error while erasing records for database "{0}".\r
-336658489=Unlicensed for database "{0}"\r
-336658488=Records affected: {0}\r
-336658487=Server version too old to support the isql command\r
-336658486=Errors occurred (possibly duplicate domains) in creating {0} in {1}\r
-336658485={0} not found\r
-336658484=    SET LIST               -- toggle column or table display format\r
-336658483=CON> \r
-336658482=Bad date {0}\r
-336658481=Enter {0}>\r
-336593039=Database "{0}" not enabled with this journal server.\r
-336658480=Enter {0} as M/D/Y>\r
-336593038=  -m <output message file>\r
-336593037=Error in opening output message file.\r
-336593036=out of sequence log record encountered.\r
-336593035=DOS error code {0}\r
-336593034=Failure in modifying journal files record\r
-336593033= Resetting database "{0}" ({1})\r
-336593032=Journal not properly closed\r
-336593031=Error in store for databases table\r
-336593030=Error in modify for databases table\r
-336658479=BLOB: {0}, type 'edit' or filename to load>\r
-336658478=BLOB display set to subtype {0}. This BLOB: subtype = {1}\r
-336658477=Cpu = !u secnBuffers = !bnReads = !rnWrites = !wnFetches = !f\r
-336658476=Current memory = !cnDelta memory = !dnMax memory = !xnElapsed time= !e sec\r
-336593029= No Databases with journaling enabled.\r
-336658470=    <object> = CHECK, DATABASE, DOMAIN, EXCEPTION, FILTER, FUNCTION, GENERATOR,\r
-336593028= {0} (db id = {1}), connections: {2}\r
-336593027=Journaling Enabled for:\r
-336593026=nJournal Server Status.\r
-336593025=Error in modify journal files table\r
-336593024=Close log file: ({0})\r
-336593023=Open log file: ({0})\r
-336593022=Error in storing journal files record\r
-336593021=Start Online Dump. dump_id: {0}\r
-336593020=Error in storing online dump record\r
-335544599=number of columns does not match select list\r
-335544598=must specify column name for view select expression\r
-335544597=Cannot prepare a CREATE DATABASE/SCHEMA statement\r
-335544596=Subselect illegal in this context\r
-335544595=Trigger unknown\r
-335675399=n{0} errors during input.\r
-335544594=Illegal array dimension range\r
-335675398=gdef: cannot open {0} or {1}\r
-335544593=Array declared with too many dimensions\r
-335675397=gdef: cannot open {0}\r
-335544592=Invalid array reference\r
-335675396=gdef: Database name is required for extract\r
-335544591=Unknown transaction option\r
-336527664=RDB$FLAGS for trigger {0} in RDB$TRIGGERS is corrupted\r
-335675395={0}{1}\r
-335544590=Option specified more than once\r
-336527663=Invalid expression for evaluation\r
-335675394= legal switches are:\r
-335675393=gdef: unknown switch {0}\r
-335675392=gdef version {0}\r
-336527660=can't find shared latch\r
-336658461=Set commands:\r
-336593019=Do not recognize journal message {0}\r
-336658460=HELP                       -- display this menu\r
-336593018=End Online Dump. dump id: {0}\r
-336593017=Error in modifying online_dump table\r
-336593016=Online Dump file. dump id: {0}. name: ({1})\r
-336593015=Error in writing record to online_dump_files table\r
-336593014=Error is updating delete flag.\r
-336593013=Control Point. Seqno: {0}  Offset: {1}\r
-336593012=Do not understand command "{0}"\r
-336593011=Set delete flag for database "{0}".\r
-336593010=Drop records for database "{0}"\r
-335544589=COLLATION {0} is not valid for specified CHARACTER SET\r
-335544588=COLLATION {0} is not defined\r
-335544587=Column is not a BLOB\r
-335544586=Function unknown\r
-336527659=exceeded maximum number of shared latches on a bdb\r
-335544585=Invalid statement handle\r
-336527658=missing exclusive latch\r
-335544584=Count of read-write columns does not equal count of values\r
-336527657=bdb is unexpectedly marked\r
-335544583=SQLDA missing or incorrect version, or incorrect number/type of variables\r
-336527656=inconsistent latch downgrade call\r
-335544582=Request unknown\r
-336527655=inconsistent LATCH_mark call\r
-335544581=Procedure unknown\r
-336658459=SHELL    <command>         -- execute Operating System command in sub-shell\r
-336527654=inconsistent LATCH_mark release\r
-335544580=Table unknown\r
-336527653=bad ACL\r
-336527652=Illegal user_type.\r
-336527651=cannot find record back version\r
-336527650=error during savepoint backout\r
-336658453=Frontend commands:n\r
-336658452=Transaction in limbo = {0}\r
-336658451=Base level = {0}\r
-336593009=Journal utility version {0}\r
-336658450=Wal group commit wait = {0}\r
-336396289=Firebird error\r
-336593008=Commands are:\r
-336593007=Error occurred during "{0}"\r
-336593006=Child process completed\r
-336593005=Error on writing disable record\r
-336593004=Release connection failed.\r
-336593003=Archiving log file. id: {0} name: {1}\r
-336593002=Forking backup process failed\r
-336593001=Failure before forking back up process\r
-336593000= Number of archives running concurrently exceeds limit.\r
-335544579=Internal error\r
-335544578=Column unknown\r
-335544577=Attempt to reclose a closed cursor\r
-335544576=Attempt to reopen an open cursor\r
-336527649=Unknown BLOB FILTER ACTION_\r
-335544575=Cursor not updatable\r
-336527648=garbage collect record disappeared\r
-335544574=Declared cursor already exists\r
-336527647=Too many savepoints\r
-335544573=Data type unknown\r
-336527646=size of opt block exceeded\r
-335544572=Cursor {0} {1}\r
-336527645=lock not found in internal lock manager\r
-335544571=Data type for constant unknown\r
-336658449=Check point interval = {0}\r
-336527644=cannot restore singleton select data\r
-335544570=Invalid command\r
-336658448=Check point length = {0}\r
-336527643=checksum error in log record when reading from log file\r
-336658447=Wal buffer size = {0}\r
-336527642=journal server cannot archive to specified archive directory\r
-336658446=Number of wal buffers = {0}\r
-336527641=error in recovery! unknown record type\r
-336527640=error in recovery! unknown page type\r
-336658444=Number of DB pages allocated = {0}\r
-336723999=password already specified\r
-336658443=     [-x|-a] [-d <target db>] [-u <user>] [-p <password>]n     [-page <pagelength>] [-n] [-m] [-q] [-s <sql_dialect>]\r
-336723998=operation already specified\r
-336658442=ISQL Version: {0}\r
-336723997=invalid parameter, no switch defined\r
-336658441=Enter data or NULL for each column.  RETURN to end.\r
-336723996=find/display record error\r
-336658440=Command error: {0}\r
-336723995=------------------------------------------------------------------------------------------\r
-336723994=     user name                      uid   gid     full name\r
-336723993=users defined for node\r
-336723992=find/delete record error\r
-336723991=delete record error\r
-336723990=record not found for user: {0}\r
-335544569=Dynamic SQL Error\r
-335544568=Implementation of text subtype {0} not located.\r
-335544567=Overflow log specification required for round-robin log\r
-335544566=WAL defined; Cache Manager must be started first\r
-336527639=error in recovery! out of sequence log record encountered\r
-335544565=Cannot transliterate character between character sets\r
-336527638=error in recovery! wrong transaction page record\r
-335544564=long-term journaling not enabled\r
-336527637=error in recovery! wrong index root page record\r
-335544563=service {0} is not defined\r
-336527636=error in recovery! wrong pointer page record\r
-335544562=unrecognized service parameter block\r
-336527635=error in recovery! wrong page inventory page record\r
-335544561=wrong version of service parameter block\r
-336658439=Rolling back work.\r
-336527634=error in recovery! wrong b-tree page record\r
-335544560=database {0} shutdown in {1} seconds\r
-336658438=Committing.\r
-336527633=error in recovery! wrong generator page record\r
-336658437=Commit current transaction (y/n)?\r
-336527632=error in recovery! wrong header page record\r
-336658436=Unable to open {0}\r
-336527631=error in recovery! no space on data page\r
-336658435=Use CONNECT or CREATE DATABASE to specify a database\r
-336527630=error in recovery! wrong data page record\r
-336658434=Unknown switch: {0}\r
-336723989=find/modify record error\r
-336658433=isql [<database>] [-e] [-t <terminator>] [-i <inputfile>] [-o <outputfile>]\r
-336723988=modify record error\r
-336658432=Statement failed, SQLCODE = {0}\r
-336723987=add record error\r
-336723986=no user name specified\r
-336723985=no operation specified\r
-336723984=error in switch specifications\r
-336723983=unable to open database\r
-336723982=LNAME          user's last name\r
-336723981=MNAME          user's middle name/initial\r
-336723980=FNAME          user's first name\r
-335544559=invalid service handle\r
-335544558=Operation violates CHECK constraint {0} on view or table {1}\r
-335544557=database shutdown unsuccessful\r
-335544556=Write-ahead Log without shared cache configuration not allowed\r
-336527629=error in recovery! database corrupted\r
-335544555=column has non-SQL security class defined\r
-336527628=buffer marked during cache unwind\r
-335544554=table/procedure has non-SQL security class defined\r
-336527627=next transaction older than oldest transaction\r
-335544553=user does not have GRANT privileges for operation\r
-336527626=next transaction older than oldest active transaction\r
-335544552=could not find column for GRANT\r
-336527625=in an ill-defined state\r
-335544551=could not find table/procedure for GRANT\r
-336527624=rolled back\r
-335544550=only the owner of a table may reassign ownership\r
-336527623=committed\r
-336527622=active\r
-336527621=scalar operator used on field which is not an array\r
-336527620=index unexpectedly deleted\r
-336723979=ORG            user's organization name\r
-336723978=PROJ           user's project name\r
-336723977=GID            user's group ID\r
-336723976=UID            user's ID\r
-336723975=PW             user's password\r
-336723974=MODIFY         modify user\r
-336723973=DISPLAY        display user(s)\r
-336723972=DELETE         delete user\r
-335609999=no default form name\r
-336723971=ADD            add user\r
-335609998="{0}" is undefined or used out of context\r
-336723970=gsec\r
-335609997={0}.* cannot be used when a single element is required\r
-335609996=cannot erase from a join\r
-335609995=no context for ERASE\r
-335609994=cannot perform assignment to computed field {0}\r
-335609993=variables may not be based on BLOB fields\r
-335609992=expand_statement: not yet implemented\r
-335609991=expand_expression: not yet implemented\r
-335609990=    Version(s) for database "{0}"\r
-335544549=cannot modify or erase a system trigger\r
-335544548=Attempt to define a second PRIMARY KEY for the same table\r
-335544547=internal gds software consistency check (invalid RDB$CONSTRAINT_TYPE)\r
-335544546=Cannot define constraints on views\r
-336527619=bad pointer page\r
-335544545=Cannot update constraints (RDB$RELATION_CONSTRAINTS).\r
-336527618=page slot not empty\r
-335544544=Cannot rename column being used in an Integrity Constraint.\r
-336527617=bad record in RDB$PAGES\r
-335544543=Cannot delete column being used in an Integrity Constraint.\r
-336527616=pointer page vanished from mark_full\r
-335544542=Cannot update trigger used by a CHECK Constraint\r
-336527615=cannot find free space\r
-335544541=Cannot delete trigger used by a CHECK Constraint\r
-336527614=pointer page vanished from relation list in locate_space\r
-335544540=Cannot modify index used by an Integrity Constraint\r
-336527613=pointer page vanished from extend_relation\r
-336527612=header fragment length changed\r
-336527611=damaged data page\r
-336527610=temporary page buffer too small\r
-336723969=GSEC>\r
-336330999=Run gfix -online to bring database online without active indices.\r
-336330998=Database is not online due to failure to activate one or more indices.\r
-336330997=  Set the TMP environment variable to a directory on a filesystem that does have enough space, and activate index with\r
-336330996=  Not enough disk space to create the sort file for an index.\r
-335609989=    QLI, version "{0}"\r
-336330995=  ALTER INDEX "{0}" ACTIVE;\r
-335609988=Variables:\r
-336330994=  Delete or Update duplicate values or NULLs, and activate index with\r
-335609987=No triggers are defined in database {0}\r
-336330993=  The unique index has duplicate values or NULLs.\r
-335609986=No triggers are defined in database {0}\r
-335609985=No triggers are defined for table {0}\r
-336330992=Index "{0}" failed to activate because:\r
-336330991= {0}NT                   Non-Transportable backup file format\r
-335609984=Procedures in database "{0}" ({1}):\r
-336330990=System memory exhausted\r
-335609983=Procedure {0} not found\r
-335609982=Procedure {0} not found in database {1}\r
-335609981=There are no fields defined in any open database\r
-335609980=There are no fields defined for database {0}\r
-335544539=Cannot delete index used by an Integrity Constraint\r
-335544538=Cannot update index segment used by an Integrity Constraint\r
-335544537=Cannot delete index segment used by an Integrity Constraint\r
-335544536=Cannot delete CHECK constraint entry (RDB$CHECK_CONSTRAINTS)\r
-336527609=pointer page vanished from DPM_next\r
-335544535=Cannot update constraints (RDB$CHECK_CONSTRAINTS).\r
-336527608=cannot find record fragment\r
-335544534=Cannot update constraints (RDB$REF_CONSTRAINTS).\r
-336527607=missing pointer page in DPM_dump\r
-335544533=Non-existent PRIMARY or UNIQUE KEY specified for FOREIGN KEY.\r
-336527606=pointer page lost from DPM_delete_relation\r
-335544532=Name of Referential Constraint not defined in constraints table.\r
-336527605=pointer page disappeared in DPM_delete\r
-335544531=Column used in a PRIMARY/UNIQUE constraint must be NOT NULL.\r
-336527604=Fragment does not exist\r
-335544530=Cannot delete PRIMARY KEY being used in FOREIGN KEY definition.\r
-336527603=missing pointer page in DPM_data_pages\r
-336527602=unimplemented FAO directive\r
-336527601=error parsing RDB FAO message string\r
-336527600=Firebird/RdB message parameter inconsistency\r
-336330989=Converted V3 scale: {0} to character_set_id: {1} and callate_id: {2}.\r
-336330988=Converted V3 sub_type: {0} to character_set_id: {1} and collate_id: {2}.\r
-336330987=Unknown V3 SUB_TYPE: {0} in FIELD: {1}.\r
-336330986=Skipped bad security class entry: {0}\r
-335609979=Global field {0} does not exist in any open database\r
-335609978=Global field {0} does not exist in database {1}\r
-336330985=could not drop database {0} (database might be in use)\r
-335609977=There are no forms defined in any open database\r
-336330984=Expected volume number {0}, found volume {1}\r
-335609976=There are no forms defined for database {0}\r
-336330983=Expected backup database {0}, found {1}\r
-335609975= (computed expression)\r
-336330982=Expected backup start time {0}, found {1}\r
-335609974=Field {0} does not exist in any open database\r
-336330981=nnERROR: Backup incomplete\r
-335609973=Field {0} does not exist in database {1}\r
-336330980=  Name: \r
-335609972=    Page size is {0} bytes.  Current allocation is {1} pages.\r
-335609971=No databases are currently ready\r
-335609970=Database "{0}"\r
-335544529=cannot modify an existing user privilege\r
-335544528=database {0} shutdown\r
-335544527=Cannot start WAL writer for the database {0}\r
-335544526=WAL writer synchronization error for the database {0}\r
-335544525=WAL setup error.  Please see Firebird log.\r
-335544524=WAL buffers cannot be increased.  Please see Firebird log.\r
-335544523=WAL writer - Journal server communication error.  Please see Firebird log.\r
-335544522=WAL I/O error.  Please see Firebird log.\r
-335544521=Unable to roll over please see Firebird log.\r
-335544520=long-term journaling already enabled\r
-336330979=Type a file name to open and hit return\r
-336330978= Press return to reopen that file, or type a newn name followed by return to open a different file.\r
-336330977=Done with volume #{0}, "{1}"\r
-335609969=Database "{0}" readied as {1}\r
-336330976=nnCould not read from file "{0}"\r
-335609968=, subtype fixed\r
-336330975=nnCould not write to file "{0}"\r
-335609967=, scale {0}\r
-336330974=nnCould not open file name "{0}"\r
-335609966=date\r
-336330973=Unexpected I/O error while writing to backup file\r
-335609965=, subtype ACL\r
-336330972=Unexpected I/O error while reading from backup file\r
-335609964=, subtype BLR\r
-335609963=, subtype {0}\r
-335609962=, segment length {0}\r
-335609961=BLOB\r
-335609960=long floating\r
-335544519=invalid lock handle\r
-335544518=restart shared cache manager\r
-335544517=exception {0}\r
-335544516=exception {0} not defined\r
-335544515=status code {0} unknown\r
-335544514=Could not expand the WAL segment for database {0}\r
-335544513=Database {0}: WAL subsystem bug for pid {1}n{2}\r
-335544512=parameter mismatch for procedure {0}\r
-335544511=procedure {0} is not defined\r
-335544510=lock time-out on wait transaction\r
-336068699=MODIFY RDB$INDICESS failed\r
-336068698=unsupported DYN verb\r
-336068697=Domain not found\r
-336068696=MODIFY RDB$FIELDS failed\r
-336068695=MODIFY RDB$FIELDS failed\r
-336068694=MODIFY DATABASE failed\r
-336330968=Writing collation {0}\r
-336068693=MODIFY DATABASE failed\r
-336330967=Bad attribute for RDB$COLLATIONS\r
-335609959=short floating\r
-336068692=MODIFY DATABASE failed\r
-336330966=Writing character set {0}\r
-335609958=quad\r
-336068691=Generation of trigger name failed\r
-336330965=Bad attribute for RDB$CHARACTER_SETS\r
-335609957=long binary\r
-336068690=Generation of index name failed\r
-336330964=writing Collations\r
-335609956=short binary\r
-336330963=writing Character Sets\r
-335609955=null terminated text, length {0}\r
-336330962=writing check constraints\r
-335609954=varying text, length {0}\r
-336330961=writing referential constraints\r
-335609953=text, length {0}\r
-336330960=Bad attribute for table constraint\r
-335609952=Procedure {0} in database "{1}" ({2})\r
-335609951=No databases are currently ready\r
-335609950= No indexes defined\r
-335544509=CHARACTER SET {0} is not defined\r
-335544508=refresh range number {0} not found\r
-335544507=refresh range number {0} already in use\r
-335544506=database {0} shutdown in progress\r
-335544505=must specify archive file when enabling long term journal for databases with round-robin log files\r
-335544504=WAL subsystem corrupted\r
-335544503=WAL subsystem encountered error\r
-335544502=reference to invalid stream number\r
-335544501=cannot drop log file when journaling is enabled\r
-335544500=database does not use Write-ahead Log\r
-336068689=Generation of column name failed\r
-336068688= Specified domain or source column does not exist\r
-336068687=STORE RDB$USER_PRIVILEGES failed in grant\r
-336068686=SELECT RDB$USER_PRIVILEGES failed in grant\r
-336068685=SELECT RDB$USER_PRIVILEGES failed in grant\r
-336330959=writing constraint {0}\r
-336068684=unsupported DYN verb\r
-336330958=writing table constraints\r
-336068683=Security class not found\r
-336330957=skipped {0} bytes looking for next valid attribute, encountered attribute {1}\r
-335609949= No indexes defined\r
-336068682=ERASE RDB$SECURITY_CLASSES failed\r
-336330956= {0}S(KIP_BAD_DATA)      skip number of bytes after reading bad data\r
-335609948= No views defined\r
-336068681=unsupported DYN verb\r
-336330955=skipped {0} bytes after reading a bad attribute {1}\r
-335609947= Security class {0} is not defined\r
-336068680=Trigger Message not found\r
-336330954=adjusting an invalid decompression length from {0} to {1}\r
-335609946=No security classes defined\r
-336330953=expected number of bytes to be skipped, encountered "{0}"\r
-335609945=Procedure {0} not found in database {1}\r
-336330952= missing parameter for the number of bytes to be skipped\r
-335609944=Procedure {0} not found in database {1}\r
-336330951=restoring exception {0}\r
-335609943=substitute prompt string too long\r
-336330950=writing exception {0}\r
-335609942=substitute prompt string too long\r
-335609941=Procedure {0} not found in database {1}\r
-335609940=Procedures can not be renamed across databases. Try COPY\r
-336068679=ERASE TRIGGER MESSAGE failed\r
-336068678=TRIGGER NAME expected\r
-336068677=unsupported DYN verb\r
-336068676=MODIFY RDB$VIEW_RELATIONS failed\r
-336068675=Trigger not found\r
-336330949=writing exceptions\r
-336068674=ERASE RDB$TRIGGERS failed\r
-336330948=restoring parameter {0} for stored procedure\r
-336068673=ERASE RDB$TRIGGER_MESSAGES failed\r
-336330947=restoring stored procedure {0}\r
-335609939=nSub-topics available for {0} are:\r
-336068672=unsupported DYN verb\r
-336330946=writing parameter {0} for stored procedure\r
-335609938=nNo help is available for {0} {1}\r
-336068671=ERASE RDB$FILES failed\r
-336330945=writing stored procedure {0}\r
-335609937=n{0}Sub-topics available:\r
-336068670=ERASE RDB$USER_PRIVILEGES failed\r
-336330944=writing stored procedures\r
-335609936= [{0} topics matched {1}]\r
-336330943= {0}USER                 Firebird user name\r
-335609935=procedure name over 31 characters\r
-336330942= {0}PAS(SWORD)           Firebird password\r
-335609934=QLI$PROCEDURES table must be created with RDO in Rdb/VMS databases\r
-336330941=password parameter missing\r
-335609933=database handle required\r
-336330940=user name parameter missing\r
-335609932=procedure name "{0}" in use in database {1}\r
-335609931=Could not create QLI$PROCEDURES table\r
-335609930=Could not create QLI$PROCEDURE field\r
-336068669=Table not found\r
-336068668=ERASE RDB$RELATIONS failed\r
-336068667=ERASE RDB$VIEW_RELATIONS failed\r
-336068666=ERASE RDB$RELATION_FIELDS failed\r
-336068665=ERASE RDB$INDICES failed\r
-336330939= {0}N(O_VALIDITY)        do not restore database validity conditions\r
-336068664=ERASE RDB$INDEX_SEGMENTS failed\r
-336330938= {0}OL(D_DESCRIPTIONS)   save old style metadata descriptions\r
-336068663=Column not found for table\r
-336330937=restoring generator {0} value: {1}\r
-335609929=Could not create QLI$PROCEDURE_NAME field\r
-336068662=ERASE RDB$RELATION_FIELDS failed\r
-336330936=a blocking factor may not be used in conjunction with device CT\r
-335609928=procedure "{0}" is undefined\r
-336068661=ERASE RDB$RELATION_FIELDS failed\r
-336330935=expected blocking factor, encountered "{0}"\r
-335609927=procedure "{0}" is undefined in database {1}\r
-336068660=Column {0} from table {1} is referenced in view {2}\r
-336330934=blocking factor parameter missing\r
-335609926=procedure "{0}" is undefined\r
-336330933= {0}FA(CTOR)             blocking factor\r
-335609925=conversion error\r
-336330932=index {0} omitted because {1} of the expected {2} keys were found\r
-335609924=PIC_edit: class not yet implemented\r
-336330931= column {0} used in index {1} seems to have vanished\r
-335609923=cannot open command file "{0}"\r
-336330930= {0}IG(NORE)             ignore bad checksums\r
-335609922=unexpected eof\r
-335609921=unexpected end of file in file {0}\r
-335609920=unexpected end of procedure in procedure {0}\r
-336068659=No table specified in ERASE RFR\r
-336068658=No segments found for index\r
-336068657=ERASE RDB$INDEX_SEGMENTS failed\r
-336068656=Index not found\r
-336068655=ERASE RDB$INDICES failed\r
-336330929= {0}G(ARBAGE_COLLECT)    inhibit garbage collection\r
-336068654=Column not found\r
-336330928=closing file, committing, and finishing. {0} bytes written\r
-336068653=ERASE RDB$FIELDS failed\r
-336330927= {0}T(RANSPORTABLE)      transportable backup -- data in XDR format\r
-335609919=unterminated quoted string\r
-336068652=ERASE RDB$FIELDS failed\r
-336330926=cannot commit files\r
-335609918=fseek failed\r
-336068651=column {0} is used in table {1} (local name {2}) and cannot be dropped\r
-336330925=cannot commit index {0}\r
-335609917=could not open scratch file\r
-336068650=unsupported DYN verb\r
-336330924= {0}K(ILL)               restore without creating shadows\r
-335609916=unterminated quoted string\r
-336330923= error committing metadata for table {0}\r
-335609915=fseek failed\r
-336330922=committing metadata for table {0}\r
-335609914=gds_$put_segment failed\r
-336330921=gbak:\r
-335609913=overflow during conversion\r
-336330920=type\r
-335609912=Error converting string "{0}" to date\r
-335609911=BLOB conversion is not supported\r
-335609910=conversion error\r
-336068649=Function not found\r
-336068648=ERASE RDB$FUNCTIONS failed\r
-336068647=ERASE RDB$FUNCTION_ARGUMENTS failed\r
-336068646=unsupported DYN verb\r
-336068645=BLOB Filter not found\r
-336330919=restoring table {0}\r
-336068644=ERASE BLOB FILTER failed\r
-336330918=readied database {0} for backup\r
-336068643=ERASE RDB$FIELDS failed\r
-336330917=    writing generator {0} value {1}\r
-335609909=conversion error\r
-336068642=STORE RDB$VIEW_RELATIONS failed\r
-336330916=writing id generators\r
-335609908=conversion error\r
-336068641=DEFINE TRIGGER MESSAGE failed\r
-336330915=    writing shadow file {0}\r
-335609907=conversion error\r
-336068640=unsupported DYN verb\r
-336330914=writing shadow files\r
-335609906=conversion error\r
-336330913=writing types\r
-336396887=invalid comparison operator for find operation\r
-335609905=conversion error\r
-336330912=    writing type {0} for column {1}\r
-336396886=data operation not supported\r
-335609904=BLOB conversion is not supported\r
-336330911=writing triggers\r
-335609903=MOVQ_move: conversion not done\r
-336330910=writing trigger messages\r
-335609902=conversion not implemented\r
-335609901=conversion not implemented\r
-336396882=subscript out of bounds\r
-335609900=comparison not done\r
-336396881=null segment of UNIQUE KEY\r
-336068639=DEFINE TRIGGER failed\r
-336068638=unsupported DYN verb\r
-336068637=STORE RDB$RELATION_FIELDS failed\r
-336068636=STORE RDB$FIELDS failed\r
-336068635=STORE RDB$RELATIONS failed\r
-336330909=    writing trigger message for {0}\r
-336068634=unsupported DYN verb\r
-336330908=    writing trigger {0}\r
-336068633=STORE RDB$USER_PRIVILEGES failed defining a table\r
-336330907=    writing security class {0}\r
-336068632=STORE RDB$RELATIONS failed\r
-336330906=writing tables\r
-336068631=STORE RDB$RELATION_FIELDS failed\r
-336330905=    writing table {0}\r
-336068630=STORE RDB$FIELDS failed\r
-336330904=    writing privilege for user {0}\r
-336330903=    writing index {0}\r
-336330902=writing domains\r
-336330901=    writing domain {0}\r
-336330900=writing functions\r
-336396875=Overflow occurred during data type conversion.\r
-336068629=STORE RDB$INDICES failed\r
-336068628=could not find PRIMARY KEY index in specified table\r
-336068627=PRIMARY KEY lookup failed\r
-336068626=could not find UNIQUE INDEX with specified columns\r
-336068625=PRIMARY KEY column lookup failed\r
-336068624=unsupported DYN verb\r
-336068623=STORE RDB$INDICES failed\r
-336068622=No table specified for index\r
-336068621=STORE RDB$FIELDS failed\r
-336068620=DEFINE FUNCTION ARGUMENT failed\r
-336068619=unsupported DYN verb\r
-336068618=DEFINE FUNCTION failed\r
-336068617=DEFINE GENERATOR unexpected DYN verb\r
-336068616=DEFINE GENERATOR failed\r
-336068615=DEFINE BLOB FILTER failed\r
-336068614=unsupported DYN verb\r
-336068613={0}\r
-336068612=unsupported DYN verb\r
-336068611=STORE RDB$FIELD_DIMENSIONS failed\r
-336068610=unsupported DYN verb\r
-336068609=ODS version not supported by DYN\r
-336527599=Firebird status vector inconsistent\r
-336527598=unknown parameter in RdB status vector\r
-336527597=Error parsing RDB FAO msg str\r
-336527596=Error parsing RDB FAO msg string\r
-336527595=Unimplemented conversion, FAO directive X,U\r
-336527594=Unimplemented conversion, FAO directive O,Z,S\r
-336527593=eval_statistical: invalid operation\r
-336527592=EVL_expt: invalid operation\r
-336527591=EVL_boolean: invalid operation\r
-336527590=EVL_bitmap: invalid operation\r
-336855113=Not enough disk space remaining\r
-336855112=A sweep must be performed on this database before it can be started.  Sweep?\r
-336855111=Beginning database sweep, which can take a long time.  This can be controlled by varying the sweep interval.  Sweep?\r
-336855110=The server disconnected from the other end of the pipe.\r
-336527589=EVL_assign_to: invalid operation\r
-336527588=cannot access field in view {0}\r
-336527587=cannot access field {0} in view {1}\r
-336527586=request size limit exceeded\r
-336855109=A write fault occurred on the network.\r
-336527585=data type not supported for arithmetic\r
-336855108=The network request was not accepted.\r
-336527584=quad word arithmetic not supported\r
-336855107=The network BIOS session limit was exceeded.\r
-336527583=argument of scalar operation must be an array\r
-336855106=The name limit for the local computer network adapter card was exceeded.\r
-336527582=bad BLR -- invalid stream\r
-336855105=The network name cannot be found.\r
-336527581=(CMP) copy: cannot remap\r
-336855104=The network resource type is not correct.\r
-336527580=release of unknown resource\r
-336855103=Network access is denied.\r
-336855102=The specified network name is no longer available.\r
-336855101=The remote adapter is not compatible.\r
-336855100=An unexpected network error occurred.\r
-336527579=request of unknown resource\r
-336527578=CCH: {0}, status = {1} (218)\r
-336527577=buffer marked for update\r
-336527576=page {0}, page type {1} lock denied\r
-336527575=page {0}, page type {1} lock conversion denied\r
-336527574=no cache buffers available for reuse\r
-336527573=insufficient cache size\r
-336527572=CCH_precedence: block marked\r
-336527571=attempt to remove page from dirty page list when not there\r
-336527570=page in use during flush\r
-336462125=Datatype needs modification\r
-335544499=Cannot roll over to the next log file {0}\r
-335544498=Invalid WAL parameter block option {0}\r
-335544497=Illegal attempt to attach to an uninitialized WAL segment for {0}\r
-335544496=Log block too small at offset {0} in log file {1}\r
-336527569=attempt to release page not acquired\r
-335544495=Log record header too small at offset {0} in log file {1}\r
-336527568=page not accessed for write\r
-335544494=Incomplete log record at offset {0} in log file {1}\r
-336527567=page already in use\r
-335544493=Unexpected end of log file {0} at offset {1}\r
-336527566=exceeded index level\r
-335544492=Database name in the log file {0} is different\r
-336527565=index bucket overfilled\r
-335544491=Log file {0} not closed properly; database recovery may be required\r
-336527564=index inconsistent\r
-335544490=Log file {0} not latest in the chain but open flag still set\r
-336527563=shadow block not found for extend file\r
-336527562=unknown data type\r
-336527561=cannot find BLOB page\r
-336527560=invalid BLOB ID\r
-335544489=Invalid version of log file {0}\r
-335544488=Log file header of {0} too small\r
-335544487=WAL Writer error\r
-335544486=Write-ahead log subsystem failure\r
-336527559=expected field node\r
-335544485=invalid statement handle\r
-336527558=array subscript computation error\r
-335544484=error in opening Write-ahead Log file during recovery\r
-336527557=field for array not known\r
-335544483=maximum number of online dump files that can be specified is 16\r
-336527556=relation for array not known\r
-335544482=journaling allowed only if database has Write-ahead Log\r
-336527555=cannot update old BLOB\r
-335544481=no more disk/tape space.  Cannot continue online dump\r
-336527554=BLOB not found\r
-335544480=an online dump is already in progress\r
-336527553=null or invalid array\r
-336527552=overflow during conversion\r
-336527551=conversion error\r
-336527550=conversion not supported for specified data types\r
-335544479=online dump failure. Retry dump\r
-335544478=enable journal for database before starting online dump\r
-335544477=maximum indexes per table ({0}) exceeded\r
-335544476=requested record lock conflicts with existing lock\r
-336527549=comparison not supported for specified data types\r
-335544475=lock on table {0} conflicts with existing lock\r
-336527548=cannot update erased record\r
-335544474=invalid lock level {0}\r
-336527547=cannot delete system tables\r
-335544473=invalid bookmark handle\r
-336527546=record disappeared\r
-335544472=Your user name and password are not defined. Ask your database administrator to set up a Firebird login.\r
-336527545=wrong record version\r
-335544471=there is no index in table {0} with id {1}\r
-336527544=limbo impossible\r
-335544470=cache buffer for page {0} invalid\r
-336527543=wrong record length\r
-336527542=differences record too long\r
-336527541=external access type not implemented\r
-336527540=cannot reposition for update after sort for RMS\r
-336920611=    -t      tablename\r
-336920610=    -r      analyze average record and version length\r
-335544469=transaction marked invalid by I/O error\r
-335544468=transaction {0} is {1}\r
-335544467=minor version too high found {0} expected {1}\r
-335544466=violation of FOREIGN KEY constraint "{0}" on table "{1}"\r
-336527539=decompression overran buffer\r
-335544465=invalid BLOB type for operation\r
-336527538=record length inconsistent\r
-335544464=secondary server attachments cannot start logging\r
-336527537=applied differences will not fit in record\r
-335544463=generator {0} is not defined\r
-336527536=bad difference record\r
-335544462=secondary server attachments cannot start journaling\r
-336527535=partner index description not found\r
-335544461=secondary server attachments cannot validate databases\r
-336527534=index key too big\r
-335544460=a file in manual shadow {0} is unavailable\r
-336527533=referenced index description not found\r
-336527532=journal server refused connection\r
-336527531=journal server is incompatible version\r
-336920609=    -p      password\r
-336527530=unexpected reply from journal server\r
-336920608=    -u      username\r
-336920607=System memory exhausted\r
-336920606=Can't read a database page\r
-336920605=Can't open database file {0}\r
-336920604=    -z      display version number\r
-336920603=    -s      analyze system relations\r
-336920602=    -l      analyze log page\r
-336920601=    -i      analyze index leaf pages\r
-336920600=    -h      analyze header page\r
-335544459=record from transaction {0} is stuck in limbo\r
-335544458=column not array or invalid dimensions (expected {0}, encountered {1})\r
-335544457=subscript out of bounds\r
-335544456=invalid slice description language at offset {0}\r
-336527529=return data type not supported\r
-335544455=cannot attach active shadow file\r
-336527528=looper: action not yet implemented\r
-335544454=filter not found to convert type {0} to type {1}\r
-336527527=invalid SEND request\r
-335544453=object {0} is in use\r
-336527526=invalid rsb type\r
-335544452=product {0} is not licensed\r
-336527525=cannot find tip page\r
-335544451=update conflicts with concurrent update\r
-336527524=failed to remove symbol from hash table\r
-335544450={0}\r
-336527523=root file name not listed for shadow\r
-336527522=shadow lock not synchronized properly\r
-336527521=shadow block not found\r
-336527520=wrong ACL version\r
-335609899=Could not run "{0}"\r
-335609898=Cannot open output file "{0}"\r
-335609897=Request terminated by statement\r
-335609896=Request terminated by statement: {0}\r
-335609895=field validation error\r
-335609894=execution terminated by signal\r
-335609893=fdopen failed\r
-335609892=could not create pipe\r
-335609891=output pipe is not supported on VMS\r
-335544449=\r
-335609890=print_blob: expected field node\r
-335544448=\r
-335544447=no rollback performed\r
-335544446=not updatable\r
-336527519=cannot assert logical lock\r
-335544445={0} extension error\r
-336527518=database file not available\r
-335544444=operation not supported\r
-336527517=cannot sort on a field that does not exist\r
-335544443=database system cannot write argument {0}\r
-336527516=attempt to release block overlapping prior free block\r
-335544442=database system cannot read argument {0}\r
-336527515=attempt to release block overlapping following free block\r
-335544441=database detach completed with errors\r
-336527514=attempt to release free block\r
-335544440=\r
-336527513=invalid pool id encountered\r
-336527512=memory pool free list is invalid\r
-336527511=request to allocate block type larger than maximum size\r
-336527510=request to allocate invalid block type\r
-336330899=    writing function {0}\r
-336330898=writing filters\r
-336330897=    writing filter {0}\r
-336330896=         writing column {0}\r
-335609889=EXEC_execute: not implemented\r
-336330895=     writing gen id of: {0}\r
-335609888=Input value is too long\r
-336330894=    writing data for table {0}\r
-335609887=user name is supported in RSEs temporarily\r
-336330893=    writing argument for function {0}\r
-335609886=data type not supported for arithmetic\r
-336330892=view\r
-335609885=EVAL_value: not finished\r
-336330891=    Version(s) for database "{0}"\r
-335609884=EVAL_boolean: not finished\r
-336330890=validation error on column in table {0}\r
-335609883=HSH_remove failed\r
-335609882=nStatistics for database "{0}"n{1}\r
-335609881=qli version {0}\r
-335544439=function {0} could not be matched\r
-335609880=Welcome to QLInQuery Language Interpreter\r
-335544438=function {0} is not defined\r
-335544437=wrong DYN version\r
-335544436=SQL error code = {0}\r
-336527509=cannot map page\r
-335544435=null segment of UNIQUE KEY\r
-336527508=wrong packet type\r
-335544434=key size exceeds implementation restriction for index "{0}"\r
-336527507=invalid block type encountered\r
-335544433=communication error with journal "{0}"\r
-335544432=lock manager error\r
-335544431=blocking signal has been received\r
-335544430=unable to allocate memory from operating system\r
-336330889=unknown switch "{0}"\r
-336330888=trigger type\r
-336330887=trigger message\r
-336330886=trigger\r
-335609879=Please retry, supplying an application script file name\r
-336330885=transportable backup -- data in XDR format\r
-335609878=illegal instruction or address, recovering...\r
-336330884=switches can be abbreviated to the unparenthesized characters\r
-335609877=arithmetic exception\r
-336330883=security class\r
-335609876=floating underflow fault\r
-336330882=starting transaction\r
-335609875=floating overflow fault\r
-336330881=started transaction\r
-335609874=floating underflow trap\r
-336330880=    restoring type {0} for column {1}\r
-335609873=floating division by zero\r
-335609872=floating overflow trap\r
-335609871=integer division by zero\r
-335544429=bad parameter number\r
-335609870=integer overflow\r
-335544428=undefined message number\r
-335544427=data operation not supported\r
-335544426=context not defined (BLR error)\r
-335544425=context already in use (BLR error)\r
-335544424=no lock manager available\r
-335544423=internal error\r
-335544422=internal error\r
-335544421=connection rejected by remote interface\r
-335544420=transaction outstanding\r
-336330879=    restoring trigger message for {0}\r
-336330878=    restoring trigger {0}\r
-336330877=restoring security class {0}\r
-336330876=restoring data for table {0}\r
-335609869=expected {0}, encountered "{1}"\r
-336330875=    restoring privilege for user {0}\r
-335609868=** QLI error: {0} **\r
-336330874=    restoring index {0}\r
-335609867=** QLI error from database **\r
-336330873=restoring domain {0}\r
-335609866=** QLI error from database "{0}" **\r
-336330872=     restoring gen id value of: {0}\r
-335609865=INTERNAL: {0}\r
-336330871=    restoring argument for function {0}\r
-335609864=show_fields: dtype not done\r
-336330870=restoring function {0}\r
-335609863=show option not implemented\r
-335609862=set option not implemented\r
-335609861=memory exhausted\r
-335544419=transaction not in limbo\r
-335609860=bad pool ID\r
-335544418=transaction in limbo\r
-335544417=internal error\r
-335544416=internal error\r
-335544415=database corrupted\r
-335544414=BLOB and array data types are not supported for {0} operation\r
-335544413=wrong version of database parameter block\r
-335544412=unsupported BLR version (expected {0}, encountered {1})\r
-335544411=wrong version of transaction parameter block\r
+335544321=arithmetic exception, numeric overflow, or string truncation\r
+335544322=invalid database key\r
+335544323=file {0} is not a valid database\r
+335544324=invalid database handle (no active connection)\r
+335544325=bad parameters on attach or create database\r
+335544326=unrecognized database parameter block\r
+335544327=invalid request handle\r
+335544328=invalid BLOB handle\r
+335544329=invalid BLOB ID\r
+335544330=invalid parameter in transaction parameter block\r
+335544331=invalid format for transaction parameter block\r
+335544332=invalid transaction handle (expecting explicit transaction start)\r
+335544333=internal gds software consistency check ({0})\r
+335544334=conversion error from string "{0}"\r
+335544335=database file appears corrupt ({0})\r
+335544336=deadlock\r
+335544337=attempt to start more than {0} transactions\r
+335544338=no match for first value expression\r
+335544339=information type inappropriate for object specified\r
+335544340=no information of this type available for object specified\r
+335544341=unknown information item\r
+335544342=action cancelled by trigger ({0}) to preserve data integrity\r
+335544343=invalid request BLR at offset {0}\r
+335544344=I/O error for file {0} "{1}"\r
+335544345=lock conflict on no wait transaction\r
+335544346=corrupt system table\r
+335544347=validation error for column {0}, value "{1}"\r
+335544348=no current record for fetch operation\r
+335544349=attempt to store duplicate value (visible to active transactions) in unique index "{0}"\r
+335544350=program attempted to exit without finishing database\r
+335544351=unsuccessful metadata update\r
+335544352=no permission for {0} access to {1} {2}\r
+335544353=transaction is not in limbo\r
+335544354=invalid database key\r
+335544355=BLOB was not closed\r
+335544356=metadata is obsolete\r
+335544357=cannot disconnect database with open transactions ({0} active)\r
+335544358=message length error (encountered {0}, expected {1})\r
+335544359=attempted update of read-only column\r
+335544360=attempted update of read-only table\r
+335544361=attempted update during read-only transaction\r
+335544362=cannot update read-only view {0}\r
+335544363=no transaction for request\r
+335544364=request synchronization error\r
+335544365=request referenced an unavailable database\r
+335544366=segment buffer length shorter than expected\r
+335544367=attempted retrieval of more segments than exist\r
+335544368=attempted invalid operation on a BLOB\r
+335544369=attempted read of a new, open BLOB\r
+335544370=attempted action on blob outside transaction\r
+335544371=attempted write to read-only BLOB\r
+335544372=attempted reference to BLOB in unavailable database\r
+335544373=operating system directive {0} failed\r
+335544374=attempt to fetch past the last record in a record stream\r
+335544375=unavailable database\r
+335544376=table {0} was omitted from the transaction reserving list\r
+335544377=request includes a DSRI extension not supported in this implementation\r
+335544378=feature is not supported\r
+335544379=unsupported on-disk structure for file {0}; found {1}, support {2}\r
+335544380=wrong number of arguments on call\r
+335544381=Implementation limit exceeded\r
+335544382={0}\r
+335544383=unrecoverable conflict with limbo transaction {0}\r
+335544384=internal error\r
+335544385=internal error\r
+335544386=too many requests\r
+335544387=internal error\r
+335544388=block size exceeds implementation restriction\r
+335544389=buffer exhausted\r
+335544390=BLR syntax error: expected {0} at offset {1}, encountered {2}\r
+335544391=buffer in use\r
+335544392=internal error\r
+335544393=request in use\r
+335544394=incompatible version of on-disk structure\r
+335544395=table {0} is not defined\r
+335544396=column {0} is not defined in table {1}\r
+335544397=internal error\r
+335544398=internal error\r
+335544399=internal error\r
+335544400=internal error\r
+335544401=internal error\r
+335544402=internal error\r
+335544403=page {0} is of wrong type (expected {1}, found {2})\r
+335544404=database corrupted\r
+335544405=checksum error on database page {0}\r
+335544406=index is broken\r
+335544407=database handle not zero\r
+335544408=transaction handle not zero\r
+335544409=transaction--request mismatch (synchronization error)\r
 335544410=bad handle count\r
-336397204=non-SQL security class defined\r
-336397203=An error occurred while trying to update the security database\r
-336330869=    restoring filter {0}\r
-336330868=    restoring file {0}\r
-336330867=    restoring column {0}\r
-336330866=restore failed for record in table {0}\r
-335609859=corrupt pool\r
-336330865= {0}V(ERIFY)             report each action taken\r
-335609858=bad block size\r
-336330864= {0}R(EPLACE_DATABASE)   replace database from backup file\r
-335609857=bad block type\r
-336330863=table\r
+335544411=wrong version of transaction parameter block\r
+335544412=unsupported BLR version (expected {0}, encountered {1})\r
+335544413=wrong version of database parameter block\r
+335544414=BLOB and array data types are not supported for {0} operation\r
+335544415=database corrupted\r
+335544416=internal error\r
+335544417=internal error\r
+335544418=transaction in limbo\r
+335544419=transaction not in limbo\r
+335544420=transaction outstanding\r
+335544421=connection rejected by remote interface\r
+335544422=internal error\r
+335544423=internal error\r
+335544424=no lock manager available\r
+335544425=context already in use (BLR error)\r
+335544426=context not defined (BLR error)\r
+335544427=data operation not supported\r
+335544428=undefined message number\r
+335544429=bad parameter number\r
+335544430=unable to allocate memory from operating system\r
+335544431=blocking signal has been received\r
+335544432=lock manager error\r
+335544433=communication error with journal "{0}"\r
+335544434=key size exceeds implementation restriction for index "{0}"\r
+335544435=null segment of UNIQUE KEY\r
+335544436=SQL error code = {0}\r
+335544437=wrong DYN version\r
+335544438=function {0} is not defined\r
+335544439=function {0} could not be matched\r
+335544440=\r
+335544441=database detach completed with errors\r
+335544442=database system cannot read argument {0}\r
+335544443=database system cannot write argument {0}\r
+335544444=operation not supported\r
+335544445={0} extension error\r
+335544446=not updatable\r
+335544447=no rollback performed\r
+335544448=\r
+335544449=\r
+335544450={0}\r
+335544451=update conflicts with concurrent update\r
+335544452=product {0} is not licensed\r
+335544453=object {0} is in use\r
+335544454=filter not found to convert type {0} to type {1}\r
+335544455=cannot attach active shadow file\r
+335544456=invalid slice description language at offset {0}\r
+335544457=subscript out of bounds\r
+335544458=column not array or invalid dimensions (expected {0}, encountered {1})\r
+335544459=record from transaction {0} is stuck in limbo\r
+335544460=a file in manual shadow {0} is unavailable\r
+335544461=secondary server attachments cannot validate databases\r
+335544462=secondary server attachments cannot start journaling\r
+335544463=generator {0} is not defined\r
+335544464=secondary server attachments cannot start logging\r
+335544465=invalid BLOB type for operation\r
+335544466=violation of FOREIGN KEY constraint "{0}" on table "{1}"\r
+335544467=minor version too high found {0} expected {1}\r
+335544468=transaction {0} is {1}\r
+335544469=transaction marked invalid by I/O error\r
+335544470=cache buffer for page {0} invalid\r
+335544471=there is no index in table {0} with id {1}\r
+335544472=Your user name and password are not defined. Ask your database administrator to set up a Firebird login.\r
+335544473=invalid bookmark handle\r
+335544474=invalid lock level {0}\r
+335544475=lock on table {0} conflicts with existing lock\r
+335544476=requested record lock conflicts with existing lock\r
+335544477=maximum indexes per table ({0}) exceeded\r
+335544478=enable journal for database before starting online dump\r
+335544479=online dump failure. Retry dump\r
+335544480=an online dump is already in progress\r
+335544481=no more disk/tape space.  Cannot continue online dump\r
+335544482=journaling allowed only if database has Write-ahead Log\r
+335544483=maximum number of online dump files that can be specified is 16\r
+335544484=error in opening Write-ahead Log file during recovery\r
+335544485=invalid statement handle\r
+335544486=Write-ahead log subsystem failure\r
+335544487=WAL Writer error\r
+335544488=Log file header of {0} too small\r
+335544489=Invalid version of log file {0}\r
+335544490=Log file {0} not latest in the chain but open flag still set\r
+335544491=Log file {0} not closed properly; database recovery may be required\r
+335544492=Database name in the log file {0} is different\r
+335544493=Unexpected end of log file {0} at offset {1}\r
+335544494=Incomplete log record at offset {0} in log file {1}\r
+335544495=Log record header too small at offset {0} in log file {1}\r
+335544496=Log block too small at offset {0} in log file {1}\r
+335544497=Illegal attempt to attach to an uninitialized WAL segment for {0}\r
+335544498=Invalid WAL parameter block option {0}\r
+335544499=Cannot roll over to the next log file {0}\r
+335544500=database does not use Write-ahead Log\r
+335544501=cannot drop log file when journaling is enabled\r
+335544502=reference to invalid stream number\r
+335544503=WAL subsystem encountered error\r
+335544504=WAL subsystem corrupted\r
+335544505=must specify archive file when enabling long term journal for databases with round-robin log files\r
+335544506=database {0} shutdown in progress\r
+335544507=refresh range number {0} already in use\r
+335544508=refresh range number {0} not found\r
+335544509=CHARACTER SET {0} is not defined\r
+335544510=lock time-out on wait transaction\r
+335544511=procedure {0} is not defined\r
+335544512=parameter mismatch for procedure {0}\r
+335544513=Database {0}: WAL subsystem bug for pid {1}-{2}\r
+335544514=Could not expand the WAL segment for database {0}\r
+335544515=status code {0} unknown\r
+335544516=exception {0} not defined\r
+335544517=exception {0}\r
+335544518=restart shared cache manager\r
+335544519=invalid lock handle\r
+335544520=long-term journaling already enabled\r
+335544521=Unable to roll over please see Firebird log.\r
+335544522=WAL I/O error.  Please see Firebird log.\r
+335544523=WAL writer - Journal server communication error.  Please see Firebird log.\r
+335544524=WAL buffers cannot be increased.  Please see Firebird log.\r
+335544525=WAL setup error.  Please see Firebird log.\r
+335544526=WAL writer synchronization error for the database {0}\r
+335544527=Cannot start WAL writer for the database {0}\r
+335544528=database {0} shutdown\r
+335544529=cannot modify an existing user privilege\r
+335544530=Cannot delete PRIMARY KEY being used in FOREIGN KEY definition.\r
+335544531=Column used in a PRIMARY/UNIQUE constraint must be NOT NULL.\r
+335544532=Name of Referential Constraint not defined in constraints table.\r
+335544533=Non-existent PRIMARY or UNIQUE KEY specified for FOREIGN KEY.\r
+335544534=Cannot update constraints (RDB$REF_CONSTRAINTS).\r
+335544535=Cannot update constraints (RDB$CHECK_CONSTRAINTS).\r
+335544536=Cannot delete CHECK constraint entry (RDB$CHECK_CONSTRAINTS)\r
+335544537=Cannot delete index segment used by an Integrity Constraint\r
+335544538=Cannot update index segment used by an Integrity Constraint\r
+335544539=Cannot delete index used by an Integrity Constraint\r
+335544540=Cannot modify index used by an Integrity Constraint\r
+335544541=Cannot delete trigger used by a CHECK Constraint\r
+335544542=Cannot update trigger used by a CHECK Constraint\r
+335544543=Cannot delete column being used in an Integrity Constraint.\r
+335544544=Cannot rename column being used in an Integrity Constraint.\r
+335544545=Cannot update constraints (RDB$RELATION_CONSTRAINTS).\r
+335544546=Cannot define constraints on views\r
+335544547=internal gds software consistency check (invalid RDB$CONSTRAINT_TYPE)\r
+335544548=Attempt to define a second PRIMARY KEY for the same table\r
+335544549=cannot modify or erase a system trigger\r
+335544550=only the owner of a table may reassign ownership\r
+335544551=could not find table/procedure for GRANT\r
+335544552=could not find column for GRANT\r
+335544553=user does not have GRANT privileges for operation\r
+335544554=table/procedure has non-SQL security class defined\r
+335544555=column has non-SQL security class defined\r
+335544556=Write-ahead Log without shared cache configuration not allowed\r
+335544557=database shutdown unsuccessful\r
+335544558=Operation violates CHECK constraint {0} on view or table {1}\r
+335544559=invalid service handle\r
+335544560=database {0} shutdown in {1} seconds\r
+335544561=wrong version of service parameter block\r
+335544562=unrecognized service parameter block\r
+335544563=service {0} is not defined\r
+335544564=long-term journaling not enabled\r
+335544565=Cannot transliterate character between character sets\r
+335544566=WAL defined; Cache Manager must be started first\r
+335544567=Overflow log specification required for round-robin log\r
+335544568=Implementation of text subtype {0} not located.\r
+335544569=Dynamic SQL Error\r
+335544570=Invalid command\r
+335544571=Data type for constant unknown\r
+335544572=Cursor {0} {1}\r
+335544573=Data type unknown\r
+335544574=Declared cursor already exists\r
+335544575=Cursor not updatable\r
+335544576=Attempt to reopen an open cursor\r
+335544577=Attempt to reclose a closed cursor\r
+335544578=Column unknown\r
+335544579=Internal error\r
+335544580=Table unknown\r
+335544581=Procedure unknown\r
+335544582=Request unknown\r
+335544583=SQLDA missing or incorrect version, or incorrect number/type of variables\r
+335544584=Count of read-write columns does not equal count of values\r
+335544585=Invalid statement handle\r
+335544586=Function unknown\r
+335544587=Column is not a BLOB\r
+335544588=COLLATION {0} is not defined\r
+335544589=COLLATION {0} is not valid for specified CHARACTER SET\r
+335544590=Option specified more than once\r
+335544591=Unknown transaction option\r
+335544592=Invalid array reference\r
+335544593=Array declared with too many dimensions\r
+335544594=Illegal array dimension range\r
+335544595=Trigger unknown\r
+335544596=Subselect illegal in this context\r
+335544597=Cannot prepare a CREATE DATABASE/SCHEMA statement\r
+335544598=must specify column name for view select expression\r
+335544599=number of columns does not match select list\r
+335544600=Only simple column names permitted for VIEW WITH CHECK OPTION\r
+335544601=No WHERE clause for VIEW WITH CHECK OPTION\r
+335544602=Only one table allowed for VIEW WITH CHECK OPTION\r
+335544603=DISTINCT, GROUP or HAVING not permitted for VIEW WITH CHECK OPTION\r
+335544604=FOREIGN KEY column count does not match PRIMARY KEY\r
+335544605=No subqueries permitted for VIEW WITH CHECK OPTION\r
+335544606=expression evaluation not supported\r
+335544607=gen.c: node not supported\r
+335544608=Unexpected end of command\r
+335544609=INDEX {0}\r
+335544610=EXCEPTION {0}\r
+335544611=COLUMN {0}\r
+335544612=Token unknown\r
+335544613=union not supported\r
+335544614=Unsupported DSQL construct\r
+335544615=column used with aggregate\r
+335544616=invalid column reference\r
+335544617=invalid ORDER BY clause\r
+335544618=Return mode by value not allowed for this data type\r
+335544619= External functions cannot have more than 10 parameters\r
+335544620=alias {0} conflicts with an alias in the same statement\r
+335544621=alias {0} conflicts with a procedure in the same statement\r
+335544622=alias {0} conflicts with a table in the same statement\r
+335544623=Illegal use of keyword VALUE\r
+335544624=segment count of 0 defined for index {0}\r
+335544625=A node name is not permitted in a secondary, shadow, cache or log file name\r
+335544626=TABLE {0}\r
+335544627=PROCEDURE {0}\r
+335544628=cannot create index {0}\r
+335544629=Write-ahead Log with shadowing configuration not allowed\r
+335544630=there are {0} dependencies\r
+335544631=too many keys defined for index {0}\r
+335544632=Preceding file did not specify length, so {0} must include starting page number\r
+335544633=Shadow number must be a positive integer\r
+335544634=Token unknown - line {0}, char {1}\r
+335544635=there is no alias or table named {0} at this scope level\r
+335544636=there is no index {0} for table {1}\r
+335544637=table {0} is not referenced in plan\r
+335544638=table {0} is referenced more than once in plan; use aliases to distinguish\r
+335544639=table {0} is referenced in the plan but not the from list\r
+335544640=Invalid use of CHARACTER SET or COLLATE\r
+335544641=Specified domain or source column {0} does not exist\r
+335544642=index {0} cannot be used in the specified plan\r
+335544643=the table {0} is referenced twice; use aliases to differentiate\r
+335544644=illegal operation when at beginning of stream\r
+335544645=the current position is on a crack\r
+335544646=database or file exists\r
+335544647=invalid comparison operator for find operation\r
+335544648=Connection lost to pipe server\r
+335544649=bad checksum\r
+335544650=wrong page type\r
+335544651=Cannot insert because the file is readonly or is on a read only medium.\r
+335544652=multiple rows in singleton select\r
+335544653=cannot attach to password database\r
+335544654=cannot start transaction for password database\r
+335544655=invalid direction for find operation\r
+335544656=variable {0} conflicts with parameter in same procedure\r
+335544657=Array/BLOB/DATE data types not allowed in arithmetic\r
+335544658={0} is not a valid base table of the specified view\r
+335544659=table {0} is referenced twice in view; use an alias to distinguish\r
+335544660=view {0} has more than one base table; use aliases to distinguish\r
+335544661=cannot add index, index root page is full.\r
+335544662=BLOB SUB_TYPE {0} is not defined\r
+335544663=Too many concurrent executions of the same request\r
+335544664=duplicate specification of {0} - not supported\r
+335544665=violation of PRIMARY or UNIQUE KEY constraint "{0}" on table "{1}"\r
+335544666=server version too old to support all CREATE DATABASE options\r
+335544667=drop database completed with errors\r
+335544668=procedure {0} does not return any values\r
+335544669=count of column list and variable list do not match\r
+335544670=attempt to index BLOB column in index {0}\r
+335544671=attempt to index array column in index {0}\r
+335544672=too few key columns found for index {0} (incorrect column name?)\r
+335544673=cannot delete\r
+335544674=last column in a table cannot be deleted\r
+335544675=sort error\r
+335544676=sort error: not enough memory\r
+335544677=too many versions\r
+335544678=invalid key position\r
+335544679=segments not allowed in expression index {0}\r
+335544680=sort error: corruption in data structure\r
+335544681=new record size of {0} bytes is too big\r
+335544682=Inappropriate self-reference of column\r
+335544683=request depth exceeded. (Recursive definition?)\r
+335544684=cannot access column {0} in view {1}\r
+335544685=dbkey not available for multi-table views\r
+335544686=journal file wrong format\r
+335544687=intermediate journal file full\r
+335544688=The prepare statement identifies a prepare statement with an open cursor\r
+335544689=Firebird error\r
+335544690=Cache redefined\r
+335544691=Insufficient memory to allocate page buffer cache\r
+335544692=Log redefined\r
+335544693=Log size too small\r
+335544694=Log partition size too small\r
+335544695=Partitions not supported in series of log file specification\r
+335544696=Total length of a partitioned log must be specified\r
+335544697=Precision must be from 1 to 18\r
+335544698=Scale must be between zero and precision\r
+335544699=Short integer expected\r
+335544700=Long integer expected\r
+335544701=Unsigned short integer expected\r
+335544702=Invalid ESCAPE sequence\r
+335544703=service {0} does not have an associated executable\r
+335544704=Failed to locate host machine.\r
+335544705=Undefined service {0}/{1}.\r
+335544706=The specified name was not found in the hosts file or Domain Name Services.\r
+335544707=user does not have GRANT privileges on base table/view for operation\r
+335544708=Ambiguous column reference.\r
+335544709=Invalid aggregate reference\r
+335544710=navigational stream {0} references a view with more than one base table\r
+335544711=Attempt to execute an unprepared dynamic SQL statement.\r
+335544712=Positive value expected\r
+335544713=Incorrect values within SQLDA structure\r
+335544714=invalid blob id\r
+335544715=Operation not supported for EXTERNAL FILE table {0}\r
+335544716=Service is currently busy: {0}\r
+335544717=stack size insufficent to execute current request\r
+335544718=Invalid key for find operation\r
+335544719=Error initializing the network software.\r
+335544720=Unable to load required library {0}.\r
+335544721=Unable to complete network request to host "{0}".\r
+335544722=Failed to establish a connection.\r
+335544723=Error while listening for an incoming connection.\r
+335544724=Failed to establish a secondary connection for event processing.\r
+335544725=Error while listening for an incoming event connection request.\r
+335544726=Error reading data from the connection.\r
+335544727=Error writing data to the connection.\r
+335544728=Cannot deactivate index used by an Integrity Constraint\r
+335544729=Cannot deactivate primary index\r
+335544730=Client/Server Express not supported in this release\r
+335544731=\r
+335544732=Access to databases on file servers is not supported.\r
+335544733=Error while trying to create file\r
+335544734=Error while trying to open file\r
+335544735=Error while trying to close file\r
+335544736=Error while trying to read from file\r
+335544737=Error while trying to write to file\r
+335544738=Error while trying to delete file\r
+335544739=Error while trying to access file\r
+335544740=A fatal exception occurred during the execution of a user defined function.\r
+335544741=connection lost to database\r
+335544742=User cannot write to RDB$USER_PRIVILEGES\r
+335544743=token size exceeds limit\r
+335544744=Maximum user count exceeded.  Contact your database administrator.\r
+335544745=Your login {0} is same as one of the SQL role name. Ask your database administrator to set up a valid Firebird login.\r
+335544746="REFERENCES table" without "(column)" requires PRIMARY KEY on referenced table\r
+335544747=The username entered is too long.  Maximum length is 31 bytes.\r
+335544748=The password specified is too long.  Maximum length is 8 bytes.\r
+335544749=A username is required for this operation.\r
+335544750=A password is required for this operation\r
+335544751=The network protocol specified is invalid\r
+335544752=A duplicate user name was found in the security database\r
+335544753=The user name specified was not found in the security database\r
+335544754=An error occurred while attempting to add the user.\r
+335544755=An error occurred while attempting to modify the user record.\r
+335544756=An error occurred while attempting to delete the user record.\r
+335544757=An error occurred while updating the security database.\r
+335544758=sort record size of {0} bytes is too big\r
+335544759=can not define a not null column with NULL as default value\r
+335544760=invalid clause --- '{0}'\r
+335544761=too many open handles to database\r
+335544762=size of optimizer block exceeded\r
+335544763=a string constant is delimited by double quotes\r
+335544764=DATE must be changed to TIMESTAMP\r
+335544765=attempted update on read-only database\r
+335544766=SQL dialect {0} is not supported in this database\r
+335544767=A fatal exception occurred during the execution of a blob filter.\r
+335544768=Access violation.  The code attempted to access a virtual address without privilege to do so.\r
+335544769=Datatype misalignment.  The attempted to read or write a value that was not stored on a memory boundary.\r
+335544770=Array bounds exceeded.  The code attempted to access an array element that is out of bounds.\r
+335544771=Float denormal operand.  One of the floating-point operands is too small to represent a standard float value.\r
+335544772=Floating-point divide by zero.  The code attempted to divide a floating-point value by zero.\r
+335544773=Floating-point inexact result.  The result of a floating-point operation cannot be represented as a deciaml fraction.\r
+335544774=Floating-point invalid operand.  An indeterminant error occurred during a floating-point operation.\r
+335544775=Floating-point overflow.  The exponent of a floating-point operation is greater than the magnitude allowed.\r
+335544776=Floating-point stack check.  The stack overflowed or underflowed as the result of a floating-point operation.\r
+335544777=Floating-point underflow.  The exponent of a floating-point operation is less than the magnitude allowed.\r
+335544778=Integer divide by zero.  The code attempted to divide an integer value by an integer divisor of zero.\r
+335544779=Integer overflow.  The result of an integer operation caused the most significant bit of the result to carry.\r
+335544780=An exception occurred that does not have a description.  Exception number {0}.\r
+335544781=Stack overflow.  The resource requirements of the runtime stack have exceeded the memory available to it.\r
+335544782=Segmentation Fault. The code attempted to access memory without priviledges.\r
+335544783=Illegal Instruction. The Code attempted to perfrom an illegal operation.\r
+335544784=Bus Error. The Code caused a system bus error.\r
+335544785=Floating Point Error. The Code caused an Arithmetic Exception or a floating point exception.\r
+335544786=Cannot delete rows from external files.\r
+335544787=Cannot update rows in external files.\r
+335544788=Unable to perform operation.  You must be either SYSDBA or owner of the database\r
+335544789=Specified EXTRACT part does not exist in input datatype\r
+335544790=Service {0} requires SYSDBA permissions.  Reattach to the Service Manager using the SYSDBA account.\r
+335544791=The file {0} is currently in use by another process.  Try again later.\r
+335544792=Cannot attach to services manager\r
+335544793=Metadata update statement is not allowed by the current database SQL dialect {0}\r
+335544794=operation was cancelled\r
+335544795=unexpected item in service parameter block, expected {0}\r
+335544796=Client SQL dialect {0} does not support reference to {1} datatype\r
+335544797=user name and password are required while attaching to the services manager\r
+335544798=You created an indirect dependency on uncommitted metadata. You must roll back the current transaction.\r
+335544799=The service name was not specified.\r
+335544800=Too many Contexts of Relation/Procedure/Views. Maximum allowed is 127\r
+335544801=data type not supported for arithmetic\r
+335544802=Database dialect being changed from 3 to 1\r
+335544803=Database dialect not changed.\r
+335544804=Unable to create database {0}\r
+335544805=Database dialect {0} is not a valid dialect.\r
+335544806=Valid database dialects are {0}.\r
+335544807=SQL warning code = {0}\r
+335544808=DATE data type is now called TIMESTAMP\r
+335544809=Function {0} is in {1}, which is not in a permitted directory for external functions.\r
+335544810=value exceeds the range for valid dates\r
+335544811=passed client dialect {0} is not a valid dialect.\r
+335544812=Valid client dialects are {0}.\r
+335544813=Unsupported field type specified in BETWEEN predicate.\r
+335544814=Services functionality will be supported in a later version  of the product\r
+335544815=GENERATOR {0}\r
+335544816=UDF {0}\r
+335544817=Invalid parameter to FIRST.  Only integers >= 0 are allowed.\r
+335544818=Invalid parameter to SKIP.  Only integers >= 0 are allowed.\r
+335544819=File exceeded maximum size of 2GB.  Add another database file or use a 64 bit I/O version of Firebird.\r
+335544820=Unable to find savepoint with name {0} in transaction context\r
+335544821=Invalid column position used in the {0} clause\r
+335544822=Cannot use an aggregate function in a WHERE clause, use HAVING instead\r
+335544823=Cannot use an aggregate function in a GROUP BY clause\r
+335544824=Invalid expression in the {0} (not contained in either an aggregate function or the GROUP BY clause)\r
+335544825=Invalid expression in the {0} (neither an aggregate function nor a part of the GROUP BY clause)\r
+335544826=Nested aggregate functions are not allowed\r
+335544827=Invalid argument in EXECUTE STATEMENT - cannot convert to string\r
+335544828=Wrong request type in EXECUTE STATEMENT '{0}'\r
+335544829=Variable type (position {0}) in EXECUTE STATEMENT '{1}' INTO does not match returned column type\r
+335544830=Too many recursion levels of EXECUTE STATEMENT\r
+335544831=Access to {0} "{1}" is denied by server administrator\r
+335544832=Cannot change difference file name while database is in backup mode\r
+335544833=Physical backup is not allowed while Write-Ahead Log is in use\r
+335544834=Invalid cursor state: {0}\r
+335544835=Target shutdown mode is invalid for database "{0}"\r
+335544836=Concatenation overflow. Resulting string cannot exceed 32K in length.\r
+335544837=Invalid {0} parameter to SUBSTRING. Only positive integers are allowed.\r
 335609856=expected type\r
-336330862=Reducing the database page size from {0} bytes to {1} bytes\r
-336330861= {0}Y  <path>            redirect/suppress status message output\r
-336330860={0} records written\r
-335544409=transaction--request mismatch (synchronization error)\r
-335544408=transaction handle not zero\r
-335544407=database handle not zero\r
-335544406=index is broken\r
-335544405=checksum error on database page {0}\r
-335544404=database corrupted\r
-335544403=page {0} is of wrong type (expected {1}, found {2})\r
-335544402=internal error\r
-335544401=internal error\r
-335544400=internal error\r
-336330859=   {0} records restored\r
-336330858=     {0} records ignored\r
-336330857=privilege\r
-336330856= {0}Z                    print version number\r
-336330855=page size specified ({0} bytes) rounded up to {1} bytes\r
-336330854=page size\r
-336330853= {0}P(AGE_SIZE)          override default page size\r
-336330852=opened file {0}\r
-336330851= {0}O(NE_AT_A_TIME)      restore one table at a time\r
-336330850= {0}L(IMBO)              ignore transactions in limbo\r
-336330849= {0}E(XPAND)             no data compression\r
-336330848=length given for initial file ({0}) is less than minimum ({1})\r
-336330847=legal switches are:\r
-336330846=trigger {0} is invalid\r
-336330845=index\r
-336330844=domain\r
-336330843=gbak version {0}\r
-336330842=function argument\r
-336330841=function\r
-336330840=finishing, closing, and going home\r
-336330839=filter\r
-336330838=file length\r
-336330837=file\r
-336330836=column\r
-336330835=Exiting before completion due to errors\r
-336330834=Exiting before completion due to errors\r
-336330833=error accessing BLOB column {0} -- continuing\r
-336330832=do not recognize {0} attribute {1} -- continuing\r
-336330831=do not understand BLOB INFO item {0}\r
-336330830= {0}I(NACTIVE)           deactivate indexes during restore\r
-336330829=database {0} has a page size of {1} bytes.\r
-336330828=creating indexes\r
-336330827=creating file {0}\r
-336330826=created database {0}, page_size {1} bytes\r
-336330825= {0}C(REATE_DATABASE)    create database from backup file\r
-336330824=committing data for table {0}\r
-336330823=creating index {0}\r
-336330822=committing secondary files\r
-336330821=commit failed on table {0}\r
-336330820=    committing metadata\r
-336330819=closing file, committing, and finishing\r
-336330818=cannot open status and error output file {0}\r
-336330817=cannot open backup file {0}\r
-336330816=blob\r
-336330815= {0}M(ETA_DATA)          backup metadata only\r
-336330814= {0}D(EVICE)             backup file device type on APOLLO (CT or MT)\r
-336330813=  backup file is compressed\r
-336330812= {0}B(ACKUP_DATABASE)    backup database to file\r
-336396787=The cursor identified in a FETCH or CLOSE statement is not open.\r
-336330811=backup\r
-336396786=The cursor identified in an OPEN statement is already open.\r
-336330810=array\r
-336396784=Unknown cursor\r
-336396780= The cursor identified in the update or delete statement is not positioned on a row.\r
-336330809=adding file {0}, starting at page {1}\r
-336330808=Unexpected I/O error while {0} backup file\r
-336330807=Expected XDR record length\r
-336330806=expected array dimension {0} but instead found {1}\r
-336330805=expected array version number {0} but instead found {1}\r
-336330804=array dimension for column {0} is invalid\r
-336330803=database format {0} is too old to restore to\r
-336396778=Attempt to update non-updatable cursor\r
-336330802=unexpected end of file on backup file\r
-336330801=no table name for data\r
+335609857=bad block type\r
+335609858=bad block size\r
+335609859=corrupt pool\r
+335609860=bad pool ID\r
+335609861=memory exhausted\r
+335609862=set option not implemented\r
+335609863=show option not implemented\r
+335609864=show_fields: dtype not done\r
+335609865=INTERNAL: {0}\r
+335609866=** QLI error from database "{0}" **\r
+335609867=** QLI error from database **\r
+335609868=** QLI error: {0} **\r
+335609869=expected {0}, encountered "{1}"\r
+335609870=integer overflow\r
+335609871=integer division by zero\r
+335609872=floating overflow trap\r
+335609873=floating division by zero\r
+335609874=floating underflow trap\r
+335609875=floating overflow fault\r
+335609876=floating underflow fault\r
+335609877=arithmetic exception\r
+335609878=illegal instruction or address, recovering...\r
+335609879=Please retry, supplying an application script file name\r
+335609880=Welcome to QLI Query Language Interpreter\r
+335609881=qli version {0}\r
+335609882=Statistics for database "{0}" {1}\r
+335609883=HSH_remove failed\r
+335609884=EVAL_boolean: not finished\r
+335609885=EVAL_value: not finished\r
+335609886=data type not supported for arithmetic\r
+335609887=user name is supported in RSEs temporarily\r
+335609888=Input value is too long\r
+335609889=EXEC_execute: not implemented\r
+335609890=print_blob: expected field node\r
+335609891=output pipe is not supported on VMS\r
+335609892=could not create pipe\r
+335609893=fdopen failed\r
+335609894=execution terminated by signal\r
+335609895=field validation error\r
+335609896=Request terminated by statement: {0}\r
+335609897=Request terminated by statement\r
+335609898=Cannot open output file "{0}"\r
+335609899=Could not run "{0}"\r
+335609900=comparison not done\r
+335609901=conversion not implemented\r
+335609902=conversion not implemented\r
+335609903=MOVQ_move: conversion not done\r
+335609904=BLOB conversion is not supported\r
+335609905=conversion error\r
+335609906=conversion error\r
+335609907=conversion error\r
+335609908=conversion error\r
+335609909=conversion error\r
+335609910=conversion error\r
+335609911=BLOB conversion is not supported\r
+335609912=Error converting string "{0}" to date\r
+335609913=overflow during conversion\r
+335609914=gds_$put_segment failed\r
+335609915=fseek failed\r
+335609916=unterminated quoted string\r
+335609917=could not open scratch file\r
+335609918=fseek failed\r
+335609919=unterminated quoted string\r
+335609920=unexpected end of procedure in procedure {0}\r
+335609921=unexpected end of file in file {0}\r
+335609922=unexpected eof\r
+335609923=cannot open command file "{0}"\r
+335609924=PIC_edit: class not yet implemented\r
+335609925=conversion error\r
+335609926=procedure "{0}" is undefined\r
+335609927=procedure "{0}" is undefined in database {1}\r
+335609928=procedure "{0}" is undefined\r
+335609929=Could not create QLI$PROCEDURE_NAME field\r
+335609930=Could not create QLI$PROCEDURE field\r
+335609931=Could not create QLI$PROCEDURES table\r
+335609932=procedure name "{0}" in use in database {1}\r
+335609933=database handle required\r
+335609934=QLI$PROCEDURES table must be created with RDO in Rdb/VMS databases\r
+335609935=procedure name over 31 characters\r
+335609936=     [{0} topics matched {1}]\r
+335609937= {0}Sub-topics available:\r
+335609938=No help is available for {0} {1}\r
+335609939=Sub-topics available for {0} are:\r
+335609940=Procedures can not be renamed across databases. Try COPY\r
+335609941=Procedure {0} not found in database {1}\r
+335609942=substitute prompt string too long\r
+335609943=substitute prompt string too long\r
+335609944=Procedure {0} not found in database {1}\r
+335609945=Procedure {0} not found in database {1}\r
+335609946=No security classes defined\r
+335609947=     Security class {0} is not defined\r
+335609948=     No views defined\r
+335609949=     No indexes defined\r
+335609950=     No indexes defined\r
+335609951=No databases are currently ready\r
+335609952=Procedure {0} in database "{1}" ({2})\r
+335609953=text, length {0}\r
+335609954=varying text, length {0}\r
+335609955=null terminated text, length {0}\r
+335609956=short binary\r
+335609957=long binary\r
+335609958=quad\r
+335609959=short floating\r
+335609960=long floating\r
+335609961=BLOB\r
+335609962=, segment length {0}\r
+335609963=, subtype {0}\r
+335609964=, subtype BLR\r
+335609965=, subtype ACL\r
+335609966=date\r
+335609967=, scale {0}\r
+335609968=, subtype fixed\r
+335609969=Database "{0}" readied as {1}\r
+335609970=Database "{0}"\r
+335609971=No databases are currently ready\r
+335609972=    Page size is {0} bytes.  Current allocation is {1} pages.\r
+335609973=Field {0} does not exist in database {1}\r
+335609974=Field {0} does not exist in any open database\r
+335609975= (computed expression)\r
+335609976=There are no forms defined for database {0}\r
+335609977=There are no forms defined in any open database\r
+335609978=Global field {0} does not exist in database {1}\r
+335609979=Global field {0} does not exist in any open database\r
+335609980=There are no fields defined for database {0}\r
+335609981=There are no fields defined in any open database\r
+335609982=Procedure {0} not found in database {1}\r
+335609983=Procedure {0} not found\r
+335609984=Procedures in database "{0}" ({1}):\r
+335609985=No triggers are defined for table {0}\r
+335609986=No triggers are defined in database {0}\r
+335609987=No triggers are defined in database {0}\r
+335609988=Variables:\r
+335609989=    QLI, version "{0}"\r
+335609990=    Version(s) for database "{0}"\r
+335609991=expand_expression: not yet implemented\r
+335609992=expand_statement: not yet implemented\r
+335609993=variables may not be based on BLOB fields\r
+335609994=cannot perform assignment to computed field {0}\r
+335609995=no context for ERASE\r
+335609996=cannot erase from a join\r
+335609997={0}.* cannot be used when a single element is required\r
+335609998="{0}" is undefined or used out of context\r
+335609999=no default form name\r
+335610000=No database for form {0}\r
+335610001=form {0} is not defined in database "{1}"\r
+335610002=no context for form ACCEPT statement\r
+335610003=field {0} is not defined in form {1}\r
+335610004=no context for modify\r
+335610005=field list required for modify\r
+335610006=No items in print list\r
+335610007=No items in print list\r
+335610008=invalid ORDER BY ordinal\r
+335610009=asterisk expressions require exactly one qualifying context\r
+335610010=unrecognized context\r
+335610011=field referenced in BASED ON cannot be resolved against readied databases\r
+335610012=expected statement, encountered "{0}"\r
+335610013=Expected PROCEDURE encountered "{0}"\r
+335610014=period in qualified name\r
+335610015=no databases are ready\r
+335610016=BLOB variables are not supported\r
+335610017=end of statement\r
+335610018=end of command\r
+335610019=quoted edit string\r
+335610020=variable definition clause\r
+335610021={0} is not a database\r
+335610022={0} is not a table in database {1}\r
+335610023=variable data type\r
+335610024=no data type may be specified for a variable based on a field\r
+335610025=object type for DEFINE\r
+335610026=table name\r
+335610027=comma between field definitions\r
+335610028=FROM\r
+335610029=table or view name\r
+335610030=[\r
+335610031=]\r
+335610032=No statements issued yet\r
+335610033=ON or TO\r
+335610034=quoted edit string\r
+335610035=column definition clause\r
+335610036=global fields may not be based on other fields\r
+335610037=field name or asterisk expression\r
+335610038=FROM RSE clause\r
+335610039=comma\r
+335610040=quoted header segment\r
+335610041=left parenthesis\r
+335610042=comma or terminating right parenthesis\r
+335610043=left parenthesis\r
+335610044=VALUES list or SELECT clause\r
+335610045=the number of values do not match the number of fields\r
+335610046=value expression\r
+335610047=right parenthesis\r
+335610048=quoted string\r
+335610049=ENTREE or END\r
+335610050=quoted string\r
+335610051=index state option\r
+335610052=table name\r
+335610053=ADD, MODIFY, or DROP\r
+335610054=comma between field definitions\r
+335610055=identifier\r
+335610056=positive number\r
+335610057=FORM\r
+335610058=period in qualified table name\r
+335610059={0} is not a table in database {1}\r
+335610060=database file name required on READY\r
+335610061=EXISTS (SELECT * <sql rse>)\r
+335610062=relational operator\r
+335610063=a database has not been readied\r
+335610064=expected "table_name", encountered "{0}"\r
+335610065=table name\r
+335610066=PROCEDURE\r
+335610067=TOP or BOTTOM\r
+335610068=report writer SET option\r
+335610069=report item\r
+335610070=set option\r
+335610071=RELATIONS or TRIGGERS\r
+335610072=table name\r
+335610073=database name\r
+335610074=table name\r
+335610075=database name\r
+335610076=table name\r
+335610077=database name\r
+335610078=table name\r
+335610079=table name\r
+335610080=FROM clause\r
+335610081=AVG, MAX, MIN, SUM, or COUNT\r
+335610082=COUNT (*)\r
+335610083=left parenthesis\r
+335610084=OF\r
+335610085=database handle\r
+335610086=SET\r
+335610087=database block not found for removal\r
+335610088=show_fields: dtype not done\r
+335610089=global field {0} already exists\r
+335610090=Cannot define an index in a view\r
+335610091=Index {0} already exists\r
+335610092=Column {0} does not occur in table {1}\r
+335610093=Table {0} already exists\r
+335610094=Field {0} is in use in the following relations:\r
+335610095=Field {0} is in use in database "{1}"\r
+335610096=Field {0} is not defined in database "{1}"\r
+335610097=Index {0} is not defined in database "{1}"\r
+335610098=metadata operation failed\r
+335610099=no active database for operation\r
+335610100=Interactive metadata updates are not available on Rdb\r
+335610101=global field {0} is not defined\r
+335610102=Index {0} does not exist in database {1}\r
+335610103=field {0} does not exist\r
+335610104=no active database for operation\r
+335610105=Interactive metadata updates are not available on Rdb\r
+335610106=Unlicensed for database "{0}"\r
+335610107=Field {0} already exists in relation {1}\r
+335610108=data type cannot be changed locally\r
+335610109=global field {0} does not exist\r
+335610110=field {0} not found in relation {1}\r
+335610111=Data type conflict with existing global field {0}\r
+335610112=No data type specified for field {0}\r
+335610113=database info call failed\r
+335610114=do not understand BLR operator {0}\r
+335610115=Operation unlicensed for database "{0}"\r
+335610116=    Security class for database {0}\r
+335610117=    Database description:\r
+335610118=    Database description:\r
+335610119=     File:   {0} starting at page {1}\r
+335610120=Field {0} in {1} {2} of database {3}\r
+335610121=    Global field {0}\r
+335610122=    Field description:\r
+335610123=    Datatype information:\r
+335610124=    Field is computed from:\r
+335610125=    Field validation:\r
+335610126=    Security class {0}\r
+335610127=    Query name:       {0}\r
+335610128=    Query name:       {0}\r
+335610129=    Edit string:      {0}\r
+335610130=    Edit string:      {0}\r
+335610131=    Query header:\r
+335610132=Global field {0} in database {1}\r
+335610133=    Field description:\r
+335610134=    Datatype information:\r
+335610135=    Field is computed from:\r
+335610136=    Field validation:\r
+335610137=    Query name:       {0}\r
+335610138=    Edit string:      {0}\r
+335610139=    Query header:\r
+335610140=    {0} is not used in any relations in database {1}\r
+335610141=Forms in database {0}\r
+335610142=Global fields for database {0}:\r
+335610143=    Field description:\r
+335610144=        Index {0}{1}\r
+335610145=            index {0} is NOT active\r
+335610146=        Index {0}{1}\r
+335610147=    Description:\r
+335610148=    Security class {0}\r
+335610149=    Stored in external file {0}\r
+335610150=OBSOLETE -        An erase trigger is defined for {0}\r
+335610151=OBSOLETE -        A modify trigger is defined for {0}\r
+335610152=OBSOLETE -        A store trigger is defined for {0}\r
+335610153=    Security classes for database {0}\r
+335610154=OBSOLETE -   Triggers for relation {0}:\r
+335610155=OBSOLETE -    Source for the erase trigger is not available.  Trigger BLR:\r
+335610156=OBSOLETE -    Erase trigger for relation {0}:\r
+335610157=OBSOLETE -    Source for the modify trigger is not available.  Trigger BLR:\r
+335610158=OBSOLETE -    Modify trigger for relation {0}:\r
+335610159=OBSOLETE -    Source for the store trigger is not available.  Trigger BLR:\r
+335610160=OBSOLETE -    Store trigger for relation {0}:\r
+335610161=OBSOLETE -    Triggers for relation {0}:\r
+335610162=OBSOLETE -    Source for the erase trigger is not available.  Trigger BLR:\r
+335610163=OBSOLETE -    Erase trigger for relation {0}:\r
+335610164=OBSOLETE -    Source for the modify trigger is not available.  Trigger BLR:\r
+335610165=OBSOLETE -    Modify trigger for relation {0}:\r
+335610166=OBSOLETE -    Source for the store trigger is not available.  Trigger BLR:\r
+335610167=OBSOLETE -    Store trigger for relation {0}:\r
+335610168= View source for relation {0} is not available.  View BLR:\r
+335610169= Relation {0} is a view defined as:\r
+335610170=Views in database {0}:\r
+335610171=    {0} comprised of :\r
+335610172=Views in database {0}:\r
+335610173=    {0} comprised of:\r
+335610174=BLOB\r
+335610175=, segment length {0}\r
+335610176=, subtype text\r
+335610177=, subtype BLR\r
+335610178=, subtype ACL\r
+335610179=, subtype {0}\r
+335610180=text, length {0}\r
+335610181=varying text, length {0}\r
+335610182=null terminated text, length {0}\r
+335610183=short binary\r
+335610184=long binary\r
+335610185=quadword binary\r
+335610186=short floating\r
+335610187=long floating\r
+335610188=date\r
+335610189=, scale {0}\r
+335610190=, subtype fixed\r
+335610191=    Global field {0} is used in database {1} as :\r
+335610192=     {0} in relation {1}\r
+335610193=Field {0} in {1} {2} of database {3}\r
+335610194=    Global field {0}\r
+335610195=    Field description:\r
+335610196=    Datatype information\r
+335610197=    Field is computed from:\r
+335610198=    Field validation:\r
+335610199=    Query name:       {0}\r
+335610200=    Query name:       {0}\r
+335610201=    Query header:\r
+335610202=    Edit string:      {0}\r
+335610203=    Edit string:      {0}\r
+335610204={0} Based on field {1} of {2}{3}\r
+335610205={0}Base field description for {1}:\r
+335610206=END PROCEDURE\r
+335610207=Do you want to roll back your updates?\r
+335610208=gen_descriptor: dtype not recognized\r
+335610209=gen_expression: not understood\r
+335610210=gen_statement: not yet implemented\r
+335610211=gen_statistical: not understood\r
+335610212=EDIT argument must be a BLOB field\r
+335610213=relations from multiple databases in single RSE\r
+335610214=cannot find database for BLOB edit\r
+335610215=compile_expression: not yet implemented\r
+335610216=not yet implemented (compile_statement)\r
+335610217=computable: not yet implemented\r
+335610218=make_descriptor: not yet implemented\r
+335610219=missing message\r
+335610220=lost message\r
+335610221=Triggers for relation {0}:\r
+335610222=    {0}      {1}, Sequence {2}, {3}\r
+335610223=Pre-store\r
+335610224=Post-store\r
+335610225=Pre-modify\r
+335610226=Post-modify\r
+335610227=Pre-erase\r
+335610228=Post-erase\r
+335610229=Active\r
+335610230=Inactive\r
+335610231=     Description:\r
+335610232=     Source for the trigger:\r
+335610233=     Source for the trigger is not available.  Trigger BLR:\r
+335610234=No system triggers are defined\r
+335610235=System Trigger for relation {0}\r
+335610236=     Triggers defined for this relation:\r
+335610237=Trigger for relation {0}:\r
+335610238=TOP or BOTTOM\r
+335610239=sort field\r
+335610240=Too many WITHs\r
+335610241=     Shadow {0}, File: {1} starting at page {2}\r
+335610242=DATABASE, TABLE, or INDEX\r
+335610243=Database filename required in CREATE\r
+335610244=FLOAT\r
+335610245=INDEX\r
+335610246=Multiple page size specifications\r
+335610247=GROUP BY not allowed in view definition\r
+335610248=Aggregates not allowed in view definition\r
+335610249=NULL\r
+335610250=AS\r
+335610251=SELECT\r
+335610252==\r
+335610253=ON\r
+335610254=field name\r
+335610255=table name\r
+335610256=user name identifier\r
+335610257=GRANT\r
+335610258=OPTION\r
+335610259=FROM\r
+335610260=TO\r
+335610261=ADD or DROP\r
+335610262=Dynamic DDL buffer exceeded\r
+335610263=TABLE\r
+335610264=Database handle {0} conflicts with an established name\r
+335610265=Could not create QLI$PROCEDURES index\r
+335610266=Cannot convert from {0} to {1}\r
+335610267=Cannot convert "{0}" to a numeric value\r
+335610268=function {0} not found in database {1}\r
+335610269=Incompatible global field {0} already exists in target database\r
+335610270=Relation {0} is missing or undefined\r
+335610271=matching language string too long\r
+335610272=Functions in database "{0}" ({1}):\r
+335610273=Functions are not supported in database {0}.\r
+335610275=There are no functions defined in any open database.\r
+335610276=Functions are not supported in any open database.\r
+335610277=    Function description:\r
+335610278=Function {0} is not defined in database {1}.\r
+335610279=Function {0} is not defined in any open database.\r
+335610280=Function {0} ({1}) in database "{2}" ({3}):\r
+335610281=Function {0} in database "{1}" ({2}):\r
+335610282=    Function library is {0}\r
+335610283=    Return argument is\r
+335610284=    Argument {0} is\r
+335610285=database file name required on DROP DATABASE\r
+335610286=Unlicensed for database "{0}"\r
+335610287=Could not drop database file "{0}"\r
+335610288=Operation unlicensed for database "{0}"\r
+335610289= array\r
+335610290=memory pool free list is incorrect\r
+335610291=block released twice\r
+335610292=released block overlaps following free block\r
+335610293=released block overlaps prior free block\r
+335610294=References to array fields like {0} in relation {1} are not supported\r
+335610295=Filters are not supported in database {0}.\r
+335610296=Filter {0} is not defined in database {1}.\r
+335610297=Filter {0} is not defined in any open database.\r
+335610298=Filters are not supported in any open database.\r
+335610299=There are no filters defined in any open database.\r
+335610300=Filter {0} in database "{1}" ({2}):\r
+335610301=    Filter library is {0}\r
+335610302=    Input sub-type is {0}\r
+335610303=    Output sub-type is {0}\r
+335610304=    Filter description:\r
+335610305=Filters in database {0} ({1}):\r
+335610306=     Index {0}{1}{2}{3}\r
+335610307=simple field reference not allowed in global aggregates\r
+335610308=prompting not allowed in select field list\r
+335610309=output pipe is not supported on MPE/XL\r
+335610310=could not resolve context for aggregate expression\r
+335610311=source relation {0} does not exist\r
+335610312=Messages associated with {0}:\r
+335610313=    message {0}:  {1}\r
+335610314=Connection to database {0} lost Please FINISH the database!\r
+335610315=Unable to create form window\r
+335610316=Do you want to rollback updates for {0}?\r
+335610317=functions are not supported in database {0}\r
+335610318=no functions are defined in database {0}\r
+335610319=filters are not supported in database {0}\r
+335610320=no filters are defined for database {0}\r
+335610321=Error during two phase commit on database {0} roll back all databases or commit databases individually\r
+335610322=Only fields may be subscripted\r
+335610323="{0}" is not a field and so may not be subscripted\r
+335610324=Data type of field {0} may not be changed to or from BLOB\r
+335610325=qli: ignoring unknown switch -{0}\r
+335610326=literal string  <MAXSYMLEN> characters or longer\r
+335610327=Variable {0}\r
+335610328=    Query name:       {0}\r
+335610329=    Edit string:      {0}\r
+335610330=Variable {0} has not been declared\r
+335610331=    Datatype information:\r
+335610332=input line too long\r
+335610333=input line too long\r
+335610334=number > 0\r
+335610335= ({0})\r
+335610336=cannot format unsubscripted array {0}\r
+335610337=unsuccessful attempt to extend pool beyond 64KB\r
+335610338=field width ({0}) * header segments ({1}) greater than 60,000 characters\r
+335610339=Relation {0} does not exist\r
+335610340=FORMs not supported\r
+335610341=     Expression index BLR:\r
+335610343=Invalid argument for UDF\r
+335610344=SINGULAR (SELECT * <sql rse>)\r
+335610345=JOIN\r
+335610351=Field {0} in view {1} of database {2}\r
+335610352=Field {0} in relation {1} of database {2}\r
+335610353=YES\r
+335610354=NO\r
+335610355=Re-enter\r
+335610356=Enter\r
+335610357=bad kanji found while formatting output\r
+335610358=Subtopic?\r
+335610359= type <cr> for next topic or <EOF> to stop:\r
+335610360=unknown data type {0}\r
+335610361=    reads = !r writes = !w fetches = !f marks = !m\r
+335610362=    elapsed = !e cpu = !u system = !s mem = !x buffers = !b\r
+335610363={0} Based on field {1} of relation {2}\r
+335610364={0} Based on field {1} of view {2}\r
+335675392=gdef version {0}\r
+335675393=gdef: unknown switch {0}\r
+335675394=     legal switches are:\r
+335675395={0}{1}\r
+335675396=gdef: Database name is required for extract\r
+335675397=gdef: cannot open {0}\r
+335675398=gdef: cannot open {0} or {1}\r
+335675399= {0} errors during input.\r
+335675400= No errors.\r
+335675401= 1 error during input.\r
+335675402=Save changes before exiting?\r
+335675403=Ceasing processing because\r
+335675404=of errors.\r
+335675405=you told me to.\r
+335675406=memory exhausted\r
+335675407={0}:{1}:\r
+335675408=error count exceeds limit ({0})\r
+335675409=what we have here is a failure to communicate!\r
+335675410=Database "{0}" already exists\r
+335675411=Do you want to replace it?\r
+335675412=Database "{0}" exists but cannot be opened\r
+335675413=Could not create database "{0}"\r
+335675414=    Version(s) for database "{0}"\r
+335675415=    Version(s) for database "{0}"\r
+335675416=GDEF unlicensed\r
+335675417=Could not locate database\r
+335675418=error committing metadata changes\r
+335675419=Could not release database\r
+335675420=Could not delete file {0}\r
+335675421=Could not attach database "{0}"\r
+335675422=    Version(s) for database "{0}"\r
+335675423=GDEF unlicensed\r
+335675424=database version is too old to modify: use GBAK first\r
+335675425=no database specified\r
+335675426=action not implemented yet\r
+335675427=error rolling back metadata changes\r
+335675428=error committing metadata changes\r
+335675429=field {0} already exists in relation {1}\r
+335675430=gds_$database_info failed\r
+335675431=Preceding file did not specify length, so {0} must include starting page number\r
+335675432=error committing new file declarations\r
+335675433=function {0} already exists\r
+335675434={0} is a view and cannot be indexed\r
+335675435=table {0} does not exist\r
+335675436=index {0}: field {1} does not exist in relation {2}\r
+335675437=index {0}: field {1} in {2} is computed and cannot be a key\r
+335675438=combined key length ({0}) for index {1} is > 254 bytes\r
+335675439=index {0} already exists\r
+335675440=error creating index {0}\r
+335675441=table {0} already exists\r
+335675442=security class {0} already exists\r
+335675443=Store trigger already exists for {0}\r
+335675444=Modify trigger already exists for {0}\r
+335675445=Erase trigger already exists for {0}\r
+335675446=table {0} does not exist\r
+335675447=table {0} already exists\r
+335675448=field {0} already exists in relation {1}\r
+335675449=field {0} does not exist in relation {1} as referenced in view field {2}\r
+335675450=gds_$close_blob failed\r
+335675451=gds_$create_blob failed\r
+335675452=field {0} from relation {1} is referenced in view {2}\r
+335675453=field {0} does not exist in relation {1}\r
+335675454=filter {0} does not exist\r
+335675455=function {0} does not exist\r
+335675456=field {0} is used in relation {1} (local name {2}) and cannot be dropped\r
+335675457=field {0} does not exist\r
+335675458=index {0} does not exist\r
+335675459={0} referenced by view {1}\r
+335675460=cannot drop system relation {0}\r
+335675461=table {0} does not exist\r
+335675462=security class {0} does not exist\r
+335675463=shadow {0} does not exist\r
+335675464=error committing deletion of shadow\r
+335675465=Trigger {0} does not exist\r
+335675466=Trigger message number {0} for trigger {1} does not exist\r
+335675467=Type {0} for field {1} does not exist\r
+335675468=User privilege {0} on field {1} in relation {2} for user {3} does not exist\r
+335675469=User privilege {0} on relation {1} for user {2} does not exist\r
+335675470=field {0} is unknown in relation {1}\r
+335675471=relation {0} is used in trigger {1} but not defined\r
+335675472=TOTAL of date not supported\r
+335675473=(EXE) make_desc: do not understand node type\r
+335675474=field {0} does not exist\r
+335675475=Unauthorized attempt to change field {0} to or from BLOB\r
+335675476=field {0} does not exist\r
+335675477=index {0} does not exist\r
+335675478=relation {0} is not external\r
+335675479=table {0} does not exist\r
+335675480=Invalid attempt to assign trigger {0} to a new relation\r
+335675481=Trigger {0} does not exist\r
+335675482=Type {0} for field {1} does not exist\r
+335675483=symbol {0} is too long\r
+335675484=gds_$put_segment failed\r
+335675485=gds_$put_segment failed\r
+335675486=(EXE) string_length: No defined length for BLOBS\r
+335675487=GENERATE_blr: dtype not supported\r
+335675488=GENERATE_blr: node not supported\r
+335675489=object cannot be resolved\r
+335675490=Global field {0} is not defined\r
+335675491=field {0} does not exist in relation {1}\r
+335675492=field {0} does not exist\r
+335675493=field {0} cannot be resolved\r
+335675494=field {0} is not defined in relation {1}\r
+335675495=global field {0} is not defined\r
+335675496=relation {0} is not defined\r
+335675497=trigger {0} is not defined\r
+335675498=bugcheck\r
+335675499=relation {0} is not defined\r
+335675500=context {0} is not defined\r
+335675501=Cannot resolve field "{0}"\r
+335675502=relation {0} is not defined\r
+335675503=no database declared\r
+335675504=ceasing processing\r
+335675505=expected function, encountered "{0}"\r
+335675506=expected function, encountered "{0}"\r
+335675507=expected number, encountered "{0}"\r
+335675508=expected table name, encountered "{0}"\r
+335675509=expected identifier, encountered "{0}"\r
+335675510=expected quoted string, encountered "{0}"\r
+335675511=expected symbol, encountered "{0}"\r
+335675512=GDEF processes only one database at a time\r
+335675513=only SECURITY_CLASS, DESCRIPTION, and CACHE can be dropped\r
+335675514=PAGE_SIZE cannot be modified\r
+335675515=data type required for global field\r
+335675516=Security class can appear only on local field references\r
+335675517=database version is too old for the new syntax: filters\r
+335675518=expected filter name, encountered "{0}"\r
+335675519=Filter entry point must be specified\r
+335675520=Filter module name must be specified\r
+335675521=database version is too old for the new syntax: functions\r
+335675522=Function entry point must be specified\r
+335675523=Function module name must be specified\r
+335675524=expected comma or semicolon, encountered "{0}"\r
+335675525=database version is too old for the new syntax: ASC/DESC\r
+335675526=database version is too old for the new syntax: ASC/DESC\b\r
+335675527=expected comma or semicolon, encountered "{0}"\r
+335675528=expected STORE, MODIFY, ERASE, END_TRIGGER, encountered "{0}"\r
+335675529=table {0} already exists\r
+335675530=expected comma or semicolon, encountered "{0}"\r
+335675531=shadow number must be a positive integer\r
+335675532=database version is too old for the new trigger syntax\r
+335675533=expected STORE, MODIFY, ERASE, encountered "{0}"\r
+335675534=message number {0} exceeds 255\r
+335675535=database version is too old for the new syntax: types\r
+335675536=expected period, encountered "{0}"\r
+335675537=expected qualified field name, encountered "{0}"\r
+335675538=expected period, encountered "{0}"\r
+335675539=data type cstring not supported for fields\r
+335675540=computed by expression must be parenthesized\r
+335675541=unmatched parenthesis\r
+335675542=expected FROM, COMPUTED, or qualified field, encountered "{0}"\r
+335675543=database version is too old for the new syntax: filters\r
+335675544=database version is too old for the new syntax: functions\r
+335675545=expected STORE, MODIFY, ERASE, or END_TRIGGER, encountered "{0}"\r
+335675546=database version is too old for the new trigger syntax\r
+335675547=database version is too old for the new syntax: types\r
+335675548=gen_trigger_name: invalid trigger type\r
+335675549=System flag value of 1 is reserved for system relations\r
+335675550=database version is too old for the new syntax: GRANT\r
+335675551=expected ON, encountered "{0}"\r
+335675552=GRANT privilege was not specified\r
+335675553=expected TO, encountered "{0}"\r
+335675554=expected GRANT, encountered "{0}"\r
+335675555=expected OPTION, encountered "{0}"\r
+335675556=global field {0} already exists\r
+335675557=expected STORE, MODIFY, ERASE, END_TRIGGER, encountered "{0}"\r
+335675558=Trigger {0} does not exist\r
+335675559=expected global field name, encountered "{0}"\r
+335675560=data type cstring not supported for fields\r
+335675561= A computed expression cannot be changed or added\r
+335675562=Security class can appear only on local field references\r
+335675563=database version is too old for the new syntax: ASC/DESC\b\r
+335675564=expected DESCRIPTION, encountered "{0}"\r
+335675565=A computed expression cannot be changed or added\r
+335675566=expected field action, encountered "{0}"\r
+335675567=database version is too old for the new trigger syntax\r
+335675568=expected trigger name, encountered "{0}"\r
+335675569=Unsuccessful attempt to modify trigger relation\r
+335675570=message number {0} exceeds 255\r
+335675571=expected message modification keyword, encountered "{0}"\r
+335675572=database version is too old for the new syntax: types \b\r
+335675573=A computed expression cannot be changed or added\r
+335675574=expected drop/modify of field or security class, encountered "{0}"\r
+335675575=expected object for DEFINE, encountered "{0}"\r
+335675576=expected object for MODIFY, encountered "{0}"\r
+335675577=expected object for DROP, encountered "{0}"\r
+335675578=expected command, encountered "{0}"\r
+335675579=database version is too old for the new syntax: array\b\r
+335675580=array size must be positive\r
+335675581=expected comma, encountered "{0}"\r
+335675582=expected semicolon, encountered "{0}"\r
+335675583=data type cstring not supported for fields\r
+335675584=expected field clause, encountered "{0}"\r
+335675585=expected DESCRIPTION, EDIT_STRING, MISSING VALUE, SECURITY_CLASS or VALID_IF, encountered "{0}"\r
+335675586=COMPUTED BY expression must be parenthesized\r
+335675587=unmatched parenthesis\r
+335675588=validation expression must be parenthesized\r
+335675589=segment length must be positive\r
+335675590=expected field sub_type, encountered "{0}"\r
+335675591=expected field sub_type, encountered "{0}"\r
+335675592=expected "[", encountered "{0}"\r
+335675593=character field length must be positive\r
+335675594=expected "]", encountered "{0}"\r
+335675595=argument mode by value not allowed for this data type\r
+335675596=argument mode is by value, or by reference\r
+335675597=return mode must be return_value or return_argument\r
+335675598=expected number, encountered "{0}"\r
+335675599=expected comma between group and user ID, encountered "{0}"\r
+335675600=expected trailing bracket, encountered "{0}"\r
+335675601=no database declared\r
+335675602=PAGE_SIZE specified ({0}) longer than limit of {1} bytes\r
+335675603=PAGE_SIZE specified ({0}) was rounded up to {1} bytes\r
+335675604=Unrecognized privilege "%c" or unrecognized identifier\r
+335675605=database version is too old for the new syntax: REVOKE\b\r
+335675606=expected ON, encountered "{0}"\r
+335675607=REVOKE privilege was not specified\r
+335675608=expected FROM, encountered "{0}"\r
+335675609=Attempt change trigger type from STORE to ERASE\r
+335675610=Attempt change trigger type from MODIFY to STORE\r
+335675611=Attempt change trigger type from MODIFY to ERASE\r
+335675612=Attempt to change trigger type from ERASE to STORE\r
+335675613=valid if\r
+335675614=missing value\r
+335675615=data type\r
+335675616=sub type\r
+335675617=segment_length\r
+335675618={0} is a global, not local, attribute\r
+335675619=computed fields need data types\r
+335675620=subtypes are valid only for BLOBS and text\r
+335675621=segment length is valid only for BLOBS\r
+335675622=global field {0} is not defined\r
+335675623=action not implemented yet\r
+335675624=action not implemented yet\r
+335675625=action not implemented yet\r
+335675626=OVER can only be used in CROSS expressions\r
+335675627=abort code cannot exceed 255\r
+335675628=expected =, encountered "{0}"\r
+335675629=too many decimal points\r
+335675630=unrecognized character in numeric string\r
+335675631=expected FROM RSE clause, encountered "{0}"\r
+335675632=expected comma or right parenthesis, encountered "{0}"\r
+335675633=expected left parenthesis, encountered "{0}"\r
+335675634=expected value expression, encountered "{0}"\r
+335675635=expected right parenthesis, encountered "{0}"\r
+335675636=expected IN, encountered "{0}"\r
+335675637=expected relational operator, encountered "{0}"\r
+335675638=expected OF, encountered "{0}"\r
+335675639=action not implemented yet\r
+335675640=ddl: cannot open {0}\r
+335675641=    Version(s) for database "{0}"\r
+335675642=**** unable to decompile missing value ***\r
+335675643=  /* Security Class Definitions / GRANT statements   */\r
+335675644=**** field {0} cannot be extracted, computed source missing ***\r
+335675645=\r
+335675646= ***gds_$database_info failed***\r
+335675647=  /* Global Field Definitions        */\r
+335675648=  /* Filter Definitions      */\r
+335675649=  /* Function Definitions    */\r
+335675650=  /* Relation Definitions    */\r
+335675651=  /* Add Security Classes to Defined Objects */\r
+335675652=  /* Trigger Definitions     */\r
+335675653=*****  trigger type not understood ****\r
+335675654=****  trigger source for trigger {0} must be recreated ****\r
+335675655=**** store trigger source for relation {0} must be recreated ****\r
+335675656=**** modify trigger source for relation {0} must be recreated ****\r
+335675657=**** erase trigger source for relation {0} must be recreated ****\r
+335675658=  /* View Definitions        */\r
+335675659=**** view definition {0} must be recreated ****\r
+335675660=***** ACL not understood *****\r
+335675661=gds_$open_blob failed\r
+335675662=*****  BLOB option not understood ****\r
+335675663=gds_$get_segment failed\r
+335675664=gds_$close_blob failed\r
+335675665=database version is too old for the new syntax: generators\r
+335675666=expected generator name, encountered "{0}"\r
+335675667=fseek failed\r
+335675668=could not open scratch file\r
+335675669=gds_$put_segment failed\r
+335675670= unterminated quoted string\r
+335675671=line too long\r
+335675672=HSH_remove failed\r
+335675673=gdef: cannot open DYN output file: {0}\r
+335675674=action not implemented yet\r
+335675675=internal error during DYN pretty print\r
+335675676=internal error during DYN pretty print\r
+335675677=internal error during DYN pretty print\r
+335675678=\r
+335675679=inappropriate self-reference of field\r
+335675680=shadow file must be AUTO or MANUAL\r
+335675681=BLR request size limit exceeded\r
+335675682=  /* Generator Definitions   */\r
+335675683=  /* Index Definitions       */\r
+335675684=argument mode of a return_argument must be 'by reference'\r
+335675685=argument mode 'by value' requires a return mode\r
+335675686=unexpected end of file, semicolon missing?\r
+335675687=Functions cannot return arrays.\r
+335675688=symbol {0} is too long, truncating it to {1} characters\r
+335675689=A node name is not permitted in a shadow, secondary, or log file name\r
+335675690=A non-Decnet node name is not permitted in an external file name\r
+335675691=A node name is not permitted in an external file name\r
+335675692=table {0} already exists\r
+335675693=Array indexes and size cannot be modified\r
+335675694=Modify data type of array {0} requires complete field specification\r
+335675695=A relation or view may not be defined and then deleted in a single execution of GDEF\r
+335675696=expected message keyword, encountered "{0}"\r
+335675697=expected trigger action, encountered "{0}"\r
+335675698=expected end_trigger or description keyword, encountered "{0}"\r
+335675699=Ceasing processing because of errors.\r
+335675700=Ceasing processing.\r
+335675701=shadow {0} is inactive\r
+335675702=UDF is limited to 10 parameters\r
+335675703=Set_generator requires write privilege for RDB$GENERATORS.\r
+335675704=key length ({0}) for compound index {1} exceeds 202\r
+335675705=expected ON or '(', encountered "{0}"\r
+335675706=expected ')', encountered "{0}"\r
+335675707=expected ON or '(', encountered "{0}"\r
+335675708=expected ')', encountered "{0}"\r
+335675709=expected comma or right bracket, encountered "{0}"\r
+335675710=expected GENERATOR, encountered "{0}"\r
+335675711=Unexpected sort clause\r
+335675712=DYN request size limit exceeded\r
+335675713=error committing new Write-ahead Log declarations\r
+335675714=a node name is not permitted in a shared cache file name\r
+335675715=a shared cache file {0} already exists\r
+335675716=error committing new shared cache file declaration\r
+335675717=no shared cache file exists to drop\r
+335675718=error committing deletion of shared cache file\r
+335675719=error in getting Write-ahead Log information\r
+335675720=error in reading list of log files\r
+335675721=use CASCADE option to remove log files before archive is done\r
+335675722=Only raw devices support partitioned log files\r
+335675723=Raw devices not supported in series of log file specification\r
+335675724=Partitions not supported in series of log file specification\r
+335675725=Cannot modify log file specification.  Drop and redefine log files\r
+335675726=log partition size too small for {0}\r
+335675727=Total length of the partitioned log {0} must be specified\r
+335675728=Minimum log length should be {0} Kbytes\r
+335675729=Cannot add and drop log file in same statement.\r
+335675730=Only one log configuration can be specified.\r
+335675731=minimum of {0} cache pages required\r
+335675732=Overflow log specification required for this configuration\r
+335675733=expected comma or ')', encountered "{0}"\r
+335675734=YES\r
+335675735=NO\r
+335675736=Please respond with YES or NO.\r
+335740929=data base file name ({0}) already given\r
+335740930=invalid switch {0}\r
+335740931=gfix version {0}\r
+335740932=incompatible switch combination\r
+335740933=replay log pathname required\r
+335740934=number of page buffers for cache required\r
+335740935=numeric value required\r
+335740936=positive numeric value required\r
+335740937=number of transactions per sweep required\r
+335740938=transaction number or "all" required\r
+335740939="sync" or "async" required\r
+335740940="full" or "reserve" required\r
+335740941=user name required\r
+335740942=password required\r
+335740943=subsystem name\r
+335740944="wal" required\r
+335740945=number of seconds required\r
+335740946=numeric value between 0 and 32767 inclusive required\r
+335740947=must specify type of shutdown\r
+335740948=please retry, specifying an option\r
+335740949=plausible options are:\r
+335740950= qualifiers show the major option in parenthesis\r
+335740951=please retry, giving a database name\r
+335740952=Summary of validation errors\r
+335740953=     -activate       activate shadow file for database usage\r
+335740954=     -attach         shutdown new database attachments\r
+335740955=     -begin_log      begin logging for replay utility\r
+335740956=     -buffers        set page buffers <n>\r
+335740957=     -commit         commit transaction <tr / all>\r
+335740958=     -cache          shutdown cache manager\r
+335740959=     -disable        disable WAL\r
+335740960=     -full           validate record fragments (-v)\r
+335740961=     -force          force database shutdown\r
+335740962=     -housekeeping   set sweep interval <n>\r
+335740963=     -ignore         ignore checksum errors\r
+335740964=     -kill           kill all unavailable shadow files\r
+335740965=     -list           show limbo transactions\r
+335740966=     -mend           prepare corrupt database for backup\r
+335740967=     -no_update      read-only validation (-v)\r
+335740968=     -online         database online <single / multi / normal>\r
+335740969=     -prompt         prompt for commit/rollback (-l)\r
+335740970=     -password       default password\r
+335740971=     -quit_log       quit logging for replay utility\r
+335740972=     -rollback       rollback transaction <tr / all>\r
+335740973=     -sweep          force garbage collection\r
+335740974=     -shut           shutdown <full / single / multi>\r
+335740975=     -two_phase      perform automated two-phase recovery\r
+335740976=     -tran           shutdown transaction startup\r
+335740977=     -use            use full or reserve space for versions\r
+335740978=     -user           default user name\r
+335740979=     -validate       validate database structure\r
+335740980=     -write          write synchronously or asynchronously\r
+335740981=     -x              set debug on\r
+335740982=     -z              print software version number\r
+335740983=  Number of record level errors      : {0}\r
+335740984=     Number of Blob page errors      : {0}\r
+335740985=     Number of data page errors      : {0}\r
+335740986=     Number of index page errors     : {0}\r
+335740987=     Number of pointer page errors   : {0}\r
+335740988=     Number of transaction page errors       : {0}\r
+335740989=     Number of database page errors  : {0}\r
+335740990=bad block type\r
+335740991=internal block exceeds maximum size\r
+335740992=corrupt pool\r
+335740993=virtual memory exhausted\r
+335740994=bad pool id\r
+335740995=Transaction state {0} not in valid range.\r
+335740996=ATTACH_DATABASE: attempted attach of {0},\r
+335740997= failed\r
+335740998= succeeded\r
+335740999=Transaction {0} is in limbo.\r
+335741000=More limbo transactions than fit.  Try again\r
+335741001=Unrecognized info item {0}\r
+335741002=A commit of transaction {0} will violate two-phase commit.\r
+335741003=A rollback of transaction {0} is needed to preserve two-phase commit.\r
+335741004=Transaction {0} has already been partially committed.\r
+335741005=A rollback of this transaction will violate two-phase commit.\r
+335741006=Transaction {0} has been partially committed.\r
+335741007=A commit is necessary to preserve the two-phase commit.\r
+335741008=Insufficient information is available to determine\r
+335741009=a proper action for transaction {0}.\r
+335741010=Transaction {0}: All subtransactions have been prepared.\r
+335741011=Either commit or rollback is possible.\r
+335741012=unexpected end of input\r
+335741013=Commit, rollback, or neither (c, r, or n)?\r
+335741014=Could not reattach to database for transaction {0}.\r
+335741015=Original path: {0}\r
+335741016=Enter a valid path:\r
+335741017=Attach unsuccessful.\r
+335741018=failed to reconnect to a transaction in database {0}\r
+335741019=Transaction {0}:\r
+335741020=  Multidatabase transaction:\r
+335741021=    Host Site: {0}\r
+335741022=    Transaction {0}\r
+335741023=has been prepared.\r
+335741024=has been committed.\r
+335741025=has been rolled back.\r
+335741026=is not available.\r
+335741027=is not found, assumed not prepared.\r
+335741028=is not found, assumed to be committed.\r
+335741029=        Remote Site: {0}\r
+335741030=        Database Path: {0}\r
+335741031=  Automated recovery would commit this transaction.\r
+335741032=  Automated recovery would rollback this transaction.\r
+335741033=Warning: Multidatabase transaction is in inconsistent state for recovery.\r
+335741034=Transaction {0} was committed, but prior ones were rolled back.\r
+335741035=Transaction {0} was rolled back, but prior ones were committed.\r
+335741036=Transaction description item unknown\r
+335741037=     -mode           read_only or read_write\r
+335741038="read_only" or "read_write" required\r
+335741039=     -sql_dialect    set database dialect n\r
+335741040=database SQL dialect must be one of '{0}'\r
+335741041=dialect number required\r
+336003074=Cannot SELECT RDB$DB_KEY from a stored procedure.\r
+336003075=Precision 10 to 18 changed from DOUBLE PRECISION in SQL dialect 1 to 64-bit scaled integer in SQL dialect 3\r
+336003076=Use of {0} expression that returns different results in dialect 1 and dialect 3\r
+336003077=Database SQL dialect {0} does not support reference to {1} datatype\r
+336003078=\r
+336003079=DB dialect {0} and client dialect {1} conflict with respect to numeric precision {2}.\r
+336003080=WARNING: Numeric literal {0} is interpreted as a floating-point\r
+336003081=value in SQL dialect 1, but as an exact numeric value in SQL dialect 3.\r
+336003082=WARNING: NUMERIC and DECIMAL fields with precision 10 or greater are stored\r
+336003083=as approximate floating-point values in SQL dialect 1, but as 64-bit\r
+336003084=integers in SQL dialect 3.\r
+336003085=Ambiguous field name between {0} and {1}\r
+336003086=External function should have return position between 1 and {0}\r
+336003087=Label {0} {1} in the current scope\r
+336003088=Datatypes {0}are not comparable in expression {1}\r
+336068609=ODS version not supported by DYN\r
+336068610=unsupported DYN verb\r
+336068611=STORE RDB$FIELD_DIMENSIONS failed\r
+336068612=unsupported DYN verb\r
+336068613={0}\r
+336068614=unsupported DYN verb\r
+336068615=DEFINE BLOB FILTER failed\r
+336068616=DEFINE GENERATOR failed\r
+336068617=DEFINE GENERATOR unexpected DYN verb\r
+336068618=DEFINE FUNCTION failed\r
+336068619=unsupported DYN verb\r
+336068620=DEFINE FUNCTION ARGUMENT failed\r
+336068621=STORE RDB$FIELDS failed\r
+336068622=No table specified for index\r
+336068623=STORE RDB$INDICES failed\r
+336068624=unsupported DYN verb\r
+336068625=PRIMARY KEY column lookup failed\r
+336068626=could not find UNIQUE INDEX with specified columns\r
+336068627=PRIMARY KEY lookup failed\r
+336068628=could not find PRIMARY KEY index in specified table\r
+336068629=STORE RDB$INDICES failed\r
+336068630=STORE RDB$FIELDS failed\r
+336068631=STORE RDB$RELATION_FIELDS failed\r
+336068632=STORE RDB$RELATIONS failed\r
+336068633=STORE RDB$USER_PRIVILEGES failed defining a table\r
+336068634=unsupported DYN verb\r
+336068635=STORE RDB$RELATIONS failed\r
+336068636=STORE RDB$FIELDS failed\r
+336068637=STORE RDB$RELATION_FIELDS failed\r
+336068638=unsupported DYN verb\r
+336068639=DEFINE TRIGGER failed\r
+336068640=unsupported DYN verb\r
+336068641=DEFINE TRIGGER MESSAGE failed\r
+336068642=STORE RDB$VIEW_RELATIONS failed\r
+336068643=ERASE RDB$FIELDS failed\r
+336068644=ERASE BLOB FILTER failed\r
+336068645=BLOB Filter not found\r
+336068646=unsupported DYN verb\r
+336068647=ERASE RDB$FUNCTION_ARGUMENTS failed\r
+336068648=ERASE RDB$FUNCTIONS failed\r
+336068649=Function not found\r
+336068650=unsupported DYN verb\r
+336068651=column {0} is used in table {1} (local name {2}) and cannot be dropped\r
+336068652=ERASE RDB$FIELDS failed\r
+336068653=ERASE RDB$FIELDS failed\r
+336068654=Column not found\r
+336068655=ERASE RDB$INDICES failed\r
+336068656=Index not found\r
+336068657=ERASE RDB$INDEX_SEGMENTS failed\r
+336068658=No segments found for index\r
+336068659=No table specified in ERASE RFR\r
+336068660=Column {0} from table {1} is referenced in view {2}\r
+336068661=ERASE RDB$RELATION_FIELDS failed\r
+336068662=ERASE RDB$RELATION_FIELDS failed\r
+336068663=Column not found for table\r
+336068664=ERASE RDB$INDEX_SEGMENTS failed\r
+336068665=ERASE RDB$INDICES failed\r
+336068666=ERASE RDB$RELATION_FIELDS failed\r
+336068667=ERASE RDB$VIEW_RELATIONS failed\r
+336068668=ERASE RDB$RELATIONS failed\r
+336068669=Table not found\r
+336068670=ERASE RDB$USER_PRIVILEGES failed\r
+336068671=ERASE RDB$FILES failed\r
+336068672=unsupported DYN verb\r
+336068673=ERASE RDB$TRIGGER_MESSAGES failed\r
+336068674=ERASE RDB$TRIGGERS failed\r
+336068675=Trigger not found\r
+336068676=MODIFY RDB$VIEW_RELATIONS failed\r
+336068677=unsupported DYN verb\r
+336068678=TRIGGER NAME expected\r
+336068679=ERASE TRIGGER MESSAGE failed\r
+336068680=Trigger Message not found\r
+336068681=unsupported DYN verb\r
+336068682=ERASE RDB$SECURITY_CLASSES failed\r
+336068683=Security class not found\r
+336068684=unsupported DYN verb\r
+336068685=SELECT RDB$USER_PRIVILEGES failed in grant\r
+336068686=SELECT RDB$USER_PRIVILEGES failed in grant\r
+336068687=STORE RDB$USER_PRIVILEGES failed in grant\r
+336068688= Specified domain or source column does not exist\r
+336068689=Generation of column name failed\r
+336068690=Generation of index name failed\r
+336068691=Generation of trigger name failed\r
+336068692=MODIFY DATABASE failed\r
+336068693=MODIFY DATABASE failed\r
+336068694=MODIFY DATABASE failed\r
+336068695=MODIFY RDB$FIELDS failed\r
+336068696=MODIFY RDB$FIELDS failed\r
+336068697=Domain not found\r
+336068698=unsupported DYN verb\r
+336068699=MODIFY RDB$INDICESS failed\r
+336068700=MODIFY RDB$INDICES failed\r
+336068701=Index column not found\r
+336068702=MODIFY RDB$FIELDS failed\r
+336068703=MODIFY RDB$RELATION_FIELDS failed\r
+336068704=Local column not found\r
+336068705=add EXTERNAL FILE not allowed\r
+336068706=drop EXTERNAL FILE not allowed\r
+336068707=MODIFY RDB$RELATIONS failed\r
+336068708=MODIFY RDB$RELATIONS failed\r
+336068709=Table column not found\r
+336068710=MODIFY TRIGGER failed\r
+336068711=TRIGGER NAME expected\r
+336068712=unsupported DYN verb\r
+336068713=MODIFY TRIGGER MESSAGE failed\r
+336068714=Create metadata BLOB failed\r
+336068715=Write metadata BLOB failed\r
+336068716=Close metadata BLOB failed\r
+336068717=Create metadata BLOB failed\r
+336068718=unsupported DYN verb\r
+336068719=ERASE RDB$USER_PRIVILEGES failed in revoke(1)\r
+336068720=Access to RDB$USER_PRIVILEGES failed in revoke(2)\r
+336068721=ERASE RDB$USER_PRIVILEGES failed in revoke (3)\r
+336068722=Access to RDB$USER_PRIVILEGES failed in revoke (4)\r
+336068723=CREATE VIEW failed\r
+336068724= attempt to index BLOB column in INDEX {0}\r
+336068725= attempt to index array column in index {0}\r
+336068726=key size too big for index {0}\r
+336068727=no keys for index {0}\r
+336068728=Unknown columns in index {0}\r
+336068729=STORE RDB$RELATION_CONSTRAINTS failed\r
+336068730=STORE RDB$CHECK_CONSTRAINTS failed\r
+336068731=Column: {0} not defined as NOT NULL - cannot be used in PRIMARY KEY/UNIQUE constraint definition\r
+336068732=A column name is repeated in the definition of constraint: {0}\r
+336068733=Integrity Constraint lookup failed\r
+336068734=Same set of columns cannot be used in more than one PRIMARY KEY and/or UNIQUE constraint definition\r
+336068735=STORE RDB$REF_CONSTRAINTS failed\r
+336068736=No table specified in delete_constraint\r
+336068737=ERASE RDB$RELATION_CONSTRAINTS failed\r
+336068738=CONSTRAINT {0} does not exist.\r
+336068739=Generation of constraint name failed\r
+336068740=Table {0} already exists\r
+336068741=Number of referencing columns do not equal number of referenced columns\r
+336068742=STORE RDB$PROCEDURES failed\r
+336068743=Procedure {0} already exists\r
+336068744=STORE RDB$PROCEDURE_PARAMETERS failed\r
+336068745=Store into system table {0} failed\r
+336068746=ERASE RDB$PROCEDURE_PARAMETERS failed\r
+336068747=ERASE RDB$PROCEDURES failed\r
+336068748=Procedure {0} not found\r
+336068749=MODIFY RDB$PROCEDURES failed\r
+336068750=DEFINE EXCEPTION failed\r
+336068751=ERASE EXCEPTION failed\r
+336068752=Exception not found\r
+336068753=MODIFY EXCEPTION failed\r
+336068754=Parameter {0} in procedure {1} not found\r
+336068755=Trigger {0} not found\r
+336068756=Shared cache file already exists\r
+336068757=Shared cache file not found\r
+336068758=STORE RDB$FILES failed\r
+336068759=Write-ahead Log already exists\r
+336068760=Write-ahead Log not found\r
+336068761=ERASE RDB$LOG_FILES failed\r
+336068762=STORE RDB$LOG_FILES failed\r
+336068763=Write-ahead Log lookup failed\r
+336068764=Shared cache lookup failed\r
+336068765=DEFINE SHADOW failed\r
+336068766=MODIFY DATABASE failed\r
+336068767=Name longer than database column size\r
+336068768="Only one constraint allowed for a domain"\r
+336068770=Looking up column position failed\r
+336068771=A node name is not permitted in a table with external file definition\r
+336068772=Shadow lookup failed\r
+336068773=Shadow {0} already exists\r
+336068774=Cannot add file with the same name as the database or added files\r
+336068775=no grant option for privilege {0} on column {1} of table/view {2}\r
+336068776=no grant option for privilege {0} on column {1} of base table/view {2}\r
+336068777=no grant option for privilege {0} on table/view {1} (for column {2})\r
+336068778=no grant option for privilege {0} on base table/view {1} (for column {2})\r
+336068779=no {0} privilege with grant option on table/view {1} (for column {2})\r
+336068780=no {0} privilege with grant option on base table/view {1} (for column {2})\r
+336068781=no grant option for privilege {0} on table/view {1}\r
+336068782=no {0} privilege with grant option on table/view {1}\r
+336068783=table/view {0} does not exist\r
+336068784=column {0} does not exist in table/view {1}\r
+336068785=Can not alter a view\r
+336068786=EXTERNAL FILE table not supported in this context\r
+336068787=attempt to index COMPUTED BY column in INDEX {0}\r
+336068788=Table Name lookup failed\r
+336068789=attempt to index a view\r
+336068790=SELECT RDB$RELATIONS failed in grant\r
+336068791=SELECT RDB$RELATION_FIELDS failed in grant\r
+336068792=SELECT RDB$RELATIONS/RDB$OWNER_NAME failed in grant\r
+336068793=SELECT RDB$USER_PRIVILEGES failed in grant\r
+336068794=SELECT RDB$VIEW_RELATIONS/RDB$RELATION_FIELDS/... failed in grant\r
+336068795=column {0} from table {1} is referenced in index {2}\r
+336068796=SQL role {0} does not exist\r
+336068797=user {0} has no grant admin option on SQL role {1}\r
+336068798=user {0} is not a member of SQL role {1}\r
+336068799={0} is not the owner of SQL role {1}\r
+336068800={0} is a SQL role and not a user\r
+336068801=user name {0} could not be used for SQL role\r
+336068802=SQL role {0} already exists\r
+336068803=keyword {0} can not be used as a SQL role name\r
+336068804=SQL roles are not supported in on older versions of the database.  A backup and restore of the database is required.\r
+336068812=Cannot rename domain {0} to {1}.  A domain with that name already exists.\r
+336068813=Cannot rename column {0} to {1}.  A column with that name already exists in table {2}.\r
+336068814=Column {0} from table {1} is referenced in {2}\r
+336068815=Cannot change datatype for column {0}.  Changing datatype is not supported for BLOB or ARRAY columns.\r
+336068816=New size specified for column {0} must be at least {1} characters.\r
+336068817=Cannot change datatype for {0}.  Conversion from base type {1} to {2} is not supported.\r
+336068818=Cannot change datatype for column {0} from a character type to a non-character type.\r
+336068819=unable to allocate memory from the operating system\r
+336068820=Zero length identifiers are not allowed\r
+336068821=ERASE RDB$GENERATORS failed\r
+336068822=Generator not found\r
+336068823=Difference file is not defined\r
+336068824=Difference file is already defined\r
+336068825=Database is already in the physical backup mode\r
+336068826=Database is not in the physical backup mode\r
+336265216=This is a modified text message\r
+336265219=This is a test message\r
+336330752=could not locate appropriate error message\r
+336330753=found unknown switch\r
+336330754=page size parameter missing\r
+336330755=Page size specified ({0}) greater than limit (8192 bytes)\r
+336330756=redirect location for output is not specified\r
+336330757=conflicting switches for backup/restore\r
+336330758=device type {0} not known\r
+336330759=protection is not there yet\r
+336330760=page size is allowed only on restore or create\r
+336330761=multiple sources or destinations specified\r
+336330762=requires both input and output filenames\r
+336330763=input and output have the same name.  Disallowed.\r
+336330764=expected page size, encountered "{0}"\r
+336330765=REPLACE specified, but the first file {0} is a database\r
+336330766=database {0} already exists.  To replace it, use the -R switch\r
+336330767=device type not specified\r
+336330768=cannot create APOLLO tape descriptor file {0}\r
+336330769=cannot set APOLLO tape descriptor attribute for {0}\r
+336330770=cannot create APOLLO cartridge descriptor file {0}\r
+336330771=cannot close APOLLO tape descriptor file {0}\r
+336330772=gds_$blob_info failed\r
+336330773=do not understand BLOB INFO item {0}\r
+336330774=gds_$get_segment failed\r
+336330775=gds_$close_blob failed\r
+336330776=gds_$open_blob failed\r
+336330777=Failed in put_blr_gen_id\r
+336330778=data type {0} not understood\r
+336330779=gds_$compile_request failed\r
+336330780=gds_$start_request failed\r
+336330781= gds_$receive failed\r
+336330782=gds_$release_request failed\r
+336330783= gds_$database_info failed\r
+336330784=Expected database description record\r
+336330785=failed to create database {0}\r
+336330786=RESTORE: decompression length error\r
+336330787=cannot find table {0}\r
+336330788=Cannot find column for BLOB\r
+336330789=gds_$create_blob failed\r
+336330790=gds_$put_segment failed\r
+336330791=expected record length\r
+336330792=wrong length record, expected {0} encountered {1}\r
+336330793=expected data attribute\r
+336330794=Failed in store_blr_gen_id\r
+336330795=do not recognize record type {0}\r
+336330796=Expected backup version 1, 2, or 3.  Found {0}\r
+336330797=expected backup description record\r
+336330798=string truncated\r
+336330799= warning -- record could not be restored\r
 336330800=gds_$send failed\r
-336396770=Unknown statement or request\r
-336396769=The prepare statement identifies a prepare statement with an open cursor\r
-336396758=violation of FOREIGN KEY constraint "{0}"\r
-336396757=Cannot prepare a CREATE DATABASE/SCHEMA statement\r
-336396756=transaction marked invalid by I/O error\r
-336396737=This user does not have privilege to perform this operation on this object.\r
-336396736=user does not have the privilege to perform operation\r
+336330801=no table name for data\r
+336330802=unexpected end of file on backup file\r
+336330803=database format {0} is too old to restore to\r
+336330804=array dimension for column {0} is invalid\r
+336330805=expected array version number {0} but instead found {1}\r
+336330806=expected array dimension {0} but instead found {1}\r
+336330807=Expected XDR record length\r
+336330808=Unexpected I/O error while {0} backup file\r
+336330809=adding file {0}, starting at page {1}\r
+336330810=array\r
+336330811=backup\r
+336330812=     {0}B(ACKUP_DATABASE)    backup database to file\r
+336330813=             backup file is compressed\r
+336330814=     {0}D(EVICE)             backup file device type on APOLLO (CT or MT)\r
+336330815=     {0}M(ETA_DATA)          backup metadata only\r
+336330816=blob\r
+336330817=cannot open backup file {0}\r
+336330818=cannot open status and error output file {0}\r
+336330819=closing file, committing, and finishing\r
+336330820=    committing metadata\r
+336330821=commit failed on table {0}\r
+336330822=committing secondary files\r
+336330823=creating index {0}\r
+336330824=committing data for table {0}\r
+336330825=     {0}C(REATE_DATABASE)    create database from backup file\r
+336330826=created database {0}, page_size {1} bytes\r
+336330827=creating file {0}\r
+336330828=creating indexes\r
+336330829=database {0} has a page size of {1} bytes.\r
+336330830=     {0}I(NACTIVE)           deactivate indexes during restore\r
+336330831=do not understand BLOB INFO item {0}\r
+336330832=do not recognize {0} attribute {1} -- continuing\r
+336330833=error accessing BLOB column {0} -- continuing\r
+336330834=Exiting before completion due to errors\r
+336330835=Exiting before completion due to errors\r
+336330836=column\r
+336330837=file\r
+336330838=file length\r
+336330839=filter\r
+336330840=finishing, closing, and going home\r
+336330841=function\r
+336330842=function argument\r
+336330843=gbak version {0}\r
+336330844=domain\r
+336330845=index\r
+336330846=trigger {0} is invalid\r
+336330847=legal switches are:\r
+336330848=length given for initial file ({0}) is less than minimum ({1})\r
+336330849=     {0}E(XPAND)             no data compression\r
+336330850=     {0}L(IMBO)              ignore transactions in limbo\r
+336330851=     {0}O(NE_AT_A_TIME)      restore one table at a time\r
+336330852=opened file {0}\r
+336330853=     {0}P(AGE_SIZE)          override default page size\r
+336330854=page size\r
+336330855=page size specified ({0} bytes) rounded up to {1} bytes\r
+336330856=     {0}Z                    print version number\r
+336330857=privilege\r
+336330858=     {0} records ignored\r
+336330859=   {0} records restored\r
+336330860={0} records written\r
+336330861=     {0}Y  <path>            redirect/suppress status message output\r
+336330862=Reducing the database page size from {0} bytes to {1} bytes\r
+336330863=table\r
+336330864=     {0}R(EPLACE_DATABASE)   replace database from backup file\r
+336330865=     {0}V(ERIFY)             report each action taken\r
+336330866=restore failed for record in table {0}\r
+336330867=    restoring column {0}\r
+336330868=    restoring file {0}\r
+336330869=    restoring filter {0}\r
+336330870=restoring function {0}\r
+336330871=    restoring argument for function {0}\r
+336330872=     restoring gen id value of: {0}\r
+336330873=restoring domain {0}\r
+336330874=    restoring index {0}\r
+336330875=    restoring privilege for user {0}\r
+336330876=restoring data for table {0}\r
+336330877=restoring security class {0}\r
+336330878=    restoring trigger {0}\r
+336330879=    restoring trigger message for {0}\r
+336330880=    restoring type {0} for column {1}\r
+336330881=started transaction\r
+336330882=starting transaction\r
+336330883=security class\r
+336330884=switches can be abbreviated to the unparenthesized characters\r
+336330885=transportable backup -- data in XDR format\r
+336330886=trigger\r
+336330887=trigger message\r
+336330888=trigger type\r
+336330889=unknown switch "{0}"\r
+336330890=validation error on column in table {0}\r
+336330891=    Version(s) for database "{0}"\r
+336330892=view\r
+336330893=    writing argument for function {0}\r
+336330894=    writing data for table {0}\r
+336330895=     writing gen id of: {0}\r
+336330896=         writing column {0}\r
+336330897=    writing filter {0}\r
+336330898=writing filters\r
+336330899=    writing function {0}\r
+336330900=writing functions\r
+336330901=    writing domain {0}\r
+336330902=writing domains\r
+336330903=    writing index {0}\r
+336330904=    writing privilege for user {0}\r
+336330905=    writing table {0}\r
+336330906=writing tables\r
+336330907=    writing security class {0}\r
+336330908=    writing trigger {0}\r
+336330909=    writing trigger message for {0}\r
+336330910=writing trigger messages\r
+336330911=writing triggers\r
+336330912=    writing type {0} for column {1}\r
+336330913=writing types\r
+336330914=writing shadow files\r
+336330915=    writing shadow file {0}\r
+336330916=writing id generators\r
+336330917=    writing generator {0} value {1}\r
+336330918=readied database {0} for backup\r
+336330919=restoring table {0}\r
+336330920=type\r
+336330921=gbak:\r
+336330922=committing metadata for table {0}\r
+336330923= error committing metadata for table {0}\r
+336330924=     {0}K(ILL)               restore without creating shadows\r
+336330925=cannot commit index {0}\r
+336330926=cannot commit files\r
+336330927=     {0}T(RANSPORTABLE)      transportable backup -- data in XDR format\r
+336330928=closing file, committing, and finishing. {0} bytes written\r
+336330929=     {0}G(ARBAGE_COLLECT)    inhibit garbage collection\r
+336330930=     {0}IG(NORE)             ignore bad checksums\r
+336330931=     column {0} used in index {1} seems to have vanished\r
+336330932=index {0} omitted because {1} of the expected {2} keys were found\r
+336330933=     {0}FA(CTOR)             blocking factor\r
+336330934=blocking factor parameter missing\r
+336330935=expected blocking factor, encountered "{0}"\r
+336330936=a blocking factor may not be used in conjunction with device CT\r
+336330937=restoring generator {0} value: {1}\r
+336330938=     {0}OL(D_DESCRIPTIONS)   save old style metadata descriptions\r
+336330939=     {0}N(O_VALIDITY)        do not restore database validity conditions\r
+336330940=user name parameter missing\r
+336330941=password parameter missing\r
+336330942=     {0}PAS(SWORD)           Firebird password\r
+336330943=     {0}USER                 Firebird user name\r
+336330944=writing stored procedures\r
+336330945=writing stored procedure {0}\r
+336330946=writing parameter {0} for stored procedure\r
+336330947=restoring stored procedure {0}\r
+336330948=restoring parameter {0} for stored procedure\r
+336330949=writing exceptions\r
+336330950=writing exception {0}\r
+336330951=restoring exception {0}\r
+336330952= missing parameter for the number of bytes to be skipped\r
+336330953=expected number of bytes to be skipped, encountered "{0}"\r
+336330954=adjusting an invalid decompression length from {0} to {1}\r
+336330955=skipped {0} bytes after reading a bad attribute {1}\r
+336330956=     {0}S(KIP_BAD_DATA)      skip number of bytes after reading bad data\r
+336330957=skipped {0} bytes looking for next valid attribute, encountered attribute {1}\r
+336330958=writing table constraints\r
+336330959=writing constraint {0}\r
+336330960=Bad attribute for table constraint\r
+336330961=writing referential constraints\r
+336330962=writing check constraints\r
+336330963=writing Character Sets\r
+336330964=writing Collations\r
+336330965=Bad attribute for RDB$CHARACTER_SETS\r
+336330966=Writing character set {0}\r
+336330967=Bad attribute for RDB$COLLATIONS\r
+336330968=Writing collation {0}\r
+336330972=Unexpected I/O error while reading from backup file\r
+336330973=Unexpected I/O error while writing to backup file\r
+336330974=  Could not open file name "{0}"\r
+336330975=  Could not write to file "{0}"\r
+336330976=  Could not read from file "{0}"\r
+336330977=Done with volume #{0}, "{1}"\r
+336330978=     Press return to reopen that file, or type a new name followed by return to open a different file.\r
+336330979=Type a file name to open and hit return\r
+336330980=  Name:\r
+336330981=  ERROR: Backup incomplete\r
+336330982=Expected backup start time {0}, found {1}\r
+336330983=Expected backup database {0}, found {1}\r
+336330984=Expected volume number {0}, found volume {1}\r
+336330985=could not drop database {0} (database might be in use)\r
+336330986=Skipped bad security class entry: {0}\r
+336330987=Unknown V3 SUB_TYPE: {0} in FIELD: {1}.\r
+336330988=Converted V3 sub_type: {0} to character_set_id: {1} and collate_id: {2}.\r
+336330989=Converted V3 scale: {0} to character_set_id: {1} and callate_id: {2}.\r
+336330990=System memory exhausted\r
+336330991=     {0}NT                   Non-Transportable backup file format\r
+336330992=Index "{0}" failed to activate because:\r
+336330993=  The unique index has duplicate values or NULLs.\r
+336330994=  Delete or Update duplicate values or NULLs, and activate index with\r
+336330995=  ALTER INDEX "{0}" ACTIVE;\r
+336330996=  Not enough disk space to create the sort file for an index.\r
+336330997=  Set the TMP environment variable to a directory on a filesystem that does have enough space, and activate index with\r
+336330998=Database is not online due to failure to activate one or more indices.\r
+336330999=Run gfix -online to bring database online without active indices.\r
+336331000=writing SQL roles\r
+336331001=writing sql role: {0}\r
+336331002=Bad attributes for restoring SQL role\r
+336331003=restoring SQL role: {0}\r
+336331004=        {0}RO(LE)               Firebird SQL role\r
+336331005=SQL role parameter missing\r
+336331006=        {0}CO(NVERT)            backup external files as tables\r
+336331007=gbak: WARNING:\r
+336331008=gbak: ERROR:\r
+336331009=     {0}BU(FFERS)            override page buffers default\r
+336331010=page buffers parameter missing\r
+336331011=expected page buffers, encountered "{0}"\r
+336331012=page buffers is allowed only on restore or create\r
+336331013=Starting with volume #{0}, "{1}"\r
+336331014=size specification either missing or incorrect for file {0}\r
+336331015=file {0} out of sequence\r
+336331016=can't join -- one of the files missing\r
+336331017= standard input is not supported when using join operation\r
+336331018=standard output is not supported when using split operation\r
+336331019=backup file {0} might be corrupt\r
+336331020=database file specification missing\r
+336331021=can't write a header record to file {0}\r
+336331022=free disk space exhausted\r
+336331023=file size given ({0}) is less than minimum allowed ({1})\r
+336331024=Warning -- free disk space exhausted for file {0}, the rest of the bytes ({1}) will be written to file {2}\r
+336331025=service name parameter missing\r
+336331026=Cannot restore over current database, must be SYSDBA or owner of the existing database.\r
+336331027=\r
+336331028=     {0}USE_(ALL_SPACE)      do not reserve space for record versions\r
+336331029=        {0}SE(RVICE)            use services manager\r
+336331030=     {0}MO(DE) <access>      "read_only" or "read_write" access\r
+336331031="read_only" or "read_write" required\r
+336331032=setting database to read-only access\r
+336331033=just data ignore all constraints etc.\r
+336331034=restoring data only ignoring foreign key, unique, not null & other constraints\r
+336331035=closing file, committing, and finishing. {0} bytes written\r
+336396289=Firebird error\r
+336396362=Rollback not performed\r
+336396364=Connection error\r
+336396365=Connection not established\r
+336396366=Connection authorization failure.\r
+336396375=deadlock\r
+336396376=Unsuccessful execution caused by deadlock.\r
+336396377=record from transaction {0} is stuck in limbo\r
+336396379=operation completed with errors\r
+336396382=the SQL statement cannot be executed\r
+336396384=Unsuccessful execution caused by an unavailable resource.\r
+336396386=Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements\r
+336396387=Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements\r
+336396446=Wrong numeric type\r
+336396447=too many versions\r
+336396448=intermediate journal file full\r
+336396449=journal file wrong format\r
+336396450=database {0} shutdown in {1} seconds\r
+336396451=restart shared cache manager\r
+336396452=exception {0}\r
+336396453=bad checksum\r
+336396454=refresh range number {0} not found\r
+336396455=expression evaluation not supported\r
+336396456=FOREIGN KEY column count does not match PRIMARY KEY\r
+336396457=Attempt to define a second PRIMARY KEY for the same table\r
+336396458=column used with aggregate\r
+336396459=invalid column reference\r
+336396460=invalid key position\r
+336396461=invalid direction for find operation\r
+336396462=Invalid statement handle\r
+336396463=invalid lock handle\r
+336396464=invalid lock level {0}\r
+336396465=invalid bookmark handle\r
+336396468=wrong or obsolete version\r
+336396471=The insert, update, delete, ddl or authorization statement cannot\r
+ be executed because the transaction is inquiry only\r
+336396472=external file could not be opened for output\r
+336396477=multiple rows in singleton select\r
+336396478=No subqueries permitted for VIEW WITH CHECK OPTION\r
+336396479=DISTINCT, GROUP or HAVING not permitted for VIEW WITH CHECK OPTION\r
+336396480=Only one table allowed for VIEW WITH CHECK OPTION\r
+336396481=No WHERE clause for VIEW WITH CHECK OPTION\r
+336396482=Only simple column names permitted for VIEW WITH CHECK OPTION\r
+336396484=An error was found in the application program input parameters for the SQL statement.\r
+336396485=Invalid insert or update value(s): object columns are constrained - no 2 table rows can have duplicate column values\r
+336396486=Arithmetic overflow or division by zero has occurred.\r
+336396594=cannot access column {0} in view {1}\r
+336396595=Too many concurrent executions of the same request\r
+336396596=maximum indexes per table ({0}) exceeded\r
+336396597=new record size of {0} bytes is too big\r
+336396598=segments not allowed in expression index {0}\r
+336396599=wrong page type\r
+336396603=invalid ARRAY or BLOB operation\r
+336396611={0} extension error\r
+336396624=key size exceeds implementation restriction for index "{0}"\r
+336396625=definition error for index {0}\r
+336396628=cannot create index\r
+336396651=duplicate specification of {0} - not supported\r
+336396663=The insert failed because a column definition includes validation constraints.\r
+336396670=Cannot delete object referenced by another object\r
+336396671=Cannot modify object referenced by another object\r
+336396672=Object is referenced by another object\r
+336396673=lock on conflicts with existing lock\r
+336396681=This operation is not defined for system tables.\r
+336396683=Inappropriate self-reference of column\r
+336396684=Illegal array dimension range\r
+336396687=database or file exists\r
+336396688=sort error: corruption in data structure\r
+336396689=node not supported\r
+336396690=Shadow number must be a positive integer\r
+336396691=Preceding file did not specify length, so {0} must include starting page number\r
+336396692=illegal operation when at beginning of stream\r
+336396693=the current position is on a crack\r
 336396735=cannot modify an existing user privilege\r
-336003088=Datatypes {0}are not comparable in expression {1}\r
-336003087=Label {0} {1} in the current scope\r
-336003086=External function should have return position between 1 and {0}\r
-336003085=Ambiguous field name between {0} and {1}\r
-336003084=integers in SQL dialect 3.\r
-336003083=as approximate floating-point values in SQL dialect 1, but as 64-bit\r
-336003082=WARNING: NUMERIC and DECIMAL fields with precision 10 or greater are stored\r
-336003081=value in SQL dialect 1, but as an exact numeric value in SQL dialect 3.\r
-336003080=WARNING: Numeric literal {0} is interpreted as a floating-point\r
-336855099=The specified server cannot perform the requested operation.\r
-336855098=A network adapter hardware error occurred.\r
-336855097=The network BIOS command limit has been reached.\r
-336855096=The network path was not found.\r
-336855095=A duplicate name exists on the network.\r
-336855094=The remote computer not available.\r
-336855093=The IPX/SPX software is already initialized.\r
-336855092=The request exceeds the maximum IPX/SPX resource limits.\r
-336855091=Lock on network resources failed.\r
-336855090=Not enough event control blocks free.\r
-336003079=DB dialect {0} and client dialect {1} conflict with respect to numeric precision {2}.\r
-336003078=\r
-336003077=Database SQL dialect {0} does not support reference to {1} datatype\r
-336003076=Use of {0} expression that returns different results in dialect 1 and dialect 3\r
-336003075=Precision 10 to 18 changed from DOUBLE PRECISION in SQL dialect 1 to 64-bit scaled integer in SQL dialect 3\r
-336003074=Cannot SELECT RDB$DB_KEY from a stored procedure.\r
-336855089=Not enough DOS memory available.\r
-336855088=The specified network resource or device is no longer available.\r
-336855087=The named pipe is busy.\r
-336855086=The specified path was not found.\r
-336855085=The remote host is not responding or you may lack proper security to access network resources.\r
-336855084=No process slots are available.\r
-336855083=The Network is busy.\r
-336855082=The input buffer is too small.\r
-336855081=Pipe has been closed or is not being read.\r
-336855080=Bad length in command.\r
-336855079=There is not enough available memory.\r
-336855078=Pipe does not exist or is no longer valid.\r
-336855077=SPX is not installed or the specified socket is not open.\r
-336855076=Malformed or overflow packet.\r
-336855075=The socket has already been closed.\r
-336855074=The SPX connection table is full.\r
-336855073=Specified connection is not valid.\r
-336855072=The Firebird server is not responding or has closed the connection.\r
-336855071=The Firebird server is not responding or has closed the connection.\r
-336855070=The IPX/SPX software is not initialized.\r
-336855069=The host was not found or is unreachable over the specified network protocol.\r
-336855068=Windows sockets have not been initialized properly.\r
-336855067=The version of winsock.dll is not usable by this application.\r
-336855066=The network subsystem is unusable.\r
-336855065=The request would cause the non-blocking socket to block.\r
-336855064=A blocking winsock request is already in progress.\r
-336855063=Operation already in progress.\r
-336855062=No route to the requested host.\r
-336855061=The requested host is down.\r
-336855060=Request timed out without establishing a connection.\r
-336855059=Cannot send or receive data on a socket which has been shutdown.\r
-336855058=The socket is not connected.\r
-336855057=The socket is already connected.\r
-336855056=Insufficient buffer space or sockets are available.\r
-336855055=The connection was reset by the remote host.\r
-336855054=The connection was aborted due to a timeout or other failure.\r
-336855053=The network dropped the connection on reset.\r
-336855052=The network cannot be reached from this host at this time.\r
-336855051=The winsock implemenation has detected that the network subsystem has failed.\r
-336855050=The specified address is not available from the local machine.\r
-336855049=The specified address is already in use.\r
-336855048=The requested address family is not supported by this protocol family.\r
-336855047=The requested protocol family is not supported.\r
-336855046=The TCP operation is not supported.\r
-336855045=The TCP socket type is not supported in the requested address family.\r
-336920599=    -d      analyze data pages\r
-336855044=The requested winsock protocol is not supported by the TCP implemenation.\r
-336920598=    -a      analyze data and index pages\r
-336855043=The packet was too large for the buffer and was truncated.\r
-336920597=Available switches:\r
-336855042=There are too many open files.  No more file descriptors are available.\r
-336920596=unknown switch "{0}"\r
-336855041=The request was canceled before completing.\r
-336920595=    Expected b-tree bucket on page {0} from {1}\r
+336396736=user does not have the privilege to perform operation\r
+336396737=This user does not have privilege to perform this operation on this object.\r
+336396756=transaction marked invalid by I/O error\r
+336396757=Cannot prepare a CREATE DATABASE/SCHEMA statement\r
+336396758=violation of FOREIGN KEY constraint "{0}"\r
+336396769=The prepare statement identifies a prepare statement with an open cursor\r
+336396770=Unknown statement or request\r
+336396778=Attempt to update non-updatable cursor\r
+336396780= The cursor identified in the update or delete statement is not positioned on a row.\r
+336396784=Unknown cursor\r
+336396786=The cursor identified in an OPEN statement is already open.\r
+336396787=The cursor identified in a FETCH or CLOSE statement is not open.\r
+336396875=Overflow occurred during data type conversion.\r
+336396881=null segment of UNIQUE KEY\r
+336396882=subscript out of bounds\r
+336396886=data operation not supported\r
+336396887=invalid comparison operator for find operation\r
+336396974=Cannot transliterate character between character sets\r
+336396975=count of column list and variable list do not match\r
+336396985=Incompatible column/host variable data type\r
+336396991=Operation violates CHECK constraint {0} on view or table\r
+336396992=internal gds software consistency check (invalid RDB$CONSTRAINT_TYPE)\r
+336396993=Cannot update constraints (RDB$RELATION_CONSTRAINTS).\r
+336396994=Cannot delete CHECK constraint entry (RDB$CHECK_CONSTRAINTS)\r
+336396995=Cannot update constraints (RDB$CHECK_CONSTRAINTS).\r
+336396996=Cannot update constraints (RDB$REF_CONSTRAINTS).\r
+336396997=Column used in a PRIMARY/UNIQUE constraint must be NOT NULL.\r
+336397004=index {0} cannot be used in the specified plan\r
+336397005=table {0} is referenced in the plan but not the from list\r
+336397006=the table {0} is referenced twice; use aliases to differentiate\r
+336397007=table {0} is not referenced in plan\r
+336397027=Log file specification partition error\r
+336397028=Cache or Log redefined\r
+336397029=Write-ahead Log with shadowing configuration not allowed\r
+336397030=Overflow log specification required for round-robin log\r
+336397031=WAL defined; Cache Manager must be started first\r
+336397033=Write-ahead Log without shared cache configuration not allowed\r
+336397034=Cannot start WAL writer for the database {0}\r
+336397035=WAL writer synchronization error for the database {0}\r
+336397036=WAL setup error.  Please see Firebird log.\r
+336397037=WAL buffers cannot be increased.  Please see Firebird log.\r
+336397038=WAL writer - Journal server communication error.  Please see Firebird log.\r
+336397039=WAL I/O error.  Please see Firebird log.\r
+336397040=Unable to roll over; please see Firebird log.\r
+336397041=Could not expand the WAL segment for database {0}\r
+336397042=Database {0}: WAL subsystem bug for pid {1}\\n{2}\r
+336397043=WAL subsystem corrupted\r
+336397044=WAL subsystem encountered error\r
+336397045=database does not use Write-ahead Log\r
+336397046=Cannot roll over to the next log file {0}\r
+336397047=Invalid WAL parameter block option {0}\r
+336397048=Illegal attempt to attach to an uninitialized WAL segment for {0}\r
+336397049=Cache or Log size too small\r
+336397050=Log record header too small at offset {0} in log file {1}\r
+336397051=Incomplete log record at offset {0} in log file {1}\r
+336397052=Unexpected end of log file {0} at offset {1}\r
+336397053=Database name in the log file {0} is different\r
+336397054=Log file {0} not closed properly; database recovery may be required\r
+336397055=Log file {0} not latest in the chain but open flag still set\r
+336397056=Invalid version of log file {0}\r
+336397057=Log file header of {0} too small\r
+336397058=WAL Writer error\r
+336397069=table {0} is not defined\r
+336397080=invalid ORDER BY clause\r
+336397082=Column does not belong to referenced table\r
+336397083=column {0} is not defined in table {1}\r
+336397084=Undefined name\r
+336397085=Ambiguous column reference.\r
+336397116=function {0} is not defined\r
+336397117=Invalid data type, length, or value\r
+336397118=Invalid number of arguments\r
+336397126=dbkey not available for multi-table views\r
+336397130=number of columns does not match select list\r
+336397131=must specify column name for view select expression\r
+336397133={0} is not a valid base table of the specified view\r
+336397137=This column cannot be updated because it is derived from an SQL function or expression.\r
+336397138=The object of the insert, delete or update statement is a view for which the requested operation is not permitted.\r
+336397183=Invalid String\r
+336397184=Invalid token\r
+336397185=Invalid numeric literal\r
+336397203=An error occurred while trying to update the security database\r
+336397204=non-SQL security class defined\r
+336461924=Row not found for fetch, update or delete, or the result of a query is an empty table.\r
+336461925=segment buffer length shorter than expected\r
+336462125=Datatype needs modification\r
+336462436=Duplicate column or domain name found.\r
+336527507=invalid block type encountered\r
+336527508=wrong packet type\r
+336527509=cannot map page\r
+336527510=request to allocate invalid block type\r
+336527511=request to allocate block type larger than maximum size\r
+336527512=memory pool free list is invalid\r
+336527513=invalid pool id encountered\r
+336527514=attempt to release free block\r
+336527515=attempt to release block overlapping following free block\r
+336527516=attempt to release block overlapping prior free block\r
+336527517=cannot sort on a field that does not exist\r
+336527518=database file not available\r
+336527519=cannot assert logical lock\r
+336527520=wrong ACL version\r
+336527521=shadow block not found\r
+336527522=shadow lock not synchronized properly\r
+336527523=root file name not listed for shadow\r
+336527524=failed to remove symbol from hash table\r
+336527525=cannot find tip page\r
+336527526=invalid rsb type\r
+336527527=invalid SEND request\r
+336527528=looper: action not yet implemented\r
+336527529=return data type not supported\r
+336527530=unexpected reply from journal server\r
+336527531=journal server is incompatible version\r
+336527532=journal server refused connection\r
+336527533=referenced index description not found\r
+336527534=index key too big\r
+336527535=partner index description not found\r
+336527536=bad difference record\r
+336527537=applied differences will not fit in record\r
+336527538=record length inconsistent\r
+336527539=decompression overran buffer\r
+336527540=cannot reposition for update after sort for RMS\r
+336527541=external access type not implemented\r
+336527542=differences record too long\r
+336527543=wrong record length\r
+336527544=limbo impossible\r
+336527545=wrong record version\r
+336527546=record disappeared\r
+336527547=cannot delete system tables\r
+336527548=cannot update erased record\r
+336527549=comparison not supported for specified data types\r
+336527550=conversion not supported for specified data types\r
+336527551=conversion error\r
+336527552=overflow during conversion\r
+336527553=null or invalid array\r
+336527554=BLOB not found\r
+336527555=cannot update old BLOB\r
+336527556=relation for array not known\r
+336527557=field for array not known\r
+336527558=array subscript computation error\r
+336527559=expected field node\r
+336527560=invalid BLOB ID\r
+336527561=cannot find BLOB page\r
+336527562=unknown data type\r
+336527563=shadow block not found for extend file\r
+336527564=index inconsistent\r
+336527565=index bucket overfilled\r
+336527566=exceeded index level\r
+336527567=page already in use\r
+336527568=page not accessed for write\r
+336527569=attempt to release page not acquired\r
+336527570=page in use during flush\r
+336527571=attempt to remove page from dirty page list when not there\r
+336527572=CCH_precedence: block marked\r
+336527573=insufficient cache size\r
+336527574=no cache buffers available for reuse\r
+336527575=page {0}, page type {1} lock conversion denied\r
+336527576=page {0}, page type {1} lock denied\r
+336527577=buffer marked for update\r
+336527578=CCH: {0}, status = {1} (218)\r
+336527579=request of unknown resource\r
+336527580=release of unknown resource\r
+336527581=(CMP) copy: cannot remap\r
+336527582=bad BLR -- invalid stream\r
+336527583=argument of scalar operation must be an array\r
+336527584=quad word arithmetic not supported\r
+336527585=data type not supported for arithmetic\r
+336527586=request size limit exceeded\r
+336527587=cannot access field {0} in view {1}\r
+336527588=cannot access field in view {0}\r
+336527589=EVL_assign_to: invalid operation\r
+336527590=EVL_bitmap: invalid operation\r
+336527591=EVL_boolean: invalid operation\r
+336527592=EVL_expt: invalid operation\r
+336527593=eval_statistical: invalid operation\r
+336527594=Unimplemented conversion, FAO directive O,Z,S\r
+336527595=Unimplemented conversion, FAO directive X,U\r
+336527596=Error parsing RDB FAO msg string\r
+336527597=Error parsing RDB FAO msg str\r
+336527598=unknown parameter in RdB status vector\r
+336527599=Firebird status vector inconsistent\r
+336527600=Firebird/RdB message parameter inconsistency\r
+336527601=error parsing RDB FAO message string\r
+336527602=unimplemented FAO directive\r
+336527603=missing pointer page in DPM_data_pages\r
+336527604=Fragment does not exist\r
+336527605=pointer page disappeared in DPM_delete\r
+336527606=pointer page lost from DPM_delete_relation\r
+336527607=missing pointer page in DPM_dump\r
+336527608=cannot find record fragment\r
+336527609=pointer page vanished from DPM_next\r
+336527610=temporary page buffer too small\r
+336527611=damaged data page\r
+336527612=header fragment length changed\r
+336527613=pointer page vanished from extend_relation\r
+336527614=pointer page vanished from relation list in locate_space\r
+336527615=cannot find free space\r
+336527616=pointer page vanished from mark_full\r
+336527617=bad record in RDB$PAGES\r
+336527618=page slot not empty\r
+336527619=bad pointer page\r
+336527620=index unexpectedly deleted\r
+336527621=scalar operator used on field which is not an array\r
+336527622=active\r
+336527623=committed\r
+336527624=rolled back\r
+336527625=in an ill-defined state\r
+336527626=next transaction older than oldest active transaction\r
+336527627=next transaction older than oldest transaction\r
+336527628=buffer marked during cache unwind\r
+336527629=error in recovery! database corrupted\r
+336527630=error in recovery! wrong data page record\r
+336527631=error in recovery! no space on data page\r
+336527632=error in recovery! wrong header page record\r
+336527633=error in recovery! wrong generator page record\r
+336527634=error in recovery! wrong b-tree page record\r
+336527635=error in recovery! wrong page inventory page record\r
+336527636=error in recovery! wrong pointer page record\r
+336527637=error in recovery! wrong index root page record\r
+336527638=error in recovery! wrong transaction page record\r
+336527639=error in recovery! out of sequence log record encountered\r
+336527640=error in recovery! unknown page type\r
+336527641=error in recovery! unknown record type\r
+336527642=journal server cannot archive to specified archive directory\r
+336527643=checksum error in log record when reading from log file\r
+336527644=cannot restore singleton select data\r
+336527645=lock not found in internal lock manager\r
+336527646=size of opt block exceeded\r
+336527647=Too many savepoints\r
+336527648=garbage collect record disappeared\r
+336527649=Unknown BLOB FILTER ACTION_\r
+336527650=error during savepoint backout\r
+336527651=cannot find record back version\r
+336527652=Illegal user_type.\r
+336527653=bad ACL\r
+336527654=inconsistent LATCH_mark release\r
+336527655=inconsistent LATCH_mark call\r
+336527656=inconsistent latch downgrade call\r
+336527657=bdb is unexpectedly marked\r
+336527658=missing exclusive latch\r
+336527659=exceeded maximum number of shared latches on a bdb\r
+336527660=can't find shared latch\r
+336527661=Non-zero use_count of a buffer in the empty que\r
+336527662=Unexpected page change from latching\r
+336527663=Invalid expression for evaluation\r
+336527664=RDB$FLAGS for trigger {0} in RDB$TRIGGERS is corrupted\r
+336592896=gjrn::\r
+336592897=exiting journal utility due to errors\r
+336592898=Journal utility version: {0}\r
+336592899=gjrn [-z] <utility> [-debug] [-verbose] [<options>] [<database name>]\r
+336592900=reading online dump parameters\r
+336592901=enter file size or <Ctrl-D> to end input:\r
+336592902=enter file name or <Ctrl-D> to end input:\r
+336592903=     <utility> : -enable | -disable | -online_dump | -server | -console | -restore\r
+336592904=             -j <journal directory>\r
+336592905=             -a <archive base name>\r
+336592906=             -i              -run utility in interactive mode\r
+336592907=             -u <until options>\r
+336592908=database file name ({0}) already specified\r
+336592909=please retry, giving a database name\r
+336592910=please retry, specifying correct journal utility\r
+336592911=please retry, specifying journal database directory\r
+336592912=online dump file size must be greater than zero\r
+336592913=no log files for recovery\r
+336592914=time stamp required with -u (e.g., "dd-mmm-yy hh:mm:ss")\r
+336592915=invalid time stamp on -u (use "dd-mmm-yy hh:mm:ss")\r
+336592916=log file for recovery: {0}\r
+336592917=applying clumps to data page {0}\r
+336592918=applying clumps to header page {0}\r
+336592919=applying clumps to gen-id page {0}\r
+336592920=applying clumps to b-tree page {0}\r
+336592921=b-tree add node. before offset {0}\r
+336592922=b-tree add node. offset: {0}  length: {1}\r
+336592923=valid b-tree btr_length: {0}\r
+336592924=b-tree add segment before length: {0}\r
+336592925=b-tree add segment. expected after length {0}\r
+336592926=b-tree drop node. offset {0}\r
+336592927=applying clumps to page inventory page {0}\r
+336592928=applying clumps to pointer page {0}\r
+336592929=applying clumps to index root page {0}\r
+336592930=applying clumps to tip page {0}\r
+336592931=database "%.*s" ({0}) disabled at {1}\r
+336592932=log file for recovery: {0}\r
+336592933=start processing online dump files\r
+336592934=end processing online dump files\r
+336592935=start processing log files\r
+336592936=end processing log files\r
+336592937=full page record (page = {0})        - not applied\r
+336592938=full page record (page = {0})        - applied\r
+336592939=clumplet records for page ({0})      - not applied\r
+336592940=clumplet records for page ({0})      - applied\r
+336592941=start online dump record.    file seqno ({0})        offset ({1})\r
+336592942=end online dump record.      file seqno ({0})        offset ({1})\r
+336592943=unknown log record type: {0}\r
+336592944=lseek failed in write page\r
+336592945=write() failed in writing page\r
+336592946=no space on header page\r
+336592947=invalid online dump record in journal database\r
+336592948=failure in online dump processing\r
+336592949=no online dump file specified\r
+336592950=error in processing log files\r
+336592951=wrong clump type for data page ({0})\r
+336592952=no space for segment in data page\r
+336592953=invalid line offset\r
+336592954=wrong clump type for header page\r
+336592955=wrong clump type generator page\r
+336592956=b-tree node delete. wrong delta\r
+336592957=b-tree node delete. wrong length\r
+336592958=wrong clump type for b-tree page\r
+336592959=wrong clump type for page inventory page\r
+336592960=wrong clump type for pointer page\r
+336592961=wrong clump type index root page\r
+336592962=wrong clump type for transaction inventory page\r
+336592963=compress: temporary buffer is too small for page\r
+336592964=wrong use count for buffer\r
+336592965=invalid clump type\r
+336592966=ms_$mapl -- wrong length map\r
+336592967=invalid secondary database file sequence number\r
+336592968=invalid clumplet record\r
+336592969=no buffers available\r
+336592970=error in file seek\r
+336592971=     <server options>\r
+336592972=     <console options>\r
+336592973=             -s <command>\r
+336592974=     <enable options>\r
+336592975=     <disable options>\r
+336592976=     <restore options>\r
+336592977=     <online dump options>\r
+336592978=             -f <file name>\r
+336592979=             -s <file size>\r
+336592980=do you want to change this? (y/n):\r
+336592981=enter new value:\r
+336592982=applying clumps to log page {0}\r
+336592983=     transaction commit at: {0}\r
+336592984=continue? (y/n)?:\r
+336592985=Online dump file name\r
+336592986=Secondary file name\r
+336592987=enter journal directory name:\r
+336592988=recover database ({0})? (y/n)\r
+336592989=Name of recovered database\r
+336592990=Dump id for recovery\r
+336592991=Console disconnected\r
+336592992=Process disconnect\r
+336592993=Journaling disabled\r
+336592994=Shutdown requested\r
+336592995=Process sign_off\r
+336592996=Process sign_on\r
+336592997=Journaling enabled\r
+336592998=Journal server started\r
+336592999=Journal server shutdown\r
+336593000= Number of archives running concurrently exceeds limit.\r
+336593001=Failure before forking back up process\r
+336593002=Forking backup process failed\r
+336593003=Archiving log file. id: {0}  name: {1}\r
+336593004=Release connection failed.\r
+336593005=Error on writing disable record\r
+336593006=Child process completed\r
+336593007=Error occurred during "{0}"\r
+336593008=Commands are:\r
+336593009=Journal utility version {0}\r
+336593010=Drop records for database "{0}"\r
+336593011=Set delete flag for database "{0}".\r
+336593012=Do not understand command "{0}"\r
+336593013=Control Point. Seqno: {0}     Offset: {1}\r
+336593014=Error is updating delete flag.\r
+336593015=Error in writing record to online_dump_files table\r
+336593016=Online Dump file. dump id: {0}.      name: ({1})\r
+336593017=Error in modifying online_dump table\r
+336593018=End Online Dump. dump id: {0}\r
+336593019=Do not recognize journal message {0}\r
+336593020=Error in storing online dump record\r
+336593021=Start Online Dump. dump_id: {0}\r
+336593022=Error in storing journal files record\r
+336593023=Open log file: ({0})\r
+336593024=Close log file: ({0})\r
+336593025=Error in modify journal files table\r
+336593026=Journal Server Status.\r
+336593027=Journaling Enabled for:\r
+336593028=     {0} (db id = {1}), connections: {2}\r
+336593029=     No Databases with journaling enabled.\r
+336593030=Error in modify for databases table\r
+336593031=Error in store for databases table\r
+336593032=Journal not properly closed\r
+336593033=     Resetting database "{0}" ({1})\r
+336593034=Failure in modifying journal files record\r
+336593035=DOS error code {0}\r
+336593036=out of sequence log record encountered.\r
+336593037=Error in opening output message file.\r
+336593038=             -m <output message file>\r
+336593039=Database "{0}" not enabled with this journal server.\r
+336593040=:Error while erasing records for database "{0}".\r
+336593041=Removing file "{0}".\r
+336593042=Console connected.\r
+336593043=Error in unlink() for file "{0}".\r
+336593044=Must recover to a point in time after the end of online dump.\r
+336593045=Encountered records for files not yet archived.\r
+336593046=Ensure files are archived for full recovery.\r
+336593047=Reset delete flag for database "{0}".\r
+336593048=Error in attaching to journal database.\r
+336593049=Error in attaching to recovered database.  Retry recovery.\r
+336593050=Log file name\r
+336593051=Rebuild Statistics.\r
+336593052=     Bytes processed = {0}\r
+336593053=     Bytes applied   = {0}\r
+336593054=     Elapsed time    = {0} seconds.\r
+336593055=Mark database "{0}" as disabled for long-term journaling.\r
+336593056=Database "{0}" not enabled with this journal server.\r
+336593057=Database (id = {0}) is currently in use.\r
+336593058=Drop records for database (id = {0}).\r
+336593059=     {0}:    disable database\r
+336593060=     {0}:    drop all files for an active database\r
+336593061=     {0}:    drop all files for non active database\r
+336593062=     {0}:    exit journal console program\r
+336593063=     {0}:    display help menu\r
+336593064=     {0}:    reset delete flag for database\r
+336593065=     {0}:    set delete flag for database\r
+336593066=     {0}:    shut down journal server\r
+336593067=     {0}:    display status of journal server\r
+336593068=     {0}:    display software version number\r
+336593069=Dos error {0}\r
+336593070=Dos error {0}\r
+336593071=Do not understand mailbox message type {0}\r
+336593072={0} ({1}/{2})\r
+336593073=Database (id = {0}) not enabled with this journal server.\r
+336593074= Log archive complete.  File "{0}" (id = {1}).\r
+336593075=Error in archiving file. (id = {0}).\r
+336593076=Secondary File: {0}.  Sequence: {1}.\r
+336593077=Commit transaction {0}.\r
+336593078=Processing records for page {0}.  seqno {1}.  offset {2}.\r
+336593079=Allocate slot {0} of pip page {1}\r
+336593080=Free slot {0} of pip page {1}\r
+336593081=Database not found in journal database\r
+336593082=Only one journal server can be active per journal database.\r
+336593083=Online dump specified does not belong to database being recovered.\r
+336593084=reading log file names\r
+336593085=Enter full name of original database:\r
+336593086=Recovering database "{0}" page size {1}.\r
+336593087=Processing online dump file {0}.\r
+336593088=Overwrite database ({0}) last log seqno ({1})? (y/n):\r
+336593089=Database exists or in use.\r
+336593090=Error in modifying relation partial_rebuilds.\r
+336593091=Target database name not specified.\r
+336593092=             -a              -activate partially recovered database\r
+336593093=             -p <database name for partial recovery>\r
+336593094=Invalid database for partial recovery.\r
+336593095=Error in creating or opening database file.\r
+336593096=Starting partial rebuild for database {0}.\r
+336593097=Continuing partial rebuild for database {0}.\r
+336593098=Next tip page {0} allocated.\r
+336593099=Next transaction {0}. Oldest active {1}. Oldest Interesting {2}.\r
+336593100=Generator offset {0}.  New value {1}.\r
+336593101=Index root split.  For index ({0}) new root page {1}.\r
+336593102=Analysis of log records.\r
+336593103=     Record Type             Number of records       Total bytes\r
+336593104=     {0}     {1}             {2}\r
+336593105=Skipping online dumps files during a trace.\r
+336593106=Error in updating log_transfer_status relation.\r
+336593107=Windows NT error {0}\r
+336593108=Windows NT error {0}\r
+336593109=Journal server required for recovery to complete.\r
+336593110=Checksum error in log record when reading from log file.\r
+336593111=Journal server console program\r
+336593112=unexpected end of file from server\r
+336593113=Cannot open mailbox {0}\r
+336593114=enter journal option:\r
+336593115=enter database name:\r
+336593116=enter backup directory name:\r
+336593117=Journal server version {0}\r
+336593118=could not open journal file "{0}"-\r
+336593119=Journal file "{0}" opened\r
+336593120=Optional close argument is a journal file sequence number\r
+336593121=Journal file sequence number {0} does not exist\r
+336593122=unsupported journal sub-system version (expected {0}, encountered {1}) -- connection rejected\r
+336593123=no output file\r
+336593124=Journaling suspended\r
+336593125=current output file: {0}\r
+336593126=Output files queued:\r
+336593127=Known databases and connections:\r
+336593128=Error in creating or opening secondary database file.\r
+336593129=Error in closing database files. Retry recover.\r
+336593130=Error in reading page from disk.\r
+336593131=Archive process unable to attach to journal server.\r
+336593132=Archive process unable to open log file.\r
+336593133=Archive process unable to create archive file.\r
+336593134=Archive process unable to close log and/or archive files.\r
+336593135=     {0}:    restart archive for database\r
+336593136=Restart archiving for database {0}.\r
+336658432=Statement failed, SQLCODE = {0}\r
+336658433=isql [<database>] [-e] [-t <terminator>] [-i <inputfile>] [-o <outputfile>]\r
+336658434=Unknown switch: {0}\r
+336658435=Use CONNECT or CREATE DATABASE to specify a database\r
+336658436=Unable to open {0}\r
+336658437=Commit current transaction (y/n)?\r
+336658438=Committing.\r
+336658439=Rolling back work.\r
+336658440=Command error: {0}\r
+336658441=Enter data or NULL for each column.  RETURN to end.\r
+336658442=ISQL Version: {0}\r
+336658443=     [-x|-a] [-d <target db>] [-u <user>] [-p <password>] [-page <pagelength>] [-n] [-m] [-q] [-s <sql_dialect>]\r
+336658444=Number of DB pages allocated = {0}\r
+336658445=Sweep interval = {0}\r
+336658446=Number of wal buffers = {0}\r
+336658447=Wal buffer size = {0}\r
+336658448=Check point length = {0}\r
+336658449=Check point interval = {0}\r
+336658450=Wal group commit wait = {0}\r
+336658451=Base level = {0}\r
+336658452=Transaction in limbo = {0}\r
+336658453=Frontend commands:\r
+336658454=BLOBVIEW <blobid>          -- view BLOB in text editor\r
+336658455=BLOBDUMP <blobid> <file>   -- dump BLOB to a file\r
+336658456=EDIT     [<filename>]      -- edit SQL script file and execute\r
+336658457=INput    <filename>        -- take input from the named SQL file\r
+336658458=OUTput   [<filename>]      -- write output to named file\r
+336658459=SHELL    <command>         -- execute Operating System command in sub-shell\r
+336658460=HELP                       -- display this menu\r
+336658461=Set commands:\r
+336658462=    SET                    -- display current SET options\r
+336658463=    SET AUTOddl            -- toggle autocommit of DDL statements\r
+336658464=    SET BLOB [ALL|<n>]     -- display BLOBS of subtype <n> or ALL\r
+336658465=    SET COUNT              -- toggle count of selected rows on/off\r
+336658466=    SET ECHO               -- toggle command echo on/off\r
+336658467=    SET STATs              -- toggle display of performance statistics\r
+336658468=    SET TERM <string>      -- change statement terminator string\r
+336658469=SHOW     <object> [<name>] -- display system information\r
+336658470=    <object> = CHECK, DATABASE, DOMAIN, EXCEPTION, FILTER, FUNCTION, GENERATOR,\r
+336658471=EXIT                       -- exit and commit changes\r
+336658472=QUIT                       -- exit and roll back changes\r
+336658473=All commands may be abbreviated to letters in CAPitals\r
+336658474=     SET SCHema/DB <db name> -- changes current database\r
+336658475=Yes\r
+336658476=Current memory = !c Delta memory = !d Max memory = !x Elapsed time= !e sec\r
+336658477=Cpu = !u sec Buffers = !b Reads = !r Writes = !w Fetches = !f\r
+336658478=BLOB display set to subtype {0}. This BLOB: subtype = {1}\r
+336658479=BLOB: {0}, type 'edit' or filename to load>\r
+336658480=Enter {0} as M/D/Y>\r
+336658481=Enter {0}>\r
+336658482=Bad date {0}\r
+336658483=CON>\r
+336658484=    SET LIST               -- toggle column or table display format\r
+336658485={0} not found\r
+336658486=Errors occurred (possibly duplicate domains) in creating {0} in {1}\r
+336658487=Server version too old to support the isql command\r
+336658488=Records affected: {0}\r
+336658489=Unlicensed for database "{0}"\r
+336658490=    SET WIDTH <col> [<n>]  -- set/unset print width to <n> for column <col>\r
+336658491=    SET PLAN               -- toggle display of query access plan\r
+336658492=    SET TIME               -- toggle display of timestamp with DATE values\r
+336658493=EDIT                       -- edit current command buffer and execute\r
+336658494=OUTput                     -- return output to stdout\r
+336658495=    SET NAMES <csname>     -- set name of runtime character set\r
+336658496=               GRANT, INDEX, PROCEDURE, ROLE, SQL DIALECT, SYSTEM, TABLE,\r
+336658497=    SET BLOB               -- turn off BLOB display\r
+336658498=SET      <option>          -- (Use HELP SET for complete list)\r
+336658499=There are no tables in this database\r
+336658500=There is no table {0} in this database\r
+336658501=There are no views in this database\r
+336658502=There is no view {0} in this database\r
+336658503=There are no indices on table {0} in this database\r
+336658504=There is no table or index {0} in this database\r
+336658505=There are no indices in this database\r
+336658506=There is no domain {0} in this database\r
+336658507=There are no domains in this database\r
+336658508=There is no exception {0} in this database\r
+336658509=There are no exceptions in this database\r
+336658510=There is no filter {0} in this database\r
+336658511=There are no filters in this database\r
+336658512=There is no user-defined function {0} in this database\r
+336658513=There are no user-defined functions in this database\r
+336658514=There is no generator {0} in this database\r
+336658515=There are no generators in this database\r
+336658516=There is no privilege granted on table {0} in this database\r
+336658517=There is no privilege granted on stored procedure {0} in this database\r
+336658518=There is no table or stored procedure {0} in this database\r
+336658519=There is no stored procedure {0} in this database\r
+336658520=There are no stored procedures in this database\r
+336658521=There are no triggers on table {0} in this database\r
+336658522=There is no table or trigger {0} in this database\r
+336658523=There are no triggers in this database\r
+336658524=There are no check constraints on table {0} in this database\r
+336658525=Buffers = !b Reads = !r Writes !w Fetches = !f\r
+336658526=Single isql command exceeded maximum buffer size\r
+336658527=There are no roles in this database\r
+336658528=There is no table, stored procedure, or role {0} in this database\r
+336658529=There is no membership privilege granted on {0} in this database\r
+336658530=Expected end of statement, encountered EOF\r
+336658533=Bad TIME: {0}\r
+336658534=               TRIGGER, VERSION, VIEW\r
+336658535=There is no role {0} in this database\r
+336658536=     [-r <rolename>] [-c <num cache buffers>] [-z] -nowarnings -noautocommit\r
+336658537=Incomplete string in {0}\r
+336658538=    SET SQL DIALECT <n>    -- set sql dialect to <n>\r
+336658539=There is no privilege granted in this database\r
+336658540=    SET PLANONLY           -- toggle display of query plan without executing\r
+336723969=GSEC>\r
+336723970=gsec\r
+336723971=ADD            add user\r
+336723972=DELETE         delete user\r
+336723973=DISPLAY        display user(s)\r
+336723974=MODIFY         modify user\r
+336723975=PW             user's password\r
+336723976=UID            user's ID\r
+336723977=GID            user's group ID\r
+336723978=PROJ           user's project name\r
+336723979=ORG            user's organization name\r
+336723980=FNAME          user's first name\r
+336723981=MNAME          user's middle name/initial\r
+336723982=LNAME          user's last name\r
+336723983=unable to open database\r
+336723984=error in switch specifications\r
+336723985=no operation specified\r
+336723986=no user name specified\r
+336723987=add record error\r
+336723988=modify record error\r
+336723989=find/modify record error\r
+336723990=record not found for user: {0}\r
+336723991=delete record error\r
+336723992=find/delete record error\r
+336723993=users defined for node\r
+336723994=     user name                      uid   gid     full name\r
+336723995=------------------------------------------------------------------------------------------\r
+336723996=find/display record error\r
+336723997=invalid parameter, no switch defined\r
+336723998=operation already specified\r
+336723999=password already specified\r
+336724000=uid already specified\r
+336724001=gid already specified\r
+336724002=project already specified\r
+336724003=organization already specified\r
+336724004=first name already specified\r
+336724005=middle name already specified\r
+336724006=last name already specified\r
+336724007=gsec version\r
+336724008=invalid switch specified\r
+336724009=ambiguous switch specified\r
+336724010=no operation specified for parameters\r
+336724011=no parameters allowed for this operation\r
+336724012=incompatible switches specified\r
+336724013=gsec utility - maintains user password database\r
+336724014=command line usage:\r
+336724015=<command> [ <parameter> ... ]\r
+336724016=interactive usage:\r
+336724017=available commands:\r
+336724018=adding a new user:\r
+336724019=add <name> [ <parameter> ... ]\r
+336724020=deleting a current user:\r
+336724021=delete <name>\r
+336724022=displaying all users:\r
+336724023=display\r
+336724024=displaying one user:\r
+336724025=display <name>\r
+336724026=modifying a user's parameters:\r
+336724027=modify <name> <parameter> [ <parameter> ... ]\r
+336724028=help:\r
+336724029=? (interactive only)\r
+336724030=help\r
+336724031=quit interactive session:\r
+336724032=quit (interactive only)\r
+336724033=available parameters:\r
+336724034=-pw <password>\r
+336724035=-uid <uid>\r
+336724036=-gid <uid>\r
+336724037=-proj <projectname>\r
+336724038=-org <organizationname>\r
+336724039=-fname <firstname>\r
+336724040=-mname <middlename>\r
+336724041=-lname <lastname>\r
+336724042=gsec - memory allocation error\r
+336724043=gsec error\r
+336724044=Invalid user name (maximum 31 bytes allowed)\r
+336724045=Warning - maximum 8 significant bytes of password used\r
+336724046=database already specified\r
+336724047=database administrator name already specified\r
+336724048=database administrator password already specified\r
+336724049=SQL role name already specified\r
+336724050=[ <options> ... ]\r
+336724051=available options:\r
+336724052=-user <database administrator name>\r
+336724053=-password <database administrator password>\r
+336724054=-role <database administrator SQL role name>\r
+336724055=-database <security database>\r
+336724056=-z\r
+336724057=displaying version number:\r
+336724058=z (interactive only)\r
+336789504=The license file does not exist or could not be opened for read\r
+336789505=                 S T O P -- S T O P -- S T O P\r
+336789506=    Your node is not registered to run InterBase.  {0}\r
+336789507=    If you are using this node to demonstrate software, or because\r
+336789508=    the registered node is temporarily unavailable, you may continue\r
+336789509=    by closing this window.\r
+336789510=\r
+336789511=    To register this node for InterBase, call (800) 437-7367,\r
+336789512=    from outside the United States and Canada call (408) 431-5400,\r
+336789513=    between 9 am and 8 pm, Monday through Friday,\r
+336789514=    Pacific time (GMT + 8 hours).\r
+336789515=    Be prepared to provide the following information.\r
+336789516=        Your version is "{0}"\r
+336789517=        Your {0}         {1}\r
+336789518=    Processing will continue in {0} seconds.\r
+336789519=        Software theft is a civil and criminal offense.\r
+336789520=Copyright (c) 1985, 1994 by Borland International, Inc.\r
+336789521=\r
+336789522=InterBase License Utility Version:\r
+336789523=operation already specified\r
+336789524=no operation specified\r
+336789525=invalid switch\r
+336789526=invalid switch combination\r
+336789527=illegal operation/switch combination\r
+336789528=ambiguous switch\r
+336789529=invalid parameter, no switch specified\r
+336789530=switch does not take any parameter\r
+336789531=switch requires a parameter\r
+336789532=syntax error in command line\r
+336789533=The operation was completed successfully.  Please restart the server for the changes to take effect.\r
+336789534=The certificate was not added.  A duplicate ID exists in the license file.\r
+336789535=The certificate was not added.  Invalid certificate ID / Key combination.\r
+336789536=The certificate was not removed.  The key does not exist or corresponds to a temporary evaluation license.\r
+336789537=An error occurred updating the license file.  Operation cancelled.\r
+336789538=The certificate could not be validated based on the information given.  Please recheck the ID and key information.\r
+336789539=Operation failed.  An unknown error occurred.\r
+336789540=Add license operation failed, KEY: {0} ID: {1}\r
+336789541=Remove license operation failed, KEY: {0}\r
+336789542=Simultaneous user license for one (1) user.\r
+336789543=Simultaneous user license for four (4) users.\r
+336789544=Simultaneous user license for five (5) users.\r
+336789545=Simultaneous user license for ten (10) users.\r
+336789546=Simultaneous user license for twenty (20) users.\r
+336789547=Local InterBase activation license.\r
+336789548=InterBase Server activation license and simultaneous user licnese for one (1) user.\r
+336789549=Firebird Server: Client capability\r
+336789550=Firebird Server: Remote access capability.\r
+336789551=Firebird Server: Metadata capability.\r
+336789552=InterBase server activation license and simultaneous user license for five (5) users.\r
+336789553=InterBase server activation license and simultaneous user license for unlimited users.\r
+336789554=Internet access license with unlimited users.\r
+336789555=Simultaneous user license for unlimited users.\r
+336789556=Precompiler license for C and C++.\r
+336789557=Precompiler license for Ada.\r
+336789558=Precompiler license for Fortran.\r
+336789559=Precompiler license for Cobol.\r
+336789560=Precompiler license for Pascal.\r
+336789561=Evaluation InterBase Server license and simultaneous user license for five (5) users.\r
+336789562=Customized license entry created by means other than entering a certificate ID/key.\r
+336789563=The evaluation license has already been used on this server.  You need to purchase a non-evaluation license.\r
 336855040=The connection request was refused.  This can occur if the Firebird server is not started on the host machine.\r
-336920594=    Expected data on page {0}\r
-336920593= Fill distribution:\r
-336920592= Average data length: {0}, total dup: {1}, max dup: {2}\r
-336920591= Depth: {0}, leaf buckets: {1}, nodes: {2}\r
-336920590=    Index {0} ({1})\r
-335610364={0} Based on field {1} of view {2}\r
-335610363={0} Based on field {1} of relation {2}\r
-335610362=    elapsed = !e cpu = !u system = !s mem = !x buffers = !b\r
-335610361=    reads = !r writes = !w fetches = !f marks = !m\r
-335610360=unknown data type {0}\r
-336920589=    Fill distribution:\r
-336920588=    Data pages: {0}, data page slots: {1}, average fill: {2}\r
-336920587=    Primary pointer page: {0}, Index root page: {1}\r
-336920586=nAnalyzing database pages ...\r
-336920585=File {0} is the {1} file\r
-336920584=File {0} continues as file {1}\r
-336920583=nnDatabase file sequence:\r
-336920582=nDatabase "{0}"\r
-336920581=gstat version {0}\r
-336920580=Unexpected end of database file.\r
-335610359=ntype <cr> for next topic or <EOF> to stop: \r
-335610358=Subtopic? \r
-335610357=bad kanji found while formatting output\r
-335610356=Enter\r
-335610355=Re-enter\r
-335610354=NO\r
-335610353=YES\r
-335610352=Field {0} in relation {1} of database {2}\r
-335610351=Field {0} in view {1} of database {2}\r
-336920579=Wrong ODS version, expected {0}, encountered {1}\r
-336920578=please retry, giving a database name\r
+336855041=The request was canceled before completing.\r
+336855042=There are too many open files.  No more file descriptors are available.\r
+336855043=The packet was too large for the buffer and was truncated.\r
+336855044=The requested winsock protocol is not supported by the TCP implemenation.\r
+336855045=The TCP socket type is not supported in the requested address family.\r
+336855046=The TCP operation is not supported.\r
+336855047=The requested protocol family is not supported.\r
+336855048=The requested address family is not supported by this protocol family.\r
+336855049=The specified address is already in use.\r
+336855050=The specified address is not available from the local machine.\r
+336855051=The winsock implemenation has detected that the network subsystem has failed.\r
+336855052=The network cannot be reached from this host at this time.\r
+336855053=The network dropped the connection on reset.\r
+336855054=The connection was aborted due to a timeout or other failure.\r
+336855055=The connection was reset by the remote host.\r
+336855056=Insufficient buffer space or sockets are available.\r
+336855057=The socket is already connected.\r
+336855058=The socket is not connected.\r
+336855059=Cannot send or receive data on a socket which has been shutdown.\r
+336855060=Request timed out without establishing a connection.\r
+336855061=The requested host is down.\r
+336855062=No route to the requested host.\r
+336855063=Operation already in progress.\r
+336855064=A blocking winsock request is already in progress.\r
+336855065=The request would cause the non-blocking socket to block.\r
+336855066=The network subsystem is unusable.\r
+336855067=The version of winsock.dll is not usable by this application.\r
+336855068=Windows sockets have not been initialized properly.\r
+336855069=The host was not found or is unreachable over the specified network protocol.\r
+336855070=The IPX/SPX software is not initialized.\r
+336855071=The Firebird server is not responding or has closed the connection.\r
+336855072=The Firebird server is not responding or has closed the connection.\r
+336855073=Specified connection is not valid.\r
+336855074=The SPX connection table is full.\r
+336855075=The socket has already been closed.\r
+336855076=Malformed or overflow packet.\r
+336855077=SPX is not installed or the specified socket is not open.\r
+336855078=Pipe does not exist or is no longer valid.\r
+336855079=There is not enough available memory.\r
+336855080=Bad length in command.\r
+336855081=Pipe has been closed or is not being read.\r
+336855082=The input buffer is too small.\r
+336855083=The Network is busy.\r
+336855084=No process slots are available.\r
+336855085=The remote host is not responding or you may lack proper security to access network resources.\r
+336855086=The specified path was not found.\r
+336855087=The named pipe is busy.\r
+336855088=The specified network resource or device is no longer available.\r
+336855089=Not enough DOS memory available.\r
+336855090=Not enough event control blocks free.\r
+336855091=Lock on network resources failed.\r
+336855092=The request exceeds the maximum IPX/SPX resource limits.\r
+336855093=The IPX/SPX software is already initialized.\r
+336855094=The remote computer not available.\r
+336855095=A duplicate name exists on the network.\r
+336855096=The network path was not found.\r
+336855097=The network BIOS command limit has been reached.\r
+336855098=A network adapter hardware error occurred.\r
+336855099=The specified server cannot perform the requested operation.\r
+336855100=An unexpected network error occurred.\r
+336855101=The remote adapter is not compatible.\r
+336855102=The specified network name is no longer available.\r
+336855103=Network access is denied.\r
+336855104=The network resource type is not correct.\r
+336855105=The network name cannot be found.\r
+336855106=The name limit for the local computer network adapter card was exceeded.\r
+336855107=The network BIOS session limit was exceeded.\r
+336855108=The network request was not accepted.\r
+336855109=A write fault occurred on the network.\r
+336855110=The server disconnected from the other end of the pipe.\r
+336855111=Beginning database sweep, which can take a long time.  This can be controlled by varying the sweep interval.  Sweep?\r
+336855112=A sweep must be performed on this database before it can be started.  Sweep?\r
+336855113=Not enough disk space remaining\r
 336920577=found unknown switch\r
-335610345=JOIN\r
-335610344=SINGULAR (SELECT * <sql rse>)\r
-335610343=Invalid argument for UDF\r
-335610341= Expression index BLR:\r
-335610340=FORMs not supported\r
-335610339=Relation {0} does not exist\r
-335610338=field width ({0}) * header segments ({1}) greater than 60,000 characters\r
-335610337=unsuccessful attempt to extend pool beyond 64KB\r
-335610336=cannot format unsubscripted array {0}\r
-335610335= ({0})\r
-335610334=number > 0\r
-335610333=input line too long\r
-335610332=input line too long\r
-335610331=    Datatype information:\r
-335610330=Variable {0} has not been declared\r
-335610329=    Edit string:  {0}\r
-335610328=    Query name:  {0}\r
-335610327=Variable {0}\r
-335610326=literal string  <MAXSYMLEN> characters or longer\r
-335610325=qli: ignoring unknown switch -{0}\r
-335610324=Data type of field {0} may not be changed to or from BLOB\r
-335610323="{0}" is not a field and so may not be subscripted\r
-335610322=Only fields may be subscripted\r
-335610321=Error during two phase commit on database {0}nroll back all databases or commit databases individually\r
-335610320=no filters are defined for database {0}\r
-335610319=filters are not supported in database {0}\r
-335610318=no functions are defined in database {0}\r
-335610317=functions are not supported in database {0}\r
-335610316=Do you want to rollback updates for {0}?\r
-335610315=Unable to create form window\r
-335610314=Connection to database {0} lostn Please FINISH the database!\r
-335544399=internal error\r
-335610313=    message {0}:  {1}\r
-335544398=internal error\r
-335610312=Messages associated with {0}:\r
-335544397=internal error\r
-335610311=source relation {0} does not exist\r
-335544396=column {0} is not defined in table {1}\r
-335610310=could not resolve context for aggregate expression\r
-335544395=table {0} is not defined\r
-335544394=incompatible version of on-disk structure\r
-335544393=request in use\r
-335544392=internal error\r
-335544391=buffer in use\r
-335544390=BLR syntax error: expected {0} at offset {1}, encountered {2}\r
-336397185=Invalid numeric literal\r
-336397184=Invalid token\r
-336397183=Invalid String\r
-335610309=output pipe is not supported on MPE/XL\r
-335610308=prompting not allowed in select field list\r
-335610307=simple field reference not allowed in global aggregates\r
-335610306= Index {0}{1}{2}{3}\r
-335610305=Filters in database {0} ({1}):\r
-335610304=    Filter description:\r
-335544389=buffer exhausted\r
-335610303=    Output sub-type is {0}\r
-335544388=block size exceeds implementation restriction\r
-335610302=    Input sub-type is {0}\r
-335544387=internal error\r
-335610301=    Filter library is {0}\r
-335544386=too many requests\r
-335610300=Filter {0} in database "{1}" ({2}):\r
-335544385=internal error\r
-335544384=internal error\r
-335544383=unrecoverable conflict with limbo transaction {0}\r
-335544382={0}\r
-335544381=Implementation limit exceeded\r
-335544380=wrong number of arguments on call\r
-335544379=unsupported on-disk structure for file {0}; found {1} type {2}, support {3} type {4}\r
-335544378=feature is not supported\r
-335544377=request includes a DSRI extension not supported in this implementation\r
-335544376=table {0} was omitted from the transaction reserving list\r
-335544375=unavailable database\r
-335544374=attempt to fetch past the last record in a record stream\r
-335544373=operating system directive {0} failed\r
-335544372=attempted reference to BLOB in unavailable database\r
-335544371=attempted write to read-only BLOB\r
-335544370=attempted action on blob outside transaction\r
-335544369=attempted read of a new, open BLOB\r
-335544368=attempted invalid operation on a BLOB\r
-335544367=attempted retrieval of more segments than exist\r
-335544366=segment buffer length shorter than expected\r
-335544365=request referenced an unavailable database\r
-335544364=request synchronization error\r
-335544363=no transaction for request\r
-335544362=cannot update read-only view {0}\r
-335544361=attempted update during read-only transaction\r
-335544360=attempted update of read-only table\r
-335544359=attempted update of read-only column\r
-335544358=message length error (encountered {0}, expected {1})\r
-335544357=cannot disconnect database with open transactions ({0} active)\r
-335544356=metadata is obsolete\r
-335544355=BLOB was not closed\r
-335544354=invalid database key\r
-335544353=transaction is not in limbo\r
-335544352=no permission for {0} access to {1} {2}\r
-335544351=unsuccessful metadata update\r
-335544350=program attempted to exit without finishing database\r
-335544349=attempt to store duplicate value (visible to active transactions) in unique index "{0}"\r
-335544348=no current record for fetch operation\r
-335544347=validation error for column {0}, value "{1}"\r
-335544346=corrupt system table\r
-335544345=lock conflict on no wait transaction\r
-335544344=I/O error for file {0} "{1}"\r
-335544343=invalid request BLR at offset {0}\r
-335544342=action cancelled by trigger ({0}) to preserve data integrity\r
-335544341=unknown information item\r
-335544340=no information of this type available for object specified\r
-336397138=The object of the insert, delete or update statement is a view for which the requested operation is not permitted.\r
-336397137=This column cannot be updated because it is derived from an SQL function or expression.\r
-336330799= warning -- record could not be restored\r
-336397133={0} is not a valid base table of the specified view\r
-336330798=string truncated\r
-336330797=expected backup description record\r
-336397131=must specify column name for view select expression\r
-336330796=Expected backup version 1, 2, or 3.  Found {0}\r
-336397130=number of columns does not match select list\r
-336330795=do not recognize record type {0}\r
-336330794=Failed in store_blr_gen_id\r
-336330793=expected data attribute\r
-336330792=wrong length record, expected {0} encountered {1}\r
-336330791=expected record length\r
-336330790=gds_$put_segment failed\r
-335544339=information type inappropriate for object specified\r
-335544338=no match for first value expression\r
-335544337=attempt to start more than {0} transactions\r
-335544336=deadlock\r
-335544335=database file appears corrupt ({0})\r
-335544334=conversion error from string "{0}"\r
-335544333=internal gds software consistency check ({0})\r
-335544332=invalid transaction handle (expecting explicit transaction start)\r
-335544331=invalid format for transaction parameter block\r
-335544330=invalid parameter in transaction parameter block\r
-336397126=dbkey not available for multi-table views\r
-336330789=gds_$create_blob failed\r
-336330788=Cannot find column for BLOB\r
-336330787=cannot find table {0}\r
-336330786=RESTORE: decompression length error\r
-336330785=failed to create database {0}\r
-336330784=Expected database description record\r
-336330783= gds_$database_info failed\r
-336330782=gds_$release_request failed\r
-336330781= gds_$receive failed\r
-336330780=gds_$start_request failed\r
-335544329=invalid BLOB ID\r
-335544328=invalid BLOB handle\r
-335544327=invalid request handle\r
-335544326=unrecognized database parameter block\r
-335544325=bad parameters on attach or create database\r
-335544324=invalid database handle (no active connection)\r
-335544323=file {0} is not a valid database\r
-335544322=invalid database key\r
-335544321=arithmetic exception, numeric overflow, or string truncation\r
-335544320=\r
-336397118=Invalid number of arguments\r
-336397117=Invalid data type, length, or value\r
-336397116=function {0} is not defined\r
-336330779=gds_$compile_request failed\r
-336330778=data type {0} not understood\r
-336330777=Failed in put_blr_gen_id\r
-336330776=gds_$open_blob failed\r
-336330775=gds_$close_blob failed\r
-336330774=gds_$get_segment failed\r
-336330773=do not understand BLOB INFO item {0}\r
-336330772=gds_$blob_info failed\r
-336330771=cannot close APOLLO tape descriptor file {0}\r
-336330770=cannot create APOLLO cartridge descriptor file {0}\r
-336265219=This is a test message\r
+336920578=please retry, giving a database name\r
+336920579=Wrong ODS version, expected {0}, encountered {1}\r
+336920580=Unexpected end of database file.\r
+336920581=gstat version {0}\r
+336920582=  Database "{0}"\r
+336920583=  Database file sequence:\r
+336920584=File {0} continues as file {1}\r
+336920585=File {0} is the {1} file\r
+336920586= Analyzing database pages ...\r
+336920587=    Primary pointer page: {0}, Index root page: {1}\r
+336920588=    Data pages: {0}, data page slots: {1}, average fill: {2}\r
+336920589=    Fill distribution:\r
+336920590=    Index {0} ({1})\r
+336920591=     Depth: {0}, leaf buckets: {1}, nodes: {2}\r
+336920592=     Average data length: {0}, total dup: {1}, max dup: {2}\r
+336920593=     Fill distribution:\r
+336920594=    Expected data on page {0}\r
+336920595=    Expected b-tree bucket on page {0} from {1}\r
+336920596=unknown switch "{0}"\r
+336920597=Available switches:\r
+336920598=    -a      analyze data and index pages\r
+336920599=    -d      analyze data pages\r
+336920600=    -h      analyze header page\r
+336920601=    -i      analyze index leaf pages\r
+336920602=    -l      analyze log page\r
+336920603=    -s      analyze system relations\r
+336920604=    -z      display version number\r
+336920605=Can't open database file {0}\r
+336920606=Can't read a database page\r
+336920607=System memory exhausted\r
+336920608=    -u      username\r
+336920609=    -p      password\r
+336920610=    -r      analyze average record and version length\r
+336920611=    -t      tablename\r
 1=arithmetic exception, numeric overflow, or string truncation\r
 2=invalid database key\r
 3=file {0} is not a valid database\r
index adcded9dd2ae79bb871b613ab566d7af5dbf9541..ce77f13bee4b92277813143699b6b72559d59d41 100644 (file)
@@ -1,75 +1,75 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class ServiceParameterBuffer : ParameterBuffer\r
-       {\r
-               #region Constructors\r
-\r
-               public ServiceParameterBuffer() : base(true)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void Append(int type, byte value)\r
-               {\r
-                       this.WriteByte(type);\r
-                       this.WriteByte(value);\r
-               }\r
-\r
-               public void Append(int type, int value)\r
-               {\r
-                       this.WriteByte(type);\r
-                       this.Write(value);\r
-               }\r
-\r
-               public void Append(int type, string value)\r
-               {\r
-                       this.Append(type, Encoding.Default.GetBytes(value));\r
-               }\r
-\r
-               public void Append(byte type, string value)\r
-               {\r
-                       this.Append(type, Encoding.Default.GetBytes(value));\r
-               }\r
-\r
-               public void Append(int type, byte[] value)\r
-               {\r
-                       this.WriteByte((byte)type);\r
-                       this.Write((short)value.Length);\r
-                       this.Write(value);\r
-               }\r
-\r
-               public void Append(byte type, byte[] value)\r
-               {\r
-                       this.WriteByte(type);\r
-                       this.WriteByte((byte)value.Length);\r
-                       this.Write(value);\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class ServiceParameterBuffer : ParameterBuffer
+       {
+               #region Constructors
+
+               public ServiceParameterBuffer() : base(true)
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void Append(int type, byte value)
+               {
+                       this.WriteByte(type);
+                       this.WriteByte(value);
+               }
+
+               public void Append(int type, int value)
+               {
+                       this.WriteByte(type);
+                       this.Write(value);
+               }
+
+               public void Append(int type, string value)
+               {
+                       this.Append(type, Encoding.Default.GetBytes(value));
+               }
+
+               public void Append(byte type, string value)
+               {
+                       this.Append(type, Encoding.Default.GetBytes(value));
+               }
+
+               public void Append(int type, byte[] value)
+               {
+                       this.WriteByte((byte)type);
+                       this.Write((short)value.Length);
+                       this.Write(value);
+               }
+
+               public void Append(byte type, byte[] value)
+               {
+                       this.WriteByte(type);
+                       this.WriteByte((byte)value.Length);
+                       this.Write(value);
+               }
+
+               #endregion
+       }
+}
index 8a0722e446adce1b35eb29a11a05c5130230e0d2..e6dd7f3063437946cf14bb75925ff6df2f11e41f 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Text;\r
-using System.Data;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       #region Enumerations\r
-\r
-       internal enum StatementState\r
-       {\r
-               Deallocated,\r
-               Allocated,\r
-               Prepared,\r
-               Executed,\r
-               Closed,\r
-               Error\r
-       }\r
-\r
-       #endregion\r
-\r
-       internal abstract class StatementBase : IDisposable\r
-       {\r
-               #region Protected Static Fields\r
-\r
-               // Plan information     items\r
-               protected static byte[] DescribePlanInfoItems = new byte[] \r
-               { \r
-                       IscCodes.isc_info_sql_get_plan\r
-               };\r
-\r
-               // Records affected     items\r
-               protected static byte[] RecordsAffectedInfoItems = new byte[]\r
-               {\r
-                       IscCodes.isc_info_sql_records\r
-               };\r
-\r
-               // Describe     information     items\r
-               protected static byte[] DescribeInfoItems = new byte[] \r
-               { \r
-                       IscCodes.isc_info_sql_select,\r
-                       IscCodes.isc_info_sql_describe_vars,\r
-                       IscCodes.isc_info_sql_sqlda_seq,\r
-                       IscCodes.isc_info_sql_type,\r
-                       IscCodes.isc_info_sql_sub_type,\r
-                       IscCodes.isc_info_sql_length,\r
-                       IscCodes.isc_info_sql_scale,\r
-                       IscCodes.isc_info_sql_field,\r
-                       IscCodes.isc_info_sql_relation,\r
-                       // IscCodes.isc_info_sql_owner,\r
-                       IscCodes.isc_info_sql_alias,\r
-                       IscCodes.isc_info_sql_describe_end\r
-               };\r
-\r
-               protected static byte[] DescribeBindInfoItems = new byte[] \r
-               { \r
-                       IscCodes.isc_info_sql_bind,\r
-                       IscCodes.isc_info_sql_describe_vars,\r
-                       IscCodes.isc_info_sql_sqlda_seq,\r
-                       IscCodes.isc_info_sql_type,\r
-                       IscCodes.isc_info_sql_sub_type,\r
-                       IscCodes.isc_info_sql_length,\r
-                       IscCodes.isc_info_sql_scale,\r
-                       IscCodes.isc_info_sql_field,\r
-                       IscCodes.isc_info_sql_relation,\r
-                       // IscCodes.isc_info_sql_owner,\r
-                       IscCodes.isc_info_sql_alias,\r
-                       IscCodes.isc_info_sql_describe_end \r
-               };\r
-\r
-               protected static byte[] StatementTypeInfoItems = new byte[]\r
-               {\r
-                       IscCodes.isc_info_sql_stmt_type\r
-               };\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private bool disposed;\r
-\r
-               #endregion\r
-\r
-               #region Abstract Properties\r
-\r
-               public abstract IDatabase DB\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               public abstract ITransaction Transaction\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               public abstract Descriptor Parameters\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               public abstract Descriptor Fields\r
-               {\r
-                       get;\r
-               }\r
-\r
-               public abstract int RecordsAffected\r
-               {\r
-                       get;\r
-               }\r
-\r
-               public abstract bool IsPrepared\r
-               {\r
-                       get;\r
-               }\r
-\r
-               public abstract DbStatementType StatementType\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               public abstract StatementState State\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               public abstract int FetchSize\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Properties\r
-\r
-               protected bool IsDisposed\r
-               {\r
-                       get { return this.disposed; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Fields\r
-\r
-               protected TransactionUpdateEventHandler TransactionUpdate;\r
-\r
-               #endregion\r
-\r
-               #region Abstract Methods\r
-\r
-               public abstract void Describe();\r
-               public abstract void DescribeParameters();\r
-               public abstract void Prepare(string commandText);\r
-               public abstract void Execute();\r
-               public abstract DbValue[] Fetch();\r
-               public abstract DbValue[] GetOuputParameters();\r
-               public abstract byte[] GetSqlInfo(byte[] items, int bufferLength);\r
-\r
-               public abstract BlobBase CreateBlob();\r
-               public abstract BlobBase CreateBlob(long handle);\r
-\r
-               public abstract ArrayBase CreateArray(ArrayDesc descriptor);\r
-               public abstract ArrayBase CreateArray(string tableName, string fieldName);\r
-               public abstract ArrayBase CreateArray(long handle, string tableName, string fieldName);\r
-\r
-               #endregion\r
-\r
-               #region Finalizer\r
-\r
-               ~StatementBase()\r
-               {\r
-                       this.Dispose(false);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     methods\r
-\r
-               public void Dispose()\r
-               {\r
-                       this.Dispose(true);\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               protected virtual void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.disposed)\r
-                               {\r
-                                       this.disposed = true;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Abstract Methods\r
-\r
-               protected abstract void TransactionUpdated(object sender, EventArgs e);\r
-               protected abstract void Free(int option);\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public string GetExecutionPlan()\r
-               {\r
-                       string  plan            = String.Empty;\r
-                       int             count           = 0;\r
-                       int             bufferSize      = IscCodes.MAX_BUFFER_SIZE;\r
-                       byte[]  buffer          = this.GetSqlInfo(DescribePlanInfoItems, bufferSize);\r
-\r
-                       while (buffer[0] == IscCodes.isc_info_truncated && count < 4)\r
-                       {\r
-                               bufferSize *= 2;\r
-                               buffer = this.GetSqlInfo(DescribePlanInfoItems, bufferSize);\r
-                               count++;\r
-                       }\r
-\r
-                       if (count > 3)\r
-                       {\r
-                               return null;\r
-                       }\r
-\r
-                       int len = buffer[1];\r
-                       len += buffer[2] << 8;\r
-\r
-                       if (len > 0)\r
-                       {\r
-                               plan = this.DB.Charset.GetString(buffer, 4, --len);\r
-                       }\r
-\r
-                       return plan;\r
-               }\r
-\r
-               public virtual void Close()\r
-               {\r
-                       if (this.State == StatementState.Executed ||\r
-                               this.State == StatementState.Error)\r
-                       {\r
-                               if (this.StatementType == DbStatementType.Select ||\r
-                                       this.StatementType == DbStatementType.SelectForUpdate ||\r
-                                       this.StatementType == DbStatementType.StoredProcedure)\r
-                               {\r
-                                       this.Free(IscCodes.DSQL_close);\r
-                                       this.ClearArrayHandles();\r
-                                       this.State = StatementState.Closed;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public virtual void Release()\r
-               {\r
-                       if (this.Transaction != null &&\r
-                               this.TransactionUpdate != null)\r
-                       {\r
-                               this.Transaction.Update -= this.TransactionUpdate;\r
-                               this.TransactionUpdate = null;\r
-                       }\r
-\r
-                       this.Free(IscCodes.DSQL_drop);\r
-\r
-                       this.State = StatementState.Deallocated;\r
-                       this.StatementType = DbStatementType.None;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected byte[] GetSqlInfo(byte[] items)\r
-               {\r
-                       return this.GetSqlInfo(items, IscCodes.MAX_BUFFER_SIZE);\r
-               }\r
-\r
-               protected int GetRecordsAffected()\r
-               {\r
-                       byte[] buffer = this.GetSqlInfo(RecordsAffectedInfoItems, IscCodes.ROWS_AFFECTED_BUFFER_SIZE);\r
-\r
-                       return this.ProcessRecordsAffectedBuffer(buffer);\r
-               }\r
-\r
-               protected int ProcessRecordsAffectedBuffer(byte[] buffer)\r
-               {\r
-                       int insertCount = 0;\r
-                       int updateCount = 0;\r
-                       int deleteCount = 0;\r
-                       int selectCount = 0;\r
-                       int pos                 = 0;\r
-                       int length              = 0;\r
-                       int type                = 0;\r
-\r
-                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)\r
-                       {\r
-                               length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                               pos += 2;\r
-                               switch (type)\r
-                               {\r
-                                       case IscCodes.isc_info_sql_records:\r
-                                               int l;\r
-                                               int t;\r
-                                               while ((t = buffer[pos++]) != IscCodes.isc_info_end)\r
-                                               {\r
-                                                       l = IscHelper.VaxInteger(buffer, pos, 2);\r
-                                                       pos += 2;\r
-                                                       switch (t)\r
-                                                       {\r
-                                                               case IscCodes.isc_info_req_insert_count:\r
-                                                                       insertCount = IscHelper.VaxInteger(\r
-                                                                               buffer, pos, l);\r
-                                                                       break;\r
-\r
-                                                               case IscCodes.isc_info_req_update_count:\r
-                                                                       updateCount = IscHelper.VaxInteger(\r
-                                                                               buffer, pos, l);\r
-                                                                       break;\r
-\r
-                                                               case IscCodes.isc_info_req_delete_count:\r
-                                                                       deleteCount = IscHelper.VaxInteger(\r
-                                                                               buffer, pos, l);\r
-                                                                       break;\r
-\r
-                                                               case IscCodes.isc_info_req_select_count:\r
-                                                                       selectCount = IscHelper.VaxInteger(\r
-                                                                               buffer, pos, l);\r
-                                                                       break;\r
-                                                       }\r
-                                                       pos += l;\r
-                                               }\r
-                                               break;\r
-\r
-                                       default:\r
-                                               pos += length;\r
-                                               break;\r
-                               }\r
-                       }\r
-\r
-                       return insertCount + updateCount + deleteCount;\r
-               }\r
-\r
-               protected DbStatementType GetStatementType()\r
-               {\r
-                       byte[] buffer = this.GetSqlInfo(StatementTypeInfoItems, IscCodes.STATEMENT_TYPE_BUFFER_SIZE);\r
-\r
-                       return this.ParseStatementTypeInfo(buffer);\r
-               }\r
-\r
-               protected DbStatementType ParseStatementTypeInfo(byte[] buffer)\r
-               {\r
-                       DbStatementType stmtType = DbStatementType.None;\r
-                       int pos = 0;\r
-                       int length = 0;\r
-                       int type = 0;\r
-\r
-                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)\r
-                       {\r
-                               length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                               pos += 2;\r
-                               switch (type)\r
-                               {\r
-                                       case IscCodes.isc_info_sql_stmt_type:\r
-                                               stmtType = (DbStatementType)IscHelper.VaxInteger(buffer, pos, length);\r
-                                               pos += length;\r
-                                               break;\r
-\r
-                                       default:\r
-                                               pos += length;\r
-                                               break;\r
-                               }\r
-                       }\r
-\r
-                       return stmtType;\r
-               }\r
-\r
-               protected void ClearArrayHandles()\r
-               {\r
-                       if (this.Fields != null && this.Fields.Count > 0)\r
-                       {\r
-                               for (int i = 0; i < this.Fields.Count; i++)\r
-                               {\r
-                                       if (this.Fields[i].IsArray())\r
-                                       {\r
-                                               this.Fields[i].ArrayHandle = null;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Text;
+using System.Data;
+
+namespace FirebirdSql.Data.Common
+{
+       #region Enumerations
+
+       internal enum StatementState
+       {
+               Deallocated,
+               Allocated,
+               Prepared,
+               Executed,
+               Closed,
+               Error
+       }
+
+       #endregion
+
+       internal abstract class StatementBase : IDisposable
+       {
+               #region Protected Static Fields
+
+               // Plan information     items
+               protected static byte[] DescribePlanInfoItems = new byte[] 
+               { 
+                       IscCodes.isc_info_sql_get_plan
+               };
+
+               // Records affected     items
+               protected static byte[] RecordsAffectedInfoItems = new byte[]
+               {
+                       IscCodes.isc_info_sql_records
+               };
+
+               // Describe     information     items
+               protected static byte[] DescribeInfoItems = new byte[] 
+               { 
+                       IscCodes.isc_info_sql_select,
+                       IscCodes.isc_info_sql_describe_vars,
+                       IscCodes.isc_info_sql_sqlda_seq,
+                       IscCodes.isc_info_sql_type,
+                       IscCodes.isc_info_sql_sub_type,
+                       IscCodes.isc_info_sql_length,
+                       IscCodes.isc_info_sql_scale,
+                       IscCodes.isc_info_sql_field,
+                       IscCodes.isc_info_sql_relation,
+                       // IscCodes.isc_info_sql_owner,
+                       IscCodes.isc_info_sql_alias,
+                       IscCodes.isc_info_sql_describe_end
+               };
+
+               protected static byte[] DescribeBindInfoItems = new byte[] 
+               { 
+                       IscCodes.isc_info_sql_bind,
+                       IscCodes.isc_info_sql_describe_vars,
+                       IscCodes.isc_info_sql_sqlda_seq,
+                       IscCodes.isc_info_sql_type,
+                       IscCodes.isc_info_sql_sub_type,
+                       IscCodes.isc_info_sql_length,
+                       IscCodes.isc_info_sql_scale,
+                       IscCodes.isc_info_sql_field,
+                       IscCodes.isc_info_sql_relation,
+                       // IscCodes.isc_info_sql_owner,
+                       IscCodes.isc_info_sql_alias,
+                       IscCodes.isc_info_sql_describe_end 
+               };
+
+               protected static byte[] StatementTypeInfoItems = new byte[]
+               {
+                       IscCodes.isc_info_sql_stmt_type
+               };
+
+               #endregion
+
+               #region Fields
+
+               private bool disposed;
+
+               #endregion
+
+               #region Abstract Properties
+
+               public abstract IDatabase DB
+               {
+                       get;
+                       set;
+               }
+
+               public abstract ITransaction Transaction
+               {
+                       get;
+                       set;
+               }
+
+               public abstract Descriptor Parameters
+               {
+                       get;
+                       set;
+               }
+
+               public abstract Descriptor Fields
+               {
+                       get;
+               }
+
+               public abstract int RecordsAffected
+               {
+                       get;
+               }
+
+               public abstract bool IsPrepared
+               {
+                       get;
+               }
+
+               public abstract DbStatementType StatementType
+               {
+                       get;
+                       set;
+               }
+
+               public abstract StatementState State
+               {
+                       get;
+                       set;
+               }
+
+               public abstract int FetchSize
+               {
+                       get;
+                       set;
+               }
+
+               #endregion
+
+               #region Protected Properties
+
+               protected bool IsDisposed
+               {
+                       get { return this.disposed; }
+               }
+
+               #endregion
+
+               #region Protected Fields
+
+               protected TransactionUpdateEventHandler TransactionUpdate;
+
+               #endregion
+
+               #region Abstract Methods
+
+               public abstract void Describe();
+               public abstract void DescribeParameters();
+               public abstract void Prepare(string commandText);
+               public abstract void Execute();
+               public abstract DbValue[] Fetch();
+               public abstract DbValue[] GetOuputParameters();
+               public abstract byte[] GetSqlInfo(byte[] items, int bufferLength);
+
+               public abstract BlobBase CreateBlob();
+               public abstract BlobBase CreateBlob(long handle);
+
+               public abstract ArrayBase CreateArray(ArrayDesc descriptor);
+               public abstract ArrayBase CreateArray(string tableName, string fieldName);
+               public abstract ArrayBase CreateArray(long handle, string tableName, string fieldName);
+
+               #endregion
+
+               #region Finalizer
+
+               ~StatementBase()
+               {
+                       this.Dispose(false);
+               }
+
+               #endregion
+
+               #region IDisposable     methods
+
+               public void Dispose()
+               {
+                       this.Dispose(true);
+                       GC.SuppressFinalize(this);
+               }
+
+               protected virtual void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.disposed)
+                               {
+                                       this.disposed = true;
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Protected Abstract Methods
+
+               protected abstract void TransactionUpdated(object sender, EventArgs e);
+               protected abstract void Free(int option);
+
+               #endregion
+
+               #region Methods
+
+               public string GetExecutionPlan()
+               {
+                       string  plan            = String.Empty;
+                       int             count           = 0;
+                       int             bufferSize      = IscCodes.MAX_BUFFER_SIZE;
+                       byte[]  buffer          = this.GetSqlInfo(DescribePlanInfoItems, bufferSize);
+
+                       while (buffer[0] == IscCodes.isc_info_truncated && count < 4)
+                       {
+                               bufferSize *= 2;
+                               buffer = this.GetSqlInfo(DescribePlanInfoItems, bufferSize);
+                               count++;
+                       }
+
+                       if (count > 3)
+                       {
+                               return null;
+                       }
+
+                       int len = buffer[1];
+                       len += buffer[2] << 8;
+
+                       if (len > 0)
+                       {
+                               plan = this.DB.Charset.GetString(buffer, 4, --len);
+                       }
+
+                       return plan;
+               }
+
+               public virtual void Close()
+               {
+                       if (this.State == StatementState.Executed ||
+                               this.State == StatementState.Error)
+                       {
+                               if (this.StatementType == DbStatementType.Select ||
+                                       this.StatementType == DbStatementType.SelectForUpdate ||
+                                       this.StatementType == DbStatementType.StoredProcedure)
+                               {
+                                       this.Free(IscCodes.DSQL_close);
+                                       this.ClearArrayHandles();
+                                       this.State = StatementState.Closed;
+                               }
+                       }
+               }
+
+               public virtual void Release()
+               {
+                       if (this.Transaction != null &&
+                               this.TransactionUpdate != null)
+                       {
+                               this.Transaction.Update -= this.TransactionUpdate;
+                               this.TransactionUpdate = null;
+                       }
+
+                       this.Free(IscCodes.DSQL_drop);
+
+                       this.State = StatementState.Deallocated;
+                       this.StatementType = DbStatementType.None;
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected byte[] GetSqlInfo(byte[] items)
+               {
+                       return this.GetSqlInfo(items, IscCodes.MAX_BUFFER_SIZE);
+               }
+
+               protected int GetRecordsAffected()
+               {
+                       byte[] buffer = this.GetSqlInfo(RecordsAffectedInfoItems, IscCodes.ROWS_AFFECTED_BUFFER_SIZE);
+
+                       return this.ProcessRecordsAffectedBuffer(buffer);
+               }
+
+               protected int ProcessRecordsAffectedBuffer(byte[] buffer)
+               {
+                       int insertCount = 0;
+                       int updateCount = 0;
+                       int deleteCount = 0;
+                       int selectCount = 0;
+                       int pos                 = 0;
+                       int length              = 0;
+                       int type                = 0;
+
+                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)
+                       {
+                               length = IscHelper.VaxInteger(buffer, pos, 2);
+                               pos += 2;
+                               switch (type)
+                               {
+                                       case IscCodes.isc_info_sql_records:
+                                               int l;
+                                               int t;
+                                               while ((t = buffer[pos++]) != IscCodes.isc_info_end)
+                                               {
+                                                       l = IscHelper.VaxInteger(buffer, pos, 2);
+                                                       pos += 2;
+                                                       switch (t)
+                                                       {
+                                                               case IscCodes.isc_info_req_insert_count:
+                                                                       insertCount = IscHelper.VaxInteger(
+                                                                               buffer, pos, l);
+                                                                       break;
+
+                                                               case IscCodes.isc_info_req_update_count:
+                                                                       updateCount = IscHelper.VaxInteger(
+                                                                               buffer, pos, l);
+                                                                       break;
+
+                                                               case IscCodes.isc_info_req_delete_count:
+                                                                       deleteCount = IscHelper.VaxInteger(
+                                                                               buffer, pos, l);
+                                                                       break;
+
+                                                               case IscCodes.isc_info_req_select_count:
+                                                                       selectCount = IscHelper.VaxInteger(
+                                                                               buffer, pos, l);
+                                                                       break;
+                                                       }
+                                                       pos += l;
+                                               }
+                                               break;
+
+                                       default:
+                                               pos += length;
+                                               break;
+                               }
+                       }
+
+                       return insertCount + updateCount + deleteCount;
+               }
+
+               protected DbStatementType GetStatementType()
+               {
+                       byte[] buffer = this.GetSqlInfo(StatementTypeInfoItems, IscCodes.STATEMENT_TYPE_BUFFER_SIZE);
+
+                       return this.ParseStatementTypeInfo(buffer);
+               }
+
+               protected DbStatementType ParseStatementTypeInfo(byte[] buffer)
+               {
+                       DbStatementType stmtType = DbStatementType.None;
+                       int pos = 0;
+                       int length = 0;
+                       int type = 0;
+
+                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)
+                       {
+                               length = IscHelper.VaxInteger(buffer, pos, 2);
+                               pos += 2;
+                               switch (type)
+                               {
+                                       case IscCodes.isc_info_sql_stmt_type:
+                                               stmtType = (DbStatementType)IscHelper.VaxInteger(buffer, pos, length);
+                                               pos += length;
+                                               break;
+
+                                       default:
+                                               pos += length;
+                                               break;
+                               }
+                       }
+
+                       return stmtType;
+               }
+
+               protected void ClearArrayHandles()
+               {
+                       if (this.Fields != null && this.Fields.Count > 0)
+                       {
+                               for (int i = 0; i < this.Fields.Count; i++)
+                               {
+                                       if (this.Fields[i].IsArray())
+                                       {
+                                               this.Fields[i].ArrayHandle = null;
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+       }
+}
index 4f7317405d9470195e17ebc36b7217829137c507..64a87bea7b7e65a10f8c2052d0153159da3459ab 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-#if    (NETCF)\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace System.Collections.Specialized\r
-{\r
-       public class StringCollection : CollectionBase\r
-       {\r
-               #region Indexers\r
-\r
-               public string this[int index]\r
-               {\r
-                       get { return ((string)base.List[index]); }\r
-                       set { base.List[index] = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public int Add(string value)\r
-               {\r
-                       return (base.List.Add(value));\r
-               }\r
-\r
-               public void CopyTo(string[] array, int index)\r
-               {\r
-                       if (array == null)\r
-                       {\r
-                               throw new ArgumentNullException("array is null.");\r
-                       }\r
-                       if (index < 0)\r
-                       {\r
-                               throw new ArgumentOutOfRangeException("index is less than zero.");\r
-                       }\r
-                       if (array.Rank > 1)\r
-                       {\r
-                               throw new ArgumentException("array is multidimensional.");\r
-                       }\r
-                       if (index >= array.Length)\r
-                       {\r
-                               throw new ArgumentException("index is equal to or greater than the length of array.");\r
-                       }\r
-                       if ((array.Length - index) < this.List.Count)\r
-                       {\r
-                               throw new ArgumentException("The number of elements in the source StringCollection is greater than the available space from index to the end of the destination array.");\r
-                       }\r
-\r
-                       foreach (string value in this.List)\r
-                       {\r
-                               if (index < array.Length)\r
-                               {\r
-                                       array[index++] = value;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public int IndexOf(string value)\r
-               {\r
-                       return (base.List.IndexOf(value));\r
-               }\r
-\r
-               public void Insert(int index, string value)\r
-               {\r
-                       base.List.Insert(index, value);\r
-               }\r
-\r
-               public void Remove(string value)\r
-               {\r
-                       base.List.Remove(value);\r
-               }\r
-\r
-               public bool Contains(string value)\r
-               {\r
-                       // If value     is not of type String, this     will return     false.\r
-                       return (base.List.Contains(value));\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected MEthods\r
-\r
-               protected override void OnValidate(Object value)\r
-               {\r
-                       if (value.GetType() != Type.GetType("System.String"))\r
-                       {\r
-                               throw new ArgumentException("value must be of type String.", "value");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
-\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+#if    (NETCF)
+
+using System;
+using System.Collections;
+
+namespace System.Collections.Specialized
+{
+       public class StringCollection : CollectionBase
+       {
+               #region Indexers
+
+               public string this[int index]
+               {
+                       get { return ((string)base.List[index]); }
+                       set { base.List[index] = value; }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public int Add(string value)
+               {
+                       return (base.List.Add(value));
+               }
+
+               public void CopyTo(string[] array, int index)
+               {
+                       if (array == null)
+                       {
+                               throw new ArgumentNullException("array is null.");
+                       }
+                       if (index < 0)
+                       {
+                               throw new ArgumentOutOfRangeException("index is less than zero.");
+                       }
+                       if (array.Rank > 1)
+                       {
+                               throw new ArgumentException("array is multidimensional.");
+                       }
+                       if (index >= array.Length)
+                       {
+                               throw new ArgumentException("index is equal to or greater than the length of array.");
+                       }
+                       if ((array.Length - index) < this.List.Count)
+                       {
+                               throw new ArgumentException("The number of elements in the source StringCollection is greater than the available space from index to the end of the destination array.");
+                       }
+
+                       foreach (string value in this.List)
+                       {
+                               if (index < array.Length)
+                               {
+                                       array[index++] = value;
+                               }
+                       }
+               }
+
+               public int IndexOf(string value)
+               {
+                       return (base.List.IndexOf(value));
+               }
+
+               public void Insert(int index, string value)
+               {
+                       base.List.Insert(index, value);
+               }
+
+               public void Remove(string value)
+               {
+                       base.List.Remove(value);
+               }
+
+               public bool Contains(string value)
+               {
+                       // If value     is not of type String, this     will return     false.
+                       return (base.List.Contains(value));
+               }
+
+               #endregion
+
+               #region Protected MEthods
+
+               protected override void OnValidate(Object value)
+               {
+                       if (value.GetType() != Type.GetType("System.String"))
+                       {
+                               throw new ArgumentException("value must be of type String.", "value");
+                       }
+               }
+
+               #endregion
+       }
+}
+
 #endif
\ No newline at end of file
index 8ee9fc42c29e0a4b997cf8ac69c72747abc962ef..7552c64a4d5aeee5308f7c9817c6a1993e4cee12 100644 (file)
@@ -1,37 +1,37 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class TransactionParameterBuffer : ParameterBuffer\r
-       {\r
-               #region Constructors\r
-\r
-               public TransactionParameterBuffer() : base()\r
-               {\r
-               }\r
-\r
-               public TransactionParameterBuffer(bool isLittleEndian) : base(isLittleEndian)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class TransactionParameterBuffer : ParameterBuffer
+       {
+               #region Constructors
+
+               public TransactionParameterBuffer() : base()
+               {
+               }
+
+               public TransactionParameterBuffer(bool isLittleEndian) : base(isLittleEndian)
+               {
+               }
+
+               #endregion
+       }
+}
index 22c1a64309a37f49a9d9e7215b87cee17fdb9b35..e9d8b98fbea7d4b638fac76ad98085945d892f8a 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class TypeDecoder\r
-       {\r
-               #region Constructors\r
-\r
-               private TypeDecoder()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               public static decimal DecodeDecimal(object value, int scale, int sqltype)\r
-               {\r
-                       long divisor = 1;\r
-                       decimal returnValue = Convert.ToDecimal(value, CultureInfo.InvariantCulture);\r
-\r
-                       if (scale < 0)\r
-                       {\r
-                               divisor = (long)System.Math.Pow(10, scale * (-1));\r
-                       }\r
-\r
-                       switch (sqltype & ~1)\r
-                       {\r
-                               case IscCodes.SQL_SHORT:\r
-                               case IscCodes.SQL_LONG:\r
-                               case IscCodes.SQL_QUAD:\r
-                               case IscCodes.SQL_INT64:\r
-                                       returnValue = returnValue / divisor;\r
-                                       break;\r
-                       }\r
-\r
-                       return returnValue;\r
-               }\r
-\r
-               public static DateTime DecodeTime(int sql_time)\r
-               {\r
-                       GregorianCalendar calendar = new GregorianCalendar();\r
-\r
-                       int millisInDay = sql_time / 10;\r
-                       int hour = millisInDay / 3600000;\r
-                       int minute = (millisInDay - hour * 3600000) / 60000;\r
-                       int second = (millisInDay - hour * 3600000 - minute * 60000) / 1000;\r
-                       int millisecond = millisInDay - hour * 3600000 - minute * 60000 - second * 1000;\r
-\r
-                       return new DateTime(1970, 1, 1, hour, minute, second, millisecond, calendar);\r
-               }\r
-\r
-               public static DateTime DecodeDate(int sql_date)\r
-               {\r
-                       int year, month, day, century;\r
-\r
-                       sql_date -= 1721119 - 2400001;\r
-                       century = (4 * sql_date - 1) / 146097;\r
-                       sql_date = 4 * sql_date - 1 - 146097 * century;\r
-                       day = sql_date / 4;\r
-\r
-                       sql_date = (4 * day + 3) / 1461;\r
-                       day = 4 * day + 3 - 1461 * sql_date;\r
-                       day = (day + 4) / 4;\r
-\r
-                       month = (5 * day - 3) / 153;\r
-                       day = 5 * day - 3 - 153 * month;\r
-                       day = (day + 5) / 5;\r
-\r
-                       year = 100 * century + sql_date;\r
-\r
-                       if (month < 10)\r
-                       {\r
-                               month += 3;\r
-                       }\r
-                       else\r
-                       {\r
-                               month -= 9;\r
-                               year += 1;\r
-                       }\r
-\r
-                       DateTime date = new System.DateTime(year, month, day);\r
-\r
-                       return date.Date;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class TypeDecoder
+       {
+               #region Constructors
+
+               private TypeDecoder()
+               {
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               public static decimal DecodeDecimal(object value, int scale, int sqltype)
+               {
+                       long divisor = 1;
+                       decimal returnValue = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
+
+                       if (scale < 0)
+                       {
+                               divisor = (long)System.Math.Pow(10, scale * (-1));
+                       }
+
+                       switch (sqltype & ~1)
+                       {
+                               case IscCodes.SQL_SHORT:
+                               case IscCodes.SQL_LONG:
+                               case IscCodes.SQL_QUAD:
+                               case IscCodes.SQL_INT64:
+                                       returnValue = returnValue / divisor;
+                                       break;
+                       }
+
+                       return returnValue;
+               }
+
+               public static DateTime DecodeTime(int sql_time)
+               {
+                       GregorianCalendar calendar = new GregorianCalendar();
+
+                       int millisInDay = sql_time / 10;
+                       int hour = millisInDay / 3600000;
+                       int minute = (millisInDay - hour * 3600000) / 60000;
+                       int second = (millisInDay - hour * 3600000 - minute * 60000) / 1000;
+                       int millisecond = millisInDay - hour * 3600000 - minute * 60000 - second * 1000;
+
+                       return new DateTime(1970, 1, 1, hour, minute, second, millisecond, calendar);
+               }
+
+               public static DateTime DecodeDate(int sql_date)
+               {
+                       int year, month, day, century;
+
+                       sql_date -= 1721119 - 2400001;
+                       century = (4 * sql_date - 1) / 146097;
+                       sql_date = 4 * sql_date - 1 - 146097 * century;
+                       day = sql_date / 4;
+
+                       sql_date = (4 * day + 3) / 1461;
+                       day = 4 * day + 3 - 1461 * sql_date;
+                       day = (day + 4) / 4;
+
+                       month = (5 * day - 3) / 153;
+                       day = 5 * day - 3 - 153 * month;
+                       day = (day + 5) / 5;
+
+                       year = 100 * century + sql_date;
+
+                       if (month < 10)
+                       {
+                               month += 3;
+                       }
+                       else
+                       {
+                               month -= 9;
+                               year += 1;
+                       }
+
+                       DateTime date = new System.DateTime(year, month, day);
+
+                       return date.Date;
+               }
+
+               #endregion
+       }
+}
index 63a6eb162c70e63803844743e57935d2d9ed9bdc..3bde933d4757b84d8dc5f10df1a2c63da190fee2 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class TypeEncoder\r
-       {\r
-               #region Constructors\r
-\r
-               private TypeEncoder()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               public static object EncodeDecimal(decimal d, int scale, int sqltype)\r
-               {\r
-                       long multiplier = 1;\r
-\r
-                       if (scale < 0)\r
-                       {\r
-                               multiplier = (long)System.Math.Pow(10, scale * (-1));\r
-                       }\r
-\r
-                       switch (sqltype & ~1)\r
-                       {\r
-                               case IscCodes.SQL_SHORT:\r
-                                       return (short)(d * multiplier);\r
-\r
-                               case IscCodes.SQL_LONG:\r
-                                       return (int)(d * multiplier);\r
-\r
-                               case IscCodes.SQL_QUAD:\r
-                               case IscCodes.SQL_INT64:\r
-                                       return (long)(d * multiplier);\r
-\r
-                               case IscCodes.SQL_DOUBLE:\r
-                               default:\r
-                                       return d;\r
-                       }\r
-               }\r
-\r
-               public static int EncodeTime(DateTime d)\r
-               {\r
-                       GregorianCalendar calendar = new GregorianCalendar();\r
-\r
-                       int millisInDay =\r
-                               (int)(calendar.GetHour(d) * 3600000 +\r
-                               calendar.GetMinute(d) * 60000 +\r
-                               calendar.GetSecond(d) * 1000 +\r
-                               calendar.GetMilliseconds(d)) * 10;\r
-\r
-                       return millisInDay;\r
-               }\r
-\r
-               public static int EncodeDate(DateTime d)\r
-               {\r
-                       int day, month, year;\r
-                       int c, ya;\r
-\r
-                       GregorianCalendar calendar = new GregorianCalendar();\r
-\r
-                       day = calendar.GetDayOfMonth(d);\r
-                       month = calendar.GetMonth(d);\r
-                       year = calendar.GetYear(d);\r
-\r
-                       if (month > 2)\r
-                       {\r
-                               month -= 3;\r
-                       }\r
-                       else\r
-                       {\r
-                               month += 9;\r
-                               year -= 1;\r
-                       }\r
-\r
-                       c = year / 100;\r
-                       ya = year - 100 * c;\r
-\r
-                       return ((146097 * c) / 4 +\r
-                               (1461 * ya) / 4 +\r
-                               (153 * month + 2) / 5 +\r
-                               day + 1721119 - 2400001);\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class TypeEncoder
+       {
+               #region Constructors
+
+               private TypeEncoder()
+               {
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               public static object EncodeDecimal(decimal d, int scale, int sqltype)
+               {
+                       long multiplier = 1;
+
+                       if (scale < 0)
+                       {
+                               multiplier = (long)System.Math.Pow(10, scale * (-1));
+                       }
+
+                       switch (sqltype & ~1)
+                       {
+                               case IscCodes.SQL_SHORT:
+                                       return (short)(d * multiplier);
+
+                               case IscCodes.SQL_LONG:
+                                       return (int)(d * multiplier);
+
+                               case IscCodes.SQL_QUAD:
+                               case IscCodes.SQL_INT64:
+                                       return (long)(d * multiplier);
+
+                               case IscCodes.SQL_DOUBLE:
+                               default:
+                                       return d;
+                       }
+               }
+
+               public static int EncodeTime(DateTime d)
+               {
+                       GregorianCalendar calendar = new GregorianCalendar();
+
+                       int millisInDay =
+                               (int)(calendar.GetHour(d) * 3600000 +
+                               calendar.GetMinute(d) * 60000 +
+                               calendar.GetSecond(d) * 1000 +
+                               calendar.GetMilliseconds(d)) * 10;
+
+                       return millisInDay;
+               }
+
+               public static int EncodeDate(DateTime d)
+               {
+                       int day, month, year;
+                       int c, ya;
+
+                       GregorianCalendar calendar = new GregorianCalendar();
+
+                       day = calendar.GetDayOfMonth(d);
+                       month = calendar.GetMonth(d);
+                       year = calendar.GetYear(d);
+
+                       if (month > 2)
+                       {
+                               month -= 3;
+                       }
+                       else
+                       {
+                               month += 9;
+                               year -= 1;
+                       }
+
+                       c = year / 100;
+                       ya = year - 100 * c;
+
+                       return ((146097 * c) / 4 +
+                               (1461 * ya) / 4 +
+                               (153 * month + 2) / 5 +
+                               day + 1721119 - 2400001);
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 42949b1c8c0f96266df30aa29e541d219207abb6..d0ebf1c241ae5a8860e5816ea1b960840feb2ec3 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-\r
-namespace FirebirdSql.Data.Common\r
-{\r
-       internal sealed class TypeHelper\r
-       {\r
-               #region Constructors\r
-\r
-               private TypeHelper()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               public static short GetSize(DbDataType dataType)\r
-               {\r
-                       switch (dataType)\r
-                       {\r
-                               case DbDataType.Array:\r
-                               case DbDataType.Binary:\r
-                               case DbDataType.Text:\r
-                                       return 8;\r
-\r
-                               case DbDataType.SmallInt:\r
-                                       return 2;\r
-\r
-                               case DbDataType.Integer:\r
-                               case DbDataType.Float:\r
-                               case DbDataType.Date:\r
-                               case DbDataType.Time:\r
-                                       return 4;\r
-\r
-                               case DbDataType.BigInt:\r
-                               case DbDataType.Double:\r
-                               case DbDataType.TimeStamp:\r
-                                       return 8;\r
-\r
-                               case DbDataType.Guid:\r
-                                       return 16;\r
-\r
-                               default:\r
-                                       return 0;\r
-                       }\r
-               }\r
-\r
-               public static int GetFbType(DbDataType dataType, bool isNullable)\r
-               {\r
-                       int sqltype = 0;\r
-\r
-                       switch (dataType)\r
-                       {\r
-                               case DbDataType.Array:\r
-                                       sqltype = IscCodes.SQL_ARRAY;\r
-                                       break;\r
-\r
-                               case DbDataType.Binary:\r
-                               case DbDataType.Text:\r
-                                       sqltype = IscCodes.SQL_BLOB;\r
-                                       break;\r
-\r
-                               case DbDataType.Char:\r
-                                       sqltype = IscCodes.SQL_TEXT;\r
-                                       break;\r
-\r
-                               case DbDataType.VarChar:\r
-                                       sqltype = IscCodes.SQL_VARYING;\r
-                                       break;\r
-\r
-                               case DbDataType.SmallInt:\r
-                                       sqltype = IscCodes.SQL_SHORT;\r
-                                       break;\r
-\r
-                               case DbDataType.Integer:\r
-                                       sqltype = IscCodes.SQL_LONG;\r
-                                       break;\r
-\r
-                               case DbDataType.BigInt:\r
-                                       sqltype = IscCodes.SQL_INT64;\r
-                                       break;\r
-\r
-                               case DbDataType.Float:\r
-                                       sqltype = IscCodes.SQL_FLOAT;\r
-                                       break;\r
-\r
-                               case DbDataType.Guid:\r
-                                       sqltype = IscCodes.SQL_TEXT;\r
-                                       break;\r
-\r
-                               case DbDataType.Double:\r
-                                       sqltype = IscCodes.SQL_DOUBLE;\r
-                                       break;\r
-\r
-                               case DbDataType.Date:\r
-                                       sqltype = IscCodes.SQL_TYPE_DATE;\r
-                                       break;\r
-\r
-                               case DbDataType.Time:\r
-                                       sqltype = IscCodes.SQL_TYPE_TIME;\r
-                                       break;\r
-\r
-                               case DbDataType.TimeStamp:\r
-                                       sqltype = IscCodes.SQL_TIMESTAMP;\r
-                                       break;\r
-\r
-                               default:\r
-                                       throw new ArgumentException("Invalid data type");\r
-                       }\r
-\r
-                       if (isNullable)\r
-                       {\r
-                               sqltype++;\r
-                       }\r
-\r
-                       return sqltype;\r
-               }\r
-\r
-               public static int GetFbType(int blrType)\r
-               {\r
-                       switch (blrType)\r
-                       {\r
-                               case IscCodes.blr_varying:\r
-                               case IscCodes.blr_varying2:\r
-                                       return IscCodes.SQL_VARYING;\r
-\r
-                               case IscCodes.blr_text:\r
-                               case IscCodes.blr_text2:\r
-                               case IscCodes.blr_cstring:\r
-                               case IscCodes.blr_cstring2:\r
-                                       return IscCodes.SQL_TEXT;\r
-\r
-                               case IscCodes.blr_short:\r
-                                       return IscCodes.SQL_SHORT;\r
-\r
-                               case IscCodes.blr_long:\r
-                                       return IscCodes.SQL_LONG;\r
-\r
-                               case IscCodes.blr_quad:\r
-                                       return IscCodes.SQL_QUAD;\r
-\r
-                               case IscCodes.blr_int64:\r
-                               case IscCodes.blr_blob_id:\r
-                                       return IscCodes.SQL_INT64;\r
-\r
-                               case IscCodes.blr_double:\r
-                                       return IscCodes.SQL_DOUBLE;\r
-\r
-                               case IscCodes.blr_d_float:\r
-                                       return IscCodes.SQL_D_FLOAT;\r
-\r
-                               case IscCodes.blr_float:\r
-                                       return IscCodes.SQL_FLOAT;\r
-\r
-                               case IscCodes.blr_sql_date:\r
-                                       return IscCodes.SQL_TYPE_DATE;\r
-\r
-                               case IscCodes.blr_sql_time:\r
-                                       return IscCodes.SQL_TYPE_TIME;\r
-\r
-                               case IscCodes.blr_timestamp:\r
-                                       return IscCodes.SQL_TIMESTAMP;\r
-\r
-                               case IscCodes.blr_blob:\r
-                                       return IscCodes.SQL_BLOB;\r
-\r
-                               default:\r
-                                       throw new ArgumentException("Invalid data type");\r
-                       }\r
-               }\r
-\r
-               public static DbDataType GetDbDataType(int blrType, int subType, int scale)\r
-               {\r
-                       switch (blrType)\r
-                       {\r
-                               case IscCodes.blr_varying:\r
-                               case IscCodes.blr_varying2:\r
-                                       return DbDataType.VarChar;\r
-\r
-                               case IscCodes.blr_text:\r
-                               case IscCodes.blr_text2:\r
-                                       return DbDataType.Char;\r
-\r
-                               case IscCodes.blr_cstring:\r
-                               case IscCodes.blr_cstring2:\r
-                                       return DbDataType.Text;\r
-\r
-                               case IscCodes.blr_short:\r
-                    if (subType == 2)\r
-                    {\r
-                        return DbDataType.Decimal;\r
-                    }\r
-                    else if (subType == 1)\r
-                    {\r
-                        return DbDataType.Numeric;\r
-                    }\r
-                                       else\r
-                                       {\r
-                                               return DbDataType.SmallInt;\r
-                                       }\r
-\r
-                               case IscCodes.blr_long:\r
-                    if (subType == 2)\r
-                    {\r
-                        return DbDataType.Decimal;\r
-                    }\r
-                    else if (subType == 1)\r
-                    {\r
-                        return DbDataType.Numeric;\r
-                    }\r
-                                       else\r
-                                       {\r
-                                               return DbDataType.Integer;\r
-                                       }\r
-\r
-                               case IscCodes.blr_quad:\r
-                               case IscCodes.blr_int64:\r
-                               case IscCodes.blr_blob_id:\r
-                    if (subType == 2)\r
-                    {\r
-                        return DbDataType.Decimal;\r
-                    }\r
-                    else if (subType == 1)\r
-                    {\r
-                        return DbDataType.Numeric;\r
-                    }\r
-                                       else\r
-                                       {\r
-                                               return DbDataType.BigInt;\r
-                                       }\r
-\r
-                               case IscCodes.blr_double:\r
-                               case IscCodes.blr_d_float:\r
-                                       return DbDataType.Double;\r
-\r
-                               case IscCodes.blr_float:\r
-                                       return DbDataType.Float;\r
-\r
-                               case IscCodes.blr_sql_date:\r
-                                       return DbDataType.Date;\r
-\r
-                               case IscCodes.blr_sql_time:\r
-                                       return DbDataType.Time;\r
-\r
-                               case IscCodes.blr_timestamp:\r
-                                       return DbDataType.TimeStamp;\r
-\r
-                               case IscCodes.blr_blob:\r
-                                       if (subType == 1)\r
-                                       {\r
-                                               return DbDataType.Text;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               return DbDataType.Binary;\r
-                                       }\r
-\r
-                               default:\r
-                                       throw new ArgumentException("Invalid data type");\r
-                       }\r
-               }\r
-\r
-               public static string GetDataTypeName(DbDataType dataType)\r
-               {\r
-                       switch (dataType)\r
-                       {\r
-                               case DbDataType.Array:\r
-                                       return "ARRAY";\r
-\r
-                               case DbDataType.Binary:\r
-                                       return "BLOB";\r
-\r
-                               case DbDataType.Text:\r
-                                       return "BLOB SUB_TYPE 1";\r
-\r
-                               case DbDataType.Char:\r
-                               case DbDataType.Guid:\r
-                                       return "CHAR";\r
-\r
-                               case DbDataType.VarChar:\r
-                                       return "VARCHAR";\r
-\r
-                               case DbDataType.SmallInt:\r
-                                       return "SMALLINT";\r
-\r
-                               case DbDataType.Integer:\r
-                                       return "INTEGER";\r
-\r
-                               case DbDataType.Float:\r
-                                       return "FLOAT";\r
-\r
-                               case DbDataType.Double:\r
-                                       return "DOUBLE PRECISION";\r
-\r
-                               case DbDataType.BigInt:\r
-                                       return "BIGINT";\r
-\r
-                               case DbDataType.Numeric:\r
-                                       return "NUMERIC";\r
-\r
-                               case DbDataType.Decimal:\r
-                                       return "DECIMAL";\r
-\r
-                               case DbDataType.Date:\r
-                                       return "DATE";\r
-\r
-                               case DbDataType.Time:\r
-                                       return "TIME";\r
-\r
-                               case DbDataType.TimeStamp:\r
-                                       return "TIMESTAMP";\r
-\r
-                               default:\r
-                                       return null;\r
-                       }\r
-               }\r
-\r
-               public static DbType GetDbType(DbDataType type)\r
-               {\r
-                       switch (type)\r
-                       {\r
-                               case DbDataType.Array:\r
-                               case DbDataType.Binary:\r
-                                       return DbType.Binary;\r
-\r
-                               case DbDataType.Text:\r
-                               case DbDataType.VarChar:\r
-                               case DbDataType.Char:\r
-                                       return DbType.String;\r
-\r
-                               case DbDataType.SmallInt:\r
-                                       return DbType.Int16;\r
-\r
-                               case DbDataType.Integer:\r
-                                       return DbType.Int32;\r
-\r
-                               case DbDataType.BigInt:\r
-                                       return DbType.Int64;\r
-\r
-                               case DbDataType.Date:\r
-                                       return DbType.Date;\r
-\r
-                               case DbDataType.Time:\r
-                                       return DbType.Time;\r
-\r
-                               case DbDataType.TimeStamp:\r
-                                       return DbType.DateTime;\r
-\r
-                               case DbDataType.Numeric:\r
-                               case DbDataType.Decimal:\r
-                                       return DbType.Decimal;\r
-\r
-                               case DbDataType.Float:\r
-                                       return DbType.Single;\r
-\r
-                               case DbDataType.Double:\r
-                                       return DbType.Double;\r
-\r
-                               case DbDataType.Guid:\r
-                                       return DbType.Guid;\r
-\r
-                               default:\r
-                                       throw new ArgumentException("Invalid data type");\r
-                       }\r
-               }\r
-\r
-               public static DbDataType GetDbDataType(DbType dbType)\r
-               {\r
-                       switch (dbType)\r
-                       {\r
-                               case DbType.String:\r
-                               case DbType.AnsiString:\r
-                                       return DbDataType.VarChar;\r
-\r
-                               case DbType.StringFixedLength:\r
-                               case DbType.AnsiStringFixedLength:\r
-                                       return DbDataType.Char;\r
-\r
-                               case DbType.Boolean:\r
-                               case DbType.Byte:\r
-                               case DbType.SByte:\r
-                               case DbType.Int16:\r
-                               case DbType.UInt16:\r
-                                       return DbDataType.SmallInt;\r
-\r
-                               case DbType.Int32:\r
-                               case DbType.UInt32:\r
-                                       return DbDataType.Integer;\r
-\r
-                               case DbType.Int64:\r
-                               case DbType.UInt64:\r
-                                       return DbDataType.BigInt;\r
-\r
-                               case DbType.Date:\r
-                                       return DbDataType.Date;\r
-\r
-                               case DbType.Time:\r
-                                       return DbDataType.Time;\r
-\r
-                               case DbType.DateTime:\r
-                                       return DbDataType.TimeStamp;\r
-\r
-                               case DbType.Object:\r
-                               case DbType.Binary:\r
-                                       return DbDataType.Binary;\r
-\r
-                               case DbType.Decimal:\r
-                                       return DbDataType.Decimal;\r
-\r
-                               case DbType.Double:\r
-                                       return DbDataType.Double;\r
-\r
-                               case DbType.Single:\r
-                                       return DbDataType.Float;\r
-\r
-                               case DbType.Guid:\r
-                                       return DbDataType.Guid;\r
-\r
-                               default:\r
-                                       throw new ArgumentException("Invalid data type");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+
+namespace FirebirdSql.Data.Common
+{
+       internal sealed class TypeHelper
+       {
+               #region Constructors
+
+               private TypeHelper()
+               {
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               public static short GetSize(DbDataType dataType)
+               {
+                       switch (dataType)
+                       {
+                               case DbDataType.Array:
+                               case DbDataType.Binary:
+                               case DbDataType.Text:
+                                       return 8;
+
+                               case DbDataType.SmallInt:
+                                       return 2;
+
+                               case DbDataType.Integer:
+                               case DbDataType.Float:
+                               case DbDataType.Date:
+                               case DbDataType.Time:
+                                       return 4;
+
+                               case DbDataType.BigInt:
+                               case DbDataType.Double:
+                               case DbDataType.TimeStamp:
+                                       return 8;
+
+                               case DbDataType.Guid:
+                                       return 16;
+
+                               default:
+                                       return 0;
+                       }
+               }
+
+               public static int GetFbType(DbDataType dataType, bool isNullable)
+               {
+                       int sqltype = 0;
+
+                       switch (dataType)
+                       {
+                               case DbDataType.Array:
+                                       sqltype = IscCodes.SQL_ARRAY;
+                                       break;
+
+                               case DbDataType.Binary:
+                               case DbDataType.Text:
+                                       sqltype = IscCodes.SQL_BLOB;
+                                       break;
+
+                               case DbDataType.Char:
+                                       sqltype = IscCodes.SQL_TEXT;
+                                       break;
+
+                               case DbDataType.VarChar:
+                                       sqltype = IscCodes.SQL_VARYING;
+                                       break;
+
+                               case DbDataType.SmallInt:
+                                       sqltype = IscCodes.SQL_SHORT;
+                                       break;
+
+                               case DbDataType.Integer:
+                                       sqltype = IscCodes.SQL_LONG;
+                                       break;
+
+                               case DbDataType.BigInt:
+                                       sqltype = IscCodes.SQL_INT64;
+                                       break;
+
+                               case DbDataType.Float:
+                                       sqltype = IscCodes.SQL_FLOAT;
+                                       break;
+
+                               case DbDataType.Guid:
+                                       sqltype = IscCodes.SQL_TEXT;
+                                       break;
+
+                               case DbDataType.Double:
+                                       sqltype = IscCodes.SQL_DOUBLE;
+                                       break;
+
+                               case DbDataType.Date:
+                                       sqltype = IscCodes.SQL_TYPE_DATE;
+                                       break;
+
+                               case DbDataType.Time:
+                                       sqltype = IscCodes.SQL_TYPE_TIME;
+                                       break;
+
+                               case DbDataType.TimeStamp:
+                                       sqltype = IscCodes.SQL_TIMESTAMP;
+                                       break;
+
+                               default:
+                                       throw new ArgumentException("Invalid data type");
+                       }
+
+                       if (isNullable)
+                       {
+                               sqltype++;
+                       }
+
+                       return sqltype;
+               }
+
+               public static int GetFbType(int blrType)
+               {
+                       switch (blrType)
+                       {
+                               case IscCodes.blr_varying:
+                               case IscCodes.blr_varying2:
+                                       return IscCodes.SQL_VARYING;
+
+                               case IscCodes.blr_text:
+                               case IscCodes.blr_text2:
+                               case IscCodes.blr_cstring:
+                               case IscCodes.blr_cstring2:
+                                       return IscCodes.SQL_TEXT;
+
+                               case IscCodes.blr_short:
+                                       return IscCodes.SQL_SHORT;
+
+                               case IscCodes.blr_long:
+                                       return IscCodes.SQL_LONG;
+
+                               case IscCodes.blr_quad:
+                                       return IscCodes.SQL_QUAD;
+
+                               case IscCodes.blr_int64:
+                               case IscCodes.blr_blob_id:
+                                       return IscCodes.SQL_INT64;
+
+                               case IscCodes.blr_double:
+                                       return IscCodes.SQL_DOUBLE;
+
+                               case IscCodes.blr_d_float:
+                                       return IscCodes.SQL_D_FLOAT;
+
+                               case IscCodes.blr_float:
+                                       return IscCodes.SQL_FLOAT;
+
+                               case IscCodes.blr_sql_date:
+                                       return IscCodes.SQL_TYPE_DATE;
+
+                               case IscCodes.blr_sql_time:
+                                       return IscCodes.SQL_TYPE_TIME;
+
+                               case IscCodes.blr_timestamp:
+                                       return IscCodes.SQL_TIMESTAMP;
+
+                               case IscCodes.blr_blob:
+                                       return IscCodes.SQL_BLOB;
+
+                               default:
+                                       throw new ArgumentException("Invalid data type");
+                       }
+               }
+
+               public static DbDataType GetDbDataType(int blrType, int subType, int scale)
+               {
+                       switch (blrType)
+                       {
+                               case IscCodes.blr_varying:
+                               case IscCodes.blr_varying2:
+                                       return DbDataType.VarChar;
+
+                               case IscCodes.blr_text:
+                               case IscCodes.blr_text2:
+                                       return DbDataType.Char;
+
+                               case IscCodes.blr_cstring:
+                               case IscCodes.blr_cstring2:
+                                       return DbDataType.Text;
+
+                               case IscCodes.blr_short:
+                    if (subType == 2)
+                    {
+                        return DbDataType.Decimal;
+                    }
+                    else if (subType == 1)
+                    {
+                        return DbDataType.Numeric;
+                    }
+                                       else
+                                       {
+                                               return DbDataType.SmallInt;
+                                       }
+
+                               case IscCodes.blr_long:
+                    if (subType == 2)
+                    {
+                        return DbDataType.Decimal;
+                    }
+                    else if (subType == 1)
+                    {
+                        return DbDataType.Numeric;
+                    }
+                                       else
+                                       {
+                                               return DbDataType.Integer;
+                                       }
+
+                               case IscCodes.blr_quad:
+                               case IscCodes.blr_int64:
+                               case IscCodes.blr_blob_id:
+                    if (subType == 2)
+                    {
+                        return DbDataType.Decimal;
+                    }
+                    else if (subType == 1)
+                    {
+                        return DbDataType.Numeric;
+                    }
+                                       else
+                                       {
+                                               return DbDataType.BigInt;
+                                       }
+
+                               case IscCodes.blr_double:
+                               case IscCodes.blr_d_float:
+                                       return DbDataType.Double;
+
+                               case IscCodes.blr_float:
+                                       return DbDataType.Float;
+
+                               case IscCodes.blr_sql_date:
+                                       return DbDataType.Date;
+
+                               case IscCodes.blr_sql_time:
+                                       return DbDataType.Time;
+
+                               case IscCodes.blr_timestamp:
+                                       return DbDataType.TimeStamp;
+
+                               case IscCodes.blr_blob:
+                                       if (subType == 1)
+                                       {
+                                               return DbDataType.Text;
+                                       }
+                                       else
+                                       {
+                                               return DbDataType.Binary;
+                                       }
+
+                               default:
+                                       throw new ArgumentException("Invalid data type");
+                       }
+               }
+
+               public static string GetDataTypeName(DbDataType dataType)
+               {
+                       switch (dataType)
+                       {
+                               case DbDataType.Array:
+                                       return "ARRAY";
+
+                               case DbDataType.Binary:
+                                       return "BLOB";
+
+                               case DbDataType.Text:
+                                       return "BLOB SUB_TYPE 1";
+
+                               case DbDataType.Char:
+                               case DbDataType.Guid:
+                                       return "CHAR";
+
+                               case DbDataType.VarChar:
+                                       return "VARCHAR";
+
+                               case DbDataType.SmallInt:
+                                       return "SMALLINT";
+
+                               case DbDataType.Integer:
+                                       return "INTEGER";
+
+                               case DbDataType.Float:
+                                       return "FLOAT";
+
+                               case DbDataType.Double:
+                                       return "DOUBLE PRECISION";
+
+                               case DbDataType.BigInt:
+                                       return "BIGINT";
+
+                               case DbDataType.Numeric:
+                                       return "NUMERIC";
+
+                               case DbDataType.Decimal:
+                                       return "DECIMAL";
+
+                               case DbDataType.Date:
+                                       return "DATE";
+
+                               case DbDataType.Time:
+                                       return "TIME";
+
+                               case DbDataType.TimeStamp:
+                                       return "TIMESTAMP";
+
+                               default:
+                                       return null;
+                       }
+               }
+
+               public static DbType GetDbType(DbDataType type)
+               {
+                       switch (type)
+                       {
+                               case DbDataType.Array:
+                               case DbDataType.Binary:
+                                       return DbType.Binary;
+
+                               case DbDataType.Text:
+                               case DbDataType.VarChar:
+                               case DbDataType.Char:
+                                       return DbType.String;
+
+                               case DbDataType.SmallInt:
+                                       return DbType.Int16;
+
+                               case DbDataType.Integer:
+                                       return DbType.Int32;
+
+                               case DbDataType.BigInt:
+                                       return DbType.Int64;
+
+                               case DbDataType.Date:
+                                       return DbType.Date;
+
+                               case DbDataType.Time:
+                                       return DbType.Time;
+
+                               case DbDataType.TimeStamp:
+                                       return DbType.DateTime;
+
+                               case DbDataType.Numeric:
+                               case DbDataType.Decimal:
+                                       return DbType.Decimal;
+
+                               case DbDataType.Float:
+                                       return DbType.Single;
+
+                               case DbDataType.Double:
+                                       return DbType.Double;
+
+                               case DbDataType.Guid:
+                                       return DbType.Guid;
+
+                               default:
+                                       throw new ArgumentException("Invalid data type");
+                       }
+               }
+
+               public static DbDataType GetDbDataType(DbType dbType)
+               {
+                       switch (dbType)
+                       {
+                               case DbType.String:
+                               case DbType.AnsiString:
+                                       return DbDataType.VarChar;
+
+                               case DbType.StringFixedLength:
+                               case DbType.AnsiStringFixedLength:
+                                       return DbDataType.Char;
+
+                               case DbType.Boolean:
+                               case DbType.Byte:
+                               case DbType.SByte:
+                               case DbType.Int16:
+                               case DbType.UInt16:
+                                       return DbDataType.SmallInt;
+
+                               case DbType.Int32:
+                               case DbType.UInt32:
+                                       return DbDataType.Integer;
+
+                               case DbType.Int64:
+                               case DbType.UInt64:
+                                       return DbDataType.BigInt;
+
+                               case DbType.Date:
+                                       return DbDataType.Date;
+
+                               case DbType.Time:
+                                       return DbDataType.Time;
+
+                               case DbType.DateTime:
+                                       return DbDataType.TimeStamp;
+
+                               case DbType.Object:
+                               case DbType.Binary:
+                                       return DbDataType.Binary;
+
+                               case DbType.Decimal:
+                                       return DbDataType.Decimal;
+
+                               case DbType.Double:
+                                       return DbDataType.Double;
+
+                               case DbType.Single:
+                                       return DbDataType.Float;
+
+                               case DbType.Guid:
+                                       return DbDataType.Guid;
+
+                               default:
+                                       throw new ArgumentException("Invalid data type");
+                       }
+               }
+
+               #endregion
+       }
+}
index 5c2aef4b37d514545daa433bf40fe037bfa237a3..22b113a67d7c1d2834dda15326aa104377422d22 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index caf5894c27b1a020de2063f51ca982382ffcdee8..251243f4a80ce424f19412a185ddecdaf769de7c 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index 9a2dc79498d1cc41edefc478c53f59f92b239640..a2ec57eb8a5a7a12869aea8a34de3e13ed52958a 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index 51f5f326f8c5d5644c815cb04c739e8351fd0f21..8a63fff7789316201029491e701e2d83ae5dc9e2 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index cac63d47f39982def04032c1eea37ece7cc67641..34ae1091495bd910f50227d01795836780129966 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index a6fb71369bed9b1006b1d43a5cd62a97dc30187e..0f9f7b9391f110bca2d5c506b5ec6666600e9cc8 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index a3dc03d20d1fec1ea2c80a29dd05f4236636fe8c..8650933231ef10c6b3c35107234fb9dbbe12286c 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index b6e820284ed54f4fbc4be1ca98000fc78e168d7d..580a8d3204d519f83e71d1b505e3338ff066efcc 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index cb7017baa0425d579f3ff5bf5325c1705b644336..c6aecebe1eac3e5d2c835acae272492e6380a20c 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
@@ -671,7 +671,8 @@ namespace FirebirdSql.Data.Embedded
                {\r
                        if (this.StatementType == DbStatementType.Insert ||\r
                                this.StatementType == DbStatementType.Delete ||\r
-                               this.StatementType == DbStatementType.Update)\r
+                               this.StatementType == DbStatementType.Update ||\r
+                this.StatementType == DbStatementType.StoredProcedure)\r
                        {\r
                                this.recordsAffected = this.GetRecordsAffected();\r
                        }\r
index eb59347c8ce876b7856daa3d22eb46e32686bf84..fbe80e8b46e4d562b6c22425f01925dd449418a2 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index 23821fa0843d6f11e4c2c18c8b109e32e408b24a..09c413cd9796dafef648ac13bbc541f1f6c379f9 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index 777266410762ed9345f8a693765b75f871a2a76b..becfce16ef41bfd113cb87d52bfe65fd61c8b716 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
+ *     Firebird ADO.NET Data provider for .NET and Mono \r
  * \r
  *        The contents of this file are subject to the Initial \r
  *        Developer's Public License Version 1.0 (the "License"); \r
index 52dcc93ad09120f00ad39bf755c288dd94549cef..67e8e905f4acee717241e22b0da5400eeafea63f 100644 (file)
@@ -1 +1 @@
--resource:FirebirdSql.Data.Common/Resources/isc_error_msg.resources
+-resource:FirebirdSql.Data.Common/Resources/isc_error_msg.resources\r
index eb807f49acd70893722c3905f85b793c3b8f9242..6a14f2857739990c63c09187b753952c2dfa6510 100644 (file)
Binary files a/mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird.snk and b/mcs/class/FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird.snk differ
index 99cf7c46e6ebf27e27a73ba937ae55ff51250550..4d262fc7d0dc7cb419f141ed4e72ecc2fd569d87 100644 (file)
@@ -1,80 +1,80 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       internal sealed class ClientFactory\r
-       {\r
-               #region Constructors\r
-\r
-               private ClientFactory()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               public static IDatabase CreateDatabase(int serverType)\r
-               {\r
-                       switch (serverType)\r
-                       {\r
-                               case 0:\r
-                                       // C# Client\r
-                                       return new FirebirdSql.Data.Gds.GdsDatabase();\r
-\r
-#if    (!NETCF)\r
-\r
-                               case 1:\r
-                                       // PInvoke Client\r
-                                       return new FirebirdSql.Data.Embedded.FesDatabase();\r
-\r
-#endif\r
-\r
-                               default:\r
-                                       throw new NotSupportedException("Specified server type is not correct.");\r
-                       }\r
-               }\r
-\r
-               public static IServiceManager CreateServiceManager(int serverType)\r
-               {\r
-                       switch (serverType)\r
-                       {\r
-                               case 0:\r
-                                       // C# Client\r
-                                       return new FirebirdSql.Data.Gds.GdsServiceManager();\r
-\r
-#if    (!NETCF)\r
-\r
-                               case 1:\r
-                                       // PInvoke Client\r
-                                       return new FirebirdSql.Data.Embedded.FesServiceManager();\r
-\r
-#endif\r
-\r
-                               default:\r
-                                       throw new NotSupportedException("Specified server type is not correct.");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       internal sealed class ClientFactory
+       {
+               #region Constructors
+
+               private ClientFactory()
+               {
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               public static IDatabase CreateDatabase(int serverType)
+               {
+                       switch (serverType)
+                       {
+                               case 0:
+                                       // C# Client
+                                       return new FirebirdSql.Data.Gds.GdsDatabase();
+
+#if    (!NETCF)
+
+                               case 1:
+                                       // PInvoke Client
+                                       return new FirebirdSql.Data.Embedded.FesDatabase();
+
+#endif
+
+                               default:
+                                       throw new NotSupportedException("Specified server type is not correct.");
+                       }
+               }
+
+               public static IServiceManager CreateServiceManager(int serverType)
+               {
+                       switch (serverType)
+                       {
+                               case 0:
+                                       // C# Client
+                                       return new FirebirdSql.Data.Gds.GdsServiceManager();
+
+#if    (!NETCF)
+
+                               case 1:
+                                       // PInvoke Client
+                                       return new FirebirdSql.Data.Embedded.FesServiceManager();
+
+#endif
+
+                               default:
+                                       throw new NotSupportedException("Specified server type is not correct.");
+                       }
+               }
+
+               #endregion
+       }
+}
index f95c98eeb9b144cd93b2c0824ad361a4ab03e153..b68e175b3c26afa4bab3561af930f75f5e9d00d6 100644 (file)
@@ -1,88 +1,88 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbCharacterSets : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbCharacterSets() : base("CharacterSets")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS CHARACTER_SET_CATALOG, " +\r
-                                       "null AS CHARACTER_SET_SCHEMA, " +\r
-                                       "rdb$character_set_name AS CHARACTER_SET_NAME, " +\r
-                                       "rdb$character_set_id AS CHARACTER_SET_ID, " +\r
-                                       "rdb$default_collate_name AS DEFAULT_COLLATION," +\r
-                                       "rdb$bytes_per_character AS BYTES_PER_CHARACTER, " +\r
-                                       "rdb$description AS DESCRIPTION " +\r
-                                "FROM " +\r
-                                       "rdb$character_sets");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* CHARACTER_SET_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CHARACTER_SET_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CHARACTER_SET_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$character_set_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$character_set_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbCharacterSets : FbDbSchema
+       {
+               #region Constructors
+
+               public FbCharacterSets() : base("CharacterSets")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS CHARACTER_SET_CATALOG, " +
+                                       "null AS CHARACTER_SET_SCHEMA, " +
+                                       "rdb$character_set_name AS CHARACTER_SET_NAME, " +
+                                       "rdb$character_set_id AS CHARACTER_SET_ID, " +
+                                       "rdb$default_collate_name AS DEFAULT_COLLATION," +
+                                       "rdb$bytes_per_character AS BYTES_PER_CHARACTER, " +
+                                       "rdb$description AS DESCRIPTION " +
+                                "FROM " +
+                                       "rdb$character_sets");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* CHARACTER_SET_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* CHARACTER_SET_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* CHARACTER_SET_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$character_set_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$character_set_name");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index ba0f2303e92575e75b8c02dc4b0109c2363a3e92..b0f3e5d0a78a0ed430925fad948f0f619c0637bc 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Text;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbCheckConstraints : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbCheckConstraints() : base("CheckConstraints")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS CONSTRAINT_CATALOG, " +\r
-                                       "null AS CONSTRAINT_SCHEMA, " +\r
-                                       "chk.rdb$constraint_name AS CONSTRAINT_NAME, " +\r
-                                       "trig.rdb$trigger_source AS CHECK_CLAUSULE, " +\r
-                                       "trig.rdb$description AS DESCRIPTION " +\r
-                               "FROM RDB$CHECK_CONSTRAINTS chk " +\r
-                                       "left join rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name"\r
-                               );\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               /* CONSTRAINT_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CONSTRAINT_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CONSTRAINT_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[1] != null)\r
-                               {\r
-                                       where.Append("chk.rdb$constraint_name = @p0");\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0}", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY chk.rdb$constraint_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override object[] ParseRestrictions(object[] restrictions)\r
-               {\r
-                       object[] parsed = restrictions;\r
-\r
-                       if (parsed != null)\r
-                       {\r
-                               if (parsed.Length == 7 && parsed[6] != null)\r
-                               {\r
-                                       switch (parsed[6].ToString().ToUpper(CultureInfo.CurrentCulture))\r
-                                       {\r
-                                               case "UNIQUE":\r
-                                                       parsed[3] = "u";\r
-                                                       break;\r
-\r
-                                               case "PRIMARY KEY":\r
-                                                       parsed[3] = "p";\r
-                                                       break;\r
-\r
-                                               case "FOREIGN KEY":\r
-                                                       parsed[3] = "f";\r
-                                                       break;\r
-\r
-                                               case "CHECK":\r
-                                                       parsed[3] = "c";\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return parsed;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Text;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbCheckConstraints : FbDbSchema
+       {
+               #region Constructors
+
+               public FbCheckConstraints() : base("CheckConstraints")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS CONSTRAINT_CATALOG, " +
+                                       "null AS CONSTRAINT_SCHEMA, " +
+                                       "chk.rdb$constraint_name AS CONSTRAINT_NAME, " +
+                                       "trig.rdb$trigger_source AS CHECK_CLAUSULE, " +
+                                       "trig.rdb$description AS DESCRIPTION " +
+                               "FROM RDB$CHECK_CONSTRAINTS chk " +
+                                       "left join rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name"
+                               );
+
+                       if (restrictions != null)
+                       {
+                               /* CONSTRAINT_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* CONSTRAINT_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* CONSTRAINT_NAME */
+                               if (restrictions.Length >= 3 && restrictions[1] != null)
+                               {
+                                       where.Append("chk.rdb$constraint_name = @p0");
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0}", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY chk.rdb$constraint_name");
+
+                       return sql;
+               }
+
+               protected override object[] ParseRestrictions(object[] restrictions)
+               {
+                       object[] parsed = restrictions;
+
+                       if (parsed != null)
+                       {
+                               if (parsed.Length == 7 && parsed[6] != null)
+                               {
+                                       switch (parsed[6].ToString().ToUpper(CultureInfo.CurrentCulture))
+                                       {
+                                               case "UNIQUE":
+                                                       parsed[3] = "u";
+                                                       break;
+
+                                               case "PRIMARY KEY":
+                                                       parsed[3] = "p";
+                                                       break;
+
+                                               case "FOREIGN KEY":
+                                                       parsed[3] = "f";
+                                                       break;
+
+                                               case "CHECK":
+                                                       parsed[3] = "c";
+                                                       break;
+                                       }
+                               }
+                       }
+
+                       return parsed;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 0784d8116f95286459efc039f71881a5bad891ee..8dbc4a26d9b53c9f613c48fb4a66da9886c76fbc 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Text;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbChecksByTable : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbChecksByTable() : base("CheckConstraintsByTable")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS CONSTRAINT_CATALOG, " +\r
-                                       "null AS CONSTRAINT_SCHEMA, " +\r
-                                       "chktb.rdb$constraint_name AS CONSTRAINT_NAME, " +\r
-                                       "chktb.rdb$relation_name AS TABLE_NAME, " +\r
-                                       "trig.rdb$trigger_source AS CHECK_CLAUSULE, " +\r
-                                       "trig.rdb$description AS DESCRIPTION " +\r
-                               "FROM rdb$relation_constraints chktb " +\r
-                                       "left join rdb$check_constraints chk ON (chktb.rdb$constraint_name = chk.rdb$constraint_name AND chktb.rdb$constraint_type = 'CHECK') " +\r
-                                       "left join rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* CONSTRAINT_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CONSTRAINT_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CONSTRAINT_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[1] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "chktb.rdb$constraint_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY chktb.rdb$relation_name, chktb.rdb$constraint_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override object[] ParseRestrictions(object[] restrictions)\r
-               {\r
-                       object[] parsed = restrictions;\r
-\r
-                       if (parsed != null)\r
-                       {\r
-                               if (parsed.Length == 7 && parsed[6] != null)\r
-                               {\r
-                                       switch (parsed[6].ToString().ToUpper(CultureInfo.CurrentCulture))\r
-                                       {\r
-                                               case "UNIQUE":\r
-                                                       parsed[3] = "u";\r
-                                                       break;\r
-\r
-                                               case "PRIMARY KEY":\r
-                                                       parsed[3] = "p";\r
-                                                       break;\r
-\r
-                                               case "FOREIGN KEY":\r
-                                                       parsed[3] = "f";\r
-                                                       break;\r
-\r
-                                               case "CHECK":\r
-                                                       parsed[3] = "c";\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return parsed;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Text;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbChecksByTable : FbDbSchema
+       {
+               #region Constructors
+
+               public FbChecksByTable() : base("CheckConstraintsByTable")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS CONSTRAINT_CATALOG, " +
+                                       "null AS CONSTRAINT_SCHEMA, " +
+                                       "chktb.rdb$constraint_name AS CONSTRAINT_NAME, " +
+                                       "chktb.rdb$relation_name AS TABLE_NAME, " +
+                                       "trig.rdb$trigger_source AS CHECK_CLAUSULE, " +
+                                       "trig.rdb$description AS DESCRIPTION " +
+                               "FROM rdb$relation_constraints chktb " +
+                                       "left join rdb$check_constraints chk ON (chktb.rdb$constraint_name = chk.rdb$constraint_name AND chktb.rdb$constraint_type = 'CHECK') " +
+                                       "left join rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* CONSTRAINT_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* CONSTRAINT_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* CONSTRAINT_NAME */
+                               if (restrictions.Length >= 3 && restrictions[1] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "chktb.rdb$constraint_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY chktb.rdb$relation_name, chktb.rdb$constraint_name");
+
+                       return sql;
+               }
+
+               protected override object[] ParseRestrictions(object[] restrictions)
+               {
+                       object[] parsed = restrictions;
+
+                       if (parsed != null)
+                       {
+                               if (parsed.Length == 7 && parsed[6] != null)
+                               {
+                                       switch (parsed[6].ToString().ToUpper(CultureInfo.CurrentCulture))
+                                       {
+                                               case "UNIQUE":
+                                                       parsed[3] = "u";
+                                                       break;
+
+                                               case "PRIMARY KEY":
+                                                       parsed[3] = "p";
+                                                       break;
+
+                                               case "FOREIGN KEY":
+                                                       parsed[3] = "f";
+                                                       break;
+
+                                               case "CHECK":
+                                                       parsed[3] = "c";
+                                                       break;
+                                       }
+                               }
+                       }
+
+                       return parsed;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index d62838220105909f58c1140682a62de95d5c064f..2233ab0086517c9a29edd3e913b83c45f9eb65e2 100644 (file)
@@ -1,87 +1,87 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Globalization;\r
-using System.Data;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbCollations : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbCollations() : base("Collations")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS COLLATION_CATALOG, " +\r
-                                       "null AS COLLATION_SCHEMA, " +\r
-                                       "coll.rdb$collation_name AS COLLATION_NAME, " +\r
-                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +\r
-                                       "coll.rdb$description AS DESCRIPTION " +\r
-                               "FROM rdb$collations coll " +\r
-                                       "left join rdb$character_sets cs ON coll.rdb$character_set_id = cs.rdb$character_set_id"\r
-                               );\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* COLLATION_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* COLLATION_SCHEMA     */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* COLLATION_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "coll.rdb$collation_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY cs.rdb$character_set_name, coll.rdb$collation_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Globalization;
+using System.Data;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbCollations : FbDbSchema
+       {
+               #region Constructors
+
+               public FbCollations() : base("Collations")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS COLLATION_CATALOG, " +
+                                       "null AS COLLATION_SCHEMA, " +
+                                       "coll.rdb$collation_name AS COLLATION_NAME, " +
+                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +
+                                       "coll.rdb$description AS DESCRIPTION " +
+                               "FROM rdb$collations coll " +
+                                       "left join rdb$character_sets cs ON coll.rdb$character_set_id = cs.rdb$character_set_id"
+                               );
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* COLLATION_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* COLLATION_SCHEMA     */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* COLLATION_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "coll.rdb$collation_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY cs.rdb$character_set_name, coll.rdb$collation_name");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 10a048d0e0341af94c61a3c5bfb32abf2d3b7846..851339b2e2684f2068cf878095a69696e52b7661 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbColumnPrivileges : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbColumnPrivileges() : base("ColumnPrivileges")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rdb$relation_name AS TABLE_NAME, " +\r
-                                       "rdb$field_name AS COLUMN_NAME, " +\r
-                                       "rdb$user AS GRANTEE, " +\r
-                                       "rdb$grantor AS GRANTOR, " +\r
-                                       "rdb$privilege AS PRIVILEGE, " +\r
-                                       "rdb$grant_option AS WITH_GRANT " +\r
-                               "FROM " +\r
-                                       "rdb$user_privileges");\r
-\r
-                       where.Append("rdb$object_type = 0");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* COLUMN_NAME */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$field_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTOR */\r
-                               if (restrictions.Length >= 6 && restrictions[5] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$grantor = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTEE */\r
-                               if (restrictions.Length >= 5 && restrictions[4] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$user = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$relation_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbColumnPrivileges : FbDbSchema
+       {
+               #region Constructors
+
+               public FbColumnPrivileges() : base("ColumnPrivileges")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rdb$relation_name AS TABLE_NAME, " +
+                                       "rdb$field_name AS COLUMN_NAME, " +
+                                       "rdb$user AS GRANTEE, " +
+                                       "rdb$grantor AS GRANTOR, " +
+                                       "rdb$privilege AS PRIVILEGE, " +
+                                       "rdb$grant_option AS WITH_GRANT " +
+                               "FROM " +
+                                       "rdb$user_privileges");
+
+                       where.Append("rdb$object_type = 0");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* COLUMN_NAME */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$field_name = @p{0}", index++);
+                               }
+
+                               /* GRANTOR */
+                               if (restrictions.Length >= 6 && restrictions[5] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$grantor = @p{0}", index++);
+                               }
+
+                               /* GRANTEE */
+                               if (restrictions.Length >= 5 && restrictions[4] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$user = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$relation_name");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index b50a861ac244aa65b1bcc587711de2236631750f..f3caf462a7d8e0fc92bb91fdb74f953fd8beb604 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbColumns : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbColumns() : base("Columns")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rfr.rdb$relation_name AS TABLE_NAME, " +\r
-                                       "rfr.rdb$field_name AS COLUMN_NAME, " +\r
-                                       "null AS COLUMN_DATA_TYPE, " +\r
-                                       "fld.rdb$field_sub_type AS COLUMN_SUB_TYPE, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS COLUMN_SIZE, " +\r
-                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +\r
-                                       "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " +\r
-                                       "cast(fld.rdb$character_length AS integer) AS CHARACTER_LENGTH, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +\r
-                                       "rfr.rdb$field_position AS ORDINAL_POSITION, " +\r
-                                       "null AS DOMAIN_CATALOG, " +\r
-                                       "null AS DOMAIN_SCHEMA, " +\r
-                                       "rfr.rdb$field_source AS DOMAIN_NAME, " +\r
-                                       "fld.rdb$default_source AS COLUMN_DEFAULT, " +\r
-                                       "fld.rdb$computed_source AS COMPUTED_SOURCE, " +\r
-                                       "fld.rdb$dimensions AS IS_ARRAY, " +\r
-                                       "rfr.rdb$null_flag AS IS_NULLABLE, " +\r
-                                       "0 AS IS_READONLY, " +\r
-                                       "fld.rdb$field_type AS FIELD_TYPE, " +\r
-                                       "null AS CHARACTER_SET_CATALOG, " +\r
-                                       "null AS CHARACTER_SET_SCHEMA, " +\r
-                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +\r
-                                       "null AS COLLATION_CATALOG, " +\r
-                                       "null AS COLLATION_SCHEMA, " +\r
-                                       "coll.rdb$collation_name AS COLLATION_NAME, " +\r
-                                       "rfr.rdb$description AS DESCRIPTION " +\r
-                               "FROM " +\r
-                                       "rdb$relation_fields rfr " +\r
-                                       "left join rdb$fields fld ON rfr.rdb$field_source = fld.rdb$field_name " +\r
-                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +\r
-                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rfr.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* COLUMN_NAME */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rfr.rdb$field_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rfr.rdb$relation_name, rfr.rdb$field_position");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);\r
-\r
-                               int subType = 0;\r
-                               if (row["COLUMN_SUB_TYPE"] != System.DBNull.Value)\r
-                               {\r
-                                       subType = Convert.ToInt32(row["COLUMN_SUB_TYPE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               int scale = 0;\r
-                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)\r
-                               {\r
-                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               if (row["IS_NULLABLE"] == DBNull.Value)\r
-                               {\r
-                                       row["IS_NULLABLE"] = true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_NULLABLE"] = false;\r
-                               }\r
-\r
-                               if (row["IS_ARRAY"] == DBNull.Value)\r
-                               {\r
-                                       row["IS_ARRAY"] = false;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_ARRAY"] = true;\r
-                               }\r
-\r
-                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);\r
-                               row["COLUMN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);\r
-\r
-                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)\r
-                               {\r
-                                       row["COLUMN_SIZE"] = Int32.MaxValue;\r
-                               }\r
-\r
-                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)\r
-                               {\r
-                                       row["COLUMN_SIZE"] = row["CHARACTER_LENGTH"];\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["CHARACTER_OCTET_LENGTH"] = 0;\r
-                               }\r
-\r
-                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&\r
-                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))\r
-                               {\r
-                                       row["NUMERIC_PRECISION"] = row["COLUMN_SIZE"];\r
-                               }\r
-\r
-                               row["NUMERIC_SCALE"] = (-1) * scale;\r
-\r
-                               string domainName = row["DOMAIN_NAME"].ToString();\r
-                               if (domainName != null && domainName.StartsWith("RDB$"))\r
-                               {\r
-                                       row["DOMAIN_NAME"] = null;\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       // Remove not more needed columns\r
-                       schema.Columns.Remove("FIELD_TYPE");\r
-                       schema.Columns.Remove("CHARACTER_LENGTH");\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbColumns : FbDbSchema
+       {
+               #region Constructors
+
+               public FbColumns() : base("Columns")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rfr.rdb$relation_name AS TABLE_NAME, " +
+                                       "rfr.rdb$field_name AS COLUMN_NAME, " +
+                                       "null AS COLUMN_DATA_TYPE, " +
+                                       "fld.rdb$field_sub_type AS COLUMN_SUB_TYPE, " +
+                                       "cast(fld.rdb$field_length AS integer) AS COLUMN_SIZE, " +
+                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +
+                                       "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " +
+                                       "cast(fld.rdb$character_length AS integer) AS \"CHARACTER_LENGTH\", " +
+                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +
+                                       "rfr.rdb$field_position AS ORDINAL_POSITION, " +
+                                       "null AS DOMAIN_CATALOG, " +
+                                       "null AS DOMAIN_SCHEMA, " +
+                                       "rfr.rdb$field_source AS DOMAIN_NAME, " +
+                                       "rfr.rdb$default_source AS COLUMN_DEFAULT, " +
+                                       "fld.rdb$computed_source AS COMPUTED_SOURCE, " +
+                                       "fld.rdb$dimensions AS IS_ARRAY, " +
+                                       "rfr.rdb$null_flag AS IS_NULLABLE, " +
+                                       "0 AS IS_READONLY, " +
+                                       "fld.rdb$field_type AS FIELD_TYPE, " +
+                                       "null AS CHARACTER_SET_CATALOG, " +
+                                       "null AS CHARACTER_SET_SCHEMA, " +
+                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +
+                                       "null AS COLLATION_CATALOG, " +
+                                       "null AS COLLATION_SCHEMA, " +
+                                       "coll.rdb$collation_name AS COLLATION_NAME, " +
+                                       "rfr.rdb$description AS DESCRIPTION " +
+                               "FROM " +
+                                       "rdb$relation_fields rfr " +
+                                       "left join rdb$fields fld ON rfr.rdb$field_source = fld.rdb$field_name " +
+                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +
+                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rfr.rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* COLUMN_NAME */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rfr.rdb$field_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rfr.rdb$relation_name, rfr.rdb$field_position");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);
+
+                               int subType = 0;
+                               if (row["COLUMN_SUB_TYPE"] != System.DBNull.Value)
+                               {
+                                       subType = Convert.ToInt32(row["COLUMN_SUB_TYPE"], CultureInfo.InvariantCulture);
+                               }
+
+                               int scale = 0;
+                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)
+                               {
+                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);
+                               }
+
+                               if (row["IS_NULLABLE"] == DBNull.Value)
+                               {
+                                       row["IS_NULLABLE"] = true;
+                               }
+                               else
+                               {
+                                       row["IS_NULLABLE"] = false;
+                               }
+
+                               if (row["IS_ARRAY"] == DBNull.Value)
+                               {
+                                       row["IS_ARRAY"] = false;
+                               }
+                               else
+                               {
+                                       row["IS_ARRAY"] = true;
+                               }
+
+                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);
+                               row["COLUMN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);
+
+                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)
+                               {
+                                       row["COLUMN_SIZE"] = Int32.MaxValue;
+                               }
+
+                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)
+                               {
+                                       row["COLUMN_SIZE"] = row["CHARACTER_LENGTH"];
+                               }
+                               else
+                               {
+                                       row["CHARACTER_OCTET_LENGTH"] = 0;
+                               }
+
+                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&
+                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))
+                               {
+                                       row["NUMERIC_PRECISION"] = row["COLUMN_SIZE"];
+                               }
+
+                               row["NUMERIC_SCALE"] = (-1) * scale;
+
+                               string domainName = row["DOMAIN_NAME"].ToString();
+                               if (domainName != null && domainName.StartsWith("RDB$"))
+                               {
+                                       row["DOMAIN_NAME"] = null;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       // Remove not more needed columns
+                       schema.Columns.Remove("FIELD_TYPE");
+                       schema.Columns.Remove("CHARACTER_LENGTH");
+
+                       return schema;
+               }
+
+               #endregion
+       }
+}
index 5d1a0b4744ef43fd2d3389583b267acaf3752dcc..402d0b277bf028cd0f76ac6d41ee100b325b15ec 100644 (file)
@@ -1,84 +1,84 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbDataTypes\r
-       {\r
-               #region Constructors\r
-\r
-               private FbDataTypes()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               public static DataTable GetSchema()\r
-               {\r
-                       DataTable table = new DataTable("DataTypes");\r
-\r
-                       table.Columns.Add("TypeName", typeof(System.String));\r
-                       table.Columns.Add("DbType", typeof(System.Int32));\r
-                       table.Columns.Add("ProviderDbType", typeof(System.Int32));\r
-                       table.Columns.Add("ColumnSize", typeof(System.Int64));\r
-                       table.Columns.Add("CreateFormat", typeof(System.String));\r
-                       table.Columns.Add("CreateParameters", typeof(System.String));\r
-                       table.Columns.Add("DataType", typeof(System.String));\r
-                       table.Columns.Add("IsAutoIncrementable", typeof(System.Boolean));\r
-                       table.Columns.Add("IsBestMatch", typeof(System.Boolean));\r
-                       table.Columns.Add("IsCaseSensitive", typeof(System.Boolean));\r
-                       table.Columns.Add("IsFixedLength", typeof(System.Boolean));\r
-                       table.Columns.Add("IsFixedPrecisionScale", typeof(System.Boolean));\r
-                       table.Columns.Add("IsLong", typeof(System.Boolean));\r
-                       table.Columns.Add("IsNullable", typeof(System.Boolean));\r
-                       table.Columns.Add("IsSearchable", typeof(System.Boolean));\r
-                       table.Columns.Add("IsSearchableWithLike", typeof(System.Boolean));\r
-                       table.Columns.Add("IsUnsigned", typeof(System.Boolean));\r
-                       table.Columns.Add("MaximumScale", typeof(System.Int16));\r
-                       table.Columns.Add("MinimumScale", typeof(System.Int16));\r
-                       table.Columns.Add("IsConcurrencyType", typeof(System.Boolean));\r
-                       table.Columns.Add("IsLiteralSupported", typeof(System.Boolean));\r
-                       table.Columns.Add("LiteralPrefix", typeof(System.String));\r
-                       table.Columns.Add("LiteralSuffix", typeof(System.String));\r
-\r
-                       DataRowCollection r = table.Rows;\r
-\r
-                       r.Add(new object[] { "array", DbType.Object, FbDbType.Array, Int32.MaxValue, "", "", "System.Array", false, false, false, false, false, true, true, false, false, false, 0, 0, false, false, null, null });\r
-                       r.Add(new object[] { "bigint", DbType.Int64, FbDbType.BigInt, 8, "", "", "System.Int64", false, false, false, true, true, false, true, true, true, false, 0, 0, false, false, null, null });\r
-                       r.Add(new object[] { "blob", DbType.Binary, FbDbType.Binary, Int32.MaxValue, "", "", "System.Byte[]", false, false, false, false, false, true, true, false, false, false, 0, 0, false, false, null, null });\r
-                       r.Add(new object[] { "blob sub_type 1", DbType.String, FbDbType.Text, Int32.MaxValue, "", "", "System.String", false, false, true, true, false, true, true, true, true, false, 0, 0, false, true, "'", "'" });\r
-                       r.Add(new object[] { "char", DbType.StringFixedLength, FbDbType.Char, Int16.MaxValue, "", "length", "System.String", false, false, true, false, false, false, true, true, true, false, 0, 0, false, true, "'", "'" });\r
-                       r.Add(new object[] { "date", DbType.Date, FbDbType.Date, 4, "", "", "System.DateTime", false, false, false, true, false, false, true, true, true, false, 0, 0, false, null, null });\r
-                       r.Add(new object[] { "decimal", DbType.Decimal, FbDbType.Decimal, 0, "", "precision,scale", "System.Decimal", false, false, false, true, false, false, true, true, true, false, 18, 0, false, null, null });\r
-                       r.Add(new object[] { "double precision", DbType.Double, FbDbType.Double, 8, "", "", "System.Double", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });\r
-                       r.Add(new object[] { "float", DbType.Single, FbDbType.Float, 4, "", "", "System.Float", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });\r
-                       r.Add(new object[] { "integer", DbType.Int32, FbDbType.Integer, 4, "", "", "System.Int32", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });\r
-                       r.Add(new object[] { "numeric", DbType.Decimal, FbDbType.Numeric, 0, "", "precision,scale", "System.Decimal", false, false, false, true, false, false, true, true, true, false, 18, 0, false, null, null });\r
-                       r.Add(new object[] { "smallint", DbType.Int16, FbDbType.SmallInt, 2, "", "", "System.Int16", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });\r
-                       r.Add(new object[] { "time", DbType.Time, FbDbType.Time, 4, "", "", "System.DateTime", false, false, false, true, false, false, true, true, true, false, 0, 0, false, null, null });\r
-                       r.Add(new object[] { "timestamp", DbType.DateTime, FbDbType.TimeStamp, 8, "", "", "System.DateTime", false, false, false, true, false, false, true, true, true, false, 0, 0, false, null, null });\r
-                       r.Add(new object[] { "varchar", DbType.String, FbDbType.VarChar, Int16.MaxValue, "", "length", "System.String", false, false, true, false, false, false, true, true, true, false, 0, 0, false, true, "'", "'" });\r
-\r
-                       return table;\r
-               }\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbDataTypes
+       {
+               #region Constructors
+
+               private FbDataTypes()
+               {
+               }
+
+               #endregion
+
+               public static DataTable GetSchema()
+               {
+                       DataTable table = new DataTable("DataTypes");
+
+                       table.Columns.Add("TypeName", typeof(System.String));
+                       table.Columns.Add("DbType", typeof(System.Int32));
+                       table.Columns.Add("ProviderDbType", typeof(System.Int32));
+                       table.Columns.Add("ColumnSize", typeof(System.Int64));
+                       table.Columns.Add("CreateFormat", typeof(System.String));
+                       table.Columns.Add("CreateParameters", typeof(System.String));
+                       table.Columns.Add("DataType", typeof(System.String));
+                       table.Columns.Add("IsAutoIncrementable", typeof(System.Boolean));
+                       table.Columns.Add("IsBestMatch", typeof(System.Boolean));
+                       table.Columns.Add("IsCaseSensitive", typeof(System.Boolean));
+                       table.Columns.Add("IsFixedLength", typeof(System.Boolean));
+                       table.Columns.Add("IsFixedPrecisionScale", typeof(System.Boolean));
+                       table.Columns.Add("IsLong", typeof(System.Boolean));
+                       table.Columns.Add("IsNullable", typeof(System.Boolean));
+                       table.Columns.Add("IsSearchable", typeof(System.Boolean));
+                       table.Columns.Add("IsSearchableWithLike", typeof(System.Boolean));
+                       table.Columns.Add("IsUnsigned", typeof(System.Boolean));
+                       table.Columns.Add("MaximumScale", typeof(System.Int16));
+                       table.Columns.Add("MinimumScale", typeof(System.Int16));
+                       table.Columns.Add("IsConcurrencyType", typeof(System.Boolean));
+                       table.Columns.Add("IsLiteralSupported", typeof(System.Boolean));
+                       table.Columns.Add("LiteralPrefix", typeof(System.String));
+                       table.Columns.Add("LiteralSuffix", typeof(System.String));
+
+                       DataRowCollection r = table.Rows;
+
+                       r.Add(new object[] { "array", DbType.Object, FbDbType.Array, Int32.MaxValue, "", "", "System.Array", false, false, false, false, false, true, true, false, false, false, 0, 0, false, false, null, null });
+                       r.Add(new object[] { "bigint", DbType.Int64, FbDbType.BigInt, 8, "", "", "System.Int64", false, false, false, true, true, false, true, true, true, false, 0, 0, false, false, null, null });
+                       r.Add(new object[] { "blob", DbType.Binary, FbDbType.Binary, Int32.MaxValue, "", "", "System.Byte[]", false, false, false, false, false, true, true, false, false, false, 0, 0, false, false, null, null });
+                       r.Add(new object[] { "blob sub_type 1", DbType.String, FbDbType.Text, Int32.MaxValue, "", "", "System.String", false, false, true, true, false, true, true, true, true, false, 0, 0, false, true, "'", "'" });
+                       r.Add(new object[] { "char", DbType.StringFixedLength, FbDbType.Char, Int16.MaxValue, "", "length", "System.String", false, false, true, false, false, false, true, true, true, false, 0, 0, false, true, "'", "'" });
+                       r.Add(new object[] { "date", DbType.Date, FbDbType.Date, 4, "", "", "System.DateTime", false, false, false, true, false, false, true, true, true, false, 0, 0, false, null, null });
+                       r.Add(new object[] { "decimal", DbType.Decimal, FbDbType.Decimal, 0, "", "precision,scale", "System.Decimal", false, false, false, true, false, false, true, true, true, false, 18, 0, false, null, null });
+                       r.Add(new object[] { "double precision", DbType.Double, FbDbType.Double, 8, "", "", "System.Double", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });
+                       r.Add(new object[] { "float", DbType.Single, FbDbType.Float, 4, "", "", "System.Float", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });
+                       r.Add(new object[] { "integer", DbType.Int32, FbDbType.Integer, 4, "", "", "System.Int32", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });
+                       r.Add(new object[] { "numeric", DbType.Decimal, FbDbType.Numeric, 0, "", "precision,scale", "System.Decimal", false, false, false, true, false, false, true, true, true, false, 18, 0, false, null, null });
+                       r.Add(new object[] { "smallint", DbType.Int16, FbDbType.SmallInt, 2, "", "", "System.Int16", false, false, false, true, true, false, true, true, true, false, 0, 0, false, null, null });
+                       r.Add(new object[] { "time", DbType.Time, FbDbType.Time, 4, "", "", "System.DateTime", false, false, false, true, false, false, true, true, true, false, 0, 0, false, null, null });
+                       r.Add(new object[] { "timestamp", DbType.DateTime, FbDbType.TimeStamp, 8, "", "", "System.DateTime", false, false, false, true, false, false, true, true, true, false, 0, 0, false, null, null });
+                       r.Add(new object[] { "varchar", DbType.String, FbDbType.VarChar, Int16.MaxValue, "", "length", "System.String", false, false, true, false, false, false, true, true, true, false, 0, 0, false, true, "'", "'" });
+
+                       return table;
+               }
+       }
 }
\ No newline at end of file
index 5b354063c53858da4be232c406dd3dc9fe5dcaea..48bd7d059fbe3d5b349bd850050d0c60d189da18 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-using System.Text.RegularExpressions;\r
-using System.Collections;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal abstract class FbDbSchema\r
-       {\r
-               #region Fields\r
-\r
-               private string schemaName;\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public FbDbSchema(string schemaName)\r
-               {\r
-                       this.schemaName = schemaName;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Abstract Methods\r
-\r
-               protected abstract StringBuilder GetCommandText(object[] restrictions);\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public virtual DataTable GetSchema(FbConnection connection, object[] restrictions)\r
-               {\r
-                       restrictions = this.ParseRestrictions(restrictions);\r
-\r
-                       FbCommand               command = this.BuildCommand(connection, restrictions);\r
-                       FbDataAdapter   adapter = new FbDataAdapter(command);\r
-                       DataSet                 dataSet = new DataSet(this.schemaName);\r
-\r
-                       try\r
-                       {\r
-                               adapter.Fill(dataSet, this.schemaName);\r
-                       }\r
-                       catch (Exception ex)\r
-                       {\r
-                               throw new FbException(ex.Message);\r
-                       }\r
-                       finally\r
-                       {\r
-                               adapter.Dispose();\r
-                               command.Dispose();\r
-                       }\r
-\r
-                       TrimStringFields(dataSet.Tables[this.schemaName]);\r
-\r
-                       return this.ProcessResult(dataSet.Tables[this.schemaName]);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected FbCommand BuildCommand(FbConnection connection, object[] restrictions)\r
-               {\r
-                       DataView collections = FbMetaDataCollections.GetSchema().DefaultView;\r
-                       collections.RowFilter = "CollectionName = '" + this.schemaName + "'";\r
-\r
-                       if (collections.Count == 0)\r
-                       {\r
-                               throw new NotSupportedException("Unsupported collection name.");\r
-                       }\r
-\r
-                       if (restrictions != null &&\r
-                               restrictions.Length > (int)collections[0]["NumberOfRestrictions"])\r
-                       {\r
-                               throw new InvalidOperationException("The number of specified restrictions is not valid.");\r
-                       }\r
-\r
-                       DataView restriction = FbRestrictions.GetSchema().DefaultView;\r
-                       restriction.RowFilter = "CollectionName = '" + this.schemaName + "'";\r
-\r
-                       if (restriction.Count != (int)collections[0]["NumberOfRestrictions"])\r
-                       {\r
-                               throw new InvalidOperationException("Incorrect restriction definitions.");\r
-                       }\r
-\r
-                       StringBuilder builder = this.GetCommandText(restrictions);\r
-                       FbCommand schema = connection.CreateCommand();\r
-\r
-                       schema.CommandText = builder.ToString();\r
-\r
-                       if (connection.InnerConnection.HasActiveTransaction)\r
-                       {\r
-                               schema.Transaction = connection.InnerConnection.ActiveTransaction;\r
-                       }\r
-\r
-                       if (restrictions != null && restrictions.Length > 0)\r
-                       {\r
-                               // Add parameters\r
-                               int index = 0;\r
-\r
-                               for (int i = 0; i < restrictions.Length; i++)\r
-                               {\r
-                                       string rname = restriction[i]["RestrictionDefault"].ToString().ToLower(CultureInfo.CurrentCulture);\r
-                                       if (restrictions[i] != null &&\r
-                                               !rname.EndsWith("_catalog") &&\r
-                                               !rname.EndsWith("_schema") &&\r
-                                               rname != "table_type")\r
-                                       {\r
-                                               string pname = String.Format(CultureInfo.CurrentCulture, "@p{0}", index++);\r
-\r
-                                               FbParameter p = schema.Parameters.Add(pname, restrictions[i].ToString());\r
-                                               p.FbDbType = FbDbType.VarChar;\r
-                                               p.Size = 255;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return schema;\r
-               }\r
-\r
-               protected virtual DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       return schema;\r
-               }\r
-\r
-               protected virtual object[] ParseRestrictions(object[] restrictions)\r
-               {\r
-                       return restrictions;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Static Methods\r
-\r
-               private static void TrimStringFields(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               for (int i = 0; i < schema.Columns.Count; i++)\r
-                               {\r
-                                       if (schema.Columns[i].DataType == typeof(System.String))\r
-                                       {\r
-                                               row[schema.Columns[i]] = row[schema.Columns[i]].ToString().Trim();\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal abstract class FbDbSchema
+       {
+               #region Fields
+
+               private string schemaName;
+
+               #endregion
+
+               #region Constructors
+
+               public FbDbSchema(string schemaName)
+               {
+                       this.schemaName = schemaName;
+               }
+
+               #endregion
+
+               #region Abstract Methods
+
+               protected abstract StringBuilder GetCommandText(object[] restrictions);
+
+               #endregion
+
+               #region Methods
+
+               public virtual DataTable GetSchema(FbConnection connection, object[] restrictions)
+               {
+                       restrictions = this.ParseRestrictions(restrictions);
+
+                       FbCommand               command = this.BuildCommand(connection, restrictions);
+                       FbDataAdapter   adapter = new FbDataAdapter(command);
+                       DataSet                 dataSet = new DataSet(this.schemaName);
+
+                       try
+                       {
+                               adapter.Fill(dataSet, this.schemaName);
+                       }
+                       catch (Exception ex)
+                       {
+                               throw new FbException(ex.Message);
+                       }
+                       finally
+                       {
+                               adapter.Dispose();
+                               command.Dispose();
+                       }
+
+                       TrimStringFields(dataSet.Tables[this.schemaName]);
+
+                       return this.ProcessResult(dataSet.Tables[this.schemaName]);
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected FbCommand BuildCommand(FbConnection connection, object[] restrictions)
+               {
+                       DataView collections = FbMetaDataCollections.GetSchema().DefaultView;
+                       collections.RowFilter = "CollectionName = '" + this.schemaName + "'";
+
+                       if (collections.Count == 0)
+                       {
+                               throw new NotSupportedException("Unsupported collection name.");
+                       }
+
+                       if (restrictions != null &&
+                               restrictions.Length > (int)collections[0]["NumberOfRestrictions"])
+                       {
+                               throw new InvalidOperationException("The number of specified restrictions is not valid.");
+                       }
+
+                       DataView restriction = FbRestrictions.GetSchema().DefaultView;
+                       restriction.RowFilter = "CollectionName = '" + this.schemaName + "'";
+
+                       if (restriction.Count != (int)collections[0]["NumberOfRestrictions"])
+                       {
+                               throw new InvalidOperationException("Incorrect restriction definitions.");
+                       }
+
+                       StringBuilder builder = this.GetCommandText(restrictions);
+                       FbCommand schema = connection.CreateCommand();
+
+                       schema.CommandText = builder.ToString();
+
+                       if (connection.InnerConnection.HasActiveTransaction)
+                       {
+                               schema.Transaction = connection.InnerConnection.ActiveTransaction;
+                       }
+
+                       if (restrictions != null && restrictions.Length > 0)
+                       {
+                               // Add parameters
+                               int index = 0;
+
+                               for (int i = 0; i < restrictions.Length; i++)
+                               {
+                                       string rname = restriction[i]["RestrictionDefault"].ToString().ToLower(CultureInfo.CurrentCulture);
+                                       if (restrictions[i] != null &&
+                                               !rname.EndsWith("_catalog") &&
+                                               !rname.EndsWith("_schema") &&
+                                               rname != "table_type")
+                                       {
+                                               string pname = String.Format(CultureInfo.CurrentCulture, "@p{0}", index++);
+
+                                               FbParameter p = schema.Parameters.Add(pname, restrictions[i].ToString());
+                                               p.FbDbType = FbDbType.VarChar;
+                                               p.Size = 255;
+                                       }
+                               }
+                       }
+
+                       return schema;
+               }
+
+               protected virtual DataTable ProcessResult(DataTable schema)
+               {
+                       return schema;
+               }
+
+               protected virtual object[] ParseRestrictions(object[] restrictions)
+               {
+                       return restrictions;
+               }
+
+               #endregion
+
+               #region Private Static Methods
+
+               private static void TrimStringFields(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               for (int i = 0; i < schema.Columns.Count; i++)
+                               {
+                                       if (schema.Columns[i].DataType == typeof(System.String))
+                                       {
+                                               row[schema.Columns[i]] = row[schema.Columns[i]].ToString().Trim();
+                                       }
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+               }
+
+               #endregion
+       }
+}
index 36668df513f2a2a849f2081d6b7063e35391f701..54b83a9673dc3c9b214a3b5190bf6aac302babae 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbDbSchemaFactory\r
-       {\r
-               #region Constructors\r
-\r
-               private FbDbSchemaFactory()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public static DataTable GetSchema(\r
-                       FbConnection connection,\r
-                       string collectionName,\r
-                       object[] restrictions)\r
-               {\r
-                       FbDbSchema returnSchema = null;\r
-\r
-                       switch (collectionName.ToLower(CultureInfo.CurrentCulture))\r
-                       {\r
-                               case "charactersets":\r
-                                       returnSchema = new FbCharacterSets();\r
-                                       break;\r
-\r
-                               case "checkconstraints":\r
-                                       returnSchema = new FbCheckConstraints();\r
-                                       break;\r
-\r
-                               case "checkconstraintsbytable":\r
-                                       returnSchema = new FbChecksByTable();\r
-                                       break;\r
-\r
-                               case "collations":\r
-                                       returnSchema = new FbCollations();\r
-                                       break;\r
-\r
-                               case "columns":\r
-                                       returnSchema = new FbColumns();\r
-                                       break;\r
-\r
-                               case "columnprivileges":\r
-                                       returnSchema = new FbColumnPrivileges();\r
-                                       break;\r
-\r
-                               case "datatypes":\r
-                                       return FbDataTypes.GetSchema();\r
-\r
-                               case "domains":\r
-                                       returnSchema = new FbDomains();\r
-                                       break;\r
-\r
-                               case "foreignkeys":\r
-                                       returnSchema = new FbForeignKeys();\r
-                                       break;\r
-\r
-                               case "functions":\r
-                                       returnSchema = new FbFunctions();\r
-                                       break;\r
-\r
-                               case "generators":\r
-                                       returnSchema = new FbGenerators();\r
-                                       break;\r
-\r
-                               case "indexes":\r
-                                       returnSchema = new FbIndexes();\r
-                                       break;\r
-\r
-                               case "metadatacollections":\r
-                                       return FbMetaDataCollections.GetSchema();\r
-\r
-                               case "primarykeys":\r
-                                       returnSchema = new FbPrimaryKeys();\r
-                                       break;\r
-\r
-                               case "procedures":\r
-                                       returnSchema = new FbProcedures();\r
-                                       break;\r
-\r
-                               case "procedureparameters":\r
-                                       returnSchema = new FbProcedureParameters();\r
-                                       break;\r
-\r
-                               case "procedureprivileges":\r
-                                       returnSchema = new FbProcedurePrivilegesSchema();\r
-                                       break;\r
-\r
-                               case "restrictions":\r
-                                       return FbRestrictions.GetSchema();\r
-\r
-                               case "roles":\r
-                                       returnSchema = new FbRoles();\r
-                                       break;\r
-\r
-                               case "tables":\r
-                                       returnSchema = new FbTables();\r
-                                       break;\r
-\r
-                               case "tableconstraints":\r
-                                       returnSchema = new FbTableConstraints();\r
-                                       break;\r
-\r
-                               case "tableprivileges":\r
-                                       returnSchema = new FbTablePrivileges();\r
-                                       break;\r
-\r
-                               case "triggers":\r
-                                       returnSchema = new FbTriggers();\r
-                                       break;\r
-\r
-                               case "uniquekeys":\r
-                                       returnSchema = new FbUniqueKeys();\r
-                                       break;\r
-\r
-                               case "viewcolumnusage":\r
-                                       returnSchema = new FbViewColumnUsage();\r
-                                       break;\r
-\r
-                               case "views":\r
-                                       returnSchema = new FbViews();\r
-                                       break;\r
-\r
-                               case "viewprivileges":\r
-                                       returnSchema = new FbViewPrivileges();\r
-                                       break;\r
-\r
-                               default:\r
-                                       throw new NotSupportedException("The specified metadata collection is not supported.");\r
-                       }\r
-\r
-                       return returnSchema.GetSchema(connection, restrictions);\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbDbSchemaFactory
+       {
+               #region Constructors
+
+               private FbDbSchemaFactory()
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               public static DataTable GetSchema(
+                       FbConnection connection,
+                       string collectionName,
+                       object[] restrictions)
+               {
+                       FbDbSchema returnSchema = null;
+
+                       switch (collectionName.ToLower(CultureInfo.CurrentCulture))
+                       {
+                               case "charactersets":
+                                       returnSchema = new FbCharacterSets();
+                                       break;
+
+                               case "checkconstraints":
+                                       returnSchema = new FbCheckConstraints();
+                                       break;
+
+                               case "checkconstraintsbytable":
+                                       returnSchema = new FbChecksByTable();
+                                       break;
+
+                               case "collations":
+                                       returnSchema = new FbCollations();
+                                       break;
+
+                               case "columns":
+                                       returnSchema = new FbColumns();
+                                       break;
+
+                               case "columnprivileges":
+                                       returnSchema = new FbColumnPrivileges();
+                                       break;
+
+                               case "datatypes":
+                                       return FbDataTypes.GetSchema();
+
+                               case "domains":
+                                       returnSchema = new FbDomains();
+                                       break;
+
+                               case "foreignkeys":
+                                       returnSchema = new FbForeignKeys();
+                                       break;
+
+                               case "functions":
+                                       returnSchema = new FbFunctions();
+                                       break;
+
+                               case "generators":
+                                       returnSchema = new FbGenerators();
+                                       break;
+
+                               case "indexes":
+                                       returnSchema = new FbIndexes();
+                                       break;
+
+                               case "metadatacollections":
+                                       return FbMetaDataCollections.GetSchema();
+
+                               case "primarykeys":
+                                       returnSchema = new FbPrimaryKeys();
+                                       break;
+
+                               case "procedures":
+                                       returnSchema = new FbProcedures();
+                                       break;
+
+                               case "procedureparameters":
+                                       returnSchema = new FbProcedureParameters();
+                                       break;
+
+                               case "procedureprivileges":
+                                       returnSchema = new FbProcedurePrivilegesSchema();
+                                       break;
+
+                               case "restrictions":
+                                       return FbRestrictions.GetSchema();
+
+                               case "roles":
+                                       returnSchema = new FbRoles();
+                                       break;
+
+                               case "tables":
+                                       returnSchema = new FbTables();
+                                       break;
+
+                               case "tableconstraints":
+                                       returnSchema = new FbTableConstraints();
+                                       break;
+
+                               case "tableprivileges":
+                                       returnSchema = new FbTablePrivileges();
+                                       break;
+
+                               case "triggers":
+                                       returnSchema = new FbTriggers();
+                                       break;
+
+                               case "uniquekeys":
+                                       returnSchema = new FbUniqueKeys();
+                                       break;
+
+                               case "viewcolumnusage":
+                                       returnSchema = new FbViewColumnUsage();
+                                       break;
+
+                               case "views":
+                                       returnSchema = new FbViews();
+                                       break;
+
+                               case "viewprivileges":
+                                       returnSchema = new FbViewPrivileges();
+                                       break;
+
+                               default:
+                                       throw new NotSupportedException("The specified metadata collection is not supported.");
+                       }
+
+                       return returnSchema.GetSchema(connection, restrictions);
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index cc35ac333ca87739998e8cbcc3bc6fc31087afaa..1b2b798a140e2c641c397cee583c1d4353a3de4d 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbDomains : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbDomains() : base("Domains")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS DOMAIN_CATALOG, " +\r
-                                       "null AS DOMAIN_SCHEMA, " +\r
-                                       "fld.rdb$field_name AS DOMAIN_NAME, " +\r
-                                       "null AS DOMAIN_DATA_TYPE, " +\r
-                                       "rdb$field_sub_type AS DOMAIN_SUB_TYPE, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS DOMAIN_SIZE, " +\r
-                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +\r
-                                       "cast(fld.rdb$field_scale  AS integer) AS NUMERIC_SCALE, " +\r
-                                       "cast(fld.rdb$character_length AS integer) AS CHARACTER_LENGTH, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +\r
-                                       "fld.rdb$null_flag AS IS_NULLABLE, " +\r
-                                       "fld.rdb$dimensions AS ARRAY_DIMENSIONS, " +\r
-                                       "fld.rdb$description AS DESCRIPTION, " +\r
-                                       "fld.rdb$field_type AS FIELD_TYPE, " +\r
-                                       "null AS CHARACTER_SET_CATALOG, " +\r
-                                       "null AS CHARACTER_SET_SCHEMA, " +\r
-                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +\r
-                                       "null AS COLLATION_CATALOG, " +\r
-                                       "null AS COLLATION_SCHEMA, " +\r
-                                       "coll.rdb$collation_name AS COLLATION_NAME " +\r
-                               "FROM " +\r
-                                       "rdb$fields fld " +\r
-                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +\r
-                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)");\r
-\r
-                       where.Append("not rdb$field_name starting with 'RDB$'");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* DOMAIN_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* DOMAIN_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* DOMAIN_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$field_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$field_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);\r
-\r
-                               int subType = 0;\r
-                               if (row["DOMAIN_SUB_TYPE"] != System.DBNull.Value)\r
-                               {\r
-                                       subType = Convert.ToInt32(row["DOMAIN_SUB_TYPE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               int scale = 0;\r
-                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)\r
-                               {\r
-                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);\r
-                               row["DOMAIN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);\r
-\r
-                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)\r
-                               {\r
-                                       row["DOMAIN_SIZE"] = row["CHARACTER_LENGTH"];\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["CHARACTER_OCTET_LENGTH"] = 0;\r
-                               }\r
-\r
-                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)\r
-                               {\r
-                                       row["DOMAIN_SIZE"] = Int32.MaxValue;\r
-                               }\r
-\r
-                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&\r
-                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))\r
-                               {\r
-                                       row["NUMERIC_PRECISION"] = row["DOMAIN_SIZE"];\r
-                               }\r
-\r
-                               row["NUMERIC_SCALE"] = (-1) * scale;\r
-\r
-                               if (row["IS_NULLABLE"] == DBNull.Value)\r
-                               {\r
-                                       row["IS_NULLABLE"] = true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_NULLABLE"] = false;\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       // Remove not more needed columns\r
-                       schema.Columns.Remove("FIELD_TYPE");\r
-                       schema.Columns.Remove("CHARACTER_LENGTH");\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbDomains : FbDbSchema
+       {
+               #region Constructors
+
+               public FbDomains() : base("Domains")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS DOMAIN_CATALOG, " +
+                                       "null AS DOMAIN_SCHEMA, " +
+                                       "fld.rdb$field_name AS DOMAIN_NAME, " +
+                                       "null AS DOMAIN_DATA_TYPE, " +
+                                       "rdb$field_sub_type AS DOMAIN_SUB_TYPE, " +
+                                       "cast(fld.rdb$field_length AS integer) AS DOMAIN_SIZE, " +
+                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +
+                                       "cast(fld.rdb$field_scale  AS integer) AS NUMERIC_SCALE, " +
+                    "cast(fld.rdb$character_length AS integer) AS \"CHARACTER_LENGTH\", " +
+                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +
+                                       "fld.rdb$null_flag AS IS_NULLABLE, " +
+                                       "fld.rdb$dimensions AS ARRAY_DIMENSIONS, " +
+                                       "fld.rdb$description AS DESCRIPTION, " +
+                                       "fld.rdb$field_type AS FIELD_TYPE, " +
+                                       "null AS CHARACTER_SET_CATALOG, " +
+                                       "null AS CHARACTER_SET_SCHEMA, " +
+                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +
+                                       "null AS COLLATION_CATALOG, " +
+                                       "null AS COLLATION_SCHEMA, " +
+                                       "coll.rdb$collation_name AS COLLATION_NAME " +
+                               "FROM " +
+                                       "rdb$fields fld " +
+                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +
+                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)");
+
+                       where.Append("not rdb$field_name starting with 'RDB$'");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* DOMAIN_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* DOMAIN_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* DOMAIN_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$field_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$field_name");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);
+
+                               int subType = 0;
+                               if (row["DOMAIN_SUB_TYPE"] != System.DBNull.Value)
+                               {
+                                       subType = Convert.ToInt32(row["DOMAIN_SUB_TYPE"], CultureInfo.InvariantCulture);
+                               }
+
+                               int scale = 0;
+                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)
+                               {
+                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);
+                               }
+
+                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);
+                               row["DOMAIN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);
+
+                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)
+                               {
+                                       row["DOMAIN_SIZE"] = row["CHARACTER_LENGTH"];
+                               }
+                               else
+                               {
+                                       row["CHARACTER_OCTET_LENGTH"] = 0;
+                               }
+
+                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)
+                               {
+                                       row["DOMAIN_SIZE"] = Int32.MaxValue;
+                               }
+
+                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&
+                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))
+                               {
+                                       row["NUMERIC_PRECISION"] = row["DOMAIN_SIZE"];
+                               }
+
+                               row["NUMERIC_SCALE"] = (-1) * scale;
+
+                               if (row["IS_NULLABLE"] == DBNull.Value)
+                               {
+                                       row["IS_NULLABLE"] = true;
+                               }
+                               else
+                               {
+                                       row["IS_NULLABLE"] = false;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       // Remove not more needed columns
+                       schema.Columns.Remove("FIELD_TYPE");
+                       schema.Columns.Remove("CHARACTER_LENGTH");
+
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index fab95e029f1f806c620f274c5d8967c33f7cff5d..4dbc7350127ffa318b79b58830c39f4aa493b1ec 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbForeignKeys : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbForeignKeys() : base("ForeignKeys")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS PK_TABLE_CATALOG, " +\r
-                                       "null AS PK_TABLE_SCHEMA, " +\r
-                                       "pk.rdb$relation_name AS PK_TABLE_NAME, " +\r
-                                       "pkseg.rdb$field_name AS PK_COLUMN_NAME, " +\r
-                                       "pk.rdb$constraint_name AS PK_NAME, " +\r
-                                       "null AS FK_TABLE_CATALOG, " +\r
-                                       "null AS FK_TABLE_SCHEMA, " +\r
-                                       "fk.rdb$relation_name AS FK_TABLE_NAME, " +\r
-                                       "fkseg.rdb$field_name AS FK_COLUMN_NAME, " +\r
-                                       "fk.rdb$constraint_name AS FK_NAME, " +\r
-                                       "pkseg.rdb$field_position AS ORDINAL_POSITION, " +\r
-                                       "ref.rdb$match_option AS MATCH_OPTION, " +\r
-                                       "ref.rdb$update_rule AS UPDATE_RULE, " +\r
-                                       "ref.rdb$delete_rule AS DELETE_RULE, " +\r
-                                       "fk.rdb$deferrable AS IS_DEFERRABLE, " +\r
-                                       "fk.rdb$initially_deferred AS INITIALLY_DEFERRED " +\r
-                               "FROM " +\r
-                                       "rdb$relation_constraints fk, " +\r
-                                       "rdb$index_segments fkseg, " +\r
-                                       "rdb$relation_constraints pk, " +\r
-                                       "rdb$index_segments pkseg, " +\r
-                                       "rdb$ref_constraints ref ");\r
-\r
-                       where.Append(\r
-                                       "fk.rdb$constraint_name = ref.rdb$constraint_name and " +\r
-                                       "fk.rdb$index_name = fkseg.rdb$index_name and " +\r
-                                       "pk.rdb$constraint_name = ref.rdb$const_name_uq and " +\r
-                                       "pk.rdb$index_name = pkseg.rdb$index_name and " +\r
-                                       "pkseg.rdb$field_position = fkseg.rdb$field_position ");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* PK_TABLE_CATALOG     */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PK_TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PK_TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " and pk.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* FK_TABLE_CATALOG     */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* FK_TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 5 && restrictions[4] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* FK_TABLE_NAME */\r
-                               if (restrictions.Length >= 6 && restrictions[5] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " and fk.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY fk.rdb$constraint_name, pk.rdb$relation_name, pkseg.rdb$field_position");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbForeignKeys : FbDbSchema
+       {
+               #region Constructors
+
+               public FbForeignKeys() : base("ForeignKeys")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS PK_TABLE_CATALOG, " +
+                                       "null AS PK_TABLE_SCHEMA, " +
+                                       "pk.rdb$relation_name AS PK_TABLE_NAME, " +
+                                       "pkseg.rdb$field_name AS PK_COLUMN_NAME, " +
+                                       "pk.rdb$constraint_name AS PK_NAME, " +
+                                       "null AS FK_TABLE_CATALOG, " +
+                                       "null AS FK_TABLE_SCHEMA, " +
+                                       "fk.rdb$relation_name AS FK_TABLE_NAME, " +
+                                       "fkseg.rdb$field_name AS FK_COLUMN_NAME, " +
+                                       "fk.rdb$constraint_name AS FK_NAME, " +
+                                       "pkseg.rdb$field_position AS ORDINAL_POSITION, " +
+                                       "ref.rdb$match_option AS MATCH_OPTION, " +
+                                       "ref.rdb$update_rule AS UPDATE_RULE, " +
+                                       "ref.rdb$delete_rule AS DELETE_RULE, " +
+                                       "fk.rdb$deferrable AS IS_DEFERRABLE, " +
+                                       "fk.rdb$initially_deferred AS INITIALLY_DEFERRED " +
+                               "FROM " +
+                                       "rdb$relation_constraints fk, " +
+                                       "rdb$index_segments fkseg, " +
+                                       "rdb$relation_constraints pk, " +
+                                       "rdb$index_segments pkseg, " +
+                                       "rdb$ref_constraints ref ");
+
+                       where.Append(
+                                       "fk.rdb$constraint_name = ref.rdb$constraint_name and " +
+                                       "fk.rdb$index_name = fkseg.rdb$index_name and " +
+                                       "pk.rdb$constraint_name = ref.rdb$const_name_uq and " +
+                                       "pk.rdb$index_name = pkseg.rdb$index_name and " +
+                                       "pkseg.rdb$field_position = fkseg.rdb$field_position ");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* PK_TABLE_CATALOG     */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* PK_TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* PK_TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " and pk.rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* FK_TABLE_CATALOG     */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                               }
+
+                               /* FK_TABLE_SCHEMA */
+                               if (restrictions.Length >= 5 && restrictions[4] != null)
+                               {
+                               }
+
+                               /* FK_TABLE_NAME */
+                               if (restrictions.Length >= 6 && restrictions[5] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " and fk.rdb$relation_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY fk.rdb$constraint_name, pk.rdb$relation_name, pkseg.rdb$field_position");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index fae98d98a1640d45ced20839aab94ad829e62092..abe64405bc3870ab04f2f1d26f30acd3d6e99412 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbFunctions : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbFunctions() : base("Functions")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS FUNCTION_CATALOG, " +\r
-                                       "null AS FUNCTION_SCHEMA, " +\r
-                                       "rdb$function_name AS FUNCTION_NAME, " +\r
-                                       "rdb$system_flag AS IS_SYSTEM_FUNCTION, " +\r
-                                       "rdb$function_type AS FUNCTION_TYPE, " +\r
-                                       "rdb$query_name AS QUERY_NAME, " +\r
-                                       "rdb$module_name AS FUNCTION_MODULE_NAME, " +\r
-                                       "rdb$entrypoint AS FUNCTION_ENTRY_POINT, " +\r
-                                       "rdb$return_argument AS RETURN_ARGUMENT, " +\r
-                                       "rdb$description AS DESCRIPTION " +\r
-                               "FROM rdb$functions");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* FUNCTION_CATALOG     */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* FUNCTION_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* FUNCTION_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$function_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* IS_SYSTEM_FUNCTION */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$function_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               if (row["IS_SYSTEM_FUNCTION"] == DBNull.Value ||\r
-                                       Convert.ToInt32(row["IS_SYSTEM_FUNCTION"], CultureInfo.InvariantCulture) == 0)\r
-                               {\r
-                                       row["IS_SYSTEM_FUNCTION"] = false;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_SYSTEM_FUNCTION"] = true;\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbFunctions : FbDbSchema
+       {
+               #region Constructors
+
+               public FbFunctions() : base("Functions")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS FUNCTION_CATALOG, " +
+                                       "null AS FUNCTION_SCHEMA, " +
+                                       "rdb$function_name AS FUNCTION_NAME, " +
+                                       "rdb$system_flag AS IS_SYSTEM_FUNCTION, " +
+                                       "rdb$function_type AS FUNCTION_TYPE, " +
+                                       "rdb$query_name AS QUERY_NAME, " +
+                                       "rdb$module_name AS FUNCTION_MODULE_NAME, " +
+                                       "rdb$entrypoint AS FUNCTION_ENTRY_POINT, " +
+                                       "rdb$return_argument AS RETURN_ARGUMENT, " +
+                                       "rdb$description AS DESCRIPTION " +
+                               "FROM rdb$functions");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* FUNCTION_CATALOG     */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* FUNCTION_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* FUNCTION_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$function_name = @p{0}", index++);
+                               }
+
+                               /* IS_SYSTEM_FUNCTION */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$function_name");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               if (row["IS_SYSTEM_FUNCTION"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_SYSTEM_FUNCTION"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_SYSTEM_FUNCTION"] = false;
+                               }
+                               else
+                               {
+                                       row["IS_SYSTEM_FUNCTION"] = true;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index b365ea63b3f4aaebcd84e4ae987743d236a22b2e..b2292f98b33fa28f65eec9df2b988326eca49e8c 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbGenerators : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbGenerators() : base("Generators")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS GENERATOR_CATALOG, " +\r
-                                       "null AS GENERATOR_SCHEMA, " +\r
-                                       "rdb$generator_name AS GENERATOR_NAME, " +\r
-                                       "rdb$system_flag AS IS_SYSTEM_GENERATOR, " +\r
-                                       "rdb$generator_id AS GENERATOR_ID " +\r
-                               "FROM " +\r
-                                       "rdb$generators");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* GENERATOR_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* GENERATOR_SCHEMA     */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* GENERATOR_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$generator_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GENERATOR_SCHEMA     */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$generator_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               if (row["IS_SYSTEM_GENERATOR"] == DBNull.Value ||\r
-                                       Convert.ToInt32(row["IS_SYSTEM_GENERATOR"], CultureInfo.InvariantCulture) == 0)\r
-                               {\r
-                                       row["IS_SYSTEM_GENERATOR"] = false;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_SYSTEM_GENERATOR"] = true;\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbGenerators : FbDbSchema
+       {
+               #region Constructors
+
+               public FbGenerators() : base("Generators")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS GENERATOR_CATALOG, " +
+                                       "null AS GENERATOR_SCHEMA, " +
+                                       "rdb$generator_name AS GENERATOR_NAME, " +
+                                       "rdb$system_flag AS IS_SYSTEM_GENERATOR, " +
+                                       "rdb$generator_id AS GENERATOR_ID " +
+                               "FROM " +
+                                       "rdb$generators");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* GENERATOR_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* GENERATOR_SCHEMA     */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* GENERATOR_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$generator_name = @p{0}", index++);
+                               }
+
+                               /* GENERATOR_SCHEMA     */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$generator_name");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               if (row["IS_SYSTEM_GENERATOR"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_SYSTEM_GENERATOR"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_SYSTEM_GENERATOR"] = false;
+                               }
+                               else
+                               {
+                                       row["IS_SYSTEM_GENERATOR"] = true;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index fdf9137847cfa409778c0f284f2d936c170d4979..6818299be7e97339e34b6d0c61216b3a67009b9f 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbIndexes : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbIndexes() : base("Indexes")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "idx.rdb$relation_name AS TABLE_NAME, " +\r
-                                       "idx.rdb$index_name AS INDEX_NAME, " +\r
-                                       "idx.rdb$index_type AS INDEX_TYPE, " +\r
-                                       "seg.rdb$field_name AS COLUMN_NAME, " +\r
-                                       "seg.rdb$field_position AS ORDINAL_POSITION, " +\r
-                                       "idx.rdb$index_inactive AS IS_INACTIVE, " +\r
-                                       "idx.rdb$system_flag AS IS_SYSTEM_INDEX, " +\r
-                                       "idx.rdb$unique_flag AS IS_UNIQUE, " +\r
-                                       "idx.rdb$statistics AS INDEX_STATISTICS, " +\r
-                                       "idx.rdb$description AS DESCRIPTION " +\r
-                               "FROM " +\r
-                                       "rdb$indices idx " +\r
-                                       "left join rdb$index_segments seg ON idx.rdb$index_name = seg.rdb$index_name");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* INDEX_NAME */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$index_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY idx.rdb$relation_name, idx.rdb$index_name, seg.rdb$field_position");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbIndexes : FbDbSchema
+       {
+               #region Constructors
+
+               public FbIndexes() : base("Indexes")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "idx.rdb$relation_name AS TABLE_NAME, " +
+                                       "idx.rdb$index_name AS INDEX_NAME, " +
+                                       "idx.rdb$index_type AS INDEX_TYPE, " +
+                                       "seg.rdb$field_name AS COLUMN_NAME, " +
+                                       "seg.rdb$field_position AS ORDINAL_POSITION, " +
+                                       "idx.rdb$index_inactive AS IS_INACTIVE, " +
+                                       "idx.rdb$system_flag AS IS_SYSTEM_INDEX, " +
+                                       "idx.rdb$unique_flag AS IS_UNIQUE, " +
+                                       "idx.rdb$statistics AS INDEX_STATISTICS, " +
+                                       "idx.rdb$description AS DESCRIPTION " +
+                               "FROM " +
+                                       "rdb$indices idx " +
+                                       "left join rdb$index_segments seg ON idx.rdb$index_name = seg.rdb$index_name");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* INDEX_NAME */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$index_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY idx.rdb$relation_name, idx.rdb$index_name, seg.rdb$field_position");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               if (row["IS_UNIQUE"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_UNIQUE"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_UNIQUE"] = true;
+                               }
+                               else
+                               {
+                                       row["IS_UNIQUE"] = false;
+                               }
+                               
+                               if (row["IS_INACTIVE"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_INACTIVE"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_INACTIVE"] = true;
+                               }
+                               else
+                               {
+                                       row["IS_INACTIVE"] = false;
+                               }
+
+                               if (row["IS_SYSTEM_INDEX"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_SYSTEM_INDEX"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_SYSTEM_INDEX"] = true;
+                               }
+                               else
+                               {
+                                       row["IS_SYSTEM_INDEX"] = false;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+               
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index dbcdf630d33249f66e855f32738bd5dcd0bb5a78..5f861901fce3dee65142954e6999d65446c0b8a3 100644 (file)
@@ -1,69 +1,69 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal sealed class FbMetaDataCollections\r
-       {\r
-               private FbMetaDataCollections()\r
-               {\r
-               }\r
-\r
-               public static DataTable GetSchema()\r
-               {\r
-                       DataTable table = new DataTable("MetaDataCollections");\r
-\r
-                       table.Columns.Add("CollectionName", typeof(string));\r
-                       table.Columns.Add("NumberOfRestrictions", typeof(int));\r
-                       table.Columns.Add("NumberOfIdentifierParts", typeof(int));\r
-\r
-                       table.Rows.Add(new object[] { "CharacterSets", 3, 0 });\r
-                       table.Rows.Add(new object[] { "CheckConstraints", 3, 0 });\r
-                       table.Rows.Add(new object[] { "CheckConstraintsByTable", 3, 0 });\r
-                       table.Rows.Add(new object[] { "Collations", 3, 0 });\r
-                       table.Rows.Add(new object[] { "ColumnPrivileges", 6, 0 });\r
-                       table.Rows.Add(new object[] { "Columns", 4, 0 });\r
-                       table.Rows.Add(new object[] { "DataTypes", 0, 0 });\r
-                       table.Rows.Add(new object[] { "Domains", 3, 0 });\r
-                       table.Rows.Add(new object[] { "ForeignKeys", 6, 0 });\r
-                       table.Rows.Add(new object[] { "Functions", 4, 0 });\r
-                       table.Rows.Add(new object[] { "Generators", 4, 0 });\r
-                       table.Rows.Add(new object[] { "Indexes", 4, 0 });\r
-                       table.Rows.Add(new object[] { "MetaDataCollections", 0, 0 });\r
-                       table.Rows.Add(new object[] { "PrimaryKeys", 3, 0 });\r
-                       table.Rows.Add(new object[] { "ProcedureParameters", 4, 0 });\r
-                       table.Rows.Add(new object[] { "ProcedurePrivileges", 5, 0 });\r
-                       table.Rows.Add(new object[] { "Procedures", 3, 0 });\r
-                       table.Rows.Add(new object[] { "Restrictions", 0, 0 });\r
-                       table.Rows.Add(new object[] { "Roles", 1, 0 });\r
-                       table.Rows.Add(new object[] { "Tables", 4, 0 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", 7, 0 });\r
-                       table.Rows.Add(new object[] { "TablePrivileges", 5, 0 });\r
-                       table.Rows.Add(new object[] { "Triggers", 4, 0 });\r
-                       table.Rows.Add(new object[] { "UniqueKeys", 3, 0 });\r
-                       table.Rows.Add(new object[] { "ViewColumnUsage", 3, 0 });\r
-                       table.Rows.Add(new object[] { "ViewPrivileges", 5, 0 });\r
-                       table.Rows.Add(new object[] { "Views", 3, 0 });\r
-\r
-                       return table;\r
-               }\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal sealed class FbMetaDataCollections
+       {
+               private FbMetaDataCollections()
+               {
+               }
+
+               public static DataTable GetSchema()
+               {
+                       DataTable table = new DataTable("MetaDataCollections");
+
+                       table.Columns.Add("CollectionName", typeof(string));
+                       table.Columns.Add("NumberOfRestrictions", typeof(int));
+                       table.Columns.Add("NumberOfIdentifierParts", typeof(int));
+
+                       table.Rows.Add(new object[] { "CharacterSets", 3, 0 });
+                       table.Rows.Add(new object[] { "CheckConstraints", 3, 0 });
+                       table.Rows.Add(new object[] { "CheckConstraintsByTable", 3, 0 });
+                       table.Rows.Add(new object[] { "Collations", 3, 0 });
+                       table.Rows.Add(new object[] { "ColumnPrivileges", 6, 0 });
+                       table.Rows.Add(new object[] { "Columns", 4, 0 });
+                       table.Rows.Add(new object[] { "DataTypes", 0, 0 });
+                       table.Rows.Add(new object[] { "Domains", 3, 0 });
+                       table.Rows.Add(new object[] { "ForeignKeys", 6, 0 });
+                       table.Rows.Add(new object[] { "Functions", 4, 0 });
+                       table.Rows.Add(new object[] { "Generators", 4, 0 });
+                       table.Rows.Add(new object[] { "Indexes", 4, 0 });
+                       table.Rows.Add(new object[] { "MetaDataCollections", 0, 0 });
+                       table.Rows.Add(new object[] { "PrimaryKeys", 3, 0 });
+                       table.Rows.Add(new object[] { "ProcedureParameters", 4, 0 });
+                       table.Rows.Add(new object[] { "ProcedurePrivileges", 5, 0 });
+                       table.Rows.Add(new object[] { "Procedures", 3, 0 });
+                       table.Rows.Add(new object[] { "Restrictions", 0, 0 });
+                       table.Rows.Add(new object[] { "Roles", 1, 0 });
+                       table.Rows.Add(new object[] { "Tables", 4, 0 });
+                       table.Rows.Add(new object[] { "TableConstraints", 7, 0 });
+                       table.Rows.Add(new object[] { "TablePrivileges", 5, 0 });
+                       table.Rows.Add(new object[] { "Triggers", 4, 0 });
+                       table.Rows.Add(new object[] { "UniqueKeys", 3, 0 });
+                       table.Rows.Add(new object[] { "ViewColumnUsage", 3, 0 });
+                       table.Rows.Add(new object[] { "ViewPrivileges", 5, 0 });
+                       table.Rows.Add(new object[] { "Views", 3, 0 });
+
+                       return table;
+               }
+       }
+}
index 4f7e08a449f6190e01a15e6917e74804be3ea50f..05fdd103881f049d18a8366edcf987df192fdd56 100644 (file)
@@ -1,91 +1,91 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbPrimaryKeys : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbPrimaryKeys() : base("PrimaryKeys")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rel.rdb$relation_name AS TABLE_NAME, " +\r
-                                       "seg.rdb$field_name AS COLUMN_NAME, " +\r
-                                       "seg.rdb$field_position AS ORDINAL_POSITION, " +\r
-                                       "rel.rdb$constraint_name AS PK_NAME " +\r
-                               "FROM " +\r
-                                       "rdb$relation_constraints rel " +\r
-                                       "left join rdb$indices idx ON rel.rdb$index_name = idx.rdb$index_name " +\r
-                                       "left join rdb$index_segments seg ON idx.rdb$index_name = seg.rdb$index_name");\r
-\r
-                       where.Append("rel.rdb$constraint_type = 'PRIMARY KEY'");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rel.rdb$relation_name, rel.rdb$constraint_name, seg.rdb$field_position");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbPrimaryKeys : FbDbSchema
+       {
+               #region Constructors
+
+               public FbPrimaryKeys() : base("PrimaryKeys")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rel.rdb$relation_name AS TABLE_NAME, " +
+                                       "seg.rdb$field_name AS COLUMN_NAME, " +
+                                       "seg.rdb$field_position AS ORDINAL_POSITION, " +
+                                       "rel.rdb$constraint_name AS PK_NAME " +
+                               "FROM " +
+                                       "rdb$relation_constraints rel " +
+                                       "left join rdb$indices idx ON rel.rdb$index_name = idx.rdb$index_name " +
+                                       "left join rdb$index_segments seg ON idx.rdb$index_name = seg.rdb$index_name");
+
+                       where.Append("rel.rdb$constraint_type = 'PRIMARY KEY'");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rel.rdb$relation_name, rel.rdb$constraint_name, seg.rdb$field_position");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 415a976b1978722fa0499556552e5d91d410ee36..0f4dd88dbf60f681aa29c2b1236710c15b14358c 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbProcedureParameters : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbProcedureParameters() : base("ProcedureParameters")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS PROCEDURE_CATALOG, " +\r
-                                       "null AS PROCEDURE_SCHEMA, " +\r
-                                       "pp.rdb$procedure_name AS PROCEDURE_NAME, " +\r
-                                       "pp.rdb$parameter_name AS PARAMETER_NAME, " +\r
-                                       "null AS PARAMETER_DATA_TYPE, " +\r
-                                       "fld.rdb$field_sub_type AS PARAMETER_SUB_TYPE, " +\r
-                                       "pp.rdb$parameter_number AS ORDINAL_POSITION, " +\r
-                                       "cast(pp.rdb$parameter_type AS integer) AS PARAMETER_DIRECTION, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS PARAMETER_SIZE, " +\r
-                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +\r
-                                       "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " +\r
-                                       "cast(fld.rdb$character_length AS integer) AS CHARACTER_LENGTH, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +\r
-                                       "null AS CHARACTER_SET_CATALOG, " +\r
-                                       "null AS CHARACTER_SET_SCHEMA, " +\r
-                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +\r
-                                       "null AS COLLATION_CATALOG, " +\r
-                                       "null AS COLLATION_SCHEMA, " +\r
-                                       "coll.rdb$collation_name AS COLLATION_NAME, " +\r
-                                       "null AS COLLATION_CATALOG, " +\r
-                                       "null AS COLLATION_SCHEMA, " +\r
-                                       "pp.rdb$description AS DESCRIPTION, " +\r
-                                       "fld.rdb$field_type AS FIELD_TYPE " +\r
-                               "FROM " +\r
-                                       "rdb$procedure_parameters pp " +\r
-                                       "left join rdb$fields fld ON pp.rdb$field_source = fld.rdb$field_name " +\r
-                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +\r
-                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id) ");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* PROCEDURE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PROCEDURE_SCHEMA     */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PROCEDURE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "pp.rdb$procedure_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* PROCEDURE_PARAMETER */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "pp.rdb$parameter_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY pp.rdb$procedure_name, pp.rdb$parameter_type, pp.rdb$parameter_number");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);\r
-\r
-                               int subType = 0;\r
-                               if (row["PARAMETER_SUB_TYPE"] != System.DBNull.Value)\r
-                               {\r
-                                       subType = Convert.ToInt32(row["PARAMETER_SUB_TYPE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               int scale = 0;\r
-                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)\r
-                               {\r
-                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);\r
-                               row["PARAMETER_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);\r
-\r
-                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)\r
-                               {\r
-                                       row["PARAMETER_SIZE"] = row["CHARACTER_LENGTH"];\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["CHARACTER_OCTET_LENGTH"] = 0;\r
-                               }\r
-\r
-                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)\r
-                               {\r
-                                       row["PARAMETER_SIZE"] = Int32.MaxValue;\r
-                               }\r
-\r
-                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&\r
-                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))\r
-                               {\r
-                                       row["NUMERIC_PRECISION"] = row["PARAMETER_SIZE"];\r
-                               }\r
-\r
-                               row["NUMERIC_SCALE"] = (-1) * scale;\r
-\r
-                               int direction = Convert.ToInt32(row["PARAMETER_DIRECTION"], CultureInfo.InvariantCulture);\r
-                               switch (direction)\r
-                               {\r
-                                       case 0:\r
-                                               row["PARAMETER_DIRECTION"] = ParameterDirection.Input;\r
-                                               break;\r
-\r
-                                       case 1:\r
-                                               row["PARAMETER_DIRECTION"] = ParameterDirection.Output;\r
-                                               break;\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       // Remove not more needed columns\r
-                       schema.Columns.Remove("FIELD_TYPE");\r
-                       schema.Columns.Remove("CHARACTER_LENGTH");\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbProcedureParameters : FbDbSchema
+       {
+               #region Constructors
+
+               public FbProcedureParameters() : base("ProcedureParameters")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS PROCEDURE_CATALOG, " +
+                                       "null AS PROCEDURE_SCHEMA, " +
+                                       "pp.rdb$procedure_name AS PROCEDURE_NAME, " +
+                                       "pp.rdb$parameter_name AS PARAMETER_NAME, " +
+                                       "null AS PARAMETER_DATA_TYPE, " +
+                                       "fld.rdb$field_sub_type AS PARAMETER_SUB_TYPE, " +
+                                       "pp.rdb$parameter_number AS ORDINAL_POSITION, " +
+                                       "cast(pp.rdb$parameter_type AS integer) AS PARAMETER_DIRECTION, " +
+                                       "cast(fld.rdb$field_length AS integer) AS PARAMETER_SIZE, " +
+                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +
+                                       "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " +
+                    "cast(fld.rdb$character_length AS integer) AS \"CHARACTER_LENGTH\", " +
+                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +
+                                       "null AS CHARACTER_SET_CATALOG, " +
+                                       "null AS CHARACTER_SET_SCHEMA, " +
+                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +
+                                       "null AS COLLATION_CATALOG, " +
+                                       "null AS COLLATION_SCHEMA, " +
+                                       "coll.rdb$collation_name AS COLLATION_NAME, " +
+                                       "null AS COLLATION_CATALOG, " +
+                                       "null AS COLLATION_SCHEMA, " +
+                                       "pp.rdb$description AS DESCRIPTION, " +
+                                       "fld.rdb$field_type AS FIELD_TYPE " +
+                               "FROM " +
+                                       "rdb$procedure_parameters pp " +
+                                       "left join rdb$fields fld ON pp.rdb$field_source = fld.rdb$field_name " +
+                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +
+                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id) ");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* PROCEDURE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* PROCEDURE_SCHEMA     */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* PROCEDURE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "pp.rdb$procedure_name = @p{0}", index++);
+                               }
+
+                               /* PROCEDURE_PARAMETER */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "pp.rdb$parameter_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY pp.rdb$procedure_name, pp.rdb$parameter_type, pp.rdb$parameter_number");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);
+
+                               int subType = 0;
+                               if (row["PARAMETER_SUB_TYPE"] != System.DBNull.Value)
+                               {
+                                       subType = Convert.ToInt32(row["PARAMETER_SUB_TYPE"], CultureInfo.InvariantCulture);
+                               }
+
+                               int scale = 0;
+                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)
+                               {
+                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);
+                               }
+
+                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);
+                               row["PARAMETER_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);
+
+                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)
+                               {
+                                       row["PARAMETER_SIZE"] = row["CHARACTER_LENGTH"];
+                               }
+                               else
+                               {
+                                       row["CHARACTER_OCTET_LENGTH"] = 0;
+                               }
+
+                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)
+                               {
+                                       row["PARAMETER_SIZE"] = Int32.MaxValue;
+                               }
+
+                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&
+                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))
+                               {
+                                       row["NUMERIC_PRECISION"] = row["PARAMETER_SIZE"];
+                               }
+
+                               row["NUMERIC_SCALE"] = (-1) * scale;
+
+                               int direction = Convert.ToInt32(row["PARAMETER_DIRECTION"], CultureInfo.InvariantCulture);
+                               switch (direction)
+                               {
+                                       case 0:
+                                               row["PARAMETER_DIRECTION"] = ParameterDirection.Input;
+                                               break;
+
+                                       case 1:
+                                               row["PARAMETER_DIRECTION"] = ParameterDirection.Output;
+                                               break;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       // Remove not more needed columns
+                       schema.Columns.Remove("FIELD_TYPE");
+                       schema.Columns.Remove("CHARACTER_LENGTH");
+
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 939007bb6366b4edaf2faca95025136cdb567bd7..fdb153981f9f35fdc4e28b81515b02470eb6d887 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbProcedurePrivilegesSchema : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbProcedurePrivilegesSchema() : base("ProcedurePrivileges")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS PROCEDURE_CATALOG, " +\r
-                                       "null AS PROCEDURE_SCHEMA, " +\r
-                                       "rdb$relation_name AS PROCEDURE_NAME, " +\r
-                                       "rdb$user AS GRANTEE, " +\r
-                                       "rdb$grantor AS GRANTOR, " +\r
-                                       "rdb$privilege AS PRIVILEGE, " +\r
-                                       "rdb$grant_option AS WITH_GRANT " +\r
-                               "FROM " +\r
-                                       "rdb$user_privileges");\r
-\r
-                       where.Append("rdb$object_type = 5");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* PROCEDURE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PROCEDURE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PROCEDURE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTOR */\r
-                               if (restrictions.Length >= 5 && restrictions[4] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$grantor = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTEE */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$user = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$relation_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbProcedurePrivilegesSchema : FbDbSchema
+       {
+               #region Constructors
+
+               public FbProcedurePrivilegesSchema() : base("ProcedurePrivileges")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS PROCEDURE_CATALOG, " +
+                                       "null AS PROCEDURE_SCHEMA, " +
+                                       "rdb$relation_name AS PROCEDURE_NAME, " +
+                                       "rdb$user AS GRANTEE, " +
+                                       "rdb$grantor AS GRANTOR, " +
+                                       "rdb$privilege AS PRIVILEGE, " +
+                                       "rdb$grant_option AS WITH_GRANT " +
+                               "FROM " +
+                                       "rdb$user_privileges");
+
+                       where.Append("rdb$object_type = 5");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* PROCEDURE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* PROCEDURE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* PROCEDURE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* GRANTOR */
+                               if (restrictions.Length >= 5 && restrictions[4] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$grantor = @p{0}", index++);
+                               }
+
+                               /* GRANTEE */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$user = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$relation_name");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 50e65c5d34a37aae66338b3be5299d0217c2dc24..84ab8999ac5bd777c09198a7da2e9683775f36f0 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbProcedures : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbProcedures() : base("Procedures")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS PROCEDURE_CATALOG, " +\r
-                                       "null AS PROCEDURE_SCHEMA, " +\r
-                                       "rdb$procedure_name AS PROCEDURE_NAME, " +\r
-                                       "rdb$procedure_inputs AS INPUTS, " +\r
-                                       "rdb$procedure_outputs AS OUTPUTS, " +\r
-                                       "rdb$procedure_source AS SOURCE, " +\r
-                                       "rdb$description AS DESCRIPTION " +\r
-                               "FROM " +\r
-                                       "rdb$procedures");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* PROCEDURE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PROCEDURE_SCHEMA     */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* PROCEDURE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$procedure_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$procedure_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               if (row["INPUTS"] == DBNull.Value)\r
-                               {\r
-                                       row["INPUTS"] = 0;\r
-                               }\r
-                               if (row["OUTPUTS"] == DBNull.Value)\r
-                               {\r
-                                       row["OUTPUTS"] = 0;\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbProcedures : FbDbSchema
+       {
+               #region Constructors
+
+               public FbProcedures() : base("Procedures")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS PROCEDURE_CATALOG, " +
+                                       "null AS PROCEDURE_SCHEMA, " +
+                                       "rdb$procedure_name AS PROCEDURE_NAME, " +
+                                       "rdb$procedure_inputs AS INPUTS, " +
+                                       "rdb$procedure_outputs AS OUTPUTS, " +
+                                       "rdb$procedure_source AS SOURCE, " +
+                                       "rdb$description AS DESCRIPTION " +
+                               "FROM " +
+                                       "rdb$procedures");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* PROCEDURE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* PROCEDURE_SCHEMA     */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* PROCEDURE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$procedure_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$procedure_name");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               if (row["INPUTS"] == DBNull.Value)
+                               {
+                                       row["INPUTS"] = 0;
+                               }
+                               if (row["OUTPUTS"] == DBNull.Value)
+                               {
+                                       row["OUTPUTS"] = 0;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index e7d5faa341c6fb1ff1c256974315172ce9ef7721..d17286dce471e127dfeed5f7f69adbfaaa83377f 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal sealed class FbRestrictions\r
-       {\r
-               private FbRestrictions()\r
-               {\r
-               }\r
-\r
-               public static DataTable GetSchema()\r
-               {\r
-                       DataTable table = new DataTable("Restrictions");\r
-\r
-                       table.Columns.Add("CollectionName", typeof(System.String));\r
-                       table.Columns.Add("RestrictionName", typeof(System.String));\r
-                       table.Columns.Add("RestrictionDefault", typeof(System.String));\r
-                       table.Columns.Add("RestrictionNumber", typeof(System.Int32));\r
-\r
-                       table.Rows.Add(new object[] { "CharacterSets", "Catalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "CharacterSets", "Schema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "CharacterSets", "Name", "character_set_name", 3 });\r
-                       table.Rows.Add(new object[] { "CheckConstraints", "Catalog", "constraint_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "CheckConstraints", "Schema", "constraint_schema", 2 });\r
-                       table.Rows.Add(new object[] { "CheckConstraints", "Name", "constraint_name", 3 });\r
-                       table.Rows.Add(new object[] { "CheckConstraintsByTable", "Catalog", "constraint_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "CheckConstraintsByTable", "Schema", "constraint_schema", 2 });\r
-                       table.Rows.Add(new object[] { "CheckConstraintsByTable", "Name", "constraint_name", 3 });\r
-                       table.Rows.Add(new object[] { "Collations", "Catalog", "collation_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Collations", "Schema", "collation_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Collations", "Name", "collation_name", 3 });\r
-                       table.Rows.Add(new object[] { "ColumnPrivileges", "TableCatalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "ColumnPrivileges", "TableSchema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "ColumnPrivileges", "TableName", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "ColumnPrivileges", "ColumnName", "column_name", 4 });\r
-                       table.Rows.Add(new object[] { "ColumnPrivileges", "Grantor", "grantor", 5 });\r
-                       table.Rows.Add(new object[] { "ColumnPrivileges", "Grantee", "grantee", 6 });\r
-                       table.Rows.Add(new object[] { "Columns", "TableCatalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Columns", "TableSchema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Columns", "TableName", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "Columns", "ColumnName", "column_name", 4 });\r
-                       table.Rows.Add(new object[] { "Domains", "Catalog", "domain_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Domains", "Schema", "domain_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Domains", "Name", "domain_name", 3 });\r
-                       table.Rows.Add(new object[] { "ForeignKeys", "PkTableCatalog", "pk_table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "ForeignKeys", "PkTableSchema", "pk_table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "ForeignKeys", "PkTableName", "pk_table_name", 3 });\r
-                       table.Rows.Add(new object[] { "ForeignKeys", "FkTableCatalog", "fk_table_catalog", 4 });\r
-                       table.Rows.Add(new object[] { "ForeignKeys", "FkTableSchema", "fk_table_schema", 5 });\r
-                       table.Rows.Add(new object[] { "ForeignKeys", "FkTableName", "fk_table_name", 6 });\r
-                       table.Rows.Add(new object[] { "Functions", "Catalog", "function_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Functions", "Schema", "function_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Functions", "Name", "function_name", 3 });\r
-                       table.Rows.Add(new object[] { "Functions", "IsSystemFunction", "is_system_function", 4 });\r
-                       table.Rows.Add(new object[] { "Generators", "Catalog", "generator_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Generators", "Schema", "generator_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Generators", "Name", "generator_name", 3 });\r
-                       table.Rows.Add(new object[] { "Generators", "IsSystemGenerator", "is_system_generator", 4 });\r
-                       table.Rows.Add(new object[] { "Indexes", "TableCatalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Indexes", "TableSchema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Indexes", "TableName", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "Indexes", "Name", "index_name", 4 });\r
-                       table.Rows.Add(new object[] { "PrimaryKeys", "TableCatalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "PrimaryKeys", "TableSchema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "PrimaryKeys", "TableName", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "ProcedureParameters", "ProcedureCatalog", "procedure_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "ProcedureParameters", "ProcedureSchema", "procedure_schema", 2 });\r
-                       table.Rows.Add(new object[] { "ProcedureParameters", "ProcedureName", "procedure_name", 3 });\r
-                       table.Rows.Add(new object[] { "ProcedureParameters", "Name", "procedure_parameter", 4 });\r
-                       table.Rows.Add(new object[] { "ProcedurePrivileges", "ProcedureCatalog", "procedure_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "ProcedurePrivileges", "ProcedureSchema", "procedure_schema", 2 });\r
-                       table.Rows.Add(new object[] { "ProcedurePrivileges", "ProcedureName", "procedure_name", 3 });\r
-                       table.Rows.Add(new object[] { "ProcedurePrivileges", "Grantor", "grantor", 4 });\r
-                       table.Rows.Add(new object[] { "ProcedurePrivileges", "Grantee", "grantee", 5 });\r
-                       table.Rows.Add(new object[] { "Procedures", "ProcedureCatalog", "procedure_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Procedures", "ProcedureSchema", "procedure_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Procedures", "Name", "procedure_name", 3 });\r
-                       table.Rows.Add(new object[] { "Roles", "Name", "role_name", 1 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintCatalog", "constraint_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintSchema", "constraint_schema", 2 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintName", "constraint_name", 3 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", "TableCatalog", "table_catalog", 4 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", "TableSchema", "table_schema", 5 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", "TableName", "table_name", 6 });\r
-                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintType", "constraint_type", 7 });\r
-                       table.Rows.Add(new object[] { "TablePrivileges", "TableCatalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "TablePrivileges", "TableSchema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "TablePrivileges", "TableName", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "TablePrivileges", "Grantor", "grantor", 4 });\r
-                       table.Rows.Add(new object[] { "TablePrivileges", "Grantee", "grantee", 5 });\r
-                       table.Rows.Add(new object[] { "Tables", "Catalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Tables", "Schema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Tables", "Name", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "Tables", "Type", "table_type", 4 });\r
-                       table.Rows.Add(new object[] { "Triggers", "TableCatalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Triggers", "TableSchema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Triggers", "TableName", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "Triggers", "Name", "trigger_name", 4 });\r
-                       table.Rows.Add(new object[] { "UniqueKeys", "TableCatalog", "table_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "UniqueKeys", "TableSchema", "table_schema", 2 });\r
-                       table.Rows.Add(new object[] { "UniqueKeys", "TableName", "table_name", 3 });\r
-                       table.Rows.Add(new object[] { "ViewColumnUsage", "ViewCatalog", "view_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "ViewColumnUsage", "ViewSchema", "view_schema", 2 });\r
-                       table.Rows.Add(new object[] { "ViewColumnUsage", "ViewName", "view_name", 3 });\r
-                       table.Rows.Add(new object[] { "ViewPrivileges", "ViewCatalog", "view_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "ViewPrivileges", "ViewSchema", "view_schema", 2 });\r
-                       table.Rows.Add(new object[] { "ViewPrivileges", "ViewName", "view_name", 3 });\r
-                       table.Rows.Add(new object[] { "ViewPrivileges", "Grantor", "grantor", 4 });\r
-                       table.Rows.Add(new object[] { "ViewPrivileges", "Grantee", "grantee", 5 });\r
-                       table.Rows.Add(new object[] { "Views", "Catalog", "view_catalog", 1 });\r
-                       table.Rows.Add(new object[] { "Views", "Schema", "view_schema", 2 });\r
-                       table.Rows.Add(new object[] { "Views", "Name", "view_name", 3 });\r
-\r
-                       return table;\r
-               }\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal sealed class FbRestrictions
+       {
+               private FbRestrictions()
+               {
+               }
+
+               public static DataTable GetSchema()
+               {
+                       DataTable table = new DataTable("Restrictions");
+
+                       table.Columns.Add("CollectionName", typeof(System.String));
+                       table.Columns.Add("RestrictionName", typeof(System.String));
+                       table.Columns.Add("RestrictionDefault", typeof(System.String));
+                       table.Columns.Add("RestrictionNumber", typeof(System.Int32));
+
+                       table.Rows.Add(new object[] { "CharacterSets", "Catalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "CharacterSets", "Schema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "CharacterSets", "Name", "character_set_name", 3 });
+                       table.Rows.Add(new object[] { "CheckConstraints", "Catalog", "constraint_catalog", 1 });
+                       table.Rows.Add(new object[] { "CheckConstraints", "Schema", "constraint_schema", 2 });
+                       table.Rows.Add(new object[] { "CheckConstraints", "Name", "constraint_name", 3 });
+                       table.Rows.Add(new object[] { "CheckConstraintsByTable", "Catalog", "constraint_catalog", 1 });
+                       table.Rows.Add(new object[] { "CheckConstraintsByTable", "Schema", "constraint_schema", 2 });
+                       table.Rows.Add(new object[] { "CheckConstraintsByTable", "Name", "constraint_name", 3 });
+                       table.Rows.Add(new object[] { "Collations", "Catalog", "collation_catalog", 1 });
+                       table.Rows.Add(new object[] { "Collations", "Schema", "collation_schema", 2 });
+                       table.Rows.Add(new object[] { "Collations", "Name", "collation_name", 3 });
+                       table.Rows.Add(new object[] { "ColumnPrivileges", "TableCatalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "ColumnPrivileges", "TableSchema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "ColumnPrivileges", "TableName", "table_name", 3 });
+                       table.Rows.Add(new object[] { "ColumnPrivileges", "ColumnName", "column_name", 4 });
+                       table.Rows.Add(new object[] { "ColumnPrivileges", "Grantor", "grantor", 5 });
+                       table.Rows.Add(new object[] { "ColumnPrivileges", "Grantee", "grantee", 6 });
+                       table.Rows.Add(new object[] { "Columns", "TableCatalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "Columns", "TableSchema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "Columns", "TableName", "table_name", 3 });
+                       table.Rows.Add(new object[] { "Columns", "ColumnName", "column_name", 4 });
+                       table.Rows.Add(new object[] { "Domains", "Catalog", "domain_catalog", 1 });
+                       table.Rows.Add(new object[] { "Domains", "Schema", "domain_schema", 2 });
+                       table.Rows.Add(new object[] { "Domains", "Name", "domain_name", 3 });
+                       table.Rows.Add(new object[] { "ForeignKeys", "PkTableCatalog", "pk_table_catalog", 1 });
+                       table.Rows.Add(new object[] { "ForeignKeys", "PkTableSchema", "pk_table_schema", 2 });
+                       table.Rows.Add(new object[] { "ForeignKeys", "PkTableName", "pk_table_name", 3 });
+                       table.Rows.Add(new object[] { "ForeignKeys", "FkTableCatalog", "fk_table_catalog", 4 });
+                       table.Rows.Add(new object[] { "ForeignKeys", "FkTableSchema", "fk_table_schema", 5 });
+                       table.Rows.Add(new object[] { "ForeignKeys", "FkTableName", "fk_table_name", 6 });
+                       table.Rows.Add(new object[] { "Functions", "Catalog", "function_catalog", 1 });
+                       table.Rows.Add(new object[] { "Functions", "Schema", "function_schema", 2 });
+                       table.Rows.Add(new object[] { "Functions", "Name", "function_name", 3 });
+                       table.Rows.Add(new object[] { "Functions", "IsSystemFunction", "is_system_function", 4 });
+                       table.Rows.Add(new object[] { "Generators", "Catalog", "generator_catalog", 1 });
+                       table.Rows.Add(new object[] { "Generators", "Schema", "generator_schema", 2 });
+                       table.Rows.Add(new object[] { "Generators", "Name", "generator_name", 3 });
+                       table.Rows.Add(new object[] { "Generators", "IsSystemGenerator", "is_system_generator", 4 });
+                       table.Rows.Add(new object[] { "Indexes", "TableCatalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "Indexes", "TableSchema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "Indexes", "TableName", "table_name", 3 });
+                       table.Rows.Add(new object[] { "Indexes", "Name", "index_name", 4 });
+                       table.Rows.Add(new object[] { "PrimaryKeys", "TableCatalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "PrimaryKeys", "TableSchema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "PrimaryKeys", "TableName", "table_name", 3 });
+                       table.Rows.Add(new object[] { "ProcedureParameters", "ProcedureCatalog", "procedure_catalog", 1 });
+                       table.Rows.Add(new object[] { "ProcedureParameters", "ProcedureSchema", "procedure_schema", 2 });
+                       table.Rows.Add(new object[] { "ProcedureParameters", "ProcedureName", "procedure_name", 3 });
+                       table.Rows.Add(new object[] { "ProcedureParameters", "Name", "procedure_parameter", 4 });
+                       table.Rows.Add(new object[] { "ProcedurePrivileges", "ProcedureCatalog", "procedure_catalog", 1 });
+                       table.Rows.Add(new object[] { "ProcedurePrivileges", "ProcedureSchema", "procedure_schema", 2 });
+                       table.Rows.Add(new object[] { "ProcedurePrivileges", "ProcedureName", "procedure_name", 3 });
+                       table.Rows.Add(new object[] { "ProcedurePrivileges", "Grantor", "grantor", 4 });
+                       table.Rows.Add(new object[] { "ProcedurePrivileges", "Grantee", "grantee", 5 });
+                       table.Rows.Add(new object[] { "Procedures", "ProcedureCatalog", "procedure_catalog", 1 });
+                       table.Rows.Add(new object[] { "Procedures", "ProcedureSchema", "procedure_schema", 2 });
+                       table.Rows.Add(new object[] { "Procedures", "Name", "procedure_name", 3 });
+                       table.Rows.Add(new object[] { "Roles", "Name", "role_name", 1 });
+                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintCatalog", "constraint_catalog", 1 });
+                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintSchema", "constraint_schema", 2 });
+                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintName", "constraint_name", 3 });
+                       table.Rows.Add(new object[] { "TableConstraints", "TableCatalog", "table_catalog", 4 });
+                       table.Rows.Add(new object[] { "TableConstraints", "TableSchema", "table_schema", 5 });
+                       table.Rows.Add(new object[] { "TableConstraints", "TableName", "table_name", 6 });
+                       table.Rows.Add(new object[] { "TableConstraints", "ConstraintType", "constraint_type", 7 });
+                       table.Rows.Add(new object[] { "TablePrivileges", "TableCatalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "TablePrivileges", "TableSchema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "TablePrivileges", "TableName", "table_name", 3 });
+                       table.Rows.Add(new object[] { "TablePrivileges", "Grantor", "grantor", 4 });
+                       table.Rows.Add(new object[] { "TablePrivileges", "Grantee", "grantee", 5 });
+                       table.Rows.Add(new object[] { "Tables", "Catalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "Tables", "Schema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "Tables", "Name", "table_name", 3 });
+                       table.Rows.Add(new object[] { "Tables", "Type", "table_type", 4 });
+                       table.Rows.Add(new object[] { "Triggers", "TableCatalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "Triggers", "TableSchema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "Triggers", "TableName", "table_name", 3 });
+                       table.Rows.Add(new object[] { "Triggers", "Name", "trigger_name", 4 });
+                       table.Rows.Add(new object[] { "UniqueKeys", "TableCatalog", "table_catalog", 1 });
+                       table.Rows.Add(new object[] { "UniqueKeys", "TableSchema", "table_schema", 2 });
+                       table.Rows.Add(new object[] { "UniqueKeys", "TableName", "table_name", 3 });
+                       table.Rows.Add(new object[] { "ViewColumnUsage", "ViewCatalog", "view_catalog", 1 });
+                       table.Rows.Add(new object[] { "ViewColumnUsage", "ViewSchema", "view_schema", 2 });
+                       table.Rows.Add(new object[] { "ViewColumnUsage", "ViewName", "view_name", 3 });
+                       table.Rows.Add(new object[] { "ViewPrivileges", "ViewCatalog", "view_catalog", 1 });
+                       table.Rows.Add(new object[] { "ViewPrivileges", "ViewSchema", "view_schema", 2 });
+                       table.Rows.Add(new object[] { "ViewPrivileges", "ViewName", "view_name", 3 });
+                       table.Rows.Add(new object[] { "ViewPrivileges", "Grantor", "grantor", 4 });
+                       table.Rows.Add(new object[] { "ViewPrivileges", "Grantee", "grantee", 5 });
+                       table.Rows.Add(new object[] { "Views", "Catalog", "view_catalog", 1 });
+                       table.Rows.Add(new object[] { "Views", "Schema", "view_schema", 2 });
+                       table.Rows.Add(new object[] { "Views", "Name", "view_name", 3 });
+
+                       return table;
+               }
+       }
+}
index 27a1f2560b999ce7167d54e31c08feb18ba8ea5f..23744bd3bd34f87a81b20d76e72e4591890724c2 100644 (file)
@@ -1,71 +1,71 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbRoles : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbRoles() : base("Roles")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "rdb$role_name AS ROLE_NAME, " +\r
-                                       "rdb$owner_name AS OWNER_NAME " +\r
-                               "FROM rdb$roles");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$role_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$role_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbRoles : FbDbSchema
+       {
+               #region Constructors
+
+               public FbRoles() : base("Roles")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "rdb$role_name AS ROLE_NAME, " +
+                                       "rdb$owner_name AS OWNER_NAME " +
+                               "FROM rdb$roles");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$role_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$role_name");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index a82c5c46d51f5d6604bcc195c281325226eea844..9c7d0679d23cc6ad1b7542029fe5cab21b0ea4ca 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbTableConstraints : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbTableConstraints() : base("TableConstraints")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS CONSTRAINT_CATALOG, " +\r
-                                       "null AS CONSTRAINT_SCHEMA, " +\r
-                                       "rc.rdb$constraint_name AS CONSTRAINT_NAME, " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rc.rdb$relation_name AS TABLE_NAME, " +\r
-                                       "rc.rdb$constraint_type AS CONSTRAINT_TYPE, " +\r
-                                       "rc.rdb$deferrable AS IS_DEFERRABLE, " +\r
-                                       "rc.rdb$initially_deferred AS INITIALLY_DEFERRED " +\r
-                               "FROM " +\r
-                                       "rdb$relation_constraints rc");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* CONSTRAINT_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CONSTRAINT_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* CONSTRAINT_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rc.rdb$constraint_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 5 && restrictions[4] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 6 && restrictions[5] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rc.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* CONSTRAINT_TYPE */\r
-                               if (restrictions.Length >= 7 && restrictions[6] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rc.rdb$constraint_type = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rc.rdb$relation_name, rc.rdb$constraint_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override object[] ParseRestrictions(object[] restrictions)\r
-               {\r
-                       object[] parsed = restrictions;\r
-\r
-                       if (parsed != null)\r
-                       {\r
-                               if (parsed.Length == 7 && parsed[6] != null)\r
-                               {\r
-                                       switch (parsed[6].ToString().ToUpper(CultureInfo.CurrentCulture))\r
-                                       {\r
-                                               case "UNIQUE":\r
-                                                       parsed[3] = "u";\r
-                                                       break;\r
-\r
-                                               case "PRIMARY KEY":\r
-                                                       parsed[3] = "p";\r
-                                                       break;\r
-\r
-                                               case "FOREIGN KEY":\r
-                                                       parsed[3] = "f";\r
-                                                       break;\r
-\r
-                                               case "CHECK":\r
-                                                       parsed[3] = "c";\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return parsed;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbTableConstraints : FbDbSchema
+       {
+               #region Constructors
+
+               public FbTableConstraints() : base("TableConstraints")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS CONSTRAINT_CATALOG, " +
+                                       "null AS CONSTRAINT_SCHEMA, " +
+                                       "rc.rdb$constraint_name AS CONSTRAINT_NAME, " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rc.rdb$relation_name AS TABLE_NAME, " +
+                                       "rc.rdb$constraint_type AS CONSTRAINT_TYPE, " +
+                                       "rc.rdb$deferrable AS IS_DEFERRABLE, " +
+                                       "rc.rdb$initially_deferred AS INITIALLY_DEFERRED " +
+                               "FROM " +
+                                       "rdb$relation_constraints rc");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* CONSTRAINT_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* CONSTRAINT_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* CONSTRAINT_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rc.rdb$constraint_name = @p{0}", index++);
+                               }
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 5 && restrictions[4] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 6 && restrictions[5] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rc.rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* CONSTRAINT_TYPE */
+                               if (restrictions.Length >= 7 && restrictions[6] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rc.rdb$constraint_type = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rc.rdb$relation_name, rc.rdb$constraint_name");
+
+                       return sql;
+               }
+
+               protected override object[] ParseRestrictions(object[] restrictions)
+               {
+                       object[] parsed = restrictions;
+
+                       if (parsed != null)
+                       {
+                               if (parsed.Length == 7 && parsed[6] != null)
+                               {
+                                       switch (parsed[6].ToString().ToUpper(CultureInfo.CurrentCulture))
+                                       {
+                                               case "UNIQUE":
+                                                       parsed[3] = "u";
+                                                       break;
+
+                                               case "PRIMARY KEY":
+                                                       parsed[3] = "p";
+                                                       break;
+
+                                               case "FOREIGN KEY":
+                                                       parsed[3] = "f";
+                                                       break;
+
+                                               case "CHECK":
+                                                       parsed[3] = "c";
+                                                       break;
+                                       }
+                               }
+                       }
+
+                       return parsed;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 4d9ae9e7925feef2de0ebd64fc3184bc9dee3d6d..0fb91df08711510ae44241150c1ef88e575146dd 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbTablePrivileges : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbTablePrivileges() : base("TablePrivileges")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rdb$relation_name AS TABLE_NAME, " +\r
-                                       "rdb$user AS GRANTEE, " +\r
-                                       "rdb$grantor AS GRANTOR, " +\r
-                                       "rdb$privilege AS PRIVILEGE, " +\r
-                                       "rdb$grant_option AS WITH_GRANT " +\r
-                               "FROM " +\r
-                                       "rdb$user_privileges");\r
-\r
-                       where.Append("rdb$object_type = 0");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTOR */\r
-                               if (restrictions.Length >= 4 && restrictions[4] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$grantor = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTEE */\r
-                               if (restrictions.Length >= 5 && restrictions[4] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$user = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$relation_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbTablePrivileges : FbDbSchema
+       {
+               #region Constructors
+
+               public FbTablePrivileges() : base("TablePrivileges")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rdb$relation_name AS TABLE_NAME, " +
+                                       "rdb$user AS GRANTEE, " +
+                                       "rdb$grantor AS GRANTOR, " +
+                                       "rdb$privilege AS PRIVILEGE, " +
+                                       "rdb$grant_option AS WITH_GRANT " +
+                               "FROM " +
+                                       "rdb$user_privileges");
+
+                       where.Append("rdb$object_type = 0");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* GRANTOR */
+                               if (restrictions.Length >= 4 && restrictions[4] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$grantor = @p{0}", index++);
+                               }
+
+                               /* GRANTEE */
+                               if (restrictions.Length >= 5 && restrictions[4] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$user = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$relation_name");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 6efa749b3ac9b891522c1c7dcb0f0c92521c28c8..d80acf0cb6eed9c04b9dd13065599419aefd5d19 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbTables : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbTables() : base("Tables")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rdb$relation_name AS TABLE_NAME, " +\r
-                                       "null AS TABLE_TYPE, " +\r
-                                       "rdb$system_flag AS IS_SYSTEM_TABLE, " +\r
-                                       "rdb$owner_name AS OWNER_NAME, " +\r
-                                       "rdb$description AS DESCRIPTION, " +\r
-                                       "rdb$view_source AS VIEW_SOURCE " +\r
-                               "FROM " +\r
-                                       "rdb$relations");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* TABLE_TYPE */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       switch (restrictions[3].ToString())\r
-                                       {\r
-                                               case "VIEW":\r
-                                                       where.Append("rdb$view_source IS NOT NULL");\r
-                                                       break;\r
-\r
-                                               case "SYSTEM TABLE":\r
-                                                       where.Append("rdb$view_source IS NULL and rdb$system_flag = 1");\r
-                                                       break;\r
-\r
-                                               case "TABLE":\r
-                                               default:\r
-                                                       where.Append("rdb$view_source IS NULL and rdb$system_flag = 0");\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$system_flag, rdb$owner_name, rdb$relation_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               row["TABLE_TYPE"] = "TABLE";\r
-                               if (row["IS_SYSTEM_TABLE"] == DBNull.Value ||\r
-                                       Convert.ToInt32(row["IS_SYSTEM_TABLE"], CultureInfo.InvariantCulture) == 0)\r
-                               {\r
-                                       row["IS_SYSTEM_TABLE"] = false;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_SYSTEM_TABLE"] = true;\r
-                                       row["TABLE_TYPE"] = "SYSTEM_TABLE";\r
-                               }\r
-                               if (row["VIEW_SOURCE"] != null &&\r
-                                       row["VIEW_SOURCE"].ToString().Length > 0)\r
-                               {\r
-                                       row["TABLE_TYPE"] = "VIEW";\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       schema.Columns.Remove("VIEW_SOURCE");\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbTables : FbDbSchema
+       {
+               #region Constructors
+
+               public FbTables() : base("Tables")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rdb$relation_name AS TABLE_NAME, " +
+                                       "null AS TABLE_TYPE, " +
+                                       "rdb$system_flag AS IS_SYSTEM_TABLE, " +
+                                       "rdb$owner_name AS OWNER_NAME, " +
+                                       "rdb$description AS DESCRIPTION, " +
+                                       "rdb$view_source AS VIEW_SOURCE " +
+                               "FROM " +
+                                       "rdb$relations");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* TABLE_TYPE */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       switch (restrictions[3].ToString())
+                                       {
+                                               case "VIEW":
+                                                       where.Append("rdb$view_source IS NOT NULL");
+                                                       break;
+
+                                               case "SYSTEM TABLE":
+                                                       where.Append("rdb$view_source IS NULL and rdb$system_flag = 1");
+                                                       break;
+
+                                               case "TABLE":
+                                               default:
+                                                       where.Append("rdb$view_source IS NULL and rdb$system_flag = 0");
+                                                       break;
+                                       }
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$system_flag, rdb$owner_name, rdb$relation_name");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               row["TABLE_TYPE"] = "TABLE";
+                               if (row["IS_SYSTEM_TABLE"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_SYSTEM_TABLE"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_SYSTEM_TABLE"] = false;
+                               }
+                               else
+                               {
+                                       row["IS_SYSTEM_TABLE"] = true;
+                                       row["TABLE_TYPE"] = "SYSTEM_TABLE";
+                               }
+                               if (row["VIEW_SOURCE"] != null &&
+                                       row["VIEW_SOURCE"].ToString().Length > 0)
+                               {
+                                       row["TABLE_TYPE"] = "VIEW";
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       schema.Columns.Remove("VIEW_SOURCE");
+
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index cc0d2e1f5440f9cec10d94a962e610b225f948a4..39e7bc885d3a9b5855187de6bd4b5d5fcad33280 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbTriggers : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbTriggers() : base("Triggers")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rdb$relation_name AS TABLE_NAME, " +\r
-                                       "rdb$trigger_name AS TRIGGER_NAME, " +\r
-                                       "rdb$system_flag AS IS_SYSTEM_TRIGGER, " +\r
-                                       "rdb$trigger_type AS TRIGGER_TYPE, " +\r
-                                       "rdb$trigger_inactive AS IS_INACTIVE, " +\r
-                                       "rdb$trigger_sequence AS SEQUENCE, " +\r
-                                       "rdb$trigger_source AS SOURCE, " +\r
-                                       "rdb$description AS DESCRIPTION " +\r
-                               "FROM " +\r
-                                       "rdb$triggers");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* TRIGGER_NAME */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$trigger_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rdb$relation_name, rdb$trigger_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               if (row["IS_SYSTEM_TRIGGER"] == DBNull.Value ||\r
-                                       Convert.ToInt32(row["IS_SYSTEM_TRIGGER"], CultureInfo.InvariantCulture) == 0)\r
-                               {\r
-                                       row["IS_SYSTEM_TRIGGER"] = false;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_SYSTEM_TRIGGER"] = true;\r
-                               }\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       return schema;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbTriggers : FbDbSchema
+       {
+               #region Constructors
+
+               public FbTriggers() : base("Triggers")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rdb$relation_name AS TABLE_NAME, " +
+                                       "rdb$trigger_name AS TRIGGER_NAME, " +
+                                       "rdb$system_flag AS IS_SYSTEM_TRIGGER, " +
+                                       "rdb$trigger_type AS TRIGGER_TYPE, " +
+                                       "rdb$trigger_inactive AS IS_INACTIVE, " +
+                                       "rdb$trigger_sequence AS SEQUENCE, " +
+                                       "rdb$trigger_source AS SOURCE, " +
+                                       "rdb$description AS DESCRIPTION " +
+                               "FROM " +
+                                       "rdb$triggers");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* TRIGGER_NAME */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       where.AppendFormat(CultureInfo.CurrentCulture, "rdb$trigger_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rdb$relation_name, rdb$trigger_name");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               if (row["IS_SYSTEM_TRIGGER"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_SYSTEM_TRIGGER"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_SYSTEM_TRIGGER"] = false;
+                               }
+                               else
+                               {
+                                       row["IS_SYSTEM_TRIGGER"] = true;
+                               }
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       return schema;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 9cf32870d9876eed2e5264f1b2ae7021ab3a7ac0..7a7b6071659ba2433377de939a6d32334e58da92 100644 (file)
@@ -1,91 +1,91 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbUniqueKeys : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbUniqueKeys() : base("PrimaryKeys")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS TABLE_CATALOG, " +\r
-                                       "null AS TABLE_SCHEMA, " +\r
-                                       "rel.rdb$relation_name AS TABLE_NAME, " +\r
-                                       "seg.rdb$field_name AS COLUMN_NAME, " +\r
-                                       "seg.rdb$field_position AS ORDINAL_POSITION, " +\r
-                                       "rel.rdb$constraint_name AS UK_NAME " +\r
-                               "FROM " +\r
-                                       "rdb$relation_constraints rel " +\r
-                                       "left join rdb$indices idx ON rel.rdb$index_name = idx.rdb$index_name " +\r
-                                       "left join rdb$index_segments seg ON idx.rdb$index_name = seg.rdb$index_name");\r
-\r
-                       where.Append("rel.rdb$constraint_type = 'UNIQUE'");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* TABLE_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* TABLE_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rel.rdb$relation_name, rel.rdb$constraint_name, seg.rdb$field_position");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbUniqueKeys : FbDbSchema
+       {
+               #region Constructors
+
+               public FbUniqueKeys() : base("UniqueKeys")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS TABLE_CATALOG, " +
+                                       "null AS TABLE_SCHEMA, " +
+                                       "rel.rdb$relation_name AS TABLE_NAME, " +
+                                       "seg.rdb$field_name AS COLUMN_NAME, " +
+                                       "seg.rdb$field_position AS ORDINAL_POSITION, " +
+                                       "rel.rdb$constraint_name AS UK_NAME " +
+                               "FROM " +
+                                       "rdb$relation_constraints rel " +
+                                       "left join rdb$indices idx ON rel.rdb$index_name = idx.rdb$index_name " +
+                                       "left join rdb$index_segments seg ON idx.rdb$index_name = seg.rdb$index_name");
+
+                       where.Append("rel.rdb$constraint_type = 'UNIQUE'");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* TABLE_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* TABLE_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* TABLE_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rel.rdb$relation_name, rel.rdb$constraint_name, seg.rdb$field_position");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index cdd7943df205e1218bed8744aa77963c1218a35c..b89c8e775a651dbc487f5e392d080d35d955e26a 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbViewColumnUsage : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbViewColumnUsage() : base("ViewColumnUsage")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS VIEW_CATALOG, " +\r
-                                       "null AS VIEW_SCHEMA, " +\r
-                                       "rel.rdb$relation_name AS VIEW_NAME, " +\r
-                                       "rfr.rdb$field_name AS COLUMN_NAME, " +\r
-                                       "null AS COLUMN_DATA_TYPE, " +\r
-                                       "fld.rdb$field_sub_type AS COLUMN_SUB_TYPE, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS COLUMN_SIZE, " +\r
-                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +\r
-                                       "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " +\r
-                                       "cast(fld.rdb$character_length AS integer) AS CHARACTER_LENGTH, " +\r
-                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +\r
-                                       "rfr.rdb$field_position AS ORDINAL_POSITION, " +\r
-                                       "fld.rdb$default_source AS COLUMN_DEFAULT, " +\r
-                                       "fld.rdb$null_flag AS IS_NULLABLE, " +\r
-                                       "fld.rdb$dimensions AS IS_ARRAY, " +\r
-                                       "0 AS IS_READONLY, " +\r
-                                       "fld.rdb$field_type AS FIELD_TYPE, " +\r
-                                       "null AS CHARACTER_SET_CATALOG, " +\r
-                                       "null AS CHARACTER_SET_SCHEMA, " +\r
-                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +\r
-                                       "null AS COLLATION_CATALOG, " +\r
-                                       "null AS COLLATION_SCHEMA, " +\r
-                                       "coll.rdb$collation_name AS COLLATION_NAME, " +\r
-                                       "rfr.rdb$description AS DESCRIPTION " +\r
-                               "FROM " +\r
-                                       "rdb$relations rel " +\r
-                                       "left join rdb$relation_fields rfr ON rel.rdb$relation_name = rfr.rdb$relation_name " +\r
-                                       "left join rdb$fields fld ON rfr.rdb$field_source = fld.rdb$field_name " +\r
-                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +\r
-                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)");\r
-\r
-                       where.Append("rel.rdb$view_source IS NOT NULL");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* VIEW_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* VIEW_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* VIEW_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rel.rdb$relation_name, rfr.rdb$field_position");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               protected override DataTable ProcessResult(DataTable schema)\r
-               {\r
-                       schema.BeginLoadData();\r
-\r
-                       foreach (DataRow row in schema.Rows)\r
-                       {\r
-                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);\r
-\r
-                               int subType = 0;\r
-                               if (row["COLUMN_SUB_TYPE"] != System.DBNull.Value)\r
-                               {\r
-                                       subType = Convert.ToInt32(row["COLUMN_SUB_TYPE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               int scale = 0;\r
-                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)\r
-                               {\r
-                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);\r
-                               }\r
-\r
-                               if (row["IS_NULLABLE"] == DBNull.Value)\r
-                               {\r
-                                       row["IS_NULLABLE"] = true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_NULLABLE"] = false;\r
-                               }\r
-\r
-                               if (row["IS_ARRAY"] == DBNull.Value ||\r
-                                       Convert.ToInt32(row["IS_ARRAY"], CultureInfo.InvariantCulture) == 0)\r
-                               {\r
-                                       row["IS_ARRAY"] = false;\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["IS_ARRAY"] = true;\r
-                               }\r
-\r
-                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);\r
-                               row["COLUMN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);\r
-\r
-                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)\r
-                               {\r
-                                       row["COLUMN_SIZE"] = row["CHARACTER_LENGTH"];\r
-                               }\r
-                               else\r
-                               {\r
-                                       row["CHARACTER_OCTET_LENGTH"] = 0;\r
-                               }\r
-\r
-                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)\r
-                               {\r
-                                       row["COLUMN_SIZE"] = Int32.MaxValue;\r
-                               }\r
-\r
-                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&\r
-                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))\r
-                               {\r
-                                       row["NUMERIC_PRECISION"] = row["COLUMN_SIZE"];\r
-                               }\r
-\r
-                               row["NUMERIC_SCALE"] = (-1) * scale;\r
-                       }\r
-\r
-                       schema.EndLoadData();\r
-                       schema.AcceptChanges();\r
-\r
-                       // Remove not more needed columns\r
-                       schema.Columns.Remove("FIELD_TYPE");\r
-                       schema.Columns.Remove("CHARACTER_LENGTH");\r
-\r
-                       return schema;\r
-               }\r
-\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbViewColumnUsage : FbDbSchema
+       {
+               #region Constructors
+
+               public FbViewColumnUsage() : base("ViewColumnUsage")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS VIEW_CATALOG, " +
+                                       "null AS VIEW_SCHEMA, " +
+                                       "rel.rdb$relation_name AS VIEW_NAME, " +
+                                       "rfr.rdb$field_name AS COLUMN_NAME, " +
+                                       "null AS COLUMN_DATA_TYPE, " +
+                                       "fld.rdb$field_sub_type AS COLUMN_SUB_TYPE, " +
+                                       "cast(fld.rdb$field_length AS integer) AS COLUMN_SIZE, " +
+                                       "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " +
+                                       "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " +
+                    "cast(fld.rdb$character_length AS integer) AS \"CHARACTER_LENGTH\", " +
+                                       "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " +
+                                       "rfr.rdb$field_position AS ORDINAL_POSITION, " +
+                                       "fld.rdb$default_source AS COLUMN_DEFAULT, " +
+                                       "fld.rdb$null_flag AS IS_NULLABLE, " +
+                                       "fld.rdb$dimensions AS IS_ARRAY, " +
+                                       "0 AS IS_READONLY, " +
+                                       "fld.rdb$field_type AS FIELD_TYPE, " +
+                                       "null AS CHARACTER_SET_CATALOG, " +
+                                       "null AS CHARACTER_SET_SCHEMA, " +
+                                       "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +
+                                       "null AS COLLATION_CATALOG, " +
+                                       "null AS COLLATION_SCHEMA, " +
+                                       "coll.rdb$collation_name AS COLLATION_NAME, " +
+                                       "rfr.rdb$description AS DESCRIPTION " +
+                               "FROM " +
+                                       "rdb$relations rel " +
+                                       "left join rdb$relation_fields rfr ON rel.rdb$relation_name = rfr.rdb$relation_name " +
+                                       "left join rdb$fields fld ON rfr.rdb$field_source = fld.rdb$field_name " +
+                                       "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " +
+                                       "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)");
+
+                       where.Append("rel.rdb$view_source IS NOT NULL");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* VIEW_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* VIEW_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* VIEW_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rel.rdb$relation_name, rfr.rdb$field_position");
+
+                       return sql;
+               }
+
+               protected override DataTable ProcessResult(DataTable schema)
+               {
+                       schema.BeginLoadData();
+
+                       foreach (DataRow row in schema.Rows)
+                       {
+                               int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture);
+
+                               int subType = 0;
+                               if (row["COLUMN_SUB_TYPE"] != System.DBNull.Value)
+                               {
+                                       subType = Convert.ToInt32(row["COLUMN_SUB_TYPE"], CultureInfo.InvariantCulture);
+                               }
+
+                               int scale = 0;
+                               if (row["NUMERIC_SCALE"] != System.DBNull.Value)
+                               {
+                                       scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);
+                               }
+
+                               if (row["IS_NULLABLE"] == DBNull.Value)
+                               {
+                                       row["IS_NULLABLE"] = true;
+                               }
+                               else
+                               {
+                                       row["IS_NULLABLE"] = false;
+                               }
+
+                               if (row["IS_ARRAY"] == DBNull.Value ||
+                                       Convert.ToInt32(row["IS_ARRAY"], CultureInfo.InvariantCulture) == 0)
+                               {
+                                       row["IS_ARRAY"] = false;
+                               }
+                               else
+                               {
+                                       row["IS_ARRAY"] = true;
+                               }
+
+                               FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale);
+                               row["COLUMN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture);
+
+                               if (dbType == FbDbType.Char || dbType == FbDbType.VarChar)
+                               {
+                                       row["COLUMN_SIZE"] = row["CHARACTER_LENGTH"];
+                               }
+                               else
+                               {
+                                       row["CHARACTER_OCTET_LENGTH"] = 0;
+                               }
+
+                               if (dbType == FbDbType.Binary || dbType == FbDbType.Text)
+                               {
+                                       row["COLUMN_SIZE"] = Int32.MaxValue;
+                               }
+
+                               if (row["NUMERIC_PRECISION"] == System.DBNull.Value &&
+                                  (dbType == FbDbType.Decimal || dbType == FbDbType.Numeric))
+                               {
+                                       row["NUMERIC_PRECISION"] = row["COLUMN_SIZE"];
+                               }
+
+                               row["NUMERIC_SCALE"] = (-1) * scale;
+                       }
+
+                       schema.EndLoadData();
+                       schema.AcceptChanges();
+
+                       // Remove not more needed columns
+                       schema.Columns.Remove("FIELD_TYPE");
+                       schema.Columns.Remove("CHARACTER_LENGTH");
+
+                       return schema;
+               }
+
+
+               #endregion
+       }
 }
\ No newline at end of file
index 47d39b9aa5e4196640c9de5b74c5b1300492aefb..f6cd82ae16db805c49d3f5510cc149e65f77bcb2 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbViewPrivileges : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbViewPrivileges() : base("ViewPrivileges")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS VIEW_CATALOG, " +\r
-                                       "null AS VIEW_SCHEMA, " +\r
-                                       "priv.rdb$relation_name AS VIEW_NAME, " +\r
-                                       "priv.rdb$user AS GRANTEE, " +\r
-                                       "priv.rdb$grantor AS GRANTOR, " +\r
-                                       "priv.rdb$privilege AS PRIVILEGE, " +\r
-                                       "priv.rdb$grant_option AS WITH_GRANT " +\r
-                               "FROM " +\r
-                                       "rdb$user_privileges priv " +\r
-                                       "left join rdb$relations rel ON priv.rdb$relation_name = rel.rdb$relation_name");\r
-\r
-                       where.Append("priv.rdb$object_type = 0");\r
-                       where.Append(" AND rel.rdb$view_source IS NOT NULL");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* VIEW_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* VIEW_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* VIEW_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND priv.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTOR */\r
-                               if (restrictions.Length >= 4 && restrictions[3] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND priv.rdb$grantor = @p{0}", index++);\r
-                               }\r
-\r
-                               /* GRANTEE */\r
-                               if (restrictions.Length >= 5 && restrictions[4] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND priv.rdb$user = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY priv.rdb$relation_name, priv.rdb$user");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbViewPrivileges : FbDbSchema
+       {
+               #region Constructors
+
+               public FbViewPrivileges() : base("ViewPrivileges")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS VIEW_CATALOG, " +
+                                       "null AS VIEW_SCHEMA, " +
+                                       "priv.rdb$relation_name AS VIEW_NAME, " +
+                                       "priv.rdb$user AS GRANTEE, " +
+                                       "priv.rdb$grantor AS GRANTOR, " +
+                                       "priv.rdb$privilege AS PRIVILEGE, " +
+                                       "priv.rdb$grant_option AS WITH_GRANT " +
+                               "FROM " +
+                                       "rdb$user_privileges priv " +
+                                       "left join rdb$relations rel ON priv.rdb$relation_name = rel.rdb$relation_name");
+
+                       where.Append("priv.rdb$object_type = 0");
+                       where.Append(" AND rel.rdb$view_source IS NOT NULL");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* VIEW_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* VIEW_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* VIEW_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND priv.rdb$relation_name = @p{0}", index++);
+                               }
+
+                               /* GRANTOR */
+                               if (restrictions.Length >= 4 && restrictions[3] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND priv.rdb$grantor = @p{0}", index++);
+                               }
+
+                               /* GRANTEE */
+                               if (restrictions.Length >= 5 && restrictions[4] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND priv.rdb$user = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY priv.rdb$relation_name, priv.rdb$user");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 9a7ea8f9b66c7f517704d8baaa98f8bd9a794ef8..c0d5d6b62e47c24563ea774efdc5f90d6b6c5382 100644 (file)
@@ -1,88 +1,88 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird.DbSchema\r
-{\r
-       internal class FbViews : FbDbSchema\r
-       {\r
-               #region Constructors\r
-\r
-               public FbViews() : base("Views")\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override StringBuilder GetCommandText(object[] restrictions)\r
-               {\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       sql.Append(\r
-                               @"SELECT " +\r
-                                       "null AS VIEW_CATALOG, " +\r
-                                       "null AS VIEW_SCHEMA, " +\r
-                                       "rel.rdb$relation_name AS VIEW_NAME, " +\r
-                                       "rel.rdb$view_source AS DEFINITION, " +\r
-                                       "rel.rdb$description AS DESCRIPTION " +\r
-                               "FROM " +\r
-                                       "rdb$relations rel");\r
-\r
-                       where.Append("rel.rdb$view_source IS NOT NULL");\r
-\r
-                       if (restrictions != null)\r
-                       {\r
-                               int index = 0;\r
-\r
-                               /* VIEW_CATALOG */\r
-                               if (restrictions.Length >= 1 && restrictions[0] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* VIEW_SCHEMA */\r
-                               if (restrictions.Length >= 2 && restrictions[1] != null)\r
-                               {\r
-                               }\r
-\r
-                               /* VIEW_NAME */\r
-                               if (restrictions.Length >= 3 && restrictions[2] != null)\r
-                               {\r
-                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);\r
-                               }\r
-                       }\r
-\r
-                       if (where.Length > 0)\r
-                       {\r
-                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());\r
-                       }\r
-\r
-                       sql.Append(" ORDER BY rel.rdb$relation_name");\r
-\r
-                       return sql;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird.DbSchema
+{
+       internal class FbViews : FbDbSchema
+       {
+               #region Constructors
+
+               public FbViews() : base("Views")
+               {
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override StringBuilder GetCommandText(object[] restrictions)
+               {
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       sql.Append(
+                               @"SELECT " +
+                                       "null AS VIEW_CATALOG, " +
+                                       "null AS VIEW_SCHEMA, " +
+                                       "rel.rdb$relation_name AS VIEW_NAME, " +
+                                       "rel.rdb$view_source AS DEFINITION, " +
+                                       "rel.rdb$description AS DESCRIPTION " +
+                               "FROM " +
+                                       "rdb$relations rel");
+
+                       where.Append("rel.rdb$view_source IS NOT NULL");
+
+                       if (restrictions != null)
+                       {
+                               int index = 0;
+
+                               /* VIEW_CATALOG */
+                               if (restrictions.Length >= 1 && restrictions[0] != null)
+                               {
+                               }
+
+                               /* VIEW_SCHEMA */
+                               if (restrictions.Length >= 2 && restrictions[1] != null)
+                               {
+                               }
+
+                               /* VIEW_NAME */
+                               if (restrictions.Length >= 3 && restrictions[2] != null)
+                               {
+                                       where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$relation_name = @p{0}", index++);
+                               }
+                       }
+
+                       if (where.Length > 0)
+                       {
+                               sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
+                       }
+
+                       sql.Append(" ORDER BY rel.rdb$relation_name");
+
+                       return sql;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 07b7d5d02e1bf4530354ea913767ca15d112c0e6..fc1c53888ad6225f6c80ad42d9488c08ff1e4e04 100644 (file)
@@ -1,84 +1,84 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Serializable]\r
-#endif\r
-       public enum FbCharset : int\r
-       {\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Default"]/*'/>\r
-               Default                 = -1,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="None"]/*'/>\r
-               None                    = 0,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Octets"]/*'/>\r
-               Octets                  = 1,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Ascii"]/*'/>\r
-               Ascii                   = 2,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="UnicodeFss"]/*'/>\r
-               UnicodeFss              = 3,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="ShiftJis0208"]/*'/>\r
-               ShiftJis0208    = 5,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="EucJapanese0208"]/*'/>\r
-               EucJapanese0208 = 6,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Iso2022Japanese"]/*'/>\r
-               Iso2022Japanese = 7,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos437"]/*'/>\r
-               Dos437                  = 10,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos850"]/*'/>\r
-               Dos850                  = 11,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos865"]/*'/>\r
-               Dos865                  = 12,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos860"]/*'/>\r
-               Dos860                  = 13,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos863"]/*'/>\r
-               Dos863                  = 14,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Iso8859_1"]/*'/>\r
-               Iso8859_1               = 21,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Iso8859_2"]/*'/>\r
-               Iso8859_2               = 22,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Ksc5601"]/*'/>\r
-               Ksc5601                 = 44,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos861"]/*'/>\r
-               Dos861                  = 47,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1250"]/*'/>\r
-               Windows1250             = 51,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1251"]/*'/>\r
-               Windows1251             = 52,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1252"]/*'/>\r
-               Windows1252             = 53,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1253"]/*'/>\r
-               Windows1253             = 54,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1254"]/*'/>\r
-               Windows1254             = 55,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Big5"]/*'/>\r
-               Big5                    = 56,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Gb2312"]/*'/>\r
-               Gb2312                  = 57,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1255"]/*'/>\r
-               Windows1255             = 58,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1256"]/*'/>\r
-               Windows1256             = 59,\r
-               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1257"]/*'/>\r
-               Windows1257             = 60\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/overview/*'/>
+#if    (!NETCF)
+       [Serializable]
+#endif
+       public enum FbCharset : int
+       {
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Default"]/*'/>
+               Default                 = -1,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="None"]/*'/>
+               None                    = 0,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Octets"]/*'/>
+               Octets                  = 1,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Ascii"]/*'/>
+               Ascii                   = 2,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="UnicodeFss"]/*'/>
+               UnicodeFss              = 3,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="ShiftJis0208"]/*'/>
+               ShiftJis0208    = 5,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="EucJapanese0208"]/*'/>
+               EucJapanese0208 = 6,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Iso2022Japanese"]/*'/>
+               Iso2022Japanese = 7,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos437"]/*'/>
+               Dos437                  = 10,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos850"]/*'/>
+               Dos850                  = 11,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos865"]/*'/>
+               Dos865                  = 12,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos860"]/*'/>
+               Dos860                  = 13,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos863"]/*'/>
+               Dos863                  = 14,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Iso8859_1"]/*'/>
+               Iso8859_1               = 21,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Iso8859_2"]/*'/>
+               Iso8859_2               = 22,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Ksc5601"]/*'/>
+               Ksc5601                 = 44,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Dos861"]/*'/>
+               Dos861                  = 47,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1250"]/*'/>
+               Windows1250             = 51,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1251"]/*'/>
+               Windows1251             = 52,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1252"]/*'/>
+               Windows1252             = 53,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1253"]/*'/>
+               Windows1253             = 54,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1254"]/*'/>
+               Windows1254             = 55,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Big5"]/*'/>
+               Big5                    = 56,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Gb2312"]/*'/>
+               Gb2312                  = 57,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1255"]/*'/>
+               Windows1255             = 58,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1256"]/*'/>
+               Windows1256             = 59,
+               /// <include file='Doc/en_EN/FbCharset.xml'     path='doc/enum[@name="FbCharset"]/field[@name="Windows1257"]/*'/>
+               Windows1257             = 60
+       }
+}
index f3bb394718cea621f432c0f92c80ae882d663735..a21e98bc5085455fbcb94788310ae6209c2d0f52 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-using System.ComponentModel;\r
-using System.Data;\r
-using System.Drawing;\r
-using System.Globalization;\r
-using System.Text;\r
-using System.Text.RegularExpressions;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/overview/*'/>\r
-#if    (NET)\r
-       [ToolboxItem(true)]\r
-       [ToolboxBitmap(typeof(FbCommand), "Resources.FbCommand.bmp")]\r
-       [Designer(typeof(Design.FbCommandDesigner), typeof(System.ComponentModel.Design.IDesigner))]\r
-#endif\r
-       public sealed class FbCommand : Component, IDbCommand, ICloneable\r
-       {\r
-               #region Private static fields\r
-\r
-               private static Regex namedRegex = new Regex(\r
-                       @"(('[^']*?\@[^']*')*[^'@]*?)*(?<param>@\w+)*([^'@]*?('[^']*?\@*[^']*'))*",\r
-                       RegexOptions.Compiled | RegexOptions.ExplicitCapture);\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private CommandType                             commandType;\r
-               private UpdateRowSource                 updatedRowSource;\r
-               private FbConnection                    connection;\r
-               private FbTransaction                   transaction;\r
-               private FbParameterCollection   parameters;\r
-               private StatementBase                   statement;\r
-               private FbDataReader                    activeReader;\r
-               private StringCollection                namedParameters;\r
-               private string                                  commandText;\r
-               private bool                                    disposed;\r
-               private bool                                    designTimeVisible;\r
-               private bool                                    implicitTransaction;\r
-               private int                                             commandTimeout;\r
-               private int                                             fetchSize;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="CommandText"]/*'/>\r
-#if    (NET)\r
-               [Category("Data")]\r
-               [DefaultValue("")]\r
-               [RefreshProperties(RefreshProperties.All)]\r
-               [Editor(typeof(Design.FbCommandTextUIEditor), typeof(System.Drawing.Design.UITypeEditor))]\r
-#endif\r
-               public string CommandText\r
-               {\r
-                       get { return this.commandText; }\r
-                       set\r
-                       {\r
-                               lock (this)\r
-                               {\r
-                                       if (this.statement != null &&\r
-                                               this.commandText != null &&\r
-                                               this.commandText != value &&\r
-                                               this.commandText.Length != 0)\r
-                                       {\r
-                                               this.Release();\r
-                                       }\r
-\r
-                                       this.commandText = value;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="CommandType"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue(CommandType.Text), RefreshProperties(RefreshProperties.All)]\r
-#endif\r
-               public CommandType CommandType\r
-               {\r
-                       get { return this.commandType; }\r
-                       set { this.commandType = value; }\r
-               }\r
-\r
-               int IDbCommand.CommandTimeout\r
-               {\r
-                       get { return this.commandTimeout; }\r
-                       set\r
-                       {\r
-                               if (value < 0)\r
-                               {\r
-                                       throw new ArgumentException("The property value assigned is less than 0.");\r
-                               }\r
-\r
-                               this.commandTimeout = value;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="CommandPlan"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false)]\r
-#endif\r
-               public string CommandPlan\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.statement != null)\r
-                               {\r
-                                       return this.statement.GetExecutionPlan();\r
-                               }\r
-                               return null;\r
-                       }\r
-               }\r
-\r
-               IDbConnection IDbCommand.Connection\r
-               {\r
-                       get { return this.Connection; }\r
-                       set { this.Connection = (FbConnection)value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="Connection"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Behavior"), DefaultValue(null)]\r
-#endif\r
-               public FbConnection Connection\r
-               {\r
-                       get { return this.connection; }\r
-                       set\r
-                       {\r
-                               lock (this)\r
-                               {\r
-                                       if (this.activeReader != null)\r
-                                       {\r
-                                               throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");\r
-                                       }\r
-\r
-                                       if (this.transaction != null && this.transaction.IsUpdated)\r
-                                       {\r
-                                               this.transaction = null;\r
-                                       }\r
-\r
-                                       if (this.connection != null &&\r
-                                               this.connection != value &&\r
-                                               this.connection.State == ConnectionState.Open)\r
-                                       {\r
-                                               this.Release();\r
-                                       }\r
-\r
-                                       this.connection = value;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               IDataParameterCollection IDbCommand.Parameters\r
-               {\r
-                       get { return this.Parameters; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="Parameters"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data")]\r
-               [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]\r
-#endif\r
-               public FbParameterCollection Parameters\r
-               {\r
-                       get { return this.parameters; }\r
-               }\r
-\r
-               IDbTransaction IDbCommand.Transaction\r
-               {\r
-                       get { return this.Transaction; }\r
-                       set { this.Transaction = (FbTransaction)value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="Transaction"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public FbTransaction Transaction\r
-               {\r
-                       get { return this.implicitTransaction ? null : this.transaction; }\r
-                       set\r
-                       {\r
-                               lock (this)\r
-                               {\r
-                                       if (this.activeReader != null)\r
-                                       {\r
-                                               throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");\r
-                                       }\r
-\r
-                                       this.RollbackImplicitTransaction();\r
-\r
-                                       this.transaction = value;\r
-\r
-                                       if (this.statement != null)\r
-                                       {\r
-                                               if (this.transaction != null)\r
-                                               {\r
-                                                       this.statement.Transaction = this.transaction.Transaction;\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       this.statement.Transaction = null;\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="UpdatedRowSource"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Behavior"), DefaultValue(UpdateRowSource.Both)]\r
-#endif\r
-               public UpdateRowSource UpdatedRowSource\r
-               {\r
-                       get { return this.updatedRowSource; }\r
-                       set { this.updatedRowSource = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="FetchSize"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Behavior"), DefaultValue(200)]\r
-#endif\r
-               public int FetchSize\r
-               {\r
-                       get { return this.fetchSize; }\r
-                       set\r
-                       {\r
-                               if (this.activeReader != null)\r
-                               {\r
-                                       throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");\r
-                               }\r
-                               this.fetchSize = value;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Design-Time     properties\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="DesignTimeVisible"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignOnly(true), DefaultValue(true)]\r
-#endif\r
-               public bool DesignTimeVisible\r
-               {\r
-                       get { return this.designTimeVisible; }\r
-                       set\r
-                       {\r
-                               this.designTimeVisible = value;\r
-#if    (!NETCF)\r
-                               TypeDescriptor.Refresh(this);\r
-#endif\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Properties\r
-\r
-               internal int RecordsAffected\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.statement != null)\r
-                               {\r
-                                       return this.statement.RecordsAffected;\r
-                               }\r
-                               return -1;\r
-                       }\r
-               }\r
-\r
-               internal bool IsDisposed\r
-               {\r
-                       get { return this.disposed; }\r
-               }\r
-\r
-               internal FbDataReader ActiveReader\r
-               {\r
-                       get { return this.activeReader; }\r
-                       set { this.activeReader = value; }\r
-               }\r
-\r
-               internal FbTransaction ActiveTransaction\r
-               {\r
-                       get { return this.transaction; }\r
-               }\r
-\r
-               internal bool HasImplicitTransaction\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.implicitTransaction)\r
-                               {\r
-                                       return true;\r
-                               }\r
-                               return false;\r
-                       }\r
-               }\r
-\r
-        internal bool IsSelectCommand\r
-        {\r
-            get \r
-            {\r
-                if (this.statement.StatementType == DbStatementType.Select ||\r
-                    this.statement.StatementType == DbStatementType.SelectForUpdate)\r
-                {\r
-                    return true;\r
-                }\r
-                return false; \r
-            }\r
-        }\r
-\r
-        internal bool IsDDLCommand\r
-        {\r
-            get\r
-            {\r
-                return this.statement.StatementType == DbStatementType.DDL;\r
-            }\r
-        }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor"]/*'/>\r
-               public FbCommand() : this(null, null, null)\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor(System.String)"]/*'/>\r
-               public FbCommand(string cmdText) : this(cmdText, null, null)\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor(System.String,FbConnection)"]/*'/>\r
-               public FbCommand(string cmdText, FbConnection connection)\r
-                       : this(cmdText, connection, null)\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor(System.String,FbConnection,Transaction)"]/*'/>\r
-               public FbCommand(string cmdText, FbConnection connection, FbTransaction transaction)\r
-                       : base()\r
-               {\r
-                       this.parameters                 = new FbParameterCollection();\r
-                       this.namedParameters    = new StringCollection();\r
-                       this.updatedRowSource   = UpdateRowSource.Both;\r
-                       this.commandType                = CommandType.Text;\r
-                       this.designTimeVisible  = true;\r
-                       this.designTimeVisible  = true;\r
-                       this.commandTimeout             = 30;\r
-                       this.fetchSize                  = 200;\r
-                       this.commandText                = "";\r
-\r
-                       if (connection != null)\r
-                       {\r
-                               this.fetchSize = connection.ConnectionOptions.FetchSize;\r
-                       }\r
-\r
-                       if (cmdText != null)\r
-                       {\r
-                               this.CommandText = cmdText;\r
-                       }\r
-\r
-                       this.Connection  = connection;\r
-                       this.transaction = transaction;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="Dispose(System.Boolean)"]/*'/>\r
-               protected override void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.disposed)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // If there     are     an active reader close it\r
-                                               this.CloseReader();\r
-\r
-                                               // Release any unmanaged resources\r
-                                               this.Release();\r
-\r
-                                               // release any managed resources\r
-                                               if (disposing)\r
-                                               {\r
-                                                       this.implicitTransaction = false;\r
-                                                       this.commandText                = null;\r
-                                                       this.commandTimeout             = 0;\r
-                                                       this.connection                 = null;\r
-                                                       this.transaction                = null;\r
-                                                       this.parameters                 = null;\r
-\r
-                                                       this.namedParameters.Clear();\r
-                                                       this.namedParameters = null;\r
-                                               }\r
-\r
-                                               this.disposed = true;\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               base.Dispose(disposing);\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICloneable Methods\r
-\r
-               object ICloneable.Clone()\r
-               {\r
-                       FbCommand command = new FbCommand();\r
-\r
-                       command.CommandText     = this.commandText;\r
-                       command.Connection      = this.connection;\r
-                       command.Transaction = this.transaction;\r
-                       command.CommandType = this.CommandType;\r
-                       command.UpdatedRowSource = this.UpdatedRowSource;\r
-\r
-                       for (int i = 0; i < this.Parameters.Count; i++)\r
-                       {\r
-                               command.Parameters.Add(((ICloneable)this.Parameters[i]).Clone());\r
-                       }\r
-\r
-                       return command;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="Cancel"]/*'/>\r
-               public void Cancel()\r
-               {\r
-                       throw new NotSupportedException();\r
-               }\r
-\r
-               IDbDataParameter IDbCommand.CreateParameter()\r
-               {\r
-                       return CreateParameter();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="CreateParameter"]/*'/>\r
-               public FbParameter CreateParameter()\r
-               {\r
-                       return new FbParameter();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="Prepare"]/*'/>\r
-               public void Prepare()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               this.CheckCommand();\r
-\r
-                               try\r
-                               {\r
-                                       this.Prepare(false);\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                               catch (Exception)\r
-                               {\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteNonQuery"]/*'/>\r
-               public int ExecuteNonQuery()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               this.CheckCommand();\r
-\r
-                               try\r
-                               {\r
-                                       this.ExecuteCommand(CommandBehavior.Default);\r
-\r
-                                       if (this.CommandType == CommandType.StoredProcedure)\r
-                                       {\r
-                                               this.SetOutputParameters();\r
-                                       }\r
-\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.CommitImplicitTransaction();\r
-                                       }\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                               catch (Exception)\r
-                               {\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw;\r
-                               }\r
-                       }\r
-\r
-                       return this.statement.RecordsAffected;\r
-               }\r
-\r
-               IDataReader IDbCommand.ExecuteReader()\r
-               {\r
-                       return this.ExecuteReader();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteReader"]/*'/>\r
-               public FbDataReader ExecuteReader()\r
-               {\r
-                       return this.ExecuteReader(CommandBehavior.Default);\r
-               }\r
-\r
-               IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)\r
-               {\r
-                       return this.ExecuteReader(behavior);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteReader(System.Data.CommandBehavior)"]/*'/>\r
-               public FbDataReader ExecuteReader(CommandBehavior behavior)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               this.CheckCommand();\r
-\r
-                               try\r
-                               {\r
-                                       this.ExecuteCommand(behavior, true);\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                               catch\r
-                               {\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw;\r
-                               }\r
-                       }\r
-\r
-                       this.activeReader = new FbDataReader(this, this.connection, behavior);\r
-\r
-                       return this.activeReader;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteScalar"]/*'/>\r
-               public object ExecuteScalar()\r
-               {\r
-                       DbValue[]       values  = null;\r
-                       object          val             = null;\r
-\r
-                       lock (this)\r
-                       {\r
-                               this.CheckCommand();\r
-\r
-                               try\r
-                               {\r
-                                       this.ExecuteCommand(CommandBehavior.Default);\r
-\r
-                                       // Gets only the values of the first row or\r
-                                       // the output parameters values if the CommandType is\r
-                                       // StoredProcedure\r
-                                       if (this.CommandType == CommandType.StoredProcedure)\r
-                                       {\r
-                                               values = this.statement.GetOuputParameters();\r
-                                               this.SetOutputParameters(values);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               values = this.statement.Fetch();\r
-                                       }\r
-\r
-                                       // Get the return value\r
-                                       if (values != null && values.Length > 0)\r
-                                       {\r
-                                               val = values[0].Value;\r
-                                       }\r
-\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.CommitImplicitTransaction();\r
-                                       }\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       if (this.HasImplicitTransaction)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                               catch (Exception)\r
-                               {\r
-                                       if (this.implicitTransaction &&\r
-                                               this.transaction != null)\r
-                                       {\r
-                                               this.RollbackImplicitTransaction();\r
-                                       }\r
-\r
-                                       throw;\r
-                               }\r
-                       }\r
-\r
-                       return val;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Methods\r
-\r
-               internal void CloseReader()\r
-               {\r
-                       if (this.activeReader != null)\r
-                       {\r
-                               this.activeReader.Close();\r
-                               this.activeReader = null;\r
-                       }\r
-               }\r
-\r
-               internal DbValue[] Fetch()\r
-               {\r
-                       try\r
-                       {\r
-                               if (this.statement != null)\r
-                               {\r
-                                       // Fetch the next row\r
-                                       return this.statement.Fetch();\r
-                               }\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-\r
-                       return null;\r
-               }\r
-\r
-               internal Descriptor GetFieldsDescriptor()\r
-               {\r
-                       if (this.statement != null)\r
-                       {\r
-                               return this.statement.Fields;\r
-                       }\r
-\r
-                       return null;\r
-               }\r
-\r
-               internal void SetOutputParameters()\r
-               {\r
-                       this.SetOutputParameters(null);\r
-               }\r
-\r
-               internal void SetOutputParameters(DbValue[] outputParameterValues)\r
-               {\r
-                       if (this.parameters.Count > 0 && this.statement != null)\r
-                       {\r
-                               IEnumerator paramEnumerator = this.parameters.GetEnumerator();\r
-                               int i = 0;\r
-\r
-                               if (this.statement != null &&\r
-                                       this.statement.StatementType == DbStatementType.StoredProcedure)\r
-                               {\r
-                                       DbValue[] values = outputParameterValues;\r
-                                       if (outputParameterValues == null)\r
-                                       {\r
-                                               values = (DbValue[])this.statement.GetOuputParameters();\r
-                                       }\r
-\r
-                                       if (values != null && values.Length > 0)\r
-                                       {\r
-                                               while (paramEnumerator.MoveNext())\r
-                                               {\r
-                                                       FbParameter parameter = (FbParameter)paramEnumerator.Current;\r
-\r
-                                                       if (parameter.Direction == ParameterDirection.Output ||\r
-                                                               parameter.Direction == ParameterDirection.InputOutput ||\r
-                                                               parameter.Direction == ParameterDirection.ReturnValue)\r
-                                                       {\r
-                                                               parameter.Value = values[i].Value;\r
-                                                               i++;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               internal void CommitImplicitTransaction()\r
-               {\r
-                       if (this.implicitTransaction && \r
-                               this.transaction != null &&\r
-                               this.transaction.Transaction != null)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.transaction.Commit();\r
-                               }\r
-                               catch (Exception)\r
-                               {\r
-                                       this.RollbackImplicitTransaction();\r
-\r
-                                       throw;\r
-                               }\r
-                               finally\r
-                               {\r
-                                       this.implicitTransaction = false;\r
-                                       this.transaction = null;\r
-                                       if (this.statement != null)\r
-                                       {\r
-                                               this.statement.Transaction = null;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               internal void RollbackImplicitTransaction()\r
-               {\r
-                       if (this.implicitTransaction &&\r
-                               this.transaction != null &&\r
-                               this.transaction.Transaction != null)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.transaction.Rollback();\r
-                               }\r
-                               catch (Exception)\r
-                               {\r
-                               }\r
-                               finally\r
-                               {\r
-                                       this.implicitTransaction = false;\r
-                                       this.transaction = null;\r
-                                       if (this.statement != null)\r
-                                       {\r
-                                               this.statement.Transaction = null;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               internal void Close()\r
-               {\r
-                       if (this.statement != null)\r
-                       {\r
-                               this.statement.Close();\r
-                       }\r
-               }\r
-\r
-               internal void Release()\r
-               {\r
-                       this.RollbackImplicitTransaction();\r
-\r
-                       if (this.connection != null && this.connection.State == ConnectionState.Open)\r
-                       {\r
-                               this.connection.InnerConnection.RemovePreparedCommand(this);\r
-                       }\r
-\r
-                       if (this.statement != null)\r
-                       {\r
-                               this.statement.Dispose();\r
-                               this.statement = null;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Input parameter descriptor generation methods\r
-\r
-               private Descriptor BuildParametersDescriptor()\r
-               {\r
-                       short count = this.ValidateInputParameters();\r
-\r
-                       if (count > 0)\r
-                       {\r
-                               if (this.namedParameters.Count > 0)\r
-                               {\r
-                                       count = (short)this.namedParameters.Count;\r
-                                       return this.BuildNamedParametersDescriptor(count);\r
-                               }\r
-                               else\r
-                               {\r
-                                       return this.BuildPlaceHoldersDescriptor(count);\r
-                               }\r
-                       }\r
-\r
-                       return null;\r
-               }\r
-\r
-               private Descriptor BuildNamedParametersDescriptor(short count)\r
-               {\r
-                       Descriptor descriptor = new Descriptor(count);\r
-                       int index = 0;\r
-\r
-                       for (int i = 0; i < this.namedParameters.Count; i++)\r
-                       {\r
-                               FbParameter parameter = this.parameters[this.namedParameters[i]];\r
-\r
-                               if (parameter.Direction == ParameterDirection.Input ||\r
-                                       parameter.Direction == ParameterDirection.InputOutput)\r
-                               {\r
-                                       if (!this.BuildParameterDescriptor(descriptor, parameter, index++))\r
-                                       {\r
-                                               return null;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return descriptor;\r
-               }\r
-\r
-               private Descriptor BuildPlaceHoldersDescriptor(short count)\r
-               {\r
-                       Descriptor descriptor = new Descriptor(count);\r
-                       int index = 0;\r
-\r
-                       for (int i = 0; i < this.parameters.Count; i++)\r
-                       {\r
-                               FbParameter parameter = this.parameters[i];\r
-\r
-                               if (parameter.Direction == ParameterDirection.Input ||\r
-                                       parameter.Direction == ParameterDirection.InputOutput)\r
-                               {\r
-                                       if (!this.BuildParameterDescriptor(descriptor, parameter, index++))\r
-                                       {\r
-                                               return null;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return descriptor;\r
-               }\r
-\r
-               private bool BuildParameterDescriptor(\r
-                       Descriptor descriptor, FbParameter parameter, int index)\r
-               {\r
-                       Charset charset = this.connection.InnerConnection.Database.Charset;\r
-                       FbDbType type = parameter.FbDbType;\r
-\r
-                       // Check the parameter character set\r
-                       if (parameter.Charset != FbCharset.Default)\r
-                       {\r
-                               int idx = Charset.SupportedCharsets.IndexOf((int)parameter.Charset);\r
-                               charset = Charset.SupportedCharsets[idx];\r
-                       }\r
-                       else\r
-                       {\r
-                               if (type == FbDbType.Guid)\r
-                               {\r
-                                       charset = Charset.SupportedCharsets["OCTETS"];\r
-                               }\r
-                       }\r
-\r
-                       // Set parameter Data Type\r
-                       descriptor[index].DataType = \r
-                               (short)TypeHelper.GetFbType((DbDataType)type, parameter.IsNullable);\r
-\r
-                       // Set parameter Sub Type\r
-                       switch (type)\r
-                       {\r
-                               case FbDbType.Binary:\r
-                                       descriptor[index].SubType = 0;\r
-                                       break;\r
-\r
-                               case FbDbType.Text:\r
-                                       descriptor[index].SubType = 1;\r
-                                       break;\r
-\r
-                               case FbDbType.Guid:\r
-                                       descriptor[index].SubType = (short)charset.ID;\r
-                                       break;\r
-\r
-                               case FbDbType.Char:\r
-                               case FbDbType.VarChar:\r
-                                       descriptor[index].SubType = (short)charset.ID;\r
-                                       if (parameter.Size > 0)\r
-                                       {\r
-                                               short len = (short)(parameter.Size * charset.BytesPerCharacter);\r
-                                               descriptor[index].Length = len;\r
-                                       }\r
-                                       break;\r
-                       }\r
-\r
-                       // Set parameter length\r
-                       if (descriptor[index].Length == 0)\r
-                       {\r
-                               descriptor[index].Length = TypeHelper.GetSize((DbDataType)type);\r
-                       }\r
-\r
-                       // Verify parameter\r
-                       if (descriptor[index].SqlType == 0 || descriptor[index].Length == 0)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       return true;\r
-               }\r
-\r
-               private short ValidateInputParameters()\r
-               {\r
-                       short count = 0;\r
-\r
-                       for (int i = 0; i < this.parameters.Count; i++)\r
-                       {\r
-                               if (this.parameters[i].Direction == ParameterDirection.Input ||\r
-                                       this.parameters[i].Direction == ParameterDirection.InputOutput)\r
-                               {\r
-                                       FbDbType type = this.parameters[i].FbDbType;\r
-\r
-                                       if (type == FbDbType.Array || type == FbDbType.Decimal ||\r
-                                               type == FbDbType.Numeric)\r
-                                       {\r
-                                               return -1;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               count++;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return count;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void DescribeInput()\r
-               {\r
-                       if (this.parameters.Count > 0)\r
-                       {\r
-                               Descriptor descriptor = this.BuildParametersDescriptor();\r
-                               if (descriptor == null)\r
-                               {\r
-                                       this.statement.DescribeParameters();\r
-                               }\r
-                               else\r
-                               {\r
-                                       this.statement.Parameters = descriptor;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private void Prepare(bool returnsSet)\r
-               {\r
-                       FbConnectionInternal innerConn = this.connection.InnerConnection;\r
-\r
-                       // Check if     we have a valid transaction\r
-                       if (this.transaction == null)\r
-                       {\r
-                               this.implicitTransaction = true;\r
-                               IsolationLevel il = this.connection.ConnectionOptions.IsolationLevel;\r
-\r
-                               this.transaction = new FbTransaction(this.connection, il);\r
-                               this.transaction.BeginTransaction();\r
-\r
-                               // Update Statement     transaction\r
-                               if (this.statement != null)\r
-                               {\r
-                                       this.statement.Transaction = this.transaction.Transaction;\r
-                               }\r
-                       }\r
-\r
-                       // Check if     we have a valid statement handle\r
-                       if (this.statement == null)\r
-                       {\r
-                               this.statement = innerConn.Database.CreateStatement(this.transaction.Transaction);\r
-                       }\r
-\r
-                       // Prepare the statement if     needed\r
-                       if (!this.statement.IsPrepared)\r
-                       {\r
-                // Close the inner DataReader if needed\r
-                this.CloseReader();\r
-\r
-                // Reformat the SQL statement if needed\r
-                               string sql = this.commandText;\r
-\r
-                               if (this.commandType == CommandType.StoredProcedure)\r
-                               {\r
-                                       sql = this.BuildStoredProcedureSql(sql, returnsSet);\r
-                               }\r
-\r
-                // Prepare the command\r
-                               this.statement.Prepare(this.ParseNamedParameters(sql));\r
-\r
-                // Describe input parameters\r
-                               this.DescribeInput();\r
-\r
-                               // Add this     command to the active command list\r
-                               innerConn.AddPreparedCommand(this);\r
-                       }\r
-                       else\r
-                       {\r
-                               // Close statement for subsequently     executions\r
-                               this.Close();\r
-                       }\r
-               }\r
-\r
-               private void ExecuteCommand(CommandBehavior behavior)\r
-               {\r
-                       this.ExecuteCommand(behavior, false);\r
-               }\r
-\r
-               private void ExecuteCommand(CommandBehavior behavior, bool returnsSet)\r
-               {\r
-                       // Prepare statement\r
-                       this.Prepare(returnsSet);\r
-\r
-                       if ((behavior & CommandBehavior.SequentialAccess) == CommandBehavior.SequentialAccess ||\r
-                               (behavior & CommandBehavior.SingleResult) == CommandBehavior.SingleResult ||\r
-                               (behavior & CommandBehavior.SingleRow) == CommandBehavior.SingleRow ||\r
-                               (behavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection ||\r
-                               behavior == CommandBehavior.Default)\r
-                       {\r
-                               // Set the fetch size\r
-                               this.statement.FetchSize = this.fetchSize;\r
-\r
-                               // Update input parameter values\r
-                               if (this.parameters.Count > 0)\r
-                               {\r
-                                       if (this.statement.Parameters == null)\r
-                                       {\r
-                                               this.DescribeInput();\r
-                                       }\r
-                                       this.UpdateParameterValues();\r
-                               }\r
-\r
-                               // Execute statement\r
-                               this.statement.Execute();\r
-                       }\r
-               }\r
-\r
-               private string BuildStoredProcedureSql(string spName, bool returnsSet)\r
-               {\r
-                       string sql = spName == null ? "" : spName.Trim();\r
-\r
-                       if (sql.Length > 0 &&\r
-                               !sql.ToLower(CultureInfo.CurrentCulture).StartsWith("execute procedure ") &&\r
-                               !sql.ToLower(CultureInfo.CurrentCulture).StartsWith("select "))\r
-                       {\r
-                               StringBuilder paramsText = new StringBuilder();\r
-\r
-                               // Append the stored proc parameter     name\r
-                               paramsText.Append(sql);\r
-                               if (parameters.Count > 0)\r
-                               {\r
-                                       paramsText.Append("(");\r
-                                       for (int i = 0; i < this.parameters.Count; i++)\r
-                                       {\r
-                                               if (this.parameters[i].Direction == ParameterDirection.Input ||\r
-                                                       this.parameters[i].Direction == ParameterDirection.InputOutput)\r
-                                               {\r
-                                                       // Append parameter     name to parameter list\r
-                                                       paramsText.Append(this.parameters[i].ParameterName);\r
-                                                       if (i != parameters.Count - 1)\r
-                                                       {\r
-                                                               paramsText = paramsText.Append(",");\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                                       paramsText.Append(")");\r
-                                       paramsText.Replace(",)", ")");\r
-                                       paramsText.Replace("()", "");\r
-                               }\r
-\r
-                               if (returnsSet)\r
-                               {\r
-                                       sql = "select * from " + paramsText.ToString();\r
-                               }\r
-                               else\r
-                               {\r
-                                       sql = "execute procedure " + paramsText.ToString();\r
-                               }\r
-                       }\r
-\r
-                       return sql;\r
-               }\r
-\r
-               private string ParseNamedParameters(string sql)\r
-               {\r
-                       this.namedParameters.Clear();\r
-\r
-                       if (sql.IndexOf("@") != -1)\r
-                       {\r
-                               MatchEvaluator me = new MatchEvaluator(NamedParametersEvaluator);\r
-\r
-                               sql = namedRegex.Replace(sql, me);\r
-                       }\r
-\r
-                       return sql;\r
-               }\r
-\r
-               private string NamedParametersEvaluator(Match match)\r
-               {\r
-                       string input = match.Value;\r
-\r
-                       if (match.Groups["param"].Success)\r
-                       {\r
-                               Group g = match.Groups["param"];\r
-\r
-                               this.namedParameters.Add(g.Value);\r
-\r
-                               return Regex.Replace(input, g.Value, "?");\r
-                       }\r
-                       else\r
-                       {\r
-                               return match.Value;\r
-                       }\r
-               }\r
-\r
-               private void UpdateParameterValues()\r
-               {\r
-                       int index = -1;\r
-\r
-                       for (int i = 0; i < this.statement.Parameters.Count; i++)\r
-                       {\r
-                               index = i;\r
-\r
-                               if (this.namedParameters.Count > 0)\r
-                               {\r
-                                       index = this.parameters.IndexOf(this.namedParameters[i]);\r
-                               }\r
-\r
-                               if (index != -1)\r
-                               {\r
-                                       if (this.parameters[index].Value == DBNull.Value ||\r
-                                               this.parameters[index].Value == null)\r
-                                       {\r
-                                               this.statement.Parameters[i].NullFlag = -1;\r
-                                               this.statement.Parameters[i].Value = DBNull.Value;\r
-\r
-                                               if (!this.statement.Parameters[i].AllowDBNull())\r
-                                               {\r
-                                                       this.statement.Parameters[i].DataType++;\r
-                                               }\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               // Parameter value is not null\r
-                                               this.statement.Parameters[i].NullFlag = 0;\r
-\r
-                                               switch (this.statement.Parameters[i].DbDataType)\r
-                                               {\r
-                                                       case DbDataType.Binary:\r
-                                                               {\r
-                                                                       BlobBase blob = this.statement.CreateBlob();\r
-                                                                       blob.Write((byte[])this.parameters[index].Value);\r
-                                                                       this.statement.Parameters[i].Value = blob.Id;\r
-                                                               }\r
-                                                               break;\r
-\r
-                                                       case DbDataType.Text:\r
-                                                               {\r
-                                                                       BlobBase blob = this.statement.CreateBlob();\r
-                                                                       blob.Write((string)this.parameters[index].Value);\r
-                                                                       this.statement.Parameters[i].Value = blob.Id;\r
-                                                               }\r
-                                                               break;\r
-\r
-                                                       case DbDataType.Array:\r
-                                                               {\r
-                                                                       if (this.statement.Parameters[i].ArrayHandle == null)\r
-                                                                       {\r
-                                                                               this.statement.Parameters[i].ArrayHandle =\r
-                                                                               this.statement.CreateArray(\r
-                                                                                       this.statement.Parameters[i].Relation,\r
-                                                                                       this.statement.Parameters[i].Name);\r
-                                                                       }\r
-                                                                       else\r
-                                                                       {\r
-                                                                               this.statement.Parameters[i].ArrayHandle.DB = this.statement.DB;\r
-                                                                               this.statement.Parameters[i].ArrayHandle.Transaction = this.statement.Transaction;\r
-                                                                       }\r
-\r
-                                                                       this.statement.Parameters[i].ArrayHandle.Handle = 0;\r
-                                                                       this.statement.Parameters[i].ArrayHandle.Write((System.Array)this.parameters[index].Value);\r
-                                                                       this.statement.Parameters[i].Value = this.statement.Parameters[i].ArrayHandle.Handle;\r
-                                                               }\r
-                                                               break;\r
-\r
-                                                       case DbDataType.Guid:\r
-                                                               if (!(this.parameters[index].Value is Guid) &&\r
-                                                                       !(this.parameters[index].Value is byte[]))\r
-                                                               {\r
-                                                                       throw new InvalidOperationException("Incorrect Guid value.");\r
-                                                               }\r
-                                                               this.statement.Parameters[i].Value = this.parameters[index].Value;\r
-                                                               break;\r
-\r
-                                                       default:\r
-                                                               this.statement.Parameters[i].Value = this.parameters[index].Value;\r
-                                                               break;\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private void CheckCommand()\r
-               {\r
-                       if (this.transaction != null && this.transaction.IsUpdated)\r
-                       {\r
-                               this.transaction = null;\r
-                       }\r
-\r
-                       if (this.connection == null || \r
-                               this.connection.State != ConnectionState.Open)\r
-                       {\r
-                               throw new InvalidOperationException("Connection must valid and open");\r
-                       }\r
-\r
-                       if (this.activeReader != null)\r
-                       {\r
-                               throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");\r
-                       }\r
-\r
-                       if (this.transaction == null &&\r
-                               this.connection.InnerConnection.HasActiveTransaction)\r
-                       {\r
-                               throw new InvalidOperationException("Execute requires the Command object to have a Transaction object when the Connection object assigned to the command is in a pending local transaction. The Transaction property of the Command has not been initialized.");\r
-                       }\r
-\r
-                       if (this.transaction != null && !this.transaction.IsUpdated &&\r
-                               !this.connection.Equals(transaction.Connection))\r
-                       {\r
-                               throw new InvalidOperationException("Command Connection is not equal to Transaction Connection.");\r
-                       }\r
-\r
-                       if (this.commandText == null || this.commandText.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("The command text for this Command has not been set.");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/overview/*'/>
+#if    (NET)
+       [ToolboxItem(true)]
+       [ToolboxBitmap(typeof(FbCommand), "Resources.FbCommand.bmp")]
+       [Designer(typeof(Design.FbCommandDesigner), typeof(System.ComponentModel.Design.IDesigner))]
+#endif
+       public sealed class FbCommand : Component, IDbCommand, ICloneable
+       {
+               #region Fields
+
+               private CommandType                             commandType;
+               private UpdateRowSource                 updatedRowSource;
+               private FbConnection                    connection;
+               private FbTransaction                   transaction;
+               private FbParameterCollection   parameters;
+               private StatementBase                   statement;
+               private FbDataReader                    activeReader;
+               private StringCollection                namedParameters;
+               private string                                  commandText;
+               private bool                                    disposed;
+               private bool                                    designTimeVisible;
+               private bool                                    implicitTransaction;
+               private int                                             commandTimeout;
+               private int                                             fetchSize;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="CommandText"]/*'/>
+#if    (NET)
+               [Category("Data")]
+               [DefaultValue("")]
+               [RefreshProperties(RefreshProperties.All)]
+               [Editor(typeof(Design.FbCommandTextUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
+#endif
+               public string CommandText
+               {
+                       get { return this.commandText; }
+                       set
+                       {
+                               lock (this)
+                               {
+                                       if (this.statement != null &&
+                                               this.commandText != null &&
+                                               this.commandText != value &&
+                                               this.commandText.Length != 0)
+                                       {
+                                               this.Release();
+                                       }
+
+                                       this.commandText = value;
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="CommandType"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue(CommandType.Text), RefreshProperties(RefreshProperties.All)]
+#endif
+               public CommandType CommandType
+               {
+                       get { return this.commandType; }
+                       set { this.commandType = value; }
+               }
+
+               int IDbCommand.CommandTimeout
+               {
+                       get { return this.commandTimeout; }
+                       set
+                       {
+                               if (value < 0)
+                               {
+                                       throw new ArgumentException("The property value assigned is less than 0.");
+                               }
+
+                               this.commandTimeout = value;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="CommandPlan"]/*'/>
+#if    (!NETCF)
+               [Browsable(false)]
+#endif
+               public string CommandPlan
+               {
+                       get
+                       {
+                               if (this.statement != null)
+                               {
+                                       return this.statement.GetExecutionPlan();
+                               }
+                               return null;
+                       }
+               }
+
+               IDbConnection IDbCommand.Connection
+               {
+                       get { return this.Connection; }
+                       set { this.Connection = (FbConnection)value; }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="Connection"]/*'/>
+#if    (!NETCF)
+               [Category("Behavior"), DefaultValue(null)]
+#endif
+               public FbConnection Connection
+               {
+                       get { return this.connection; }
+                       set
+                       {
+                               lock (this)
+                               {
+                                       if (this.activeReader != null)
+                                       {
+                                               throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");
+                                       }
+
+                                       if (this.transaction != null && this.transaction.IsUpdated)
+                                       {
+                                               this.transaction = null;
+                                       }
+
+                                       if (this.connection != null &&
+                                               this.connection != value &&
+                                               this.connection.State == ConnectionState.Open)
+                                       {
+                                               this.Release();
+                                       }
+
+                                       this.connection = value;
+                               }
+                       }
+               }
+
+               IDataParameterCollection IDbCommand.Parameters
+               {
+                       get { return this.Parameters; }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="Parameters"]/*'/>
+#if    (!NETCF)
+               [Category("Data")]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+#endif
+               public FbParameterCollection Parameters
+               {
+                       get { return this.parameters; }
+               }
+
+               IDbTransaction IDbCommand.Transaction
+               {
+                       get { return this.Transaction; }
+                       set { this.Transaction = (FbTransaction)value; }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="Transaction"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public FbTransaction Transaction
+               {
+                       get { return this.implicitTransaction ? null : this.transaction; }
+                       set
+                       {
+                               lock (this)
+                               {
+                                       if (this.activeReader != null)
+                                       {
+                                               throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");
+                                       }
+
+                                       this.RollbackImplicitTransaction();
+
+                                       this.transaction = value;
+
+                                       if (this.statement != null)
+                                       {
+                                               if (this.transaction != null)
+                                               {
+                                                       this.statement.Transaction = this.transaction.Transaction;
+                                               }
+                                               else
+                                               {
+                                                       this.statement.Transaction = null;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="UpdatedRowSource"]/*'/>
+#if    (!NETCF)
+               [Category("Behavior"), DefaultValue(UpdateRowSource.Both)]
+#endif
+               public UpdateRowSource UpdatedRowSource
+               {
+                       get { return this.updatedRowSource; }
+                       set { this.updatedRowSource = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="FetchSize"]/*'/>
+#if    (!NETCF)
+               [Category("Behavior"), DefaultValue(200)]
+#endif
+               public int FetchSize
+               {
+                       get { return this.fetchSize; }
+                       set
+                       {
+                               if (this.activeReader != null)
+                               {
+                                       throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");
+                               }
+                               this.fetchSize = value;
+                       }
+               }
+
+               #endregion
+
+               #region Design-Time     properties
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/property[@name="DesignTimeVisible"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignOnly(true), DefaultValue(true)]
+#endif
+               public bool DesignTimeVisible
+               {
+                       get { return this.designTimeVisible; }
+                       set
+                       {
+                               this.designTimeVisible = value;
+#if    (!NETCF)
+                               TypeDescriptor.Refresh(this);
+#endif
+                       }
+               }
+
+               #endregion
+
+               #region Internal Properties
+
+               internal int RecordsAffected
+               {
+                       get
+                       {
+                               if (this.statement != null)
+                               {
+                                       return this.statement.RecordsAffected;
+                               }
+                               return -1;
+                       }
+               }
+
+               internal bool IsDisposed
+               {
+                       get { return this.disposed; }
+               }
+
+               internal FbDataReader ActiveReader
+               {
+                       get { return this.activeReader; }
+                       set { this.activeReader = value; }
+               }
+
+               internal FbTransaction ActiveTransaction
+               {
+                       get { return this.transaction; }
+               }
+
+               internal bool HasImplicitTransaction
+               {
+                       get { return this.implicitTransaction; }
+               }
+
+        internal bool IsSelectCommand
+        {
+            get
+            {
+                if (this.statement != null)
+                {
+                    if (this.statement.StatementType == DbStatementType.Select ||
+                        this.statement.StatementType == DbStatementType.SelectForUpdate)
+                    {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        }
+
+        internal bool IsDDLCommand
+        {
+            get { return (this.statement != null && this.statement.StatementType == DbStatementType.DDL); }
+        }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor"]/*'/>
+               public FbCommand() : this(null, null, null)
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor(System.String)"]/*'/>
+               public FbCommand(string cmdText) : this(cmdText, null, null)
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor(System.String,FbConnection)"]/*'/>
+               public FbCommand(string cmdText, FbConnection connection)
+                       : this(cmdText, connection, null)
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/constructor[@name="ctor(System.String,FbConnection,Transaction)"]/*'/>
+               public FbCommand(string cmdText, FbConnection connection, FbTransaction transaction)
+                       : base()
+               {
+                       this.parameters                 = new FbParameterCollection();
+                       this.namedParameters    = new StringCollection();
+                       this.updatedRowSource   = UpdateRowSource.Both;
+                       this.commandType                = CommandType.Text;
+                       this.designTimeVisible  = true;
+                       this.designTimeVisible  = true;
+                       this.commandTimeout             = 30;
+                       this.fetchSize                  = 200;
+                       this.commandText                = "";
+
+                       if (connection != null)
+                       {
+                               this.fetchSize = connection.ConnectionOptions.FetchSize;
+                       }
+
+                       if (cmdText != null)
+                       {
+                               this.CommandText = cmdText;
+                       }
+
+                       this.Connection  = connection;
+                       this.transaction = transaction;
+               }
+
+               #endregion
+
+               #region IDisposable     Methods
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="Dispose(System.Boolean)"]/*'/>
+               protected override void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.disposed)
+                               {
+                                       try
+                                       {
+                                               // If there     are     an active reader close it
+                                               this.CloseReader();
+
+                                               // Release any unmanaged resources
+                                               this.Release();
+
+                                               // release any managed resources
+                                               if (disposing)
+                                               {
+                                                       this.implicitTransaction = false;
+                                                       this.commandText                = null;
+                                                       this.commandTimeout             = 0;
+                                                       this.connection                 = null;
+                                                       this.transaction                = null;
+                                                       this.parameters                 = null;
+
+                                                       this.namedParameters.Clear();
+                                                       this.namedParameters = null;
+                                               }
+
+                                               this.disposed = true;
+                                       }
+                                       finally
+                                       {
+                                               base.Dispose(disposing);
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region ICloneable Methods
+
+               object ICloneable.Clone()
+               {
+            FbCommand command = new FbCommand();
+
+            command.CommandText                     = this.CommandText;
+            command.Connection                      = this.Connection;
+            command.Transaction                     = this.Transaction;
+            command.CommandType                     = this.CommandType;
+            command.UpdatedRowSource                = this.UpdatedRowSource;
+            ((IDbCommand)command).CommandTimeout    = this.commandTimeout;
+            command.FetchSize                       = this.FetchSize;
+            command.UpdatedRowSource                = this.UpdatedRowSource;
+
+            for (int i = 0; i < this.Parameters.Count; i++)
+            {
+                command.Parameters.Add(((ICloneable)this.Parameters[i]).Clone());
+            }
+
+            return command;
+        }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="Cancel"]/*'/>
+               public void Cancel()
+               {
+                       throw new NotSupportedException();
+               }
+
+               IDbDataParameter IDbCommand.CreateParameter()
+               {
+                       return CreateParameter();
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="CreateParameter"]/*'/>
+               public FbParameter CreateParameter()
+               {
+                       return new FbParameter();
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="Prepare"]/*'/>
+               public void Prepare()
+               {
+                       lock (this)
+                       {
+                               this.CheckCommand();
+
+                               try
+                               {
+                                       this.Prepare(false);
+                               }
+                               catch (IscException ex)
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw new FbException(ex.Message, ex);
+                               }
+                               catch (Exception)
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw;
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteNonQuery"]/*'/>
+               public int ExecuteNonQuery()
+               {
+                       lock (this)
+                       {
+                               this.CheckCommand();
+
+                               try
+                               {
+                                       this.ExecuteCommand(CommandBehavior.Default);
+
+                                       if (this.statement.StatementType == DbStatementType.StoredProcedure)
+                                       {
+                                               this.SetOutputParameters();
+                                       }
+
+                                       this.CommitImplicitTransaction();
+                               }
+                               catch (IscException ex)
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw new FbException(ex.Message, ex);
+                               }
+                               catch (Exception)
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw;
+                               }
+                       }
+
+                       return this.statement.RecordsAffected;
+               }
+
+               IDataReader IDbCommand.ExecuteReader()
+               {
+                       return this.ExecuteReader();
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteReader"]/*'/>
+               public FbDataReader ExecuteReader()
+               {
+                       return this.ExecuteReader(CommandBehavior.Default);
+               }
+
+               IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)
+               {
+                       return this.ExecuteReader(behavior);
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteReader(System.Data.CommandBehavior)"]/*'/>
+               public FbDataReader ExecuteReader(CommandBehavior behavior)
+               {
+                       lock (this)
+                       {
+                               this.CheckCommand();
+
+                               try
+                               {
+                                       this.ExecuteCommand(behavior, true);
+                               }
+                               catch (IscException ex)
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw new FbException(ex.Message, ex);
+                               }
+                               catch
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw;
+                               }
+                       }
+
+                       this.activeReader = new FbDataReader(this, this.connection, behavior);
+
+                       return this.activeReader;
+               }
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbCommand"]/method[@name="ExecuteScalar"]/*'/>
+               public object ExecuteScalar()
+               {
+                       DbValue[]       values  = null;
+                       object          val             = null;
+
+                       lock (this)
+                       {
+                               this.CheckCommand();
+
+                               try
+                               {
+                                       this.ExecuteCommand(CommandBehavior.Default);
+
+                    if (this.statement.StatementType == DbStatementType.StoredProcedure)
+                                       {
+                                               values = this.statement.GetOuputParameters();
+                                               this.SetOutputParameters(values);
+                                       }
+                                       else
+                                       {
+                                               values = this.statement.Fetch();
+                                       }
+
+                                       // Get the return value
+                                       if (values != null && values.Length > 0)
+                                       {
+                                               val = values[0].Value;
+                                       }
+
+                                       this.CommitImplicitTransaction();
+                               }
+                               catch (IscException ex)
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw new FbException(ex.Message, ex);
+                               }
+                               catch (Exception)
+                               {
+                                       this.DiscardImplicitTransaction();
+
+                                       throw;
+                               }
+                       }
+
+                       return val;
+               }
+
+               #endregion
+
+               #region Internal Methods
+
+               internal void CloseReader()
+               {
+                       if (this.activeReader != null)
+                       {
+                               this.activeReader.Close();
+                               this.activeReader = null;
+                       }
+               }
+
+               internal DbValue[] Fetch()
+               {
+                       try
+                       {
+                               if (this.statement != null)
+                               {
+                                       // Fetch the next row
+                                       return this.statement.Fetch();
+                               }
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+
+                       return null;
+               }
+
+               internal Descriptor GetFieldsDescriptor()
+               {
+                       if (this.statement != null)
+                       {
+                               return this.statement.Fields;
+                       }
+
+                       return null;
+               }
+
+               internal void SetOutputParameters()
+               {
+                       this.SetOutputParameters(null);
+               }
+
+               internal void SetOutputParameters(DbValue[] outputParameterValues)
+               {
+                       if (this.parameters.Count > 0 && this.statement != null)
+                       {
+                               IEnumerator paramEnumerator = this.parameters.GetEnumerator();
+                               int i = 0;
+
+                               if (this.statement != null &&
+                                       this.statement.StatementType == DbStatementType.StoredProcedure)
+                               {
+                                       DbValue[] values = outputParameterValues;
+                                       if (outputParameterValues == null)
+                                       {
+                                               values = (DbValue[])this.statement.GetOuputParameters();
+                                       }
+
+                                       if (values != null && values.Length > 0)
+                                       {
+                                               while (paramEnumerator.MoveNext())
+                                               {
+                                                       FbParameter parameter = (FbParameter)paramEnumerator.Current;
+
+                                                       if (parameter.Direction == ParameterDirection.Output ||
+                                                               parameter.Direction == ParameterDirection.InputOutput ||
+                                                               parameter.Direction == ParameterDirection.ReturnValue)
+                                                       {
+                                                               parameter.Value = values[i].Value;
+                                                               i++;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               internal void DiscardImplicitTransaction()
+               {
+                       if (this.IsSelectCommand)
+                       {
+                               this.CommitImplicitTransaction();
+                       }
+                       else
+                       {
+                               this.RollbackImplicitTransaction();
+                       }
+               }
+
+               internal void CommitImplicitTransaction()
+               {
+                       if (this.HasImplicitTransaction && 
+                               this.transaction != null &&
+                               this.transaction.Transaction != null)
+                       {
+                               try
+                               {
+                                       this.transaction.Commit();
+                               }
+                               catch
+                               {
+                                       this.RollbackImplicitTransaction();
+
+                                       throw;
+                               }
+                               finally
+                               {
+                                       this.implicitTransaction = false;
+                                       this.transaction = null;
+                                       if (this.statement != null)
+                                       {
+                                               this.statement.Transaction = null;
+                                       }
+                               }
+                       }
+               }
+
+               internal void RollbackImplicitTransaction()
+               {
+                       if (this.HasImplicitTransaction &&
+                               this.transaction != null &&
+                               this.transaction.Transaction != null)
+                       {
+                               try
+                               {
+                                       this.transaction.Rollback();
+                               }
+                               catch
+                               {
+                               }
+                               finally
+                               {
+                                       this.implicitTransaction = false;
+                                       this.transaction = null;
+                                       if (this.statement != null)
+                                       {
+                                               this.statement.Transaction = null;
+                                       }
+                               }
+                       }
+               }
+
+               internal void Close()
+               {
+                       if (this.statement != null)
+                       {
+                               this.statement.Close();
+                       }
+               }
+
+               internal void Release()
+               {
+                       this.RollbackImplicitTransaction();
+
+                       if (this.connection != null && this.connection.State == ConnectionState.Open)
+                       {
+                               this.connection.InnerConnection.RemovePreparedCommand(this);
+                       }
+
+                       if (this.statement != null)
+                       {
+                               this.statement.Dispose();
+                               this.statement = null;
+                       }
+               }
+
+               #endregion
+
+               #region Input parameter descriptor generation methods
+
+               private void DescribeInput()
+               {
+                       if (this.parameters.Count > 0)
+                       {
+                               if (this.statement.Parameters == null || this.CountInputParameters() != this.statement.Parameters.Count) 
+                               {
+                                       // Build or Rebuild the parameter descriptor
+                                       if (this.CanInferInputParameters())
+                                       {
+                                               this.statement.Parameters = null;
+                                       }
+                                       else
+                                       {
+                                               this.statement.DescribeParameters();
+                                       }
+                               }
+
+                               this.UpdateInputParameterDescriptor();
+                       }
+               }
+
+               private void UpdateInputParameterDescriptor()
+               {
+                       if (this.statement.Parameters == null)
+                       {
+                               this.statement.Parameters = new Descriptor(this.CountInputParameters());
+                       }
+
+                       if (this.namedParameters.Count > 0)
+                       {
+                               this.UpdateNamedParametersDescriptor();
+                       }
+                       else
+                       {
+                               this.UpdatePlaceHoldersDescriptor();
+                       }
+               }
+
+               private void UpdateNamedParametersDescriptor()
+               {
+                       for (int i = 0; i < this.namedParameters.Count; i++)
+                       {
+                               FbParameter parameter = this.parameters[this.namedParameters[i]];
+
+                               if (parameter.Direction == ParameterDirection.Input ||
+                                       parameter.Direction == ParameterDirection.InputOutput)
+                               {
+                                       this.UpdateParameterDescriptor(parameter, this.statement.Parameters[i]);
+                               }
+                       }
+               }
+
+               private void UpdatePlaceHoldersDescriptor()
+               {
+                       int index = 0;
+
+                       for (int i = 0; i < this.parameters.Count; i++)
+                       {
+                               FbParameter parameter = this.parameters[i];
+
+                               if (parameter.Direction == ParameterDirection.Input ||
+                                       parameter.Direction == ParameterDirection.InputOutput)
+                               {
+                                       this.UpdateParameterDescriptor(parameter, this.statement.Parameters[index++]);
+                               }
+                       }
+               }
+
+               private void UpdateParameterDescriptor(FbParameter source, DbField target)
+               {
+                       Charset         charset = this.connection.InnerConnection.Database.Charset;
+                       FbDbType        type    = source.FbDbType;
+
+                       // Check the parameter character set
+                       if (source.Charset != FbCharset.Default)
+                       {
+                               int idx = Charset.SupportedCharsets.IndexOf((int)source.Charset);
+                               charset = Charset.SupportedCharsets[idx];
+                       }
+                       else
+                       {
+                               if (type == FbDbType.Guid)
+                               {
+                                       charset = Charset.SupportedCharsets["OCTETS"];
+                               }
+                       }
+
+                       // Set parameter Data Type
+                       if (type != FbDbType.Numeric && type != FbDbType.Decimal)
+                       {
+                               target.DataType = (short)TypeHelper.GetFbType((DbDataType)type, source.IsNullable);
+                       }
+
+                       // Set parameter Sub Type
+                       switch (type)
+                       {
+                               case FbDbType.Binary:
+                                       target.SubType = 0;
+                                       break;
+
+                               case FbDbType.Text:
+                                       target.SubType = 1;
+                                       break;
+
+                               case FbDbType.Guid:
+                                       target.SubType = (short)charset.ID;
+                                       break;
+
+                               case FbDbType.Char:
+                               case FbDbType.VarChar:
+                                       if (target.SubType == 0)
+                                       {
+                                               target.SubType = (short)charset.ID;
+                                       }
+                                       if (source.Size > 0)
+                                       {
+                                               target.Length = (short)(source.Size * charset.BytesPerCharacter);
+                                       }
+                                       break;
+                       }
+
+                       // Set parameter length
+                       if (target.Length == 0)
+                       {
+                               target.Length = TypeHelper.GetSize((DbDataType)type);
+                       }
+
+                       // Update parameter value
+                       this.UpdateInputParameterValue(source, target);
+               }
+
+               private bool CanInferInputParameters()
+               {
+                       for (int i = 0; i < this.parameters.Count; i++)
+                       {
+                               if (this.parameters[i].Direction == ParameterDirection.Input ||
+                                       this.parameters[i].Direction == ParameterDirection.InputOutput)
+                               {
+                                       FbDbType type = this.parameters[i].FbDbType;
+
+                                       if ((type == FbDbType.Char || type == FbDbType.VarChar) && this.Parameters[i].Size == 0)
+                                       {
+                                               return false;
+                                       }
+                                       else if (type == FbDbType.Array || type == FbDbType.Decimal || type == FbDbType.Numeric)
+                                       {
+                                               return false;
+                                       }
+                               }
+                       }
+
+                       return true;
+               }
+
+               private int CountInputParameters()
+               {
+                       int count = 0;
+
+                       if (this.namedParameters.Count == 0)
+                       {
+                               for (int i = 0; i < this.parameters.Count; i++)
+                               {
+                                       if (this.parameters[i].Direction == ParameterDirection.Input ||
+                                               this.parameters[i].Direction == ParameterDirection.InputOutput)
+                                       {
+                                               count++;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               count = this.namedParameters.Count;
+                       }
+
+                       return count;
+               }
+
+               private void UpdateInputParameterValue(FbParameter source, DbField target)
+               {
+                       if (source.Value == DBNull.Value || source.Value == null)
+                       {
+                               target.NullFlag = -1;
+                               target.Value    = DBNull.Value;
+
+//                             if (!target.AllowDBNull())
+//                             {
+//                                     target.DataType++;
+//                             }
+                       }
+                       else
+                       {
+                               // Parameter value is not null
+                               target.NullFlag = 0;
+
+                               switch (target.DbDataType)
+                               {
+                                       case DbDataType.Binary:
+                                               BlobBase blob = this.statement.CreateBlob();
+                                               blob.Write((byte[])source.Value);
+                                               target.Value = blob.Id;
+                                               break;
+
+                                       case DbDataType.Text:
+                                               BlobBase clob = this.statement.CreateBlob();
+                                               clob.Write((string)source.Value);
+                                               target.Value = clob.Id;
+                                               break;
+
+                                       case DbDataType.Array:
+                                       {
+                                               if (target.ArrayHandle == null)
+                                               {
+                                                       target.ArrayHandle = this.statement.CreateArray(target.Relation, target.Name);
+                                               }
+                                               else
+                                               {
+                                                       target.ArrayHandle.DB                   = this.statement.DB;
+                                                       target.ArrayHandle.Transaction  = this.statement.Transaction;
+                                               }
+
+                                               target.ArrayHandle.Handle = 0;
+                                               target.ArrayHandle.Write((System.Array)source.Value);
+                                               target.Value = target.ArrayHandle.Handle;
+                                       }
+                                       break;
+
+                                       case DbDataType.Guid:
+                                               if (!(source.Value is Guid) && !(source.Value is byte[]))
+                                               {
+                                                       throw new InvalidOperationException("Incorrect Guid value.");
+                                               }
+                                               target.Value = source.Value;
+                                               break;
+
+                                       default:
+                                               target.Value = source.Value;
+                                               break;
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void Prepare(bool returnsSet)
+               {
+                       FbConnectionInternal innerConn = this.connection.InnerConnection;
+
+                       // Check if     we have a valid transaction
+                       if (this.transaction == null)
+                       {
+                               this.implicitTransaction = true;
+                               IsolationLevel il = this.connection.ConnectionOptions.IsolationLevel;
+
+                               this.transaction = new FbTransaction(this.connection, il);
+                               this.transaction.BeginTransaction();
+
+                               // Update Statement     transaction
+                               if (this.statement != null)
+                               {
+                                       this.statement.Transaction = this.transaction.Transaction;
+                               }
+                       }
+
+                       // Check if     we have a valid statement handle
+                       if (this.statement == null)
+                       {
+                               this.statement = innerConn.Database.CreateStatement(this.transaction.Transaction);
+                       }
+
+                       // Prepare the statement if     needed
+                       if (!this.statement.IsPrepared)
+                       {
+                // Close the inner DataReader if needed
+                this.CloseReader();
+
+                // Reformat the SQL statement if needed
+                               string sql = this.commandText;
+
+                               if (this.commandType == CommandType.StoredProcedure)
+                               {
+                                       sql = this.BuildStoredProcedureSql(sql, returnsSet);
+                               }
+
+
+                try
+                {
+                    // Try to prepare the command
+                    this.statement.Prepare(this.ParseNamedParameters(sql));
+                }
+                catch
+                {
+                    // Release the statement and rethrow the exception
+                    this.statement.Release();
+                    this.statement = null;
+
+                    throw;
+                }
+
+                               // Add this     command to the active command list
+                               innerConn.AddPreparedCommand(this);
+                       }
+                       else
+                       {
+                               // Close statement for subsequently     executions
+                               this.Close();
+                       }
+               }
+
+               private void ExecuteCommand(CommandBehavior behavior)
+               {
+                       this.ExecuteCommand(behavior, false);
+               }
+
+               private void ExecuteCommand(CommandBehavior behavior, bool returnsSet)
+               {
+                       // Prepare statement
+                       this.Prepare(returnsSet);
+
+                       if ((behavior & CommandBehavior.SequentialAccess) == CommandBehavior.SequentialAccess ||
+                               (behavior & CommandBehavior.SingleResult) == CommandBehavior.SingleResult ||
+                               (behavior & CommandBehavior.SingleRow) == CommandBehavior.SingleRow ||
+                               (behavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection ||
+                               behavior == CommandBehavior.Default)
+                       {
+                               // Set the fetch size
+                               this.statement.FetchSize = this.fetchSize;
+
+                               // Update input parameter values
+                               if (this.parameters.Count > 0)
+                               {
+                                       this.DescribeInput();
+                               }
+
+                               // Execute statement
+                               this.statement.Execute();
+                       }
+               }
+
+               private string BuildStoredProcedureSql(string spName, bool returnsSet)
+               {
+                       string sql = spName == null ? "" : spName.Trim();
+
+                       if (sql.Length > 0 &&
+                               !sql.ToLower(CultureInfo.CurrentCulture).StartsWith("execute procedure ") &&
+                               !sql.ToLower(CultureInfo.CurrentCulture).StartsWith("select "))
+                       {
+                               StringBuilder paramsText = new StringBuilder();
+
+                               // Append the stored proc parameter     name
+                               paramsText.Append(sql);
+                               if (parameters.Count > 0)
+                               {
+                                       paramsText.Append("(");
+                                       for (int i = 0; i < this.parameters.Count; i++)
+                                       {
+                                               if (this.parameters[i].Direction == ParameterDirection.Input ||
+                                                       this.parameters[i].Direction == ParameterDirection.InputOutput)
+                                               {
+                                                       // Append parameter     name to parameter list
+                                                       paramsText.Append(this.parameters[i].ParameterName);
+                                                       if (i != parameters.Count - 1)
+                                                       {
+                                                               paramsText = paramsText.Append(",");
+                                                       }
+                                               }
+                                       }
+                                       paramsText.Append(")");
+                                       paramsText.Replace(",)", ")");
+                                       paramsText.Replace("()", "");
+                               }
+
+                               if (returnsSet)
+                               {
+                                       sql = "select * from " + paramsText.ToString();
+                               }
+                               else
+                               {
+                                       sql = "execute procedure " + paramsText.ToString();
+                               }
+                       }
+
+                       return sql;
+               }
+
+        private string ParseNamedParameters(string sql)
+        {
+            namedParameters.Clear();
+
+            if (sql.IndexOf('@') == -1)
+            {
+                return sql;
+            }
+
+            StringBuilder builder = new StringBuilder();
+            StringBuilder paramBuilder = new StringBuilder();
+
+            bool inCommas = false;
+            bool inParam = false;
+
+            for (int i = 0; i < sql.Length; i++)
+            {
+                char sym = sql[i];
+
+                if (inParam)
+                {
+                    if (Char.IsLetterOrDigit(sym) || sym == '_' ||
+                        sym == '$')
+                    {
+                        paramBuilder.Append(sym);
+                    }
+                    else
+                    {
+                        namedParameters.Add(paramBuilder.ToString());
+                        paramBuilder.Length = 0;
+                        builder.Append('?');
+                        builder.Append(sym);
+                        inParam = false;
+                    }
+                }
+                else
+                {
+                    if (sym == '\'')
+                    {
+                        inCommas = !inCommas;
+                    }
+                    else if (!inCommas && sym == '@')
+                    {
+                        inParam = true;
+                        paramBuilder.Append(sym);
+                        continue;
+                    }
+
+                    builder.Append(sym);
+                }
+            }
+
+            if (inParam)
+            {
+                namedParameters.Add(paramBuilder.ToString());
+                builder.Append('?');
+            }
+
+            return builder.ToString();
+        }
+
+               private void CheckCommand()
+               {
+                       if (this.transaction != null && this.transaction.IsUpdated)
+                       {
+                               this.transaction = null;
+                       }
+
+                       if (this.connection == null || 
+                               this.connection.State != ConnectionState.Open)
+                       {
+                               throw new InvalidOperationException("Connection must valid and open");
+                       }
+
+                       if (this.activeReader != null)
+                       {
+                               throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");
+                       }
+
+                       if (this.transaction == null &&
+                               this.connection.InnerConnection.HasActiveTransaction)
+                       {
+                               throw new InvalidOperationException("Execute requires the Command object to have a Transaction object when the Connection object assigned to the command is in a pending local transaction. The Transaction property of the Command has not been initialized.");
+                       }
+
+                       if (this.transaction != null && !this.transaction.IsUpdated &&
+                               !this.connection.Equals(transaction.Connection))
+                       {
+                               throw new InvalidOperationException("Command Connection is not equal to Transaction Connection.");
+                       }
+
+                       if (this.commandText == null || this.commandText.Length == 0)
+                       {
+                               throw new InvalidOperationException("The command text for this Command has not been set.");
+                       }
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index ad843524671e791ff2d494a3b764be194947e6b4..34dbe1f6c47832ba9dc348a71ee90ced7bf726e6 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.ComponentModel;\r
-using System.Data;\r
-using System.Data.Common;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/overview/*'/>\r
-       public sealed class FbCommandBuilder : Component\r
-       {\r
-               #region Fields\r
-\r
-               private FbDataAdapter dataAdapter;\r
-               private FbCommand insertCommand;\r
-               private FbCommand updateCommand;\r
-               private FbCommand deleteCommand;\r
-               private DataTable schemaTable;\r
-               private string sqlInsert;\r
-               private string sqlUpdate;\r
-               private string sqlDelete;\r
-               private string separator;\r
-               private string whereClausule1;\r
-               private string whereClausule2;\r
-               private string setClausule;\r
-               private string quotePrefix;\r
-               private string quoteSuffix;\r
-               private string tableName;\r
-               private string timestampColumnName;\r
-               private bool usingCoalesce;\r
-               private bool disposed;\r
-               private bool hasPrimaryKey;\r
-\r
-               private FbCommandBuilderBehavior commandBuilderBehavior;\r
-               private FbRowUpdatingEventHandler adapterHandler;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="DataAdapter"]/*'/>\r
-#if    (!NETCF)\r
-               [DefaultValue(null)]\r
-#endif\r
-               public FbDataAdapter DataAdapter\r
-               {\r
-                       get { return this.dataAdapter; }\r
-                       set\r
-                       {\r
-                               this.dataAdapter = value;\r
-\r
-                               // Registers the CommandBuilder as a listener for RowUpdating events that are \r
-                               // generated by the     FbDataAdapter specified in this property.\r
-                               if (this.dataAdapter != null)\r
-                               {\r
-                                       this.adapterHandler = new FbRowUpdatingEventHandler(this.RowUpdatingHandler);\r
-                                       this.dataAdapter.RowUpdating += this.adapterHandler;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="QuotePrefix"]/*'/>\r
-               public string QuotePrefix\r
-               {\r
-                       get { return this.quotePrefix; }\r
-                       set\r
-                       {\r
-                               if (this.insertCommand != null ||\r
-                                       this.updateCommand != null ||\r
-                                       this.deleteCommand != null)\r
-                               {\r
-                                       throw new InvalidOperationException("This property cannot be changed after an insert, update, or delete command has been generated.");\r
-                               }\r
-\r
-                               this.quotePrefix = value;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="QuoteSuffix"]/*'/>\r
-               public string QuoteSuffix\r
-               {\r
-                       get { return this.quoteSuffix; }\r
-                       set\r
-                       {\r
-                               if (this.insertCommand != null ||\r
-                                       this.updateCommand != null ||\r
-                                       this.deleteCommand != null)\r
-                               {\r
-                                       throw new InvalidOperationException("This property cannot be changed after an insert, update, or delete command has been generated.");\r
-                               }\r
-\r
-                               this.quoteSuffix = value;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="CommandBuilderBehavior"]/*'/>\r
-#if    (!NETCF)\r
-               [DefaultValue(FbCommandBuilderBehavior.Default)]\r
-#endif\r
-               public FbCommandBuilderBehavior CommandBuilderBehavior\r
-               {\r
-                       get { return this.commandBuilderBehavior; }\r
-                       set { this.commandBuilderBehavior = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="timestampColumnName"]/*'/>\r
-#if    (!NETCF)\r
-               [DefaultValue("")]\r
-#endif\r
-               public string TimestampColumnName\r
-               {\r
-                       get { return this.timestampColumnName; }\r
-                       set\r
-                       {\r
-                               if (value == null)\r
-                               {\r
-                                       value = String.Empty;\r
-                               }\r
-                               this.timestampColumnName = value;\r
-                       }\r
-               }\r
-\r
-\r
-               #endregion\r
-\r
-               #region Internal properties\r
-\r
-               internal FbCommand SelectCommand\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.dataAdapter.SelectCommand != null)\r
-                               {\r
-                                       return this.dataAdapter.SelectCommand;\r
-                               }\r
-\r
-                               return null;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/constructor[@name="ctor"]/*'/>\r
-               public FbCommandBuilder() : base()\r
-               {\r
-                       this.sqlInsert          = "INSERT INTO {0} ({1}) VALUES ({2})";\r
-                       this.sqlUpdate          = "UPDATE {0} SET {1} WHERE ({2})";\r
-                       this.sqlDelete          = "DELETE FROM {0} WHERE ({1})";\r
-                       this.whereClausule1 = "(({0} IS NULL) OR ({0} = {1}))";\r
-                       this.whereClausule2 = "({0} = {1})";\r
-                       this.setClausule        = "{0} = {1}";\r
-                       this.separator          = ",";\r
-                       this.quotePrefix        = "\"";\r
-                       this.quoteSuffix        = "\"";\r
-                       this.timestampColumnName        = String.Empty;\r
-                       this.commandBuilderBehavior = FbCommandBuilderBehavior.Default;\r
-\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="ctor(FbDataAdapter)"]/*'/>\r
-               public FbCommandBuilder(FbDataAdapter adapter) : this()\r
-               {\r
-                       this.DataAdapter = adapter;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="Dispose(System.Boolean)"]/*'/>\r
-               protected override void Dispose(bool disposing)\r
-               {\r
-                       if (!this.disposed)\r
-                       {\r
-                               try\r
-                               {\r
-                                       if (disposing)\r
-                                       {\r
-                                               // Clear generated commands\r
-                                               this.RefreshSchema();\r
-\r
-                                               // Clear FbDataAdapter handler if needed\r
-                                               if (this.adapterHandler != null)\r
-                                               {\r
-                                                       this.dataAdapter.RowUpdating -= adapterHandler;\r
-                                               }\r
-\r
-                                               // Clear fields\r
-                                               this.sqlInsert          = null;\r
-                                               this.sqlUpdate          = null;\r
-                                               this.sqlDelete          = null;\r
-                                               this.whereClausule1 = null;\r
-                                               this.whereClausule2 = null;\r
-                                               this.setClausule        = null;\r
-                                               this.separator          = null;\r
-                                               this.quotePrefix        = null;\r
-                                               this.quoteSuffix        = null;\r
-                                               this.dataAdapter        = null;\r
-                                               this.timestampColumnName = null;\r
-                                       }\r
-\r
-                                       // release any unmanaged resources\r
-\r
-                                       this.disposed = true;\r
-                               }\r
-                               finally\r
-                               {\r
-                                       base.Dispose(disposing);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="DeriveParameters(FbCommand)"]/*'/>\r
-               public static void DeriveParameters(FbCommand command)\r
-               {\r
-                       if (command.CommandType != CommandType.StoredProcedure)\r
-                       {\r
-                               throw new InvalidOperationException("The command text is not a valid stored procedure name.");\r
-                       }\r
-\r
-                       string spName           = command.CommandText.Trim();\r
-                       string quotePrefix      = "\"";\r
-                       string quoteSuffix      = "\"";\r
-\r
-                       if (spName.StartsWith(quotePrefix) && spName.EndsWith(quoteSuffix))\r
-                       {\r
-                               spName = spName.Substring(1, spName.Length - 2);\r
-                       }\r
-                       else\r
-                       {\r
-                               spName = spName.ToUpper(CultureInfo.CurrentCulture);\r
-                       }\r
-\r
-                       command.Parameters.Clear();\r
-\r
-                       DataView dataTypes = command.Connection.GetSchema("DataTypes").DefaultView;\r
-\r
-                       DataTable spSchema = command.Connection.GetSchema(\r
-                               "ProcedureParameters", new string[] { null, null, spName });\r
-\r
-                       int count = 1;\r
-                       foreach (DataRow row in spSchema.Rows)\r
-                       {\r
-                               dataTypes.RowFilter = String.Format(\r
-                                       CultureInfo.CurrentCulture,\r
-                                       "TypeName = '{0}'",\r
-                                       row["PARAMETER_DATA_TYPE"]);\r
-\r
-                               FbParameter parameter = command.Parameters.Add(\r
-                                       "@" + row["PARAMETER_NAME"].ToString().Trim(),\r
-                                FbDbType.VarChar);\r
-\r
-                               parameter.FbDbType = (FbDbType)dataTypes[0]["ProviderDbType"];\r
-\r
-                               parameter.Direction = (ParameterDirection)row["PARAMETER_DIRECTION"];\r
-\r
-                               parameter.Size = Convert.ToInt32(row["PARAMETER_SIZE"], CultureInfo.InvariantCulture);\r
-\r
-                               if (parameter.FbDbType == FbDbType.Decimal ||\r
-                                       parameter.FbDbType == FbDbType.Numeric)\r
-                               {\r
-                                       if (row["NUMERIC_PRECISION"] != DBNull.Value)\r
-                                       {\r
-                                               parameter.Precision = Convert.ToByte(row["NUMERIC_PRECISION"], CultureInfo.InvariantCulture);\r
-                                       }\r
-                                       if (row["NUMERIC_SCALE"] != DBNull.Value)\r
-                                       {\r
-                                               parameter.Scale = Convert.ToByte(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);\r
-                                       }\r
-                               }\r
-\r
-                               count++;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="GetInsertCommand"]/*'/>\r
-               public FbCommand GetInsertCommand()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.insertCommand == null)\r
-                               {\r
-                                       this.BuildInsertCommand(null, null);\r
-                               }\r
-                       }\r
-\r
-                       return this.insertCommand;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="GetUpdateCommand"]/*'/>\r
-               public FbCommand GetUpdateCommand()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.updateCommand == null)\r
-                               {\r
-                                       this.BuildUpdateCommand(null, null);\r
-                               }\r
-                       }\r
-\r
-                       return updateCommand;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="GetDeleteCommand"]/*'/>\r
-               public FbCommand GetDeleteCommand()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.deleteCommand == null)\r
-                               {\r
-                                       this.BuildDeleteCommand(null, null);\r
-                               }\r
-                       }\r
-\r
-                       return this.deleteCommand;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="RefreshSchema"]/*'/>\r
-               public void RefreshSchema()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               // Clear DataAdapter commands if needed\r
-                               if (this.dataAdapter != null)\r
-                               {\r
-                                       if (this.insertCommand == this.dataAdapter.InsertCommand)\r
-                                       {\r
-                                               this.dataAdapter.InsertCommand = null;\r
-                                       }\r
-                                       if (this.deleteCommand == this.dataAdapter.DeleteCommand)\r
-                                       {\r
-                                               this.dataAdapter.DeleteCommand = null;\r
-                                       }\r
-                                       if (this.updateCommand == this.dataAdapter.UpdateCommand)\r
-                                       {\r
-                                               this.dataAdapter.UpdateCommand = null;\r
-                                       }\r
-                               }\r
-\r
-                               // Clear commands\r
-                               if (this.insertCommand != null)\r
-                               {\r
-                                       this.insertCommand.Dispose();\r
-                               }\r
-                               if (this.updateCommand != null)\r
-                               {\r
-                                       this.updateCommand.Dispose();\r
-                               }\r
-                               if (this.deleteCommand != null)\r
-                               {\r
-                                       this.deleteCommand.Dispose();\r
-                               }\r
-                               if (this.schemaTable != null)\r
-                               {\r
-                                       this.schemaTable.Dispose();\r
-                               }\r
-                               this.insertCommand = null;\r
-                               this.updateCommand = null;\r
-                               this.deleteCommand = null;\r
-                               this.schemaTable = null;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Command Building Methods\r
-\r
-               private FbCommand BuildInsertCommand(DataRow row, DataTableMapping tableMapping)\r
-               {\r
-                       if (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields &&\r
-                               (this.timestampColumnName == null ||\r
-                               this.timestampColumnName.Length == 0))\r
-                       {\r
-                               throw new InvalidOperationException();\r
-                       }\r
-\r
-                       StringBuilder sql               = new StringBuilder();\r
-                       StringBuilder fields    = new StringBuilder();\r
-                       StringBuilder values    = new StringBuilder();\r
-\r
-                       this.BuildSchemaTable();\r
-\r
-                       this.CreateCommand(ref this.insertCommand);\r
-\r
-                       int i = 0;\r
-                       foreach (DataRow schemaRow in schemaTable.Rows)\r
-                       {\r
-                               if (this.IsUpdatable(schemaRow, row, tableMapping))\r
-                               {\r
-                                       if (fields.Length > 0)\r
-                                       {\r
-                                               fields.Append(this.separator);\r
-                                       }\r
-                                       if (values.Length > 0)\r
-                                       {\r
-                                               values.Append(this.separator);\r
-                                       }\r
-\r
-                                       fields.Append(this.GetQuotedIdentifier(schemaRow["BaseColumnName"]));\r
-\r
-                                       FbParameter parameter = this.CreateParameter(schemaRow, i, false);\r
-\r
-                                       values.Append(parameter.ParameterName);\r
-\r
-                                       if (row != null && tableMapping != null)\r
-                                       {\r
-                                               DataColumn column = this.GetDataColumn(\r
-                                                       schemaRow["BaseColumnName"].ToString(),\r
-                                                       tableMapping,\r
-                                                       row);\r
-\r
-                                               if (column != null)\r
-                                               {\r
-                                                       parameter.Value = row[column];\r
-                                               }\r
-                                       }\r
-\r
-                                       i++;\r
-\r
-                                       this.insertCommand.Parameters.Add(parameter);\r
-                               }\r
-                       }\r
-\r
-                       sql.AppendFormat(\r
-                               CultureInfo.CurrentCulture,\r
-                               this.sqlInsert,\r
-                               this.GetQuotedIdentifier(tableName),\r
-                               fields.ToString(),\r
-                               values.ToString());\r
-\r
-                       this.insertCommand.CommandText = sql.ToString();\r
-\r
-                       return this.insertCommand;\r
-               }\r
-\r
-               private FbCommand BuildUpdateCommand(DataRow row, DataTableMapping tableMapping)\r
-               {\r
-                       if (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields &&\r
-                               (this.timestampColumnName == null ||\r
-                               this.timestampColumnName.Length == 0))\r
-                       {\r
-                               throw new InvalidOperationException();\r
-                       }\r
-\r
-                       StringBuilder sql       = new StringBuilder();\r
-                       StringBuilder sets      = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       this.BuildSchemaTable();\r
-\r
-                       if (!this.hasPrimaryKey)\r
-                       {\r
-                               throw new InvalidOperationException("Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.");\r
-                       }\r
-\r
-                       this.CreateCommand(ref this.updateCommand);\r
-\r
-                       int i = 0;\r
-                       foreach (DataRow schemaRow in schemaTable.Rows)\r
-                       {\r
-                               if (this.IsUpdatable(schemaRow, row, tableMapping))\r
-                               {\r
-                                       if (sets.Length > 0)\r
-                                       {\r
-                                               sets.Append(separator);\r
-                                       }\r
-\r
-                                       FbParameter parameter = this.CreateParameter(schemaRow, i, false);\r
-\r
-                                       // Update SET clausule\r
-                                       sets.AppendFormat(\r
-                                               CultureInfo.CurrentCulture,\r
-                                               setClausule,\r
-                                               this.GetQuotedIdentifier(schemaRow["BaseColumnName"]),\r
-                                               parameter.ParameterName);\r
-\r
-                                       if (row != null && tableMapping != null)\r
-                                       {\r
-                                               DataColumn column = this.GetDataColumn(\r
-                                                       schemaRow["BaseColumnName"].ToString(),\r
-                                                       tableMapping,\r
-                                                       row);\r
-\r
-                                               if (column != null)\r
-                                               {\r
-                                                       parameter.Value = row[column];\r
-                                               }\r
-                                       }\r
-\r
-                                       i++;\r
-\r
-                                       this.updateCommand.Parameters.Add(parameter);\r
-                               }\r
-                       }\r
-\r
-                       // Build where clausule\r
-                       foreach (DataRow schemaRow in schemaTable.Rows)\r
-                       {\r
-                               if (this.IncludedInWhereClause(schemaRow))\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]);\r
-\r
-                                       // Create parameters for this field\r
-                                       FbParameter parameter = this.CreateParameter(schemaRow, i, true);\r
-\r
-                                       // Add where clausule for this field\r
-                                       if ((bool)schemaRow["IsKey"])\r
-                                       {\r
-                                               where.AppendFormat(\r
-                                                       CultureInfo.CurrentCulture,\r
-                                                       whereClausule2,\r
-                                                       quotedId,\r
-                                                       parameter.ParameterName);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               if (this.usingCoalesce)\r
-                                               {\r
-                                                       string typeName = TypeHelper.GetDataTypeName((DbDataType)parameter.FbDbType);\r
-\r
-                                                       switch (typeName)\r
-                                                       {\r
-                                                               case "VARCHAR":\r
-                                                               case "CHAR":\r
-                                                                       typeName = String.Format(\r
-                                                                               CultureInfo.CurrentCulture,\r
-                                                                               "{0}({1})",\r
-                                                                               typeName,\r
-                                                                               schemaRow["ColumnSize"]);\r
-                                                                       break;\r
-\r
-                                                               case "DECIMAL":\r
-                                                               case "NUMERIC":\r
-                                                                       typeName = String.Format(\r
-                                                                               CultureInfo.CurrentCulture,\r
-                                                                               "{0}({1},{2})",\r
-                                                                               typeName,\r
-                                                                               schemaRow["NumericPrecision"],\r
-                                                                               schemaRow["NumericScale"]);\r
-                                                                       break;\r
-                                                       }\r
-\r
-                                                       where.AppendFormat(\r
-                                                               CultureInfo.CurrentCulture,\r
-                                                               whereClausule1,\r
-                                                               quotedId,\r
-                                                               parameter.ParameterName,\r
-                                                               typeName);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       where.AppendFormat(\r
-                                                               CultureInfo.CurrentCulture,\r
-                                                               whereClausule1,\r
-                                                               quotedId,\r
-                                                               parameter.ParameterName);\r
-                                               }\r
-                                       }\r
-\r
-                                       if (row != null && tableMapping != null)\r
-                                       {\r
-                                               DataColumn column = this.GetDataColumn(\r
-                                                       schemaRow["BaseColumnName"].ToString(),\r
-                                                       tableMapping,\r
-                                                       row);\r
-\r
-                                               if (column != null)\r
-                                               {\r
-                                                       parameter.Value = row[column, DataRowVersion.Original];\r
-                                               }\r
-                                       }\r
-\r
-                                       this.updateCommand.Parameters.Add(parameter);\r
-\r
-                                       i++;\r
-                               }\r
-                       }\r
-\r
-                       sql.AppendFormat(\r
-                               CultureInfo.CurrentCulture,\r
-                               this.sqlUpdate,\r
-                               this.GetQuotedIdentifier(tableName),\r
-                               sets.ToString(),\r
-                               where.ToString());\r
-\r
-                       this.updateCommand.CommandText = sql.ToString();\r
-\r
-                       return this.updateCommand;\r
-               }\r
-\r
-               private FbCommand BuildDeleteCommand(DataRow row, DataTableMapping tableMapping)\r
-               {\r
-                       if (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields &&\r
-                               (this.timestampColumnName == null ||\r
-                               this.timestampColumnName.Length == 0))\r
-                       {\r
-                               throw new InvalidOperationException();\r
-                       }\r
-\r
-                       StringBuilder sql = new StringBuilder();\r
-                       StringBuilder where = new StringBuilder();\r
-\r
-                       this.BuildSchemaTable();\r
-\r
-                       if (!this.hasPrimaryKey)\r
-                       {\r
-                               throw new InvalidOperationException("Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information.");\r
-                       }\r
-\r
-                       this.CreateCommand(ref this.deleteCommand);\r
-\r
-                       // Build where clausule\r
-                       int i = 0;\r
-                       foreach (DataRow schemaRow in schemaTable.Rows)\r
-                       {\r
-                               if (this.IncludedInWhereClause(schemaRow))\r
-                               {\r
-                                       if (where.Length > 0)\r
-                                       {\r
-                                               where.Append(" AND ");\r
-                                       }\r
-\r
-                                       string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]);\r
-\r
-                                       // Create parameters for this field\r
-                                       FbParameter parameter = this.CreateParameter(schemaRow, i, true);\r
-\r
-                                       if ((bool)schemaRow["IsKey"])\r
-                                       {\r
-                                               where.AppendFormat(\r
-                                                       CultureInfo.CurrentCulture,\r
-                                                       whereClausule2,\r
-                                                       quotedId,\r
-                                                       parameter.ParameterName);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               if (this.usingCoalesce)\r
-                                               {\r
-                                                       string typeName = TypeHelper.GetDataTypeName((DbDataType)parameter.FbDbType);\r
-\r
-                                                       switch (typeName)\r
-                                                       {\r
-                                                               case "VARCHAR":\r
-                                                               case "CHAR":\r
-                                                                       typeName = String.Format(\r
-                                                                               CultureInfo.CurrentCulture,\r
-                                                                               "{0}({1})",\r
-                                                                               typeName,\r
-                                                                               schemaRow["ColumnSize"]);\r
-                                                                       break;\r
-\r
-                                                               case "DECIMAL":\r
-                                                               case "NUMERIC":\r
-                                                                       typeName = String.Format(\r
-                                                                               CultureInfo.CurrentCulture,\r
-                                                                               "{0}({1},{2})",\r
-                                                                               typeName,\r
-                                                                               schemaRow["NumericPrecision"],\r
-                                                                               schemaRow["NumericScale"]);\r
-                                                                       break;\r
-                                                       }\r
-\r
-                                                       where.AppendFormat(\r
-                                                               CultureInfo.CurrentCulture,\r
-                                                               whereClausule1,\r
-                                                               quotedId,\r
-                                                               parameter.ParameterName,\r
-                                                               typeName);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       where.AppendFormat(\r
-                                                               CultureInfo.CurrentCulture,\r
-                                                               whereClausule1,\r
-                                                               quotedId,\r
-                                                               parameter.ParameterName);\r
-                                               }\r
-                                       }\r
-\r
-                                       if (row != null && tableMapping != null)\r
-                                       {\r
-                                               DataColumn column = this.GetDataColumn(\r
-                                                       schemaRow["BaseColumnName"].ToString(),\r
-                                                       tableMapping,\r
-                                                       row);\r
-\r
-                                               if (column != null)\r
-                                               {\r
-                                                       parameter.Value = row[column, DataRowVersion.Original];\r
-                                               }\r
-                                       }\r
-\r
-                                       this.deleteCommand.Parameters.Add(parameter);\r
-\r
-                                       i++;\r
-                               }\r
-                       }\r
-\r
-                       sql.AppendFormat(\r
-                               CultureInfo.CurrentCulture,\r
-                               this.sqlDelete,\r
-                               this.GetQuotedIdentifier(tableName),\r
-                               where.ToString());\r
-\r
-                       this.deleteCommand.CommandText = sql.ToString();\r
-\r
-                       return this.deleteCommand;\r
-               }\r
-\r
-               private bool IsUpdatable(\r
-                       DataRow schemaRow, DataRow row, DataTableMapping tableMapping)\r
-               {\r
-                       if (row != null && tableMapping != null)\r
-                       {\r
-                               DataColumn column = this.GetDataColumn(\r
-                                       schemaRow["BaseColumnName"].ToString(),\r
-                                       tableMapping,\r
-                                       row);\r
-\r
-                               if (column != null)\r
-                               {\r
-                                       if (column.Expression != null &&\r
-                                               column.Expression.Length != 0)\r
-                                       {\r
-                                               return false;\r
-                                       }\r
-                                       if (column.ReadOnly)\r
-                                       {\r
-                                               return false;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       if ((bool)schemaRow["IsExpression"])\r
-                       {\r
-                               return false;\r
-                       }\r
-                       if ((bool)schemaRow["IsAutoIncrement"])\r
-                       {\r
-                               return false;\r
-                       }\r
-                       if ((bool)schemaRow["IsRowVersion"])\r
-                       {\r
-                               return false;\r
-                       }\r
-                       if ((bool)schemaRow["IsReadOnly"])\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       return true;\r
-               }\r
-\r
-               private bool IncludedInWhereClause(DataRow schemaRow)\r
-               {\r
-                       if (!(bool)schemaRow["IsKey"] &&\r
-                               (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyFields ||\r
-                               this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields))\r
-                       {\r
-                               if (this.timestampColumnName != schemaRow["BaseColumnName"].ToString())\r
-                               {\r
-                                       return false;\r
-                               }\r
-                       }\r
-\r
-                       FbDbType dbType = (FbDbType)schemaRow["ProviderType"];\r
-\r
-                       if (dbType == FbDbType.Array || dbType == FbDbType.Binary)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       if ((bool)schemaRow["IsLong"])\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       return true;\r
-               }\r
-\r
-               private void BuildSchemaTable()\r
-               {\r
-                       bool mustClose = false;\r
-\r
-                       if (this.SelectCommand == null)\r
-                       {\r
-                               throw new InvalidOperationException("The DataAdapter.SelectCommand property needs to be initialized.");\r
-                       }\r
-                       if (this.SelectCommand.Connection == null)\r
-                       {\r
-                               throw new InvalidOperationException("The DataAdapter.SelectCommand.Connection property needs to be initialized.");\r
-                       }\r
-\r
-                       if (this.schemaTable == null)\r
-                       {\r
-                               if (this.SelectCommand.Connection.State == ConnectionState.Closed)\r
-                               {\r
-                                       mustClose = true;\r
-                                       this.SelectCommand.Connection.Open();\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       FbCommand schemaCmd = (FbCommand)((ICloneable)this.SelectCommand).Clone();\r
-\r
-                                       FbDataReader reader = schemaCmd.ExecuteReader(CommandBehavior.SchemaOnly);\r
-\r
-                                       this.schemaTable = reader.GetSchemaTable();\r
-\r
-                                       reader.Close();\r
-\r
-                                       schemaCmd.Dispose();\r
-                                       schemaCmd = null;\r
-\r
-                                       this.CheckSchemaTable();\r
-\r
-                                       this.UpdateFormats();\r
-                               }\r
-                               catch\r
-                               {\r
-                                       throw;\r
-                               }\r
-                               finally\r
-                               {\r
-                                       if (mustClose)\r
-                                       {\r
-                                               this.SelectCommand.Connection.Close();\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private void CheckSchemaTable()\r
-               {\r
-                       this.tableName = String.Empty;\r
-                       this.hasPrimaryKey = false;\r
-\r
-                       foreach (DataRow schemaRow in schemaTable.Rows)\r
-                       {\r
-                               if (this.tableName.Length == 0)\r
-                               {\r
-                                       this.tableName = (string)schemaRow["BaseTableName"];\r
-                               }\r
-                               if (this.tableName != (string)schemaRow["BaseTableName"] &&\r
-                                       !(bool)schemaRow["IsExpression"])\r
-                               {\r
-                                       throw new InvalidOperationException("Dynamic SQL generation is not supported against multiple base tables.");\r
-                               }\r
-                               if ((bool)schemaRow["IsKey"] || (bool)schemaRow["IsUnique"])\r
-                               {\r
-                                       this.hasPrimaryKey = true;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private string GetQuotedIdentifier(object identifier)\r
-               {\r
-                       string suffix = this.quoteSuffix != null ? this.quoteSuffix : String.Empty;\r
-                       string prefix = this.quotePrefix != null ? this.quotePrefix : String.Empty;\r
-\r
-                       return prefix + identifier.ToString() + suffix;\r
-               }\r
-\r
-               private void CreateCommand(ref FbCommand command)\r
-               {\r
-                       if (command == null)\r
-                       {\r
-                               command = this.SelectCommand.Connection.CreateCommand();\r
-                       }\r
-\r
-                       command.Transaction = this.SelectCommand.Transaction;\r
-                       command.CommandType = CommandType.Text;\r
-                       command.UpdatedRowSource = UpdateRowSource.None;\r
-                       command.Parameters.Clear();\r
-               }\r
-\r
-               private FbParameter CreateParameter(\r
-                       DataRow schemaRow, int index, bool isWhereParameter)\r
-               {\r
-                       string pname = String.Format(CultureInfo.CurrentCulture, "@p{0}", index + 1);\r
-                       FbParameter parameter = new FbParameter(pname, (FbDbType)schemaRow["ProviderType"]);\r
-\r
-                       parameter.Size = Convert.ToInt32(schemaRow["ColumnSize"], CultureInfo.InvariantCulture);\r
-                       if (schemaRow["NumericPrecision"] != DBNull.Value)\r
-                       {\r
-                               parameter.Precision = Convert.ToByte(schemaRow["NumericPrecision"], CultureInfo.InvariantCulture);\r
-                       }\r
-                       if (schemaRow["NumericScale"] != DBNull.Value)\r
-                       {\r
-                               parameter.Scale = Convert.ToByte(schemaRow["NumericScale"], CultureInfo.InvariantCulture);\r
-                       }\r
-                       parameter.SourceColumn = schemaRow["BaseColumnName"].ToString();\r
-                       parameter.IsNullable = Convert.ToBoolean(schemaRow["AllowDbNull"], CultureInfo.InvariantCulture);\r
-\r
-                       if (isWhereParameter)\r
-                       {\r
-                               parameter.SourceVersion = DataRowVersion.Original;\r
-                       }\r
-                       else\r
-                       {\r
-                               parameter.SourceVersion = DataRowVersion.Current;\r
-                       }\r
-\r
-                       return parameter;\r
-               }\r
-\r
-               private DataColumn GetDataColumn(\r
-                       string columnName, DataTableMapping tableMapping, DataRow row)\r
-               {\r
-                       DataColumn dataColumn = null;\r
-\r
-                       // Get the DataColumnMapping that matches\r
-                       // the given column     name\r
-                       DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction(\r
-                               columnName, this.dataAdapter.MissingMappingAction);\r
-\r
-                       if (columnMapping != null)\r
-                       {\r
-                               // Get the DataColumn for the given     column name\r
-                               dataColumn = columnMapping.GetDataColumnBySchemaAction(\r
-                                       row.Table,\r
-                                       null,\r
-                                       this.dataAdapter.MissingSchemaAction);\r
-                       }\r
-\r
-                       return dataColumn;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Event Handler Methods\r
-\r
-               private void RowUpdatingHandler(object sender, FbRowUpdatingEventArgs e)\r
-               {\r
-                       if (e.Status != UpdateStatus.Continue)\r
-                       {\r
-                               return;\r
-                       }\r
-\r
-                       if (e.Command != null)\r
-                       {\r
-                               // Check that we can really     build a new     command.\r
-                               // If the command passed in     the     FbRowUpdatingEventArgs\r
-                               // is different than the one existent in the CommabdBuilder\r
-                               // we can't     build a new     command\r
-\r
-                               FbCommand command = null;\r
-\r
-                               switch (e.StatementType)\r
-                               {\r
-                                       case StatementType.Insert:\r
-                                               command = this.insertCommand;\r
-                                               break;\r
-\r
-                                       case StatementType.Delete:\r
-                                               command = this.deleteCommand;\r
-                                               break;\r
-\r
-                                       case StatementType.Update:\r
-                                               command = this.updateCommand;\r
-                                               break;\r
-                               }\r
-\r
-                               if (command != e.Command)\r
-                               {\r
-                                       return;\r
-                               }\r
-                       }\r
-\r
-                       try\r
-                       {\r
-                               switch (e.StatementType)\r
-                               {\r
-                                       case StatementType.Insert:\r
-                                               e.Command = this.BuildInsertCommand(\r
-                                                               e.Row,\r
-                                                               e.TableMapping);\r
-                                               break;\r
-\r
-                                       case StatementType.Update:\r
-                                               e.Command = this.BuildUpdateCommand(\r
-                                                               e.Row,\r
-                                                               e.TableMapping);\r
-                                               break;\r
-\r
-                                       case StatementType.Delete:\r
-                                               e.Command = this.BuildDeleteCommand(\r
-                                                               e.Row,\r
-                                                               e.TableMapping);\r
-                                               break;\r
-                               }\r
-                       }\r
-                       catch (Exception exception)\r
-                       {\r
-                               e.Errors = exception;\r
-                               e.Status = UpdateStatus.ErrorsOccurred;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void UpdateFormats()\r
-               {\r
-                       this.usingCoalesce = false;\r
-\r
-                       if (this.SelectCommand.Connection != null)\r
-                       {\r
-                               string version = this.SelectCommand.Connection.ServerVersion;\r
-\r
-                               if (version.IndexOf("Firebird 1.5") > 0)\r
-                               {\r
-                                       this.whereClausule1 = "(({0} IS NULL AND COALESCE({1}, CAST(NULL AS {2})) IS NULL) OR ({0} = {1}))";\r
-                                       this.usingCoalesce = true;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Globalization;
+using System.Text;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/overview/*'/>
+       public sealed class FbCommandBuilder : Component
+       {
+               #region Fields
+
+               private FbDataAdapter dataAdapter;
+               private FbCommand insertCommand;
+               private FbCommand updateCommand;
+               private FbCommand deleteCommand;
+               private DataTable schemaTable;
+               private string sqlInsert;
+               private string sqlUpdate;
+               private string sqlDelete;
+               private string separator;
+               private string whereClausule1;
+               private string whereClausule2;
+               private string setClausule;
+               private string quotePrefix;
+               private string quoteSuffix;
+               private string tableName;
+               private string timestampColumnName;
+               private bool usingCoalesce;
+               private bool disposed;
+               private bool hasPrimaryKey;
+
+               private FbCommandBuilderBehavior commandBuilderBehavior;
+               private FbRowUpdatingEventHandler adapterHandler;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="DataAdapter"]/*'/>
+#if    (!NETCF)
+               [DefaultValue(null)]
+#endif
+               public FbDataAdapter DataAdapter
+               {
+                       get { return this.dataAdapter; }
+                       set
+                       {
+                               this.dataAdapter = value;
+
+                               // Registers the CommandBuilder as a listener for RowUpdating events that are 
+                               // generated by the     FbDataAdapter specified in this property.
+                               if (this.dataAdapter != null)
+                               {
+                                       this.adapterHandler = new FbRowUpdatingEventHandler(this.RowUpdatingHandler);
+                                       this.dataAdapter.RowUpdating += this.adapterHandler;
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="QuotePrefix"]/*'/>
+               public string QuotePrefix
+               {
+                       get { return this.quotePrefix; }
+                       set
+                       {
+                               if (this.insertCommand != null ||
+                                       this.updateCommand != null ||
+                                       this.deleteCommand != null)
+                               {
+                                       throw new InvalidOperationException("This property cannot be changed after an insert, update, or delete command has been generated.");
+                               }
+
+                               this.quotePrefix = value;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="QuoteSuffix"]/*'/>
+               public string QuoteSuffix
+               {
+                       get { return this.quoteSuffix; }
+                       set
+                       {
+                               if (this.insertCommand != null ||
+                                       this.updateCommand != null ||
+                                       this.deleteCommand != null)
+                               {
+                                       throw new InvalidOperationException("This property cannot be changed after an insert, update, or delete command has been generated.");
+                               }
+
+                               this.quoteSuffix = value;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="CommandBuilderBehavior"]/*'/>
+#if    (!NETCF)
+               [DefaultValue(FbCommandBuilderBehavior.Default)]
+#endif
+               public FbCommandBuilderBehavior CommandBuilderBehavior
+               {
+                       get { return this.commandBuilderBehavior; }
+                       set { this.commandBuilderBehavior = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="timestampColumnName"]/*'/>
+#if    (!NETCF)
+               [DefaultValue("")]
+#endif
+               public string TimestampColumnName
+               {
+                       get { return this.timestampColumnName; }
+                       set
+                       {
+                               if (value == null)
+                               {
+                                       value = String.Empty;
+                               }
+                               this.timestampColumnName = value;
+                       }
+               }
+
+
+               #endregion
+
+               #region Internal properties
+
+               internal FbCommand SelectCommand
+               {
+                       get
+                       {
+                               if (this.dataAdapter.SelectCommand != null)
+                               {
+                                       return this.dataAdapter.SelectCommand;
+                               }
+
+                               return null;
+                       }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/constructor[@name="ctor"]/*'/>
+               public FbCommandBuilder() : base()
+               {
+                       this.sqlInsert          = "INSERT INTO {0} ({1}) VALUES ({2})";
+                       this.sqlUpdate          = "UPDATE {0} SET {1} WHERE ({2})";
+                       this.sqlDelete          = "DELETE FROM {0} WHERE ({1})";
+                       this.whereClausule1 = "(({0} IS NULL) OR ({0} = {1}))";
+                       this.whereClausule2 = "({0} = {1})";
+                       this.setClausule        = "{0} = {1}";
+                       this.separator          = ",";
+                       this.quotePrefix        = "\"";
+                       this.quoteSuffix        = "\"";
+                       this.timestampColumnName        = String.Empty;
+                       this.commandBuilderBehavior = FbCommandBuilderBehavior.Default;
+
+                       GC.SuppressFinalize(this);
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/property[@name="ctor(FbDataAdapter)"]/*'/>
+               public FbCommandBuilder(FbDataAdapter adapter) : this()
+               {
+                       this.DataAdapter = adapter;
+               }
+
+               #endregion
+
+               #region IDisposable     Methods
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="Dispose(System.Boolean)"]/*'/>
+               protected override void Dispose(bool disposing)
+               {
+                       if (!this.disposed)
+                       {
+                               try
+                               {
+                                       if (disposing)
+                                       {
+                                               // Clear generated commands
+                                               this.RefreshSchema();
+
+                                               // Clear FbDataAdapter handler if needed
+                                               if (this.adapterHandler != null)
+                                               {
+                                                       this.dataAdapter.RowUpdating -= adapterHandler;
+                                               }
+
+                                               // Clear fields
+                                               this.sqlInsert          = null;
+                                               this.sqlUpdate          = null;
+                                               this.sqlDelete          = null;
+                                               this.whereClausule1 = null;
+                                               this.whereClausule2 = null;
+                                               this.setClausule        = null;
+                                               this.separator          = null;
+                                               this.quotePrefix        = null;
+                                               this.quoteSuffix        = null;
+                                               this.dataAdapter        = null;
+                                               this.timestampColumnName = null;
+                                       }
+
+                                       // release any unmanaged resources
+
+                                       this.disposed = true;
+                               }
+                               finally
+                               {
+                                       base.Dispose(disposing);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="DeriveParameters(FbCommand)"]/*'/>
+               public static void DeriveParameters(FbCommand command)
+               {
+                       if (command.CommandType != CommandType.StoredProcedure)
+                       {
+                               throw new InvalidOperationException("The command text is not a valid stored procedure name.");
+                       }
+
+                       string spName           = command.CommandText.Trim();
+                       string quotePrefix      = "\"";
+                       string quoteSuffix      = "\"";
+
+                       if (spName.StartsWith(quotePrefix) && spName.EndsWith(quoteSuffix))
+                       {
+                               spName = spName.Substring(1, spName.Length - 2);
+                       }
+                       else
+                       {
+                               spName = spName.ToUpper(CultureInfo.CurrentCulture);
+                       }
+
+                       command.Parameters.Clear();
+
+                       DataView dataTypes = command.Connection.GetSchema("DataTypes").DefaultView;
+
+                       DataTable spSchema = command.Connection.GetSchema(
+                               "ProcedureParameters", new string[] { null, null, spName });
+
+                       int count = 1;
+                       foreach (DataRow row in spSchema.Rows)
+                       {
+                               dataTypes.RowFilter = String.Format(
+                                       CultureInfo.CurrentCulture,
+                                       "TypeName = '{0}'",
+                                       row["PARAMETER_DATA_TYPE"]);
+
+                               FbParameter parameter = command.Parameters.Add(
+                                       "@" + row["PARAMETER_NAME"].ToString().Trim(),
+                                FbDbType.VarChar);
+
+                               parameter.FbDbType = (FbDbType)dataTypes[0]["ProviderDbType"];
+
+                               parameter.Direction = (ParameterDirection)row["PARAMETER_DIRECTION"];
+
+                               parameter.Size = Convert.ToInt32(row["PARAMETER_SIZE"], CultureInfo.InvariantCulture);
+
+                               if (parameter.FbDbType == FbDbType.Decimal ||
+                                       parameter.FbDbType == FbDbType.Numeric)
+                               {
+                                       if (row["NUMERIC_PRECISION"] != DBNull.Value)
+                                       {
+                                               parameter.Precision = Convert.ToByte(row["NUMERIC_PRECISION"], CultureInfo.InvariantCulture);
+                                       }
+                                       if (row["NUMERIC_SCALE"] != DBNull.Value)
+                                       {
+                                               parameter.Scale = Convert.ToByte(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture);
+                                       }
+                               }
+
+                               count++;
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="GetInsertCommand"]/*'/>
+               public FbCommand GetInsertCommand()
+               {
+                       lock (this)
+                       {
+                               if (this.insertCommand == null)
+                               {
+                                       this.BuildInsertCommand(null, null);
+                               }
+                       }
+
+                       return this.insertCommand;
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="GetUpdateCommand"]/*'/>
+               public FbCommand GetUpdateCommand()
+               {
+                       lock (this)
+                       {
+                               if (this.updateCommand == null)
+                               {
+                                       this.BuildUpdateCommand(null, null);
+                               }
+                       }
+
+                       return updateCommand;
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="GetDeleteCommand"]/*'/>
+               public FbCommand GetDeleteCommand()
+               {
+                       lock (this)
+                       {
+                               if (this.deleteCommand == null)
+                               {
+                                       this.BuildDeleteCommand(null, null);
+                               }
+                       }
+
+                       return this.deleteCommand;
+               }
+
+               /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="RefreshSchema"]/*'/>
+               public void RefreshSchema()
+               {
+                       lock (this)
+                       {
+                               // Clear DataAdapter commands if needed
+                               if (this.dataAdapter != null)
+                               {
+                                       if (this.insertCommand == this.dataAdapter.InsertCommand)
+                                       {
+                                               this.dataAdapter.InsertCommand = null;
+                                       }
+                                       if (this.deleteCommand == this.dataAdapter.DeleteCommand)
+                                       {
+                                               this.dataAdapter.DeleteCommand = null;
+                                       }
+                                       if (this.updateCommand == this.dataAdapter.UpdateCommand)
+                                       {
+                                               this.dataAdapter.UpdateCommand = null;
+                                       }
+                               }
+
+                               // Clear commands
+                               if (this.insertCommand != null)
+                               {
+                                       this.insertCommand.Dispose();
+                               }
+                               if (this.updateCommand != null)
+                               {
+                                       this.updateCommand.Dispose();
+                               }
+                               if (this.deleteCommand != null)
+                               {
+                                       this.deleteCommand.Dispose();
+                               }
+                               if (this.schemaTable != null)
+                               {
+                                       this.schemaTable.Dispose();
+                               }
+                               this.insertCommand = null;
+                               this.updateCommand = null;
+                               this.deleteCommand = null;
+                               this.schemaTable = null;
+                       }
+               }
+
+               #endregion
+
+               #region Command Building Methods
+
+               private FbCommand BuildInsertCommand(DataRow row, DataTableMapping tableMapping)
+               {
+                       if (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields &&
+                               (this.timestampColumnName == null ||
+                               this.timestampColumnName.Length == 0))
+                       {
+                               throw new InvalidOperationException();
+                       }
+
+                       StringBuilder sql               = new StringBuilder();
+                       StringBuilder fields    = new StringBuilder();
+                       StringBuilder values    = new StringBuilder();
+
+                       this.BuildSchemaTable();
+
+                       this.CreateCommand(ref this.insertCommand);
+
+                       int i = 0;
+                       foreach (DataRow schemaRow in schemaTable.Rows)
+                       {
+                               if (this.IsUpdatable(schemaRow, row, tableMapping))
+                               {
+                                       if (fields.Length > 0)
+                                       {
+                                               fields.Append(this.separator);
+                                       }
+                                       if (values.Length > 0)
+                                       {
+                                               values.Append(this.separator);
+                                       }
+
+                                       fields.Append(this.GetQuotedIdentifier(schemaRow["BaseColumnName"]));
+
+                                       FbParameter parameter = this.CreateParameter(schemaRow, i, false);
+
+                                       values.Append(parameter.ParameterName);
+
+                                       if (row != null && tableMapping != null)
+                                       {
+                                               DataColumn column = this.GetDataColumn(
+                                                       schemaRow["BaseColumnName"].ToString(),
+                                                       tableMapping,
+                                                       row);
+
+                                               if (column != null)
+                                               {
+                                                       parameter.Value = row[column];
+                                               }
+                                       }
+
+                                       i++;
+
+                                       this.insertCommand.Parameters.Add(parameter);
+                               }
+                       }
+
+                       sql.AppendFormat(
+                               CultureInfo.CurrentCulture,
+                               this.sqlInsert,
+                               this.GetQuotedIdentifier(tableName),
+                               fields.ToString(),
+                               values.ToString());
+
+                       this.insertCommand.CommandText = sql.ToString();
+
+                       return this.insertCommand;
+               }
+
+               private FbCommand BuildUpdateCommand(DataRow row, DataTableMapping tableMapping)
+               {
+                       if (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields &&
+                               (this.timestampColumnName == null ||
+                               this.timestampColumnName.Length == 0))
+                       {
+                               throw new InvalidOperationException();
+                       }
+
+                       StringBuilder sql       = new StringBuilder();
+                       StringBuilder sets      = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       this.BuildSchemaTable();
+
+                       if (!this.hasPrimaryKey)
+                       {
+                               throw new InvalidOperationException("Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.");
+                       }
+
+                       this.CreateCommand(ref this.updateCommand);
+
+                       int i = 0;
+                       foreach (DataRow schemaRow in schemaTable.Rows)
+                       {
+                               if (this.IsUpdatable(schemaRow, row, tableMapping))
+                               {
+                                       if (sets.Length > 0)
+                                       {
+                                               sets.Append(separator);
+                                       }
+
+                                       FbParameter parameter = this.CreateParameter(schemaRow, i, false);
+
+                                       // Update SET clausule
+                                       sets.AppendFormat(
+                                               CultureInfo.CurrentCulture,
+                                               setClausule,
+                                               this.GetQuotedIdentifier(schemaRow["BaseColumnName"]),
+                                               parameter.ParameterName);
+
+                                       if (row != null && tableMapping != null)
+                                       {
+                                               DataColumn column = this.GetDataColumn(
+                                                       schemaRow["BaseColumnName"].ToString(),
+                                                       tableMapping,
+                                                       row);
+
+                                               if (column != null)
+                                               {
+                                                       parameter.Value = row[column];
+                                               }
+                                       }
+
+                                       i++;
+
+                                       this.updateCommand.Parameters.Add(parameter);
+                               }
+                       }
+
+                       // Build where clausule
+                       foreach (DataRow schemaRow in schemaTable.Rows)
+                       {
+                               if (this.IncludedInWhereClause(schemaRow))
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]);
+
+                                       // Create parameters for this field
+                                       FbParameter parameter = this.CreateParameter(schemaRow, i, true);
+
+                                       // Add where clausule for this field
+                                       if ((bool)schemaRow["IsKey"])
+                                       {
+                                               where.AppendFormat(
+                                                       CultureInfo.CurrentCulture,
+                                                       whereClausule2,
+                                                       quotedId,
+                                                       parameter.ParameterName);
+                                       }
+                                       else
+                                       {
+                                               if (this.usingCoalesce)
+                                               {
+                                                       string typeName = TypeHelper.GetDataTypeName((DbDataType)parameter.FbDbType);
+
+                                                       switch (typeName)
+                                                       {
+                                                               case "VARCHAR":
+                                                               case "CHAR":
+                                                                       typeName = String.Format(
+                                                                               CultureInfo.CurrentCulture,
+                                                                               "{0}({1})",
+                                                                               typeName,
+                                                                               schemaRow["ColumnSize"]);
+                                                                       break;
+
+                                                               case "DECIMAL":
+                                                               case "NUMERIC":
+                                                                       typeName = String.Format(
+                                                                               CultureInfo.CurrentCulture,
+                                                                               "{0}({1},{2})",
+                                                                               typeName,
+                                                                               schemaRow["NumericPrecision"],
+                                                                               schemaRow["NumericScale"]);
+                                                                       break;
+                                                       }
+
+                                                       where.AppendFormat(
+                                                               CultureInfo.CurrentCulture,
+                                                               whereClausule1,
+                                                               quotedId,
+                                                               parameter.ParameterName,
+                                                               typeName);
+                                               }
+                                               else
+                                               {
+                                                       where.AppendFormat(
+                                                               CultureInfo.CurrentCulture,
+                                                               whereClausule1,
+                                                               quotedId,
+                                                               parameter.ParameterName);
+                                               }
+                                       }
+
+                                       if (row != null && tableMapping != null)
+                                       {
+                                               DataColumn column = this.GetDataColumn(
+                                                       schemaRow["BaseColumnName"].ToString(),
+                                                       tableMapping,
+                                                       row);
+
+                                               if (column != null)
+                                               {
+                                                       parameter.Value = row[column, DataRowVersion.Original];
+                                               }
+                                       }
+
+                                       this.updateCommand.Parameters.Add(parameter);
+
+                                       i++;
+                               }
+                       }
+
+                       sql.AppendFormat(
+                               CultureInfo.CurrentCulture,
+                               this.sqlUpdate,
+                               this.GetQuotedIdentifier(tableName),
+                               sets.ToString(),
+                               where.ToString());
+
+                       this.updateCommand.CommandText = sql.ToString();
+
+                       return this.updateCommand;
+               }
+
+               private FbCommand BuildDeleteCommand(DataRow row, DataTableMapping tableMapping)
+               {
+                       if (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields &&
+                               (this.timestampColumnName == null ||
+                               this.timestampColumnName.Length == 0))
+                       {
+                               throw new InvalidOperationException();
+                       }
+
+                       StringBuilder sql = new StringBuilder();
+                       StringBuilder where = new StringBuilder();
+
+                       this.BuildSchemaTable();
+
+                       if (!this.hasPrimaryKey)
+                       {
+                               throw new InvalidOperationException("Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information.");
+                       }
+
+                       this.CreateCommand(ref this.deleteCommand);
+
+                       // Build where clausule
+                       int i = 0;
+                       foreach (DataRow schemaRow in schemaTable.Rows)
+                       {
+                               if (this.IncludedInWhereClause(schemaRow))
+                               {
+                                       if (where.Length > 0)
+                                       {
+                                               where.Append(" AND ");
+                                       }
+
+                                       string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]);
+
+                                       // Create parameters for this field
+                                       FbParameter parameter = this.CreateParameter(schemaRow, i, true);
+
+                                       if ((bool)schemaRow["IsKey"])
+                                       {
+                                               where.AppendFormat(
+                                                       CultureInfo.CurrentCulture,
+                                                       whereClausule2,
+                                                       quotedId,
+                                                       parameter.ParameterName);
+                                       }
+                                       else
+                                       {
+                                               if (this.usingCoalesce)
+                                               {
+                                                       string typeName = TypeHelper.GetDataTypeName((DbDataType)parameter.FbDbType);
+
+                                                       switch (typeName)
+                                                       {
+                                                               case "VARCHAR":
+                                                               case "CHAR":
+                                                                       typeName = String.Format(
+                                                                               CultureInfo.CurrentCulture,
+                                                                               "{0}({1})",
+                                                                               typeName,
+                                                                               schemaRow["ColumnSize"]);
+                                                                       break;
+
+                                                               case "DECIMAL":
+                                                               case "NUMERIC":
+                                                                       typeName = String.Format(
+                                                                               CultureInfo.CurrentCulture,
+                                                                               "{0}({1},{2})",
+                                                                               typeName,
+                                                                               schemaRow["NumericPrecision"],
+                                                                               schemaRow["NumericScale"]);
+                                                                       break;
+                                                       }
+
+                                                       where.AppendFormat(
+                                                               CultureInfo.CurrentCulture,
+                                                               whereClausule1,
+                                                               quotedId,
+                                                               parameter.ParameterName,
+                                                               typeName);
+                                               }
+                                               else
+                                               {
+                                                       where.AppendFormat(
+                                                               CultureInfo.CurrentCulture,
+                                                               whereClausule1,
+                                                               quotedId,
+                                                               parameter.ParameterName);
+                                               }
+                                       }
+
+                                       if (row != null && tableMapping != null)
+                                       {
+                                               DataColumn column = this.GetDataColumn(
+                                                       schemaRow["BaseColumnName"].ToString(),
+                                                       tableMapping,
+                                                       row);
+
+                                               if (column != null)
+                                               {
+                                                       parameter.Value = row[column, DataRowVersion.Original];
+                                               }
+                                       }
+
+                                       this.deleteCommand.Parameters.Add(parameter);
+
+                                       i++;
+                               }
+                       }
+
+                       sql.AppendFormat(
+                               CultureInfo.CurrentCulture,
+                               this.sqlDelete,
+                               this.GetQuotedIdentifier(tableName),
+                               where.ToString());
+
+                       this.deleteCommand.CommandText = sql.ToString();
+
+                       return this.deleteCommand;
+               }
+
+               private bool IsUpdatable(
+                       DataRow schemaRow, DataRow row, DataTableMapping tableMapping)
+               {
+                       if (row != null && tableMapping != null)
+                       {
+                               DataColumn column = this.GetDataColumn(
+                                       schemaRow["BaseColumnName"].ToString(),
+                                       tableMapping,
+                                       row);
+
+                               if (column != null)
+                               {
+                                       if (column.Expression != null &&
+                                               column.Expression.Length != 0)
+                                       {
+                                               return false;
+                                       }
+                                       if (column.ReadOnly)
+                                       {
+                                               return false;
+                                       }
+                               }
+                       }
+
+                       if ((bool)schemaRow["IsExpression"])
+                       {
+                               return false;
+                       }
+                       if ((bool)schemaRow["IsAutoIncrement"])
+                       {
+                               return false;
+                       }
+                       if ((bool)schemaRow["IsRowVersion"])
+                       {
+                               return false;
+                       }
+                       if ((bool)schemaRow["IsReadOnly"])
+                       {
+                               return false;
+                       }
+
+                       return true;
+               }
+
+               private bool IncludedInWhereClause(DataRow schemaRow)
+               {
+                       if (!(bool)schemaRow["IsKey"] &&
+                               (this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyFields ||
+                               this.commandBuilderBehavior == FbCommandBuilderBehavior.KeyAndTimestampFields))
+                       {
+                               if (this.timestampColumnName != schemaRow["BaseColumnName"].ToString())
+                               {
+                                       return false;
+                               }
+                       }
+
+                       FbDbType dbType = (FbDbType)schemaRow["ProviderType"];
+
+                       if (dbType == FbDbType.Array || dbType == FbDbType.Binary)
+                       {
+                               return false;
+                       }
+
+                       if ((bool)schemaRow["IsLong"])
+                       {
+                               return false;
+                       }
+
+                       return true;
+               }
+
+               private void BuildSchemaTable()
+               {
+                       bool mustClose = false;
+
+                       if (this.SelectCommand == null)
+                       {
+                               throw new InvalidOperationException("The DataAdapter.SelectCommand property needs to be initialized.");
+                       }
+                       if (this.SelectCommand.Connection == null)
+                       {
+                               throw new InvalidOperationException("The DataAdapter.SelectCommand.Connection property needs to be initialized.");
+                       }
+
+                       if (this.schemaTable == null)
+                       {
+                               if (this.SelectCommand.Connection.State == ConnectionState.Closed)
+                               {
+                                       mustClose = true;
+                                       this.SelectCommand.Connection.Open();
+                               }
+
+                               try
+                               {
+                                       FbCommand schemaCmd = (FbCommand)((ICloneable)this.SelectCommand).Clone();
+
+                                       FbDataReader reader = schemaCmd.ExecuteReader(CommandBehavior.SchemaOnly);
+
+                                       this.schemaTable = reader.GetSchemaTable();
+
+                                       reader.Close();
+
+                                       schemaCmd.Dispose();
+                                       schemaCmd = null;
+
+                                       this.CheckSchemaTable();
+
+                                       this.UpdateFormats();
+                               }
+                               catch
+                               {
+                                       throw;
+                               }
+                               finally
+                               {
+                                       if (mustClose)
+                                       {
+                                               this.SelectCommand.Connection.Close();
+                                       }
+                               }
+                       }
+               }
+
+               private void CheckSchemaTable()
+               {
+                       this.tableName = String.Empty;
+                       this.hasPrimaryKey = false;
+
+                       foreach (DataRow schemaRow in schemaTable.Rows)
+                       {
+                               if (this.tableName.Length == 0)
+                               {
+                                       this.tableName = (string)schemaRow["BaseTableName"];
+                               }
+                               if (this.tableName != (string)schemaRow["BaseTableName"] &&
+                                       !(bool)schemaRow["IsExpression"])
+                               {
+                                       throw new InvalidOperationException("Dynamic SQL generation is not supported against multiple base tables.");
+                               }
+                               if ((bool)schemaRow["IsKey"] || (bool)schemaRow["IsUnique"])
+                               {
+                                       this.hasPrimaryKey = true;
+                               }
+                       }
+               }
+
+               private string GetQuotedIdentifier(object identifier)
+               {
+                       string suffix = this.quoteSuffix != null ? this.quoteSuffix : String.Empty;
+                       string prefix = this.quotePrefix != null ? this.quotePrefix : String.Empty;
+
+                       return prefix + identifier.ToString() + suffix;
+               }
+
+               private void CreateCommand(ref FbCommand command)
+               {
+                       if (command == null)
+                       {
+                               command = this.SelectCommand.Connection.CreateCommand();
+                       }
+
+                       command.Transaction = this.SelectCommand.Transaction;
+                       command.CommandType = CommandType.Text;
+                       command.UpdatedRowSource = UpdateRowSource.None;
+                       command.Parameters.Clear();
+               }
+
+               private FbParameter CreateParameter(
+                       DataRow schemaRow, int index, bool isWhereParameter)
+               {
+                       string pname = String.Format(CultureInfo.CurrentCulture, "@p{0}", index + 1);
+                       FbParameter parameter = new FbParameter(pname, (FbDbType)schemaRow["ProviderType"]);
+
+                       parameter.Size = Convert.ToInt32(schemaRow["ColumnSize"], CultureInfo.InvariantCulture);
+                       if (schemaRow["NumericPrecision"] != DBNull.Value)
+                       {
+                               parameter.Precision = Convert.ToByte(schemaRow["NumericPrecision"], CultureInfo.InvariantCulture);
+                       }
+                       if (schemaRow["NumericScale"] != DBNull.Value)
+                       {
+                               parameter.Scale = Convert.ToByte(schemaRow["NumericScale"], CultureInfo.InvariantCulture);
+                       }
+                       parameter.SourceColumn = schemaRow["BaseColumnName"].ToString();
+                       parameter.IsNullable = Convert.ToBoolean(schemaRow["AllowDbNull"], CultureInfo.InvariantCulture);
+
+                       if (isWhereParameter)
+                       {
+                               parameter.SourceVersion = DataRowVersion.Original;
+                       }
+                       else
+                       {
+                               parameter.SourceVersion = DataRowVersion.Current;
+                       }
+
+                       return parameter;
+               }
+
+               private DataColumn GetDataColumn(
+                       string columnName, DataTableMapping tableMapping, DataRow row)
+               {
+                       DataColumn dataColumn = null;
+
+                       // Get the DataColumnMapping that matches
+                       // the given column     name
+                       DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction(
+                               columnName, this.dataAdapter.MissingMappingAction);
+
+                       if (columnMapping != null)
+                       {
+                               // Get the DataColumn for the given     column name
+                               dataColumn = columnMapping.GetDataColumnBySchemaAction(
+                                       row.Table,
+                                       null,
+                                       this.dataAdapter.MissingSchemaAction);
+                       }
+
+                       return dataColumn;
+               }
+
+               #endregion
+
+               #region Event Handler Methods
+
+               private void RowUpdatingHandler(object sender, FbRowUpdatingEventArgs e)
+               {
+                       if (e.Status != UpdateStatus.Continue)
+                       {
+                               return;
+                       }
+
+                       if (e.Command != null)
+                       {
+                               // Check that we can really     build a new     command.
+                               // If the command passed in     the     FbRowUpdatingEventArgs
+                               // is different than the one existent in the CommabdBuilder
+                               // we can't     build a new     command
+
+                               FbCommand command = null;
+
+                               switch (e.StatementType)
+                               {
+                                       case StatementType.Insert:
+                                               command = this.insertCommand;
+                                               break;
+
+                                       case StatementType.Delete:
+                                               command = this.deleteCommand;
+                                               break;
+
+                                       case StatementType.Update:
+                                               command = this.updateCommand;
+                                               break;
+                               }
+
+                               if (command != e.Command)
+                               {
+                                       return;
+                               }
+                       }
+
+                       try
+                       {
+                               switch (e.StatementType)
+                               {
+                                       case StatementType.Insert:
+                                               e.Command = this.BuildInsertCommand(
+                                                               e.Row,
+                                                               e.TableMapping);
+                                               break;
+
+                                       case StatementType.Update:
+                                               e.Command = this.BuildUpdateCommand(
+                                                               e.Row,
+                                                               e.TableMapping);
+                                               break;
+
+                                       case StatementType.Delete:
+                                               e.Command = this.BuildDeleteCommand(
+                                                               e.Row,
+                                                               e.TableMapping);
+                                               break;
+                               }
+                       }
+                       catch (Exception exception)
+                       {
+                               e.Errors = exception;
+                               e.Status = UpdateStatus.ErrorsOccurred;
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void UpdateFormats()
+               {
+                       this.usingCoalesce = false;
+
+                       if (this.SelectCommand.Connection != null)
+                       {
+                               string version = this.SelectCommand.Connection.ServerVersion;
+
+                               if (version.IndexOf("Firebird 1.5") > 0)
+                               {
+                                       this.whereClausule1 = "(({0} IS NULL AND COALESCE({1}, CAST(NULL AS {2})) IS NULL) OR ({0} = {1}))";
+                                       this.usingCoalesce = true;
+                               }
+                       }
+               }
+
+               #endregion
+       }
+}
index 3c06ef4742feaff665d1bde7e23760515f2a8a6e..f83a8a55f810ba9416b5a2e34be1e966e92ded45 100644 (file)
@@ -1,38 +1,38 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Serializable]\r
-#endif\r
-       public enum FbCommandBuilderBehavior\r
-       {\r
-               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="Default"]/*'/>\r
-               Default,\r
-               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="AllFields"]/*'/>\r
-               AllFields,\r
-               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="KeyFields"]/*'/>\r
-               KeyFields,\r
-               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="KeyAndTimestampFields"]/*'/>\r
-               KeyAndTimestampFields\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/overview/*'/>
+#if    (!NETCF)
+       [Serializable]
+#endif
+       public enum FbCommandBuilderBehavior
+       {
+               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="Default"]/*'/>
+               Default,
+               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="AllFields"]/*'/>
+               AllFields,
+               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="KeyFields"]/*'/>
+               KeyFields,
+               /// <include file='Doc/en_EN/FbCommandBuilderBehavior.xml' path='doc/enum[@name="FbCommandBuilderBehavior"]/field[@name="KeyAndTimestampFields"]/*'/>
+               KeyAndTimestampFields
+       }
+}
index a2ed6aeade1c61e5a010397efca947057b8d8af5..d42f4e1a9ae9928dbee68dfddafc4aba284e92ec 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.ComponentModel;\r
-using System.Data;\r
-using System.Drawing;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [ToolboxItem(true)]\r
-       [ToolboxBitmap(typeof(FbConnection), "Resources.FbConnection.bmp")]\r
-       [DefaultEvent("InfoMessage")]\r
-#endif\r
-       public sealed class FbConnection : Component, IDbConnection, ICloneable\r
-       {\r
-               #region Events\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/event[@name="StateChange"]/*'/>\r
-               public event StateChangeEventHandler StateChange;\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/event[@name="InfoMessage"]/*'/>\r
-               public event FbInfoMessageEventHandler InfoMessage;\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private FbConnectionInternal innerConnection;\r
-               private ConnectionState         state;\r
-               private FbConnectionString      options;\r
-               private bool                            disposed;\r
-               private string                          connectionString;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ConnectionString"]/*'/>\r
-#if    (NET)\r
-               [Category("Data"), RecommendedAsConfigurableAttribute(true), RefreshProperties(RefreshProperties.All), DefaultValue("")]\r
-               [Editor(typeof(Design.FbConnectionStringUIEditor), typeof(System.Drawing.Design.UITypeEditor))]\r
-#endif\r
-               public string ConnectionString\r
-               {\r
-                       get { return this.connectionString; }\r
-                       set\r
-                       {\r
-                               lock (this)\r
-                               {\r
-                                       if (this.state == ConnectionState.Closed)\r
-                                       {\r
-                                               if (value == null)\r
-                                               {\r
-                                                       value = "";\r
-                                               }\r
-\r
-                                               this.options.Load(value);\r
-                                               this.options.Validate();\r
-                                               this.connectionString = value;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ConnectionTimeout"]/*'/>\r
-#if    (!NETCF)\r
-               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public int ConnectionTimeout\r
-               {\r
-                       get { return this.options.ConnectionTimeout; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="Database"]/*'/>\r
-#if    (!NETCF)\r
-               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public string Database\r
-               {\r
-                       get { return this.options.Database; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="DataSource"]/*'/>\r
-#if    (!NETCF)\r
-               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public string DataSource\r
-               {\r
-                       get { return this.options.DataSource; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ServerVersion"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public string ServerVersion\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.state == ConnectionState.Closed)\r
-                               {\r
-                                       throw new InvalidOperationException("The connection is closed.");\r
-                               }\r
-\r
-                               if (this.innerConnection != null)\r
-                               {\r
-                                       return this.innerConnection.Database.ServerVersion;\r
-                               }\r
-\r
-                               return String.Empty;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="State"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public ConnectionState State\r
-               {\r
-                       get { return this.state; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="PacketSize"]/*'/>\r
-#if    (!NETCF)\r
-               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public int PacketSize\r
-               {\r
-                       get { return this.options.PacketSize; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Properties\r
-\r
-               internal FbConnectionInternal InnerConnection\r
-               {\r
-                       get { return this.innerConnection; }\r
-               }\r
-\r
-               internal FbConnectionString ConnectionOptions\r
-               {\r
-                       get { return this.options; }\r
-               }\r
-\r
-               internal bool IsClosed\r
-               {\r
-                       get { return this.state == ConnectionState.Closed; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/constructor[@name="ctor"]/*'/>\r
-               public FbConnection() : this(null)\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/constructor[@name="ctor(System.String)"]/*'/>      \r
-               public FbConnection(string connectionString) : base()\r
-               {\r
-                       this.options = new FbConnectionString();\r
-                       this.state = ConnectionState.Closed;\r
-                       this.connectionString = "";\r
-\r
-                       if (connectionString != null)\r
-                       {\r
-                               this.ConnectionString = connectionString;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="Dispose(System.Boolean)"]/*'/>\r
-               protected override void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.disposed)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // release any unmanaged resources\r
-                                               this.Close();\r
-\r
-                                               if (disposing)\r
-                                               {\r
-                                                       // release any managed resources\r
-                                                       this.innerConnection = null;\r
-                                               }\r
-\r
-                                               this.disposed = true;\r
-                                       }\r
-                                       catch\r
-                                       {\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               base.Dispose(disposing);\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICloneable Methods\r
-\r
-               object ICloneable.Clone()\r
-               {\r
-                       return new FbConnection(this.ConnectionString);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Properties\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ConnectionPoolsCount"]/*'/>\r
-               public static int ConnectionPoolsCount\r
-               {\r
-                       get { return FbPoolManager.Instance.PoolsCount; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetPooledConnectionCount(FbConnection)"]/*'/>\r
-               public static int GetPooledConnectionCount(FbConnection connection)\r
-               {\r
-                       FbPoolManager manager = FbPoolManager.Instance;\r
-                       FbConnectionPool pool = manager.FindPool(connection.ConnectionString);\r
-\r
-                       if (pool != null)\r
-                       {\r
-                               return pool.Count;\r
-                       }\r
-\r
-                       return 0;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="ClearAllPools"]/*'/>\r
-               public static void ClearAllPools()\r
-               {\r
-                       FbPoolManager manager = FbPoolManager.Instance;\r
-\r
-                       manager.ClearAllPools();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="ClearPool(FbConnection)"]/*'/>\r
-               public static void ClearPool(FbConnection connection)\r
-               {\r
-                       FbPoolManager manager = FbPoolManager.Instance;\r
-\r
-                       manager.ClearPool(connection.ConnectionString);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.String)"]/*'/>\r
-               public static void CreateDatabase(string connectionString)\r
-               {\r
-                       FbConnection.CreateDatabase(connectionString, 4096, true, false);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.String, System.Boolean)"]/*'/>\r
-               public static void CreateDatabase(string connectionString, bool overwrite)\r
-               {\r
-                       FbConnection.CreateDatabase(connectionString, 4096, true, overwrite);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.String,System.Int32,System.Boolean,System.Boolean)"]/*'/>\r
-               public static void CreateDatabase(\r
-                       string connectionString, int pageSize, bool forcedWrites, bool overwrite)\r
-               {\r
-                       FbConnectionString options = new FbConnectionString(connectionString);\r
-                       options.Validate();\r
-\r
-                       try\r
-                       {\r
-                               // DPB configuration\r
-                               DatabaseParameterBuffer dpb = new DatabaseParameterBuffer();\r
-\r
-                               // Dpb version\r
-                               dpb.Append(IscCodes.isc_dpb_version1);\r
-\r
-                               // Dummy packet interval\r
-                               dpb.Append(IscCodes.isc_dpb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 });\r
-\r
-                               // User name\r
-                               dpb.Append(IscCodes.isc_dpb_user_name, options.UserID);\r
-\r
-                               // User password\r
-                               dpb.Append(IscCodes.isc_dpb_password, options.Password);\r
-\r
-                               // Database     dialect\r
-                               dpb.Append(IscCodes.isc_dpb_sql_dialect, new byte[] { options.Dialect, 0, 0, 0 });\r
-\r
-                               // Database overwrite\r
-                               dpb.Append(IscCodes.isc_dpb_overwrite, (short)(overwrite ? 1 : 0));\r
-\r
-                               // Character set\r
-                               if (options.Charset.Length > 0)\r
-                               {\r
-                                       int index = Charset.SupportedCharsets.IndexOf(options.Charset);\r
-\r
-                                       if (index == -1)\r
-                                       {\r
-                                               throw new ArgumentException("Character set is not valid.");\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               dpb.Append(\r
-                                                       IscCodes.isc_dpb_set_db_charset,\r
-                                                       Charset.SupportedCharsets[index].Name);\r
-                                       }\r
-                               }\r
-\r
-                               // Page Size\r
-                               if (pageSize > 0)\r
-                               {\r
-                                       dpb.Append(IscCodes.isc_dpb_page_size, pageSize);\r
-                               }\r
-\r
-                               // Forced writes\r
-                               dpb.Append(IscCodes.isc_dpb_force_write, (short)(forcedWrites ? 1 : 0));\r
-\r
-                               if (!overwrite)\r
-                               {\r
-                                       // Check if     the     database exists\r
-                                       FbConnectionInternal c = new FbConnectionInternal(options);\r
-\r
-                                       try\r
-                                       {\r
-                                               c.Connect();\r
-                                               c.Disconnect();\r
-\r
-                                               IscException ex = new IscException(IscCodes.isc_db_or_file_exists);\r
-                                               throw new FbException(ex.Message, ex);\r
-                                       }\r
-                                       catch (FbException ex)\r
-                                       {\r
-                                               if (ex.ErrorCode != 335544344)\r
-                                               {\r
-                                                       throw;\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               // Create the new database\r
-                               FbConnectionInternal db = new FbConnectionInternal(options);\r
-                               db.CreateDatabase(dpb);\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="DropDatabase(System.String)"]/*'/>\r
-               public static void DropDatabase(string connectionString)\r
-               {\r
-                       // Configure Attachment\r
-                       FbConnectionString options = new FbConnectionString(connectionString);\r
-                       options.Validate();\r
-\r
-                       try\r
-                       {\r
-                               // Drop the     database        \r
-                               FbConnectionInternal db = new FbConnectionInternal(options);\r
-                               db.DropDatabase();\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.Collections.Hashtable)"]/*'/>\r
-               [Obsolete("Use CreateDatabase(string connectionString) instead")]\r
-               public static void CreateDatabase(Hashtable values)\r
-               {\r
-                       bool overwrite = false;\r
-                       int index = 0;\r
-                       byte dialect = 3;\r
-                       int serverType = 0;\r
-\r
-                       if (!values.ContainsKey("User") ||\r
-                               !values.ContainsKey("Password") ||\r
-                               !values.ContainsKey("Database"))\r
-                       {\r
-                               throw new ArgumentException("CreateDatabase requires a user name, password and database path.");\r
-                       }\r
-\r
-                       if (values.ContainsKey("ServerType"))\r
-                       {\r
-                               serverType = Convert.ToInt32(values["ServerType"], CultureInfo.InvariantCulture);\r
-                       }\r
-\r
-                       if (!values.ContainsKey("DataSource"))\r
-                       {\r
-                               values.Add("DataSource", "localhost");\r
-                       }\r
-\r
-                       if (!values.ContainsKey("Port"))\r
-                       {\r
-                               values.Add("Port", 3050);\r
-                       }\r
-\r
-                       if (values.ContainsKey("Dialect"))\r
-                       {\r
-                               dialect = Convert.ToByte(values["Dialect"], CultureInfo.InvariantCulture);\r
-                       }\r
-\r
-                       if (dialect < 1 || dialect > 3)\r
-                       {\r
-                               throw new ArgumentException("Incorrect database dialect it should be 1, 2, or 3.");\r
-                       }\r
-\r
-                       if (values.ContainsKey("Overwrite"))\r
-                       {\r
-                               overwrite = (bool)values["Overwrite"];\r
-                       }\r
-\r
-                       try\r
-                       {\r
-                               // Configure Attachment\r
-                               FbConnectionStringBuilder csb = new FbConnectionStringBuilder();\r
-\r
-                               csb.DataSource  = values["DataSource"].ToString();\r
-                               csb.UserID              = values["User"].ToString();\r
-                               csb.Password    = values["Password"].ToString();\r
-                               csb.Database    = values["Database"].ToString();\r
-                               csb.Port                = Convert.ToInt32(values["Port"], CultureInfo.InvariantCulture);\r
-                               csb.ServerType  = serverType;\r
-\r
-                               FbConnectionString options = new FbConnectionString(csb);\r
-\r
-                               // DPB configuration\r
-                               DatabaseParameterBuffer dpb = new DatabaseParameterBuffer();\r
-\r
-                               // Dpb version\r
-                               dpb.Append(IscCodes.isc_dpb_version1);\r
-\r
-                               // Dummy packet interval\r
-                               dpb.Append(IscCodes.isc_dpb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 });\r
-\r
-                               // User name\r
-                               dpb.Append(IscCodes.isc_dpb_user_name, values["User"].ToString());\r
-\r
-                               // User password\r
-                               dpb.Append(IscCodes.isc_dpb_password, values["Password"].ToString());\r
-\r
-                               // Database     dialect\r
-                               dpb.Append(IscCodes.isc_dpb_sql_dialect, new byte[] { dialect, 0, 0, 0 });\r
-\r
-                               // Database overwrite\r
-                               dpb.Append(IscCodes.isc_dpb_overwrite, (short)(overwrite ? 1 : 0));\r
-\r
-                               // Character set\r
-                               if (values.ContainsKey("Charset"))\r
-                               {\r
-                                       index = Charset.SupportedCharsets.IndexOf(values["Charset"].ToString());\r
-\r
-                                       if (index == -1)\r
-                                       {\r
-                                               throw new ArgumentException("Character set is not valid.");\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               dpb.Append(\r
-                                                       IscCodes.isc_dpb_set_db_charset,\r
-                                                       Charset.SupportedCharsets[index].Name);\r
-                                       }\r
-                               }\r
-\r
-                               // Page Size\r
-                               if (values.ContainsKey("PageSize"))\r
-                               {\r
-                                       dpb.Append(IscCodes.isc_dpb_page_size, Convert.ToInt32(values["PageSize"], CultureInfo.InvariantCulture));\r
-                               }\r
-\r
-                               // Forced writes\r
-                               if (values.ContainsKey("ForcedWrite"))\r
-                               {\r
-                                       dpb.Append(IscCodes.isc_dpb_force_write,\r
-                                               (short)((bool)values["ForcedWrite"] ? 1 : 0));\r
-                               }\r
-\r
-                               if (!overwrite)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // Check if     the     database exists\r
-                                               FbConnectionInternal check = new FbConnectionInternal(options);\r
-\r
-                                               check.Connect();\r
-                                               check.Disconnect();\r
-\r
-                                               IscException ex = new IscException(IscCodes.isc_db_or_file_exists);\r
-\r
-                                               throw new FbException(ex.Message, ex);\r
-                                       }\r
-                                       catch (Exception)\r
-                                       {\r
-                                               throw;\r
-                                       }\r
-                               }\r
-\r
-                               // Create the new database\r
-                               FbConnectionInternal c = new FbConnectionInternal(options);\r
-                               c.CreateDatabase(dpb);\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="DropDatabase(System.Collections.Hashtable)"]/*'/>\r
-               [Obsolete("Use DropDatabase(string connectionString) instead")]\r
-               public static void DropDatabase(Hashtable values)\r
-               {\r
-                       int serverType = 0;\r
-\r
-                       if (!values.ContainsKey("User") ||\r
-                               !values.ContainsKey("Password") ||\r
-                               !values.ContainsKey("Database"))\r
-                       {\r
-                               throw new ArgumentException("CreateDatabase requires a user name, password and database path.");\r
-                       }\r
-\r
-                       if (!values.ContainsKey("DataSource"))\r
-                       {\r
-                               values.Add("DataSource", "localhost");\r
-                       }\r
-\r
-                       if (!values.ContainsKey("Port"))\r
-                       {\r
-                               values.Add("Port", 3050);\r
-                       }\r
-\r
-                       if (values.ContainsKey("ServerType"))\r
-                       {\r
-                               serverType = Convert.ToInt32(values["ServerType"], CultureInfo.InvariantCulture);\r
-                       }\r
-\r
-                       try\r
-                       {\r
-                               // Configure Attachment\r
-                               FbConnectionStringBuilder csb = new FbConnectionStringBuilder();\r
-\r
-                               csb.DataSource = values["DataSource"].ToString();\r
-                               csb.Port = Convert.ToInt32(values["Port"], CultureInfo.InvariantCulture);\r
-                               csb.Database = values["Database"].ToString();\r
-                               csb.UserID = values["User"].ToString();\r
-                               csb.Password = values["Password"].ToString();\r
-                               csb.ServerType = serverType;\r
-\r
-                               FbConnectionString options = new FbConnectionString(csb);\r
-\r
-                               // Drop the     database\r
-                               FbConnectionInternal db = new FbConnectionInternal(options);\r
-                               db.DropDatabase();\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               IDbTransaction IDbConnection.BeginTransaction()\r
-               {\r
-                       return this.BeginTransaction();\r
-               }\r
-\r
-               IDbTransaction IDbConnection.BeginTransaction(IsolationLevel level)\r
-               {\r
-                       return this.BeginTransaction(level);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction"]/*'/>\r
-               public FbTransaction BeginTransaction()\r
-               {\r
-                       return this.BeginTransaction(IsolationLevel.ReadCommitted, null);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(System.String)"]/*'/>\r
-               public FbTransaction BeginTransaction(string transactionName)\r
-               {\r
-                       return this.BeginTransaction(IsolationLevel.ReadCommitted, transactionName);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(System.Data.IsolationLevel)"]/*'/>\r
-               public FbTransaction BeginTransaction(IsolationLevel level)\r
-               {\r
-                       return this.BeginTransaction(level, null);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(System.Data.IsolationLevel,System.String)"]/*'/>\r
-               public FbTransaction BeginTransaction(IsolationLevel level, string transactionName)\r
-               {\r
-                       if (this.IsClosed)\r
-                       {\r
-                               throw new InvalidOperationException("BeginTransaction requires an open and available Connection.");\r
-                       }\r
-\r
-                       return this.innerConnection.BeginTransaction(level, transactionName);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(FbTransactionOptions)"]/*'/>\r
-               public FbTransaction BeginTransaction(FbTransactionOptions options)\r
-               {\r
-                       return this.BeginTransaction(options, null);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(FbTransactionOptions, System.String)"]/*'/>\r
-               public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName)\r
-               {\r
-                       if (this.IsClosed)\r
-                       {\r
-                               throw new InvalidOperationException("BeginTransaction requires an open and available Connection.");\r
-                       }\r
-\r
-                       return this.innerConnection.BeginTransaction(options, transactionName);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="ChangeDatabase(System.String)"]/*'/>\r
-               public void ChangeDatabase(string db)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.IsClosed)\r
-                               {\r
-                                       throw new InvalidOperationException("ChangeDatabase requires an open and available Connection.");\r
-                               }\r
-\r
-                               if (db == null || db.Trim().Length == 0)\r
-                               {\r
-                                       throw new InvalidOperationException("Database name is not valid.");\r
-                               }\r
-\r
-                               string cs = this.connectionString;\r
-\r
-                               try\r
-                               {\r
-                                       FbConnectionStringBuilder csb = new FbConnectionStringBuilder(this.connectionString);\r
-\r
-                                       /* Close current connection     */\r
-                                       this.Close();\r
-\r
-                                       /* Set up the new Database      */\r
-                                       csb.Database = db;\r
-\r
-                                       /* Open new     connection      */\r
-                                       this.Open();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       this.ConnectionString = cs;\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="Open"]/*'/>\r
-               public void Open()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.connectionString == null || this.connectionString.Length == 0)\r
-                               {\r
-                                       throw new InvalidOperationException("Connection String is not initialized.");\r
-                               }\r
-                               if (!this.IsClosed && this.state != ConnectionState.Connecting)\r
-                               {\r
-                                       throw new InvalidOperationException("Connection already Open.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.OnStateChange(this.state, ConnectionState.Connecting);\r
-\r
-                                       if (this.options.Pooling)\r
-                                       {\r
-                                               // Use Connection Pooling\r
-                                               FbConnectionPool pool = FbPoolManager.Instance.CreatePool(this.connectionString);\r
-                                               this.innerConnection = pool.CheckOut();\r
-                                               this.innerConnection.OwningConnection = this;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               // Do not use Connection Pooling\r
-                                               this.innerConnection = new FbConnectionInternal(this.options, this);\r
-                                               this.innerConnection.Connect();\r
-                                       }\r
-\r
-                                       // Bind Warning messages event\r
-                                       this.innerConnection.Database.WarningMessage = new WarningMessageCallback(this.OnWarningMessage);\r
-\r
-                                       // Update the connection state\r
-                                       this.OnStateChange(this.state, ConnectionState.Open);\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       this.OnStateChange(this.state, ConnectionState.Closed);\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                               catch (Exception)\r
-                               {\r
-                                       this.OnStateChange(this.state, ConnectionState.Closed);\r
-                                       throw;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="Close"]/*'/>\r
-               public void Close()\r
-               {\r
-                       if (this.IsClosed)\r
-                       {\r
-                               return;\r
-                       }\r
-\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       lock (this.innerConnection)\r
-                                       {\r
-                                               // Close the Remote     Event Manager\r
-                                               this.innerConnection.CloseEventManager();\r
-\r
-                                               // Unbind Warning messages event\r
-                                               this.innerConnection.Database.WarningMessage = null;\r
-\r
-                                               // Dispose Transaction\r
-                                               this.innerConnection.DisposeTransaction();\r
-\r
-                                               // Dispose all active statemenets\r
-                                               this.innerConnection.DisposePreparedCommands();\r
-\r
-                                               // Close connection     or send it back to the pool\r
-                                               if (this.innerConnection.Pooled)\r
-                                               {\r
-                                                       // Get Connection Pool\r
-                                                       FbConnectionPool pool = FbPoolManager.Instance.FindPool(this.connectionString);\r
-\r
-                                                       // Send connection to the Pool\r
-                                                       pool.CheckIn(this.innerConnection);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       this.innerConnection.Disconnect();\r
-                                               }\r
-                                       }\r
-\r
-                                       // Update connection state\r
-                                       this.OnStateChange(this.state, ConnectionState.Closed);\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               IDbCommand IDbConnection.CreateCommand()\r
-               {\r
-                       return this.CreateCommand();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateCommand"]/*'/>\r
-               public FbCommand CreateCommand()\r
-               {\r
-                       FbCommand command = new FbCommand();\r
-\r
-                       lock (this)\r
-                       {\r
-                               command.Connection = this;\r
-                       }\r
-\r
-                       return command;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Database Schema\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetSchema"]/*'/>\r
-               public DataTable GetSchema()\r
-               {\r
-                       return this.GetSchema("MetaDataCollections");\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetSchema(System.String)"]/*'/>\r
-               public DataTable GetSchema(string collectionName)\r
-               {\r
-                       return this.GetSchema(collectionName, null);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetSchema(System.String, System.String[])"]/*'/>\r
-               public DataTable GetSchema(string collectionName, string[] restrictions)\r
-               {\r
-                       if (this.IsClosed)\r
-                       {\r
-                               throw new InvalidOperationException("The connection is closed.");\r
-                       }\r
-\r
-                       return this.innerConnection.GetSchema(collectionName, restrictions);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetDbSchemaTable"]/*'/>\r
-               [Obsolete("Use GetSchema methods instead")]\r
-               public DataTable GetDbSchemaTable(FbDbSchemaType schema, object[] restrictions)\r
-               {\r
-                       if (this.state == ConnectionState.Closed)\r
-                       {\r
-                               throw new InvalidOperationException("The conneciton is closed.");\r
-                       }\r
-\r
-                       return innerConnection.GetSchema(schema.ToString(), restrictions);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void OnWarningMessage(IscException warning)\r
-               {\r
-                       if (this.InfoMessage != null)\r
-                       {\r
-                               this.InfoMessage(this, new FbInfoMessageEventArgs(warning));\r
-                       }\r
-               }\r
-\r
-               private void OnStateChange(ConnectionState originalState, ConnectionState currentState)\r
-               {\r
-                       this.state = currentState;\r
-                       if (this.StateChange != null)\r
-                       {\r
-                               this.StateChange(this, new StateChangeEventArgs(originalState, currentState));\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Globalization;
+using System.Text;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/overview/*'/>
+#if    (!NETCF)
+       [ToolboxItem(true)]
+       [ToolboxBitmap(typeof(FbConnection), "Resources.FbConnection.bmp")]
+       [DefaultEvent("InfoMessage")]
+#endif
+       public sealed class FbConnection : Component, IDbConnection, ICloneable
+       {
+               #region Events
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/event[@name="StateChange"]/*'/>
+               public event StateChangeEventHandler StateChange;
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/event[@name="InfoMessage"]/*'/>
+               public event FbInfoMessageEventHandler InfoMessage;
+
+               #endregion
+
+               #region Fields
+
+               private FbConnectionInternal innerConnection;
+               private ConnectionState         state;
+               private FbConnectionString      options;
+               private bool                            disposed;
+               private string                          connectionString;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ConnectionString"]/*'/>
+#if    (NET)
+               [Category("Data"), RecommendedAsConfigurableAttribute(true), RefreshProperties(RefreshProperties.All), DefaultValue("")]
+               [Editor(typeof(Design.FbConnectionStringUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
+#endif
+               public string ConnectionString
+               {
+                       get { return this.connectionString; }
+                       set
+                       {
+                               lock (this)
+                               {
+                                       if (this.state == ConnectionState.Closed)
+                                       {
+                                               if (value == null)
+                                               {
+                                                       value = "";
+                                               }
+
+                                               this.options.Load(value);
+                                               this.options.Validate();
+                                               this.connectionString = value;
+                                       }
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ConnectionTimeout"]/*'/>
+#if    (!NETCF)
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public int ConnectionTimeout
+               {
+                       get { return this.options.ConnectionTimeout; }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="Database"]/*'/>
+#if    (!NETCF)
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public string Database
+               {
+                       get { return this.options.Database; }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="DataSource"]/*'/>
+#if    (!NETCF)
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public string DataSource
+               {
+                       get { return this.options.DataSource; }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ServerVersion"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public string ServerVersion
+               {
+                       get
+                       {
+                               if (this.state == ConnectionState.Closed)
+                               {
+                                       throw new InvalidOperationException("The connection is closed.");
+                               }
+
+                               if (this.innerConnection != null)
+                               {
+                                       return this.innerConnection.Database.ServerVersion;
+                               }
+
+                               return String.Empty;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="State"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public ConnectionState State
+               {
+                       get { return this.state; }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="PacketSize"]/*'/>
+#if    (!NETCF)
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public int PacketSize
+               {
+                       get { return this.options.PacketSize; }
+               }
+
+               #endregion
+
+               #region Internal Properties
+
+               internal FbConnectionInternal InnerConnection
+               {
+                       get { return this.innerConnection; }
+               }
+
+               internal FbConnectionString ConnectionOptions
+               {
+                       get { return this.options; }
+               }
+
+               internal bool IsClosed
+               {
+                       get { return this.state == ConnectionState.Closed; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/constructor[@name="ctor"]/*'/>
+               public FbConnection() : this(null)
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/constructor[@name="ctor(System.String)"]/*'/>      
+               public FbConnection(string connectionString) : base()
+               {
+                       this.options = new FbConnectionString();
+                       this.state = ConnectionState.Closed;
+                       this.connectionString = "";
+
+                       if (connectionString != null)
+                       {
+                               this.ConnectionString = connectionString;
+                       }
+               }
+
+               #endregion
+
+               #region IDisposable     Methods
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="Dispose(System.Boolean)"]/*'/>
+               protected override void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.disposed)
+                               {
+                                       try
+                                       {
+                                               // release any unmanaged resources
+                                               this.Close();
+
+                                               if (disposing)
+                                               {
+                                                       // release any managed resources
+                                                       this.innerConnection = null;
+                                               }
+
+                                               this.disposed = true;
+                                       }
+                                       catch
+                                       {
+                                       }
+                                       finally
+                                       {
+                                               base.Dispose(disposing);
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region ICloneable Methods
+
+               object ICloneable.Clone()
+               {
+                       return new FbConnection(this.ConnectionString);
+               }
+
+               #endregion
+
+               #region Static Properties
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/property[@name="ConnectionPoolsCount"]/*'/>
+               public static int ConnectionPoolsCount
+               {
+                       get { return FbPoolManager.Instance.PoolsCount; }
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetPooledConnectionCount(FbConnection)"]/*'/>
+               public static int GetPooledConnectionCount(FbConnection connection)
+               {
+                       FbPoolManager manager = FbPoolManager.Instance;
+                       FbConnectionPool pool = manager.FindPool(connection.ConnectionString);
+
+                       if (pool != null)
+                       {
+                               return pool.Count;
+                       }
+
+                       return 0;
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="ClearAllPools"]/*'/>
+               public static void ClearAllPools()
+               {
+                       FbPoolManager manager = FbPoolManager.Instance;
+
+                       manager.ClearAllPools();
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="ClearPool(FbConnection)"]/*'/>
+               public static void ClearPool(FbConnection connection)
+               {
+                       FbPoolManager manager = FbPoolManager.Instance;
+
+                       manager.ClearPool(connection.ConnectionString);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.String)"]/*'/>
+               public static void CreateDatabase(string connectionString)
+               {
+                       FbConnection.CreateDatabase(connectionString, 4096, true, false);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.String, System.Boolean)"]/*'/>
+               public static void CreateDatabase(string connectionString, bool overwrite)
+               {
+                       FbConnection.CreateDatabase(connectionString, 4096, true, overwrite);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.String,System.Int32,System.Boolean,System.Boolean)"]/*'/>
+               public static void CreateDatabase(
+                       string connectionString, int pageSize, bool forcedWrites, bool overwrite)
+               {
+                       FbConnectionString options = new FbConnectionString(connectionString);
+                       options.Validate();
+
+                       try
+                       {
+                               // DPB configuration
+                               DatabaseParameterBuffer dpb = new DatabaseParameterBuffer();
+
+                               // Dpb version
+                               dpb.Append(IscCodes.isc_dpb_version1);
+
+                               // Dummy packet interval
+                               dpb.Append(IscCodes.isc_dpb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 });
+
+                               // User name
+                               dpb.Append(IscCodes.isc_dpb_user_name, options.UserID);
+
+                               // User password
+                               dpb.Append(IscCodes.isc_dpb_password, options.Password);
+
+                               // Database     dialect
+                               dpb.Append(IscCodes.isc_dpb_sql_dialect, new byte[] { options.Dialect, 0, 0, 0 });
+
+                               // Database overwrite
+                               dpb.Append(IscCodes.isc_dpb_overwrite, (short)(overwrite ? 1 : 0));
+
+                               // Character set
+                               if (options.Charset.Length > 0)
+                               {
+                                       int index = Charset.SupportedCharsets.IndexOf(options.Charset);
+
+                                       if (index == -1)
+                                       {
+                                               throw new ArgumentException("Character set is not valid.");
+                                       }
+                                       else
+                                       {
+                                               dpb.Append(
+                                                       IscCodes.isc_dpb_set_db_charset,
+                                                       Charset.SupportedCharsets[index].Name);
+                                       }
+                               }
+
+                               // Page Size
+                               if (pageSize > 0)
+                               {
+                                       dpb.Append(IscCodes.isc_dpb_page_size, pageSize);
+                               }
+
+                               // Forced writes
+                               dpb.Append(IscCodes.isc_dpb_force_write, (short)(forcedWrites ? 1 : 0));
+
+                               if (!overwrite)
+                               {
+                                       // Check if     the     database exists
+                                       FbConnectionInternal c = new FbConnectionInternal(options);
+
+                                       try
+                                       {
+                                               c.Connect();
+                                               c.Disconnect();
+
+                                               IscException ex = new IscException(IscCodes.isc_db_or_file_exists);
+                                               throw new FbException(ex.Message, ex);
+                                       }
+                                       catch (FbException ex)
+                                       {
+                                               if (ex.ErrorCode != 335544344)
+                                               {
+                                                       throw;
+                                               }
+                                       }
+                               }
+
+                               // Create the new database
+                               FbConnectionInternal db = new FbConnectionInternal(options);
+                               db.CreateDatabase(dpb);
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="DropDatabase(System.String)"]/*'/>
+               public static void DropDatabase(string connectionString)
+               {
+                       // Configure Attachment
+                       FbConnectionString options = new FbConnectionString(connectionString);
+                       options.Validate();
+
+                       try
+                       {
+                               // Drop the     database        
+                               FbConnectionInternal db = new FbConnectionInternal(options);
+                               db.DropDatabase();
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateDatabase(System.Collections.Hashtable)"]/*'/>
+               [Obsolete("Use CreateDatabase(string connectionString) instead")]
+               public static void CreateDatabase(Hashtable values)
+               {
+                       bool overwrite = false;
+                       int index = 0;
+                       byte dialect = 3;
+                       int serverType = 0;
+
+                       if (!values.ContainsKey("User") ||
+                               !values.ContainsKey("Password") ||
+                               !values.ContainsKey("Database"))
+                       {
+                               throw new ArgumentException("CreateDatabase requires a user name, password and database path.");
+                       }
+
+                       if (values.ContainsKey("ServerType"))
+                       {
+                               serverType = Convert.ToInt32(values["ServerType"], CultureInfo.InvariantCulture);
+                       }
+
+                       if (!values.ContainsKey("DataSource"))
+                       {
+                               values.Add("DataSource", "localhost");
+                       }
+
+                       if (!values.ContainsKey("Port"))
+                       {
+                               values.Add("Port", 3050);
+                       }
+
+                       if (values.ContainsKey("Dialect"))
+                       {
+                               dialect = Convert.ToByte(values["Dialect"], CultureInfo.InvariantCulture);
+                       }
+
+                       if (dialect < 1 || dialect > 3)
+                       {
+                               throw new ArgumentException("Incorrect database dialect it should be 1, 2, or 3.");
+                       }
+
+                       if (values.ContainsKey("Overwrite"))
+                       {
+                               overwrite = (bool)values["Overwrite"];
+                       }
+
+                       try
+                       {
+                               // Configure Attachment
+                               FbConnectionStringBuilder csb = new FbConnectionStringBuilder();
+
+                               csb.DataSource  = values["DataSource"].ToString();
+                               csb.UserID              = values["User"].ToString();
+                               csb.Password    = values["Password"].ToString();
+                               csb.Database    = values["Database"].ToString();
+                               csb.Port                = Convert.ToInt32(values["Port"], CultureInfo.InvariantCulture);
+                               csb.ServerType  = serverType;
+
+                               FbConnectionString options = new FbConnectionString(csb);
+
+                               // DPB configuration
+                               DatabaseParameterBuffer dpb = new DatabaseParameterBuffer();
+
+                               // Dpb version
+                               dpb.Append(IscCodes.isc_dpb_version1);
+
+                               // Dummy packet interval
+                               dpb.Append(IscCodes.isc_dpb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 });
+
+                               // User name
+                               dpb.Append(IscCodes.isc_dpb_user_name, values["User"].ToString());
+
+                               // User password
+                               dpb.Append(IscCodes.isc_dpb_password, values["Password"].ToString());
+
+                               // Database     dialect
+                               dpb.Append(IscCodes.isc_dpb_sql_dialect, new byte[] { dialect, 0, 0, 0 });
+
+                               // Database overwrite
+                               dpb.Append(IscCodes.isc_dpb_overwrite, (short)(overwrite ? 1 : 0));
+
+                               // Character set
+                               if (values.ContainsKey("Charset"))
+                               {
+                                       index = Charset.SupportedCharsets.IndexOf(values["Charset"].ToString());
+
+                                       if (index == -1)
+                                       {
+                                               throw new ArgumentException("Character set is not valid.");
+                                       }
+                                       else
+                                       {
+                                               dpb.Append(
+                                                       IscCodes.isc_dpb_set_db_charset,
+                                                       Charset.SupportedCharsets[index].Name);
+                                       }
+                               }
+
+                               // Page Size
+                               if (values.ContainsKey("PageSize"))
+                               {
+                                       dpb.Append(IscCodes.isc_dpb_page_size, Convert.ToInt32(values["PageSize"], CultureInfo.InvariantCulture));
+                               }
+
+                               // Forced writes
+                               if (values.ContainsKey("ForcedWrite"))
+                               {
+                                       dpb.Append(IscCodes.isc_dpb_force_write,
+                                               (short)((bool)values["ForcedWrite"] ? 1 : 0));
+                               }
+
+                               if (!overwrite)
+                               {
+                                       try
+                                       {
+                                               // Check if     the     database exists
+                                               FbConnectionInternal check = new FbConnectionInternal(options);
+
+                                               check.Connect();
+                                               check.Disconnect();
+
+                                               IscException ex = new IscException(IscCodes.isc_db_or_file_exists);
+
+                                               throw new FbException(ex.Message, ex);
+                                       }
+                                       catch (Exception)
+                                       {
+                                               throw;
+                                       }
+                               }
+
+                               // Create the new database
+                               FbConnectionInternal c = new FbConnectionInternal(options);
+                               c.CreateDatabase(dpb);
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="DropDatabase(System.Collections.Hashtable)"]/*'/>
+               [Obsolete("Use DropDatabase(string connectionString) instead")]
+               public static void DropDatabase(Hashtable values)
+               {
+                       int serverType = 0;
+
+                       if (!values.ContainsKey("User") ||
+                               !values.ContainsKey("Password") ||
+                               !values.ContainsKey("Database"))
+                       {
+                               throw new ArgumentException("CreateDatabase requires a user name, password and database path.");
+                       }
+
+                       if (!values.ContainsKey("DataSource"))
+                       {
+                               values.Add("DataSource", "localhost");
+                       }
+
+                       if (!values.ContainsKey("Port"))
+                       {
+                               values.Add("Port", 3050);
+                       }
+
+                       if (values.ContainsKey("ServerType"))
+                       {
+                               serverType = Convert.ToInt32(values["ServerType"], CultureInfo.InvariantCulture);
+                       }
+
+                       try
+                       {
+                               // Configure Attachment
+                               FbConnectionStringBuilder csb = new FbConnectionStringBuilder();
+
+                               csb.DataSource = values["DataSource"].ToString();
+                               csb.Port = Convert.ToInt32(values["Port"], CultureInfo.InvariantCulture);
+                               csb.Database = values["Database"].ToString();
+                               csb.UserID = values["User"].ToString();
+                               csb.Password = values["Password"].ToString();
+                               csb.ServerType = serverType;
+
+                               FbConnectionString options = new FbConnectionString(csb);
+
+                               // Drop the     database
+                               FbConnectionInternal db = new FbConnectionInternal(options);
+                               db.DropDatabase();
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               IDbTransaction IDbConnection.BeginTransaction()
+               {
+                       return this.BeginTransaction();
+               }
+
+               IDbTransaction IDbConnection.BeginTransaction(IsolationLevel level)
+               {
+                       return this.BeginTransaction(level);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction"]/*'/>
+               public FbTransaction BeginTransaction()
+               {
+                       return this.BeginTransaction(IsolationLevel.ReadCommitted, null);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(System.String)"]/*'/>
+               public FbTransaction BeginTransaction(string transactionName)
+               {
+                       return this.BeginTransaction(IsolationLevel.ReadCommitted, transactionName);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(System.Data.IsolationLevel)"]/*'/>
+               public FbTransaction BeginTransaction(IsolationLevel level)
+               {
+                       return this.BeginTransaction(level, null);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(System.Data.IsolationLevel,System.String)"]/*'/>
+               public FbTransaction BeginTransaction(IsolationLevel level, string transactionName)
+               {
+                       if (this.IsClosed)
+                       {
+                               throw new InvalidOperationException("BeginTransaction requires an open and available Connection.");
+                       }
+
+                       return this.innerConnection.BeginTransaction(level, transactionName);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(FbTransactionOptions)"]/*'/>
+               public FbTransaction BeginTransaction(FbTransactionOptions options)
+               {
+                       return this.BeginTransaction(options, null);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="BeginTransaction(FbTransactionOptions, System.String)"]/*'/>
+               public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName)
+               {
+                       if (this.IsClosed)
+                       {
+                               throw new InvalidOperationException("BeginTransaction requires an open and available Connection.");
+                       }
+
+                       return this.innerConnection.BeginTransaction(options, transactionName);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="ChangeDatabase(System.String)"]/*'/>
+               public void ChangeDatabase(string db)
+               {
+                       lock (this)
+                       {
+                               if (this.IsClosed)
+                               {
+                                       throw new InvalidOperationException("ChangeDatabase requires an open and available Connection.");
+                               }
+
+                               if (db == null || db.Trim().Length == 0)
+                               {
+                                       throw new InvalidOperationException("Database name is not valid.");
+                               }
+
+                               string cs = this.connectionString;
+
+                               try
+                               {
+                                       FbConnectionStringBuilder csb = new FbConnectionStringBuilder(this.connectionString);
+
+                                       // Close current connection
+                                       this.Close();
+
+                                       // Set up the new Database
+                                       csb.Database = db;
+
+                                       // Open new     connection
+                                       this.Open();
+                               }
+                               catch (IscException ex)
+                               {
+                                       this.ConnectionString = cs;
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="Open"]/*'/>
+               public void Open()
+               {
+                       lock (this)
+                       {
+                               if (this.connectionString == null || this.connectionString.Length == 0)
+                               {
+                                       throw new InvalidOperationException("Connection String is not initialized.");
+                               }
+                               if (!this.IsClosed && this.state != ConnectionState.Connecting)
+                               {
+                                       throw new InvalidOperationException("Connection already Open.");
+                               }
+
+                               try
+                               {
+                                       this.OnStateChange(this.state, ConnectionState.Connecting);
+
+                                       if (this.options.Pooling)
+                                       {
+                                               // Use Connection Pooling
+                                               FbConnectionPool pool = FbPoolManager.Instance.CreatePool(this.connectionString);
+                                               this.innerConnection = pool.CheckOut();
+                                               this.innerConnection.OwningConnection = this;
+                                       }
+                                       else
+                                       {
+                                               // Do not use Connection Pooling
+                                               this.innerConnection = new FbConnectionInternal(this.options, this);
+                                               this.innerConnection.Connect();
+                                       }
+
+                                       // Bind Warning messages event
+                                       this.innerConnection.Database.WarningMessage = new WarningMessageCallback(this.OnWarningMessage);
+
+                                       // Update the connection state
+                                       this.OnStateChange(this.state, ConnectionState.Open);
+                               }
+                               catch (IscException ex)
+                               {
+                                       this.OnStateChange(this.state, ConnectionState.Closed);
+                                       throw new FbException(ex.Message, ex);
+                               }
+                               catch (Exception)
+                               {
+                                       this.OnStateChange(this.state, ConnectionState.Closed);
+                                       throw;
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="Close"]/*'/>
+               public void Close()
+               {
+                       if (this.IsClosed)
+                       {
+                               return;
+                       }
+
+                       lock (this)
+                       {
+                               try
+                               {
+                                       lock (this.innerConnection)
+                                       {
+                                               // Close the Remote     Event Manager
+                                               this.innerConnection.CloseEventManager();
+
+                                               // Unbind Warning messages event
+                                               this.innerConnection.Database.WarningMessage = null;
+
+                                               // Dispose Transaction
+                                               this.innerConnection.DisposeTransaction();
+
+                                               // Dispose all active statemenets
+                                               this.innerConnection.DisposePreparedCommands();
+
+                                               // Close connection     or send it back to the pool
+                                               if (this.innerConnection.Pooled)
+                                               {
+                                                       // Get Connection Pool
+                                                       FbConnectionPool pool = FbPoolManager.Instance.FindPool(this.connectionString);
+
+                                                       // Send connection to the Pool
+                                                       pool.CheckIn(this.innerConnection);
+                                               }
+                                               else
+                                               {
+                                                       this.innerConnection.Disconnect();
+                                               }
+                                       }
+
+                                       // Update connection state
+                                       this.OnStateChange(this.state, ConnectionState.Closed);
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               IDbCommand IDbConnection.CreateCommand()
+               {
+                       return this.CreateCommand();
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="CreateCommand"]/*'/>
+               public FbCommand CreateCommand()
+               {
+                       FbCommand command = new FbCommand();
+
+                       lock (this)
+                       {
+                               command.Connection = this;
+                       }
+
+                       return command;
+               }
+
+               #endregion
+
+               #region Database Schema
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetSchema"]/*'/>
+               public DataTable GetSchema()
+               {
+                       return this.GetSchema("MetaDataCollections");
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetSchema(System.String)"]/*'/>
+               public DataTable GetSchema(string collectionName)
+               {
+                       return this.GetSchema(collectionName, null);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetSchema(System.String, System.String[])"]/*'/>
+               public DataTable GetSchema(string collectionName, string[] restrictions)
+               {
+                       if (this.IsClosed)
+                       {
+                               throw new InvalidOperationException("The connection is closed.");
+                       }
+
+                       return this.innerConnection.GetSchema(collectionName, restrictions);
+               }
+
+               /// <include file='Doc/en_EN/FbConnection.xml' path='doc/class[@name="FbConnection"]/method[@name="GetDbSchemaTable"]/*'/>
+               [Obsolete("Use GetSchema methods instead")]
+               public DataTable GetDbSchemaTable(FbDbSchemaType schema, object[] restrictions)
+               {
+                       if (this.state == ConnectionState.Closed)
+                       {
+                               throw new InvalidOperationException("The conneciton is closed.");
+                       }
+
+                       return innerConnection.GetSchema(schema.ToString(), restrictions);
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void OnWarningMessage(IscException warning)
+               {
+                       if (this.InfoMessage != null)
+                       {
+                               this.InfoMessage(this, new FbInfoMessageEventArgs(warning));
+                       }
+               }
+
+               private void OnStateChange(ConnectionState originalState, ConnectionState currentState)
+               {
+                       this.state = currentState;
+                       if (this.StateChange != null)
+                       {
+                               this.StateChange(this, new StateChangeEventArgs(originalState, currentState));
+                       }
+               }
+
+               #endregion
+       }
+}
index 675e10b306e79d6b04d5f5eeb0b54531707583ec..5b5f5bc352bfb69e5b8e7e6355e2810679b62e3c 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Data;\r
-using System.Text;\r
-\r
-using FirebirdSql.Data.Common;\r
-using FirebirdSql.Data.Firebird.DbSchema;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       internal class FbConnectionInternal : MarshalByRefObject\r
-       {\r
-               #region Fields\r
-\r
-               private IDatabase                       db;\r
-               private FbTransaction           activeTransaction;\r
-               private ArrayList                       preparedCommands;\r
-               private FbConnectionString      options;\r
-               private FbConnection            owningConnection;\r
-               private long                            created;\r
-               private long                            lifetime;\r
-               private bool                            pooled;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public IDatabase Database\r
-               {\r
-                       get { return this.db; }\r
-               }\r
-\r
-               public long Lifetime\r
-               {\r
-                       get { return this.lifetime; }\r
-                       set { this.lifetime = value; }\r
-               }\r
-\r
-               public long Created\r
-               {\r
-                       get { return this.created; }\r
-                       set { this.created = value; }\r
-               }\r
-\r
-               public bool Pooled\r
-               {\r
-                       get { return this.pooled; }\r
-                       set { this.pooled = value; }\r
-               }\r
-\r
-               public bool HasActiveTransaction\r
-               {\r
-                       get\r
-                       {\r
-                               return this.activeTransaction != null && !this.activeTransaction.IsUpdated;\r
-                       }\r
-               }\r
-\r
-               public ArrayList PreparedCommands\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.preparedCommands == null)\r
-                               {\r
-                                       this.preparedCommands = new ArrayList();\r
-                               }\r
-\r
-                               return this.preparedCommands;\r
-                       }\r
-               }\r
-\r
-               public FbTransaction ActiveTransaction\r
-               {\r
-                       get { return this.activeTransaction; }\r
-               }\r
-\r
-               public FbConnectionString ConnectionOptions\r
-               {\r
-                       get { return this.options; }\r
-               }\r
-\r
-               public FbConnection OwningConnection\r
-               {\r
-                       get { return this.owningConnection; }\r
-                       set { this.owningConnection = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public FbConnectionInternal(FbConnectionString options) : this(options, null)\r
-               {\r
-               }\r
-\r
-               public FbConnectionInternal(FbConnectionString options, FbConnection owningConnection)\r
-               {\r
-                       this.options = options;\r
-                       this.owningConnection = owningConnection;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Create and Drop database methods\r
-\r
-               public void CreateDatabase(DatabaseParameterBuffer dpb)\r
-               {\r
-                       IDatabase db = ClientFactory.CreateDatabase(this.options.ServerType);\r
-                       db.CreateDatabase(dpb, this.options.DataSource, this.options.Port, this.options.Database);\r
-               }\r
-\r
-               public void DropDatabase()\r
-               {\r
-                       IDatabase db = ClientFactory.CreateDatabase(this.options.ServerType);\r
-                       db.Attach(this.BuildDpb(db, this.options), this.options.DataSource, this.options.Port, this.options.Database);\r
-                       db.DropDatabase();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Connect and     Disconenct methods\r
-\r
-               public void Connect()\r
-               {\r
-                       try\r
-                       {\r
-                               this.db = ClientFactory.CreateDatabase(this.options.ServerType);\r
-                               this.db.Charset = Charset.SupportedCharsets[this.options.Charset];\r
-                               this.db.Dialect = this.options.Dialect;\r
-                               this.db.PacketSize = this.options.PacketSize;\r
-\r
-                               DatabaseParameterBuffer dpb = this.BuildDpb(this.db, options);\r
-\r
-                               this.db.Attach(dpb, this.options.DataSource, this.options.Port, this.options.Database);\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               public void Disconnect()\r
-               {\r
-                       try\r
-                       {\r
-                               this.db.Dispose();\r
-\r
-                               this.owningConnection   = null;\r
-                               this.options                    = null;\r
-                               this.lifetime                   = 0;\r
-                               this.pooled                             = false;\r
-                               this.db                                 = null;\r
-\r
-                               this.DisposePreparedCommands();\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Transaction     Methods\r
-\r
-               public FbTransaction BeginTransaction(IsolationLevel level, string transactionName)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.HasActiveTransaction)\r
-                               {\r
-                                       throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.activeTransaction = new FbTransaction(this.owningConnection, level);\r
-                                       this.activeTransaction.BeginTransaction();\r
-\r
-                                       if (transactionName != null)\r
-                                       {\r
-                                               this.activeTransaction.Save(transactionName);\r
-                                       }\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-\r
-                       return this.activeTransaction;\r
-               }\r
-\r
-               public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.HasActiveTransaction)\r
-                               {\r
-                                       throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.activeTransaction = new FbTransaction(\r
-                                               this.owningConnection, IsolationLevel.Unspecified);\r
-\r
-                                       this.activeTransaction.BeginTransaction(options);\r
-\r
-                                       if (transactionName != null)\r
-                                       {\r
-                                               this.activeTransaction.Save(transactionName);\r
-                                       }\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-\r
-                       return this.activeTransaction;\r
-               }\r
-\r
-               public void DisposeTransaction()\r
-               {\r
-                       if (this.activeTransaction != null)\r
-                       {\r
-                               this.activeTransaction.Dispose();\r
-                               this.activeTransaction = null;\r
-                       }\r
-               }\r
-\r
-               public void TransactionUpdated()\r
-               {\r
-                       for (int i = 0; i < this.PreparedCommands.Count; i++)\r
-                       {\r
-                               FbCommand command = (FbCommand)this.PreparedCommands[i];\r
-\r
-                               if (command.Transaction != null)\r
-                               {\r
-                                       command.CloseReader();\r
-                                       command.Transaction = null;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Schema Methods\r
-\r
-               public DataTable GetSchema(string collectionName, string[] restrictions)\r
-               {\r
-                       return FbDbSchemaFactory.GetSchema(this.owningConnection, collectionName, restrictions);\r
-               }\r
-\r
-               [Obsolete]\r
-               public DataTable GetSchema(string collectionName, object[] restrictions)\r
-               {\r
-                       return FbDbSchemaFactory.GetSchema(this.owningConnection, collectionName, restrictions);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Prepared Commands Methods\r
-\r
-               public void AddPreparedCommand(FbCommand command)\r
-               {\r
-                       if (!this.PreparedCommands.Contains(command))\r
-                       {\r
-                               this.PreparedCommands.Add(command);\r
-                       }\r
-               }\r
-\r
-               public void RemovePreparedCommand(FbCommand command)\r
-               {\r
-                       this.PreparedCommands.Remove(command);\r
-               }\r
-\r
-               public void DisposePreparedCommands()\r
-               {\r
-                       if (this.preparedCommands != null)\r
-                       {\r
-                               if (this.PreparedCommands.Count > 0)\r
-                               {\r
-                                       FbCommand[] commands = (FbCommand[])this.PreparedCommands.ToArray(typeof(FbCommand));\r
-\r
-                                       for (int i = 0; i < commands.Length; i++)\r
-                                       {\r
-                                               // Release statement handle\r
-                                               commands[i].Release();\r
-                                       }\r
-                               }\r
-\r
-                               this.PreparedCommands.Clear();\r
-                               this.preparedCommands = null;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Firebird Events Methods\r
-\r
-               public void CloseEventManager()\r
-               {\r
-                       if (this.db.HasRemoteEventSupport)\r
-                       {\r
-                               lock (this.db)\r
-                               {\r
-                                       this.db.CloseEventManager();\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Connection Verification\r
-\r
-               public bool Verify()\r
-               {\r
-                       // Do not actually ask for any information\r
-                       byte[] items = new byte[]\r
-                       {\r
-                               IscCodes.isc_info_end\r
-                       };\r
-\r
-                       try\r
-                       {\r
-                               this.db.GetDatabaseInfo(items, 16);\r
-\r
-                               return true;\r
-                       }\r
-                       catch\r
-                       {\r
-                               return false;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private DatabaseParameterBuffer BuildDpb(IDatabase db, FbConnectionString options)\r
-               {\r
-                       DatabaseParameterBuffer dpb = db.CreateDatabaseParameterBuffer();\r
-\r
-                       dpb.Append(IscCodes.isc_dpb_version1);\r
-                       dpb.Append(IscCodes.isc_dpb_dummy_packet_interval,\r
-                               new byte[] { 120, 10, 0, 0 });\r
-                       dpb.Append(IscCodes.isc_dpb_sql_dialect,\r
-                               new byte[] { Convert.ToByte(options.Dialect), 0, 0, 0 });\r
-                       dpb.Append(IscCodes.isc_dpb_lc_ctype, options.Charset);\r
-                       if (options.Role != null && options.Role.Length > 0)\r
-                       {\r
-                               dpb.Append(IscCodes.isc_dpb_sql_role_name, options.Role);\r
-                       }\r
-                       dpb.Append(IscCodes.isc_dpb_connect_timeout, options.ConnectionTimeout);\r
-                       dpb.Append(IscCodes.isc_dpb_user_name, options.UserID);\r
-                       dpb.Append(IscCodes.isc_dpb_password, options.Password);\r
-\r
-                       return dpb;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Text;
+
+using FirebirdSql.Data.Common;
+using FirebirdSql.Data.Firebird.DbSchema;
+
+namespace FirebirdSql.Data.Firebird
+{
+       internal class FbConnectionInternal : MarshalByRefObject
+       {
+               #region Fields
+
+               private IDatabase                       db;
+               private FbTransaction           activeTransaction;
+               private ArrayList                       preparedCommands;
+               private FbConnectionString      options;
+               private FbConnection            owningConnection;
+               private long                            created;
+               private long                            lifetime;
+               private bool                            pooled;
+
+               #endregion
+
+               #region Properties
+
+               public IDatabase Database
+               {
+                       get { return this.db; }
+               }
+
+               public long Lifetime
+               {
+                       get { return this.lifetime; }
+                       set { this.lifetime = value; }
+               }
+
+               public long Created
+               {
+                       get { return this.created; }
+                       set { this.created = value; }
+               }
+
+               public bool Pooled
+               {
+                       get { return this.pooled; }
+                       set { this.pooled = value; }
+               }
+
+               public bool HasActiveTransaction
+               {
+                       get
+                       {
+                               return this.activeTransaction != null && !this.activeTransaction.IsUpdated;
+                       }
+               }
+
+               public ArrayList PreparedCommands
+               {
+                       get
+                       {
+                               if (this.preparedCommands == null)
+                               {
+                                       this.preparedCommands = new ArrayList();
+                               }
+
+                               return this.preparedCommands;
+                       }
+               }
+
+               public FbTransaction ActiveTransaction
+               {
+                       get { return this.activeTransaction; }
+               }
+
+               public FbConnectionString ConnectionOptions
+               {
+                       get { return this.options; }
+               }
+
+               public FbConnection OwningConnection
+               {
+                       get { return this.owningConnection; }
+                       set { this.owningConnection = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public FbConnectionInternal(FbConnectionString options) : this(options, null)
+               {
+               }
+
+               public FbConnectionInternal(FbConnectionString options, FbConnection owningConnection)
+               {
+                       this.options = options;
+                       this.owningConnection = owningConnection;
+               }
+
+               #endregion
+
+               #region Create and Drop database methods
+
+               public void CreateDatabase(DatabaseParameterBuffer dpb)
+               {
+                       IDatabase db = ClientFactory.CreateDatabase(this.options.ServerType);
+                       db.CreateDatabase(dpb, this.options.DataSource, this.options.Port, this.options.Database);
+               }
+
+               public void DropDatabase()
+               {
+                       IDatabase db = ClientFactory.CreateDatabase(this.options.ServerType);
+                       db.Attach(this.BuildDpb(db, this.options), this.options.DataSource, this.options.Port, this.options.Database);
+                       db.DropDatabase();
+               }
+
+               #endregion
+
+               #region Connect and     Disconenct methods
+
+               public void Connect()
+               {
+                       try
+                       {
+                               this.db = ClientFactory.CreateDatabase(this.options.ServerType);
+                               this.db.Charset = Charset.SupportedCharsets[this.options.Charset];
+                               this.db.Dialect = this.options.Dialect;
+                               this.db.PacketSize = this.options.PacketSize;
+
+                               DatabaseParameterBuffer dpb = this.BuildDpb(this.db, options);
+
+                               this.db.Attach(dpb, this.options.DataSource, this.options.Port, this.options.Database);
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               public void Disconnect()
+               {
+                       try
+                       {
+                               this.db.Dispose();
+
+                               this.owningConnection   = null;
+                               this.options                    = null;
+                               this.lifetime                   = 0;
+                               this.pooled                             = false;
+                               this.db                                 = null;
+
+                               this.DisposePreparedCommands();
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               #endregion
+
+               #region Transaction     Methods
+
+               public FbTransaction BeginTransaction(IsolationLevel level, string transactionName)
+               {
+                       lock (this)
+                       {
+                               if (this.HasActiveTransaction)
+                               {
+                                       throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported.");
+                               }
+
+                               try
+                               {
+                                       this.activeTransaction = new FbTransaction(this.owningConnection, level);
+                                       this.activeTransaction.BeginTransaction();
+
+                                       if (transactionName != null)
+                                       {
+                                               this.activeTransaction.Save(transactionName);
+                                       }
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+
+                       return this.activeTransaction;
+               }
+
+               public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName)
+               {
+                       lock (this)
+                       {
+                               if (this.HasActiveTransaction)
+                               {
+                                       throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported.");
+                               }
+
+                               try
+                               {
+                                       this.activeTransaction = new FbTransaction(
+                                               this.owningConnection, IsolationLevel.Unspecified);
+
+                                       this.activeTransaction.BeginTransaction(options);
+
+                                       if (transactionName != null)
+                                       {
+                                               this.activeTransaction.Save(transactionName);
+                                       }
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+
+                       return this.activeTransaction;
+               }
+
+               public void DisposeTransaction()
+               {
+                       if (this.activeTransaction != null)
+                       {
+                               this.activeTransaction.Dispose();
+                               this.activeTransaction = null;
+                       }
+               }
+
+               public void TransactionUpdated()
+               {
+                       for (int i = 0; i < this.PreparedCommands.Count; i++)
+                       {
+                               FbCommand command = (FbCommand)this.PreparedCommands[i];
+
+                               if (command.Transaction != null)
+                               {
+                                       command.CloseReader();
+                                       command.Transaction = null;
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Schema Methods
+
+               public DataTable GetSchema(string collectionName, string[] restrictions)
+               {
+                       return FbDbSchemaFactory.GetSchema(this.owningConnection, collectionName, restrictions);
+               }
+
+               [Obsolete]
+               public DataTable GetSchema(string collectionName, object[] restrictions)
+               {
+                       return FbDbSchemaFactory.GetSchema(this.owningConnection, collectionName, restrictions);
+               }
+
+               #endregion
+
+               #region Prepared Commands Methods
+
+               public void AddPreparedCommand(FbCommand command)
+               {
+                       if (!this.PreparedCommands.Contains(command))
+                       {
+                               this.PreparedCommands.Add(command);
+                       }
+               }
+
+               public void RemovePreparedCommand(FbCommand command)
+               {
+                       this.PreparedCommands.Remove(command);
+               }
+
+               public void DisposePreparedCommands()
+               {
+                       if (this.preparedCommands != null)
+                       {
+                               if (this.PreparedCommands.Count > 0)
+                               {
+                                       FbCommand[] commands = (FbCommand[])this.PreparedCommands.ToArray(typeof(FbCommand));
+
+                                       for (int i = 0; i < commands.Length; i++)
+                                       {
+                                               // Release statement handle
+                                               commands[i].Release();
+                                       }
+                               }
+
+                               this.PreparedCommands.Clear();
+                               this.preparedCommands = null;
+                       }
+               }
+
+               #endregion
+
+               #region Firebird Events Methods
+
+               public void CloseEventManager()
+               {
+                       if (this.db.HasRemoteEventSupport)
+                       {
+                               lock (this.db)
+                               {
+                                       this.db.CloseEventManager();
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Connection Verification
+
+               public bool Verify()
+               {
+                       // Do not actually ask for any information
+                       byte[] items = new byte[]
+                       {
+                               IscCodes.isc_info_end
+                       };
+
+                       try
+                       {
+                               this.db.GetDatabaseInfo(items, 16);
+
+                               return true;
+                       }
+                       catch
+                       {
+                               return false;
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private DatabaseParameterBuffer BuildDpb(IDatabase db, FbConnectionString options)
+               {
+                       DatabaseParameterBuffer dpb = db.CreateDatabaseParameterBuffer();
+
+                       dpb.Append(IscCodes.isc_dpb_version1);
+                       dpb.Append(IscCodes.isc_dpb_dummy_packet_interval,
+                               new byte[] { 120, 10, 0, 0 });
+                       dpb.Append(IscCodes.isc_dpb_sql_dialect,
+                               new byte[] { Convert.ToByte(options.Dialect), 0, 0, 0 });
+                       dpb.Append(IscCodes.isc_dpb_lc_ctype, options.Charset);
+                       if (options.Role != null && options.Role.Length > 0)
+                       {
+                               dpb.Append(IscCodes.isc_dpb_sql_role_name, options.Role);
+                       }
+                       dpb.Append(IscCodes.isc_dpb_connect_timeout, options.ConnectionTimeout);
+                       dpb.Append(IscCodes.isc_dpb_user_name, options.UserID);
+                       dpb.Append(IscCodes.isc_dpb_password, options.Password);
+
+                       return dpb;
+               }
+
+               #endregion
+       }
+}
index 43f8642256da067a3727c73c3c9d819cecacd0bf..fbdbaeb723f46931db61bdab496a502febfa2594 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Collections;\r
-using System.Threading;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       internal sealed class FbPoolManager\r
-       {\r
-               #region Static fields\r
-\r
-               private static FbPoolManager instance;\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private Hashtable pools;\r
-               private Hashtable handlers;\r
-\r
-               #endregion\r
-\r
-               #region Static Properties\r
-\r
-               public static FbPoolManager Instance\r
-               {\r
-                       get\r
-                       {\r
-                               if (FbPoolManager.instance == null)\r
-                               {\r
-                                       FbPoolManager.instance = new FbPoolManager();\r
-                               }\r
-\r
-                               return FbPoolManager.instance;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Priperties\r
-\r
-               public int PoolsCount\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.pools != null)\r
-                               {\r
-                                       return this.pools.Count;\r
-                               }\r
-                               return 0;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               private FbPoolManager()\r
-               {\r
-                       this.pools = Hashtable.Synchronized(new Hashtable());\r
-                       this.handlers = Hashtable.Synchronized(new Hashtable());\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public FbConnectionPool FindPool(string connectionString)\r
-               {\r
-                       FbConnectionPool pool = null;\r
-\r
-                       lock (this)\r
-                       {\r
-                               if (this.pools.ContainsKey(connectionString.GetHashCode()))\r
-                               {\r
-                                       pool = (FbConnectionPool)pools[connectionString.GetHashCode()];\r
-                               }\r
-                       }\r
-\r
-                       return pool;\r
-               }\r
-\r
-               public FbConnectionPool CreatePool(string connectionString)\r
-               {\r
-                       FbConnectionPool pool = null;\r
-\r
-                       lock (this)\r
-                       {\r
-                               pool = this.FindPool(connectionString);\r
-\r
-                               if (pool == null)\r
-                               {\r
-                                       lock (this.pools.SyncRoot)\r
-                                       {\r
-                                               int hashcode = connectionString.GetHashCode();\r
-\r
-                                               // Create an empty pool handler\r
-                                               EmptyPoolEventHandler handler = new EmptyPoolEventHandler(this.OnEmptyPool);\r
-\r
-                                               this.handlers.Add(hashcode, handler);\r
-\r
-                                               // Create the new connection pool\r
-                                               pool = new FbConnectionPool(connectionString);\r
-\r
-                                               this.pools.Add(hashcode, pool);\r
-\r
-                                               pool.EmptyPool += handler;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return pool;\r
-               }\r
-\r
-               public void ClearAllPools()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               lock (this.pools.SyncRoot)\r
-                               {\r
-                                       FbConnectionPool[] tempPools = new FbConnectionPool[this.pools.Count];\r
-\r
-                                       this.pools.Values.CopyTo(tempPools, 0);\r
-\r
-                                       foreach (FbConnectionPool pool in tempPools)\r
-                                       {\r
-                                               // Clear pool\r
-                                               pool.Clear();\r
-                                       }\r
-\r
-                                       // Clear Hashtables\r
-                                       this.pools.Clear();\r
-                                       this.handlers.Clear();\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void ClearPool(string connectionString)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               lock (this.pools.SyncRoot)\r
-                               {\r
-                                       int hashCode = connectionString.GetHashCode();\r
-\r
-                                       if (this.pools.ContainsKey(hashCode))\r
-                                       {\r
-                                               FbConnectionPool pool = (FbConnectionPool)this.pools[hashCode];\r
-\r
-                                               // Clear pool\r
-                                               pool.Clear();\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void OnEmptyPool(object sender, EventArgs e)\r
-               {\r
-                       lock (this.pools.SyncRoot)\r
-                       {\r
-                               int hashCode = (int)sender;\r
-\r
-                               if (this.pools.ContainsKey(hashCode))\r
-                               {\r
-                                       FbConnectionPool pool = (FbConnectionPool)this.pools[hashCode];\r
-                                       EmptyPoolEventHandler handler = (EmptyPoolEventHandler)this.handlers[hashCode];\r
-\r
-                                       pool.EmptyPool -= handler;\r
-\r
-                                       this.pools.Remove(hashCode);\r
-                                       this.handlers.Remove(hashCode);\r
-\r
-                                       pool = null;\r
-                                       handler = null;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-\r
-       internal delegate void EmptyPoolEventHandler(object sender, EventArgs e);\r
-\r
-       internal class FbConnectionPool : MarshalByRefObject\r
-       {\r
-               #region Fields\r
-\r
-               private FbConnectionString      options;\r
-               private ArrayList                       locked;\r
-               private ArrayList                       unlocked;\r
-               private Thread                          cleanUpThread;\r
-               private string                          connectionString;\r
-               private bool                            isRunning;\r
-               private long                            lifeTime;\r
-\r
-               #endregion\r
-\r
-               #region Events\r
-\r
-               public event EmptyPoolEventHandler EmptyPool;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int Count\r
-               {\r
-                       get { return this.unlocked.Count + this.locked.Count; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public FbConnectionPool(string connectionString)\r
-               {\r
-                       this.connectionString   = connectionString;\r
-                       this.options                    = new FbConnectionString(connectionString);\r
-                       this.lifeTime                   = this.options.ConnectionLifeTime * TimeSpan.TicksPerSecond;\r
-\r
-                       if (this.options.MaxPoolSize == 0)\r
-                       {\r
-                               this.locked = ArrayList.Synchronized(new ArrayList());\r
-                               this.unlocked = ArrayList.Synchronized(new ArrayList());\r
-                       }\r
-                       else\r
-                       {\r
-                               this.locked = ArrayList.Synchronized(new ArrayList(this.options.MaxPoolSize));\r
-                               this.unlocked = ArrayList.Synchronized(new ArrayList(this.options.MaxPoolSize));\r
-                       }\r
-\r
-                       // If a minimun number of connections is requested\r
-                       // initialize the pool\r
-                       this.Initialize();\r
-\r
-                       // Start the cleanup thread     only if needed\r
-                       if (this.lifeTime != 0)\r
-                       {\r
-                               this.isRunning = true;\r
-\r
-                               this.cleanUpThread = new Thread(new ThreadStart(this.RunCleanup));\r
-                               this.cleanUpThread.Name = "Cleanup Thread";\r
-                               this.cleanUpThread.Start();\r
-                               this.cleanUpThread.IsBackground = true;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void CheckIn(FbConnectionInternal connection)\r
-               {\r
-                       connection.OwningConnection = null;\r
-                       connection.Created = System.DateTime.Now.Ticks;\r
-\r
-                       this.locked.Remove(connection);\r
-                       this.unlocked.Add(connection);\r
-               }\r
-\r
-               public FbConnectionInternal CheckOut()\r
-               {\r
-                       FbConnectionInternal newConnection = null;\r
-\r
-                       lock (this)\r
-                       {\r
-                               this.CheckMaxPoolSize();\r
-\r
-                               lock (this.unlocked.SyncRoot)\r
-                               {\r
-                                       newConnection = this.GetConnection();\r
-                                       if (newConnection != null)\r
-                                       {\r
-                                               return newConnection;\r
-                                       }\r
-                               }\r
-\r
-                               newConnection = this.Create();\r
-\r
-                               // Set connection pooling settings to the new connection\r
-                               newConnection.Lifetime = this.options.ConnectionLifeTime;\r
-                               newConnection.Pooled = true;\r
-\r
-                               // Added to     the     locked connections list.\r
-                               this.locked.Add(newConnection);\r
-                       }\r
-\r
-                       return newConnection;\r
-               }\r
-\r
-               public void Clear()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               // Stop cleanup thread\r
-                               if (this.cleanUpThread != null)\r
-                               {\r
-                                       this.cleanUpThread.Abort();\r
-                                       this.cleanUpThread.Join();\r
-                               }\r
-\r
-                               // Close all unlocked connections\r
-                               FbConnectionInternal[] list = (FbConnectionInternal[])this.unlocked.ToArray(typeof(FbConnectionInternal));\r
-\r
-                               foreach (FbConnectionInternal connection in list)\r
-                               {\r
-                                       connection.Disconnect();\r
-                               }\r
-\r
-                               // Close all locked     connections\r
-                               list = (FbConnectionInternal[])this.locked.ToArray(typeof(FbConnectionInternal));\r
-\r
-                               foreach (FbConnectionInternal connection in list)\r
-                               {\r
-                                       connection.Disconnect();\r
-                               }\r
-\r
-                               // Clear lists\r
-                               this.unlocked.Clear();\r
-                               this.locked.Clear();\r
-\r
-                               // Raise EmptyPool event\r
-                               if (this.EmptyPool != null)\r
-                               {\r
-                                       this.EmptyPool(this.connectionString.GetHashCode(), null);\r
-                               }\r
-\r
-                               // Reset fields\r
-                               this.unlocked                   = null;\r
-                               this.locked                             = null;\r
-                               this.connectionString   = null;\r
-                               this.cleanUpThread              = null;\r
-                               this.EmptyPool                  = null;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private bool CheckMinPoolSize()\r
-               {\r
-                       if (this.options.MinPoolSize > 0 && this.Count == this.options.MinPoolSize)\r
-                       {\r
-                               return false;\r
-                       }\r
-                       else\r
-                       {\r
-                               return true;\r
-                       }\r
-               }\r
-\r
-               private void CheckMaxPoolSize()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.options.MaxPoolSize > 0 &&\r
-                                       (this.Count + 1) >= this.options.MaxPoolSize)\r
-                               {\r
-                                       long timeout = this.options.ConnectionTimeout * TimeSpan.TicksPerSecond;\r
-                                       long start = DateTime.Now.Ticks;\r
-\r
-                                       while (true)\r
-                                       {\r
-                                               if ((this.Count + 1) >= this.options.MaxPoolSize)\r
-                                               {\r
-                                                       if ((DateTime.Now.Ticks - start) > timeout)\r
-                                                       {\r
-                                                               throw new SystemException("Timeout exceeded.");\r
-                                                       }\r
-\r
-                                                       Thread.Sleep(100);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private void Initialize()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               for (int i = 0; i < this.options.MinPoolSize; i++)\r
-                               {\r
-                                       this.unlocked.Add(this.Create());\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private FbConnectionInternal Create()\r
-               {\r
-                       FbConnectionInternal connection = new FbConnectionInternal(this.options);\r
-                       connection.Connect();\r
-\r
-                       connection.Pooled = true;\r
-                       connection.Created = DateTime.Now.Ticks;\r
-\r
-                       return connection;\r
-               }\r
-\r
-               private FbConnectionInternal GetConnection()\r
-               {\r
-                       FbConnectionInternal[] list = (FbConnectionInternal[])this.unlocked.ToArray(typeof(FbConnectionInternal));\r
-                       FbConnectionInternal result = null;\r
-                       long check = -1;\r
-\r
-                       Array.Reverse(list);\r
-\r
-                       foreach (FbConnectionInternal connection in list)\r
-                       {\r
-                               if (connection.Verify())\r
-                               {\r
-                                       if (this.lifeTime != 0)\r
-                                       {\r
-                                               long now = DateTime.Now.Ticks;\r
-                                               long expire = connection.Created + this.lifeTime;\r
-\r
-                                               if (now >= expire)\r
-                                               {\r
-                                                       if (this.CheckMinPoolSize())\r
-                                                       {\r
-                                                               this.unlocked.Remove(connection);\r
-                                                               this.Expire(connection);\r
-                                                       }\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       if (expire > check)\r
-                                                       {\r
-                                                               check = expire;\r
-                                                               result = connection;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               result = connection;\r
-                                               break;\r
-                                       }\r
-                               }\r
-                               else\r
-                               {\r
-                                       this.unlocked.Remove(connection);\r
-                                       this.Expire(connection);\r
-                               }\r
-                       }\r
-\r
-                       if (result != null)\r
-                       {\r
-                               this.unlocked.Remove(result);\r
-                               this.locked.Add(result);\r
-                       }\r
-\r
-                       return result;\r
-               }\r
-\r
-               private void RunCleanup()\r
-               {\r
-                       int interval = Convert.ToInt32(TimeSpan.FromTicks(this.lifeTime).TotalMilliseconds);\r
-\r
-                       if (interval > 60000)\r
-                       {\r
-                               interval = 60000;\r
-                       }\r
-\r
-                       try\r
-                       {\r
-                               while (this.isRunning)\r
-                               {\r
-                                       Thread.Sleep(interval);\r
-\r
-                                       this.Cleanup();\r
-\r
-                                       if (this.Count == 0)\r
-                                       {\r
-                                               lock (this)\r
-                                               {\r
-                                                       // Empty pool\r
-                                                       if (this.EmptyPool != null)\r
-                                                       {\r
-                                                               this.EmptyPool(this.connectionString.GetHashCode(), null);\r
-                                                       }\r
-\r
-                                                       // Stop running\r
-                                                       this.isRunning = false;\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-                       catch (ThreadAbortException)\r
-                       {\r
-                               this.isRunning = false;\r
-                       }\r
-               }\r
-\r
-               private void Expire(FbConnectionInternal connection)\r
-               {\r
-                       try\r
-                       {\r
-                               if (connection.Verify())\r
-                               {\r
-                                       connection.Disconnect();\r
-                               }\r
-                       }\r
-                       catch (Exception)\r
-                       {\r
-                               throw new FbException("Error closing database connection.");\r
-                       }\r
-               }\r
-\r
-               private void Cleanup()\r
-               {\r
-                       lock (this.unlocked.SyncRoot)\r
-                       {\r
-                               if (this.unlocked.Count > 0 && this.lifeTime != 0)\r
-                               {\r
-                                       FbConnectionInternal[] list = (FbConnectionInternal[])this.unlocked.ToArray(typeof(FbConnectionInternal));\r
-\r
-                                       foreach (FbConnectionInternal connection in list)\r
-                                       {\r
-                                               long now = DateTime.Now.Ticks;\r
-                                               long expire = connection.Created + this.lifeTime;\r
-\r
-                                               if (now >= expire)\r
-                                               {\r
-                                                       if (this.CheckMinPoolSize())\r
-                                                       {\r
-                                                               this.unlocked.Remove(connection);\r
-                                                               this.Expire(connection);\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Collections;
+using System.Threading;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       internal sealed class FbPoolManager
+       {
+               #region Static fields
+
+               private static FbPoolManager instance;
+
+               #endregion
+
+               #region Fields
+
+               private Hashtable pools;
+               private Hashtable handlers;
+
+               #endregion
+
+               #region Static Properties
+
+               public static FbPoolManager Instance
+               {
+                       get
+                       {
+                               if (FbPoolManager.instance == null)
+                               {
+                                       FbPoolManager.instance = new FbPoolManager();
+                               }
+
+                               return FbPoolManager.instance;
+                       }
+               }
+
+               #endregion
+
+               #region Priperties
+
+               public int PoolsCount
+               {
+                       get
+                       {
+                               if (this.pools != null)
+                               {
+                                       return this.pools.Count;
+                               }
+                               return 0;
+                       }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               private FbPoolManager()
+               {
+                       this.pools = Hashtable.Synchronized(new Hashtable());
+                       this.handlers = Hashtable.Synchronized(new Hashtable());
+               }
+
+               #endregion
+
+               #region Methods
+
+               public FbConnectionPool FindPool(string connectionString)
+               {
+                       FbConnectionPool pool = null;
+
+                       lock (this)
+                       {
+                               if (this.pools.ContainsKey(connectionString.GetHashCode()))
+                               {
+                                       pool = (FbConnectionPool)pools[connectionString.GetHashCode()];
+                               }
+                       }
+
+                       return pool;
+               }
+
+               public FbConnectionPool CreatePool(string connectionString)
+               {
+                       FbConnectionPool pool = null;
+
+                       lock (this)
+                       {
+                               pool = this.FindPool(connectionString);
+
+                               if (pool == null)
+                               {
+                                       lock (this.pools.SyncRoot)
+                                       {
+                                               int hashcode = connectionString.GetHashCode();
+
+                                               // Create an empty pool handler
+                                               EmptyPoolEventHandler handler = new EmptyPoolEventHandler(this.OnEmptyPool);
+
+                                               this.handlers.Add(hashcode, handler);
+
+                                               // Create the new connection pool
+                                               pool = new FbConnectionPool(connectionString);
+
+                                               this.pools.Add(hashcode, pool);
+
+                                               pool.EmptyPool += handler;
+                                       }
+                               }
+                       }
+
+                       return pool;
+               }
+
+               public void ClearAllPools()
+               {
+                       lock (this)
+                       {
+                               lock (this.pools.SyncRoot)
+                               {
+                                       FbConnectionPool[] tempPools = new FbConnectionPool[this.pools.Count];
+
+                                       this.pools.Values.CopyTo(tempPools, 0);
+
+                                       foreach (FbConnectionPool pool in tempPools)
+                                       {
+                                               // Clear pool
+                                               pool.Clear();
+                                       }
+
+                                       // Clear Hashtables
+                                       this.pools.Clear();
+                                       this.handlers.Clear();
+                               }
+                       }
+               }
+
+               public void ClearPool(string connectionString)
+               {
+                       lock (this)
+                       {
+                               lock (this.pools.SyncRoot)
+                               {
+                                       int hashCode = connectionString.GetHashCode();
+
+                                       if (this.pools.ContainsKey(hashCode))
+                                       {
+                                               FbConnectionPool pool = (FbConnectionPool)this.pools[hashCode];
+
+                                               // Clear pool
+                                               pool.Clear();
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void OnEmptyPool(object sender, EventArgs e)
+               {
+                       lock (this.pools.SyncRoot)
+                       {
+                               int hashCode = (int)sender;
+
+                               if (this.pools.ContainsKey(hashCode))
+                               {
+                                       FbConnectionPool pool = (FbConnectionPool)this.pools[hashCode];
+                                       EmptyPoolEventHandler handler = (EmptyPoolEventHandler)this.handlers[hashCode];
+
+                                       pool.EmptyPool -= handler;
+
+                                       this.pools.Remove(hashCode);
+                                       this.handlers.Remove(hashCode);
+
+                                       pool = null;
+                                       handler = null;
+                               }
+                       }
+               }
+
+               #endregion
+       }
+
+       internal delegate void EmptyPoolEventHandler(object sender, EventArgs e);
+
+       internal class FbConnectionPool : MarshalByRefObject
+       {
+               #region Fields
+
+               private FbConnectionString      options;
+               private ArrayList                       locked;
+               private ArrayList                       unlocked;
+               private Thread                          cleanUpThread;
+               private string                          connectionString;
+               private bool                            isRunning;
+               private long                            lifeTime;
+
+               #endregion
+
+               #region Events
+
+               public event EmptyPoolEventHandler EmptyPool;
+
+               #endregion
+
+               #region Properties
+
+               public int Count
+               {
+                       get { return this.unlocked.Count + this.locked.Count; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public FbConnectionPool(string connectionString)
+               {
+                       this.connectionString   = connectionString;
+                       this.options                    = new FbConnectionString(connectionString);
+                       this.lifeTime                   = this.options.ConnectionLifeTime * TimeSpan.TicksPerSecond;
+
+                       if (this.options.MaxPoolSize == 0)
+                       {
+                               this.locked = ArrayList.Synchronized(new ArrayList());
+                               this.unlocked = ArrayList.Synchronized(new ArrayList());
+                       }
+                       else
+                       {
+                               this.locked = ArrayList.Synchronized(new ArrayList(this.options.MaxPoolSize));
+                               this.unlocked = ArrayList.Synchronized(new ArrayList(this.options.MaxPoolSize));
+                       }
+
+                       // If a minimun number of connections is requested
+                       // initialize the pool
+                       this.Initialize();
+
+                       // Start the cleanup thread     only if needed
+                       if (this.lifeTime != 0)
+                       {
+                               this.isRunning = true;
+
+                               this.cleanUpThread = new Thread(new ThreadStart(this.RunCleanup));
+                               this.cleanUpThread.Name = "Cleanup Thread";
+                               this.cleanUpThread.Start();
+                               this.cleanUpThread.IsBackground = true;
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void CheckIn(FbConnectionInternal connection)
+               {
+                       connection.OwningConnection = null;
+                       connection.Created = System.DateTime.Now.Ticks;
+
+                       this.locked.Remove(connection);
+                       this.unlocked.Add(connection);
+               }
+
+               public FbConnectionInternal CheckOut()
+               {
+                       FbConnectionInternal newConnection = null;
+
+                       lock (this)
+                       {
+                               this.CheckMaxPoolSize();
+
+                               lock (this.unlocked.SyncRoot)
+                               {
+                                       newConnection = this.GetConnection();
+                                       if (newConnection != null)
+                                       {
+                                               return newConnection;
+                                       }
+                               }
+
+                               newConnection = this.Create();
+
+                               // Set connection pooling settings to the new connection
+                               newConnection.Lifetime = this.options.ConnectionLifeTime;
+                               newConnection.Pooled = true;
+
+                               // Added to     the     locked connections list.
+                               this.locked.Add(newConnection);
+                       }
+
+                       return newConnection;
+               }
+
+               public void Clear()
+               {
+                       lock (this)
+                       {
+                               // Stop cleanup thread
+                               if (this.cleanUpThread != null)
+                               {
+                                       this.cleanUpThread.Abort();
+                                       this.cleanUpThread.Join();
+                               }
+
+                               // Close all unlocked connections
+                               FbConnectionInternal[] list = (FbConnectionInternal[])this.unlocked.ToArray(typeof(FbConnectionInternal));
+
+                               foreach (FbConnectionInternal connection in list)
+                               {
+                                       connection.Disconnect();
+                               }
+
+                               // Close all locked     connections
+                               list = (FbConnectionInternal[])this.locked.ToArray(typeof(FbConnectionInternal));
+
+                               foreach (FbConnectionInternal connection in list)
+                               {
+                                       connection.Disconnect();
+                               }
+
+                               // Clear lists
+                               this.unlocked.Clear();
+                               this.locked.Clear();
+
+                               // Raise EmptyPool event
+                               if (this.EmptyPool != null)
+                               {
+                                       this.EmptyPool(this.connectionString.GetHashCode(), null);
+                               }
+
+                               // Reset fields
+                               this.unlocked                   = null;
+                               this.locked                             = null;
+                               this.connectionString   = null;
+                               this.cleanUpThread              = null;
+                               this.EmptyPool                  = null;
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private bool CheckMinPoolSize()
+               {
+                       if (this.options.MinPoolSize > 0 && this.Count == this.options.MinPoolSize)
+                       {
+                               return false;
+                       }
+                       else
+                       {
+                               return true;
+                       }
+               }
+
+               private void CheckMaxPoolSize()
+               {
+                       lock (this)
+                       {
+                               if (this.options.MaxPoolSize > 0 &&
+                                       (this.Count + 1) >= this.options.MaxPoolSize)
+                               {
+                                       long timeout = this.options.ConnectionTimeout * TimeSpan.TicksPerSecond;
+                                       long start = DateTime.Now.Ticks;
+
+                                       while (true)
+                                       {
+                                               if ((this.Count + 1) >= this.options.MaxPoolSize)
+                                               {
+                                                       if ((DateTime.Now.Ticks - start) > timeout)
+                                                       {
+                                                               throw new SystemException("Timeout exceeded.");
+                                                       }
+
+                                                       Thread.Sleep(100);
+                                               }
+                                               else
+                                               {
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               private void Initialize()
+               {
+                       lock (this)
+                       {
+                               for (int i = 0; i < this.options.MinPoolSize; i++)
+                               {
+                                       this.unlocked.Add(this.Create());
+                               }
+                       }
+               }
+
+               private FbConnectionInternal Create()
+               {
+                       FbConnectionInternal connection = new FbConnectionInternal(this.options);
+                       connection.Connect();
+
+                       connection.Pooled = true;
+                       connection.Created = DateTime.Now.Ticks;
+
+                       return connection;
+               }
+
+               private FbConnectionInternal GetConnection()
+               {
+                       FbConnectionInternal[] list = (FbConnectionInternal[])this.unlocked.ToArray(typeof(FbConnectionInternal));
+                       FbConnectionInternal result = null;
+                       long check = -1;
+
+                       Array.Reverse(list);
+
+                       foreach (FbConnectionInternal connection in list)
+                       {
+                               if (connection.Verify())
+                               {
+                                       if (this.lifeTime != 0)
+                                       {
+                                               long now = DateTime.Now.Ticks;
+                                               long expire = connection.Created + this.lifeTime;
+
+                                               if (now >= expire)
+                                               {
+                                                       if (this.CheckMinPoolSize())
+                                                       {
+                                                               this.unlocked.Remove(connection);
+                                                               this.Expire(connection);
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       if (expire > check)
+                                                       {
+                                                               check = expire;
+                                                               result = connection;
+                                                       }
+                                               }
+                                       }
+                                       else
+                                       {
+                                               result = connection;
+                                               break;
+                                       }
+                               }
+                               else
+                               {
+                                       this.unlocked.Remove(connection);
+                                       this.Expire(connection);
+                               }
+                       }
+
+                       if (result != null)
+                       {
+                               this.unlocked.Remove(result);
+                               this.locked.Add(result);
+                       }
+
+                       return result;
+               }
+
+               private void RunCleanup()
+               {
+                       int interval = Convert.ToInt32(TimeSpan.FromTicks(this.lifeTime).TotalMilliseconds);
+
+                       if (interval > 60000)
+                       {
+                               interval = 60000;
+                       }
+
+                       try
+                       {
+                               while (this.isRunning)
+                               {
+                                       Thread.Sleep(interval);
+
+                                       this.Cleanup();
+
+                                       if (this.Count == 0)
+                                       {
+                                               lock (this)
+                                               {
+                                                       // Empty pool
+                                                       if (this.EmptyPool != null)
+                                                       {
+                                                               this.EmptyPool(this.connectionString.GetHashCode(), null);
+                                                       }
+
+                                                       // Stop running
+                                                       this.isRunning = false;
+                                               }
+                                       }
+                               }
+                       }
+                       catch (ThreadAbortException)
+                       {
+                               this.isRunning = false;
+                       }
+               }
+
+               private void Expire(FbConnectionInternal connection)
+               {
+                       try
+                       {
+                               if (connection.Verify())
+                               {
+                                       connection.Disconnect();
+                               }
+                       }
+                       catch (Exception)
+                       {
+                               throw new FbException("Error closing database connection.");
+                       }
+               }
+
+               private void Cleanup()
+               {
+                       lock (this.unlocked.SyncRoot)
+                       {
+                               if (this.unlocked.Count > 0 && this.lifeTime != 0)
+                               {
+                                       FbConnectionInternal[] list = (FbConnectionInternal[])this.unlocked.ToArray(typeof(FbConnectionInternal));
+
+                                       foreach (FbConnectionInternal connection in list)
+                                       {
+                                               long now = DateTime.Now.Ticks;
+                                               long expire = connection.Created + this.lifeTime;
+
+                                               if (now >= expire)
+                                               {
+                                                       if (this.CheckMinPoolSize())
+                                                       {
+                                                               this.unlocked.Remove(connection);
+                                                               this.Expire(connection);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+       }
+}
index a8df98f346a6ba9b196c56eddb1d7d2a1478060e..e26cc02f1bfff4c04a47e82a5ef1234ea3d32945 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2004-2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text.RegularExpressions;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       internal sealed class FbConnectionString\r
-       {\r
-               #region Static Fields\r
-\r
-               public static readonly Hashtable Synonyms = GetSynonyms();\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               // This is somethig     that should     be needed in .NET 2.0\r
-               // for use with the     DbConnectionOptions     or DbConnectionString classes.\r
-               private static Hashtable GetSynonyms()\r
-               {\r
-                       Hashtable synonyms = new Hashtable();\r
-\r
-                       synonyms.Add("data source", "data source");\r
-                       synonyms.Add("datasource", "data source");\r
-                       synonyms.Add("server", "data source");\r
-                       synonyms.Add("host", "data source");\r
-                       synonyms.Add("port", "port number");\r
-                       synonyms.Add("port number", "port number");\r
-                       synonyms.Add("database", "database");\r
-                       synonyms.Add("user id", "user id");\r
-                       synonyms.Add("uid", "user id");\r
-                       synonyms.Add("user", "user id");\r
-                       synonyms.Add("user name", "user id");\r
-                       synonyms.Add("password", "password");\r
-                       synonyms.Add("user password", "password");\r
-                       synonyms.Add("dialect", "dialect");\r
-                       synonyms.Add("charset", "charset");\r
-                       synonyms.Add("pooling", "pooling");\r
-                       synonyms.Add("max pool size", "max pool size");\r
-                       synonyms.Add("min pool size", "min pool size");\r
-                       synonyms.Add("character set", "charset");\r
-                       synonyms.Add("connection lifetime", "connection lifetime");\r
-                       synonyms.Add("timeout", "connection timeout");\r
-                       synonyms.Add("connection timeout", "connection timeout");\r
-                       synonyms.Add("packet size", "packet size");\r
-                       synonyms.Add("role", "role name");\r
-                       synonyms.Add("role name", "role name");\r
-                       synonyms.Add("fetch size", "fetch size");\r
-                       synonyms.Add("fetchsize", "fetch size");\r
-                       synonyms.Add("server type", "server type");\r
-                       synonyms.Add("servertype", "server type");\r
-                       synonyms.Add("isolation level", "isolation level");\r
-\r
-                       return synonyms;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private fields\r
-\r
-               private Hashtable options;\r
-               private bool isServiceConnectionString;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public string UserID\r
-               {\r
-                       get { return this.GetString("user id"); }\r
-               }\r
-\r
-               public string Password\r
-               {\r
-                       get { return this.GetString("password"); }\r
-               }\r
-\r
-               public string DataSource\r
-               {\r
-                       get { return this.GetString("data source"); }\r
-               }\r
-\r
-               public int Port\r
-               {\r
-                       get { return this.GetInt32("port number"); }\r
-               }\r
-\r
-               public string Database\r
-               {\r
-                       get { return this.GetString("database"); }\r
-               }\r
-\r
-               public short PacketSize\r
-               {\r
-                       get { return this.GetInt16("packet size"); }\r
-               }\r
-\r
-               public string Role\r
-               {\r
-                       get { return this.GetString("role name"); }\r
-               }\r
-\r
-               public byte Dialect\r
-               {\r
-                       get { return this.GetByte("dialect"); }\r
-               }\r
-\r
-               public string Charset\r
-               {\r
-                       get { return this.GetString("charset"); }\r
-               }\r
-\r
-               public int ConnectionTimeout\r
-               {\r
-                       get { return this.GetInt32("connection timeout"); }\r
-               }\r
-\r
-               public bool Pooling\r
-               {\r
-                       get { return this.GetBoolean("pooling"); }\r
-               }\r
-\r
-               public long ConnectionLifeTime\r
-               {\r
-                       get { return this.GetInt64("connection lifetime"); }\r
-               }\r
-\r
-               public int MinPoolSize\r
-               {\r
-                       get { return this.GetInt32("min pool size"); }\r
-               }\r
-\r
-               public int MaxPoolSize\r
-               {\r
-                       get { return this.GetInt32("max pool size"); }\r
-               }\r
-\r
-               public int FetchSize\r
-               {\r
-                       get { return this.GetInt32("fetch size"); }\r
-               }\r
-\r
-               public int ServerType\r
-               {\r
-                       get { return this.GetInt32("server type"); }\r
-               }\r
-\r
-               public IsolationLevel IsolationLevel\r
-               {\r
-                       get { return this.GetIsolationLevel("isolation level"); }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public FbConnectionString()\r
-               {\r
-                       this.SetDefaultOptions();\r
-               }\r
-\r
-               public FbConnectionString(FbConnectionStringBuilder csb)\r
-                       : this(csb.ToString())\r
-               {\r
-               }\r
-\r
-               public FbConnectionString(string connectionString)\r
-               {\r
-                       this.Load(connectionString);\r
-               }\r
-\r
-               internal FbConnectionString(bool isServiceConnectionString)\r
-               {\r
-                       this.isServiceConnectionString = isServiceConnectionString;\r
-                       this.SetDefaultOptions();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Public methods\r
-\r
-               public void Load(string connectionString)\r
-               {\r
-                       this.SetDefaultOptions();\r
-\r
-                       if (connectionString != null && connectionString.Length > 0)\r
-                       {\r
-                               Hashtable synonyms = GetSynonyms();\r
-                               MatchCollection keyPairs = Regex.Matches(connectionString, @"([\w\s\d]*)\s*=\s*([^;]*)");\r
-\r
-                               foreach (Match keyPair in keyPairs)\r
-                               {\r
-                                       if (keyPair.Groups.Count == 3)\r
-                                       {\r
-                                               string[] values = new string[] \r
-                                               {\r
-                                                       keyPair.Groups[1].Value.Trim(),\r
-                                                       keyPair.Groups[2].Value.Trim()\r
-                                               };\r
-\r
-                                               if (values.Length == 2 &&\r
-                                                       values[0] != null && values[0].Length > 0 &&\r
-                                                       values[1] != null && values[1].Length > 0)\r
-                                               {\r
-                                                       values[0] = values[0].ToLower(CultureInfo.CurrentCulture);\r
-\r
-                                                       if (synonyms.Contains(values[0]))\r
-                                                       {\r
-                                                               string key = (string)synonyms[values[0]];\r
-                                                               this.options[key] = values[1].Trim();\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               if (this.Database != null && this.Database.Length > 0)\r
-                               {\r
-                                       this.ParseConnectionInfo(this.Database);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void Validate()\r
-               {\r
-                       if ((this.UserID == null || this.UserID.Length == 0) ||\r
-                               (this.Password == null || this.Password.Length == 0) ||\r
-                               ((this.Database == null || this.Database.Length == 0) && !this.isServiceConnectionString) ||\r
-                               ((this.DataSource == null || this.DataSource.Length == 0) && this.ServerType != 1) ||\r
-                               (this.Charset == null || this.Charset.Length == 0) ||\r
-                               this.Port == 0 ||\r
-                               (this.ServerType != 0 && this.ServerType != 1) ||\r
-                               (this.MinPoolSize > this.MaxPoolSize))\r
-                       {\r
-                               throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied.");\r
-                       }\r
-                       else\r
-                       {\r
-                               if (this.Dialect < 1 || this.Dialect > 3)\r
-                               {\r
-                                       throw new ArgumentException("Incorrect database dialect it should be 1, 2, or 3.");\r
-                               }\r
-                               if (this.PacketSize < 512 || this.PacketSize > 32767)\r
-                               {\r
-                                       throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "'Packet Size' value of {0} is not valid.\r\nThe value should be an integer >= 512 and <= 32767.", this.PacketSize));\r
-                               }\r
-\r
-                               this.CheckIsolationLevel();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void SetDefaultOptions()\r
-               {\r
-                       if (this.options == null)\r
-                       {\r
-                               this.options = new Hashtable();\r
-                       }\r
-\r
-                       this.options.Clear();\r
-\r
-                       // Add default key pairs values\r
-                       this.options.Add("data source", "");\r
-                       this.options.Add("port number", 3050);\r
-                       this.options.Add("user id", "SYSDBA");\r
-                       this.options.Add("password", "masterkey");\r
-                       this.options.Add("role name", String.Empty);\r
-                       this.options.Add("database", String.Empty);\r
-                       this.options.Add("charset", "None");\r
-                       this.options.Add("dialect", 3);\r
-                       this.options.Add("packet size", 8192);\r
-                       this.options.Add("pooling", true);\r
-                       this.options.Add("connection lifetime", 0);\r
-                       this.options.Add("min pool size", 0);\r
-                       this.options.Add("max pool size", 100);\r
-                       this.options.Add("connection timeout", 15);\r
-                       this.options.Add("fetch size", 200);\r
-                       this.options.Add("server type", 0);\r
-                       this.options.Add("isolation level", IsolationLevel.ReadCommitted.ToString());\r
-               }\r
-\r
-               private void ParseConnectionInfo(string connectInfo)\r
-               {\r
-                       string database = null;\r
-                       string dataSource = null;\r
-                       int portNumber = -1;\r
-\r
-                       // allows standard syntax //host:port/....\r
-                       // and old fb syntax host/port:....\r
-                       connectInfo = connectInfo.Trim();\r
-                       char hostSepChar;\r
-                       char portSepChar;\r
-\r
-                       if (connectInfo.StartsWith("//"))\r
-                       {\r
-                               connectInfo = connectInfo.Substring(2);\r
-                               hostSepChar = '/';\r
-                               portSepChar = ':';\r
-                       }\r
-                       else\r
-                       {\r
-                               hostSepChar = ':';\r
-                               portSepChar = '/';\r
-                       }\r
-\r
-                       int sep = connectInfo.IndexOf(hostSepChar);\r
-                       if (sep == 0 || sep == connectInfo.Length - 1)\r
-                       {\r
-                               throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied.");\r
-                       }\r
-                       else if (sep > 0)\r
-                       {\r
-                               dataSource = connectInfo.Substring(0, sep);\r
-                               database = connectInfo.Substring(sep + 1);\r
-                               int portSep = dataSource.IndexOf(portSepChar);\r
-\r
-                               if (portSep == 0 || portSep == dataSource.Length - 1)\r
-                               {\r
-                                       throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied.");\r
-                               }\r
-                               else if (portSep > 0)\r
-                               {\r
-                                       portNumber = Int32.Parse(dataSource.Substring(portSep + 1), CultureInfo.InvariantCulture);\r
-                                       dataSource = dataSource.Substring(0, portSep);\r
-                               }\r
-                               else if (portSep < 0 && dataSource.Length == 1)\r
-                               {\r
-                                       if (this.DataSource == null || this.DataSource.Length == 0)\r
-                                       {\r
-                                               dataSource = "localhost";\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               dataSource = null;\r
-                                       }\r
-\r
-                                       database = connectInfo;\r
-                               }\r
-                       }\r
-                       else if (sep == -1)\r
-                       {\r
-                               database = connectInfo;\r
-                       }\r
-\r
-                       this.options["database"] = database;\r
-                       if (dataSource != null)\r
-                       {\r
-                               this.options["data source"] = dataSource;\r
-                       }\r
-                       if (portNumber != -1)\r
-                       {\r
-                               this.options["port"] = portNumber;\r
-                       }\r
-               }\r
-\r
-               private string GetString(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return (string)this.options[key];\r
-                       }\r
-                       return null;\r
-               }\r
-\r
-               private bool GetBoolean(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Boolean.Parse(this.options[key].ToString());\r
-                       }\r
-                       return false;\r
-               }\r
-\r
-               private byte GetByte(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToByte(this.options[key], CultureInfo.CurrentCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private short GetInt16(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToInt16(this.options[key], CultureInfo.InvariantCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private int GetInt32(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToInt32(this.options[key], CultureInfo.InvariantCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private long GetInt64(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToInt64(this.options[key], CultureInfo.InvariantCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private IsolationLevel GetIsolationLevel(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               string il = this.options[key].ToString().ToLower(CultureInfo.CurrentCulture);\r
-                               switch (il)\r
-                               {\r
-                                       case "readcommitted":\r
-                                               return IsolationLevel.ReadCommitted;\r
-\r
-                                       case "readuncommitted":\r
-                                               return IsolationLevel.ReadUncommitted;\r
-\r
-                                       case "repeatableread":\r
-                                               return IsolationLevel.RepeatableRead;\r
-\r
-                                       case "serializable":\r
-                                               return IsolationLevel.Serializable;\r
-\r
-                                       case "chaos":\r
-                                               return IsolationLevel.Chaos;\r
-\r
-                                       case "unspecified":\r
-                                               return IsolationLevel.Unspecified;\r
-                               }\r
-                       }\r
-\r
-                       return IsolationLevel.ReadCommitted;\r
-               }\r
-\r
-               private void CheckIsolationLevel()\r
-               {\r
-                       string il = this.options["isolation level"].ToString().ToLower(CultureInfo.CurrentCulture);\r
-                       switch (il)\r
-                       {\r
-                               case "readcommitted":\r
-                               case "readuncommitted":\r
-                               case "repeatableread":\r
-                               case "serializable":\r
-                               case "chaos":\r
-                               case "unspecified":\r
-                                       break;\r
-\r
-                               default:\r
-                                       throw new ArgumentException("Specified Isolation Level is not valid.");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2004-2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Globalization;
+using System.Text.RegularExpressions;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       internal sealed class FbConnectionString
+       {
+               #region Static Fields
+
+               public static readonly Hashtable Synonyms = GetSynonyms();
+
+               #endregion
+
+               #region Static Methods
+
+               // This is somethig     that should     be needed in .NET 2.0
+               // for use with the     DbConnectionOptions     or DbConnectionString classes.
+               private static Hashtable GetSynonyms()
+               {
+                       Hashtable synonyms = new Hashtable();
+
+                       synonyms.Add("data source", "data source");
+                       synonyms.Add("datasource", "data source");
+                       synonyms.Add("server", "data source");
+                       synonyms.Add("host", "data source");
+                       synonyms.Add("port", "port number");
+                       synonyms.Add("port number", "port number");
+                       synonyms.Add("database", "database");
+                       synonyms.Add("user id", "user id");
+                       synonyms.Add("uid", "user id");
+                       synonyms.Add("user", "user id");
+                       synonyms.Add("user name", "user id");
+                       synonyms.Add("password", "password");
+                       synonyms.Add("user password", "password");
+                       synonyms.Add("dialect", "dialect");
+                       synonyms.Add("charset", "charset");
+                       synonyms.Add("pooling", "pooling");
+                       synonyms.Add("max pool size", "max pool size");
+                       synonyms.Add("min pool size", "min pool size");
+                       synonyms.Add("character set", "charset");
+                       synonyms.Add("connection lifetime", "connection lifetime");
+                       synonyms.Add("timeout", "connection timeout");
+                       synonyms.Add("connection timeout", "connection timeout");
+                       synonyms.Add("packet size", "packet size");
+                       synonyms.Add("role", "role name");
+                       synonyms.Add("role name", "role name");
+                       synonyms.Add("fetch size", "fetch size");
+                       synonyms.Add("fetchsize", "fetch size");
+                       synonyms.Add("server type", "server type");
+                       synonyms.Add("servertype", "server type");
+                       synonyms.Add("isolation level", "isolation level");
+
+                       return synonyms;
+               }
+
+               #endregion
+
+               #region Private fields
+
+               private Hashtable options;
+               private bool isServiceConnectionString;
+
+               #endregion
+
+               #region Properties
+
+               public string UserID
+               {
+                       get { return this.GetString("user id"); }
+               }
+
+               public string Password
+               {
+                       get { return this.GetString("password"); }
+               }
+
+               public string DataSource
+               {
+                       get { return this.GetString("data source"); }
+               }
+
+               public int Port
+               {
+                       get { return this.GetInt32("port number"); }
+               }
+
+               public string Database
+               {
+                       get { return this.GetString("database"); }
+               }
+
+               public short PacketSize
+               {
+                       get { return this.GetInt16("packet size"); }
+               }
+
+               public string Role
+               {
+                       get { return this.GetString("role name"); }
+               }
+
+               public byte Dialect
+               {
+                       get { return this.GetByte("dialect"); }
+               }
+
+               public string Charset
+               {
+                       get { return this.GetString("charset"); }
+               }
+
+               public int ConnectionTimeout
+               {
+                       get { return this.GetInt32("connection timeout"); }
+               }
+
+               public bool Pooling
+               {
+                       get { return this.GetBoolean("pooling"); }
+               }
+
+               public long ConnectionLifeTime
+               {
+                       get { return this.GetInt64("connection lifetime"); }
+               }
+
+               public int MinPoolSize
+               {
+                       get { return this.GetInt32("min pool size"); }
+               }
+
+               public int MaxPoolSize
+               {
+                       get { return this.GetInt32("max pool size"); }
+               }
+
+               public int FetchSize
+               {
+                       get { return this.GetInt32("fetch size"); }
+               }
+
+               public int ServerType
+               {
+                       get { return this.GetInt32("server type"); }
+               }
+
+               public IsolationLevel IsolationLevel
+               {
+                       get { return this.GetIsolationLevel("isolation level"); }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public FbConnectionString()
+               {
+                       this.SetDefaultOptions();
+               }
+
+               public FbConnectionString(FbConnectionStringBuilder csb)
+                       : this(csb.ToString())
+               {
+               }
+
+               public FbConnectionString(string connectionString)
+               {
+                       this.Load(connectionString);
+               }
+
+               internal FbConnectionString(bool isServiceConnectionString)
+               {
+                       this.isServiceConnectionString = isServiceConnectionString;
+                       this.SetDefaultOptions();
+               }
+
+               #endregion
+
+               #region Public methods
+
+               public void Load(string connectionString)
+               {
+                       this.SetDefaultOptions();
+
+                       if (connectionString != null && connectionString.Length > 0)
+                       {
+                               Hashtable synonyms = GetSynonyms();
+                               MatchCollection keyPairs = Regex.Matches(connectionString, @"([\w\s\d]*)\s*=\s*([^;]*)");
+
+                               foreach (Match keyPair in keyPairs)
+                               {
+                                       if (keyPair.Groups.Count == 3)
+                                       {
+                                               string[] values = new string[] 
+                                               {
+                                                       keyPair.Groups[1].Value.Trim(),
+                                                       keyPair.Groups[2].Value.Trim()
+                                               };
+
+                                               if (values.Length == 2 &&
+                                                       values[0] != null && values[0].Length > 0 &&
+                                                       values[1] != null && values[1].Length > 0)
+                                               {
+                                                       values[0] = values[0].ToLower(CultureInfo.CurrentCulture);
+
+                                                       if (synonyms.Contains(values[0]))
+                                                       {
+                                                               string key = (string)synonyms[values[0]];
+                                                               this.options[key] = values[1].Trim();
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               if (this.Database != null && this.Database.Length > 0)
+                               {
+                                       this.ParseConnectionInfo(this.Database);
+                               }
+                       }
+               }
+
+               public void Validate()
+               {
+                       if ((this.UserID == null || this.UserID.Length == 0) ||
+                               (this.Password == null || this.Password.Length == 0) ||
+                               ((this.Database == null || this.Database.Length == 0) && !this.isServiceConnectionString) ||
+                               ((this.DataSource == null || this.DataSource.Length == 0) && this.ServerType != 1) ||
+                               (this.Charset == null || this.Charset.Length == 0) ||
+                               this.Port == 0 ||
+                               (this.ServerType != 0 && this.ServerType != 1) ||
+                               (this.MinPoolSize > this.MaxPoolSize))
+                       {
+                               throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied.");
+                       }
+                       else
+                       {
+                               if (this.Dialect < 1 || this.Dialect > 3)
+                               {
+                                       throw new ArgumentException("Incorrect database dialect it should be 1, 2, or 3.");
+                               }
+                               if (this.PacketSize < 512 || this.PacketSize > 32767)
+                               {
+                                       throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "'Packet Size' value of {0} is not valid.\r\nThe value should be an integer >= 512 and <= 32767.", this.PacketSize));
+                               }
+
+                               this.CheckIsolationLevel();
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void SetDefaultOptions()
+               {
+                       if (this.options == null)
+                       {
+                               this.options = new Hashtable();
+                       }
+
+                       this.options.Clear();
+
+                       // Add default key pairs values
+                       this.options.Add("data source", "");
+                       this.options.Add("port number", 3050);
+                       this.options.Add("user id", "SYSDBA");
+                       this.options.Add("password", "masterkey");
+                       this.options.Add("role name", String.Empty);
+                       this.options.Add("database", String.Empty);
+                       this.options.Add("charset", "None");
+                       this.options.Add("dialect", 3);
+                       this.options.Add("packet size", 8192);
+                       this.options.Add("pooling", true);
+                       this.options.Add("connection lifetime", 0);
+                       this.options.Add("min pool size", 0);
+                       this.options.Add("max pool size", 100);
+                       this.options.Add("connection timeout", 15);
+                       this.options.Add("fetch size", 200);
+                       this.options.Add("server type", 0);
+                       this.options.Add("isolation level", IsolationLevel.ReadCommitted.ToString());
+               }
+
+               private void ParseConnectionInfo(string connectInfo)
+               {
+                       string database = null;
+                       string dataSource = null;
+                       int portNumber = -1;
+
+                       // allows standard syntax //host:port/....
+                       // and old fb syntax host/port:....
+                       connectInfo = connectInfo.Trim();
+                       char hostSepChar;
+                       char portSepChar;
+
+                       if (connectInfo.StartsWith("//"))
+                       {
+                               connectInfo = connectInfo.Substring(2);
+                               hostSepChar = '/';
+                               portSepChar = ':';
+                       }
+                       else
+                       {
+                               hostSepChar = ':';
+                               portSepChar = '/';
+                       }
+
+                       int sep = connectInfo.IndexOf(hostSepChar);
+                       if (sep == 0 || sep == connectInfo.Length - 1)
+                       {
+                               throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied.");
+                       }
+                       else if (sep > 0)
+                       {
+                               dataSource = connectInfo.Substring(0, sep);
+                               database = connectInfo.Substring(sep + 1);
+                               int portSep = dataSource.IndexOf(portSepChar);
+
+                               if (portSep == 0 || portSep == dataSource.Length - 1)
+                               {
+                                       throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied.");
+                               }
+                               else if (portSep > 0)
+                               {
+                                       portNumber = Int32.Parse(dataSource.Substring(portSep + 1), CultureInfo.InvariantCulture);
+                                       dataSource = dataSource.Substring(0, portSep);
+                               }
+                               else if (portSep < 0 && dataSource.Length == 1)
+                               {
+                                       if (this.DataSource == null || this.DataSource.Length == 0)
+                                       {
+                                               dataSource = "localhost";
+                                       }
+                                       else
+                                       {
+                                               dataSource = null;
+                                       }
+
+                                       database = connectInfo;
+                               }
+                       }
+                       else if (sep == -1)
+                       {
+                               database = connectInfo;
+                       }
+
+                       this.options["database"] = database;
+                       if (dataSource != null)
+                       {
+                               this.options["data source"] = dataSource;
+                       }
+                       if (portNumber != -1)
+                       {
+                               this.options["port"] = portNumber;
+                       }
+               }
+
+               private string GetString(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return (string)this.options[key];
+                       }
+                       return null;
+               }
+
+               private bool GetBoolean(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Boolean.Parse(this.options[key].ToString());
+                       }
+                       return false;
+               }
+
+               private byte GetByte(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToByte(this.options[key], CultureInfo.CurrentCulture);
+                       }
+                       return 0;
+               }
+
+               private short GetInt16(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToInt16(this.options[key], CultureInfo.InvariantCulture);
+                       }
+                       return 0;
+               }
+
+               private int GetInt32(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToInt32(this.options[key], CultureInfo.InvariantCulture);
+                       }
+                       return 0;
+               }
+
+               private long GetInt64(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToInt64(this.options[key], CultureInfo.InvariantCulture);
+                       }
+                       return 0;
+               }
+
+               private IsolationLevel GetIsolationLevel(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               string il = this.options[key].ToString().ToLower(CultureInfo.CurrentCulture);
+                               switch (il)
+                               {
+                                       case "readcommitted":
+                                               return IsolationLevel.ReadCommitted;
+
+                                       case "readuncommitted":
+                                               return IsolationLevel.ReadUncommitted;
+
+                                       case "repeatableread":
+                                               return IsolationLevel.RepeatableRead;
+
+                                       case "serializable":
+                                               return IsolationLevel.Serializable;
+
+                                       case "chaos":
+                                               return IsolationLevel.Chaos;
+
+                                       case "unspecified":
+                                               return IsolationLevel.Unspecified;
+                               }
+                       }
+
+                       return IsolationLevel.ReadCommitted;
+               }
+
+               private void CheckIsolationLevel()
+               {
+                       string il = this.options["isolation level"].ToString().ToLower(CultureInfo.CurrentCulture);
+                       switch (il)
+                       {
+                               case "readcommitted":
+                               case "readuncommitted":
+                               case "repeatableread":
+                               case "serializable":
+                               case "chaos":
+                               case "unspecified":
+                                       break;
+
+                               default:
+                                       throw new ArgumentException("Specified Isolation Level is not valid.");
+                       }
+               }
+
+               #endregion
+       }
+}
index 740d00b63b0c1cb10aa6140efaba623abcbf86ce..3295b9c449a8b9b8fecedf24446d7a8c804bf39c 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2004 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.Text;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/overview/*'/>\r
-       public sealed class FbConnectionStringBuilder\r
-       {\r
-               #region Private fields\r
-\r
-               private Hashtable options;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ConnectionString"]/*'/>\r
-               public string ConnectionString\r
-               {\r
-                       get { return this.ToString(); }\r
-                       set { this.Load(value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="UserID"]/*'/>\r
-               public string UserID\r
-               {\r
-                       get { return this.GetString("user id"); }\r
-                       set { this.SetValue("user id", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Password"]/*'/>\r
-               public string Password\r
-               {\r
-                       get { return this.GetString("password"); }\r
-                       set { this.SetValue("password", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="DataSource"]/*'/>\r
-               public string DataSource\r
-               {\r
-                       get { return this.GetString("data source"); }\r
-                       set { this.SetValue("data source", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Port"]/*'/>\r
-               public int Port\r
-               {\r
-                       get { return this.GetInt32("port number"); }\r
-                       set { this.SetValue("port number", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Database"]/*'/>\r
-               public string Database\r
-               {\r
-                       get { return this.GetString("database"); }\r
-                       set { this.SetValue("database", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="PacketSize"]/*'/>\r
-               public short PacketSize\r
-               {\r
-                       get { return this.GetInt16("packet size"); }\r
-                       set { this.SetValue("packet size", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Role"]/*'/>\r
-               public string Role\r
-               {\r
-                       get { return this.GetString("role name"); }\r
-                       set\r
-                       {\r
-                               if (value == null)\r
-                               {\r
-                                       value = String.Empty;\r
-                               }\r
-                               this.SetValue("role name", value);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Dialect"]/*'/>\r
-               public byte Dialect\r
-               {\r
-                       get { return this.GetByte("dialect"); }\r
-                       set { this.SetValue("dialect", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Charset"]/*'/>\r
-               public string Charset\r
-               {\r
-                       get { return this.GetString("charset"); }\r
-                       set { this.SetValue("charset", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ConnectionTimeout"]/*'/>\r
-               public int ConnectionTimeout\r
-               {\r
-                       get { return this.GetInt32("connection timeout"); }\r
-                       set { this.SetValue("connection timeout", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Pooling"]/*'/>\r
-               public bool Pooling\r
-               {\r
-                       get { return this.GetBoolean("pooling"); }\r
-                       set { this.SetValue("pooling", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ConnectionLifeTime"]/*'/>\r
-               public long ConnectionLifeTime\r
-               {\r
-                       get { return this.GetInt64("connection lifetime"); }\r
-                       set { this.SetValue("connection lifetime", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="MinPoolSize"]/*'/>\r
-               public int MinPoolSize\r
-               {\r
-                       get { return this.GetInt32("min pool size"); }\r
-                       set { this.SetValue("min pool size", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="MaxPoolSize"]/*'/>\r
-               public int MaxPoolSize\r
-               {\r
-                       get { return this.GetInt32("max pool size"); }\r
-                       set { this.SetValue("max pool size", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="FetchSize"]/*'/>\r
-               public int FetchSize\r
-               {\r
-                       get { return this.GetInt32("fetch size"); }\r
-                       set { this.SetValue("fetch size", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ServerType"]/*'/>\r
-               public int ServerType\r
-               {\r
-                       get { return this.GetInt32("server type"); }\r
-                       set { this.SetValue("server type", value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="IsolationLevel"]/*'/>\r
-               public IsolationLevel IsolationLevel\r
-               {\r
-                       get { return this.GetIsolationLevel("isolation level"); }\r
-                       set { this.SetValue("isolation level", value.ToString()); }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/constructor[@name="ctor"]/*'/>\r
-               public FbConnectionStringBuilder() : this(null)\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/constructor[@name="ctor(System.String)"]/*'/>\r
-               public FbConnectionStringBuilder(string connectionString)\r
-               {\r
-                       this.options = new Hashtable();\r
-\r
-                       if (connectionString != null && connectionString.Length > 0)\r
-                       {\r
-                               this.Load(connectionString);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Overriden methods\r
-\r
-               /// <summary>\r
-               /// Overrided method, returns the Firebird connection string.\r
-               /// </summary>\r
-               /// <returns>The Firebird connection string.</returns>\r
-               public override string ToString()\r
-               {\r
-                       StringBuilder cs = new StringBuilder();\r
-\r
-                       IDictionaryEnumerator e = this.options.GetEnumerator();\r
-                       while (e.MoveNext())\r
-                       {\r
-                               if (e.Value != null)\r
-                               {\r
-                                       if (cs.Length > 0)\r
-                                       {\r
-                                               cs.Append(";");\r
-                                       }\r
-                                       string key = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(e.Key.ToString());\r
-                                       cs.AppendFormat(CultureInfo.CurrentCulture, "{0}={1}", key, e.Value);\r
-                               }\r
-                       }\r
-\r
-                       return cs.ToString();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void Load(string connectionString)\r
-               {\r
-                       string[]        keyPairs = connectionString.Split(';');\r
-                       Hashtable       synonyms = FbConnectionString.Synonyms;\r
-\r
-                       if (this.options != null)\r
-                       {\r
-                               this.options.Clear();\r
-                       }\r
-\r
-                       foreach (string keyPair in keyPairs)\r
-                       {\r
-                               string[] values = keyPair.Split('=');\r
-\r
-                               if (values.Length == 2 &&\r
-                                       values[0] != null && values[0].Length > 0 &&\r
-                                       values[1] != null && values[1].Length > 0)\r
-                               {\r
-                                       values[0] = values[0].ToLower(CultureInfo.CurrentCulture).Trim();\r
-\r
-                                       if (synonyms.Contains(values[0]))\r
-                                       {\r
-                                               string key = (string)synonyms[values[0]];\r
-                                               this.options[key] = values[1].Trim();\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private string GetString(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return (string)this.options[key];\r
-                       }\r
-                       return null;\r
-               }\r
-\r
-               private bool GetBoolean(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Boolean.Parse(this.options[key].ToString());\r
-                       }\r
-                       return false;\r
-               }\r
-\r
-               private byte GetByte(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToByte(this.options[key], CultureInfo.InvariantCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private short GetInt16(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToInt16(this.options[key], CultureInfo.InvariantCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private int GetInt32(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToInt32(this.options[key], CultureInfo.InvariantCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private long GetInt64(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               return Convert.ToInt64(this.options[key], CultureInfo.InvariantCulture);\r
-                       }\r
-                       return 0;\r
-               }\r
-\r
-               private void SetValue(string key, object value)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               this.options[key] = value;\r
-                       }\r
-                       else\r
-                       {\r
-                               this.options.Add(key, value);\r
-                       }\r
-               }\r
-\r
-               private IsolationLevel GetIsolationLevel(string key)\r
-               {\r
-                       if (this.options.Contains(key))\r
-                       {\r
-                               string il = this.options[key].ToString().ToLower(CultureInfo.CurrentCulture);\r
-                               switch (il)\r
-                               {\r
-                                       case "readcommitted":\r
-                                               return IsolationLevel.ReadCommitted;\r
-\r
-                                       case "readuncommitted":\r
-                                               return IsolationLevel.ReadUncommitted;\r
-\r
-                                       case "repeatableread":\r
-                                               return IsolationLevel.RepeatableRead;\r
-\r
-                                       case "serializable":\r
-                                               return IsolationLevel.Serializable;\r
-\r
-                                       case "chaos":\r
-                                               return IsolationLevel.Chaos;\r
-\r
-                                       case "unspecified":\r
-                                               return IsolationLevel.Unspecified;\r
-                               }\r
-                       }\r
-                       return IsolationLevel.ReadCommitted;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2004 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Globalization;
+using System.Text;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/overview/*'/>
+       public sealed class FbConnectionStringBuilder
+       {
+               #region Private fields
+
+               private Hashtable options;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ConnectionString"]/*'/>
+               public string ConnectionString
+               {
+                       get { return this.ToString(); }
+                       set { this.Load(value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="UserID"]/*'/>
+               public string UserID
+               {
+                       get { return this.GetString("user id"); }
+                       set { this.SetValue("user id", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Password"]/*'/>
+               public string Password
+               {
+                       get { return this.GetString("password"); }
+                       set { this.SetValue("password", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="DataSource"]/*'/>
+               public string DataSource
+               {
+                       get { return this.GetString("data source"); }
+                       set { this.SetValue("data source", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Port"]/*'/>
+               public int Port
+               {
+                       get { return this.GetInt32("port number"); }
+                       set { this.SetValue("port number", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Database"]/*'/>
+               public string Database
+               {
+                       get { return this.GetString("database"); }
+                       set { this.SetValue("database", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="PacketSize"]/*'/>
+               public short PacketSize
+               {
+                       get { return this.GetInt16("packet size"); }
+                       set { this.SetValue("packet size", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Role"]/*'/>
+               public string Role
+               {
+                       get { return this.GetString("role name"); }
+                       set
+                       {
+                               if (value == null)
+                               {
+                                       value = String.Empty;
+                               }
+                               this.SetValue("role name", value);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Dialect"]/*'/>
+               public byte Dialect
+               {
+                       get { return this.GetByte("dialect"); }
+                       set { this.SetValue("dialect", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Charset"]/*'/>
+               public string Charset
+               {
+                       get { return this.GetString("charset"); }
+                       set { this.SetValue("charset", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ConnectionTimeout"]/*'/>
+               public int ConnectionTimeout
+               {
+                       get { return this.GetInt32("connection timeout"); }
+                       set { this.SetValue("connection timeout", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="Pooling"]/*'/>
+               public bool Pooling
+               {
+                       get { return this.GetBoolean("pooling"); }
+                       set { this.SetValue("pooling", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ConnectionLifeTime"]/*'/>
+               public long ConnectionLifeTime
+               {
+                       get { return this.GetInt64("connection lifetime"); }
+                       set { this.SetValue("connection lifetime", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="MinPoolSize"]/*'/>
+               public int MinPoolSize
+               {
+                       get { return this.GetInt32("min pool size"); }
+                       set { this.SetValue("min pool size", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="MaxPoolSize"]/*'/>
+               public int MaxPoolSize
+               {
+                       get { return this.GetInt32("max pool size"); }
+                       set { this.SetValue("max pool size", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="FetchSize"]/*'/>
+               public int FetchSize
+               {
+                       get { return this.GetInt32("fetch size"); }
+                       set { this.SetValue("fetch size", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="ServerType"]/*'/>
+               public int ServerType
+               {
+                       get { return this.GetInt32("server type"); }
+                       set { this.SetValue("server type", value); }
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/property[@name="IsolationLevel"]/*'/>
+               public IsolationLevel IsolationLevel
+               {
+                       get { return this.GetIsolationLevel("isolation level"); }
+                       set { this.SetValue("isolation level", value.ToString()); }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/constructor[@name="ctor"]/*'/>
+               public FbConnectionStringBuilder() : this(null)
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbConnectionStringBuilder.xml'     path='doc/class[@name="FbConnectionStringBuilder"]/constructor[@name="ctor(System.String)"]/*'/>
+               public FbConnectionStringBuilder(string connectionString)
+               {
+                       this.options = new Hashtable();
+
+                       if (connectionString != null && connectionString.Length > 0)
+                       {
+                               this.Load(connectionString);
+                       }
+               }
+
+               #endregion
+
+               #region Overriden methods
+
+               /// <summary>
+               /// Overrided method, returns the Firebird connection string.
+               /// </summary>
+               /// <returns>The Firebird connection string.</returns>
+               public override string ToString()
+               {
+                       StringBuilder cs = new StringBuilder();
+
+                       IDictionaryEnumerator e = this.options.GetEnumerator();
+                       while (e.MoveNext())
+                       {
+                               if (e.Value != null)
+                               {
+                                       if (cs.Length > 0)
+                                       {
+                                               cs.Append(";");
+                                       }
+                                       string key = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(e.Key.ToString());
+                                       cs.AppendFormat(CultureInfo.CurrentCulture, "{0}={1}", key, e.Value);
+                               }
+                       }
+
+                       return cs.ToString();
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void Load(string connectionString)
+               {
+                       string[]        keyPairs = connectionString.Split(';');
+                       Hashtable       synonyms = FbConnectionString.Synonyms;
+
+                       if (this.options != null)
+                       {
+                               this.options.Clear();
+                       }
+
+                       foreach (string keyPair in keyPairs)
+                       {
+                               string[] values = keyPair.Split('=');
+
+                               if (values.Length == 2 &&
+                                       values[0] != null && values[0].Length > 0 &&
+                                       values[1] != null && values[1].Length > 0)
+                               {
+                                       values[0] = values[0].ToLower(CultureInfo.CurrentCulture).Trim();
+
+                                       if (synonyms.Contains(values[0]))
+                                       {
+                                               string key = (string)synonyms[values[0]];
+                                               this.options[key] = values[1].Trim();
+                                       }
+                               }
+                       }
+               }
+
+               private string GetString(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return (string)this.options[key];
+                       }
+                       return null;
+               }
+
+               private bool GetBoolean(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Boolean.Parse(this.options[key].ToString());
+                       }
+                       return false;
+               }
+
+               private byte GetByte(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToByte(this.options[key], CultureInfo.InvariantCulture);
+                       }
+                       return 0;
+               }
+
+               private short GetInt16(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToInt16(this.options[key], CultureInfo.InvariantCulture);
+                       }
+                       return 0;
+               }
+
+               private int GetInt32(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToInt32(this.options[key], CultureInfo.InvariantCulture);
+                       }
+                       return 0;
+               }
+
+               private long GetInt64(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               return Convert.ToInt64(this.options[key], CultureInfo.InvariantCulture);
+                       }
+                       return 0;
+               }
+
+               private void SetValue(string key, object value)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               this.options[key] = value;
+                       }
+                       else
+                       {
+                               this.options.Add(key, value);
+                       }
+               }
+
+               private IsolationLevel GetIsolationLevel(string key)
+               {
+                       if (this.options.Contains(key))
+                       {
+                               string il = this.options[key].ToString().ToLower(CultureInfo.CurrentCulture);
+                               switch (il)
+                               {
+                                       case "readcommitted":
+                                               return IsolationLevel.ReadCommitted;
+
+                                       case "readuncommitted":
+                                               return IsolationLevel.ReadUncommitted;
+
+                                       case "repeatableread":
+                                               return IsolationLevel.RepeatableRead;
+
+                                       case "serializable":
+                                               return IsolationLevel.Serializable;
+
+                                       case "chaos":
+                                               return IsolationLevel.Chaos;
+
+                                       case "unspecified":
+                                               return IsolationLevel.Unspecified;
+                               }
+                       }
+                       return IsolationLevel.ReadCommitted;
+               }
+
+               #endregion
+       }
+}
index 56641ab49fc6161ab45b584c971b9b6123036902..7d6848f102195571ef2aef99211c71be83a2187a 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.ComponentModel;\r
-using System.Data;\r
-using System.Data.Common;\r
-using System.Drawing;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/overview/*'/>\r
-#if    (NET)\r
-       [ToolboxItem(true)]\r
-       [ToolboxBitmap(typeof(FbDataAdapter), "Resources.FbDataAdapter.bmp")]\r
-       [DefaultEvent("RowUpdated")]\r
-       [DesignerAttribute(typeof(Design.FbDataAdapterDesigner), typeof(System.ComponentModel.Design.IDesigner))]\r
-#endif\r
-       public sealed class FbDataAdapter : DbDataAdapter, IDbDataAdapter\r
-       {\r
-               #region Static Fields\r
-\r
-               private static readonly object EventRowUpdated = new object();\r
-               private static readonly object EventRowUpdating = new object();\r
-\r
-               #endregion\r
-\r
-               #region Events\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/event[@name="RowUpdated"]/*'/>\r
-               public event FbRowUpdatedEventHandler RowUpdated\r
-               {\r
-                       add { base.Events.AddHandler(EventRowUpdated, value); }\r
-                       remove { base.Events.RemoveHandler(EventRowUpdated, value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/event[@name="RowUpdating"]/*'/>\r
-               public event FbRowUpdatingEventHandler RowUpdating\r
-               {\r
-                       add\r
-                       {\r
-                               base.Events.AddHandler(EventRowUpdating, value);\r
-                       }\r
-\r
-                       remove\r
-                       {\r
-                               base.Events.RemoveHandler(EventRowUpdating, value);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private FbCommand selectCommand;\r
-               private FbCommand insertCommand;\r
-               private FbCommand updateCommand;\r
-               private FbCommand deleteCommand;\r
-\r
-               private bool disposed;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               IDbCommand IDbDataAdapter.SelectCommand\r
-               {\r
-                       get { return this.selectCommand; }\r
-                       set { this.selectCommand = (FbCommand)value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="SelectCommand"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Fill"), DefaultValue(null)]\r
-#endif\r
-               public FbCommand SelectCommand\r
-               {\r
-                       get { return this.selectCommand; }\r
-                       set { this.selectCommand = value; }\r
-               }\r
-\r
-               IDbCommand IDbDataAdapter.InsertCommand\r
-               {\r
-                       get { return this.insertCommand; }\r
-                       set { this.insertCommand = (FbCommand)value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="InsertCommand"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Update"), DefaultValue(null)]\r
-#endif\r
-               public FbCommand InsertCommand\r
-               {\r
-                       get { return this.insertCommand; }\r
-                       set { this.insertCommand = value; }\r
-               }\r
-\r
-               IDbCommand IDbDataAdapter.UpdateCommand\r
-               {\r
-                       get { return this.updateCommand; }\r
-                       set { this.updateCommand = (FbCommand)value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="UpdateCommand"]/*'/>             \r
-#if    (!NETCF)\r
-               [Category("Update"), DefaultValue(null)]\r
-#endif\r
-               public FbCommand UpdateCommand\r
-               {\r
-                       get { return this.updateCommand; }\r
-                       set { this.updateCommand = value; }\r
-               }\r
-\r
-               IDbCommand IDbDataAdapter.DeleteCommand\r
-               {\r
-                       get { return this.deleteCommand; }\r
-                       set { this.deleteCommand = (FbCommand)value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="DeleteCommand"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Update"), DefaultValue(null)]\r
-#endif\r
-               public FbCommand DeleteCommand\r
-               {\r
-                       get { return this.deleteCommand; }\r
-                       set { this.deleteCommand = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor"]/*'/>\r
-               public FbDataAdapter() : base()\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor(FbCommand)"]/*'/>\r
-               public FbDataAdapter(FbCommand selectCommand) : base()\r
-               {\r
-                       this.SelectCommand = selectCommand;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor(System.String,FbConnection)"]/*'/>               \r
-               public FbDataAdapter(string selectCommandText, FbConnection selectConnection)\r
-                       : base()\r
-               {\r
-                       this.SelectCommand = new FbCommand(selectCommandText, selectConnection);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor(System.String,System.String)"]/*'/>\r
-               public FbDataAdapter(string selectCommandText, string selectConnectionString)\r
-                       : base()\r
-               {\r
-                       FbConnection connection = new FbConnection(selectConnectionString);\r
-                       this.SelectCommand = new FbCommand(selectCommandText, connection);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="Dispose(System.Boolean)"]/*'/>\r
-               protected override void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.disposed)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // Release any managed resources\r
-                                               if (disposing)\r
-                                               {\r
-                                                       if (this.SelectCommand != null)\r
-                                                       {\r
-                                                               this.SelectCommand.Dispose();\r
-                                                       }\r
-                                                       if (this.InsertCommand != null)\r
-                                                       {\r
-                                                               this.InsertCommand.Dispose();\r
-                                                       }\r
-                                                       if (this.UpdateCommand != null)\r
-                                                       {\r
-                                                               this.UpdateCommand.Dispose();\r
-                                                       }\r
-                                               }\r
-\r
-                                               // release any unmanaged resources\r
-\r
-                                               this.disposed = true;\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               base.Dispose(disposing);\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="CreateRowUpdatingEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)"]/*'/>\r
-               protected override RowUpdatingEventArgs CreateRowUpdatingEvent(\r
-                       DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)\r
-               {\r
-                       return new FbRowUpdatingEventArgs(dataRow, command, statementType, tableMapping);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="CreateRowUpdatedEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)"]/*'/>\r
-               protected override RowUpdatedEventArgs CreateRowUpdatedEvent(\r
-                       DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)\r
-               {\r
-                       return new FbRowUpdatedEventArgs(dataRow, command, statementType, tableMapping);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="OnRowUpdating(System.Data.Common.RowUpdatingEventArgs)"]/*'/>\r
-               protected override void OnRowUpdating(RowUpdatingEventArgs value)\r
-               {\r
-                       FbRowUpdatingEventHandler handler = null;\r
-\r
-                       handler = (FbRowUpdatingEventHandler)base.Events[EventRowUpdating];\r
-\r
-                       if ((null != handler) &&\r
-                               (value is FbRowUpdatingEventArgs) &&\r
-                               (value != null))\r
-                       {\r
-                               handler(this, (FbRowUpdatingEventArgs)value);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="OnRowUpdated(System.Data.Common.RowUpdatedEventArgs)"]/*'/>\r
-               protected override void OnRowUpdated(RowUpdatedEventArgs value)\r
-               {\r
-                       FbRowUpdatedEventHandler handler = null;\r
-\r
-                       handler = (FbRowUpdatedEventHandler)base.Events[EventRowUpdated];\r
-\r
-                       if ((handler != null) &&\r
-                               (value is FbRowUpdatedEventArgs) &&\r
-                               (value != null))\r
-                       {\r
-                               handler(this, (FbRowUpdatedEventArgs)value);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Update DataRow Collection\r
-\r
-               /// <summary>\r
-               /// Review .NET Framework documentation.\r
-               /// </summary>\r
-               protected override int Update(DataRow[] dataRows, DataTableMapping tableMapping)\r
-               {\r
-                       int                                             updated                 = 0;\r
-                       IDbCommand                              command                 = null;\r
-                       StatementType                   statementType   = StatementType.Insert;\r
-                       ArrayList                               connections             = new ArrayList();\r
-                       RowUpdatingEventArgs    updatingArgs    = null;\r
-                       Exception                               updateException = null;\r
-\r
-                       foreach (DataRow row in dataRows)\r
-                       {\r
-                               if (row.RowState == DataRowState.Detached ||\r
-                                       row.RowState == DataRowState.Unchanged)\r
-                               {\r
-                                       continue;\r
-                               }\r
-\r
-                               switch (row.RowState)\r
-                               {\r
-                                       case DataRowState.Added:\r
-                                               command = this.insertCommand;\r
-                                               statementType = StatementType.Insert;\r
-                                               break;\r
-\r
-                                       case DataRowState.Modified:\r
-                                               command = this.updateCommand;\r
-                                               statementType = StatementType.Update;\r
-                                               break;\r
-\r
-                                       case DataRowState.Deleted:\r
-                                               command = this.deleteCommand;\r
-                                               statementType = StatementType.Delete;\r
-                                               break;\r
-                               }\r
-\r
-                               /* The order of execution can be reviewed in the .NET 1.1 documentation\r
-                                       *\r
-                                       * 1. The values in      the     DataRow are     moved to the parameter values. \r
-                                       * 2. The OnRowUpdating  event is raised. \r
-                                       * 3. The command executes.      \r
-                                       * 4. If the command is  set     to FirstReturnedRecord, then the first returned result is placed in     the     DataRow. \r
-                                       * 5. If there are output parameters, they are placed in the DataRow. \r
-                                       * 6. The OnRowUpdated event is  raised. \r
-                                       * 7 AcceptChanges is called. \r
-                                       */\r
-\r
-                               try\r
-                               {\r
-                                       /* 1. Update Parameter values (It's     very similar to what we \r
-                                        * are doing in the     FbCommandBuilder class).\r
-                                        *\r
-                                        * Only input parameters should be updated.\r
-                                        */\r
-                                       if (command != null && command.Parameters.Count > 0)\r
-                                       {\r
-                                               this.UpdateParameterValues(command, statementType, row, tableMapping);\r
-                                       }\r
-\r
-                                       // 2. Raise     RowUpdating     event\r
-                                       updatingArgs = this.CreateRowUpdatingEvent(row, command, statementType, tableMapping);\r
-                                       this.OnRowUpdating(updatingArgs);\r
-\r
-                                       if (updatingArgs.Status == UpdateStatus.SkipAllRemainingRows)\r
-                                       {\r
-                                               break;\r
-                                       }\r
-                                       else if (updatingArgs.Status == UpdateStatus.ErrorsOccurred)\r
-                                       {\r
-                                               if (updatingArgs.Errors == null)\r
-                                               {\r
-                                                       throw new InvalidOperationException("RowUpdatingEvent: Errors occurred; no additional is information available.");\r
-                                               }\r
-                                               throw updatingArgs.Errors;\r
-                                       }\r
-                                       else if (updatingArgs.Status == UpdateStatus.SkipCurrentRow)\r
-                                       {\r
-                                       }\r
-                                       else if (updatingArgs.Status == UpdateStatus.Continue)\r
-                                       {\r
-                                               if (command != updatingArgs.Command)\r
-                                               {\r
-                                                       command = updatingArgs.Command;\r
-                                               }\r
-                                               if (command == null)\r
-                                               {\r
-                                                       /* Samples of exceptions thrown by DbDataAdapter class\r
-                                                               *\r
-                                                               *       Update requires a valid InsertCommand when passed DataRow collection with new rows\r
-                                                               *       Update requires a valid UpdateCommand when passed DataRow collection with modified rows.\r
-                                                               *       Update requires a valid DeleteCommand when passed DataRow collection with deleted rows.\r
-                                                               */\r
-                                                       string message = this.CreateExceptionMessage(statementType);\r
-                                                       throw new InvalidOperationException(message);\r
-                                               }\r
-\r
-                                               /* Validate that the command has a connection */\r
-                                               if (command.Connection == null)\r
-                                               {\r
-                                                       throw new InvalidOperationException("Update requires a command with a valid connection.");\r
-                                               }\r
-\r
-                                               // 3. Execute the command\r
-                                               if (command.Connection.State == ConnectionState.Closed)\r
-                                               {\r
-                                                       command.Connection.Open();\r
-                                                       // Track command connection\r
-                                                       connections.Add(command.Connection);\r
-                                               }\r
-\r
-                                               int rowsAffected = command.ExecuteNonQuery();\r
-                                               if (rowsAffected == 0)\r
-                                               {\r
-                                                       throw new DBConcurrencyException("An attempt to execute an INSERT, UPDATE, or DELETE statement resulted in zero records affected.");\r
-                                               }\r
-\r
-                                               updated++;\r
-\r
-                                               /* 4. If the command is set     to FirstReturnedRecord, then the \r
-                                                       * first returned result is      placed in the DataRow. \r
-                                                       * \r
-                                                       * We have nothing to do in      this case as there are no \r
-                                                       * support for batch commands.\r
-                                                       */\r
-\r
-                                               /* 5. Check     if we have output parameters and they should \r
-                                                       * be updated.\r
-                                                       *\r
-                                                       * Only  output paraneters should be     updated\r
-                                                       */\r
-                                               if (command.UpdatedRowSource == UpdateRowSource.OutputParameters ||\r
-                                                       command.UpdatedRowSource == UpdateRowSource.Both)\r
-                                               {\r
-                                                       // Process output parameters\r
-                                                       foreach (IDataParameter parameter in command.Parameters)\r
-                                                       {\r
-                                                               if ((parameter.Direction == ParameterDirection.Output ||\r
-                                                                       parameter.Direction == ParameterDirection.ReturnValue ||\r
-                                                                       parameter.Direction == ParameterDirection.InputOutput) &&\r
-                                                                       parameter.SourceColumn != null &&\r
-                                                                       parameter.SourceColumn.Length > 0)\r
-                                                               {\r
-                                                                       DataColumn column = null;\r
-\r
-                                                                       DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction(\r
-                                                                               parameter.SourceColumn,\r
-                                                                               this.MissingMappingAction);\r
-\r
-                                                                       if (columnMapping != null)\r
-                                                                       {\r
-                                                                               column = columnMapping.GetDataColumnBySchemaAction(\r
-                                                                                       row.Table,\r
-                                                                                       null,\r
-                                                                                       this.MissingSchemaAction);\r
-\r
-                                                                               if (column != null)\r
-                                                                               {\r
-                                                                                       row[column] = parameter.Value;\r
-                                                                               }\r
-                                                                       }\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                               catch (Exception ex)\r
-                               {\r
-                                       row.RowError    = ex.Message;\r
-                                       updateException = ex;\r
-                               }\r
-\r
-                               if (updatingArgs.Status == UpdateStatus.Continue)\r
-                               {\r
-                                       // 6. Raise     RowUpdated event\r
-                                       RowUpdatedEventArgs     updatedArgs = this.CreateRowUpdatedEvent(row, command, statementType, tableMapping);\r
-                                       this.OnRowUpdated(updatedArgs);\r
-\r
-                                       if (updatedArgs.Status == UpdateStatus.SkipAllRemainingRows)\r
-                                       {\r
-                                               break;\r
-                                       }\r
-                                       else if (updatedArgs.Status == UpdateStatus.ErrorsOccurred)\r
-                                       {\r
-                                               if (updatingArgs.Errors == null)\r
-                                               {\r
-                                                       throw new InvalidOperationException("RowUpdatedEvent: Errors occurred; no additional information available.");\r
-                                               }\r
-                                               throw updatedArgs.Errors;\r
-                                       }\r
-                                       else if (updatedArgs.Status == UpdateStatus.SkipCurrentRow)\r
-                                       {\r
-                                       }\r
-                                       else if (updatingArgs.Status == UpdateStatus.Continue)\r
-                                       {\r
-                                               // If the update result is an exception throw it\r
-                                               if (!this.ContinueUpdateOnError && updateException != null)\r
-                                               {\r
-                                                       this.CloseConnections(connections);\r
-                                                       throw updateException;\r
-                                               }\r
-\r
-                                               // 7. Call AcceptChanges\r
-                                               row.AcceptChanges();\r
-                                       }\r
-                               }\r
-                               else\r
-                               {\r
-                                       // If the update result is an exception throw it\r
-                                       if (!this.ContinueUpdateOnError && updateException != null)\r
-                                       {\r
-                                               this.CloseConnections(connections);\r
-                                               throw updateException;\r
-                                       }\r
-                               }\r
-\r
-                               updateException = null;\r
-                       }\r
-\r
-                       this.CloseConnections(connections);\r
-\r
-                       return updated;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private string CreateExceptionMessage(StatementType statementType)\r
-               {\r
-                       System.Text.StringBuilder sb = new System.Text.StringBuilder();\r
-\r
-                       sb.Append("Update requires a valid ");\r
-                       sb.Append(statementType.ToString());\r
-                       sb.Append("Command when passed DataRow collection with ");\r
-\r
-                       switch (statementType)\r
-                       {\r
-                               case StatementType.Insert:\r
-                                       sb.Append("new");\r
-                                       break;\r
-\r
-                               case StatementType.Update:\r
-                                       sb.Append("modified");\r
-                                       break;\r
-\r
-                               case StatementType.Delete:\r
-                                       sb.Append("deleted");\r
-                                       break;\r
-                       }\r
-\r
-                       sb.Append(" rows.");\r
-\r
-                       return sb.ToString();\r
-               }\r
-\r
-               private void UpdateParameterValues(\r
-                       IDbCommand command,\r
-                       StatementType statementType,\r
-                       DataRow row,\r
-                       DataTableMapping tableMapping)\r
-               {\r
-                       foreach (IDataParameter parameter in command.Parameters)\r
-                       {\r
-                               // Process only input parameters\r
-                               if (parameter.Direction != ParameterDirection.Input &&\r
-                                       parameter.Direction != ParameterDirection.InputOutput)\r
-                               {\r
-                                       continue;\r
-                               }\r
-\r
-                               DataColumn column = null;\r
-\r
-                               /* Get the DataColumnMapping that matches the given\r
-                                * column name\r
-                                */\r
-                               DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction(\r
-                                       parameter.SourceColumn,\r
-                                       this.MissingMappingAction);\r
-\r
-                               if (columnMapping != null)\r
-                               {\r
-                                       column = columnMapping.GetDataColumnBySchemaAction(\r
-                                               row.Table,\r
-                                               null,\r
-                                               this.MissingSchemaAction);\r
-\r
-                                       if (column != null)\r
-                                       {\r
-                                               DataRowVersion dataRowVersion = DataRowVersion.Default;\r
-\r
-                                               if (statementType == StatementType.Insert)\r
-                                               {\r
-                                                       dataRowVersion = DataRowVersion.Current;\r
-                                               }\r
-                                               else if (statementType == StatementType.Update)\r
-                                               {\r
-                                                       dataRowVersion = parameter.SourceVersion;\r
-                                               }\r
-                                               else if (statementType == StatementType.Delete)\r
-                                               {\r
-                                                       dataRowVersion = DataRowVersion.Original;\r
-                                               }\r
-\r
-                                               parameter.Value = row[column, dataRowVersion];\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private void CloseConnections(ArrayList connections)\r
-               {\r
-                       foreach (IDbConnection c in connections)\r
-                       {\r
-                               c.Close();\r
-                       }\r
-                       connections.Clear();\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Drawing;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/overview/*'/>
+#if    (NET)
+       [ToolboxItem(true)]
+       [ToolboxBitmap(typeof(FbDataAdapter), "Resources.FbDataAdapter.bmp")]
+       [DefaultEvent("RowUpdated")]
+       [DesignerAttribute(typeof(Design.FbDataAdapterDesigner), typeof(System.ComponentModel.Design.IDesigner))]
+#endif
+       public sealed class FbDataAdapter : DbDataAdapter, IDbDataAdapter
+       {
+               #region Static Fields
+
+               private static readonly object EventRowUpdated = new object();
+               private static readonly object EventRowUpdating = new object();
+
+               #endregion
+
+               #region Events
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/event[@name="RowUpdated"]/*'/>
+               public event FbRowUpdatedEventHandler RowUpdated
+               {
+                       add { base.Events.AddHandler(EventRowUpdated, value); }
+                       remove { base.Events.RemoveHandler(EventRowUpdated, value); }
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/event[@name="RowUpdating"]/*'/>
+               public event FbRowUpdatingEventHandler RowUpdating
+               {
+                       add
+                       {
+                               base.Events.AddHandler(EventRowUpdating, value);
+                       }
+
+                       remove
+                       {
+                               base.Events.RemoveHandler(EventRowUpdating, value);
+                       }
+               }
+
+               #endregion
+
+               #region Fields
+
+               private FbCommand selectCommand;
+               private FbCommand insertCommand;
+               private FbCommand updateCommand;
+               private FbCommand deleteCommand;
+
+               private bool disposed;
+
+               #endregion
+
+               #region Properties
+
+               IDbCommand IDbDataAdapter.SelectCommand
+               {
+                       get { return this.selectCommand; }
+                       set { this.selectCommand = (FbCommand)value; }
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="SelectCommand"]/*'/>
+#if    (!NETCF)
+               [Category("Fill"), DefaultValue(null)]
+#endif
+               public FbCommand SelectCommand
+               {
+                       get { return this.selectCommand; }
+                       set { this.selectCommand = value; }
+               }
+
+               IDbCommand IDbDataAdapter.InsertCommand
+               {
+                       get { return this.insertCommand; }
+                       set { this.insertCommand = (FbCommand)value; }
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="InsertCommand"]/*'/>
+#if    (!NETCF)
+               [Category("Update"), DefaultValue(null)]
+#endif
+               public FbCommand InsertCommand
+               {
+                       get { return this.insertCommand; }
+                       set { this.insertCommand = value; }
+               }
+
+               IDbCommand IDbDataAdapter.UpdateCommand
+               {
+                       get { return this.updateCommand; }
+                       set { this.updateCommand = (FbCommand)value; }
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="UpdateCommand"]/*'/>             
+#if    (!NETCF)
+               [Category("Update"), DefaultValue(null)]
+#endif
+               public FbCommand UpdateCommand
+               {
+                       get { return this.updateCommand; }
+                       set { this.updateCommand = value; }
+               }
+
+               IDbCommand IDbDataAdapter.DeleteCommand
+               {
+                       get { return this.deleteCommand; }
+                       set { this.deleteCommand = (FbCommand)value; }
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/property[@name="DeleteCommand"]/*'/>
+#if    (!NETCF)
+               [Category("Update"), DefaultValue(null)]
+#endif
+               public FbCommand DeleteCommand
+               {
+                       get { return this.deleteCommand; }
+                       set { this.deleteCommand = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor"]/*'/>
+               public FbDataAdapter() : base()
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor(FbCommand)"]/*'/>
+               public FbDataAdapter(FbCommand selectCommand) : base()
+               {
+                       this.SelectCommand = selectCommand;
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor(System.String,FbConnection)"]/*'/>               
+               public FbDataAdapter(string selectCommandText, FbConnection selectConnection)
+                       : base()
+               {
+                       this.SelectCommand = new FbCommand(selectCommandText, selectConnection);
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/constructor[@name="ctor(System.String,System.String)"]/*'/>
+               public FbDataAdapter(string selectCommandText, string selectConnectionString)
+                       : base()
+               {
+                       FbConnection connection = new FbConnection(selectConnectionString);
+                       this.SelectCommand = new FbCommand(selectCommandText, connection);
+               }
+
+               #endregion
+
+               #region IDisposable     Methods
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="Dispose(System.Boolean)"]/*'/>
+               protected override void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.disposed)
+                               {
+                                       try
+                                       {
+                                               // Release any managed resources
+                                               if (disposing)
+                                               {
+                                                       if (this.SelectCommand != null)
+                                                       {
+                                                               this.SelectCommand.Dispose();
+                                                       }
+                                                       if (this.InsertCommand != null)
+                                                       {
+                                                               this.InsertCommand.Dispose();
+                                                       }
+                                                       if (this.UpdateCommand != null)
+                                                       {
+                                                               this.UpdateCommand.Dispose();
+                                                       }
+                                               }
+
+                                               // release any unmanaged resources
+
+                                               this.disposed = true;
+                                       }
+                                       finally
+                                       {
+                                               base.Dispose(disposing);
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="CreateRowUpdatingEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)"]/*'/>
+               protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
+                       DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+               {
+                       return new FbRowUpdatingEventArgs(dataRow, command, statementType, tableMapping);
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="CreateRowUpdatedEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)"]/*'/>
+               protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
+                       DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+               {
+                       return new FbRowUpdatedEventArgs(dataRow, command, statementType, tableMapping);
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="OnRowUpdating(System.Data.Common.RowUpdatingEventArgs)"]/*'/>
+               protected override void OnRowUpdating(RowUpdatingEventArgs value)
+               {
+                       FbRowUpdatingEventHandler handler = null;
+
+                       handler = (FbRowUpdatingEventHandler)base.Events[EventRowUpdating];
+
+                       if ((null != handler) &&
+                               (value is FbRowUpdatingEventArgs) &&
+                               (value != null))
+                       {
+                               handler(this, (FbRowUpdatingEventArgs)value);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbDataAdapter.xml' path='doc/class[@name="FbDataAdapter"]/method[@name="OnRowUpdated(System.Data.Common.RowUpdatedEventArgs)"]/*'/>
+               protected override void OnRowUpdated(RowUpdatedEventArgs value)
+               {
+                       FbRowUpdatedEventHandler handler = null;
+
+                       handler = (FbRowUpdatedEventHandler)base.Events[EventRowUpdated];
+
+                       if ((handler != null) &&
+                               (value is FbRowUpdatedEventArgs) &&
+                               (value != null))
+                       {
+                               handler(this, (FbRowUpdatedEventArgs)value);
+                       }
+               }
+
+               #endregion
+
+               #region Update DataRow Collection
+
+               /// <summary>
+               /// Review .NET Framework documentation.
+               /// </summary>
+               protected override int Update(DataRow[] dataRows, DataTableMapping tableMapping)
+               {
+                       int                                             updated                 = 0;
+                       IDbCommand                              command                 = null;
+                       StatementType                   statementType   = StatementType.Insert;
+                       ArrayList                               connections             = new ArrayList();
+                       RowUpdatingEventArgs    updatingArgs    = null;
+                       Exception                               updateException = null;
+
+                       foreach (DataRow row in dataRows)
+                       {
+                               if (row.RowState == DataRowState.Detached ||
+                                       row.RowState == DataRowState.Unchanged)
+                               {
+                                       continue;
+                               }
+
+                               switch (row.RowState)
+                               {
+                                       case DataRowState.Added:
+                                               command = this.insertCommand;
+                                               statementType = StatementType.Insert;
+                                               break;
+
+                                       case DataRowState.Modified:
+                                               command = this.updateCommand;
+                                               statementType = StatementType.Update;
+                                               break;
+
+                                       case DataRowState.Deleted:
+                                               command = this.deleteCommand;
+                                               statementType = StatementType.Delete;
+                                               break;
+                               }
+
+                               /* The order of execution can be reviewed in the .NET 1.1 documentation
+                                       *
+                                       * 1. The values in      the     DataRow are     moved to the parameter values. 
+                                       * 2. The OnRowUpdating  event is raised. 
+                                       * 3. The command executes.      
+                                       * 4. If the command is  set     to FirstReturnedRecord, then the first returned result is placed in     the     DataRow. 
+                                       * 5. If there are output parameters, they are placed in the DataRow. 
+                                       * 6. The OnRowUpdated event is  raised. 
+                                       * 7 AcceptChanges is called. 
+                                       */
+
+                               try
+                               {
+                                       /* 1. Update Parameter values (It's     very similar to what we 
+                                        * are doing in the     FbCommandBuilder class).
+                                        *
+                                        * Only input parameters should be updated.
+                                        */
+                                       if (command != null && command.Parameters.Count > 0)
+                                       {
+                                               this.UpdateParameterValues(command, statementType, row, tableMapping);
+                                       }
+
+                                       // 2. Raise     RowUpdating     event
+                                       updatingArgs = this.CreateRowUpdatingEvent(row, command, statementType, tableMapping);
+                                       this.OnRowUpdating(updatingArgs);
+
+                                       if (updatingArgs.Status == UpdateStatus.SkipAllRemainingRows)
+                                       {
+                                               break;
+                                       }
+                                       else if (updatingArgs.Status == UpdateStatus.ErrorsOccurred)
+                                       {
+                                               if (updatingArgs.Errors == null)
+                                               {
+                                                       throw new InvalidOperationException("RowUpdatingEvent: Errors occurred; no additional is information available.");
+                                               }
+                                               throw updatingArgs.Errors;
+                                       }
+                                       else if (updatingArgs.Status == UpdateStatus.SkipCurrentRow)
+                                       {
+                                       }
+                                       else if (updatingArgs.Status == UpdateStatus.Continue)
+                                       {
+                                               if (command != updatingArgs.Command)
+                                               {
+                                                       command = updatingArgs.Command;
+                                               }
+                                               if (command == null)
+                                               {
+                                                       /* Samples of exceptions thrown by DbDataAdapter class
+                                                               *
+                                                               *       Update requires a valid InsertCommand when passed DataRow collection with new rows
+                                                               *       Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
+                                                               *       Update requires a valid DeleteCommand when passed DataRow collection with deleted rows.
+                                                               */
+                                                       string message = this.CreateExceptionMessage(statementType);
+                                                       throw new InvalidOperationException(message);
+                                               }
+
+                                               /* Validate that the command has a connection */
+                                               if (command.Connection == null)
+                                               {
+                                                       throw new InvalidOperationException("Update requires a command with a valid connection.");
+                                               }
+
+                                               // 3. Execute the command
+                                               if (command.Connection.State == ConnectionState.Closed)
+                                               {
+                                                       command.Connection.Open();
+                                                       // Track command connection
+                                                       connections.Add(command.Connection);
+                                               }
+
+                                               int rowsAffected = command.ExecuteNonQuery();
+                                               if (rowsAffected == 0)
+                                               {
+                                                       throw new DBConcurrencyException("An attempt to execute an INSERT, UPDATE, or DELETE statement resulted in zero records affected.");
+                                               }
+
+                                               updated++;
+
+                                               /* 4. If the command is set     to FirstReturnedRecord, then the 
+                                                       * first returned result is      placed in the DataRow. 
+                                                       * 
+                                                       * We have nothing to do in      this case as there are no 
+                                                       * support for batch commands.
+                                                       */
+
+                                               /* 5. Check     if we have output parameters and they should 
+                                                       * be updated.
+                                                       *
+                                                       * Only  output paraneters should be     updated
+                                                       */
+                                               if (command.UpdatedRowSource == UpdateRowSource.OutputParameters ||
+                                                       command.UpdatedRowSource == UpdateRowSource.Both)
+                                               {
+                                                       // Process output parameters
+                                                       foreach (IDataParameter parameter in command.Parameters)
+                                                       {
+                                                               if ((parameter.Direction == ParameterDirection.Output ||
+                                                                       parameter.Direction == ParameterDirection.ReturnValue ||
+                                                                       parameter.Direction == ParameterDirection.InputOutput) &&
+                                                                       parameter.SourceColumn != null &&
+                                                                       parameter.SourceColumn.Length > 0)
+                                                               {
+                                                                       DataColumn column = null;
+
+                                                                       DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction(
+                                                                               parameter.SourceColumn,
+                                                                               this.MissingMappingAction);
+
+                                                                       if (columnMapping != null)
+                                                                       {
+                                                                               column = columnMapping.GetDataColumnBySchemaAction(
+                                                                                       row.Table,
+                                                                                       null,
+                                                                                       this.MissingSchemaAction);
+
+                                                                               if (column != null)
+                                                                               {
+                                                                                       row[column] = parameter.Value;
+                                                                               }
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                               catch (Exception ex)
+                               {
+                                       row.RowError    = ex.Message;
+                                       updateException = ex;
+                               }
+
+                               if (updatingArgs.Status == UpdateStatus.Continue)
+                               {
+                                       // 6. Raise     RowUpdated event
+                                       RowUpdatedEventArgs     updatedArgs = this.CreateRowUpdatedEvent(row, command, statementType, tableMapping);
+                                       this.OnRowUpdated(updatedArgs);
+
+                                       if (updatedArgs.Status == UpdateStatus.SkipAllRemainingRows)
+                                       {
+                                               break;
+                                       }
+                                       else if (updatedArgs.Status == UpdateStatus.ErrorsOccurred)
+                                       {
+                                               if (updatingArgs.Errors == null)
+                                               {
+                                                       throw new InvalidOperationException("RowUpdatedEvent: Errors occurred; no additional information available.");
+                                               }
+                                               throw updatedArgs.Errors;
+                                       }
+                                       else if (updatedArgs.Status == UpdateStatus.SkipCurrentRow)
+                                       {
+                                       }
+                                       else if (updatingArgs.Status == UpdateStatus.Continue)
+                                       {
+                                               // If the update result is an exception throw it
+                                               if (!this.ContinueUpdateOnError && updateException != null)
+                                               {
+                                                       this.CloseConnections(connections);
+                                                       throw updateException;
+                                               }
+
+                                               // 7. Call AcceptChanges
+                                               row.AcceptChanges();
+                                       }
+                               }
+                               else
+                               {
+                                       // If the update result is an exception throw it
+                                       if (!this.ContinueUpdateOnError && updateException != null)
+                                       {
+                                               this.CloseConnections(connections);
+                                               throw updateException;
+                                       }
+                               }
+
+                               updateException = null;
+                       }
+
+                       this.CloseConnections(connections);
+
+                       return updated;
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private string CreateExceptionMessage(StatementType statementType)
+               {
+                       System.Text.StringBuilder sb = new System.Text.StringBuilder();
+
+                       sb.Append("Update requires a valid ");
+                       sb.Append(statementType.ToString());
+                       sb.Append("Command when passed DataRow collection with ");
+
+                       switch (statementType)
+                       {
+                               case StatementType.Insert:
+                                       sb.Append("new");
+                                       break;
+
+                               case StatementType.Update:
+                                       sb.Append("modified");
+                                       break;
+
+                               case StatementType.Delete:
+                                       sb.Append("deleted");
+                                       break;
+                       }
+
+                       sb.Append(" rows.");
+
+                       return sb.ToString();
+               }
+
+               private void UpdateParameterValues(
+                       IDbCommand command,
+                       StatementType statementType,
+                       DataRow row,
+                       DataTableMapping tableMapping)
+               {
+                       foreach (IDataParameter parameter in command.Parameters)
+                       {
+                               // Process only input parameters
+                               if (parameter.Direction != ParameterDirection.Input &&
+                                       parameter.Direction != ParameterDirection.InputOutput)
+                               {
+                                       continue;
+                               }
+
+                               DataColumn column = null;
+
+                               /* Get the DataColumnMapping that matches the given
+                                * column name
+                                */
+                               DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction(
+                                       parameter.SourceColumn,
+                                       this.MissingMappingAction);
+
+                               if (columnMapping != null)
+                               {
+                                       column = columnMapping.GetDataColumnBySchemaAction(
+                                               row.Table,
+                                               null,
+                                               this.MissingSchemaAction);
+
+                                       if (column != null)
+                                       {
+                                               DataRowVersion dataRowVersion = DataRowVersion.Default;
+
+                                               if (statementType == StatementType.Insert)
+                                               {
+                                                       dataRowVersion = DataRowVersion.Current;
+                                               }
+                                               else if (statementType == StatementType.Update)
+                                               {
+                                                       dataRowVersion = parameter.SourceVersion;
+                                               }
+                                               else if (statementType == StatementType.Delete)
+                                               {
+                                                       dataRowVersion = DataRowVersion.Original;
+                                               }
+
+                                               parameter.Value = row[column, dataRowVersion];
+                                       }
+                               }
+                       }
+               }
+
+               private void CloseConnections(ArrayList connections)
+               {
+                       foreach (IDbConnection c in connections)
+                       {
+                               c.Close();
+                       }
+                       connections.Clear();
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 68280e73c85de02dc2a2b05df8ac8bd362022e03..75b8b66283417821d26f605d695ecb5d72ea0331 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.ComponentModel;\r
-using System.Data;\r
-using System.Data.Common;\r
-using System.Globalization;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/overview/*'/>\r
-       public sealed class FbDataReader : MarshalByRefObject, IDataReader, IEnumerable, IDisposable, IDataRecord\r
-       {\r
-               #region Consts\r
-\r
-               private const int STARTPOS = -1;\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private bool                    disposed;\r
-               private bool                    isClosed;\r
-               private bool                    eof;\r
-               private int                             position;\r
-               private int                             recordsAffected;\r
-               private DataTable               schemaTable;\r
-               private FbCommand               command;\r
-               private FbConnection    connection;\r
-               private DbValue[]               row;\r
-               private Descriptor              fields;\r
-               private CommandBehavior behavior;\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal FbDataReader(\r
-                       FbCommand command, FbConnection connection, CommandBehavior behavior)\r
-               {\r
-                       this.position                   = STARTPOS;\r
-                       this.command                    = command;\r
-                       this.behavior                   = behavior;\r
-                       this.connection                 = connection;\r
-                       this.fields                             = this.command.GetFieldsDescriptor();\r
-\r
-                       this.UpdateRecordsAffected();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Finalizer\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/destructor[@name="Finalize"]/*'/>\r
-               ~FbDataReader()\r
-               {\r
-                       this.Dispose(false);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     Methods\r
-\r
-               void IDisposable.Dispose()\r
-               {\r
-                       this.Dispose(true);\r
-                       System.GC.SuppressFinalize(this);\r
-               }\r
-\r
-               private void Dispose(bool disposing)\r
-               {\r
-                       if (!this.disposed)\r
-                       {\r
-                               try\r
-                               {\r
-                                       if (disposing)\r
-                                       {\r
-                                               // release any managed resources\r
-                                               this.Close();\r
-                                       }\r
-\r
-                                       // release any unmanaged resources\r
-                               }\r
-                               finally\r
-                               {\r
-                               }\r
-\r
-                               this.disposed = true;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDataReader     Properties & Methods\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="Depth"]/*'/>\r
-               public int Depth\r
-               {\r
-                       get\r
-                       {\r
-                               this.CheckState();\r
-\r
-                               return 0;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="IsClosed"]/*'/>\r
-               public bool IsClosed\r
-               {\r
-                       get { return this.isClosed; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="RecordsAffected"]/*'/>\r
-               public int RecordsAffected\r
-               {\r
-                       get { return this.recordsAffected; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="HasRows"]/*'/>\r
-               public bool HasRows\r
-               {\r
-                       get { return this.command.IsSelectCommand; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="Close"]/*'/>\r
-               public void Close()\r
-               {\r
-                       bool closeConnection = false;\r
-\r
-                       if (this.IsClosed)\r
-                       {\r
-                               return;\r
-                       }\r
-\r
-                       this.isClosed = true;\r
-                       this.position = STARTPOS;\r
-                       \r
-                       if (this.connection != null)\r
-                       {\r
-                               if ((this.behavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection)\r
-                               {\r
-                                       closeConnection = true;\r
-                               }\r
-                       }\r
-\r
-                       if (this.command != null && !this.command.IsDisposed)\r
-                       {\r
-                               if (this.command.CommandType == CommandType.StoredProcedure)\r
-                               {\r
-                                       // Set values of output parameters\r
-                                       this.command.SetOutputParameters();\r
-                               }\r
-\r
-                               if (this.command.HasImplicitTransaction)\r
-                               {\r
-                                       // Commit implicit transaction if needed\r
-                                       this.command.CommitImplicitTransaction();\r
-                               }\r
-\r
-                               // Set null     the     active reader of the command\r
-                               this.command.ActiveReader = null;\r
-                       }\r
-\r
-                       if (closeConnection)\r
-                       {\r
-                               this.connection.Close();\r
-                       }\r
-\r
-                       this.command            = null;\r
-                       this.connection         = null;\r
-                       this.row                        = null;\r
-                       this.schemaTable        = null;\r
-                       this.fields                     = null;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="NextResult"]/*'/>\r
-               public bool NextResult()\r
-               {\r
-                       return false;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="Read"]/*'/>\r
-               public bool Read()\r
-               {\r
-                       this.CheckState();\r
-\r
-                       bool retValue = false;\r
-\r
-                       if ((this.behavior & CommandBehavior.SingleRow) == CommandBehavior.SingleRow &&\r
-                               this.position != STARTPOS)\r
-                       {\r
-                       }\r
-                       else\r
-                       {\r
-                               if ((this.behavior & CommandBehavior.SchemaOnly) == CommandBehavior.SchemaOnly)\r
-                               {\r
-                               }\r
-                               else\r
-                               {\r
-                                       this.row = this.command.Fetch();\r
-\r
-                                       if (this.row != null)\r
-                                       {\r
-                                               this.position++;\r
-                                               retValue = true;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               this.eof = true;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return retValue;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetSchemaTable"]/*'/>\r
-               public DataTable GetSchemaTable()\r
-               {\r
-                       this.CheckState();\r
-\r
-                       if (this.schemaTable != null)\r
-                       {\r
-                               return this.schemaTable;\r
-                       }\r
-\r
-                       DataRow schemaRow;\r
-\r
-                       this.schemaTable = this.GetSchemaTableStructure();\r
-\r
-                       /* Prepare statement for schema fields information      */\r
-                       FbCommand schemaCmd = new FbCommand(\r
-                               this.GetSchemaCommandText(),\r
-                               this.command.Connection,\r
-                               this.command.ActiveTransaction);\r
-\r
-                       schemaCmd.Parameters.Add("@TABLE_NAME", FbDbType.Char, 31);\r
-                       schemaCmd.Parameters.Add("@COLUMN_NAME", FbDbType.Char, 31);\r
-                       schemaCmd.Prepare();\r
-\r
-                       schemaTable.BeginLoadData();\r
-                       for (int i = 0; i < this.fields.Count; i++)\r
-                       {\r
-                               bool isKeyColumn = false;\r
-                               bool isUnique   = false;\r
-                               bool isReadOnly = false;\r
-                               int precision   = 0;\r
-\r
-                               if (!this.fields[i].IsExpression())\r
-                               {\r
-                                       /* Get Schema data for the field        */\r
-                                       schemaCmd.Parameters[0].Value = this.fields[i].Relation;\r
-                                       schemaCmd.Parameters[1].Value = this.fields[i].Name;\r
-\r
-                                       FbDataReader r = schemaCmd.ExecuteReader();\r
-\r
-                                       if (r.Read())\r
-                                       {\r
-                                               isReadOnly = (this.IsReadOnly(r) || this.fields[i].IsExpression()) ? true : false;\r
-                                               isKeyColumn = (r.GetInt32(2) == 1) ? true : false;\r
-                                               isUnique = (r.GetInt32(3) == 1) ? true : false;\r
-                                               precision = r.IsDBNull(4) ? -1 : r.GetInt32(4);\r
-                                       }\r
-\r
-                                       /* Close the Reader     */\r
-                                       r.Close();\r
-                               }\r
-\r
-                               /* Create new row for the Schema Table  */\r
-                               schemaRow = schemaTable.NewRow();\r
-\r
-                               schemaRow["ColumnName"]         = this.GetName(i);\r
-                               schemaRow["ColumnOrdinal"]      = i;\r
-                               schemaRow["ColumnSize"]         = this.fields[i].GetSize();\r
-                               if (fields[i].IsDecimal())\r
-                               {\r
-                                       schemaRow["NumericPrecision"] = schemaRow["ColumnSize"];\r
-                                       if (precision > 0)\r
-                                       {\r
-                                               schemaRow["NumericPrecision"] = precision;\r
-                                       }\r
-                                       schemaRow["NumericScale"] = this.fields[i].NumericScale * (-1);\r
-                               }\r
-                               schemaRow["DataType"]           = this.GetFieldType(i);\r
-                               schemaRow["ProviderType"]       = this.GetProviderType(i);\r
-                               schemaRow["IsLong"]                     = this.fields[i].IsLong();\r
-                               schemaRow["AllowDBNull"]        = this.fields[i].AllowDBNull();\r
-                               schemaRow["IsRowVersion"]       = false;\r
-                               schemaRow["IsAutoIncrement"] = false;\r
-                               schemaRow["IsReadOnly"]         = isReadOnly;\r
-                               schemaRow["IsKey"]                      = isKeyColumn;\r
-                               schemaRow["IsUnique"]           = isUnique;\r
-                               schemaRow["IsAliased"]          = this.fields[i].IsAliased();\r
-                               schemaRow["IsExpression"]       = this.fields[i].IsExpression();\r
-                               schemaRow["BaseSchemaName"] = DBNull.Value;\r
-                               schemaRow["BaseCatalogName"] = DBNull.Value;\r
-                               schemaRow["BaseTableName"]      = this.fields[i].Relation;\r
-                               schemaRow["BaseColumnName"] = this.fields[i].Name;\r
-\r
-                               schemaTable.Rows.Add(schemaRow);\r
-\r
-                               /* Close statement      */\r
-                               schemaCmd.Close();\r
-                       }\r
-                       schemaTable.EndLoadData();\r
-\r
-                       /* Dispose command      */\r
-                       schemaCmd.Dispose();\r
-\r
-                       return schemaTable;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDataRecord     Properties & Methods\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/indexer[@name="Item(System.Int32)"]/*'/>\r
-               public object this[int i]\r
-               {\r
-                       get { return this.GetValue(i); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/indexer[@name="Item(System.String)"]/*'/>\r
-               public object this[String name]\r
-               {\r
-                       get { return this.GetValue(this.GetOrdinal(name)); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="FieldCount"]/*'/>\r
-               public int FieldCount\r
-               {\r
-                       get\r
-                       {\r
-                               this.CheckState();\r
-\r
-                               return this.fields.Count;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetOrdinal(System.String)"]/*'/>\r
-               public int GetOrdinal(string name)\r
-               {\r
-                       this.CheckState();\r
-\r
-                       for (int i = 0; i < this.fields.Count; i++)\r
-                       {\r
-                               if (GlobalizationHelper.CultureAwareCompare(name, this.fields[i].Alias))\r
-                               {\r
-                                       return i;\r
-                               }\r
-                       }\r
-\r
-                       throw new IndexOutOfRangeException("Could not find specified column in results.");\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetName(System.Int32)"]/*'/>\r
-               public string GetName(int i)\r
-               {\r
-                       this.CheckState();\r
-                       this.CheckIndex(i);\r
-\r
-                       if (this.fields[i].Alias.Length > 0)\r
-                       {\r
-                               return this.fields[i].Alias;\r
-                       }\r
-                       else\r
-                       {\r
-                               return this.fields[i].Name;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDataTypeName(System.Int32)"]/*'/>\r
-               public String GetDataTypeName(int i)\r
-               {\r
-                       this.CheckState();\r
-                       this.CheckIndex(i);\r
-\r
-                       return TypeHelper.GetDataTypeName(this.fields[i].DbDataType);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetFieldType(System.Int32)"]/*'/>\r
-               public Type GetFieldType(int i)\r
-               {\r
-                       this.CheckState();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.fields[i].GetSystemType();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetValue(System.Int32)"]/*'/>\r
-               public object GetValue(int i)\r
-               {\r
-                       this.CheckState();\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].Value;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetValues(System.Array)"]/*'/>\r
-               public int GetValues(object[] values)\r
-               {\r
-                       this.CheckState();\r
-                       this.CheckPosition();\r
-\r
-                       for (int i = 0; i < this.fields.Count; i++)\r
-                       {\r
-                               values[i] = this.GetValue(i);\r
-                       }\r
-\r
-                       return values.Length;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetBoolean(System.Int32)"]/*'/>\r
-               public bool GetBoolean(int i)\r
-               {\r
-                       this.CheckPosition();\r
-\r
-                       return this.row[i].GetBoolean();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetByte(System.Int32)"]/*'/>\r
-               public byte GetByte(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetByte();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetBytes(System.Int32,System.Int64,System.Byte[],System.Int32,System.Int32)"]/*'/>\r
-               public long GetBytes(\r
-                       int i, long dataIndex, byte[] buffer, int bufferIndex, int length)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       int bytesRead = 0;\r
-                       int realLength = length;\r
-\r
-                       if (buffer == null)\r
-                       {\r
-                               if (this.IsDBNull(i))\r
-                               {\r
-                                       return 0;\r
-                               }\r
-                               else\r
-                               {\r
-                                       return this.row[i].GetBinary().Length;\r
-                               }\r
-                       }\r
-\r
-                       byte[] byteArray = (byte[])row[i].GetBinary();\r
-\r
-                       if (length > (byteArray.Length - dataIndex))\r
-                       {\r
-                               realLength = byteArray.Length - (int)dataIndex;\r
-                       }\r
-\r
-                       Array.Copy(byteArray, (int)dataIndex, buffer, bufferIndex, realLength);\r
-\r
-                       if ((byteArray.Length - dataIndex) < length)\r
-                       {\r
-                               bytesRead = byteArray.Length - (int)dataIndex;\r
-                       }\r
-                       else\r
-                       {\r
-                               bytesRead = length;\r
-                       }\r
-\r
-                       return bytesRead;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetChar(System.Int32)"]/*'/>\r
-               [EditorBrowsable(EditorBrowsableState.Never)]\r
-               public char GetChar(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetChar();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetChars(System.Int32,System.Int64,System.Char[],System.Int32,System.Int32)"]/*'/>\r
-               public long GetChars(\r
-                       int i, long dataIndex, char[] buffer, int bufferIndex, int length)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       if (buffer == null)\r
-                       {\r
-                               if (this.IsDBNull(i))\r
-                               {\r
-                                       return 0;\r
-                               }\r
-                               else\r
-                               {\r
-                                       char[] data = ((string)this.GetValue(i)).ToCharArray();\r
-\r
-                                       return data.Length;\r
-                               }\r
-                       }\r
-\r
-                       int charsRead = 0;\r
-                       int realLength = length;\r
-\r
-                       char[] charArray = ((string)this.GetValue(i)).ToCharArray();\r
-\r
-                       if (length > (charArray.Length - dataIndex))\r
-                       {\r
-                               realLength = charArray.Length - (int)dataIndex;\r
-                       }\r
-\r
-                       System.Array.Copy(charArray, (int)dataIndex, buffer,\r
-                               bufferIndex, realLength);\r
-\r
-                       if ((charArray.Length - dataIndex) < length)\r
-                       {\r
-                               charsRead = charArray.Length - (int)dataIndex;\r
-                       }\r
-                       else\r
-                       {\r
-                               charsRead = length;\r
-                       }\r
-\r
-                       return charsRead;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetGuid(System.Int32)"]/*'/>\r
-               public Guid GetGuid(int i)\r
-               {\r
-                       this.CheckPosition();\r
-\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetGuid();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetInt16(System.Int32)"]/*'/>\r
-               public Int16 GetInt16(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetInt16();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetInt32(System.Int32)"]/*'/>\r
-               public Int32 GetInt32(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetInt32();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetInt64(System.Int32)"]/*'/>                \r
-               public Int64 GetInt64(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetInt64();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetFloat(System.Int32)"]/*'/>\r
-               public float GetFloat(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetFloat();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDouble(System.Int32)"]/*'/>\r
-               public double GetDouble(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetDouble();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetString(System.Int32)"]/*'/>\r
-               public String GetString(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetString();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDecimal(System.Int32)"]/*'/>\r
-               public Decimal GetDecimal(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetDecimal();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDateTime(System.Int32)"]/*'/>\r
-               public DateTime GetDateTime(int i)\r
-               {\r
-                       this.CheckPosition();\r
-\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].GetDateTime();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetData(System.Int32)"]/*'/>\r
-               [EditorBrowsable(EditorBrowsableState.Never)]\r
-               public IDataReader GetData(int i)\r
-               {\r
-                       throw new NotSupportedException("GetData not supported.");\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="IsDBNull(System.Int32)"]/*'/>\r
-               public bool IsDBNull(int i)\r
-               {\r
-                       this.CheckPosition();\r
-                       this.CheckIndex(i);\r
-\r
-                       return this.row[i].IsDBNull();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IEnumerable     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="IEnumerable.GetEnumerator"]/*'/>\r
-               IEnumerator IEnumerable.GetEnumerator()\r
-               {\r
-                       return new DbEnumerator(this);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void CheckPosition()\r
-               {\r
-                       if (this.eof || this.position == STARTPOS)\r
-                       {\r
-                               throw new InvalidOperationException("There are no data to read.");\r
-                       }\r
-               }\r
-\r
-               private void CheckState()\r
-               {\r
-                       if (this.IsClosed)\r
-                       {\r
-                               throw new InvalidOperationException("Invalid attempt of read when the reader is closed.");\r
-                       }\r
-               }\r
-\r
-               private void CheckIndex(int i)\r
-               {\r
-                       if (i < 0 || i >= this.FieldCount)\r
-                       {\r
-                               throw new IndexOutOfRangeException("Could not find specified column in results.");\r
-                       }\r
-               }\r
-\r
-               private FbDbType GetProviderType(int i)\r
-               {\r
-                       return (FbDbType)this.fields[i].DbDataType;\r
-               }\r
-\r
-               private bool IsReadOnly(FbDataReader r)\r
-               {\r
-                       /* [0] = COMPUTED_BLR\r
-                        * [1] = COMPUTED_SOURCE\r
-                        */\r
-                       if (!r.IsDBNull(0) || !r.IsDBNull(1))\r
-                       {\r
-                               return true;\r
-                       }\r
-\r
-                       return false;\r
-               }\r
-\r
-               private DataTable GetSchemaTableStructure()\r
-               {\r
-                       DataTable schema = new DataTable("Schema");\r
-\r
-                       // Schema table structure\r
-                       schema.Columns.Add("ColumnName", System.Type.GetType("System.String"));\r
-                       schema.Columns.Add("ColumnOrdinal", System.Type.GetType("System.Int32"));\r
-                       schema.Columns.Add("ColumnSize", System.Type.GetType("System.Int32"));\r
-                       schema.Columns.Add("NumericPrecision", System.Type.GetType("System.Int32"));\r
-                       schema.Columns.Add("NumericScale", System.Type.GetType("System.Int32"));\r
-                       schema.Columns.Add("DataType", System.Type.GetType("System.Type"));\r
-                       schema.Columns.Add("ProviderType", System.Type.GetType("System.Int32"));\r
-                       schema.Columns.Add("IsLong", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("AllowDBNull", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("IsReadOnly", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("IsRowVersion", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("IsUnique", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("IsKey", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("IsAutoIncrement", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("IsAliased", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("IsExpression", System.Type.GetType("System.Boolean"));\r
-                       schema.Columns.Add("BaseSchemaName", System.Type.GetType("System.String"));\r
-                       schema.Columns.Add("BaseCatalogName", System.Type.GetType("System.String"));\r
-                       schema.Columns.Add("BaseTableName", System.Type.GetType("System.String"));\r
-                       schema.Columns.Add("BaseColumnName", System.Type.GetType("System.String"));\r
-\r
-                       return schema;\r
-               }\r
-\r
-               private string GetSchemaCommandText()\r
-               {\r
-                       System.Text.StringBuilder sql = new System.Text.StringBuilder();\r
-                       sql.Append(\r
-                               "SELECT \n" +\r
-                                       "fld.rdb$computed_blr      as computed_blr,\n" +\r
-                                       "fld.rdb$computed_source   as computed_source,\n" +\r
-                                       "(select count(*)\n" +\r
-                                       "from rdb$relation_constraints rel, rdb$indices idx, rdb$index_segments seg\n" +\r
-                                       "where rel.rdb$constraint_type = 'PRIMARY KEY'\n" +\r
-                                       "and rel.rdb$index_name = idx.rdb$index_name\n" +\r
-                                       "and idx.rdb$index_name = seg.rdb$index_name\n" +\r
-                                       "and rel.rdb$relation_name = rfr.rdb$relation_name\n" +\r
-                                       "and seg.rdb$field_name = rfr.rdb$field_name) as primary_key,\n" +\r
-                                       "(select count(*)\n" +\r
-                                       "from rdb$relation_constraints rel, rdb$indices idx, rdb$index_segments seg\n" +\r
-                                       "where rel.rdb$constraint_type = 'UNIQUE'\n" +\r
-                                       "and rel.rdb$index_name = idx.rdb$index_name\n" +\r
-                                       "and idx.rdb$index_name = seg.rdb$index_name\n" +\r
-                                       "and rel.rdb$relation_name = rfr.rdb$relation_name\n" +\r
-                                       "and seg.rdb$field_name = rfr.rdb$field_name) as unique_key,\n" +\r
-                                       "fld.rdb$field_precision as numeric_precision\n" +\r
-                               "from rdb$relation_fields rfr, rdb$fields fld\n" +\r
-                                       "where rfr.rdb$field_source = fld.rdb$field_name");\r
-\r
-                       sql.Append("\n and rfr.rdb$relation_name = ?");\r
-                       sql.Append("\n and rfr.rdb$field_name = ?");\r
-                       sql.Append("\n order by rfr.rdb$relation_name, rfr.rdb$field_position");\r
-\r
-                       return sql.ToString();\r
-               }\r
-\r
-               private void UpdateRecordsAffected()\r
-               {\r
-                       if (this.command != null && !this.command.IsDisposed)\r
-                       {\r
-                               if (this.command.RecordsAffected != -1)\r
-                               {\r
-                                       this.recordsAffected = this.recordsAffected == -1 ? 0 : this.recordsAffected;\r
-                                       this.recordsAffected += this.command.RecordsAffected;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Globalization;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/overview/*'/>
+       public sealed class FbDataReader : MarshalByRefObject, IDataReader, IEnumerable, IDisposable, IDataRecord
+       {
+               #region Consts
+
+               private const int STARTPOS = -1;
+
+               #endregion
+
+               #region Fields
+
+               private bool                    disposed;
+               private bool                    isClosed;
+               private bool                    eof;
+               private int                             position;
+               private int                             recordsAffected;
+               private DataTable               schemaTable;
+               private FbCommand               command;
+               private FbConnection    connection;
+               private DbValue[]               row;
+               private Descriptor              fields;
+               private CommandBehavior behavior;
+
+               #endregion
+
+               #region Constructors
+
+               internal FbDataReader(
+                       FbCommand command, FbConnection connection, CommandBehavior behavior)
+               {
+                       this.position                   = STARTPOS;
+                       this.command                    = command;
+                       this.behavior                   = behavior;
+                       this.connection                 = connection;
+                       this.fields                             = this.command.GetFieldsDescriptor();
+
+                       this.UpdateRecordsAffected();
+               }
+
+               #endregion
+
+               #region Finalizer
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/destructor[@name="Finalize"]/*'/>
+               ~FbDataReader()
+               {
+                       this.Dispose(false);
+               }
+
+               #endregion
+
+               #region IDisposable     Methods
+
+               void IDisposable.Dispose()
+               {
+                       this.Dispose(true);
+                       System.GC.SuppressFinalize(this);
+               }
+
+               private void Dispose(bool disposing)
+               {
+                       if (!this.disposed)
+                       {
+                               try
+                               {
+                                       if (disposing)
+                                       {
+                                               // release any managed resources
+                                               this.Close();
+                                       }
+
+                                       // release any unmanaged resources
+                               }
+                               finally
+                               {
+                               }
+
+                               this.disposed = true;
+                       }
+               }
+
+               #endregion
+
+               #region IDataReader     Properties & Methods
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="Depth"]/*'/>
+               public int Depth
+               {
+                       get
+                       {
+                               this.CheckState();
+
+                               return 0;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="IsClosed"]/*'/>
+               public bool IsClosed
+               {
+                       get { return this.isClosed; }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="RecordsAffected"]/*'/>
+               public int RecordsAffected
+               {
+                       get { return this.recordsAffected; }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="HasRows"]/*'/>
+               public bool HasRows
+               {
+                       get { return this.command.IsSelectCommand; }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="Close"]/*'/>
+               public void Close()
+               {
+                       bool closeConnection = false;
+
+                       if (this.IsClosed)
+                       {
+                               return;
+                       }
+
+                       this.isClosed = true;
+                       this.position = STARTPOS;
+                       
+                       if (this.connection != null)
+                       {
+                               if ((this.behavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection)
+                               {
+                                       closeConnection = true;
+                               }
+                       }
+
+                       if (this.command != null && !this.command.IsDisposed)
+                       {
+                               if (this.command.CommandType == CommandType.StoredProcedure)
+                               {
+                                       // Set values of output parameters
+                                       this.command.SetOutputParameters();
+                               }
+
+                               if (this.command.HasImplicitTransaction)
+                               {
+                                       // Commit implicit transaction if needed
+                                       this.command.CommitImplicitTransaction();
+                               }
+
+                               // Set null     the     active reader of the command
+                               this.command.ActiveReader = null;
+                       }
+
+                       if (closeConnection)
+                       {
+                               this.connection.Close();
+                       }
+
+                       this.command            = null;
+                       this.connection         = null;
+                       this.row                        = null;
+                       this.schemaTable        = null;
+                       this.fields                     = null;
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="NextResult"]/*'/>
+               public bool NextResult()
+               {
+                       return false;
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="Read"]/*'/>
+               public bool Read()
+               {
+                       this.CheckState();
+
+                       bool retValue = false;
+
+                       if ((this.behavior & CommandBehavior.SingleRow) == CommandBehavior.SingleRow &&
+                               this.position != STARTPOS)
+                       {
+                       }
+                       else
+                       {
+                               if ((this.behavior & CommandBehavior.SchemaOnly) == CommandBehavior.SchemaOnly)
+                               {
+                               }
+                               else
+                               {
+                                       this.row = this.command.Fetch();
+
+                                       if (this.row != null)
+                                       {
+                                               this.position++;
+                                               retValue = true;
+                                       }
+                                       else
+                                       {
+                                               this.eof = true;
+                                       }
+                               }
+                       }
+
+                       return retValue;
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetSchemaTable"]/*'/>
+               public DataTable GetSchemaTable()
+               {
+                       this.CheckState();
+
+                       if (this.schemaTable != null)
+                       {
+                               return this.schemaTable;
+                       }
+
+                       DataRow schemaRow;
+
+                       this.schemaTable = this.GetSchemaTableStructure();
+
+                       /* Prepare statement for schema fields information      */
+                       FbCommand schemaCmd = new FbCommand(
+                               this.GetSchemaCommandText(),
+                               this.command.Connection,
+                               this.command.ActiveTransaction);
+
+                       schemaCmd.Parameters.Add("@TABLE_NAME", FbDbType.Char, 31);
+                       schemaCmd.Parameters.Add("@COLUMN_NAME", FbDbType.Char, 31);
+                       schemaCmd.Prepare();
+
+                       schemaTable.BeginLoadData();
+                       for (int i = 0; i < this.fields.Count; i++)
+                       {
+                               bool isKeyColumn = false;
+                               bool isUnique   = false;
+                               bool isReadOnly = false;
+                               int precision   = 0;
+
+                               if (!this.fields[i].IsExpression())
+                               {
+                                       /* Get Schema data for the field        */
+                                       schemaCmd.Parameters[0].Value = this.fields[i].Relation;
+                                       schemaCmd.Parameters[1].Value = this.fields[i].Name;
+
+                                       FbDataReader r = schemaCmd.ExecuteReader();
+
+                                       if (r.Read())
+                                       {
+                                               isReadOnly = (this.IsReadOnly(r) || this.fields[i].IsExpression()) ? true : false;
+                                               isKeyColumn = (r.GetInt32(2) == 1) ? true : false;
+                                               isUnique = (r.GetInt32(3) == 1) ? true : false;
+                                               precision = r.IsDBNull(4) ? -1 : r.GetInt32(4);
+                                       }
+
+                                       /* Close the Reader     */
+                                       r.Close();
+                               }
+
+                               /* Create new row for the Schema Table  */
+                               schemaRow = schemaTable.NewRow();
+
+                               schemaRow["ColumnName"]         = this.GetName(i);
+                               schemaRow["ColumnOrdinal"]      = i;
+                               schemaRow["ColumnSize"]         = this.fields[i].GetSize();
+                               if (fields[i].IsDecimal())
+                               {
+                                       schemaRow["NumericPrecision"] = schemaRow["ColumnSize"];
+                                       if (precision > 0)
+                                       {
+                                               schemaRow["NumericPrecision"] = precision;
+                                       }
+                                       schemaRow["NumericScale"] = this.fields[i].NumericScale * (-1);
+                               }
+                               schemaRow["DataType"]           = this.GetFieldType(i);
+                               schemaRow["ProviderType"]       = this.GetProviderType(i);
+                               schemaRow["IsLong"]                     = this.fields[i].IsLong();
+                               schemaRow["AllowDBNull"]        = this.fields[i].AllowDBNull();
+                               schemaRow["IsRowVersion"]       = false;
+                               schemaRow["IsAutoIncrement"] = false;
+                               schemaRow["IsReadOnly"]         = isReadOnly;
+                               schemaRow["IsKey"]                      = isKeyColumn;
+                               schemaRow["IsUnique"]           = isUnique;
+                               schemaRow["IsAliased"]          = this.fields[i].IsAliased();
+                               schemaRow["IsExpression"]       = this.fields[i].IsExpression();
+                               schemaRow["BaseSchemaName"] = DBNull.Value;
+                               schemaRow["BaseCatalogName"] = DBNull.Value;
+                               schemaRow["BaseTableName"]      = this.fields[i].Relation;
+                               schemaRow["BaseColumnName"] = this.fields[i].Name;
+
+                               schemaTable.Rows.Add(schemaRow);
+
+                               /* Close statement      */
+                               schemaCmd.Close();
+                       }
+                       schemaTable.EndLoadData();
+
+                       /* Dispose command      */
+                       schemaCmd.Dispose();
+
+                       return schemaTable;
+               }
+
+               #endregion
+
+               #region IDataRecord     Properties & Methods
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/indexer[@name="Item(System.Int32)"]/*'/>
+               public object this[int i]
+               {
+                       get { return this.GetValue(i); }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/indexer[@name="Item(System.String)"]/*'/>
+               public object this[String name]
+               {
+                       get { return this.GetValue(this.GetOrdinal(name)); }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/property[@name="FieldCount"]/*'/>
+               public int FieldCount
+               {
+                       get
+                       {
+                               this.CheckState();
+
+                               return this.fields.Count;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetOrdinal(System.String)"]/*'/>
+               public int GetOrdinal(string name)
+               {
+                       this.CheckState();
+
+                       for (int i = 0; i < this.fields.Count; i++)
+                       {
+                               if (GlobalizationHelper.CultureAwareCompare(name, this.fields[i].Alias))
+                               {
+                                       return i;
+                               }
+                       }
+
+                       throw new IndexOutOfRangeException("Could not find specified column in results.");
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetName(System.Int32)"]/*'/>
+               public string GetName(int i)
+               {
+                       this.CheckState();
+                       this.CheckIndex(i);
+
+                       if (this.fields[i].Alias.Length > 0)
+                       {
+                               return this.fields[i].Alias;
+                       }
+                       else
+                       {
+                               return this.fields[i].Name;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDataTypeName(System.Int32)"]/*'/>
+               public String GetDataTypeName(int i)
+               {
+                       this.CheckState();
+                       this.CheckIndex(i);
+
+                       return TypeHelper.GetDataTypeName(this.fields[i].DbDataType);
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetFieldType(System.Int32)"]/*'/>
+               public Type GetFieldType(int i)
+               {
+                       this.CheckState();
+                       this.CheckIndex(i);
+
+                       return this.fields[i].GetSystemType();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetValue(System.Int32)"]/*'/>
+               public object GetValue(int i)
+               {
+                       this.CheckState();
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].Value;
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetValues(System.Array)"]/*'/>
+               public int GetValues(object[] values)
+               {
+                       this.CheckState();
+                       this.CheckPosition();
+
+                       for (int i = 0; i < this.fields.Count; i++)
+                       {
+                               values[i] = this.GetValue(i);
+                       }
+
+                       return values.Length;
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetBoolean(System.Int32)"]/*'/>
+               public bool GetBoolean(int i)
+               {
+                       this.CheckPosition();
+
+                       return this.row[i].GetBoolean();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetByte(System.Int32)"]/*'/>
+               public byte GetByte(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetByte();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetBytes(System.Int32,System.Int64,System.Byte[],System.Int32,System.Int32)"]/*'/>
+               public long GetBytes(
+                       int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       int bytesRead = 0;
+                       int realLength = length;
+
+                       if (buffer == null)
+                       {
+                               if (this.IsDBNull(i))
+                               {
+                                       return 0;
+                               }
+                               else
+                               {
+                                       return this.row[i].GetBinary().Length;
+                               }
+                       }
+
+                       byte[] byteArray = (byte[])row[i].GetBinary();
+
+                       if (length > (byteArray.Length - dataIndex))
+                       {
+                               realLength = byteArray.Length - (int)dataIndex;
+                       }
+
+                       Array.Copy(byteArray, (int)dataIndex, buffer, bufferIndex, realLength);
+
+                       if ((byteArray.Length - dataIndex) < length)
+                       {
+                               bytesRead = byteArray.Length - (int)dataIndex;
+                       }
+                       else
+                       {
+                               bytesRead = length;
+                       }
+
+                       return bytesRead;
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetChar(System.Int32)"]/*'/>
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public char GetChar(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetChar();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetChars(System.Int32,System.Int64,System.Char[],System.Int32,System.Int32)"]/*'/>
+               public long GetChars(
+                       int i, long dataIndex, char[] buffer, int bufferIndex, int length)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       if (buffer == null)
+                       {
+                               if (this.IsDBNull(i))
+                               {
+                                       return 0;
+                               }
+                               else
+                               {
+                                       char[] data = ((string)this.GetValue(i)).ToCharArray();
+
+                                       return data.Length;
+                               }
+                       }
+
+                       int charsRead = 0;
+                       int realLength = length;
+
+                       char[] charArray = ((string)this.GetValue(i)).ToCharArray();
+
+                       if (length > (charArray.Length - dataIndex))
+                       {
+                               realLength = charArray.Length - (int)dataIndex;
+                       }
+
+                       System.Array.Copy(charArray, (int)dataIndex, buffer,
+                               bufferIndex, realLength);
+
+                       if ((charArray.Length - dataIndex) < length)
+                       {
+                               charsRead = charArray.Length - (int)dataIndex;
+                       }
+                       else
+                       {
+                               charsRead = length;
+                       }
+
+                       return charsRead;
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetGuid(System.Int32)"]/*'/>
+               public Guid GetGuid(int i)
+               {
+                       this.CheckPosition();
+
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetGuid();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetInt16(System.Int32)"]/*'/>
+               public Int16 GetInt16(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetInt16();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetInt32(System.Int32)"]/*'/>
+               public Int32 GetInt32(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetInt32();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetInt64(System.Int32)"]/*'/>                
+               public Int64 GetInt64(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetInt64();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetFloat(System.Int32)"]/*'/>
+               public float GetFloat(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetFloat();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDouble(System.Int32)"]/*'/>
+               public double GetDouble(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetDouble();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetString(System.Int32)"]/*'/>
+               public String GetString(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetString();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDecimal(System.Int32)"]/*'/>
+               public Decimal GetDecimal(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetDecimal();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetDateTime(System.Int32)"]/*'/>
+               public DateTime GetDateTime(int i)
+               {
+                       this.CheckPosition();
+
+                       this.CheckIndex(i);
+
+                       return this.row[i].GetDateTime();
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="GetData(System.Int32)"]/*'/>
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public IDataReader GetData(int i)
+               {
+                       throw new NotSupportedException("GetData not supported.");
+               }
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="IsDBNull(System.Int32)"]/*'/>
+               public bool IsDBNull(int i)
+               {
+                       this.CheckPosition();
+                       this.CheckIndex(i);
+
+                       return this.row[i].IsDBNull();
+               }
+
+               #endregion
+
+               #region IEnumerable     Methods
+
+               /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/method[@name="IEnumerable.GetEnumerator"]/*'/>
+               IEnumerator IEnumerable.GetEnumerator()
+               {
+                       return new DbEnumerator(this);
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void CheckPosition()
+               {
+                       if (this.eof || this.position == STARTPOS)
+                       {
+                               throw new InvalidOperationException("There are no data to read.");
+                       }
+               }
+
+               private void CheckState()
+               {
+                       if (this.IsClosed)
+                       {
+                               throw new InvalidOperationException("Invalid attempt of read when the reader is closed.");
+                       }
+               }
+
+               private void CheckIndex(int i)
+               {
+                       if (i < 0 || i >= this.FieldCount)
+                       {
+                               throw new IndexOutOfRangeException("Could not find specified column in results.");
+                       }
+               }
+
+               private FbDbType GetProviderType(int i)
+               {
+                       return (FbDbType)this.fields[i].DbDataType;
+               }
+
+               private bool IsReadOnly(FbDataReader r)
+               {
+                       /* [0] = COMPUTED_BLR
+                        * [1] = COMPUTED_SOURCE
+                        */
+                       if (!r.IsDBNull(0) || !r.IsDBNull(1))
+                       {
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               private DataTable GetSchemaTableStructure()
+               {
+                       DataTable schema = new DataTable("Schema");
+
+                       // Schema table structure
+                       schema.Columns.Add("ColumnName", System.Type.GetType("System.String"));
+                       schema.Columns.Add("ColumnOrdinal", System.Type.GetType("System.Int32"));
+                       schema.Columns.Add("ColumnSize", System.Type.GetType("System.Int32"));
+                       schema.Columns.Add("NumericPrecision", System.Type.GetType("System.Int32"));
+                       schema.Columns.Add("NumericScale", System.Type.GetType("System.Int32"));
+                       schema.Columns.Add("DataType", System.Type.GetType("System.Type"));
+                       schema.Columns.Add("ProviderType", System.Type.GetType("System.Int32"));
+                       schema.Columns.Add("IsLong", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("AllowDBNull", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("IsReadOnly", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("IsRowVersion", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("IsUnique", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("IsKey", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("IsAutoIncrement", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("IsAliased", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("IsExpression", System.Type.GetType("System.Boolean"));
+                       schema.Columns.Add("BaseSchemaName", System.Type.GetType("System.String"));
+                       schema.Columns.Add("BaseCatalogName", System.Type.GetType("System.String"));
+                       schema.Columns.Add("BaseTableName", System.Type.GetType("System.String"));
+                       schema.Columns.Add("BaseColumnName", System.Type.GetType("System.String"));
+
+                       return schema;
+               }
+
+               private string GetSchemaCommandText()
+               {
+                       System.Text.StringBuilder sql = new System.Text.StringBuilder();
+                       sql.Append(
+                               "SELECT \n" +
+                                       "fld.rdb$computed_blr      as computed_blr,\n" +
+                                       "fld.rdb$computed_source   as computed_source,\n" +
+                                       "(select count(*)\n" +
+                                       "from rdb$relation_constraints rel, rdb$indices idx, rdb$index_segments seg\n" +
+                                       "where rel.rdb$constraint_type = 'PRIMARY KEY'\n" +
+                                       "and rel.rdb$index_name = idx.rdb$index_name\n" +
+                                       "and idx.rdb$index_name = seg.rdb$index_name\n" +
+                                       "and rel.rdb$relation_name = rfr.rdb$relation_name\n" +
+                                       "and seg.rdb$field_name = rfr.rdb$field_name) as primary_key,\n" +
+                                       "(select count(*)\n" +
+                                       "from rdb$relation_constraints rel, rdb$indices idx, rdb$index_segments seg\n" +
+                                       "where rel.rdb$constraint_type = 'UNIQUE'\n" +
+                                       "and rel.rdb$index_name = idx.rdb$index_name\n" +
+                                       "and idx.rdb$index_name = seg.rdb$index_name\n" +
+                                       "and rel.rdb$relation_name = rfr.rdb$relation_name\n" +
+                                       "and seg.rdb$field_name = rfr.rdb$field_name) as unique_key,\n" +
+                                       "fld.rdb$field_precision as numeric_precision\n" +
+                               "from rdb$relation_fields rfr, rdb$fields fld\n" +
+                                       "where rfr.rdb$field_source = fld.rdb$field_name");
+
+                       sql.Append("\n and rfr.rdb$relation_name = ?");
+                       sql.Append("\n and rfr.rdb$field_name = ?");
+                       sql.Append("\n order by rfr.rdb$relation_name, rfr.rdb$field_position");
+
+                       return sql.ToString();
+               }
+
+               private void UpdateRecordsAffected()
+               {
+                       if (this.command != null && !this.command.IsDisposed)
+                       {
+                               if (this.command.RecordsAffected != -1)
+                               {
+                                       this.recordsAffected = this.recordsAffected == -1 ? 0 : this.recordsAffected;
+                                       this.recordsAffected += this.command.RecordsAffected;
+                               }
+                       }
+               }
+
+               #endregion
+       }
+}
index c0c8690ca2557484c14cb0aa1bc87e3247ca328f..a1af175fc44a285cf8b3a01544ed0f06005394eb 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Text;\r
-using System.Data;\r
-using System.Collections;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/overview/*'/>\r
-       public sealed class FbDatabaseInfo\r
-       {\r
-               #region Fields\r
-\r
-               private FbConnection connection;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Connection"]/*'/>\r
-               public FbConnection Connection\r
-               {\r
-                       get { return this.connection; }\r
-                       set { this.connection = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="IscVersion"]/*'/>\r
-               public string IscVersion\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_isc_version); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ServerVersion"]/*'/>\r
-               public string ServerVersion\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_firebird_version); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ServerClass"]/*'/>\r
-               public string ServerClass\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_db_class); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="PageSize"]/*'/>\r
-               public int PageSize\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_page_size); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="AllocationPages"]/*'/>\r
-               public int AllocationPages\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_allocation); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="BaseLevel"]/*'/>\r
-               public string BaseLevel\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_base_level); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="DbId"]/*'/>\r
-               public string DbId\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_db_id); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Implementation"]/*'/>\r
-               public string Implementation\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_implementation); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="NoReserve"]/*'/>\r
-               public bool NoReserve\r
-               {\r
-                       get { return this.GetBoolean(IscCodes.isc_info_no_reserve); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OdsVersion"]/*'/>\r
-               public int OdsVersion\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_ods_version); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OdsMinorVersion"]/*'/>\r
-               public int OdsMinorVersion\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_ods_minor_version); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="MaxMemory"]/*'/>\r
-               public int MaxMemory\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_max_memory); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="CurrentMemory"]/*'/>\r
-               public int CurrentMemory\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_current_memory); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ForcedWrites"]/*'/>\r
-               public bool ForcedWrites\r
-               {\r
-                       get { return this.GetBoolean(IscCodes.isc_info_forced_writes); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="NumBuffers"]/*'/>\r
-               public int NumBuffers\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_num_buffers); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="SweepInterval"]/*'/>\r
-               public int SweepInterval\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_sweep_interval); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ReadOnly"]/*'/>\r
-               public bool ReadOnly\r
-               {\r
-                       get { return this.GetBoolean(IscCodes.isc_info_db_read_only); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Fetches"]/*'/>\r
-               public int Fetches\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_fetches); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Marks"]/*'/>\r
-               public int Marks\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_marks); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Reads"]/*'/>\r
-               public int Reads\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_reads); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Writes"]/*'/>\r
-               public int Writes\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_writes); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="BackoutCount"]/*'/>\r
-               public int BackoutCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_backout_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="DeleteCount"]/*'/>\r
-               public int DeleteCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_delete_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ExpungeCount"]/*'/>\r
-               public int ExpungeCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_expunge_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="InsertCount"]/*'/>\r
-               public int InsertCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_insert_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="PurgeCount"]/*'/>\r
-               public int PurgeCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_purge_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ReadIdxCount"]/*'/>\r
-               public int ReadIdxCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_read_idx_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ReadSeqCount"]/*'/>\r
-               public int ReadSeqCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_read_seq_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="UpdateCount"]/*'/>\r
-               public int UpdateCount\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_update_count); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="DatabaseSizeInPages"]/*'/>\r
-               public int DatabaseSizeInPages\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_db_size_in_pages); }\r
-               }\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OldestTransaction"]/*'/>\r
-               public int OldestTransaction\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_oldest_transaction); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OldestActiveTransaction"]/*'/>\r
-               public int OldestActiveTransaction\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_oldest_active); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OldestActiveSnapshot"]/*'/>\r
-               public int OldestActiveSnapshot\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_oldest_snapshot); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="NextTransaction"]/*'/>\r
-               public int NextTransaction\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_next_transaction); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ActiveTransactions"]/*'/>\r
-               public int ActiveTransactions\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_active_transactions); }\r
-               }\r
-\r
-        /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ActiveUsers"]/*'/>\r
-        public ArrayList ActiveUsers\r
-        {\r
-            get { return this.GetArrayList(IscCodes.isc_info_user_names); }\r
-        }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/constructor[@name="ctor"]/*'/>\r
-               public FbDatabaseInfo()\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/constructor[@name="ctor(FbConnection)"]/*'/>\r
-               public FbDatabaseInfo(FbConnection connection)\r
-               {\r
-                       this.connection = connection;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private string GetString(byte item)\r
-               {\r
-                       this.CheckConnection();\r
-\r
-                       IDatabase db = this.Connection.InnerConnection.Database;\r
-                       byte[] items = new byte[]\r
-                               {\r
-                                       item,\r
-                                       IscCodes.isc_info_end\r
-                               };\r
-\r
-                       return (string)db.GetDatabaseInfo(items)[0];\r
-               }\r
-\r
-               private int GetInt32(byte item)\r
-               {\r
-                       this.CheckConnection();\r
-\r
-                       IDatabase db = this.Connection.InnerConnection.Database;\r
-                       byte[] items = new byte[]\r
-                               {\r
-                                       item,\r
-                                       IscCodes.isc_info_end\r
-                               };\r
-\r
-                       ArrayList info = db.GetDatabaseInfo(items);\r
-\r
-                       return (info.Count > 0 ? (int)info[0] : 0);\r
-               }\r
-\r
-               private bool GetBoolean(byte item)\r
-               {\r
-                       this.CheckConnection();\r
-\r
-                       IDatabase db = this.Connection.InnerConnection.Database;\r
-                       byte[] items = new byte[]\r
-                               {\r
-                                       item,\r
-                                       IscCodes.isc_info_end\r
-                               };\r
-\r
-                       ArrayList info = db.GetDatabaseInfo(items);\r
-\r
-                       return (info.Count > 0 ? (bool)info[0] : false);\r
-               }\r
-\r
-        private ArrayList GetArrayList(byte item)\r
-        {\r
-            this.CheckConnection();\r
-\r
-            IDatabase db = this.Connection.InnerConnection.Database;\r
-            byte[] items = new byte[]\r
-                               {\r
-                                       item,\r
-                                       IscCodes.isc_info_end\r
-                               };\r
-            \r
-            return db.GetDatabaseInfo(items);\r
-        }\r
-\r
-               private void CheckConnection()\r
-               {\r
-                       if (this.connection == null ||\r
-                               this.connection.State == ConnectionState.Closed)\r
-                       {\r
-                               throw new InvalidOperationException("Connection must valid and open");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Text;
+using System.Data;
+using System.Collections;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/overview/*'/>
+       public sealed class FbDatabaseInfo
+       {
+               #region Fields
+
+               private FbConnection connection;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Connection"]/*'/>
+               public FbConnection Connection
+               {
+                       get { return this.connection; }
+                       set { this.connection = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="IscVersion"]/*'/>
+               public string IscVersion
+               {
+                       get { return this.GetString(IscCodes.isc_info_isc_version); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ServerVersion"]/*'/>
+               public string ServerVersion
+               {
+                       get { return this.GetString(IscCodes.isc_info_firebird_version); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ServerClass"]/*'/>
+               public string ServerClass
+               {
+                       get { return this.GetString(IscCodes.isc_info_db_class); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="PageSize"]/*'/>
+               public int PageSize
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_page_size); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="AllocationPages"]/*'/>
+               public int AllocationPages
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_allocation); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="BaseLevel"]/*'/>
+               public string BaseLevel
+               {
+                       get { return this.GetString(IscCodes.isc_info_base_level); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="DbId"]/*'/>
+               public string DbId
+               {
+                       get { return this.GetString(IscCodes.isc_info_db_id); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Implementation"]/*'/>
+               public string Implementation
+               {
+                       get { return this.GetString(IscCodes.isc_info_implementation); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="NoReserve"]/*'/>
+               public bool NoReserve
+               {
+                       get { return this.GetBoolean(IscCodes.isc_info_no_reserve); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OdsVersion"]/*'/>
+               public int OdsVersion
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_ods_version); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OdsMinorVersion"]/*'/>
+               public int OdsMinorVersion
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_ods_minor_version); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="MaxMemory"]/*'/>
+               public int MaxMemory
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_max_memory); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="CurrentMemory"]/*'/>
+               public int CurrentMemory
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_current_memory); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ForcedWrites"]/*'/>
+               public bool ForcedWrites
+               {
+                       get { return this.GetBoolean(IscCodes.isc_info_forced_writes); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="NumBuffers"]/*'/>
+               public int NumBuffers
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_num_buffers); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="SweepInterval"]/*'/>
+               public int SweepInterval
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_sweep_interval); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ReadOnly"]/*'/>
+               public bool ReadOnly
+               {
+                       get { return this.GetBoolean(IscCodes.isc_info_db_read_only); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Fetches"]/*'/>
+               public int Fetches
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_fetches); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Marks"]/*'/>
+               public int Marks
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_marks); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Reads"]/*'/>
+               public int Reads
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_reads); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="Writes"]/*'/>
+               public int Writes
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_writes); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="BackoutCount"]/*'/>
+               public int BackoutCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_backout_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="DeleteCount"]/*'/>
+               public int DeleteCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_delete_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ExpungeCount"]/*'/>
+               public int ExpungeCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_expunge_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="InsertCount"]/*'/>
+               public int InsertCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_insert_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="PurgeCount"]/*'/>
+               public int PurgeCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_purge_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ReadIdxCount"]/*'/>
+               public int ReadIdxCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_read_idx_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ReadSeqCount"]/*'/>
+               public int ReadSeqCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_read_seq_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="UpdateCount"]/*'/>
+               public int UpdateCount
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_update_count); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="DatabaseSizeInPages"]/*'/>
+               public int DatabaseSizeInPages
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_db_size_in_pages); }
+               }
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OldestTransaction"]/*'/>
+               public int OldestTransaction
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_oldest_transaction); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OldestActiveTransaction"]/*'/>
+               public int OldestActiveTransaction
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_oldest_active); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="OldestActiveSnapshot"]/*'/>
+               public int OldestActiveSnapshot
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_oldest_snapshot); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="NextTransaction"]/*'/>
+               public int NextTransaction
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_next_transaction); }
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ActiveTransactions"]/*'/>
+               public int ActiveTransactions
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_active_transactions); }
+               }
+
+        /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/property[@name="ActiveUsers"]/*'/>
+        public ArrayList ActiveUsers
+        {
+            get { return this.GetArrayList(IscCodes.isc_info_user_names); }
+        }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/constructor[@name="ctor"]/*'/>
+               public FbDatabaseInfo()
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbDatabaseInfo.xml' path='doc/class[@name="FbDatabaseInfo"]/constructor[@name="ctor(FbConnection)"]/*'/>
+               public FbDatabaseInfo(FbConnection connection)
+               {
+                       this.connection = connection;
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private string GetString(byte item)
+               {
+                       this.CheckConnection();
+
+                       IDatabase db = this.Connection.InnerConnection.Database;
+                       byte[] items = new byte[]
+                               {
+                                       item,
+                                       IscCodes.isc_info_end
+                               };
+
+                       return (string)db.GetDatabaseInfo(items)[0];
+               }
+
+               private int GetInt32(byte item)
+               {
+                       this.CheckConnection();
+
+                       IDatabase db = this.Connection.InnerConnection.Database;
+                       byte[] items = new byte[]
+                               {
+                                       item,
+                                       IscCodes.isc_info_end
+                               };
+
+                       ArrayList info = db.GetDatabaseInfo(items);
+
+                       return (info.Count > 0 ? (int)info[0] : 0);
+               }
+
+               private bool GetBoolean(byte item)
+               {
+                       this.CheckConnection();
+
+                       IDatabase db = this.Connection.InnerConnection.Database;
+                       byte[] items = new byte[]
+                               {
+                                       item,
+                                       IscCodes.isc_info_end
+                               };
+
+                       ArrayList info = db.GetDatabaseInfo(items);
+
+                       return (info.Count > 0 ? (bool)info[0] : false);
+               }
+
+        private ArrayList GetArrayList(byte item)
+        {
+            this.CheckConnection();
+
+            IDatabase db = this.Connection.InnerConnection.Database;
+            byte[] items = new byte[]
+                               {
+                                       item,
+                                       IscCodes.isc_info_end
+                               };
+            
+            return db.GetDatabaseInfo(items);
+        }
+
+               private void CheckConnection()
+               {
+                       if (this.connection == null ||
+                               this.connection.State == ConnectionState.Closed)
+                       {
+                               throw new InvalidOperationException("Connection must valid and open");
+                       }
+               }
+
+               #endregion
+       }
+}
index 0c308886855c5006878717e1ae482e09db120b30..bb1178bb0429093b1419035e6b325e81f2ba9eac 100644 (file)
@@ -1,85 +1,85 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Serializable]\r
-#endif\r
-       [Obsolete("Use the FbConnection.GetSchema() methods.")]\r
-       public enum FbDbSchemaType\r
-       {\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="CharacterSets"]/*'/>\r
-               CharacterSets,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="CheckConstraints"]/*'/>\r
-               CheckConstraints,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="CheckConstraintsByTable"]/*'/>\r
-               CheckConstraintsByTable,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Collations"]/*'/>\r
-               Collations,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Columns"]/*'/>\r
-               Columns,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ColumnPrivileges"]/*'/>\r
-               ColumnPrivileges,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="DataTypes"]/*'/>\r
-               DataTypes,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Domains"]/*'/>\r
-               Domains,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ForeignKeys"]/*'/>\r
-               ForeignKeys,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Functions"]/*'/>\r
-               Functions,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Generators"]/*'/>\r
-               Generators,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Indexes"]/*'/>\r
-               Indexes,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="MetaDataCollections"]/*'/>\r
-               MetaDataCollections,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="PrimaryKeys"]/*'/>\r
-               PrimaryKeys,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ProcedureParameters"]/*'/>\r
-               ProcedureParameters,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ProcedurePrivileges"]/*'/>\r
-               ProcedurePrivileges,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Procedures"]/*'/>\r
-               Procedures,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Restrictions"]/*'/>\r
-               Restrictions,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Roles"]/*'/>\r
-               Roles,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="TableConstraints"]/*'/>\r
-               TableConstraints,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="TablePrivileges"]/*'/>\r
-               TablePrivileges,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Tables"]/*'/>\r
-               Tables,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Triggers"]/*'/>\r
-               Triggers,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="UniqueKeys"]/*'/>\r
-               UniqueKeys,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ViewColumnUsage"]/*'/>\r
-               ViewColumnUsage,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ViewPrivileges"]/*'/>\r
-               ViewPrivileges,\r
-               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Views"]/*'/>\r
-               Views\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/overview/*'/>
+#if    (!NETCF)
+       [Serializable]
+#endif
+       [Obsolete("Use the FbConnection.GetSchema() methods.")]
+       public enum FbDbSchemaType
+       {
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="CharacterSets"]/*'/>
+               CharacterSets,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="CheckConstraints"]/*'/>
+               CheckConstraints,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="CheckConstraintsByTable"]/*'/>
+               CheckConstraintsByTable,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Collations"]/*'/>
+               Collations,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Columns"]/*'/>
+               Columns,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ColumnPrivileges"]/*'/>
+               ColumnPrivileges,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="DataTypes"]/*'/>
+               DataTypes,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Domains"]/*'/>
+               Domains,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ForeignKeys"]/*'/>
+               ForeignKeys,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Functions"]/*'/>
+               Functions,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Generators"]/*'/>
+               Generators,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Indexes"]/*'/>
+               Indexes,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="MetaDataCollections"]/*'/>
+               MetaDataCollections,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="PrimaryKeys"]/*'/>
+               PrimaryKeys,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ProcedureParameters"]/*'/>
+               ProcedureParameters,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ProcedurePrivileges"]/*'/>
+               ProcedurePrivileges,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Procedures"]/*'/>
+               Procedures,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Restrictions"]/*'/>
+               Restrictions,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Roles"]/*'/>
+               Roles,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="TableConstraints"]/*'/>
+               TableConstraints,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="TablePrivileges"]/*'/>
+               TablePrivileges,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Tables"]/*'/>
+               Tables,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Triggers"]/*'/>
+               Triggers,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="UniqueKeys"]/*'/>
+               UniqueKeys,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ViewColumnUsage"]/*'/>
+               ViewColumnUsage,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="ViewPrivileges"]/*'/>
+               ViewPrivileges,
+               /// <include file='Doc/en_EN/FbDbSchemaType.xml' path='doc/enum[@name="FbDbSchemaType"]/field[@name="Views"]/*'/>
+               Views
+       }
+}
index fcef761117e0accaa44b7b6739bf04c54cdf525f..3db1cc8f75d2e9abdb5b5cc9c3d6f1cbdc0038e8 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Serializable]\r
-#endif\r
-       public enum FbDbType\r
-       {\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Array"]/*'/>\r
-               Array,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="BigInt"]/*'/>\r
-               BigInt,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Binary"]/*'/>\r
-               Binary,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Char"]/*'/>\r
-               Char,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Date"]/*'/>\r
-               Date,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Decimal"]/*'/>\r
-               Decimal,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Double"]/*'/>\r
-               Double,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Float"]/*'/>\r
-               Float,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Guid"]/*'/>\r
-               Guid,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Integer"]/*'/>\r
-               Integer,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Numeric"]/*'/>\r
-               Numeric,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="SmallInt"]/*'/>\r
-               SmallInt,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Text"]/*'/>\r
-               Text,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Time"]/*'/>\r
-               Time,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="TimeStamp"]/*'/>\r
-               TimeStamp,\r
-               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="VarChar"]/*'/>\r
-               VarChar\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/overview/*'/>
+#if    (!NETCF)
+       [Serializable]
+#endif
+       public enum FbDbType
+       {
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Array"]/*'/>
+               Array,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="BigInt"]/*'/>
+               BigInt,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Binary"]/*'/>
+               Binary,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Char"]/*'/>
+               Char,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Date"]/*'/>
+               Date,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Decimal"]/*'/>
+               Decimal,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Double"]/*'/>
+               Double,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Float"]/*'/>
+               Float,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Guid"]/*'/>
+               Guid,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Integer"]/*'/>
+               Integer,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Numeric"]/*'/>
+               Numeric,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="SmallInt"]/*'/>
+               SmallInt,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Text"]/*'/>
+               Text,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="Time"]/*'/>
+               Time,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="TimeStamp"]/*'/>
+               TimeStamp,
+               /// <include file='Doc/en_EN/FbDbType.xml' path='doc/enum[@name="FbDbType"]/field[@name="VarChar"]/*'/>
+               VarChar
+       }
+}
index 8ae4c674bc264ee080cf6c5ba0622bd7b44c014e..41e3b1c1319375152a827a1f072fe821ace949dd 100644 (file)
@@ -1,88 +1,88 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Serializable]\r
-#endif\r
-       public sealed class FbError\r
-       {\r
-               #region Fields\r
-\r
-               private byte    classError;\r
-               private int             lineNumber;\r
-               private string  message;\r
-               private int             number;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="Class"]/*'/>\r
-               public byte Class\r
-               {\r
-                       get { return this.classError; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="LineNumber"]/*'/>            \r
-               public int LineNumber\r
-               {\r
-                       get { return this.lineNumber; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="Message"]/*'/>\r
-               public string Message\r
-               {\r
-                       get { return this.message; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="Number"]/*'/>\r
-               public int Number\r
-               {\r
-                       get { return this.number; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal FbError(string message, int number)\r
-                       : this(0, 0, message, number)\r
-               {\r
-               }\r
-\r
-               internal FbError(byte classError, string message, int number)\r
-                       : this(classError, 0, message, number)\r
-               {\r
-               }\r
-\r
-               internal FbError(byte classError, int line, string message, int number)\r
-               {\r
-                       this.classError = classError;\r
-                       this.lineNumber = line;\r
-                       this.number             = number;\r
-                       this.message    = message;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/overview/*'/>
+#if    (!NETCF)
+       [Serializable]
+#endif
+       public sealed class FbError
+       {
+               #region Fields
+
+               private byte    classError;
+               private int             lineNumber;
+               private string  message;
+               private int             number;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="Class"]/*'/>
+               public byte Class
+               {
+                       get { return this.classError; }
+               }
+
+               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="LineNumber"]/*'/>            
+               public int LineNumber
+               {
+                       get { return this.lineNumber; }
+               }
+
+               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="Message"]/*'/>
+               public string Message
+               {
+                       get { return this.message; }
+               }
+
+               /// <include file='Doc/en_EN/FbError.xml' path='doc/class[@name="FbError"]/property[@name="Number"]/*'/>
+               public int Number
+               {
+                       get { return this.number; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               internal FbError(string message, int number)
+                       : this(0, 0, message, number)
+               {
+               }
+
+               internal FbError(byte classError, string message, int number)
+                       : this(classError, 0, message, number)
+               {
+               }
+
+               internal FbError(byte classError, int line, string message, int number)
+               {
+                       this.classError = classError;
+                       this.lineNumber = line;
+                       this.number             = number;
+                       this.message    = message;
+               }
+
+               #endregion
+       }
+}
index 91ddddd8a5a896c8a949f7f3881061a567e9bd3e..3574b0257e7230d7b7e893e7ca8115a262828ee1 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.ComponentModel;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Serializable, ListBindable(false)]\r
-#endif\r
-       public sealed class FbErrorCollection : ICollection, IEnumerable\r
-       {\r
-               #region Fields\r
-\r
-               private ArrayList errors;\r
-\r
-               #endregion\r
-\r
-               #region Indexers\r
-\r
-               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/indexer[@name="Item(System.Int32)"]/*'/>\r
-               public FbError this[int index]\r
-               {\r
-                       get { return (FbError)this.errors[index]; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal FbErrorCollection()\r
-               {\r
-                       this.errors = ArrayList.Synchronized(new ArrayList());\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICollection     Properties\r
-\r
-               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/property[@name="Count"]/*'/>\r
-               public int Count\r
-               {\r
-                       get { return this.errors.Count; }\r
-               }\r
-\r
-               bool ICollection.IsSynchronized\r
-               {\r
-                       get { return this.errors.IsSynchronized; }\r
-               }\r
-\r
-               object ICollection.SyncRoot\r
-               {\r
-                       get { return this.errors.SyncRoot; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICollection     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="CopyTo(System.Array,System.Int32)"]/*'/>       \r
-               public void CopyTo(Array array, int index)\r
-               {\r
-                       this.errors.CopyTo(array, index);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IEnumerable     Methods\r
-\r
-               IEnumerator IEnumerable.GetEnumerator()\r
-               {\r
-                       return this.errors.GetEnumerator();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Methods\r
-\r
-               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="IndexOf(System.String)"]/*'/>          \r
-               internal int IndexOf(string errorMessage)\r
-               {\r
-                       int index = 0;\r
-                       foreach (FbError item in this)\r
-                       {\r
-                               if (GlobalizationHelper.CultureAwareCompare(item.Message, errorMessage))\r
-                               {\r
-                                       return index;\r
-                               }\r
-                               index++;\r
-                       }\r
-\r
-                       return -1;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="Add(FbError)"]/*'/>\r
-               internal FbError Add(FbError error)\r
-               {\r
-                       this.errors.Add(error);\r
-\r
-                       return error;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="Add(System.String,System.Int32)"]/*'/>\r
-               internal FbError Add(string errorMessage, int number)\r
-               {\r
-                       FbError error = new FbError(errorMessage, number);\r
-\r
-                       return this.Add(error);\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/overview/*'/>
+#if    (!NETCF)
+       [Serializable, ListBindable(false)]
+#endif
+       public sealed class FbErrorCollection : ICollection, IEnumerable
+       {
+               #region Fields
+
+               private ArrayList errors;
+
+               #endregion
+
+               #region Indexers
+
+               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/indexer[@name="Item(System.Int32)"]/*'/>
+               public FbError this[int index]
+               {
+                       get { return (FbError)this.errors[index]; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               internal FbErrorCollection()
+               {
+                       this.errors = ArrayList.Synchronized(new ArrayList());
+               }
+
+               #endregion
+
+               #region ICollection     Properties
+
+               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/property[@name="Count"]/*'/>
+               public int Count
+               {
+                       get { return this.errors.Count; }
+               }
+
+               bool ICollection.IsSynchronized
+               {
+                       get { return this.errors.IsSynchronized; }
+               }
+
+               object ICollection.SyncRoot
+               {
+                       get { return this.errors.SyncRoot; }
+               }
+
+               #endregion
+
+               #region ICollection     Methods
+
+               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="CopyTo(System.Array,System.Int32)"]/*'/>       
+               public void CopyTo(Array array, int index)
+               {
+                       this.errors.CopyTo(array, index);
+               }
+
+               #endregion
+
+               #region IEnumerable     Methods
+
+               IEnumerator IEnumerable.GetEnumerator()
+               {
+                       return this.errors.GetEnumerator();
+               }
+
+               #endregion
+
+               #region Internal Methods
+
+               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="IndexOf(System.String)"]/*'/>          
+               internal int IndexOf(string errorMessage)
+               {
+                       int index = 0;
+                       foreach (FbError item in this)
+                       {
+                               if (GlobalizationHelper.CultureAwareCompare(item.Message, errorMessage))
+                               {
+                                       return index;
+                               }
+                               index++;
+                       }
+
+                       return -1;
+               }
+
+               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="Add(FbError)"]/*'/>
+               internal FbError Add(FbError error)
+               {
+                       this.errors.Add(error);
+
+                       return error;
+               }
+
+               /// <include file='Doc/en_EN/FbErrorCollection.xml'     path='doc/class[@name="FbErrorCollection"]/method[@name="Add(System.String,System.Int32)"]/*'/>
+               internal FbError Add(string errorMessage, int number)
+               {
+                       FbError error = new FbError(errorMessage, number);
+
+                       return this.Add(error);
+               }
+
+               #endregion
+       }
+}
index c0006fba4ea96cc653a85218b4f752eb91beda8a..946b04f9ac334da5879ce8f137af004087c28b6c 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.ComponentModel;\r
-using System.Security.Permissions;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Serializable]\r
-#endif\r
-       public sealed class FbException : SystemException\r
-       {\r
-               #region Fields\r
-\r
-               private FbErrorCollection errors = new FbErrorCollection();\r
-               private int errorCode;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/property[@name="Errors"]/*'/>\r
-#if    (!NETCF)\r
-               [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]\r
-#endif\r
-               public FbErrorCollection Errors\r
-               {\r
-                       get { return this.errors; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/property[@name="ErrorCode"]/*'/>\r
-               public int ErrorCode\r
-               {\r
-                       get { return this.errorCode; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal FbException() : base()\r
-               {\r
-               }\r
-\r
-               internal FbException(string message) : base(message)\r
-               {\r
-               }\r
-\r
-               internal FbException(string message, IscException ex) : base(message)\r
-               {\r
-                       this.errorCode = ex.ErrorCode;\r
-#if    (!NETCF)\r
-                       this.Source = ex.Source;\r
-#endif\r
-\r
-                       this.GetIscExceptionErrors(ex);\r
-               }\r
-\r
-#if    (!NETCF)\r
-\r
-               internal FbException(\r
-            System.Runtime.Serialization.SerializationInfo info, \r
-            System.Runtime.Serialization.StreamingContext context) : base(info, context)\r
-               {\r
-                       this.errors = (FbErrorCollection)info.GetValue("errors", typeof(FbErrorCollection));\r
-                       this.errorCode = info.GetInt32("errorCode");\r
-               }\r
-\r
-#endif\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-#if    (!NETCF)\r
-\r
-               /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/method[@name="GetObjectData(SerializationInfo, StreamingContext)"]/*'/>\r
-               [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]\r
-               public override void GetObjectData(\r
-            System.Runtime.Serialization.SerializationInfo info, \r
-            System.Runtime.Serialization.StreamingContext context)\r
-               {\r
-                       info.AddValue("errors", this.errors);\r
-                       info.AddValue("errorCode", this.errorCode);\r
-\r
-                       base.GetObjectData(info, context);\r
-               }\r
-\r
-#endif\r
-\r
-               #endregion\r
-\r
-               #region Internal Methods\r
-\r
-               internal void GetIscExceptionErrors(IscException ex)\r
-               {\r
-                       foreach (IscError error in ex.Errors)\r
-                       {\r
-                               this.errors.Add(error.Message, error.ErrorCode);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.ComponentModel;
+using System.Security.Permissions;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/overview/*'/>
+#if    (!NETCF)
+       [Serializable]
+#endif
+       public sealed class FbException : SystemException
+       {
+               #region Fields
+
+               private FbErrorCollection errors = new FbErrorCollection();
+               private int errorCode;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/property[@name="Errors"]/*'/>
+#if    (!NETCF)
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+#endif
+               public FbErrorCollection Errors
+               {
+                       get { return this.errors; }
+               }
+
+               /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/property[@name="ErrorCode"]/*'/>
+               public int ErrorCode
+               {
+                       get { return this.errorCode; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               internal FbException() : base()
+               {
+               }
+
+               internal FbException(string message) : base(message)
+               {
+               }
+
+               internal FbException(string message, IscException ex) : base(message)
+               {
+                       this.errorCode = ex.ErrorCode;
+#if    (!NETCF)
+                       this.Source = ex.Source;
+#endif
+
+                       this.GetIscExceptionErrors(ex);
+               }
+
+#if    (!NETCF)
+
+               internal FbException(
+            System.Runtime.Serialization.SerializationInfo info, 
+            System.Runtime.Serialization.StreamingContext context) : base(info, context)
+               {
+                       this.errors = (FbErrorCollection)info.GetValue("errors", typeof(FbErrorCollection));
+                       this.errorCode = info.GetInt32("errorCode");
+               }
+
+#endif
+
+               #endregion
+
+               #region Methods
+
+#if    (!NETCF)
+
+               /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/method[@name="GetObjectData(SerializationInfo, StreamingContext)"]/*'/>
+               [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
+               public override void GetObjectData(
+            System.Runtime.Serialization.SerializationInfo info, 
+            System.Runtime.Serialization.StreamingContext context)
+               {
+                       info.AddValue("errors", this.errors);
+                       info.AddValue("errorCode", this.errorCode);
+
+                       base.GetObjectData(info, context);
+               }
+
+#endif
+
+               #endregion
+
+               #region Internal Methods
+
+               internal void GetIscExceptionErrors(IscException ex)
+               {
+                       foreach (IscError error in ex.Errors)
+                       {
+                               this.errors.Add(error.Message, error.ErrorCode);
+                       }
+               }
+
+               #endregion
+       }
+}
index 4387619e38077ce9d55b6346fa09934933b912de..5ed2ad31b0504505065b59a46896113c2ea5dd52 100644 (file)
@@ -1,71 +1,71 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       #region Delegates\r
-\r
-       /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/delegate[@name="FbInfoMessageEventHandler"]/overview/*'/>\r
-       public delegate void FbInfoMessageEventHandler(object sender, FbInfoMessageEventArgs e);\r
-\r
-       #endregion\r
-\r
-       /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/class[@name="FbInfoMessageEventArgs"]/overview/*'/>\r
-       public sealed class FbInfoMessageEventArgs : EventArgs\r
-       {\r
-               #region Fields\r
-\r
-               private FbErrorCollection errors = new FbErrorCollection();\r
-               private string message = String.Empty;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/class[@name="FbInfoMessageEventArgs"]/property[@name="Errors"]/*'/>\r
-               public FbErrorCollection Errors\r
-               {\r
-                       get { return this.errors; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/class[@name="FbInfoMessageEventArgs"]/property[@name="Message"]/*'/>\r
-               public string Message\r
-               {\r
-                       get { return this.message; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal FbInfoMessageEventArgs(IscException ex)\r
-               {\r
-                       this.message = ex.Message;\r
-\r
-                       foreach (IscError error in ex.Errors)\r
-                       {\r
-                               this.errors.Add(error.Message, error.ErrorCode);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       #region Delegates
+
+       /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/delegate[@name="FbInfoMessageEventHandler"]/overview/*'/>
+       public delegate void FbInfoMessageEventHandler(object sender, FbInfoMessageEventArgs e);
+
+       #endregion
+
+       /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/class[@name="FbInfoMessageEventArgs"]/overview/*'/>
+       public sealed class FbInfoMessageEventArgs : EventArgs
+       {
+               #region Fields
+
+               private FbErrorCollection errors = new FbErrorCollection();
+               private string message = String.Empty;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/class[@name="FbInfoMessageEventArgs"]/property[@name="Errors"]/*'/>
+               public FbErrorCollection Errors
+               {
+                       get { return this.errors; }
+               }
+
+               /// <include file='Doc/en_EN/FbInfoMessageEventArgs.xml' path='doc/class[@name="FbInfoMessageEventArgs"]/property[@name="Message"]/*'/>
+               public string Message
+               {
+                       get { return this.message; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               internal FbInfoMessageEventArgs(IscException ex)
+               {
+                       this.message = ex.Message;
+
+                       foreach (IscError error in ex.Errors)
+                       {
+                               this.errors.Add(error.Message, error.ErrorCode);
+                       }
+               }
+
+               #endregion
+       }
+}
index 64414a27a774e14fecf50504f309e097ad1bdf15..04ccdb0d5d40b8e08963266d1e54abfbced48428 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.ComponentModel;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/overview/*'/>\r
-#if    (NET)\r
-       [ParenthesizePropertyName(true)]\r
-       [TypeConverter(typeof(Design.FbParameterConverter))]\r
-#endif\r
-       public sealed class FbParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable\r
-       {\r
-               #region Fields\r
-\r
-               private FbParameterCollection parent;\r
-               private FbDbType                        fbType;\r
-               private ParameterDirection      direction;\r
-               private DataRowVersion          sourceVersion;\r
-               private FbCharset                       charset;\r
-               private bool                            isNullable;\r
-               private string                          parameterName;\r
-               private string                          sourceColumn;\r
-               private object                          value;\r
-               private byte                            precision;\r
-               private byte                            scale;\r
-               private int                                     size;\r
-               private bool                            inferType;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               string IDataParameter.ParameterName\r
-               {\r
-                       get { return this.ParameterName; }\r
-                       set { this.ParameterName = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="ParameterName"]/*'/>\r
-#if    (!NETCF)\r
-               [DefaultValue("")]\r
-#endif\r
-               public string ParameterName\r
-               {\r
-                       get { return this.parameterName; }\r
-                       set { this.parameterName = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Precision"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue((byte)0)]\r
-#endif\r
-               public byte Precision\r
-               {\r
-                       get { return this.precision; }\r
-                       set { this.precision = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Scale"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue((byte)0)]\r
-#endif\r
-               public byte Scale\r
-               {\r
-                       get { return this.scale; }\r
-                       set { this.scale = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Size"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue(0)]\r
-#endif\r
-               public int Size\r
-               {\r
-                       get { return this.size; }\r
-                       set { this.size = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="DbType"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), Category("Data"), RefreshProperties(RefreshProperties.All),\r
-               DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public DbType DbType\r
-               {\r
-                       get { return TypeHelper.GetDbType((DbDataType)this.fbType); }\r
-                       set { this.fbType = (FbDbType)TypeHelper.GetDbDataType(value); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="FbDbType"]/*'/>\r
-#if    (!NETCF)\r
-               [RefreshProperties(RefreshProperties.All), Category("Data"), DefaultValue(FbDbType.VarChar)]\r
-#endif\r
-               public FbDbType FbDbType\r
-               {\r
-                       get { return this.fbType; }\r
-                       set\r
-                       {\r
-                               this.fbType             = value;\r
-                               this.inferType  = false;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Direction"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue(ParameterDirection.Input)]\r
-#endif\r
-               public ParameterDirection Direction\r
-               {\r
-                       get { return this.direction; }\r
-                       set { this.direction = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="IsNullable"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignOnly(true), DefaultValue(false), EditorBrowsable(EditorBrowsableState.Advanced)]\r
-#endif\r
-               public Boolean IsNullable\r
-               {\r
-                       get { return this.isNullable; }\r
-                       set { this.isNullable = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="SourceColumn"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue("")]\r
-#endif\r
-               public string SourceColumn\r
-               {\r
-                       get { return this.sourceColumn; }\r
-                       set { this.sourceColumn = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="SourceVersion"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue(DataRowVersion.Current)]\r
-#endif\r
-               public DataRowVersion SourceVersion\r
-               {\r
-                       get { return this.sourceVersion; }\r
-                       set { this.sourceVersion = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Value"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), TypeConverter(typeof(StringConverter)), DefaultValue(null)]\r
-#endif\r
-               public object Value\r
-               {\r
-                       get { return this.value; }\r
-                       set\r
-                       {\r
-                               if (value == null)\r
-                               {\r
-                                       value = System.DBNull.Value;\r
-                               }\r
-\r
-                               if (this.FbDbType == FbDbType.Guid && value != null \r
-                                       && value != DBNull.Value &&\r
-                                       !(value is Guid) && !(value is byte[]))\r
-                               {\r
-                                       throw new InvalidOperationException("Incorrect Guid value.");\r
-                               }\r
-\r
-                               this.value = value;\r
-\r
-                               if (this.inferType)\r
-                               {\r
-                                       this.SetFbDbType(value);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Charset"]/*'/>\r
-#if    (!NETCF)\r
-               [Category("Data"), DefaultValue(FbCharset.Default)]\r
-#endif\r
-               public FbCharset Charset\r
-               {\r
-                       get { return this.charset; }\r
-                       set { this.charset = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Properties\r
-\r
-               internal FbParameterCollection Parent\r
-               {\r
-                       get { return this.parent; }\r
-                       set { this.parent = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor"]/*'/>\r
-               public FbParameter()\r
-               {\r
-                       this.fbType                     = FbDbType.VarChar;\r
-                       this.direction          = ParameterDirection.Input;\r
-                       this.sourceVersion      = DataRowVersion.Current;\r
-                       this.sourceColumn       = String.Empty;\r
-                       this.parameterName      = String.Empty;\r
-                       this.inferType          = true;\r
-                       this.charset            = FbCharset.Default;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,System.Object)"]/*'/>\r
-               public FbParameter(string parameterName, object value) : this()\r
-               {\r
-                       this.parameterName      = parameterName;\r
-                       this.Value                      = value;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType)"]/*'/>\r
-               public FbParameter(string parameterName, FbDbType fbType) : this()\r
-               {\r
-                       this.inferType          = false;\r
-                       this.parameterName      = parameterName;\r
-                       this.fbType                     = fbType;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType,System.Int32)"]/*'/>\r
-               public FbParameter(string parameterName, FbDbType fbType, int size) : this()\r
-               {\r
-                       this.inferType          = false;\r
-                       this.parameterName      = parameterName;\r
-                       this.fbType                     = fbType;\r
-                       this.size                       = size;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType,System.Int32,System.String)"]/*'/>\r
-               public FbParameter(string parameterName, FbDbType fbType, int size, string sourceColumn)\r
-                       : this()\r
-               {\r
-                       this.inferType          = false;\r
-                       this.parameterName      = parameterName;\r
-                       this.fbType                     = fbType;\r
-                       this.size                       = size;\r
-                       this.sourceColumn       = sourceColumn;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType,System.Int32,System.Data.ParameterDirection,System.Boolean,System.Byte,System.Byte,System.String,System.Data.DataRowVersion,System.Object)"]/*'/>\r
-#if    (!NETCF)\r
-               [EditorBrowsable(EditorBrowsableState.Advanced)]\r
-#endif\r
-               public FbParameter(\r
-                       string                          parameterName, \r
-                       FbDbType                        dbType, \r
-                       int                                     size,\r
-                       ParameterDirection      direction,\r
-                       bool                            isNullable,\r
-                       byte                            precision,\r
-                       byte                            scale,\r
-                       string                          sourceColumn,\r
-                       DataRowVersion          sourceVersion,\r
-                       object                          value)\r
-               {\r
-                       this.inferType          = false;\r
-                       this.parameterName      = parameterName;\r
-                       this.fbType                     = dbType;\r
-                       this.size                       = size;\r
-                       this.direction          = direction;\r
-                       this.isNullable         = isNullable;\r
-                       this.precision          = precision;\r
-                       this.scale                      = scale;\r
-                       this.sourceColumn       = sourceColumn;\r
-                       this.sourceVersion      = sourceVersion;\r
-                       this.value                      = value;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICloneable Methods\r
-\r
-               object ICloneable.Clone()\r
-               {\r
-                       FbParameter p = new FbParameter(\r
-                               this.parameterName,\r
-                               this.fbType,\r
-                               this.size,\r
-                               this.direction,\r
-                               this.isNullable,\r
-                               this.precision,\r
-                               this.scale,\r
-                               this.sourceColumn,\r
-                               this.sourceVersion,\r
-                               this.value);\r
-\r
-                       // Set extra properties\r
-                       p.Charset = this.charset;\r
-\r
-                       return p;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbParameter"]/method[@name="ToString"]/*'/>\r
-               public override string ToString()\r
-               {\r
-                       return this.parameterName;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void SetFbDbType(object value)\r
-               {\r
-                       if (value == null)\r
-                       {\r
-                               value = System.DBNull.Value;\r
-                       }\r
-\r
-                       TypeCode code = Type.GetTypeCode(value.GetType());\r
-\r
-                       switch (code)\r
-                       {\r
-                               case TypeCode.Object:\r
-                                       this.fbType = FbDbType.Binary;\r
-                                       break;\r
-\r
-                               case TypeCode.Char:\r
-                                       this.fbType = FbDbType.Char;\r
-                                       break;\r
-\r
-                               case TypeCode.DBNull:\r
-                               case TypeCode.String:\r
-                                       this.fbType = FbDbType.VarChar;\r
-                                       break;\r
-\r
-                               case TypeCode.Boolean:\r
-                               case TypeCode.Byte:\r
-                               case TypeCode.SByte:\r
-                               case TypeCode.Int16:\r
-                               case TypeCode.UInt16:\r
-                                       this.fbType = FbDbType.SmallInt;\r
-                                       break;\r
-\r
-                               case TypeCode.Int32:\r
-                               case TypeCode.UInt32:\r
-                                       this.fbType = FbDbType.Integer;\r
-                                       break;\r
-\r
-                               case TypeCode.Int64:\r
-                               case TypeCode.UInt64:\r
-                                       this.fbType = FbDbType.BigInt;\r
-                                       break;\r
-\r
-                               case TypeCode.Single:\r
-                                       this.fbType = FbDbType.Float;\r
-                                       break;\r
-\r
-                               case TypeCode.Double:\r
-                                       this.fbType = FbDbType.Double;\r
-                                       break;\r
-\r
-                               case TypeCode.Decimal:\r
-                                       this.fbType = FbDbType.Decimal;\r
-                                       break;\r
-\r
-                               case TypeCode.DateTime:\r
-                                       this.fbType = FbDbType.TimeStamp;\r
-                                       break;\r
-\r
-                               case TypeCode.Empty:\r
-                               default:\r
-                                       if (value is Guid)\r
-                                       {\r
-                                               this.fbType = FbDbType.Guid;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               throw new SystemException("Value is of unknown data type");\r
-                                       }\r
-                                       break;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.ComponentModel;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/overview/*'/>
+#if    (NET)
+       [ParenthesizePropertyName(true)]
+       [TypeConverter(typeof(Design.FbParameterConverter))]
+#endif
+       public sealed class FbParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+       {
+               #region Fields
+
+               private FbParameterCollection parent;
+               private FbDbType                        fbType;
+               private ParameterDirection      direction;
+               private DataRowVersion          sourceVersion;
+               private FbCharset                       charset;
+               private bool                            isNullable;
+               private string                          parameterName;
+               private string                          sourceColumn;
+               private object                          value;
+               private byte                            precision;
+               private byte                            scale;
+               private int                                     size;
+               private bool                            inferType;
+
+               #endregion
+
+               #region Properties
+
+               string IDataParameter.ParameterName
+               {
+                       get { return this.ParameterName; }
+                       set { this.ParameterName = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="ParameterName"]/*'/>
+#if    (!NETCF)
+               [DefaultValue("")]
+#endif
+               public string ParameterName
+               {
+                       get { return this.parameterName; }
+                       set { this.parameterName = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Precision"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue((byte)0)]
+#endif
+               public byte Precision
+               {
+                       get { return this.precision; }
+                       set { this.precision = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Scale"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue((byte)0)]
+#endif
+               public byte Scale
+               {
+                       get { return this.scale; }
+                       set { this.scale = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Size"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue(0)]
+#endif
+               public int Size
+               {
+                       get { return this.size; }
+                       set { this.size = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="DbType"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), Category("Data"), RefreshProperties(RefreshProperties.All),
+               DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public DbType DbType
+               {
+                       get { return TypeHelper.GetDbType((DbDataType)this.fbType); }
+                       set { this.fbType = (FbDbType)TypeHelper.GetDbDataType(value); }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="FbDbType"]/*'/>
+#if    (!NETCF)
+               [RefreshProperties(RefreshProperties.All), Category("Data"), DefaultValue(FbDbType.VarChar)]
+#endif
+               public FbDbType FbDbType
+               {
+                       get { return this.fbType; }
+                       set
+                       {
+                               this.fbType             = value;
+                               this.inferType  = false;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Direction"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue(ParameterDirection.Input)]
+#endif
+               public ParameterDirection Direction
+               {
+                       get { return this.direction; }
+                       set { this.direction = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="IsNullable"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignOnly(true), DefaultValue(false), EditorBrowsable(EditorBrowsableState.Advanced)]
+#endif
+               public Boolean IsNullable
+               {
+                       get { return this.isNullable; }
+                       set { this.isNullable = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="SourceColumn"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue("")]
+#endif
+               public string SourceColumn
+               {
+                       get { return this.sourceColumn; }
+                       set { this.sourceColumn = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="SourceVersion"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue(DataRowVersion.Current)]
+#endif
+               public DataRowVersion SourceVersion
+               {
+                       get { return this.sourceVersion; }
+                       set { this.sourceVersion = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Value"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), TypeConverter(typeof(StringConverter)), DefaultValue(null)]
+#endif
+               public object Value
+               {
+                       get { return this.value; }
+                       set
+                       {
+                               if (value == null)
+                               {
+                                       value = System.DBNull.Value;
+                               }
+
+                               if (this.FbDbType == FbDbType.Guid && value != null 
+                                       && value != DBNull.Value &&
+                                       !(value is Guid) && !(value is byte[]))
+                               {
+                                       throw new InvalidOperationException("Incorrect Guid value.");
+                               }
+
+                               this.value = value;
+
+                               if (this.inferType)
+                               {
+                                       this.SetFbDbType(value);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/property[@name="Charset"]/*'/>
+#if    (!NETCF)
+               [Category("Data"), DefaultValue(FbCharset.Default)]
+#endif
+               public FbCharset Charset
+               {
+                       get { return this.charset; }
+                       set { this.charset = value; }
+               }
+
+               #endregion
+
+               #region Internal Properties
+
+               internal FbParameterCollection Parent
+               {
+                       get { return this.parent; }
+                       set { this.parent = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor"]/*'/>
+               public FbParameter()
+               {
+                       this.fbType                     = FbDbType.VarChar;
+                       this.direction          = ParameterDirection.Input;
+                       this.sourceVersion      = DataRowVersion.Current;
+                       this.sourceColumn       = String.Empty;
+                       this.parameterName      = String.Empty;
+                       this.inferType          = true;
+                       this.charset            = FbCharset.Default;
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,System.Object)"]/*'/>
+               public FbParameter(string parameterName, object value) : this()
+               {
+                       this.parameterName      = parameterName;
+                       this.Value                      = value;
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType)"]/*'/>
+               public FbParameter(string parameterName, FbDbType fbType) : this()
+               {
+                       this.inferType          = false;
+                       this.parameterName      = parameterName;
+                       this.fbType                     = fbType;
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType,System.Int32)"]/*'/>
+               public FbParameter(string parameterName, FbDbType fbType, int size) : this()
+               {
+                       this.inferType          = false;
+                       this.parameterName      = parameterName;
+                       this.fbType                     = fbType;
+                       this.size                       = size;
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType,System.Int32,System.String)"]/*'/>
+               public FbParameter(string parameterName, FbDbType fbType, int size, string sourceColumn)
+                       : this()
+               {
+                       this.inferType          = false;
+                       this.parameterName      = parameterName;
+                       this.fbType                     = fbType;
+                       this.size                       = size;
+                       this.sourceColumn       = sourceColumn;
+               }
+
+               /// <include file='Doc/en_EN/FbParameter.xml' path='doc/class[@name="FbParameter"]/constrctor[@name="ctor(System.String,FbDbType,System.Int32,System.Data.ParameterDirection,System.Boolean,System.Byte,System.Byte,System.String,System.Data.DataRowVersion,System.Object)"]/*'/>
+#if    (!NETCF)
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+#endif
+               public FbParameter(
+                       string                          parameterName, 
+                       FbDbType                        dbType, 
+                       int                                     size,
+                       ParameterDirection      direction,
+                       bool                            isNullable,
+                       byte                            precision,
+                       byte                            scale,
+                       string                          sourceColumn,
+                       DataRowVersion          sourceVersion,
+                       object                          value)
+               {
+                       this.inferType          = false;
+                       this.parameterName      = parameterName;
+                       this.fbType                     = dbType;
+                       this.size                       = size;
+                       this.direction          = direction;
+                       this.isNullable         = isNullable;
+                       this.precision          = precision;
+                       this.scale                      = scale;
+                       this.sourceColumn       = sourceColumn;
+                       this.sourceVersion      = sourceVersion;
+                       this.value                      = value;
+               }
+
+               #endregion
+
+               #region ICloneable Methods
+
+               object ICloneable.Clone()
+               {
+                       FbParameter p = new FbParameter(
+                               this.parameterName,
+                               this.fbType,
+                               this.size,
+                               this.direction,
+                               this.isNullable,
+                               this.precision,
+                               this.scale,
+                               this.sourceColumn,
+                               this.sourceVersion,
+                               this.value);
+
+                       // Set extra properties
+                       p.Charset = this.charset;
+
+                       return p;
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbCommand.xml'     path='doc/class[@name="FbParameter"]/method[@name="ToString"]/*'/>
+               public override string ToString()
+               {
+                       return this.parameterName;
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void SetFbDbType(object value)
+               {
+                       if (value == null)
+                       {
+                               value = System.DBNull.Value;
+                       }
+
+                       TypeCode code = Type.GetTypeCode(value.GetType());
+
+                       switch (code)
+                       {
+                               case TypeCode.Object:
+                                       this.fbType = FbDbType.Binary;
+                                       break;
+
+                               case TypeCode.Char:
+                                       this.fbType = FbDbType.Char;
+                                       break;
+
+                               case TypeCode.DBNull:
+                               case TypeCode.String:
+                                       this.fbType = FbDbType.VarChar;
+                                       break;
+
+                               case TypeCode.Boolean:
+                               case TypeCode.Byte:
+                               case TypeCode.SByte:
+                               case TypeCode.Int16:
+                               case TypeCode.UInt16:
+                                       this.fbType = FbDbType.SmallInt;
+                                       break;
+
+                               case TypeCode.Int32:
+                               case TypeCode.UInt32:
+                                       this.fbType = FbDbType.Integer;
+                                       break;
+
+                               case TypeCode.Int64:
+                               case TypeCode.UInt64:
+                                       this.fbType = FbDbType.BigInt;
+                                       break;
+
+                               case TypeCode.Single:
+                                       this.fbType = FbDbType.Float;
+                                       break;
+
+                               case TypeCode.Double:
+                                       this.fbType = FbDbType.Double;
+                                       break;
+
+                               case TypeCode.Decimal:
+                                       this.fbType = FbDbType.Decimal;
+                                       break;
+
+                               case TypeCode.DateTime:
+                                       this.fbType = FbDbType.TimeStamp;
+                                       break;
+
+                               case TypeCode.Empty:
+                               default:
+                                       if (value is Guid)
+                                       {
+                                               this.fbType = FbDbType.Guid;
+                                       }
+                                       else
+                                       {
+                                               throw new SystemException("Value is of unknown data type");
+                                       }
+                                       break;
+                       }
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 54ee2fabbd194ca0dc4a1cad767691f49b5ed781..94c4411310d815da94fa08e07c81e1a8260a570b 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.ComponentModel;\r
-using System.Collections;\r
-using System.Globalization;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/overview/*'/>\r
-#if    (NET)\r
-       [ListBindable(false)]\r
-       [Editor(typeof(Design.FbParameterCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]\r
-#endif\r
-       public sealed class FbParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable\r
-       {\r
-               #region Fields\r
-\r
-               private ArrayList parameters;\r
-\r
-               #endregion\r
-\r
-               #region Indexers\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/indexer[@name="Item(System.String)"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public FbParameter this[string parameterName]\r
-               {\r
-                       get { return (FbParameter)this[this.IndexOf(parameterName)]; }\r
-                       set { this[this.IndexOf(parameterName)] = (FbParameter)value; }\r
-               }\r
-\r
-               object IDataParameterCollection.this[string parameterName]\r
-               {\r
-                       get { return this[parameterName]; }\r
-                       set { this[parameterName] = (FbParameter)value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/indexer[@name="Item(System.Int32)"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public FbParameter this[int index]\r
-               {\r
-                       get { return (FbParameter)this.parameters[index]; }\r
-                       set { this.parameters[index] = (FbParameter)value; }\r
-               }\r
-\r
-               object IList.this[int index]\r
-               {\r
-                       get { return (FbParameter)this[index]; }\r
-                       set { this[index] = (FbParameter)value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal FbParameterCollection()\r
-               {\r
-                       this.parameters = ArrayList.Synchronized(new ArrayList());\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IList Properties\r
-\r
-               bool IList.IsFixedSize\r
-               {\r
-                       get { return this.parameters.IsFixedSize; }\r
-               }\r
-\r
-               bool IList.IsReadOnly\r
-               {\r
-                       get { return this.parameters.IsReadOnly; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICollection     Properties\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/property[@name="Count"]/*'/>\r
-#if    (!NETCF)\r
-               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
-#endif\r
-               public int Count\r
-               {\r
-                       get { return this.parameters.Count; }\r
-               }\r
-\r
-               bool ICollection.IsSynchronized\r
-               {\r
-                       get { return this.parameters.IsSynchronized; }\r
-               }\r
-\r
-               object ICollection.SyncRoot\r
-               {\r
-                       get { return this.parameters.SyncRoot; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ICollection     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="CopyTo(System.Array,System.Int32)"]/*'/>\r
-               public void CopyTo(Array array, int index)\r
-               {\r
-                       this.parameters.CopyTo(array, index);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IList Methods\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Clear"]/*'/>\r
-               public void Clear()\r
-               {\r
-                       this.parameters.Clear();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IEnumerable     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="GetEnumerator"]/*'/>\r
-               public IEnumerator GetEnumerator()\r
-               {\r
-                       return this.parameters.GetEnumerator();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Contains(System.Object)"]/*'/>\r
-               public bool Contains(object value)\r
-               {\r
-                       return this.parameters.Contains(value);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Contains(System.String)"]/*'/>\r
-               public bool Contains(string parameterName)\r
-               {\r
-                       return (-1 != this.IndexOf(parameterName));\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="IndexOf(System.Object)"]/*'/>\r
-               public int IndexOf(object value)\r
-               {\r
-                       return this.parameters.IndexOf(value);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="IndexOf(System.String)"]/*'/>\r
-               public int IndexOf(string parameterName)\r
-               {\r
-                       int index = 0;\r
-                       foreach (FbParameter item in this.parameters)\r
-                       {\r
-                               if (GlobalizationHelper.CultureAwareCompare(item.ParameterName, parameterName))\r
-                               {\r
-                                       return index;\r
-                               }\r
-                               index++;\r
-                       }\r
-                       return -1;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Insert(System.Int32,System.Object)"]/*'/>\r
-               public void Insert(int index, object value)\r
-               {\r
-                       this.parameters.Insert(index, value);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Remove(System.Object)"]/*'/>\r
-               public void Remove(object value)\r
-               {\r
-                       if (!(value is FbParameter))\r
-                       {\r
-                               throw new InvalidCastException("The parameter passed was not a FbParameter.");\r
-                       }\r
-                       if (!this.Contains(value))\r
-                       {\r
-                               throw new SystemException("The parameter does not exist in the collection.");\r
-                       }\r
-\r
-                       this.parameters.Remove(value);\r
-\r
-                       ((FbParameter)value).Parent = null;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="RemoveAt(System.Int32)"]/*'/>\r
-               public void RemoveAt(int index)\r
-               {\r
-                       if (index < 0 || index > this.Count)\r
-                       {\r
-                               throw new IndexOutOfRangeException("The specified index does not exist.");\r
-                       }\r
-\r
-                       FbParameter parameter = this[index];\r
-                       this.parameters.RemoveAt(index);\r
-                       parameter.Parent = null;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="RemoveAt(System.String)"]/*'/>\r
-               public void RemoveAt(string parameterName)\r
-               {\r
-                       this.RemoveAt(this.IndexOf(parameterName));\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,System.Object)"]/*'/>\r
-               public FbParameter Add(string parameterName, object value)\r
-               {\r
-                       FbParameter param = new FbParameter(parameterName, value);\r
-\r
-                       return this.Add(param);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,FbDbType)"]/*'/>\r
-               public FbParameter Add(string parameterName, FbDbType type)\r
-               {\r
-                       FbParameter param = new FbParameter(parameterName, type);\r
-\r
-                       return this.Add(param);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,FbDbType,System.Int32)"]/*'/>\r
-               public FbParameter Add(string parameterName, FbDbType fbType, int size)\r
-               {\r
-                       FbParameter param = new FbParameter(parameterName, fbType, size);\r
-\r
-                       return this.Add(param);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,FbDbType,System.Int32,System.String)"]/*'/>\r
-               public FbParameter Add(\r
-                       string parameterName, FbDbType fbType, int size, string sourceColumn)\r
-               {\r
-                       FbParameter param = new FbParameter(parameterName, fbType, size, sourceColumn);\r
-\r
-                       return this.Add(param);\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.Object)"]/*'/>\r
-               public int Add(object value)\r
-               {\r
-                       if (!(value is FbParameter))\r
-                       {\r
-                               throw new InvalidCastException("The parameter passed was not a FbParameter.");\r
-                       }\r
-\r
-                       return this.IndexOf(this.Add(value as FbParameter));\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(FbParameter)"]/*'/>\r
-               public FbParameter Add(FbParameter value)\r
-               {\r
-                       lock (this.parameters.SyncRoot)\r
-                       {\r
-                               if (value == null)\r
-                               {\r
-                                       throw new ArgumentException("The value parameter is null.");\r
-                               }\r
-                               if (value.Parent != null)\r
-                               {\r
-                                       throw new ArgumentException("The FbParameter specified in the value parameter is already added to this or another FbParameterCollection.");\r
-                               }\r
-                               if (value.ParameterName == null ||\r
-                                       value.ParameterName.Length == 0)\r
-                               {\r
-                                       value.ParameterName = this.GenerateParameterName();\r
-                               }\r
-                               else\r
-                               {\r
-                                       if (this.IndexOf(value) != -1)\r
-                                       {\r
-                                               throw new ArgumentException("FbParameterCollection already contains FbParameter with ParameterName '" + value.ParameterName + "'.");\r
-                                       }\r
-                               }\r
-\r
-                               this.parameters.Add(value);\r
-\r
-                               return value;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private string GenerateParameterName()\r
-               {\r
-                       int index = this.Count + 1;\r
-                       string name = String.Empty;\r
-\r
-                       while (index > 0)\r
-                       {\r
-                               name = "Parameter" + index.ToString(CultureInfo.InvariantCulture);\r
-\r
-                               if (this.IndexOf(name) == -1)\r
-                               {\r
-                                       index = -1;\r
-                               }\r
-                               else\r
-                               {\r
-                                       index++;\r
-                               }\r
-                       }\r
-\r
-                       return name;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.ComponentModel;
+using System.Collections;
+using System.Globalization;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/overview/*'/>
+#if    (NET)
+       [ListBindable(false)]
+       [Editor(typeof(Design.FbParameterCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
+#endif
+       public sealed class FbParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
+       {
+               #region Fields
+
+               private ArrayList parameters;
+
+               #endregion
+
+               #region Indexers
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/indexer[@name="Item(System.String)"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public FbParameter this[string parameterName]
+               {
+                       get { return (FbParameter)this[this.IndexOf(parameterName)]; }
+                       set { this[this.IndexOf(parameterName)] = (FbParameter)value; }
+               }
+
+               object IDataParameterCollection.this[string parameterName]
+               {
+                       get { return this[parameterName]; }
+                       set { this[parameterName] = (FbParameter)value; }
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/indexer[@name="Item(System.Int32)"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public FbParameter this[int index]
+               {
+                       get { return (FbParameter)this.parameters[index]; }
+                       set { this.parameters[index] = (FbParameter)value; }
+               }
+
+               object IList.this[int index]
+               {
+                       get { return (FbParameter)this[index]; }
+                       set { this[index] = (FbParameter)value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               internal FbParameterCollection()
+               {
+                       this.parameters = ArrayList.Synchronized(new ArrayList());
+               }
+
+               #endregion
+
+               #region IList Properties
+
+               bool IList.IsFixedSize
+               {
+                       get { return this.parameters.IsFixedSize; }
+               }
+
+               bool IList.IsReadOnly
+               {
+                       get { return this.parameters.IsReadOnly; }
+               }
+
+               #endregion
+
+               #region ICollection     Properties
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/property[@name="Count"]/*'/>
+#if    (!NETCF)
+               [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif
+               public int Count
+               {
+                       get { return this.parameters.Count; }
+               }
+
+               bool ICollection.IsSynchronized
+               {
+                       get { return this.parameters.IsSynchronized; }
+               }
+
+               object ICollection.SyncRoot
+               {
+                       get { return this.parameters.SyncRoot; }
+               }
+
+               #endregion
+
+               #region ICollection     Methods
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="CopyTo(System.Array,System.Int32)"]/*'/>
+               public void CopyTo(Array array, int index)
+               {
+                       this.parameters.CopyTo(array, index);
+               }
+
+               #endregion
+
+               #region IList Methods
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Clear"]/*'/>
+               public void Clear()
+               {
+                       this.parameters.Clear();
+               }
+
+               #endregion
+
+               #region IEnumerable     Methods
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="GetEnumerator"]/*'/>
+               public IEnumerator GetEnumerator()
+               {
+                       return this.parameters.GetEnumerator();
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Contains(System.Object)"]/*'/>
+               public bool Contains(object value)
+               {
+                       return this.parameters.Contains(value);
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Contains(System.String)"]/*'/>
+               public bool Contains(string parameterName)
+               {
+                       return (-1 != this.IndexOf(parameterName));
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="IndexOf(System.Object)"]/*'/>
+               public int IndexOf(object value)
+               {
+                       return this.parameters.IndexOf(value);
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="IndexOf(System.String)"]/*'/>
+               public int IndexOf(string parameterName)
+               {
+                       int index = 0;
+                       foreach (FbParameter item in this.parameters)
+                       {
+                               if (GlobalizationHelper.CultureAwareCompare(item.ParameterName, parameterName))
+                               {
+                                       return index;
+                               }
+                               index++;
+                       }
+                       return -1;
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Insert(System.Int32,System.Object)"]/*'/>
+               public void Insert(int index, object value)
+               {
+                       this.parameters.Insert(index, value);
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Remove(System.Object)"]/*'/>
+               public void Remove(object value)
+               {
+                       if (!(value is FbParameter))
+                       {
+                               throw new InvalidCastException("The parameter passed was not a FbParameter.");
+                       }
+                       if (!this.Contains(value))
+                       {
+                               throw new SystemException("The parameter does not exist in the collection.");
+                       }
+
+                       this.parameters.Remove(value);
+
+                       ((FbParameter)value).Parent = null;
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="RemoveAt(System.Int32)"]/*'/>
+               public void RemoveAt(int index)
+               {
+                       if (index < 0 || index > this.Count)
+                       {
+                               throw new IndexOutOfRangeException("The specified index does not exist.");
+                       }
+
+                       FbParameter parameter = this[index];
+                       this.parameters.RemoveAt(index);
+                       parameter.Parent = null;
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="RemoveAt(System.String)"]/*'/>
+               public void RemoveAt(string parameterName)
+               {
+                       this.RemoveAt(this.IndexOf(parameterName));
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,System.Object)"]/*'/>
+               public FbParameter Add(string parameterName, object value)
+               {
+                       FbParameter param = new FbParameter(parameterName, value);
+
+                       return this.Add(param);
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,FbDbType)"]/*'/>
+               public FbParameter Add(string parameterName, FbDbType type)
+               {
+                       FbParameter param = new FbParameter(parameterName, type);
+
+                       return this.Add(param);
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,FbDbType,System.Int32)"]/*'/>
+               public FbParameter Add(string parameterName, FbDbType fbType, int size)
+               {
+                       FbParameter param = new FbParameter(parameterName, fbType, size);
+
+                       return this.Add(param);
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.String,FbDbType,System.Int32,System.String)"]/*'/>
+               public FbParameter Add(
+                       string parameterName, FbDbType fbType, int size, string sourceColumn)
+               {
+                       FbParameter param = new FbParameter(parameterName, fbType, size, sourceColumn);
+
+                       return this.Add(param);
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(System.Object)"]/*'/>
+               public int Add(object value)
+               {
+                       if (!(value is FbParameter))
+                       {
+                               throw new InvalidCastException("The parameter passed was not a FbParameter.");
+                       }
+
+                       return this.IndexOf(this.Add(value as FbParameter));
+               }
+
+               /// <include file='Doc/en_EN/FbParameterCollection.xml' path='doc/class[@name="FbParameterCollection"]/method[@name="Add(FbParameter)"]/*'/>
+               public FbParameter Add(FbParameter value)
+               {
+                       lock (this.parameters.SyncRoot)
+                       {
+                               if (value == null)
+                               {
+                                       throw new ArgumentException("The value parameter is null.");
+                               }
+                               if (value.Parent != null)
+                               {
+                                       throw new ArgumentException("The FbParameter specified in the value parameter is already added to this or another FbParameterCollection.");
+                               }
+                               if (value.ParameterName == null ||
+                                       value.ParameterName.Length == 0)
+                               {
+                                       value.ParameterName = this.GenerateParameterName();
+                               }
+                               else
+                               {
+                                       if (this.IndexOf(value) != -1)
+                                       {
+                                               throw new ArgumentException("FbParameterCollection already contains FbParameter with ParameterName '" + value.ParameterName + "'.");
+                                       }
+                               }
+
+                               this.parameters.Add(value);
+
+                               return value;
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private string GenerateParameterName()
+               {
+                       int index = this.Count + 1;
+                       string name = String.Empty;
+
+                       while (index > 0)
+                       {
+                               name = "Parameter" + index.ToString(CultureInfo.InvariantCulture);
+
+                               if (this.IndexOf(name) == -1)
+                               {
+                                       index = -1;
+                               }
+                               else
+                               {
+                                       index++;
+                               }
+                       }
+
+                       return name;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 7ac6202637952718fff7ce2bb9012e97ab217344..444df9405ad2cee2273df070d67d76ea009199e5 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/overview/*'/>\r
-       public sealed class FbRemoteEvent\r
-       {\r
-               #region Events\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/event[@name="RemoteEventCounts"]/*'/>\r
-               public event FbRemoteEventEventHandler RemoteEventCounts;\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private FbConnection    connection;\r
-               private RemoteEvent             revent;\r
-\r
-               #endregion\r
-\r
-               #region Indexers\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/indexer[@name="Item(System.Int32)"]/*'/>\r
-               public string this[int index]\r
-               {\r
-                       get { return this.revent.Events[index]; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/property[@name="Connection"]/*'/>\r
-               public FbConnection Connection\r
-               {\r
-                       get { return this.connection; }\r
-                       set { this.connection = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/property[@name="HasChanges"]/*'/>\r
-               public bool HasChanges\r
-               {\r
-                       get { return this.revent.HasChanges; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/constructor[@name="ctor(FbConnection)"]/*'/>\r
-               public FbRemoteEvent(FbConnection connection) : this(connection, null)\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/constructor[@name="ctor(FbConnection, System.Array)"]/*'/>\r
-               public FbRemoteEvent(FbConnection connection, string[] events)\r
-               {\r
-                       this.connection = connection;\r
-                       this.revent             = connection.InnerConnection.Database.CreateEvent();\r
-                       this.revent.EventCountsCallback = new EventCountsCallback(this.OnRemoteEventCounts);\r
-\r
-                       if (events != null)\r
-                       {\r
-                               this.AddEvents(events);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/method[@name="AddEvents(System.Array)"]/*'/>\r
-               public void AddEvents(string[] events)\r
-               {\r
-                       if (events == null)\r
-                       {\r
-                               throw new ArgumentNullException("events cannot be null.");\r
-                       }\r
-                       if (events.Length > 15)\r
-                       {\r
-                               throw new ArgumentException("Max number of events for request interest is 15");\r
-                       }\r
-\r
-                       if (events.Length != this.revent.Events.Count)\r
-                       {\r
-                               this.revent.ResetCounts();\r
-                       }\r
-                       else\r
-                       {\r
-                               string[] actualEvents = new string[this.revent.Events.Count];\r
-                               this.revent.Events.CopyTo(actualEvents, 0);\r
-\r
-                               for (int i = 0; i < actualEvents.Length; i++)\r
-                               {\r
-                                       if (events[i] != actualEvents[i])\r
-                                       {\r
-                                               this.revent.ResetCounts();\r
-                                               break;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       this.revent.Events.Clear();\r
-\r
-                       for (int i = 0; i < events.Length; i++)\r
-                       {\r
-                               this.revent.Events.Add(events[i]);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/method[@name="QueueEvents"]/*'/>\r
-               public void QueueEvents()\r
-               {\r
-                       this.revent.QueueEvents();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/method[@name="CancelEvents"]/*'/>\r
-               public void CancelEvents()\r
-               {\r
-                       this.revent.CancelEvents();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Callbacks methods\r
-\r
-               private void OnRemoteEventCounts()\r
-               {\r
-                       bool canceled = false;\r
-\r
-                       if (this.RemoteEventCounts != null)\r
-                       {\r
-                               int[] actualCounts = (int[])this.revent.ActualCounts.Clone();\r
-                               if (this.revent.PreviousCounts != null)\r
-                               {\r
-                                       for (int i = 0; i < this.revent.ActualCounts.Length; i++)\r
-                                       {\r
-                                               actualCounts[i] -= this.revent.PreviousCounts[i];\r
-                                       }\r
-                               }\r
-\r
-                               // Send individual event notifications\r
-                               for (int i = 0; i < actualCounts.Length; i++)\r
-                               {\r
-                                       FbRemoteEventEventArgs args = new FbRemoteEventEventArgs(this.revent.Events[i], actualCounts[i]);\r
-                                       this.RemoteEventCounts(this, args);\r
-\r
-                                       if (args.Cancel)\r
-                                       {\r
-                                               canceled = true;\r
-                                               break;\r
-                                       }\r
-                               }\r
-\r
-                               if (canceled)\r
-                               {\r
-                                       // Requeque\r
-                                       this.CancelEvents();\r
-                               }\r
-                               else\r
-                               {\r
-                                       // Requeque\r
-                                       this.QueueEvents();\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/overview/*'/>
+       public sealed class FbRemoteEvent
+       {
+               #region Events
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/event[@name="RemoteEventCounts"]/*'/>
+               public event FbRemoteEventEventHandler RemoteEventCounts;
+
+               #endregion
+
+               #region Fields
+
+               private FbConnection    connection;
+               private RemoteEvent             revent;
+
+               #endregion
+
+               #region Indexers
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/indexer[@name="Item(System.Int32)"]/*'/>
+               public string this[int index]
+               {
+                       get { return this.revent.Events[index]; }
+               }
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/property[@name="Connection"]/*'/>
+               public FbConnection Connection
+               {
+                       get { return this.connection; }
+                       set { this.connection = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/property[@name="HasChanges"]/*'/>
+               public bool HasChanges
+               {
+                       get { return this.revent.HasChanges; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/constructor[@name="ctor(FbConnection)"]/*'/>
+               public FbRemoteEvent(FbConnection connection) : this(connection, null)
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/constructor[@name="ctor(FbConnection, System.Array)"]/*'/>
+               public FbRemoteEvent(FbConnection connection, string[] events)
+               {
+                       if (connection == null || connection.State != System.Data.ConnectionState.Open)
+                       {
+                               throw new InvalidOperationException("Connection must valid and open");
+                       }
+                       this.connection = connection;
+                       this.revent             = connection.InnerConnection.Database.CreateEvent();
+                       this.revent.EventCountsCallback = new EventCountsCallback(this.OnRemoteEventCounts);
+
+                       if (events != null)
+                       {
+                               this.AddEvents(events);
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/method[@name="AddEvents(System.Array)"]/*'/>
+               public void AddEvents(string[] events)
+               {
+                       if (events == null)
+                       {
+                               throw new ArgumentNullException("events cannot be null.");
+                       }
+                       if (events.Length > 15)
+                       {
+                               throw new ArgumentException("Max number of events for request interest is 15");
+                       }
+
+                       if (events.Length != this.revent.Events.Count)
+                       {
+                               this.revent.ResetCounts();
+                       }
+                       else
+                       {
+                               string[] actualEvents = new string[this.revent.Events.Count];
+                               this.revent.Events.CopyTo(actualEvents, 0);
+
+                               for (int i = 0; i < actualEvents.Length; i++)
+                               {
+                                       if (events[i] != actualEvents[i])
+                                       {
+                                               this.revent.ResetCounts();
+                                               break;
+                                       }
+                               }
+                       }
+
+                       this.revent.Events.Clear();
+
+                       for (int i = 0; i < events.Length; i++)
+                       {
+                               this.revent.Events.Add(events[i]);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/method[@name="QueueEvents"]/*'/>
+               public void QueueEvents()
+               {
+                       this.revent.QueueEvents();
+               }
+
+               /// <include file='Doc/en_EN/FbRemoteEvent.xml' path='doc/class[@name="FbRemoteEvent"]/method[@name="CancelEvents"]/*'/>
+               public void CancelEvents()
+               {
+                       this.revent.CancelEvents();
+               }
+
+               #endregion
+
+               #region Callbacks methods
+
+               private void OnRemoteEventCounts()
+               {
+                       bool canceled = false;
+
+                       if (this.RemoteEventCounts != null)
+                       {
+                               int[] actualCounts = (int[])this.revent.ActualCounts.Clone();
+                               if (this.revent.PreviousCounts != null)
+                               {
+                                       for (int i = 0; i < this.revent.ActualCounts.Length; i++)
+                                       {
+                                               actualCounts[i] -= this.revent.PreviousCounts[i];
+                                       }
+                               }
+
+                               // Send individual event notifications
+                               for (int i = 0; i < actualCounts.Length; i++)
+                               {
+                                       FbRemoteEventEventArgs args = new FbRemoteEventEventArgs(this.revent.Events[i], actualCounts[i]);
+                                       this.RemoteEventCounts(this, args);
+
+                                       if (args.Cancel)
+                                       {
+                                               canceled = true;
+                                               break;
+                                       }
+                               }
+
+                               if (canceled)
+                               {
+                                       // Requeque
+                                       this.CancelEvents();
+                               }
+                               else
+                               {
+                                       // Requeque
+                                       this.QueueEvents();
+                               }
+                       }
+               }
+
+               #endregion
+       }
+}
index f4a78188375b1cc8399e7e20d6e3991010591e5a..127540b21f595ad5f200bb378d1bedef10379fdc 100644 (file)
@@ -1,72 +1,72 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       #region Delegates\r
-\r
-       /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/delegate[@name="FbRemoteEventEventHandler"]/overview/*'/>\r
-       public delegate void FbRemoteEventEventHandler(object sender, FbRemoteEventEventArgs e);\r
-\r
-       #endregion\r
-\r
-       /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/overview/*'/>\r
-       public sealed class     FbRemoteEventEventArgs : System.ComponentModel.CancelEventArgs\r
-       {\r
-               #region Fields\r
-\r
-               private string  name;\r
-               private int             counts;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/property[@name="Name"]/*'/>\r
-               public string Name\r
-               {\r
-                       get     { return this.name;     }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/property[@name="Counts"]/*'/>\r
-               public int Counts\r
-               {\r
-                       get     { return this.counts; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/constructor[@name="ctor(System.String,System.Int32)"]/*'/>\r
-               public FbRemoteEventEventArgs(string name, int counts) : this(name,     counts, false)\r
-               {\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/constructor[@name="ctor(System.String,System.Int32,System.Boolean)"]/*'/>\r
-               public FbRemoteEventEventArgs(string name, int counts, bool     cancel) : base(cancel)\r
-               {\r
-                       this.name = name;\r
-                       this.counts = counts;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird
+{
+       #region Delegates
+
+       /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/delegate[@name="FbRemoteEventEventHandler"]/overview/*'/>
+       public delegate void FbRemoteEventEventHandler(object sender, FbRemoteEventEventArgs e);
+
+       #endregion
+
+       /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/overview/*'/>
+       public sealed class     FbRemoteEventEventArgs : System.ComponentModel.CancelEventArgs
+       {
+               #region Fields
+
+               private string  name;
+               private int             counts;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/property[@name="Name"]/*'/>
+               public string Name
+               {
+                       get     { return this.name;     }
+               }
+
+               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/property[@name="Counts"]/*'/>
+               public int Counts
+               {
+                       get     { return this.counts; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/constructor[@name="ctor(System.String,System.Int32)"]/*'/>
+               public FbRemoteEventEventArgs(string name, int counts) : this(name,     counts, false)
+               {
+               }
+
+               /// <include file='Doc/en_EN/FbRemoteEventEventArgs.xml' path='doc/class[@name="FbRemoteEventEventArgs"]/constructor[@name="ctor(System.String,System.Int32,System.Boolean)"]/*'/>
+               public FbRemoteEventEventArgs(string name, int counts, bool     cancel) : base(cancel)
+               {
+                       this.name = name;
+                       this.counts = counts;
+               }
+
+               #endregion
+       }
+}
index 3fc9b887540b4b705e91ca5e1a3cbd54d509bc5a..1fe9bfecf45f7d8f124c5a84465d12581b0725d5 100644 (file)
@@ -1,55 +1,55 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       #region Delegates\r
-\r
-       /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/delegate[@name="FbRowUpdatedEventHandler"]/*'/>\r
-       public delegate void FbRowUpdatedEventHandler(object sender, FbRowUpdatedEventArgs e);\r
-\r
-       #endregion\r
-\r
-       /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/class[@name="FbRowUpdatedEventArgs"]/overview/*'/>\r
-       public sealed class FbRowUpdatedEventArgs : RowUpdatedEventArgs\r
-       {\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/class[@name="FbRowUpdatedEventArgs"]/property[@name="Command"]/*'/>\r
-               public new FbCommand Command\r
-               {\r
-                       get { return (FbCommand)base.Command; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/class[@name="FbRowUpdatedEventArgs"]/constructor[@name="ctor(DataRow,IDbCommand,StatementType,DataTableMapping)"]/*'/>\r
-               public FbRowUpdatedEventArgs(DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)\r
-                       : base(row, command, statementType, tableMapping)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       #region Delegates
+
+       /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/delegate[@name="FbRowUpdatedEventHandler"]/*'/>
+       public delegate void FbRowUpdatedEventHandler(object sender, FbRowUpdatedEventArgs e);
+
+       #endregion
+
+       /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/class[@name="FbRowUpdatedEventArgs"]/overview/*'/>
+       public sealed class FbRowUpdatedEventArgs : RowUpdatedEventArgs
+       {
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/class[@name="FbRowUpdatedEventArgs"]/property[@name="Command"]/*'/>
+               public new FbCommand Command
+               {
+                       get { return (FbCommand)base.Command; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbRowUpdatedEventArgs.xml' path='doc/class[@name="FbRowUpdatedEventArgs"]/constructor[@name="ctor(DataRow,IDbCommand,StatementType,DataTableMapping)"]/*'/>
+               public FbRowUpdatedEventArgs(DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+                       : base(row, command, statementType, tableMapping)
+               {
+               }
+
+               #endregion
+       }
+}
index afa9a8773abd3130d4582e8e71339b503d6a72ef..44ece120c32f0cc07f4a9dc5f2d9dfeea8dd26e6 100644 (file)
@@ -1,56 +1,56 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       #region Delegates\r
-\r
-       /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/delegate[@name="FbRowUpdatingEventHandler"]/*'/>\r
-       public delegate void FbRowUpdatingEventHandler(object sender, FbRowUpdatingEventArgs e);\r
-\r
-       #endregion\r
-\r
-       /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/class[@name="FbRowUpdatingEventArgs"]/overview/*'/>\r
-       public sealed class FbRowUpdatingEventArgs : RowUpdatingEventArgs\r
-       {\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/class[@name="FbRowUpdatingEventArgs"]/property[@name="Command"]/*'/>\r
-               public new FbCommand Command\r
-               {\r
-                       get { return (FbCommand)base.Command; }\r
-                       set { base.Command = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/class[@name="FbRowUpdatingEventArgs"]/constructor[@name="ctor(DataRow,IDbCommand,StatementType,DataTableMapping)"]/*'/>\r
-               public FbRowUpdatingEventArgs(DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)\r
-                       : base(row, command, statementType, tableMapping)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       #region Delegates
+
+       /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/delegate[@name="FbRowUpdatingEventHandler"]/*'/>
+       public delegate void FbRowUpdatingEventHandler(object sender, FbRowUpdatingEventArgs e);
+
+       #endregion
+
+       /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/class[@name="FbRowUpdatingEventArgs"]/overview/*'/>
+       public sealed class FbRowUpdatingEventArgs : RowUpdatingEventArgs
+       {
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/class[@name="FbRowUpdatingEventArgs"]/property[@name="Command"]/*'/>
+               public new FbCommand Command
+               {
+                       get { return (FbCommand)base.Command; }
+                       set { base.Command = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbRowUpdatingEventArgs.xml' path='doc/class[@name="FbRowUpdatingEventArgs"]/constructor[@name="ctor(DataRow,IDbCommand,StatementType,DataTableMapping)"]/*'/>
+               public FbRowUpdatingEventArgs(DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+                       : base(row, command, statementType, tableMapping)
+               {
+               }
+
+               #endregion
+       }
+}
index d693feff1eb458bd501efc28d0fd6dcd1e517cb5..ade3579fb0b3cec8244c9c1caac98c647e531ddb 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Collections;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/overview/*'/>\r
-       public sealed class FbTransaction : MarshalByRefObject, IDbTransaction, IDisposable\r
-       {\r
-               #region Fields\r
-\r
-               private ITransaction    transaction;\r
-               private FbConnection    connection;\r
-               private IsolationLevel  isolationLevel;\r
-               private bool                    disposed;\r
-               private bool                    isUpdated;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               IDbConnection IDbTransaction.Connection\r
-               {\r
-                       get { return this.Connection; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/property[@name="Connection"]/*'/>\r
-               public FbConnection Connection\r
-               {\r
-                       get\r
-                       {\r
-                               if (!this.isUpdated)\r
-                               {\r
-                                       return this.connection;\r
-                               }\r
-                               else\r
-                               {\r
-                                       return null;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/property[@name="IsolationLevel"]/*'/>\r
-               public IsolationLevel IsolationLevel\r
-               {\r
-                       get { return this.isolationLevel; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Properties\r
-\r
-               internal ITransaction Transaction\r
-               {\r
-                       get { return this.transaction; }\r
-               }\r
-\r
-               internal bool IsUpdated\r
-               {\r
-                       get { return this.isUpdated; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               internal FbTransaction(FbConnection connection) : this(connection, IsolationLevel.ReadCommitted)\r
-               {\r
-               }\r
-\r
-               internal FbTransaction(FbConnection connection, IsolationLevel il)\r
-               {\r
-                       this.isolationLevel = il;\r
-                       this.connection         = connection;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Finalizer\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbCommandBuilder"]/destructor[@name="Finalize"]/*'/>\r
-               ~FbTransaction()\r
-               {\r
-                       this.Dispose(false);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     Methods\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Dispose"]/*'/>\r
-               public void Dispose()\r
-               {\r
-                       this.Dispose(true);\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               private void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.disposed)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // release any unmanaged resources\r
-                                               if (this.transaction != null)\r
-                                               {\r
-                                                       if ((this.transaction.State == TransactionState.TransactionStarted\r
-                                                               || this.transaction.State == TransactionState.TransactionPrepared)\r
-                                                               && !this.isUpdated)\r
-                                                       {\r
-                                                               this.transaction.Dispose();\r
-                                                               this.transaction = null;\r
-                                                       }\r
-                                               }\r
-\r
-                                               // release any managed resources\r
-                                               if (disposing)\r
-                                               {\r
-                                                       this.connection = null;\r
-                                                       this.transaction = null;\r
-                                               }\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               this.isUpdated = true;\r
-                                               this.disposed = true;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Commit"]/*'/>\r
-               public void Commit()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.isUpdated)\r
-                               {\r
-                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.transaction.Commit();\r
-                                       this.UpdateTransaction();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Rollback"]/*'/>\r
-               public void Rollback()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.isUpdated)\r
-                               {\r
-                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.transaction.Rollback();\r
-                                       this.UpdateTransaction();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Save(System.String)"]/*'/>\r
-               public void Save(string savePointName)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (savePointName == null)\r
-                               {\r
-                                       throw new ArgumentException("No transaction name was be specified.");\r
-                               }\r
-                               else\r
-                               {\r
-                                       if (savePointName.Length == 0)\r
-                                       {\r
-                                               throw new ArgumentException("No transaction name was be specified.");\r
-                                       }\r
-                               }\r
-                               if (this.isUpdated)\r
-                               {\r
-                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       FbCommand command = new FbCommand(\r
-                                               "SAVEPOINT " + savePointName,\r
-                                               this.connection,\r
-                                               this);\r
-                                       command.ExecuteNonQuery();\r
-                                       command.Dispose();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Commit(System.String)"]/*'/>\r
-               public void Commit(string savePointName)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (savePointName == null)\r
-                               {\r
-                                       throw new ArgumentException("No transaction name was be specified.");\r
-                               }\r
-                               else\r
-                               {\r
-                                       if (savePointName.Length == 0)\r
-                                       {\r
-                                               throw new ArgumentException("No transaction name was be specified.");\r
-                                       }\r
-                               }\r
-                               if (this.isUpdated)\r
-                               {\r
-                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       FbCommand command = new FbCommand(\r
-                                               "RELEASE SAVEPOINT " + savePointName,\r
-                                               this.connection,\r
-                                               this);\r
-                                       command.ExecuteNonQuery();\r
-                                       command.Dispose();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Rollback(System.String)"]/*'/>\r
-               public void Rollback(string savePointName)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (savePointName == null)\r
-                               {\r
-                                       throw new ArgumentException("No transaction name was be specified.");\r
-                               }\r
-                               else\r
-                               {\r
-                                       if (savePointName.Length == 0)\r
-                                       {\r
-                                               throw new ArgumentException("No transaction name was be specified.");\r
-                                       }\r
-                               }\r
-                               if (this.isUpdated)\r
-                               {\r
-                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       FbCommand command = new FbCommand(\r
-                                               "ROLLBACK WORK TO SAVEPOINT " + savePointName,\r
-                                               this.connection,\r
-                                               this);\r
-                                       command.ExecuteNonQuery();\r
-                                       command.Dispose();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="CommitRetaining"]/*'/>\r
-               public void CommitRetaining()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.isUpdated)\r
-                               {\r
-                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.transaction.CommitRetaining();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="RollbackRetaining"]/*'/>\r
-               public void RollbackRetaining()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.isUpdated)\r
-                               {\r
-                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.transaction.RollbackRetaining();\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region InternalMethods\r
-\r
-               internal void BeginTransaction()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       IDatabase database = this.connection.InnerConnection.Database;\r
-                                       this.transaction = database.BeginTransaction(this.BuildTpb());\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               internal void BeginTransaction(FbTransactionOptions options)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       IDatabase database = this.connection.InnerConnection.Database;\r
-                                       this.transaction = database.BeginTransaction(this.BuildTpb(options));\r
-                               }\r
-                               catch (IscException ex)\r
-                               {\r
-                                       throw new FbException(ex.Message, ex);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void UpdateTransaction()\r
-               {\r
-                       if (this.connection != null)\r
-                       {\r
-                               this.connection.InnerConnection.TransactionUpdated();\r
-                       }\r
-\r
-                       this.isUpdated  = true;\r
-                       this.connection = null;\r
-                       this.transaction = null;\r
-               }\r
-\r
-               private TransactionParameterBuffer BuildTpb()\r
-               {\r
-                       FbTransactionOptions options = FbTransactionOptions.Write;\r
-\r
-                       options |= FbTransactionOptions.Wait;\r
-\r
-                       /* Isolation level */\r
-                       switch (this.isolationLevel)\r
-                       {\r
-                               case IsolationLevel.Serializable:\r
-                                       options |= FbTransactionOptions.Consistency;\r
-                                       break;\r
-\r
-                               case IsolationLevel.RepeatableRead:\r
-                                       options |= FbTransactionOptions.Concurrency;\r
-                                       break;\r
-\r
-                               case IsolationLevel.ReadUncommitted:\r
-                                       options |= FbTransactionOptions.ReadCommitted;\r
-                                       options |= FbTransactionOptions.RecVersion;\r
-                                       break;\r
-\r
-                               case IsolationLevel.ReadCommitted:\r
-                               default:\r
-                                       options |= FbTransactionOptions.ReadCommitted;\r
-                                       options |= FbTransactionOptions.NoRecVersion;\r
-                                       break;\r
-                       }\r
-\r
-                       return this.BuildTpb(options);\r
-               }\r
-\r
-#if    (!NETCF)\r
-\r
-               private TransactionParameterBuffer BuildTpb(FbTransactionOptions options)\r
-               {\r
-                       TransactionParameterBuffer tpb = new TransactionParameterBuffer();\r
-\r
-                       tpb.Append(IscCodes.isc_tpb_version3);\r
-\r
-                       FbTransactionOptions[] o = (FbTransactionOptions[])Enum.GetValues(options.GetType());\r
-                       for (int i = 0; i < o.Length; i++)\r
-                       {\r
-                               FbTransactionOptions option = ((FbTransactionOptions)(o[i]));\r
-                               if ((options & option) == option)\r
-                               {\r
-                                       switch (option)\r
-                                       {\r
-                                               case FbTransactionOptions.Consistency:\r
-                                                       tpb.Append(IscCodes.isc_tpb_consistency);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Concurrency:\r
-                                                       tpb.Append(IscCodes.isc_tpb_concurrency);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Shared:\r
-                                                       tpb.Append(IscCodes.isc_tpb_shared);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Protected:\r
-                                                       tpb.Append(IscCodes.isc_tpb_protected);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Exclusive:\r
-                                                       tpb.Append(IscCodes.isc_tpb_exclusive);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Wait:\r
-                                                       tpb.Append(IscCodes.isc_tpb_wait);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.NoWait:\r
-                                                       tpb.Append(IscCodes.isc_tpb_nowait);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Read:\r
-                                                       tpb.Append(IscCodes.isc_tpb_read);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Write:\r
-                                                       tpb.Append(IscCodes.isc_tpb_write);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.LockRead:\r
-                                                       tpb.Append(IscCodes.isc_tpb_lock_read);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.LockWrite:\r
-                                                       tpb.Append(IscCodes.isc_tpb_lock_write);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.ReadCommitted:\r
-                                                       tpb.Append(IscCodes.isc_tpb_read_committed);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.Autocommit:\r
-                                                       tpb.Append(IscCodes.isc_tpb_autocommit);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.RecVersion:\r
-                                                       tpb.Append(IscCodes.isc_tpb_rec_version);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.NoRecVersion:\r
-                                                       tpb.Append(IscCodes.isc_tpb_no_rec_version);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.RestartRequests:\r
-                                                       tpb.Append(IscCodes.isc_tpb_restart_requests);\r
-                                                       break;\r
-\r
-                                               case FbTransactionOptions.NoAutoUndo:\r
-                                                       tpb.Append(IscCodes.isc_tpb_no_auto_undo);\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return tpb;\r
-               }\r
-\r
-#else\r
-\r
-               private TransactionParameterBuffer BuildTpb(FbTransactionOptions options)\r
-               {\r
-                       TransactionParameterBuffer tpb = new TransactionParameterBuffer();\r
-\r
-                       tpb.Append(IscCodes.isc_tpb_version3);\r
-\r
-                       if ((options & FbTransactionOptions.Consistency) ==     FbTransactionOptions.Consistency)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_consistency);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Concurrency) ==     FbTransactionOptions.Concurrency)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_concurrency);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Shared) == FbTransactionOptions.Shared)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_shared);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Protected) == FbTransactionOptions.Protected)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_protected);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Exclusive) == FbTransactionOptions.Exclusive)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_exclusive);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Wait) == FbTransactionOptions.Wait)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_wait);\r
-                       }\r
-                       if ((options & FbTransactionOptions.NoWait) == FbTransactionOptions.NoWait)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_nowait);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Read) == FbTransactionOptions.Read)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_read);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Write) == FbTransactionOptions.Write)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_write);\r
-                       }\r
-                       if ((options & FbTransactionOptions.LockRead) == FbTransactionOptions.LockRead)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_lock_read);\r
-                       }\r
-                       if ((options & FbTransactionOptions.LockWrite) == FbTransactionOptions.LockWrite)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_lock_write);\r
-                       }\r
-                       if ((options & FbTransactionOptions.ReadCommitted) == FbTransactionOptions.ReadCommitted)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_read_committed);\r
-                       }\r
-                       if ((options & FbTransactionOptions.Autocommit) == FbTransactionOptions.Autocommit)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_autocommit);\r
-                       }\r
-                       if ((options & FbTransactionOptions.RecVersion) == FbTransactionOptions.RecVersion)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_rec_version);\r
-                       }\r
-                       if ((options & FbTransactionOptions.NoRecVersion) == FbTransactionOptions.NoRecVersion)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_no_rec_version);\r
-                       }\r
-                       if ((options & FbTransactionOptions.RestartRequests) == FbTransactionOptions.RestartRequests)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_restart_requests);\r
-                       }\r
-                       if ((options & FbTransactionOptions.NoAutoUndo) == FbTransactionOptions.NoAutoUndo)\r
-                       {\r
-                               tpb.Append(IscCodes.isc_tpb_no_auto_undo);\r
-                       }\r
-                       \r
-                       return tpb;\r
-               }\r
-\r
-#endif\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Collections;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/overview/*'/>
+       public sealed class FbTransaction : MarshalByRefObject, IDbTransaction, IDisposable
+       {
+               #region Fields
+
+               private ITransaction    transaction;
+               private FbConnection    connection;
+               private IsolationLevel  isolationLevel;
+               private bool                    disposed;
+               private bool                    isUpdated;
+
+               #endregion
+
+               #region Properties
+
+               IDbConnection IDbTransaction.Connection
+               {
+                       get { return this.Connection; }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/property[@name="Connection"]/*'/>
+               public FbConnection Connection
+               {
+                       get
+                       {
+                               if (!this.isUpdated)
+                               {
+                                       return this.connection;
+                               }
+                               else
+                               {
+                                       return null;
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/property[@name="IsolationLevel"]/*'/>
+               public IsolationLevel IsolationLevel
+               {
+                       get { return this.isolationLevel; }
+               }
+
+               #endregion
+
+               #region Internal Properties
+
+               internal ITransaction Transaction
+               {
+                       get { return this.transaction; }
+               }
+
+               internal bool IsUpdated
+               {
+                       get { return this.isUpdated; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               internal FbTransaction(FbConnection connection) : this(connection, IsolationLevel.ReadCommitted)
+               {
+               }
+
+               internal FbTransaction(FbConnection connection, IsolationLevel il)
+               {
+                       this.isolationLevel = il;
+                       this.connection         = connection;
+               }
+
+               #endregion
+
+               #region Finalizer
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbCommandBuilder"]/destructor[@name="Finalize"]/*'/>
+               ~FbTransaction()
+               {
+                       this.Dispose(false);
+               }
+
+               #endregion
+
+               #region IDisposable     Methods
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Dispose"]/*'/>
+               public void Dispose()
+               {
+                       this.Dispose(true);
+                       GC.SuppressFinalize(this);
+               }
+
+               private void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.disposed)
+                               {
+                                       try
+                                       {
+                                               // release any unmanaged resources
+                                               if (this.transaction != null)
+                                               {
+                                                       if ((this.transaction.State == TransactionState.TransactionStarted
+                                                               || this.transaction.State == TransactionState.TransactionPrepared)
+                                                               && !this.isUpdated)
+                                                       {
+                                                               this.transaction.Dispose();
+                                                               this.transaction = null;
+                                                       }
+                                               }
+
+                                               // release any managed resources
+                                               if (disposing)
+                                               {
+                                                       this.connection = null;
+                                                       this.transaction = null;
+                                               }
+                                       }
+                                       finally
+                                       {
+                                               this.isUpdated = true;
+                                               this.disposed = true;
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Commit"]/*'/>
+               public void Commit()
+               {
+                       lock (this)
+                       {
+                               if (this.isUpdated)
+                               {
+                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");
+                               }
+
+                               try
+                               {
+                                       this.transaction.Commit();
+                                       this.UpdateTransaction();
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Rollback"]/*'/>
+               public void Rollback()
+               {
+                       lock (this)
+                       {
+                               if (this.isUpdated)
+                               {
+                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");
+                               }
+
+                               try
+                               {
+                                       this.transaction.Rollback();
+                                       this.UpdateTransaction();
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Save(System.String)"]/*'/>
+               public void Save(string savePointName)
+               {
+                       lock (this)
+                       {
+                               if (savePointName == null)
+                               {
+                                       throw new ArgumentException("No transaction name was be specified.");
+                               }
+                               else
+                               {
+                                       if (savePointName.Length == 0)
+                                       {
+                                               throw new ArgumentException("No transaction name was be specified.");
+                                       }
+                               }
+                               if (this.isUpdated)
+                               {
+                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");
+                               }
+
+                               try
+                               {
+                                       FbCommand command = new FbCommand(
+                                               "SAVEPOINT " + savePointName,
+                                               this.connection,
+                                               this);
+                                       command.ExecuteNonQuery();
+                                       command.Dispose();
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Commit(System.String)"]/*'/>
+               public void Commit(string savePointName)
+               {
+                       lock (this)
+                       {
+                               if (savePointName == null)
+                               {
+                                       throw new ArgumentException("No transaction name was be specified.");
+                               }
+                               else
+                               {
+                                       if (savePointName.Length == 0)
+                                       {
+                                               throw new ArgumentException("No transaction name was be specified.");
+                                       }
+                               }
+                               if (this.isUpdated)
+                               {
+                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");
+                               }
+
+                               try
+                               {
+                                       FbCommand command = new FbCommand(
+                                               "RELEASE SAVEPOINT " + savePointName,
+                                               this.connection,
+                                               this);
+                                       command.ExecuteNonQuery();
+                                       command.Dispose();
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="Rollback(System.String)"]/*'/>
+               public void Rollback(string savePointName)
+               {
+                       lock (this)
+                       {
+                               if (savePointName == null)
+                               {
+                                       throw new ArgumentException("No transaction name was be specified.");
+                               }
+                               else
+                               {
+                                       if (savePointName.Length == 0)
+                                       {
+                                               throw new ArgumentException("No transaction name was be specified.");
+                                       }
+                               }
+                               if (this.isUpdated)
+                               {
+                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");
+                               }
+
+                               try
+                               {
+                                       FbCommand command = new FbCommand(
+                                               "ROLLBACK WORK TO SAVEPOINT " + savePointName,
+                                               this.connection,
+                                               this);
+                                       command.ExecuteNonQuery();
+                                       command.Dispose();
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="CommitRetaining"]/*'/>
+               public void CommitRetaining()
+               {
+                       lock (this)
+                       {
+                               if (this.isUpdated)
+                               {
+                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");
+                               }
+
+                               try
+                               {
+                                       this.transaction.CommitRetaining();
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbTransaction.xml' path='doc/class[@name="FbTransaction"]/method[@name="RollbackRetaining"]/*'/>
+               public void RollbackRetaining()
+               {
+                       lock (this)
+                       {
+                               if (this.isUpdated)
+                               {
+                                       throw new InvalidOperationException("This Transaction has completed; it is no longer usable.");
+                               }
+
+                               try
+                               {
+                                       this.transaction.RollbackRetaining();
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region InternalMethods
+
+               internal void BeginTransaction()
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       IDatabase database = this.connection.InnerConnection.Database;
+                                       this.transaction = database.BeginTransaction(this.BuildTpb());
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               internal void BeginTransaction(FbTransactionOptions options)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       IDatabase database = this.connection.InnerConnection.Database;
+                                       this.transaction = database.BeginTransaction(this.BuildTpb(options));
+                               }
+                               catch (IscException ex)
+                               {
+                                       throw new FbException(ex.Message, ex);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void UpdateTransaction()
+               {
+                       if (this.connection != null)
+                       {
+                               this.connection.InnerConnection.TransactionUpdated();
+                       }
+
+                       this.isUpdated  = true;
+                       this.connection = null;
+                       this.transaction = null;
+               }
+
+               private TransactionParameterBuffer BuildTpb()
+               {
+                       FbTransactionOptions options = FbTransactionOptions.Write;
+
+                       options |= FbTransactionOptions.Wait;
+
+                       /* Isolation level */
+                       switch (this.isolationLevel)
+                       {
+                               case IsolationLevel.Serializable:
+                                       options |= FbTransactionOptions.Consistency;
+                                       break;
+
+                               case IsolationLevel.RepeatableRead:
+                                       options |= FbTransactionOptions.Concurrency;
+                                       break;
+
+                               case IsolationLevel.ReadUncommitted:
+                                       options |= FbTransactionOptions.ReadCommitted;
+                                       options |= FbTransactionOptions.RecVersion;
+                                       break;
+
+                               case IsolationLevel.ReadCommitted:
+                               default:
+                                       options |= FbTransactionOptions.ReadCommitted;
+                                       options |= FbTransactionOptions.NoRecVersion;
+                                       break;
+                       }
+
+                       return this.BuildTpb(options);
+               }
+
+#if    (!NETCF)
+
+               private TransactionParameterBuffer BuildTpb(FbTransactionOptions options)
+               {
+                       TransactionParameterBuffer tpb = new TransactionParameterBuffer();
+
+                       tpb.Append(IscCodes.isc_tpb_version3);
+
+                       FbTransactionOptions[] o = (FbTransactionOptions[])Enum.GetValues(options.GetType());
+                       for (int i = 0; i < o.Length; i++)
+                       {
+                               FbTransactionOptions option = ((FbTransactionOptions)(o[i]));
+                               if ((options & option) == option)
+                               {
+                                       switch (option)
+                                       {
+                                               case FbTransactionOptions.Consistency:
+                                                       tpb.Append(IscCodes.isc_tpb_consistency);
+                                                       break;
+
+                                               case FbTransactionOptions.Concurrency:
+                                                       tpb.Append(IscCodes.isc_tpb_concurrency);
+                                                       break;
+
+                                               case FbTransactionOptions.Shared:
+                                                       tpb.Append(IscCodes.isc_tpb_shared);
+                                                       break;
+
+                                               case FbTransactionOptions.Protected:
+                                                       tpb.Append(IscCodes.isc_tpb_protected);
+                                                       break;
+
+                                               case FbTransactionOptions.Exclusive:
+                                                       tpb.Append(IscCodes.isc_tpb_exclusive);
+                                                       break;
+
+                                               case FbTransactionOptions.Wait:
+                                                       tpb.Append(IscCodes.isc_tpb_wait);
+                                                       break;
+
+                                               case FbTransactionOptions.NoWait:
+                                                       tpb.Append(IscCodes.isc_tpb_nowait);
+                                                       break;
+
+                                               case FbTransactionOptions.Read:
+                                                       tpb.Append(IscCodes.isc_tpb_read);
+                                                       break;
+
+                                               case FbTransactionOptions.Write:
+                                                       tpb.Append(IscCodes.isc_tpb_write);
+                                                       break;
+
+                                               case FbTransactionOptions.LockRead:
+                                                       tpb.Append(IscCodes.isc_tpb_lock_read);
+                                                       break;
+
+                                               case FbTransactionOptions.LockWrite:
+                                                       tpb.Append(IscCodes.isc_tpb_lock_write);
+                                                       break;
+
+                                               case FbTransactionOptions.ReadCommitted:
+                                                       tpb.Append(IscCodes.isc_tpb_read_committed);
+                                                       break;
+
+                                               case FbTransactionOptions.Autocommit:
+                                                       tpb.Append(IscCodes.isc_tpb_autocommit);
+                                                       break;
+
+                                               case FbTransactionOptions.RecVersion:
+                                                       tpb.Append(IscCodes.isc_tpb_rec_version);
+                                                       break;
+
+                                               case FbTransactionOptions.NoRecVersion:
+                                                       tpb.Append(IscCodes.isc_tpb_no_rec_version);
+                                                       break;
+
+                                               case FbTransactionOptions.RestartRequests:
+                                                       tpb.Append(IscCodes.isc_tpb_restart_requests);
+                                                       break;
+
+                                               case FbTransactionOptions.NoAutoUndo:
+                                                       tpb.Append(IscCodes.isc_tpb_no_auto_undo);
+                                                       break;
+                                       }
+                               }
+                       }
+
+                       return tpb;
+               }
+
+#else
+
+               private TransactionParameterBuffer BuildTpb(FbTransactionOptions options)
+               {
+                       TransactionParameterBuffer tpb = new TransactionParameterBuffer();
+
+                       tpb.Append(IscCodes.isc_tpb_version3);
+
+                       if ((options & FbTransactionOptions.Consistency) ==     FbTransactionOptions.Consistency)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_consistency);
+                       }
+                       if ((options & FbTransactionOptions.Concurrency) ==     FbTransactionOptions.Concurrency)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_concurrency);
+                       }
+                       if ((options & FbTransactionOptions.Shared) == FbTransactionOptions.Shared)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_shared);
+                       }
+                       if ((options & FbTransactionOptions.Protected) == FbTransactionOptions.Protected)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_protected);
+                       }
+                       if ((options & FbTransactionOptions.Exclusive) == FbTransactionOptions.Exclusive)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_exclusive);
+                       }
+                       if ((options & FbTransactionOptions.Wait) == FbTransactionOptions.Wait)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_wait);
+                       }
+                       if ((options & FbTransactionOptions.NoWait) == FbTransactionOptions.NoWait)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_nowait);
+                       }
+                       if ((options & FbTransactionOptions.Read) == FbTransactionOptions.Read)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_read);
+                       }
+                       if ((options & FbTransactionOptions.Write) == FbTransactionOptions.Write)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_write);
+                       }
+                       if ((options & FbTransactionOptions.LockRead) == FbTransactionOptions.LockRead)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_lock_read);
+                       }
+                       if ((options & FbTransactionOptions.LockWrite) == FbTransactionOptions.LockWrite)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_lock_write);
+                       }
+                       if ((options & FbTransactionOptions.ReadCommitted) == FbTransactionOptions.ReadCommitted)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_read_committed);
+                       }
+                       if ((options & FbTransactionOptions.Autocommit) == FbTransactionOptions.Autocommit)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_autocommit);
+                       }
+                       if ((options & FbTransactionOptions.RecVersion) == FbTransactionOptions.RecVersion)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_rec_version);
+                       }
+                       if ((options & FbTransactionOptions.NoRecVersion) == FbTransactionOptions.NoRecVersion)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_no_rec_version);
+                       }
+                       if ((options & FbTransactionOptions.RestartRequests) == FbTransactionOptions.RestartRequests)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_restart_requests);
+                       }
+                       if ((options & FbTransactionOptions.NoAutoUndo) == FbTransactionOptions.NoAutoUndo)
+                       {
+                               tpb.Append(IscCodes.isc_tpb_no_auto_undo);
+                       }
+                       
+                       return tpb;
+               }
+
+#endif
+
+               #endregion
+       }
+}
index 8e61af424ab4c20e7a1a95d7059a2f41a5468535..ad39b3c1562c1466f391e65f0d15bdd91fc3f51b 100644 (file)
@@ -1,67 +1,67 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird\r
-{\r
-       /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/overview/*'/>\r
-#if    (!NETCF)\r
-       [Flags]\r
-       [Serializable]\r
-#endif\r
-       public enum FbTransactionOptions : int\r
-       {\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Consistency"]/*'/>\r
-               Consistency             = 1,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Concurrency"]/*'/>\r
-               Concurrency             = 2,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Shared"]/*'/>\r
-               Shared                  = 4,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Protected"]/*'/>\r
-               Protected               = 8,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Exclusive"]/*'/>\r
-               Exclusive               = 16,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Wait"]/*'/>\r
-               Wait                    = 32,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="NoWait"]/*'/>\r
-               NoWait                  = 64,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Read"]/*'/>\r
-               Read                    = 128,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Write"]/*'/>\r
-               Write                   = 256,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="LockRead"]/*'/>\r
-               LockRead                = 512,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="LockWrite"]/*'/>\r
-               LockWrite               = 1024,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="ReadCommitted"]/*'/>\r
-               ReadCommitted   = 2048,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Autocommit"]/*'/>\r
-               Autocommit              = 4096,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="RecVersion"]/*'/>\r
-               RecVersion              = 8192,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="NoRecVersion"]/*'/>\r
-               NoRecVersion    = 16384,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="RestartRequests"]/*'/>\r
-               RestartRequests = 32768,\r
-               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="NoAutoUndo"]/*'/>\r
-               NoAutoUndo              = 65536\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird
+{
+       /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/overview/*'/>
+#if    (!NETCF)
+       [Flags]
+       [Serializable]
+#endif
+       public enum FbTransactionOptions : int
+       {
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Consistency"]/*'/>
+               Consistency             = 1,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Concurrency"]/*'/>
+               Concurrency             = 2,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Shared"]/*'/>
+               Shared                  = 4,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Protected"]/*'/>
+               Protected               = 8,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Exclusive"]/*'/>
+               Exclusive               = 16,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Wait"]/*'/>
+               Wait                    = 32,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="NoWait"]/*'/>
+               NoWait                  = 64,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Read"]/*'/>
+               Read                    = 128,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Write"]/*'/>
+               Write                   = 256,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="LockRead"]/*'/>
+               LockRead                = 512,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="LockWrite"]/*'/>
+               LockWrite               = 1024,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="ReadCommitted"]/*'/>
+               ReadCommitted   = 2048,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="Autocommit"]/*'/>
+               Autocommit              = 4096,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="RecVersion"]/*'/>
+               RecVersion              = 8192,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="NoRecVersion"]/*'/>
+               NoRecVersion    = 16384,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="RestartRequests"]/*'/>
+               RestartRequests = 32768,
+               /// <include file='Doc/en_EN/FbTransactionOptions.xml' path='doc/enum[@name="FbTransactionOptions"]/field[@name="NoAutoUndo"]/*'/>
+               NoAutoUndo              = 65536
+       }
+}
index aca7afff4317af4d171002c8008e1c1dc5724159..00299ddfda54a2d2ad569245ffd9e742ad43d8cb 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2003, 2004 Abel Eduardo Pereira\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using FirebirdSql.Data.Firebird;\r
-\r
-namespace FirebirdSql.Data.Firebird.Isql\r
-{\r
-       #region Delegates\r
-\r
-       /// <summary>\r
-       /// The event handler type trigged after a SQL statement execution.\r
-       /// </summary>\r
-       public delegate void CommandExecutedEventHandler(object sender, CommandExecutedEventArgs e);\r
-\r
-       #endregion\r
-\r
-       /// <summary>\r
-       /// Summary description for CommandExecutedEventArgs.\r
-       /// </summary>\r
-       public class CommandExecutedEventArgs\r
-       {\r
-               #region Fields\r
-\r
-               private string          commandText;\r
-               private FbDataReader    dataReader;\r
-               private int             rowsAffected;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <summary>\r
-               /// Returns the <see cref="SqlStatementType"/> of the current <see cref="CommandText"/>.\r
-               /// </summary>\r
-               public SqlStatementType StatementType \r
-               {\r
-                       get { return FbBatchExecution.GetStatementType(this.commandText); }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Returns the SQL statement that was executed.\r
-               /// </summary>\r
-               public string CommandText \r
-               {\r
-                       get { return this.commandText; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Returns a <see cref="FbDataReader"/> instance case the executed SQL command returns data. If\r
-               /// the executed SQL command does not returns data, (for instance: the case of an UPDATE statement), \r
-               /// the <b>DataReader</b> is setled to <b>null</b>.\r
-               /// </summary>\r
-               public FbDataReader DataReader\r
-               {\r
-                       get { return this.dataReader; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <summary>\r
-               /// Creates an instance of CommandExecutedEventArgs class.\r
-               /// </summary>\r
-               /// <param name="dataReader"></param>\r
-               /// <param name="commandText">The CommandText of the <see cref="FbCommand"/> that was executed.</param>\r
-               /// <param name="rowsAffected"></param>\r
-               public CommandExecutedEventArgs(\r
-                       FbDataReader    dataReader,\r
-                       string          commandText,\r
-                       int             rowsAffected)\r
-               {\r
-                       this.dataReader  = dataReader;\r
-                       this.commandText = commandText;\r
-                       this.rowsAffected = rowsAffected;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <summary>\r
-               /// Overrided. Returns the SQL statement that was executed.\r
-               /// </summary>\r
-               /// <returns>The SQL statement that will be executed.</returns>\r
-               public override string ToString() \r
-               {\r
-                       return this.commandText;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2003, 2004 Abel Eduardo Pereira
+ *  All Rights Reserved.
+ */
+
+using System;
+using FirebirdSql.Data.Firebird;
+
+namespace FirebirdSql.Data.Firebird.Isql
+{
+       #region Delegates
+
+       /// <summary>
+       /// The event handler type trigged after a SQL statement execution.
+       /// </summary>
+       public delegate void CommandExecutedEventHandler(object sender, CommandExecutedEventArgs e);
+
+       #endregion
+
+       /// <summary>
+       /// Summary description for CommandExecutedEventArgs.
+       /// </summary>
+       public class CommandExecutedEventArgs
+       {
+               #region Fields
+
+               private string          commandText;
+               private FbDataReader    dataReader;
+               private int             rowsAffected;
+
+               #endregion
+
+               #region Properties
+
+               /// <summary>
+               /// Returns the <see cref="SqlStatementType"/> of the current <see cref="CommandText"/>.
+               /// </summary>
+               public SqlStatementType StatementType 
+               {
+                       get { return FbBatchExecution.GetStatementType(this.commandText); }
+               }
+
+               /// <summary>
+               /// Returns the SQL statement that was executed.
+               /// </summary>
+               public string CommandText 
+               {
+                       get { return this.commandText; }
+               }
+
+               /// <summary>
+               /// Returns a <see cref="FbDataReader"/> instance case the executed SQL command returns data. If
+               /// the executed SQL command does not returns data, (for instance: the case of an UPDATE statement), 
+               /// the <b>DataReader</b> is setled to <b>null</b>.
+               /// </summary>
+               public FbDataReader DataReader
+               {
+                       get { return this.dataReader; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <summary>
+               /// Creates an instance of CommandExecutedEventArgs class.
+               /// </summary>
+               /// <param name="dataReader"></param>
+               /// <param name="commandText">The CommandText of the <see cref="FbCommand"/> that was executed.</param>
+               /// <param name="rowsAffected"></param>
+               public CommandExecutedEventArgs(
+                       FbDataReader    dataReader,
+                       string          commandText,
+                       int             rowsAffected)
+               {
+                       this.dataReader  = dataReader;
+                       this.commandText = commandText;
+                       this.rowsAffected = rowsAffected;
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <summary>
+               /// Overrided. Returns the SQL statement that was executed.
+               /// </summary>
+               /// <returns>The SQL statement that will be executed.</returns>
+               public override string ToString() 
+               {
+                       return this.commandText;
+               }
+
+               #endregion
+       }
+}
index 7240e2531bcdf1f03f3147eb73e786878c9b3ad8..12f7ea6ab5e611b8bdfe51a6b9d9d820f73860bf 100644 (file)
@@ -1,98 +1,98 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2003,     2004 Abel Eduardo Pereira\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using FirebirdSql.Data.Firebird;\r
-\r
-namespace FirebirdSql.Data.Firebird.Isql\r
-{\r
-       #region Delegates\r
-\r
-       /// <summary>\r
-       /// The event handler type trigged before a     SQL     statement execution.\r
-       /// </summary>\r
-       public delegate void CommandExecutingEventHandler(object sender, CommandExecutingEventArgs e);\r
-\r
-       #endregion\r
-\r
-       /// <summary>\r
-       /// CommandExecutingEventArgs encapsulates the events arguments for     the     event trigged \r
-       /// from the <see cref="FbBatchExecution"/>     during the execution. \r
-       /// </summary>\r
-       /// <remarks>\r
-       /// \r
-       /// </remarks>\r
-       public class CommandExecutingEventArgs: EventArgs\r
-       {\r
-               #region Private\r
-\r
-               private FbCommand sqlCommand;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <summary>\r
-               /// Returns     the     <see cref="FbCommand"/> instance that created for the SQL statement     that goes \r
-               /// for execution. \r
-               /// </summary>\r
-               public FbCommand SqlCommand     \r
-               {\r
-                       get     { return this.sqlCommand; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Returns     the     <see cref="SqlStatementType"/> of the current <see cref="SqlCommand"/>.\r
-               /// </summary>\r
-               public SqlStatementType StatementType \r
-               {\r
-                       get     { return FbBatchExecution.GetStatementType(this.SqlCommand.CommandText); }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <summary>\r
-               /// Creates     an instance     of CommandExecutingEventArgs class.\r
-               /// </summary>\r
-               /// <param name="sqlCommand">The FbCommand properly     instanciated.</param>\r
-               /// <remarks>The <b>sqlCommand</b> should be proper     instanciated with a     valid \r
-               /// <see cref="FbCommand"/> and with the SQL statement loaded in <see cref="FbCommand.CommandText"/>.\r
-               /// </remarks>\r
-               public CommandExecutingEventArgs(FbCommand sqlCommand)\r
-               {\r
-                       this.sqlCommand = sqlCommand;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <summary>\r
-               /// Overrided. Returns the SQL statement that goes for execution.\r
-               /// </summary>\r
-               /// <returns>The SQL statement that     will be executed.</returns>\r
-               public override string ToString() \r
-               {\r
-                       return this.sqlCommand.CommandText;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2003, 2005 Abel Eduardo Pereira
+ *     All Rights Reserved.
+ */
+
+using System;
+using FirebirdSql.Data.Firebird;
+
+namespace FirebirdSql.Data.Firebird.Isql
+{
+       #region Delegates
+
+       /// <summary>
+       /// The event handler type trigged before a     SQL     statement execution.
+       /// </summary>
+       public delegate void CommandExecutingEventHandler(object sender, CommandExecutingEventArgs e);
+
+       #endregion
+
+       /// <summary>
+       /// CommandExecutingEventArgs encapsulates the events arguments for     the     event trigged 
+       /// from the <see cref="FbBatchExecution"/>     during the execution. 
+       /// </summary>
+       /// <remarks>
+       /// 
+       /// </remarks>
+       public class CommandExecutingEventArgs: EventArgs
+       {
+               #region Private
+
+               private FbCommand sqlCommand;
+
+               #endregion
+
+               #region Properties
+
+               /// <summary>
+               /// Returns     the     <see cref="FbCommand"/> instance that created for the SQL statement     that goes 
+               /// for execution. 
+               /// </summary>
+               public FbCommand SqlCommand     
+               {
+                       get     { return this.sqlCommand; }
+               }
+
+               /// <summary>
+               /// Returns     the     <see cref="SqlStatementType"/> of the current <see cref="SqlCommand"/>.
+               /// </summary>
+               public SqlStatementType StatementType 
+               {
+                       get     { return FbBatchExecution.GetStatementType(this.SqlCommand.CommandText); }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <summary>
+               /// Creates     an instance     of CommandExecutingEventArgs class.
+               /// </summary>
+               /// <param name="sqlCommand">The FbCommand properly     instanciated.</param>
+               /// <remarks>The <b>sqlCommand</b> should be proper     instanciated with a     valid 
+               /// <see cref="FbCommand"/> and with the SQL statement loaded in <see cref="FbCommand.CommandText"/>.
+               /// </remarks>
+               public CommandExecutingEventArgs(FbCommand sqlCommand)
+               {
+                       this.sqlCommand = sqlCommand;
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <summary>
+               /// Overrided. Returns the SQL statement that goes for execution.
+               /// </summary>
+               /// <returns>The SQL statement that     will be executed.</returns>
+               public override string ToString() 
+               {
+                       return this.sqlCommand.CommandText;
+               }
+
+               #endregion
+       }
+}
index 13662e68f3244e4946063d3bc17d6a6c6be119ed..5ac14b36a2477cd44b1cbc3d5999ff1f0d3d1129 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2003,     2004 Abel Eduardo Pereira\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-using System.Globalization;\r
-\r
-using FirebirdSql.Data.Firebird;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Isql\r
-{\r
-       /// <summary>\r
-       /// Performs batch execution of ISQL commands.\r
-       /// </summary>\r
-       public class FbBatchExecution\r
-       {\r
-               #region Events\r
-\r
-               /// <summary>\r
-               /// The event trigged before a SQL statement goes for execution.\r
-               /// </summary>\r
-               public event CommandExecutingEventHandler CommandExecuting;\r
-\r
-               /// <summary>\r
-               /// The event trigged after     a SQL statement execution.\r
-               /// </summary>\r
-               public event CommandExecutedEventHandler CommandExecuted;\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private StringCollection                        sqlStatements;\r
-               private FbConnection                            sqlConnection;\r
-               private FbTransaction                           sqlTransaction;\r
-               private FbConnectionStringBuilder       connectionString;\r
-               private FbCommand                                       sqlCommand;\r
-\r
-               // control fields\r
-               private bool requiresNewConnection;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <summary>\r
-               /// Represents the list of SQL statements for batch     execution.\r
-               /// </summary>\r
-               public StringCollection SqlStatements \r
-               {\r
-                       get     \r
-                       {\r
-                               if (this.sqlStatements == null)\r
-                               {\r
-                                       this.sqlStatements = new StringCollection();\r
-                               }\r
-                               return this.sqlStatements; \r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <summary>\r
-               /// Creates     an instance     of FbBatchExecution     engine.\r
-               /// </summary>\r
-               public FbBatchExecution()\r
-               {\r
-                       this.sqlConnection       = new FbConnection(); // do    not     specify the     connection string\r
-                       this.connectionString = new FbConnectionStringBuilder();\r
-               }\r
-\r
-               /// <summary>\r
-               /// Creates     an instance     of FbBatchExecution     engine with     the     given\r
-               /// connection.\r
-               /// </summary>\r
-               /// <param name="sqlConnection">A <see cref="FbConnection"/> object.</param>\r
-               public FbBatchExecution(FbConnection sqlConnection) : this(sqlConnection, null)\r
-               {\r
-               }\r
-\r
-               public FbBatchExecution(FbConnection sqlConnection, FbScript isqlScript)\r
-               {\r
-                       if (sqlConnection == null)\r
-                       {\r
-                               this.sqlConnection       = new FbConnection(); // do    not     specify the     connection string\r
-                               this.connectionString = new FbConnectionStringBuilder();\r
-                       }\r
-                       else\r
-                       {\r
-                               this.sqlConnection       = sqlConnection;\r
-                               this.connectionString = new FbConnectionStringBuilder(sqlConnection.ConnectionString);\r
-                       }\r
-\r
-            if (isqlScript != null)\r
-            {\r
-                foreach (string sql in isqlScript.Results)\r
-                {\r
-                    this.SqlStatements.Add(sql);\r
-                }\r
-            }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <summary>\r
-               /// Starts the ordered execution of     the     SQL     statements that are     in <see cref="SqlStatements"/> collection.\r
-               /// </summary>\r
-               public virtual void     Execute()\r
-               {\r
-                       this.Execute(true);\r
-               }\r
-\r
-               /// <summary>\r
-               /// Starts the ordered execution of     the     SQL     statements that are     in <see cref="SqlStatements"/> collection.\r
-               /// </summary>\r
-               /// <param name="autoCommit">Specifies if the transaction should be     committed after a DDL command execution</param>\r
-               public virtual void     Execute(bool autoCommit) \r
-               {\r
-                       if (this.SqlStatements == null || this.SqlStatements.Count == 0)        \r
-                       {\r
-                               throw new InvalidOperationException("There are no commands for execution.");\r
-                       }\r
-\r
-                       foreach (string sqlStatement in this.SqlStatements)\r
-                       {\r
-                               if (sqlStatement ==     null || sqlStatement.Length == 0)\r
-                               {\r
-                                       continue;\r
-                               }\r
-                               \r
-                               // initializate outputs to default\r
-                               int                             rowsAffected = -1;\r
-                               FbDataReader    dataReader       = null;\r
-                               SqlStatementType statementType = FbBatchExecution.GetStatementType(sqlStatement);\r
-\r
-                               // Update command configuration\r
-                               this.ProvideCommand().CommandText = sqlStatement;\r
-\r
-                               // Check how transactions are going     to be handled\r
-                               if (statementType == SqlStatementType.Insert ||\r
-                                       statementType == SqlStatementType.Update ||\r
-                                       statementType == SqlStatementType.Delete)\r
-                               {\r
-                                       // DML commands should be inside a transaction\r
-                                       if (this.sqlTransaction == null)\r
-                                       {\r
-                                               this.sqlTransaction = this.sqlConnection.BeginTransaction();\r
-                                       }\r
-                                       this.sqlCommand.Transaction = this.sqlTransaction;\r
-                               }\r
-                               else if (this.sqlTransaction != null && (statementType != SqlStatementType.Commit && statementType != SqlStatementType.Rollback))\r
-                               {\r
-                                       // Non DML Statements should be executed using\r
-                                       // implicit     transaction     support\r
-                                       this.sqlTransaction.Commit();\r
-                    this.sqlTransaction = null;\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       switch (statementType)\r
-                                       {\r
-                                               case SqlStatementType.AlterDatabase:\r
-                                               case SqlStatementType.AlterDomain:\r
-                                               case SqlStatementType.AlterException:\r
-                                               case SqlStatementType.AlterIndex:\r
-                                               case SqlStatementType.AlterProcedure:\r
-                                               case SqlStatementType.AlterTable:\r
-                                               case SqlStatementType.AlterTrigger:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(this.sqlCommand);\r
-\r
-                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);\r
-                                                       this.requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.Commit:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(null);\r
-\r
-                                                       this.sqlTransaction.Commit();\r
-                                                       this.sqlTransaction = null;\r
-                                                       \r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, -1);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.Connect:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(null);\r
-\r
-                                                       this.ConnectToDatabase(sqlStatement);\r
-\r
-                                                       requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, -1);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.CreateDatabase:\r
-#if    (!NETCF)\r
-                                                       throw new NotImplementedException();\r
-#else\r
-                                                       throw new NotSupportedException();\r
-#endif\r
-\r
-                                               case SqlStatementType.CreateDomain:\r
-                                               case SqlStatementType.CreateException:\r
-                                               case SqlStatementType.CreateGenerator:\r
-                                               case SqlStatementType.CreateIndex:\r
-                                               case SqlStatementType.CreateProcedure:\r
-                                               case SqlStatementType.CreateRole:\r
-                                               case SqlStatementType.CreateShadow:\r
-                                               case SqlStatementType.CreateTable:\r
-                                               case SqlStatementType.CreateTrigger:\r
-                                               case SqlStatementType.CreateView:\r
-                                               case SqlStatementType.DeclareCursor:\r
-                                               case SqlStatementType.DeclareExternalFunction:\r
-                                               case SqlStatementType.DeclareFilter:\r
-                                               case SqlStatementType.DeclareStatement:\r
-                                               case SqlStatementType.DeclareTable:\r
-                                               case SqlStatementType.Delete:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(this.sqlCommand);\r
-\r
-                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);\r
-                                                       requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.Describe:\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.Disconnect:\r
-                                                       this.sqlConnection.Close();\r
-                                                       this.requiresNewConnection = false;\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.DropDatabase:\r
-#if    (!NETCF)\r
-                                                       throw new NotImplementedException();\r
-#else\r
-                                                       throw new NotSupportedException();\r
-#endif\r
-\r
-                                               case SqlStatementType.DropDomain:\r
-                                               case SqlStatementType.DropException:\r
-                                               case SqlStatementType.DropExternalFunction:\r
-                                               case SqlStatementType.DropFilter:\r
-                                               case SqlStatementType.DropGenerator:\r
-                                               case SqlStatementType.DropIndex:\r
-                                               case SqlStatementType.DropProcedure:\r
-                                               case SqlStatementType.DropRole:\r
-                                               case SqlStatementType.DropShadow:\r
-                                               case SqlStatementType.DropTable:\r
-                                               case SqlStatementType.DropTrigger:\r
-                                               case SqlStatementType.DropView:\r
-                                               case SqlStatementType.EventInit:\r
-                                               case SqlStatementType.EventWait:\r
-                                               case SqlStatementType.Execute:\r
-                                               case SqlStatementType.ExecuteImmediate:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(this.sqlCommand);\r
-\r
-                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);\r
-                                                       this.requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.ExecuteProcedure:\r
-                                               case SqlStatementType.Fetch:\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.Grant:\r
-                                               case SqlStatementType.Insert:\r
-                                               case SqlStatementType.InsertCursor:\r
-                                               case SqlStatementType.Open:\r
-                                               case SqlStatementType.Prepare:\r
-                                               case SqlStatementType.Revoke:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(this.sqlCommand);\r
-\r
-                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);\r
-                                                       this.requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.Rollback:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(null);\r
-\r
-                                                       this.sqlTransaction.Rollback();\r
-                                                       this.sqlTransaction = null;\r
-                                                       \r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, -1);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.Select:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(this.sqlCommand);\r
-\r
-                                                       dataReader = this.sqlCommand.ExecuteReader();\r
-                                                       this.requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, dataReader, -1);\r
-                                                       if (!dataReader.IsClosed)\r
-                                                       {\r
-                                                               dataReader.Close();\r
-                                                       }\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.SetGenerator:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(this.sqlCommand);\r
-\r
-                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);\r
-                                                       this.requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);\r
-                                                       break;\r
-\r
-                                               case SqlStatementType.SetDatabase:\r
-                                               case SqlStatementType.SetNames:\r
-                                               case SqlStatementType.SetSQLDialect:\r
-                                               case SqlStatementType.SetStatistics:\r
-                                               case SqlStatementType.SetTransaction:\r
-                                               case SqlStatementType.ShowSQLDialect:\r
-#if    (!NETCF)\r
-                                                       throw new NotImplementedException();\r
-#else\r
-                                                       throw new NotSupportedException();\r
-#endif\r
-                                                       \r
-                                               case SqlStatementType.Update:\r
-                                               case SqlStatementType.Whenever:\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuting(this.sqlCommand);\r
-\r
-                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);\r
-                                                       this.requiresNewConnection = false;\r
-\r
-                                                       // raise the event\r
-                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                               catch (Exception ex)\r
-                               {\r
-                                       if (this.sqlTransaction != null)\r
-                                       {\r
-                                               this.sqlTransaction.Rollback();\r
-                                               this.sqlTransaction = null;\r
-                                       }\r
-\r
-                                       throw new FbException(String.Format(CultureInfo.CurrentCulture, "An exception was thrown when executing command: {0}\nBatch execution aborted\nThe returned message was: {1}", sqlStatement, ex.Message));\r
-                               }\r
-                       }\r
-\r
-                       if (this.sqlTransaction != null)\r
-                       {\r
-                               // commit root transaction\r
-                               this.sqlTransaction.Commit();\r
-                               this.sqlTransaction = null;\r
-                       }\r
-\r
-                       this.sqlConnection.Close();\r
-               }\r
-\r
-               \r
-               #endregion\r
-\r
-               #region Protected Internal Methods\r
-\r
-               /// <summary>\r
-               /// Updates     the     connection string with the data parsed from     the parameter and opens a connection\r
-               /// to the database.\r
-               /// </summary>\r
-               /// <param name="connectDbStatement"></param>\r
-               protected internal void ConnectToDatabase(string connectDbStatement)\r
-               {\r
-                       // CONNECT 'filespec' [USER     'username'][PASSWORD 'password'] [CACHE int] [ROLE 'rolename']\r
-                       StringParser parser = new StringParser(connectDbStatement, false);\r
-                       parser.Token = " ";\r
-                       parser.ParseNext();\r
-                       if (parser.Result.Trim().ToUpper(CultureInfo.CurrentCulture) != "CONNECT")\r
-                       {\r
-                               throw new Exception("Malformed isql CONNECT statement. Expected keyword CONNECT but something else was found.");\r
-                       }\r
-                       parser.ParseNext();\r
-                       this.connectionString.Database = parser.Result.Replace("'", "");\r
-                       while (parser.ParseNext() != -1)\r
-                       {\r
-                               switch (parser.Result.Trim().ToUpper(CultureInfo.CurrentCulture))\r
-                               {\r
-                                       case "USER":\r
-                                               parser.ParseNext();\r
-                                               this.connectionString.UserID = parser.Result.Replace("'", "");\r
-                                               break;\r
-\r
-                                       case "PASSWORD":\r
-                                               parser.ParseNext();\r
-                                               this.connectionString.Password = parser.Result.Replace("'", "");\r
-                                               break;\r
-\r
-                                       case "CACHE":\r
-                                               parser.ParseNext();\r
-                                               break;\r
-\r
-                                       case "ROLE":\r
-                                               parser.ParseNext();\r
-                                               this.connectionString.Role = parser.Result.Replace("'", "");\r
-                                               break;\r
-\r
-                                       default:\r
-                                               throw new Exception("Unexpected token '" + parser.Result.Trim() + "' on isql CONNECT statement.");\r
-                       \r
-                               }\r
-                       }\r
-                       this.requiresNewConnection = true;\r
-                       this.ProvideConnection();                                       \r
-               }\r
-\r
-               /// <summary>\r
-               /// Parses the isql     statement CREATE DATABASE and creates the database and opens a connection to the recently created database.\r
-               /// </summary>\r
-               /// <param name="createDbStatement">the create database statement.</param>\r
-               protected internal void CreateDatabase(string createDbStatement)\r
-               {\r
-                       // CREATE {DATABASE     | SCHEMA} 'filespec'\r
-                       // [USER 'username'     [PASSWORD 'password']]\r
-                       // [PAGE_SIZE [=] int]\r
-                       // [LENGTH [=] int [PAGE[S]]]\r
-                       // [DEFAULT     CHARACTER SET charset]\r
-                       // [<secondary_file>];  \r
-#if    (!NETCF)\r
-                       throw new NotImplementedException();\r
-#else\r
-                       throw new NotSupportedException();\r
-#endif\r
-               }\r
-\r
-               /// <summary>\r
-               /// \r
-               /// </summary>\r
-               /// <returns></returns>\r
-               protected internal FbConnection SetDatabase(string setDbStatement)\r
-               {\r
-#if    (!NETCF)\r
-                       throw new NotImplementedException();\r
-#else\r
-                       throw new NotSupportedException();\r
-#endif\r
-               }\r
-               \r
-               /// <summary>\r
-               /// Gets a <see cref="FbConnection"/> instance.\r
-               /// </summary>\r
-               /// <returns>An instance of the <see cref="FbConnection"/> class.</returns>\r
-               protected internal FbConnection ProvideConnection()\r
-               {\r
-                       if (requiresNewConnection)\r
-                       {\r
-                               if ((this.sqlConnection != null) ||\r
-                                       (this.sqlConnection.State != ConnectionState.Closed) ||\r
-                                       (this.sqlConnection.State != ConnectionState.Broken))\r
-                               {\r
-                                       this.sqlConnection.Close();\r
-                               }\r
-                               this.sqlConnection = new FbConnection(this.connectionString.ToString());        \r
-                       }\r
-\r
-                       if (this.sqlConnection.State == ConnectionState.Closed)\r
-                       {\r
-                               this.sqlConnection.Open();\r
-                       }\r
-\r
-                       return this.sqlConnection;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets a <see cref="FbCommand" /> instance.\r
-               /// </summary>\r
-               /// <returns>An instance of the <see cref="FbCommand" /> class.</returns>\r
-               protected internal FbCommand ProvideCommand()\r
-               {\r
-                       if (this.sqlCommand == null)\r
-                       {\r
-                               this.sqlCommand = new FbCommand();\r
-                       }\r
-                       this.sqlCommand.Connection = this.ProvideConnection();\r
-\r
-                       return this.sqlCommand;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Executes a command and optionally commits the transaction.\r
-               /// </summary>\r
-               /// <param name="command">Command to execute.</param>\r
-               /// <param name="autocommit">true to commit     the     transaction     after execution; or     false if not.</param>\r
-               /// <returns>The number of rows affected by the query execution.</returns>\r
-               protected internal int ExecuteCommand(FbCommand command, bool autocommit)\r
-               {\r
-                       int     rowsAffected = command.ExecuteNonQuery();\r
-                       if (autocommit && command.IsDDLCommand && command.Transaction != null)\r
-                       {\r
-                               command.Transaction.CommitRetaining();\r
-                       }\r
-\r
-                       return rowsAffected;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Event Handlers\r
-\r
-               /// <summary>\r
-               /// The trigger function for <see cref="CommandExecuting"/>     event.\r
-               /// </summary>\r
-               /// <param name="sqlCommand">The SQL command that is going for execution.</param>\r
-               protected virtual void OnCommandExecuting(FbCommand     sqlCommand)\r
-               {\r
-                       if (CommandExecuting != null)\r
-                       {\r
-                               CommandExecutingEventArgs e = new CommandExecutingEventArgs(sqlCommand);\r
-                               CommandExecuting(this, e);\r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// The trigger function for <see cref="CommandExecuted"/> event.\r
-               /// </summary>\r
-               /// <param name="commandText">The <see cref="FbCommand.CommandText"/> of the executed SQL command.</param>\r
-               /// <param name="dataReader">The <see cref="FbDataReader"/>     instance with the returned data. If     the     \r
-               /// command     executed is     not     meant to return data (ex: UPDATE, INSERT...) this parameter     must be \r
-               /// setled to <b>null</b>.</param>\r
-               /// <param name="rowsAffected">The rows that were affected by the executed SQL command. If the executed \r
-               /// command     is not meant to return this     kind of information     (ex: SELECT) this parameter     must \r
-               /// be setled to <b>-1</b>.</param>\r
-               protected virtual void OnCommandExecuted(string commandText, FbDataReader dataReader, int rowsAffected) \r
-               {\r
-                       if (CommandExecuted     != null) \r
-                       {\r
-                               CommandExecutedEventArgs e = new CommandExecutedEventArgs(dataReader, commandText, rowsAffected);\r
-                               CommandExecuted(this, e);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               /// <summary>\r
-               /// Determines the <see cref="SqlStatementType"/> of the provided SQL statement.\r
-               /// </summary>\r
-               /// <param name="sqlStatement">The string containing the SQL statement.</param>\r
-               /// <returns>The <see cref="SqlStatementType"/> of the <b>sqlStatement</b>.</returns>\r
-               /// <remarks>If the     type of <b>sqlStatement</b>     could not be determinated this \r
-               /// method will throw an exception.</remarks>\r
-               public static SqlStatementType GetStatementType(string sqlStatement) \r
-               {\r
-                       char type = sqlStatement ==     null ? ' ' : sqlStatement.Trim().ToUpper(CultureInfo.CurrentCulture)[0];\r
-\r
-                       switch (type)\r
-                       {\r
-                               case 'A':\r
-                                       if (StringParser.StartsWith(sqlStatement, "ALTER DATABASE",     true))\r
-                                               return SqlStatementType.AlterDatabase;\r
-                                       if (StringParser.StartsWith(sqlStatement, "ALTER DOMAIN", true))\r
-                                               return SqlStatementType.AlterDomain;\r
-                                       if (StringParser.StartsWith(sqlStatement, "ALTER EXCEPTION", true))\r
-                                               return SqlStatementType.AlterException;\r
-                                       if (StringParser.StartsWith(sqlStatement, "ALTER INDEX", true))\r
-                                               return SqlStatementType.AlterIndex;\r
-                                       if (StringParser.StartsWith(sqlStatement, "ALTER PROCEDURE", true))\r
-                                               return SqlStatementType.AlterProcedure;\r
-                                       if (StringParser.StartsWith(sqlStatement, "ALTER TABLE", true))\r
-                                               return SqlStatementType.AlterTable;\r
-                                       if (StringParser.StartsWith(sqlStatement, "ALTER TRIGGER", true))\r
-                                               return SqlStatementType.AlterTrigger;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'C':\r
-                               switch (char.ToUpper(sqlStatement[1], CultureInfo.CurrentCulture)) \r
-                               {\r
-                                       case 'L':\r
-                                               if (StringParser.StartsWith(sqlStatement, "CLOSE", true))\r
-                                                       return SqlStatementType.Close;\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                                       case 'O':\r
-                                               if (StringParser.StartsWith(sqlStatement, "COMMIT",     true))\r
-                                                       return SqlStatementType.Commit;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CONNECT", true))\r
-                                                       return SqlStatementType.Connect;\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                                       case 'R':\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE DATABASE", true))\r
-                                                       return SqlStatementType.CreateDatabase;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE DOMAIN", true))\r
-                                                       return SqlStatementType.CreateDomain;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE EXCEPTION", true))\r
-                                                       return SqlStatementType.CreateException;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE GENERATOR", true))\r
-                                                       return SqlStatementType.CreateGenerator;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE INDEX", true))\r
-                                                       return SqlStatementType.CreateIndex;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE DESCENDING INDEX", true))\r
-                                                       return SqlStatementType.CreateIndex;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE PROCEDURE", true))\r
-                                                       return SqlStatementType.CreateProcedure;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE ROLE", true))\r
-                                                       return SqlStatementType.CreateRole;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE SHADOW", true))\r
-                                                       return SqlStatementType.CreateShadow;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE TABLE", true))\r
-                                                       return SqlStatementType.CreateTable;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE TRIGGER",     true))\r
-                                                       return SqlStatementType.CreateTrigger;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE UNIQUE INDEX", true))\r
-                                                       return SqlStatementType.CreateIndex;\r
-                                               if (StringParser.StartsWith(sqlStatement, "CREATE VIEW", true))\r
-                                                       return SqlStatementType.CreateView;\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                                       default:\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-                               }\r
-                                       \r
-                               case 'D':\r
-                               switch (char.ToUpper(sqlStatement[1], CultureInfo.CurrentCulture)) \r
-                               {\r
-                                       case 'E':\r
-                                               if (StringParser.StartsWith(sqlStatement, "DECLARE CURSOR",     true))\r
-                                                       return SqlStatementType.DeclareCursor;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DECLARE EXTERNAL FUNCTION", true))\r
-                                                       return SqlStatementType.DeclareExternalFunction;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DECLARE FILTER",     true))\r
-                                                       return SqlStatementType.DeclareFilter;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DECLARE STATEMENT", true))\r
-                                                       return SqlStatementType.DeclareStatement;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DECLARE TABLE", true))\r
-                                                       return SqlStatementType.DeclareTable;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DELETE",     true))\r
-                                                       return SqlStatementType.Delete;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DESCRIBE", true))\r
-                                                       return SqlStatementType.Describe;\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                                       case 'I':\r
-                                               if (StringParser.StartsWith(sqlStatement, "DISCONNECT", true))\r
-                                                       return SqlStatementType.Disconnect;\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                                       case 'R':\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP DATABASE", true))\r
-                                                       return SqlStatementType.DropDatabase;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP DOMAIN", true))\r
-                                                       return SqlStatementType.DropDomain;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP EXCEPTION",     true))\r
-                                                       return SqlStatementType.DropException;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP EXTERNAL FUNCTION",     true))\r
-                                                       return SqlStatementType.DropExternalFunction;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP FILTER", true))\r
-                                                       return SqlStatementType.DropFilter;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP GENERATOR",     true))\r
-                                                       return SqlStatementType.DropGenerator;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP INDEX", true))\r
-                                                       return SqlStatementType.DropIndex;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP PROCEDURE",     true))\r
-                                                       return SqlStatementType.DropProcedure;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP ROLE", true))\r
-                                                       return SqlStatementType.DropRole;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP SHADOW", true))\r
-                                                       return SqlStatementType.DropShadow;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP TABLE", true))\r
-                                                       return SqlStatementType.DropTable;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP TRIGGER", true))\r
-                                                       return SqlStatementType.DropTrigger;\r
-                                               if (StringParser.StartsWith(sqlStatement, "DROP VIEW", true))\r
-                                                       return SqlStatementType.DropView;\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                                       default:\r
-                                               throw new Exception("The type of the SQL statement could not be determinated.");\r
-                               }\r
-                               \r
-                               case 'E':\r
-                                       if (StringParser.StartsWith(sqlStatement, "EXECUTE PROCEDURE", true))\r
-                                               return SqlStatementType.ExecuteProcedure;\r
-                                       if (StringParser.StartsWith(sqlStatement, "EXECUTE IMMEDIATE", true))\r
-                                               return SqlStatementType.ExecuteImmediate;\r
-                                       if (StringParser.StartsWith(sqlStatement, "EXECUTE", true))\r
-                                               return SqlStatementType.Execute;\r
-                                       if (StringParser.StartsWith(sqlStatement, "EVENT WAIT", true))\r
-                                               return SqlStatementType.EventWait;\r
-                                       if (StringParser.StartsWith(sqlStatement, "EVENT INIT", true))\r
-                                               return SqlStatementType.EventInit;\r
-                                       if (StringParser.StartsWith(sqlStatement, "END DECLARE SECTION", true))\r
-                                               return SqlStatementType.EndDeclareSection;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'F':\r
-                                       if (StringParser.StartsWith(sqlStatement, "FETCH", true))\r
-                                               return SqlStatementType.Fetch;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'G':\r
-                                       if (StringParser.StartsWith(sqlStatement, "GRANT", true))\r
-                                               return SqlStatementType.Grant;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'I':\r
-                                       if (StringParser.StartsWith(sqlStatement, "INSERT CURSOR", true))\r
-                                               return SqlStatementType.InsertCursor;\r
-                                       if (StringParser.StartsWith(sqlStatement, "INSERT",     true))\r
-                                               return SqlStatementType.Insert;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'O':\r
-                                       if (StringParser.StartsWith(sqlStatement, "OPEN", true))\r
-                                               return SqlStatementType.Open;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'P':\r
-                                       if (StringParser.StartsWith(sqlStatement, "PREPARE", true))\r
-                                               return SqlStatementType.Prepare;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'R':\r
-                                       if (StringParser.StartsWith(sqlStatement, "REVOKE",     true))\r
-                                               return SqlStatementType.Revoke;\r
-                                       if (StringParser.StartsWith(sqlStatement, "ROLLBACK", true))\r
-                                               return SqlStatementType.Rollback;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'S':                                                               \r
-                                       if (StringParser.StartsWith(sqlStatement, "SELECT",     true))\r
-                                               return SqlStatementType.Select;\r
-                                       if (StringParser.StartsWith(sqlStatement, "SET DATABASE", true))\r
-                                               return SqlStatementType.SetDatabase;\r
-                                       if (StringParser.StartsWith(sqlStatement, "SET GENERATOR", true))\r
-                                               return SqlStatementType.SetGenerator;\r
-                                       if (StringParser.StartsWith(sqlStatement, "SET NAMES", true))\r
-                                               return SqlStatementType.SetGenerator;\r
-                                       if (StringParser.StartsWith(sqlStatement, "SET SQL DIALECT", true))\r
-                                               return SqlStatementType.SetSQLDialect;\r
-                                       if (StringParser.StartsWith(sqlStatement, "SET STATISTICS",     true))\r
-                                               return SqlStatementType.SetStatistics;\r
-                                       if (StringParser.StartsWith(sqlStatement, "SET TRANSACTION", true))\r
-                                               return SqlStatementType.SetTransaction;\r
-                                       if (StringParser.StartsWith(sqlStatement, "SHOW SQL DIALECT", true))\r
-                                               return SqlStatementType.ShowSQLDialect;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'U':\r
-                                       if (StringParser.StartsWith(sqlStatement, "UPDATE",     true))\r
-                                               return SqlStatementType.Update;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               case 'W':\r
-                                       if (StringParser.StartsWith(sqlStatement, "WHENEVER", true))\r
-                                               return SqlStatementType.Whenever;\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-\r
-                               default:\r
-                                       throw new Exception("The type of the SQL statement could not be determinated.");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2003, 2005 Abel Eduardo Pereira
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+
+using FirebirdSql.Data.Firebird;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Isql
+{
+       /// <summary>
+       /// Performs batch execution of ISQL commands.
+       /// </summary>
+       public class FbBatchExecution
+       {
+               #region Events
+
+               /// <summary>
+               /// The event trigged before a SQL statement goes for execution.
+               /// </summary>
+               public event CommandExecutingEventHandler CommandExecuting;
+
+               /// <summary>
+               /// The event trigged after     a SQL statement execution.
+               /// </summary>
+               public event CommandExecutedEventHandler CommandExecuted;
+
+               #endregion
+
+               #region Fields
+
+               private StringCollection                        sqlStatements;
+               private FbConnection                            sqlConnection;
+               private FbTransaction                           sqlTransaction;
+               private FbConnectionStringBuilder       connectionString;
+               private FbCommand                                       sqlCommand;
+
+               // control fields
+               private bool requiresNewConnection;
+
+               #endregion
+
+               #region Properties
+
+               /// <summary>
+               /// Represents the list of SQL statements for batch     execution.
+               /// </summary>
+               public StringCollection SqlStatements 
+               {
+                       get     
+                       {
+                               if (this.sqlStatements == null)
+                               {
+                                       this.sqlStatements = new StringCollection();
+                               }
+                               return this.sqlStatements; 
+                       }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <summary>
+               /// Creates     an instance     of FbBatchExecution     engine.
+               /// </summary>
+               public FbBatchExecution()
+               {
+                       this.sqlConnection       = new FbConnection(); // do    not     specify the     connection string
+                       this.connectionString = new FbConnectionStringBuilder();
+               }
+
+               /// <summary>
+               /// Creates     an instance     of FbBatchExecution     engine with     the     given
+               /// connection.
+               /// </summary>
+               /// <param name="sqlConnection">A <see cref="FbConnection"/> object.</param>
+               public FbBatchExecution(FbConnection sqlConnection) : this(sqlConnection, null)
+               {
+               }
+
+               public FbBatchExecution(FbConnection sqlConnection, FbScript isqlScript)
+               {
+                       if (sqlConnection == null)
+                       {
+                               this.sqlConnection       = new FbConnection(); // do    not     specify the     connection string
+                               this.connectionString = new FbConnectionStringBuilder();
+                       }
+                       else
+                       {
+                               this.sqlConnection       = sqlConnection;
+                               this.connectionString = new FbConnectionStringBuilder(sqlConnection.ConnectionString);
+                       }
+
+            if (isqlScript != null)
+            {
+                foreach (string sql in isqlScript.Results)
+                {
+                    this.SqlStatements.Add(sql);
+                }
+            }
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <summary>
+               /// Starts the ordered execution of     the     SQL     statements that are     in <see cref="SqlStatements"/> collection.
+               /// </summary>
+               public virtual void     Execute()
+               {
+                       this.Execute(true);
+               }
+
+               /// <summary>
+               /// Starts the ordered execution of     the     SQL     statements that are     in <see cref="SqlStatements"/> collection.
+               /// </summary>
+               /// <param name="autoCommit">Specifies if the transaction should be     committed after a DDL command execution</param>
+               public virtual void     Execute(bool autoCommit) 
+               {
+                       if (this.SqlStatements == null || this.SqlStatements.Count == 0)        
+                       {
+                               throw new InvalidOperationException("There are no commands for execution.");
+                       }
+
+                       foreach (string sqlStatement in this.SqlStatements)
+                       {
+                               if (sqlStatement ==     null || sqlStatement.Length == 0)
+                               {
+                                       continue;
+                               }
+                               
+                               // initializate outputs to default
+                               int                             rowsAffected = -1;
+                               FbDataReader    dataReader       = null;
+                               SqlStatementType statementType = FbBatchExecution.GetStatementType(sqlStatement);
+
+                               // Update command configuration
+                               this.ProvideCommand().CommandText = sqlStatement;
+
+                               // Check how transactions are going     to be handled
+                               if (statementType == SqlStatementType.Insert ||
+                                       statementType == SqlStatementType.Update ||
+                                       statementType == SqlStatementType.Delete)
+                               {
+                                       // DML commands should be inside a transaction
+                                       if (this.sqlTransaction == null)
+                                       {
+                                               this.sqlTransaction = this.sqlConnection.BeginTransaction();
+                                       }
+                                       this.sqlCommand.Transaction = this.sqlTransaction;
+                               }
+                               else if (this.sqlTransaction != null && (statementType != SqlStatementType.Commit && statementType != SqlStatementType.Rollback))
+                               {
+                                       // Non DML Statements should be executed using
+                                       // implicit     transaction     support
+                                       this.sqlTransaction.Commit();
+                    this.sqlTransaction = null;
+                               }
+
+                               try
+                               {
+                                       switch (statementType)
+                                       {
+                                               case SqlStatementType.AlterDatabase:
+                                               case SqlStatementType.AlterDomain:
+                                               case SqlStatementType.AlterException:
+                                               case SqlStatementType.AlterIndex:
+                                               case SqlStatementType.AlterProcedure:
+                                               case SqlStatementType.AlterTable:
+                                               case SqlStatementType.AlterTrigger:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(this.sqlCommand);
+
+                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);
+                                                       this.requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);
+                                                       break;
+
+                                               case SqlStatementType.Commit:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(null);
+
+                                                       this.sqlTransaction.Commit();
+                                                       this.sqlTransaction = null;
+                                                       
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, -1);
+                                                       break;
+
+                                               case SqlStatementType.Connect:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(null);
+
+                                                       this.ConnectToDatabase(sqlStatement);
+
+                                                       requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, -1);
+                                                       break;
+
+                                               case SqlStatementType.CreateDatabase:
+#if    (!NETCF)
+                                                       throw new NotImplementedException();
+#else
+                                                       throw new NotSupportedException();
+#endif
+
+                                               case SqlStatementType.CreateDomain:
+                                               case SqlStatementType.CreateException:
+                                               case SqlStatementType.CreateGenerator:
+                                               case SqlStatementType.CreateIndex:
+                                               case SqlStatementType.CreateProcedure:
+                                               case SqlStatementType.CreateRole:
+                                               case SqlStatementType.CreateShadow:
+                                               case SqlStatementType.CreateTable:
+                                               case SqlStatementType.CreateTrigger:
+                                               case SqlStatementType.CreateView:
+                                               case SqlStatementType.DeclareCursor:
+                                               case SqlStatementType.DeclareExternalFunction:
+                                               case SqlStatementType.DeclareFilter:
+                                               case SqlStatementType.DeclareStatement:
+                                               case SqlStatementType.DeclareTable:
+                                               case SqlStatementType.Delete:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(this.sqlCommand);
+
+                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);
+                                                       requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);
+                                                       break;
+
+                                               case SqlStatementType.Describe:
+                                                       break;
+
+                                               case SqlStatementType.Disconnect:
+                                                       this.sqlConnection.Close();
+                                                       this.requiresNewConnection = false;
+                                                       break;
+
+                                               case SqlStatementType.DropDatabase:
+#if    (!NETCF)
+                                                       throw new NotImplementedException();
+#else
+                                                       throw new NotSupportedException();
+#endif
+
+                                               case SqlStatementType.DropDomain:
+                                               case SqlStatementType.DropException:
+                                               case SqlStatementType.DropExternalFunction:
+                                               case SqlStatementType.DropFilter:
+                                               case SqlStatementType.DropGenerator:
+                                               case SqlStatementType.DropIndex:
+                                               case SqlStatementType.DropProcedure:
+                                               case SqlStatementType.DropRole:
+                                               case SqlStatementType.DropShadow:
+                                               case SqlStatementType.DropTable:
+                                               case SqlStatementType.DropTrigger:
+                                               case SqlStatementType.DropView:
+                                               case SqlStatementType.EventInit:
+                                               case SqlStatementType.EventWait:
+                                               case SqlStatementType.Execute:
+                                               case SqlStatementType.ExecuteImmediate:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(this.sqlCommand);
+
+                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);
+                                                       this.requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);
+                                                       break;
+
+                                               case SqlStatementType.ExecuteProcedure:
+                                               case SqlStatementType.Fetch:
+                                                       break;
+
+                                               case SqlStatementType.Grant:
+                                               case SqlStatementType.Insert:
+                                               case SqlStatementType.InsertCursor:
+                                               case SqlStatementType.Open:
+                                               case SqlStatementType.Prepare:
+                                               case SqlStatementType.Revoke:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(this.sqlCommand);
+
+                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);
+                                                       this.requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);
+                                                       break;
+
+                                               case SqlStatementType.Rollback:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(null);
+
+                                                       this.sqlTransaction.Rollback();
+                                                       this.sqlTransaction = null;
+                                                       
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, -1);
+                                                       break;
+
+                                               case SqlStatementType.Select:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(this.sqlCommand);
+
+                                                       dataReader = this.sqlCommand.ExecuteReader();
+                                                       this.requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, dataReader, -1);
+                                                       if (!dataReader.IsClosed)
+                                                       {
+                                                               dataReader.Close();
+                                                       }
+                                                       break;
+
+                                               case SqlStatementType.SetGenerator:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(this.sqlCommand);
+
+                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);
+                                                       this.requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);
+                                                       break;
+
+                                               case SqlStatementType.SetDatabase:
+                                               case SqlStatementType.SetNames:
+                                               case SqlStatementType.SetSQLDialect:
+                                               case SqlStatementType.SetStatistics:
+                                               case SqlStatementType.SetTransaction:
+                                               case SqlStatementType.ShowSQLDialect:
+#if    (!NETCF)
+                                                       throw new NotImplementedException();
+#else
+                                                       throw new NotSupportedException();
+#endif
+                                                       
+                                               case SqlStatementType.Update:
+                                               case SqlStatementType.Whenever:
+                                                       // raise the event
+                                                       this.OnCommandExecuting(this.sqlCommand);
+
+                                                       rowsAffected = this.ExecuteCommand(this.sqlCommand,     autoCommit);
+                                                       this.requiresNewConnection = false;
+
+                                                       // raise the event
+                                                       this.OnCommandExecuted(sqlStatement, null, rowsAffected);
+                                                       break;
+                                       }
+                               }
+                               catch (Exception ex)
+                               {
+                                       if (this.sqlTransaction != null)
+                                       {
+                                               this.sqlTransaction.Rollback();
+                                               this.sqlTransaction = null;
+                                       }
+
+                                       throw new FbException(String.Format(CultureInfo.CurrentCulture, "An exception was thrown when executing command: {0}\nBatch execution aborted\nThe returned message was: {1}", sqlStatement, ex.Message));
+                               }
+                       }
+
+                       if (this.sqlTransaction != null)
+                       {
+                               // commit root transaction
+                               this.sqlTransaction.Commit();
+                               this.sqlTransaction = null;
+                       }
+
+                       this.sqlConnection.Close();
+               }
+
+               
+               #endregion
+
+               #region Protected Internal Methods
+
+               /// <summary>
+               /// Updates     the     connection string with the data parsed from     the parameter and opens a connection
+               /// to the database.
+               /// </summary>
+               /// <param name="connectDbStatement"></param>
+               protected internal void ConnectToDatabase(string connectDbStatement)
+               {
+                       // CONNECT 'filespec' [USER     'username'][PASSWORD 'password'] [CACHE int] [ROLE 'rolename']
+                       StringParser parser = new StringParser(connectDbStatement, false);
+                       parser.Token = " ";
+                       parser.ParseNext();
+                       if (parser.Result.Trim().ToUpper(CultureInfo.CurrentCulture) != "CONNECT")
+                       {
+                               throw new Exception("Malformed isql CONNECT statement. Expected keyword CONNECT but something else was found.");
+                       }
+                       parser.ParseNext();
+                       this.connectionString.Database = parser.Result.Replace("'", "");
+                       while (parser.ParseNext() != -1)
+                       {
+                               switch (parser.Result.Trim().ToUpper(CultureInfo.CurrentCulture))
+                               {
+                                       case "USER":
+                                               parser.ParseNext();
+                                               this.connectionString.UserID = parser.Result.Replace("'", "");
+                                               break;
+
+                                       case "PASSWORD":
+                                               parser.ParseNext();
+                                               this.connectionString.Password = parser.Result.Replace("'", "");
+                                               break;
+
+                                       case "CACHE":
+                                               parser.ParseNext();
+                                               break;
+
+                                       case "ROLE":
+                                               parser.ParseNext();
+                                               this.connectionString.Role = parser.Result.Replace("'", "");
+                                               break;
+
+                                       default:
+                                               throw new Exception("Unexpected token '" + parser.Result.Trim() + "' on isql CONNECT statement.");
+                       
+                               }
+                       }
+                       this.requiresNewConnection = true;
+                       this.ProvideConnection();                                       
+               }
+
+               /// <summary>
+               /// Parses the isql     statement CREATE DATABASE and creates the database and opens a connection to the recently created database.
+               /// </summary>
+               /// <param name="createDbStatement">the create database statement.</param>
+               protected internal void CreateDatabase(string createDbStatement)
+               {
+                       // CREATE {DATABASE     | SCHEMA} 'filespec'
+                       // [USER 'username'     [PASSWORD 'password']]
+                       // [PAGE_SIZE [=] int]
+                       // [LENGTH [=] int [PAGE[S]]]
+                       // [DEFAULT     CHARACTER SET charset]
+                       // [<secondary_file>];  
+#if    (!NETCF)
+                       throw new NotImplementedException();
+#else
+                       throw new NotSupportedException();
+#endif
+               }
+
+               /// <summary>
+               /// 
+               /// </summary>
+               /// <returns></returns>
+               protected internal FbConnection SetDatabase(string setDbStatement)
+               {
+#if    (!NETCF)
+                       throw new NotImplementedException();
+#else
+                       throw new NotSupportedException();
+#endif
+               }
+               
+               /// <summary>
+               /// Gets a <see cref="FbConnection"/> instance.
+               /// </summary>
+               /// <returns>An instance of the <see cref="FbConnection"/> class.</returns>
+               protected internal FbConnection ProvideConnection()
+               {
+                       if (requiresNewConnection)
+                       {
+                               if ((this.sqlConnection != null) ||
+                                       (this.sqlConnection.State != ConnectionState.Closed) ||
+                                       (this.sqlConnection.State != ConnectionState.Broken))
+                               {
+                                       this.sqlConnection.Close();
+                               }
+                               this.sqlConnection = new FbConnection(this.connectionString.ToString());        
+                       }
+
+                       if (this.sqlConnection.State == ConnectionState.Closed)
+                       {
+                               this.sqlConnection.Open();
+                       }
+
+                       return this.sqlConnection;
+               }
+
+               /// <summary>
+               /// Gets a <see cref="FbCommand" /> instance.
+               /// </summary>
+               /// <returns>An instance of the <see cref="FbCommand" /> class.</returns>
+               protected internal FbCommand ProvideCommand()
+               {
+                       if (this.sqlCommand == null)
+                       {
+                               this.sqlCommand = new FbCommand();
+                       }
+                       this.sqlCommand.Connection = this.ProvideConnection();
+
+                       return this.sqlCommand;
+               }
+
+               /// <summary>
+               /// Executes a command and optionally commits the transaction.
+               /// </summary>
+               /// <param name="command">Command to execute.</param>
+               /// <param name="autocommit">true to commit     the     transaction     after execution; or     false if not.</param>
+               /// <returns>The number of rows affected by the query execution.</returns>
+               protected internal int ExecuteCommand(FbCommand command, bool autocommit)
+               {
+                       int     rowsAffected = command.ExecuteNonQuery();
+                       if (autocommit && command.IsDDLCommand && command.Transaction != null)
+                       {
+                               command.Transaction.CommitRetaining();
+                       }
+
+                       return rowsAffected;
+               }
+
+               #endregion
+
+               #region Event Handlers
+
+               /// <summary>
+               /// The trigger function for <see cref="CommandExecuting"/>     event.
+               /// </summary>
+               /// <param name="sqlCommand">The SQL command that is going for execution.</param>
+               protected virtual void OnCommandExecuting(FbCommand     sqlCommand)
+               {
+                       if (CommandExecuting != null)
+                       {
+                               CommandExecutingEventArgs e = new CommandExecutingEventArgs(sqlCommand);
+                               CommandExecuting(this, e);
+                       }
+               }
+
+               /// <summary>
+               /// The trigger function for <see cref="CommandExecuted"/> event.
+               /// </summary>
+               /// <param name="commandText">The <see cref="FbCommand.CommandText"/> of the executed SQL command.</param>
+               /// <param name="dataReader">The <see cref="FbDataReader"/>     instance with the returned data. If     the     
+               /// command     executed is     not     meant to return data (ex: UPDATE, INSERT...) this parameter     must be 
+               /// setled to <b>null</b>.</param>
+               /// <param name="rowsAffected">The rows that were affected by the executed SQL command. If the executed 
+               /// command     is not meant to return this     kind of information     (ex: SELECT) this parameter     must 
+               /// be setled to <b>-1</b>.</param>
+               protected virtual void OnCommandExecuted(string commandText, FbDataReader dataReader, int rowsAffected) 
+               {
+                       if (CommandExecuted     != null) 
+                       {
+                               CommandExecutedEventArgs e = new CommandExecutedEventArgs(dataReader, commandText, rowsAffected);
+                               CommandExecuted(this, e);
+                       }
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               /// <summary>
+               /// Determines the <see cref="SqlStatementType"/> of the provided SQL statement.
+               /// </summary>
+               /// <param name="sqlStatement">The string containing the SQL statement.</param>
+               /// <returns>The <see cref="SqlStatementType"/> of the <b>sqlStatement</b>.</returns>
+               /// <remarks>If the     type of <b>sqlStatement</b>     could not be determinated this 
+               /// method will throw an exception.</remarks>
+               public static SqlStatementType GetStatementType(string sqlStatement) 
+               {
+                       char type = sqlStatement ==     null ? ' ' : sqlStatement.Trim().ToUpper(CultureInfo.CurrentCulture)[0];
+
+                       switch (type)
+                       {
+                               case 'A':
+                                       if (StringParser.StartsWith(sqlStatement, "ALTER DATABASE",     true))
+                                               return SqlStatementType.AlterDatabase;
+                                       if (StringParser.StartsWith(sqlStatement, "ALTER DOMAIN", true))
+                                               return SqlStatementType.AlterDomain;
+                                       if (StringParser.StartsWith(sqlStatement, "ALTER EXCEPTION", true))
+                                               return SqlStatementType.AlterException;
+                                       if (StringParser.StartsWith(sqlStatement, "ALTER INDEX", true))
+                                               return SqlStatementType.AlterIndex;
+                                       if (StringParser.StartsWith(sqlStatement, "ALTER PROCEDURE", true))
+                                               return SqlStatementType.AlterProcedure;
+                                       if (StringParser.StartsWith(sqlStatement, "ALTER TABLE", true))
+                                               return SqlStatementType.AlterTable;
+                                       if (StringParser.StartsWith(sqlStatement, "ALTER TRIGGER", true))
+                                               return SqlStatementType.AlterTrigger;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'C':
+                               switch (char.ToUpper(sqlStatement[1], CultureInfo.CurrentCulture)) 
+                               {
+                                       case 'L':
+                                               if (StringParser.StartsWith(sqlStatement, "CLOSE", true))
+                                                       return SqlStatementType.Close;
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+
+                                       case 'O':
+                                               if (StringParser.StartsWith(sqlStatement, "COMMIT",     true))
+                                                       return SqlStatementType.Commit;
+                                               if (StringParser.StartsWith(sqlStatement, "CONNECT", true))
+                                                       return SqlStatementType.Connect;
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+
+                                       case 'R':
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE DATABASE", true))
+                                                       return SqlStatementType.CreateDatabase;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE DOMAIN", true))
+                                                       return SqlStatementType.CreateDomain;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE EXCEPTION", true))
+                                                       return SqlStatementType.CreateException;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE GENERATOR", true))
+                                                       return SqlStatementType.CreateGenerator;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE INDEX", true))
+                                                       return SqlStatementType.CreateIndex;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE DESCENDING INDEX", true))
+                                                       return SqlStatementType.CreateIndex;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE PROCEDURE", true))
+                                                       return SqlStatementType.CreateProcedure;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE ROLE", true))
+                                                       return SqlStatementType.CreateRole;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE SHADOW", true))
+                                                       return SqlStatementType.CreateShadow;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE TABLE", true))
+                                                       return SqlStatementType.CreateTable;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE TRIGGER",     true))
+                                                       return SqlStatementType.CreateTrigger;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE UNIQUE INDEX", true))
+                                                       return SqlStatementType.CreateIndex;
+                                               if (StringParser.StartsWith(sqlStatement, "CREATE VIEW", true))
+                                                       return SqlStatementType.CreateView;
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+
+                                       default:
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+                               }
+                                       
+                               case 'D':
+                               switch (char.ToUpper(sqlStatement[1], CultureInfo.CurrentCulture)) 
+                               {
+                                       case 'E':
+                                               if (StringParser.StartsWith(sqlStatement, "DECLARE CURSOR",     true))
+                                                       return SqlStatementType.DeclareCursor;
+                                               if (StringParser.StartsWith(sqlStatement, "DECLARE EXTERNAL FUNCTION", true))
+                                                       return SqlStatementType.DeclareExternalFunction;
+                                               if (StringParser.StartsWith(sqlStatement, "DECLARE FILTER",     true))
+                                                       return SqlStatementType.DeclareFilter;
+                                               if (StringParser.StartsWith(sqlStatement, "DECLARE STATEMENT", true))
+                                                       return SqlStatementType.DeclareStatement;
+                                               if (StringParser.StartsWith(sqlStatement, "DECLARE TABLE", true))
+                                                       return SqlStatementType.DeclareTable;
+                                               if (StringParser.StartsWith(sqlStatement, "DELETE",     true))
+                                                       return SqlStatementType.Delete;
+                                               if (StringParser.StartsWith(sqlStatement, "DESCRIBE", true))
+                                                       return SqlStatementType.Describe;
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+
+                                       case 'I':
+                                               if (StringParser.StartsWith(sqlStatement, "DISCONNECT", true))
+                                                       return SqlStatementType.Disconnect;
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+
+                                       case 'R':
+                                               if (StringParser.StartsWith(sqlStatement, "DROP DATABASE", true))
+                                                       return SqlStatementType.DropDatabase;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP DOMAIN", true))
+                                                       return SqlStatementType.DropDomain;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP EXCEPTION",     true))
+                                                       return SqlStatementType.DropException;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP EXTERNAL FUNCTION",     true))
+                                                       return SqlStatementType.DropExternalFunction;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP FILTER", true))
+                                                       return SqlStatementType.DropFilter;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP GENERATOR",     true))
+                                                       return SqlStatementType.DropGenerator;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP INDEX", true))
+                                                       return SqlStatementType.DropIndex;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP PROCEDURE",     true))
+                                                       return SqlStatementType.DropProcedure;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP ROLE", true))
+                                                       return SqlStatementType.DropRole;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP SHADOW", true))
+                                                       return SqlStatementType.DropShadow;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP TABLE", true))
+                                                       return SqlStatementType.DropTable;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP TRIGGER", true))
+                                                       return SqlStatementType.DropTrigger;
+                                               if (StringParser.StartsWith(sqlStatement, "DROP VIEW", true))
+                                                       return SqlStatementType.DropView;
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+
+                                       default:
+                                               throw new Exception("The type of the SQL statement could not be determinated.");
+                               }
+                               
+                               case 'E':
+                                       if (StringParser.StartsWith(sqlStatement, "EXECUTE PROCEDURE", true))
+                                               return SqlStatementType.ExecuteProcedure;
+                                       if (StringParser.StartsWith(sqlStatement, "EXECUTE IMMEDIATE", true))
+                                               return SqlStatementType.ExecuteImmediate;
+                                       if (StringParser.StartsWith(sqlStatement, "EXECUTE", true))
+                                               return SqlStatementType.Execute;
+                                       if (StringParser.StartsWith(sqlStatement, "EVENT WAIT", true))
+                                               return SqlStatementType.EventWait;
+                                       if (StringParser.StartsWith(sqlStatement, "EVENT INIT", true))
+                                               return SqlStatementType.EventInit;
+                                       if (StringParser.StartsWith(sqlStatement, "END DECLARE SECTION", true))
+                                               return SqlStatementType.EndDeclareSection;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'F':
+                                       if (StringParser.StartsWith(sqlStatement, "FETCH", true))
+                                               return SqlStatementType.Fetch;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'G':
+                                       if (StringParser.StartsWith(sqlStatement, "GRANT", true))
+                                               return SqlStatementType.Grant;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'I':
+                                       if (StringParser.StartsWith(sqlStatement, "INSERT CURSOR", true))
+                                               return SqlStatementType.InsertCursor;
+                                       if (StringParser.StartsWith(sqlStatement, "INSERT",     true))
+                                               return SqlStatementType.Insert;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'O':
+                                       if (StringParser.StartsWith(sqlStatement, "OPEN", true))
+                                               return SqlStatementType.Open;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'P':
+                                       if (StringParser.StartsWith(sqlStatement, "PREPARE", true))
+                                               return SqlStatementType.Prepare;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'R':
+                                       if (StringParser.StartsWith(sqlStatement, "REVOKE",     true))
+                                               return SqlStatementType.Revoke;
+                                       if (StringParser.StartsWith(sqlStatement, "ROLLBACK", true))
+                                               return SqlStatementType.Rollback;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'S':                                                               
+                                       if (StringParser.StartsWith(sqlStatement, "SELECT",     true))
+                                               return SqlStatementType.Select;
+                                       if (StringParser.StartsWith(sqlStatement, "SET DATABASE", true))
+                                               return SqlStatementType.SetDatabase;
+                                       if (StringParser.StartsWith(sqlStatement, "SET GENERATOR", true))
+                                               return SqlStatementType.SetGenerator;
+                                       if (StringParser.StartsWith(sqlStatement, "SET NAMES", true))
+                                               return SqlStatementType.SetGenerator;
+                                       if (StringParser.StartsWith(sqlStatement, "SET SQL DIALECT", true))
+                                               return SqlStatementType.SetSQLDialect;
+                                       if (StringParser.StartsWith(sqlStatement, "SET STATISTICS",     true))
+                                               return SqlStatementType.SetStatistics;
+                                       if (StringParser.StartsWith(sqlStatement, "SET TRANSACTION", true))
+                                               return SqlStatementType.SetTransaction;
+                                       if (StringParser.StartsWith(sqlStatement, "SHOW SQL DIALECT", true))
+                                               return SqlStatementType.ShowSQLDialect;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'U':
+                                       if (StringParser.StartsWith(sqlStatement, "UPDATE",     true))
+                                               return SqlStatementType.Update;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               case 'W':
+                                       if (StringParser.StartsWith(sqlStatement, "WHENEVER", true))
+                                               return SqlStatementType.Whenever;
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+
+                               default:
+                                       throw new Exception("The type of the SQL statement could not be determinated.");
+                       }
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index de51b878e2876a9d4ceb802d35bcaff9d5bf69ea..ec2efc664e755d9a2748067043c6f7276bea2a4b 100644 (file)
-/*\r
- *  Firebird ADO.NET Data provider for .NET and Mono \r
- * \r
- *     The contents of this file are subject to the Initial \r
- *     Developer's Public License Version 1.0 (the "License"); \r
- *     you may not use this file except in compliance with the \r
- *     License. You may obtain a copy of the License at \r
- *     http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *     Software distributed under the License is distributed on \r
- *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *     express or implied.  See the License for the specific \r
- *     language governing rights and limitations under the License.\r
- * \r
- *  Copyright (c) 2003, 2005 Abel Eduardo Pereira\r
- *  All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-using System.Collections.Specialized;\r
-\r
-namespace FirebirdSql.Data.Firebird.Isql\r
-{\r
-       /// <summary>\r
-       /// FbScript parses a SQL file and returns its SQL statements. \r
-       /// The class take in consideration that the statement separator can change in code. \r
-       /// For instance, in Firebird databases the statement <c>SET TERM !! ;</c> will change the\r
-       /// statement token terminator <b>;</b> into <b>!!</b>.\r
-       /// </summary>\r
-       public class FbScript\r
-       {\r
-               #region Fields\r
-\r
-               private StringParser            parser;\r
-               private StringCollection        results;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <summary>\r
-               /// Returns a StringCollection containing all the SQL statements (without comments) present on the file.\r
-               /// This property is loaded after the method call <see cref="Parse"/>.\r
-               /// </summary>\r
-               public StringCollection Results\r
-               {\r
-                       get { return this.results; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <summary>\r
-               /// Creates an instance of FbScript class.\r
-               /// </summary>\r
-               /// <param name="sqlFilename">The filename for the SQL file.</param>\r
-               public FbScript(string sqlFilename)\r
-               {\r
-                       string                  script = "";\r
-                       StreamReader    reader = null;\r
-\r
-                       try\r
-                       {\r
-                               reader = File.OpenText(sqlFilename);\r
-                               script = reader.ReadToEnd();\r
-                       }\r
-                       catch\r
-                       {\r
-                               throw;\r
-                       }\r
-                       finally\r
-                       {\r
-                               if (reader != null)\r
-                               {\r
-                                       reader.Close();\r
-                               }\r
-                       }\r
-\r
-                       this.results            = new StringCollection();\r
-                       this.parser                     = new StringParser(RemoveComments(script), false);\r
-                       this.parser.Token       = ";";\r
-               }\r
-\r
-               /// <summary>\r
-               /// Creates an instance of FbScript class.\r
-               /// </summary>\r
-               /// <param name="sqlCode">A <see cref="TextReader"/> instance.</param>\r
-               /// <remarks>The all data in <see cref="TextReader"/> is read.</remarks>\r
-               public FbScript(TextReader sqlCode)\r
-               {\r
-                       this.results            = new StringCollection();\r
-                       this.parser                     = new StringParser(RemoveComments(sqlCode.ReadToEnd()), false);\r
-                       this.parser.Token       = ";";\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <summary>\r
-               /// Parses the SQL code and loads the SQL statements into the StringCollection <see cref="Results"/>.\r
-               /// </summary>\r
-               /// <returns>The number of statements found.</returns>\r
-               public int Parse()\r
-               {\r
-                       int index = 0;\r
-                       string  atomicResult;\r
-                       string  newParserToken;\r
-\r
-                       this.results.Clear();\r
-\r
-                       while (index < this.parser.Length)\r
-                       {\r
-                               index = this.parser.ParseNext();\r
-                               atomicResult = this.parser.Result.Trim();\r
-\r
-                               if (this.IsSetTermStatement(atomicResult, out newParserToken))\r
-                               {\r
-                                       this.parser.Token = newParserToken;\r
-                                       continue;\r
-                               }\r
-\r
-                               if (atomicResult != null && atomicResult.Length > 0)\r
-                               {\r
-                                       this.results.Add(atomicResult);\r
-                               }\r
-                       }\r
-\r
-                       return this.results.Count;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Overrided method, returns the the SQL code to be parsed (with comments removed).\r
-               /// </summary>\r
-               /// <returns>The SQL code to be parsed (without comments).</returns>\r
-               public override string ToString()\r
-               {\r
-                       return this.parser.ToString();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Static Methods\r
-\r
-               /// <summary>\r
-               /// Removes from the SQL code all comments of the type: /*...*/ or --\r
-               /// </summary>\r
-               /// <param name="source">The string containing the original SQL code.</param>\r
-               /// <returns>A string containing the SQL code without comments.</returns>\r
-               protected static string RemoveComments(string source)\r
-               {\r
-                       StringBuilder   result                  = new StringBuilder();\r
-                       int                             i                               = 0;\r
-                       int                             length                  = source.Length;\r
-                       bool                    insideComment   = false;\r
-                       bool                    insideString    = false;\r
-\r
-                       while (i < length)\r
-                       {\r
-                               if (insideComment)\r
-                               {\r
-                                       if (source[i] == '*')\r
-                                       {\r
-                                               if ((i < length - 1) && (source[i + 1] == '/'))\r
-                                               {\r
-                                                       i++;\r
-                                                       insideComment = false;\r
-                                               }\r
-                                       }\r
-                               }\r
-                               else\r
-                               {\r
-                                       if (source[i] == '\'' || source[i] == '/' || (source[i] == '-' && ((i < length - 1) && source[i + 1] == '-')))\r
-                                       {\r
-                                               switch (source[i])\r
-                                               {\r
-                                                       case '\'':\r
-                                                               if (!insideString && !insideComment)\r
-                                                               {\r
-                                                                       insideString = true;\r
-                                                               }\r
-                                                               else\r
-                                                               {\r
-                                                                       if (insideString)\r
-                                                                       {\r
-                                                                               insideString = false;\r
-                                                                       }\r
-                                                               }\r
-                                                               result.Append(source[i]);\r
-                                                               break;\r
-\r
-                                                       case '/':\r
-                                if (!insideString && (i < length - 1) && (source[i + 1] == '*'))\r
-                                {\r
-                                    i++;\r
-                                    insideComment = true;\r
-                                }\r
-                                else\r
-                                {\r
-                                    if ((source[i + 1] == '*'))\r
-                                    {\r
-                                        Console.WriteLine("");\r
-                                    }\r
-                                    result.Append(source[i]);\r
-                                }\r
-                                                               break;\r
-\r
-                                                       case '-':\r
-                                                               if (!insideString && (i < length - 1) && (source[i + 1] == '-'))\r
-                                                               {\r
-                                                                       i++;\r
-                                                                       while (i < length && source[i] != '\n')\r
-                                                                       {\r
-                                                                               i++;\r
-                                                                       }\r
-                                                                       i--;\r
-                                                               }\r
-                                                               break;\r
-                                               }\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               result.Append(source[i]);\r
-                                       }\r
-                               }\r
-\r
-                               i++;\r
-                       }\r
-\r
-                       return result.ToString();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               // method assumes that statement is trimmed \r
-               private bool IsSetTermStatement(string statement, out string newTerm)\r
-               {\r
-                       bool result = false;\r
-\r
-                       newTerm = "";\r
-                       if (StringParser.StartsWith(statement, "SET TERM", true))\r
-                       {\r
-                               newTerm = statement.Substring(8).Trim();\r
-                               result = true;\r
-                       }\r
-\r
-                       return result;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *  Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *     The contents of this file are subject to the Initial 
+ *     Developer's Public License Version 1.0 (the "License"); 
+ *     you may not use this file except in compliance with the 
+ *     License. You may obtain a copy of the License at 
+ *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *     Software distributed under the License is distributed on 
+ *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *     express or implied.  See the License for the specific 
+ *     language governing rights and limitations under the License.
+ * 
+ *  Copyright (c) 2003, 2005 Abel Eduardo Pereira
+ *  All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections.Specialized;
+
+namespace FirebirdSql.Data.Firebird.Isql
+{
+       /// <summary>
+       /// FbScript parses a SQL file and returns its SQL statements. 
+       /// The class take in consideration that the statement separator can change in code. 
+       /// For instance, in Firebird databases the statement <c>SET TERM !! ;</c> will change the
+       /// statement token terminator <b>;</b> into <b>!!</b>.
+       /// </summary>
+       public class FbScript
+       {
+               #region Fields
+
+               private StringParser            parser;
+               private StringCollection        results;
+
+               #endregion
+
+               #region Properties
+
+               /// <summary>
+               /// Returns a StringCollection containing all the SQL statements (without comments) present on the file.
+               /// This property is loaded after the method call <see cref="Parse"/>.
+               /// </summary>
+               public StringCollection Results
+               {
+                       get { return this.results; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <summary>
+               /// Creates an instance of FbScript class.
+               /// </summary>
+               /// <param name="sqlFilename">The filename for the SQL file.</param>
+               public FbScript(string sqlFilename)
+               {
+                       string                  script = "";
+                       StreamReader    reader = null;
+
+                       try
+                       {
+                               reader = File.OpenText(sqlFilename);
+                               script = reader.ReadToEnd();
+                       }
+                       catch
+                       {
+                               throw;
+                       }
+                       finally
+                       {
+                               if (reader != null)
+                               {
+                                       reader.Close();
+                               }
+                       }
+
+                       this.results            = new StringCollection();
+                       this.parser                     = new StringParser(RemoveComments(script), false);
+                       this.parser.Token       = ";";
+               }
+
+               /// <summary>
+               /// Creates an instance of FbScript class.
+               /// </summary>
+               /// <param name="sqlCode">A <see cref="TextReader"/> instance.</param>
+               /// <remarks>The all data in <see cref="TextReader"/> is read.</remarks>
+               public FbScript(TextReader sqlCode)
+               {
+                       this.results            = new StringCollection();
+                       this.parser                     = new StringParser(RemoveComments(sqlCode.ReadToEnd()), false);
+                       this.parser.Token       = ";";
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <summary>
+               /// Parses the SQL code and loads the SQL statements into the StringCollection <see cref="Results"/>.
+               /// </summary>
+               /// <returns>The number of statements found.</returns>
+               public int Parse()
+               {
+                       int index = 0;
+                       string  atomicResult;
+                       string  newParserToken;
+
+                       this.results.Clear();
+
+                       while (index < this.parser.Length)
+                       {
+                               index = this.parser.ParseNext();
+                               atomicResult = this.parser.Result.Trim();
+
+                               if (this.IsSetTermStatement(atomicResult, out newParserToken))
+                               {
+                                       this.parser.Token = newParserToken;
+                                       continue;
+                               }
+
+                               if (atomicResult != null && atomicResult.Length > 0)
+                               {
+                                       this.results.Add(atomicResult);
+                               }
+                       }
+
+                       return this.results.Count;
+               }
+
+               /// <summary>
+               /// Overrided method, returns the the SQL code to be parsed (with comments removed).
+               /// </summary>
+               /// <returns>The SQL code to be parsed (without comments).</returns>
+               public override string ToString()
+               {
+                       return this.parser.ToString();
+               }
+
+               #endregion
+
+               #region Protected Static Methods
+
+               /// <summary>
+               /// Removes from the SQL code all comments of the type: /*...*/ or --
+               /// </summary>
+               /// <param name="source">The string containing the original SQL code.</param>
+               /// <returns>A string containing the SQL code without comments.</returns>
+               protected static string RemoveComments(string source)
+               {
+                       StringBuilder   result                  = new StringBuilder();
+                       int                             i                               = 0;
+                       int                             length                  = source.Length;
+                       bool                    insideComment   = false;
+                       bool                    insideString    = false;
+
+                       while (i < length)
+                       {
+                               if (insideComment)
+                               {
+                                       if (source[i] == '*')
+                                       {
+                                               if ((i < length - 1) && (source[i + 1] == '/'))
+                                               {
+                                                       i++;
+                                                       insideComment = false;
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       if (source[i] == '\'' || source[i] == '/' || (source[i] == '-' && ((i < length - 1) && source[i + 1] == '-')))
+                                       {
+                                               switch (source[i])
+                                               {
+                                                       case '\'':
+                                                               if (!insideString && !insideComment)
+                                                               {
+                                                                       insideString = true;
+                                                               }
+                                                               else
+                                                               {
+                                                                       if (insideString)
+                                                                       {
+                                                                               insideString = false;
+                                                                       }
+                                                               }
+                                                               result.Append(source[i]);
+                                                               break;
+
+                                                       case '/':
+                                if (!insideString && (i < length - 1) && (source[i + 1] == '*'))
+                                {
+                                    i++;
+                                    insideComment = true;
+                                }
+                                else
+                                {
+                                    if ((source[i + 1] == '*'))
+                                    {
+                                        Console.WriteLine("");
+                                    }
+                                    result.Append(source[i]);
+                                }
+                                                               break;
+
+                                                       case '-':
+                                                               if (!insideString && (i < length - 1) && (source[i + 1] == '-'))
+                                                               {
+                                                                       i++;
+                                                                       while (i < length && source[i] != '\n')
+                                                                       {
+                                                                               i++;
+                                                                       }
+                                                                       i--;
+                                                               }
+                                                               break;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               result.Append(source[i]);
+                                       }
+                               }
+
+                               i++;
+                       }
+
+                       return result.ToString();
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               // method assumes that statement is trimmed 
+               private bool IsSetTermStatement(string statement, out string newTerm)
+               {
+                       bool result = false;
+
+                       newTerm = "";
+                       if (StringParser.StartsWith(statement, "SET TERM", true))
+                       {
+                               newTerm = statement.Substring(8).Trim();
+                               result = true;
+                       }
+
+                       return result;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index b3ed287aafb438e79427b7ec7bd251324568722d..9833ee64cddd27af17b9efef6bc1693eeb02b133 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2003,     2004 Abel Eduardo Pereira\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-using System.Globalization;\r
-\r
-using FirebirdSql.Data.Firebird;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Isql\r
-{\r
-       /// <summary>\r
-       /// DSQL and ISQL statement     types.\r
-       /// </summary>\r
-       public enum     SqlStatementType \r
-       {\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ALTER DATABASE</b>\r
-               /// </summary>\r
-               AlterDatabase = 0,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ALTER DOMAIN</b>\r
-               /// </summary>\r
-               AlterDomain,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ALTER EXCEPTION</b>\r
-               /// </summary>\r
-               AlterException,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ALTER INDEX</b>\r
-               /// </summary>\r
-               AlterIndex,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ALTER PROCEDURE</b>\r
-               /// </summary>\r
-               AlterProcedure,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ALTER TABLE</b>\r
-               /// </summary>\r
-               AlterTable,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ALTER TRIGGER</b>\r
-               /// </summary>\r
-               AlterTrigger,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CLOSE</b>\r
-               /// </summary>\r
-               Close,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>COMMIT</b>\r
-               /// </summary>\r
-               Commit,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CONNECT</b>\r
-               /// </summary>\r
-               Connect,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     DATABASE</b>\r
-               /// </summary>\r
-               CreateDatabase,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     DOMAIN</b>\r
-               /// </summary>\r
-               CreateDomain,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     EXCEPTION</b>\r
-               /// </summary>\r
-               CreateException,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     GENERATOR</b>\r
-               /// </summary>\r
-               CreateGenerator,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     INDEX</b>\r
-               /// </summary>\r
-               CreateIndex,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     PROCEDURE</b>\r
-               /// </summary>\r
-               CreateProcedure,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     ROLE</b>\r
-               /// </summary>\r
-               CreateRole,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     SHADOW</b>\r
-               /// </summary>\r
-               CreateShadow,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     TABLE</b>\r
-               /// </summary>\r
-               CreateTable,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     TRIGGER</b>\r
-               /// </summary>\r
-               CreateTrigger,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>CREATE     VIEW</b>\r
-               /// </summary>\r
-               CreateView,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DECLARE CURSOR</b>\r
-               /// </summary>\r
-               DeclareCursor,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DECLARE EXTERNAL FUNCTION</b>\r
-               /// </summary>\r
-               DeclareExternalFunction,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DECLARE FILTER</b>\r
-               /// </summary>\r
-               DeclareFilter,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DECLARE STATEMENT</b>\r
-               /// </summary>\r
-               DeclareStatement,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DECLARE TABLE</b>\r
-               /// </summary>\r
-               DeclareTable,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DELETE</b>\r
-               /// </summary>\r
-               Delete,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DESCRIBE</b>\r
-               /// </summary>\r
-               Describe,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DISCONNECT</b>\r
-               /// </summary>\r
-               Disconnect,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP DATABASE</b>\r
-               /// </summary>\r
-               DropDatabase,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP DOMAIN</b>\r
-               /// </summary>\r
-               DropDomain,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP EXCEPTION</b>\r
-               /// </summary>\r
-               DropException,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP EXTERNAL FUNCTION</b>\r
-               /// </summary>\r
-               DropExternalFunction,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP FILTER</b>\r
-               /// </summary>\r
-               DropFilter,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP GENERATOR</b>\r
-               /// </summary>\r
-               DropGenerator,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP INDEX</b>\r
-               /// </summary>\r
-               DropIndex,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP PROCEDURE</b>\r
-               /// </summary>\r
-               DropProcedure,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP ROLE</b>\r
-               /// </summary>\r
-               DropRole,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP SHADOW</b>\r
-               /// </summary>\r
-               DropShadow,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP TABLE</b>\r
-               /// </summary>\r
-               DropTable,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP TRIGGER</b>\r
-               /// </summary>\r
-               DropTrigger,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>DROP VIEW</b>\r
-               /// </summary>\r
-               DropView,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>END DECLARE SECTION</b>\r
-               /// </summary>\r
-               EndDeclareSection,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>EVENT INIT</b>\r
-               /// </summary>\r
-               EventInit,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>EVENT WAIT</b>\r
-               /// </summary>\r
-               EventWait,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>EXECUTE</b>\r
-               /// </summary>\r
-               Execute,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>EXECUTE IMMEDIATE</b>\r
-               /// </summary>\r
-               ExecuteImmediate,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>EXECUTE PROCEDURE</b>\r
-               /// </summary>\r
-               ExecuteProcedure,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>FETCH</b>\r
-               /// </summary>\r
-               Fetch,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>GRANT</b>\r
-               /// </summary>\r
-               Grant,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>INSERT</b>\r
-               /// </summary>\r
-               Insert,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>INSERT     CURSOR</b>\r
-               /// </summary>\r
-               InsertCursor,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>OPEN</b>\r
-               /// </summary>\r
-               Open,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>PREPARE</b>\r
-               /// </summary>\r
-               Prepare,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>REVOKE</b>\r
-               /// </summary>\r
-               Revoke,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>ROLLBACK</b>\r
-               /// </summary>\r
-               Rollback,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SELECT</b>\r
-               /// </summary>\r
-               Select,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SET DATABASE</b>\r
-               /// </summary>\r
-               SetDatabase,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SET GENERATOR</b>\r
-               /// </summary>\r
-               SetGenerator,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SET NAMES</b>\r
-               /// </summary>\r
-               SetNames,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SET SQL DIALECT</b>\r
-               /// </summary>\r
-               SetSQLDialect,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SET STATISTICS</b>\r
-               /// </summary>\r
-               SetStatistics,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SET TRANSACTION</b>\r
-               /// </summary>\r
-               SetTransaction,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>SHOW SQL DIALECT</b>\r
-               /// </summary>\r
-               ShowSQLDialect,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>UPDATE</b>\r
-               /// </summary>\r
-               Update,\r
-\r
-               /// <summary>\r
-               /// Represents the SQL statement: <b>WHENEVER</b>\r
-               /// </summary>\r
-               Whenever\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2003, 2005 Abel Eduardo Pereira
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+
+using FirebirdSql.Data.Firebird;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Isql
+{
+       /// <summary>
+       /// DSQL and ISQL statement types.
+       /// </summary>
+       public enum SqlStatementType 
+       {
+               /// <summary>
+               /// Represents the SQL statement: <b>ALTER DATABASE</b>
+               /// </summary>
+               AlterDatabase = 0,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>ALTER DOMAIN</b>
+               /// </summary>
+               AlterDomain,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>ALTER EXCEPTION</b>
+               /// </summary>
+               AlterException,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>ALTER INDEX</b>
+               /// </summary>
+               AlterIndex,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>ALTER PROCEDURE</b>
+               /// </summary>
+               AlterProcedure,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>ALTER TABLE</b>
+               /// </summary>
+               AlterTable,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>ALTER TRIGGER</b>
+               /// </summary>
+               AlterTrigger,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CLOSE</b>
+               /// </summary>
+               Close,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>COMMIT</b>
+               /// </summary>
+               Commit,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CONNECT</b>
+               /// </summary>
+               Connect,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     DATABASE</b>
+               /// </summary>
+               CreateDatabase,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     DOMAIN</b>
+               /// </summary>
+               CreateDomain,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     EXCEPTION</b>
+               /// </summary>
+               CreateException,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     GENERATOR</b>
+               /// </summary>
+               CreateGenerator,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     INDEX</b>
+               /// </summary>
+               CreateIndex,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     PROCEDURE</b>
+               /// </summary>
+               CreateProcedure,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     ROLE</b>
+               /// </summary>
+               CreateRole,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     SHADOW</b>
+               /// </summary>
+               CreateShadow,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     TABLE</b>
+               /// </summary>
+               CreateTable,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     TRIGGER</b>
+               /// </summary>
+               CreateTrigger,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>CREATE     VIEW</b>
+               /// </summary>
+               CreateView,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DECLARE CURSOR</b>
+               /// </summary>
+               DeclareCursor,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DECLARE EXTERNAL FUNCTION</b>
+               /// </summary>
+               DeclareExternalFunction,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DECLARE FILTER</b>
+               /// </summary>
+               DeclareFilter,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DECLARE STATEMENT</b>
+               /// </summary>
+               DeclareStatement,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DECLARE TABLE</b>
+               /// </summary>
+               DeclareTable,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DELETE</b>
+               /// </summary>
+               Delete,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DESCRIBE</b>
+               /// </summary>
+               Describe,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DISCONNECT</b>
+               /// </summary>
+               Disconnect,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP DATABASE</b>
+               /// </summary>
+               DropDatabase,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP DOMAIN</b>
+               /// </summary>
+               DropDomain,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP EXCEPTION</b>
+               /// </summary>
+               DropException,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP EXTERNAL FUNCTION</b>
+               /// </summary>
+               DropExternalFunction,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP FILTER</b>
+               /// </summary>
+               DropFilter,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP GENERATOR</b>
+               /// </summary>
+               DropGenerator,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP INDEX</b>
+               /// </summary>
+               DropIndex,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP PROCEDURE</b>
+               /// </summary>
+               DropProcedure,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP ROLE</b>
+               /// </summary>
+               DropRole,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP SHADOW</b>
+               /// </summary>
+               DropShadow,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP TABLE</b>
+               /// </summary>
+               DropTable,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP TRIGGER</b>
+               /// </summary>
+               DropTrigger,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>DROP VIEW</b>
+               /// </summary>
+               DropView,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>END DECLARE SECTION</b>
+               /// </summary>
+               EndDeclareSection,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>EVENT INIT</b>
+               /// </summary>
+               EventInit,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>EVENT WAIT</b>
+               /// </summary>
+               EventWait,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>EXECUTE</b>
+               /// </summary>
+               Execute,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>EXECUTE IMMEDIATE</b>
+               /// </summary>
+               ExecuteImmediate,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>EXECUTE PROCEDURE</b>
+               /// </summary>
+               ExecuteProcedure,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>FETCH</b>
+               /// </summary>
+               Fetch,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>GRANT</b>
+               /// </summary>
+               Grant,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>INSERT</b>
+               /// </summary>
+               Insert,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>INSERT     CURSOR</b>
+               /// </summary>
+               InsertCursor,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>OPEN</b>
+               /// </summary>
+               Open,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>PREPARE</b>
+               /// </summary>
+               Prepare,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>REVOKE</b>
+               /// </summary>
+               Revoke,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>ROLLBACK</b>
+               /// </summary>
+               Rollback,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SELECT</b>
+               /// </summary>
+               Select,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SET DATABASE</b>
+               /// </summary>
+               SetDatabase,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SET GENERATOR</b>
+               /// </summary>
+               SetGenerator,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SET NAMES</b>
+               /// </summary>
+               SetNames,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SET SQL DIALECT</b>
+               /// </summary>
+               SetSQLDialect,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SET STATISTICS</b>
+               /// </summary>
+               SetStatistics,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SET TRANSACTION</b>
+               /// </summary>
+               SetTransaction,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>SHOW SQL DIALECT</b>
+               /// </summary>
+               ShowSQLDialect,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>UPDATE</b>
+               /// </summary>
+               Update,
+
+               /// <summary>
+               /// Represents the SQL statement: <b>WHENEVER</b>
+               /// </summary>
+               Whenever
+       }
+}
index 56ce465ee906c8cf2ab543c1668b52892b977433..a215c4aa6768588f8897a69a2828a4c073666d84 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2003,     2004 Abel Eduardo Pereira\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Globalization;\r
-\r
-namespace FirebirdSql.Data.Firebird.Isql\r
-{\r
-       /// <summary>\r
-       /// StringParser parses a string returnning     the     (sub)strings between tokens.\r
-       /// </summary>\r
-       /// <example>\r
-       /// An example of how to use this class.\r
-       /// <code>\r
-       /// [STAThread]\r
-       /// static void Main(string[] args)     {\r
-       ///     int     currentIndex = 0;\r
-       ///     string s = ".NET Framework doesn't have a string parsing class?!";\r
-       ///     StringParser parser = new StringParser(s, false);                       \r
-       ///     while (currentIndex     &lt; s.Length) {\r
-       ///             Console.WriteLine("Returned Index: {0}", currentIndex = parser.ParseNext());\r
-       ///             Console.WriteLine("Chars scanned: {0}", parser.CharsParsed);\r
-       ///             Console.WriteLine("Parsing result: {0}\n", parser.Result);\r
-       ///     }\r
-       /// }\r
-       /// </code>\r
-       /// <para>The output:</para>\r
-       /// <code>\r
-       /// Returned Index:     5\r
-       /// Chars scanned: 5\r
-       /// Parsing     result: .NET\r
-       ///\r
-       /// Returned Index:     15\r
-       /// Chars scanned: 10\r
-       /// Parsing     result: Framework\r
-       ///\r
-       /// Returned Index:     23\r
-       /// Chars scanned: 8\r
-       /// Parsing     result: doesn't\r
-       ///\r
-       /// Returned Index:     28\r
-       /// Chars scanned: 5\r
-       /// Parsing     result: have\r
-       ///\r
-       /// Returned Index:     30\r
-       /// Chars scanned: 2\r
-       /// Parsing     result: a\r
-       ///\r
-       /// Returned Index:     37\r
-       /// Chars scanned: 7\r
-       /// Parsing     result: string\r
-       ///\r
-       /// Returned Index:     45\r
-       /// Chars scanned: 8\r
-       /// Parsing     result: parsing\r
-       ///\r
-       /// Returned Index:     52\r
-       /// Chars scanned: 7\r
-       /// Parsing     result: class?!\r
-       /// </code>\r
-       /// </example>\r
-       public class StringParser \r
-       {\r
-               #region Fields\r
-\r
-               private int             charsParsed;\r
-               private string  source;\r
-               private string  token;\r
-               private int             currentIndex;\r
-               private bool    caseSensitive;\r
-               private int             sourceLength;\r
-               private string  result;\r
-               private int             tokenLength;\r
-               \r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <summary>\r
-               /// Loaded after a parsing operation with the number of chars parsed.\r
-               /// </summary>\r
-               public int CharsParsed \r
-               {\r
-                       get     { return this.charsParsed; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Loaded after a parsing operation with the string that was found     between tokens.\r
-               /// </summary>\r
-               public string Result \r
-               {\r
-                       get     { return this.result; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// The string separator. The default value     is a white space: 0x32 ASCII code.\r
-               /// </summary>\r
-               public string Token     \r
-               {\r
-                       get     { return this.token; }\r
-                       set\r
-                       {\r
-                               if (value == null || value.Length == 0) \r
-                               {\r
-                                       throw new Exception("Token is empty!");\r
-                               }\r
-                               this.token = value;\r
-                               this.tokenLength = this.token.Length;\r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Returns     the     length of the string that is being parsed.\r
-               /// </summary>\r
-               public int Length \r
-               {\r
-                       get      { return this.sourceLength; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <summary>\r
-               /// Creates     an instance     of StringParser.\r
-               /// </summary>\r
-               /// <param name="caseSensitive">Indicates if parser     system should be case-sensitive (true) or case-intensitive (false).</param>\r
-               public StringParser(bool caseSensitive) \r
-               {\r
-                       this.caseSensitive = caseSensitive;\r
-                       this.token = " ";\r
-                       this.tokenLength = this.token.Length;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Creates     an instance     of StringParser.\r
-               /// </summary>\r
-               /// <param name="targetString">Indicates if     parser system should be case-sensitive (true) or case-intensitive (false).</param>\r
-               /// <param name="caseSensitive">The     string to parse.</param>\r
-               /// <remarks>By defining the string     (to     parse) in constructor you can call directly     the     method <see     cref="ParseNext"/>\r
-               /// without     having to initializate the target string on     <see cref="Parse(System.String)"/> method. See the example for further details.\r
-               /// </remarks>\r
-               public StringParser(string targetString, bool caseSensitive) \r
-               {\r
-                       this.caseSensitive = caseSensitive;\r
-                       this.token = " ";\r
-                       this.tokenLength = this.token.Length;\r
-                       this.source              = targetString;\r
-                       this.sourceLength = targetString.Length;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-               \r
-               /// <summary>\r
-               /// Parses target string attempting     to determine the (sub)string between the beginning of this string and the <see cref="Token"/>.\r
-               /// After the parse is complete system will load into <see cref="CharsParsed"/> then number of chars scanned and into <see cref="Result"/>\r
-               /// the string that     was     found.\r
-               /// </summary>\r
-               /// <param name="targetString">The string to be parsed.</param>\r
-               /// <returns>The index of the char next char after the <see     cref="Token"/> end.</returns>\r
-               /// <remarks>If nothing is parsed the method will return -1. Case the <see cref="Token"/> wasn't found until the end of the     string the method retuns \r
-               /// (in <see cref="Result"/>) the string found between the starting     index and the end of the string. </remarks>\r
-               public int Parse(string targetString) \r
-               {\r
-                       return Parse(targetString, 0);\r
-               }\r
-\r
-               /// <summary>\r
-               /// Parses target string attempting     to determine the (sub)string between the index <b>start</b>     of this string and the <see     cref="Token"/>.\r
-                /// After the parse is complete system will load into <see cref="CharsParsed"/> then number of chars scanned and into <see cref="Result"/>\r
-               /// the string that     was     found.\r
-               /// </summary>\r
-               /// <param name="targetString">The string to be parsed.</param>\r
-               /// <param name="start">The     start index     for     parsing purposes.</param>\r
-               /// <returns>The index of the char next char after the <c>Token</c>     end.</returns>\r
-               /// <remarks>If nothing is parsed the method will return -1. Case the <see cref="Token"/> wasn't found until the end of the     string the method returns \r
-               /// (in <see cref="Result"/>) the string found between the starting     index and the end of the string. </remarks>\r
-               public int Parse(string targetString, int start) \r
-               {\r
-                       this.sourceLength = targetString.Length;\r
-                       \r
-                       if (start >= this.sourceLength) \r
-                       {\r
-                               throw new Exception("Cannot start parsing after the end of the string.");\r
-                       }\r
-                       \r
-                       this.source = targetString;\r
-                       \r
-                       int     i = start;\r
-                       while (i < this.sourceLength) \r
-                       {\r
-                               if (string.Compare(this.source[i].ToString(), this.token[0].ToString(), !this.caseSensitive, CultureInfo.CurrentCulture) == 0) \r
-                               {\r
-                                       if (string.Compare(this.source.Substring(i,     this.tokenLength), this.token, !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)       \r
-                                       {\r
-                                               i += this.tokenLength; \r
-                                               break;\r
-                                       }\r
-                               }\r
-                               i++;\r
-                       }\r
-                       \r
-                       this.currentIndex = i;\r
-                       if (this.currentIndex != this.sourceLength)     \r
-                       {\r
-                               this.charsParsed = this.currentIndex - start;\r
-                               this.result = this.source.Substring(start, this.currentIndex - start - this.tokenLength);\r
-                       }\r
-                       else \r
-                       {\r
-                               this.charsParsed = this.currentIndex - start;\r
-                               this.result = this.source.Substring(start);\r
-                       }\r
-\r
-                       return this.currentIndex;\r
-               }\r
-\r
-               /// <summary>\r
-               /// <para>Repeats the parsing starting on the index     returned by <see cref="Parse(System.String)"/> method.</para>\r
-               /// You can     also call <b>ParseNext</b> directly     (without calling <see cref="Parse(System.String)"/>) if you     define the text to be parsed at instance construction.  \r
-               /// </summary>\r
-               /// <returns>The index of the char next char after the <see     cref="Token"/> end.</returns>\r
-               /// <remarks>If nothing is parsed the method will return -1. Case the <see cref="Token"/> wasn't found until the end of the     string the method returns \r
-               /// (in <see cref="Result"/>) the string found between the starting     index and the end of the string.</remarks>\r
-               public int ParseNext() \r
-               {\r
-                       if (this.currentIndex >= this.sourceLength)     \r
-                       {\r
-                               throw new Exception("Cannot start parsing after the end of the string.");\r
-                       }\r
-                       \r
-                       int     i = this.currentIndex;\r
-                       while (i < this.sourceLength) \r
-                       {\r
-                               if (string.Compare(this.source[i].ToString(), this.token[0].ToString(), !this.caseSensitive, CultureInfo.CurrentCulture) == 0) \r
-                               {\r
-                                       if (string.Compare(this.source.Substring(i,     this.tokenLength), this.token, !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)       \r
-                                       {\r
-                                               i += this.tokenLength; \r
-                                               break;\r
-                                       }\r
-                               }\r
-                               i++;\r
-                       }\r
-                       \r
-                       if (i != this.sourceLength)     \r
-                       {\r
-                               this.charsParsed = i - this.currentIndex;\r
-                               this.result = this.source.Substring(this.currentIndex, i - this.currentIndex - this.tokenLength);\r
-                       }\r
-                       else \r
-                       {\r
-                               this.charsParsed = i - this.currentIndex;\r
-                               this.result = this.source.Substring(this.currentIndex);\r
-                       }\r
-                       \r
-                       return this.currentIndex = i;\r
-               }       \r
-               \r
-               /// <summary>\r
-               /// Returns     the     index of the substring in the string. If the substring does     not     exists the method returns <b>-1</b>.\r
-               /// </summary>\r
-               /// <param name="substring">The string to be located.</param>\r
-               /// <returns>The index of the substring or -1 if the string     does not exists within the source string.\r
-               /// If the the substring is     empty method returns 0.</returns>\r
-               /// <remarks>The instance parses for the substring in a case sensitive or intensive     way, as you     specify at \r
-               /// class construction.</remarks>\r
-               public int IndexOf(string substring) \r
-               {\r
-                       return IndexOf(substring, 0);\r
-               }\r
-\r
-               /// <summary>\r
-               /// Returns     the     index of the substring in the string starting on index <b>startIndex</b>. \r
-               /// If the substring does not exists the method returns <b>-1</b>.\r
-               /// </summary>\r
-               /// <param name="substring">The string to be located.</param>\r
-               /// <param name="startIndex">The start index of the     source string where     parser will     start.</param>\r
-               /// <returns>The index of the substring or -1 if the string     does not exists within the source string.\r
-               /// If the the substring is     empty method returns <i>startIndex</i>.</returns>\r
-               /// <remarks>The instance parses for the substring in a case sensitive or intensive     way, as you     specify at \r
-               /// class construction.</remarks>\r
-               public int IndexOf(string substring, int startIndex)\r
-               {\r
-                       if (startIndex >= this.sourceLength)\r
-                       {\r
-                               throw new IndexOutOfRangeException("Start index out of bounds.");\r
-                       }\r
-\r
-                       if (substring == null || substring.Length == 0)\r
-                       {\r
-                               return startIndex;\r
-                       }\r
-\r
-                       int     i = startIndex;\r
-                       while (i < this.sourceLength) \r
-                       {\r
-                               if (String.Compare(this.source[i].ToString(), substring[0].ToString(), !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)\r
-                               {\r
-                                       if (substring != null && substring.Length == 1)\r
-                                       {\r
-                                               return i;\r
-                                       }\r
-\r
-                                       int     j = i + 1;\r
-                                       while ((j <     this.sourceLength) && ((j -     i) < substring.Length))\r
-                                       {\r
-                                               if (String.Compare(this.source[j].ToString(), substring[j -     i].ToString(), !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)\r
-                                               {\r
-                                                       j++;\r
-                                               }\r
-                                               else \r
-                                               {\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-\r
-                                       if ((j - i) == substring.Length)\r
-                                       {\r
-                                               return i;\r
-                                       }\r
-                               }\r
-\r
-                               i++;\r
-                       }\r
-\r
-                       return -1;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Overrided method that returns the string to be parsed.\r
-               /// </summary>\r
-               /// <returns>The string to be parsed.</returns>\r
-               public override string ToString() \r
-               {\r
-                       return this.source;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Static Methods\r
-\r
-               /// <summary>\r
-               /// Indicates if the string     specified as <b>source</b> starts with the <b>token</b> string.\r
-               /// </summary>\r
-               /// <param name="source">The source     string.</param>\r
-               /// <param name="token">The     token that is intended to find.</param>\r
-               /// <param name="ignoreCase">Indicated is char case     should be ignored.</param>\r
-               /// <returns>Returns <b>true</b> if     the     <b>token</b> precedes the <b>source</b>.</returns>\r
-               public static bool StartsWith(string source, string     token, bool     ignoreCase)     \r
-               {\r
-                       if (source.Length <     token.Length)\r
-                       {\r
-                               return false;\r
-                       }\r
-\r
-                       return string.Compare(token, source.Substring(0, token.Length), ignoreCase,     CultureInfo.CurrentCulture) == 0;\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2003, 2005 Abel Eduardo Pereira
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Firebird.Isql
+{
+       /// <summary>
+       /// StringParser parses a string returnning     the     (sub)strings between tokens.
+       /// </summary>
+       /// <example>
+       /// An example of how to use this class.
+       /// <code>
+       /// [STAThread]
+       /// static void Main(string[] args)     {
+       ///     int     currentIndex = 0;
+       ///     string s = ".NET Framework doesn't have a string parsing class?!";
+       ///     StringParser parser = new StringParser(s, false);                       
+       ///     while (currentIndex     &lt; s.Length) {
+       ///             Console.WriteLine("Returned Index: {0}", currentIndex = parser.ParseNext());
+       ///             Console.WriteLine("Chars scanned: {0}", parser.CharsParsed);
+       ///             Console.WriteLine("Parsing result: {0}\n", parser.Result);
+       ///     }
+       /// }
+       /// </code>
+       /// <para>The output:</para>
+       /// <code>
+       /// Returned Index:     5
+       /// Chars scanned: 5
+       /// Parsing     result: .NET
+       ///
+       /// Returned Index:     15
+       /// Chars scanned: 10
+       /// Parsing     result: Framework
+       ///
+       /// Returned Index:     23
+       /// Chars scanned: 8
+       /// Parsing     result: doesn't
+       ///
+       /// Returned Index:     28
+       /// Chars scanned: 5
+       /// Parsing     result: have
+       ///
+       /// Returned Index:     30
+       /// Chars scanned: 2
+       /// Parsing     result: a
+       ///
+       /// Returned Index:     37
+       /// Chars scanned: 7
+       /// Parsing     result: string
+       ///
+       /// Returned Index:     45
+       /// Chars scanned: 8
+       /// Parsing     result: parsing
+       ///
+       /// Returned Index:     52
+       /// Chars scanned: 7
+       /// Parsing     result: class?!
+       /// </code>
+       /// </example>
+       public class StringParser 
+       {
+               #region Fields
+
+               private int             charsParsed;
+               private string  source;
+               private string  token;
+               private int             currentIndex;
+               private bool    caseSensitive;
+               private int             sourceLength;
+               private string  result;
+               private int             tokenLength;
+               
+               #endregion
+
+               #region Properties
+
+               /// <summary>
+               /// Loaded after a parsing operation with the number of chars parsed.
+               /// </summary>
+               public int CharsParsed 
+               {
+                       get     { return this.charsParsed; }
+               }
+
+               /// <summary>
+               /// Loaded after a parsing operation with the string that was found     between tokens.
+               /// </summary>
+               public string Result 
+               {
+                       get     { return this.result; }
+               }
+
+               /// <summary>
+               /// The string separator. The default value     is a white space: 0x32 ASCII code.
+               /// </summary>
+               public string Token     
+               {
+                       get     { return this.token; }
+                       set
+                       {
+                               if (value == null || value.Length == 0) 
+                               {
+                                       throw new Exception("Token is empty!");
+                               }
+                               this.token = value;
+                               this.tokenLength = this.token.Length;
+                       }
+               }
+
+               /// <summary>
+               /// Returns     the     length of the string that is being parsed.
+               /// </summary>
+               public int Length 
+               {
+                       get      { return this.sourceLength; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <summary>
+               /// Creates     an instance     of StringParser.
+               /// </summary>
+               /// <param name="caseSensitive">Indicates if parser     system should be case-sensitive (true) or case-intensitive (false).</param>
+               public StringParser(bool caseSensitive) 
+               {
+                       this.caseSensitive = caseSensitive;
+                       this.token = " ";
+                       this.tokenLength = this.token.Length;
+               }
+
+               /// <summary>
+               /// Creates     an instance     of StringParser.
+               /// </summary>
+               /// <param name="targetString">Indicates if     parser system should be case-sensitive (true) or case-intensitive (false).</param>
+               /// <param name="caseSensitive">The     string to parse.</param>
+               /// <remarks>By defining the string     (to     parse) in constructor you can call directly     the     method <see     cref="ParseNext"/>
+               /// without     having to initializate the target string on     <see cref="Parse(System.String)"/> method. See the example for further details.
+               /// </remarks>
+               public StringParser(string targetString, bool caseSensitive) 
+               {
+                       this.caseSensitive = caseSensitive;
+                       this.token = " ";
+                       this.tokenLength = this.token.Length;
+                       this.source              = targetString;
+                       this.sourceLength = targetString.Length;
+               }
+
+               #endregion
+
+               #region Methods
+               
+               /// <summary>
+               /// Parses target string attempting     to determine the (sub)string between the beginning of this string and the <see cref="Token"/>.
+               /// After the parse is complete system will load into <see cref="CharsParsed"/> then number of chars scanned and into <see cref="Result"/>
+               /// the string that     was     found.
+               /// </summary>
+               /// <param name="targetString">The string to be parsed.</param>
+               /// <returns>The index of the char next char after the <see     cref="Token"/> end.</returns>
+               /// <remarks>If nothing is parsed the method will return -1. Case the <see cref="Token"/> wasn't found until the end of the     string the method retuns 
+               /// (in <see cref="Result"/>) the string found between the starting     index and the end of the string. </remarks>
+               public int Parse(string targetString) 
+               {
+                       return Parse(targetString, 0);
+               }
+
+               /// <summary>
+               /// Parses target string attempting     to determine the (sub)string between the index <b>start</b>     of this string and the <see     cref="Token"/>.
+                /// After the parse is complete system will load into <see cref="CharsParsed"/> then number of chars scanned and into <see cref="Result"/>
+               /// the string that     was     found.
+               /// </summary>
+               /// <param name="targetString">The string to be parsed.</param>
+               /// <param name="start">The     start index     for     parsing purposes.</param>
+               /// <returns>The index of the char next char after the <c>Token</c>     end.</returns>
+               /// <remarks>If nothing is parsed the method will return -1. Case the <see cref="Token"/> wasn't found until the end of the     string the method returns 
+               /// (in <see cref="Result"/>) the string found between the starting     index and the end of the string. </remarks>
+               public int Parse(string targetString, int start) 
+               {
+                       this.sourceLength = targetString.Length;
+                       
+                       if (start >= this.sourceLength) 
+                       {
+                               throw new Exception("Cannot start parsing after the end of the string.");
+                       }
+                       
+                       this.source = targetString;
+                       
+                       int     i = start;
+                       while (i < this.sourceLength) 
+                       {
+                               if (string.Compare(this.source[i].ToString(), this.token[0].ToString(), !this.caseSensitive, CultureInfo.CurrentCulture) == 0) 
+                               {
+                                       if (string.Compare(this.source.Substring(i,     this.tokenLength), this.token, !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)       
+                                       {
+                                               i += this.tokenLength; 
+                                               break;
+                                       }
+                               }
+                               i++;
+                       }
+                       
+                       this.currentIndex = i;
+                       if (this.currentIndex != this.sourceLength)     
+                       {
+                               this.charsParsed = this.currentIndex - start;
+                               this.result = this.source.Substring(start, this.currentIndex - start - this.tokenLength);
+                       }
+                       else 
+                       {
+                               this.charsParsed = this.currentIndex - start;
+                               this.result = this.source.Substring(start);
+                       }
+
+                       return this.currentIndex;
+               }
+
+               /// <summary>
+               /// <para>Repeats the parsing starting on the index     returned by <see cref="Parse(System.String)"/> method.</para>
+               /// You can     also call <b>ParseNext</b> directly     (without calling <see cref="Parse(System.String)"/>) if you     define the text to be parsed at instance construction.  
+               /// </summary>
+               /// <returns>The index of the char next char after the <see     cref="Token"/> end.</returns>
+               /// <remarks>If nothing is parsed the method will return -1. Case the <see cref="Token"/> wasn't found until the end of the     string the method returns 
+               /// (in <see cref="Result"/>) the string found between the starting     index and the end of the string.</remarks>
+               public int ParseNext() 
+               {
+                       if (this.currentIndex >= this.sourceLength)     
+                       {
+                               throw new Exception("Cannot start parsing after the end of the string.");
+                       }
+                       
+                       int     i = this.currentIndex;
+                       while (i < this.sourceLength) 
+                       {
+                               if (string.Compare(this.source[i].ToString(), this.token[0].ToString(), !this.caseSensitive, CultureInfo.CurrentCulture) == 0) 
+                               {
+                                       if (string.Compare(this.source.Substring(i,     this.tokenLength), this.token, !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)       
+                                       {
+                                               i += this.tokenLength; 
+                                               break;
+                                       }
+                               }
+                               i++;
+                       }
+                       
+                       if (i != this.sourceLength)     
+                       {
+                               this.charsParsed = i - this.currentIndex;
+                               this.result = this.source.Substring(this.currentIndex, i - this.currentIndex - this.tokenLength);
+                       }
+                       else 
+                       {
+                               this.charsParsed = i - this.currentIndex;
+                               this.result = this.source.Substring(this.currentIndex);
+                       }
+                       
+                       return this.currentIndex = i;
+               }       
+               
+               /// <summary>
+               /// Returns     the     index of the substring in the string. If the substring does     not     exists the method returns <b>-1</b>.
+               /// </summary>
+               /// <param name="substring">The string to be located.</param>
+               /// <returns>The index of the substring or -1 if the string     does not exists within the source string.
+               /// If the the substring is     empty method returns 0.</returns>
+               /// <remarks>The instance parses for the substring in a case sensitive or intensive     way, as you     specify at 
+               /// class construction.</remarks>
+               public int IndexOf(string substring) 
+               {
+                       return IndexOf(substring, 0);
+               }
+
+               /// <summary>
+               /// Returns     the     index of the substring in the string starting on index <b>startIndex</b>. 
+               /// If the substring does not exists the method returns <b>-1</b>.
+               /// </summary>
+               /// <param name="substring">The string to be located.</param>
+               /// <param name="startIndex">The start index of the     source string where     parser will     start.</param>
+               /// <returns>The index of the substring or -1 if the string     does not exists within the source string.
+               /// If the the substring is     empty method returns <i>startIndex</i>.</returns>
+               /// <remarks>The instance parses for the substring in a case sensitive or intensive     way, as you     specify at 
+               /// class construction.</remarks>
+               public int IndexOf(string substring, int startIndex)
+               {
+                       if (startIndex >= this.sourceLength)
+                       {
+                               throw new IndexOutOfRangeException("Start index out of bounds.");
+                       }
+
+                       if (substring == null || substring.Length == 0)
+                       {
+                               return startIndex;
+                       }
+
+                       int     i = startIndex;
+                       while (i < this.sourceLength) 
+                       {
+                               if (String.Compare(this.source[i].ToString(), substring[0].ToString(), !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)
+                               {
+                                       if (substring != null && substring.Length == 1)
+                                       {
+                                               return i;
+                                       }
+
+                                       int     j = i + 1;
+                                       while ((j <     this.sourceLength) && ((j -     i) < substring.Length))
+                                       {
+                                               if (String.Compare(this.source[j].ToString(), substring[j -     i].ToString(), !this.caseSensitive,     CultureInfo.CurrentCulture) == 0)
+                                               {
+                                                       j++;
+                                               }
+                                               else 
+                                               {
+                                                       break;
+                                               }
+                                       }
+
+                                       if ((j - i) == substring.Length)
+                                       {
+                                               return i;
+                                       }
+                               }
+
+                               i++;
+                       }
+
+                       return -1;
+               }
+
+               /// <summary>
+               /// Overrided method that returns the string to be parsed.
+               /// </summary>
+               /// <returns>The string to be parsed.</returns>
+               public override string ToString() 
+               {
+                       return this.source;
+               }
+
+               #endregion
+
+               #region Static Methods
+
+               /// <summary>
+               /// Indicates if the string     specified as <b>source</b> starts with the <b>token</b> string.
+               /// </summary>
+               /// <param name="source">The source     string.</param>
+               /// <param name="token">The     token that is intended to find.</param>
+               /// <param name="ignoreCase">Indicated is char case     should be ignored.</param>
+               /// <returns>Returns <b>true</b> if     the     <b>token</b> precedes the <b>source</b>.</returns>
+               public static bool StartsWith(string source, string     token, bool     ignoreCase)     
+               {
+                       if (source.Length <     token.Length)
+                       {
+                               return false;
+                       }
+
+                       return string.Compare(token, source.Substring(0, token.Length), ignoreCase,     CultureInfo.CurrentCulture) == 0;
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 6f2740442a874996d407bb3c11a68a0b623482e7..af1262c5c4de83c7368dc79d09bf97ba140d31b4 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/overview/*'/>\r
-       public sealed class FbBackup : FbService\r
-       {\r
-               #region Fields\r
-\r
-               private bool                    verbose;\r
-               private int                             factor;\r
-               private ArrayList               backupFiles;\r
-               private FbBackupFlags   options;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="BackupFiles"]/*'/>\r
-               public ArrayList BackupFiles\r
-               {\r
-                       get { return this.backupFiles; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="Verbose"]/*'/>\r
-               public bool Verbose\r
-               {\r
-                       get { return this.verbose; }\r
-                       set { this.verbose = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="Factor"]/*'/>\r
-               public int Factor\r
-               {\r
-                       get { return this.factor; }\r
-                       set { this.factor = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="Options"]/*'/>\r
-               public FbBackupFlags Options\r
-               {\r
-                       get { return this.options; }\r
-                       set { this.options = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/constructor[@name="ctor"]/*'/>\r
-               public FbBackup() : base()\r
-               {\r
-                       this.backupFiles = new ArrayList();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/method[@name="Execute"]/*'/>\r
-               public void Execute()\r
-               {\r
-                       try\r
-                       {\r
-                               // Configure Spb\r
-                               this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                               this.StartSpb.Append(IscCodes.isc_action_svc_backup);\r
-                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-\r
-                               foreach (FbBackupFile file in backupFiles)\r
-                               {\r
-                                       this.StartSpb.Append(IscCodes.isc_spb_bkp_file, file.BackupFile);\r
-                                       this.StartSpb.Append(IscCodes.isc_spb_bkp_length, file.BackupLength);\r
-                               }\r
-\r
-                               if (verbose)\r
-                               {\r
-                                       this.StartSpb.Append(IscCodes.isc_spb_verbose);\r
-                               }\r
-\r
-                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);\r
-\r
-                               // Start execution\r
-                               this.StartTask();\r
-\r
-                               if (this.verbose)\r
-                               {\r
-                                       this.ProcessServiceOutput();\r
-                               }\r
-                       }\r
-                       catch\r
-                       {\r
-                               throw;\r
-                       }\r
-                       finally\r
-                       {\r
-                               // Close\r
-                               this.Close();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/overview/*'/>
+       public sealed class FbBackup : FbService
+       {
+               #region Fields
+
+               private bool                    verbose;
+               private int                             factor;
+               private ArrayList               backupFiles;
+               private FbBackupFlags   options;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="BackupFiles"]/*'/>
+               public ArrayList BackupFiles
+               {
+                       get { return this.backupFiles; }
+               }
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="Verbose"]/*'/>
+               public bool Verbose
+               {
+                       get { return this.verbose; }
+                       set { this.verbose = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="Factor"]/*'/>
+               public int Factor
+               {
+                       get { return this.factor; }
+                       set { this.factor = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/property[@name="Options"]/*'/>
+               public FbBackupFlags Options
+               {
+                       get { return this.options; }
+                       set { this.options = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/constructor[@name="ctor"]/*'/>
+               public FbBackup() : base()
+               {
+                       this.backupFiles = new ArrayList();
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackup"]/method[@name="Execute"]/*'/>
+               public void Execute()
+               {
+                       try
+                       {
+                               // Configure Spb
+                               this.StartSpb = this.CreateParameterBuffer();
+
+                               this.StartSpb.Append(IscCodes.isc_action_svc_backup);
+                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+
+                               foreach (FbBackupFile file in backupFiles)
+                               {
+                                       this.StartSpb.Append(IscCodes.isc_spb_bkp_file, file.BackupFile);
+                                       this.StartSpb.Append(IscCodes.isc_spb_bkp_length, file.BackupLength);
+                               }
+
+                               if (verbose)
+                               {
+                                       this.StartSpb.Append(IscCodes.isc_spb_verbose);
+                               }
+
+                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);
+
+                               // Start execution
+                               this.StartTask();
+
+                               if (this.verbose)
+                               {
+                                       this.ProcessServiceOutput();
+                               }
+                       }
+                       catch
+                       {
+                               throw;
+                       }
+                       finally
+                       {
+                               // Close
+                               this.Close();
+                       }
+               }
+
+               #endregion
+       }
+}
index c4fb712ba5ef50f1bc3c00e6d1ff10aaf8d1e6ac..e186e9bb194132d437b3cd9eef692fa6f37590b1 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/overview/*'/>\r
-       public class FbBackupFile\r
-       {\r
-               #region Fields\r
-\r
-               private string  backupFile;\r
-               private int             backupLength;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/property[@name="BackupFile"]/*'/>\r
-               public string BackupFile\r
-               {\r
-                       get { return this.backupFile; }\r
-                       set { this.backupFile = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/property[@name="BackupLength"]/*'/>\r
-               public int BackupLength\r
-               {\r
-                       get { return this.backupLength; }\r
-                       set { this.backupLength = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/constructor[@name="ctor(system.String,System.Int32)"]/*'/>\r
-               public FbBackupFile(string fileName, int fileLength)\r
-               {\r
-                       this.backupFile = fileName;\r
-                       this.backupLength       = fileLength;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/overview/*'/>
+       public class FbBackupFile
+       {
+               #region Fields
+
+               private string  backupFile;
+               private int             backupLength;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/property[@name="BackupFile"]/*'/>
+               public string BackupFile
+               {
+                       get { return this.backupFile; }
+                       set { this.backupFile = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/property[@name="BackupLength"]/*'/>
+               public int BackupLength
+               {
+                       get { return this.backupLength; }
+                       set { this.backupLength = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/class[@name="FbBackupFile"]/constructor[@name="ctor(system.String,System.Int32)"]/*'/>
+               public FbBackupFile(string fileName, int fileLength)
+               {
+                       this.backupFile = fileName;
+                       this.backupLength       = fileLength;
+               }
+
+               #endregion
+       }
+}
index 9cb03d7f5247cf99117c5b31b3b25602ac4e9e3b..71bb2dd497651c1260f9129683c66ad1b2f07c56 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/overview/*'/>\r
-       [Flags]\r
-       public enum FbBackupFlags\r
-       {\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="IgnoreChecksums"]/*'/>\r
-               IgnoreChecksums         = 0x01,\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="IgnoreLimbo"]/*'/>\r
-               IgnoreLimbo                     = 0x02,\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="MetaDataOnly"]/*'/>\r
-               MetaDataOnly            = 0x04,\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="NoGarbageCollect"]/*'/>\r
-               NoGarbageCollect        = 0x08,\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="OldDescriptions"]/*'/>\r
-               OldDescriptions         = 0x10,\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="NonTransportable"]/*'/>\r
-               NonTransportable        = 0x20,\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="Convert"]/*'/>\r
-               Convert                         = 0x40,\r
-               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="Expand"]/*'/>\r
-               Expand                          = 0x80\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/overview/*'/>
+       [Flags]
+       public enum FbBackupFlags
+       {
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="IgnoreChecksums"]/*'/>
+               IgnoreChecksums         = 0x01,
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="IgnoreLimbo"]/*'/>
+               IgnoreLimbo                     = 0x02,
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="MetaDataOnly"]/*'/>
+               MetaDataOnly            = 0x04,
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="NoGarbageCollect"]/*'/>
+               NoGarbageCollect        = 0x08,
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="OldDescriptions"]/*'/>
+               OldDescriptions         = 0x10,
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="NonTransportable"]/*'/>
+               NonTransportable        = 0x20,
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="Convert"]/*'/>
+               Convert                         = 0x40,
+               /// <include file='Doc/en_EN/FbBackup.xml' path='doc/enum[@name="FbBackupFlags"]/field[@name="Expand"]/*'/>
+               Expand                          = 0x80
+       }
+}
index cd9ea69025e5269700c007ecac8fefbb5b81a387..d18459bcfe973a234c36ed583a9b13af388a0266 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/overview/*'/>\r
-       public sealed class FbConfiguration : FbService\r
-       {\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/constructor[@name="ctor"]/*'/>\r
-               public FbConfiguration() : base()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetSqlDialect(System.Int32)"]/*'/>\r
-               public void SetSqlDialect(int sqlDialect)\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_prp_set_sql_dialect, sqlDialect);\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetSweepInterval(System.Int32)"]/*'/>\r
-               public void SetSweepInterval(int sweepInterval)\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_prp_sweep_interval, sweepInterval);\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetPageBuffers(System.Int32)"]/*'/>\r
-               public void SetPageBuffers(int pageBuffers)\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_prp_page_buffers, pageBuffers);\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="DatabaseShutdown(FbShutdownMode,System.Int32)"]/*'/>\r
-               public void DatabaseShutdown(FbShutdownMode mode, int seconds)\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-\r
-                       switch (mode)\r
-                       {\r
-                               case FbShutdownMode.Forced:\r
-                                       this.StartSpb.Append(IscCodes.isc_spb_prp_shutdown_db, seconds);\r
-                                       break;\r
-\r
-                               case FbShutdownMode.DenyTransaction:\r
-                                       this.StartSpb.Append(\r
-                                               IscCodes.isc_spb_prp_deny_new_transactions, seconds);\r
-                                       break;\r
-\r
-                               case FbShutdownMode.DenyConnection:\r
-                                       this.StartSpb.Append(\r
-                                               IscCodes.isc_spb_prp_deny_new_attachments, seconds);\r
-                                       break;\r
-                       }\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="DatabaseOnline"]/*'/>\r
-               public void DatabaseOnline()\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_options, IscCodes.isc_spb_prp_db_online);\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="ActivateShadows"]/*'/>\r
-               public void ActivateShadows()\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_options, IscCodes.isc_spb_prp_activate);\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetForcedWrites(System.Boolean)"]/*'/>\r
-               public void SetForcedWrites(bool forcedWrites)\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-\r
-                       // WriteMode\r
-                       if (forcedWrites)\r
-                       {\r
-                               this.StartSpb.Append(\r
-                                       IscCodes.isc_spb_prp_write_mode, (byte)IscCodes.isc_spb_prp_wm_sync);\r
-                       }\r
-                       else\r
-                       {\r
-                               this.StartSpb.Append(\r
-                                       IscCodes.isc_spb_prp_write_mode, (byte)IscCodes.isc_spb_prp_wm_async);\r
-                       }\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetReserveSpace(System.Boolean)"]/*'/>\r
-               public void SetReserveSpace(bool reserveSpace)\r
-               {\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-\r
-                       // Reserve Space\r
-                       if (reserveSpace)\r
-                       {\r
-                               this.StartSpb.Append(\r
-                                       IscCodes.isc_spb_prp_reserve_space, (byte)IscCodes.isc_spb_prp_res);\r
-                       }\r
-                       else\r
-                       {\r
-                               this.StartSpb.Append(\r
-                                       IscCodes.isc_spb_prp_reserve_space, (byte)IscCodes.isc_spb_prp_res_use_full);\r
-                       }\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetAccessMode(System.Boolean)"]/*'/>\r
-               public void SetAccessMode(bool readOnly)\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-\r
-                       if (readOnly)\r
-                       {\r
-                               this.StartSpb.Append(\r
-                                       IscCodes.isc_spb_prp_access_mode, (byte)IscCodes.isc_spb_prp_am_readonly);\r
-                       }\r
-                       else\r
-                       {\r
-                               this.StartSpb.Append(\r
-                                       IscCodes.isc_spb_prp_access_mode, (byte)IscCodes.isc_spb_prp_am_readwrite);\r
-                       }\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/overview/*'/>
+       public sealed class FbConfiguration : FbService
+       {
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/constructor[@name="ctor"]/*'/>
+               public FbConfiguration() : base()
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetSqlDialect(System.Int32)"]/*'/>
+               public void SetSqlDialect(int sqlDialect)
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+                       this.StartSpb.Append(IscCodes.isc_spb_prp_set_sql_dialect, sqlDialect);
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetSweepInterval(System.Int32)"]/*'/>
+               public void SetSweepInterval(int sweepInterval)
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+                       this.StartSpb.Append(IscCodes.isc_spb_prp_sweep_interval, sweepInterval);
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetPageBuffers(System.Int32)"]/*'/>
+               public void SetPageBuffers(int pageBuffers)
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+                       this.StartSpb.Append(IscCodes.isc_spb_prp_page_buffers, pageBuffers);
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="DatabaseShutdown(FbShutdownMode,System.Int32)"]/*'/>
+               public void DatabaseShutdown(FbShutdownMode mode, int seconds)
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+
+                       switch (mode)
+                       {
+                               case FbShutdownMode.Forced:
+                                       this.StartSpb.Append(IscCodes.isc_spb_prp_shutdown_db, seconds);
+                                       break;
+
+                               case FbShutdownMode.DenyTransaction:
+                                       this.StartSpb.Append(
+                                               IscCodes.isc_spb_prp_deny_new_transactions, seconds);
+                                       break;
+
+                               case FbShutdownMode.DenyConnection:
+                                       this.StartSpb.Append(
+                                               IscCodes.isc_spb_prp_deny_new_attachments, seconds);
+                                       break;
+                       }
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="DatabaseOnline"]/*'/>
+               public void DatabaseOnline()
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+                       this.StartSpb.Append(IscCodes.isc_spb_options, IscCodes.isc_spb_prp_db_online);
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="ActivateShadows"]/*'/>
+               public void ActivateShadows()
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+                       this.StartSpb.Append(IscCodes.isc_spb_options, IscCodes.isc_spb_prp_activate);
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetForcedWrites(System.Boolean)"]/*'/>
+               public void SetForcedWrites(bool forcedWrites)
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+
+                       // WriteMode
+                       if (forcedWrites)
+                       {
+                               this.StartSpb.Append(
+                                       IscCodes.isc_spb_prp_write_mode, (byte)IscCodes.isc_spb_prp_wm_sync);
+                       }
+                       else
+                       {
+                               this.StartSpb.Append(
+                                       IscCodes.isc_spb_prp_write_mode, (byte)IscCodes.isc_spb_prp_wm_async);
+                       }
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetReserveSpace(System.Boolean)"]/*'/>
+               public void SetReserveSpace(bool reserveSpace)
+               {
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+
+                       // Reserve Space
+                       if (reserveSpace)
+                       {
+                               this.StartSpb.Append(
+                                       IscCodes.isc_spb_prp_reserve_space, (byte)IscCodes.isc_spb_prp_res);
+                       }
+                       else
+                       {
+                               this.StartSpb.Append(
+                                       IscCodes.isc_spb_prp_reserve_space, (byte)IscCodes.isc_spb_prp_res_use_full);
+                       }
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/class[@name="FbConfiguration"]/method[@name="SetAccessMode(System.Boolean)"]/*'/>
+               public void SetAccessMode(bool readOnly)
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_properties);
+                       this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+
+                       if (readOnly)
+                       {
+                               this.StartSpb.Append(
+                                       IscCodes.isc_spb_prp_access_mode, (byte)IscCodes.isc_spb_prp_am_readonly);
+                       }
+                       else
+                       {
+                               this.StartSpb.Append(
+                                       IscCodes.isc_spb_prp_access_mode, (byte)IscCodes.isc_spb_prp_am_readwrite);
+                       }
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               #endregion
+       }
+}
index acb2674f0506043679c9cab3a8d69a690fb35d9a..c15385f9bf5dae5d35c111e7897a7763c8aeeb22 100644 (file)
@@ -1,58 +1,58 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections.Specialized;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbDatabasesInfo"]/overview/*'/>\r
-       public struct FbDatabasesInfo\r
-       {\r
-               #region Fields\r
-\r
-               private int connectionCount;\r
-               private StringCollection databases;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbDatabasesInfo"]/field[@name="ConnectionCount"]/*'/>\r
-               public int ConnectionCount\r
-               {\r
-                       get { return this.connectionCount; }\r
-                       set { this.connectionCount = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbDatabasesInfo"]/field[@name="Databases"]/*'/>\r
-               public StringCollection Databases\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.databases == null)\r
-                               {\r
-                                       this.databases = new StringCollection();\r
-                               }\r
-                               return this.databases;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections.Specialized;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbDatabasesInfo"]/overview/*'/>
+       public struct FbDatabasesInfo
+       {
+               #region Fields
+
+               private int connectionCount;
+               private StringCollection databases;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbDatabasesInfo"]/field[@name="ConnectionCount"]/*'/>
+               public int ConnectionCount
+               {
+                       get { return this.connectionCount; }
+                       set { this.connectionCount = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbDatabasesInfo"]/field[@name="Databases"]/*'/>
+               public StringCollection Databases
+               {
+                       get
+                       {
+                               if (this.databases == null)
+                               {
+                                       this.databases = new StringCollection();
+                               }
+                               return this.databases;
+                       }
+               }
+
+               #endregion
+       }
+}
index c14f77276faa57b0b4e666fc1ed4194aa6fea245..270dace9352c471a8ce3bd63016fbb632f5ad8bb 100644 (file)
@@ -1,68 +1,68 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/overview/*'/>\r
-       public sealed class FbLog : FbService\r
-       {\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/constructor[@name="ctor"]/*'/>\r
-               public FbLog() : base()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/method[@name="Execute"]/*'/>\r
-               public void Execute()\r
-               {\r
-                       try\r
-                       {\r
-                               // Configure Spb\r
-                               this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                               this.StartSpb.Append(IscCodes.isc_action_svc_get_ib_log);\r
-\r
-                               // Start execution\r
-                               this.StartTask();\r
-\r
-                               // Process service output\r
-                               this.ProcessServiceOutput();\r
-                       }\r
-                       catch\r
-                       {\r
-                               throw;\r
-                       }\r
-                       finally\r
-                       {\r
-                               this.Close();\r
-                       }\r
-\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/overview/*'/>
+       public sealed class FbLog : FbService
+       {
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/constructor[@name="ctor"]/*'/>
+               public FbLog() : base()
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/method[@name="Execute"]/*'/>
+               public void Execute()
+               {
+                       try
+                       {
+                               // Configure Spb
+                               this.StartSpb = this.CreateParameterBuffer();
+
+                               this.StartSpb.Append(IscCodes.isc_action_svc_get_ib_log);
+
+                               // Start execution
+                               this.StartTask();
+
+                               // Process service output
+                               this.ProcessServiceOutput();
+                       }
+                       catch
+                       {
+                               throw;
+                       }
+                       finally
+                       {
+                               this.Close();
+                       }
+
+               }
+
+               #endregion
+       }
+}
index a65d5664d19702cdba52ef38b4d30c0c90a92576..7eb0751482cf30a4c868170f960cd8c2c7713984 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/overview/*'/>\r
-       public sealed class FbRestore : FbService\r
-       {\r
-               #region Fields\r
-\r
-               private ArrayList               backupFiles;\r
-               private FbRestoreFlags  options;\r
-               private bool                    verbose;\r
-               private int                             pageBuffers;\r
-               private int                             pageSize;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="BackupFiles"]/*'/>\r
-               public ArrayList BackupFiles\r
-               {\r
-                       get { return this.backupFiles; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="Verbose"]/*'/>\r
-               public bool Verbose\r
-               {\r
-                       get { return this.verbose; }\r
-                       set { this.verbose = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="PageBuffers"]/*'/>\r
-               public int PageBuffers\r
-               {\r
-                       get { return this.pageBuffers; }\r
-                       set { this.pageBuffers = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="PageSize"]/*'/>\r
-               public int PageSize\r
-               {\r
-                       get { return this.pageSize; }\r
-                       set\r
-                       {\r
-                               if (this.pageSize != 1024 && this.pageSize != 2048 &&\r
-                                       this.pageSize != 4096 && this.pageSize != 8192 &&\r
-                                       this.pageSize != 16384)\r
-                               {\r
-                                       throw new InvalidOperationException("Invalid page size.");\r
-                               }\r
-                               this.pageSize = value;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="Options"]/*'/>\r
-               public FbRestoreFlags Options\r
-               {\r
-                       get { return this.options; }\r
-                       set { this.options = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/constructor[@name="ctor"]/*'/>\r
-               public FbRestore() : base()\r
-               {\r
-                       this.backupFiles        = new ArrayList();\r
-                       this.pageSize           = 4096;\r
-                       this.pageBuffers        = 2048;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/method[@name="Execute"]/*'/>\r
-               public void Execute()\r
-               {\r
-                       try\r
-                       {\r
-                               // Configure Spb\r
-                               this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                               this.StartSpb.Append(IscCodes.isc_action_svc_restore);\r
-\r
-                               foreach (FbBackupFile bkpFile in backupFiles)\r
-                               {\r
-                                       this.StartSpb.Append(IscCodes.isc_spb_bkp_file, bkpFile.BackupFile);\r
-                               }\r
-\r
-                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-\r
-                               if (this.verbose)\r
-                               {\r
-                                       this.StartSpb.Append(IscCodes.isc_spb_verbose);\r
-                               }\r
-\r
-                               this.StartSpb.Append(IscCodes.isc_spb_res_buffers, this.pageBuffers);\r
-                               this.StartSpb.Append(IscCodes.isc_spb_res_page_size, this.pageSize);\r
-                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);\r
-\r
-                               // Start execution\r
-                               this.StartTask();\r
-\r
-                               if (this.verbose)\r
-                               {\r
-                                       this.ProcessServiceOutput();\r
-                               }\r
-                       }\r
-                       catch\r
-                       {\r
-                               throw;\r
-                       }\r
-                       finally\r
-                       {\r
-                               this.Close();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/overview/*'/>
+       public sealed class FbRestore : FbService
+       {
+               #region Fields
+
+               private ArrayList               backupFiles;
+               private FbRestoreFlags  options;
+               private bool                    verbose;
+               private int                             pageBuffers;
+               private int                             pageSize;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="BackupFiles"]/*'/>
+               public ArrayList BackupFiles
+               {
+                       get { return this.backupFiles; }
+               }
+
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="Verbose"]/*'/>
+               public bool Verbose
+               {
+                       get { return this.verbose; }
+                       set { this.verbose = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="PageBuffers"]/*'/>
+               public int PageBuffers
+               {
+                       get { return this.pageBuffers; }
+                       set { this.pageBuffers = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="PageSize"]/*'/>
+               public int PageSize
+               {
+                       get { return this.pageSize; }
+                       set
+                       {
+                               if (this.pageSize != 1024 && this.pageSize != 2048 &&
+                                       this.pageSize != 4096 && this.pageSize != 8192 &&
+                                       this.pageSize != 16384)
+                               {
+                                       throw new InvalidOperationException("Invalid page size.");
+                               }
+                               this.pageSize = value;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/property[@name="Options"]/*'/>
+               public FbRestoreFlags Options
+               {
+                       get { return this.options; }
+                       set { this.options = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/constructor[@name="ctor"]/*'/>
+               public FbRestore() : base()
+               {
+                       this.backupFiles        = new ArrayList();
+                       this.pageSize           = 4096;
+                       this.pageBuffers        = 2048;
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/class[@name="FbRestore"]/method[@name="Execute"]/*'/>
+               public void Execute()
+               {
+                       try
+                       {
+                               // Configure Spb
+                               this.StartSpb = this.CreateParameterBuffer();
+
+                               this.StartSpb.Append(IscCodes.isc_action_svc_restore);
+
+                               foreach (FbBackupFile bkpFile in backupFiles)
+                               {
+                                       this.StartSpb.Append(IscCodes.isc_spb_bkp_file, bkpFile.BackupFile);
+                               }
+
+                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+
+                               if (this.verbose)
+                               {
+                                       this.StartSpb.Append(IscCodes.isc_spb_verbose);
+                               }
+
+                               this.StartSpb.Append(IscCodes.isc_spb_res_buffers, this.pageBuffers);
+                               this.StartSpb.Append(IscCodes.isc_spb_res_page_size, this.pageSize);
+                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);
+
+                               // Start execution
+                               this.StartTask();
+
+                               if (this.verbose)
+                               {
+                                       this.ProcessServiceOutput();
+                               }
+                       }
+                       catch
+                       {
+                               throw;
+                       }
+                       finally
+                       {
+                               this.Close();
+                       }
+               }
+
+               #endregion
+       }
+}
index 367ab5504a67afe0549133076f73d513e3049ef2..0bc468d9a45db23e0f91ab1fc659715a125bffd5 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/overview/*'/>\r
-       [Flags]\r
-       public enum FbRestoreFlags\r
-       {\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="DeactivateIndexes"]/*'/>\r
-               DeactivateIndexes       = 0x0100,\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="NoShadow"]/*'/>\r
-               NoShadow                        = 0x0200,\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="NoValidity"]/*'/>\r
-               NoValidity                      = 0x0400,\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="IndividualCommit"]/*'/>\r
-               IndividualCommit        = 0x0800,\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="Replace"]/*'/>\r
-               Replace                         = 0x1000,\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="Create"]/*'/>\r
-               Create                          = 0x2000,\r
-               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="UseAllSpace"]/*'/>\r
-               UseAllSpace                     = 0x4000\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/overview/*'/>
+       [Flags]
+       public enum FbRestoreFlags
+       {
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="DeactivateIndexes"]/*'/>
+               DeactivateIndexes       = 0x0100,
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="NoShadow"]/*'/>
+               NoShadow                        = 0x0200,
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="NoValidity"]/*'/>
+               NoValidity                      = 0x0400,
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="IndividualCommit"]/*'/>
+               IndividualCommit        = 0x0800,
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="Replace"]/*'/>
+               Replace                         = 0x1000,
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="Create"]/*'/>
+               Create                          = 0x2000,
+               /// <include file='Doc/en_EN/FbRestore.xml'     path='doc/enum[@name="FbRestoreFlags"]/field[@name="UseAllSpace"]/*'/>
+               UseAllSpace                     = 0x4000
+       }
+}
index e738055fdca8009ad2dc2ce3c1c2638aef89c136..9b3aa0493987b97120a0a3d67bcf84bebab7f04c 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/overview/*'/>\r
-       public sealed class FbSecurity : FbService\r
-       {\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/property[@name="UsersDbPath"]/*'/>\r
-               public string UsersDbPath\r
-               {\r
-                       get\r
-                       {\r
-                               byte[] buffer = this.QueryService(\r
-                                       new byte[] { IscCodes.isc_info_svc_user_dbpath });\r
-                               System.Collections.ArrayList info = this.ParseQueryInfo(buffer);\r
-\r
-                               return info.Count != 0 ? (string)info[0] : null;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/constructor[@name="FbSecurity"]/*'/>\r
-               public FbSecurity() : base()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="AddUser(FbUserData)"]/*'/>\r
-               public void AddUser(FbUserData user)\r
-               {\r
-                       if (user.UserName != null && user.UserName.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("Invalid user name.");\r
-                       }\r
-                       if (user.UserPassword != null && user.UserPassword.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("Invalid user password.");\r
-                       }\r
-\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_add_user);\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, user.UserName);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_sec_password, user.UserPassword);\r
-\r
-                       if (user.FirstName != null && user.FirstName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_firstname, user.FirstName);\r
-                       }\r
-\r
-                       if (user.MiddleName != null && user.MiddleName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_middlename, user.MiddleName);\r
-                       }\r
-\r
-                       if (user.LastName != null && user.LastName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_lastname, user.LastName);\r
-                       }\r
-\r
-                       if (user.UserID != 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_userid, user.UserID);\r
-                       }\r
-\r
-                       if (user.GroupID != 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_groupid, user.GroupID);\r
-                       }\r
-\r
-                       if (user.GroupName != null && user.GroupName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_groupname, user.GroupName);\r
-                       }\r
-\r
-                       if (user.RoleName != null && user.RoleName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sql_role_name, user.RoleName);\r
-                       }\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="DeleteUser(FbUserData)"]/*'/>\r
-               public void DeleteUser(FbUserData user)\r
-               {\r
-                       if (user.UserName != null && user.UserName.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("Invalid user name.");\r
-                       }\r
-\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_delete_user);\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, user.UserName);\r
-\r
-                       if (user.RoleName != null && user.RoleName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sql_role_name, user.RoleName);\r
-                       }\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="ModifyUser(FbUserData)"]/*'/>\r
-               public void ModifyUser(FbUserData user)\r
-               {\r
-                       if (user.UserName != null && user.UserName.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("Invalid user name.");\r
-                       }\r
-                       if (user.UserPassword != null && user.UserPassword.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("Invalid user password.");\r
-                       }\r
-\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_modify_user);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, user.UserName);\r
-\r
-                       if (user.UserPassword != null && user.UserPassword.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_password, user.UserPassword);\r
-                       }\r
-\r
-                       if (user.FirstName != null && user.FirstName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_firstname, user.FirstName);\r
-                       }\r
-\r
-                       if (user.MiddleName != null && user.MiddleName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_middlename, user.MiddleName);\r
-                       }\r
-\r
-                       if (user.LastName != null && user.LastName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_lastname, user.LastName);\r
-                       }\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_spb_sec_userid, user.UserID);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_sec_groupid, user.GroupID);\r
-\r
-                       if (user.GroupName != null && user.GroupName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sec_groupname, user.GroupName);\r
-                       }\r
-\r
-                       if (user.RoleName != null && user.RoleName.Length > 0)\r
-                       {\r
-                               this.StartSpb.Append(IscCodes.isc_spb_sql_role_name, user.RoleName);\r
-                       }\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       this.Close();\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="DisplayUser(System.String)"]/*'/>\r
-               public FbUserData DisplayUser(string userName)\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_display_user);\r
-                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, userName);\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       byte[] buffer = this.QueryService(\r
-                               new byte[] { IscCodes.isc_info_svc_get_users });\r
-\r
-                       System.Collections.ArrayList info = base.ParseQueryInfo(buffer);\r
-\r
-                       this.Close();\r
-\r
-                       if (info.Count == 0)\r
-                       {\r
-                               return null;\r
-                       }\r
-\r
-                       FbUserData[] users = (FbUserData[])info[0];\r
-\r
-                       return (users != null && users.Length > 0) ? users[0] : null;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="DisplayUsers"]/*'/>\r
-               public FbUserData[] DisplayUsers()\r
-               {\r
-                       // Configure Spb\r
-                       this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                       this.StartSpb.Append(IscCodes.isc_action_svc_display_user);\r
-\r
-                       // Start execution\r
-                       this.StartTask();\r
-\r
-                       byte[] buffer = this.QueryService(\r
-                               new byte[] { IscCodes.isc_info_svc_get_users });\r
-\r
-                       System.Collections.ArrayList info = base.ParseQueryInfo(buffer);\r
-\r
-                       this.Close();\r
-\r
-                       if (info.Count == 0)\r
-                       {\r
-                               return null;\r
-                       }\r
-\r
-                       return (FbUserData[])info[0];\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/overview/*'/>
+       public sealed class FbSecurity : FbService
+       {
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/property[@name="UsersDbPath"]/*'/>
+               public string UsersDbPath
+               {
+                       get
+                       {
+                               byte[] buffer = this.QueryService(
+                                       new byte[] { IscCodes.isc_info_svc_user_dbpath });
+                               System.Collections.ArrayList info = this.ParseQueryInfo(buffer);
+
+                               return info.Count != 0 ? (string)info[0] : null;
+                       }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/constructor[@name="FbSecurity"]/*'/>
+               public FbSecurity() : base()
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="AddUser(FbUserData)"]/*'/>
+               public void AddUser(FbUserData user)
+               {
+                       if (user.UserName != null && user.UserName.Length == 0)
+                       {
+                               throw new InvalidOperationException("Invalid user name.");
+                       }
+                       if (user.UserPassword != null && user.UserPassword.Length == 0)
+                       {
+                               throw new InvalidOperationException("Invalid user password.");
+                       }
+
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_add_user);
+
+                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, user.UserName);
+                       this.StartSpb.Append(IscCodes.isc_spb_sec_password, user.UserPassword);
+
+                       if (user.FirstName != null && user.FirstName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_firstname, user.FirstName);
+                       }
+
+                       if (user.MiddleName != null && user.MiddleName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_middlename, user.MiddleName);
+                       }
+
+                       if (user.LastName != null && user.LastName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_lastname, user.LastName);
+                       }
+
+                       if (user.UserID != 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_userid, user.UserID);
+                       }
+
+                       if (user.GroupID != 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_groupid, user.GroupID);
+                       }
+
+                       if (user.GroupName != null && user.GroupName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_groupname, user.GroupName);
+                       }
+
+                       if (user.RoleName != null && user.RoleName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sql_role_name, user.RoleName);
+                       }
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="DeleteUser(FbUserData)"]/*'/>
+               public void DeleteUser(FbUserData user)
+               {
+                       if (user.UserName != null && user.UserName.Length == 0)
+                       {
+                               throw new InvalidOperationException("Invalid user name.");
+                       }
+
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_delete_user);
+
+                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, user.UserName);
+
+                       if (user.RoleName != null && user.RoleName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sql_role_name, user.RoleName);
+                       }
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="ModifyUser(FbUserData)"]/*'/>
+               public void ModifyUser(FbUserData user)
+               {
+                       if (user.UserName != null && user.UserName.Length == 0)
+                       {
+                               throw new InvalidOperationException("Invalid user name.");
+                       }
+                       if (user.UserPassword != null && user.UserPassword.Length == 0)
+                       {
+                               throw new InvalidOperationException("Invalid user password.");
+                       }
+
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_modify_user);
+                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, user.UserName);
+
+                       if (user.UserPassword != null && user.UserPassword.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_password, user.UserPassword);
+                       }
+
+                       if (user.FirstName != null && user.FirstName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_firstname, user.FirstName);
+                       }
+
+                       if (user.MiddleName != null && user.MiddleName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_middlename, user.MiddleName);
+                       }
+
+                       if (user.LastName != null && user.LastName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_lastname, user.LastName);
+                       }
+
+                       this.StartSpb.Append(IscCodes.isc_spb_sec_userid, user.UserID);
+                       this.StartSpb.Append(IscCodes.isc_spb_sec_groupid, user.GroupID);
+
+                       if (user.GroupName != null && user.GroupName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sec_groupname, user.GroupName);
+                       }
+
+                       if (user.RoleName != null && user.RoleName.Length > 0)
+                       {
+                               this.StartSpb.Append(IscCodes.isc_spb_sql_role_name, user.RoleName);
+                       }
+
+                       // Start execution
+                       this.StartTask();
+
+                       this.Close();
+               }
+
+               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="DisplayUser(System.String)"]/*'/>
+               public FbUserData DisplayUser(string userName)
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_display_user);
+                       this.StartSpb.Append(IscCodes.isc_spb_sec_username, userName);
+
+                       // Start execution
+                       this.StartTask();
+
+                       byte[] buffer = this.QueryService(
+                               new byte[] { IscCodes.isc_info_svc_get_users });
+
+                       System.Collections.ArrayList info = base.ParseQueryInfo(buffer);
+
+                       this.Close();
+
+                       if (info.Count == 0)
+                       {
+                               return null;
+                       }
+
+                       FbUserData[] users = (FbUserData[])info[0];
+
+                       return (users != null && users.Length > 0) ? users[0] : null;
+               }
+
+               /// <include file='Doc/en_EN/FbSecurity.xml' path='doc/class[@name="FbSecurity"]/method[@name="DisplayUsers"]/*'/>
+               public FbUserData[] DisplayUsers()
+               {
+                       // Configure Spb
+                       this.StartSpb = this.CreateParameterBuffer();
+
+                       this.StartSpb.Append(IscCodes.isc_action_svc_display_user);
+
+                       // Start execution
+                       this.StartTask();
+
+                       byte[] buffer = this.QueryService(
+                               new byte[] { IscCodes.isc_info_svc_get_users });
+
+                       System.Collections.ArrayList info = base.ParseQueryInfo(buffer);
+
+                       this.Close();
+
+                       if (info.Count == 0)
+                       {
+                               return null;
+                       }
+
+                       return (FbUserData[])info[0];
+               }
+
+               #endregion
+       }
+}
index 9a0d8a219be14a98b7a0c4f0df0d238a453d59d3..3dfe692388308ac5ec826c159bdd6edc9a90da77 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/overview/*'/>\r
-       public struct FbServerConfig\r
-       {\r
-               #region Fields\r
-\r
-               private int lockMemSize;\r
-               private int lockSemCount;\r
-               private int lockSignal;\r
-               private int eventMemorySize;\r
-               private int prioritySwitchDelay;\r
-               private int minMemory;\r
-               private int maxMemory;\r
-               private int lockGrantOrder;\r
-               private int anyLockMemory;\r
-               private int anyLockSemaphore;\r
-               private int anyLockSignal;\r
-               private int anyEventMemory;\r
-               private int lockHashSlots;\r
-               private int deadlockTimeout;\r
-               private int lockRequireSpins;\r
-               private int connectionTimeout;\r
-               private int dummyPacketInterval;\r
-               private int ipcMapSize;\r
-               private int defaultDbCachePages;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockMemSize"]/*'/>\r
-               public int LockMemSize\r
-               {\r
-                       get { return this.lockMemSize; }\r
-                       set { this.lockMemSize = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockSemCount"]/*'/>\r
-               public int LockSemCount\r
-               {\r
-                       get { return this.lockSemCount; }\r
-                       set { this.lockSemCount = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockSignal"]/*'/>\r
-               public int LockSignal\r
-               {\r
-                       get { return this.lockSignal; }\r
-                       set { this.lockSignal = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="EventMemorySize"]/*'/>\r
-               public int EventMemorySize\r
-               {\r
-                       get { return this.eventMemorySize; }\r
-                       set { this.eventMemorySize = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="PrioritySwitchDelay"]/*'/>\r
-               public int PrioritySwitchDelay\r
-               {\r
-                       get { return this.prioritySwitchDelay; }\r
-                       set { this.prioritySwitchDelay = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="MinMemory"]/*'/>\r
-               public int MinMemory\r
-               {\r
-                       get { return this.minMemory; }\r
-                       set { this.minMemory = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="MaxMemory"]/*'/>\r
-               public int MaxMemory\r
-               {\r
-                       get { return this.maxMemory; }\r
-                       set { this.maxMemory = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockGrantOrder"]/*'/>\r
-               public int LockGrantOrder\r
-               {\r
-                       get { return this.lockGrantOrder; }\r
-                       set { this.lockGrantOrder = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyLockMemory"]/*'/>\r
-               public int AnyLockMemory\r
-               {\r
-                       get { return this.anyLockMemory; }\r
-                       set { this.anyLockMemory = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyLockSemaphore"]/*'/>\r
-               public int AnyLockSemaphore\r
-               {\r
-                       get { return this.anyLockSemaphore; }\r
-                       set { this.anyLockSemaphore = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyLockSignal"]/*'/>\r
-               public int AnyLockSignal\r
-               {\r
-                       get { return this.anyLockSignal; }\r
-                       set { this.anyLockSignal = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyEventMemory"]/*'/>\r
-               public int AnyEventMemory\r
-               {\r
-                       get { return this.anyEventMemory; }\r
-                       set { this.anyEventMemory = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockHashSlots"]/*'/>\r
-               public int LockHashSlots\r
-               {\r
-                       get { return this.lockHashSlots; }\r
-                       set { this.lockHashSlots = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="DeadlockTimeout"]/*'/>\r
-               public int DeadlockTimeout\r
-               {\r
-                       get { return this.deadlockTimeout; }\r
-                       set { this.deadlockTimeout = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockRequireSpins"]/*'/>\r
-               public int LockRequireSpins\r
-               {\r
-                       get { return this.lockRequireSpins; }\r
-                       set { this.lockRequireSpins = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="ConnectionTimeout"]/*'/>\r
-               public int ConnectionTimeout\r
-               {\r
-                       get { return this.connectionTimeout; }\r
-                       set { this.connectionTimeout = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="DummyPacketInterval"]/*'/>\r
-               public int DummyPacketInterval\r
-               {\r
-                       get { return this.dummyPacketInterval; }\r
-                       set { this.dummyPacketInterval = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="IpcMapSize"]/*'/>\r
-               public int IpcMapSize\r
-               {\r
-                       get { return this.ipcMapSize; }\r
-                       set { this.ipcMapSize = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="DefaultDbCachePages"]/*'/>\r
-               public int DefaultDbCachePages\r
-               {\r
-                       get { return this.defaultDbCachePages; }\r
-                       set { this.defaultDbCachePages = value; }\r
-               }\r
-\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/overview/*'/>
+       public struct FbServerConfig
+       {
+               #region Fields
+
+               private int lockMemSize;
+               private int lockSemCount;
+               private int lockSignal;
+               private int eventMemorySize;
+               private int prioritySwitchDelay;
+               private int minMemory;
+               private int maxMemory;
+               private int lockGrantOrder;
+               private int anyLockMemory;
+               private int anyLockSemaphore;
+               private int anyLockSignal;
+               private int anyEventMemory;
+               private int lockHashSlots;
+               private int deadlockTimeout;
+               private int lockRequireSpins;
+               private int connectionTimeout;
+               private int dummyPacketInterval;
+               private int ipcMapSize;
+               private int defaultDbCachePages;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockMemSize"]/*'/>
+               public int LockMemSize
+               {
+                       get { return this.lockMemSize; }
+                       set { this.lockMemSize = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockSemCount"]/*'/>
+               public int LockSemCount
+               {
+                       get { return this.lockSemCount; }
+                       set { this.lockSemCount = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockSignal"]/*'/>
+               public int LockSignal
+               {
+                       get { return this.lockSignal; }
+                       set { this.lockSignal = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="EventMemorySize"]/*'/>
+               public int EventMemorySize
+               {
+                       get { return this.eventMemorySize; }
+                       set { this.eventMemorySize = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="PrioritySwitchDelay"]/*'/>
+               public int PrioritySwitchDelay
+               {
+                       get { return this.prioritySwitchDelay; }
+                       set { this.prioritySwitchDelay = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="MinMemory"]/*'/>
+               public int MinMemory
+               {
+                       get { return this.minMemory; }
+                       set { this.minMemory = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="MaxMemory"]/*'/>
+               public int MaxMemory
+               {
+                       get { return this.maxMemory; }
+                       set { this.maxMemory = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockGrantOrder"]/*'/>
+               public int LockGrantOrder
+               {
+                       get { return this.lockGrantOrder; }
+                       set { this.lockGrantOrder = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyLockMemory"]/*'/>
+               public int AnyLockMemory
+               {
+                       get { return this.anyLockMemory; }
+                       set { this.anyLockMemory = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyLockSemaphore"]/*'/>
+               public int AnyLockSemaphore
+               {
+                       get { return this.anyLockSemaphore; }
+                       set { this.anyLockSemaphore = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyLockSignal"]/*'/>
+               public int AnyLockSignal
+               {
+                       get { return this.anyLockSignal; }
+                       set { this.anyLockSignal = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="AnyEventMemory"]/*'/>
+               public int AnyEventMemory
+               {
+                       get { return this.anyEventMemory; }
+                       set { this.anyEventMemory = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockHashSlots"]/*'/>
+               public int LockHashSlots
+               {
+                       get { return this.lockHashSlots; }
+                       set { this.lockHashSlots = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="DeadlockTimeout"]/*'/>
+               public int DeadlockTimeout
+               {
+                       get { return this.deadlockTimeout; }
+                       set { this.deadlockTimeout = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="LockRequireSpins"]/*'/>
+               public int LockRequireSpins
+               {
+                       get { return this.lockRequireSpins; }
+                       set { this.lockRequireSpins = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="ConnectionTimeout"]/*'/>
+               public int ConnectionTimeout
+               {
+                       get { return this.connectionTimeout; }
+                       set { this.connectionTimeout = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="DummyPacketInterval"]/*'/>
+               public int DummyPacketInterval
+               {
+                       get { return this.dummyPacketInterval; }
+                       set { this.dummyPacketInterval = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="IpcMapSize"]/*'/>
+               public int IpcMapSize
+               {
+                       get { return this.ipcMapSize; }
+                       set { this.ipcMapSize = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbServerConfig"]/field[@name="DefaultDbCachePages"]/*'/>
+               public int DefaultDbCachePages
+               {
+                       get { return this.defaultDbCachePages; }
+                       set { this.defaultDbCachePages = value; }
+               }
+
+
+               #endregion
+       }
+}
index 17e9fc83f455ab6c80157b35a3b3f1d6b072e93b..259a5968f7ce1c709de7b771f3999c1f396bc9b2 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/overview/*'/>\r
-       public sealed class FbServerProperties : FbService\r
-       {\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="Version"]/*'/>\r
-               public int Version\r
-               {\r
-                       get { return this.GetInt32(IscCodes.isc_info_svc_version); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="ServerVersion"]/*'/>\r
-               public string ServerVersion\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_svc_server_version); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="Implementation"]/*'/>\r
-               public string Implementation\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_svc_implementation); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="RootDirectory"]/*'/>\r
-               public string RootDirectory\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_svc_get_env); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="LockManager"]/*'/>\r
-               public string LockManager\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_svc_get_env_lock); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="MessageFile"]/*'/>\r
-               public string MessageFile\r
-               {\r
-                       get { return this.GetString(IscCodes.isc_info_svc_get_env_msg); }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="DatabasesInfo"]/*'/>\r
-               public FbDatabasesInfo DatabasesInfo\r
-               {\r
-                       get\r
-                       {\r
-                               ArrayList info = this.GetInfo(IscCodes.isc_info_svc_svr_db_info);\r
-\r
-                               return info.Count != 0 ? (FbDatabasesInfo)info[0] : new FbDatabasesInfo();\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="ServerConfig"]/*'/>\r
-               public FbServerConfig ServerConfig\r
-               {\r
-                       get\r
-                       {\r
-                               ArrayList info = this.GetInfo(IscCodes.isc_info_svc_get_config);\r
-\r
-                               return info.Count != 0 ? (FbServerConfig)info[0] : new FbServerConfig();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/constructor[@name="FbServerProperties"]/*'/>\r
-               public FbServerProperties() : base()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private string GetString(int item)\r
-               {\r
-                       ArrayList info = this.GetInfo(item);\r
-\r
-                       return info.Count != 0 ? (string)info[0] : null;\r
-               }\r
-\r
-               private int GetInt32(int item)\r
-               {\r
-                       ArrayList info = this.GetInfo(item);\r
-\r
-                       return info.Count != 0 ? (int)info[0] : 0;\r
-               }\r
-\r
-               private ArrayList GetInfo(int item)\r
-               {\r
-                       return this.GetInfo(new byte[] { (byte)item });\r
-               }\r
-\r
-               private ArrayList GetInfo(byte[] items)\r
-               {\r
-                       byte[] buffer = this.QueryService(items);\r
-\r
-                       return this.ParseQueryInfo(buffer);\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/overview/*'/>
+       public sealed class FbServerProperties : FbService
+       {
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="Version"]/*'/>
+               public int Version
+               {
+                       get { return this.GetInt32(IscCodes.isc_info_svc_version); }
+               }
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="ServerVersion"]/*'/>
+               public string ServerVersion
+               {
+                       get { return this.GetString(IscCodes.isc_info_svc_server_version); }
+               }
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="Implementation"]/*'/>
+               public string Implementation
+               {
+                       get { return this.GetString(IscCodes.isc_info_svc_implementation); }
+               }
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="RootDirectory"]/*'/>
+               public string RootDirectory
+               {
+                       get { return this.GetString(IscCodes.isc_info_svc_get_env); }
+               }
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="LockManager"]/*'/>
+               public string LockManager
+               {
+                       get { return this.GetString(IscCodes.isc_info_svc_get_env_lock); }
+               }
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="MessageFile"]/*'/>
+               public string MessageFile
+               {
+                       get { return this.GetString(IscCodes.isc_info_svc_get_env_msg); }
+               }
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="DatabasesInfo"]/*'/>
+               public FbDatabasesInfo DatabasesInfo
+               {
+                       get
+                       {
+                               ArrayList info = this.GetInfo(IscCodes.isc_info_svc_svr_db_info);
+
+                               return info.Count != 0 ? (FbDatabasesInfo)info[0] : new FbDatabasesInfo();
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="ServerConfig"]/*'/>
+               public FbServerConfig ServerConfig
+               {
+                       get
+                       {
+                               ArrayList info = this.GetInfo(IscCodes.isc_info_svc_get_config);
+
+                               return info.Count != 0 ? (FbServerConfig)info[0] : new FbServerConfig();
+                       }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/constructor[@name="FbServerProperties"]/*'/>
+               public FbServerProperties() : base()
+               {
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private string GetString(int item)
+               {
+                       ArrayList info = this.GetInfo(item);
+
+                       return info.Count != 0 ? (string)info[0] : null;
+               }
+
+               private int GetInt32(int item)
+               {
+                       ArrayList info = this.GetInfo(item);
+
+                       return info.Count != 0 ? (int)info[0] : 0;
+               }
+
+               private ArrayList GetInfo(int item)
+               {
+                       return this.GetInfo(new byte[] { (byte)item });
+               }
+
+               private ArrayList GetInfo(byte[] items)
+               {
+                       byte[] buffer = this.QueryService(items);
+
+                       return this.ParseQueryInfo(buffer);
+               }
+
+               #endregion
+       }
+}
index 1cf7363ff4c372ab365e1d328138b4b5078af244..d3a9da70712ce8e76c537c2684d785d1635e0d8d 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-using System.Net;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-\r
-using FirebirdSql.Data;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/overview/*'/>\r
-       public abstract class FbService\r
-       {\r
-               #region Events\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/event[@name="ServiceOutput"]/*'/>\r
-               public event ServiceOutputEventHandler ServiceOutput;\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private IServiceManager                 svc;\r
-               private FbServiceState                  state;\r
-               private ServiceParameterBuffer  querySpb;\r
-               private FbConnectionString              csManager;\r
-               private string                                  connectionString;\r
-               private string                                  serviceName;\r
-               private int                                             queryBufferSize;\r
-\r
-               #endregion\r
-\r
-               #region Protected Fields\r
-\r
-               internal ServiceParameterBuffer StartSpb;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="State"]/*'/>\r
-               public FbServiceState State\r
-               {\r
-                       get { return state; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="ConnectionString"]/*'/>\r
-               public string ConnectionString\r
-               {\r
-                       get { return this.connectionString; }\r
-                       set\r
-                       {\r
-                               if (this.svc != null && this.state == FbServiceState.Open)\r
-                               {\r
-                                       throw new InvalidOperationException("ConnectionString cannot be modified on active service instances.");\r
-                               }\r
-\r
-                               this.csManager.Load(value);\r
-\r
-                               if (value == null)\r
-                               {\r
-                                       this.connectionString = String.Empty;\r
-                               }\r
-                               else\r
-                               {\r
-                                       this.connectionString = value;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="QueryBufferSize"]/*'/>\r
-               public int QueryBufferSize\r
-               {\r
-                       get { return this.queryBufferSize; }\r
-                       set { this.queryBufferSize = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Properties\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="Database"]/*'/>\r
-               protected string Database\r
-               {\r
-                       get { return this.csManager.Database; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/constructor[@name="ctor"]/*'/>\r
-               protected FbService()\r
-               {\r
-                       this.csManager                  = new FbConnectionString(true);\r
-                       this.state                              = FbServiceState.Closed;\r
-                       this.connectionString   = String.Empty;\r
-                       this.serviceName                = "service_mgr";\r
-                       this.queryBufferSize    = 1024;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="Open"]/*'/>\r
-               protected void Open()\r
-               {\r
-                       if (this.state != FbServiceState.Closed)\r
-                       {\r
-                               throw new InvalidOperationException("Service already Open.");\r
-                       }\r
-\r
-                       if (this.csManager.UserID == null || this.csManager.UserID.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("No user name was specified.");\r
-                       }\r
-\r
-                       if (this.csManager.Password == null || this.csManager.Password.Length == 0)\r
-                       {\r
-                               throw new InvalidOperationException("No user password was specified.");\r
-                       }\r
-\r
-                       try\r
-                       {\r
-                               if (this.svc == null)\r
-                               {\r
-                                       // New instance for     Service handler\r
-                                       this.svc = ClientFactory.CreateServiceManager(this.csManager.ServerType);\r
-                               }\r
-\r
-                               // Set service name\r
-                               string service = String.Empty;\r
-\r
-                               switch (this.csManager.ServerType)\r
-                               {\r
-                                       case 0:\r
-                                               service = this.csManager.DataSource + ":" + serviceName;\r
-                                               break;\r
-\r
-                                       default:\r
-                                               service = serviceName;\r
-                                               break;\r
-                               }\r
-\r
-                               // Initialize Services API\r
-                               this.svc.Attach(this.BuildSpb(), this.csManager.DataSource,\r
-                                                               this.csManager.Port, service);\r
-\r
-                               this.state = FbServiceState.Open;\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="Close"]/*'/>\r
-               protected void Close()\r
-               {\r
-                       if (this.state != FbServiceState.Open)\r
-                       {\r
-                               return;\r
-                       }\r
-\r
-                       try\r
-                       {\r
-                               this.svc.Detach();\r
-                               this.svc = null;\r
-\r
-                               this.state = FbServiceState.Closed;\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="startTask"]/*'/>\r
-               protected void StartTask()\r
-               {\r
-                       if (this.state == FbServiceState.Closed)\r
-                       {\r
-                               // Attach to Service Manager\r
-                               this.Open();\r
-                       }\r
-\r
-                       try\r
-                       {\r
-                               // Start service operation\r
-                               this.svc.Start(this.StartSpb);\r
-                       }\r
-                       catch (IscException ex)\r
-                       {\r
-                               throw new FbException(ex.Message, ex);\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="queryService"]/*'/>\r
-               protected byte[] QueryService(byte[] items)\r
-               {\r
-                       if (this.state == FbServiceState.Closed)\r
-                       {\r
-                               // Attach to Service Manager\r
-                               this.Open();\r
-                       }\r
-\r
-                       if (this.querySpb == null)\r
-                       {\r
-                               this.querySpb = new ServiceParameterBuffer();\r
-                       }\r
-\r
-                       // Response     buffer\r
-                       byte[] buffer = new byte[queryBufferSize];\r
-\r
-                       this.svc.Query(this.querySpb, items.Length, items, buffer.Length, buffer);\r
-\r
-                       return buffer;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="parseQueryInfo"]/*'/>\r
-               protected ArrayList ParseQueryInfo(byte[] buffer)\r
-               {\r
-                       int pos = 0;\r
-                       int length = 0;\r
-                       int type = 0;\r
-\r
-                       ArrayList items = new ArrayList();\r
-\r
-                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)\r
-                       {\r
-                               length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                               pos += 2;\r
-\r
-                               if (length != 0)\r
-                               {\r
-                                       switch (type)\r
-                                       {\r
-                                               case IscCodes.isc_info_svc_version:\r
-                                               case IscCodes.isc_info_svc_get_license_mask:\r
-                                               case IscCodes.isc_info_svc_capabilities:\r
-                                               case IscCodes.isc_info_svc_get_licensed_users:\r
-                                                       items.Add(IscHelper.VaxInteger(buffer, pos, 4));\r
-                                                       pos += length;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_svc_server_version:\r
-                                               case IscCodes.isc_info_svc_implementation:\r
-                                               case IscCodes.isc_info_svc_get_env:\r
-                                               case IscCodes.isc_info_svc_get_env_lock:\r
-                                               case IscCodes.isc_info_svc_get_env_msg:\r
-                                               case IscCodes.isc_info_svc_user_dbpath:\r
-                                               case IscCodes.isc_info_svc_line:\r
-                                               case IscCodes.isc_info_svc_to_eof:\r
-                                                       items.Add(Encoding.Default.GetString(buffer, pos, length));\r
-                                                       pos += length;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_svc_svr_db_info:\r
-                                                       items.Add(ParseDatabasesInfo(buffer, ref pos));\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_svc_get_users:\r
-                                                       items.Add(ParseUserData(buffer, ref     pos));\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_svc_get_config:\r
-                                                       items.Add(ParseServerConfig(buffer, ref pos));\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return items;\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="GetNextLine"]/*'/>\r
-               protected string GetNextLine()\r
-               {\r
-                       this.querySpb = new ServiceParameterBuffer();\r
-\r
-                       byte[] items    = new byte[] { IscCodes.isc_info_svc_line };\r
-                       byte[] buffer   = this.QueryService(items);\r
-\r
-                       ArrayList info = this.ParseQueryInfo(buffer);\r
-                       if (info.Count != 0)\r
-                       {\r
-                               return info[0] as string;\r
-                       }\r
-                       else\r
-                       {\r
-                               return null;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="ProcessServiceOutput"]/*'/>\r
-               protected void ProcessServiceOutput()\r
-               {\r
-                       string line = null;\r
-\r
-                       while ((line = this.GetNextLine()) != null)\r
-                       {\r
-                               if (this.ServiceOutput != null)\r
-                               {\r
-                                       this.ServiceOutput(this, new ServiceOutputEventArgs(line));\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Methods\r
-\r
-               internal ServiceParameterBuffer CreateParameterBuffer()\r
-               {\r
-                       if (this.svc == null)\r
-                       {\r
-                               // New instance for     Service handler\r
-                               this.svc = ClientFactory.CreateServiceManager(this.csManager.ServerType);\r
-                       }\r
-\r
-                       return this.svc.CreateParameterBuffer();\r
-               }\r
-\r
-               internal ServiceParameterBuffer BuildSpb()\r
-               {\r
-                       ServiceParameterBuffer spb = this.CreateParameterBuffer();\r
-\r
-                       // SPB configuration                            \r
-                       spb.Append(IscCodes.isc_spb_version);\r
-                       spb.Append(IscCodes.isc_spb_current_version);\r
-                       spb.Append((byte)IscCodes.isc_spb_user_name, this.csManager.UserID);\r
-                       spb.Append((byte)IscCodes.isc_spb_password, this.csManager.Password);\r
-                       spb.Append((byte)IscCodes.isc_spb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 });\r
-\r
-                       if (this.csManager.Role != null && this.csManager.Role.Length > 0)\r
-                       {\r
-                               spb.Append((byte)IscCodes.isc_spb_sql_role_name, this.csManager.Role);\r
-                       }\r
-\r
-                       return spb;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Static Methods\r
-\r
-               private static FbServerConfig ParseServerConfig(byte[] buffer, ref int pos)\r
-               {\r
-                       FbServerConfig config = new FbServerConfig();\r
-\r
-                       pos = 1;\r
-                       while (buffer[pos] != IscCodes.isc_info_flag_end)\r
-                       {\r
-                               pos++;\r
-\r
-                               int key = buffer[pos - 1];\r
-                               int keyValue = IscHelper.VaxInteger(buffer, pos, 4);\r
-\r
-                               pos += 4;\r
-\r
-                               switch (key)\r
-                               {\r
-                                       case IscCodes.ISCCFG_LOCKMEM_KEY:\r
-                                               config.LockMemSize = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_LOCKSEM_KEY:\r
-                                               config.LockSemCount = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_LOCKSIG_KEY:\r
-                                               config.LockSignal = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_EVNTMEM_KEY:\r
-                                               config.EventMemorySize = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_PRIORITY_KEY:\r
-                                               config.PrioritySwitchDelay = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_MEMMIN_KEY:\r
-                                               config.MinMemory = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_MEMMAX_KEY:\r
-                                               config.MaxMemory = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_LOCKORDER_KEY:\r
-                                               config.LockGrantOrder = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_ANYLOCKMEM_KEY:\r
-                                               config.AnyLockMemory = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_ANYLOCKSEM_KEY:\r
-                                               config.AnyLockSemaphore = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_ANYLOCKSIG_KEY:\r
-                                               config.AnyLockSignal = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_ANYEVNTMEM_KEY:\r
-                                               config.AnyEventMemory = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_LOCKHASH_KEY:\r
-                                               config.LockHashSlots = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_DEADLOCK_KEY:\r
-                                               config.DeadlockTimeout = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_LOCKSPIN_KEY:\r
-                                               config.LockRequireSpins = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_CONN_TIMEOUT_KEY:\r
-                                               config.ConnectionTimeout = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_DUMMY_INTRVL_KEY:\r
-                                               config.DummyPacketInterval = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_IPCMAP_KEY:\r
-                                               config.IpcMapSize = keyValue;\r
-                                               break;\r
-\r
-                                       case IscCodes.ISCCFG_DBCACHE_KEY:\r
-                                               config.DefaultDbCachePages = keyValue;\r
-                                               break;\r
-                               }\r
-                       }\r
-\r
-                       pos++;\r
-\r
-                       return config;\r
-               }\r
-\r
-               private static FbDatabasesInfo ParseDatabasesInfo(byte[] buffer, ref int pos)\r
-               {\r
-                       FbDatabasesInfo dbInfo = new FbDatabasesInfo();\r
-                       int type = 0;\r
-                       int length = 0;\r
-\r
-                       pos = 1;\r
-                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)\r
-                       {\r
-                               switch (type)\r
-                               {\r
-                                       case IscCodes.isc_spb_num_att:\r
-                                               dbInfo.ConnectionCount = IscHelper.VaxInteger(buffer, pos, 4);\r
-                                               pos += 4;\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_spb_num_db:\r
-                                               pos += 4;\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_spb_dbname:\r
-                                               length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                                               pos += 2;\r
-                                               dbInfo.Databases.Add(Encoding.Default.GetString(buffer, pos, length));\r
-                                               pos += length;\r
-                                               break;\r
-                               }\r
-                       }\r
-                       pos--;\r
-\r
-                       return dbInfo;\r
-               }\r
-\r
-               private static FbUserData[] ParseUserData(byte[] buffer, ref int pos)\r
-               {\r
-                       ArrayList users = new ArrayList();\r
-                       FbUserData currentUser = null;\r
-                       int type = 0;\r
-                       int length = 0;\r
-\r
-                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)\r
-                       {\r
-                               switch (type)\r
-                               {\r
-                                       case IscCodes.isc_spb_sec_username:\r
-                                               {\r
-                                                       currentUser = new FbUserData();\r
-\r
-                                                       users.Add(currentUser);\r
-\r
-                                                       length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                                                       pos += 2;\r
-                                                       currentUser.UserName = Encoding.Default.GetString(buffer, pos, length);\r
-                                                       pos += length;\r
-                                               }\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_spb_sec_firstname:\r
-                                               length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                                               pos += 2;\r
-                                               currentUser.FirstName = Encoding.Default.GetString(buffer, pos, length);\r
-                                               pos += length;\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_spb_sec_middlename:\r
-                                               length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                                               pos += 2;\r
-                                               currentUser.MiddleName = Encoding.Default.GetString(buffer, pos, length);\r
-                                               pos += length;\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_spb_sec_lastname:\r
-                                               length = IscHelper.VaxInteger(buffer, pos, 2);\r
-                                               pos += 2;\r
-                                               currentUser.LastName = Encoding.Default.GetString(buffer, pos, length);\r
-                                               pos += length;\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_spb_sec_userid:\r
-                                               currentUser.UserID = IscHelper.VaxInteger(buffer, pos, 4);\r
-                                               pos += 4;\r
-                                               break;\r
-\r
-                                       case IscCodes.isc_spb_sec_groupid:\r
-                                               currentUser.GroupID = IscHelper.VaxInteger(buffer, pos, 4);\r
-                                               pos += 4;\r
-                                               break;\r
-                               }\r
-                       }\r
-                       pos--;\r
-\r
-                       return (FbUserData[])users.ToArray(typeof(FbUserData));\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Net;
+using System.Collections;
+using System.Collections.Specialized;
+
+using FirebirdSql.Data;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/overview/*'/>
+       public abstract class FbService
+       {
+               #region Events
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/event[@name="ServiceOutput"]/*'/>
+               public event ServiceOutputEventHandler ServiceOutput;
+
+               #endregion
+
+               #region Fields
+
+               private IServiceManager                 svc;
+               private FbServiceState                  state;
+               private ServiceParameterBuffer  querySpb;
+               private FbConnectionString              csManager;
+               private string                                  connectionString;
+               private string                                  serviceName;
+               private int                                             queryBufferSize;
+
+               #endregion
+
+               #region Protected Fields
+
+               internal ServiceParameterBuffer StartSpb;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="State"]/*'/>
+               public FbServiceState State
+               {
+                       get { return state; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="ConnectionString"]/*'/>
+               public string ConnectionString
+               {
+                       get { return this.connectionString; }
+                       set
+                       {
+                               if (this.svc != null && this.state == FbServiceState.Open)
+                               {
+                                       throw new InvalidOperationException("ConnectionString cannot be modified on active service instances.");
+                               }
+
+                               this.csManager.Load(value);
+
+                               if (value == null)
+                               {
+                                       this.connectionString = String.Empty;
+                               }
+                               else
+                               {
+                                       this.connectionString = value;
+                               }
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="QueryBufferSize"]/*'/>
+               public int QueryBufferSize
+               {
+                       get { return this.queryBufferSize; }
+                       set { this.queryBufferSize = value; }
+               }
+
+               #endregion
+
+               #region Protected Properties
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/property[@name="Database"]/*'/>
+               protected string Database
+               {
+                       get { return this.csManager.Database; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/constructor[@name="ctor"]/*'/>
+               protected FbService()
+               {
+                       this.csManager                  = new FbConnectionString(true);
+                       this.state                              = FbServiceState.Closed;
+                       this.connectionString   = String.Empty;
+                       this.serviceName                = "service_mgr";
+                       this.queryBufferSize    = 1024;
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="Open"]/*'/>
+               protected void Open()
+               {
+                       if (this.state != FbServiceState.Closed)
+                       {
+                               throw new InvalidOperationException("Service already Open.");
+                       }
+
+                       if (this.csManager.UserID == null || this.csManager.UserID.Length == 0)
+                       {
+                               throw new InvalidOperationException("No user name was specified.");
+                       }
+
+                       if (this.csManager.Password == null || this.csManager.Password.Length == 0)
+                       {
+                               throw new InvalidOperationException("No user password was specified.");
+                       }
+
+                       try
+                       {
+                               if (this.svc == null)
+                               {
+                                       // New instance for     Service handler
+                                       this.svc = ClientFactory.CreateServiceManager(this.csManager.ServerType);
+                               }
+
+                               // Set service name
+                               string service = String.Empty;
+
+                               switch (this.csManager.ServerType)
+                               {
+                                       case 0:
+                                               service = this.csManager.DataSource + ":" + serviceName;
+                                               break;
+
+                                       default:
+                                               service = serviceName;
+                                               break;
+                               }
+
+                               // Initialize Services API
+                               this.svc.Attach(this.BuildSpb(), this.csManager.DataSource,
+                                                               this.csManager.Port, service);
+
+                               this.state = FbServiceState.Open;
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="Close"]/*'/>
+               protected void Close()
+               {
+                       if (this.state != FbServiceState.Open)
+                       {
+                               return;
+                       }
+
+                       try
+                       {
+                               this.svc.Detach();
+                               this.svc = null;
+
+                               this.state = FbServiceState.Closed;
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="startTask"]/*'/>
+               protected void StartTask()
+               {
+                       if (this.state == FbServiceState.Closed)
+                       {
+                               // Attach to Service Manager
+                               this.Open();
+                       }
+
+                       try
+                       {
+                               // Start service operation
+                               this.svc.Start(this.StartSpb);
+                       }
+                       catch (IscException ex)
+                       {
+                               throw new FbException(ex.Message, ex);
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="queryService"]/*'/>
+               protected byte[] QueryService(byte[] items)
+               {
+                       if (this.state == FbServiceState.Closed)
+                       {
+                               // Attach to Service Manager
+                               this.Open();
+                       }
+
+                       if (this.querySpb == null)
+                       {
+                               this.querySpb = new ServiceParameterBuffer();
+                       }
+
+                       // Response     buffer
+                       byte[] buffer = new byte[queryBufferSize];
+
+                       this.svc.Query(this.querySpb, items.Length, items, buffer.Length, buffer);
+
+                       return buffer;
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="parseQueryInfo"]/*'/>
+               protected ArrayList ParseQueryInfo(byte[] buffer)
+               {
+                       int pos = 0;
+                       int length = 0;
+                       int type = 0;
+
+                       ArrayList items = new ArrayList();
+
+                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)
+                       {
+                               length = IscHelper.VaxInteger(buffer, pos, 2);
+                               pos += 2;
+
+                               if (length != 0)
+                               {
+                                       switch (type)
+                                       {
+                                               case IscCodes.isc_info_svc_version:
+                                               case IscCodes.isc_info_svc_get_license_mask:
+                                               case IscCodes.isc_info_svc_capabilities:
+                                               case IscCodes.isc_info_svc_get_licensed_users:
+                                                       items.Add(IscHelper.VaxInteger(buffer, pos, 4));
+                                                       pos += length;
+                                                       break;
+
+                                               case IscCodes.isc_info_svc_server_version:
+                                               case IscCodes.isc_info_svc_implementation:
+                                               case IscCodes.isc_info_svc_get_env:
+                                               case IscCodes.isc_info_svc_get_env_lock:
+                                               case IscCodes.isc_info_svc_get_env_msg:
+                                               case IscCodes.isc_info_svc_user_dbpath:
+                                               case IscCodes.isc_info_svc_line:
+                                               case IscCodes.isc_info_svc_to_eof:
+                                                       items.Add(Encoding.Default.GetString(buffer, pos, length));
+                                                       pos += length;
+                                                       break;
+
+                                               case IscCodes.isc_info_svc_svr_db_info:
+                                                       items.Add(ParseDatabasesInfo(buffer, ref pos));
+                                                       break;
+
+                                               case IscCodes.isc_info_svc_get_users:
+                                                       items.Add(ParseUserData(buffer, ref     pos));
+                                                       break;
+
+                                               case IscCodes.isc_info_svc_get_config:
+                                                       items.Add(ParseServerConfig(buffer, ref pos));
+                                                       break;
+                                       }
+                               }
+                       }
+
+                       return items;
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="GetNextLine"]/*'/>
+               protected string GetNextLine()
+               {
+                       this.querySpb = new ServiceParameterBuffer();
+
+                       byte[] items    = new byte[] { IscCodes.isc_info_svc_line };
+                       byte[] buffer   = this.QueryService(items);
+
+                       ArrayList info = this.ParseQueryInfo(buffer);
+                       if (info.Count != 0)
+                       {
+                               return info[0] as string;
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbService"]/method[@name="ProcessServiceOutput"]/*'/>
+               protected void ProcessServiceOutput()
+               {
+                       string line = null;
+
+                       while ((line = this.GetNextLine()) != null)
+                       {
+                               if (this.ServiceOutput != null)
+                               {
+                                       this.ServiceOutput(this, new ServiceOutputEventArgs(line));
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Internal Methods
+
+               internal ServiceParameterBuffer CreateParameterBuffer()
+               {
+                       if (this.svc == null)
+                       {
+                               // New instance for     Service handler
+                               this.svc = ClientFactory.CreateServiceManager(this.csManager.ServerType);
+                       }
+
+                       return this.svc.CreateParameterBuffer();
+               }
+
+               internal ServiceParameterBuffer BuildSpb()
+               {
+                       ServiceParameterBuffer spb = this.CreateParameterBuffer();
+
+                       // SPB configuration                            
+                       spb.Append(IscCodes.isc_spb_version);
+                       spb.Append(IscCodes.isc_spb_current_version);
+                       spb.Append((byte)IscCodes.isc_spb_user_name, this.csManager.UserID);
+                       spb.Append((byte)IscCodes.isc_spb_password, this.csManager.Password);
+                       spb.Append((byte)IscCodes.isc_spb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 });
+
+                       if (this.csManager.Role != null && this.csManager.Role.Length > 0)
+                       {
+                               spb.Append((byte)IscCodes.isc_spb_sql_role_name, this.csManager.Role);
+                       }
+
+                       return spb;
+               }
+
+               #endregion
+
+               #region Private Static Methods
+
+               private static FbServerConfig ParseServerConfig(byte[] buffer, ref int pos)
+               {
+                       FbServerConfig config = new FbServerConfig();
+
+                       pos = 1;
+                       while (buffer[pos] != IscCodes.isc_info_flag_end)
+                       {
+                               pos++;
+
+                               int key = buffer[pos - 1];
+                               int keyValue = IscHelper.VaxInteger(buffer, pos, 4);
+
+                               pos += 4;
+
+                               switch (key)
+                               {
+                                       case IscCodes.ISCCFG_LOCKMEM_KEY:
+                                               config.LockMemSize = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_LOCKSEM_KEY:
+                                               config.LockSemCount = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_LOCKSIG_KEY:
+                                               config.LockSignal = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_EVNTMEM_KEY:
+                                               config.EventMemorySize = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_PRIORITY_KEY:
+                                               config.PrioritySwitchDelay = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_MEMMIN_KEY:
+                                               config.MinMemory = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_MEMMAX_KEY:
+                                               config.MaxMemory = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_LOCKORDER_KEY:
+                                               config.LockGrantOrder = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_ANYLOCKMEM_KEY:
+                                               config.AnyLockMemory = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_ANYLOCKSEM_KEY:
+                                               config.AnyLockSemaphore = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_ANYLOCKSIG_KEY:
+                                               config.AnyLockSignal = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_ANYEVNTMEM_KEY:
+                                               config.AnyEventMemory = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_LOCKHASH_KEY:
+                                               config.LockHashSlots = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_DEADLOCK_KEY:
+                                               config.DeadlockTimeout = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_LOCKSPIN_KEY:
+                                               config.LockRequireSpins = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_CONN_TIMEOUT_KEY:
+                                               config.ConnectionTimeout = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_DUMMY_INTRVL_KEY:
+                                               config.DummyPacketInterval = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_IPCMAP_KEY:
+                                               config.IpcMapSize = keyValue;
+                                               break;
+
+                                       case IscCodes.ISCCFG_DBCACHE_KEY:
+                                               config.DefaultDbCachePages = keyValue;
+                                               break;
+                               }
+                       }
+
+                       pos++;
+
+                       return config;
+               }
+
+               private static FbDatabasesInfo ParseDatabasesInfo(byte[] buffer, ref int pos)
+               {
+                       FbDatabasesInfo dbInfo = new FbDatabasesInfo();
+                       int type = 0;
+                       int length = 0;
+
+                       pos = 1;
+                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)
+                       {
+                               switch (type)
+                               {
+                                       case IscCodes.isc_spb_num_att:
+                                               dbInfo.ConnectionCount = IscHelper.VaxInteger(buffer, pos, 4);
+                                               pos += 4;
+                                               break;
+
+                                       case IscCodes.isc_spb_num_db:
+                                               pos += 4;
+                                               break;
+
+                                       case IscCodes.isc_spb_dbname:
+                                               length = IscHelper.VaxInteger(buffer, pos, 2);
+                                               pos += 2;
+                                               dbInfo.Databases.Add(Encoding.Default.GetString(buffer, pos, length));
+                                               pos += length;
+                                               break;
+                               }
+                       }
+                       pos--;
+
+                       return dbInfo;
+               }
+
+               private static FbUserData[] ParseUserData(byte[] buffer, ref int pos)
+               {
+                       ArrayList users = new ArrayList();
+                       FbUserData currentUser = null;
+                       int type = 0;
+                       int length = 0;
+
+                       while ((type = buffer[pos++]) != IscCodes.isc_info_end)
+                       {
+                               switch (type)
+                               {
+                                       case IscCodes.isc_spb_sec_username:
+                                               {
+                                                       currentUser = new FbUserData();
+
+                                                       users.Add(currentUser);
+
+                                                       length = IscHelper.VaxInteger(buffer, pos, 2);
+                                                       pos += 2;
+                                                       currentUser.UserName = Encoding.Default.GetString(buffer, pos, length);
+                                                       pos += length;
+                                               }
+                                               break;
+
+                                       case IscCodes.isc_spb_sec_firstname:
+                                               length = IscHelper.VaxInteger(buffer, pos, 2);
+                                               pos += 2;
+                                               currentUser.FirstName = Encoding.Default.GetString(buffer, pos, length);
+                                               pos += length;
+                                               break;
+
+                                       case IscCodes.isc_spb_sec_middlename:
+                                               length = IscHelper.VaxInteger(buffer, pos, 2);
+                                               pos += 2;
+                                               currentUser.MiddleName = Encoding.Default.GetString(buffer, pos, length);
+                                               pos += length;
+                                               break;
+
+                                       case IscCodes.isc_spb_sec_lastname:
+                                               length = IscHelper.VaxInteger(buffer, pos, 2);
+                                               pos += 2;
+                                               currentUser.LastName = Encoding.Default.GetString(buffer, pos, length);
+                                               pos += length;
+                                               break;
+
+                                       case IscCodes.isc_spb_sec_userid:
+                                               currentUser.UserID = IscHelper.VaxInteger(buffer, pos, 4);
+                                               pos += 4;
+                                               break;
+
+                                       case IscCodes.isc_spb_sec_groupid:
+                                               currentUser.GroupID = IscHelper.VaxInteger(buffer, pos, 4);
+                                               pos += 4;
+                                               break;
+                               }
+                       }
+                       pos--;
+
+                       return (FbUserData[])users.ToArray(typeof(FbUserData));
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index 8f77f736255f6b6b526c5387f7f112463d6da18e..5cd0d60fcec734c55fe34882971ea82d566a742e 100644 (file)
@@ -1,39 +1,39 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-using System.Net;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-\r
-using FirebirdSql.Data;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbService.xml'     path='doc/enum[@name="FbServiceState"]/overview/*'/>\r
-       public enum FbServiceState\r
-       {\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/enum[@name="FbServiceState"]/field[@name="Closed"]/*'/>\r
-               Closed = 0,\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/enum[@name="FbServiceState"]/field[@name="Open"]/*'/>\r
-               Open = 1\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Net;
+using System.Collections;
+using System.Collections.Specialized;
+
+using FirebirdSql.Data;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbService.xml'     path='doc/enum[@name="FbServiceState"]/overview/*'/>
+       public enum FbServiceState
+       {
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/enum[@name="FbServiceState"]/field[@name="Closed"]/*'/>
+               Closed = 0,
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/enum[@name="FbServiceState"]/field[@name="Open"]/*'/>
+               Open = 1
+       }
+}
index aa3e6b3293897297e8f58605b9b3373c6e8fc3ec..5a4ece3554059c086b291f6d5b0d2663d68533b0 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/overview/*'/>\r
-       public enum FbShutdownMode\r
-       {\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/field[@name="Forced"]/*'/>\r
-               Forced,\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/field[@name="DenyTransaction"]/*'/>\r
-               DenyTransaction,\r
-               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/field[@name="DenyConnection"]/*'/>\r
-               DenyConnection\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/overview/*'/>
+       public enum FbShutdownMode
+       {
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/field[@name="Forced"]/*'/>
+               Forced,
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/field[@name="DenyTransaction"]/*'/>
+               DenyTransaction,
+               /// <include file='Doc/en_EN/FbConfiguration.xml' path='doc/enum[@name="FbShutdownMode"]/field[@name="DenyConnection"]/*'/>
+               DenyConnection
+       }
+}
index cc3452225f32a80ec3e5df36cfd09d7c528d2332..7a28daefa913c1aeb310120c79e18bf00155e2d9 100644 (file)
@@ -1,86 +1,86 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/overview/*'/>\r
-       public sealed class FbStatistical : FbService\r
-       {\r
-               #region Fields\r
-\r
-               private FbStatisticalFlags options;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/property[@name="Options"]/*'/>\r
-               public FbStatisticalFlags Options\r
-               {\r
-                       get { return this.options; }\r
-                       set { this.options = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/constructor[@name="FbStatistical"]/*'/>\r
-               public FbStatistical() : base()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/constructor[@name="Execute"]/*'/>\r
-               public void Execute()\r
-               {\r
-                       try\r
-                       {\r
-                               this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                               // Configure Spb\r
-                               this.StartSpb.Append(IscCodes.isc_action_svc_db_stats);\r
-                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);\r
-\r
-                               // Start execution\r
-                               this.StartTask();\r
-\r
-                               // Process service output\r
-                               this.ProcessServiceOutput();\r
-                       }\r
-                       catch\r
-                       {\r
-                               throw;\r
-                       }\r
-                       finally\r
-                       {\r
-                               this.Close();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/overview/*'/>
+       public sealed class FbStatistical : FbService
+       {
+               #region Fields
+
+               private FbStatisticalFlags options;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/property[@name="Options"]/*'/>
+               public FbStatisticalFlags Options
+               {
+                       get { return this.options; }
+                       set { this.options = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/constructor[@name="FbStatistical"]/*'/>
+               public FbStatistical() : base()
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/constructor[@name="Execute"]/*'/>
+               public void Execute()
+               {
+                       try
+                       {
+                               this.StartSpb = this.CreateParameterBuffer();
+
+                               // Configure Spb
+                               this.StartSpb.Append(IscCodes.isc_action_svc_db_stats);
+                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);
+
+                               // Start execution
+                               this.StartTask();
+
+                               // Process service output
+                               this.ProcessServiceOutput();
+                       }
+                       catch
+                       {
+                               throw;
+                       }
+                       finally
+                       {
+                               this.Close();
+                       }
+               }
+
+               #endregion
+       }
+}
index bdad25c6bd3f478d2fdfd326ef8581d5e4f2006a..ce95c666afd950dd638a50d629cd3ed1ba36be22 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/overview/*'/>\r
-       [Flags]\r
-       public enum FbStatisticalFlags\r
-       {\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="DataPages"]/*'/>\r
-               DataPages               = 0x01,\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="DatabaseLog"]/*'/>\r
-               DatabaseLog             = 0x02,\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="HeaderPages"]/*'/>\r
-               HeaderPages             = 0x04,\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="IndexPages"]/*'/>\r
-               IndexPages              = 0x08,\r
-               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="SystemTablesRelations"]/*'/>\r
-               SystemTablesRelations = 0x10,\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/overview/*'/>
+       [Flags]
+       public enum FbStatisticalFlags
+       {
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="DataPages"]/*'/>
+               DataPages               = 0x01,
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="DatabaseLog"]/*'/>
+               DatabaseLog             = 0x02,
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="HeaderPages"]/*'/>
+               HeaderPages             = 0x04,
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="IndexPages"]/*'/>
+               IndexPages              = 0x08,
+               /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="SystemTablesRelations"]/*'/>
+               SystemTablesRelations = 0x10,
+       }
+}
index e4663b28d55bce73c8d763f474b896ccbf442136..eac74cacdbbd4f004817bb9a14648dc5676fff4b 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbUserData"]/overview/*'/>\r
-       public sealed class FbUserData\r
-       {\r
-               #region Fields\r
-\r
-               private string  userName;\r
-               private string  firstName;\r
-               private string  lastName;\r
-               private string  middleName;\r
-               private string  userPassword;\r
-               private string  groupName;\r
-               private string  roleName;\r
-               private int             userID;\r
-               private int             groupID;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="UserName"]/*'/>\r
-               public string UserName\r
-               {\r
-                       get { return this.userName; }\r
-                       set\r
-                       {\r
-                               if (value == null)\r
-                               {\r
-                                       throw new InvalidOperationException("The user name cannot be null.");\r
-                               }\r
-                               if (value.Length > 31)\r
-                               {\r
-                                       throw new InvalidOperationException("The user name cannot have more than 31 characters.");\r
-                               }\r
-\r
-                               this.userName = value;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="UserPassword"]/*'/>\r
-               public string UserPassword\r
-               {\r
-                       get { return this.userPassword; }\r
-                       set\r
-                       {\r
-                               if (value == null)\r
-                               {\r
-                                       throw new InvalidOperationException("The user password cannot be null.");\r
-                               }\r
-                               if (value.Length > 31)\r
-                               {\r
-                                       throw new InvalidOperationException("The user password cannot have more than 31 characters.");\r
-                               }\r
-\r
-                               this.userPassword = value;\r
-                       }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="FirstName"]/*'/>           \r
-               public string FirstName\r
-               {\r
-                       get { return this.firstName; }\r
-                       set { this.firstName = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="LastName"]/*'/>\r
-               public string LastName\r
-               {\r
-                       get { return this.lastName; }\r
-                       set { this.lastName = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="MiddleName"]/*'/>\r
-               public string MiddleName\r
-               {\r
-                       get { return this.middleName; }\r
-                       set { this.middleName = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="UserID"]/*'/>\r
-               public int UserID\r
-               {\r
-                       get { return this.userID; }\r
-                       set { this.userID = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="GroupID"]/*'/>\r
-               public int GroupID\r
-               {\r
-                       get { return this.groupID; }\r
-                       set { this.groupID = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="GroupName"]/*'/>\r
-               public string GroupName\r
-               {\r
-                       get { return this.groupName; }\r
-                       set { this.groupName = value; }\r
-               }\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="RoleName"]/*'/>\r
-               public string RoleName\r
-               {\r
-                       get { return this.roleName; }\r
-                       set { this.roleName = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbUserData"]/constructor[@name="FbUserData"]/*'/>\r
-               public FbUserData()\r
-               {\r
-                       this.userName           = String.Empty;\r
-                       this.firstName          = String.Empty;\r
-                       this.lastName           = String.Empty;\r
-                       this.middleName         = String.Empty;\r
-                       this.userPassword       = String.Empty;\r
-                       this.roleName           = String.Empty;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbUserData"]/overview/*'/>
+       public sealed class FbUserData
+       {
+               #region Fields
+
+               private string  userName;
+               private string  firstName;
+               private string  lastName;
+               private string  middleName;
+               private string  userPassword;
+               private string  groupName;
+               private string  roleName;
+               private int             userID;
+               private int             groupID;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="UserName"]/*'/>
+               public string UserName
+               {
+                       get { return this.userName; }
+                       set
+                       {
+                               if (value == null)
+                               {
+                                       throw new InvalidOperationException("The user name cannot be null.");
+                               }
+                               if (value.Length > 31)
+                               {
+                                       throw new InvalidOperationException("The user name cannot have more than 31 characters.");
+                               }
+
+                               this.userName = value;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="UserPassword"]/*'/>
+               public string UserPassword
+               {
+                       get { return this.userPassword; }
+                       set
+                       {
+                               if (value == null)
+                               {
+                                       throw new InvalidOperationException("The user password cannot be null.");
+                               }
+                               if (value.Length > 31)
+                               {
+                                       throw new InvalidOperationException("The user password cannot have more than 31 characters.");
+                               }
+
+                               this.userPassword = value;
+                       }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="FirstName"]/*'/>           
+               public string FirstName
+               {
+                       get { return this.firstName; }
+                       set { this.firstName = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="LastName"]/*'/>
+               public string LastName
+               {
+                       get { return this.lastName; }
+                       set { this.lastName = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="MiddleName"]/*'/>
+               public string MiddleName
+               {
+                       get { return this.middleName; }
+                       set { this.middleName = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="UserID"]/*'/>
+               public int UserID
+               {
+                       get { return this.userID; }
+                       set { this.userID = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="GroupID"]/*'/>
+               public int GroupID
+               {
+                       get { return this.groupID; }
+                       set { this.groupID = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="GroupName"]/*'/>
+               public string GroupName
+               {
+                       get { return this.groupName; }
+                       set { this.groupName = value; }
+               }
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/struct[@name="FbUserData"]/property[@name="RoleName"]/*'/>
+               public string RoleName
+               {
+                       get { return this.roleName; }
+                       set { this.roleName = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="FbUserData"]/constructor[@name="FbUserData"]/*'/>
+               public FbUserData()
+               {
+                       this.userName           = String.Empty;
+                       this.firstName          = String.Empty;
+                       this.lastName           = String.Empty;
+                       this.middleName         = String.Empty;
+                       this.userPassword       = String.Empty;
+                       this.roleName           = String.Empty;
+               }
+
+               #endregion
+       }
+}
index def3b029d75f1e1175da90ccaa6ca69626cb720b..68baf74aff4d73c8f4611be371e361da7319b811 100644 (file)
@@ -1,86 +1,86 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/overview/*'/>\r
-       public sealed class FbValidation : FbService\r
-       {\r
-               #region Fields\r
-\r
-               private FbValidationFlags options;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/property[@name="Options"]/*'/>\r
-               public FbValidationFlags Options\r
-               {\r
-                       get { return this.options; }\r
-                       set { this.options = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/constructor[@name="ctor"]/*'/>\r
-               public FbValidation() : base()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/method[@name="Execute"]/*'/>\r
-               public void Execute()\r
-               {\r
-                       try\r
-                       {\r
-                               this.StartSpb = this.CreateParameterBuffer();\r
-\r
-                               // Configure Spb\r
-                               this.StartSpb.Append(IscCodes.isc_action_svc_repair);\r
-                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);\r
-                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);\r
-\r
-                               // Start execution\r
-                               this.StartTask();\r
-\r
-                               // Process service output\r
-                               this.ProcessServiceOutput();\r
-                       }\r
-                       catch\r
-                       {\r
-                               throw;\r
-                       }\r
-                       finally\r
-                       {\r
-                               this.Close();\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/overview/*'/>
+       public sealed class FbValidation : FbService
+       {
+               #region Fields
+
+               private FbValidationFlags options;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/property[@name="Options"]/*'/>
+               public FbValidationFlags Options
+               {
+                       get { return this.options; }
+                       set { this.options = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/constructor[@name="ctor"]/*'/>
+               public FbValidation() : base()
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/method[@name="Execute"]/*'/>
+               public void Execute()
+               {
+                       try
+                       {
+                               this.StartSpb = this.CreateParameterBuffer();
+
+                               // Configure Spb
+                               this.StartSpb.Append(IscCodes.isc_action_svc_repair);
+                               this.StartSpb.Append(IscCodes.isc_spb_dbname, this.Database);
+                               this.StartSpb.Append(IscCodes.isc_spb_options, (int)this.options);
+
+                               // Start execution
+                               this.StartTask();
+
+                               // Process service output
+                               this.ProcessServiceOutput();
+                       }
+                       catch
+                       {
+                               throw;
+                       }
+                       finally
+                       {
+                               this.Close();
+                       }
+               }
+
+               #endregion
+       }
+}
index cebad8e6d64d03945e4705e3b625d5ca8960c64b..91371cbb70d4fefb3fe46b6b8abf7e44c88e568b 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/overview/*'/>\r
-       [Flags]\r
-       public enum FbValidationFlags\r
-       {\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="ValidateDatabase"]/*'/>\r
-               ValidateDatabase        = 0x01,\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="SweepDatabase"]/*'/>\r
-               SweepDatabase           = 0x02,\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="MendDatabase"]/*'/>\r
-               MendDatabase            = 0x04,\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="CheckDatabase"]/*'/>\r
-               CheckDatabase           = 0x10,\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="IgnoreChecksum"]/*'/>\r
-               IgnoreChecksum          = 0x20,\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="KillShadows"]/*'/>\r
-               KillShadows                     = 0x40,\r
-               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="Full"]/*'/>\r
-               Full                            = 0x80\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/overview/*'/>
+       [Flags]
+       public enum FbValidationFlags
+       {
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="ValidateDatabase"]/*'/>
+               ValidateDatabase        = 0x01,
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="SweepDatabase"]/*'/>
+               SweepDatabase           = 0x02,
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="MendDatabase"]/*'/>
+               MendDatabase            = 0x04,
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="CheckDatabase"]/*'/>
+               CheckDatabase           = 0x10,
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="IgnoreChecksum"]/*'/>
+               IgnoreChecksum          = 0x20,
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="KillShadows"]/*'/>
+               KillShadows                     = 0x40,
+               /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="Full"]/*'/>
+               Full                            = 0x80
+       }
+}
index fa9ab08608d3f4d1071a1592bd3274b2f362b6de..7f994a6ceba8a607e926bfb131f447500a17912e 100644 (file)
@@ -1,59 +1,59 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-\r
-namespace FirebirdSql.Data.Firebird.Services\r
-{\r
-       #region Delegates\r
-\r
-       /// <include file='Doc/en_EN/FbService.xml'     path='doc/delegate[@name="ServiceOutputEventHandler(System.Object,ServiceOutputEventArgs)"]/*'/>\r
-       public delegate void ServiceOutputEventHandler(object sender, ServiceOutputEventArgs e);\r
-\r
-       #endregion\r
-\r
-       /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="ServiceOutputEventArgs"]/overview/*'/>\r
-       public sealed class ServiceOutputEventArgs : EventArgs\r
-       {\r
-               #region Fields\r
-\r
-               private string message;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="ServiceOutputEventArgs"]/property[@name="Message"]/*'/>\r
-               public string Message\r
-               {\r
-                       get { return this.message; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="ServiceOutputEventArgs"]/constructor[@name="ctor(System.String)"]/*'/>\r
-               public ServiceOutputEventArgs(string message)\r
-               {\r
-                       this.message = message;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+
+namespace FirebirdSql.Data.Firebird.Services
+{
+       #region Delegates
+
+       /// <include file='Doc/en_EN/FbService.xml'     path='doc/delegate[@name="ServiceOutputEventHandler(System.Object,ServiceOutputEventArgs)"]/*'/>
+       public delegate void ServiceOutputEventHandler(object sender, ServiceOutputEventArgs e);
+
+       #endregion
+
+       /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="ServiceOutputEventArgs"]/overview/*'/>
+       public sealed class ServiceOutputEventArgs : EventArgs
+       {
+               #region Fields
+
+               private string message;
+
+               #endregion
+
+               #region Properties
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="ServiceOutputEventArgs"]/property[@name="Message"]/*'/>
+               public string Message
+               {
+                       get { return this.message; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               /// <include file='Doc/en_EN/FbService.xml'     path='doc/class[@name="ServiceOutputEventArgs"]/constructor[@name="ctor(System.String)"]/*'/>
+               public ServiceOutputEventArgs(string message)
+               {
+                       this.message = message;
+               }
+
+               #endregion
+       }
+}
index 506481f0f24a48f576a7ee62825e2e1be2845b7f..7dd90244ab83aa88e020838e2451f077977b189f 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Net;\r
-using System.Text;\r
-using System.IO;\r
-using System.Collections;\r
-using System.Globalization;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal sealed class GdsArray : ArrayBase\r
-       {\r
-               #region Fields\r
-\r
-               private long                    handle;\r
-               private GdsDatabase             db;\r
-               private GdsTransaction  transaction;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public override long Handle\r
-               {\r
-                       get { return this.handle; }\r
-                       set { this.handle = value; }\r
-               }\r
-\r
-               public override IDatabase DB\r
-               {\r
-                       get { return this.db; }\r
-                       set { this.db = (GdsDatabase)value; }\r
-               }\r
-\r
-               public override ITransaction Transaction\r
-               {\r
-                       get { return this.transaction; }\r
-                       set { this.transaction = (GdsTransaction)value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsArray(ArrayDesc descriptor) : base(descriptor)\r
-               {\r
-               }\r
-\r
-               public GdsArray(IDatabase db, ITransaction transaction, string tableName, string fieldName)\r
-                       : this(db, transaction, -1, tableName, fieldName)\r
-               {\r
-               }\r
-\r
-               public GdsArray(IDatabase db, ITransaction transaction, long handle, string tableName, string fieldName)\r
-                       : base(tableName, fieldName)\r
-               {\r
-                       if (!(db is GdsDatabase))\r
-                       {\r
-                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");\r
-                       }\r
-\r
-                       if (!(transaction is GdsTransaction))\r
-                       {\r
-                               throw new ArgumentException("Specified argument is not of GdsTransaction type.");\r
-                       }\r
-\r
-                       this.db                         = (GdsDatabase)db;\r
-                       this.transaction        = (GdsTransaction)transaction;\r
-                       this.handle                     = handle;\r
-\r
-                       this.LookupBounds();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public override byte[] GetSlice(int sliceLength)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       byte[] sdl = this.GenerateSDL(this.Descriptor);\r
-\r
-                                       this.db.Send.Write(IscCodes.op_get_slice);      // Op code\r
-                                       this.db.Send.Write(this.transaction.Handle);// Transaction\r
-                                       this.db.Send.Write(this.handle);                        // Array id\r
-                                       this.db.Send.Write(sliceLength);                        // Slice length\r
-                                       this.db.Send.WriteBuffer(sdl);                          // Slice descriptor     language\r
-                                       this.db.Send.Write(String.Empty);                       // Slice parameters                                     \r
-                                       this.db.Send.Write(0);                                          // Slice proper\r
-                                       this.db.Send.Flush();\r
-\r
-                                       return this.ReceiveSliceResponse(this.Descriptor);\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public override void PutSlice(System.Array sourceArray, int sliceLength)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       byte[] sdl = this.GenerateSDL(this.Descriptor);\r
-                                       byte[] slice = this.EncodeSliceArray(sourceArray);\r
-\r
-                                       this.db.Send.Write(IscCodes.op_put_slice);      // Op code\r
-                                       this.db.Send.Write(this.transaction.Handle);// Transaction\r
-                                       this.db.Send.Write((long)0);                            // Array Handle\r
-                                       this.db.Send.Write(sliceLength);                        // Slice length\r
-                                       this.db.Send.WriteBuffer(sdl);                          // Slice descriptor     language\r
-                                       this.db.Send.Write(String.Empty);                       // Slice parameters\r
-                                       this.db.Send.Write(sliceLength);                        // Slice length\r
-                                       this.db.Send.Write(slice, 0, slice.Length);     // Slice proper\r
-                                       this.db.Send.Flush();\r
-\r
-                                       GdsResponse r = this.db.ReadGenericResponse();\r
-\r
-                                       this.handle = r.BlobId;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override System.Array DecodeSlice(byte[] slice)\r
-               {\r
-                       DbDataType      dbType          = DbDataType.Array;\r
-                       Array           sliceData       = null;\r
-                       Array           tempData        = null;\r
-                       Type            systemType      = this.GetSystemType();\r
-                       int[]           lengths         = new int[this.Descriptor.Dimensions];\r
-                       int[]           lowerBounds = new int[this.Descriptor.Dimensions];\r
-                       int                     type            = 0;\r
-                       int                     index           = 0;\r
-\r
-                       // Get upper and lower bounds of each dimension\r
-                       for (int i = 0; i < this.Descriptor.Dimensions; i++)\r
-                       {\r
-                               lowerBounds[i]  = this.Descriptor.Bounds[i].LowerBound;\r
-                               lengths[i]              = this.Descriptor.Bounds[i].UpperBound;\r
-\r
-                               if (lowerBounds[i] == 0)\r
-                               {\r
-                                       lengths[i]++;\r
-                               }\r
-                       }\r
-\r
-                       // Create arrays\r
-#if    (NETCF)\r
-                       sliceData = Array.CreateInstance(systemType, lengths);\r
-#else\r
-                       sliceData = Array.CreateInstance(systemType, lengths, lowerBounds);\r
-#endif\r
-                       tempData = Array.CreateInstance(systemType, sliceData.Length);\r
-\r
-                       // Infer Firebird and Db datatypes\r
-                       type    = TypeHelper.GetFbType(this.Descriptor.DataType);\r
-                       dbType  = TypeHelper.GetDbDataType(this.Descriptor.DataType, 0, this.Descriptor.Scale);\r
-\r
-                       // Decode slice data\r
-                       XdrStream xdr = new XdrStream(slice, this.db.Charset);\r
-\r
-                       while (xdr.Position < xdr.Length)\r
-                       {\r
-                               switch (dbType)\r
-                               {\r
-                                       case DbDataType.Char:\r
-                                               tempData.SetValue(xdr.ReadString(this.Descriptor.Length), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.VarChar:\r
-                                               tempData.SetValue(xdr.ReadString(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.SmallInt:\r
-                                               tempData.SetValue(xdr.ReadInt16(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.Integer:\r
-                                               tempData.SetValue(xdr.ReadInt32(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.BigInt:\r
-                                               tempData.SetValue(xdr.ReadInt64(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.Numeric:\r
-                                       case DbDataType.Decimal:\r
-                                               tempData.SetValue(xdr.ReadDecimal(type, this.Descriptor.Scale), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.Float:\r
-                                               tempData.SetValue(xdr.ReadSingle(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.Double:\r
-                                               tempData.SetValue(xdr.ReadDouble(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.Date:\r
-                                               tempData.SetValue(xdr.ReadDate(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.Time:\r
-                                               tempData.SetValue(xdr.ReadTime(), index);\r
-                                               break;\r
-\r
-                                       case DbDataType.TimeStamp:\r
-                                               tempData.SetValue(xdr.ReadDateTime(), index);\r
-                                               break;\r
-                               }\r
-\r
-                               index++;\r
-                       }\r
-\r
-                       if (systemType.IsPrimitive)\r
-                       {\r
-                               // For primitive types we can use System.Buffer to copy generated data to destination array\r
-                               Buffer.BlockCopy(tempData, 0, sliceData, 0, Buffer.ByteLength(tempData));\r
-                       }\r
-                       else\r
-                       {\r
-                               sliceData = tempData;\r
-                       }\r
-\r
-                       // Close XDR stream\r
-                       xdr.Close();\r
-\r
-                       return sliceData;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Slice response methods\r
-\r
-               private byte[] ReceiveSliceResponse(ArrayDesc desc)\r
-               {\r
-                       try\r
-                       {\r
-                               int operation = this.db.ReadOperation();\r
-\r
-                               if (operation == IscCodes.op_slice)\r
-                               {\r
-                                       // Read slice length\r
-                                       bool    isVariying = false;\r
-                                       int             elements = 0;\r
-                                       int             length = this.db.Receive.ReadInt32();\r
-\r
-                                       length = this.db.Receive.ReadInt32();\r
-\r
-                                       switch (desc.DataType)\r
-                                       {\r
-                                               case IscCodes.blr_text:\r
-                                               case IscCodes.blr_text2:\r
-                                               case IscCodes.blr_cstring:\r
-                                               case IscCodes.blr_cstring2:\r
-                                                       elements = length / desc.Length;\r
-                                                       length += elements * ((4 - desc.Length) & 3);\r
-                                                       break;\r
-\r
-                                               case IscCodes.blr_varying:\r
-                                               case IscCodes.blr_varying2:\r
-                                                       elements = length / desc.Length;\r
-                                                       isVariying = true;\r
-                                                       break;\r
-\r
-                                               case IscCodes.blr_short:\r
-                                                       length = length * desc.Length;\r
-                                                       break;\r
-                                       }\r
-\r
-                                       if (isVariying)\r
-                                       {\r
-                                               XdrStream xdr = new XdrStream();\r
-\r
-                                               for (int i = 0; i < elements; i++)\r
-                                               {\r
-                                                       byte[] buffer = this.db.Receive.ReadOpaque(\r
-                                                               this.db.Receive.ReadInt32());\r
-\r
-                                                       xdr.WriteBuffer(buffer, buffer.Length);\r
-                                               }\r
-\r
-                                               return xdr.ToArray();\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               return this.db.Receive.ReadOpaque(length);\r
-                                       }\r
-                               }\r
-                               else\r
-                               {\r
-                                       this.db.SetOperation(operation);\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       return null;\r
-                               }\r
-                       }\r
-                       catch (IOException)\r
-                       {\r
-                               throw new IscException(IscCodes.isc_net_read_err);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private byte[] EncodeSliceArray(Array sourceArray)\r
-               {\r
-                       IEnumerator i           = sourceArray.GetEnumerator();\r
-                       DbDataType      dbType  = DbDataType.Array;\r
-                       Charset         charset = this.db.Charset;\r
-                       XdrStream       xdr             = new XdrStream(this.db.Charset);\r
-                       int                     type    = 0;\r
-                       int                     subtype = (this.Descriptor.Scale < 0) ? 2 : 0;\r
-\r
-                       type = TypeHelper.GetFbType(this.Descriptor.DataType);\r
-                       dbType = TypeHelper.GetDbDataType(this.Descriptor.DataType, subtype, this.Descriptor.Scale);\r
-\r
-                       while (i.MoveNext())\r
-                       {\r
-                               switch (dbType)\r
-                               {\r
-                                       case DbDataType.Char:\r
-                                               byte[] buffer = charset.GetBytes(i.Current.ToString());\r
-                                               xdr.WriteOpaque(buffer, this.Descriptor.Length);\r
-                                               break;\r
-\r
-                                       case DbDataType.VarChar:\r
-                                               xdr.Write((string)i.Current);\r
-                                               break;\r
-\r
-                                       case DbDataType.SmallInt:\r
-                                               xdr.Write((short)i.Current);\r
-                                               break;\r
-\r
-                                       case DbDataType.Integer:\r
-                                               xdr.Write((int)i.Current);\r
-                                               break;\r
-\r
-                                       case DbDataType.BigInt:\r
-                                               xdr.Write((long)i.Current);\r
-                                               break;\r
-\r
-                                       case DbDataType.Decimal:\r
-                                       case DbDataType.Numeric:\r
-                                               xdr.Write((decimal)i.Current, type, this.Descriptor.Scale);\r
-                                               break;\r
-\r
-                                       case DbDataType.Float:\r
-                                               xdr.Write((float)i.Current);\r
-                                               break;\r
-\r
-                                       case DbDataType.Double:\r
-                                               xdr.Write((double)i.Current);\r
-                                               break;\r
-\r
-                                       case DbDataType.Date:\r
-                                               xdr.WriteDate(Convert.ToDateTime(i.Current, CultureInfo.CurrentCulture.DateTimeFormat));\r
-                                               break;\r
-\r
-                                       case DbDataType.Time:\r
-                                               xdr.WriteTime(Convert.ToDateTime(i.Current, CultureInfo.CurrentCulture.DateTimeFormat));\r
-                                               break;\r
-\r
-                                       case DbDataType.TimeStamp:\r
-                                               xdr.Write(Convert.ToDateTime(i.Current, CultureInfo.CurrentCulture.DateTimeFormat));\r
-                                               break;\r
-\r
-                                       default:\r
-                                               throw new NotSupportedException("Unknown data type");\r
-                               }\r
-                       }\r
-\r
-                       return xdr.ToArray();\r
-               }\r
-\r
-               private byte[] GenerateSDL(ArrayDesc desc)\r
-               {\r
-                       int n;\r
-                       int from;\r
-                       int to;\r
-                       int increment;\r
-                       int dimensions;\r
-                       ArrayBound tail;\r
-                       BinaryWriter sdl;\r
-\r
-                       dimensions = desc.Dimensions;\r
-\r
-                       if (dimensions > 16)\r
-                       {\r
-                               throw new IscException(IscCodes.isc_invalid_dimension);\r
-                       }\r
-\r
-                       sdl = new BinaryWriter(new MemoryStream());\r
-                       this.Stuff(\r
-                               sdl, 4, IscCodes.isc_sdl_version1,\r
-                               IscCodes.isc_sdl_struct, 1, desc.DataType);\r
-\r
-                       switch (desc.DataType)\r
-                       {\r
-                               case IscCodes.blr_short:\r
-                               case IscCodes.blr_long:\r
-                               case IscCodes.blr_int64:\r
-                               case IscCodes.blr_quad:\r
-                                       this.StuffSdl(sdl, (byte)desc.Scale);\r
-                                       break;\r
-\r
-                               case IscCodes.blr_text:\r
-                               case IscCodes.blr_cstring:\r
-                               case IscCodes.blr_varying:\r
-                                       this.StuffWord(sdl, desc.Length);\r
-                                       break;\r
-\r
-                               default:\r
-                                       break;\r
-                       }\r
-\r
-                       this.StuffString(sdl, IscCodes.isc_sdl_relation, desc.RelationName);\r
-                       this.StuffString(sdl, IscCodes.isc_sdl_field, desc.FieldName);\r
-\r
-                       if ((desc.Flags & IscCodes.ARRAY_DESC_COLUMN_MAJOR) == IscCodes.ARRAY_DESC_COLUMN_MAJOR)\r
-                       {\r
-                               from = dimensions - 1;\r
-                               to = -1;\r
-                               increment = -1;\r
-                       }\r
-                       else\r
-                       {\r
-                               from = 0;\r
-                               to = dimensions;\r
-                               increment = 1;\r
-                       }\r
-\r
-                       for (n = from; n != to; n += increment)\r
-                       {\r
-                               tail = desc.Bounds[n];\r
-                               if (tail.LowerBound == 1)\r
-                               {\r
-                                       this.Stuff(sdl, 2, IscCodes.isc_sdl_do1, n);\r
-                               }\r
-                               else\r
-                               {\r
-                                       this.Stuff(sdl, 2, IscCodes.isc_sdl_do2, n);\r
-\r
-                                       this.StuffLiteral(sdl, tail.LowerBound);\r
-                               }\r
-\r
-                               this.StuffLiteral(sdl, tail.UpperBound);\r
-                       }\r
-\r
-                       this.Stuff(\r
-                               sdl, 5, IscCodes.isc_sdl_element,\r
-                               1, IscCodes.isc_sdl_scalar, 0, dimensions);\r
-\r
-                       for (n = 0; n < dimensions; n++)\r
-                       {\r
-                               this.Stuff(sdl, 2, IscCodes.isc_sdl_variable, n);\r
-                       }\r
-\r
-                       this.StuffSdl(sdl, IscCodes.isc_sdl_eoc);\r
-\r
-                       return ((MemoryStream)sdl.BaseStream).ToArray();\r
-               }\r
-\r
-               private void Stuff(BinaryWriter sdl, short count, params object[] args)\r
-               {\r
-                       for (int i = 0; i < count; i++)\r
-                       {\r
-                               sdl.Write(Convert.ToByte(args[i], CultureInfo.InvariantCulture));\r
-                       }\r
-               }\r
-\r
-               private void Stuff(BinaryWriter sdl, byte[] args)\r
-               {\r
-                       sdl.Write(args);\r
-               }\r
-\r
-               private void StuffSdl(BinaryWriter sdl, byte sdl_byte)\r
-               {\r
-                       this.Stuff(sdl, 1, sdl_byte);\r
-               }\r
-\r
-               private void StuffWord(BinaryWriter sdl, short word)\r
-               {\r
-                       this.Stuff(sdl, BitConverter.GetBytes(word));\r
-               }\r
-\r
-               private void StuffLong(BinaryWriter sdl, int word)\r
-               {\r
-                       this.Stuff(sdl, BitConverter.GetBytes(word));\r
-               }\r
-\r
-               private void StuffLiteral(BinaryWriter sdl, int literal)\r
-               {\r
-                       if (literal >= -128 && literal <= 127)\r
-                       {\r
-                               this.Stuff(sdl, 2, IscCodes.isc_sdl_tiny_integer, literal);\r
-\r
-                               return;\r
-                       }\r
-\r
-                       if (literal >= -32768 && literal <= 32767)\r
-                       {\r
-                               this.StuffSdl(sdl, IscCodes.isc_sdl_short_integer);\r
-                               this.StuffWord(sdl, (short)literal);\r
-\r
-                               return;\r
-                       }\r
-\r
-                       this.StuffSdl(sdl, IscCodes.isc_sdl_long_integer);\r
-                       this.StuffLong(sdl, literal);\r
-               }\r
-\r
-               private void StuffString(BinaryWriter sdl, int constant, string value)\r
-               {\r
-                       this.StuffSdl(sdl, (byte)constant);\r
-                       this.StuffSdl(sdl, (byte)value.Length);\r
-\r
-                       for (int i = 0; i < value.Length; i++)\r
-                       {\r
-                               this.StuffSdl(sdl, (byte)value[i]);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Net;
+using System.Text;
+using System.IO;
+using System.Collections;
+using System.Globalization;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal sealed class GdsArray : ArrayBase
+       {
+               #region Fields
+
+               private long                    handle;
+               private GdsDatabase             db;
+               private GdsTransaction  transaction;
+
+               #endregion
+
+               #region Properties
+
+               public override long Handle
+               {
+                       get { return this.handle; }
+                       set { this.handle = value; }
+               }
+
+               public override IDatabase DB
+               {
+                       get { return this.db; }
+                       set { this.db = (GdsDatabase)value; }
+               }
+
+               public override ITransaction Transaction
+               {
+                       get { return this.transaction; }
+                       set { this.transaction = (GdsTransaction)value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsArray(ArrayDesc descriptor) : base(descriptor)
+               {
+               }
+
+               public GdsArray(IDatabase db, ITransaction transaction, string tableName, string fieldName)
+                       : this(db, transaction, -1, tableName, fieldName)
+               {
+               }
+
+               public GdsArray(IDatabase db, ITransaction transaction, long handle, string tableName, string fieldName)
+                       : base(tableName, fieldName)
+               {
+                       if (!(db is GdsDatabase))
+                       {
+                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");
+                       }
+
+                       if (!(transaction is GdsTransaction))
+                       {
+                               throw new ArgumentException("Specified argument is not of GdsTransaction type.");
+                       }
+
+                       this.db                         = (GdsDatabase)db;
+                       this.transaction        = (GdsTransaction)transaction;
+                       this.handle                     = handle;
+
+                       this.LookupBounds();
+               }
+
+               #endregion
+
+               #region Methods
+
+               public override byte[] GetSlice(int sliceLength)
+               {
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       byte[] sdl = this.GenerateSDL(this.Descriptor);
+
+                                       this.db.Send.Write(IscCodes.op_get_slice);      // Op code
+                                       this.db.Send.Write(this.transaction.Handle);// Transaction
+                                       this.db.Send.Write(this.handle);                        // Array id
+                                       this.db.Send.Write(sliceLength);                        // Slice length
+                                       this.db.Send.WriteBuffer(sdl);                          // Slice descriptor     language
+                                       this.db.Send.Write(String.Empty);                       // Slice parameters                                     
+                                       this.db.Send.Write(0);                                          // Slice proper
+                                       this.db.Send.Flush();
+
+                                       return this.ReceiveSliceResponse(this.Descriptor);
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public override void PutSlice(System.Array sourceArray, int sliceLength)
+               {
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       byte[] sdl = this.GenerateSDL(this.Descriptor);
+                                       byte[] slice = this.EncodeSliceArray(sourceArray);
+
+                                       this.db.Send.Write(IscCodes.op_put_slice);      // Op code
+                                       this.db.Send.Write(this.transaction.Handle);// Transaction
+                                       this.db.Send.Write((long)0);                            // Array Handle
+                                       this.db.Send.Write(sliceLength);                        // Slice length
+                                       this.db.Send.WriteBuffer(sdl);                          // Slice descriptor     language
+                                       this.db.Send.Write(String.Empty);                       // Slice parameters
+                                       this.db.Send.Write(sliceLength);                        // Slice length
+                                       this.db.Send.Write(slice, 0, slice.Length);     // Slice proper
+                                       this.db.Send.Flush();
+
+                                       GdsResponse r = this.db.ReadGenericResponse();
+
+                                       this.handle = r.BlobId;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override System.Array DecodeSlice(byte[] slice)
+               {
+                       DbDataType      dbType          = DbDataType.Array;
+                       Array           sliceData       = null;
+                       Array           tempData        = null;
+                       Type            systemType      = this.GetSystemType();
+                       int[]           lengths         = new int[this.Descriptor.Dimensions];
+                       int[]           lowerBounds = new int[this.Descriptor.Dimensions];
+                       int                     type            = 0;
+                       int                     index           = 0;
+
+                       // Get upper and lower bounds of each dimension
+                       for (int i = 0; i < this.Descriptor.Dimensions; i++)
+                       {
+                               lowerBounds[i]  = this.Descriptor.Bounds[i].LowerBound;
+                               lengths[i]              = this.Descriptor.Bounds[i].UpperBound;
+
+                               if (lowerBounds[i] == 0)
+                               {
+                                       lengths[i]++;
+                               }
+                       }
+
+                       // Create arrays
+#if    (NETCF)
+                       sliceData = Array.CreateInstance(systemType, lengths);
+#else
+                       sliceData = Array.CreateInstance(systemType, lengths, lowerBounds);
+#endif
+                       tempData = Array.CreateInstance(systemType, sliceData.Length);
+
+                       // Infer Firebird and Db datatypes
+                       type    = TypeHelper.GetFbType(this.Descriptor.DataType);
+                       dbType  = TypeHelper.GetDbDataType(this.Descriptor.DataType, 0, this.Descriptor.Scale);
+
+                       // Decode slice data
+                       XdrStream xdr = new XdrStream(slice, this.db.Charset);
+
+                       while (xdr.Position < xdr.Length)
+                       {
+                               switch (dbType)
+                               {
+                                       case DbDataType.Char:
+                                               tempData.SetValue(xdr.ReadString(this.Descriptor.Length), index);
+                                               break;
+
+                                       case DbDataType.VarChar:
+                                               tempData.SetValue(xdr.ReadString(), index);
+                                               break;
+
+                                       case DbDataType.SmallInt:
+                                               tempData.SetValue(xdr.ReadInt16(), index);
+                                               break;
+
+                                       case DbDataType.Integer:
+                                               tempData.SetValue(xdr.ReadInt32(), index);
+                                               break;
+
+                                       case DbDataType.BigInt:
+                                               tempData.SetValue(xdr.ReadInt64(), index);
+                                               break;
+
+                                       case DbDataType.Numeric:
+                                       case DbDataType.Decimal:
+                                               tempData.SetValue(xdr.ReadDecimal(type, this.Descriptor.Scale), index);
+                                               break;
+
+                                       case DbDataType.Float:
+                                               tempData.SetValue(xdr.ReadSingle(), index);
+                                               break;
+
+                                       case DbDataType.Double:
+                                               tempData.SetValue(xdr.ReadDouble(), index);
+                                               break;
+
+                                       case DbDataType.Date:
+                                               tempData.SetValue(xdr.ReadDate(), index);
+                                               break;
+
+                                       case DbDataType.Time:
+                                               tempData.SetValue(xdr.ReadTime(), index);
+                                               break;
+
+                                       case DbDataType.TimeStamp:
+                                               tempData.SetValue(xdr.ReadDateTime(), index);
+                                               break;
+                               }
+
+                               index++;
+                       }
+
+                       if (systemType.IsPrimitive)
+                       {
+                               // For primitive types we can use System.Buffer to copy generated data to destination array
+                               Buffer.BlockCopy(tempData, 0, sliceData, 0, Buffer.ByteLength(tempData));
+                       }
+                       else
+                       {
+                               sliceData = tempData;
+                       }
+
+                       // Close XDR stream
+                       xdr.Close();
+
+                       return sliceData;
+               }
+
+               #endregion
+
+               #region Slice response methods
+
+               private byte[] ReceiveSliceResponse(ArrayDesc desc)
+               {
+                       try
+                       {
+                               int operation = this.db.ReadOperation();
+
+                               if (operation == IscCodes.op_slice)
+                               {
+                                       // Read slice length
+                                       bool    isVariying = false;
+                                       int             elements = 0;
+                                       int             length = this.db.Receive.ReadInt32();
+
+                                       length = this.db.Receive.ReadInt32();
+
+                                       switch (desc.DataType)
+                                       {
+                                               case IscCodes.blr_text:
+                                               case IscCodes.blr_text2:
+                                               case IscCodes.blr_cstring:
+                                               case IscCodes.blr_cstring2:
+                                                       elements = length / desc.Length;
+                                                       length += elements * ((4 - desc.Length) & 3);
+                                                       break;
+
+                                               case IscCodes.blr_varying:
+                                               case IscCodes.blr_varying2:
+                                                       elements = length / desc.Length;
+                                                       isVariying = true;
+                                                       break;
+
+                                               case IscCodes.blr_short:
+                                                       length = length * desc.Length;
+                                                       break;
+                                       }
+
+                                       if (isVariying)
+                                       {
+                                               XdrStream xdr = new XdrStream();
+
+                                               for (int i = 0; i < elements; i++)
+                                               {
+                                                       byte[] buffer = this.db.Receive.ReadOpaque(
+                                                               this.db.Receive.ReadInt32());
+
+                                                       xdr.WriteBuffer(buffer, buffer.Length);
+                                               }
+
+                                               return xdr.ToArray();
+                                       }
+                                       else
+                                       {
+                                               return this.db.Receive.ReadOpaque(length);
+                                       }
+                               }
+                               else
+                               {
+                                       this.db.SetOperation(operation);
+                                       this.db.ReadGenericResponse();
+
+                                       return null;
+                               }
+                       }
+                       catch (IOException)
+                       {
+                               throw new IscException(IscCodes.isc_net_read_err);
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private byte[] EncodeSliceArray(Array sourceArray)
+               {
+                       IEnumerator i           = sourceArray.GetEnumerator();
+                       DbDataType      dbType  = DbDataType.Array;
+                       Charset         charset = this.db.Charset;
+                       XdrStream       xdr             = new XdrStream(this.db.Charset);
+                       int                     type    = 0;
+                       int                     subtype = (this.Descriptor.Scale < 0) ? 2 : 0;
+
+                       type = TypeHelper.GetFbType(this.Descriptor.DataType);
+                       dbType = TypeHelper.GetDbDataType(this.Descriptor.DataType, subtype, this.Descriptor.Scale);
+
+                       while (i.MoveNext())
+                       {
+                               switch (dbType)
+                               {
+                                       case DbDataType.Char:
+                                               byte[] buffer = charset.GetBytes(i.Current.ToString());
+                                               xdr.WriteOpaque(buffer, this.Descriptor.Length);
+                                               break;
+
+                                       case DbDataType.VarChar:
+                                               xdr.Write((string)i.Current);
+                                               break;
+
+                                       case DbDataType.SmallInt:
+                                               xdr.Write((short)i.Current);
+                                               break;
+
+                                       case DbDataType.Integer:
+                                               xdr.Write((int)i.Current);
+                                               break;
+
+                                       case DbDataType.BigInt:
+                                               xdr.Write((long)i.Current);
+                                               break;
+
+                                       case DbDataType.Decimal:
+                                       case DbDataType.Numeric:
+                                               xdr.Write((decimal)i.Current, type, this.Descriptor.Scale);
+                                               break;
+
+                                       case DbDataType.Float:
+                                               xdr.Write((float)i.Current);
+                                               break;
+
+                                       case DbDataType.Double:
+                                               xdr.Write((double)i.Current);
+                                               break;
+
+                                       case DbDataType.Date:
+                                               xdr.WriteDate(Convert.ToDateTime(i.Current, CultureInfo.CurrentCulture.DateTimeFormat));
+                                               break;
+
+                                       case DbDataType.Time:
+                                               xdr.WriteTime(Convert.ToDateTime(i.Current, CultureInfo.CurrentCulture.DateTimeFormat));
+                                               break;
+
+                                       case DbDataType.TimeStamp:
+                                               xdr.Write(Convert.ToDateTime(i.Current, CultureInfo.CurrentCulture.DateTimeFormat));
+                                               break;
+
+                                       default:
+                                               throw new NotSupportedException("Unknown data type");
+                               }
+                       }
+
+                       return xdr.ToArray();
+               }
+
+               private byte[] GenerateSDL(ArrayDesc desc)
+               {
+                       int n;
+                       int from;
+                       int to;
+                       int increment;
+                       int dimensions;
+                       ArrayBound tail;
+                       BinaryWriter sdl;
+
+                       dimensions = desc.Dimensions;
+
+                       if (dimensions > 16)
+                       {
+                               throw new IscException(IscCodes.isc_invalid_dimension);
+                       }
+
+                       sdl = new BinaryWriter(new MemoryStream());
+                       this.Stuff(
+                               sdl, 4, IscCodes.isc_sdl_version1,
+                               IscCodes.isc_sdl_struct, 1, desc.DataType);
+
+                       switch (desc.DataType)
+                       {
+                               case IscCodes.blr_short:
+                               case IscCodes.blr_long:
+                               case IscCodes.blr_int64:
+                               case IscCodes.blr_quad:
+                                       this.StuffSdl(sdl, (byte)desc.Scale);
+                                       break;
+
+                               case IscCodes.blr_text:
+                               case IscCodes.blr_cstring:
+                               case IscCodes.blr_varying:
+                                       this.StuffWord(sdl, desc.Length);
+                                       break;
+
+                               default:
+                                       break;
+                       }
+
+                       this.StuffString(sdl, IscCodes.isc_sdl_relation, desc.RelationName);
+                       this.StuffString(sdl, IscCodes.isc_sdl_field, desc.FieldName);
+
+                       if ((desc.Flags & IscCodes.ARRAY_DESC_COLUMN_MAJOR) == IscCodes.ARRAY_DESC_COLUMN_MAJOR)
+                       {
+                               from = dimensions - 1;
+                               to = -1;
+                               increment = -1;
+                       }
+                       else
+                       {
+                               from = 0;
+                               to = dimensions;
+                               increment = 1;
+                       }
+
+                       for (n = from; n != to; n += increment)
+                       {
+                               tail = desc.Bounds[n];
+                               if (tail.LowerBound == 1)
+                               {
+                                       this.Stuff(sdl, 2, IscCodes.isc_sdl_do1, n);
+                               }
+                               else
+                               {
+                                       this.Stuff(sdl, 2, IscCodes.isc_sdl_do2, n);
+
+                                       this.StuffLiteral(sdl, tail.LowerBound);
+                               }
+
+                               this.StuffLiteral(sdl, tail.UpperBound);
+                       }
+
+                       this.Stuff(
+                               sdl, 5, IscCodes.isc_sdl_element,
+                               1, IscCodes.isc_sdl_scalar, 0, dimensions);
+
+                       for (n = 0; n < dimensions; n++)
+                       {
+                               this.Stuff(sdl, 2, IscCodes.isc_sdl_variable, n);
+                       }
+
+                       this.StuffSdl(sdl, IscCodes.isc_sdl_eoc);
+
+                       return ((MemoryStream)sdl.BaseStream).ToArray();
+               }
+
+               private void Stuff(BinaryWriter sdl, short count, params object[] args)
+               {
+                       for (int i = 0; i < count; i++)
+                       {
+                               sdl.Write(Convert.ToByte(args[i], CultureInfo.InvariantCulture));
+                       }
+               }
+
+               private void Stuff(BinaryWriter sdl, byte[] args)
+               {
+                       sdl.Write(args);
+               }
+
+               private void StuffSdl(BinaryWriter sdl, byte sdl_byte)
+               {
+                       this.Stuff(sdl, 1, sdl_byte);
+               }
+
+               private void StuffWord(BinaryWriter sdl, short word)
+               {
+                       this.Stuff(sdl, BitConverter.GetBytes(word));
+               }
+
+               private void StuffLong(BinaryWriter sdl, int word)
+               {
+                       this.Stuff(sdl, BitConverter.GetBytes(word));
+               }
+
+               private void StuffLiteral(BinaryWriter sdl, int literal)
+               {
+                       if (literal >= -128 && literal <= 127)
+                       {
+                               this.Stuff(sdl, 2, IscCodes.isc_sdl_tiny_integer, literal);
+
+                               return;
+                       }
+
+                       if (literal >= -32768 && literal <= 32767)
+                       {
+                               this.StuffSdl(sdl, IscCodes.isc_sdl_short_integer);
+                               this.StuffWord(sdl, (short)literal);
+
+                               return;
+                       }
+
+                       this.StuffSdl(sdl, IscCodes.isc_sdl_long_integer);
+                       this.StuffLong(sdl, literal);
+               }
+
+               private void StuffString(BinaryWriter sdl, int constant, string value)
+               {
+                       this.StuffSdl(sdl, (byte)constant);
+                       this.StuffSdl(sdl, (byte)value.Length);
+
+                       for (int i = 0; i < value.Length; i++)
+                       {
+                               this.StuffSdl(sdl, (byte)value[i]);
+                       }
+               }
+
+               #endregion
+       }
+}
index 1b6d692c6930a3ad781294d11cc2f95dd12254c2..30ff65e0f3ab97207d2c0cd7aedd76ede2496c46 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal sealed class GdsBlob : BlobBase\r
-       {\r
-               #region Fields\r
-\r
-               private GdsDatabase db;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public override IDatabase DB\r
-               {\r
-                       get { return this.db; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsBlob(IDatabase db, ITransaction transaction) : this(db, transaction, 0)\r
-               {\r
-               }\r
-\r
-               public GdsBlob(IDatabase db, ITransaction transaction, long blobId) : base(db)\r
-               {\r
-                       if (!(db is GdsDatabase))\r
-                       {\r
-                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");\r
-                       }\r
-                       if (!(transaction is GdsTransaction))\r
-                       {\r
-                               throw new ArgumentException("Specified argument is not of GdsTransaction type.");\r
-                       }\r
-\r
-                       this.db                         = (GdsDatabase)db;\r
-                       this.transaction        = transaction;\r
-                       this.position           = 0;\r
-                       this.blobHandle         = 0;\r
-                       this.blobId                     = blobId;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override void Create()\r
-               {\r
-                       try\r
-                       {\r
-                               this.CreateOrOpen(IscCodes.op_create_blob, null);\r
-                               this.RblAddValue(IscCodes.RBL_create);\r
-                       }\r
-                       catch (IscException)\r
-                       {\r
-                               throw;\r
-                       }\r
-               }\r
-\r
-               protected override void Open()\r
-               {\r
-                       try\r
-                       {\r
-                               this.CreateOrOpen(IscCodes.op_open_blob, null);\r
-                       }\r
-                       catch (IscException)\r
-                       {\r
-                               throw;\r
-                       }\r
-               }\r
-\r
-               protected override byte[] GetSegment()\r
-               {\r
-                       int requested = this.SegmentSize;\r
-\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_get_segment);\r
-                                       this.db.Send.Write(this.blobHandle);\r
-                                       this.db.Send.Write((requested + 2 < short.MaxValue) ? requested + 2 : short.MaxValue);\r
-                                       this.db.Send.Write((int)0);     // Data segment\r
-                                       this.db.Send.Flush();\r
-\r
-                                       GdsResponse r = this.db.ReadGenericResponse();\r
-\r
-                                       this.RblRemoveValue(IscCodes.RBL_segment);\r
-                                       if (r.ObjectHandle == 1)\r
-                                       {\r
-                                               this.RblAddValue(IscCodes.RBL_segment);\r
-                                       }\r
-                                       else if (r.ObjectHandle == 2)\r
-                                       {\r
-                                               this.RblAddValue(IscCodes.RBL_eof_pending);\r
-                                       }\r
-\r
-                                       byte[] buffer = r.Data;\r
-\r
-                                       if (buffer.Length == 0)\r
-                                       {\r
-                                               // previous     segment was     last, this has no data\r
-                                               return buffer;\r
-                                       }\r
-\r
-                                       int len = 0;\r
-                                       int srcpos = 0;\r
-                                       int destpos = 0;\r
-                                       while (srcpos < buffer.Length)\r
-                                       {\r
-                                               len = IscHelper.VaxInteger(buffer, srcpos, 2);\r
-                                               srcpos += 2;\r
-\r
-                                               Buffer.BlockCopy(buffer, srcpos, buffer, destpos, len);\r
-                                               srcpos  += len;\r
-                                               destpos += len;\r
-                                       }\r
-\r
-                                       byte[] result = new byte[destpos];\r
-                                       Buffer.BlockCopy(buffer, 0, result, 0, destpos);\r
-\r
-                                       return result;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               protected override void PutSegment(byte[] buffer)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_batch_segments);\r
-                                       this.db.Send.Write(this.blobHandle);\r
-                                       this.db.Send.WriteBlobBuffer(buffer);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.db.ReadGenericResponse();\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               protected override void Seek(int position)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_seek_blob);\r
-                                       this.db.Send.Write(this.blobHandle);\r
-                                       this.db.Send.Write(0);                                  // Seek mode\r
-                                       this.db.Send.Write(position);                   // Seek offset\r
-                                       this.db.Send.Flush();\r
-\r
-                                       GdsResponse r = db.ReadGenericResponse();\r
-\r
-                                       this.position = r.ObjectHandle;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_network_error);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               protected override void GetBlobInfo()\r
-               {\r
-                       throw new NotSupportedException();\r
-               }\r
-\r
-               protected override void Close()\r
-               {\r
-                       this.db.ReleaseObject(IscCodes.op_close_blob, this.blobHandle);\r
-               }\r
-\r
-               protected override void Cancel()\r
-               {\r
-                       this.db.ReleaseObject(IscCodes.op_cancel_blob, this.blobHandle);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private API     Methods\r
-\r
-               private void CreateOrOpen(int op, BlobParameterBuffer bpb)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(op);\r
-                                       if (bpb != null)\r
-                                       {\r
-                                               this.db.Send.WriteTyped(IscCodes.isc_bpb_version1, bpb.ToArray());\r
-                                       }\r
-                                       this.db.Send.Write(this.transaction.Handle);\r
-                                       this.db.Send.Write(this.blobId);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       GdsResponse r = this.db.ReadGenericResponse();\r
-\r
-                                       this.blobId = r.BlobId;\r
-                                       this.blobHandle = r.ObjectHandle;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal sealed class GdsBlob : BlobBase
+       {
+               #region Fields
+
+               private GdsDatabase db;
+
+               #endregion
+
+               #region Properties
+
+               public override IDatabase DB
+               {
+                       get { return this.db; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsBlob(IDatabase db, ITransaction transaction) : this(db, transaction, 0)
+               {
+               }
+
+               public GdsBlob(IDatabase db, ITransaction transaction, long blobId) : base(db)
+               {
+                       if (!(db is GdsDatabase))
+                       {
+                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");
+                       }
+                       if (!(transaction is GdsTransaction))
+                       {
+                               throw new ArgumentException("Specified argument is not of GdsTransaction type.");
+                       }
+
+                       this.db                         = (GdsDatabase)db;
+                       this.transaction        = transaction;
+                       this.position           = 0;
+                       this.blobHandle         = 0;
+                       this.blobId                     = blobId;
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override void Create()
+               {
+                       try
+                       {
+                               this.CreateOrOpen(IscCodes.op_create_blob, null);
+                               this.RblAddValue(IscCodes.RBL_create);
+                       }
+                       catch (IscException)
+                       {
+                               throw;
+                       }
+               }
+
+               protected override void Open()
+               {
+                       try
+                       {
+                               this.CreateOrOpen(IscCodes.op_open_blob, null);
+                       }
+                       catch (IscException)
+                       {
+                               throw;
+                       }
+               }
+
+               protected override byte[] GetSegment()
+               {
+                       int requested = this.SegmentSize;
+
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_get_segment);
+                                       this.db.Send.Write(this.blobHandle);
+                                       this.db.Send.Write((requested + 2 < short.MaxValue) ? requested + 2 : short.MaxValue);
+                                       this.db.Send.Write((int)0);     // Data segment
+                                       this.db.Send.Flush();
+
+                                       GdsResponse r = this.db.ReadGenericResponse();
+
+                                       this.RblRemoveValue(IscCodes.RBL_segment);
+                                       if (r.ObjectHandle == 1)
+                                       {
+                                               this.RblAddValue(IscCodes.RBL_segment);
+                                       }
+                                       else if (r.ObjectHandle == 2)
+                                       {
+                                               this.RblAddValue(IscCodes.RBL_eof_pending);
+                                       }
+
+                                       byte[] buffer = r.Data;
+
+                                       if (buffer.Length == 0)
+                                       {
+                                               // previous     segment was     last, this has no data
+                                               return buffer;
+                                       }
+
+                                       int len = 0;
+                                       int srcpos = 0;
+                                       int destpos = 0;
+                                       while (srcpos < buffer.Length)
+                                       {
+                                               len = IscHelper.VaxInteger(buffer, srcpos, 2);
+                                               srcpos += 2;
+
+                                               Buffer.BlockCopy(buffer, srcpos, buffer, destpos, len);
+                                               srcpos  += len;
+                                               destpos += len;
+                                       }
+
+                                       byte[] result = new byte[destpos];
+                                       Buffer.BlockCopy(buffer, 0, result, 0, destpos);
+
+                                       return result;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               protected override void PutSegment(byte[] buffer)
+               {
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_batch_segments);
+                                       this.db.Send.Write(this.blobHandle);
+                                       this.db.Send.WriteBlobBuffer(buffer);
+                                       this.db.Send.Flush();
+
+                                       this.db.ReadGenericResponse();
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               protected override void Seek(int position)
+               {
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_seek_blob);
+                                       this.db.Send.Write(this.blobHandle);
+                                       this.db.Send.Write(0);                                  // Seek mode
+                                       this.db.Send.Write(position);                   // Seek offset
+                                       this.db.Send.Flush();
+
+                                       GdsResponse r = db.ReadGenericResponse();
+
+                                       this.position = r.ObjectHandle;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_network_error);
+                               }
+                       }
+               }
+
+               protected override void GetBlobInfo()
+               {
+                       throw new NotSupportedException();
+               }
+
+               protected override void Close()
+               {
+                       this.db.ReleaseObject(IscCodes.op_close_blob, this.blobHandle);
+               }
+
+               protected override void Cancel()
+               {
+                       this.db.ReleaseObject(IscCodes.op_cancel_blob, this.blobHandle);
+               }
+
+               #endregion
+
+               #region Private API     Methods
+
+               private void CreateOrOpen(int op, BlobParameterBuffer bpb)
+               {
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       this.db.Send.Write(op);
+                                       if (bpb != null)
+                                       {
+                                               this.db.Send.WriteTyped(IscCodes.isc_bpb_version1, bpb.ToArray());
+                                       }
+                                       this.db.Send.Write(this.transaction.Handle);
+                                       this.db.Send.Write(this.blobId);
+                                       this.db.Send.Flush();
+
+                                       GdsResponse r = this.db.ReadGenericResponse();
+
+                                       this.blobId = r.BlobId;
+                                       this.blobHandle = r.ObjectHandle;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               #endregion
+       }
+}
index 26ff08c0e0ded3f132ecf3961466922bc00ebcce..62f8b15d7b68de5acfa4c83a3386f49922e3069f 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Net;\r
-using System.Net.Sockets;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal sealed class GdsConnection\r
-       {\r
-               #region Fields\r
-\r
-               private Socket                  socket;\r
-               private NetworkStream   networkStream;\r
-               private XdrStream               send;\r
-               private XdrStream               receive;\r
-               private int                             operation;\r
-\r
-               #endregion\r
-\r
-               #region Internal Properties\r
-\r
-               internal XdrStream Receive\r
-               {\r
-                       get { return this.receive; }\r
-               }\r
-\r
-               internal XdrStream Send\r
-               {\r
-                       get { return this.send; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsConnection()\r
-               {\r
-                       this.operation = -1;\r
-\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void Connect(string dataSource, int port)\r
-               {\r
-                       this.Connect(dataSource, port, 8192, Charset.DefaultCharset);\r
-               }\r
-\r
-               public void Connect(string dataSource, int port, int packetSize, Charset charset)\r
-               {\r
-                       try\r
-                       {\r
-                               IPAddress hostadd = Dns.Resolve(dataSource).AddressList[0];\r
-                               IPEndPoint EPhost = new IPEndPoint(hostadd, port);\r
-\r
-                               this.socket = new Socket(\r
-                                       AddressFamily.InterNetwork,\r
-                                       SocketType.Stream,\r
-                                       ProtocolType.Tcp);\r
-\r
-#if (!NETCF)\r
-\r
-                               // Set Receive Buffer size.\r
-                               this.socket.SetSocketOption(\r
-                                       SocketOptionLevel.Socket,\r
-                                       SocketOptionName.ReceiveBuffer,\r
-                                       packetSize);\r
-\r
-                               // Set Send     Buffer size.\r
-                               this.socket.SetSocketOption(\r
-                                       SocketOptionLevel.Socket,\r
-                                       SocketOptionName.SendBuffer,\r
-                                       packetSize);\r
-#endif\r
-\r
-                               // Disables     the     Nagle algorithm for     send coalescing.\r
-                               this.socket.SetSocketOption(\r
-                                       SocketOptionLevel.Tcp,\r
-                                       SocketOptionName.NoDelay,\r
-                                       1);\r
-\r
-                               // Make the     socket to connect to the Server\r
-                               this.socket.Connect(EPhost);\r
-                               this.networkStream = new NetworkStream(this.socket, true);\r
-\r
-#if    (NETCF)\r
-                               this.send        = new XdrStream(this.networkStream, charset);\r
-                               this.receive = new XdrStream(this.networkStream, charset);\r
-#else\r
-                               this.send = new XdrStream(new BufferedStream(this.networkStream), charset);\r
-                               this.receive = new XdrStream(new BufferedStream(this.networkStream), charset);\r
-#endif\r
-\r
-                               GC.SuppressFinalize(this.socket);\r
-                               GC.SuppressFinalize(this.networkStream);\r
-                               GC.SuppressFinalize(this.send);\r
-                               GC.SuppressFinalize(this.receive);\r
-                       }\r
-                       catch (SocketException)\r
-                       {\r
-                               throw new IscException(IscCodes.isc_arg_gds, IscCodes.isc_network_error, dataSource);\r
-                       }\r
-               }\r
-\r
-               public void Disconnect()\r
-               {\r
-                       try\r
-                       {\r
-                               if (this.receive != null)\r
-                               {\r
-                                       this.receive.Close();\r
-                               }\r
-                               if (this.send != null)\r
-                               {\r
-                                       this.send.Close();\r
-                               }\r
-                               if (this.networkStream != null)\r
-                               {\r
-                                       this.networkStream.Close();\r
-                               }\r
-                               if (this.socket != null)\r
-                               {\r
-                                       this.socket.Close();\r
-                               }\r
-\r
-                               this.receive            = null;\r
-                               this.send                       = null;\r
-                               this.socket                     = null;\r
-                               this.networkStream      = null;\r
-                       }\r
-                       catch (IOException)\r
-                       {\r
-                               throw;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Methods\r
-\r
-               internal int ReadOperation()\r
-               {\r
-                       int op = (this.operation >= 0) ? this.operation : this.NextOperation();\r
-                       this.operation = -1;\r
-\r
-                       return op;\r
-               }\r
-\r
-               internal int NextOperation()\r
-               {\r
-                       do\r
-                       {\r
-                               /* loop as long as we are receiving     dummy packets, just\r
-                                * throwing     them away--note that if we are a server we won't\r
-                                * be receiving them, but it is better to check for     them at\r
-                                * this level rather than try to catch them     in all places where\r
-                                * this routine is called \r
-                                */\r
-                               this.operation = this.receive.ReadInt32();\r
-                       } while (this.operation == IscCodes.op_dummy);\r
-\r
-                       return this.operation;\r
-               }\r
-\r
-               internal GdsResponse ReadGenericResponse()\r
-               {\r
-                       try\r
-                       {\r
-                               if (this.ReadOperation() == IscCodes.op_response)\r
-                               {\r
-                                       GdsResponse r = new GdsResponse(\r
-                                               this.receive.ReadInt32(),\r
-                                               this.receive.ReadInt64(),\r
-                                               this.receive.ReadBuffer());\r
-\r
-                                       r.Warning = this.ReadStatusVector();\r
-\r
-                                       return r;\r
-                               }\r
-                               else\r
-                               {\r
-                                       return null;\r
-                               }\r
-                       }\r
-                       catch (IOException)\r
-                       {\r
-                               throw new IscException(IscCodes.isc_net_read_err);\r
-                       }\r
-               }\r
-\r
-               internal IscException ReadStatusVector()\r
-               {\r
-                       IscException exception = null;\r
-                       bool eof = false;\r
-\r
-                       try\r
-                       {\r
-                               while (!eof)\r
-                               {\r
-                                       int arg = this.receive.ReadInt32();\r
-\r
-                                       switch (arg)\r
-                                       {\r
-                                               case IscCodes.isc_arg_gds:\r
-                                                       int er = this.receive.ReadInt32();\r
-                                                       if (er != 0)\r
-                                                       {\r
-                                                               if (exception == null)\r
-                                                               {\r
-                                                                       exception = new IscException();\r
-                                                               }\r
-                                                               exception.Errors.Add(arg, er);\r
-                                                       }\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_arg_end:\r
-                                                       if (exception != null && exception.Errors.Count != 0)\r
-                                                       {\r
-                                                               exception.BuildExceptionMessage();\r
-                                                       }\r
-                                                       eof = true;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_arg_interpreted:\r
-                                               case IscCodes.isc_arg_string:\r
-                                                       exception.Errors.Add(arg, this.receive.ReadString());\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_arg_number:\r
-                                                       exception.Errors.Add(arg, this.receive.ReadInt32());\r
-                                                       break;\r
-\r
-                                               default:\r
-                                                       {\r
-                                                               int e = this.receive.ReadInt32();\r
-                                                               if (e != 0)\r
-                                                               {\r
-                                                                       if (exception == null)\r
-                                                                       {\r
-                                                                               exception = new IscException();\r
-                                                                       }\r
-                                                                       exception.Errors.Add(arg, e);\r
-                                                               }\r
-                                                       }\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                       }\r
-                       catch (IOException)\r
-                       {\r
-                               throw new IscException(IscCodes.isc_arg_gds, IscCodes.isc_net_read_err);\r
-                       }\r
-\r
-                       if (exception != null && !exception.IsWarning)\r
-                       {\r
-                               throw exception;\r
-                       }\r
-\r
-                       return exception;\r
-               }\r
-\r
-               internal void SetOperation(int operation)\r
-               {\r
-                       this.operation = operation;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal sealed class GdsConnection
+       {
+               #region Fields
+
+               private Socket                  socket;
+               private NetworkStream   networkStream;
+               private XdrStream               send;
+               private XdrStream               receive;
+               private int                             operation;
+
+               #endregion
+
+               #region Internal Properties
+
+               internal XdrStream Receive
+               {
+                       get { return this.receive; }
+               }
+
+               internal XdrStream Send
+               {
+                       get { return this.send; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsConnection()
+               {
+                       this.operation = -1;
+
+                       GC.SuppressFinalize(this);
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void Connect(string dataSource, int port)
+               {
+                       this.Connect(dataSource, port, 8192, Charset.DefaultCharset);
+               }
+
+               public void Connect(string dataSource, int port, int packetSize, Charset charset)
+               {
+                       try
+                       {
+                               IPAddress hostadd = Dns.Resolve(dataSource).AddressList[0];
+                               IPEndPoint EPhost = new IPEndPoint(hostadd, port);
+
+                               this.socket = new Socket(
+                                       AddressFamily.InterNetwork,
+                                       SocketType.Stream,
+                                       ProtocolType.Tcp);
+
+#if (!NETCF)
+
+                               // Set Receive Buffer size.
+                               this.socket.SetSocketOption(
+                                       SocketOptionLevel.Socket,
+                                       SocketOptionName.ReceiveBuffer,
+                                       packetSize);
+
+                               // Set Send     Buffer size.
+                               this.socket.SetSocketOption(
+                                       SocketOptionLevel.Socket,
+                                       SocketOptionName.SendBuffer,
+                                       packetSize);
+#endif
+
+                               // Disables     the     Nagle algorithm for     send coalescing.
+                               this.socket.SetSocketOption(
+                                       SocketOptionLevel.Tcp,
+                                       SocketOptionName.NoDelay,
+                                       1);
+
+                               // Make the     socket to connect to the Server
+                               this.socket.Connect(EPhost);
+                               this.networkStream = new NetworkStream(this.socket, true);
+
+#if    (NETCF)
+                               this.send        = new XdrStream(this.networkStream, charset);
+                               this.receive = new XdrStream(this.networkStream, charset);
+#else
+                               this.send = new XdrStream(new BufferedStream(this.networkStream), charset);
+                               this.receive = new XdrStream(new BufferedStream(this.networkStream), charset);
+#endif
+
+                               GC.SuppressFinalize(this.socket);
+                               GC.SuppressFinalize(this.networkStream);
+                               GC.SuppressFinalize(this.send);
+                               GC.SuppressFinalize(this.receive);
+                       }
+                       catch (SocketException)
+                       {
+                               throw new IscException(IscCodes.isc_arg_gds, IscCodes.isc_network_error, dataSource);
+                       }
+               }
+
+               public void Disconnect()
+               {
+                       try
+                       {
+                               if (this.receive != null)
+                               {
+                                       this.receive.Close();
+                               }
+                               if (this.send != null)
+                               {
+                                       this.send.Close();
+                               }
+                               if (this.networkStream != null)
+                               {
+                                       this.networkStream.Close();
+                               }
+                               if (this.socket != null)
+                               {
+                                       this.socket.Close();
+                               }
+
+                               this.receive            = null;
+                               this.send                       = null;
+                               this.socket                     = null;
+                               this.networkStream      = null;
+                       }
+                       catch (IOException)
+                       {
+                               throw;
+                       }
+               }
+
+               #endregion
+
+               #region Internal Methods
+
+               internal int ReadOperation()
+               {
+                       int op = (this.operation >= 0) ? this.operation : this.NextOperation();
+                       this.operation = -1;
+
+                       return op;
+               }
+
+               internal int NextOperation()
+               {
+                       do
+                       {
+                               /* loop as long as we are receiving     dummy packets, just
+                                * throwing     them away--note that if we are a server we won't
+                                * be receiving them, but it is better to check for     them at
+                                * this level rather than try to catch them     in all places where
+                                * this routine is called 
+                                */
+                               this.operation = this.receive.ReadInt32();
+                       } while (this.operation == IscCodes.op_dummy);
+
+                       return this.operation;
+               }
+
+               internal GdsResponse ReadGenericResponse()
+               {
+                       try
+                       {
+                               if (this.ReadOperation() == IscCodes.op_response)
+                               {
+                                       GdsResponse r = new GdsResponse(
+                                               this.receive.ReadInt32(),
+                                               this.receive.ReadInt64(),
+                                               this.receive.ReadBuffer());
+
+                                       r.Warning = this.ReadStatusVector();
+
+                                       return r;
+                               }
+                               else
+                               {
+                                       return null;
+                               }
+                       }
+                       catch (IOException)
+                       {
+                               throw new IscException(IscCodes.isc_net_read_err);
+                       }
+               }
+
+               internal IscException ReadStatusVector()
+               {
+                       IscException exception = null;
+                       bool eof = false;
+
+                       try
+                       {
+                               while (!eof)
+                               {
+                                       int arg = this.receive.ReadInt32();
+
+                                       switch (arg)
+                                       {
+                                               case IscCodes.isc_arg_gds:
+                                                       int er = this.receive.ReadInt32();
+                                                       if (er != 0)
+                                                       {
+                                                               if (exception == null)
+                                                               {
+                                                                       exception = new IscException();
+                                                               }
+                                                               exception.Errors.Add(arg, er);
+                                                       }
+                                                       break;
+
+                                               case IscCodes.isc_arg_end:
+                                                       if (exception != null && exception.Errors.Count != 0)
+                                                       {
+                                                               exception.BuildExceptionMessage();
+                                                       }
+                                                       eof = true;
+                                                       break;
+
+                                               case IscCodes.isc_arg_interpreted:
+                                               case IscCodes.isc_arg_string:
+                                                       exception.Errors.Add(arg, this.receive.ReadString());
+                                                       break;
+
+                                               case IscCodes.isc_arg_number:
+                                                       exception.Errors.Add(arg, this.receive.ReadInt32());
+                                                       break;
+
+                                               default:
+                                                       {
+                                                               int e = this.receive.ReadInt32();
+                                                               if (e != 0)
+                                                               {
+                                                                       if (exception == null)
+                                                                       {
+                                                                               exception = new IscException();
+                                                                       }
+                                                                       exception.Errors.Add(arg, e);
+                                                               }
+                                                       }
+                                                       break;
+                                       }
+                               }
+                       }
+                       catch (IOException)
+                       {
+                               throw new IscException(IscCodes.isc_arg_gds, IscCodes.isc_net_read_err);
+                       }
+
+                       if (exception != null && !exception.IsWarning)
+                       {
+                               throw exception;
+                       }
+
+                       return exception;
+               }
+
+               internal void SetOperation(int operation)
+               {
+                       this.operation = operation;
+               }
+
+               #endregion
+       }
+}
index d0f9918f3dc301f32b50b301ab0543f2b386fdb6..770cc8fb6e13b141ebfbcbebb991a35c84f2c1ea 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-using System.Data;\r
-using System.Globalization;\r
-using System.IO;\r
-using System.Text;\r
-using System.Net;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal sealed class GdsDatabase : IDatabase\r
-       {\r
-               #region Callbacks\r
-\r
-               public WarningMessageCallback WarningMessage\r
-               {\r
-                       get { return this.warningMessage; }\r
-                       set { this.warningMessage = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private WarningMessageCallback warningMessage;\r
-\r
-               private GdsConnection   connection;\r
-               private GdsEventManager eventManager;\r
-               private Charset                 charset;\r
-               private int                             handle;\r
-               private int                             transactionCount;\r
-               private string                  serverVersion;\r
-               private short                   packetSize;\r
-               private short                   dialect;\r
-               private int                             eventsId;\r
-               private bool                    disposed;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int Handle\r
-               {\r
-                       get { return this.handle; }\r
-               }\r
-\r
-               public int TransactionCount\r
-               {\r
-                       get { return this.transactionCount; }\r
-                       set { this.transactionCount = value; }\r
-               }\r
-\r
-               public string ServerVersion\r
-               {\r
-                       get { return this.serverVersion; }\r
-               }\r
-\r
-               public Charset Charset\r
-               {\r
-                       get { return this.charset; }\r
-                       set { this.charset = value; }\r
-               }\r
-\r
-               public short PacketSize\r
-               {\r
-                       get { return this.packetSize; }\r
-                       set { this.packetSize = value; }\r
-               }\r
-\r
-               public short Dialect\r
-               {\r
-                       get { return this.dialect; }\r
-                       set { this.dialect = value; }\r
-               }\r
-\r
-               public bool HasRemoteEventSupport\r
-               {\r
-                       get { return true; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal properties\r
-\r
-               internal XdrStream Send\r
-               {\r
-                       get { return this.connection.Send; }\r
-               }\r
-\r
-               internal XdrStream Receive\r
-               {\r
-                       get { return this.connection.Receive; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsDatabase()\r
-               {\r
-                       this.connection         = new GdsConnection();\r
-                       this.charset            = Charset.DefaultCharset;\r
-                       this.dialect            = 3;\r
-                       this.packetSize         = 8192;\r
-\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Finalizer\r
-\r
-               ~GdsDatabase()\r
-               {\r
-                       this.Dispose(false);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     methods\r
-\r
-               public void Dispose()\r
-               {\r
-                       this.Dispose(true);\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               private void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.disposed)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // release any unmanaged resources\r
-                                               this.Detach();\r
-\r
-                                               // release any managed resources\r
-                                               if (disposing)\r
-                                               {\r
-                                                       this.connection         = null;\r
-                                                       this.charset            = null;\r
-                                                       this.eventManager       = null;\r
-                                                       this.serverVersion      = null;\r
-                                                       this.dialect            = 0;\r
-                                                       this.eventsId           = 0;\r
-                                                       this.handle                     = 0;\r
-                                                       this.packetSize         = 0;\r
-                                                       this.warningMessage = null;\r
-                                                       this.transactionCount = 0;\r
-                                               }\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                       }\r
-\r
-                                       this.disposed = true;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Database Methods\r
-\r
-               public void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.connection.Connect(dataSource, port, this.packetSize, this.charset);\r
-                                       this.Send.Write(IscCodes.op_create);\r
-                                       this.Send.Write((int)0);\r
-                                       this.Send.Write(database);\r
-                                       this.Send.WriteBuffer(dpb.ToArray());\r
-                                       this.Send.Flush();\r
-\r
-                                       try\r
-                                       {\r
-                                               this.handle = this.ReadGenericResponse().ObjectHandle;\r
-                                               this.Detach();\r
-                                       }\r
-                                       catch (IscException)\r
-                                       {\r
-                                               try\r
-                                               {\r
-                                                       this.connection.Disconnect();\r
-                                               }\r
-                                               catch (Exception)\r
-                                               {\r
-                                               }\r
-\r
-                                               throw;\r
-                                       }\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_write_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void DropDatabase()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.Send.Write(IscCodes.op_drop_database);\r
-                                       this.Send.Write(this.handle);\r
-                                       this.Send.Flush();\r
-\r
-                                       this.ReadGenericResponse();\r
-\r
-                                       this.handle = 0;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_network_error);\r
-                               }\r
-                               finally\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               this.Detach();\r
-                                       }\r
-                                       catch\r
-                                       {\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Auxiliary connection\r
-\r
-               public void ConnectionRequest(out int auxHandle, out string ipAddress, out int portNumber)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.Send.Write(IscCodes.op_connect_request);\r
-                                       this.Send.Write(IscCodes.P_REQ_async);  // Connection type\r
-                                       this.Send.Write(this.handle);                   // Related object\r
-                                       this.Send.Write(0);                                             // Partner identification\r
-\r
-                                       this.Send.Flush();\r
-\r
-                                       this.ReadOperation();\r
-\r
-                                       auxHandle = this.Receive.ReadInt32();\r
-\r
-                                       // socketaddr_in (non XDR encoded)\r
-\r
-                                       // sin_port\r
-                                       portNumber = IscHelper.VaxInteger(this.Receive.ReadBytes(2), 0, 2);\r
-\r
-                                       // sin_Family\r
-                                       this.Receive.ReadBytes(2);\r
-\r
-                                       // sin_addr\r
-                                       byte[] buffer = this.Receive.ReadBytes(4);\r
-                                       ipAddress = String.Format(\r
-                                               CultureInfo.InvariantCulture,\r
-                                               "{0}.{1}.{2}.{3}",\r
-                                               buffer[3], buffer[2], buffer[1], buffer[0]);\r
-\r
-                                       // sin_zero     + garbage\r
-                                       this.Receive.ReadBytes(12);\r
-\r
-                                       // Read Status Vector\r
-                                       this.connection.ReadStatusVector();\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Remote Events Methods\r
-\r
-               public void CloseEventManager()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.eventManager != null)\r
-                               {\r
-                                       this.eventManager.Close();\r
-                                       this.eventManager = null;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public RemoteEvent CreateEvent()\r
-               {\r
-                       return new RemoteEvent(this);\r
-               }\r
-\r
-               public void QueueEvents(RemoteEvent events)\r
-               {\r
-                       if (this.eventManager == null)\r
-                       {\r
-                               string  ipAddress       = string.Empty;\r
-                               int             portNumber      = 0;\r
-                               int             auxHandle       = 0;\r
-\r
-                               this.ConnectionRequest(out auxHandle, out ipAddress, out portNumber);\r
-\r
-                               this.eventManager = new GdsEventManager(auxHandle, ipAddress, portNumber);\r
-                       }\r
-\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       events.LocalId = ++this.eventsId;\r
-\r
-                                       EventParameterBuffer epb = events.ToEpb();\r
-\r
-                                       this.Send.Write(IscCodes.op_que_events);// Op codes\r
-                                       this.Send.Write(this.handle);                   // Database     object id\r
-                                       this.Send.WriteBuffer(epb.ToArray());   // Event description block\r
-                                       this.Send.Write(0);                                             // Address of ast routine\r
-                                       this.Send.Write(0);                                             // Argument     to ast routine                                          \r
-                                       this.Send.Write(events.LocalId);                // Client side id of remote     event\r
-\r
-                                       this.Send.Flush();\r
-\r
-                                       // Update event Remote event ID\r
-                                       events.RemoteId = this.ReadGenericResponse().ObjectHandle;\r
-\r
-                                       // Enqueue events in the event manager\r
-                                       this.eventManager.QueueEvents(events);\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void CancelEvents(RemoteEvent events)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.Send.Write(IscCodes.op_cancel_events);     // Op code\r
-                                       this.Send.Write(this.handle);                           // Database     object id\r
-                                       this.Send.Write(events.LocalId);                        // Event ID\r
-\r
-                                       this.Send.Flush();\r
-\r
-                                       this.ReadGenericResponse();\r
-\r
-                                       this.eventManager.CancelEvents(events);\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.connection.Connect(dataSource, port, this.packetSize, this.charset);\r
-\r
-                                       this.Identify(database);\r
-\r
-                                       this.Send.Write(IscCodes.op_attach);\r
-                                       this.Send.Write((int)0);                                // Database     object ID\r
-                                       this.Send.Write(database);                              // Database     PATH\r
-                                       this.Send.WriteBuffer(dpb.ToArray());   // DPB Parameter buffer\r
-                                       this.Send.Flush();\r
-\r
-                                       try\r
-                                       {\r
-                                               this.handle = this.ReadGenericResponse().ObjectHandle;\r
-                                       }\r
-                                       catch (IscException)\r
-                                       {\r
-                                               try\r
-                                               {\r
-                                                       this.connection.Disconnect();\r
-                                               }\r
-                                               catch\r
-                                               {\r
-                                               }\r
-                                               throw;\r
-                                       }\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       this.connection.Disconnect();\r
-\r
-                                       throw new IscException(IscCodes.isc_net_write_err);\r
-                               }\r
-\r
-                               // Get server version\r
-                               this.serverVersion = this.GetServerVersion();\r
-                       }\r
-               }\r
-\r
-               public void Detach()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.TransactionCount > 0)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_open_trans, this.TransactionCount);\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.Send.Write(IscCodes.op_detach);\r
-                                       this.Send.Write(this.handle);\r
-                                       this.Send.Flush();\r
-\r
-                                       this.ReadGenericResponse();\r
-\r
-                                       // Close the Event Manager\r
-                                       this.CloseEventManager();\r
-\r
-                                       // Close the connection to the server\r
-                                       this.connection.Disconnect();\r
-\r
-                                       this.transactionCount   = 0;\r
-                                       this.handle                             = 0;\r
-                                       this.dialect                    = 0;\r
-                                       this.packetSize                 = 0;\r
-                                       this.charset                    = null;\r
-                                       this.connection                 = null;\r
-                                       this.serverVersion              = null;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               this.connection.Disconnect();\r
-                                       }\r
-                                       catch (IOException)\r
-                                       {\r
-                                               throw new IscException(IscCodes.isc_network_error);\r
-                                       }\r
-\r
-                                       throw new IscException(IscCodes.isc_network_error);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Transaction     methods\r
-\r
-               public ITransaction BeginTransaction(TransactionParameterBuffer tpb)\r
-               {\r
-                       GdsTransaction transaction = new GdsTransaction(this);\r
-\r
-                       transaction.BeginTransaction(tpb);\r
-\r
-                       return transaction;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Statement creation methods\r
-\r
-               public StatementBase CreateStatement()\r
-               {\r
-                       return new GdsStatement(this);\r
-               }\r
-\r
-               public StatementBase CreateStatement(ITransaction transaction)\r
-               {\r
-                       return new GdsStatement(this, transaction as GdsTransaction);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Parameter Buffer creation methods\r
-\r
-               public BlobParameterBuffer CreateBlobParameterBuffer()\r
-               {\r
-                       return new BlobParameterBuffer(false);\r
-               }\r
-\r
-               public DatabaseParameterBuffer CreateDatabaseParameterBuffer()\r
-               {\r
-                       return new DatabaseParameterBuffer(false);\r
-               }\r
-\r
-               public EventParameterBuffer CreateEventParameterBuffer()\r
-               {\r
-                       return new EventParameterBuffer();\r
-               }\r
-\r
-               public TransactionParameterBuffer CreateTransactionParameterBuffer()\r
-               {\r
-                       return new TransactionParameterBuffer(false);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Database Information methods\r
-\r
-               public string GetServerVersion()\r
-               {\r
-                       byte[] items = new byte[]\r
-                       {\r
-                               IscCodes.isc_info_isc_version,\r
-                               IscCodes.isc_info_end\r
-                       };\r
-\r
-                       return this.GetDatabaseInfo(items, IscCodes.BUFFER_SIZE_128)[0].ToString();\r
-               }\r
-\r
-               public ArrayList GetDatabaseInfo(byte[] items)\r
-               {\r
-                       return this.GetDatabaseInfo(items, IscCodes.MAX_BUFFER_SIZE);\r
-               }\r
-\r
-               public ArrayList GetDatabaseInfo(byte[] items, int bufferLength)\r
-               {\r
-                       byte[] buffer = new byte[bufferLength];\r
-\r
-                       this.DatabaseInfo(items, buffer, buffer.Length);\r
-\r
-                       return IscHelper.ParseDatabaseInfo(buffer);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Internal Methods\r
-\r
-               internal void ReleaseObject(int op, int id)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.Send.Write(op);\r
-                                       this.Send.Write(id);\r
-                                       this.Send.Flush();\r
-\r
-                                       this.ReadGenericResponse();\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               internal GdsResponse ReadGenericResponse()\r
-               {\r
-                       GdsResponse response = this.connection.ReadGenericResponse();\r
-\r
-                       if (response != null && response.Warning != null)\r
-                       {\r
-                               if (this.warningMessage != null)\r
-                               {\r
-                                       this.warningMessage(response.Warning);\r
-                               }\r
-                       }\r
-\r
-                       return response;\r
-               }\r
-\r
-               internal int ReadOperation()\r
-               {\r
-                       return this.connection.ReadOperation();\r
-               }\r
-\r
-               internal int NextOperation()\r
-               {\r
-                       return this.connection.NextOperation();\r
-               }\r
-\r
-               internal void SetOperation(int operation)\r
-               {\r
-                       this.connection.SetOperation(operation);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void Identify(string database)\r
-               {\r
-                       try\r
-                       {\r
-                               // Here we identify     the     user to the     engine.  \r
-                               // This may     or may not be used as login     info to a database.                             \r
-#if    (!NETCF)\r
-                               byte[] user = Encoding.Default.GetBytes(System.Environment.UserName);\r
-                               byte[] host = Encoding.Default.GetBytes(System.Net.Dns.GetHostName());\r
-#else\r
-                               byte[] user = Encoding.Default.GetBytes("fbnetcf");\r
-                               byte[] host = Encoding.Default.GetBytes(System.Net.Dns.GetHostName());\r
-#endif\r
-\r
-                               MemoryStream user_id = new MemoryStream();\r
-\r
-                               /* User Name */\r
-                               user_id.WriteByte(1);\r
-                               user_id.WriteByte((byte)user.Length);\r
-                               user_id.Write(user, 0, user.Length);\r
-                               /* Host name */\r
-                               user_id.WriteByte(4);\r
-                               user_id.WriteByte((byte)host.Length);\r
-                               user_id.Write(host, 0, host.Length);\r
-                               /* Attach/create using this     connection \r
-                                * will use     user verification\r
-                                */\r
-                               user_id.WriteByte(6);\r
-                               user_id.WriteByte(0);\r
-\r
-                               this.Send.Write(IscCodes.op_connect);\r
-                               this.Send.Write(IscCodes.op_attach);\r
-                               this.Send.Write(IscCodes.CONNECT_VERSION2);     // CONNECT_VERSION2\r
-                               this.Send.Write(1);                                                     // Architecture of client -     Generic\r
-\r
-                               this.Send.Write(database);                                      // Database     path\r
-                               this.Send.Write(1);                                                     // Protocol     versions understood\r
-                               this.Send.WriteBuffer(user_id.ToArray());       // User identification Stuff\r
-\r
-                               this.Send.Write(IscCodes.PROTOCOL_VERSION10);// Protocol version\r
-                               this.Send.Write(1);                                                     // Architecture of client -     Generic\r
-                               this.Send.Write(2);                                                     // Minumum type\r
-                               this.Send.Write(3);                                                     // Maximum type\r
-                               this.Send.Write(2);                                                     // Preference weight\r
-\r
-                               this.Send.Flush();\r
-\r
-                               if (this.ReadOperation() == IscCodes.op_accept)\r
-                               {\r
-                                       this.Receive.ReadInt32();       // Protocol     version\r
-                                       this.Receive.ReadInt32();       // Architecture for     protocol\r
-                                       this.Receive.ReadInt32();       // Minimum type\r
-                               }\r
-                               else\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               this.Detach();\r
-                                       }\r
-                                       catch (Exception)\r
-                                       {\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               throw new IscException(IscCodes.isc_connect_reject);\r
-                                       }\r
-                               }\r
-                       }\r
-                       catch (IOException)\r
-                       {\r
-                               // throw new IscException(IscCodes.isc_arg_gds, IscCodes.isc_network_error,     Parameters.DataSource);\r
-                               throw new IscException(IscCodes.isc_network_error);\r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// isc_database_info\r
-               /// </summary>\r
-               private void DatabaseInfo(byte[] items, byte[] buffer, int bufferLength)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       // see src/remote/protocol.h for packet definition (p_info struct)                                      \r
-                                       this.Send.Write(IscCodes.op_info_database);     //      operation\r
-                                       this.Send.Write(this.handle);                           //      db_handle\r
-                                       this.Send.Write(0);                                                     //      incarnation\r
-                                       this.Send.WriteBuffer(items, items.Length);     //      items\r
-                                       this.Send.Write(bufferLength);                          //      result buffer length\r
-\r
-                                       this.Send.Flush();\r
-\r
-                                       GdsResponse r = this.ReadGenericResponse();\r
-\r
-                                       Buffer.BlockCopy(r.Data, 0, buffer, 0, bufferLength);\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_network_error);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Data;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Net;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal sealed class GdsDatabase : IDatabase
+       {
+               #region Callbacks
+
+               public WarningMessageCallback WarningMessage
+               {
+                       get { return this.warningMessage; }
+                       set { this.warningMessage = value; }
+               }
+
+               #endregion
+
+               #region Fields
+
+               private WarningMessageCallback warningMessage;
+
+               private GdsConnection   connection;
+               private GdsEventManager eventManager;
+               private Charset                 charset;
+               private int                             handle;
+               private int                             transactionCount;
+               private string                  serverVersion;
+               private short                   packetSize;
+               private short                   dialect;
+               private int                             eventsId;
+               private bool                    disposed;
+
+               #endregion
+
+               #region Properties
+
+               public int Handle
+               {
+                       get { return this.handle; }
+               }
+
+               public int TransactionCount
+               {
+                       get { return this.transactionCount; }
+                       set { this.transactionCount = value; }
+               }
+
+               public string ServerVersion
+               {
+                       get { return this.serverVersion; }
+               }
+
+               public Charset Charset
+               {
+                       get { return this.charset; }
+                       set { this.charset = value; }
+               }
+
+               public short PacketSize
+               {
+                       get { return this.packetSize; }
+                       set { this.packetSize = value; }
+               }
+
+               public short Dialect
+               {
+                       get { return this.dialect; }
+                       set { this.dialect = value; }
+               }
+
+               public bool HasRemoteEventSupport
+               {
+                       get { return true; }
+               }
+
+               #endregion
+
+               #region Internal properties
+
+               internal XdrStream Send
+               {
+                       get { return this.connection.Send; }
+               }
+
+               internal XdrStream Receive
+               {
+                       get { return this.connection.Receive; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsDatabase()
+               {
+                       this.connection         = new GdsConnection();
+                       this.charset            = Charset.DefaultCharset;
+                       this.dialect            = 3;
+                       this.packetSize         = 8192;
+
+                       GC.SuppressFinalize(this);
+               }
+
+               #endregion
+
+               #region Finalizer
+
+               ~GdsDatabase()
+               {
+                       this.Dispose(false);
+               }
+
+               #endregion
+
+               #region IDisposable     methods
+
+               public void Dispose()
+               {
+                       this.Dispose(true);
+                       GC.SuppressFinalize(this);
+               }
+
+               private void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.disposed)
+                               {
+                                       try
+                                       {
+                                               // release any unmanaged resources
+                                               this.Detach();
+
+                                               // release any managed resources
+                                               if (disposing)
+                                               {
+                                                       this.connection         = null;
+                                                       this.charset            = null;
+                                                       this.eventManager       = null;
+                                                       this.serverVersion      = null;
+                                                       this.dialect            = 0;
+                                                       this.eventsId           = 0;
+                                                       this.handle                     = 0;
+                                                       this.packetSize         = 0;
+                                                       this.warningMessage = null;
+                                                       this.transactionCount = 0;
+                                               }
+                                       }
+                                       finally
+                                       {
+                                       }
+
+                                       this.disposed = true;
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Database Methods
+
+               public void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.connection.Connect(dataSource, port, this.packetSize, this.charset);
+                                       this.Send.Write(IscCodes.op_create);
+                                       this.Send.Write((int)0);
+                                       this.Send.Write(database);
+                                       this.Send.WriteBuffer(dpb.ToArray());
+                                       this.Send.Flush();
+
+                                       try
+                                       {
+                                               this.handle = this.ReadGenericResponse().ObjectHandle;
+                                               this.Detach();
+                                       }
+                                       catch (IscException)
+                                       {
+                                               try
+                                               {
+                                                       this.connection.Disconnect();
+                                               }
+                                               catch (Exception)
+                                               {
+                                               }
+
+                                               throw;
+                                       }
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_write_err);
+                               }
+                       }
+               }
+
+               public void DropDatabase()
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.Send.Write(IscCodes.op_drop_database);
+                                       this.Send.Write(this.handle);
+                                       this.Send.Flush();
+
+                                       this.ReadGenericResponse();
+
+                                       this.handle = 0;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_network_error);
+                               }
+                               finally
+                               {
+                                       try
+                                       {
+                                               this.Detach();
+                                       }
+                                       catch
+                                       {
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Auxiliary connection
+
+               public void ConnectionRequest(out int auxHandle, out string ipAddress, out int portNumber)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.Send.Write(IscCodes.op_connect_request);
+                                       this.Send.Write(IscCodes.P_REQ_async);  // Connection type
+                                       this.Send.Write(this.handle);                   // Related object
+                                       this.Send.Write(0);                                             // Partner identification
+
+                                       this.Send.Flush();
+
+                                       this.ReadOperation();
+
+                                       auxHandle = this.Receive.ReadInt32();
+
+                                       // socketaddr_in (non XDR encoded)
+
+                                       // sin_port
+                                       portNumber = IscHelper.VaxInteger(this.Receive.ReadBytes(2), 0, 2);
+
+                                       // sin_Family
+                                       this.Receive.ReadBytes(2);
+
+                                       // sin_addr
+                                       byte[] buffer = this.Receive.ReadBytes(4);
+                                       ipAddress = String.Format(
+                                               CultureInfo.InvariantCulture,
+                                               "{0}.{1}.{2}.{3}",
+                                               buffer[3], buffer[2], buffer[1], buffer[0]);
+
+                                       // sin_zero     + garbage
+                                       this.Receive.ReadBytes(12);
+
+                                       // Read Status Vector
+                                       this.connection.ReadStatusVector();
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Remote Events Methods
+
+               public void CloseEventManager()
+               {
+                       lock (this)
+                       {
+                               if (this.eventManager != null)
+                               {
+                                       this.eventManager.Close();
+                                       this.eventManager = null;
+                               }
+                       }
+               }
+
+               public RemoteEvent CreateEvent()
+               {
+                       return new RemoteEvent(this);
+               }
+
+               public void QueueEvents(RemoteEvent events)
+               {
+                       if (this.eventManager == null)
+                       {
+                               string  ipAddress       = string.Empty;
+                               int             portNumber      = 0;
+                               int             auxHandle       = 0;
+
+                               this.ConnectionRequest(out auxHandle, out ipAddress, out portNumber);
+
+                               this.eventManager = new GdsEventManager(auxHandle, ipAddress, portNumber);
+                       }
+
+                       lock (this)
+                       {
+                               try
+                               {
+                                       events.LocalId = ++this.eventsId;
+
+                                       EventParameterBuffer epb = events.ToEpb();
+
+                                       this.Send.Write(IscCodes.op_que_events);// Op codes
+                                       this.Send.Write(this.handle);                   // Database     object id
+                                       this.Send.WriteBuffer(epb.ToArray());   // Event description block
+                                       this.Send.Write(0);                                             // Address of ast routine
+                                       this.Send.Write(0);                                             // Argument     to ast routine                                          
+                                       this.Send.Write(events.LocalId);                // Client side id of remote     event
+
+                                       this.Send.Flush();
+
+                                       // Update event Remote event ID
+                                       events.RemoteId = this.ReadGenericResponse().ObjectHandle;
+
+                                       // Enqueue events in the event manager
+                                       this.eventManager.QueueEvents(events);
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public void CancelEvents(RemoteEvent events)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.Send.Write(IscCodes.op_cancel_events);     // Op code
+                                       this.Send.Write(this.handle);                           // Database     object id
+                                       this.Send.Write(events.LocalId);                        // Event ID
+
+                                       this.Send.Flush();
+
+                                       this.ReadGenericResponse();
+
+                                       this.eventManager.CancelEvents(events);
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.connection.Connect(dataSource, port, this.packetSize, this.charset);
+
+                                       this.Identify(database);
+
+                                       this.Send.Write(IscCodes.op_attach);
+                                       this.Send.Write((int)0);                                // Database     object ID
+                                       this.Send.Write(database);                              // Database     PATH
+                                       this.Send.WriteBuffer(dpb.ToArray());   // DPB Parameter buffer
+                                       this.Send.Flush();
+
+                                       try
+                                       {
+                                               this.handle = this.ReadGenericResponse().ObjectHandle;
+                                       }
+                                       catch (IscException)
+                                       {
+                                               try
+                                               {
+                                                       this.connection.Disconnect();
+                                               }
+                                               catch
+                                               {
+                                               }
+                                               throw;
+                                       }
+                               }
+                               catch (IOException)
+                               {
+                                       this.connection.Disconnect();
+
+                                       throw new IscException(IscCodes.isc_net_write_err);
+                               }
+
+                               // Get server version
+                               this.serverVersion = this.GetServerVersion();
+                       }
+               }
+
+               public void Detach()
+               {
+                       lock (this)
+                       {
+                               if (this.TransactionCount > 0)
+                               {
+                                       throw new IscException(IscCodes.isc_open_trans, this.TransactionCount);
+                               }
+
+                               try
+                               {
+                                       this.Send.Write(IscCodes.op_detach);
+                                       this.Send.Write(this.handle);
+                                       this.Send.Flush();
+
+                                       this.ReadGenericResponse();
+
+                                       // Close the Event Manager
+                                       this.CloseEventManager();
+
+                                       // Close the connection to the server
+                                       this.connection.Disconnect();
+
+                                       this.transactionCount   = 0;
+                                       this.handle                             = 0;
+                                       this.dialect                    = 0;
+                                       this.packetSize                 = 0;
+                                       this.charset                    = null;
+                                       this.connection                 = null;
+                                       this.serverVersion              = null;
+                               }
+                               catch (IOException)
+                               {
+                                       try
+                                       {
+                                               this.connection.Disconnect();
+                                       }
+                                       catch (IOException)
+                                       {
+                                               throw new IscException(IscCodes.isc_network_error);
+                                       }
+
+                                       throw new IscException(IscCodes.isc_network_error);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Transaction     methods
+
+               public ITransaction BeginTransaction(TransactionParameterBuffer tpb)
+               {
+                       GdsTransaction transaction = new GdsTransaction(this);
+
+                       transaction.BeginTransaction(tpb);
+
+                       return transaction;
+               }
+
+               #endregion
+
+               #region Statement creation methods
+
+               public StatementBase CreateStatement()
+               {
+                       return new GdsStatement(this);
+               }
+
+               public StatementBase CreateStatement(ITransaction transaction)
+               {
+                       return new GdsStatement(this, transaction as GdsTransaction);
+               }
+
+               #endregion
+
+               #region Parameter Buffer creation methods
+
+               public BlobParameterBuffer CreateBlobParameterBuffer()
+               {
+                       return new BlobParameterBuffer(false);
+               }
+
+               public DatabaseParameterBuffer CreateDatabaseParameterBuffer()
+               {
+                       return new DatabaseParameterBuffer(false);
+               }
+
+               public EventParameterBuffer CreateEventParameterBuffer()
+               {
+                       return new EventParameterBuffer();
+               }
+
+               public TransactionParameterBuffer CreateTransactionParameterBuffer()
+               {
+                       return new TransactionParameterBuffer(false);
+               }
+
+               #endregion
+
+               #region Database Information methods
+
+               public string GetServerVersion()
+               {
+                       byte[] items = new byte[]
+                       {
+                               IscCodes.isc_info_isc_version,
+                               IscCodes.isc_info_end
+                       };
+
+                       return this.GetDatabaseInfo(items, IscCodes.BUFFER_SIZE_128)[0].ToString();
+               }
+
+               public ArrayList GetDatabaseInfo(byte[] items)
+               {
+                       return this.GetDatabaseInfo(items, IscCodes.MAX_BUFFER_SIZE);
+               }
+
+               public ArrayList GetDatabaseInfo(byte[] items, int bufferLength)
+               {
+                       byte[] buffer = new byte[bufferLength];
+
+                       this.DatabaseInfo(items, buffer, buffer.Length);
+
+                       return IscHelper.ParseDatabaseInfo(buffer);
+               }
+
+               #endregion
+
+               #region Internal Methods
+
+               internal void ReleaseObject(int op, int id)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.Send.Write(op);
+                                       this.Send.Write(id);
+                                       this.Send.Flush();
+
+                                       this.ReadGenericResponse();
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               internal GdsResponse ReadGenericResponse()
+               {
+                       GdsResponse response = this.connection.ReadGenericResponse();
+
+                       if (response != null && response.Warning != null)
+                       {
+                               if (this.warningMessage != null)
+                               {
+                                       this.warningMessage(response.Warning);
+                               }
+                       }
+
+                       return response;
+               }
+
+               internal int ReadOperation()
+               {
+                       return this.connection.ReadOperation();
+               }
+
+               internal int NextOperation()
+               {
+                       return this.connection.NextOperation();
+               }
+
+               internal void SetOperation(int operation)
+               {
+                       this.connection.SetOperation(operation);
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void Identify(string database)
+               {
+                       try
+                       {
+                               // Here we identify     the     user to the     engine.  
+                               // This may     or may not be used as login     info to a database.                             
+#if    (!NETCF)
+                               byte[] user = Encoding.Default.GetBytes(System.Environment.UserName);
+                               byte[] host = Encoding.Default.GetBytes(System.Net.Dns.GetHostName());
+#else
+                               byte[] user = Encoding.Default.GetBytes("fbnetcf");
+                               byte[] host = Encoding.Default.GetBytes(System.Net.Dns.GetHostName());
+#endif
+
+                               MemoryStream user_id = new MemoryStream();
+
+                               /* User Name */
+                               user_id.WriteByte(1);
+                               user_id.WriteByte((byte)user.Length);
+                               user_id.Write(user, 0, user.Length);
+                               /* Host name */
+                               user_id.WriteByte(4);
+                               user_id.WriteByte((byte)host.Length);
+                               user_id.Write(host, 0, host.Length);
+                               /* Attach/create using this     connection 
+                                * will use     user verification
+                                */
+                               user_id.WriteByte(6);
+                               user_id.WriteByte(0);
+
+                               this.Send.Write(IscCodes.op_connect);
+                               this.Send.Write(IscCodes.op_attach);
+                               this.Send.Write(IscCodes.CONNECT_VERSION2);     // CONNECT_VERSION2
+                               this.Send.Write(1);                                                     // Architecture of client -     Generic
+
+                               this.Send.Write(database);                                      // Database     path
+                               this.Send.Write(1);                                                     // Protocol     versions understood
+                               this.Send.WriteBuffer(user_id.ToArray());       // User identification Stuff
+
+                               this.Send.Write(IscCodes.PROTOCOL_VERSION10);// Protocol version
+                               this.Send.Write(1);                                                     // Architecture of client -     Generic
+                               this.Send.Write(2);                                                     // Minumum type
+                               this.Send.Write(3);                                                     // Maximum type
+                               this.Send.Write(2);                                                     // Preference weight
+
+                               this.Send.Flush();
+
+                               if (this.ReadOperation() == IscCodes.op_accept)
+                               {
+                                       this.Receive.ReadInt32();       // Protocol     version
+                                       this.Receive.ReadInt32();       // Architecture for     protocol
+                                       this.Receive.ReadInt32();       // Minimum type
+                               }
+                               else
+                               {
+                                       try
+                                       {
+                                               this.Detach();
+                                       }
+                                       catch (Exception)
+                                       {
+                                       }
+                                       finally
+                                       {
+                                               throw new IscException(IscCodes.isc_connect_reject);
+                                       }
+                               }
+                       }
+                       catch (IOException)
+                       {
+                               // throw new IscException(IscCodes.isc_arg_gds, IscCodes.isc_network_error,     Parameters.DataSource);
+                               throw new IscException(IscCodes.isc_network_error);
+                       }
+               }
+
+               /// <summary>
+               /// isc_database_info
+               /// </summary>
+               private void DatabaseInfo(byte[] items, byte[] buffer, int bufferLength)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       // see src/remote/protocol.h for packet definition (p_info struct)                                      
+                                       this.Send.Write(IscCodes.op_info_database);     //      operation
+                                       this.Send.Write(this.handle);                           //      db_handle
+                                       this.Send.Write(0);                                                     //      incarnation
+                                       this.Send.WriteBuffer(items, items.Length);     //      items
+                                       this.Send.Write(bufferLength);                          //      result buffer length
+
+                                       this.Send.Flush();
+
+                                       GdsResponse r = this.ReadGenericResponse();
+
+                                       Buffer.BlockCopy(r.Data, 0, buffer, 0, bufferLength);
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_network_error);
+                               }
+                       }
+               }
+
+               #endregion
+       }
 }
\ No newline at end of file
index f3d21e9d9281d38f71000a0b9e1f6f73e7a9542e..3a4d6aaff7878a97ec38a2c8017c8b31c2d19362 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Threading;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal class GdsEventManager\r
-       {\r
-               #region Fields\r
-\r
-               private GdsConnection   connection;\r
-               private Thread                  thread;\r
-               private Hashtable               events;\r
-               private int                             handle;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public Hashtable EventList\r
-               {\r
-                       get { return this.events; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsEventManager(int handle, string ipAddress, int portNumber)\r
-               {\r
-                       this.events = new Hashtable();\r
-                       this.events = Hashtable.Synchronized(this.events);\r
-                       this.handle = handle;\r
-\r
-                       // Initialize the connection\r
-                       if (this.connection == null)\r
-                       {\r
-                               this.connection = new GdsConnection();\r
-                               this.connection.Connect(ipAddress, portNumber);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void QueueEvents(RemoteEvent remoteEvent)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               lock (this.events.SyncRoot)\r
-                               {\r
-                                       if (!this.events.ContainsKey(remoteEvent.LocalId))\r
-                                       {\r
-                                               this.events.Add(remoteEvent.LocalId, remoteEvent);\r
-                                       }\r
-                               }\r
-\r
-#if    (!NETCF)\r
-                               if (this.thread == null ||\r
-                                       (this.thread.ThreadState != ThreadState.Running && this.thread.ThreadState != ThreadState.Background))\r
-#else\r
-                               if (this.thread == null)\r
-#endif\r
-                               {\r
-                                       this.thread = new Thread(new ThreadStart(ThreadHandler));\r
-                                       this.thread.Start();\r
-                                       this.thread.IsBackground = true;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void CancelEvents(RemoteEvent remoteEvent)\r
-               {\r
-                       lock (this.events.SyncRoot)\r
-                       {\r
-                               this.events.Remove(remoteEvent.LocalId);\r
-                       }\r
-               }\r
-\r
-               public void Close()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.connection != null)\r
-                               {\r
-                                       this.connection.Disconnect();\r
-                               }\r
-\r
-                               if (this.thread != null)\r
-                               {\r
-                                       this.thread.Abort();\r
-                                       this.thread.Join();\r
-\r
-                                       this.thread = null;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void ThreadHandler()\r
-               {\r
-                       int             operation = -1;\r
-                       int             dbHandle = 0;\r
-                       int             eventId = 0;\r
-                       byte[]  buffer  = null;\r
-                       byte[]  ast             = null;\r
-\r
-                       while (this.events.Count > 0)\r
-                       {\r
-                               try\r
-                               {\r
-                                       operation = this.connection.NextOperation();\r
-\r
-                                       switch (operation)\r
-                                       {\r
-                                               case IscCodes.op_response:\r
-                                                       this.connection.ReadGenericResponse();\r
-                                                       break;\r
-\r
-                                               case IscCodes.op_exit:\r
-                                               case IscCodes.op_disconnect:\r
-                                                       this.connection.Disconnect();\r
-                                                       return;\r
-\r
-                                               case IscCodes.op_event:\r
-                                                       dbHandle        = this.connection.Receive.ReadInt32();\r
-                                                       buffer          = this.connection.Receive.ReadBuffer();\r
-                                                       ast                     = this.connection.Receive.ReadBytes(8);\r
-                                                       eventId         = this.connection.Receive.ReadInt32();\r
-\r
-                                                       if (this.events.ContainsKey(eventId))\r
-                                                       {\r
-                                                               RemoteEvent currentEvent = (RemoteEvent)this.events[eventId];\r
-\r
-                                                               lock (this.events.SyncRoot)\r
-                                                               {\r
-                                                                       // Remove event from the list\r
-                                                                       this.events.Remove(eventId);\r
-\r
-                                                                       // Notify new event     counts\r
-                                                                       currentEvent.EventCounts(buffer);\r
-\r
-                                                                       if (this.events.Count == 0)\r
-                                                                       {\r
-                                                                               return;\r
-                                                                       }\r
-                                                               }\r
-                                                       }\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                               catch (ThreadAbortException)\r
-                               {\r
-                                       return;\r
-                               }\r
-                               catch (Exception)\r
-                               {\r
-                                       return;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Threading;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal class GdsEventManager
+       {
+               #region Fields
+
+               private GdsConnection   connection;
+               private Thread                  thread;
+               private Hashtable               events;
+               private int                             handle;
+
+               #endregion
+
+               #region Properties
+
+               public Hashtable EventList
+               {
+                       get { return this.events; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsEventManager(int handle, string ipAddress, int portNumber)
+               {
+                       this.events = new Hashtable();
+                       this.events = Hashtable.Synchronized(this.events);
+                       this.handle = handle;
+
+                       // Initialize the connection
+                       if (this.connection == null)
+                       {
+                               this.connection = new GdsConnection();
+                               this.connection.Connect(ipAddress, portNumber);
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void QueueEvents(RemoteEvent remoteEvent)
+               {
+                       lock (this)
+                       {
+                               lock (this.events.SyncRoot)
+                               {
+                                       if (!this.events.ContainsKey(remoteEvent.LocalId))
+                                       {
+                                               this.events.Add(remoteEvent.LocalId, remoteEvent);
+                                       }
+                               }
+
+#if    (!NETCF)
+                               if (this.thread == null ||
+                                       (this.thread.ThreadState != ThreadState.Running && this.thread.ThreadState != ThreadState.Background))
+#else
+                               if (this.thread == null)
+#endif
+                               {
+                                       this.thread = new Thread(new ThreadStart(ThreadHandler));
+                                       this.thread.Start();
+                                       this.thread.IsBackground = true;
+                               }
+                       }
+               }
+
+               public void CancelEvents(RemoteEvent remoteEvent)
+               {
+                       lock (this.events.SyncRoot)
+                       {
+                               this.events.Remove(remoteEvent.LocalId);
+                       }
+               }
+
+               public void Close()
+               {
+                       lock (this)
+                       {
+                               if (this.connection != null)
+                               {
+                                       this.connection.Disconnect();
+                               }
+
+                               if (this.thread != null)
+                               {
+                                       this.thread.Abort();
+                                       this.thread.Join();
+
+                                       this.thread = null;
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void ThreadHandler()
+               {
+                       int             operation = -1;
+                       int             dbHandle = 0;
+                       int             eventId = 0;
+                       byte[]  buffer  = null;
+                       byte[]  ast             = null;
+
+                       while (this.events.Count > 0)
+                       {
+                               try
+                               {
+                                       operation = this.connection.NextOperation();
+
+                                       switch (operation)
+                                       {
+                                               case IscCodes.op_response:
+                                                       this.connection.ReadGenericResponse();
+                                                       break;
+
+                                               case IscCodes.op_exit:
+                                               case IscCodes.op_disconnect:
+                                                       this.connection.Disconnect();
+                                                       return;
+
+                                               case IscCodes.op_event:
+                                                       dbHandle        = this.connection.Receive.ReadInt32();
+                                                       buffer          = this.connection.Receive.ReadBuffer();
+                                                       ast                     = this.connection.Receive.ReadBytes(8);
+                                                       eventId         = this.connection.Receive.ReadInt32();
+
+                                                       if (this.events.ContainsKey(eventId))
+                                                       {
+                                                               RemoteEvent currentEvent = (RemoteEvent)this.events[eventId];
+
+                                                               lock (this.events.SyncRoot)
+                                                               {
+                                                                       // Remove event from the list
+                                                                       this.events.Remove(eventId);
+
+                                                                       // Notify new event     counts
+                                                                       currentEvent.EventCounts(buffer);
+
+                                                                       if (this.events.Count == 0)
+                                                                       {
+                                                                               return;
+                                                                       }
+                                                               }
+                                                       }
+                                                       break;
+                                       }
+                               }
+                               catch (ThreadAbortException)
+                               {
+                                       return;
+                               }
+                               catch (Exception)
+                               {
+                                       return;
+                               }
+                       }
+               }
+
+               #endregion
+       }
+}
index 8029f5de7011ea75e95fc4187d233eb9723622d9..6840429c0bbf35f9093384fca351fea111ec2643 100644 (file)
@@ -1,71 +1,71 @@
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal sealed class GdsResponse\r
-       {\r
-               #region Fields\r
-\r
-               private int                     objectHandle;\r
-               private long            blobId;\r
-               private byte[]          data;\r
-               private IscException warning;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int ObjectHandle\r
-               {\r
-                       get { return objectHandle; }\r
-               }\r
-\r
-               public long BlobId\r
-               {\r
-                       get { return blobId; }\r
-               }\r
-\r
-               public byte[] Data\r
-               {\r
-                       get { return data; }\r
-               }\r
-\r
-               public IscException Warning\r
-               {\r
-                       get { return this.warning; }\r
-                       set { this.warning = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsResponse(int objectHandle, long blobId, byte[] data)\r
-               {\r
-                       this.objectHandle       = objectHandle;\r
-                       this.blobId                     = blobId;\r
-                       this.data                       = data;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal sealed class GdsResponse
+       {
+               #region Fields
+
+               private int                     objectHandle;
+               private long            blobId;
+               private byte[]          data;
+               private IscException warning;
+
+               #endregion
+
+               #region Properties
+
+               public int ObjectHandle
+               {
+                       get { return objectHandle; }
+               }
+
+               public long BlobId
+               {
+                       get { return blobId; }
+               }
+
+               public byte[] Data
+               {
+                       get { return data; }
+               }
+
+               public IscException Warning
+               {
+                       get { return this.warning; }
+                       set { this.warning = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsResponse(int objectHandle, long blobId, byte[] data)
+               {
+                       this.objectHandle       = objectHandle;
+                       this.blobId                     = blobId;
+                       this.data                       = data;
+               }
+
+               #endregion
+       }
+}
index ce7d2b963f24a9b17719361ff52a16ced448550b..0fd46726b05498481fc02aca9d5c711f85ce0817 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal sealed class GdsServiceManager : IServiceManager\r
-       {\r
-               #region Fields\r
-\r
-               private int handle;\r
-               private GdsConnection connection;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int Handle\r
-               {\r
-                       get { return this.handle; }\r
-               }\r
-\r
-               public bool IsLittleEndian\r
-               {\r
-                       get { return false; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsServiceManager()\r
-               {\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       if (this.connection == null)\r
-                                       {\r
-                                               this.connection = new GdsConnection();\r
-                                       }\r
-\r
-                                       this.connection.Connect(dataSource, port, 8192, Charset.DefaultCharset);\r
-\r
-                                       this.connection.Send.Write(IscCodes.op_service_attach);\r
-                                       this.connection.Send.Write(0);\r
-                                       this.connection.Send.Write(service);\r
-                                       this.connection.Send.WriteBuffer(spb.ToArray());\r
-                                       this.connection.Send.Flush();\r
-\r
-                                       try\r
-                                       {\r
-                                               this.handle = this.connection.ReadGenericResponse().ObjectHandle;\r
-                                       }\r
-                                       catch (IscException)\r
-                                       {\r
-                                               try\r
-                                               {\r
-                                                       this.Detach();\r
-                                               }\r
-                                               catch\r
-                                               {\r
-                                               }\r
-\r
-                                               throw;\r
-                                       }\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       this.connection.Disconnect();\r
-\r
-                                       throw new IscException(IscCodes.isc_net_write_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void Detach()\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.connection.Send.Write(IscCodes.op_service_detach);\r
-                                       this.connection.Send.Write(this.Handle);\r
-                                       this.connection.Send.Flush();\r
-\r
-                                       this.connection.ReadGenericResponse();\r
-\r
-                                       this.handle = 0;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_network_error);\r
-                               }\r
-                               finally\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               this.connection.Disconnect();\r
-                                       }\r
-                                       catch (IOException)\r
-                                       {\r
-                                               throw new IscException(IscCodes.isc_network_error);\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void Start(ServiceParameterBuffer spb)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.connection.Send.Write(IscCodes.op_service_start);\r
-                                       this.connection.Send.Write(this.Handle);\r
-                                       this.connection.Send.Write(0);\r
-                                       this.connection.Send.WriteBuffer(spb.ToArray(), spb.Length);\r
-                                       this.connection.Send.Flush();\r
-\r
-                                       try\r
-                                       {\r
-                                               this.connection.ReadGenericResponse();\r
-                                       }\r
-                                       catch (IscException)\r
-                                       {\r
-                                               throw;\r
-                                       }\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_write_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void Query(\r
-                       ServiceParameterBuffer  spb,\r
-                       int                                             requestLength,\r
-                       byte[]                                  requestBuffer,\r
-                       int                                             bufferLength,\r
-                       byte[]                                  buffer)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.connection.Send.Write(IscCodes.op_service_info);   //      operation\r
-                                       this.connection.Send.Write(this.Handle);                                //      db_handle\r
-                                       this.connection.Send.Write((int)0);                                             //      incarnation                                     \r
-                                       this.connection.Send.WriteTyped(\r
-                                               IscCodes.isc_spb_version, spb.ToArray());                       //      Service parameter buffer\r
-                                       this.connection.Send.WriteBuffer(\r
-                                               requestBuffer, requestLength);                                          //      request buffer\r
-                                       this.connection.Send.Write(bufferLength);                               //      result buffer length\r
-\r
-                                       this.connection.Send.Flush();\r
-\r
-                                       GdsResponse r = this.connection.ReadGenericResponse();\r
-\r
-                                       Buffer.BlockCopy(r.Data, 0, buffer, 0, bufferLength);\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_network_error);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Buffer creation methods\r
-\r
-               public ServiceParameterBuffer CreateParameterBuffer()\r
-               {\r
-                       return new ServiceParameterBuffer();\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.IO;
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal sealed class GdsServiceManager : IServiceManager
+       {
+               #region Fields
+
+               private int handle;
+               private GdsConnection connection;
+
+               #endregion
+
+               #region Properties
+
+               public int Handle
+               {
+                       get { return this.handle; }
+               }
+
+               public bool IsLittleEndian
+               {
+                       get { return false; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsServiceManager()
+               {
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       if (this.connection == null)
+                                       {
+                                               this.connection = new GdsConnection();
+                                       }
+
+                                       this.connection.Connect(dataSource, port, 8192, Charset.DefaultCharset);
+
+                                       this.connection.Send.Write(IscCodes.op_service_attach);
+                                       this.connection.Send.Write(0);
+                                       this.connection.Send.Write(service);
+                                       this.connection.Send.WriteBuffer(spb.ToArray());
+                                       this.connection.Send.Flush();
+
+                                       try
+                                       {
+                                               this.handle = this.connection.ReadGenericResponse().ObjectHandle;
+                                       }
+                                       catch (IscException)
+                                       {
+                                               try
+                                               {
+                                                       this.Detach();
+                                               }
+                                               catch
+                                               {
+                                               }
+
+                                               throw;
+                                       }
+                               }
+                               catch (IOException)
+                               {
+                                       this.connection.Disconnect();
+
+                                       throw new IscException(IscCodes.isc_net_write_err);
+                               }
+                       }
+               }
+
+               public void Detach()
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.connection.Send.Write(IscCodes.op_service_detach);
+                                       this.connection.Send.Write(this.Handle);
+                                       this.connection.Send.Flush();
+
+                                       this.connection.ReadGenericResponse();
+
+                                       this.handle = 0;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_network_error);
+                               }
+                               finally
+                               {
+                                       try
+                                       {
+                                               this.connection.Disconnect();
+                                       }
+                                       catch (IOException)
+                                       {
+                                               throw new IscException(IscCodes.isc_network_error);
+                                       }
+                               }
+                       }
+               }
+
+               public void Start(ServiceParameterBuffer spb)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.connection.Send.Write(IscCodes.op_service_start);
+                                       this.connection.Send.Write(this.Handle);
+                                       this.connection.Send.Write(0);
+                                       this.connection.Send.WriteBuffer(spb.ToArray(), spb.Length);
+                                       this.connection.Send.Flush();
+
+                                       try
+                                       {
+                                               this.connection.ReadGenericResponse();
+                                       }
+                                       catch (IscException)
+                                       {
+                                               throw;
+                                       }
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_write_err);
+                               }
+                       }
+               }
+
+               public void Query(
+                       ServiceParameterBuffer  spb,
+                       int                                             requestLength,
+                       byte[]                                  requestBuffer,
+                       int                                             bufferLength,
+                       byte[]                                  buffer)
+               {
+                       lock (this)
+                       {
+                               try
+                               {
+                                       this.connection.Send.Write(IscCodes.op_service_info);   //      operation
+                                       this.connection.Send.Write(this.Handle);                                //      db_handle
+                                       this.connection.Send.Write((int)0);                                             //      incarnation                                     
+                                       this.connection.Send.WriteTyped(
+                                               IscCodes.isc_spb_version, spb.ToArray());                       //      Service parameter buffer
+                                       this.connection.Send.WriteBuffer(
+                                               requestBuffer, requestLength);                                          //      request buffer
+                                       this.connection.Send.Write(bufferLength);                               //      result buffer length
+
+                                       this.connection.Send.Flush();
+
+                                       GdsResponse r = this.connection.ReadGenericResponse();
+
+                                       Buffer.BlockCopy(r.Data, 0, buffer, 0, bufferLength);
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_network_error);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Buffer creation methods
+
+               public ServiceParameterBuffer CreateParameterBuffer()
+               {
+                       return new ServiceParameterBuffer();
+               }
+
+               #endregion
+       }
+}
index 18153e16904419fcd91f168e07e43a1896355ae6..09136d412a159d2774a61404dc6f3c9c4cac96b0 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Text;\r
-using System.IO;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal class GdsStatement : StatementBase\r
-       {\r
-               #region Fields\r
-\r
-               private int                             handle;\r
-               private GdsDatabase             db;\r
-               private GdsTransaction  transaction;\r
-               private Descriptor              parameters;\r
-               private Descriptor              fields;\r
-               private StatementState  state;\r
-               private DbStatementType statementType;\r
-               private bool                    allRowsFetched;\r
-               private Queue                   rows;\r
-               private Queue                   outputParams;\r
-               private int                             recordsAffected;\r
-               private int                             fetchSize;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public override IDatabase DB\r
-               {\r
-                       get { return this.db; }\r
-                       set { this.db = (GdsDatabase)value; }\r
-               }\r
-\r
-               public override ITransaction Transaction\r
-               {\r
-                       get { return this.transaction; }\r
-                       set\r
-                       {\r
-                               if (this.transaction != value)\r
-                               {\r
-                                       if (this.TransactionUpdate != null && this.transaction != null)\r
-                                       {\r
-                                               this.transaction.Update -= this.TransactionUpdate;\r
-                                               this.TransactionUpdate  = null;\r
-                                       }\r
-\r
-                                       if (value == null)\r
-                                       {\r
-                                               this.transaction = null;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               this.transaction                = (GdsTransaction)value;\r
-                                               this.TransactionUpdate  = new TransactionUpdateEventHandler(this.TransactionUpdated);\r
-                                               this.transaction.Update += this.TransactionUpdate;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public override Descriptor Parameters\r
-               {\r
-                       get { return this.parameters; }\r
-                       set { this.parameters = value; }\r
-               }\r
-\r
-               public override Descriptor Fields\r
-               {\r
-                       get { return this.fields; }\r
-               }\r
-\r
-               public override int RecordsAffected\r
-               {\r
-                       get { return this.recordsAffected; }\r
-               }\r
-\r
-               public override bool IsPrepared\r
-               {\r
-                       get\r
-                       {\r
-                               if (this.state == StatementState.Deallocated ||\r
-                                       this.state == StatementState.Error)\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               else\r
-                               {\r
-                                       return true;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public override DbStatementType StatementType\r
-               {\r
-                       get { return this.statementType; }\r
-                       set { this.statementType = value; }\r
-               }\r
-\r
-               public override StatementState State\r
-               {\r
-                       get { return this.state; }\r
-                       set { this.state = value; }\r
-               }\r
-\r
-               public override int FetchSize\r
-               {\r
-                       get { return this.fetchSize; }\r
-                       set { this.fetchSize = value; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsStatement(IDatabase db)\r
-                       : this(db, null)\r
-               {\r
-               }\r
-\r
-               public GdsStatement(IDatabase db, ITransaction transaction)\r
-               {\r
-                       if (!(db is GdsDatabase))\r
-                       {\r
-                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");\r
-                       }\r
-                       if (transaction != null && !(transaction is GdsTransaction))\r
-                       {\r
-                               throw new ArgumentException("Specified argument is not of GdsTransaction type.");\r
-                       }\r
-\r
-                       this.recordsAffected = -1;\r
-                       this.fetchSize          = 200;\r
-                       this.rows                       = new Queue();\r
-                       this.outputParams       = new Queue();\r
-\r
-                       this.db = (GdsDatabase)db;\r
-                       if (transaction != null)\r
-                       {\r
-                               this.Transaction = transaction;\r
-                       }\r
-\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     Methods\r
-\r
-               protected override void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.IsDisposed)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // release any unmanaged resources\r
-                                               this.Release();\r
-\r
-                                               // release any managed resources\r
-                                               if (disposing)\r
-                                               {\r
-                                                       this.Clear();\r
-\r
-                                                       this.rows                       = null;\r
-                                                       this.outputParams       = null;\r
-                                                       this.db                         = null;\r
-                                                       this.fields                     = null;\r
-                                                       this.parameters         = null;\r
-                                                       this.transaction        = null;\r
-                                                       this.allRowsFetched = false;\r
-                                                       this.state                      = StatementState.Deallocated;\r
-                                                       this.handle                     = 0;\r
-                                                       this.fetchSize          = 0;\r
-                                                       this.recordsAffected = 0;\r
-                                               }\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               base.Dispose(disposing);\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Blob Creation Metods\r
-\r
-               public override BlobBase CreateBlob()\r
-               {\r
-                       return new GdsBlob(this.db, this.transaction);\r
-               }\r
-\r
-               public override BlobBase CreateBlob(long blobId)\r
-               {\r
-                       return new GdsBlob(this.db, this.transaction, blobId);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Array Creation Methods\r
-\r
-               public override ArrayBase CreateArray(ArrayDesc descriptor)\r
-               {\r
-                       return new GdsArray(descriptor);\r
-               }\r
-\r
-               public override ArrayBase CreateArray(string tableName, string fieldName)\r
-               {\r
-                       return new GdsArray(this.db, this.transaction, tableName, fieldName);\r
-               }\r
-\r
-               public override ArrayBase CreateArray(long handle, string tableName, string fieldName)\r
-               {\r
-                       return new GdsArray(this.db, this.transaction, handle, tableName, fieldName);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public override void Prepare(string commandText)\r
-               {\r
-                       // Clear data\r
-                       this.Clear();\r
-                       this.parameters = null;\r
-                       this.fields = null;\r
-\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state == StatementState.Deallocated)\r
-                               {\r
-                                       // Allocate     statement\r
-                                       this.Allocate();\r
-                               }\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_prepare_statement);\r
-                                       this.db.Send.Write(this.transaction.Handle);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Write((int)this.db.Dialect);\r
-                                       this.db.Send.Write(commandText);\r
-                                       this.db.Send.WriteBuffer(DescribeInfoItems, DescribeInfoItems.Length);\r
-                                       this.db.Send.Write(IscCodes.MAX_BUFFER_SIZE);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       GdsResponse r = this.db.ReadGenericResponse();\r
-                                       this.fields = this.ParseSqlInfo(r.Data, DescribeInfoItems);\r
-\r
-                                       // Determine the statement type\r
-                                       this.statementType = this.GetStatementType();\r
-\r
-                                       this.state = StatementState.Prepared;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       this.state = StatementState.Error;\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public override void Execute()\r
-               {\r
-                       if (this.state == StatementState.Deallocated)\r
-                       {\r
-                               throw new InvalidOperationException("Statment is not correctly created.");\r
-                       }\r
-\r
-                       // Clear data\r
-                       this.Clear();\r
-\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       byte[] descriptor = null;\r
-                                       if (this.parameters != null)\r
-                                       {\r
-                                               XdrStream xdr = new XdrStream(this.db.Charset);\r
-                                               xdr.Write(this.parameters);\r
-\r
-                                               descriptor = xdr.ToArray();\r
-\r
-                                               xdr.Close();\r
-                                       }\r
-\r
-                                       if (this.statementType == DbStatementType.StoredProcedure)\r
-                                       {\r
-                                               this.db.Send.Write(IscCodes.op_execute2);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               this.db.Send.Write(IscCodes.op_execute);\r
-                                       }\r
-\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Write(this.transaction.Handle);\r
-\r
-                                       if (this.parameters != null)\r
-                                       {\r
-                                               this.db.Send.WriteBuffer(this.parameters.ToBlrArray());\r
-                                               this.db.Send.Write(0);  // Message number\r
-                                               this.db.Send.Write(1);  // Number of messages\r
-                                               this.db.Send.Write(descriptor, 0, descriptor.Length);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               this.db.Send.WriteBuffer(null);\r
-                                               this.db.Send.Write(0);\r
-                                               this.db.Send.Write(0);\r
-                                       }\r
-\r
-                                       if (this.statementType == DbStatementType.StoredProcedure)\r
-                                       {\r
-                                               this.db.Send.WriteBuffer(\r
-                                                       (this.fields == null) ? null : this.fields.ToBlrArray());\r
-                                               this.db.Send.Write(0);  // Output message number\r
-                                       }\r
-\r
-                                       this.db.Send.Flush();\r
-\r
-                                       if (this.db.NextOperation() == IscCodes.op_sql_response)\r
-                                       {\r
-                                               // This would be an     Execute procedure\r
-                                               this.outputParams.Enqueue(this.ReceiveSqlResponse());\r
-                                       }\r
-\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       // Updated number of records affected by the statement execution                        \r
-                                       if (this.StatementType == DbStatementType.Insert ||\r
-                                               this.StatementType == DbStatementType.Delete ||\r
-                                               this.StatementType == DbStatementType.Update)\r
-                                       {\r
-                                               this.recordsAffected = this.GetRecordsAffected();\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               this.recordsAffected = -1;\r
-                                       }\r
-\r
-                                       this.state = StatementState.Executed;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       this.state = StatementState.Error;\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public override DbValue[] Fetch()\r
-               {\r
-                       if (this.state == StatementState.Deallocated)\r
-                       {\r
-                               throw new InvalidOperationException("Statement is not correctly created.");\r
-                       }\r
-                       if (this.statementType != DbStatementType.Select &&\r
-                               this.statementType != DbStatementType.SelectForUpdate)\r
-                       {\r
-                               return null;\r
-                       }\r
-\r
-                       if (!this.allRowsFetched && this.rows.Count == 0)\r
-                       {\r
-                               // Fetch next batch     of rows\r
-                               lock (this.db)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               this.db.Send.Write(IscCodes.op_fetch);\r
-                                               this.db.Send.Write(this.handle);\r
-                                               this.db.Send.WriteBuffer(this.fields.ToBlrArray());\r
-                                               this.db.Send.Write(0);                  // p_sqldata_message_number                                             \r
-                                               this.db.Send.Write(fetchSize);  // p_sqldata_messages\r
-                                               this.db.Send.Flush();\r
-\r
-                                               if (this.db.NextOperation() == IscCodes.op_fetch_response)\r
-                                               {\r
-                                                       int status      = 0;\r
-                                                       int count       = 1;\r
-                                                       int op          = 0;\r
-\r
-                                                       while (count > 0 && status == 0)\r
-                                                       {\r
-                                                               op = this.db.ReadOperation();\r
-                                                               status = this.db.Receive.ReadInt32();\r
-                                                               count = this.db.Receive.ReadInt32();\r
-\r
-                                                               if (count > 0 && status == 0)\r
-                                                               {\r
-                                                                       this.rows.Enqueue(this.ReadDataRow());\r
-                                                               }\r
-                                                       }\r
-\r
-                                                       if (status == 100)\r
-                                                       {\r
-                                                               this.allRowsFetched = true;\r
-                                                       }\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       this.db.ReadGenericResponse();\r
-                                               }\r
-                                       }\r
-                                       catch (IOException)\r
-                                       {\r
-                                               throw new IscException(IscCodes.isc_net_read_err);\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       if (this.rows != null && this.rows.Count > 0)\r
-                       {\r
-                               // return current row\r
-                               return (DbValue[])this.rows.Dequeue();\r
-                       }\r
-                       else\r
-                       {\r
-                               // All readed clear     rows and return null\r
-                               this.rows.Clear();\r
-\r
-                               return null;\r
-                       }\r
-               }\r
-\r
-               public override DbValue[] GetOuputParameters()\r
-               {\r
-                       if (this.outputParams.Count > 0)\r
-                       {\r
-                               return (DbValue[])this.outputParams.Dequeue();\r
-                       }\r
-\r
-                       return null;\r
-               }\r
-\r
-               public override void Describe()\r
-               {\r
-                       try\r
-                       {\r
-                               byte[] buffer = this.GetSqlInfo(DescribeInfoItems);\r
-                               this.fields = this.ParseSqlInfo(buffer, DescribeInfoItems);\r
-                       }\r
-                       catch (IscException)\r
-                       {\r
-                               throw;\r
-                       }\r
-               }\r
-\r
-               public override void DescribeParameters()\r
-               {\r
-                       try\r
-                       {\r
-                               byte[] buffer = this.GetSqlInfo(DescribeBindInfoItems);\r
-                               this.parameters = this.ParseSqlInfo(buffer, DescribeBindInfoItems);\r
-                       }\r
-                       catch (IscException)\r
-                       {\r
-                               throw;\r
-                       }\r
-               }\r
-\r
-               public override byte[] GetSqlInfo(byte[] items, int bufferLength)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_info_sql);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Write(0);\r
-                                       this.db.Send.WriteBuffer(items, items.Length);\r
-                                       this.db.Send.Write(bufferLength);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       return this.db.ReadGenericResponse().Data;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Protected Methods\r
-\r
-               protected override void Free(int option)\r
-               {\r
-                       // Does not     seem to be possible     or necessary to close\r
-                       // an execute procedure statement.\r
-                       if (this.StatementType == DbStatementType.StoredProcedure &&\r
-                               option == IscCodes.DSQL_close)\r
-                       {\r
-                               return;\r
-                       }\r
-\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_free_statement);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Write(option);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       // Reset statement information\r
-                                       if (option == IscCodes.DSQL_drop)\r
-                                       {\r
-                                               this.parameters = null;\r
-                                               this.fields = null;\r
-                                       }\r
-\r
-                                       this.Clear();\r
-                                       this.allRowsFetched = false;\r
-\r
-                                       this.db.ReadGenericResponse();\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       this.state = StatementState.Error;\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               protected override void TransactionUpdated(object sender, EventArgs e)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (this.Transaction != null && this.TransactionUpdate != null)\r
-                               {\r
-                                       this.Transaction.Update -= this.TransactionUpdate;\r
-                               }\r
-\r
-                               this.State = StatementState.Closed;\r
-                               this.TransactionUpdate = null;\r
-                               this.allRowsFetched = false;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Response Methods\r
-\r
-               private DbValue[] ReceiveSqlResponse()\r
-               {\r
-                       try\r
-                       {\r
-                               if (this.db.ReadOperation() == IscCodes.op_sql_response)\r
-                               {\r
-                                       int messages = this.db.Receive.ReadInt32();\r
-                                       if (messages > 0)\r
-                                       {\r
-                                               return this.ReadDataRow();\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               return null;\r
-                                       }\r
-                               }\r
-                               else\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-                       catch (IOException)\r
-                       {\r
-                               throw new IscException(IscCodes.isc_net_read_err);\r
-                       }\r
-               }\r
-\r
-               private DbValue[] ReadDataRow()\r
-               {\r
-                       DbValue[] row = new DbValue[this.fields.Count];\r
-                       object value = null;\r
-\r
-                       lock (this.db)\r
-                       {\r
-                               // This only works if not (port->port_flags     & PORT_symmetric)                               \r
-                               for (int i = 0; i < this.fields.Count; i++)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               value = this.db.Receive.ReadValue(this.fields[i]);\r
-                                               row[i] = new DbValue(this, this.fields[i], value);\r
-                                       }\r
-                                       catch (IOException)\r
-                                       {\r
-                                               throw new IscException(IscCodes.isc_net_read_err);\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return row;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void Clear()\r
-               {\r
-                       if (this.rows != null && this.rows.Count > 0)\r
-                       {\r
-                               this.rows.Clear();\r
-                       }\r
-                       if (this.outputParams != null && this.outputParams.Count > 0)\r
-                       {\r
-                               this.outputParams.Clear();\r
-                       }\r
-               }\r
-\r
-               private void Allocate()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_allocate_statement);\r
-                                       this.db.Send.Write(this.db.Handle);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.handle = this.db.ReadGenericResponse().ObjectHandle;\r
-                                       this.allRowsFetched = false;\r
-                                       this.state = StatementState.Allocated;\r
-                                       this.statementType = DbStatementType.None;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       this.state = StatementState.Deallocated;\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               private Descriptor ParseSqlInfo(byte[] info, byte[] items)\r
-               {\r
-                       Descriptor rowDesc = null;\r
-                       int lastindex = 0;\r
-\r
-                       while ((lastindex = this.ParseTruncSqlInfo(info, ref rowDesc, lastindex)) > 0)\r
-                       {\r
-                               lastindex--;                       // Is this OK ?\r
-\r
-                               byte[] new_items = new byte[4 + items.Length];\r
-\r
-                               new_items[0] = IscCodes.isc_info_sql_sqlda_start;\r
-                               new_items[1] = 2;\r
-                               new_items[2] = (byte)(lastindex & 255);\r
-                               new_items[3] = (byte)(lastindex >> 8);\r
-\r
-                               Array.Copy(items, 0, new_items, 4, items.Length);\r
-                               info = this.GetSqlInfo(new_items, info.Length);\r
-                       }\r
-\r
-                       return rowDesc;\r
-               }\r
-\r
-               private int ParseTruncSqlInfo(byte[] info, ref Descriptor rowDesc, int lastindex)\r
-               {\r
-                       byte    item    = 0;\r
-                       int             index   = 0;\r
-                       int             i               = 2;\r
-\r
-                       int len = IscHelper.VaxInteger(info, i, 2);\r
-                       i += 2;\r
-                       int n = IscHelper.VaxInteger(info, i, len);\r
-                       i += len;\r
-\r
-                       if (rowDesc == null)\r
-                       {\r
-                               rowDesc = new Descriptor((short)n);\r
-                       }\r
-\r
-                       while (info[i] != IscCodes.isc_info_end)\r
-                       {\r
-                               while ((item = info[i++]) != IscCodes.isc_info_sql_describe_end)\r
-                               {\r
-                                       switch (item)\r
-                                       {\r
-                                               case IscCodes.isc_info_sql_sqlda_seq:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       index = IscHelper.VaxInteger(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_type:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].DataType = (short)IscHelper.VaxInteger(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_sub_type:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].SubType = (short)IscHelper.VaxInteger(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_scale:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].NumericScale = (short)IscHelper.VaxInteger(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_length:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].Length = (short)IscHelper.VaxInteger(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_field:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].Name = this.db.Charset.GetString(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_relation:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].Relation = this.db.Charset.GetString(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_owner:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].Owner = this.db.Charset.GetString(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_sql_alias:\r
-                                                       len = IscHelper.VaxInteger(info, i, 2);\r
-                                                       i += 2;\r
-                                                       rowDesc[index - 1].Alias = this.db.Charset.GetString(info, i, len);\r
-                                                       i += len;\r
-                                                       break;\r
-\r
-                                               case IscCodes.isc_info_truncated:\r
-                                                       return lastindex;\r
-\r
-                                               default:\r
-                                                       throw new IscException(IscCodes.isc_dsql_sqlda_err);\r
-                                       }\r
-                               }\r
-\r
-                               lastindex = index;\r
-                       }\r
-\r
-                       return 0;\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.Text;
+using System.IO;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal class GdsStatement : StatementBase
+       {
+               #region Fields
+
+               private int                             handle;
+               private GdsDatabase             db;
+               private GdsTransaction  transaction;
+               private Descriptor              parameters;
+               private Descriptor              fields;
+               private StatementState  state;
+               private DbStatementType statementType;
+               private bool                    allRowsFetched;
+               private Queue                   rows;
+               private Queue                   outputParams;
+               private int                             recordsAffected;
+               private int                             fetchSize;
+
+               #endregion
+
+               #region Properties
+
+               public override IDatabase DB
+               {
+                       get { return this.db; }
+                       set { this.db = (GdsDatabase)value; }
+               }
+
+               public override ITransaction Transaction
+               {
+                       get { return this.transaction; }
+                       set
+                       {
+                               if (this.transaction != value)
+                               {
+                                       if (this.TransactionUpdate != null && this.transaction != null)
+                                       {
+                                               this.transaction.Update -= this.TransactionUpdate;
+                                               this.TransactionUpdate  = null;
+                                       }
+
+                                       if (value == null)
+                                       {
+                                               this.transaction = null;
+                                       }
+                                       else
+                                       {
+                                               this.transaction                = (GdsTransaction)value;
+                                               this.TransactionUpdate  = new TransactionUpdateEventHandler(this.TransactionUpdated);
+                                               this.transaction.Update += this.TransactionUpdate;
+                                       }
+                               }
+                       }
+               }
+
+               public override Descriptor Parameters
+               {
+                       get { return this.parameters; }
+                       set { this.parameters = value; }
+               }
+
+               public override Descriptor Fields
+               {
+                       get { return this.fields; }
+               }
+
+               public override int RecordsAffected
+               {
+                       get { return this.recordsAffected; }
+               }
+
+               public override bool IsPrepared
+               {
+                       get
+                       {
+                               if (this.state == StatementState.Deallocated ||
+                                       this.state == StatementState.Error)
+                               {
+                                       return false;
+                               }
+                               else
+                               {
+                                       return true;
+                               }
+                       }
+               }
+
+               public override DbStatementType StatementType
+               {
+                       get { return this.statementType; }
+                       set { this.statementType = value; }
+               }
+
+               public override StatementState State
+               {
+                       get { return this.state; }
+                       set { this.state = value; }
+               }
+
+               public override int FetchSize
+               {
+                       get { return this.fetchSize; }
+                       set { this.fetchSize = value; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsStatement(IDatabase db)
+                       : this(db, null)
+               {
+               }
+
+               public GdsStatement(IDatabase db, ITransaction transaction)
+               {
+                       if (!(db is GdsDatabase))
+                       {
+                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");
+                       }
+                       if (transaction != null && !(transaction is GdsTransaction))
+                       {
+                               throw new ArgumentException("Specified argument is not of GdsTransaction type.");
+                       }
+
+                       this.recordsAffected = -1;
+                       this.fetchSize          = 200;
+                       this.rows                       = new Queue();
+                       this.outputParams       = new Queue();
+
+                       this.db = (GdsDatabase)db;
+                       if (transaction != null)
+                       {
+                               this.Transaction = transaction;
+                       }
+
+                       GC.SuppressFinalize(this);
+               }
+
+               #endregion
+
+               #region IDisposable     Methods
+
+               protected override void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.IsDisposed)
+                               {
+                                       try
+                                       {
+                                               // release any unmanaged resources
+                                               this.Release();
+
+                                               // release any managed resources
+                                               if (disposing)
+                                               {
+                                                       this.Clear();
+
+                                                       this.rows                       = null;
+                                                       this.outputParams       = null;
+                                                       this.db                         = null;
+                                                       this.fields                     = null;
+                                                       this.parameters         = null;
+                                                       this.transaction        = null;
+                                                       this.allRowsFetched = false;
+                                                       this.state                      = StatementState.Deallocated;
+                                                       this.handle                     = 0;
+                                                       this.fetchSize          = 0;
+                                                       this.recordsAffected = 0;
+                                               }
+                                       }
+                                       finally
+                                       {
+                                               base.Dispose(disposing);
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Blob Creation Metods
+
+               public override BlobBase CreateBlob()
+               {
+                       return new GdsBlob(this.db, this.transaction);
+               }
+
+               public override BlobBase CreateBlob(long blobId)
+               {
+                       return new GdsBlob(this.db, this.transaction, blobId);
+               }
+
+               #endregion
+
+               #region Array Creation Methods
+
+               public override ArrayBase CreateArray(ArrayDesc descriptor)
+               {
+                       return new GdsArray(descriptor);
+               }
+
+               public override ArrayBase CreateArray(string tableName, string fieldName)
+               {
+                       return new GdsArray(this.db, this.transaction, tableName, fieldName);
+               }
+
+               public override ArrayBase CreateArray(long handle, string tableName, string fieldName)
+               {
+                       return new GdsArray(this.db, this.transaction, handle, tableName, fieldName);
+               }
+
+               #endregion
+
+               #region Methods
+
+               public override void Prepare(string commandText)
+               {
+                       // Clear data
+                       this.Clear();
+                       this.parameters = null;
+                       this.fields = null;
+
+                       lock (this.db)
+                       {
+                               if (this.state == StatementState.Deallocated)
+                               {
+                                       // Allocate     statement
+                                       this.Allocate();
+                               }
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_prepare_statement);
+                                       this.db.Send.Write(this.transaction.Handle);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Write((int)this.db.Dialect);
+                                       this.db.Send.Write(commandText);
+                                       this.db.Send.WriteBuffer(DescribeInfoItems, DescribeInfoItems.Length);
+                                       this.db.Send.Write(IscCodes.MAX_BUFFER_SIZE);
+                                       this.db.Send.Flush();
+
+                                       GdsResponse r = this.db.ReadGenericResponse();
+                                       this.fields = this.ParseSqlInfo(r.Data, DescribeInfoItems);
+
+                                       // Determine the statement type
+                                       this.statementType = this.GetStatementType();
+
+                                       this.state = StatementState.Prepared;
+                               }
+                               catch (IOException)
+                               {
+                                       this.state = StatementState.Error;
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public override void Execute()
+               {
+                       if (this.state == StatementState.Deallocated)
+                       {
+                               throw new InvalidOperationException("Statment is not correctly created.");
+                       }
+
+                       // Clear data
+                       this.Clear();
+
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       byte[] descriptor = null;
+                                       if (this.parameters != null)
+                                       {
+                                               XdrStream xdr = new XdrStream(this.db.Charset);
+                                               xdr.Write(this.parameters);
+
+                                               descriptor = xdr.ToArray();
+
+                                               xdr.Close();
+                                       }
+
+                                       if (this.statementType == DbStatementType.StoredProcedure)
+                                       {
+                                               this.db.Send.Write(IscCodes.op_execute2);
+                                       }
+                                       else
+                                       {
+                                               this.db.Send.Write(IscCodes.op_execute);
+                                       }
+
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Write(this.transaction.Handle);
+
+                                       if (this.parameters != null)
+                                       {
+                                               this.db.Send.WriteBuffer(this.parameters.ToBlrArray());
+                                               this.db.Send.Write(0);  // Message number
+                                               this.db.Send.Write(1);  // Number of messages
+                                               this.db.Send.Write(descriptor, 0, descriptor.Length);
+                                       }
+                                       else
+                                       {
+                                               this.db.Send.WriteBuffer(null);
+                                               this.db.Send.Write(0);
+                                               this.db.Send.Write(0);
+                                       }
+
+                                       if (this.statementType == DbStatementType.StoredProcedure)
+                                       {
+                                               this.db.Send.WriteBuffer(
+                                                       (this.fields == null) ? null : this.fields.ToBlrArray());
+                                               this.db.Send.Write(0);  // Output message number
+                                       }
+
+                                       this.db.Send.Flush();
+
+                                       if (this.db.NextOperation() == IscCodes.op_sql_response)
+                                       {
+                                               // This would be an     Execute procedure
+                                               this.outputParams.Enqueue(this.ReceiveSqlResponse());
+                                       }
+
+                                       this.db.ReadGenericResponse();
+
+                                       // Updated number of records affected by the statement execution                        
+                                       if (this.StatementType == DbStatementType.Insert ||
+                                               this.StatementType == DbStatementType.Delete ||
+                                               this.StatementType == DbStatementType.Update ||
+                        this.StatementType == DbStatementType.StoredProcedure)
+                                       {
+                                               this.recordsAffected = this.GetRecordsAffected();
+                                       }
+                                       else
+                                       {
+                                               this.recordsAffected = -1;
+                                       }
+
+                                       this.state = StatementState.Executed;
+                               }
+                               catch (IOException)
+                               {
+                                       this.state = StatementState.Error;
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public override DbValue[] Fetch()
+               {
+                       if (this.state == StatementState.Deallocated)
+                       {
+                               throw new InvalidOperationException("Statement is not correctly created.");
+                       }
+                       if (this.statementType != DbStatementType.Select &&
+                               this.statementType != DbStatementType.SelectForUpdate)
+                       {
+                               return null;
+                       }
+
+                       if (!this.allRowsFetched && this.rows.Count == 0)
+                       {
+                               // Fetch next batch     of rows
+                               lock (this.db)
+                               {
+                                       try
+                                       {
+                                               this.db.Send.Write(IscCodes.op_fetch);
+                                               this.db.Send.Write(this.handle);
+                                               this.db.Send.WriteBuffer(this.fields.ToBlrArray());
+                                               this.db.Send.Write(0);                  // p_sqldata_message_number                                             
+                                               this.db.Send.Write(fetchSize);  // p_sqldata_messages
+                                               this.db.Send.Flush();
+
+                                               if (this.db.NextOperation() == IscCodes.op_fetch_response)
+                                               {
+                                                       int status      = 0;
+                                                       int count       = 1;
+                                                       int op          = 0;
+
+                                                       while (count > 0 && status == 0)
+                                                       {
+                                                               op = this.db.ReadOperation();
+                                                               status = this.db.Receive.ReadInt32();
+                                                               count = this.db.Receive.ReadInt32();
+
+                                                               if (count > 0 && status == 0)
+                                                               {
+                                                                       this.rows.Enqueue(this.ReadDataRow());
+                                                               }
+                                                       }
+
+                                                       if (status == 100)
+                                                       {
+                                                               this.allRowsFetched = true;
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       this.db.ReadGenericResponse();
+                                               }
+                                       }
+                                       catch (IOException)
+                                       {
+                                               throw new IscException(IscCodes.isc_net_read_err);
+                                       }
+                               }
+                       }
+
+                       if (this.rows != null && this.rows.Count > 0)
+                       {
+                               // return current row
+                               return (DbValue[])this.rows.Dequeue();
+                       }
+                       else
+                       {
+                               // All readed clear     rows and return null
+                               this.rows.Clear();
+
+                               return null;
+                       }
+               }
+
+               public override DbValue[] GetOuputParameters()
+               {
+                       if (this.outputParams.Count > 0)
+                       {
+                               return (DbValue[])this.outputParams.Dequeue();
+                       }
+
+                       return null;
+               }
+
+               public override void Describe()
+               {
+                       try
+                       {
+                               byte[] buffer = this.GetSqlInfo(DescribeInfoItems);
+                               this.fields = this.ParseSqlInfo(buffer, DescribeInfoItems);
+                       }
+                       catch (IscException)
+                       {
+                               throw;
+                       }
+               }
+
+               public override void DescribeParameters()
+               {
+                       try
+                       {
+                               byte[] buffer = this.GetSqlInfo(DescribeBindInfoItems);
+                               this.parameters = this.ParseSqlInfo(buffer, DescribeBindInfoItems);
+                       }
+                       catch (IscException)
+                       {
+                               throw;
+                       }
+               }
+
+               public override byte[] GetSqlInfo(byte[] items, int bufferLength)
+               {
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_info_sql);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Write(0);
+                                       this.db.Send.WriteBuffer(items, items.Length);
+                                       this.db.Send.Write(bufferLength);
+                                       this.db.Send.Flush();
+
+                                       return this.db.ReadGenericResponse().Data;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Protected Methods
+
+               protected override void Free(int option)
+               {
+                       // Does not     seem to be possible     or necessary to close
+                       // an execute procedure statement.
+                       if (this.StatementType == DbStatementType.StoredProcedure &&
+                               option == IscCodes.DSQL_close)
+                       {
+                               return;
+                       }
+
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_free_statement);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Write(option);
+                                       this.db.Send.Flush();
+
+                                       // Reset statement information
+                                       if (option == IscCodes.DSQL_drop)
+                                       {
+                                               this.parameters = null;
+                                               this.fields = null;
+                                       }
+
+                                       this.Clear();
+                                       this.allRowsFetched = false;
+
+                                       this.db.ReadGenericResponse();
+                               }
+                               catch (IOException)
+                               {
+                                       this.state = StatementState.Error;
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               protected override void TransactionUpdated(object sender, EventArgs e)
+               {
+                       lock (this)
+                       {
+                               if (this.Transaction != null && this.TransactionUpdate != null)
+                               {
+                                       this.Transaction.Update -= this.TransactionUpdate;
+                               }
+
+                               this.State = StatementState.Closed;
+                               this.TransactionUpdate = null;
+                               this.allRowsFetched = false;
+                       }
+               }
+
+               #endregion
+
+               #region Response Methods
+
+               private DbValue[] ReceiveSqlResponse()
+               {
+                       try
+                       {
+                               if (this.db.ReadOperation() == IscCodes.op_sql_response)
+                               {
+                                       int messages = this.db.Receive.ReadInt32();
+                                       if (messages > 0)
+                                       {
+                                               return this.ReadDataRow();
+                                       }
+                                       else
+                                       {
+                                               return null;
+                                       }
+                               }
+                               else
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+                       catch (IOException)
+                       {
+                               throw new IscException(IscCodes.isc_net_read_err);
+                       }
+               }
+
+               private DbValue[] ReadDataRow()
+               {
+                       DbValue[] row = new DbValue[this.fields.Count];
+                       object value = null;
+
+                       lock (this.db)
+                       {
+                               // This only works if not (port->port_flags     & PORT_symmetric)                               
+                               for (int i = 0; i < this.fields.Count; i++)
+                               {
+                                       try
+                                       {
+                                               value = this.db.Receive.ReadValue(this.fields[i]);
+                                               row[i] = new DbValue(this, this.fields[i], value);
+                                       }
+                                       catch (IOException)
+                                       {
+                                               throw new IscException(IscCodes.isc_net_read_err);
+                                       }
+                               }
+                       }
+
+                       return row;
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void Clear()
+               {
+                       if (this.rows != null && this.rows.Count > 0)
+                       {
+                               this.rows.Clear();
+                       }
+                       if (this.outputParams != null && this.outputParams.Count > 0)
+                       {
+                               this.outputParams.Clear();
+                       }
+               }
+
+               private void Allocate()
+               {
+                       lock (this.db)
+                       {
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_allocate_statement);
+                                       this.db.Send.Write(this.db.Handle);
+                                       this.db.Send.Flush();
+
+                                       this.handle = this.db.ReadGenericResponse().ObjectHandle;
+                                       this.allRowsFetched = false;
+                                       this.state = StatementState.Allocated;
+                                       this.statementType = DbStatementType.None;
+                               }
+                               catch (IOException)
+                               {
+                                       this.state = StatementState.Deallocated;
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               private Descriptor ParseSqlInfo(byte[] info, byte[] items)
+               {
+                       Descriptor rowDesc = null;
+                       int lastindex = 0;
+
+                       while ((lastindex = this.ParseTruncSqlInfo(info, ref rowDesc, lastindex)) > 0)
+                       {
+                               lastindex--;                       // Is this OK ?
+
+                               byte[] new_items = new byte[4 + items.Length];
+
+                               new_items[0] = IscCodes.isc_info_sql_sqlda_start;
+                               new_items[1] = 2;
+                               new_items[2] = (byte)(lastindex & 255);
+                               new_items[3] = (byte)(lastindex >> 8);
+
+                               Array.Copy(items, 0, new_items, 4, items.Length);
+                               info = this.GetSqlInfo(new_items, info.Length);
+                       }
+
+                       return rowDesc;
+               }
+
+               private int ParseTruncSqlInfo(byte[] info, ref Descriptor rowDesc, int lastindex)
+               {
+                       byte    item    = 0;
+                       int             index   = 0;
+                       int             i               = 2;
+
+                       int len = IscHelper.VaxInteger(info, i, 2);
+                       i += 2;
+                       int n = IscHelper.VaxInteger(info, i, len);
+                       i += len;
+
+                       if (rowDesc == null)
+                       {
+                               rowDesc = new Descriptor((short)n);
+                       }
+
+                       while (info[i] != IscCodes.isc_info_end)
+                       {
+                               while ((item = info[i++]) != IscCodes.isc_info_sql_describe_end)
+                               {
+                                       switch (item)
+                                       {
+                                               case IscCodes.isc_info_sql_sqlda_seq:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       index = IscHelper.VaxInteger(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_type:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].DataType = (short)IscHelper.VaxInteger(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_sub_type:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].SubType = (short)IscHelper.VaxInteger(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_scale:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].NumericScale = (short)IscHelper.VaxInteger(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_length:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].Length = (short)IscHelper.VaxInteger(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_field:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].Name = this.db.Charset.GetString(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_relation:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].Relation = this.db.Charset.GetString(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_owner:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].Owner = this.db.Charset.GetString(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_sql_alias:
+                                                       len = IscHelper.VaxInteger(info, i, 2);
+                                                       i += 2;
+                                                       rowDesc[index - 1].Alias = this.db.Charset.GetString(info, i, len);
+                                                       i += len;
+                                                       break;
+
+                                               case IscCodes.isc_info_truncated:
+                                                       return lastindex;
+
+                                               default:
+                                                       throw new IscException(IscCodes.isc_dsql_sqlda_err);
+                                       }
+                               }
+
+                               lastindex = index;
+                       }
+
+                       return 0;
+               }
+
+               #endregion
+       }
+}
index 57879b1ecd4ff2d36eca7f1c0a0dafee42f07aaf..75e13ee1fbcc4ed4c077bf77474bf02e240d1089 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Data;\r
-using System.IO;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal sealed class GdsTransaction : ITransaction, IDisposable\r
-       {\r
-               #region Events\r
-\r
-               public event TransactionUpdateEventHandler Update;\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private int                                     handle;\r
-               private bool                            disposed;\r
-               private GdsDatabase                     db;\r
-               private TransactionState        state;\r
-\r
-               #endregion\r
-\r
-               #region Properties\r
-\r
-               public int Handle\r
-               {\r
-                       get { return this.handle; }\r
-               }\r
-\r
-               public TransactionState State\r
-               {\r
-                       get { return this.state; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public GdsTransaction(IDatabase db)\r
-               {\r
-                       if (!(db is GdsDatabase))\r
-                       {\r
-                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");\r
-                       }\r
-\r
-                       this.db         = (GdsDatabase)db;\r
-                       this.state      = TransactionState.NoTransaction;\r
-\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Finalizer\r
-\r
-               ~GdsTransaction()\r
-               {\r
-                       this.Dispose(false);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region IDisposable     methods\r
-\r
-               public void Dispose()\r
-               {\r
-                       this.Dispose(true);\r
-                       GC.SuppressFinalize(this);\r
-               }\r
-\r
-               private void Dispose(bool disposing)\r
-               {\r
-                       lock (this)\r
-                       {\r
-                               if (!this.disposed)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               // release any unmanaged resources\r
-                                               this.Rollback();\r
-\r
-                                               // release any managed resources\r
-                                               if (disposing)\r
-                                               {\r
-                                                       this.db         = null;\r
-                                                       this.handle = 0;\r
-                                                       this.state      = TransactionState.NoTransaction;\r
-                                               }\r
-                                       }\r
-                                       finally\r
-                                       {\r
-                                               this.disposed = true;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Methods\r
-\r
-               public void BeginTransaction(TransactionParameterBuffer tpb)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state != TransactionState.NoTransaction)\r
-                               {\r
-                                       throw new IscException(\r
-                                               IscCodes.isc_arg_gds,\r
-                                               IscCodes.isc_tra_state,\r
-                                               this.handle,\r
-                                               "no valid");\r
-                               }\r
-\r
-                               this.state = TransactionState.TrasactionStarting;\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_transaction);\r
-                                       this.db.Send.Write(this.db.Handle);\r
-                                       this.db.Send.WriteBuffer(tpb.ToArray());\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.handle = db.ReadGenericResponse().ObjectHandle;\r
-                                       this.state = TransactionState.TransactionStarted;\r
-\r
-                                       this.db.TransactionCount++;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void Commit()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state != TransactionState.TransactionStarted &&\r
-                                       this.state != TransactionState.TransactionPrepared)\r
-                               {\r
-                                       throw new IscException(\r
-                                               IscCodes.isc_arg_gds,\r
-                                               IscCodes.isc_tra_state,\r
-                                               this.handle,\r
-                                               "no valid");\r
-                               }\r
-\r
-                               this.state = TransactionState.TransactionCommiting;\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_commit);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       this.db.TransactionCount--;\r
-\r
-                                       if (this.Update != null)\r
-                                       {\r
-                                               this.Update(this, new EventArgs());\r
-                                       }\r
-\r
-                                       this.state = TransactionState.NoTransaction;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void Rollback()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state == TransactionState.NoTransaction)\r
-                               {\r
-                                       throw new IscException(\r
-                                               IscCodes.isc_arg_gds,\r
-                                               IscCodes.isc_tra_state,\r
-                                               this.handle,\r
-                                               "no valid");\r
-                               }\r
-\r
-                               this.state = TransactionState.TransactionRollbacking;\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_rollback);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       this.db.TransactionCount--;\r
-\r
-                                       if (this.Update != null)\r
-                                       {\r
-                                               this.Update(this, new EventArgs());\r
-                                       }\r
-\r
-                                       this.state = TransactionState.NoTransaction;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void CommitRetaining()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state != TransactionState.TransactionStarted &&\r
-                                       this.state != TransactionState.TransactionPrepared)\r
-                               {\r
-                                       throw new IscException(\r
-                                               IscCodes.isc_arg_gds,\r
-                                               IscCodes.isc_tra_state,\r
-                                               this.handle,\r
-                                               "no valid");\r
-                               }\r
-\r
-                               this.state = TransactionState.TransactionCommiting;\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_commit_retaining);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       this.state = TransactionState.TransactionStarted;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void RollbackRetaining()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state != TransactionState.TransactionStarted &&\r
-                                       this.state != TransactionState.TransactionPrepared)\r
-                               {\r
-                                       throw new IscException(\r
-                                               IscCodes.isc_arg_gds,\r
-                                               IscCodes.isc_tra_state,\r
-                                               this.handle,\r
-                                               "no valid");\r
-                               }\r
-\r
-                               this.state = TransactionState.TransactionRollbacking;\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_rollback_retaining);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       this.state = TransactionState.TransactionStarted;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /*\r
-               public void     Prepare()\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state != TransactionState.TransactionStarted)\r
-                               {\r
-                                       throw new IscException(\r
-                                               IscCodes.isc_arg_gds,\r
-                                               IscCodes.isc_tra_state,\r
-                                               this.handle,\r
-                                               "no valid");\r
-                               }\r
-\r
-                               this.state = TransactionState.TransactionPreparing;\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_prepare);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       this.state = TransactionState.TransactionPrepared;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void     Prepare(byte[] buffer)\r
-               {\r
-                       lock (this.db)\r
-                       {\r
-                               if (this.state != TransactionState.TransactionStarted)\r
-                               {\r
-                                       throw new IscException(\r
-                                               IscCodes.isc_arg_gds,\r
-                                               IscCodes.isc_tra_state,\r
-                                               this.handle,\r
-                                               "no valid");\r
-                               }\r
-\r
-                               this.state = TransactionState.TransactionPreparing;\r
-\r
-                               try\r
-                               {\r
-                                       this.db.Send.Write(IscCodes.op_prepare2);\r
-                                       this.db.Send.Write(this.handle);\r
-                                       this.db.Send.WriteBuffer(buffer, buffer.Length);\r
-                                       this.db.Send.Flush();\r
-\r
-                                       this.db.ReadGenericResponse();\r
-\r
-                                       this.state = TransactionState.TransactionStarted;\r
-                               }\r
-                               catch (IOException)\r
-                               {\r
-                                       throw new IscException(IscCodes.isc_net_read_err);\r
-                               }\r
-                       }\r
-               }\r
-               */\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Data;
+using System.IO;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal sealed class GdsTransaction : ITransaction, IDisposable
+       {
+               #region Events
+
+               public event TransactionUpdateEventHandler Update;
+
+               #endregion
+
+               #region Fields
+
+               private int                                     handle;
+               private bool                            disposed;
+               private GdsDatabase                     db;
+               private TransactionState        state;
+
+               #endregion
+
+               #region Properties
+
+               public int Handle
+               {
+                       get { return this.handle; }
+               }
+
+               public TransactionState State
+               {
+                       get { return this.state; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public GdsTransaction(IDatabase db)
+               {
+                       if (!(db is GdsDatabase))
+                       {
+                               throw new ArgumentException("Specified argument is not of GdsDatabase type.");
+                       }
+
+                       this.db         = (GdsDatabase)db;
+                       this.state      = TransactionState.NoTransaction;
+
+                       GC.SuppressFinalize(this);
+               }
+
+               #endregion
+
+               #region Finalizer
+
+               ~GdsTransaction()
+               {
+                       this.Dispose(false);
+               }
+
+               #endregion
+
+               #region IDisposable     methods
+
+               public void Dispose()
+               {
+                       this.Dispose(true);
+                       GC.SuppressFinalize(this);
+               }
+
+               private void Dispose(bool disposing)
+               {
+                       lock (this)
+                       {
+                               if (!this.disposed)
+                               {
+                                       try
+                                       {
+                                               // release any unmanaged resources
+                                               this.Rollback();
+
+                                               // release any managed resources
+                                               if (disposing)
+                                               {
+                                                       this.db         = null;
+                                                       this.handle = 0;
+                                                       this.state      = TransactionState.NoTransaction;
+                                               }
+                                       }
+                                       finally
+                                       {
+                                               this.disposed = true;
+                                       }
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public void BeginTransaction(TransactionParameterBuffer tpb)
+               {
+                       lock (this.db)
+                       {
+                               if (this.state != TransactionState.NoTransaction)
+                               {
+                                       throw new IscException(
+                                               IscCodes.isc_arg_gds,
+                                               IscCodes.isc_tra_state,
+                                               this.handle,
+                                               "no valid");
+                               }
+
+                               this.state = TransactionState.TrasactionStarting;
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_transaction);
+                                       this.db.Send.Write(this.db.Handle);
+                                       this.db.Send.WriteBuffer(tpb.ToArray());
+                                       this.db.Send.Flush();
+
+                                       this.handle = db.ReadGenericResponse().ObjectHandle;
+                                       this.state = TransactionState.TransactionStarted;
+
+                                       this.db.TransactionCount++;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public void Commit()
+               {
+                       lock (this.db)
+                       {
+                               if (this.state != TransactionState.TransactionStarted &&
+                                       this.state != TransactionState.TransactionPrepared)
+                               {
+                                       throw new IscException(
+                                               IscCodes.isc_arg_gds,
+                                               IscCodes.isc_tra_state,
+                                               this.handle,
+                                               "no valid");
+                               }
+
+                               this.state = TransactionState.TransactionCommiting;
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_commit);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Flush();
+
+                                       this.db.ReadGenericResponse();
+
+                                       this.db.TransactionCount--;
+
+                                       if (this.Update != null)
+                                       {
+                                               this.Update(this, new EventArgs());
+                                       }
+
+                                       this.state = TransactionState.NoTransaction;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public void Rollback()
+               {
+                       lock (this.db)
+                       {
+                               if (this.state == TransactionState.NoTransaction)
+                               {
+                                       throw new IscException(
+                                               IscCodes.isc_arg_gds,
+                                               IscCodes.isc_tra_state,
+                                               this.handle,
+                                               "no valid");
+                               }
+
+                               this.state = TransactionState.TransactionRollbacking;
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_rollback);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Flush();
+
+                                       this.db.ReadGenericResponse();
+
+                                       this.db.TransactionCount--;
+
+                                       if (this.Update != null)
+                                       {
+                                               this.Update(this, new EventArgs());
+                                       }
+
+                                       this.state = TransactionState.NoTransaction;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public void CommitRetaining()
+               {
+                       lock (this.db)
+                       {
+                               if (this.state != TransactionState.TransactionStarted &&
+                                       this.state != TransactionState.TransactionPrepared)
+                               {
+                                       throw new IscException(
+                                               IscCodes.isc_arg_gds,
+                                               IscCodes.isc_tra_state,
+                                               this.handle,
+                                               "no valid");
+                               }
+
+                               this.state = TransactionState.TransactionCommiting;
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_commit_retaining);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Flush();
+
+                                       this.db.ReadGenericResponse();
+
+                                       this.state = TransactionState.TransactionStarted;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public void RollbackRetaining()
+               {
+                       lock (this.db)
+                       {
+                               if (this.state != TransactionState.TransactionStarted &&
+                                       this.state != TransactionState.TransactionPrepared)
+                               {
+                                       throw new IscException(
+                                               IscCodes.isc_arg_gds,
+                                               IscCodes.isc_tra_state,
+                                               this.handle,
+                                               "no valid");
+                               }
+
+                               this.state = TransactionState.TransactionRollbacking;
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_rollback_retaining);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Flush();
+
+                                       this.db.ReadGenericResponse();
+
+                                       this.state = TransactionState.TransactionStarted;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               /*
+               public void     Prepare()
+               {
+                       lock (this.db)
+                       {
+                               if (this.state != TransactionState.TransactionStarted)
+                               {
+                                       throw new IscException(
+                                               IscCodes.isc_arg_gds,
+                                               IscCodes.isc_tra_state,
+                                               this.handle,
+                                               "no valid");
+                               }
+
+                               this.state = TransactionState.TransactionPreparing;
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_prepare);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.Flush();
+
+                                       this.db.ReadGenericResponse();
+
+                                       this.state = TransactionState.TransactionPrepared;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+
+               public void     Prepare(byte[] buffer)
+               {
+                       lock (this.db)
+                       {
+                               if (this.state != TransactionState.TransactionStarted)
+                               {
+                                       throw new IscException(
+                                               IscCodes.isc_arg_gds,
+                                               IscCodes.isc_tra_state,
+                                               this.handle,
+                                               "no valid");
+                               }
+
+                               this.state = TransactionState.TransactionPreparing;
+
+                               try
+                               {
+                                       this.db.Send.Write(IscCodes.op_prepare2);
+                                       this.db.Send.Write(this.handle);
+                                       this.db.Send.WriteBuffer(buffer, buffer.Length);
+                                       this.db.Send.Flush();
+
+                                       this.db.ReadGenericResponse();
+
+                                       this.state = TransactionState.TransactionStarted;
+                               }
+                               catch (IOException)
+                               {
+                                       throw new IscException(IscCodes.isc_net_read_err);
+                               }
+                       }
+               }
+               */
+
+               #endregion
+       }
+}
index 06a76a089be99f9770984ca1c046b8969c6092f1..fed6b42ae5ed965064d3f522e6813d980aedfd41 100644 (file)
-/*\r
- *     Firebird ADO.NET Data provider for .NET and     Mono \r
- * \r
- *        The contents of this file are subject to the Initial \r
- *        Developer's Public License Version 1.0 (the "License"); \r
- *        you may not use this file except in compliance with the \r
- *        License. You may obtain a copy of the License at \r
- *        http://www.firebirdsql.org/index.php?op=doc&id=idpl\r
- *\r
- *        Software distributed under the License is distributed on \r
- *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either \r
- *        express or implied. See the License for the specific \r
- *        language governing rights and limitations under the License.\r
- * \r
- *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez\r
- *     All Rights Reserved.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Net;\r
-using System.Text;\r
-using System.Globalization;\r
-\r
-using FirebirdSql.Data.Common;\r
-\r
-namespace FirebirdSql.Data.Gds\r
-{\r
-       internal class XdrStream : Stream\r
-       {\r
-               #region Static Fields\r
-\r
-               private static byte[] fill;\r
-               private static byte[] pad;\r
-\r
-               #endregion\r
-\r
-               #region Static Properties\r
-\r
-               internal static byte[] Fill\r
-               {\r
-                       get\r
-                       {\r
-                               if (fill == null)\r
-                               {\r
-                                       fill = new byte[32767];\r
-                                       for (int i = 0; i < fill.Length; i++)\r
-                                       {\r
-                                               fill[i] = 32;\r
-                                       }\r
-                               }\r
-\r
-                               return fill;\r
-                       }\r
-               }\r
-\r
-               private static byte[] Pad\r
-               {\r
-                       get\r
-                       {\r
-                               if (pad == null)\r
-                               {\r
-                                       pad = new byte[] { 0, 0, 0, 0 };\r
-                               }\r
-\r
-                               return pad;\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Fields\r
-\r
-               private byte[]  buffer;\r
-               private Charset charset;\r
-               private Stream  innerStream;\r
-\r
-               #endregion\r
-\r
-               #region Stream Properties\r
-\r
-               public override bool CanWrite\r
-               {\r
-                       get { return this.innerStream.CanWrite; }\r
-               }\r
-\r
-               public override bool CanRead\r
-               {\r
-                       get { return this.innerStream.CanRead; }\r
-               }\r
-\r
-               public override bool CanSeek\r
-               {\r
-                       get { return this.innerStream.CanSeek; }\r
-               }\r
-\r
-               public override long Position\r
-               {\r
-                       get { return this.innerStream.Position; }\r
-                       set { this.innerStream.Position = value; }\r
-               }\r
-\r
-               public override long Length\r
-               {\r
-                       get { return this.innerStream.Length; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Constructors\r
-\r
-               public XdrStream() : this(Charset.DefaultCharset)\r
-               {\r
-               }\r
-\r
-               public XdrStream(Charset charset) : this(new MemoryStream(), charset)\r
-               {\r
-               }\r
-\r
-               public XdrStream(byte[] buffer, Charset charset) : this(new MemoryStream(buffer), charset)\r
-               {\r
-               }\r
-\r
-               public XdrStream(Stream innerStream, Charset charset) : base()\r
-               {\r
-                       this.buffer                     = new byte[8] { 0, 0, 0, 0, 0, 0, 0, 0 };\r
-                       this.innerStream        = innerStream;\r
-                       this.charset            = charset;\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Stream methods\r
-\r
-               public override void Close()\r
-               {\r
-                       if (this.innerStream != null)\r
-                       {\r
-                               this.innerStream.Close();\r
-                       }\r
-\r
-                       this.buffer                     = null;\r
-                       this.charset            = null;\r
-                       this.innerStream        = null;\r
-               }\r
-\r
-               public override void Flush()\r
-               {\r
-                       this.CheckDisposed();\r
-\r
-                       this.innerStream.Flush();\r
-               }\r
-\r
-               public override void SetLength(long length)\r
-               {\r
-                       this.CheckDisposed();\r
-\r
-                       this.innerStream.SetLength(length);\r
-               }\r
-\r
-               public override long Seek(long offset, System.IO.SeekOrigin loc)\r
-               {\r
-                       this.CheckDisposed();\r
-\r
-                       return this.innerStream.Seek(offset, loc);\r
-               }\r
-\r
-               public override int Read(byte[] buffer, int offset, int count)\r
-               {\r
-                       this.CheckDisposed();\r
-\r
-                       if (this.CanRead)\r
-                       {\r
-                               return this.innerStream.Read(buffer, offset, count);\r
-                       }\r
-\r
-                       throw new InvalidOperationException("Read operations are not allowed by this stream");\r
-               }\r
-\r
-               public override void WriteByte(byte value)\r
-               {\r
-                       this.CheckDisposed();\r
-\r
-                       this.innerStream.WriteByte(value);\r
-               }\r
-\r
-               public override void Write(byte[] buffer, int offset, int count)\r
-               {\r
-                       this.CheckDisposed();\r
-\r
-                       if (this.CanWrite)\r
-                       {\r
-                               this.innerStream.Write(buffer, offset, count);\r
-                       }\r
-                       else\r
-                       {\r
-                               throw new InvalidOperationException("Write operations are not allowed by this stream");\r
-                       }\r
-               }\r
-\r
-               public byte[] ToArray()\r
-               {\r
-                       this.CheckDisposed();\r
-\r
-                       if (this.innerStream is MemoryStream)\r
-                       {\r
-                               return ((MemoryStream)this.innerStream).ToArray();\r
-                       }\r
-\r
-                       throw new InvalidOperationException();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Xdr     Read Methods\r
-\r
-               public byte[] ReadBytes(int count)\r
-               {\r
-                       byte[] buffer = new byte[count];\r
-                       this.Read(buffer, 0, buffer.Length);\r
-\r
-                       return buffer;\r
-               }\r
-\r
-               public byte[] ReadOpaque(int length)\r
-               {\r
-                       byte[] buffer = new byte[length];\r
-                       int readed = 0;\r
-\r
-                       if (length > 0)\r
-                       {\r
-                               while (readed < length)\r
-                               {\r
-                                       readed += this.Read(buffer, readed, length - readed);\r
-                               }\r
-\r
-                               int padLength = ((4 - length) & 3);\r
-                               if (padLength > 0)\r
-                               {\r
-                                       this.Read(Pad, 0, padLength);\r
-                               }\r
-                       }\r
-\r
-                       return buffer;\r
-               }\r
-\r
-               public byte[] ReadBuffer()\r
-               {\r
-                       return this.ReadOpaque(this.ReadInt32());\r
-               }\r
-\r
-               public string ReadString()\r
-               {\r
-                       return this.ReadString(this.charset);\r
-               }\r
-\r
-               public string ReadString(int length)\r
-               {\r
-                       return this.ReadString(this.charset, length);\r
-               }\r
-\r
-               public string ReadString(Charset charset)\r
-               {\r
-                       return this.ReadString(charset, this.ReadInt32());\r
-               }\r
-\r
-               public string ReadString(Charset charset, int length)\r
-               {\r
-                       byte[] buffer = this.ReadOpaque(length);\r
-\r
-                       return charset.GetString(buffer, 0, buffer.Length);\r
-               }\r
-\r
-               public short ReadInt16()\r
-               {\r
-                       return Convert.ToInt16(this.ReadInt32());\r
-               }\r
-\r
-               public int ReadInt32()\r
-               {\r
-                       this.Read(buffer, 0, 4);\r
-\r
-                       return IPAddress.HostToNetworkOrder(BitConverter.ToInt32(buffer, 0));\r
-               }\r
-\r
-               public long ReadInt64()\r
-               {\r
-                       this.Read(buffer, 0, 8);\r
-\r
-                       return IPAddress.HostToNetworkOrder(BitConverter.ToInt64(buffer, 0));\r
-               }\r
-\r
-               public Guid ReadGuid(int length)\r
-               {\r
-                       return new Guid(this.ReadOpaque(length));\r
-               }\r
-\r
-               public float ReadSingle()\r
-               {\r
-                       return BitConverter.ToSingle(BitConverter.GetBytes(this.ReadInt32()), 0);\r
-               }\r
-\r
-               public double ReadDouble()\r
-               {\r
-                       return BitConverter.ToDouble(BitConverter.GetBytes(this.ReadInt64()), 0);\r
-               }\r
-\r
-               public DateTime ReadDateTime()\r
-               {\r
-                       DateTime date = this.ReadDate();\r
-                       DateTime time = this.ReadTime();\r
-\r
-                       return new System.DateTime(\r
-                               date.Year, date.Month, date.Day,\r
-                               time.Hour, time.Minute, time.Second, time.Millisecond);\r
-               }\r
-\r
-               public DateTime ReadDate()\r
-               {\r
-                       return TypeDecoder.DecodeDate(this.ReadInt32());\r
-               }\r
-\r
-               public DateTime ReadTime()\r
-               {\r
-                       return TypeDecoder.DecodeTime(this.ReadInt32());\r
-               }\r
-\r
-               public decimal ReadDecimal(int type, int scale)\r
-               {\r
-                       decimal value = 0;\r
-\r
-                       switch (type & ~1)\r
-                       {\r
-                               case IscCodes.SQL_SHORT:\r
-                                       value = TypeDecoder.DecodeDecimal(this.ReadInt16(), scale, type);\r
-                                       break;\r
-\r
-                               case IscCodes.SQL_LONG:\r
-                                       value = TypeDecoder.DecodeDecimal(this.ReadInt32(), scale, type);\r
-                                       break;\r
-\r
-                               case IscCodes.SQL_QUAD:\r
-                               case IscCodes.SQL_INT64:\r
-                                       value = TypeDecoder.DecodeDecimal(this.ReadInt64(), scale, type);\r
-                                       break;\r
-\r
-                               case IscCodes.SQL_DOUBLE:\r
-                               case IscCodes.SQL_D_FLOAT:\r
-                                       value = Convert.ToDecimal(this.ReadDouble());\r
-                                       break;\r
-                       }\r
-\r
-                       return value;\r
-               }\r
-\r
-               public object ReadValue(DbField field)\r
-               {\r
-                       object fieldValue = null;\r
-                       Charset innerCharset = (this.charset.Name != "NONE") ? this.charset : field.Charset;\r
-\r
-                       switch (field.DbDataType)\r
-                       {\r
-                               case DbDataType.Char:\r
-                                       {\r
-                                               string s = this.ReadString(innerCharset, field.Length);\r
-\r
-                                               if ((field.Length % field.Charset.BytesPerCharacter) == 0 &&\r
-                                                       s.Length > field.CharCount)\r
-                                               {\r
-                                                       fieldValue = s.Substring(0, field.CharCount);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       fieldValue = s;\r
-                                               }\r
-                                       }\r
-                                       break;\r
-\r
-                               case DbDataType.VarChar:\r
-                                       fieldValue = this.ReadString(innerCharset).TrimEnd();\r
-                                       break;\r
-\r
-                               case DbDataType.SmallInt:\r
-                                       fieldValue = this.ReadInt16();\r
-                                       break;\r
-\r
-                               case DbDataType.Integer:\r
-                                       fieldValue = this.ReadInt32();\r
-                                       break;\r
-\r
-                               case DbDataType.Array:\r
-                               case DbDataType.Binary:\r
-                               case DbDataType.Text:\r
-                               case DbDataType.BigInt:\r
-                                       fieldValue = this.ReadInt64();\r
-                                       break;\r
-\r
-                               case DbDataType.Decimal:\r
-                               case DbDataType.Numeric:\r
-                                       fieldValue = this.ReadDecimal(\r
-                                               field.DataType,\r
-                                               field.NumericScale);\r
-                                       break;\r
-\r
-                               case DbDataType.Float:\r
-                                       fieldValue = this.ReadSingle();\r
-                                       break;\r
-\r
-                               case DbDataType.Guid:\r
-                                       fieldValue = this.ReadGuid(field.Length);\r
-                                       break;\r
-\r
-                               case DbDataType.Double:\r
-                                       fieldValue = this.ReadDouble();\r
-                                       break;\r
-\r
-                               case DbDataType.Date:\r
-                                       fieldValue = this.ReadDate();\r
-                                       break;\r
-\r
-                               case DbDataType.Time:\r
-                                       fieldValue = this.ReadTime();\r
-                                       break;\r
-\r
-                               case DbDataType.TimeStamp:\r
-                                       fieldValue = this.ReadDateTime();\r
-                                       break;\r
-                       }\r
-\r
-                       int sqlInd = this.ReadInt32();\r
-\r
-                       if (sqlInd == 0)\r
-                       {\r
-                               return fieldValue;\r
-                       }\r
-                       else if (sqlInd == -1)\r
-                       {\r
-                               return null;\r
-                       }\r
-                       else\r
-                       {\r
-                               throw new IscException("invalid sqlind value: " + sqlInd);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Xdr     Write Methods\r
-\r
-               public void WriteOpaque(byte[] buffer)\r
-               {\r
-                       this.WriteOpaque(buffer, buffer.Length);\r
-               }\r
-\r
-               public void WriteOpaque(byte[] buffer, int length)\r
-               {\r
-                       if (buffer != null && length > 0)\r
-                       {\r
-                               this.Write(buffer, 0, buffer.Length);\r
-                               this.Write(Fill, 0, length - buffer.Length);\r
-                               this.Write(Pad, 0, ((4 - length) & 3));\r
-                       }\r
-               }\r
-\r
-               public void WriteBuffer(byte[] buffer)\r
-               {\r
-                       this.WriteBuffer(buffer, buffer == null ? 0 : buffer.Length);\r
-               }\r
-\r
-               public void WriteBuffer(byte[] buffer, int length)\r
-               {\r
-                       this.Write(length);\r
-                       if (buffer != null && length > 0)\r
-                       {\r
-                               this.Write(buffer, 0, length);\r
-                               this.Write(Pad, 0, ((4 - length) & 3));\r
-                       }\r
-               }\r
-\r
-               public void WriteBlobBuffer(byte[] buffer)\r
-               {\r
-                       int length = buffer.Length;     // 2 for short for buffer length\r
-\r
-                       if (length > short.MaxValue)\r
-                       {\r
-                               throw (new IOException()); //Need a     value???\r
-                       }\r
-\r
-                       this.Write(length + 2);\r
-                       this.Write(length + 2); //bizarre but true!     three copies of the     length\r
-                       this.WriteByte((byte)((length >> 0) & 0xff));\r
-                       this.WriteByte((byte)((length >> 8) & 0xff));\r
-                       this.Write(buffer, 0, length);\r
-\r
-                       this.Write(Pad, 0, ((4 - length + 2) & 3));\r
-               }\r
-\r
-               public void WriteTyped(int type, byte[] buffer)\r
-               {\r
-                       int length;\r
-\r
-                       if (buffer == null)\r
-                       {\r
-                               this.Write(1);\r
-                               this.WriteByte((byte)type);\r
-                               length = 1;\r
-                       }\r
-                       else\r
-                       {\r
-                               length = buffer.Length + 1;\r
-                               this.Write(length);\r
-                               this.WriteByte((byte)type);\r
-                               this.Write(buffer, 0, buffer.Length);\r
-                       }\r
-                       this.Write(Pad, 0, ((4 - length) & 3));\r
-               }\r
-\r
-               public void Write(string value)\r
-               {\r
-                       byte[] buffer = this.charset.GetBytes(value);\r
-\r
-                       this.WriteBuffer(buffer, buffer.Length);\r
-               }\r
-\r
-               public void Write(short value)\r
-               {\r
-                       this.Write((int)value);\r
-               }\r
-\r
-               public void Write(int value)\r
-               {\r
-                       this.Write(BitConverter.GetBytes(IPAddress.NetworkToHostOrder(value)), 0, 4);\r
-               }\r
-\r
-               public void Write(long value)\r
-               {\r
-                       this.Write(BitConverter.GetBytes(IPAddress.NetworkToHostOrder(value)), 0, 8);\r
-               }\r
-\r
-               public void Write(float value)\r
-               {\r
-                       byte[] buffer = BitConverter.GetBytes(value);\r
-\r
-                       this.Write(BitConverter.ToInt32(buffer, 0));\r
-               }\r
-\r
-               public void Write(double value)\r
-               {\r
-                       byte[] buffer = BitConverter.GetBytes(value);\r
-\r
-                       this.Write(BitConverter.ToInt64(buffer, 0));\r
-               }\r
-\r
-               public void Write(decimal value, int type, int scale)\r
-               {\r
-                       object numeric = TypeEncoder.EncodeDecimal(value, scale, type);\r
-\r
-                       switch (type & ~1)\r
-                       {\r
-                               case IscCodes.SQL_SHORT:\r
-                                       this.Write((short)numeric);\r
-                                       break;\r
-\r
-                               case IscCodes.SQL_LONG:\r
-                                       this.Write((int)numeric);\r
-                                       break;\r
-\r
-                               case IscCodes.SQL_QUAD:\r
-                               case IscCodes.SQL_INT64:\r
-                                       this.Write((long)numeric);\r
-                                       break;\r
-\r
-                               case IscCodes.SQL_DOUBLE:\r
-                               case IscCodes.SQL_D_FLOAT:\r
-                                       this.Write((double)value);\r
-                                       break;\r
-                       }\r
-               }\r
-\r
-               public void Write(DateTime value)\r
-               {\r
-                       this.WriteDate(value);\r
-                       this.WriteTime(value);\r
-               }\r
-\r
-               public void WriteDate(DateTime value)\r
-               {\r
-                       this.Write(TypeEncoder.EncodeDate(Convert.ToDateTime(value)));\r
-               }\r
-\r
-               public void WriteTime(DateTime value)\r
-               {\r
-                       this.Write(TypeEncoder.EncodeTime(Convert.ToDateTime(value)));\r
-               }\r
-\r
-               public void Write(Descriptor descriptor)\r
-               {\r
-                       for (int i = 0; i < descriptor.Count; i++)\r
-                       {\r
-                               this.Write(descriptor[i]);\r
-                       }\r
-               }\r
-\r
-               public void Write(DbField param)\r
-               {\r
-                       Charset innerCharset = (this.charset.Name != "NONE") ? this.charset : param.Charset;\r
-\r
-                       param.FixNull();\r
-\r
-                       try\r
-                       {\r
-                               switch (param.DbDataType)\r
-                               {\r
-                                       case DbDataType.Char:\r
-                                               {\r
-                                                       string svalue = param.DbValue.GetString();\r
-\r
-                                                       if ((param.Length % param.Charset.BytesPerCharacter) == 0 &&\r
-                                                               svalue.Length > param.CharCount)\r
-                                                       {\r
-                                                               throw new IscException(335544321);\r
-                                                       }\r
-\r
-                                                       this.WriteOpaque(innerCharset.GetBytes(svalue), param.Length);\r
-                                               }\r
-                                               break;\r
-\r
-                                       case DbDataType.VarChar:\r
-                                               {\r
-                                                       string svalue = param.DbValue.GetString().TrimEnd();\r
-\r
-                                                       if ((param.Length % param.Charset.BytesPerCharacter) == 0 &&\r
-                                                               svalue.Length > param.CharCount)\r
-                                                       {\r
-                                                               throw new IscException(335544321);\r
-                                                       }\r
-\r
-                                                       byte[] data = innerCharset.GetBytes(svalue);\r
-\r
-                                                       this.WriteBuffer(data, data.Length);\r
-                                               }\r
-                                               break;\r
-\r
-                                       case DbDataType.SmallInt:\r
-                                               this.Write(param.DbValue.GetInt16());\r
-                                               break;\r
-\r
-                                       case DbDataType.Integer:\r
-                                               this.Write(param.DbValue.GetInt32());\r
-                                               break;\r
-\r
-                                       case DbDataType.BigInt:\r
-                                       case DbDataType.Array:\r
-                                       case DbDataType.Binary:\r
-                                       case DbDataType.Text:\r
-                                               this.Write(param.DbValue.GetInt64());\r
-                                               break;\r
-\r
-                                       case DbDataType.Decimal:\r
-                                       case DbDataType.Numeric:\r
-                                               this.Write(\r
-                                                       param.DbValue.GetDecimal(),\r
-                                                       param.DataType,\r
-                                                       param.NumericScale);\r
-                                               break;\r
-\r
-                                       case DbDataType.Float:\r
-                                               this.Write(param.DbValue.GetFloat());\r
-                                               break;\r
-\r
-                                       case DbDataType.Guid:\r
-                                               this.WriteOpaque(param.DbValue.GetGuid().ToByteArray());\r
-                                               break;\r
-\r
-                                       case DbDataType.Double:\r
-                                               this.Write(param.DbValue.GetDouble());\r
-                                               break;\r
-\r
-                                       case DbDataType.Date:\r
-                                               this.Write(param.DbValue.EncodeDate());\r
-                                               break;\r
-\r
-                                       case DbDataType.Time:\r
-                                               this.Write(param.DbValue.EncodeTime());\r
-                                               break;\r
-\r
-                                       case DbDataType.TimeStamp:\r
-                                               this.Write(param.DbValue.EncodeDate());\r
-                                               this.Write(param.DbValue.EncodeTime());\r
-                                               break;\r
-\r
-                                       default:\r
-                                               throw new IscException("Unknown sql data type: " + param.DataType);\r
-                               }\r
-\r
-                               this.Write(param.NullFlag);\r
-                       }\r
-                       catch (IOException)\r
-                       {\r
-                               throw new IscException(IscCodes.isc_net_write_err);\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region Private Methods\r
-\r
-               private void CheckDisposed()\r
-               {\r
-                       if (this.innerStream == null)\r
-                       {\r
-                               throw new ObjectDisposedException("The XdrStream is closed.");\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/*
+ *     Firebird ADO.NET Data provider for .NET and Mono 
+ * 
+ *        The contents of this file are subject to the Initial 
+ *        Developer's Public License Version 1.0 (the "License"); 
+ *        you may not use this file except in compliance with the 
+ *        License. You may obtain a copy of the License at 
+ *        http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ *        Software distributed under the License is distributed on 
+ *        an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
+ *        express or implied. See the License for the specific 
+ *        language governing rights and limitations under the License.
+ * 
+ *     Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ *     All Rights Reserved.
+ */
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Globalization;
+
+using FirebirdSql.Data.Common;
+
+namespace FirebirdSql.Data.Gds
+{
+       internal class XdrStream : Stream
+       {
+               #region Static Fields
+
+               private static byte[] fill;
+               private static byte[] pad;
+
+               #endregion
+
+               #region Static Properties
+
+               internal static byte[] Fill
+               {
+                       get
+                       {
+                               if (fill == null)
+                               {
+                                       fill = new byte[32767];
+                                       for (int i = 0; i < fill.Length; i++)
+                                       {
+                                               fill[i] = 32;
+                                       }
+                               }
+
+                               return fill;
+                       }
+               }
+
+               private static byte[] Pad
+               {
+                       get
+                       {
+                               if (pad == null)
+                               {
+                                       pad = new byte[] { 0, 0, 0, 0 };
+                               }
+
+                               return pad;
+                       }
+               }
+
+               #endregion
+
+               #region Fields
+
+               private byte[]  buffer;
+               private Charset charset;
+               private Stream  innerStream;
+
+               #endregion
+
+               #region Stream Properties
+
+               public override bool CanWrite
+               {
+                       get { return this.innerStream.CanWrite; }
+               }
+
+               public override bool CanRead
+               {
+                       get { return this.innerStream.CanRead; }
+               }
+
+               public override bool CanSeek
+               {
+                       get { return this.innerStream.CanSeek; }
+               }
+
+               public override long Position
+               {
+                       get { return this.innerStream.Position; }
+                       set { this.innerStream.Position = value; }
+               }
+
+               public override long Length
+               {
+                       get { return this.innerStream.Length; }
+               }
+
+               #endregion
+
+               #region Constructors
+
+               public XdrStream() : this(Charset.DefaultCharset)
+               {
+               }
+
+               public XdrStream(Charset charset) : this(new MemoryStream(), charset)
+               {
+               }
+
+               public XdrStream(byte[] buffer, Charset charset) : this(new MemoryStream(buffer), charset)
+               {
+               }
+
+               public XdrStream(Stream innerStream, Charset charset) : base()
+               {
+                       this.buffer                     = new byte[8] { 0, 0, 0, 0, 0, 0, 0, 0 };
+                       this.innerStream        = innerStream;
+                       this.charset            = charset;
+               }
+
+               #endregion
+
+               #region Stream methods
+
+               public override void Close()
+               {
+                       if (this.innerStream != null)
+                       {
+                               this.innerStream.Close();
+                       }
+
+                       this.buffer                     = null;
+                       this.charset            = null;
+                       this.innerStream        = null;
+               }
+
+               public override void Flush()
+               {
+                       this.CheckDisposed();
+
+                       this.innerStream.Flush();
+               }
+
+               public override void SetLength(long length)
+               {
+                       this.CheckDisposed();
+
+                       this.innerStream.SetLength(length);
+               }
+
+               public override long Seek(long offset, System.IO.SeekOrigin loc)
+               {
+                       this.CheckDisposed();
+
+                       return this.innerStream.Seek(offset, loc);
+               }
+
+               public override int Read(byte[] buffer, int offset, int count)
+               {
+                       this.CheckDisposed();
+
+                       if (this.CanRead)
+                       {
+                               return this.innerStream.Read(buffer, offset, count);
+                       }
+
+                       throw new InvalidOperationException("Read operations are not allowed by this stream");
+               }
+
+               public override void WriteByte(byte value)
+               {
+                       this.CheckDisposed();
+
+                       this.innerStream.WriteByte(value);
+               }
+
+               public override void Write(byte[] buffer, int offset, int count)
+               {
+                       this.CheckDisposed();
+
+                       if (this.CanWrite)
+                       {
+                               this.innerStream.Write(buffer, offset, count);
+                       }
+                       else
+                       {
+                               throw new InvalidOperationException("Write operations are not allowed by this stream");
+                       }
+               }
+
+               public byte[] ToArray()
+               {
+                       this.CheckDisposed();
+
+                       if (this.innerStream is MemoryStream)
+                       {
+                               return ((MemoryStream)this.innerStream).ToArray();
+                       }
+
+                       throw new InvalidOperationException();
+               }
+
+               #endregion
+
+               #region Xdr     Read Methods
+
+               public byte[] ReadBytes(int count)
+               {
+                       byte[] buffer = new byte[count];
+                       this.Read(buffer, 0, buffer.Length);
+
+                       return buffer;
+               }
+
+               public byte[] ReadOpaque(int length)
+               {
+                       byte[] buffer = new byte[length];
+                       int readed = 0;
+
+                       if (length > 0)
+                       {
+                               while (readed < length)
+                               {
+                                       readed += this.Read(buffer, readed, length - readed);
+                               }
+
+                               int padLength = ((4 - length) & 3);
+                               if (padLength > 0)
+                               {
+                                       this.Read(Pad, 0, padLength);
+                               }
+                       }
+
+                       return buffer;
+               }
+
+               public byte[] ReadBuffer()
+               {
+                       return this.ReadOpaque(this.ReadInt32());
+               }
+
+               public string ReadString()
+               {
+                       return this.ReadString(this.charset);
+               }
+
+               public string ReadString(int length)
+               {
+                       return this.ReadString(this.charset, length);
+               }
+
+               public string ReadString(Charset charset)
+               {
+                       return this.ReadString(charset, this.ReadInt32());
+               }
+
+               public string ReadString(Charset charset, int length)
+               {
+                       byte[] buffer = this.ReadOpaque(length);
+
+                       return charset.GetString(buffer, 0, buffer.Length);
+               }
+
+               public short ReadInt16()
+               {
+                       return Convert.ToInt16(this.ReadInt32());
+               }
+
+               public int ReadInt32()
+               {
+                       this.Read(buffer, 0, 4);
+
+                       return IPAddress.HostToNetworkOrder(BitConverter.ToInt32(buffer, 0));
+               }
+
+               public long ReadInt64()
+               {
+                       this.Read(buffer, 0, 8);
+
+                       return IPAddress.HostToNetworkOrder(BitConverter.ToInt64(buffer, 0));
+               }
+
+               public Guid ReadGuid(int length)
+               {
+                       return new Guid(this.ReadOpaque(length));
+               }
+
+               public float ReadSingle()
+               {
+                       return BitConverter.ToSingle(BitConverter.GetBytes(this.ReadInt32()), 0);
+               }
+
+               public double ReadDouble()
+               {
+                       return BitConverter.ToDouble(BitConverter.GetBytes(this.ReadInt64()), 0);
+               }
+
+               public DateTime ReadDateTime()
+               {
+                       DateTime date = this.ReadDate();
+                       DateTime time = this.ReadTime();
+
+                       return new System.DateTime(
+                               date.Year, date.Month, date.Day,
+                               time.Hour, time.Minute, time.Second, time.Millisecond);
+               }
+
+               public DateTime ReadDate()
+               {
+                       return TypeDecoder.DecodeDate(this.ReadInt32());
+               }
+
+               public DateTime ReadTime()
+               {
+                       return TypeDecoder.DecodeTime(this.ReadInt32());
+               }
+
+               public decimal ReadDecimal(int type, int scale)
+               {
+                       decimal value = 0;
+
+                       switch (type & ~1)
+                       {
+                               case IscCodes.SQL_SHORT:
+                                       value = TypeDecoder.DecodeDecimal(this.ReadInt16(), scale, type);
+                                       break;
+
+                               case IscCodes.SQL_LONG:
+                                       value = TypeDecoder.DecodeDecimal(this.ReadInt32(), scale, type);
+                                       break;
+
+                               case IscCodes.SQL_QUAD:
+                               case IscCodes.SQL_INT64:
+                                       value = TypeDecoder.DecodeDecimal(this.ReadInt64(), scale, type);
+                                       break;
+
+                               case IscCodes.SQL_DOUBLE:
+                               case IscCodes.SQL_D_FLOAT:
+                                       value = Convert.ToDecimal(this.ReadDouble());
+                                       break;
+                       }
+
+                       return value;
+               }
+
+               public object ReadValue(DbField field)
+               {
+                       object fieldValue = null;
+                       Charset innerCharset = (this.charset.Name != "NONE") ? this.charset : field.Charset;
+
+                       switch (field.DbDataType)
+                       {
+                               case DbDataType.Char:
+                                       {
+                                               string s = this.ReadString(innerCharset, field.Length);
+
+                                               if ((field.Length % field.Charset.BytesPerCharacter) == 0 &&
+                                                       s.Length > field.CharCount)
+                                               {
+                                                       fieldValue = s.Substring(0, field.CharCount);
+                                               }
+                                               else
+                                               {
+                                                       fieldValue = s;
+                                               }
+                                       }
+                                       break;
+
+                               case DbDataType.VarChar:
+                                       fieldValue = this.ReadString(innerCharset).TrimEnd();
+                                       break;
+
+                               case DbDataType.SmallInt:
+                                       fieldValue = this.ReadInt16();
+                                       break;
+
+                               case DbDataType.Integer:
+                                       fieldValue = this.ReadInt32();
+                                       break;
+
+                               case DbDataType.Array:
+                               case DbDataType.Binary:
+                               case DbDataType.Text:
+                               case DbDataType.BigInt:
+                                       fieldValue = this.ReadInt64();
+                                       break;
+
+                               case DbDataType.Decimal:
+                               case DbDataType.Numeric:
+                                       fieldValue = this.ReadDecimal(
+                                               field.DataType,
+                                               field.NumericScale);
+                                       break;
+
+                               case DbDataType.Float:
+                                       fieldValue = this.ReadSingle();
+                                       break;
+
+                               case DbDataType.Guid:
+                                       fieldValue = this.ReadGuid(field.Length);
+                                       break;
+
+                               case DbDataType.Double:
+                                       fieldValue = this.ReadDouble();
+                                       break;
+
+                               case DbDataType.Date:
+                                       fieldValue = this.ReadDate();
+                                       break;
+
+                               case DbDataType.Time:
+                                       fieldValue = this.ReadTime();
+                                       break;
+
+                               case DbDataType.TimeStamp:
+                                       fieldValue = this.ReadDateTime();
+                                       break;
+                       }
+
+                       int sqlInd = this.ReadInt32();
+
+                       if (sqlInd == 0)
+                       {
+                               return fieldValue;
+                       }
+                       else if (sqlInd == -1)
+                       {
+                               return null;
+                       }
+                       else
+                       {
+                               throw new IscException("invalid sqlind value: " + sqlInd);
+                       }
+               }
+
+               #endregion
+
+               #region Xdr     Write Methods
+
+               public void WriteOpaque(byte[] buffer)
+               {
+                       this.WriteOpaque(buffer, buffer.Length);
+               }
+
+               public void WriteOpaque(byte[] buffer, int length)
+               {
+                       if (buffer != null && length > 0)
+                       {
+                               this.Write(buffer, 0, buffer.Length);
+                               this.Write(Fill, 0, length - buffer.Length);
+                               this.Write(Pad, 0, ((4 - length) & 3));
+                       }
+               }
+
+               public void WriteBuffer(byte[] buffer)
+               {
+                       this.WriteBuffer(buffer, buffer == null ? 0 : buffer.Length);
+               }
+
+               public void WriteBuffer(byte[] buffer, int length)
+               {
+                       this.Write(length);
+                       if (buffer != null && length > 0)
+                       {
+                               this.Write(buffer, 0, length);
+                               this.Write(Pad, 0, ((4 - length) & 3));
+                       }
+               }
+
+               public void WriteBlobBuffer(byte[] buffer)
+               {
+                       int length = buffer.Length;     // 2 for short for buffer length
+
+                       if (length > short.MaxValue)
+                       {
+                               throw (new IOException()); //Need a     value???
+                       }
+
+                       this.Write(length + 2);
+                       this.Write(length + 2); //bizarre but true!     three copies of the     length
+                       this.WriteByte((byte)((length >> 0) & 0xff));
+                       this.WriteByte((byte)((length >> 8) & 0xff));
+                       this.Write(buffer, 0, length);
+
+                       this.Write(Pad, 0, ((4 - length + 2) & 3));
+               }
+
+               public void WriteTyped(int type, byte[] buffer)
+               {
+                       int length;
+
+                       if (buffer == null)
+                       {
+                               this.Write(1);
+                               this.WriteByte((byte)type);
+                               length = 1;
+                       }
+                       else
+                       {
+                               length = buffer.Length + 1;
+                               this.Write(length);
+                               this.WriteByte((byte)type);
+                               this.Write(buffer, 0, buffer.Length);
+                       }
+                       this.Write(Pad, 0, ((4 - length) & 3));
+               }
+
+               public void Write(string value)
+               {
+                       byte[] buffer = this.charset.GetBytes(value);
+
+                       this.WriteBuffer(buffer, buffer.Length);
+               }
+
+               public void Write(short value)
+               {
+                       this.Write((int)value);
+               }
+
+               public void Write(int value)
+               {
+                       this.Write(BitConverter.GetBytes(IPAddress.NetworkToHostOrder(value)), 0, 4);
+               }
+
+               public void Write(long value)
+               {
+                       this.Write(BitConverter.GetBytes(IPAddress.NetworkToHostOrder(value)), 0, 8);
+               }
+
+               public void Write(float value)
+               {
+                       byte[] buffer = BitConverter.GetBytes(value);
+
+                       this.Write(BitConverter.ToInt32(buffer, 0));
+               }
+
+               public void Write(double value)
+               {
+                       byte[] buffer = BitConverter.GetBytes(value);
+
+                       this.Write(BitConverter.ToInt64(buffer, 0));
+               }
+
+               public void Write(decimal value, int type, int scale)
+               {
+                       object numeric = TypeEncoder.EncodeDecimal(value, scale, type);
+
+                       switch (type & ~1)
+                       {
+                               case IscCodes.SQL_SHORT:
+                                       this.Write((short)numeric);
+                                       break;
+
+                               case IscCodes.SQL_LONG:
+                                       this.Write((int)numeric);
+                                       break;
+
+                               case IscCodes.SQL_QUAD:
+                               case IscCodes.SQL_INT64:
+                                       this.Write((long)numeric);
+                                       break;
+
+                               case IscCodes.SQL_DOUBLE:
+                               case IscCodes.SQL_D_FLOAT:
+                                       this.Write((double)value);
+                                       break;
+                       }
+               }
+
+               public void Write(DateTime value)
+               {
+                       this.WriteDate(value);
+                       this.WriteTime(value);
+               }
+
+               public void WriteDate(DateTime value)
+               {
+                       this.Write(TypeEncoder.EncodeDate(Convert.ToDateTime(value)));
+               }
+
+               public void WriteTime(DateTime value)
+               {
+                       this.Write(TypeEncoder.EncodeTime(Convert.ToDateTime(value)));
+               }
+
+               public void Write(Descriptor descriptor)
+               {
+                       for (int i = 0; i < descriptor.Count; i++)
+                       {
+                               this.Write(descriptor[i]);
+                       }
+               }
+
+               public void Write(DbField param)
+               {
+                       Charset innerCharset = (this.charset.Name != "NONE") ? this.charset : param.Charset;
+
+                       param.FixNull();
+
+                       try
+                       {
+                               switch (param.DbDataType)
+                               {
+                                       case DbDataType.Char:
+                                               {
+                                                       string svalue = param.DbValue.GetString();
+
+                                                       if ((param.Length % param.Charset.BytesPerCharacter) == 0 &&
+                                                               svalue.Length > param.CharCount)
+                                                       {
+                                                               throw new IscException(335544321);
+                                                       }
+
+                                                       this.WriteOpaque(innerCharset.GetBytes(svalue), param.Length);
+                                               }
+                                               break;
+
+                                       case DbDataType.VarChar:
+                                               {
+                                                       string svalue = param.DbValue.GetString().TrimEnd();
+
+                                                       if ((param.Length % param.Charset.BytesPerCharacter) == 0 &&
+                                                               svalue.Length > param.CharCount)
+                                                       {
+                                                               throw new IscException(335544321);
+                                                       }
+
+                                                       byte[] data = innerCharset.GetBytes(svalue);
+
+                                                       this.WriteBuffer(data, data.Length);
+                                               }
+                                               break;
+
+                                       case DbDataType.SmallInt:
+                                               this.Write(param.DbValue.GetInt16());
+                                               break;
+
+                                       case DbDataType.Integer:
+                                               this.Write(param.DbValue.GetInt32());
+                                               break;
+
+                                       case DbDataType.BigInt:
+                                       case DbDataType.Array:
+                                       case DbDataType.Binary:
+                                       case DbDataType.Text:
+                                               this.Write(param.DbValue.GetInt64());
+                                               break;
+
+                                       case DbDataType.Decimal:
+                                       case DbDataType.Numeric:
+                                               this.Write(
+                                                       param.DbValue.GetDecimal(),
+                                                       param.DataType,
+                                                       param.NumericScale);
+                                               break;
+
+                                       case DbDataType.Float:
+                                               this.Write(param.DbValue.GetFloat());
+                                               break;
+
+                                       case DbDataType.Guid:
+                                               this.WriteOpaque(param.DbValue.GetGuid().ToByteArray());
+                                               break;
+
+                                       case DbDataType.Double:
+                                               this.Write(param.DbValue.GetDouble());
+                                               break;
+
+                                       case DbDataType.Date:
+                                               this.Write(param.DbValue.EncodeDate());
+                                               break;
+
+                                       case DbDataType.Time:
+                                               this.Write(param.DbValue.EncodeTime());
+                                               break;
+
+                                       case DbDataType.TimeStamp:
+                                               this.Write(param.DbValue.EncodeDate());
+                                               this.Write(param.DbValue.EncodeTime());
+                                               break;
+
+                                       default:
+                                               throw new IscException("Unknown sql data type: " + param.DataType);
+                               }
+
+                               this.Write(param.NullFlag);
+                       }
+                       catch (IOException)
+                       {
+                               throw new IscException(IscCodes.isc_net_write_err);
+                       }
+               }
+
+               #endregion
+
+               #region Private Methods
+
+               private void CheckDisposed()
+               {
+                       if (this.innerStream == null)
+                       {
+                               throw new ObjectDisposedException("The XdrStream is closed.");
+                       }
+               }
+
+               #endregion
+       }
+}
index 9a787e08162888f94c7057599d4c7fdddab810f2..b930f04158ad84cecc152e271e916ff46d9969dc 100644 (file)
@@ -27,7 +27,7 @@ EXTRA_DISTFILES = \
        readme.txt \
        changelog.txt \
        FirebirdSql.Data.Firebird.snk \
-       FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Resources/isc_error_msg.resources \
+       FirebirdSql.Data.Common/Resources/isc_error_msg.resources \
        Test/App.config \
        Test/AssemblyInfo.cs \
        Test/BaseTest.cs \
index 0c3518723ffb7b48e57ff6476c5e5ce0284ea39c..9e4c4f75d1a1d61e9f3f5645df743587ed7bf803 100644 (file)
-Firebird ADO.NET Data provider for .NET and Mono \r
-================================================\r
-\r
-\r
-\r
-2005-06-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs:\r
-       * FirebirdSql.Data.firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs:\r
-\r
-               - Allow configuration of quoted identifiers usage. (Thanks to Ernesto Cullen for his help.)\r
-\r
-       * FirebirdSql.WizardFramework/WizardForm.cs:\r
-\r
-               - Allow to cancel wizard execution using ESC key.\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:\r
-\r
-               - Updated documentation comments.\r
-\r
-               - Added execution of SET GENERATOR commands.\r
-\r
-2005-06-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs:\r
-\r
-               - Add parameter information for DML statements.\r
-\r
-2005-06-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-\r
-               - Fixed bug on numeric and decimal reads and writes.\r
-\r
-       * FirebirdSql.Data.Gds/GdsArray.cs:\r
-       * FirebirdSql.Data.Embedded/FesArray.cs:\r
-\r
-               - Fixed bug on numeri and decimal array encoding.\r
-\r
-\r
-2005-06-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsConnection.cs:\r
-\r
-               - Fixed problem with mono on linux when reading port number for firebird events\r
-               connection (Gabriel Reid)\r
-\r
-\r
------------------- 1.7 Final Release ----------------------\r
-\r
-2005-05-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs\r
-\r
-               - Bug fixes for the DataSet generation and Visual Studio integration.\r
-\r
-       * Update assembly version.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:\r
-\r
-               - Change to ensure the command has a valid connection before perform an update.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs\r
-\r
-               - Force command initialization on .NET 1.0 and .NET 1.1\r
-\r
-2005-05-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsConnection.cs:\r
-\r
-               - Correctly disable Nagle Algorithm.\r
-\r
-2005-05-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Services/FbBackupFile.cs:\r
-\r
-               - Changed to be class instead of an struct, to allow it be used in C++\r
-\r
-2005-05-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDatabaseInfo.cs:\r
-       * FirebirdSql.Data.Common/IscHelper.cs:\r
-\r
-               - Implemented new property ActiveUSers (Tracker item #1198051)\r
-\r
-2005-05-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:\r
-\r
-               - Fixed constructor bug. (Thanks to Julien Ferraro)\r
-\r
-2005-05-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - HasRows property will return true only for Select commands.\r
-\r
-2005-04-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Close DataReader when preparing a new command.\r
-\r
-2005-04-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Common/TypeHelper.cs:\r
-       * FirebirdSql.Data.Firebird/Common/DbField.cs:\r
-       * FirebirdSql.Data.Firebird/Gds/XdrStream.cs:\r
-\r
-               - Fixed Decimal and Numeric field handling.\r
-\r
-2005-04-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbException.cs:\r
-       * FirebirdSql.Data.Common/BinaryEncoding.cs:\r
-       \r
-               - Fixed .NET Compact Framework Beta 2 build problems.\r
-\r
-2005-04-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:\r
-\r
-               - Better handling of comments and strings.\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:\r
-\r
-               - Fix bug on transaction handling.\r
-\r
-2005-04-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/Charset.cs:\r
-\r
-               - Try to make the SupportedCharsets property thread safe.\r
-\r
-2005-04-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:\r
-\r
-               - Added a new constructor.\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:\r
-\r
-               - Try to avoid problem with / inside comments (needs tetsting)\r
-\r
-\r
------------------- Release Candidate 3 ----------------------\r
-\r
-\r
-2005-04-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Make usage of the isc_dpb_overwrite parameter in CreateDatabase method.\r
-\r
-2005-04-9 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-\r
-               - Try to fix performance problems when reading array fields using the embedded server.\r
-\r
-2005-04-7 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/DbValue.cs:\r
-\r
-               - Fixed bug in GetString method when reading \r
-               Clob values several times (Thanks to Mike Scott for his feedback).\r
-\r
-2005-04-6 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fixed output parameter handling.\r
-\r
-2005-04-3 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Try to avoid breaking change on sp calls using ExecuteScalar method.\r
-\r
-2005-03-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:\r
-\r
-               - Close the isql file after have readed the contents (Thanks to for Muthu Annamalai his feedback).\r
-\r
-2005-03-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs:\r
-\r
-               - Changed the way the DataSet is added to the designer (and serialized into source code)\r
-\r
-2005-03-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Allow access to the RecordsAffected property when the reader is not closed (Thanks to Andrea Sansottera for his feedback)\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:\r
-\r
-               - Changes to improve the RowUpdated event handling, they\r
-               needs testing (Thanks to Andrea Sansottera for his feedback)\r
-\r
-2005-03-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:\r
-\r
-               - Improved error reporting on Updates (Thanks to Andrea Sansottera for his feedback)\r
-\r
-2005-03-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fixed problem with implicit transaction Commit's and Rollback's\r
-               when the objects are collected by the GC.\r
-\r
-2005-03-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Changed all references to CurrentUICulture to CurrentCulture.\r
-\r
-2005-03-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:\r
-\r
-               - Added CREATE DESCENDING INDEX command handling. (Thanks to Daniel Letecky)\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:\r
-\r
-               - Try to improve handling of -- comments (changes doesn't cover all cases of quoted ' usage)\r
-\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs\r
-\r
-               - Changed encoding of relation, field, alias and owner names, to use\r
-               the connection character set.\r
-\r
-2005-03-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:\r
-\r
-               - Fixed comment removal (Thanks to Daniel Letecky)\r
-\r
-2005-02-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-\r
-               - Fixed problem with space handling. Added NUnit test case.\r
-\r
------------------- Release Candidate 2 ----------------------\r
-\r
-2005-02-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/IscException.cs\r
-\r
-               - Changes for better exception handling on message formatting.\r
-\r
-2005-02-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Added missing synonym (Thanks to Mike Scott by his feedback)\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedures.cs:\r
-\r
-               - Added column for the procedure source.\r
-\r
-2005-02-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-       * FirebirdSql.Data.Gds/FesStatement.cs:\r
-\r
-               - Fixed problem with transaction value set (Thanks to Oleg Paschenko)\r
-\r
-2005-02-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/VSExtensibility.cs:\r
-\r
-               - Added Visual Studio 2002 support.\r
-\r
-2005-02-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsConnection.cs:\r
-\r
-               - Do not include calls to Socket.SetSocketOption when working\r
-               with the .NET Compact Framework that should allow the provider\r
-               to do connections when working with the .NET Compact Framework\r
-               (Thanks to Fonzetto Michaël for his feedback)\r
-\r
-2005-02-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsConnection.cs:\r
-\r
-               - Changed ProtocolType used to configure the Socket to ProtocolType.Tcp\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:\r
-\r
-               - Undo latest changes on RemoveComments method as they breaks the execution of some tstatements.\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbBatchExecition.cs:\r
-\r
-               - Fixed bug on autocommit mode.\r
-\r
-2005-02-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-\r
-               - Fix for exception message building.\r
-\r
-\r
------------------- Release Candidate 1 ----------------------\r
-\r
-2005-02-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fixed SP execution on ExecuteScalar method (Thanks to Alessandro Petrelli for his feddback)\r
-\r
-       * FirebirdSql.Data.Firebird/FbParameter.cs:\r
-       * FirebirdSql.Data.Common./DbField.cs:\r
-\r
-               - Fixed null Guid handling.\r
-\r
-2005-01-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Embedded/FesArray.cs:\r
-\r
-               - Fixed problem with 0 lowerbound arrays.\r
-\r
-2005-01-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fixed sqal generation for strored procedure names (Thanks to Andrzej Kaczmarczyk for his feedback).\r
-\r
-2005-01-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/DbField.cs:\r
-\r
-               - Fixed incorrect mapping (Thanks to Frans Bouma for his feedback.)\r
-\r
-2005-01-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-       \r
-       - Reformatted the source code.\r
-\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-\r
-               - Fixed problem with system field values, now checks are done using the\r
-               field character set (Thanks to Phaidros for his feedback).\r
-\r
-       * FirebirdSql.Data.Common/ITransaction.cs:\r
-       * FirebirdSql.Data.Embedded/FesTransaction.cs:  \r
-       * FirebirdSql.Data.Gds/GdsTransaction.cs:       \r
-       \r
-               - Commented Prepare method overloads.\r
-\r
-       * FirebirdSql.Data.Embedded/FesTransaction.cs:  \r
-\r
-               - Commented PInvoke funcition definitions that aren't used.\r
-\r
-2005-01-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-\r
-               - Fixed problem on Event manager close.\r
-\r
-2005-01-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep1.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep5.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs\r
-\r
-               - Minor changes on label's text.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs\r
-\r
-               - Changes to show information abot the errors got on data adapter configuration.\r
-\r
-       * Updated license headers.\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-\r
-               - Fix ClearArrayHandles method by checking for array fields.\r
-\r
-2005-01-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-\r
-               - Try to fix performance problems with array fields on select statements.\r
-\r
-2005-01-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:\r
-\r
-               - Changes for better handling of comment removal (Andreas Sandner)\r
-\r
-2005-01-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Embedded/FesArray.cs:\r
-       * FirebirdSql.Data.Embedded/FesBlob.cs:\r
-       * FirebirdSql.Data.Embedded/FesConnection.cs:\r
-       * FirebirdSql.Data.Embedded/FesDatabase.cs:\r
-       * FirebirdSql.Data.Embedded/FesServiceManager.cs:\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-       * FirebirdSql.Data.Embedded/FesTransaction.cs:\r
-       * FirebirdSql.Data.Gds/GdsArray.cs:\r
-       * FirebirdSql.Data.Gds/GdsBlob.cs:\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-       * FirebirdSql.Data.Gds/GdsEventManager.cs:\r
-       * FirebirdSql.Data.Gds/GdsServiceManager.cs:\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-       * FirebirdSql.Data.Gds/GdsTransaction.cs:\r
-\r
-               - Cleanup.\r
-\r
-2005-01-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.WizardFramework/WizardStep.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep1.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep5.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs\r
-\r
-               - Changes for try to get the Wizard working on VS 2003.\r
-\r
-       * FirebirdSql.Data.Common/BinaryEncoding.cs\r
-\r
-               - Integrate the Encoding implementation for the OCTETS character set\r
-               Contributed by Jim Beveridge. (It's under the Public Domain)\r
-\r
-       * FirebirdSql.Data.Common/Charset.cs:\r
-\r
-               - Integrate the BinaryEncoding implementation.\r
-\r
-       * FirebirdSql.Data.Embedded/XsqldaMarshaler.cs:\r
-\r
-               - Added support for Guid parameters.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs\r
-\r
-               - Show a MessageBox with the exception deatils.\r
-\r
--------------------------- Beta 3 ----------------------------\r
-\r
-2005-01-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               -Fixed problem with the Guid parameters support.\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbbatchExecution.cs:\r
-\r
-               - Added initial autocommit mode support (needs testing).\r
-\r
-2004-12-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/Charset.cs:\r
-       * FirebirdSql.Data.Common/DbDataType.cs:\r
-       * FirebirdSql.Data.Common/DbField.cs:\r
-       * FirebirdSql.Data.Common/DbValue.cs:\r
-       * FirebirdSql.Data.Common/TypeHelper.cs:\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-       * FirebirdSql.Data.Firebird/FbCharset.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-       * FirebirdSql.Data.Firebird/FbDbType.cs:\r
-       * FirebirdSql.Data.Firebird/FbParameter.cs:\r
-\r
-               - Added initial suport for the GUID datatype.\r
-               Guids will be mapped to CHAR(16) CHARACTER SET OCTETS fields in firebird.\r
-               In the FbParameter class Guid values should be passed as Guid instances or \r
-               byte arrays.\r
-               The changes are not finished yet.\r
-               A new Test suite for the Guid support is included.\r
-\r
-               Thanks to Jim Beveridge for his help and feedback.\r
-\r
-2004-12-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/DbValue.cs:\r
-\r
-               - Fixed bug on long values conversion to string (Thanks to Sven Kammradt for his feedback).\r
-               Test case added to the test suite.\r
-\r
-2004-12-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommandbBuilder.cs:\r
-\r
-               - Removed check of the DataColumn.Autoincrement property in the IsUpdateable method.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Fixed globalization issues.\r
-\r
-2004-12-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/FbDataAdapter/Designer/FbDataAdapterWizardSettings.cs\r
-       * FirebirdSql.Data.Firebird/Design/FbDataAdapter/Designer/FbDataAdapterWizard.cs\r
-       * FirebirdSql.Data.Firebird/Design/FbDataAdapter/Designer/FbDataAdapterDesigner.cs\r
-\r
-               - Changes for see if we can get the wizard to work with VS 2003\r
-\r
-2004-12-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Fixed validation of connection strings without a data source when the\r
-               ServerType parameter is 1 (Thanks to Peter Turcan for his feedback).\r
-\r
-       * FirebirdSql.Data.Common/Charset.cs:\r
-       * FirebirdSql.Data.Common/CharsetCollection.cs:\r
-\r
-               - Load encodings at runtime in order to improve memory usage. (Thnaks to Jim Beveridge for his feedback)\r
-\r
-2004-12-08 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs\r
-\r
-               - Fixed FillConnections method.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs\r
-\r
-               - Prevent to generate Typed DataSets if the provider was\r
-               not build with the VISUAL_STUDIO define\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs:\r
-\r
-               - Fixed DTE creation when there are more than one Visual Studio instance.\r
-               Reference:\r
-                       http://devresource.hp.com/technical_white_papers/CodeModel1.pdf\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-\r
-               - Better checks on Release method (Thanks to Pierre Arnaud)\r
-\r
--------------------------- Beta 2 ----------------------------\r
-\r
-2004-12-03 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardSettings.cs:\r
-\r
-               - Fixed conversion doing a cast.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardStep2.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardStep4.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardStep6.cs:\r
-\r
-               - Changes for allow a better initialization of the step data when \r
-               the DataAdapter was already configured before.\r
-\r
-       * Fixed FxCop issues.\r
-\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-\r
-               - Fix Stream and IDisposable implementation.\r
-\r
-2004-12-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Changes on the Firebird Events implementation.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-       * FirebirdSql.Data.Common/DbValue.cs:\r
-               \r
-               - Try to get the FbDataReader.GetBoolean method working.\r
-\r
-2004-12-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-\r
-               - Added a new Commit(string) method (Thanks to for Andrzej Kaczmarczyk his feedback)\r
-\r
-2004-11-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Reorganization of the Services sources.\r
-\r
-2004-11-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-\r
-               - Fix for the latest changes of the exception message formatting\r
-\r
-2004-11-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-\r
-               - If the resource cannot be found raise the \r
-               exception with the default message.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Changes on Transaction and resources management.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Fixed problem with the CreateDatabase problem, when it's requested to not\r
-               overwrite the an existing database database, and there are no real database \r
-               to connect to.\r
-\r
-2004-11-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSQl.Data.Gds/GdsTransaction.cs:\r
-       * FirebirdSQl.Data.Embedded/FesTransaction.cs:\r
-\r
-               - Fixed bug in the Dispose method (Thanks to Pierre Arnaud for his feedback)\r
-                 Test case added for this bug.\r
-\r
-2004-11-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:\r
-\r
-               - Set the dataset namespace.\r
-\r
-2004-11-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs:\r
-\r
-               - Changes for better support of Visual Studio project files,\r
-               when adding Typed Datasets (not finished.)\r
-\r
-2004-11-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbErrorCollection.cs:\r
-       * FirebirdSql.Data.Firebird/FbParameterCollection.cs:\r
-               \r
-                       - Better fit to ADO.NET\r
-       \r
-       * FirebirdSql.Data.Common/IscErrorCollection.cs:\r
-       * FirebirdSql.WizardFramework/WizardStepCollection.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-       * FirebirdSql.Data.Firebird/FbRemoteEventEventArgs.cs:\r
-       * FirebirdSql.Data.Firebird/Isql/FbbatchExecution.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs:\r
-       \r
-                       - Fixed FxCop issues.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs:\r
-       \r
-                       - Minor reorganization.\r
-                       \r
-2004-11-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-\r
-               - Changes to try to handle correctly the character sets (Thanks to Kazuhiro Kato for his feedback)\r
-\r
-       * FirebirdSql.Data.Common/Charset.cs:\r
-       * FirebirdSql.Data.Common/BlobBase.cs:\r
-       * FirebirdSql.Data.Common/DbField.cs:\r
-       * FirebirdSql.Data.Common/RemoteEvent.cs:\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-       * FirebirdSql.Data.Embedded/FesArray.cs:\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-       * FirebirdSql.Data.Embedded/XsldaMarshaler.cs:\r
-       * FirebirdSql.Data.Gds/GdsArray.cs:\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-\r
-               - Make the charset class to be a full wrapper for the .NET encoding class.\r
-\r
-2004-11-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.WizardFramework/WizardStep.cs:\r
-       * FirebirdSql.Data.WizardFramework/WizardForm.cs:\r
-\r
-               - Added changes to allow condition navigation to previous steps.\r
-\r
-               - Simplify finish navigation.\r
-\r
-       * FirebirdSql.Data.WizardFramework/WizardForm.cs:\r
-\r
-               - Moved Validation handler configuration to the ShowStep method.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/FbDataAdadapterWizardStep7.cs:\r
-\r
-               - New wizard step to show the results.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/FbDataAdadapterWizardForm.cs:\r
-\r
-               - Removed DataAdapter configuration code.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/DataSetGenerator.cs:\r
-\r
-               - Let Visual Studio to generate the source code for the Typed DataSet.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/VSExtensibility.cs:\r
-\r
-               - Changes to add a file as an embedded resource.\r
-\r
-2004-11-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:\r
-\r
-               - Fixed bug in DropDatabase implementation. (Thanks to Daniel Letecky for his feedback.)\r
-\r
-       * FirebirdSql.Data.Common/CharsetCollection.cs:\r
-       * FirebirdSql.Data.Common/IscErrorCollection.cs:\r
-\r
-               - Changes to inherit from CollectionBase\r
-\r
-2004-11-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs:\r
-\r
-               - Override OnSetComponentDefaults and launch the wizard for initialization.\r
-\r
-               - Do not use localization support in the wizard for now.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:\r
-\r
-               - Use FillSchema to generate the tables in the DataSet.\r
-\r
-               - Make one of the DataSet generation methods to be more\r
-               general (it takes a connection string instead of a DataAdapter\r
-               as parameter).\r
-\r
-2004-11-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-\r
-               - Try to fix a problem with the transactions and data readers handling.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSextensibility.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:\r
-\r
-               - Added class for handle Visual Studio Extensibility support\r
-               (No terminado)\r
-\r
-2004-11-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:\r
-\r
-               - New DataSet generation class for the Design Time support.\r
-\r
-2004-11-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbRemoteEventEventArgs.cs:\r
-\r
-               - New file.\r
-\r
-       * FirebirdSql.Data.Firebird/FbEvent.cs:\r
-\r
-               - Try to improve the remothe event handling, the\r
-               new event should provide cancelation capabilities.              \r
-\r
-2004-11-09 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs:\r
-\r
-               - Save settings and control wheter the textbox is empty\r
-\r
-       * FirebirdSql.WizardFramework/WizardForm.cs:\r
-\r
-               - Save settings before raise the BeforeFinish event.\r
-\r
-       * FirebirdSql.WizardFramework/WizardStep.cs:\r
-\r
-               - Changed the SaveSettings method to public.\r
-\r
-2004-11-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardSettings.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardForm.cs:\r
-\r
-                -Added initial DataAdapter configuration code in the BeforeFinsh event.\r
-\r
-       * Fixed FxCop rules.\r
-\r
-2004-11-06 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:\r
-       * FirebirdSql.Data.Firebird/FbEvent.cs:\r
-       * FirebirdSql.Data.Common/IDatabase.cs:\r
-       * FirebirdSql.Data.Embedded/FesDatabase.cs:\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-       * FirebirdSql.Data.Gds/GdsEventManager.cs:\r
-\r
-               - Improved Firebird Events Implementation.\r
-\r
-       * Fixed FxCop rules.\r
-\r
-       * Added FxCop project file to the builds directory.\r
-\r
-2004-11-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs:\r
-\r
-               - Fixed problem with the Setting update.\r
-\r
-       * FirebirdSql.Data.Firebird/Embedded/FesStatement.cs:\r
-       * FirebirdSql.Data.Firebird/Embedded/XSQLDA.cs:\r
-       * FirebirdSql.Data.Firebird/Embedded/XsqlMarshaler.cs:\r
-\r
-               - Better handling of the XSQLVAR strings, now\r
-               instead of being marshaled directly as strings\r
-               they are being marshaed as byte arrays, what\r
-               would make possible to handle strings with a\r
-               multibyte encoding.\r
-               The encoding/decoding of the strings are being \r
-               done using the connection character set.\r
-\r
-\r
--------------------------- Beta 1 ----------------------------\r
-\r
-\r
-2004-11-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Updated Wizard Framework sources.\r
-\r
-2004-11-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs:\r
-\r
-               - Update schema information (Thanks to Viatcheslav V. Vassiliev for his feedback)\r
-\r
-       * Updated documentation of the WizardFramework classes.\r
-\r
-       * Removed WizardState class (the validation will be done\r
-       using the DialogResult as the wizard will be called always\r
-       using the ShowDialog method).\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Fixed bug on initialization of the user id\r
-\r
-       * FirebirdSql.WizardFramework/WizardStep.cs:    \r
-\r
-               - Added support for custom navigations (for next button)\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs:\r
-\r
-               - Implemented custom navigation.\r
-\r
-2004-10-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/Connection/Editor/FbConnectionStringEditor.cs:\r
-\r
-               - Minor change for allow the editor to be used with the default constructor.\r
-\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs:\r
-\r
-               - New class for the DataSet Genetator (without implementation)\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep5.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs:\r
-\r
-               - New steps (without implementation)\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs:\r
-\r
-               - Implement funcionaly of the new connection button.\r
-               It will call the FbConnectionStringEditor.\r
-\r
-               - Changed settings handling.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardSettings.cs:\r
-\r
-               - New inner class for handle wizard settings.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:\r
-\r
-               - Change step loading and settings handling.\r
-\r
-2004-10-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-\r
-               - Format the statement plan using the character set\r
-               of the connection.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs:\r
-               \r
-               - Run the wizard automatically when the componenet is created (.NET 2.0 only).\r
-\r
-               - Initialize the SelectCommand, InsertCommand, UpdateCommand and DeleteCommand\r
-               when the component is created (the first time only) (.NET 2.0 only).\r
-\r
-2004-10-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.WizardFramework/WizardSettings.cs:\r
-       * FirebirdSql.WizardFramework/WizardSettingsManager.cs:\r
-\r
-               - New classes.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:\r
-\r
-               - Added some settings handling code.\r
-\r
-       * FirebirdSql.WizardFramework/WizardForm.cs:\r
-       * FirebirdSql.WizardFramework/WizardStep.cs:    \r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs;\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:\r
-\r
-               - Added better validations.\r
-\r
-2004-10-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Modified the build file to include the Wizard Framework.\r
-\r
-       * FirebirdSql.WizardFramework/WizardForm.cs:\r
-\r
-               - Minor change.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep1.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs:\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:\r
-\r
-               - New files for the FbDataAdapter Configuration wizard (not finished)\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs:\r
-\r
-               - Changes for load the Wizard. (not finished)\r
-\r
-2004-10-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Changes for try to get the Role to be working again (Thanbks to Oleg Deribas for his feedback)\r
-\r
-2004-10-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.WizardFramework/ActionStep.cs:\r
-       * FirebirdSql.WizardFramework/WelcomeStep.cs:   \r
-\r
-               - New clases.\r
-\r
-       * FirebirdSql.WizardFramework\r
-\r
-               - New Directory\r
-\r
-       * FirebirdSql.WizardFramework/WizardForm.cs:\r
-       * FirebirdSql.WizardFramework/WizardStep.cs:    \r
-       * FirebirdSql.WizardFramework/WizardState.cs:\r
-\r
-               - Added an initial implementation of a simple wizard Framework\r
-               to simplify the creation of the provider Design Time Wizards.\r
-\r
-               * It's under heavy development so it's not finished and it's untested *\r
-\r
-               * For now it will be not included in the build process *\r
-\r
-2004-10-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:\r
-\r
-               - Minor fix (Thanks to Viatcheslav V. Vassiliev for his\r
-               feedback)\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fixed Input parameter describe when the Prepare method\r
-               is called before the FbCommand instance has parameters assigned.\r
-               ( test case included ) Thanks to Viatcheslav V. Vassiliev for his\r
-               feedback\r
-\r
-       * FirebirdSql.Data.Firebird/Design/Command/Designer/FbCommandDesigner.cs:\r
-               \r
-               - Override PreFilterAttributes and add teh DesignTimeVisibleAttribute using\r
-               the FbCommand.DesignTimeVisible property value.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdpater/Designer/FbDataAdapterDesigner.cs:\r
-\r
-               - Minor changes (contains test code).\r
-\r
-2004-10-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/RemoteEvent.cs:\r
-       * FirebirdSql.Data.Common/EventParameterBuffer.cs:\r
-\r
-               - Fixed TPB generation (Olaf Lüder)\r
-\r
-2004-10-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fixed command text initialization.\r
-\r
-2004-10-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Design/Connection/Designer/FbCommandDesigner.cs\r
-\r
-               - New class.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs\r
-\r
-               - Added Designer Attribute.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs\r
-\r
-               - New class.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataAdapter.cs\r
-\r
-               - Added Designer Attribute.\r
-\r
-2004-10-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Reorganization of the Design Time support classes.\r
-\r
-2004-10-09 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/StringCollection.cs:\r
-\r
-               - Added CopyTo method.\r
-\r
-2004-10-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbSecurity.cs\r
-\r
-               - Added better checks for user data.\r
-\r
-2004-10-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommandbuilder.cs:\r
-\r
-               - Fixed quoted identifier generation when\r
-               the quote prefix or the quote suffix are null.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Fixed exception handling on Open method.\r
-\r
-       * FirebirdSql.Data.Common/ArrayBase.cs:\r
-       * FirebirdSql.Data.Embedded/FesArray.cs:\r
-       * FirebirdSql.Data.Gds/GdsArray.cs:\r
-\r
-               - Changes for try to allow work with arrays\r
-               defined with lowerbound 0.\r
-\r
-2004-10-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbEvent.cs:\r
-       * FirebirdSql.Data.Common/RemoteEvent.cs:\r
-\r
-               - Modified handling of actual event counts.\r
-\r
-2004-09-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-       * FirebirdSql.Data.Embedded/FesDatabase.cs:\r
-       * FirebirdSql.Data.Common/EventParameterBuffer.cs:\r
-\r
-               - Fixed EventParameter buffer handling.\r
-\r
-\r
-2004-09-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Cleanup.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-\r
-               - Removed IsolationLevel.Snapshot that is supported only \r
-               in .NET 2.0\r
-\r
-2004-09-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       - Updated IDPL license URL to point to the FirebirdSQL project web site.\r
-\r
-       - Fixed FbDataAdapter documentation example (Thanks to Roland Turcan)\r
-\r
-2004-09-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-\r
-               - Added new "Isolation Level" parameter for the connection string,\r
-               that allows to set the default IsolationLevel for implicit transactions.\r
-\r
-       * FirebirdSql.Data.Embedded/XSQLDA.cs:\r
-       * FirebirdSql.Data.Embedded/XsqldaMarshaler.cs:\r
-\r
-               - Changes on pointer address calculation.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Improve handling of parameters when they have null values.\r
-               Affects mainly the embedded server support (Thanks to Pierre \r
-               Arnaud for his feedback)        \r
-\r
-2004-09-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbField.cs:\r
-\r
-               - Fix for SetValue method on character values trimming when \r
-               working with system tables. Affects only the embedded server \r
-               support (Thanks to Sander Bosman for his feedback)\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Added new synonym for the 'Server Type' parameter.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fixed implicit transaction handling.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:\r
-\r
-               - Set IsNullable property for parameters of generated \r
-               commands.\r
-\r
-       * FirebirdSql.Data.Embedded/XsqdaMarshaler.cs:\r
-\r
-               - Minor changes on sqlind handling.\r
-\r
-2004-09-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Added support for the .NET Compact Framework 2.0 Beta 1\r
-\r
-2004-09-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-       * FirebirdSql.Data.Gds/GdsArray.cs:     \r
-       * FirebirdSql.Data.Gds/FesArray.cs:\r
-\r
-               - Changes on DateTime conversions by using CurrentUICulture\r
-               instead of the InvariantCulture.\r
-\r
-       * FirebirdSql.Data.Gds/XdrStream.cs:\r
-\r
-               - Minor formatting changes.\r
-\r
-2004-09-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbParameter.cs:\r
-       * FirebirdSql.Data.Firebird/FbParameterCollection.cs:\r
-\r
-               - Format changes\r
-\r
-       * FirebirdSql.Data.Firebird/FbException.cs:\r
-\r
-               - Minor reorganization.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Added new code for handle the Max Connection Pool behavior (needs testing)\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Globalization changes.\r
-\r
-       * FirebirdSql.Data.Common/ArrayBase.cs:\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-       \r
-               - Globalization changes.\r
-\r
-       * FirebirdSql.Data.Common/IscCodes.cs:\r
-\r
-               - Minor reorganization.\r
-\r
-               - Added new constants for standard buffer sizes.\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-\r
-               - Use constants instead of hard-coded values for buffer sizes\r
-\r
-       * FirebirdSql.Data.Gds/GdsConnection.cs:\r
-\r
-               - Added GC.SupressFinalize calls.\r
-\r
-\r
--------------------------- Alpha 3 ----------------------------\r
-\r
-\r
-2004-09-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Added changes to the connection cleanup.\r
-\r
-               - Fixed connection checkout from the pol.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Fixed packet size synonym\r
-\r
-2004-09-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Added new nunit test case for the database sweep (Validation service)\r
-\r
-       * FirebirdSql.Data.Gds/GdsServiceManager.cs:\r
-               \r
-               - Minor fix.\r
-\r
-2004-09-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:\r
-\r
-               - Added new GetSchema methods to FbConnectionInternall class.\r
-\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-\r
-               - Fixed buffer size for the Server Version\r
-               50 bytes seems to be not enough when working \r
-               against Firbeird 1.0.3 (it's weird because it returns \r
-               a string of length less than 50)\r
-\r
-\r
-2004-09-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDbConnection.cs:\r
-\r
-               - Renamed to FbConnectionInternal.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:\r
-\r
-               - New file (ADO.NET 2.0 has an DbConnectionInternal that should be implemented\r
-               in ado.net provider implementations this class should be used in the future\r
-               as base for that class implementation)\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:\r
-       * FirebirdSql.Data.Firebird/FbDatabaseInfo.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDbSchema.cs:\r
-       * FirebirdSql.Data.Firebird/FbEvent.cs:\r
-       * FirebirdSql.Data.Firebird/FbException.cs:\r
-\r
-               - Formatting changes.\r
-\r
-               - Moved some of the FbConnection and FbTransaction classes\r
-               funcionality to FbConnectionInternal.\r
-\r
-               With the new changes the connection handling matches better the\r
-               .net 2.0 compliant version i have in my local tree and will allow\r
-               an easy transaction in the future to ADO.NET 2.0.\r
-\r
-2004-09-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Added changes on connection pool handling.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cS:\r
-\r
-               - Minor improvements on pool handling.\r
-\r
-               - Fixed bug on GetConnection method when\r
-               timestamps are equal including the milliseconds\r
-               (Thanks to Alessandro Petrelli for his help ontesting the problem)\r
-\r
-2004-09-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Added better lock handling in the FbPoolManager class.\r
-               \r
-2004-09-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Return back to use regular expressions for\r
-               connection string parsing as they ar emore precise\r
-               for this purpouse (Thanks to Sven Kammradt for his feedback)\r
-\r
-2004-09-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - CheckState shouldn't check for eof.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Added changes for the initial implementation\r
-               iof a Wendell Wilkie suggestion for improve \r
-               connection checkouts adn pools load.\r
-\r
-2004-09-09 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Added new ConnectionPoolsCount and \r
-               GetPooledConnectionCount members to the\r
-               FbConnection class.\r
-\r
-               - Minor change in FbConnectionPool class.\r
-\r
-\r
-2004-09-08 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Updated documentation.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Minor fix for better detection of the datareader position.\r
-\r
-\r
-2004-09-03 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Fixed pool cleaning when the for pools with\r
-               connection lifetime of 0.\r
-\r
-       * Formatting changes.\r
-\r
-       * Added new parameter buffer classes and reworked existent \r
-       parameter buffer classes.\r
-\r
-       New classes:\r
-\r
-               - TransactionParameterBuffer.cs\r
-\r
-               - BlobParameterBuffer.cs\r
-\r
-       * Renamed parameter buffer classes:\r
-\r
-               - BufferBase -> ParameterBuffer\r
-               - DpbBuffer -> DatabaseParameterBuffer\r
-               - SpbBuffer -> ServiceParameterBuffer\r
-               - EpbBuffer -> EventParameterBuffer\r
-\r
-       * FirebirdSql.Data.Common/IDatabase.cs:\r
-       * FirebirdSql.Data.Common/IServiceManager.cs:\r
-       * FirebirdSql.Data.Common/RemoteEvent.cs:\r
-       * FirebirdSql.Data.Embedded/FesDatabase.cs:\r
-       * FirebirdSql.Data.Embedded/FesServerManager.cs:\r
-       * FirebirdSql.Data.Embedded/FesTransaction.cs:\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-       * FirebirdSql.Data.Gds/GdsBlob.cs:\r
-       * FirebirdSql.Data.Gds/GdsTransaction.cs:\r
-       * FirebirdSql.Data.Gds/GdsServerManager.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbDbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbService.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbBackup.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbRestore.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbConfiguration.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbLog.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbSecurity.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbStatistical.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbServerProperties.cs:\r
-       * FirebirdSql.Data.Firebird/Services/FbValidation.cs:\r
-               \r
-               - Improved parameter buffer handling\r
-\r
-2004-09-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/IscCodes.cs:\r
-\r
-               - Added Firebird facilities codes.\r
-\r
-               - Added ISC_MASK code for isc error code generation.\r
-\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-\r
-               - Changes on the error collection handling\r
-\r
-               - Added new statioc method for generation of isc error codes.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Added changes for try to get the connection pooling working correctly.\r
-               (Thanks to Alessandro Petrelli.  for his feedback)\r
-\r
-2004-08-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-       \r
-       * FirebirdSql.Data.Firebird/Embedded/FbClient.dll:\r
-\r
-               - Allow the embedded GDS to be built for work against Vulcan.\r
-\r
-2004-08-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Added changes to the GetSchemaTable method to \r
-               avoid schema command execution when the field\r
-               doesn't belong to a firebird table.\r
-               (Thanks to Gregory P. for his feedback)\r
-\r
-2004-08-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Fixed bug #1017108\r
-\r
-2004-08-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-\r
-               - Improved building of the exception message.\r
-\r
-       * FirebirdSql.Data.Embedded/FesServiceManager.cs:\r
-\r
-               - Monor fix.\r
-\r
-       * FirebirdSql.Data.Firebird/Services/FbService.cs:\r
-\r
-               - Do not throw an exception if the service is closed and\r
-               a new call to close is done.\r
-\r
-       * FirebirdSql.Data.Common/IDatabase.cs:\r
-       * FirebirdSql.Data.Common/FesDatabase.cs:\r
-       * FirebirdSql.Data.Common/GdsDatabase.cs:\r
-       * FirebirdSql.Data.Firebird/FbDbConnection.cs:\r
-\r
-               - Changes on GetDatabaseInfo overloads.\r
-\r
-               - Make the GetServerVersion method to request only 50 bytes.\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-               \r
-               - Try to get the statement plan only 4 times,\r
-               if the plan cannot be retrieved returns null (Thanks to Claudio Valderrama)\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Minor changes and improvements over the latest commit.\r
-\r
-2004-08-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsage.cs:\r
-\r
-               - Set the CHARACTER_OCTET_LENGTH to 0 if the comlumns is not a char/varchar column.\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-\r
-               - Fixed bug #1015453.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       \r
-               - Changed FbConnectionString class to be internal.\r
-\r
-               - NEw class to build connection strings.\r
-\r
-       * FirebirdSql.Data.Firebird/Design/*.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Include the classes only if we are doing the build using MS.NET\r
-       \r
-       * FirebirdSql.Data.Common/DbField.cs:\r
-\r
-               - Trim trainling spaces for char fields when using the\r
-               embedded server and character sets with 2/3 characters per byte.\r
-\r
-\r
-2004-08-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Embedded/FbClient.cs:\r
-\r
-               - Cleanup.\r
-\r
-               - Change isc_dsql_prepare to get a byte array as parameter instead of a string.\r
-\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-\r
-               - Send a byte array in the isc_dsql_prepare call instead of a string.\r
-\r
-\r
--------------------------- Alpha 2 ----------------------------\r
-\r
-\r
-2004-08-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsage.cs:\r
-\r
-               - Added new CHARACTER_OCTET_LENGTH column\r
-\r
-               - Fixed size for char/varchar columns\r
-\r
-2004-08-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * The nunit test suite will run now using UNICODE_FSS \r
-       by default.\r
-\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsage.cs:\r
-\r
-               - Fixed NUMERIC_PRECISION value.\r
-       \r
-       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:\r
-\r
-               - Do not set the numeric precision and scale if the parameter\r
-               is not a decimal or numeric type.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:\r
-\r
-               - Added Restrictions definition.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbRestrictions.cs:\r
-\r
-               - Added name to the DataTable.\r
-\r
-2004-08-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Fixed bug #1013031\r
-\r
-2004-08-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:\r
-\r
-               - Added domain information.\r
-\r
-2004-08-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Updated nant build system.\r
-\r
-               - Put in different directories the nant build files\r
-               of the ADO.NET Provider and the Borland Data Provider.\r
-\r
-       * The build will done always in a single assembly.\r
-\r
-       * Fixed Globalization problems reported by FxCop.\r
-\r
-2004-08-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-\r
-               - [TESTING CHANGE] Do not request the owner when\r
-               describing statements as we are not using it for \r
-               never at this moment.\r
-\r
-       * FirebirdSql.Data.Gds/GdsConnection.cs:\r
-\r
-               - Added a call to GC.SuprresFinalize in the constructor.\r
-\r
-\r
-2004-08-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:\r
-\r
-               - Throw a InvalidOperationException instead of a\r
-               DataAdapterException that it's .NET 2.0 specific.\r
-\r
-               - Minor change on update count, seems that it needs to return\r
-               the number of *DataRows* updated.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Cleanup.\r
-\r
-2004-08-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Minor change on Null value check.\r
-\r
-               - Removed Attributes form the CommandTimeout,\r
-               they prevents the sources to be built using .net 1.0\r
-               (Thanks to Mara)\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:\r
-\r
-               - Override the DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)\r
-               method to make calls to FbCommand.ExecuteNonQuery method always on\r
-               inserts, updates and deletes.\r
-\r
-               It's  on *testing* for now and it's not clear if it will be finally used.\r
-\r
-2004-08-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Set conenction string default value to an empty string.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Changes on constructor implementation.\r
-\r
-\r
-2004-08-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/TypeHelper.cs:\r
-\r
-               - Fixed Float to mapping (Thanks to HDV).\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeys.cs:\r
-\r
-               - Added IS_DEFERRANLE and INITIALLY_DEFERRED columns\r
-\r
-\r
-2004-08-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Do not use GetMaxByteCount to calc the number of bytes for the input parameters.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs:\r
-\r
-               - Improved numeric precision handling.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Fixed bug #1007104\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs:\r
-\r
-               - Improved numeric precision handling.\r
-\r
-               - Minor fix to schema queries to let them to run\r
-               using the embedded server.\r
-\r
-2004-08-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>    \r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-               \r
-               - Cleanup.\r
-\r
-               - Reworked handling of stored procedure output \r
-               parameter values.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Improved input parameter descriptor generation.\r
-\r
-       * Last changes for the database schmeas support:\r
-\r
-\r
-               * All source files has been renamed to remove\r
-               the Schema suffix (FbTablesSchema.cs -> FbTables.cs)\r
-               The same for the class names.\r
-\r
-               * There are a new 'Restrictions' schema that will\r
-               return the restriction columns for each schema.\r
-\r
-               * There are new columns in some schemas:\r
-\r
-                          XXXX_CATALOG\r
-                          XXXX_SCHEMA\r
-\r
-               That will make the returned schemas more\r
-               general and compatible with other databases\r
-               (what will be nice for .net 2.0 as the schema\r
-               support is in the System.Data.Common.DbConnection\r
-               class)\r
-\r
-               These new columns are restriction columns as\r
-               well (the value will be null always)            \r
-\r
-\r
-2004-08-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Removed test comments.\r
-\r
-               - Throw an exception when trying to set the FetchSzie with an\r
-               active DataReader open.\r
-\r
-               - Set fetch size on execute instead of fetch.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbTablesSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:\r
-\r
-               - Now it's no possible to filter by the IS_SYSTEM_TABLE column,\r
-               doing that using the table type restriction.\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-\r
-               - Removed Rows property.\r
-\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-\r
-               - Removed Rows property.\r
-\r
-               - Use a Queue instead of a object[] to store the rows.\r
-               Performance looks similar (seems to be better with greater\r
-               fetch sizes) and the code is more readable.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Changes on the way that output parameters\r
-               for Stored procedures query are retrieved.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Minor changes in method calls.\r
-\r
-2004-08-06 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Fixed invalid references in the documentation reported by \r
-       .NET 2.0\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Cleanup.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbTablesSchema.cs:\r
-\r
-               - The system tables will now be filtered using the table type parameter.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-               \r
-               - Check connection state in GetSchema methods.  \r
-\r
-2004-08-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-       * FirebirdSql.Data.GDS/GdsStatement.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Fetch Size implementation that allows to define the \r
-               fetch size (number of rows fetches in the call selectable queries)\r
-               in the connection string and command objects.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionString.cs:\r
-\r
-               - Fixed bug #1004055 \r
-\r
-               - Added new nunit test.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDbSchema.cs:\r
-\r
-               - Added a little hack for the Tables schema restrictions.\r
-       \r
-\r
-2004-08-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:\r
-\r
-               - Removed PRIMARY_KEY and UNIQUE_KEY columns\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbPrimaryKeysSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbUniqueKeysSchema.cs:\r
-\r
-               - Allow filter by the column name\r
-\r
-\r
-2004-08-03 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs:\r
-\r
-               - Added new IS_ARRAY column.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeySchema.cs:\r
-\r
-               - Fixed error in latest commit.\r
-\r
-2004-08-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeySchema.cs:\r
-\r
-               - Updated sql statement.\r
-\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-       * FirebirdSql.Data.Embbeded/FesStatement.cs:\r
-\r
-               - Some cleanup and refactoring.\r
-\r
-2004-08-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDbSchemaType.cs:\r
-\r
-               - Removed not implemented elements.\r
-\r
-               - Added new MEtaDataCollections element.\r
-       \r
-       * FirebirdSql.Data.Firebird/FbMetaDataCollections.cs:\r
-\r
-               - Added restriction counts values.\r
-\r
-               - Modided the constructos of the schame classes\r
-               to remove the restriction count value.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDbSchema.cs:\r
-\r
-               - Use the new MetaDataCollections schema to check the\r
-               restriction count.\r
-\r
-2004-07-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-\r
-               - Removed the code of the partial batch command\r
-               execution (that was available only using FbDataReader.NextResult)\r
-\r
-\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-\r
-               - Added testing change on statement execution.\r
-               Now on execute we will request the number of rows \r
-               affected in the same message.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/*.cs:\r
-\r
-               - Updated Database schema support.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs:\r
-\r
-               - Added new files.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProviderTypesSchema.cs:\r
-\r
-               - Removed file.\r
-\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Added new CreateDatabase overload\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:\r
-\r
-               - Updated DeriveParameters method to work with the new\r
-               Database schema stuff.\r
-\r
-\r
-2004-07-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Added new GetSchema method\r
-\r
-               - Set GetDbSchemaTable method as Obsolete.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDbSchemaType.cs:\r
-\r
-               - Removed _ from the element names.\r
-\r
-               - Set as obsolete.\r
-\r
-       * Improvements on Database schema support.\r
-\r
-       * FirebirdSql.Data.Firebird/FbService.cs:\r
-\r
-               - Fixed parsing database infor buffer (Thanks to Christian for his feedback).\r
-\r
-\r
-2004-07-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDbSchema.cs:\r
-\r
-               - Fixed bug #1000160\r
-\r
-2004-07-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-       * FirebirdSql.Data.Common/FbCharsetCollection.cs:\r
-       * FirebirdSql.Data.Common/FbIscErrorCollection.cs:\r
-       * FirebirdSql.Data.Common/DbValue.cs:\r
-       * FirebirdSql.Data.Common/BlobBase.cs:\r
-       * FirebirdSql.Data.Common/TypeEncoder.cs:\r
-       * FirebirdSql.Data.Common/StatementBase.cs:\r
-\r
-               - Fixed FxCop rules.\r
-\r
-2004-07-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Removed limitation of one active \r
-               data reader per connection, now it\r
-               will be one active data reader per\r
-               command.\r
-\r
-               NUNit tests will be commited later \r
-               today.\r
-\r
-\r
-2004-07-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbParameter.cs:\r
-\r
-               - Fixed bug #998002\r
-\r
-\r
--------------------------- Alpha 1 ----------------------------\r
-\r
-2004-07-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbParameter.cs:\r
-\r
-               - Fixed bug #995178\r
-\r
-2004-07-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Updated documentation.\r
-\r
-       * Updated assembly version.\r
-\r
-       * Updated installation script.\r
-       With th enew changes the assembly will be registered\r
-       in the HKLM\Software\Microsoft\.NETFramework\AssemblyFolders\r
-       registry element, this will allow the assembly to be shown by the\r
-       Visual Studio Add Reference dialog.\r
-\r
-\r
-2004-07-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       - Private methods naming changes in all classes, using PascalCase,\r
-       to match MS Guidelines.\r
-\r
-2004-07-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Changed CommandTimeout property accesible only using\r
-               explicit interfaces.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:\r
-\r
-               - Fixed IS_NULLABLE column value.\r
-\r
-\r
-2004-07-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:\r
-\r
-               - Fixed mistake in latest commit.\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:\r
-\r
-               - Make use of the new PARAMETER_DIRECTION column.\r
-\r
-               - Remove COLUMN_SIZE reference.\r
-\r
-2004-07-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:\r
-\r
-               - Report correct size for blob columns.\r
-\r
-2004-07-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbFunctionsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbIndexeschema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbGeneratorsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbTablesSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbTriggersSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbUniqueKeysSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsageSchema.cs:\r
-\r
-\r
-               - Columns that indicates wheter an object is a system\r
-               object are now called IS_SYSTEM_XXXX.\r
-\r
-               - Columns that indicates wheter an object is inactive\r
-               are now called IS_INACTIVE. \r
-               \r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeysSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbIndexesSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbPremaryKeysSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:\r
-\r
-               - Set ORDINAL_POSITION as name for all ordinal columns.\r
-\r
-2004-07-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCharset.cs:\r
-\r
-               - Added Serializable attribute.\r
-\r
-2004-07-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProceduresSchema.cs:\r
-\r
-               - Added AcceptChanges call.\r
-\r
-       * FirebirdSql.Data.Firebird/FbDataReader.cs:\r
-\r
-               - Cleanup.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProceduresSchema.cs:\r
-\r
-               - Return intputs and outputs columns null values\r
-               as 0.\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:\r
-\r
-               - Renamed PARAMETER_TYPE column as PARAMETER_DIRECTION\r
-               and set the value as ParameterDirection.Input or\r
-               ParameterDirection.Output.\r
-\r
-2004-07-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Set actual CreateDatabase and DropDatabase as Obsolete\r
-\r
-               - Added new CreateDatabase and DropDatabase methods\r
-               that uses connection strings.\r
-\r
-\r
-2004-07-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/DbField.cs:\r
-\r
-               - Added new IsDecimal method.\r
-\r
-       * FirebirdSql.Data.Common/FbDataReader.cs:\r
-\r
-               - Set numeric precision and scale only for decimal/numeric datatypes.\r
-\r
-\r
-2004-06-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbDbSchemaType.cs:\r
-\r
-               - Added Serializable attribute.\r
-\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Simplify constructor implementation.\r
-\r
-       * FirebirdSql.Data.Firebird/FbParameter.cs:\r
-\r
-               - Added private keyyworkd to class fields.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-\r
-               - Simplified BeginTransaction overloads.\r
-\r
-2004-06-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-\r
-               - Fixed bug on Detach method.   \r
-\r
-       * FirebirdSql.Data.common/IDatabase.cs\r
-       * FirebirdSql.Data.common/ITransaction.cs\r
-       * FirebirdSql.Data.common/StatementBase.cs\r
-       * FirebirdSql.Data.Embedded/FesDatabase.cs:\r
-       * FirebirdSql.Data.Embedded/FesTransaction.cs:\r
-       * FirebirdSql.Data.Embedded/FesStatement.cs:\r
-       * FirebirdSql.Data.Gds/GdsDatabase.cs:\r
-       * FirebirdSql.Data.Gds/GdsTransaction.cs:\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-       * FirebirdSql.Data.Firebird/FbConnection.cs:\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-       * FirebirdSql.Data.Firebird/FbTransaction.cs:\r
-       * FirebirdSql.Data.Firebird/FbDbConnection.cs:  \r
-\r
-               - Implement IDisposable interface in \r
-               Database, Transaction and statement implementations\r
-               of GDs's.\r
-\r
-               Prior sources are tagged as NP_1_7_Alpha1.\r
-\r
-               * This change needs carefully review/testing. *\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:\r
-\r
-               - Fixed NUMERIC_SCALE column value (Thanks to Jack for his feedback).\r
-\r
-2004-06-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Services/FbService.cs:\r
-\r
-               - Modify the delegate and event used for\r
-               handling service output by adding a new\r
-               ServiceOutputEventArgs class (Thanks to Mike Scott for his feedback).\r
-\r
-2004-06-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/Services/*.cs:\r
-       \r
-               - Changes on output processing, now it's going to be done\r
-               using an event instead of the GetNextLine method.\r
-               \r
-               Start methods has been renamed to Execute in every class.\r
-               \r
-               (Thanks to Pierre Y. for his suggestion)\r
-\r
-2004-06-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsArray.cs:\r
-\r
-               - Fix Array implementation. All NUnit tests suite are running fine.\r
-\r
-       * Added setup projects.\r
-\r
-       * FirebirdSql.Data.Firebird.UnitTest/FbDataAdapter.cs:\r
-\r
-               - Added new nunit test for check dataset fill using\r
-               an execute procedure statement.\r
-\r
-2004-06-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbConenctionString.cs:\r
-\r
-               - Added Validate method.\r
-\r
-       * Updated/added documentation of classes:\r
-\r
-               - FbConnection\r
-               - FbEvent\r
-               - FbService\r
-\r
-       * Added BDP NUnit test suite.\r
-\r
-\r
-2004-06-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Bdp/Fbconnection.cs:\r
-\r
-               - Finish connection code for work with new\r
-               GDS implementation structure.\r
-\r
-\r
-2004-06-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Gds/GdsStatement.cs:\r
-\r
-               - Fixed bug in Fetch method when working\r
-               with statements using EXECUTE PROCEDURE syntax.\r
-\r
-\r
-2004-06-08 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * Finished first stage of the events reimplementation.\r
-\r
-\r
-2004-06-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Firebird/FbCommand.cs:\r
-\r
-               - Simplify handling of input parameters with null values (Thanks to Jojakim Stahl).\r
-\r
-       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeysSchema.cs:\r
-\r
-               - Fix order by clausule.\r
-\r
-       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:\r
-\r
-               - Run cleanup over pooled connections\r
-               only when there are a number of pooled connections\r
-               greater than the min pool size (needs testing).\r
-\r
-2004-06-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-       * FirebirdSql.Data.Common/FbCommandBuilder.cs:\r
-       \r
-               - Improved DeriveParameters implementation.\r
-\r
-       * FirebirdSql.Data.Common/Descriptor.cs:\r
-\r
-               - Changed ToBlr method for use a MemoryStream.\r
-\r
-       * FirebirdSql.Data.Common/IscError.cs:\r
-       * FirebirdSql.Data.Common/IscCodes.cs:\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-\r
-               - Clean up on fatal errors exceptions.\r
-\r
-       * FirebirdSql.Data.Common/IscException.cs:\r
-\r
-               - Rewrite the way the exeption emessage is built.\r
-               \r
-       * FirebirdSql.Data.Common/IscExceptionHelper.cs:\r
-\r
-               - Removed.\r
-\r
-       * FirebirdSql.Data.Common:\r
-\r
-               - RowDescriptor.cs renamed as Descriptor.cs\r
-\r
-\r
-2004-05-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>\r
-\r
-    * FirebirdSql.Data.Common:\r
-\r
-    Removed classes:\r
-\r
-        - AttachmentParams\r
-        - Factorybase\r
-        - IAttachment\r
-\r
-    Renamed classes:\r
-\r
-        - IDbAttachment    -> IDatabase\r
-        - ISvcAttachment   -> IServiceManager\r
-\r
-    * FirebirdSql.Data.Embedded:\r
-\r
-    Removed classes:\r
-\r
-        - FesFactory\r
-        - FesAttachment\r
-\r
-    Renamed classes\r
-\r
-        - FesDbAttachment     -> FesDatabase\r
-        - FesSvcAttachment    -> FesServiceManager\r
-        * FirebirdSql.Data.Gds: \r
-    Removed classes:\r
-\r
-        - GdsFactory\r
-\r
-    Renamed classes\r
-\r
-        - GdsAttachment       -> GdsConnection\r
-        - GdsDbAttachment     -> GdsDatabase\r
-        - GdsSvcAttachment    -> GdsServiceManager\r
-\r
-    * FirebirdSql.Data.Firebird:\r
-\r
-    New classes:\r
-\r
-        - FbConnectionString\r
-\r
-    * FirebirdSql.Data.Firebird.Service:\r
-\r
-    Removed classes:\r
-\r
-        - FbServiceParameters.\r
-\r
+Firebird ADO.NET Data provider for .NET and Mono 
+================================================
+
+
+------------------ 1.7.1 Release Candidate 1 ----------------------
+
+
+2005-08-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird\FbCommand.cs:
+       * FirebirdSql.Data.Gds\GdsStatement.cs:
+       * FirebirdSql.Data.Embedded\FesStatement.cs:
+
+               - Added support to INSERT INTO .... RETURNING statement of Firebird 2.0
+
+2005-08-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird\FbCommand.cs:
+
+               - Backported the new named parameters method from the v2.0
+
+2005-08-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird\DbSchema\FbColumns.cs:
+       * FirebirdSql.Data.Firebird\DbSchema\FbDomains.cs:
+       * FirebirdSql.Data.Firebird\DbSchema\FbProcedureParameters.cs:
+       * FirebirdSql.Data.Firebird\DbSchema\FbViewColumnUsage.cs:
+
+               - Renamed column CHARACTER_LENGTH to "CHARACTER_LENGTH" to allow the query to run in Firebird 2.0               
+
+2005-08-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.FirebirdClient.FbCommand.cs:
+
+               - Initial fix for bug #1242812
+
+2005-07-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Changes on implicit transaction handling, they will be discarded by doing 
+               Commit when the command is a SELECT statement.
+
+2005-07-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Changed the way to describe input parameters, not finished needs tetsing.
+
+2005-07-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Changed the way to describe input parameters, not finished and needs tetsing.
+
+2005-07-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbRemoteEvent.cs:
+
+               - Check connection state on constructor ( Thanks to Michele Lepri )
+
+2005-06-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbIndexes.cs:
+
+               - Added ProcessResult implementation (Thanks to Rolo Tomasi)
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbUniqueKeys.cs:
+
+               - Fixed parameter value in constructor (Thanks to Rolo Tomasi)
+
+2005-06-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:
+
+               - Fixed default value retrieval. (Thanks to RoloTomasi.)
+
+2005-06-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs:
+
+               - Allow configuration of quoted identifiers usage. (Thanks to Ernesto Cullen for his help.)
+
+       * FirebirdSql.WizardFramework/WizardForm.cs:
+
+               - Allow to cancel wizard execution using ESC key.
+
+       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:
+
+               - Updated documentation comments.
+
+               - Added execution of SET GENERATOR commands.
+
+2005-06-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs:
+
+               - Add parameter information for DML statements.
+
+2005-06-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+
+               - Fixed bug on numeric and decimal reads and writes.
+
+       * FirebirdSql.Data.Gds/GdsArray.cs:
+       * FirebirdSql.Data.Embedded/FesArray.cs:
+
+               - Fixed bug on numeric and decimal array encoding.
+
+2005-06-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+
+               - Fixed problem with mono on linux when reading port number for firebird events
+               connection (Gabriel Reid)
+
+
+------------------ 1.7 Final Release ----------------------
+
+2005-05-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs
+
+               - Bug fixes for the DataSet generation and Visual Studio integration.
+
+       * Update assembly version.
+
+       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:
+
+               - Change to ensure the command has a valid connection before perform an update.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs
+
+               - Force command initialization on .NET 1.0 and .NET 1.1
+
+2005-05-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsConnection.cs:
+
+               - Correctly disable Nagle Algorithm.
+
+2005-05-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Services/FbBackupFile.cs:
+
+               - Changed to be class instead of an struct, to allow it be used in C++
+
+2005-05-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDatabaseInfo.cs:
+       * FirebirdSql.Data.Common/IscHelper.cs:
+
+               - Implemented new property ActiveUSers (Tracker item #1198051)
+
+2005-05-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:
+
+               - Fixed constructor bug. (Thanks to Julien Ferraro)
+
+2005-05-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - HasRows property will return true only for Select commands.
+
+2005-04-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Close DataReader when preparing a new command.
+
+2005-04-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Common/TypeHelper.cs:
+       * FirebirdSql.Data.Firebird/Common/DbField.cs:
+       * FirebirdSql.Data.Firebird/Gds/XdrStream.cs:
+
+               - Fixed Decimal and Numeric field handling.
+
+2005-04-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbException.cs:
+       * FirebirdSql.Data.Common/BinaryEncoding.cs:
+       
+               - Fixed .NET Compact Framework Beta 2 build problems.
+
+2005-04-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:
+
+               - Better handling of comments and strings.
+
+       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:
+
+               - Fix bug on transaction handling.
+
+2005-04-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/Charset.cs:
+
+               - Try to make the SupportedCharsets property thread safe.
+
+2005-04-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+
+       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:
+
+               - Added a new constructor.
+
+       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:
+
+               - Try to avoid problem with / inside comments (needs tetsting)
+
+
+------------------ Release Candidate 3 ----------------------
+
+
+2005-04-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Make usage of the isc_dpb_overwrite parameter in CreateDatabase method.
+
+2005-04-9 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+
+               - Try to fix performance problems when reading array fields using the embedded server.
+
+2005-04-7 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/DbValue.cs:
+
+               - Fixed bug in GetString method when reading 
+               Clob values several times (Thanks to Mike Scott for his feedback).
+
+2005-04-6 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fixed output parameter handling.
+
+2005-04-3 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Try to avoid breaking change on sp calls using ExecuteScalar method.
+
+2005-03-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:
+
+               - Close the isql file after have readed the contents (Thanks to for Muthu Annamalai his feedback).
+
+2005-03-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs:
+
+               - Changed the way the DataSet is added to the designer (and serialized into source code)
+
+2005-03-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Allow access to the RecordsAffected property when the reader is not closed (Thanks to Andrea Sansottera for his feedback)
+
+       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:
+
+               - Changes to improve the RowUpdated event handling, they
+               needs testing (Thanks to Andrea Sansottera for his feedback)
+
+2005-03-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:
+
+               - Improved error reporting on Updates (Thanks to Andrea Sansottera for his feedback)
+
+2005-03-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fixed problem with implicit transaction Commit's and Rollback's
+               when the objects are collected by the GC.
+
+2005-03-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Changed all references to CurrentUICulture to CurrentCulture.
+
+2005-03-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:
+
+               - Added CREATE DESCENDING INDEX command handling. (Thanks to Daniel Letecky)
+
+       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:
+
+               - Try to improve handling of -- comments (changes doesn't cover all cases of quoted ' usage)
+
+       * FirebirdSql.Data.Gds/GdsStatement.cs
+
+               - Changed encoding of relation, field, alias and owner names, to use
+               the connection character set.
+
+2005-03-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:
+
+               - Fixed comment removal (Thanks to Daniel Letecky)
+
+2005-02-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+
+               - Fixed problem with space handling. Added NUnit test case.
+
+------------------ Release Candidate 2 ----------------------
+
+2005-02-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/IscException.cs
+
+               - Changes for better exception handling on message formatting.
+
+2005-02-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Added missing synonym (Thanks to Mike Scott by his feedback)
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedures.cs:
+
+               - Added column for the procedure source.
+
+2005-02-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+       * FirebirdSql.Data.Gds/FesStatement.cs:
+
+               - Fixed problem with transaction value set (Thanks to Oleg Paschenko)
+
+2005-02-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/VSExtensibility.cs:
+
+               - Added Visual Studio 2002 support.
+
+2005-02-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsConnection.cs:
+
+               - Do not include calls to Socket.SetSocketOption when working
+               with the .NET Compact Framework that should allow the provider
+               to do connections when working with the .NET Compact Framework
+               (Thanks to Fonzetto Michaël for his feedback)
+
+2005-02-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsConnection.cs:
+
+               - Changed ProtocolType used to configure the Socket to ProtocolType.Tcp
+
+       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:
+
+               - Undo latest changes on RemoveComments method as they breaks the execution of some tstatements.
+
+       * FirebirdSql.Data.Firebird/Isql/FbBatchExecition.cs:
+
+               - Fixed bug on autocommit mode.
+
+2005-02-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/IscException.cs:
+
+               - Fix for exception message building.
+
+
+------------------ Release Candidate 1 ----------------------
+
+2005-02-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fixed SP execution on ExecuteScalar method (Thanks to Alessandro Petrelli for his feddback)
+
+       * FirebirdSql.Data.Firebird/FbParameter.cs:
+       * FirebirdSql.Data.Common./DbField.cs:
+
+               - Fixed null Guid handling.
+
+2005-01-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Embedded/FesArray.cs:
+
+               - Fixed problem with 0 lowerbound arrays.
+
+2005-01-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fixed sqal generation for strored procedure names (Thanks to Andrzej Kaczmarczyk for his feedback).
+
+2005-01-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/DbField.cs:
+
+               - Fixed incorrect mapping (Thanks to Frans Bouma for his feedback.)
+
+2005-01-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+       
+       - Reformatted the source code.
+
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+
+               - Fixed problem with system field values, now checks are done using the
+               field character set (Thanks to Phaidros for his feedback).
+
+       * FirebirdSql.Data.Common/ITransaction.cs:
+       * FirebirdSql.Data.Embedded/FesTransaction.cs:  
+       * FirebirdSql.Data.Gds/GdsTransaction.cs:       
+       
+               - Commented Prepare method overloads.
+
+       * FirebirdSql.Data.Embedded/FesTransaction.cs:  
+
+               - Commented PInvoke funcition definitions that aren't used.
+
+2005-01-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+
+               - Fixed problem on Event manager close.
+
+2005-01-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep1.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep5.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs
+
+               - Minor changes on label's text.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs
+
+               - Changes to show information abot the errors got on data adapter configuration.
+
+       * Updated license headers.
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+
+               - Fix ClearArrayHandles method by checking for array fields.
+
+2005-01-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+
+               - Try to fix performance problems with array fields on select statements.
+
+2005-01-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Isql/FbScript.cs:
+
+               - Changes for better handling of comment removal (Andreas Sandner)
+
+2005-01-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Embedded/FesArray.cs:
+       * FirebirdSql.Data.Embedded/FesBlob.cs:
+       * FirebirdSql.Data.Embedded/FesConnection.cs:
+       * FirebirdSql.Data.Embedded/FesDatabase.cs:
+       * FirebirdSql.Data.Embedded/FesServiceManager.cs:
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+       * FirebirdSql.Data.Embedded/FesTransaction.cs:
+       * FirebirdSql.Data.Gds/GdsArray.cs:
+       * FirebirdSql.Data.Gds/GdsBlob.cs:
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+       * FirebirdSql.Data.Gds/GdsEventManager.cs:
+       * FirebirdSql.Data.Gds/GdsServiceManager.cs:
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+       * FirebirdSql.Data.Gds/GdsTransaction.cs:
+
+               - Cleanup.
+
+2005-01-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.WizardFramework/WizardStep.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep1.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep5.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep7.cs
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs
+
+               - Changes for try to get the Wizard working on VS 2003.
+
+       * FirebirdSql.Data.Common/BinaryEncoding.cs
+
+               - Integrate the Encoding implementation for the OCTETS character set
+               Contributed by Jim Beveridge. (It's under the Public Domain)
+
+       * FirebirdSql.Data.Common/Charset.cs:
+
+               - Integrate the BinaryEncoding implementation.
+
+       * FirebirdSql.Data.Embedded/XsqldaMarshaler.cs:
+
+               - Added support for Guid parameters.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs
+
+               - Show a MessageBox with the exception deatils.
+
+-------------------------- Beta 3 ----------------------------
+
+2005-01-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               -Fixed problem with the Guid parameters support.
+
+       * FirebirdSql.Data.Firebird/Isql/FbbatchExecution.cs:
+
+               - Added initial autocommit mode support (needs testing).
+
+2004-12-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/Charset.cs:
+       * FirebirdSql.Data.Common/DbDataType.cs:
+       * FirebirdSql.Data.Common/DbField.cs:
+       * FirebirdSql.Data.Common/DbValue.cs:
+       * FirebirdSql.Data.Common/TypeHelper.cs:
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+       * FirebirdSql.Data.Firebird/FbCharset.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+       * FirebirdSql.Data.Firebird/FbDbType.cs:
+       * FirebirdSql.Data.Firebird/FbParameter.cs:
+
+               - Added initial suport for the GUID datatype.
+               Guids will be mapped to CHAR(16) CHARACTER SET OCTETS fields in firebird.
+               In the FbParameter class Guid values should be passed as Guid instances or 
+               byte arrays.
+               The changes are not finished yet.
+               A new Test suite for the Guid support is included.
+
+               Thanks to Jim Beveridge for his help and feedback.
+
+2004-12-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/DbValue.cs:
+
+               - Fixed bug on long values conversion to string (Thanks to Sven Kammradt for his feedback).
+               Test case added to the test suite.
+
+2004-12-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommandbBuilder.cs:
+
+               - Removed check of the DataColumn.Autoincrement property in the IsUpdateable method.
+
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Fixed globalization issues.
+
+2004-12-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/FbDataAdapter/Designer/FbDataAdapterWizardSettings.cs
+       * FirebirdSql.Data.Firebird/Design/FbDataAdapter/Designer/FbDataAdapterWizard.cs
+       * FirebirdSql.Data.Firebird/Design/FbDataAdapter/Designer/FbDataAdapterDesigner.cs
+
+               - Changes for see if we can get the wizard to work with VS 2003
+
+2004-12-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Fixed validation of connection strings without a data source when the
+               ServerType parameter is 1 (Thanks to Peter Turcan for his feedback).
+
+       * FirebirdSql.Data.Common/Charset.cs:
+       * FirebirdSql.Data.Common/CharsetCollection.cs:
+
+               - Load encodings at runtime in order to improve memory usage. (Thnaks to Jim Beveridge for his feedback)
+
+2004-12-08 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs
+
+               - Fixed FillConnections method.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs
+
+               - Prevent to generate Typed DataSets if the provider was
+               not build with the VISUAL_STUDIO define
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs:
+
+               - Fixed DTE creation when there are more than one Visual Studio instance.
+               Reference:
+                       http://devresource.hp.com/technical_white_papers/CodeModel1.pdf
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+
+               - Better checks on Release method (Thanks to Pierre Arnaud)
+
+-------------------------- Beta 2 ----------------------------
+
+2004-12-03 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardSettings.cs:
+
+               - Fixed conversion doing a cast.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardStep2.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardStep4.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardStep6.cs:
+
+               - Changes for allow a better initialization of the step data when 
+               the DataAdapter was already configured before.
+
+       * Fixed FxCop issues.
+
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+
+               - Fix Stream and IDisposable implementation.
+
+2004-12-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Changes on the Firebird Events implementation.
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+       * FirebirdSql.Data.Common/DbValue.cs:
+               
+               - Try to get the FbDataReader.GetBoolean method working.
+
+2004-12-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+
+               - Added a new Commit(string) method (Thanks to for Andrzej Kaczmarczyk his feedback)
+
+2004-11-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Reorganization of the Services sources.
+
+2004-11-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/IscException.cs:
+
+               - Fix for the latest changes of the exception message formatting
+
+2004-11-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/IscException.cs:
+
+               - If the resource cannot be found raise the 
+               exception with the default message.
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Changes on Transaction and resources management.
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Fixed problem with the CreateDatabase problem, when it's requested to not
+               overwrite the an existing database database, and there are no real database 
+               to connect to.
+
+2004-11-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSQl.Data.Gds/GdsTransaction.cs:
+       * FirebirdSQl.Data.Embedded/FesTransaction.cs:
+
+               - Fixed bug in the Dispose method (Thanks to Pierre Arnaud for his feedback)
+                 Test case added for this bug.
+
+2004-11-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:
+
+               - Set the dataset namespace.
+
+2004-11-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs:
+
+               - Changes for better support of Visual Studio project files,
+               when adding Typed Datasets (not finished.)
+
+2004-11-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbErrorCollection.cs:
+       * FirebirdSql.Data.Firebird/FbParameterCollection.cs:
+               
+                       - Better fit to ADO.NET
+       
+       * FirebirdSql.Data.Common/IscErrorCollection.cs:
+       * FirebirdSql.WizardFramework/WizardStepCollection.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+       * FirebirdSql.Data.Firebird/FbRemoteEventEventArgs.cs:
+       * FirebirdSql.Data.Firebird/Isql/FbbatchExecution.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs:
+       
+                       - Fixed FxCop issues.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSExtensibility.cs:
+       
+                       - Minor reorganization.
+                       
+2004-11-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+
+               - Changes to try to handle correctly the character sets (Thanks to Kazuhiro Kato for his feedback)
+
+       * FirebirdSql.Data.Common/Charset.cs:
+       * FirebirdSql.Data.Common/BlobBase.cs:
+       * FirebirdSql.Data.Common/DbField.cs:
+       * FirebirdSql.Data.Common/RemoteEvent.cs:
+       * FirebirdSql.Data.Common/StatementBase.cs:
+       * FirebirdSql.Data.Embedded/FesArray.cs:
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+       * FirebirdSql.Data.Embedded/XsldaMarshaler.cs:
+       * FirebirdSql.Data.Gds/GdsArray.cs:
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+
+               - Make the charset class to be a full wrapper for the .NET encoding class.
+
+2004-11-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.WizardFramework/WizardStep.cs:
+       * FirebirdSql.Data.WizardFramework/WizardForm.cs:
+
+               - Added changes to allow condition navigation to previous steps.
+
+               - Simplify finish navigation.
+
+       * FirebirdSql.Data.WizardFramework/WizardForm.cs:
+
+               - Moved Validation handler configuration to the ShowStep method.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/FbDataAdadapterWizardStep7.cs:
+
+               - New wizard step to show the results.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/FbDataAdadapterWizardForm.cs:
+
+               - Removed DataAdapter configuration code.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/DataSetGenerator.cs:
+
+               - Let Visual Studio to generate the source code for the Typed DataSet.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/VSExtensibility.cs:
+
+               - Changes to add a file as an embedded resource.
+
+2004-11-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:
+
+               - Fixed bug in DropDatabase implementation. (Thanks to Daniel Letecky for his feedback.)
+
+       * FirebirdSql.Data.Common/CharsetCollection.cs:
+       * FirebirdSql.Data.Common/IscErrorCollection.cs:
+
+               - Changes to inherit from CollectionBase
+
+2004-11-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs:
+
+               - Override OnSetComponentDefaults and launch the wizard for initialization.
+
+               - Do not use localization support in the wizard for now.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:
+
+               - Use FillSchema to generate the tables in the DataSet.
+
+               - Make one of the DataSet generation methods to be more
+               general (it takes a connection string instead of a DataAdapter
+               as parameter).
+
+2004-11-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+
+               - Try to fix a problem with the transactions and data readers handling.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/VSextensibility.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:
+
+               - Added class for handle Visual Studio Extensibility support
+               (No terminado)
+
+2004-11-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/DataSetGenerator.cs:
+
+               - New DataSet generation class for the Design Time support.
+
+2004-11-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbRemoteEventEventArgs.cs:
+
+               - New file.
+
+       * FirebirdSql.Data.Firebird/FbEvent.cs:
+
+               - Try to improve the remothe event handling, the
+               new event should provide cancelation capabilities.              
+
+2004-11-09 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs:
+
+               - Save settings and control wheter the textbox is empty
+
+       * FirebirdSql.WizardFramework/WizardForm.cs:
+
+               - Save settings before raise the BeforeFinish event.
+
+       * FirebirdSql.WizardFramework/WizardStep.cs:
+
+               - Changed the SaveSettings method to public.
+
+2004-11-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardSettings.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardForm.cs:
+
+                -Added initial DataAdapter configuration code in the BeforeFinsh event.
+
+       * Fixed FxCop rules.
+
+2004-11-06 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:
+       * FirebirdSql.Data.Firebird/FbEvent.cs:
+       * FirebirdSql.Data.Common/IDatabase.cs:
+       * FirebirdSql.Data.Embedded/FesDatabase.cs:
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+       * FirebirdSql.Data.Gds/GdsEventManager.cs:
+
+               - Improved Firebird Events Implementation.
+
+       * Fixed FxCop rules.
+
+       * Added FxCop project file to the builds directory.
+
+2004-11-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs:
+
+               - Fixed problem with the Setting update.
+
+       * FirebirdSql.Data.Firebird/Embedded/FesStatement.cs:
+       * FirebirdSql.Data.Firebird/Embedded/XSQLDA.cs:
+       * FirebirdSql.Data.Firebird/Embedded/XsqlMarshaler.cs:
+
+               - Better handling of the XSQLVAR strings, now
+               instead of being marshaled directly as strings
+               they are being marshaed as byte arrays, what
+               would make possible to handle strings with a
+               multibyte encoding.
+               The encoding/decoding of the strings are being 
+               done using the connection character set.
+
+
+-------------------------- Beta 1 ----------------------------
+
+
+2004-11-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Updated Wizard Framework sources.
+
+2004-11-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs:
+
+               - Update schema information (Thanks to Viatcheslav V. Vassiliev for his feedback)
+
+       * Updated documentation of the WizardFramework classes.
+
+       * Removed WizardState class (the validation will be done
+       using the DialogResult as the wizard will be called always
+       using the ShowDialog method).
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Fixed bug on initialization of the user id
+
+       * FirebirdSql.WizardFramework/WizardStep.cs:    
+
+               - Added support for custom navigations (for next button)
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs:
+
+               - Implemented custom navigation.
+
+2004-10-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/Connection/Editor/FbConnectionStringEditor.cs:
+
+               - Minor change for allow the editor to be used with the default constructor.
+
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDataSetGenerator.cs:
+
+               - New class for the DataSet Genetator (without implementation)
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep3.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep4.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep5.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep6.cs:
+
+               - New steps (without implementation)
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs:
+
+               - Implement funcionaly of the new connection button.
+               It will call the FbConnectionStringEditor.
+
+               - Changed settings handling.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterWizardSettings.cs:
+
+               - New inner class for handle wizard settings.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:
+
+               - Change step loading and settings handling.
+
+2004-10-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+
+               - Format the statement plan using the character set
+               of the connection.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs:
+               
+               - Run the wizard automatically when the componenet is created (.NET 2.0 only).
+
+               - Initialize the SelectCommand, InsertCommand, UpdateCommand and DeleteCommand
+               when the component is created (the first time only) (.NET 2.0 only).
+
+2004-10-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.WizardFramework/WizardSettings.cs:
+       * FirebirdSql.WizardFramework/WizardSettingsManager.cs:
+
+               - New classes.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:
+
+               - Added some settings handling code.
+
+       * FirebirdSql.WizardFramework/WizardForm.cs:
+       * FirebirdSql.WizardFramework/WizardStep.cs:    
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs;
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:
+
+               - Added better validations.
+
+2004-10-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Modified the build file to include the Wizard Framework.
+
+       * FirebirdSql.WizardFramework/WizardForm.cs:
+
+               - Minor change.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep1.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationStep2.cs:
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterConfigurationWizard.cs:
+
+               - New files for the FbDataAdapter Configuration wizard (not finished)
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs:
+
+               - Changes for load the Wizard. (not finished)
+
+2004-10-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Changes for try to get the Role to be working again (Thanbks to Oleg Deribas for his feedback)
+
+2004-10-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.WizardFramework/ActionStep.cs:
+       * FirebirdSql.WizardFramework/WelcomeStep.cs:   
+
+               - New clases.
+
+       * FirebirdSql.WizardFramework
+
+               - New Directory
+
+       * FirebirdSql.WizardFramework/WizardForm.cs:
+       * FirebirdSql.WizardFramework/WizardStep.cs:    
+       * FirebirdSql.WizardFramework/WizardState.cs:
+
+               - Added an initial implementation of a simple wizard Framework
+               to simplify the creation of the provider Design Time Wizards.
+
+               * It's under heavy development so it's not finished and it's untested *
+
+               * For now it will be not included in the build process *
+
+2004-10-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs:
+
+               - Minor fix (Thanks to Viatcheslav V. Vassiliev for his
+               feedback)
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fixed Input parameter describe when the Prepare method
+               is called before the FbCommand instance has parameters assigned.
+               ( test case included ) Thanks to Viatcheslav V. Vassiliev for his
+               feedback
+
+       * FirebirdSql.Data.Firebird/Design/Command/Designer/FbCommandDesigner.cs:
+               
+               - Override PreFilterAttributes and add teh DesignTimeVisibleAttribute using
+               the FbCommand.DesignTimeVisible property value.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdpater/Designer/FbDataAdapterDesigner.cs:
+
+               - Minor changes (contains test code).
+
+2004-10-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/RemoteEvent.cs:
+       * FirebirdSql.Data.Common/EventParameterBuffer.cs:
+
+               - Fixed TPB generation (Olaf Lüder)
+
+2004-10-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fixed command text initialization.
+
+2004-10-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Design/Connection/Designer/FbCommandDesigner.cs
+
+               - New class.
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs
+
+               - Added Designer Attribute.
+
+       * FirebirdSql.Data.Firebird/Design/DataAdapter/Designer/FbDataAdapterDesigner.cs
+
+               - New class.
+
+       * FirebirdSql.Data.Firebird/FbDataAdapter.cs
+
+               - Added Designer Attribute.
+
+2004-10-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Reorganization of the Design Time support classes.
+
+2004-10-09 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/StringCollection.cs:
+
+               - Added CopyTo method.
+
+2004-10-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbSecurity.cs
+
+               - Added better checks for user data.
+
+2004-10-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommandbuilder.cs:
+
+               - Fixed quoted identifier generation when
+               the quote prefix or the quote suffix are null.
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Fixed exception handling on Open method.
+
+       * FirebirdSql.Data.Common/ArrayBase.cs:
+       * FirebirdSql.Data.Embedded/FesArray.cs:
+       * FirebirdSql.Data.Gds/GdsArray.cs:
+
+               - Changes for try to allow work with arrays
+               defined with lowerbound 0.
+
+2004-10-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbEvent.cs:
+       * FirebirdSql.Data.Common/RemoteEvent.cs:
+
+               - Modified handling of actual event counts.
+
+2004-09-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+       * FirebirdSql.Data.Embedded/FesDatabase.cs:
+       * FirebirdSql.Data.Common/EventParameterBuffer.cs:
+
+               - Fixed EventParameter buffer handling.
+
+
+2004-09-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Cleanup.
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+
+               - Removed IsolationLevel.Snapshot that is supported only 
+               in .NET 2.0
+
+2004-09-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       - Updated IDPL license URL to point to the FirebirdSQL project web site.
+
+       - Fixed FbDataAdapter documentation example (Thanks to Roland Turcan)
+
+2004-09-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+
+               - Added new "Isolation Level" parameter for the connection string,
+               that allows to set the default IsolationLevel for implicit transactions.
+
+       * FirebirdSql.Data.Embedded/XSQLDA.cs:
+       * FirebirdSql.Data.Embedded/XsqldaMarshaler.cs:
+
+               - Changes on pointer address calculation.
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Improve handling of parameters when they have null values.
+               Affects mainly the embedded server support (Thanks to Pierre 
+               Arnaud for his feedback)        
+
+2004-09-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbField.cs:
+
+               - Fix for SetValue method on character values trimming when 
+               working with system tables. Affects only the embedded server 
+               support (Thanks to Sander Bosman for his feedback)
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Added new synonym for the 'Server Type' parameter.
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fixed implicit transaction handling.
+
+       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:
+
+               - Set IsNullable property for parameters of generated 
+               commands.
+
+       * FirebirdSql.Data.Embedded/XsqdaMarshaler.cs:
+
+               - Minor changes on sqlind handling.
+
+2004-09-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Added support for the .NET Compact Framework 2.0 Beta 1
+
+2004-09-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+       * FirebirdSql.Data.Gds/GdsArray.cs:     
+       * FirebirdSql.Data.Gds/FesArray.cs:
+
+               - Changes on DateTime conversions by using CurrentUICulture
+               instead of the InvariantCulture.
+
+       * FirebirdSql.Data.Gds/XdrStream.cs:
+
+               - Minor formatting changes.
+
+2004-09-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbParameter.cs:
+       * FirebirdSql.Data.Firebird/FbParameterCollection.cs:
+
+               - Format changes
+
+       * FirebirdSql.Data.Firebird/FbException.cs:
+
+               - Minor reorganization.
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Added new code for handle the Max Connection Pool behavior (needs testing)
+
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Globalization changes.
+
+       * FirebirdSql.Data.Common/ArrayBase.cs:
+       * FirebirdSql.Data.Common/IscException.cs:
+       
+               - Globalization changes.
+
+       * FirebirdSql.Data.Common/IscCodes.cs:
+
+               - Minor reorganization.
+
+               - Added new constants for standard buffer sizes.
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+
+               - Use constants instead of hard-coded values for buffer sizes
+
+       * FirebirdSql.Data.Gds/GdsConnection.cs:
+
+               - Added GC.SupressFinalize calls.
+
+
+-------------------------- Alpha 3 ----------------------------
+
+
+2004-09-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Added changes to the connection cleanup.
+
+               - Fixed connection checkout from the pol.
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Fixed packet size synonym
+
+2004-09-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Added new nunit test case for the database sweep (Validation service)
+
+       * FirebirdSql.Data.Gds/GdsServiceManager.cs:
+               
+               - Minor fix.
+
+2004-09-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:
+
+               - Added new GetSchema methods to FbConnectionInternall class.
+
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+
+               - Fixed buffer size for the Server Version
+               50 bytes seems to be not enough when working 
+               against Firbeird 1.0.3 (it's weird because it returns 
+               a string of length less than 50)
+
+
+2004-09-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDbConnection.cs:
+
+               - Renamed to FbConnectionInternal.
+
+       * FirebirdSql.Data.Firebird/FbConnectionInternal.cs:
+
+               - New file (ADO.NET 2.0 has an DbConnectionInternal that should be implemented
+               in ado.net provider implementations this class should be used in the future
+               as base for that class implementation)
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:
+       * FirebirdSql.Data.Firebird/FbDatabaseInfo.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDbSchema.cs:
+       * FirebirdSql.Data.Firebird/FbEvent.cs:
+       * FirebirdSql.Data.Firebird/FbException.cs:
+
+               - Formatting changes.
+
+               - Moved some of the FbConnection and FbTransaction classes
+               funcionality to FbConnectionInternal.
+
+               With the new changes the connection handling matches better the
+               .net 2.0 compliant version i have in my local tree and will allow
+               an easy transaction in the future to ADO.NET 2.0.
+
+2004-09-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Added changes on connection pool handling.
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cS:
+
+               - Minor improvements on pool handling.
+
+               - Fixed bug on GetConnection method when
+               timestamps are equal including the milliseconds
+               (Thanks to Alessandro Petrelli for his help ontesting the problem)
+
+2004-09-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Added better lock handling in the FbPoolManager class.
+               
+2004-09-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Return back to use regular expressions for
+               connection string parsing as they ar emore precise
+               for this purpouse (Thanks to Sven Kammradt for his feedback)
+
+2004-09-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - CheckState shouldn't check for eof.
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Added changes for the initial implementation
+               iof a Wendell Wilkie suggestion for improve 
+               connection checkouts adn pools load.
+
+2004-09-09 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Added new ConnectionPoolsCount and 
+               GetPooledConnectionCount members to the
+               FbConnection class.
+
+               - Minor change in FbConnectionPool class.
+
+
+2004-09-08 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Updated documentation.
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Minor fix for better detection of the datareader position.
+
+
+2004-09-03 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Fixed pool cleaning when the for pools with
+               connection lifetime of 0.
+
+       * Formatting changes.
+
+       * Added new parameter buffer classes and reworked existent 
+       parameter buffer classes.
+
+       New classes:
+
+               - TransactionParameterBuffer.cs
+
+               - BlobParameterBuffer.cs
+
+       * Renamed parameter buffer classes:
+
+               - BufferBase -> ParameterBuffer
+               - DpbBuffer -> DatabaseParameterBuffer
+               - SpbBuffer -> ServiceParameterBuffer
+               - EpbBuffer -> EventParameterBuffer
+
+       * FirebirdSql.Data.Common/IDatabase.cs:
+       * FirebirdSql.Data.Common/IServiceManager.cs:
+       * FirebirdSql.Data.Common/RemoteEvent.cs:
+       * FirebirdSql.Data.Embedded/FesDatabase.cs:
+       * FirebirdSql.Data.Embedded/FesServerManager.cs:
+       * FirebirdSql.Data.Embedded/FesTransaction.cs:
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+       * FirebirdSql.Data.Gds/GdsBlob.cs:
+       * FirebirdSql.Data.Gds/GdsTransaction.cs:
+       * FirebirdSql.Data.Gds/GdsServerManager.cs:
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbDbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+       * FirebirdSql.Data.Firebird/Services/FbService.cs:
+       * FirebirdSql.Data.Firebird/Services/FbBackup.cs:
+       * FirebirdSql.Data.Firebird/Services/FbRestore.cs:
+       * FirebirdSql.Data.Firebird/Services/FbConfiguration.cs:
+       * FirebirdSql.Data.Firebird/Services/FbLog.cs:
+       * FirebirdSql.Data.Firebird/Services/FbSecurity.cs:
+       * FirebirdSql.Data.Firebird/Services/FbStatistical.cs:
+       * FirebirdSql.Data.Firebird/Services/FbServerProperties.cs:
+       * FirebirdSql.Data.Firebird/Services/FbValidation.cs:
+               
+               - Improved parameter buffer handling
+
+2004-09-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/IscCodes.cs:
+
+               - Added Firebird facilities codes.
+
+               - Added ISC_MASK code for isc error code generation.
+
+       * FirebirdSql.Data.Common/IscException.cs:
+
+               - Changes on the error collection handling
+
+               - Added new statioc method for generation of isc error codes.
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Added changes for try to get the connection pooling working correctly.
+               (Thanks to Alessandro Petrelli.  for his feedback)
+
+2004-08-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+       
+       * FirebirdSql.Data.Firebird/Embedded/FbClient.dll:
+
+               - Allow the embedded GDS to be built for work against Vulcan.
+
+2004-08-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Added changes to the GetSchemaTable method to 
+               avoid schema command execution when the field
+               doesn't belong to a firebird table.
+               (Thanks to Gregory P. for his feedback)
+
+2004-08-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Fixed bug #1017108
+
+2004-08-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/IscException.cs:
+
+               - Improved building of the exception message.
+
+       * FirebirdSql.Data.Embedded/FesServiceManager.cs:
+
+               - Monor fix.
+
+       * FirebirdSql.Data.Firebird/Services/FbService.cs:
+
+               - Do not throw an exception if the service is closed and
+               a new call to close is done.
+
+       * FirebirdSql.Data.Common/IDatabase.cs:
+       * FirebirdSql.Data.Common/FesDatabase.cs:
+       * FirebirdSql.Data.Common/GdsDatabase.cs:
+       * FirebirdSql.Data.Firebird/FbDbConnection.cs:
+
+               - Changes on GetDatabaseInfo overloads.
+
+               - Make the GetServerVersion method to request only 50 bytes.
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+               
+               - Try to get the statement plan only 4 times,
+               if the plan cannot be retrieved returns null (Thanks to Claudio Valderrama)
+
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Minor changes and improvements over the latest commit.
+
+2004-08-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsage.cs:
+
+               - Set the CHARACTER_OCTET_LENGTH to 0 if the comlumns is not a char/varchar column.
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+
+               - Fixed bug #1015453.
+
+       * FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       
+               - Changed FbConnectionString class to be internal.
+
+               - NEw class to build connection strings.
+
+       * FirebirdSql.Data.Firebird/Design/*.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Include the classes only if we are doing the build using MS.NET
+       
+       * FirebirdSql.Data.Common/DbField.cs:
+
+               - Trim trainling spaces for char fields when using the
+               embedded server and character sets with 2/3 characters per byte.
+
+
+2004-08-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Embedded/FbClient.cs:
+
+               - Cleanup.
+
+               - Change isc_dsql_prepare to get a byte array as parameter instead of a string.
+
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+
+               - Send a byte array in the isc_dsql_prepare call instead of a string.
+
+
+-------------------------- Alpha 2 ----------------------------
+
+
+2004-08-22 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsage.cs:
+
+               - Added new CHARACTER_OCTET_LENGTH column
+
+               - Fixed size for char/varchar columns
+
+2004-08-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * The nunit test suite will run now using UNICODE_FSS 
+       by default.
+
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsage.cs:
+
+               - Fixed NUMERIC_PRECISION value.
+       
+       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:
+
+               - Do not set the numeric precision and scale if the parameter
+               is not a decimal or numeric type.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:
+
+               - Added Restrictions definition.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbRestrictions.cs:
+
+               - Added name to the DataTable.
+
+2004-08-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Fixed bug #1013031
+
+2004-08-19 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:
+
+               - Added domain information.
+
+2004-08-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Updated nant build system.
+
+               - Put in different directories the nant build files
+               of the ADO.NET Provider and the Borland Data Provider.
+
+       * The build will done always in a single assembly.
+
+       * Fixed Globalization problems reported by FxCop.
+
+2004-08-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+
+               - [TESTING CHANGE] Do not request the owner when
+               describing statements as we are not using it for 
+               never at this moment.
+
+       * FirebirdSql.Data.Gds/GdsConnection.cs:
+
+               - Added a call to GC.SuprresFinalize in the constructor.
+
+
+2004-08-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:
+
+               - Throw a InvalidOperationException instead of a
+               DataAdapterException that it's .NET 2.0 specific.
+
+               - Minor change on update count, seems that it needs to return
+               the number of *DataRows* updated.
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Cleanup.
+
+2004-08-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Minor change on Null value check.
+
+               - Removed Attributes form the CommandTimeout,
+               they prevents the sources to be built using .net 1.0
+               (Thanks to Mara)
+
+       * FirebirdSql.Data.Firebird/FbDataAdapter.cs:
+
+               - Override the DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
+               method to make calls to FbCommand.ExecuteNonQuery method always on
+               inserts, updates and deletes.
+
+               It's  on *testing* for now and it's not clear if it will be finally used.
+
+2004-08-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Set conenction string default value to an empty string.
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Changes on constructor implementation.
+
+
+2004-08-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/TypeHelper.cs:
+
+               - Fixed Float to mapping (Thanks to HDV).
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeys.cs:
+
+               - Added IS_DEFERRANLE and INITIALLY_DEFERRED columns
+
+
+2004-08-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Do not use GetMaxByteCount to calc the number of bytes for the input parameters.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs:
+
+               - Improved numeric precision handling.
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Fixed bug #1007104
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs:
+
+               - Improved numeric precision handling.
+
+               - Minor fix to schema queries to let them to run
+               using the embedded server.
+
+2004-08-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>    
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+               
+               - Cleanup.
+
+               - Reworked handling of stored procedure output 
+               parameter values.
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Improved input parameter descriptor generation.
+
+       * Last changes for the database schmeas support:
+
+
+               * All source files has been renamed to remove
+               the Schema suffix (FbTablesSchema.cs -> FbTables.cs)
+               The same for the class names.
+
+               * There are a new 'Restrictions' schema that will
+               return the restriction columns for each schema.
+
+               * There are new columns in some schemas:
+
+                          XXXX_CATALOG
+                          XXXX_SCHEMA
+
+               That will make the returned schemas more
+               general and compatible with other databases
+               (what will be nice for .net 2.0 as the schema
+               support is in the System.Data.Common.DbConnection
+               class)
+
+               These new columns are restriction columns as
+               well (the value will be null always)            
+
+
+2004-08-07 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Removed test comments.
+
+               - Throw an exception when trying to set the FetchSzie with an
+               active DataReader open.
+
+               - Set fetch size on execute instead of fetch.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbTablesSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:
+
+               - Now it's no possible to filter by the IS_SYSTEM_TABLE column,
+               doing that using the table type restriction.
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+
+               - Removed Rows property.
+
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+
+               - Removed Rows property.
+
+               - Use a Queue instead of a object[] to store the rows.
+               Performance looks similar (seems to be better with greater
+               fetch sizes) and the code is more readable.
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Changes on the way that output parameters
+               for Stored procedures query are retrieved.
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Minor changes in method calls.
+
+2004-08-06 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Fixed invalid references in the documentation reported by 
+       .NET 2.0
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Cleanup.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbTablesSchema.cs:
+
+               - The system tables will now be filtered using the table type parameter.
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+               
+               - Check connection state in GetSchema methods.  
+
+2004-08-05 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+       * FirebirdSql.Data.GDS/GdsStatement.cs:
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Fetch Size implementation that allows to define the 
+               fetch size (number of rows fetches in the call selectable queries)
+               in the connection string and command objects.
+
+       * FirebirdSql.Data.Firebird/FbConnectionString.cs:
+
+               - Fixed bug #1004055 
+
+               - Added new nunit test.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbDbSchema.cs:
+
+               - Added a little hack for the Tables schema restrictions.
+       
+
+2004-08-04 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:
+
+               - Removed PRIMARY_KEY and UNIQUE_KEY columns
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbPrimaryKeysSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbUniqueKeysSchema.cs:
+
+               - Allow filter by the column name
+
+
+2004-08-03 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs:
+
+               - Added new IS_ARRAY column.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeySchema.cs:
+
+               - Fixed error in latest commit.
+
+2004-08-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeySchema.cs:
+
+               - Updated sql statement.
+
+       * FirebirdSql.Data.Common/StatementBase.cs:
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+       * FirebirdSql.Data.Embbeded/FesStatement.cs:
+
+               - Some cleanup and refactoring.
+
+2004-08-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDbSchemaType.cs:
+
+               - Removed not implemented elements.
+
+               - Added new MEtaDataCollections element.
+       
+       * FirebirdSql.Data.Firebird/FbMetaDataCollections.cs:
+
+               - Added restriction counts values.
+
+               - Modided the constructos of the schame classes
+               to remove the restriction count value.
+
+       * FirebirdSql.Data.Firebird/FbDbSchema.cs:
+
+               - Use the new MetaDataCollections schema to check the
+               restriction count.
+
+2004-07-31 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+
+               - Removed the code of the partial batch command
+               execution (that was available only using FbDataReader.NextResult)
+
+
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+
+               - Added testing change on statement execution.
+               Now on execute we will request the number of rows 
+               affected in the same message.
+
+       * FirebirdSql.Data.Firebird/DbSchema/*.cs:
+
+               - Updated Database schema support.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs:
+
+               - Added new files.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbProviderTypesSchema.cs:
+
+               - Removed file.
+
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Added new CreateDatabase overload
+
+       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:
+
+               - Updated DeriveParameters method to work with the new
+               Database schema stuff.
+
+
+2004-07-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Added new GetSchema method
+
+               - Set GetDbSchemaTable method as Obsolete.
+
+       * FirebirdSql.Data.Firebird/FbDbSchemaType.cs:
+
+               - Removed _ from the element names.
+
+               - Set as obsolete.
+
+       * Improvements on Database schema support.
+
+       * FirebirdSql.Data.Firebird/FbService.cs:
+
+               - Fixed parsing database infor buffer (Thanks to Christian for his feedback).
+
+
+2004-07-29 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDbSchema.cs:
+
+               - Fixed bug #1000160
+
+2004-07-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+       * FirebirdSql.Data.Common/FbCharsetCollection.cs:
+       * FirebirdSql.Data.Common/FbIscErrorCollection.cs:
+       * FirebirdSql.Data.Common/DbValue.cs:
+       * FirebirdSql.Data.Common/BlobBase.cs:
+       * FirebirdSql.Data.Common/TypeEncoder.cs:
+       * FirebirdSql.Data.Common/StatementBase.cs:
+
+               - Fixed FxCop rules.
+
+2004-07-27 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Removed limitation of one active 
+               data reader per connection, now it
+               will be one active data reader per
+               command.
+
+               NUNit tests will be commited later 
+               today.
+
+
+2004-07-26 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbParameter.cs:
+
+               - Fixed bug #998002
+
+
+-------------------------- Alpha 1 ----------------------------
+
+2004-07-21 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbParameter.cs:
+
+               - Fixed bug #995178
+
+2004-07-20 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Updated documentation.
+
+       * Updated assembly version.
+
+       * Updated installation script.
+       With th enew changes the assembly will be registered
+       in the HKLM\Software\Microsoft\.NETFramework\AssemblyFolders
+       registry element, this will allow the assembly to be shown by the
+       Visual Studio Add Reference dialog.
+
+
+2004-07-18 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       - Private methods naming changes in all classes, using PascalCase,
+       to match MS Guidelines.
+
+2004-07-17 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Changed CommandTimeout property accesible only using
+               explicit interfaces.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:
+
+               - Fixed IS_NULLABLE column value.
+
+
+2004-07-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:
+
+               - Fixed mistake in latest commit.
+
+       * FirebirdSql.Data.Firebird/FbCommandBuilder.cs:
+
+               - Make use of the new PARAMETER_DIRECTION column.
+
+               - Remove COLUMN_SIZE reference.
+
+2004-07-15 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:
+
+               - Report correct size for blob columns.
+
+2004-07-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbFunctionsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbIndexeschema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbGeneratorsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbTablesSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbTriggersSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbUniqueKeysSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbViewColumnsUsageSchema.cs:
+
+
+               - Columns that indicates wheter an object is a system
+               object are now called IS_SYSTEM_XXXX.
+
+               - Columns that indicates wheter an object is inactive
+               are now called IS_INACTIVE. 
+               
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeysSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbIndexesSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbPremaryKeysSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:
+
+               - Set ORDINAL_POSITION as name for all ordinal columns.
+
+2004-07-11 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCharset.cs:
+
+               - Added Serializable attribute.
+
+2004-07-10 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbDomainsSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbProceduresSchema.cs:
+
+               - Added AcceptChanges call.
+
+       * FirebirdSql.Data.Firebird/FbDataReader.cs:
+
+               - Cleanup.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbProceduresSchema.cs:
+
+               - Return intputs and outputs columns null values
+               as 0.
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:
+
+               - Renamed PARAMETER_TYPE column as PARAMETER_DIRECTION
+               and set the value as ParameterDirection.Input or
+               ParameterDirection.Output.
+
+2004-07-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Set actual CreateDatabase and DropDatabase as Obsolete
+
+               - Added new CreateDatabase and DropDatabase methods
+               that uses connection strings.
+
+
+2004-07-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/DbField.cs:
+
+               - Added new IsDecimal method.
+
+       * FirebirdSql.Data.Common/FbDataReader.cs:
+
+               - Set numeric precision and scale only for decimal/numeric datatypes.
+
+
+2004-06-30 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbDbSchemaType.cs:
+
+               - Added Serializable attribute.
+
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Simplify constructor implementation.
+
+       * FirebirdSql.Data.Firebird/FbParameter.cs:
+
+               - Added private keyyworkd to class fields.
+
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+
+               - Simplified BeginTransaction overloads.
+
+2004-06-25 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+
+               - Fixed bug on Detach method.   
+
+       * FirebirdSql.Data.common/IDatabase.cs
+       * FirebirdSql.Data.common/ITransaction.cs
+       * FirebirdSql.Data.common/StatementBase.cs
+       * FirebirdSql.Data.Embedded/FesDatabase.cs:
+       * FirebirdSql.Data.Embedded/FesTransaction.cs:
+       * FirebirdSql.Data.Embedded/FesStatement.cs:
+       * FirebirdSql.Data.Gds/GdsDatabase.cs:
+       * FirebirdSql.Data.Gds/GdsTransaction.cs:
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+       * FirebirdSql.Data.Firebird/FbConnection.cs:
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+       * FirebirdSql.Data.Firebird/FbTransaction.cs:
+       * FirebirdSql.Data.Firebird/FbDbConnection.cs:  
+
+               - Implement IDisposable interface in 
+               Database, Transaction and statement implementations
+               of GDs's.
+
+               Prior sources are tagged as NP_1_7_Alpha1.
+
+               * This change needs carefully review/testing. *
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbProcedureParametersSchema.cs:
+       * FirebirdSql.Data.Firebird/DbSchema/FbColumnsSchema.cs:
+
+               - Fixed NUMERIC_SCALE column value (Thanks to Jack for his feedback).
+
+2004-06-24 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Services/FbService.cs:
+
+               - Modify the delegate and event used for
+               handling service output by adding a new
+               ServiceOutputEventArgs class (Thanks to Mike Scott for his feedback).
+
+2004-06-23 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/Services/*.cs:
+       
+               - Changes on output processing, now it's going to be done
+               using an event instead of the GetNextLine method.
+               
+               Start methods has been renamed to Execute in every class.
+               
+               (Thanks to Pierre Y. for his suggestion)
+
+2004-06-16 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsArray.cs:
+
+               - Fix Array implementation. All NUnit tests suite are running fine.
+
+       * Added setup projects.
+
+       * FirebirdSql.Data.Firebird.UnitTest/FbDataAdapter.cs:
+
+               - Added new nunit test for check dataset fill using
+               an execute procedure statement.
+
+2004-06-14 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbConenctionString.cs:
+
+               - Added Validate method.
+
+       * Updated/added documentation of classes:
+
+               - FbConnection
+               - FbEvent
+               - FbService
+
+       * Added BDP NUnit test suite.
+
+
+2004-06-13 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Bdp/Fbconnection.cs:
+
+               - Finish connection code for work with new
+               GDS implementation structure.
+
+
+2004-06-12 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Gds/GdsStatement.cs:
+
+               - Fixed bug in Fetch method when working
+               with statements using EXECUTE PROCEDURE syntax.
+
+
+2004-06-08 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * Finished first stage of the events reimplementation.
+
+
+2004-06-02 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Firebird/FbCommand.cs:
+
+               - Simplify handling of input parameters with null values (Thanks to Jojakim Stahl).
+
+       * FirebirdSql.Data.Firebird/DbSchema/FbForeignKeysSchema.cs:
+
+               - Fix order by clausule.
+
+       * FirebirdSql.Data.Firebird/FbConnectionPool.cs:
+
+               - Run cleanup over pooled connections
+               only when there are a number of pooled connections
+               greater than the min pool size (needs testing).
+
+2004-06-01 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+       * FirebirdSql.Data.Common/FbCommandBuilder.cs:
+       
+               - Improved DeriveParameters implementation.
+
+       * FirebirdSql.Data.Common/Descriptor.cs:
+
+               - Changed ToBlr method for use a MemoryStream.
+
+       * FirebirdSql.Data.Common/IscError.cs:
+       * FirebirdSql.Data.Common/IscCodes.cs:
+       * FirebirdSql.Data.Common/IscException.cs:
+
+               - Clean up on fatal errors exceptions.
+
+       * FirebirdSql.Data.Common/IscException.cs:
+
+               - Rewrite the way the exeption emessage is built.
+               
+       * FirebirdSql.Data.Common/IscExceptionHelper.cs:
+
+               - Removed.
+
+       * FirebirdSql.Data.Common:
+
+               - RowDescriptor.cs renamed as Descriptor.cs
+
+
+2004-05-28 Carlos Guzman Alvarez  <carlosga@telefonica.net>
+
+    * FirebirdSql.Data.Common:
+
+    Removed classes:
+
+        - AttachmentParams
+        - Factorybase
+        - IAttachment
+
+    Renamed classes:
+
+        - IDbAttachment    -> IDatabase
+        - ISvcAttachment   -> IServiceManager
+
+    * FirebirdSql.Data.Embedded:
+
+    Removed classes:
+
+        - FesFactory
+        - FesAttachment
+
+    Renamed classes
+
+        - FesDbAttachment     -> FesDatabase
+        - FesSvcAttachment    -> FesServiceManager
+        * FirebirdSql.Data.Gds: 
+    Removed classes:
+
+        - GdsFactory
+
+    Renamed classes
+
+        - GdsAttachment       -> GdsConnection
+        - GdsDbAttachment     -> GdsDatabase
+        - GdsSvcAttachment    -> GdsServiceManager
+
+    * FirebirdSql.Data.Firebird:
+
+    New classes:
+
+        - FbConnectionString
+
+    * FirebirdSql.Data.Firebird.Service:
+
+    Removed classes:
+
+        - FbServiceParameters.
+
     (The services implementation now works with a connection strings. 
\ No newline at end of file
index b663c07c6496791d914639e4b08f73c5168a8b1c..39e8b812374e2948c5bb0a4f6e2f77dfd46e511a 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<HTML>
-<HEAD>
-       <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
-       <TITLE>Initial Developer's PUBLIC LICENSE Version 1.0</TITLE>
-       <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.1  (Win32)">
-       <META NAME="CREATED" CONTENT="20040603;16204312">
-       <META NAME="CHANGED" CONTENT="20040603;16215490">
-       <STYLE>
-       <!--
-               TD P { color: #000000; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt }
-               P { color: #000000; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt }
-               H2 { color: #008080; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 13pt }
-               A:visited { font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt; text-decoration: none }
-               A:link { color: #0000ff; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt; text-decoration: none }
-       -->
-       </STYLE>
-</HEAD>
-<BODY LANG="es-ES" TEXT="#000000" LINK="#0000ff" BGCOLOR="#ffffff" DIR="LTR">
-<TABLE WIDTH=65% CELLPADDING=2 CELLSPACING=2>
-       <TR>
-               <TD>
-                       <H2>Initial Developer's PUBLIC LICENSE Version 1.0</H2>
-               </TD>
-       </TR>
-       <TR>
-               <TD>
-                       <P>1. Definitions 
-                       </P>
-                       <P>1.0 &quot;<B>Commercial Use</B>&quot; means distribution or
-                       otherwise making the Covered Code available to a third party. 
-                       </P>
-                       <P>1.1 ''<B>Contributor</B>'' means each entity that creates or
-                       contributes to the creation of Modifications. 
-                       </P>
-                       <P>1.2 ''<B>Contributor Version</B>'' means the combination of the
-                       Original Code, prior Modifications used by a Contributor, and the
-                       Modifications made by that particular Contributor. 
-                       </P>
-                       <P>1.3. ''<B>Covered Code</B>'' means the Original Code or
-                       Modifications or the combination of the Original Code and
-                       Modifications, in each case including portions thereof. 
-                       </P>
-                       <P>1.4. ''<B>Electronic Distribution Mechanism</B>'' means a
-                       mechanism generally accepted in the software development community
-                       for the electronic transfer of data. 
-                       </P>
-                       <P>1.5. ''<B>Executable</B>'' means Covered Code in any form other
-                       than Source Code. 
-                       </P>
-                       <P>1.6. ''<B>Initial Developer</B>'' means the individual or
-                       entity identified as the Initial Developer in the Source Code
-                       notice required by Exhibit A. 
-                       </P>
-                       <P>1.7. ''<B>Larger Work</B>'' means a work which combines Covered
-                       Code or portions thereof with code not governed by the terms of
-                       this License. 
-                       </P>
-                       <P>1.8. ''<B>License</B>'' means this document. 
-                       </P>
-                       <P>1.8.1. &quot;<B>Licensable</B>&quot; means having the right to
-                       grant, to the maximum extent possible, whether at the time of the
-                       initial grant or subsequently acquired, any and all of the rights
-                       conveyed herein. 
-                       </P>
-                       <P>1.9. ''<B>Modifications</B>'' means any addition to or deletion
-                       from the substance or structure of either the Original Code or any
-                       previous Modifications. When Covered Code is released as a series
-                       of files, a Modification is: 
-                       </P>
-                       <P>Any addition to or deletion from the contents of a file
-                       containing Original Code or previous Modifications. 
-                       </P>
-                       <P>Any new file that contains any part of the Original Code or
-                       previous Modifications. 
-                       </P>
-                       <P>1.10. ''<B>Original Code</B>'' means Source Code of computer
-                       software code which is described in the Source Code notice
-                       required by Exhibit A as Original Code, and which, at the time of
-                       its release under this License is not already Covered Code
-                       governed by this License. 
-                       </P>
-                       <P>1.10.1. &quot;<B>Patent Claims</B>&quot; means any patent
-                       claim(s), now owned or hereafter acquired, including without
-                       limitation, method, process, and apparatus claims, in any patent
-                       Licensable by grantor. 
-                       </P>
-                       <P>1.11. ''<B>Source Code</B>'' means the preferred form of the
-                       Covered Code for making modifications to it, including all modules
-                       it contains, plus any associated interface definition files,
-                       scripts used to control compilation and installation of an
-                       Executable, or source code differential comparisons against either
-                       the Original Code or another well known, available Covered Code of
-                       the Contributor's choice. The Source Code can be in a compressed
-                       or archival form, provided the appropriate decompression or
-                       de-archiving software is widely available for no charge. 
-                       </P>
-                       <P>1.12. &quot;<B>You</B>'' (or &quot;<B>Your</B>&quot;) means an
-                       individual or a legal entity exercising rights under, and
-                       complying with all of the terms of, this License or a future
-                       version of this License issued under Section 6.1. For legal
-                       entities, &quot;You'' includes any entity w hich controls, is
-                       controlled by, or is under common control with You. For purposes
-                       of this definition, &quot;control'' means (a) the power, direct or
-                       indirect, to cause the direction or management of such entity,
-                       whether by contract or otherwise, or (b) ownership of more than
-                       fifty percent (50%) of the outstanding shares or beneficial
-                       ownership of such entity.</P>
-                       <P>2. Source Code License. 
-                       </P>
-                       <P><B>2.1. The Initial Developer Grant.</B> The Initial Developer
-                       hereby grants You a world-wide, royalty-free, non-exclusive
-                       license, subject to third party intellectual property claims: 
-                       </P>
-                       <P>(a) under intellectual property rights (other than patent or
-                       trademark) Licensable by Initial Developer to use, reproduce,
-                       modify, display, perform, sublicense and distribute the Original
-                       Code (or portions thereof) with or without Modifications, and/or
-                       as part of a Larger Work; and 
-                       </P>
-                       <P>(b) under Patents Claims infringed by the making, using or
-                       selling of Original Code, to make, have made, use, practice, sell,
-                       and offer for sale, and/or otherwise dispose of the Original Code
-                       (or portions thereof). 
-                       </P>
-                       <P>(c) the licenses granted in this Section 2.1(a) and (b) are
-                       effective on the date Initial Developer first distributes Original
-                       Code under the terms of this License. 
-                       </P>
-                       <P>d) Notwithstanding Section 2.1(b) above, no patent license is
-                       granted:</P>
-                       <P>1) for code that You delete from the Original Code; 
-                       </P>
-                       <P>2) separate from the Original Code; or 
-                       </P>
-                       <P>3) for infringements caused by: 
-                       </P>
-                       <P>i) the modification of the Original Code or 
-                       </P>
-                       <P>ii) the combination of the Original Code with other software or
-                       devices. 
-                       </P>
-                       <P><B>2.2. Contributor Grant.</B> Subject to third party
-                       intellectual property claims, each Contributor hereby grants You a
-                       world-wide, royalty-free, non-exclusive license 
-                       </P>
-                       <P>(a) under intellectual property rights (other than patent or
-                       trademark) Licensable by Contributor, to use, reproduce, modify,
-                       display, perform, sublicense and distribute the Modifications
-                       created by such Contributor (or portions thereof) either on an
-                       unmodified basis, with other Modifications, as Covered Code and/or
-                       as part of a Larger Work; and 
-                       </P>
-                       <P>(b) under Patent Claims infringed by the making, using, or
-                       selling of Modifications made by that Contributor either alone
-                       and/or in combination with its Contributor Version (or portions of
-                       such combination), to make, use, sell, offer for sale, have made,
-                       and/or otherwise dispose of: 1) Modifications made by that
-                       Contributor (or portions thereof); and 2) the combination of
-                       Modifications made by that Contributor with its Contributor
-                       Version (or portions of such combination). 
-                       </P>
-                       <P>(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
-                       effective on the date Contributor first makes Commercial Use of
-                       the Covered Code. 
-                       </P>
-                       <P>(d) Notwithstanding Section 2.2(b) above, no patent license is
-                       granted: 
-                       </P>
-                       <P>1) for any code that Contributor has deleted from the
-                       Contributor Version; 
-                       </P>
-                       <P>2) separate from the Contributor Version; 
-                       </P>
-                       <P>3) for infringements caused by: i) third party modifications of
-                       Contributor Version or 
-                       </P>
-                       <P>ii) the combination of Modifications made by that Contributor
-                       with other software (except as part of the Contributor Version) or
-                       other devices; or 
-                       </P>
-                       <P>4) under Patent Claims infringed by Covered Code in the absence
-                       of Modifications made by that Contributor. 
-                       </P>
-                       <P>3. Distribution Obligations. 
-                       </P>
-                       <P><B>3.1. Application of License.</B> The Modifications which You
-                       create or to which You contribute are governed by the terms of
-                       this License, including without limitation Section 2.2. The Source
-                       Code version of Covered Code may be distributed only under the
-                       terms of this License or a future version of this License released
-                       under Section 6.1, and You must include a copy of this License
-                       with every copy of the Source Code You distribute. You may not
-                       offer or impose any terms on any Source Code version that alters
-                       or restricts the applicable version of this License or the
-                       recipients' rights hereunder. However, You may include an
-                       additional document offering the additional rights described in
-                       Section 3.5.</P>
-                       <P><B>3.2. Availability of Source Code</B>. Any Modification which
-                       You create or to which You contribute must be made available in
-                       Source Code form under the terms of this License either on the
-                       same media as an Executable version or via an accepted Electronic
-                       Distribution Mechanism to anyone to whom you made an Executable
-                       version available; and if made available via Electronic
-                       Distribution Mechanism, must remain available for at least twelve
-                       (12) months after the date it initially became available, or at
-                       least six (6) months after a subsequent version of that particular
-                       Modification has been made available to such recipients. You are
-                       responsible for ensuring that the Source Code version remains
-                       available even if the Electronic Distribution Mechanism is
-                       maintained by a third party. 
-                       </P>
-                       <P><B>3.3. Description of Modifications.</B> You must cause all
-                       Covered Code to which You contribute to contain a file documenting
-                       the changes You made to create that Covered Code and the date of
-                       any change. You must include a prominent statement that the
-                       Modification is derived, directly or indirectly, from Original
-                       Code provided by the Initial Developer and including the name of
-                       the Initial Developer in 
-                       </P>
-                       <P>(a) the Source Code, and 
-                       </P>
-                       <P>(b) in any notice in an Executable version or related
-                       documentation in which You describe the origin or ownership of the
-                       Covered Code.</P>
-                       <P><B>3.4. Intellectual Property Matters </B>
-                       </P>
-                       <P>a) Third Party Claims. If Contributor has knowledge that a
-                       license under a third party's intellectual property rights is
-                       required to exercise the rights granted by such Contributor under
-                       Sections 2.1 or 2.2, Contributor must include a text file with the
-                       Source Code distribution titled &quot;LEGAL'' which describes the
-                       claim and the party making the claim in sufficient detail that a
-                       recipient will know whom to contact. If Contributor obtains such
-                       knowledge after the Modification is made available as described in
-                       Section 3.2, Contributor shall promptly modify the LEGAL file in
-                       all copies Contributor makes available thereafter and shall take
-                       other steps (such as notifying appropriate mailing lists or
-                       newsgroups) reasonably calculated to inform those who received the
-                       Covered Code that new knowledge has been obtained. 
-                       </P>
-                       <P>(b) Contributor APIs. If Contributor's Modifications include an
-                       application programming interface and Contributor has knowledge of
-                       patent licenses which are reasonably necessary to implement that
-                       API, Contributor must also include this information in the LEGAL
-                       file. 
-                       </P>
-                       <P>(c) Representations. Contributor represents that, except as
-                       disclosed pursuant to Section 3.4(a) above, Contributor believes
-                       that Contributor's Modifications are Contributor's original
-                       creation(s) and/or Contributor has sufficient rights to grant the
-                       rights conveyed by this License. 
-                       </P>
-                       <P><B>3.5. Required Notices.</B> You must duplicate the notice in
-                       Exhibit A in each file of the Source Code. If it is not possible
-                       to put such notice in a particular Source Code file due to its
-                       structure, then You must include such notice in a location (such
-                       as a relevant directory) where a user would be likely to look for
-                       such a notice. If You created one or more Modification(s) You may
-                       add your name as a Contributor to the notice described in Exhibit
-                       A. You must also duplicate this License in any documentation for
-                       the Source Code where You describe recipients' rights or ownership
-                       rights relating to Covered Code. You may choose to offer, and to
-                       charge a fee for, warranty, support, indemnity or liability
-                       obligations to one or more recipients of Covered Code. However,
-                       You may do so only on Your own behalf, and not on behalf of the
-                       Initial Developer or any Contributor. You must make it absolutely
-                       clear than any such warranty, support, indemnity or liability
-                       obligation is offered by You alone, and You hereby agree to
-                       indemnify the Initial Developer and every Contributor for any
-                       liability incurred by the Initial Developer or such Contributor as
-                       a result of warranty, support, indemnity or liability terms You
-                       offer. 
-                       </P>
-                       <P><B>3.6. Distribution of Executable Versions.</B> You may
-                       distribute Covered Code in Executable form only if the
-                       requirements of Section 3.1-3.5 have been met for that Covered
-                       Code, and if You include a notice stating that the Source Code
-                       version of the Covered Code is available under the terms of this
-                       License, including a description of how and where You have
-                       fulfilled the obligations of Section 3.2. The notice must be
-                       conspicuously included in any notice in an Executable version,
-                       related documentation or collateral in which You describe
-                       recipients' rights relating to the Covered Code. You may
-                       distribute the Executable version of Covered Code or ownership
-                       rights under a license of Your choice, which may contain terms
-                       different from this License, provided that You are in compliance
-                       with the terms of this License and hat the license for the
-                       Executable version does not attempt to limit or alter the
-                       recipient's rights in the Source Code version from the rights set
-                       forth in this License. If You distribute the Executable version
-                       under a different license You must make it absolutely clear that
-                       any terms which differ from this License are offered by You alone,
-                       not by the Initial Developer or any Contributor. You hereby agree
-                       to indemnify the Initial Developer and every Contributor for any
-                       liability incurred by the Initial Developer or such Contributor as
-                       a result of any such terms You offer. 
-                       </P>
-                       <P><B>3.7. Larger Works.</B> You may create a Larger Work by
-                       combining Covered Code with other code not governed by the terms
-                       of this License and distribute the Larger Work as a single
-                       product. In such a case, You must make sure the requirements of
-                       this License are fulfilled for the Covered Code. 
-                       </P>
-                       <P>4. Inability to Comply Due to Statute or Regulation. 
-                       </P>
-                       <P>If it is impossible for You to comply with any of the terms of
-                       this License with respect to some or all of the Covered Code due
-                       to statute, judicial order, or regulation then You must: 
-                       </P>
-                       <P>(a) comply with the terms of this License to the maximum extent
-                       possible; and 
-                       </P>
-                       <P>(b) describe the limitations and the code they affect. Such
-                       description must be included in the LEGAL file described in
-                       Section 3.4 and must be included with all distributions of the
-                       Source Code. Except to the extent prohibited by statute or
-                       regulation, such description must be sufficiently detailed for a
-                       recipient of ordinary skill to be able to understand it. 
-                       </P>
-                       <P>5. Application of this License.</P>
-                       <P>This License applies to code to which the Initial Developer has
-                       attached the notice in Exhibit A and to related Covered Code. 
-                       </P>
-                       <P>6. Versions of the License. 
-                       </P>
-                       <P><B>6.1. New Versions.</B> The Initial Developer of this code
-                       may publish revised and/or new versions of the License from time
-                       to time. Each version will be given a distinguishing version
-                       number. 
-                       </P>
-                       <P><B>6.2. Effect of New Versions.</B> Once Covered Code has been
-                       published under a particular version of the License, You may
-                       always continue to use it under the terms of that version. You may
-                       also choose to use such Covered Code under the terms of any
-                       subsequent version of the License published by the Initial
-                       Developer. No one other than the Initial Developer has the right
-                       to modify the terms applicable to Covered Code created under this
-                       License. 
-                       </P>
-                       <P><B>6.3. Derivative Works.</B> If You create or use a modified
-                       version of this License (which you may only do in order to apply
-                       it to code which is not already Covered Code governed by this
-                       License), You must 
-                       </P>
-                       <P>(a) rename Your license so that the phrases ''Mozilla'',
-                       ''MOZILLAPL'', ''MOZPL'', ''Netscape'', &quot;MPL&quot;, ''NPL&quot;,
-                       or any confusingly similar phrases do not appear in your license
-                       (except to note that your license differs from this License) and 
-                       </P>
-                       <P>(b) otherwise make it clear that Your version of the license
-                       contains terms which differ from the Mozilla Public License and
-                       Netscape Public License. (Filling in the name of the Initial
-                       Developer, Original Code or Contributor in the notice described in
-                       Exhibit A shall not of themselves be deemed to be modifications of
-                       this License.) 
-                       </P>
-                       <P><B>6.4 Origin of the Initial Developer's Public License.</B>
-                       The Initial Developer's Public License is based on the Mozilla
-                       Public License V 1.1 with the following changes: 
-                       </P>
-                       <P>1) The license is published by the Initial Developer of this
-                       code. Only the Initial Developer can modify the terms applicable
-                       to Covered Code. 
-                       </P>
-                       <P>2) The license can be modified and used for code which is not
-                       already governed by this license. Modified versions of the license
-                       must be renamed to avoid confusion with Netscape's license Initial
-                       Developer's's license and must include a description of changes
-                       from the Initial Developer's Public License. 
-                       </P>
-                       <P>3) The name of the license in Exhibit A is the &quot;Initial
-                       Developer's Public License&quot;. 
-                       </P>
-                       <P>4) The reference to an alternative license in Exhibit A has
-                       been removed . 
-                       </P>
-                       <P>5) Amendments I, II, III, V, and VI have been deleted. 
-                       </P>
-                       <P>6) Exhibit A, Netscape Public License has been deleted 
-                       </P>
-                       <P>7. DISCLAIMER OF WARRANTY. 
-                       </P>
-                       <P>COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN &quot;AS IS''
-                       BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-                       INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS
-                       FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR
-                       NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
-                       OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE
-                       DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
-                       OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
-                       REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
-                       ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS
-                       AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.</P>
-                       <P>8. TERMINATION. 
-                       </P>
-                       <P>8.1. This License and the rights granted hereunder will
-                       terminate automatically if You fail to comply with terms herein
-                       and fail to cure such breach within 30 days of becoming aware of
-                       the breach. All sublicenses to the Covered Code which are properly
-                       granted shall survive any termination of this License. Provisions
-                       which, by their nature, must remain in effect beyond the
-                       termination of this License shall survive. 
-                       </P>
-                       <P>8.2. If You initiate litigation by asserting a patent
-                       infringement claim (excluding declatory judgment actions) against
-                       Initial Developer or a Contributor (the Initial Developer or
-                       Contributor against whom You file such action is referred to as
-                       &quot;Participant&quot;) alleging that: 
-                       </P>
-                       <P>(a) such Participant's Contributor Version directly or
-                       indirectly infringes any patent, then any and all rights granted
-                       by such Participant to You under Sections 2.1 and/or 2.2 of this
-                       License shall, upon 60 days notice from Participant terminate
-                       prospectively, unless if within 60 days after receipt of notice
-                       You either: 
-                       </P>
-                       <P>(i) agree in writing to pay Participant a mutually agreeable
-                       reasonable royalty for Your past and future use of Modifications
-                       made by such Participant, or</P>
-                       <P>(ii) withdraw Your litigation claim with respect to the
-                       Contributor Version against such Participant. 
-                       </P>
-                       <P>If within 60 days of notice, a reasonable royalty and payment
-                       arrangement are not mutually agreed upon in writing by the parties
-                       or the litigation claim is not withdrawn, the rights granted by
-                       Participant to You under Sections 2.1 and/or 2.2 automatically
-                       terminate at the expiration of the 60 day notice period specified
-                       above.</P>
-                       <P>(b) any software, hardware, or device, other than such
-                       Participant's Contributor Version, directly or indirectly
-                       infringes any patent, then any rights granted to You by such
-                       Participant under Sections 2.1(b) and 2.2(b) are revoked effective
-                       as of the date You first made, used, sold, distributed, or had
-                       made, Modifications made by that Participant. 
-                       </P>
-                       <P>8.3. If You assert a patent infringement claim against
-                       Participant alleging that such Participant's Contributor Version
-                       directly or indirectly infringes any patent where such claim is
-                       resolved (such as by license or settlement) prior to the
-                       initiation of patent infringement litigation, then the reasonable
-                       value of the licenses granted by such Participant under Sections
-                       2.1 or 2.2 shall be taken into account in determining the amount
-                       or value of any payment or license. 
-                       </P>
-                       <P>8.4. In the event of termination under Sections 8.1 or 8.2
-                       above, all end user license agreements (excluding distributors and
-                       resellers) which have been validly granted by You or any
-                       distributor hereunder prior to termination shall survive
-                       termination. 
-                       </P>
-                       <P>9. LIMITATION OF LIABILITY.</P>
-                       <P>UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
-                       (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
-                       INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
-                       COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO
-                       ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
-                       DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES
-                       FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR
-                       MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES,
-                       EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
-                       SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO
-                       LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S
-                       NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION.
-                       SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF
-                       INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND
-                       LIMITATION MAY NOT APPLY TO YOU. 
-                       </P>
-                       <P>10. U.S. GOVERNMENT END USERS. 
-                       </P>
-                       <P>The Covered Code is a ''commercial item,'' as that term is
-                       defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of ''commercial
-                       computer software'' and ''commercial computer software
-                       documentation,'' as such terms are used in 48 C.F.R. 12.212 (Sept.
-                       1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
-                       through 227.7202-4 (June 1995), all U.S. Government End Users
-                       acquire Covered Code with only those rights set forth herein. 
-                       </P>
-                       <P>11. MISCELLANEOUS. 
-                       </P>
-                       <P>This License represents the complete agreement concerning
-                       subject matter hereof. If any provision of this License is held to
-                       be unenforceable, such provision shall be reformed only to the
-                       extent necessary to make it enforceable. This License shall be
-                       governed by California law provisions (except to the extent
-                       applicable law, if any, provides otherwise), excluding its
-                       conflict-of-law provisions. With respect to disputes in which at
-                       least one party is a citizen of, or an entity chartered or
-                       registered to do business in the United States of America, any
-                       litigation relating to this License shall be subject to the
-                       jurisdiction of the Federal Courts of the Northern District of
-                       California, with venue lying in Santa Clara County, California,
-                       with the losing party responsible for costs, including without
-                       limitation, court costs and reasonable attorneys' fees and
-                       expenses. The application of the United Nations Convention on
-                       Contracts for the International Sale of Goods is expressly
-                       excluded. Any law or regulation which provides that the language
-                       of a contract shall be construed against the drafter shall not
-                       apply to this License. 
-                       </P>
-                       <P>12. RESPONSIBILITY FOR CLAIMS. 
-                       </P>
-                       <P>As between Initial Developer and the Contributors, each party
-                       is responsible for claims and damages arising, directly or
-                       indirectly, out of its utilization of rights under this License
-                       and You agree to work with Initial Developer and Contributors to
-                       distribute such responsibility on an equitable basis. Nothing
-                       herein is intended or shall be deemed to constitute any admission
-                       of liability. 
-                       </P>
-                       <P>13. MULTIPLE-LICENSED CODE. 
-                       </P>
-                       <P>Initial Developer may designate portions of the Covered Code as
-                       &quot;Multiple-Licensed&quot;. &quot;Multiple-Licensed&quot; means
-                       that the Initial Devpoeloper permits you to utilize portions of
-                       the Covered Code under Your choice of the IDPL or the alternative
-                       licenses, if any, specified by the Initial Developer in the file
-                       described in Exhibit A. 
-                       </P>
-                       <P><B>EXHIBIT A</B> -Initial Developer's Public License. 
-                       </P>
-                       <P>The contents of this file are subject to the Initial
-                       Developer's Public License Version 1.0 (the &quot;License&quot;);
-                       you may not use this file except in compliance with the License.
-                       You may obtain a copy of the License <A HREF="http://www.ibphoenix.com/main.nfs?a=ibphoenix&amp;page=ibp_idpl">here.</A></P>
-                       <P>Software distributed under the License is distributed on an &quot;AS
-                       IS&quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or
-                       implied. See the License for the specific language governing
-                       rights and limitations under the License. 
-                       </P>
-                       <P>The Original Code is ______________________________________. 
-                       </P>
-                       <P>The Initial Developer of the Original Code is
-                       ________________________. 
-                       </P>
-                       <P>Portions created by ______________________ <BR>are Copyright
-                       (C) ______ _______________________. 
-                       </P>
-                       <P>All Rights Reserved. 
-                       </P>
-                       <P>Contributor(s): ______________________________________. 
-                       </P>
-               </TD>
-       </TR>
-</TABLE>
-<P><BR><BR>
-</P>
-</BODY>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
+<HTML>\r
+<HEAD>\r
+       <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">\r
+       <TITLE>Initial Developer's PUBLIC LICENSE Version 1.0</TITLE>\r
+       <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.1  (Win32)">\r
+       <META NAME="CREATED" CONTENT="20040603;16204312">\r
+       <META NAME="CHANGED" CONTENT="20040603;16215490">\r
+       <STYLE>\r
+       <!--\r
+               TD P { color: #000000; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt }\r
+               P { color: #000000; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt }\r
+               H2 { color: #008080; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 13pt }\r
+               A:visited { font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt; text-decoration: none }\r
+               A:link { color: #0000ff; font-family: "verdana", "arial", "geneva", sans-serif; font-size: 9pt; text-decoration: none }\r
+       -->\r
+       </STYLE>\r
+</HEAD>\r
+<BODY LANG="es-ES" TEXT="#000000" LINK="#0000ff" BGCOLOR="#ffffff" DIR="LTR">\r
+<TABLE WIDTH=65% CELLPADDING=2 CELLSPACING=2>\r
+       <TR>\r
+               <TD>\r
+                       <H2>Initial Developer's PUBLIC LICENSE Version 1.0</H2>\r
+               </TD>\r
+       </TR>\r
+       <TR>\r
+               <TD>\r
+                       <P>1. Definitions \r
+                       </P>\r
+                       <P>1.0 &quot;<B>Commercial Use</B>&quot; means distribution or\r
+                       otherwise making the Covered Code available to a third party. \r
+                       </P>\r
+                       <P>1.1 ''<B>Contributor</B>'' means each entity that creates or\r
+                       contributes to the creation of Modifications. \r
+                       </P>\r
+                       <P>1.2 ''<B>Contributor Version</B>'' means the combination of the\r
+                       Original Code, prior Modifications used by a Contributor, and the\r
+                       Modifications made by that particular Contributor. \r
+                       </P>\r
+                       <P>1.3. ''<B>Covered Code</B>'' means the Original Code or\r
+                       Modifications or the combination of the Original Code and\r
+                       Modifications, in each case including portions thereof. \r
+                       </P>\r
+                       <P>1.4. ''<B>Electronic Distribution Mechanism</B>'' means a\r
+                       mechanism generally accepted in the software development community\r
+                       for the electronic transfer of data. \r
+                       </P>\r
+                       <P>1.5. ''<B>Executable</B>'' means Covered Code in any form other\r
+                       than Source Code. \r
+                       </P>\r
+                       <P>1.6. ''<B>Initial Developer</B>'' means the individual or\r
+                       entity identified as the Initial Developer in the Source Code\r
+                       notice required by Exhibit A. \r
+                       </P>\r
+                       <P>1.7. ''<B>Larger Work</B>'' means a work which combines Covered\r
+                       Code or portions thereof with code not governed by the terms of\r
+                       this License. \r
+                       </P>\r
+                       <P>1.8. ''<B>License</B>'' means this document. \r
+                       </P>\r
+                       <P>1.8.1. &quot;<B>Licensable</B>&quot; means having the right to\r
+                       grant, to the maximum extent possible, whether at the time of the\r
+                       initial grant or subsequently acquired, any and all of the rights\r
+                       conveyed herein. \r
+                       </P>\r
+                       <P>1.9. ''<B>Modifications</B>'' means any addition to or deletion\r
+                       from the substance or structure of either the Original Code or any\r
+                       previous Modifications. When Covered Code is released as a series\r
+                       of files, a Modification is: \r
+                       </P>\r
+                       <P>Any addition to or deletion from the contents of a file\r
+                       containing Original Code or previous Modifications. \r
+                       </P>\r
+                       <P>Any new file that contains any part of the Original Code or\r
+                       previous Modifications. \r
+                       </P>\r
+                       <P>1.10. ''<B>Original Code</B>'' means Source Code of computer\r
+                       software code which is described in the Source Code notice\r
+                       required by Exhibit A as Original Code, and which, at the time of\r
+                       its release under this License is not already Covered Code\r
+                       governed by this License. \r
+                       </P>\r
+                       <P>1.10.1. &quot;<B>Patent Claims</B>&quot; means any patent\r
+                       claim(s), now owned or hereafter acquired, including without\r
+                       limitation, method, process, and apparatus claims, in any patent\r
+                       Licensable by grantor. \r
+                       </P>\r
+                       <P>1.11. ''<B>Source Code</B>'' means the preferred form of the\r
+                       Covered Code for making modifications to it, including all modules\r
+                       it contains, plus any associated interface definition files,\r
+                       scripts used to control compilation and installation of an\r
+                       Executable, or source code differential comparisons against either\r
+                       the Original Code or another well known, available Covered Code of\r
+                       the Contributor's choice. The Source Code can be in a compressed\r
+                       or archival form, provided the appropriate decompression or\r
+                       de-archiving software is widely available for no charge. \r
+                       </P>\r
+                       <P>1.12. &quot;<B>You</B>'' (or &quot;<B>Your</B>&quot;) means an\r
+                       individual or a legal entity exercising rights under, and\r
+                       complying with all of the terms of, this License or a future\r
+                       version of this License issued under Section 6.1. For legal\r
+                       entities, &quot;You'' includes any entity w hich controls, is\r
+                       controlled by, or is under common control with You. For purposes\r
+                       of this definition, &quot;control'' means (a) the power, direct or\r
+                       indirect, to cause the direction or management of such entity,\r
+                       whether by contract or otherwise, or (b) ownership of more than\r
+                       fifty percent (50%) of the outstanding shares or beneficial\r
+                       ownership of such entity.</P>\r
+                       <P>2. Source Code License. \r
+                       </P>\r
+                       <P><B>2.1. The Initial Developer Grant.</B> The Initial Developer\r
+                       hereby grants You a world-wide, royalty-free, non-exclusive\r
+                       license, subject to third party intellectual property claims: \r
+                       </P>\r
+                       <P>(a) under intellectual property rights (other than patent or\r
+                       trademark) Licensable by Initial Developer to use, reproduce,\r
+                       modify, display, perform, sublicense and distribute the Original\r
+                       Code (or portions thereof) with or without Modifications, and/or\r
+                       as part of a Larger Work; and \r
+                       </P>\r
+                       <P>(b) under Patents Claims infringed by the making, using or\r
+                       selling of Original Code, to make, have made, use, practice, sell,\r
+                       and offer for sale, and/or otherwise dispose of the Original Code\r
+                       (or portions thereof). \r
+                       </P>\r
+                       <P>(c) the licenses granted in this Section 2.1(a) and (b) are\r
+                       effective on the date Initial Developer first distributes Original\r
+                       Code under the terms of this License. \r
+                       </P>\r
+                       <P>d) Notwithstanding Section 2.1(b) above, no patent license is\r
+                       granted:</P>\r
+                       <P>1) for code that You delete from the Original Code; \r
+                       </P>\r
+                       <P>2) separate from the Original Code; or \r
+                       </P>\r
+                       <P>3) for infringements caused by: \r
+                       </P>\r
+                       <P>i) the modification of the Original Code or \r
+                       </P>\r
+                       <P>ii) the combination of the Original Code with other software or\r
+                       devices. \r
+                       </P>\r
+                       <P><B>2.2. Contributor Grant.</B> Subject to third party\r
+                       intellectual property claims, each Contributor hereby grants You a\r
+                       world-wide, royalty-free, non-exclusive license \r
+                       </P>\r
+                       <P>(a) under intellectual property rights (other than patent or\r
+                       trademark) Licensable by Contributor, to use, reproduce, modify,\r
+                       display, perform, sublicense and distribute the Modifications\r
+                       created by such Contributor (or portions thereof) either on an\r
+                       unmodified basis, with other Modifications, as Covered Code and/or\r
+                       as part of a Larger Work; and \r
+                       </P>\r
+                       <P>(b) under Patent Claims infringed by the making, using, or\r
+                       selling of Modifications made by that Contributor either alone\r
+                       and/or in combination with its Contributor Version (or portions of\r
+                       such combination), to make, use, sell, offer for sale, have made,\r
+                       and/or otherwise dispose of: 1) Modifications made by that\r
+                       Contributor (or portions thereof); and 2) the combination of\r
+                       Modifications made by that Contributor with its Contributor\r
+                       Version (or portions of such combination). \r
+                       </P>\r
+                       <P>(c) the licenses granted in Sections 2.2(a) and 2.2(b) are\r
+                       effective on the date Contributor first makes Commercial Use of\r
+                       the Covered Code. \r
+                       </P>\r
+                       <P>(d) Notwithstanding Section 2.2(b) above, no patent license is\r
+                       granted: \r
+                       </P>\r
+                       <P>1) for any code that Contributor has deleted from the\r
+                       Contributor Version; \r
+                       </P>\r
+                       <P>2) separate from the Contributor Version; \r
+                       </P>\r
+                       <P>3) for infringements caused by: i) third party modifications of\r
+                       Contributor Version or \r
+                       </P>\r
+                       <P>ii) the combination of Modifications made by that Contributor\r
+                       with other software (except as part of the Contributor Version) or\r
+                       other devices; or \r
+                       </P>\r
+                       <P>4) under Patent Claims infringed by Covered Code in the absence\r
+                       of Modifications made by that Contributor. \r
+                       </P>\r
+                       <P>3. Distribution Obligations. \r
+                       </P>\r
+                       <P><B>3.1. Application of License.</B> The Modifications which You\r
+                       create or to which You contribute are governed by the terms of\r
+                       this License, including without limitation Section 2.2. The Source\r
+                       Code version of Covered Code may be distributed only under the\r
+                       terms of this License or a future version of this License released\r
+                       under Section 6.1, and You must include a copy of this License\r
+                       with every copy of the Source Code You distribute. You may not\r
+                       offer or impose any terms on any Source Code version that alters\r
+                       or restricts the applicable version of this License or the\r
+                       recipients' rights hereunder. However, You may include an\r
+                       additional document offering the additional rights described in\r
+                       Section 3.5.</P>\r
+                       <P><B>3.2. Availability of Source Code</B>. Any Modification which\r
+                       You create or to which You contribute must be made available in\r
+                       Source Code form under the terms of this License either on the\r
+                       same media as an Executable version or via an accepted Electronic\r
+                       Distribution Mechanism to anyone to whom you made an Executable\r
+                       version available; and if made available via Electronic\r
+                       Distribution Mechanism, must remain available for at least twelve\r
+                       (12) months after the date it initially became available, or at\r
+                       least six (6) months after a subsequent version of that particular\r
+                       Modification has been made available to such recipients. You are\r
+                       responsible for ensuring that the Source Code version remains\r
+                       available even if the Electronic Distribution Mechanism is\r
+                       maintained by a third party. \r
+                       </P>\r
+                       <P><B>3.3. Description of Modifications.</B> You must cause all\r
+                       Covered Code to which You contribute to contain a file documenting\r
+                       the changes You made to create that Covered Code and the date of\r
+                       any change. You must include a prominent statement that the\r
+                       Modification is derived, directly or indirectly, from Original\r
+                       Code provided by the Initial Developer and including the name of\r
+                       the Initial Developer in \r
+                       </P>\r
+                       <P>(a) the Source Code, and \r
+                       </P>\r
+                       <P>(b) in any notice in an Executable version or related\r
+                       documentation in which You describe the origin or ownership of the\r
+                       Covered Code.</P>\r
+                       <P><B>3.4. Intellectual Property Matters </B>\r
+                       </P>\r
+                       <P>a) Third Party Claims. If Contributor has knowledge that a\r
+                       license under a third party's intellectual property rights is\r
+                       required to exercise the rights granted by such Contributor under\r
+                       Sections 2.1 or 2.2, Contributor must include a text file with the\r
+                       Source Code distribution titled &quot;LEGAL'' which describes the\r
+                       claim and the party making the claim in sufficient detail that a\r
+                       recipient will know whom to contact. If Contributor obtains such\r
+                       knowledge after the Modification is made available as described in\r
+                       Section 3.2, Contributor shall promptly modify the LEGAL file in\r
+                       all copies Contributor makes available thereafter and shall take\r
+                       other steps (such as notifying appropriate mailing lists or\r
+                       newsgroups) reasonably calculated to inform those who received the\r
+                       Covered Code that new knowledge has been obtained. \r
+                       </P>\r
+                       <P>(b) Contributor APIs. If Contributor's Modifications include an\r
+                       application programming interface and Contributor has knowledge of\r
+                       patent licenses which are reasonably necessary to implement that\r
+                       API, Contributor must also include this information in the LEGAL\r
+                       file. \r
+                       </P>\r
+                       <P>(c) Representations. Contributor represents that, except as\r
+                       disclosed pursuant to Section 3.4(a) above, Contributor believes\r
+                       that Contributor's Modifications are Contributor's original\r
+                       creation(s) and/or Contributor has sufficient rights to grant the\r
+                       rights conveyed by this License. \r
+                       </P>\r
+                       <P><B>3.5. Required Notices.</B> You must duplicate the notice in\r
+                       Exhibit A in each file of the Source Code. If it is not possible\r
+                       to put such notice in a particular Source Code file due to its\r
+                       structure, then You must include such notice in a location (such\r
+                       as a relevant directory) where a user would be likely to look for\r
+                       such a notice. If You created one or more Modification(s) You may\r
+                       add your name as a Contributor to the notice described in Exhibit\r
+                       A. You must also duplicate this License in any documentation for\r
+                       the Source Code where You describe recipients' rights or ownership\r
+                       rights relating to Covered Code. You may choose to offer, and to\r
+                       charge a fee for, warranty, support, indemnity or liability\r
+                       obligations to one or more recipients of Covered Code. However,\r
+                       You may do so only on Your own behalf, and not on behalf of the\r
+                       Initial Developer or any Contributor. You must make it absolutely\r
+                       clear than any such warranty, support, indemnity or liability\r
+                       obligation is offered by You alone, and You hereby agree to\r
+                       indemnify the Initial Developer and every Contributor for any\r
+                       liability incurred by the Initial Developer or such Contributor as\r
+                       a result of warranty, support, indemnity or liability terms You\r
+                       offer. \r
+                       </P>\r
+                       <P><B>3.6. Distribution of Executable Versions.</B> You may\r
+                       distribute Covered Code in Executable form only if the\r
+                       requirements of Section 3.1-3.5 have been met for that Covered\r
+                       Code, and if You include a notice stating that the Source Code\r
+                       version of the Covered Code is available under the terms of this\r
+                       License, including a description of how and where You have\r
+                       fulfilled the obligations of Section 3.2. The notice must be\r
+                       conspicuously included in any notice in an Executable version,\r
+                       related documentation or collateral in which You describe\r
+                       recipients' rights relating to the Covered Code. You may\r
+                       distribute the Executable version of Covered Code or ownership\r
+                       rights under a license of Your choice, which may contain terms\r
+                       different from this License, provided that You are in compliance\r
+                       with the terms of this License and hat the license for the\r
+                       Executable version does not attempt to limit or alter the\r
+                       recipient's rights in the Source Code version from the rights set\r
+                       forth in this License. If You distribute the Executable version\r
+                       under a different license You must make it absolutely clear that\r
+                       any terms which differ from this License are offered by You alone,\r
+                       not by the Initial Developer or any Contributor. You hereby agree\r
+                       to indemnify the Initial Developer and every Contributor for any\r
+                       liability incurred by the Initial Developer or such Contributor as\r
+                       a result of any such terms You offer. \r
+                       </P>\r
+                       <P><B>3.7. Larger Works.</B> You may create a Larger Work by\r
+                       combining Covered Code with other code not governed by the terms\r
+                       of this License and distribute the Larger Work as a single\r
+                       product. In such a case, You must make sure the requirements of\r
+                       this License are fulfilled for the Covered Code. \r
+                       </P>\r
+                       <P>4. Inability to Comply Due to Statute or Regulation. \r
+                       </P>\r
+                       <P>If it is impossible for You to comply with any of the terms of\r
+                       this License with respect to some or all of the Covered Code due\r
+                       to statute, judicial order, or regulation then You must: \r
+                       </P>\r
+                       <P>(a) comply with the terms of this License to the maximum extent\r
+                       possible; and \r
+                       </P>\r
+                       <P>(b) describe the limitations and the code they affect. Such\r
+                       description must be included in the LEGAL file described in\r
+                       Section 3.4 and must be included with all distributions of the\r
+                       Source Code. Except to the extent prohibited by statute or\r
+                       regulation, such description must be sufficiently detailed for a\r
+                       recipient of ordinary skill to be able to understand it. \r
+                       </P>\r
+                       <P>5. Application of this License.</P>\r
+                       <P>This License applies to code to which the Initial Developer has\r
+                       attached the notice in Exhibit A and to related Covered Code. \r
+                       </P>\r
+                       <P>6. Versions of the License. \r
+                       </P>\r
+                       <P><B>6.1. New Versions.</B> The Initial Developer of this code\r
+                       may publish revised and/or new versions of the License from time\r
+                       to time. Each version will be given a distinguishing version\r
+                       number. \r
+                       </P>\r
+                       <P><B>6.2. Effect of New Versions.</B> Once Covered Code has been\r
+                       published under a particular version of the License, You may\r
+                       always continue to use it under the terms of that version. You may\r
+                       also choose to use such Covered Code under the terms of any\r
+                       subsequent version of the License published by the Initial\r
+                       Developer. No one other than the Initial Developer has the right\r
+                       to modify the terms applicable to Covered Code created under this\r
+                       License. \r
+                       </P>\r
+                       <P><B>6.3. Derivative Works.</B> If You create or use a modified\r
+                       version of this License (which you may only do in order to apply\r
+                       it to code which is not already Covered Code governed by this\r
+                       License), You must \r
+                       </P>\r
+                       <P>(a) rename Your license so that the phrases ''Mozilla'',\r
+                       ''MOZILLAPL'', ''MOZPL'', ''Netscape'', &quot;MPL&quot;, ''NPL&quot;,\r
+                       or any confusingly similar phrases do not appear in your license\r
+                       (except to note that your license differs from this License) and \r
+                       </P>\r
+                       <P>(b) otherwise make it clear that Your version of the license\r
+                       contains terms which differ from the Mozilla Public License and\r
+                       Netscape Public License. (Filling in the name of the Initial\r
+                       Developer, Original Code or Contributor in the notice described in\r
+                       Exhibit A shall not of themselves be deemed to be modifications of\r
+                       this License.) \r
+                       </P>\r
+                       <P><B>6.4 Origin of the Initial Developer's Public License.</B>\r
+                       The Initial Developer's Public License is based on the Mozilla\r
+                       Public License V 1.1 with the following changes: \r
+                       </P>\r
+                       <P>1) The license is published by the Initial Developer of this\r
+                       code. Only the Initial Developer can modify the terms applicable\r
+                       to Covered Code. \r
+                       </P>\r
+                       <P>2) The license can be modified and used for code which is not\r
+                       already governed by this license. Modified versions of the license\r
+                       must be renamed to avoid confusion with Netscape's license Initial\r
+                       Developer's's license and must include a description of changes\r
+                       from the Initial Developer's Public License. \r
+                       </P>\r
+                       <P>3) The name of the license in Exhibit A is the &quot;Initial\r
+                       Developer's Public License&quot;. \r
+                       </P>\r
+                       <P>4) The reference to an alternative license in Exhibit A has\r
+                       been removed . \r
+                       </P>\r
+                       <P>5) Amendments I, II, III, V, and VI have been deleted. \r
+                       </P>\r
+                       <P>6) Exhibit A, Netscape Public License has been deleted \r
+                       </P>\r
+                       <P>7. DISCLAIMER OF WARRANTY. \r
+                       </P>\r
+                       <P>COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN &quot;AS IS''\r
+                       BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,\r
+                       INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS\r
+                       FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR\r
+                       NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE\r
+                       OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE\r
+                       DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY\r
+                       OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,\r
+                       REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN\r
+                       ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS\r
+                       AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.</P>\r
+                       <P>8. TERMINATION. \r
+                       </P>\r
+                       <P>8.1. This License and the rights granted hereunder will\r
+                       terminate automatically if You fail to comply with terms herein\r
+                       and fail to cure such breach within 30 days of becoming aware of\r
+                       the breach. All sublicenses to the Covered Code which are properly\r
+                       granted shall survive any termination of this License. Provisions\r
+                       which, by their nature, must remain in effect beyond the\r
+                       termination of this License shall survive. \r
+                       </P>\r
+                       <P>8.2. If You initiate litigation by asserting a patent\r
+                       infringement claim (excluding declatory judgment actions) against\r
+                       Initial Developer or a Contributor (the Initial Developer or\r
+                       Contributor against whom You file such action is referred to as\r
+                       &quot;Participant&quot;) alleging that: \r
+                       </P>\r
+                       <P>(a) such Participant's Contributor Version directly or\r
+                       indirectly infringes any patent, then any and all rights granted\r
+                       by such Participant to You under Sections 2.1 and/or 2.2 of this\r
+                       License shall, upon 60 days notice from Participant terminate\r
+                       prospectively, unless if within 60 days after receipt of notice\r
+                       You either: \r
+                       </P>\r
+                       <P>(i) agree in writing to pay Participant a mutually agreeable\r
+                       reasonable royalty for Your past and future use of Modifications\r
+                       made by such Participant, or</P>\r
+                       <P>(ii) withdraw Your litigation claim with respect to the\r
+                       Contributor Version against such Participant. \r
+                       </P>\r
+                       <P>If within 60 days of notice, a reasonable royalty and payment\r
+                       arrangement are not mutually agreed upon in writing by the parties\r
+                       or the litigation claim is not withdrawn, the rights granted by\r
+                       Participant to You under Sections 2.1 and/or 2.2 automatically\r
+                       terminate at the expiration of the 60 day notice period specified\r
+                       above.</P>\r
+                       <P>(b) any software, hardware, or device, other than such\r
+                       Participant's Contributor Version, directly or indirectly\r
+                       infringes any patent, then any rights granted to You by such\r
+                       Participant under Sections 2.1(b) and 2.2(b) are revoked effective\r
+                       as of the date You first made, used, sold, distributed, or had\r
+                       made, Modifications made by that Participant. \r
+                       </P>\r
+                       <P>8.3. If You assert a patent infringement claim against\r
+                       Participant alleging that such Participant's Contributor Version\r
+                       directly or indirectly infringes any patent where such claim is\r
+                       resolved (such as by license or settlement) prior to the\r
+                       initiation of patent infringement litigation, then the reasonable\r
+                       value of the licenses granted by such Participant under Sections\r
+                       2.1 or 2.2 shall be taken into account in determining the amount\r
+                       or value of any payment or license. \r
+                       </P>\r
+                       <P>8.4. In the event of termination under Sections 8.1 or 8.2\r
+                       above, all end user license agreements (excluding distributors and\r
+                       resellers) which have been validly granted by You or any\r
+                       distributor hereunder prior to termination shall survive\r
+                       termination. \r
+                       </P>\r
+                       <P>9. LIMITATION OF LIABILITY.</P>\r
+                       <P>UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT\r
+                       (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE\r
+                       INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF\r
+                       COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO\r
+                       ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL\r
+                       DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES\r
+                       FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR\r
+                       MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES,\r
+                       EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF\r
+                       SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO\r
+                       LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S\r
+                       NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION.\r
+                       SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF\r
+                       INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND\r
+                       LIMITATION MAY NOT APPLY TO YOU. \r
+                       </P>\r
+                       <P>10. U.S. GOVERNMENT END USERS. \r
+                       </P>\r
+                       <P>The Covered Code is a ''commercial item,'' as that term is\r
+                       defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of ''commercial\r
+                       computer software'' and ''commercial computer software\r
+                       documentation,'' as such terms are used in 48 C.F.R. 12.212 (Sept.\r
+                       1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1\r
+                       through 227.7202-4 (June 1995), all U.S. Government End Users\r
+                       acquire Covered Code with only those rights set forth herein. \r
+                       </P>\r
+                       <P>11. MISCELLANEOUS. \r
+                       </P>\r
+                       <P>This License represents the complete agreement concerning\r
+                       subject matter hereof. If any provision of this License is held to\r
+                       be unenforceable, such provision shall be reformed only to the\r
+                       extent necessary to make it enforceable. This License shall be\r
+                       governed by California law provisions (except to the extent\r
+                       applicable law, if any, provides otherwise), excluding its\r
+                       conflict-of-law provisions. With respect to disputes in which at\r
+                       least one party is a citizen of, or an entity chartered or\r
+                       registered to do business in the United States of America, any\r
+                       litigation relating to this License shall be subject to the\r
+                       jurisdiction of the Federal Courts of the Northern District of\r
+                       California, with venue lying in Santa Clara County, California,\r
+                       with the losing party responsible for costs, including without\r
+                       limitation, court costs and reasonable attorneys' fees and\r
+                       expenses. The application of the United Nations Convention on\r
+                       Contracts for the International Sale of Goods is expressly\r
+                       excluded. Any law or regulation which provides that the language\r
+                       of a contract shall be construed against the drafter shall not\r
+                       apply to this License. \r
+                       </P>\r
+                       <P>12. RESPONSIBILITY FOR CLAIMS. \r
+                       </P>\r
+                       <P>As between Initial Developer and the Contributors, each party\r
+                       is responsible for claims and damages arising, directly or\r
+                       indirectly, out of its utilization of rights under this License\r
+                       and You agree to work with Initial Developer and Contributors to\r
+                       distribute such responsibility on an equitable basis. Nothing\r
+                       herein is intended or shall be deemed to constitute any admission\r
+                       of liability. \r
+                       </P>\r
+                       <P>13. MULTIPLE-LICENSED CODE. \r
+                       </P>\r
+                       <P>Initial Developer may designate portions of the Covered Code as\r
+                       &quot;Multiple-Licensed&quot;. &quot;Multiple-Licensed&quot; means\r
+                       that the Initial Devpoeloper permits you to utilize portions of\r
+                       the Covered Code under Your choice of the IDPL or the alternative\r
+                       licenses, if any, specified by the Initial Developer in the file\r
+                       described in Exhibit A. \r
+                       </P>\r
+                       <P><B>EXHIBIT A</B> -Initial Developer's Public License. \r
+                       </P>\r
+                       <P>The contents of this file are subject to the Initial\r
+                       Developer's Public License Version 1.0 (the &quot;License&quot;);\r
+                       you may not use this file except in compliance with the License.\r
+                       You may obtain a copy of the License <A HREF="http://www.ibphoenix.com/main.nfs?a=ibphoenix&amp;page=ibp_idpl">here.</A></P>\r
+                       <P>Software distributed under the License is distributed on an &quot;AS\r
+                       IS&quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or\r
+                       implied. See the License for the specific language governing\r
+                       rights and limitations under the License. \r
+                       </P>\r
+                       <P>The Original Code is ______________________________________. \r
+                       </P>\r
+                       <P>The Initial Developer of the Original Code is\r
+                       ________________________. \r
+                       </P>\r
+                       <P>Portions created by ______________________ <BR>are Copyright\r
+                       (C) ______ _______________________. \r
+                       </P>\r
+                       <P>All Rights Reserved. \r
+                       </P>\r
+                       <P>Contributor(s): ______________________________________. \r
+                       </P>\r
+               </TD>\r
+       </TR>\r
+</TABLE>\r
+<P><BR><BR>\r
+</P>\r
+</BODY>\r
 </HTML>
\ No newline at end of file
index 1b125471954564064a7dcfd9e528d0a68da48f6d..0330568dcf6bcce9a46ca541c7d15fcebec7bfa6 100644 (file)
-Initial Developer's PUBLIC LICENSE Version 1.0\r
-\r
-1. Definitions\r
-\r
-1.0 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party.\r
-\r
-1.1 ''Contributor'' means each entity that creates or contributes to the creation of Modifications.\r
-\r
-1.2 ''Contributor Version'' means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.\r
-\r
-1.3. ''Covered Code'' means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.\r
-\r
-1.4. ''Electronic Distribution Mechanism'' means a mechanism generally accepted in the software development community for the electronic transfer of data.\r
-\r
-1.5. ''Executable'' means Covered Code in any form other than Source Code.\r
-\r
-1.6. ''Initial Developer'' means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.\r
-\r
-1.7. ''Larger Work'' means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.\r
-\r
-1.8. ''License'' means this document.\r
-\r
-1.8.1. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.\r
-\r
-1.9. ''Modifications'' means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:\r
-\r
-Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.\r
-\r
-Any new file that contains any part of the Original Code or previous Modifications.\r
-\r
-1.10. ''Original Code'' means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.\r
-\r
-1.10.1. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.\r
-\r
-1.11. ''Source Code'' means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.\r
-\r
-1.12. "You'' (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You'' includes any entity w hich controls, is controlled by, or is under common control with You. For purposes of this definition, "control'' means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.\r
-\r
-2. Source Code License.\r
-\r
-2.1. The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:\r
-\r
-(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and\r
-\r
-(b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).\r
-\r
-(c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License.\r
-\r
-d) Notwithstanding Section 2.1(b) above, no patent license is granted:\r
-\r
-1) for code that You delete from the Original Code;\r
-\r
-2) separate from the Original Code; or\r
-\r
-3) for infringements caused by:\r
-\r
-i) the modification of the Original Code or\r
-\r
-ii) the combination of the Original Code with other software or devices.\r
-\r
-2.2. Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license\r
-\r
-(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and\r
-\r
-(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).\r
-\r
-(c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code.\r
-\r
-(d) Notwithstanding Section 2.2(b) above, no patent license is granted:\r
-\r
-1) for any code that Contributor has deleted from the Contributor Version;\r
-\r
-2) separate from the Contributor Version;\r
-\r
-3) for infringements caused by: i) third party modifications of Contributor Version or\r
-\r
-ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or\r
-\r
-4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.\r
-\r
-3. Distribution Obligations.\r
-\r
-3.1. Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.\r
-\r
-3.2. Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.\r
-\r
-3.3. Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in\r
-\r
-(a) the Source Code, and\r
-\r
-(b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.\r
-\r
-3.4. Intellectual Property Matters\r
-\r
-a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL'' which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.\r
-\r
-(b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file.\r
-\r
-(c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.\r
-\r
-3.5. Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.\r
-\r
-3.6. Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and hat the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.\r
-\r
-3.7. Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.\r
-\r
-4. Inability to Comply Due to Statute or Regulation.\r
-\r
-If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must:\r
-\r
-(a) comply with the terms of this License to the maximum extent possible; and\r
-\r
-(b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.\r
-\r
-5. Application of this License.\r
-\r
-This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.\r
-\r
-6. Versions of the License.\r
-\r
-6.1. New Versions. The Initial Developer of this code may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.\r
-\r
-6.2. Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by the Initial Developer. No one other than the Initial Developer has the right to modify the terms applicable to Covered Code created under this License.\r
-\r
-6.3. Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must\r
-\r
-(a) rename Your license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'', ''Netscape'', "MPL", ''NPL", or any confusingly similar phrases do not appear in your license (except to note that your license differs from this License) and\r
-\r
-(b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)\r
-\r
-6.4 Origin of the Initial Developer's Public License. The Initial Developer's Public License is based on the Mozilla Public License V 1.1 with the following changes:\r
-\r
-1) The license is published by the Initial Developer of this code. Only the Initial Developer can modify the terms applicable to Covered Code.\r
-\r
-2) The license can be modified and used for code which is not already governed by this license. Modified versions of the license must be renamed to avoid confusion with Netscape's license Initial Developer's's license and must include a description of changes from the Initial Developer's Public License.\r
-\r
-3) The name of the license in Exhibit A is the "Initial Developer's Public License".\r
-\r
-4) The reference to an alternative license in Exhibit A has been removed .\r
-\r
-5) Amendments I, II, III, V, and VI have been deleted.\r
-\r
-6) Exhibit A, Netscape Public License has been deleted\r
-\r
-7. DISCLAIMER OF WARRANTY.\r
-\r
-COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.\r
-\r
-8. TERMINATION.\r
-\r
-8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.\r
-\r
-8.2. If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that:\r
-\r
-(a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either:\r
-\r
-(i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or\r
-\r
-(ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant.\r
-\r
-If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above.\r
-\r
-(b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant.\r
-\r
-8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.\r
-\r
-8.4. In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.\r
-\r
-9. LIMITATION OF LIABILITY.\r
-\r
-UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.\r
-\r
-10. U.S. GOVERNMENT END USERS.\r
-\r
-The Covered Code is a ''commercial item,'' as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and ''commercial computer software documentation,'' as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.\r
-\r
-11. MISCELLANEOUS.\r
-\r
-This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.\r
-\r
-12. RESPONSIBILITY FOR CLAIMS.\r
-\r
-As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.\r
-\r
-13. MULTIPLE-LICENSED CODE.\r
-\r
-Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Devpoeloper permits you to utilize portions of the Covered Code under Your choice of the IDPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A.\r
-\r
-EXHIBIT A -Initial Developer's Public License.\r
-\r
-The contents of this file are subject to the Initial Developer's Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License here.\r
-\r
-Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.\r
-\r
-The Original Code is ______________________________________.\r
-\r
-The Initial Developer of the Original Code is ________________________.\r
-\r
-Portions created by ______________________\r
-are Copyright (C) ______ _______________________.\r
-\r
-All Rights Reserved.\r
-\r
+Initial Developer's PUBLIC LICENSE Version 1.0
+
+1. Definitions
+
+1.0 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party.
+
+1.1 ''Contributor'' means each entity that creates or contributes to the creation of Modifications.
+
+1.2 ''Contributor Version'' means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
+
+1.3. ''Covered Code'' means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
+
+1.4. ''Electronic Distribution Mechanism'' means a mechanism generally accepted in the software development community for the electronic transfer of data.
+
+1.5. ''Executable'' means Covered Code in any form other than Source Code.
+
+1.6. ''Initial Developer'' means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.
+
+1.7. ''Larger Work'' means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
+
+1.8. ''License'' means this document.
+
+1.8.1. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
+
+1.9. ''Modifications'' means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:
+
+Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
+
+Any new file that contains any part of the Original Code or previous Modifications.
+
+1.10. ''Original Code'' means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
+
+1.10.1. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
+
+1.11. ''Source Code'' means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
+
+1.12. "You'' (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You'' includes any entity w hich controls, is controlled by, or is under common control with You. For purposes of this definition, "control'' means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
+
+2. Source Code License.
+
+2.1. The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
+
+(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and
+
+(b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).
+
+(c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License.
+
+d) Notwithstanding Section 2.1(b) above, no patent license is granted:
+
+1) for code that You delete from the Original Code;
+
+2) separate from the Original Code; or
+
+3) for infringements caused by:
+
+i) the modification of the Original Code or
+
+ii) the combination of the Original Code with other software or devices.
+
+2.2. Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license
+
+(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
+
+(c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code.
+
+(d) Notwithstanding Section 2.2(b) above, no patent license is granted:
+
+1) for any code that Contributor has deleted from the Contributor Version;
+
+2) separate from the Contributor Version;
+
+3) for infringements caused by: i) third party modifications of Contributor Version or
+
+ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or
+
+4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.
+
+3.2. Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
+
+3.3. Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in
+
+(a) the Source Code, and
+
+(b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
+
+3.4. Intellectual Property Matters
+
+a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL'' which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.
+
+(b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file.
+
+(c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.
+
+3.5. Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
+
+3.6. Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and hat the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
+
+3.7. Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must:
+
+(a) comply with the terms of this License to the maximum extent possible; and
+
+(b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
+
+5. Application of this License.
+
+This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+6.1. New Versions. The Initial Developer of this code may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.
+
+6.2. Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by the Initial Developer. No one other than the Initial Developer has the right to modify the terms applicable to Covered Code created under this License.
+
+6.3. Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must
+
+(a) rename Your license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'', ''Netscape'', "MPL", ''NPL", or any confusingly similar phrases do not appear in your license (except to note that your license differs from this License) and
+
+(b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
+
+6.4 Origin of the Initial Developer's Public License. The Initial Developer's Public License is based on the Mozilla Public License V 1.1 with the following changes:
+
+1) The license is published by the Initial Developer of this code. Only the Initial Developer can modify the terms applicable to Covered Code.
+
+2) The license can be modified and used for code which is not already governed by this license. Modified versions of the license must be renamed to avoid confusion with Netscape's license Initial Developer's's license and must include a description of changes from the Initial Developer's Public License.
+
+3) The name of the license in Exhibit A is the "Initial Developer's Public License".
+
+4) The reference to an alternative license in Exhibit A has been removed .
+
+5) Amendments I, II, III, V, and VI have been deleted.
+
+6) Exhibit A, Netscape Public License has been deleted
+
+7. DISCLAIMER OF WARRANTY.
+
+COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
+
+8.2. If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that:
+
+(a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either:
+
+(i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or
+
+(ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant.
+
+If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above.
+
+(b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant.
+
+8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.
+
+8.4. In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+The Covered Code is a ''commercial item,'' as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and ''commercial computer software documentation,'' as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
+
+11. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Devpoeloper permits you to utilize portions of the Covered Code under Your choice of the IDPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Initial Developer's Public License.
+
+The contents of this file are subject to the Initial Developer's Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License here.
+
+Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
+
+The Original Code is ______________________________________.
+
+The Initial Developer of the Original Code is ________________________.
+
+Portions created by ______________________
+are Copyright (C) ______ _______________________.
+
+All Rights Reserved.
+
 Contributor(s): ______________________________________. 
\ No newline at end of file
index 27dc7ffc270d1f0a8e5fd440e5e0141bca00bf28..9eaa40836fe9be333c06a20e6713a34e699d2a29 100644 (file)
@@ -1,81 +1,81 @@
-Firebird ADO.NET Data provider for .NET and Mono \r
-================================================\r
-\r
-This project is supported by:\r
----- ------- -- --------- ---\r
-\r
-       Sean Leyne ( Broadview Software )\r
-\r
-\r
-Developement list\r
------------------\r
-\r
-You can subscribe to the developement list at:\r
-\r
-       http://lists.sourceforge.net/lists/listinfo/firebird-net-provider\r
-\r
-\r
-You can access to the lastest developement sources through CVS, see:\r
-\r
-       http://sourceforge.net/cvs/?group_id=9028\r
-\r
-\r
-Reporting Bugs\r
---------------\r
-\r
-Yo can report bugs using two ways:\r
-\r
-1. Sending it to the developement list.\r
-2. If you have a Sourceforge ID you can send it using the Bugs section of the Firebird Project web page \r
-(category .Net Provider):\r
-\r
-\r
-       http://sourceforge.net/tracker/?group_id=9028&atid=109028\r
-\r
-\r
-Requirements for build the sources on Windows\r
----------------------------------------------\r
-\r
-- The Microsoft .NET Framework or Mono:: platform.\r
-\r
-\r
-Build with Microsoft .NET Framework:\r
-\r
-       - You need the Microsoft .NET Platform.\r
-\r
-       - The provider sources have a build file for NAnt ( http://nant.sourceforge.net/ ), \r
-       FirebirdNetProvider.build.\r
-\r
-       For build it you only need to exececute nant (0.85) on the same directory as the build file.\r
-\r
-       - The Nant build file generates (inside framework version directory net-1.0, net-1.1, ...):\r
-\r
-                       1.- FirebirdSql.Data.Firebird.dll ( binary of the ADO .NET data provider )\r
-                       2.- FirebirdSql.Data.Firebird.UnitTest.dll ( binary of the NUnit tests. )\r
-                       3.- MSDN style documentation.\r
-\r
-\r
-Build with mono:: platform ( www.go-mono.com ):\r
-\r
-       - The mono platform with ICU support.\r
-\r
-       - The provider sources have a build file, makefile, for build the sources ( this script file needs Cygwin ).\r
-\r
-       - The makefile build file generates:\r
-\r
-               1.- FirebirdSql.Data.Firebird.dll ( binary of the ado .net provider )\r
-\r
-       Note : You can build it using NAnt too, for this you need to modify the NAnt script changing the build \r
-       file for allow it.\r
-\r
-\r
-\r
-Requirements for build the sources on Linux\r
--------------------------------------------\r
-\r
-Build with mono:: platform ( www.go-mono.com ):\r
-\r
-       - The mono platform with ICU support.\r
-\r
-       - The provider sources have a build file, makefile, for build the sources, you only need to execute make on the same\r
-       directory as the script.\r
+Firebird ADO.NET Data provider for .NET and Mono 
+================================================
+
+This project is supported by:
+---- ------- -- --------- ---
+
+       Sean Leyne ( Broadview Software )
+
+
+Developement list
+-----------------
+
+You can subscribe to the developement list at:
+
+       http://lists.sourceforge.net/lists/listinfo/firebird-net-provider
+
+
+You can access to the lastest developement sources through CVS, see:
+
+       http://sourceforge.net/cvs/?group_id=9028
+
+
+Reporting Bugs
+--------------
+
+Yo can report bugs using two ways:
+
+1. Sending it to the developement list.
+2. If you have a Sourceforge ID you can send it using the Bugs section of the Firebird Project web page 
+(category .Net Provider):
+
+
+       http://sourceforge.net/tracker/?group_id=9028&atid=109028
+
+
+Requirements for build the sources on Windows
+---------------------------------------------
+
+- The Microsoft .NET Framework or Mono:: platform.
+
+
+Build with Microsoft .NET Framework:
+
+       - You need the Microsoft .NET Platform.
+
+       - The provider sources have a build file for NAnt ( http://nant.sourceforge.net/ ), 
+       FirebirdNetProvider.build.
+
+       For build it you only need to exececute nant (0.85) on the same directory as the build file.
+
+       - The Nant build file generates (inside framework version directory net-1.0, net-1.1, ...):
+
+                       1.- FirebirdSql.Data.Firebird.dll ( binary of the ADO .NET data provider )
+                       2.- FirebirdSql.Data.Firebird.UnitTest.dll ( binary of the NUnit tests. )
+                       3.- MSDN style documentation.
+
+
+Build with mono:: platform ( www.go-mono.com ):
+
+       - The mono platform with ICU support.
+
+       - The provider sources have a build file, makefile, for build the sources ( this script file needs Cygwin ).
+
+       - The makefile build file generates:
+
+               1.- FirebirdSql.Data.Firebird.dll ( binary of the ado .net provider )
+
+       Note : You can build it using NAnt too, for this you need to modify the NAnt script changing the build 
+       file for allow it.
+
+
+
+Requirements for build the sources on Linux
+-------------------------------------------
+
+Build with mono:: platform ( www.go-mono.com ):
+
+       - The mono platform with ICU support.
+
+       - The provider sources have a build file, makefile, for build the sources, you only need to execute make on the same
+       directory as the script.
index bcc3d7f1d4167031c66b78ffc457c0f0583bee99..81da9e5aafb3595712ee1683ae0ddeba695559a9 100644 (file)
@@ -3,7 +3,7 @@ using System.Text;
 
 namespace I18N.CJK
 {
-       public class CP50221Encoding : Encoding
+       public class CP50221 : Encoding
        {
                static JISConvert convert = JISConvert.Convert;
 
@@ -11,10 +11,6 @@ namespace I18N.CJK
                        get { return "iso-2022-jp"; }
                }
 
-               public override int CodePage {
-                       get { return 50221; }
-               }
-
                public override string HeaderName {
                        get { return "iso-2022-jp"; }
                }
@@ -288,7 +284,7 @@ namespace I18N.CJK
                }
        }
 
-       public class ENCiso_2022_jp : CP50221Encoding
+       public class ENCiso_2022_jp : CP50221
        {
                public ENCiso_2022_jp () : base() {}
 
index b1c5980f9142d7635044c1616c30e1c91e58c1bb..05dcf3b72b11fd8d62ec01c8754c6e474ae5b0a5 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-18  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * CP50221.cs, GB18030Encoding.cs : because of silly design
+         Common/Manager expects fixed class names CPxxxxx. Fixed bug #76139.
+
 2005-08-22  Raja R Harinath  <rharinath@novell.com>
 
        * Makefile (EXTRA_DISTFILES): Add README.gb18030 and gb18030.table.
index 99fabe28a528ce91029becb9ebe4520d67f02774..dc05b22926520a2c67e7980050e51fcdba179e78 100644 (file)
@@ -15,6 +15,8 @@ namespace I18N.CJK
                public ENCgb18030 (): base () {}
        }
 
+       public class CP54936 : GB18030Encoding { }
+
        public class GB18030Encoding : Encoding
        {
                // Constructor.
index 2ccbcc4b5401ac550ce84d7d61ff626fba1d59e7..99674f8bd24c0e944c0e54c23746f67548ab1483 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-18  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Handler.cs : Required changes wrt some class renames.
+
 2005-08-19  Atsushi Enomoto  <atsushi@ximian.com>
 
        why didn't we have it? ;-)
index 2eea8f4af59245c2da4a4d955e56ce1b08f86f13..651459e006bf91d2b9d68d257c3778a582f53e7e 100644 (file)
@@ -41,6 +41,7 @@ public sealed class Handlers
         "I18N.CJK.CP950",
         "I18N.CJK.CP50221",
         "I18N.CJK.CP51932",
+        "I18N.CJK.CP54936",
         "I18N.CJK.ENCbig5",
         "I18N.CJK.ENCgb2312",
         "I18N.CJK.ENCshift_jis",
@@ -48,7 +49,6 @@ public sealed class Handlers
         "I18N.CJK.ENCeuc_jp",
         "I18N.CJK.ENCuhc",
         "I18N.CJK.ENCgb18030",
-        "I18N.CJK.GB18030Encoding",
         "I18N.MidEast.CP1254",
         "I18N.MidEast.ENCwindows_1254",
         "I18N.MidEast.CP1255",
index a8636bf30970e56501ee29ec7de7c651990dce68..7ff1dd0b79cbfb4473e44f3a3398627ac7311df2 100644 (file)
@@ -73,7 +73,8 @@ SUBDIRS = \
        Microsoft.Vsa                   \
        Mono.Cairo                      \
        IBM.Data.DB2                    \
-       Microsoft.JScript       
+       Microsoft.JScript               \
+       FirebirdSql.Data.Firebird
 
 # Starting with Microsoft.Vsa, the libraries above weren't in the
 # Linux makefile.gnu before, but they build fine, so might as well
index 265ef49aff5477bb507ac3f5bf3413927f69da56..284f282ab941e93db6b89113ce5a7c045541da9e 100644 (file)
@@ -1,3 +1,41 @@
+2005-09-20  Ritvik Mayank  <mritvik@novell.com>
+
+        * System.Windows.Forms_test.dll.sources : Added pictureBoxTest.cs
+
+2005-09-09 Jonathan Chambers  <jonathan.chambers@ansys.com>
+
+       * System.Windows.Forms.dll.sources: Added IRootGridEntry.cs and PropertyGridCommands.cs
+
+2005-09-09  Hisham Mardam Bey  <hisham.mardambey@gmail.com>
+
+        * Test/System.Windows.Forms/LabelTest.cs : More tests. 
+
+2005-09-09  Hisham Mardam Bey  <hisham.mardambey@gmail.com>
+
+        * Test/System.Windows.Forms/LabelTest.cs : new Label tests (incomplete)
+        * System.Windows.Forms_test.dll.sources : add new tests
+        * System.Windows.Forms/Label.cs : give FlatStyle a default value
+         of FlatStyle.Standard.
+
+2005-09-08  Ritvik Mayank  <mritvik@novell.com>
+       
+       * System.Windows.Forms_test.dll.sources : added MonthCalendarTest.cs
+
+2005-09-08  Peter Dennis Bartok  <pbartok@novell.com>
+
+       * System.Windows.Forms.dll.sources: Added RichTextBox.cs to build
+       * SWF.csproj: Updated
+
+2005-09-06 Jonathan Chambers  <jonathan.chambers@ansys.com>
+
+       * System.Windows.Forms.dll.sources: Added System.Windows.Forms.PropertiesTab.cs
+
+2005-09-04  Peter Dennis Bartok  <pbartok@novell.com>
+
+       * System.Windows.Forms.dll.sources: Added System.Windows.Forms.RTF
+         subdirectory to build
+       * SWF.csproj: Updated
+
 2005-08-29  Alexander Olk  <xenomorph2@onlinehome.de>
 
        * System.Windows.Forms.dll.sources: Added ThemeNice.cs
index 20c920c5cd2c614e3e0cb3b4c1d62da1971ace79..f23322dace5c8282a3e8a5677e452357ce7019e7 100644 (file)
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "System.Windows.Forms\PropertiesTab.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "System.Windows.Forms\PropertyGrid.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "System.Windows.Forms\RichTextBox.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "System.Windows.Forms\RichTextBoxFinds.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "System.Windows.Forms\ThemeNice.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "System.Windows.Forms\ThemeWin32Classic.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\Charcode.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\Charset.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\CharsetFlags.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\CharsetType.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\ClassDelegate.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\Color.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\DestinationDelegate.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\Font.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\KeysInit.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\KeyStruct.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\Major.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\Minor.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\RTF.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\RTFException.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\StandardCharCode.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\StandardCharName.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\Style.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\StyleElement.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\StyleType.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\TextMap.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms.RTF\TokenClass.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = ""
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
             </Include>
         </Files>
     </CSHARP>
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog
new file mode 100644 (file)
index 0000000..bc8404d
--- /dev/null
@@ -0,0 +1,36 @@
+2005-09-04  Peter Dennis Bartok  <pbartok@novell.com>
+
+       * Charcode.cs: Created; provides StandardCharCode <-> character 
+         translation
+       * Charset.cs: Created; provides two standard charsets, AnsiGeneral 
+         and AnsiSymbol
+       * CharsetFlags.cs: Created
+       * CharsetType.cs: Created
+       * ClassDelegate.cs: Created; allows consumer to register a callback
+         for RTF command classes
+       * Color.cs: Created; provides access to RTF-defined RGB color sets
+       * DestinationDelegate.cs: Created; allows consumer to register a
+         callback for Destination class types
+       * Font.cs: Created; provides access to RTF-defined font descriptions
+       * KeysInit.cs: Created; provides translation table from RTF keyword
+         to Major/Minor classes
+       * KeyStruct.cs: Created
+       * Major.cs: Created; describes available RTF command groups
+       * Minor.cs: Created; describes available 'arguments' for command groups
+       * README: Created
+       * RTF.cs: Created; contains main RTF parser code
+       * rtf.csproj: Created; provides Visual Studio project that allows to
+         use test this assembly via the included test.cs
+         to provide 
+       * RTFException.cs: Created; provides custom RTF exception class
+       * StandardCharCode.cs: Created
+       * StandardCharName.cs: Created
+       * Style.cs: Created; provides access to RTF-define styles
+       * StyleElement.cs: Created; provides support class to allow parsing
+         recursive styles
+       * StyleType.cs: Created
+       * test.cs: Test code showing use of RTF class (also acts as Main for
+         the included Visual Studio project)
+       * TextMap.cs: Created; allows to create simple translation table for
+         converting parsed RTF document to text; table-based
+       * TokenClass.cs: Created; describes all available RTF command classes
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs
new file mode 100644 (file)
index 0000000..600c744
--- /dev/null
@@ -0,0 +1,405 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.Collections;
+
+namespace System.Windows.Forms.RTF {
+       internal class Charcode {
+               #region Local Variables
+               private StandardCharCode[]      codes;
+               private Hashtable               reverse;
+               private int                     size;
+               #endregion      // Local Variables
+
+               #region Public Constructors
+               public Charcode() : this(256) {
+               }
+
+               private Charcode(int size) {
+                       this.size = size;
+                       this.codes = new StandardCharCode[size];
+                       this.reverse = new Hashtable(size);
+
+                       for (int i = 0; i < size; i++) {
+                               codes[i] = StandardCharCode.nothing;
+                       }
+               }
+               #endregion      // Public Constructors
+
+               #region Public Instance Properties
+               public int this[StandardCharCode c] {
+                       get {
+                               object obj;
+
+                               obj = reverse[c];
+                               if (obj != null) {
+                                       return (int)obj;
+                               }
+                               for (int i = 0; i < size; i++) {
+                                       if (codes[i] == c) {
+                                               return i;
+                                       }
+                               }
+
+                               return -1;
+                       }
+               }
+
+               public StandardCharCode this[int c] {
+                       get {
+                               if (c < 0 || c >= size) {
+                                       return StandardCharCode.nothing;
+                               }
+
+                               return codes[c];
+                       }
+
+                       set {
+                               if (c < 0 || c >= size) {
+                                       return;
+                               }
+
+                               codes[c] = value;
+                               reverse[value] = c;
+                       }
+               }
+               #endregion      // Public Instance Properties
+
+               #region Public Instance Methods
+               #endregion      // Public Instance Methods
+
+               #region Public Static Methods
+               public static Charcode AnsiGeneric {
+                       get {
+                               Charcode code = new Charcode(256);
+
+                               code[0x06] = StandardCharCode.formula;
+                               code[0x1e] =  StandardCharCode.nobrkhyphen;
+                               code[0x1f] = StandardCharCode.opthyphen;
+                               code[' '] = StandardCharCode.space;
+                               code['!'] = StandardCharCode.exclam;
+                               code['"'] = StandardCharCode.quotedbl;
+                               code['#'] = StandardCharCode.numbersign;
+                               code['$'] = StandardCharCode.dollar;
+                               code['%'] = StandardCharCode.percent;
+                               code['&'] = StandardCharCode.ampersand;
+                               code['\\'] = StandardCharCode.quoteright;
+                               code['('] = StandardCharCode.parenleft;
+                               code[')'] = StandardCharCode.parenright;
+                               code['*'] = StandardCharCode.asterisk;
+                               code['+'] = StandardCharCode.plus;
+                               code[','] = StandardCharCode.comma;
+                               code['-'] = StandardCharCode.hyphen;
+                               code['.'] = StandardCharCode.period;
+                               code['/'] = StandardCharCode.slash;
+                               code['0'] = StandardCharCode.zero;
+                               code['1'] = StandardCharCode.one;
+                               code['2'] = StandardCharCode.two;
+                               code['3'] = StandardCharCode.three;
+                               code['4'] = StandardCharCode.four;
+                               code['5'] = StandardCharCode.five;
+                               code['6'] = StandardCharCode.six;
+                               code['7'] = StandardCharCode.seven;
+                               code['8'] = StandardCharCode.eight;
+                               code['9'] = StandardCharCode.nine;
+                               code[':'] = StandardCharCode.colon;
+                               code[';'] = StandardCharCode.semicolon;
+                               code['<'] = StandardCharCode.less;
+                               code['='] = StandardCharCode.equal;
+                               code['>'] = StandardCharCode.greater;
+                               code['?'] = StandardCharCode.question;
+                               code['@'] = StandardCharCode.at;
+                               code['A'] = StandardCharCode.A;
+                               code['B'] = StandardCharCode.B;
+                               code['C'] = StandardCharCode.C;
+                               code['D'] = StandardCharCode.D;
+                               code['E'] = StandardCharCode.E;
+                               code['F'] = StandardCharCode.F;
+                               code['G'] = StandardCharCode.G;
+                               code['H'] = StandardCharCode.H;
+                               code['I'] = StandardCharCode.I;
+                               code['J'] = StandardCharCode.J;
+                               code['K'] = StandardCharCode.K;
+                               code['L'] = StandardCharCode.L;
+                               code['M'] = StandardCharCode.M;
+                               code['N'] = StandardCharCode.N;
+                               code['O'] = StandardCharCode.O;
+                               code['P'] = StandardCharCode.P;
+                               code['Q'] = StandardCharCode.Q;
+                               code['R'] = StandardCharCode.R;
+                               code['S'] = StandardCharCode.S;
+                               code['T'] = StandardCharCode.T;
+                               code['U'] = StandardCharCode.U;
+                               code['V'] = StandardCharCode.V;
+                               code['W'] = StandardCharCode.W;
+                               code['X'] = StandardCharCode.X;
+                               code['Y'] = StandardCharCode.Y;
+                               code['Z'] = StandardCharCode.Z;
+                               code['['] = StandardCharCode.bracketleft;
+                               code['\\'] = StandardCharCode.backslash;
+                               code[']'] = StandardCharCode.bracketright;
+                               code['^'] = StandardCharCode.asciicircum;
+                               code['_'] = StandardCharCode.underscore;
+                               code['`'] = StandardCharCode.quoteleft;
+                               code['a'] = StandardCharCode.a;
+                               code['b'] = StandardCharCode.b;
+                               code['c'] = StandardCharCode.c;
+                               code['d'] = StandardCharCode.d;
+                               code['e'] = StandardCharCode.e;
+                               code['f'] = StandardCharCode.f;
+                               code['g'] = StandardCharCode.g;
+                               code['h'] = StandardCharCode.h;
+                               code['i'] = StandardCharCode.i;
+                               code['j'] = StandardCharCode.j;
+                               code['k'] = StandardCharCode.k;
+                               code['l'] = StandardCharCode.l;
+                               code['m'] = StandardCharCode.m;
+                               code['n'] = StandardCharCode.n;
+                               code['o'] = StandardCharCode.o;
+                               code['p'] = StandardCharCode.p;
+                               code['q'] = StandardCharCode.q;
+                               code['r'] = StandardCharCode.r;
+                               code['s'] = StandardCharCode.s;
+                               code['t'] = StandardCharCode.t;
+                               code['u'] = StandardCharCode.u;
+                               code['v'] = StandardCharCode.v;
+                               code['w'] = StandardCharCode.w;
+                               code['x'] = StandardCharCode.x;
+                               code['y'] = StandardCharCode.y;
+                               code['z'] = StandardCharCode.z;
+                               code['{'] = StandardCharCode.braceleft;
+                               code['|'] = StandardCharCode.bar;
+                               code['}'] = StandardCharCode.braceright;
+                               code['~'] = StandardCharCode.asciitilde;
+                               code[0xa0] = StandardCharCode.nobrkspace;
+                               code[0xa1] = StandardCharCode.exclamdown;
+                               code[0xa2] = StandardCharCode.cent;
+                               code[0xa3] = StandardCharCode.sterling;
+                               code[0xa4] = StandardCharCode.currency;
+                               code[0xa5] = StandardCharCode.yen;
+                               code[0xa6] = StandardCharCode.brokenbar;
+                               code[0xa7] = StandardCharCode.section;
+                               code[0xa8] = StandardCharCode.dieresis;
+                               code[0xa9] = StandardCharCode.copyright;
+                               code[0xaa] = StandardCharCode.ordfeminine;
+                               code[0xab] = StandardCharCode.guillemotleft;
+                               code[0xac] = StandardCharCode.logicalnot;
+                               code[0xad] = StandardCharCode.opthyphen;
+                               code[0xae] = StandardCharCode.registered;
+                               code[0xaf] = StandardCharCode.macron;
+                               code[0xb0] = StandardCharCode.degree;
+                               code[0xb1] = StandardCharCode.plusminus;
+                               code[0xb2] = StandardCharCode.twosuperior;
+                               code[0xb3] = StandardCharCode.threesuperior;
+                               code[0xb4] = StandardCharCode.acute;
+                               code[0xb5] = StandardCharCode.mu;
+                               code[0xb6] = StandardCharCode.paragraph;
+                               code[0xb7] = StandardCharCode.periodcentered;
+                               code[0xb8] = StandardCharCode.cedilla;
+                               code[0xb9] = StandardCharCode.onesuperior;
+                               code[0xba] = StandardCharCode.ordmasculine;
+                               code[0xbb] = StandardCharCode.guillemotright;
+                               code[0xbc] = StandardCharCode.onequarter;
+                               code[0xbd] = StandardCharCode.onehalf;
+                               code[0xbe] = StandardCharCode.threequarters;
+                               code[0xbf] = StandardCharCode.questiondown;
+                               code[0xc0] = StandardCharCode.Agrave;
+                               code[0xc1] = StandardCharCode.Aacute;
+                               code[0xc2] = StandardCharCode.Acircumflex;
+                               code[0xc3] = StandardCharCode.Atilde;
+                               code[0xc4] = StandardCharCode.Adieresis;
+                               code[0xc5] = StandardCharCode.Aring;
+                               code[0xc6] = StandardCharCode.AE;
+                               code[0xc7] = StandardCharCode.Ccedilla;
+                               code[0xc8] = StandardCharCode.Egrave;
+                               code[0xc9] = StandardCharCode.Eacute;
+                               code[0xca] = StandardCharCode.Ecircumflex;
+                               code[0xcb] = StandardCharCode.Edieresis;
+                               code[0xcc] = StandardCharCode.Igrave;
+                               code[0xcd] = StandardCharCode.Iacute;
+                               code[0xce] = StandardCharCode.Icircumflex;
+                               code[0xcf] = StandardCharCode.Idieresis;
+                               code[0xd0] = StandardCharCode.Eth;
+                               code[0xd1] = StandardCharCode.Ntilde;
+                               code[0xd2] = StandardCharCode.Ograve;
+                               code[0xd3] = StandardCharCode.Oacute;
+                               code[0xd4] = StandardCharCode.Ocircumflex;
+                               code[0xd5] = StandardCharCode.Otilde;
+                               code[0xd6] = StandardCharCode.Odieresis;
+                               code[0xd7] = StandardCharCode.multiply;
+                               code[0xd8] = StandardCharCode.Oslash;
+                               code[0xd9] = StandardCharCode.Ugrave;
+                               code[0xda] = StandardCharCode.Uacute;
+                               code[0xdb] = StandardCharCode.Ucircumflex;
+                               code[0xdc] = StandardCharCode.Udieresis;
+                               code[0xdd] = StandardCharCode.Yacute;
+                               code[0xde] = StandardCharCode.Thorn;
+                               code[0xdf] = StandardCharCode.germandbls;
+                               code[0xe0] = StandardCharCode.agrave;
+                               code[0xe1] = StandardCharCode.aacute;
+                               code[0xe2] = StandardCharCode.acircumflex;
+                               code[0xe3] = StandardCharCode.atilde;
+                               code[0xe4] = StandardCharCode.adieresis;
+                               code[0xe5] = StandardCharCode.aring;
+                               code[0xe6] = StandardCharCode.ae;
+                               code[0xe7] = StandardCharCode.ccedilla;
+                               code[0xe8] = StandardCharCode.egrave;
+                               code[0xe9] = StandardCharCode.eacute;
+                               code[0xea] = StandardCharCode.ecircumflex;
+                               code[0xeb] = StandardCharCode.edieresis;
+                               code[0xec] = StandardCharCode.igrave;
+                               code[0xed] = StandardCharCode.iacute;
+                               code[0xee] = StandardCharCode.icircumflex;
+                               code[0xef] = StandardCharCode.idieresis;
+                               code[0xf0] = StandardCharCode.eth;
+                               code[0xf1] = StandardCharCode.ntilde;
+                               code[0xf2] = StandardCharCode.ograve;
+                               code[0xf3] = StandardCharCode.oacute;
+                               code[0xf4] = StandardCharCode.ocircumflex;
+                               code[0xf5] = StandardCharCode.otilde;
+                               code[0xf6] = StandardCharCode.odieresis;
+                               code[0xf7] = StandardCharCode.divide;
+                               code[0xf8] = StandardCharCode.oslash;
+                               code[0xf9] = StandardCharCode.ugrave;
+                               code[0xfa] = StandardCharCode.uacute;
+                               code[0xfb] = StandardCharCode.ucircumflex;
+                               code[0xfc] = StandardCharCode.udieresis;
+                               code[0xfd] = StandardCharCode.yacute;
+                               code[0xfe] = StandardCharCode.thorn;
+                               code[0xff] = StandardCharCode.ydieresis;
+
+                               return code;
+                       }
+               }
+
+               public static Charcode AnsiSymbol {
+                       get {
+                               Charcode code = new Charcode(256);
+
+                               code[0x06] = StandardCharCode.formula;
+                               code[0x1e] = StandardCharCode.nobrkhyphen;
+                               code[0x1f] = StandardCharCode.opthyphen;
+                               code[' '] = StandardCharCode.space;
+                               code['!'] = StandardCharCode.exclam;
+                               code['"'] = StandardCharCode.universal;
+                               code['#'] = StandardCharCode.mathnumbersign;
+                               code['$'] = StandardCharCode.existential;
+                               code['%'] = StandardCharCode.percent;
+                               code['&'] = StandardCharCode.ampersand;
+                               code['\\'] = StandardCharCode.suchthat;
+                               code['('] = StandardCharCode.parenleft;
+                               code[')'] = StandardCharCode.parenright;
+                               code['*'] = StandardCharCode.mathasterisk;
+                               code['+'] = StandardCharCode.mathplus;
+                               code[','] = StandardCharCode.comma;
+                               code['-'] = StandardCharCode.mathminus;
+                               code['.'] = StandardCharCode.period;
+                               code['/'] = StandardCharCode.slash;
+                               code['0'] = StandardCharCode.zero;
+                               code['1'] = StandardCharCode.one;
+                               code['2'] = StandardCharCode.two;
+                               code['3'] = StandardCharCode.three;
+                               code['4'] = StandardCharCode.four;
+                               code['5'] = StandardCharCode.five;
+                               code['6'] = StandardCharCode.six;
+                               code['7'] = StandardCharCode.seven;
+                               code['8'] = StandardCharCode.eight;
+                               code['9'] = StandardCharCode.nine;
+                               code[':'] = StandardCharCode.colon;
+                               code[';'] = StandardCharCode.semicolon;
+                               code['<'] = StandardCharCode.less;
+                               code['='] = StandardCharCode.mathequal;
+                               code['>'] = StandardCharCode.greater;
+                               code['?'] = StandardCharCode.question;
+                               code['@'] = StandardCharCode.congruent;
+                               code['A'] = StandardCharCode.Alpha;
+                               code['B'] = StandardCharCode.Beta;
+                               code['C'] = StandardCharCode.Chi;
+                               code['D'] = StandardCharCode.Delta;
+                               code['E'] = StandardCharCode.Epsilon;
+                               code['F'] = StandardCharCode.Phi;
+                               code['G'] = StandardCharCode.Gamma;
+                               code['H'] = StandardCharCode.Eta;
+                               code['I'] = StandardCharCode.Iota;
+                               code['K'] = StandardCharCode.Kappa;
+                               code['L'] = StandardCharCode.Lambda;
+                               code['M'] = StandardCharCode.Mu;
+                               code['N'] = StandardCharCode.Nu;
+                               code['O'] = StandardCharCode.Omicron;
+                               code['P'] = StandardCharCode.Pi;
+                               code['Q'] = StandardCharCode.Theta;
+                               code['R'] = StandardCharCode.Rho;
+                               code['S'] = StandardCharCode.Sigma;
+                               code['T'] = StandardCharCode.Tau;
+                               code['U'] = StandardCharCode.Upsilon;
+                               code['V'] = StandardCharCode.varsigma;
+                               code['W'] = StandardCharCode.Omega;
+                               code['X'] = StandardCharCode.Xi;
+                               code['Y'] = StandardCharCode.Psi;
+                               code['Z'] = StandardCharCode.Zeta;
+                               code['['] = StandardCharCode.bracketleft;
+                               code['\\'] = StandardCharCode.backslash;
+                               code[']'] = StandardCharCode.bracketright;
+                               code['^'] = StandardCharCode.asciicircum;
+                               code['_'] = StandardCharCode.underscore;
+                               code['`'] = StandardCharCode.quoteleft;
+                               code['a'] = StandardCharCode.alpha;
+                               code['b'] = StandardCharCode.beta;
+                               code['c'] = StandardCharCode.chi;
+                               code['d'] = StandardCharCode.delta;
+                               code['e'] = StandardCharCode.epsilon;
+                               code['f'] = StandardCharCode.phi;
+                               code['g'] = StandardCharCode.gamma;
+                               code['h'] = StandardCharCode.eta;
+                               code['i'] = StandardCharCode.iota;
+                               code['k'] = StandardCharCode.kappa;
+                               code['l'] = StandardCharCode.lambda;
+                               code['m'] = StandardCharCode.mu;
+                               code['n'] = StandardCharCode.nu;
+                               code['o'] = StandardCharCode.omicron;
+                               code['p'] = StandardCharCode.pi;
+                               code['q'] = StandardCharCode.theta;
+                               code['r'] = StandardCharCode.rho;
+                               code['s'] = StandardCharCode.sigma;
+                               code['t'] = StandardCharCode.tau;
+                               code['u'] = StandardCharCode.upsilon;
+                               code['w'] = StandardCharCode.omega;
+                               code['x'] = StandardCharCode.xi;
+                               code['y'] = StandardCharCode.psi;
+                               code['z'] = StandardCharCode.zeta;
+                               code['{'] = StandardCharCode.braceleft;
+                               code['|'] = StandardCharCode.bar;
+                               code['}'] = StandardCharCode.braceright;
+                               code['~'] = StandardCharCode.mathtilde;
+
+                               return code;
+                       }
+               }
+               #endregion      // Public Static Methods
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charset.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charset.cs
new file mode 100644 (file)
index 0000000..5e093b4
--- /dev/null
@@ -0,0 +1,159 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+using System;
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal class Charset {
+               #region Local Variables
+               private CharsetType     id;
+               private CharsetFlags    flags;
+               private Charcode        code;
+               private string          file;
+               private bool            loaded;
+               #endregion      // Local Variables
+
+               #region Public Constructors
+               public Charset() {
+                       flags = CharsetFlags.Read | CharsetFlags.Switch;
+                       id = CharsetType.General;
+                       file = string.Empty;
+                       loaded = false;
+                       this.ReadMap();
+               }
+               #endregion      // Public Constructors
+
+               #region Public Instance Properties
+               public Charcode Code {
+                       get {
+                               return code;
+                       }
+
+                       set {
+                               code = value;
+                       }
+               }
+
+               public CharsetFlags Flags {
+                       get {
+                               return flags;
+                       }
+
+                       set {
+                               flags = value;
+                       }
+               }
+
+               public CharsetType ID {
+                       get {
+                               return id;
+                       }
+
+                       set {
+                               switch(value) {
+                                       case CharsetType.Symbol: {
+                                               id = CharsetType.Symbol;
+                                               return;
+                                       }
+
+                                       default:
+                                       case CharsetType.General: {
+                                               id = CharsetType.General;
+                                               return;
+                                       }
+                               }
+                       }
+               }
+
+               public string File {
+                       get {
+                               return file;
+                       }
+
+                       set {
+                               if (file != value) {
+                                       file = value;
+                                       loaded = false;
+                               }
+                       }
+               }
+
+               public StandardCharCode this[int c] {
+                       get {
+                               return code[c];
+                       }
+               }
+
+               #endregion      // Public Instance Properties
+
+               #region Public Instance Methods
+               public bool ReadMap() {
+                       switch (id) {
+                               case CharsetType.General: {
+                                       if (file == string.Empty) {
+                                               code = Charcode.AnsiGeneric;
+                                               return true;
+                                       }
+                                       // FIXME - implement reading charmap from file...
+                                       return true;
+                               }
+
+                               case CharsetType.Symbol: {
+                                       if (file == string.Empty) {
+                                               code = Charcode.AnsiSymbol;
+                                               return true;
+                                       }
+
+                                       // FIXME - implement reading charmap from file...
+                                       return true;
+                               }
+
+                               default: {
+                                       return false;
+                               }
+                       }
+               }
+
+               public char StdCharCode(string name) {
+                       // FIXME - finish this
+                       return ' ';
+                       
+               }
+
+               public string StdCharName(char code) {
+                       // FIXME - finish this
+                       return String.Empty;
+               }
+
+               public StandardCharCode MapChar(char c) {
+                       return code[c];
+                       
+               }
+               #endregion      // Public Instance Methods
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs
new file mode 100644 (file)
index 0000000..4a9ab4d
--- /dev/null
@@ -0,0 +1,36 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       [Flags]
+       internal enum CharsetFlags {
+               None            = 0x00,
+               Read            = 0x01,
+               Switch          = 0x02
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs
new file mode 100644 (file)
index 0000000..66de5c2
--- /dev/null
@@ -0,0 +1,34 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal enum CharsetType {
+               General         = 0,
+               Symbol          = 1,
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ClassDelegate.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ClassDelegate.cs
new file mode 100644 (file)
index 0000000..1c252ef
--- /dev/null
@@ -0,0 +1,49 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal delegate void ClassDelegate(RTF sender);
+
+       internal class ClassCallback {
+               ClassDelegate[] callbacks;
+
+               public ClassCallback() {
+                       callbacks = new ClassDelegate[Enum.GetValues(typeof(Major)).Length];
+               }
+
+               public ClassDelegate this[TokenClass c] {
+                       get {
+                               return callbacks[(int)c];
+                       }
+
+                       set {
+                               callbacks[(int)c] = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Color.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Color.cs
new file mode 100644 (file)
index 0000000..253fe3a
--- /dev/null
@@ -0,0 +1,127 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal class Color {
+               #region Local Variables
+               private int             red;
+               private int             green;
+               private int             blue;
+               private int             num;
+               private Color           next;
+               #endregion      // Local Variables
+
+               #region Constructors
+               public Color(RTF rtf) {
+                       red = -1;
+                       green = -1;
+                       blue = -1;
+                       num = -1;
+
+                       lock (rtf) {
+                               if (rtf.Colors == null) {
+                                       rtf.Colors = this;
+                               } else {
+                                       Color c = rtf.Colors;
+                                       while (c.next != null)
+                                               c = c.next;
+                                       c.next = this;
+                               }
+                       }
+               }
+               #endregion      // Constructors
+
+               #region Properties
+               public int Red {
+                       get {
+                               return red;
+                       }
+
+                       set {
+                               red = value;
+                       }
+               }
+
+               public int Green {
+                       get {
+                               return green;
+                       }
+
+                       set {
+                               green = value;
+                       }
+               }
+
+               public int Blue {
+                       get {
+                               return blue;
+                       }
+
+                       set {
+                               blue = value;
+                       }
+               }
+
+               public int Num {
+                       get {
+                               return num;
+                       }
+
+                       set {
+                               num = value;
+                       }
+               }
+               #endregion      // Properties
+
+               #region Methods
+               static public Color GetColor(RTF rtf, int color_number) {
+                       Color   c;
+
+                       lock (rtf) {
+                               c = GetColor(rtf.Colors, color_number);
+                       }
+                       return c;
+               }
+
+               static private Color GetColor(Color start, int color_number) {
+                       Color   c;
+
+                       if (color_number == -1) {
+                               return start;
+                       }
+
+                       c = start;
+
+                       while ((c != null) && (c.num != color_number)) {
+                               c = c.next;
+                       }
+                       return c;
+               }
+               #endregion      // Methods
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/DestinationDelegate.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/DestinationDelegate.cs
new file mode 100644 (file)
index 0000000..4c85bdb
--- /dev/null
@@ -0,0 +1,49 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal delegate void DestinationDelegate(RTF Sender);
+
+       internal class DestinationCallback {
+               DestinationDelegate[]   callbacks;
+
+               public DestinationCallback() {
+                       callbacks = new DestinationDelegate[Enum.GetValues(typeof(Minor)).Length];
+               }
+
+               public DestinationDelegate this[Minor c] {
+                       get {
+                               return callbacks[(int)c];
+                       }
+
+                       set {
+                               callbacks[(int)c] = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Font.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Font.cs
new file mode 100644 (file)
index 0000000..65610a7
--- /dev/null
@@ -0,0 +1,169 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal class Font {
+               #region Local Variables
+               private string          name;
+               private string          alt_name;
+               private int             num;
+               private int             family;
+               private CharsetType     charset;
+               private int             pitch;
+               private int             type;
+               private int             codepage;
+               private Font            next;
+               #endregion      // Local Variables
+
+               #region Constructors
+               public Font(RTF rtf) {
+                       num = -1;
+
+                       lock (rtf) {
+                               if (rtf.Fonts == null)
+                                       rtf.Fonts = this;
+                               else {
+                                       Font f = rtf.Fonts;
+                                       while (f.next != null)
+                                               f = f.next;
+                                       f.next = this;
+                               }
+                       }
+               }
+               #endregion      // Constructors
+
+               #region Properties
+               public string Name {
+                       get {
+                               return name;
+                       }
+
+                       set {
+                               name = value;
+                       }
+               }
+
+               public string AltName {
+                       get {
+                               return alt_name;
+                       }
+
+                       set {
+                               alt_name = value;
+                       }
+               }
+
+               public int Num {
+                       get {
+                               return num;
+                       }
+
+                       set {
+                               num = value;
+                       }
+               }
+
+               public int Family {
+                       get {
+                               return family;
+                       }
+
+                       set {
+                               family = value;
+                       }
+               }
+
+               public CharsetType Charset {
+                       get {
+                               return charset;
+                       }
+
+                       set {
+                               charset = value;
+                       }
+               }
+
+
+               public int Pitch {
+                       get {
+                               return pitch;
+                       }
+
+                       set {
+                               pitch = value;
+                       }
+               }
+
+               public int Type {
+                       get {
+                               return type;
+                       }
+
+                       set {
+                               type = value;
+                       }
+               }
+
+               public int Codepage {
+                       get {
+                               return codepage;
+                       }
+
+                       set {
+                               codepage = value;
+                       }
+               }
+               #endregion      // Properties
+
+               #region Methods
+               static public Font GetFont(RTF rtf, int font_number) {
+                       Font    f;
+
+                       lock (rtf) {
+                               f = GetFont(rtf.Fonts, font_number);
+                       }
+                       return f;
+               }
+
+               static public Font GetFont(Font start, int font_number) {
+                       Font    f;
+
+                       if (font_number == -1) {
+                               return start;
+                       }
+
+                       f = start;
+
+                       while ((f != null) && (f.num != font_number)) {
+                               f = f.next;
+                       }
+                       return f;
+               }
+               #endregion      // Methods
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeyStruct.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeyStruct.cs
new file mode 100644 (file)
index 0000000..3e2280a
--- /dev/null
@@ -0,0 +1,40 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal struct KeyStruct {
+               public KeyStruct(Major major, Minor minor, string symbol) {
+                       Major = major;
+                       Minor = minor;
+                       Symbol = symbol;
+               }
+               public Major    Major;
+               public Minor    Minor;
+               public string   Symbol;
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs
new file mode 100644 (file)
index 0000000..9a1cce1
--- /dev/null
@@ -0,0 +1,719 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal class KeysInit {
+               public static KeyStruct[] Init() {
+                       return new KeyStruct[] {
+                                       new KeyStruct(Major.SpecialChar, Minor.IIntVersion, "vern"),
+                                       new KeyStruct(Major.SpecialChar, Minor.ICreateTime, "creatim"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IRevisionTime, "revtim"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IPrintTime, "printim"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IBackupTime, "buptim"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IEditTime, "edmins"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IYear, "yr"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IMonth, "mo"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IDay, "dy"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IHour, "hr"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IMinute, "min"),
+                                       new KeyStruct(Major.SpecialChar, Minor.ISecond, "sec"),
+                                       new KeyStruct(Major.SpecialChar, Minor.INPages, "nofpages"),
+                                       new KeyStruct(Major.SpecialChar, Minor.INWords, "nofwords"),
+                                       new KeyStruct(Major.SpecialChar, Minor.INChars, "nofchars"),
+                                       new KeyStruct(Major.SpecialChar, Minor.IIntID, "id"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurHeadDate, "chdate"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurHeadDateLong, "chdpl"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurHeadDateAbbrev, "chdpa"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurHeadTime, "chtime"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurHeadPage, "chpgn"),
+                                       new KeyStruct(Major.SpecialChar, Minor.SectNum, "sectnum"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurFNote, "chftn"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurAnnotRef, "chatn"),
+                                       new KeyStruct(Major.SpecialChar, Minor.FNoteSep, "chftnsep"),
+                                       new KeyStruct(Major.SpecialChar, Minor.FNoteCont, "chftnsepc"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Cell, "cell"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Row, "row"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Par, "par"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Par, "\n"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Par, "\r"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Sect, "sect"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Page, "page"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Column, "column"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Line, "line"),
+                                       new KeyStruct(Major.SpecialChar, Minor.SoftPage, "softpage"),
+                                       new KeyStruct(Major.SpecialChar, Minor.SoftColumn, "softcol"),
+                                       new KeyStruct(Major.SpecialChar, Minor.SoftLine, "softline"),
+                                       new KeyStruct(Major.SpecialChar, Minor.SoftLineHt, "softlheight"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Tab, "tab"),
+                                       new KeyStruct(Major.SpecialChar, Minor.EmDash, "emdash"),
+                                       new KeyStruct(Major.SpecialChar, Minor.EnDash, "endash"),
+                                       new KeyStruct(Major.SpecialChar, Minor.EmSpace, "emspace"),
+                                       new KeyStruct(Major.SpecialChar, Minor.EnSpace, "enspace"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Bullet, "bullet"),
+                                       new KeyStruct(Major.SpecialChar, Minor.LQuote, "lquote"),
+                                       new KeyStruct(Major.SpecialChar, Minor.RQuote, "rquote"),
+                                       new KeyStruct(Major.SpecialChar, Minor.LDblQuote, "ldblquote"),
+                                       new KeyStruct(Major.SpecialChar, Minor.RDblQuote, "rdblquote"),
+                                       new KeyStruct(Major.SpecialChar, Minor.Formula, "|"),
+                                       new KeyStruct(Major.SpecialChar, Minor.NoBrkSpace, "~"),
+                                       new KeyStruct(Major.SpecialChar, Minor.NoReqHyphen, "-"),
+                                       new KeyStruct(Major.SpecialChar, Minor.NoBrkHyphen, "_"),
+                                       new KeyStruct(Major.SpecialChar, Minor.OptDest, "*"),
+                                       new KeyStruct(Major.SpecialChar, Minor.LTRMark, "ltrmark"),
+                                       new KeyStruct(Major.SpecialChar, Minor.RTLMark, "rtlmark"),
+                                       new KeyStruct(Major.SpecialChar, Minor.NoWidthJoiner, "zwj"),
+                                       new KeyStruct(Major.SpecialChar, Minor.NoWidthNonJoiner, "zwnj"),
+                                       new KeyStruct(Major.SpecialChar, Minor.CurHeadPict, "chpict"),
+                                       new KeyStruct(Major.CharAttr, Minor.Plain, "plain"),
+                                       new KeyStruct(Major.CharAttr, Minor.Bold, "b"),
+                                       new KeyStruct(Major.CharAttr, Minor.AllCaps, "caps"),
+                                       new KeyStruct(Major.CharAttr, Minor.Deleted, "deleted"),
+                                       new KeyStruct(Major.CharAttr, Minor.SubScript, "dn"),
+                                       new KeyStruct(Major.CharAttr, Minor.SubScrShrink, "sub"),
+                                       new KeyStruct(Major.CharAttr, Minor.NoSuperSub, "nosupersub"),
+                                       new KeyStruct(Major.CharAttr, Minor.Expand, "expnd"),
+                                       new KeyStruct(Major.CharAttr, Minor.ExpandTwips, "expndtw"),
+                                       new KeyStruct(Major.CharAttr, Minor.Kerning, "kerning"),
+                                       new KeyStruct(Major.CharAttr, Minor.FontNum, "f"),
+                                       new KeyStruct(Major.CharAttr, Minor.FontSize, "fs"),
+                                       new KeyStruct(Major.CharAttr, Minor.Italic, "i"),
+                                       new KeyStruct(Major.CharAttr, Minor.Outline, "outl"),
+                                       new KeyStruct(Major.CharAttr, Minor.Revised, "revised"),
+                                       new KeyStruct(Major.CharAttr, Minor.RevAuthor, "revauth"),
+                                       new KeyStruct(Major.CharAttr, Minor.RevDTTM, "revdttm"),
+                                       new KeyStruct(Major.CharAttr, Minor.SmallCaps, "scaps"),
+                                       new KeyStruct(Major.CharAttr, Minor.Shadow, "shad"),
+                                       new KeyStruct(Major.CharAttr, Minor.StrikeThru, "strike"),
+                                       new KeyStruct(Major.CharAttr, Minor.Underline, "ul"),
+                                       new KeyStruct(Major.CharAttr, Minor.DotUnderline, "uld"),
+                                       new KeyStruct(Major.CharAttr, Minor.DbUnderline, "uldb"),
+                                       new KeyStruct(Major.CharAttr, Minor.NoUnderline, "ulnone"),
+                                       new KeyStruct(Major.CharAttr, Minor.WordUnderline, "ulw"),
+                                       new KeyStruct(Major.CharAttr, Minor.SuperScript, "up"),
+                                       new KeyStruct(Major.CharAttr, Minor.SuperScrShrink, "super"),
+                                       new KeyStruct(Major.CharAttr, Minor.Invisible, "v"),
+                                       new KeyStruct(Major.CharAttr, Minor.ForeColor, "cf"),
+                                       new KeyStruct(Major.CharAttr, Minor.BackColor, "cb"),
+                                       new KeyStruct(Major.CharAttr, Minor.RTLChar, "rtlch"),
+                                       new KeyStruct(Major.CharAttr, Minor.LTRChar, "ltrch"),
+                                       new KeyStruct(Major.CharAttr, Minor.CharStyleNum, "cs"),
+                                       new KeyStruct(Major.CharAttr, Minor.CharCharSet, "cchs"),
+                                       new KeyStruct(Major.CharAttr, Minor.Language, "lang"),
+                                       new KeyStruct(Major.CharAttr, Minor.Gray, "gray"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParDef, "pard"),
+                                       new KeyStruct(Major.ParAttr, Minor.StyleNum, "s"),
+                                       new KeyStruct(Major.ParAttr, Minor.Hyphenate, "hyphpar"),
+                                       new KeyStruct(Major.ParAttr, Minor.InTable, "intbl"),
+                                       new KeyStruct(Major.ParAttr, Minor.Keep, "keep"),
+                                       new KeyStruct(Major.ParAttr, Minor.NoWidowControl, "nowidctlpar"),
+                                       new KeyStruct(Major.ParAttr, Minor.KeepNext, "keepn"),
+                                       new KeyStruct(Major.ParAttr, Minor.OutlineLevel, "level"),
+                                       new KeyStruct(Major.ParAttr, Minor.NoLineNum, "noline"),
+                                       new KeyStruct(Major.ParAttr, Minor.PBBefore, "pagebb"),
+                                       new KeyStruct(Major.ParAttr, Minor.SideBySide, "sbys"),
+                                       new KeyStruct(Major.ParAttr, Minor.QuadLeft, "ql"),
+                                       new KeyStruct(Major.ParAttr, Minor.QuadRight, "qr"),
+                                       new KeyStruct(Major.ParAttr, Minor.QuadJust, "qj"),
+                                       new KeyStruct(Major.ParAttr, Minor.QuadCenter, "qc"),
+                                       new KeyStruct(Major.ParAttr, Minor.FirstIndent, "fi"),
+                                       new KeyStruct(Major.ParAttr, Minor.LeftIndent, "li"),
+                                       new KeyStruct(Major.ParAttr, Minor.RightIndent, "ri"),
+                                       new KeyStruct(Major.ParAttr, Minor.SpaceBefore, "sb"),
+                                       new KeyStruct(Major.ParAttr, Minor.SpaceAfter, "sa"),
+                                       new KeyStruct(Major.ParAttr, Minor.SpaceBetween, "sl"),
+                                       new KeyStruct(Major.ParAttr, Minor.SpaceMultiply, "slmult"),
+                                       new KeyStruct(Major.ParAttr, Minor.SubDocument, "subdocument"),
+                                       new KeyStruct(Major.ParAttr, Minor.RTLPar, "rtlpar"),
+                                       new KeyStruct(Major.ParAttr, Minor.LTRPar, "ltrpar"),
+                                       new KeyStruct(Major.ParAttr, Minor.TabPos, "tx"),
+                                       new KeyStruct(Major.ParAttr, Minor.TabLeft, "tql"),
+                                       new KeyStruct(Major.ParAttr, Minor.TabRight, "tqr"),
+                                       new KeyStruct(Major.ParAttr, Minor.TabCenter, "tqc"),
+                                       new KeyStruct(Major.ParAttr, Minor.TabDecimal, "tqdec"),
+                                       new KeyStruct(Major.ParAttr, Minor.TabBar, "tb"),
+                                       new KeyStruct(Major.ParAttr, Minor.LeaderDot, "tldot"),
+                                       new KeyStruct(Major.ParAttr, Minor.LeaderHyphen, "tlhyph"),
+                                       new KeyStruct(Major.ParAttr, Minor.LeaderUnder, "tlul"),
+                                       new KeyStruct(Major.ParAttr, Minor.LeaderThick, "tlth"),
+                                       new KeyStruct(Major.ParAttr, Minor.LeaderEqual, "tleq"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParLevel, "pnlvl"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParBullet, "pnlvlblt"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParSimple, "pnlvlbody"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumCont, "pnlvlcont"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumOnce, "pnnumonce"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumAcross, "pnacross"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParHangIndent, "pnhang"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumRestart, "pnrestart"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumCardinal, "pncard"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumDecimal, "pndec"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumULetter, "pnucltr"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumURoman, "pnucrm"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumLLetter, "pnlcltr"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumLRoman, "pnlcrm"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumOrdinal, "pnord"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumOrdinalText, "pnordt"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumBold, "pnb"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumItalic, "pni"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumAllCaps, "pncaps"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumSmallCaps, "pnscaps"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumUnder, "pnul"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumDotUnder, "pnuld"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumDbUnder, "pnuldb"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumNoUnder, "pnulnone"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumWordUnder, "pnulw"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumStrikethru, "pnstrike"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumForeColor, "pncf"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumFont, "pnf"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumFontSize, "pnfs"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumIndent, "pnindent"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumSpacing, "pnsp"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumInclPrev, "pnprev"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumCenter, "pnqc"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumLeft, "pnql"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumRight, "pnqr"),
+                                       new KeyStruct(Major.ParAttr, Minor.ParNumStartAt, "pnstart"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderTop, "brdrt"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderBottom, "brdrb"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderLeft, "brdrl"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderRight, "brdrr"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderBetween, "brdrbtw"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderBar, "brdrbar"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderBox, "box"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderSingle, "brdrs"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderThick, "brdrth"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderShadow, "brdrsh"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderDouble, "brdrdb"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderDot, "brdrdot"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderDot, "brdrdash"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderHair, "brdrhair"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderWidth, "brdrw"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderColor, "brdrcf"),
+                                       new KeyStruct(Major.ParAttr, Minor.BorderSpace, "brsp"),
+                                       new KeyStruct(Major.ParAttr, Minor.Shading, "shading"),
+                                       new KeyStruct(Major.ParAttr, Minor.BgPatH, "bghoriz"),
+                                       new KeyStruct(Major.ParAttr, Minor.BgPatV, "bgvert"),
+                                       new KeyStruct(Major.ParAttr, Minor.FwdDiagBgPat, "bgfdiag"),
+                                       new KeyStruct(Major.ParAttr, Minor.BwdDiagBgPat, "bgbdiag"),
+                                       new KeyStruct(Major.ParAttr, Minor.HatchBgPat, "bgcross"),
+                                       new KeyStruct(Major.ParAttr, Minor.DiagHatchBgPat, "bgdcross"),
+                                       new KeyStruct(Major.ParAttr, Minor.DarkBgPatH, "bgdkhoriz"),
+                                       new KeyStruct(Major.ParAttr, Minor.DarkBgPatV, "bgdkvert"),
+                                       new KeyStruct(Major.ParAttr, Minor.FwdDarkBgPat, "bgdkfdiag"),
+                                       new KeyStruct(Major.ParAttr, Minor.BwdDarkBgPat, "bgdkbdiag"),
+                                       new KeyStruct(Major.ParAttr, Minor.DarkHatchBgPat, "bgdkcross"),
+                                       new KeyStruct(Major.ParAttr, Minor.DarkDiagHatchBgPat, "bgdkdcross"),
+                                       new KeyStruct(Major.ParAttr, Minor.BgPatLineColor, "cfpat"),
+                                       new KeyStruct(Major.ParAttr, Minor.BgPatColor, "cbpat"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectDef, "sectd"),
+                                       new KeyStruct(Major.SectAttr, Minor.ENoteHere, "endnhere"),
+                                       new KeyStruct(Major.SectAttr, Minor.PrtBinFirst, "binfsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.PrtBin, "binsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectStyleNum, "ds"),
+                                       new KeyStruct(Major.SectAttr, Minor.NoBreak, "sbknone"),
+                                       new KeyStruct(Major.SectAttr, Minor.ColBreak, "sbkcol"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageBreak, "sbkpage"),
+                                       new KeyStruct(Major.SectAttr, Minor.EvenBreak, "sbkeven"),
+                                       new KeyStruct(Major.SectAttr, Minor.OddBreak, "sbkodd"),
+                                       new KeyStruct(Major.SectAttr, Minor.Columns, "cols"),
+                                       new KeyStruct(Major.SectAttr, Minor.ColumnSpace, "colsx"),
+                                       new KeyStruct(Major.SectAttr, Minor.ColumnNumber, "colno"),
+                                       new KeyStruct(Major.SectAttr, Minor.ColumnSpRight, "colsr"),
+                                       new KeyStruct(Major.SectAttr, Minor.ColumnWidth, "colw"),
+                                       new KeyStruct(Major.SectAttr, Minor.ColumnLine, "linebetcol"),
+                                       new KeyStruct(Major.SectAttr, Minor.LineModulus, "linemod"),
+                                       new KeyStruct(Major.SectAttr, Minor.LineDist, "linex"),
+                                       new KeyStruct(Major.SectAttr, Minor.LineStarts, "linestarts"),
+                                       new KeyStruct(Major.SectAttr, Minor.LineRestart, "linerestart"),
+                                       new KeyStruct(Major.SectAttr, Minor.LineRestartPg, "lineppage"),
+                                       new KeyStruct(Major.SectAttr, Minor.LineCont, "linecont"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectPageWid, "pgwsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectPageHt, "pghsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectMarginLeft, "marglsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectMarginRight, "margrsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectMarginTop, "margtsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectMarginBottom, "margbsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectMarginGutter, "guttersxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.SectLandscape, "lndscpsxn"),
+                                       new KeyStruct(Major.SectAttr, Minor.TitleSpecial, "titlepg"),
+                                       new KeyStruct(Major.SectAttr, Minor.HeaderY, "headery"),
+                                       new KeyStruct(Major.SectAttr, Minor.FooterY, "footery"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageStarts, "pgnstarts"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageCont, "pgncont"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageRestart, "pgnrestart"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageNumRight, "pgnx"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageNumTop, "pgny"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageDecimal, "pgndec"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageURoman, "pgnucrm"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageLRoman, "pgnlcrm"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageULetter, "pgnucltr"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageLLetter, "pgnlcltr"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageNumHyphSep, "pgnhnsh"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageNumSpaceSep, "pgnhnsp"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageNumColonSep, "pgnhnsc"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageNumEmdashSep, "pgnhnsm"),
+                                       new KeyStruct(Major.SectAttr, Minor.PageNumEndashSep, "pgnhnsn"),
+                                       new KeyStruct(Major.SectAttr, Minor.TopVAlign, "vertalt"),
+                                       new KeyStruct(Major.SectAttr, Minor.BottomVAlign, "vertalb"),
+                                       new KeyStruct(Major.SectAttr, Minor.CenterVAlign, "vertalc"),
+                                       new KeyStruct(Major.SectAttr, Minor.JustVAlign, "vertalj"),
+                                       new KeyStruct(Major.SectAttr, Minor.RTLSect, "rtlsect"),
+                                       new KeyStruct(Major.SectAttr, Minor.LTRSect, "ltrsect"),
+                                       new KeyStruct(Major.DocAttr, Minor.DefTab, "deftab"),
+                                       new KeyStruct(Major.DocAttr, Minor.HyphHotZone, "hyphhotz"),
+                                       new KeyStruct(Major.DocAttr, Minor.HyphConsecLines, "hyphconsec"),
+                                       new KeyStruct(Major.DocAttr, Minor.HyphCaps, "hyphcaps"),
+                                       new KeyStruct(Major.DocAttr, Minor.HyphAuto, "hyphauto"),
+                                       new KeyStruct(Major.DocAttr, Minor.LineStart, "linestart"),
+                                       new KeyStruct(Major.DocAttr, Minor.FracWidth, "fracwidth"),
+                                       new KeyStruct(Major.DocAttr, Minor.MakeBackup, "makeback"),
+                                       new KeyStruct(Major.DocAttr, Minor.MakeBackup, "makebackup"),
+                                       new KeyStruct(Major.DocAttr, Minor.RTFDefault, "defformat"),
+                                       new KeyStruct(Major.DocAttr, Minor.PSOverlay, "psover"),
+                                       new KeyStruct(Major.DocAttr, Minor.DocTemplate, "doctemp"),
+                                       new KeyStruct(Major.DocAttr, Minor.DefLanguage, "deflang"),
+                                       new KeyStruct(Major.DocAttr, Minor.FENoteType, "fet"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteEndSect, "endnotes"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteEndDoc, "enddoc"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteText, "ftntj"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteBottom, "ftnbj"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteEndSect, "aendnotes"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteEndDoc, "aenddoc"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteText, "aftntj"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteBottom, "aftnbj"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteStart, "ftnstart"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteStart, "aftnstart"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteRestartPage, "ftnrstpg"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteRestart, "ftnrestart"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteRestartCont, "ftnrstcont"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteRestart, "aftnrestart"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteRestartCont, "aftnrstcont"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteNumArabic, "ftnnar"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteNumLLetter, "ftnnalc"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteNumULetter, "ftnnauc"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteNumLRoman, "ftnnrlc"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteNumURoman, "ftnnruc"),
+                                       new KeyStruct(Major.DocAttr, Minor.FNoteNumChicago, "ftnnchi"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteNumArabic, "aftnnar"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteNumLLetter, "aftnnalc"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteNumULetter, "aftnnauc"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteNumLRoman, "aftnnrlc"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteNumURoman, "aftnnruc"),
+                                       new KeyStruct(Major.DocAttr, Minor.ENoteNumChicago, "aftnnchi"),
+                                       new KeyStruct(Major.DocAttr, Minor.PaperWidth, "paperw"),
+                                       new KeyStruct(Major.DocAttr, Minor.PaperHeight, "paperh"),
+                                       new KeyStruct(Major.DocAttr, Minor.PaperSize, "psz"),
+                                       new KeyStruct(Major.DocAttr, Minor.LeftMargin, "margl"),
+                                       new KeyStruct(Major.DocAttr, Minor.RightMargin, "margr"),
+                                       new KeyStruct(Major.DocAttr, Minor.TopMargin, "margt"),
+                                       new KeyStruct(Major.DocAttr, Minor.BottomMargin, "margb"),
+                                       new KeyStruct(Major.DocAttr, Minor.FacingPage, "facingp"),
+                                       new KeyStruct(Major.DocAttr, Minor.GutterWid, "gutter"),
+                                       new KeyStruct(Major.DocAttr, Minor.MirrorMargin, "margmirror"),
+                                       new KeyStruct(Major.DocAttr, Minor.Landscape, "landscape"),
+                                       new KeyStruct(Major.DocAttr, Minor.PageStart, "pgnstart"),
+                                       new KeyStruct(Major.DocAttr, Minor.WidowCtrl, "widowctrl"),
+                                       new KeyStruct(Major.DocAttr, Minor.LinkStyles, "linkstyles"),
+                                       new KeyStruct(Major.DocAttr, Minor.NoAutoTabIndent, "notabind"),
+                                       new KeyStruct(Major.DocAttr, Minor.WrapSpaces, "wraptrsp"),
+                                       new KeyStruct(Major.DocAttr, Minor.PrintColorsBlack, "prcolbl"),
+                                       new KeyStruct(Major.DocAttr, Minor.NoExtraSpaceRL, "noextrasprl"),
+                                       new KeyStruct(Major.DocAttr, Minor.NoColumnBalance, "nocolbal"),
+                                       new KeyStruct(Major.DocAttr, Minor.CvtMailMergeQuote, "cvmme"),
+                                       new KeyStruct(Major.DocAttr, Minor.SuppressTopSpace, "sprstsp"),
+                                       new KeyStruct(Major.DocAttr, Minor.SuppressPreParSpace, "sprsspbf"),
+                                       new KeyStruct(Major.DocAttr, Minor.CombineTblBorders, "otblrul"),
+                                       new KeyStruct(Major.DocAttr, Minor.TranspMetafiles, "transmf"),
+                                       new KeyStruct(Major.DocAttr, Minor.SwapBorders, "swpbdr"),
+                                       new KeyStruct(Major.DocAttr, Minor.ShowHardBreaks, "brkfrm"),
+                                       new KeyStruct(Major.DocAttr, Minor.FormProtected, "formprot"),
+                                       new KeyStruct(Major.DocAttr, Minor.AllProtected, "allprot"),
+                                       new KeyStruct(Major.DocAttr, Minor.FormShading, "formshade"),
+                                       new KeyStruct(Major.DocAttr, Minor.FormDisplay, "formdisp"),
+                                       new KeyStruct(Major.DocAttr, Minor.PrintData, "printdata"),
+                                       new KeyStruct(Major.DocAttr, Minor.RevProtected, "revprot"),
+                                       new KeyStruct(Major.DocAttr, Minor.Revisions, "revisions"),
+                                       new KeyStruct(Major.DocAttr, Minor.RevDisplay, "revprop"),
+                                       new KeyStruct(Major.DocAttr, Minor.RevBar, "revbar"),
+                                       new KeyStruct(Major.DocAttr, Minor.AnnotProtected, "annotprot"),
+                                       new KeyStruct(Major.DocAttr, Minor.RTLDoc, "rtldoc"),
+                                       new KeyStruct(Major.DocAttr, Minor.LTRDoc, "ltrdoc"),
+                                       new KeyStruct(Major.StyleAttr, Minor.Additive, "additive"),
+                                       new KeyStruct(Major.StyleAttr, Minor.BasedOn, "sbasedon"),
+                                       new KeyStruct(Major.StyleAttr, Minor.Next, "snext"),
+                                       new KeyStruct(Major.PictAttr, Minor.MacQD, "macpict"),
+                                       new KeyStruct(Major.PictAttr, Minor.PMMetafile, "pmmetafile"),
+                                       new KeyStruct(Major.PictAttr, Minor.WinMetafile, "wmetafile"),
+                                       new KeyStruct(Major.PictAttr, Minor.DevIndBitmap, "dibitmap"),
+                                       new KeyStruct(Major.PictAttr, Minor.WinBitmap, "wbitmap"),
+                                       new KeyStruct(Major.PictAttr, Minor.PixelBits, "wbmbitspixel"),
+                                       new KeyStruct(Major.PictAttr, Minor.BitmapPlanes, "wbmplanes"),
+                                       new KeyStruct(Major.PictAttr, Minor.BitmapWid, "wbmwidthbytes"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicWid, "picw"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicHt, "pich"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicGoalWid, "picwgoal"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicGoalHt, "pichgoal"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicGoalWid, "picwGoal"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicGoalHt, "pichGoal"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicScaleX, "picscalex"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicScaleY, "picscaley"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicScaled, "picscaled"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicCropTop, "piccropt"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicCropBottom, "piccropb"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicCropLeft, "piccropl"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicCropRight, "piccropr"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicMFHasBitmap, "picbmp"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicMFBitsPerPixel, "picbpp"),
+                                       new KeyStruct(Major.PictAttr, Minor.PicBinary, "bin"),
+                                       new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGWidth, "width"),
+                                       new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGHeight, "height"),
+                                       new KeyStruct(Major.Destination, Minor.FontTbl, "fonttbl"),
+                                       new KeyStruct(Major.Destination, Minor.FontAltName, "falt"),
+                                       new KeyStruct(Major.Destination, Minor.EmbeddedFont, "fonteb"),
+                                       new KeyStruct(Major.Destination, Minor.FontFile, "fontfile"),
+                                       new KeyStruct(Major.Destination, Minor.FileTbl, "filetbl"),
+                                       new KeyStruct(Major.Destination, Minor.FileInfo, "file"),
+                                       new KeyStruct(Major.Destination, Minor.ColorTbl, "colortbl"),
+                                       new KeyStruct(Major.Destination, Minor.StyleSheet, "stylesheet"),
+                                       new KeyStruct(Major.Destination, Minor.KeyCode, "keycode"),
+                                       new KeyStruct(Major.Destination, Minor.RevisionTbl, "revtbl"),
+                                       new KeyStruct(Major.Destination, Minor.Info, "info"),
+                                       new KeyStruct(Major.Destination, Minor.ITitle, "title"),
+                                       new KeyStruct(Major.Destination, Minor.ISubject, "subject"),
+                                       new KeyStruct(Major.Destination, Minor.IAuthor, "author"),
+                                       new KeyStruct(Major.Destination, Minor.IOperator, "operator"),
+                                       new KeyStruct(Major.Destination, Minor.IKeywords, "keywords"),
+                                       new KeyStruct(Major.Destination, Minor.IComment, "comment"),
+                                       new KeyStruct(Major.Destination, Minor.IVersion, "version"),
+                                       new KeyStruct(Major.Destination, Minor.IDoccomm, "doccomm"),
+                                       new KeyStruct(Major.Destination, Minor.IVerscomm, "verscomm"),
+                                       new KeyStruct(Major.Destination, Minor.NextFile, "nextfile"),
+                                       new KeyStruct(Major.Destination, Minor.Template, "template"),
+                                       new KeyStruct(Major.Destination, Minor.FNSep, "ftnsep"),
+                                       new KeyStruct(Major.Destination, Minor.FNContSep, "ftnsepc"),
+                                       new KeyStruct(Major.Destination, Minor.FNContNotice, "ftncn"),
+                                       new KeyStruct(Major.Destination, Minor.ENSep, "aftnsep"),
+                                       new KeyStruct(Major.Destination, Minor.ENContSep, "aftnsepc"),
+                                       new KeyStruct(Major.Destination, Minor.ENContNotice, "aftncn"),
+                                       new KeyStruct(Major.Destination, Minor.PageNumLevel, "pgnhn"),
+                                       new KeyStruct(Major.Destination, Minor.ParNumLevelStyle, "pnseclvl"),
+                                       new KeyStruct(Major.Destination, Minor.Header, "header"),
+                                       new KeyStruct(Major.Destination, Minor.Footer, "footer"),
+                                       new KeyStruct(Major.Destination, Minor.HeaderLeft, "headerl"),
+                                       new KeyStruct(Major.Destination, Minor.HeaderRight, "headerr"),
+                                       new KeyStruct(Major.Destination, Minor.HeaderFirst, "headerf"),
+                                       new KeyStruct(Major.Destination, Minor.FooterLeft, "footerl"),
+                                       new KeyStruct(Major.Destination, Minor.FooterRight, "footerr"),
+                                       new KeyStruct(Major.Destination, Minor.FooterFirst, "footerf"),
+                                       new KeyStruct(Major.Destination, Minor.ParNumText, "pntext"),
+                                       new KeyStruct(Major.Destination, Minor.ParNumbering, "pn"),
+                                       new KeyStruct(Major.Destination, Minor.ParNumTextAfter, "pntexta"),
+                                       new KeyStruct(Major.Destination, Minor.ParNumTextBefore, "pntextb"),
+                                       new KeyStruct(Major.Destination, Minor.BookmarkStart, "bkmkstart"),
+                                       new KeyStruct(Major.Destination, Minor.BookmarkEnd, "bkmkend"),
+                                       new KeyStruct(Major.Destination, Minor.Pict, "pict"),
+                                       new KeyStruct(Major.Destination, Minor.Object, "object"),
+                                       new KeyStruct(Major.Destination, Minor.ObjClass, "objclass"),
+                                       new KeyStruct(Major.Destination, Minor.ObjName, "objname"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjTime, "objtime"),
+                                       new KeyStruct(Major.Destination, Minor.ObjData, "objdata"),
+                                       new KeyStruct(Major.Destination, Minor.ObjAlias, "objalias"),
+                                       new KeyStruct(Major.Destination, Minor.ObjSection, "objsect"),
+                                       new KeyStruct(Major.Destination, Minor.ObjItem, "objitem"),
+                                       new KeyStruct(Major.Destination, Minor.ObjTopic, "objtopic"),
+                                       new KeyStruct(Major.Destination, Minor.ObjResult, "result"),
+                                       new KeyStruct(Major.Destination, Minor.DrawObject, "do"),
+                                       new KeyStruct(Major.Destination, Minor.Footnote, "footnote"),
+                                       new KeyStruct(Major.Destination, Minor.AnnotRefStart, "atrfstart"),
+                                       new KeyStruct(Major.Destination, Minor.AnnotRefEnd, "atrfend"),
+                                       new KeyStruct(Major.Destination, Minor.AnnotID, "atnid"),
+                                       new KeyStruct(Major.Destination, Minor.AnnotAuthor, "atnauthor"),
+                                       new KeyStruct(Major.Destination, Minor.Annotation, "annotation"),
+                                       new KeyStruct(Major.Destination, Minor.AnnotRef, "atnref"),
+                                       new KeyStruct(Major.Destination, Minor.AnnotTime, "atntime"),
+                                       new KeyStruct(Major.Destination, Minor.AnnotIcon, "atnicn"),
+                                       new KeyStruct(Major.Destination, Minor.Field, "field"),
+                                       new KeyStruct(Major.Destination, Minor.FieldInst, "fldinst"),
+                                       new KeyStruct(Major.Destination, Minor.FieldResult, "fldrslt"),
+                                       new KeyStruct(Major.Destination, Minor.DataField, "datafield"),
+                                       new KeyStruct(Major.Destination, Minor.Index, "xe"),
+                                       new KeyStruct(Major.Destination, Minor.IndexText, "txe"),
+                                       new KeyStruct(Major.Destination, Minor.IndexRange, "rxe"),
+                                       new KeyStruct(Major.Destination, Minor.TOC, "tc"),
+                                       new KeyStruct(Major.Destination, Minor.NeXTGraphic, "NeXTGraphic"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFNil, "fnil"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFRoman, "froman"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFSwiss, "fswiss"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFModern, "fmodern"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFScript, "fscript"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFDecor, "fdecor"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFTech, "ftech"),
+                                       new KeyStruct(Major.FontFamily, Minor.FFBidirectional, "fbidi"),
+                                       new KeyStruct(Major.FontAttr, Minor.FontCharSet, "fcharset"),
+                                       new KeyStruct(Major.FontAttr, Minor.FontPitch, "fprq"),
+                                       new KeyStruct(Major.FontAttr, Minor.FontCodePage, "cpg"),
+                                       new KeyStruct(Major.FontAttr, Minor.FTypeNil, "ftnil"),
+                                       new KeyStruct(Major.FontAttr, Minor.FTypeTrueType, "fttruetype"),
+                                       new KeyStruct(Major.FileAttr, Minor.FileNum, "fid"),
+                                       new KeyStruct(Major.FileAttr, Minor.FileRelPath, "frelative"),
+                                       new KeyStruct(Major.FileAttr, Minor.FileOSNum, "fosnum"),
+                                       new KeyStruct(Major.FileSource, Minor.SrcMacintosh, "fvalidmac"),
+                                       new KeyStruct(Major.FileSource, Minor.SrcDOS, "fvaliddos"),
+                                       new KeyStruct(Major.FileSource, Minor.SrcNTFS, "fvalidntfs"),
+                                       new KeyStruct(Major.FileSource, Minor.SrcHPFS, "fvalidhpfs"),
+                                       new KeyStruct(Major.FileSource, Minor.SrcNetwork, "fnetwork"),
+                                       new KeyStruct(Major.ColorName, Minor.Red, "red"),
+                                       new KeyStruct(Major.ColorName, Minor.Green, "green"),
+                                       new KeyStruct(Major.ColorName, Minor.Blue, "blue"),
+                                       new KeyStruct(Major.CharSet, Minor.MacCharSet, "mac"),
+                                       new KeyStruct(Major.CharSet, Minor.AnsiCharSet, "ansi"),
+                                       new KeyStruct(Major.CharSet, Minor.PcCharSet, "pc"),
+                                       new KeyStruct(Major.CharSet, Minor.PcaCharSet, "pca"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowDef, "trowd"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowGapH, "trgaph"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellPos, "cellx"),
+                                       new KeyStruct(Major.TblAttr, Minor.MergeRngFirst, "clmgf"),
+                                       new KeyStruct(Major.TblAttr, Minor.MergePrevious, "clmrg"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowLeft, "trql"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowRight, "trqr"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowCenter, "trqc"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowLeftEdge, "trleft"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowHt, "trrh"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowHeader, "trhdr"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowKeep, "trkeep"),
+                                       new KeyStruct(Major.TblAttr, Minor.RTLRow, "rtlrow"),
+                                       new KeyStruct(Major.TblAttr, Minor.LTRRow, "ltrrow"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowBordTop, "trbrdrt"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowBordLeft, "trbrdrl"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowBordBottom, "trbrdrb"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowBordRight, "trbrdrr"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowBordHoriz, "trbrdrh"),
+                                       new KeyStruct(Major.TblAttr, Minor.RowBordVert, "trbrdrv"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBordBottom, "clbrdrb"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBordTop, "clbrdrt"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBordLeft, "clbrdrl"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBordRight, "clbrdrr"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellShading, "clshdng"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBgPatH, "clbghoriz"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBgPatV, "clbgvert"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellFwdDiagBgPat, "clbgfdiag"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBwdDiagBgPat, "clbgbdiag"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellHatchBgPat, "clbgcross"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellDiagHatchBgPat, "clbgdcross"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellDarkBgPatH, "clbgdkhoriz"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellDarkBgPatH, "clbgdkhor"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellDarkBgPatV, "clbgdkvert"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellFwdDarkBgPat, "clbgdkfdiag"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBwdDarkBgPat, "clbgdkbdiag"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellDarkHatchBgPat, "clbgdkcross"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellDarkDiagHatchBgPat, "clbgdkdcross"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBgPatLineColor, "clcfpat"),
+                                       new KeyStruct(Major.TblAttr, Minor.CellBgPatColor, "clcbpat"),
+                                       new KeyStruct(Major.FieldAttr, Minor.FieldDirty, "flddirty"),
+                                       new KeyStruct(Major.FieldAttr, Minor.FieldEdited, "fldedit"),
+                                       new KeyStruct(Major.FieldAttr, Minor.FieldLocked, "fldlock"),
+                                       new KeyStruct(Major.FieldAttr, Minor.FieldPrivate, "fldpriv"),
+                                       new KeyStruct(Major.FieldAttr, Minor.FieldAlt, "fldalt"),
+                                       new KeyStruct(Major.PosAttr, Minor.AbsWid, "absw"),
+                                       new KeyStruct(Major.PosAttr, Minor.AbsHt, "absh"),
+                                       new KeyStruct(Major.PosAttr, Minor.RPosMargH, "phmrg"),
+                                       new KeyStruct(Major.PosAttr, Minor.RPosPageH, "phpg"),
+                                       new KeyStruct(Major.PosAttr, Minor.RPosColH, "phcol"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosX, "posx"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosNegX, "posnegx"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosXCenter, "posxc"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosXInside, "posxi"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosXOutSide, "posxo"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosXRight, "posxr"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosXLeft, "posxl"),
+                                       new KeyStruct(Major.PosAttr, Minor.RPosMargV, "pvmrg"),
+                                       new KeyStruct(Major.PosAttr, Minor.RPosPageV, "pvpg"),
+                                       new KeyStruct(Major.PosAttr, Minor.RPosParaV, "pvpara"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosY, "posy"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosNegY, "posnegy"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosYInline, "posyil"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosYTop, "posyt"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosYCenter, "posyc"),
+                                       new KeyStruct(Major.PosAttr, Minor.PosYBottom, "posyb"),
+                                       new KeyStruct(Major.PosAttr, Minor.NoWrap, "nowrap"),
+                                       new KeyStruct(Major.PosAttr, Minor.DistFromTextAll, "dxfrtext"),
+                                       new KeyStruct(Major.PosAttr, Minor.DistFromTextX, "dfrmtxtx"),
+                                       new KeyStruct(Major.PosAttr, Minor.DistFromTextY, "dfrmtxty"),
+                                       new KeyStruct(Major.PosAttr, Minor.TextDistY, "dyfrtext"),
+                                       new KeyStruct(Major.PosAttr, Minor.DropCapLines, "dropcapli"),
+                                       new KeyStruct(Major.PosAttr, Minor.DropCapType, "dropcapt"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjEmb, "objemb"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjLink, "objlink"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjAutoLink, "objautlink"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjSubscriber, "objsub"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjPublisher, "objpub"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjICEmb, "objicemb"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjLinkSelf, "linkself"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjLock, "objupdate"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjUpdate, "objlock"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjHt, "objh"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjWid, "objw"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjSetSize, "objsetsize"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjAlign, "objalign"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjTransposeY, "objtransy"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjCropTop, "objcropt"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjCropBottom, "objcropb"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjCropLeft, "objcropl"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjCropRight, "objcropr"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjScaleX, "objscalex"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjScaleY, "objscaley"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjResRTF, "rsltrtf"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjResPict, "rsltpict"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjResBitmap, "rsltbmp"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjResText, "rslttxt"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjResMerge, "rsltmerge"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjBookmarkPubObj, "bkmkpub"),
+                                       new KeyStruct(Major.ObjAttr, Minor.ObjPubAutoUpdate, "pubauto"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACBold, "ab"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACAllCaps, "caps"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACForeColor, "acf"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACSubScript, "adn"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACExpand, "aexpnd"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACFontNum, "af"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACFontSize, "afs"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACItalic, "ai"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACLanguage, "alang"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACOutline, "aoutl"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACSmallCaps, "ascaps"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACShadow, "ashad"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACStrikeThru, "astrike"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACUnderline, "aul"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACDotUnderline, "auld"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACDbUnderline, "auldb"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACNoUnderline, "aulnone"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACWordUnderline, "aulw"),
+                                       new KeyStruct(Major.ACharAttr, Minor.ACSuperScript, "aup"),
+                                       new KeyStruct(Major.FNoteAttr, Minor.FNAlt, "ftnalt"),
+                                       new KeyStruct(Major.KeyCodeAttr, Minor.AltKey, "alt"),
+                                       new KeyStruct(Major.KeyCodeAttr, Minor.ShiftKey, "shift"),
+                                       new KeyStruct(Major.KeyCodeAttr, Minor.ControlKey, "ctrl"),
+                                       new KeyStruct(Major.KeyCodeAttr, Minor.FunctionKey, "fn"),
+                                       new KeyStruct(Major.BookmarkAttr, Minor.BookmarkFirstCol, "bkmkcolf"),
+                                       new KeyStruct(Major.BookmarkAttr, Minor.BookmarkLastCol, "bkmkcoll"),
+                                       new KeyStruct(Major.IndexAttr, Minor.IndexNumber, "xef"),
+                                       new KeyStruct(Major.IndexAttr, Minor.IndexBold, "bxe"),
+                                       new KeyStruct(Major.IndexAttr, Minor.IndexItalic, "ixe"),
+                                       new KeyStruct(Major.TOCAttr, Minor.TOCType, "tcf"),
+                                       new KeyStruct(Major.TOCAttr, Minor.TOCLevel, "tcl"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLock, "dolock"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawPageRelX, "doxpage"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawColumnRelX, "dobxcolumn"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawMarginRelX, "dobxmargin"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawPageRelY, "dobypage"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawColumnRelY, "dobycolumn"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawMarginRelY, "dobymargin"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawHeight, "dobhgt"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawBeginGroup, "dpgroup"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawGroupCount, "dpcount"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawEndGroup, "dpendgroup"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawArc, "dparc"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawCallout, "dpcallout"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawEllipse, "dpellipse"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLine, "dpline"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawPolygon, "dppolygon"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawPolyLine, "dppolyline"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawRect, "dprect"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawTextBox, "dptxbx"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawOffsetX, "dpx"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawSizeX, "dpxsize"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawOffsetY, "dpy"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawSizeY, "dpysize"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COAngle, "dpcoa"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COAccentBar, "dpcoaccent"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COBestFit, "dpcobestfit"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COBorder, "dpcoborder"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COAttachAbsDist, "dpcodabs"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COAttachBottom, "dpcodbottom"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COAttachCenter, "dpcodcenter"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COAttachTop, "dpcodtop"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COLength, "dpcolength"),
+                                       new KeyStruct(Major.DrawAttr, Minor.CONegXQuadrant, "dpcominusx"),
+                                       new KeyStruct(Major.DrawAttr, Minor.CONegYQuadrant, "dpcominusy"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COOffset, "dpcooffset"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COAttachSmart, "dpcosmarta"),
+                                       new KeyStruct(Major.DrawAttr, Minor.CODoubleLine, "dpcotdouble"),
+                                       new KeyStruct(Major.DrawAttr, Minor.CORightAngle, "dpcotright"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COSingleLine, "dpcotsingle"),
+                                       new KeyStruct(Major.DrawAttr, Minor.COTripleLine, "dpcottriple"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawTextBoxMargin, "dptxbxmar"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawTextBoxText, "dptxbxtext"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawRoundRect, "dproundr"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawPointX, "dpptx"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawPointY, "dppty"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawPolyCount, "dppolycount"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawArcFlipX, "dparcflipx"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawArcFlipY, "dparcflipy"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineBlue, "dplinecob"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineGreen, "dplinecog"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineRed, "dplinecor"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLinePalette, "dplinepal"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineDashDot, "dplinedado"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineDashDotDot, "dplinedadodo"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineDash, "dplinedash"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineDot, "dplinedot"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineGray, "dplinegray"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineHollow, "dplinehollow"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineSolid, "dplinesolid"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawLineWidth, "dplinew"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawHollowEndArrow, "dpaendhol"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawEndArrowLength, "dpaendl"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawSolidEndArrow, "dpaendsol"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawEndArrowWidth, "dpaendw"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawHollowStartArrow,"dpastarthol"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawStartArrowLength,"dpastartl"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawSolidStartArrow, "dpastartsol"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawStartArrowWidth, "dpastartw"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawBgFillBlue, "dpfillbgcb"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawBgFillGreen, "dpfillbgcg"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawBgFillRed, "dpfillbgcr"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawBgFillPalette, "dpfillbgpal"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawBgFillGray, "dpfillbggray"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawFgFillBlue, "dpfillfgcb"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawFgFillGreen, "dpfillfgcg"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawFgFillRed, "dpfillfgcr"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawFgFillPalette, "dpfillfgpal"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawFgFillGray, "dpfillfggray"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawFillPatIndex, "dpfillpat"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawShadow, "dpshadow"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawShadowXOffset, "dpshadx"),
+                                       new KeyStruct(Major.DrawAttr, Minor.DrawShadowYOffset, "dpshady"),
+                                       new KeyStruct(Major.Version, Minor.Undefined, "rtf"),
+                                       new KeyStruct(Major.DefFont, Minor.Undefined, "deff"),
+                                       new KeyStruct(Major.Unicode, Minor.UnicodeCharBytes, "uc"),
+                                       new KeyStruct(Major.Unicode, Minor.UnicodeChar, "u"),
+                                       new KeyStruct(Major.Unicode, Minor.UnicodeDestination, "ud"),
+                                       new KeyStruct(Major.Unicode, Minor.UnicodeDualDestination, "upr"),
+                                       new KeyStruct(Major.Unicode, Minor.UnicodeAnsiCodepage, "ansicpg"),
+                       };
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Major.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Major.cs
new file mode 100644 (file)
index 0000000..023a012
--- /dev/null
@@ -0,0 +1,67 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal enum Major {
+               // Group class
+               BeginGroup      = 0,
+               EndGroup        = 1,
+
+               // Control
+               Version         = 0,
+               DefFont         = 1,
+               CharSet         = 2,
+
+               Destination     = 3,
+               FontFamily      = 4,
+               ColorName       = 5,
+               SpecialChar     = 6,
+               StyleAttr       = 7,
+               DocAttr         = 8,
+               SectAttr        = 9,
+               TblAttr         = 10,
+               ParAttr         = 11,
+               CharAttr        = 12,
+               PictAttr        = 13,
+               BookmarkAttr    = 14,
+               NeXTGrAttr      = 15,
+               FieldAttr       = 16,
+               TOCAttr         = 17,
+               PosAttr         = 18,
+               ObjAttr         = 19,
+               FNoteAttr       = 20,
+               KeyCodeAttr     = 21,
+               ACharAttr       = 22,
+               FontAttr        = 23,
+               FileAttr        = 24,
+               FileSource      = 25,
+               DrawAttr        = 26,
+               IndexAttr       = 27,
+               Unicode         = 28
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Minor.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Minor.cs
new file mode 100644 (file)
index 0000000..92afb4a
--- /dev/null
@@ -0,0 +1,765 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+       internal enum Minor {
+               Undefined       = -1,
+
+               // Major.CharSet
+               AnsiCharSet     = 0,
+               MacCharSet      = 1,
+               PcCharSet       = 2,
+               PcaCharSet      = 3,
+
+               // Major.Destination
+               FontTbl         = 0,
+               FontAltName     = 1,
+               EmbeddedFont    = 2,
+               FontFile        = 3,
+               FileTbl         = 4,
+               FileInfo        = 5,
+               ColorTbl        = 6,
+               StyleSheet      = 7,
+               KeyCode         = 8,
+               RevisionTbl     = 9,
+               Info            = 10,
+               ITitle          = 11,
+               ISubject        = 12,
+               IAuthor         = 13,
+               IOperator       = 14,
+               IKeywords       = 15,
+               IComment        = 16,
+               IVersion        = 17,
+               IDoccomm        = 18,
+               IVerscomm       = 19,
+               NextFile        = 20,
+               Template        = 21,
+               FNSep           = 22,
+               FNContSep       = 23,
+               FNContNotice    = 24,
+               ENSep           = 25,
+               ENContSep       = 26,
+               ENContNotice    = 27,
+               PageNumLevel    = 28,
+               ParNumLevelStyle= 29,
+               Header          = 30,
+               Footer          = 31,
+               HeaderLeft      = 32,
+               HeaderRight     = 33,
+               HeaderFirst     = 34,
+               FooterLeft      = 35,
+               FooterRight     = 36,
+               FooterFirst     = 37,
+               ParNumText      = 38,
+               ParNumbering    = 39,
+               ParNumTextAfter = 40,
+               ParNumTextBefore= 41,
+               BookmarkStart   = 42,
+               BookmarkEnd     = 43,
+               Pict            = 44,
+               Object          = 45,
+               ObjClass        = 46,
+               ObjName         = 47,
+               ObjTime         = 48,
+               ObjData         = 49,
+               ObjAlias        = 50,
+               ObjSection      = 51,
+               ObjResult       = 52,
+               ObjItem         = 53,
+               ObjTopic        = 54,
+               DrawObject      = 55,
+               Footnote        = 56,
+               AnnotRefStart   = 57,
+               AnnotRefEnd     = 58,
+               AnnotID         = 59,
+               AnnotAuthor     = 60,
+               Annotation      = 61,
+               AnnotRef        = 62,
+               AnnotTime       = 63,
+               AnnotIcon       = 64,
+               Field           = 65,
+               FieldInst       = 66,
+               FieldResult     = 67,
+               DataField       = 68,
+               Index           = 69,
+               IndexText       = 70,
+               IndexRange      = 71,
+               TOC             = 72,
+               NeXTGraphic     = 73,
+               MaxDestination  = 74,
+
+               // Major.FontFamily
+               FFNil           = 0,
+               FFRoman         = 1,
+               FFSwiss         = 2,
+               FFModern        = 3,
+               FFScript        = 4,
+               FFDecor         = 5,
+               FFTech          = 6,
+               FFBidirectional = 7,
+
+               // Major.ColorName
+               Red             = 0,
+               Green           = 1,
+               Blue            = 2,
+
+               // Major.SpecialChar
+               IIntVersion     = 0,
+               ICreateTime     = 1,
+               IRevisionTime   = 2,
+               IPrintTime      = 3,
+               IBackupTime     = 4,
+               IEditTime       = 5,
+               IYear           = 6,
+               IMonth          = 7,
+               IDay            = 8,
+               IHour           = 9,
+               IMinute         = 10,
+               ISecond         = 11,
+               INPages         = 12,
+               INWords         = 13,
+               INChars         = 14,
+               IIntID          = 15,
+               CurHeadDate     = 16,
+               CurHeadDateLong = 17,
+               CurHeadDateAbbrev= 18,
+               CurHeadTime     = 19,
+               CurHeadPage     = 20,
+               SectNum         = 21,
+               CurFNote        = 22,
+               CurAnnotRef     = 23,
+               FNoteSep        = 24,
+               FNoteCont       = 25,
+               Cell            = 26,
+               Row             = 27,
+               Par             = 28,
+               Sect            = 29,
+               Page            = 30,
+               Column          = 31,
+               Line            = 32,
+               SoftPage        = 33,
+               SoftColumn      = 34,
+               SoftLine        = 35,
+               SoftLineHt      = 36,
+               Tab             = 37,
+               EmDash          = 38,
+               EnDash          = 39,
+               EmSpace         = 40,
+               EnSpace         = 41,
+               Bullet          = 42,
+               LQuote          = 43,
+               RQuote          = 44,
+               LDblQuote       = 45,
+               RDblQuote       = 46,
+               Formula         = 47,
+               NoBrkSpace      = 49,
+               NoReqHyphen     = 50,
+               NoBrkHyphen     = 51,
+               OptDest         = 52,
+               LTRMark         = 53,
+               RTLMark         = 54,
+               NoWidthJoiner   = 55,
+               NoWidthNonJoiner= 56,
+               CurHeadPict     = 57,
+
+               // Major.StyleAttr
+               Additive        = 0,
+               BasedOn         = 1,
+               Next            = 2,
+
+               // Major.DocAttr
+               DefTab          = 0,
+               HyphHotZone     = 1,
+               HyphConsecLines = 2,
+               HyphCaps        = 3,
+               HyphAuto        = 4,
+               LineStart       = 5,
+               FracWidth       = 6,
+               MakeBackup      = 7,
+               RTFDefault      = 8,
+               PSOverlay       = 9,
+               DocTemplate     = 10,
+               DefLanguage     = 11,
+               FENoteType      = 12,
+               FNoteEndSect    = 13,
+               FNoteEndDoc     = 14,
+               FNoteText       = 15,
+               FNoteBottom     = 16,
+               ENoteEndSect    = 17,
+               ENoteEndDoc     = 18,
+               ENoteText       = 19,
+               ENoteBottom     = 20,
+               FNoteStart      = 21,
+               ENoteStart      = 22,
+               FNoteRestartPage= 23,
+               FNoteRestart    = 24,
+               FNoteRestartCont= 25,
+               ENoteRestart    = 26,
+               ENoteRestartCont= 27,
+               FNoteNumArabic  = 28,
+               FNoteNumLLetter = 29,
+               FNoteNumULetter = 30,
+               FNoteNumLRoman  = 31,
+               FNoteNumURoman  = 32,
+               FNoteNumChicago = 33,
+               ENoteNumArabic  = 34,
+               ENoteNumLLetter = 35,
+               ENoteNumULetter = 36,
+               ENoteNumLRoman  = 37,
+               ENoteNumURoman  = 38,
+               ENoteNumChicago = 39,
+               PaperWidth      = 40,
+               PaperHeight     = 41,
+               PaperSize       = 42,
+               LeftMargin      = 43,
+               RightMargin     = 44,
+               TopMargin       = 45,
+               BottomMargin    = 46,
+               FacingPage      = 47,
+               GutterWid       = 48,
+               MirrorMargin    = 49,
+               Landscape       = 50,
+               PageStart       = 51,
+               WidowCtrl       = 52,
+               LinkStyles      = 53,
+               NoAutoTabIndent = 54,
+               WrapSpaces      = 55,
+               PrintColorsBlack= 56,
+               NoExtraSpaceRL  = 57,
+               NoColumnBalance = 58,
+               CvtMailMergeQuote= 59,
+               SuppressTopSpace= 60,
+               SuppressPreParSpace= 61,
+               CombineTblBorders= 62,
+               TranspMetafiles = 63,
+               SwapBorders     = 64,
+               ShowHardBreaks  = 65,
+               FormProtected   = 66,
+               AllProtected    = 67,
+               FormShading     = 68,
+               FormDisplay     = 69,
+               PrintData       = 70,
+               RevProtected    = 71,
+               Revisions       = 72,
+               RevDisplay      = 73,
+               RevBar          = 74,
+               AnnotProtected  = 75,
+               RTLDoc          = 76,
+               LTRDoc          = 77,
+
+               // Major.SectAttr
+
+               SectDef         = 0,
+               ENoteHere       = 1,
+               PrtBinFirst     = 2,
+               PrtBin          = 3,
+               SectStyleNum    = 4,
+               NoBreak         = 5,
+               ColBreak        = 6,
+               PageBreak       = 7,
+               EvenBreak       = 8,
+               OddBreak        = 9,
+               Columns         = 10,
+               ColumnSpace     = 11,
+               ColumnNumber    = 12,
+               ColumnSpRight   = 13,
+               ColumnWidth     = 14,
+               ColumnLine      = 15,
+               LineModulus     = 16,
+               LineDist        = 17,
+               LineStarts      = 18,
+               LineRestart     = 19,
+               LineRestartPg   = 20,
+               LineCont        = 21,
+               SectPageWid     = 22,
+               SectPageHt      = 23,
+               SectMarginLeft  = 24,
+               SectMarginRight = 25,
+               SectMarginTop   = 26,
+               SectMarginBottom= 27,
+               SectMarginGutter= 28,
+               SectLandscape   = 29,
+               TitleSpecial    = 30,
+               HeaderY         = 31,
+               FooterY         = 32,
+               PageStarts      = 33,
+               PageCont        = 34,
+               PageRestart     = 35,
+               PageNumRight    = 36,
+               PageNumTop      = 37,
+               PageDecimal     = 38,
+               PageURoman      = 39,
+               PageLRoman      = 40,
+               PageULetter     = 41,
+               PageLLetter     = 42,
+               PageNumHyphSep  = 43,
+               PageNumSpaceSep = 44,
+               PageNumColonSep = 45,
+               PageNumEmdashSep= 46,
+               PageNumEndashSep= 47,
+               TopVAlign       = 48,
+               BottomVAlign    = 49,
+               CenterVAlign    = 50,
+               JustVAlign      = 51,
+               RTLSect         = 52,
+               LTRSect         = 53,
+
+               // Major.TblAttr
+               RowDef          = 0,
+               RowGapH         = 1,
+               CellPos         = 2,
+               MergeRngFirst   = 3,
+               MergePrevious   = 4,
+               RowLeft         = 5,
+               RowRight        = 6,
+               RowCenter       = 7,
+               RowLeftEdge     = 8,
+               RowHt           = 9,
+               RowHeader       = 10,
+               RowKeep         = 11,
+               RTLRow          = 12,
+               LTRRow          = 13,
+               RowBordTop      = 14,
+               RowBordLeft     = 15,
+               RowBordBottom   = 16,
+               RowBordRight    = 17,
+               RowBordHoriz    = 18,
+               RowBordVert     = 19,
+               CellBordBottom  = 20,
+               CellBordTop     = 21,
+               CellBordLeft    = 22,
+               CellBordRight   = 23,
+               CellShading     = 24,
+               CellBgPatH      = 25,
+               CellBgPatV      = 26,
+               CellFwdDiagBgPat= 27,
+               CellBwdDiagBgPat= 28,
+               CellHatchBgPat  = 29,
+               CellDiagHatchBgPat      = 30,
+               CellDarkBgPatH  = 31,
+               CellDarkBgPatV  = 32,
+               CellFwdDarkBgPat= 33,
+               CellBwdDarkBgPat= 34,
+               CellDarkHatchBgPat      = 35,
+               CellDarkDiagHatchBgPat  = 36,
+               CellBgPatLineColor      = 37,
+               CellBgPatColor  = 38,
+
+               // Major.ParAttr
+               ParDef          = 0,
+               StyleNum        = 1,
+               Hyphenate       = 2,
+               InTable         = 3,
+               Keep            = 4,
+               NoWidowControl  = 5,
+               KeepNext        = 6,
+               OutlineLevel    = 7,
+               NoLineNum       = 8,
+               PBBefore        = 9,
+               SideBySide      = 10,
+               QuadLeft        = 11,
+               QuadRight       = 12,
+               QuadJust        = 13,
+               QuadCenter      = 14,
+               FirstIndent     = 15,
+               LeftIndent      = 16,
+               RightIndent     = 17,
+               SpaceBefore     = 18,
+               SpaceAfter      = 19,
+               SpaceBetween    = 20,
+               SpaceMultiply   = 21,
+               SubDocument     = 22,
+               RTLPar          = 23,
+               LTRPar          = 24,
+               TabPos          = 25,
+               TabLeft         = 26,
+               TabRight        = 27,
+               TabCenter       = 28,
+               TabDecimal      = 29,
+               TabBar          = 30,
+               LeaderDot       = 31,
+               LeaderHyphen    = 32,
+               LeaderUnder     = 33,
+               LeaderThick     = 34,
+               LeaderEqual     = 35,
+               ParLevel        = 36,
+               ParBullet       = 37,
+               ParSimple       = 38,
+               ParNumCont      = 39,
+               ParNumOnce      = 40,
+               ParNumAcross    = 41,
+               ParHangIndent   = 42,
+               ParNumRestart   = 43,
+               ParNumCardinal  = 44,
+               ParNumDecimal   = 45,
+               ParNumULetter   = 46,
+               ParNumURoman    = 47,
+               ParNumLLetter   = 48,
+               ParNumLRoman    = 49,
+               ParNumOrdinal   = 50,
+               ParNumOrdinalText= 51,
+               ParNumBold      = 52,
+               ParNumItalic    = 53,
+               ParNumAllCaps   = 54,
+               ParNumSmallCaps = 55,
+               ParNumUnder     = 56,
+               ParNumDotUnder  = 57,
+               ParNumDbUnder   = 58,
+               ParNumNoUnder   = 59,
+               ParNumWordUnder = 60,
+               ParNumStrikethru= 61,
+               ParNumForeColor = 62,
+               ParNumFont      = 63,
+               ParNumFontSize  = 64,
+               ParNumIndent    = 65,
+               ParNumSpacing   = 66,
+               ParNumInclPrev  = 67,
+               ParNumCenter    = 68,
+               ParNumLeft      = 69,
+               ParNumRight     = 70,
+               ParNumStartAt   = 71,
+               BorderTop       = 72,
+               BorderBottom    = 73,
+               BorderLeft      = 74,
+               BorderRight     = 75,
+               BorderBetween   = 76,
+               BorderBar       = 77,
+               BorderBox       = 78,
+               BorderSingle    = 79,
+               BorderThick     = 80,
+               BorderShadow    = 81,
+               BorderDouble    = 82,
+               BorderDot       = 83,
+               BorderDash      = 84,
+               BorderHair      = 85,
+               BorderWidth     = 86,
+               BorderColor     = 87,
+               BorderSpace     = 88,
+               Shading         = 89,
+               BgPatH          = 90,
+               BgPatV          = 91,
+               FwdDiagBgPat    = 92,
+               BwdDiagBgPat    = 93,
+               HatchBgPat      = 94,
+               DiagHatchBgPat  = 95,
+               DarkBgPatH      = 96,
+               DarkBgPatV      = 97,
+               FwdDarkBgPat    = 98,
+               BwdDarkBgPat    = 99,
+               DarkHatchBgPat  = 100,
+               DarkDiagHatchBgPat= 101,
+               BgPatLineColor  = 102,
+               BgPatColor      = 103,
+
+               // Major.CharAttr
+               Plain           = 0,
+               Bold            = 1,
+               AllCaps         = 2,
+               Deleted         = 3,
+               SubScript       = 4,
+               SubScrShrink    = 5,
+               NoSuperSub      = 6,
+               Expand          = 7,
+               ExpandTwips     = 8,
+               Kerning         = 9,
+               FontNum         = 10,
+               FontSize        = 11,
+               Italic          = 12,
+               Outline         = 13,
+               Revised         = 14,
+               RevAuthor       = 15,
+               RevDTTM         = 16,
+               SmallCaps       = 17,
+               Shadow          = 18,
+               StrikeThru      = 19,
+               Underline       = 20,
+               DotUnderline    = 21,
+               DbUnderline     = 22,
+               NoUnderline     = 23,
+               WordUnderline   = 24,
+               SuperScript     = 25,
+               SuperScrShrink  = 26,
+               Invisible       = 27,
+               ForeColor       = 28,
+               BackColor       = 29,
+               RTLChar         = 30,
+               LTRChar         = 31,
+               CharStyleNum    = 32,
+               CharCharSet     = 33,
+               Language        = 34,
+               Gray            = 35,
+
+               // Major.PictAttr
+               MacQD           = 0,
+               PMMetafile      = 1,
+               WinMetafile     = 2,
+               DevIndBitmap    = 3,
+               WinBitmap       = 4,
+               PixelBits       = 5,
+               BitmapPlanes    = 6,
+               BitmapWid       = 7,
+               PicWid          = 8,
+               PicHt           = 9,
+               PicGoalWid      = 10,
+               PicGoalHt       = 11,
+               PicScaleX       = 12,
+               PicScaleY       = 13,
+               PicScaled       = 14,
+               PicCropTop      = 15,
+               PicCropBottom   = 16,
+               PicCropLeft     = 17,
+               PicCropRight    = 18,
+               PicMFHasBitmap  = 19,
+               PicMFBitsPerPixel= 20,
+               PicBinary       = 21,
+
+               // Major.BookmarkAttr
+               BookmarkFirstCol= 0,
+               BookmarkLastCol = 1,
+
+               // Major.NeXTGrAttr
+               NeXTGWidth      = 0,
+               NeXTGHeight     = 1,
+
+               // Major.FieldAttr
+               FieldDirty      = 0,
+               FieldEdited     = 1,
+               FieldLocked     = 2,
+               FieldPrivate    = 3,
+               FieldAlt        = 4,
+
+               // Major.TOCAttr
+               TOCType         = 0,
+               TOCLevel        = 1,
+
+               // Major.PosAttr
+               AbsWid          = 0,
+               AbsHt           = 1,
+               RPosMargH       = 2,
+               RPosPageH       = 3,
+               RPosColH        = 4,
+               PosX            = 5,
+               PosNegX         = 6,
+               PosXCenter      = 7,
+               PosXInside      = 8,
+               PosXOutSide     = 9,
+               PosXRight       = 10,
+               PosXLeft        = 11,
+               RPosMargV       = 12,
+               RPosPageV       = 13,
+               RPosParaV       = 14,
+               PosY            = 15,
+               PosNegY         = 16,
+               PosYInline      = 17,
+               PosYTop         = 18,
+               PosYCenter      = 19,
+               PosYBottom      = 20,
+               NoWrap          = 21,
+               DistFromTextAll = 22,
+               DistFromTextX   = 23,
+               DistFromTextY   = 24,
+               TextDistY       = 25,
+               DropCapLines    = 26,
+               DropCapType     = 27,
+
+               // Major.ObjAttr
+               ObjEmb          = 0,
+               ObjLink         = 1,
+               ObjAutoLink     = 2,
+               ObjSubscriber   = 3,
+               ObjPublisher    = 4,
+               ObjICEmb        = 5,
+               ObjLinkSelf     = 6,
+               ObjLock         = 7,
+               ObjUpdate       = 8,
+               ObjHt           = 9,
+               ObjWid          = 10,
+               ObjSetSize      = 11,
+               ObjAlign        = 12,
+               ObjTransposeY   = 13,
+               ObjCropTop      = 14,
+               ObjCropBottom   = 15,
+               ObjCropLeft     = 16,
+               ObjCropRight    = 17,
+               ObjScaleX       = 18,
+               ObjScaleY       = 19,
+               ObjResRTF       = 20,
+               ObjResPict      = 21,
+               ObjResBitmap    = 22,
+               ObjResText      = 23,
+               ObjResMerge     = 24,
+               ObjBookmarkPubObj= 25,
+               ObjPubAutoUpdate= 26,
+
+               // Major.FNoteAttr
+               FNAlt           = 0,
+
+               // Major.KeyCodeAttr
+               AltKey          = 0,
+               ShiftKey        = 1,
+               ControlKey      = 2,
+               FunctionKey     = 3,
+
+               // Major.ACharAttr
+               ACBold          = 0,
+               ACAllCaps       = 1,
+               ACForeColor     = 2,
+               ACSubScript     = 3,
+               ACExpand        = 4,
+               ACFontNum       = 5,
+               ACFontSize      = 6,
+               ACItalic        = 7,
+               ACLanguage      = 8,
+               ACOutline       = 9,
+               ACSmallCaps     = 10,
+               ACShadow        = 11,
+               ACStrikeThru    = 12,
+               ACUnderline     = 13,
+               ACDotUnderline  = 14,
+               ACDbUnderline   = 15,
+               ACNoUnderline   = 16,
+               ACWordUnderline = 17,
+               ACSuperScript   = 18,
+
+               // Major.FontAttr
+               FontCharSet     = 0,
+               FontPitch       = 1,
+               FontCodePage    = 2,
+               FTypeNil        = 3,
+               FTypeTrueType   = 4,
+
+               // Major.FileAttr
+               FileNum         = 0,
+               FileRelPath     = 1,
+               FileOSNum       = 2,
+
+               // Major.FileSource
+               SrcMacintosh    = 0,
+               SrcDOS          = 1,
+               SrcNTFS         = 2,
+               SrcHPFS         = 3,
+               SrcNetwork      = 4,
+
+               // Major.DrawAttr
+               DrawLock        = 0,
+               DrawPageRelX    = 1,
+               DrawColumnRelX  = 2,
+               DrawMarginRelX  = 3,
+               DrawPageRelY    = 4,
+               DrawColumnRelY  = 5,
+               DrawMarginRelY  = 6,
+               DrawHeight      = 7,
+               DrawBeginGroup  = 8,
+               DrawGroupCount  = 9,
+               DrawEndGroup    = 10,
+               DrawArc         = 11,
+               DrawCallout     = 12,
+               DrawEllipse     = 13,
+               DrawLine        = 14,
+               DrawPolygon     = 15,
+               DrawPolyLine    = 16,
+               DrawRect        = 17,
+               DrawTextBox     = 18,
+               DrawOffsetX     = 19,
+               DrawSizeX       = 20,
+               DrawOffsetY     = 21,
+               DrawSizeY       = 22,
+               COAngle         = 23,
+               COAccentBar     = 24,
+               COBestFit       = 25,
+               COBorder        = 26,
+               COAttachAbsDist = 27,
+               COAttachBottom  = 28,
+               COAttachCenter  = 29,
+               COAttachTop     = 30,
+               COLength        = 31,
+               CONegXQuadrant  = 32,
+               CONegYQuadrant  = 33,
+               COOffset        = 34,
+               COAttachSmart   = 35,
+               CODoubleLine    = 36,
+               CORightAngle    = 37,
+               COSingleLine    = 38,
+               COTripleLine    = 39,
+               DrawTextBoxMargin= 40,
+               DrawTextBoxText = 41,
+               DrawRoundRect   = 42,
+               DrawPointX      = 43,
+               DrawPointY      = 44,
+               DrawPolyCount   = 45,
+               DrawArcFlipX    = 46,
+               DrawArcFlipY    = 47,
+               DrawLineBlue    = 48,
+               DrawLineGreen   = 49,
+               DrawLineRed     = 50,
+               DrawLinePalette = 51,
+               DrawLineDashDot = 52,
+               DrawLineDashDotDot= 53,
+               DrawLineDash    = 54,
+               DrawLineDot     = 55,
+               DrawLineGray    = 56,
+               DrawLineHollow  = 57,
+               DrawLineSolid   = 58,
+               DrawLineWidth   = 59,
+               DrawHollowEndArrow      = 60,
+               DrawEndArrowLength      = 61,
+               DrawSolidEndArrow       = 62,
+               DrawEndArrowWidth       = 63,
+               DrawHollowStartArrow    = 64,
+               DrawStartArrowLength    = 65,
+               DrawSolidStartArrow     = 66,
+               DrawStartArrowWidth     = 67,
+               DrawBgFillBlue          = 68,
+               DrawBgFillGreen         = 69,
+               DrawBgFillRed           = 70,
+               DrawBgFillPalette       = 71,
+               DrawBgFillGray          = 72,
+               DrawFgFillBlue          = 73,
+               DrawFgFillGreen         = 74,
+               DrawFgFillRed           = 75,
+               DrawFgFillPalette       = 76,
+               DrawFgFillGray          = 77,
+               DrawFillPatIndex        = 78,
+               DrawShadow              = 79,
+               DrawShadowXOffset       = 80,
+               DrawShadowYOffset       = 81,
+
+               // Major.IndexAttr
+               IndexNumber     = 0,
+               IndexBold       = 1,
+               IndexItalic     = 2,
+
+               // Major.Unicode
+               UnicodeCharBytes        = 0,
+               UnicodeChar             = 1,
+               UnicodeDestination      = 2,
+               UnicodeDualDestination  = 3,
+               UnicodeAnsiCodepage     = 4
+
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/README b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/README
new file mode 100644 (file)
index 0000000..ccfb3fa
--- /dev/null
@@ -0,0 +1,7 @@
+This RTF parser was originally based on a C-based RTF parser written 
+by Paul DuBois (dubois@primate.wisc.edu). It came with the following license:
+
+ * This software may be redistributed without restriction and used for
+ * any purpose whatsoever.
+
+and was part of the code found in the 'rewind' project.
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs
new file mode 100644 (file)
index 0000000..e4250ff
--- /dev/null
@@ -0,0 +1,874 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+
+// COMPLETE
+
+#undef RTF_DEBUG
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Windows.Forms.RTF {
+       internal class RTF {
+               #region Local Variables
+               internal const char     EOF = unchecked((char)-1);
+               internal const int      NoParam = -1000000;
+
+               private TokenClass      rtf_class;
+               private Major           major;
+               private Minor           minor;
+               private int             param;
+               private int             format;
+               private StringBuilder   text_buffer;
+               private int             line_num;
+               private int             line_pos;
+
+               private char            pushed_char;
+               private StringBuilder   pushed_text_buffer;
+               private TokenClass      pushed_class;
+               private Major           pushed_major;
+               private Minor           pushed_minor;
+               private int             pushed_param;
+
+               private char            prev_char;
+               private bool            bump_line;
+
+               private Font            font_list;
+               private Color           color_list;
+               private Style           style_list;
+
+               private Charset         cur_charset;
+               private Stack           charset_stack;
+
+               private Style           styles;
+               private Color           colors;
+               private Font            fonts;
+
+               private StreamReader    source;
+
+               private static Hashtable        key_table;
+               private static KeyStruct[]      Keys = KeysInit.Init();
+
+               private DestinationCallback     destination_callbacks;
+               private ClassCallback           class_callbacks;
+               #endregion      // Local Variables
+
+               #region Constructors
+               static RTF() {
+                       key_table = new Hashtable(Keys.Length);
+                       for (int i = 0; i < Keys.Length; i++) {
+                               key_table[Keys[i].Symbol] = Keys[i];
+                       }
+               }
+
+               public RTF(Stream stream) {
+                       source = new StreamReader(stream);
+
+                       text_buffer = new StringBuilder(1024);
+                       pushed_text_buffer = new StringBuilder(1024);
+
+                       rtf_class = TokenClass.None;
+                       pushed_class = TokenClass.None;
+                       pushed_char = unchecked((char)-1);
+
+                       line_num = 0;
+                       line_pos = 0;
+                       prev_char = unchecked((char)-1);
+                       bump_line = false;
+
+                       cur_charset = new Charset();
+
+                       destination_callbacks = new DestinationCallback();
+                       class_callbacks = new ClassCallback();
+
+                       destination_callbacks[Minor.FontTbl] = new DestinationDelegate(ReadFontTbl);
+                       destination_callbacks[Minor.ColorTbl] = new DestinationDelegate(ReadColorTbl);
+                       destination_callbacks[Minor.StyleSheet] = new DestinationDelegate(ReadStyleSheet);
+                       destination_callbacks[Minor.Info] = new DestinationDelegate(ReadInfoGroup);
+                       destination_callbacks[Minor.Pict] = new DestinationDelegate(ReadPictGroup);
+                       destination_callbacks[Minor.Object] = new DestinationDelegate(ReadObjGroup);
+               }
+               #endregion      // Constructors
+
+               #region Properties
+               public TokenClass TokenClass {
+                       get {
+                               return this.rtf_class;
+                       }
+
+                       set {
+                               this.rtf_class = value;
+                       }
+               }
+
+               public Major Major {
+                       get {
+                               return this.major;
+                       }
+
+                       set {
+                               this.major = value;
+                       }
+               }
+
+               public Minor Minor {
+                       get {
+                               return this.minor;
+                       }
+
+                       set {
+                               this.minor = value;
+                       }
+               }
+
+               public int Param {
+                       get {
+                               return this.param;
+                       }
+
+                       set {
+                               this.param = value;
+                       }
+               }
+
+               public string Text {
+                       get {
+                               return this.text_buffer.ToString();
+                       }
+
+                       set {
+                               if (value == null) {
+                                       this.text_buffer.Length = 0;
+                               } else {
+                                       this.text_buffer = new StringBuilder(value);
+                               }
+                       }
+               }
+
+               public Color Colors {
+                       get {
+                               return colors;
+                       }
+
+                       set {
+                               colors = value;
+                       }
+               }
+
+               public Style Styles {
+                       get {
+                               return styles;
+                       }
+
+                       set {
+                               styles = value;
+                       }
+               }
+
+               public Font Fonts {
+                       get {
+                               return fonts;
+                       }
+
+                       set {
+                               fonts = value;
+                       }
+               }
+
+               public ClassCallback ClassCallback {
+                       get {
+                               return class_callbacks;
+                       }
+
+                       set {
+                               class_callbacks = value;
+                       }
+               }
+
+               public DestinationCallback DestinationCallback {
+                       get {
+                               return destination_callbacks;
+                       }
+
+                       set {
+                               destination_callbacks = value;
+                       }
+               }
+
+               public int LineNumber {
+                       get {
+                               return line_num;
+                       }
+               }
+
+               public int LinePos {
+                       get {
+                               return line_pos;
+                       }
+               }
+               #endregion      // Properties
+
+               #region Methods
+               /// <summary>Read the next character from the input</summary>
+               private char GetChar() {
+                       char    c;
+                       bool    old_bump_line;
+
+                       if ((c = (char)source.Read()) != EOF) {
+                               this.text_buffer.Append(c);
+                       }
+
+                       if (this.prev_char == EOF) {
+                               this.bump_line = true;
+                       }
+
+                       old_bump_line = bump_line;
+                       bump_line = false;
+
+                       if (c == '\r') {
+                               bump_line = true;
+                       } else if (c == '\n') {
+                               bump_line = true;
+                               if (this.prev_char == '\r') {
+                                       old_bump_line = false;
+                               }
+                       }
+
+                       this.line_pos ++;
+                       if (old_bump_line) {
+                               this.line_num++;
+                               this.line_pos = 1;
+                       }
+
+                       this.prev_char = c;
+                       return c;
+               }
+
+               /// <summary>Parse the RTF stream</summary>
+               public void Read() {
+                       while (GetToken() != TokenClass.EOF) {
+                               RouteToken();
+                       }
+               }
+
+               /// <summary>Route a token</summary>
+               public void RouteToken() {
+                       if (CheckCM(TokenClass.Control, Major.Destination)) {
+                               DestinationDelegate d;
+
+                               d = destination_callbacks[minor];
+                               if (d != null) {
+                                       d(this);
+                               }
+                       }
+
+                       // Invoke class callback if there is one
+                       ClassDelegate c;
+
+                       c = class_callbacks[rtf_class];
+                       if (c != null) {
+                               c(this);
+                       }
+                       
+               }
+
+               /// <summary>Skip to the end of the current group</summary>
+               public void SkipGroup() {
+                       int     level;
+
+                       level = 1;
+
+                       while (GetToken() != TokenClass.EOF) {
+                               if (rtf_class == TokenClass.Group) {
+                                       if (this.major == Major.BeginGroup) {
+                                               level++;
+                                       } else if (this.major == Major.EndGroup) {
+                                               level--;
+                                               if (level < 1) {
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               /// <summary>Return the next token in the stream</summary>
+               public TokenClass GetToken() {
+                       if (pushed_class != TokenClass.None) {
+                               this.rtf_class = this.pushed_class;
+                               this.major = this.pushed_major;
+                               this.minor = this.pushed_minor;
+                               this.param = this.pushed_param;
+                               this.pushed_class = TokenClass.None;
+                               return this.rtf_class;
+                       }
+
+                       GetToken2();
+
+                       if (this.rtf_class == TokenClass.Text) {
+                               this.minor = (Minor)this.cur_charset[(int)this.major];
+                       }
+
+                       if (this.cur_charset.Flags == CharsetFlags.None) {
+                               return this.rtf_class;
+                       }
+
+                       if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
+                               this.cur_charset.ReadMap();
+                       } else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
+                               Font    fp;
+
+                               fp = Font.GetFont(this.font_list, this.param);
+
+                               if (fp != null) {
+                                       if (fp.Name.StartsWith("Symbol")) {
+                                               this.cur_charset.ID = CharsetType.Symbol;
+                                       } else {
+                                               this.cur_charset.ID = CharsetType.General;
+                                       }
+                               } else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
+                                       switch(this.major) {
+                                               case Major.BeginGroup: {
+                                                       this.charset_stack.Push(this.cur_charset);
+                                                       break;
+                                               }
+
+                                               case Major.EndGroup: {
+                                                       this.cur_charset = (Charset)this.charset_stack.Pop();
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+
+                       return this.rtf_class;
+               }
+
+               private void GetToken2() {
+                       char    c;
+                       int     sign;
+
+                       this.rtf_class = TokenClass.Unknown;
+                       this.param = NoParam;
+
+                       this.text_buffer.Length = 0;
+
+                       if (this.pushed_char != EOF) {
+                               c = this.pushed_char;
+                               this.text_buffer.Append(c);
+                               this.pushed_char = EOF;
+                       } else if ((c = GetChar()) == EOF) {
+                               this.rtf_class = TokenClass.EOF;
+                               return;
+                       }
+
+                       if (c == '{') {
+                               this.rtf_class = TokenClass.Group;
+                               this.major = Major.BeginGroup;
+                               return;
+                       }
+
+                       if (c == '}') {
+                               this.rtf_class = TokenClass.Group;
+                               this.major = Major.EndGroup;
+                               return;
+                       }
+
+                       if (c != '\\') {
+                               if (c != '\t') {
+                                       this.rtf_class = TokenClass.Text;
+                                       this.major = (Major)c;  // FIXME - typing?
+                                       return;
+                               } else {
+                                       this.rtf_class = TokenClass.Control;
+                                       this.major = Major.SpecialChar;
+                                       this.minor = Minor.Tab;
+                                       return;
+                               }
+                       }
+
+                       if ((c = GetChar()) == EOF) {
+                               // Not so good
+                               return;
+                       }
+
+                       if (!Char.IsLetter(c)) {
+                               if (c == '\'') {
+                                       char c2;
+
+                                       if ((c = GetChar()) == EOF) {
+                                               return;
+                                       }
+
+                                       if ((c2 = GetChar()) == EOF) {
+                                               return;
+                                       }
+
+                                       this.rtf_class = TokenClass.Text;
+                                       this.major = (Major)((Char)((Convert.ToByte(c.ToString(), 16) * 16 + Convert.ToByte(c2.ToString(), 16))));
+                                       return;
+                               }
+
+                               // Escaped char
+                               if (c == ':' || c == '{' || c == '}' || c == '\\') {
+                                       this.rtf_class = TokenClass.Text;
+                                       this.major = (Major)c;
+                                       return;
+                               }
+
+                               Lookup(this.text_buffer.ToString());
+                               return;
+                       }
+
+                       while (Char.IsLetter(c)) {
+                               if ((c = GetChar()) == EOF) {
+                                       break;
+                               }
+                       }
+
+                       if (c != EOF) {
+                               this.text_buffer.Length--;
+                       }
+
+                       Lookup(this.text_buffer.ToString());
+
+                       if (c != EOF) {
+                               this.text_buffer.Append(c);
+                       }
+
+                       sign = 1;
+                       if (c == '-') {
+                               sign = -1;
+                               c = GetChar();
+                       }
+
+                       if (c != EOF && Char.IsDigit(c)) {
+                               this.param = 0;
+                               while (Char.IsDigit(c)) {
+                                       this.param = this.param * 10 + Convert.ToByte(c) - 48;
+                                       if ((c = GetChar()) == EOF) {
+                                               break;
+                                       }
+                               }
+                               this.param *= sign;
+                       }
+
+                       if (c != EOF) {
+                               if (c != ' ') {
+                                       this.pushed_char = c;
+                               }
+                               this.text_buffer.Length--;
+                       }
+               }
+
+               public void SetToken(TokenClass cl, Major maj, Minor min, int par, string text) {
+                       this.rtf_class = cl;
+                       this.major = maj;
+                       this.minor = min;
+                       this.param = par;
+                       if (par == NoParam) {
+                               this.text_buffer = new StringBuilder(text);
+                       } else {
+                               this.text_buffer = new StringBuilder(text + par.ToString());
+                       }
+               }
+
+               public void UngetToken() {
+                       if (this.pushed_class != TokenClass.None) {
+                               throw new RTFException(this, "Cannot unget more than one token");
+                       }
+
+                       if (this.rtf_class == TokenClass.None) {
+                               throw new RTFException(this, "No token to unget");
+                       }
+
+                       this.pushed_class = this.rtf_class;
+                       this.pushed_major = this.major;
+                       this.pushed_minor = this.minor;
+                       this.pushed_param = this.param;
+                       this.pushed_text_buffer = new StringBuilder(this.text_buffer.ToString());
+               }
+
+               public TokenClass PeekToken() {
+                       GetToken();
+                       UngetToken();
+                       return rtf_class;
+               }
+
+               public void Lookup(string token) {
+                       Object          obj;
+                       KeyStruct       key;
+
+                       obj = key_table[token.Substring(1)];
+                       if (obj == null) {
+                               rtf_class = TokenClass.Unknown;
+                               return;
+                       }
+
+                       key = (KeyStruct)obj;
+                       this.rtf_class = TokenClass.Control;
+                       this.major = key.Major;
+                       this.minor = key.Minor;
+               }
+
+               public bool CheckCM(TokenClass rtf_class, Major major) {
+                       if ((this.rtf_class == rtf_class) && (this.major == major)) {
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               public bool CheckCMM(TokenClass rtf_class, Major major, Minor minor) {
+                       if ((this.rtf_class == rtf_class) && (this.major == major) && (this.minor == minor)) {
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               public bool CheckMM(Major major, Minor minor) {
+                       if ((this.major == major) && (this.minor == minor)) {
+                               return true;
+                       }
+
+                       return false;
+               }
+               #endregion      // Methods
+
+               #region Default Delegates
+               private void ReadFontTbl(RTF rtf) {
+                       int     old;
+                       Font    font;
+
+                       old = -1;
+                       font = null;
+
+                       while (true) {
+                               rtf.GetToken();
+
+                               if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+                                       break;
+                               }
+
+                               if (old < 0) {
+                                       if (rtf.CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
+                                               old = 1;
+                                       } else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+                                               old = 0;
+                                       } else {
+                                               throw new RTFException(rtf, "Cannot determine format");
+                                       }
+                               }
+
+                               if (old == 0) {
+                                       if (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+                                               throw new RTFException(rtf, "missing \"{\"");
+                                       }
+                                       rtf.GetToken();
+                               }
+
+                               font = new Font(rtf);
+
+                               while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup))) {
+                                       if (rtf.rtf_class == TokenClass.Control) {
+                                               switch(rtf.major) {
+                                                       case Major.FontFamily: {
+                                                               font.Family = (int)rtf.minor;
+                                                               break;
+                                                       }
+
+                                                       case Major.CharAttr: {
+                                                               switch(rtf.minor) {
+                                                                       case Minor.FontNum: {
+                                                                               font.Num = rtf.param;
+                                                                               break;
+                                                                       }
+
+                                                                       default: {
+                                                                               #if RTF_DEBUG
+                                                                                       Console.WriteLine("Got unhandled Control.CharAttr.Minor: " + rtf.minor);
+                                                                               #endif
+                                                                               break;
+                                                                       }
+                                                               }
+                                                               break;
+                                                       }
+
+                                                       case Major.FontAttr: {
+                                                               switch (rtf.minor) {
+                                                                       case Minor.FontCharSet: {
+                                                                               font.Charset = (CharsetType)rtf.param;
+                                                                               break;
+                                                                       }
+
+                                                                       case Minor.FontPitch: {
+                                                                               font.Pitch = rtf.param;
+                                                                               break;
+                                                                       }
+
+                                                                       case Minor.FontCodePage: {
+                                                                               font.Codepage = rtf.param;
+                                                                               break;
+                                                                       }
+
+                                                                       case Minor.FTypeNil:
+                                                                       case Minor.FTypeTrueType: {
+                                                                               font.Type = rtf.param;
+                                                                               break;
+                                                                       }
+                                                                       default: {
+                                                                               #if RTF_DEBUG
+                                                                                       Console.WriteLine("Got unhandled Control.FontAttr.Minor: " + rtf.minor);
+                                                                               #endif
+                                                                               break;
+                                                                       }
+                                                               }
+                                                               break;
+                                                       }
+
+                                                       default: {
+                                                               #if RTF_DEBUG
+                                                                       Console.WriteLine("ReadFontTbl: Unknown Control token " + rtf.major);
+                                                               #endif
+                                                               break;
+                                                       }
+                                               }
+                                       } else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+                                               rtf.SkipGroup();
+                                       } else if (rtf.rtf_class == TokenClass.Text) {
+                                               StringBuilder   sb;
+
+                                               sb = new StringBuilder();
+
+                                               while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup))) {
+                                                       sb.Append((char)rtf.major);
+                                                       rtf.GetToken();
+                                               }
+
+                                               if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+                                                       rtf.UngetToken();
+                                               }
+
+                                               font.Name = sb.ToString();
+                                               continue;
+#if RTF_DEBUG
+                                       } else {
+                                               Console.WriteLine("ReadFontTbl: Unknown token " + rtf.text_buffer);
+#endif
+                                       }
+
+                                       rtf.GetToken();
+                               }
+
+                               if (old == 0) {
+                                       rtf.GetToken();
+
+                                       if (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+                                               throw new RTFException(rtf, "Missing \"}\"");
+                                       }
+                               }
+                       }
+
+                       if (font == null) {
+                               throw new RTFException(rtf, "No font created");
+                       }
+
+                       if (font.Num == -1) {
+                               throw new RTFException(rtf, "Missing font number");
+                       }
+
+                       rtf.RouteToken();
+               }
+
+               private void ReadColorTbl(RTF rtf) {
+                       Color   color;
+                       int     num;
+
+                       num = 0;
+
+                       while (true) {
+                               rtf.GetToken();
+
+                               if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+                                       break;
+                               }
+
+                               color = new Color(rtf);
+                               color.Num = num++;
+
+                               while (rtf.CheckCM(TokenClass.Control, Major.ColorName)) {
+                                       switch (rtf.minor) {
+                                               case Minor.Red: {
+                                                       color.Red = rtf.param;
+                                                       break;
+                                               }
+
+                                               case Minor.Green: {
+                                                       color.Green = rtf.param;
+                                                       break;
+                                               }
+
+                                               case Minor.Blue: {
+                                                       color.Blue = rtf.param;
+                                                       break;
+                                               }
+                                       }
+
+                                       rtf.GetToken();
+                               }
+                               if (!rtf.CheckCM(TokenClass.Text, (Major)';')) {
+                                       throw new RTFException(rtf, "Malformed color entry");
+                               }
+                       }
+                       rtf.RouteToken();
+               }
+
+               private void ReadStyleSheet(RTF rtf) {
+                       Style           style;
+                       StringBuilder   sb;
+
+                       sb = new StringBuilder();
+
+                       while (true) {
+                               rtf.GetToken();
+
+                               if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+                                       break;
+                               }
+
+                               style = new Style(rtf);
+
+                               if (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+                                       throw new RTFException(rtf, "Missing \"{\"");
+                               }
+
+                               while (true) {
+                                       rtf.GetToken();
+
+                                       if ((rtf.rtf_class == TokenClass.EOF) || rtf.CheckCM(TokenClass.Text, (Major)';')) {
+                                               break;
+                                       }
+
+                                       if (rtf.rtf_class == TokenClass.Control) {
+                                               if (rtf.CheckMM(Major.SpecialChar, Minor.OptDest)) {
+                                                       continue;
+                                               }
+                                               if (rtf.CheckMM(Major.ParAttr, Minor.StyleNum)) {
+                                                       style.Num = rtf.param;
+                                                       style.Type = StyleType.Paragraph;
+                                                       continue;
+                                               }
+                                               if (rtf.CheckMM(Major.CharAttr, Minor.CharStyleNum)) {
+                                                       style.Num = rtf.param;
+                                                       style.Type = StyleType.Character;
+                                                       continue;
+                                               }
+                                               if (rtf.CheckMM(Major.StyleAttr, Minor.SectStyleNum)) {
+                                                       style.Num = rtf.param;
+                                                       style.Type = StyleType.Section;
+                                                       continue;
+                                               }
+                                               if (rtf.CheckMM(Major.StyleAttr, Minor.BasedOn)) {
+                                                       style.BasedOn = rtf.param;
+                                                       continue;
+                                               }
+                                               if (rtf.CheckMM(Major.StyleAttr, Minor.Additive)) {
+                                                       style.Additive = true;
+                                                       continue;
+                                               }
+                                               if (rtf.CheckMM(Major.StyleAttr, Minor.Next)) {
+                                                       style.NextPar = rtf.param;
+                                                       continue;
+                                               }
+
+                                               new StyleElement(style, rtf.rtf_class, rtf.major, rtf.minor, rtf.param, rtf.text_buffer.ToString());
+                                       } else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+                                               // This passes over "{\*\keycode ... }, among other things
+                                               rtf.SkipGroup();
+                                       } else if (rtf.rtf_class == TokenClass.Text) {
+                                               while (rtf.rtf_class == TokenClass.Text) {
+                                                       if (rtf.major == (Major)';') {
+                                                               rtf.UngetToken();
+                                                               break;
+                                                       }
+
+                                                       sb.Append((char)rtf.major);
+                                                       rtf.GetToken();
+                                               }
+
+                                               style.Name = sb.ToString();
+#if RTF_DEBUG
+                                       } else {
+                                               Console.WriteLine("ReadStyleSheet: Ignored token " + rtf.text_buffer);
+#endif
+                                       }
+                               }
+                               rtf.GetToken();
+
+                               if (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+                                       throw new RTFException(rtf, "Missing EndGroup (\"}\"");
+                               }
+
+                               // Sanity checks
+                               if (style.Name == null) {
+                                       throw new RTFException(rtf, "Style must have name");
+                               }
+
+                               if (style.Num < 0) {
+                                       if (!sb.ToString().StartsWith("Normal") && !sb.ToString().StartsWith("Standard")) {
+                                               throw new RTFException(rtf, "Missing style number");
+                                       }
+
+                                       style.Num = Style.NormalStyleNum;
+                               }
+
+                               if (style.NextPar == -1) {
+                                       style.NextPar = style.Num;
+                               }
+                       }
+
+                       rtf.RouteToken();
+               }
+
+               private void ReadInfoGroup(RTF rtf) {
+                       rtf.SkipGroup();
+                       rtf.RouteToken();
+               }
+
+               private void ReadPictGroup(RTF rtf) {
+                       rtf.SkipGroup();
+                       rtf.RouteToken();
+               }
+
+               private void ReadObjGroup(RTF rtf) {
+                       rtf.SkipGroup();
+                       rtf.RouteToken();
+               }
+               #endregion      // Default Delegates
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTFException.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTFException.cs
new file mode 100644 (file)
index 0000000..07d35f2
--- /dev/null
@@ -0,0 +1,81 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Text;
+
+namespace System.Windows.Forms.RTF {
+       internal class RTFException : ApplicationException {
+               #region Local Variables
+               private int             pos;
+               private int             line;
+               private TokenClass      token_class;
+               private Major           major;
+               private Minor           minor;
+               private int             param;
+               private string          text;
+               private string          error_message;
+               #endregion      // Local Variables
+
+               #region Constructors
+               public RTFException(RTF rtf, string error_message) {
+                       this.pos = rtf.LinePos;
+                       this.line = rtf.LineNumber;
+                       this.token_class = rtf.TokenClass;
+                       this.major = rtf.Major;
+                       this.minor = rtf.Minor;
+                       this.param = rtf.Param;
+                       this.text = rtf.Text;
+                       this.error_message = error_message;
+               }
+               #endregion      // Constructors
+
+               #region Properties
+               public override string Message {
+                       get {
+                               StringBuilder   sb;
+
+                               sb = new StringBuilder();
+                               sb.Append(error_message);
+                               sb.Append("\n");
+
+                               sb.Append("RTF Stream Info: Pos:" + pos + " Line:" + line);
+                               sb.Append("\n");
+
+                               sb.Append("TokenClass:" + token_class + ", ");
+                               sb.Append("Major:" + String.Format("{0}", (int)major) + ", ");
+                               sb.Append("Minor:" + String.Format("{0}", (int)minor) + ", ");
+                               sb.Append("Param:" + String.Format("{0}", param) + ", ");
+                               sb.Append("Text:" + text);
+
+                               return sb.ToString();
+                       }
+               }
+               #endregion      // Properties
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs
new file mode 100644 (file)
index 0000000..02eacf8
--- /dev/null
@@ -0,0 +1,386 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal enum StandardCharCode {
+               nothing                 = 0,
+               space                   = 1,
+               exclam                  = 2,
+               quotedbl                = 3,
+               numbersign              = 4,
+               dollar                  = 5,
+               percent                 = 6,
+               ampersand               = 7,
+               quoteright              = 8,
+               parenleft               = 9,
+               parenright              = 10,
+               asterisk                = 11,
+               plus                    = 12,
+               comma                   = 13,
+               hyphen                  = 14,
+               period                  = 15,
+               slash                   = 16,
+               zero                    = 17,
+               one                     = 18,
+               two                     = 19,
+               three                   = 20,
+               four                    = 21,
+               five                    = 22,
+               six                     = 23,
+               seven                   = 24,
+               eight                   = 25,
+               nine                    = 26,
+               colon                   = 27,
+               semicolon               = 28,
+               less                    = 29,
+               equal                   = 30,
+               greater                 = 31,
+               question                = 32,
+               at                      = 33,
+               A                       = 34,
+               B                       = 35,
+               C                       = 36,
+               D                       = 37,
+               E                       = 38,
+               F                       = 39,
+               G                       = 40,
+               H                       = 41,
+               I                       = 42,
+               J                       = 43,
+               K                       = 44,
+               L                       = 45,
+               M                       = 46,
+               N                       = 47,
+               O                       = 48,
+               P                       = 49,
+               Q                       = 50,
+               R                       = 51,
+               S                       = 52,
+               T                       = 53,
+               U                       = 54,
+               V                       = 55,
+               W                       = 56,
+               X                       = 57,
+               Y                       = 58,
+               Z                       = 59,
+               bracketleft             = 60,
+               backslash               = 61,
+               bracketright            = 62,
+               asciicircum             = 63,
+               underscore              = 64,
+               quoteleft               = 65,
+               a                       = 66,
+               b                       = 67,
+               c                       = 68,
+               d                       = 69,
+               e                       = 70,
+               f                       = 71,
+               g                       = 72,
+               h                       = 73,
+               i                       = 74,
+               j                       = 75,
+               k                       = 76,
+               l                       = 77,
+               m                       = 78,
+               n                       = 79,
+               o                       = 80,
+               p                       = 81,
+               q                       = 82,
+               r                       = 83,
+               s                       = 84,
+               t                       = 85,
+               u                       = 86,
+               v                       = 87,
+               w                       = 88,
+               x                       = 89,
+               y                       = 90,
+               z                       = 91,
+               braceleft               = 92,
+               bar                     = 93,
+               braceright              = 94,
+               asciitilde              = 95,
+               exclamdown              = 96,
+               cent                    = 97,
+               sterling                = 98,
+               fraction                = 99,
+               yen                     = 100,
+               florin                  = 101,
+               section                 = 102,
+               currency                = 103,
+               quotedblleft            = 104,
+               guillemotleft           = 105,
+               guilsinglleft           = 106,
+               guilsinglright          = 107,
+               fi                      = 108,
+               fl                      = 109,
+               endash                  = 110,
+               dagger                  = 111,
+               daggerdbl               = 112,
+               periodcentered          = 113,
+               paragraph               = 114,
+               bullet                  = 115,
+               quotesinglbase          = 116,
+               quotedblbase            = 117,
+               quotedblright           = 118,
+               guillemotright          = 119,
+               ellipsis                = 120,
+               perthousand             = 121,
+               questiondown            = 122,
+               grave                   = 123,
+               acute                   = 124,
+               circumflex              = 125,
+               tilde                   = 126,
+               macron                  = 127,
+               breve                   = 128,
+               dotaccent               = 129,
+               dieresis                = 130,
+               ring                    = 131,
+               cedilla                 = 132,
+               hungarumlaut            = 133,
+               ogonek                  = 134,
+               caron                   = 135,
+               emdash                  = 136,
+               AE                      = 137,
+               ordfeminine             = 138,
+               Lslash                  = 139,
+               Oslash                  = 140,
+               OE                      = 141,
+               ordmasculine            = 142,
+               ae                      = 143,
+               dotlessi                = 144,
+               lslash                  = 145,
+               oslash                  = 146,
+               oe                      = 147,
+               germandbls              = 148,
+               Aacute                  = 149,
+               Acircumflex             = 150,
+               Adieresis               = 151,
+               Agrave                  = 152,
+               Aring                   = 153,
+               Atilde                  = 154,
+               Ccedilla                = 155,
+               Eacute                  = 156,
+               Ecircumflex             = 157,
+               Edieresis               = 158,
+               Egrave                  = 159,
+               Eth                     = 160,
+               Iacute                  = 161,
+               Icircumflex             = 162,
+               Idieresis               = 163,
+               Igrave                  = 164,
+               Ntilde                  = 165,
+               Oacute                  = 166,
+               Ocircumflex             = 167,
+               Odieresis               = 168,
+               Ograve                  = 169,
+               Otilde                  = 170,
+               Scaron                  = 171,
+               Thorn                   = 172,
+               Uacute                  = 173,
+               Ucircumflex             = 174,
+               Udieresis               = 175,
+               Ugrave                  = 176,
+               Yacute                  = 177,
+               Ydieresis               = 178,
+               aacute                  = 179,
+               acircumflex             = 180,
+               adieresis               = 181,
+               agrave                  = 182,
+               aring                   = 183,
+               atilde                  = 184,
+               brokenbar               = 185,
+               ccedilla                = 186,
+               copyright               = 187,
+               degree                  = 188,
+               divide                  = 189,
+               eacute                  = 190,
+               ecircumflex             = 191,
+               edieresis               = 192,
+               egrave                  = 193,
+               eth                     = 194,
+               iacute                  = 195,
+               icircumflex             = 196,
+               idieresis               = 197,
+               igrave                  = 198,
+               logicalnot              = 199,
+               minus                   = 200,
+               multiply                = 201,
+               ntilde                  = 202,
+               oacute                  = 203,
+               ocircumflex             = 204,
+               odieresis               = 205,
+               ograve                  = 206,
+               onehalf                 = 207,
+               onequarter              = 208,
+               onesuperior             = 209,
+               otilde                  = 210,
+               plusminus               = 211,
+               registered              = 212,
+               thorn                   = 213,
+               threequarters           = 214,
+               threesuperior           = 215,
+               trademark               = 216,
+               twosuperior             = 217,
+               uacute                  = 218,
+               ucircumflex             = 219,
+               udieresis               = 220,
+               ugrave                  = 221,
+               yacute                  = 222,
+               ydieresis               = 223,
+               Alpha                   = 224,
+               Beta                    = 225,
+               Chi                     = 226,
+               Delta                   = 227,
+               Epsilon                 = 228,
+               Phi                     = 229,
+               Gamma                   = 230,
+               Eta                     = 231,
+               Iota                    = 232,
+               Kappa                   = 233,
+               Lambda                  = 234,
+               Mu                      = 235,
+               Nu                      = 236,
+               Omicron                 = 237,
+               Pi                      = 238,
+               Theta                   = 239,
+               Rho                     = 240,
+               Sigma                   = 241,
+               Tau                     = 242,
+               Upsilon                 = 243,
+               varUpsilon              = 244,
+               Omega                   = 245,
+               Xi                      = 246,
+               Psi                     = 247,
+               Zeta                    = 248,
+               alpha                   = 249,
+               beta                    = 250,
+               chi                     = 251,
+               delta                   = 252,
+               epsilon                 = 253,
+               phi                     = 254,
+               varphi                  = 255,
+               gamma                   = 256,
+               eta                     = 257,
+               iota                    = 258,
+               kappa                   = 259,
+               lambda                  = 260,
+               mu                      = 261,
+               nu                      = 262,
+               omicron                 = 263,
+               pi                      = 264,
+               varpi                   = 265,
+               theta                   = 266,
+               vartheta                = 267,
+               rho                     = 268,
+               sigma                   = 269,
+               varsigma                = 270,
+               tau                     = 271,
+               upsilon                 = 272,
+               omega                   = 273,
+               xi                      = 274,
+               psi                     = 275,
+               zeta                    = 276,
+               nobrkspace              = 277,
+               nobrkhyphen             = 278,
+               lessequal               = 279,
+               greaterequal            = 280,
+               infinity                = 281,
+               integral                = 282,
+               notequal                = 283,
+               radical                 = 284,
+               radicalex               = 285,
+               approxequal             = 286,
+               apple                   = 287,
+               partialdiff             = 288,
+               opthyphen               = 289,
+               formula                 = 290,
+               lozenge                 = 291,
+               universal               = 292,
+               existential             = 293,
+               suchthat                = 294,
+               congruent               = 295,
+               therefore               = 296,
+               perpendicular           = 297,
+               minute                  = 298,
+               club                    = 299,
+               diamond                 = 300,
+               heart                   = 301,
+               spade                   = 302,
+               arrowboth               = 303,
+               arrowleft               = 304,
+               arrowup                 = 305,
+               arrowright              = 306,
+               arrowdown               = 307,
+               second                  = 308,
+               proportional            = 309,
+               equivalence             = 310,
+               arrowvertex             = 311,
+               arrowhorizex            = 312,
+               carriagereturn          = 313,
+               aleph                   = 314,
+               Ifraktur                = 315,
+               Rfraktur                = 316,
+               weierstrass             = 317,
+               circlemultiply          = 318,
+               circleplus              = 319,
+               emptyset                = 320,
+               intersection            = 321,
+               union                   = 322,
+               propersuperset          = 323,
+               reflexsuperset          = 324,
+               notsubset               = 325,
+               propersubset            = 326,
+               reflexsubset            = 327,
+               element                 = 328,
+               notelement              = 329,
+               angle                   = 330,
+               gradient                = 331,
+               product                 = 332,
+               logicaland              = 333,
+               logicalor               = 334,
+               arrowdblboth            = 335,
+               arrowdblleft            = 336,
+               arrowdblup              = 337,
+               arrowdblright           = 338,
+               arrowdbldown            = 339,
+               angleleft               = 340,
+               registersans            = 341,
+               copyrightsans           = 342,
+               trademarksans           = 343,
+               angleright              = 344,
+               mathplus                = 345,
+               mathminus               = 346,
+               mathasterisk            = 347,
+               mathnumbersign          = 348,
+               dotmath                 = 349,
+               mathequal               = 350,
+               mathtilde               = 351,
+
+               MaxChar                 = 352
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs
new file mode 100644 (file)
index 0000000..3c75464
--- /dev/null
@@ -0,0 +1,405 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal class StandardCharName {
+               public static string[] Names = {
+                       "nothing",
+                       "space",
+                       "exclam",
+                       "quotedbl",
+                       "numbersign",
+                       "dollar",
+                       "percent",
+                       "ampersand",
+                       "quoteright",
+                       "parenleft",
+                       "parenright",
+                       "asterisk",
+                       "plus",
+                       "comma",
+                       "hyphen",
+                       "period",
+                       "slash",
+                       "zero",
+                       "one",
+                       "two",
+                       "three",
+                       "four",
+                       "five",
+                       "six",
+                       "seven",
+                       "eight",
+                       "nine",
+                       "colon",
+                       "semicolon",
+                       "less",
+                       "equal",
+                       "greater",
+                       "question",
+                       "at",
+                       "A",
+                       "B",
+                       "C",
+                       "D",
+                       "E",
+                       "F",
+                       "G",
+                       "H",
+                       "I",
+                       "J",
+                       "K",
+                       "L",
+                       "M",
+                       "N",
+                       "O",
+                       "P",
+                       "Q",
+                       "R",
+                       "S",
+                       "T",
+                       "U",
+                       "V",
+                       "W",
+                       "X",
+                       "Y",
+                       "Z",
+                       "bracketleft",
+                       "backslash",
+                       "bracketright",
+                       "asciicircum",
+                       "underscore",
+                       "quoteleft",
+                       "a",
+                       "b",
+                       "c",
+                       "d",
+                       "e",
+                       "f",
+                       "g",
+                       "h",
+                       "i",
+                       "j",
+                       "k",
+                       "l",
+                       "m",
+                       "n",
+                       "o",
+                       "p",
+                       "q",
+                       "r",
+                       "s",
+                       "t",
+                       "u",
+                       "v",
+                       "w",
+                       "x",
+                       "y",
+                       "z",
+                       "braceleft",
+                       "bar",
+                       "braceright",
+                       "asciitilde",
+                       "exclamdown",
+                       "cent",
+                       "sterling",
+                       "fraction",
+                       "yen",
+                       "florin",
+                       "section",
+                       "currency",
+                       "quotedblleft",
+                       "guillemotleft",
+                       "guilsinglleft",
+                       "guilsinglright",
+                       "fi",
+                       "fl",
+                       "endash",
+                       "dagger",
+                       "daggerdbl",
+                       "periodcentered",
+                       "paragraph",
+                       "bullet",
+                       "quotesinglbase",
+                       "quotedblbase",
+                       "quotedblright",
+                       "guillemotright",
+                       "ellipsis",
+                       "perthousand",
+                       "questiondown",
+                       "grave",
+                       "acute",
+                       "circumflex",
+                       "tilde",
+                       "macron",
+                       "breve",
+                       "dotaccent",
+                       "dieresis",
+                       "ring",
+                       "cedilla",
+                       "hungarumlaut",
+                       "ogonek",
+                       "caron",
+                       "emdash",
+                       "AE",
+                       "ordfeminine",
+                       "Lslash",
+                       "Oslash",
+                       "OE",
+                       "ordmasculine",
+                       "ae",
+                       "dotlessi",
+                       "lslash",
+                       "oslash",
+                       "oe",
+                       "germandbls",
+                       "Aacute",
+                       "Acircumflex",
+                       "Adieresis",
+                       "Agrave",
+                       "Aring",
+                       "Atilde",
+                       "Ccedilla",
+                       "Eacute",
+                       "Ecircumflex",
+                       "Edieresis",
+                       "Egrave",
+                       "Eth",
+                       "Iacute",
+                       "Icircumflex",
+                       "Idieresis",
+                       "Igrave",
+                       "Ntilde",
+                       "Oacute",
+                       "Ocircumflex",
+                       "Odieresis",
+                       "Ograve",
+                       "Otilde",
+                       "Scaron",
+                       "Thorn",
+                       "Uacute",
+                       "Ucircumflex",
+                       "Udieresis",
+                       "Ugrave",
+                       "Yacute",
+                       "Ydieresis",
+                       "aacute",
+                       "acircumflex",
+                       "adieresis",
+                       "agrave",
+                       "aring",
+                       "atilde",
+                       "brokenbar",
+                       "ccedilla",
+                       "copyright",
+                       "degree",
+                       "divide",
+                       "eacute",
+                       "ecircumflex",
+                       "edieresis",
+                       "egrave",
+                       "eth",
+                       "iacute",
+                       "icircumflex",
+                       "idieresis",
+                       "igrave",
+                       "logicalnot",
+                       "minus",
+                       "multiply",
+                       "ntilde",
+                       "oacute",
+                       "ocircumflex",
+                       "odieresis",
+                       "ograve",
+                       "onehalf",
+                       "onequarter",
+                       "onesuperior",
+                       "otilde",
+                       "plusminus",
+                       "registered",
+                       "thorn",
+                       "threequarters",
+                       "threesuperior",
+                       "trademark",
+                       "twosuperior",
+                       "uacute",
+                       "ucircumflex",
+                       "udieresis",
+                       "ugrave",
+                       "yacute",
+                       "ydieresis",
+                       "Alpha",
+                       "Beta",
+                       "Chi",
+                       "Delta",
+                       "Epsilon",
+                       "Phi",
+                       "Gamma",
+                       "Eta",
+                       "Iota",
+                       "Kappa",
+                       "Lambda",
+                       "Mu",
+                       "Nu",
+                       "Omicron",
+                       "Pi",
+                       "Theta",
+                       "Rho",
+                       "Sigma",
+                       "Tau",
+                       "Upsilon",
+                       "varUpsilon",
+                       "Omega",
+                       "Xi",
+                       "Psi",
+                       "Zeta",
+                       "alpha",
+                       "beta",
+                       "chi",
+                       "delta",
+                       "epsilon",
+                       "phi",
+                       "varphi",
+                       "gamma",
+                       "eta",
+                       "iota",
+                       "kappa",
+                       "lambda",
+                       "mu",
+                       "nu",
+                       "omicron",
+                       "pi",
+                       "varpi",
+                       "theta",
+                       "vartheta",
+                       "rho",
+                       "sigma",
+                       "varsigma",
+                       "tau",
+                       "upsilon",
+                       "omega",
+                       "xi",
+                       "psi",
+                       "zeta",
+                       "nobrkspace",
+                       "nobrkhyphen",
+                       "lessequal",
+                       "greaterequal",
+                       "infinity",
+                       "integral",
+                       "notequal",
+                       "radical",
+                       "radicalex",
+                       "approxequal",
+                       "apple",
+                       "partialdiff",
+                       "opthyphen",
+                       "formula",
+                       "lozenge",
+                       "universal",
+                       "existential",
+                       "suchthat",
+                       "congruent",
+                       "therefore",
+                       "perpendicular",
+                       "minute",
+                       "club",
+                       "diamond",
+                       "heart",
+                       "spade",
+                       "arrowboth",
+                       "arrowleft",
+                       "arrowup",
+                       "arrowright",
+                       "arrowdown",
+                       "second",
+                       "proportional",
+                       "equivalence",
+                       "arrowvertex",
+                       "arrowhorizex",
+                       "carriagereturn",
+                       "aleph",
+                       "Ifraktur",
+                       "Rfraktur",
+                       "weierstrass",
+                       "circlemultiply",
+                       "circleplus",
+                       "emptyset",
+                       "intersection",
+                       "union",
+                       "propersuperset",
+                       "reflexsuperset",
+                       "notsubset",
+                       "propersubset",
+                       "reflexsubset",
+                       "element",
+                       "notelement",
+                       "angle",
+                       "gradient",
+                       "product",
+                       "logicaland",
+                       "logicalor",
+                       "arrowdblboth",
+                       "arrowdblleft",
+                       "arrowdblup",
+                       "arrowdblright",
+                       "arrowdbldown",
+                       "angleleft",
+                       "registersans",
+                       "copyrightsans",
+                       "trademarksans",
+                       "angleright",
+                       "mathplus",
+                       "mathminus",
+                       "mathasterisk",
+                       "mathnumbersign",
+                       "dotmath",
+                       "mathequal",
+                       "mathtilde"
+               };
+
+               /// <summary>Lookup name by ID</summary>
+               public static string Name(int index) {
+                       if ((index < 0) || (index >= Names.Length)) {
+                               return string.Empty;
+                       }
+
+                       return Names[index];
+               }
+
+               /// <summary>Lookup ID by name (e.g. mathtilde)</summary>
+               public static int ID(string name) {
+                       for (int i=0; i < Names.Length; i++) {
+                               if (name.Equals(Names[i])) {
+                                       return i;
+                               }
+                       }
+                       return 0;
+               }
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Style.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Style.cs
new file mode 100644 (file)
index 0000000..9e8ed79
--- /dev/null
@@ -0,0 +1,205 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal class Style {
+               #region Local Variables
+               public const int        NoStyleNum = 222;
+               public const int        NormalStyleNum = 0;
+
+               private string          name;
+               private StyleType       type;
+               private bool            additive;
+               private int             num;
+               private int             based_on;
+               private int             next_par;
+               private int             se_list;
+               private bool            expanding;
+               private StyleElement    elements;
+               private Style           next;
+               #endregion Local Variables
+
+               #region Constructors
+               public Style(RTF rtf) {
+                       num = -1;
+                       type = StyleType.Paragraph;
+                       based_on = NoStyleNum;
+                       next_par = -1;
+
+                       lock (rtf) {
+                               if (rtf.Styles == null) {
+                                       rtf.Styles = this;
+                               } else {
+                                       Style s = rtf.Styles;
+                                       while (s.next != null)
+                                               s = s.next;
+                                       s.next = this;
+                               }
+                       }
+               }
+               #endregion      // Constructors
+
+               #region Properties
+               public string Name {
+                       get {
+                               return name;
+                       }
+
+                       set {
+                               name = value;
+                       }
+               }
+
+               public StyleType Type {
+                       get {
+                               return type;
+                       }
+
+                       set {
+                               type = value;
+                       }
+               }
+
+               public bool Additive {
+                       get {
+                               return additive;
+                       }
+
+                       set {
+                               additive = value;
+                       }
+               }
+
+               public int BasedOn {
+                       get {
+                               return based_on;
+                       }
+
+                       set {
+                               based_on = value;
+                       }
+               }
+
+               public StyleElement Elements {
+                       get {
+                               return elements;
+                       }
+
+                       set {
+                               elements = value;
+                       }
+               }
+
+               public bool Expanding {
+                       get {
+                               return expanding;
+                       }
+
+                       set {
+                               expanding = value;
+                       }
+               }
+
+               public int NextPar {
+                       get {
+                               return next_par;
+                       }
+
+                       set {
+                               next_par = value;
+                       }
+               }
+
+               public int Num {
+                       get {
+                               return num;
+                       }
+
+                       set {
+                               num = value;
+                       }
+               }
+               #endregion      // Properties
+
+               #region Methods
+               public void Expand(RTF rtf) {
+                       StyleElement    se;
+
+                       if (num == -1) {
+                               return;
+                       }
+
+                       if (expanding) {
+                               throw new Exception("Recursive style expansion");
+                       }
+                       expanding = true;
+
+                       if (num != based_on) {
+                               rtf.SetToken(TokenClass.Control, Major.ParAttr, Minor.StyleNum, based_on, "\\s");
+                               rtf.RouteToken();
+                       }
+
+                       se = elements;
+                       while (se != null) {
+                               rtf.TokenClass = se.TokenClass;
+                               rtf.Major = se.Major;
+                               rtf.Minor = se.Minor;
+                               rtf.Param = se.Param;
+                               rtf.Text = se.Text;
+                               rtf.RouteToken();
+                       }
+
+                       expanding = false;
+               }
+
+               static public Style GetStyle(RTF rtf, int style_number) {
+                       Style s;
+
+                       lock (rtf) {
+                               s = GetStyle(rtf.Styles, style_number);
+                       }
+                       return s;
+               }
+
+               static public Style GetStyle(Style start, int style_number) {
+                       Style   s;
+
+                       if (style_number == -1) {
+                               return start;
+                       }
+
+                       s = start;
+
+                       while ((s != null) && (s.num != style_number)) {
+                               s = s.next;
+                       }
+                       return s;
+               }
+               #endregion      // Methods
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleElement.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleElement.cs
new file mode 100644 (file)
index 0000000..505758d
--- /dev/null
@@ -0,0 +1,116 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal class StyleElement {
+               #region Local Variables
+               private TokenClass      token_class;
+               private Major           major;
+               private Minor           minor;
+               private int             param;
+               private string          text;
+               private StyleElement    next;
+               #endregion Local Variables
+
+               #region Constructors
+               public StyleElement(Style s, TokenClass token_class, Major major, Minor minor, int param, string text) {
+                       this.token_class = token_class;
+                       this.major = major;
+                       this.minor = minor;
+                       this.param = param;
+                       this.text = text;
+
+                       lock (s) {
+                               if (s.Elements == null) {
+                                       s.Elements = this;
+                               } else {
+                                       StyleElement se = s.Elements;
+                                       while (se.next != null)
+                                               se = se.next;
+                                       se.next = this;
+                               }
+                       }
+               }
+               #endregion      // Constructors
+
+               #region Properties
+               public TokenClass TokenClass {
+                       get {
+                               return token_class;
+                       }
+
+                       set {
+                               token_class = value;
+                       }
+               }
+
+               public Major Major {
+                       get {
+                               return major;
+                       }
+
+                       set {
+                               major = value;
+                       }
+               }
+
+               public Minor Minor {
+                       get {
+                               return minor;
+                       }
+
+                       set {
+                               minor = value;
+                       }
+               }
+
+               public int Param {
+                       get {
+                               return param;
+                       }
+
+                       set {
+                               param = value;
+                       }
+               }
+
+               public string Text {
+                       get {
+                               return text;
+                       }
+
+                       set {
+                               text = value;
+                       }
+               }
+               #endregion      // Properties
+
+               #region Methods
+               #endregion      // Methods
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleType.cs
new file mode 100644 (file)
index 0000000..f34a667
--- /dev/null
@@ -0,0 +1,35 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal enum StyleType {
+               Paragraph       = 0,
+               Character       = 1,
+               Section         = 2
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs
new file mode 100644 (file)
index 0000000..b77497a
--- /dev/null
@@ -0,0 +1,228 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// This map is for convencience only, any app can create/use it's own
+// StdCharCode -> <text> table
+
+using System.Collections;
+
+namespace System.Windows.Forms.RTF {
+       internal class TextMap {
+               #region Local Variables
+               private string[]                table;
+               #endregion      // Local Variables
+
+               #region Public Constructors
+               public TextMap() {
+                       table = new string[(int)StandardCharCode.MaxChar];
+
+                       for (int i = 0; i < (int)StandardCharCode.MaxChar; i++) {
+                               table[i] = string.Empty;
+                       }
+               }
+               #endregion      // Public Constructors
+
+               #region Public Instance Properties
+               internal string this[StandardCharCode c] {      // FIXME - this should be public, if the whole namespace was public (ie standalone RTF parser)
+                       get {
+                               return table[(int)c];
+                       }
+
+                       set {
+                               table[(int)c] = value;
+                       }
+               }
+
+               public string[] Table {
+                       get {
+                               return table;
+                       }
+               }
+               #endregion      // Public Instance Properties
+
+               #region Public Static Methods
+               public static void SetupStandardTable(string[] table) {
+                       table[(int)StandardCharCode.space] = " ";
+                       table[(int)StandardCharCode.exclam] = "!";
+                       table[(int)StandardCharCode.quotedbl] = "\"";
+                       table[(int)StandardCharCode.numbersign] = "#";
+                       table[(int)StandardCharCode.dollar] = "$";
+                       table[(int)StandardCharCode.percent] = "%";
+                       table[(int)StandardCharCode.ampersand] = "&";
+                       table[(int)StandardCharCode.quoteright] = "'";
+                       table[(int)StandardCharCode.parenleft] = "(";
+                       table[(int)StandardCharCode.parenright] = ")";
+                       table[(int)StandardCharCode.asterisk] = "*";
+                       table[(int)StandardCharCode.plus] = "+";
+                       table[(int)StandardCharCode.comma] = ",";
+                       table[(int)StandardCharCode.hyphen] = "-";
+                       table[(int)StandardCharCode.period] = ".";
+                       table[(int)StandardCharCode.slash] = "/";
+                       table[(int)StandardCharCode.zero] = "0";
+                       table[(int)StandardCharCode.one] = "1";
+                       table[(int)StandardCharCode.two] = "2";
+                       table[(int)StandardCharCode.three] = "3";
+                       table[(int)StandardCharCode.four] = "4";
+                       table[(int)StandardCharCode.five] = "5";
+                       table[(int)StandardCharCode.six] = "6";
+                       table[(int)StandardCharCode.seven] = "7";
+                       table[(int)StandardCharCode.eight] = "8";
+                       table[(int)StandardCharCode.nine] = "9";
+                       table[(int)StandardCharCode.colon] = ":";
+                       table[(int)StandardCharCode.semicolon] = ";";
+                       table[(int)StandardCharCode.less] = "<";
+                       table[(int)StandardCharCode.equal] = "=";
+                       table[(int)StandardCharCode.greater] = ">";
+                       table[(int)StandardCharCode.question] = "?";
+                       table[(int)StandardCharCode.at] = "@";
+                       table[(int)StandardCharCode.A] = "A";
+                       table[(int)StandardCharCode.B] = "B";
+                       table[(int)StandardCharCode.C] = "C";
+                       table[(int)StandardCharCode.D] = "D";
+                       table[(int)StandardCharCode.E] = "E";
+                       table[(int)StandardCharCode.F] = "F";
+                       table[(int)StandardCharCode.G] = "G";
+                       table[(int)StandardCharCode.H] = "H";
+                       table[(int)StandardCharCode.I] = "I";
+                       table[(int)StandardCharCode.J] = "J";
+                       table[(int)StandardCharCode.K] = "K";
+                       table[(int)StandardCharCode.L] = "L";
+                       table[(int)StandardCharCode.M] = "M";
+                       table[(int)StandardCharCode.N] = "N";
+                       table[(int)StandardCharCode.O] = "O";
+                       table[(int)StandardCharCode.P] = "P";
+                       table[(int)StandardCharCode.Q] = "Q";
+                       table[(int)StandardCharCode.R] = "R";
+                       table[(int)StandardCharCode.S] = "S";
+                       table[(int)StandardCharCode.T] = "T";
+                       table[(int)StandardCharCode.U] = "U";
+                       table[(int)StandardCharCode.V] = "V";
+                       table[(int)StandardCharCode.W] = "W";
+                       table[(int)StandardCharCode.X] = "X";
+                       table[(int)StandardCharCode.Y] = "Y";
+                       table[(int)StandardCharCode.Z] = "Z";
+                       table[(int)StandardCharCode.bracketleft] = "[";
+                       table[(int)StandardCharCode.backslash] = "\\";
+                       table[(int)StandardCharCode.bracketright] = "]";
+                       table[(int)StandardCharCode.asciicircum] = "^";
+                       table[(int)StandardCharCode.underscore] = "_";
+                       table[(int)StandardCharCode.quoteleft] = "`";
+                       table[(int)StandardCharCode.a] = "a";
+                       table[(int)StandardCharCode.b] = "b";
+                       table[(int)StandardCharCode.c] = "c";
+                       table[(int)StandardCharCode.d] = "d";
+                       table[(int)StandardCharCode.e] = "e";
+                       table[(int)StandardCharCode.f] = "f";
+                       table[(int)StandardCharCode.g] = "g";
+                       table[(int)StandardCharCode.h] = "h";
+                       table[(int)StandardCharCode.i] = "i";
+                       table[(int)StandardCharCode.j] = "j";
+                       table[(int)StandardCharCode.k] = "k";
+                       table[(int)StandardCharCode.l] = "l";
+                       table[(int)StandardCharCode.m] = "m";
+                       table[(int)StandardCharCode.n] = "n";
+                       table[(int)StandardCharCode.o] = "o";
+                       table[(int)StandardCharCode.p] = "p";
+                       table[(int)StandardCharCode.q] = "q";
+                       table[(int)StandardCharCode.r] = "r";
+                       table[(int)StandardCharCode.s] = "s";
+                       table[(int)StandardCharCode.t] = "t";
+                       table[(int)StandardCharCode.u] = "u";
+                       table[(int)StandardCharCode.v] = "v";
+                       table[(int)StandardCharCode.w] = "w";
+                       table[(int)StandardCharCode.x] = "x";
+                       table[(int)StandardCharCode.y] = "y";
+                       table[(int)StandardCharCode.z] = "z";
+                       table[(int)StandardCharCode.braceleft] = "{";
+                       table[(int)StandardCharCode.bar] = "|";
+                       table[(int)StandardCharCode.braceright] = "}";
+                       table[(int)StandardCharCode.asciitilde] = "~";
+                       table[(int)StandardCharCode.AE] = "AE";
+                       table[(int)StandardCharCode.OE] = "OE";
+                       table[(int)StandardCharCode.acute] = "'";
+                       table[(int)StandardCharCode.ae] = "ae";
+                       table[(int)StandardCharCode.angleleft] = "<";
+                       table[(int)StandardCharCode.angleright] = ">";
+                       table[(int)StandardCharCode.arrowboth] = "<->";
+                       table[(int)StandardCharCode.arrowdblboth] = "<=>";
+                       table[(int)StandardCharCode.arrowdblleft] = "<=";
+                       table[(int)StandardCharCode.arrowdblright] = "=>";
+                       table[(int)StandardCharCode.arrowleft] = "<-";
+                       table[(int)StandardCharCode.arrowright] = "->";
+                       table[(int)StandardCharCode.bullet] = "o";
+                       table[(int)StandardCharCode.cent] = "cent";
+                       table[(int)StandardCharCode.circumflex] = "^";
+                       table[(int)StandardCharCode.copyright] = "(c)";
+                       table[(int)StandardCharCode.copyrightsans] = "(c)";
+                       table[(int)StandardCharCode.degree] = "deg.";
+                       table[(int)StandardCharCode.divide] = "/";
+                       table[(int)StandardCharCode.dotlessi] = "i";
+                       table[(int)StandardCharCode.ellipsis] = "...";
+                       table[(int)StandardCharCode.emdash] = "--";
+                       table[(int)StandardCharCode.endash] = "-";
+                       table[(int)StandardCharCode.fi] = "fi";
+                       table[(int)StandardCharCode.fl] = "fl";
+                       table[(int)StandardCharCode.fraction] = "/";
+                       table[(int)StandardCharCode.germandbls] = "ss";
+                       table[(int)StandardCharCode.grave] = "`";
+                       table[(int)StandardCharCode.greaterequal] = ">=";
+                       table[(int)StandardCharCode.guillemotleft] = "<<";
+                       table[(int)StandardCharCode.guillemotright] = ">>";
+                       table[(int)StandardCharCode.guilsinglleft] = "<";
+                       table[(int)StandardCharCode.guilsinglright] = ">";
+                       table[(int)StandardCharCode.lessequal] = "<=";
+                       table[(int)StandardCharCode.logicalnot] = "~";
+                       table[(int)StandardCharCode.mathasterisk] = "*";
+                       table[(int)StandardCharCode.mathequal] = "=";
+                       table[(int)StandardCharCode.mathminus] = "-";
+                       table[(int)StandardCharCode.mathnumbersign] = "#";
+                       table[(int)StandardCharCode.mathplus] = "+";
+                       table[(int)StandardCharCode.mathtilde] = "~";
+                       table[(int)StandardCharCode.minus] = "-";
+                       table[(int)StandardCharCode.mu] = "u";
+                       table[(int)StandardCharCode.multiply] = "x";
+                       table[(int)StandardCharCode.nobrkhyphen] = "-";
+                       table[(int)StandardCharCode.nobrkspace] = "";
+                       table[(int)StandardCharCode.notequal] = "!=";
+                       table[(int)StandardCharCode.oe] = "oe";
+                       table[(int)StandardCharCode.onehalf] = "1/2";
+                       table[(int)StandardCharCode.onequarter] = "1/4";
+                       table[(int)StandardCharCode.periodcentered] = ".";
+                       table[(int)StandardCharCode.plusminus] = "+/-";
+                       table[(int)StandardCharCode.quotedblbase] = ",,";
+                       table[(int)StandardCharCode.quotedblleft] = "\"";
+                       table[(int)StandardCharCode.quotedblright] = "\"";
+                       table[(int)StandardCharCode.quotesinglbase] = ",";
+                       table[(int)StandardCharCode.registered] = "reg.";
+                       table[(int)StandardCharCode.registersans] = "reg.";
+                       table[(int)StandardCharCode.threequarters] = "3/4";
+                       table[(int)StandardCharCode.tilde] = "~";
+                       table[(int)StandardCharCode.trademark] = "(TM)";
+                       table[(int)StandardCharCode.trademarksans] = "(TM)";
+               }
+               #endregion      // Public Static Methods
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TokenClass.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TokenClass.cs
new file mode 100644 (file)
index 0000000..bd86509
--- /dev/null
@@ -0,0 +1,39 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+       internal enum TokenClass {
+               None            = -1,
+               Unknown         = 0,
+               Group           = 1,
+               Text            = 2,
+               Control         = 3,
+               EOF             = 4,
+               MaxClass        = 5
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj
new file mode 100644 (file)
index 0000000..f8763b1
--- /dev/null
@@ -0,0 +1,200 @@
+<VisualStudioProject>\r
+    <CSHARP\r
+        ProjectType = "Local"\r
+        ProductVersion = "7.10.3077"\r
+        SchemaVersion = "2.0"\r
+        ProjectGuid = "{12D60959-776E-41E9-82BE-AA5DF4BB7CAE}"\r
+    >\r
+        <Build>\r
+            <Settings\r
+                ApplicationIcon = ""\r
+                AssemblyKeyContainerName = ""\r
+                AssemblyName = "rtf"\r
+                AssemblyOriginatorKeyFile = ""\r
+                DefaultClientScript = "JScript"\r
+                DefaultHTMLPageLayout = "Grid"\r
+                DefaultTargetSchema = "IE50"\r
+                DelaySign = "false"\r
+                OutputType = "Exe"\r
+                PreBuildEvent = ""\r
+                PostBuildEvent = ""\r
+                RootNamespace = "rtf"\r
+                RunPostBuildEvent = "OnBuildSuccess"\r
+                StartupObject = ""\r
+            >\r
+                <Config\r
+                    Name = "Debug"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = ""\r
+                    DocumentationFile = ""\r
+                    DebugSymbols = "true"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "false"\r
+                    NoStdLib = "false"\r
+                    NoWarn = ""\r
+                    Optimize = "false"\r
+                    OutputPath = "bin\Debug\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "1"\r
+                />\r
+                <Config\r
+                    Name = "Release"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = ""\r
+                    DocumentationFile = ""\r
+                    DebugSymbols = "false"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "false"\r
+                    NoStdLib = "false"\r
+                    NoWarn = ""\r
+                    Optimize = "false"\r
+                    OutputPath = "bin\Release\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "1"\r
+                />\r
+            </Settings>\r
+            <References>\r
+                <Reference\r
+                    Name = "System.Drawing"\r
+                    AssemblyName = "System.Drawing"\r
+                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System"\r
+                    AssemblyName = "System"\r
+                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System.Windows.Forms"\r
+                    AssemblyName = "System.Windows.Forms"\r
+                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"\r
+                />\r
+            </References>\r
+        </Build>\r
+        <Files>\r
+            <Include>\r
+                <File\r
+                    RelPath = "Charcode.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Charset.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "CharsetFlags.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "CharsetType.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "ClassDelegate.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Color.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "DestinationDelegate.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Font.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "KeysInit.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "KeyStruct.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Major.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Minor.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "RTF.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "RTFException.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "StandardCharCode.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "StandardCharName.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "Style.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "StyleElement.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "StyleType.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "test.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "TextMap.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "TokenClass.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+            </Include>\r
+        </Files>\r
+    </CSHARP>\r
+</VisualStudioProject>\r
+\r
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj.user b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj.user
new file mode 100644 (file)
index 0000000..0e89b7e
--- /dev/null
@@ -0,0 +1,48 @@
+<VisualStudioProject>\r
+    <CSHARP LastOpenVersion = "7.10.3077" >\r
+        <Build>\r
+            <Settings ReferencePath = "" >\r
+                <Config\r
+                    Name = "Debug"\r
+                    EnableASPDebugging = "false"\r
+                    EnableASPXDebugging = "false"\r
+                    EnableUnmanagedDebugging = "false"\r
+                    EnableSQLServerDebugging = "false"\r
+                    RemoteDebugEnabled = "false"\r
+                    RemoteDebugMachine = ""\r
+                    StartAction = "Project"\r
+                    StartArguments = ""\r
+                    StartPage = ""\r
+                    StartProgram = ""\r
+                    StartURL = ""\r
+                    StartWorkingDirectory = ""\r
+                    StartWithIE = "false"\r
+                />\r
+                <Config\r
+                    Name = "Release"\r
+                    EnableASPDebugging = "false"\r
+                    EnableASPXDebugging = "false"\r
+                    EnableUnmanagedDebugging = "false"\r
+                    EnableSQLServerDebugging = "false"\r
+                    RemoteDebugEnabled = "false"\r
+                    RemoteDebugMachine = ""\r
+                    StartAction = "Project"\r
+                    StartArguments = ""\r
+                    StartPage = ""\r
+                    StartProgram = ""\r
+                    StartURL = ""\r
+                    StartWorkingDirectory = ""\r
+                    StartWithIE = "false"\r
+                />\r
+            </Settings>\r
+        </Build>\r
+        <OtherProjectSettings\r
+            CopyProjectDestinationFolder = ""\r
+            CopyProjectUncPath = ""\r
+            CopyProjectOption = "0"\r
+            ProjectView = "ProjectFiles"\r
+            ProjectTrust = "0"\r
+        />\r
+    </CSHARP>\r
+</VisualStudioProject>\r
+\r
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/test.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/test.cs
new file mode 100644 (file)
index 0000000..c62cdb9
--- /dev/null
@@ -0,0 +1,286 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Text;
+using System.Windows.Forms;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms.RTF;
+using System.IO;
+
+namespace TextTestClass {
+       public class Test {
+               static Test     test;
+               int             skip_width;
+               int             skip_count;
+               private string rtf_string = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs17 testing 123testiong\\par\r\n}";
+               private string rtf_string2 =    "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fcharset0 Arial;}{\\f1\\fmodern\\fprq1\\fcharset0 Courier;}{\\f2\\fswiss\\fprq2\\fcharset0 Arial;}}\r\n" + 
+                       "{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green0\\blue0;}\r\n" + 
+                       "{\\*\\generator Msftedit 5.41.15.1507;}\\viewkind4\\uc1\\pard\\f0\\fs20 I am in Arial 10pt\\par\r\n" + 
+                       "\\fs24 I am in Arial 12pt\\par\r\n" +
+                       "\\f1 I am in Courier 12pt\\par\r\n" + 
+                       "\\cf1 I am in Courier 12pt Red\\par\r\n" + 
+                       "\\cf2\\f2\\fs20 I am in Arial 10pt\\par\r\n" +
+                       "\\b I am in Arial 10pt Italic\\cf0\\b0\\f0\\par\r\n" +
+                       "}";
+               private string rtf_string3 = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fcharset0 Arial;}{" + 
+                       "\\f1\\fmodern\\fprq1\\fcharset0 Courier;}{\\f2\\fswiss\\fprq2\\fcharset0 Arial;}{\\f3\\fni" +
+                       "l\\fcharset0 Impact;}{\\f4\\fnil\\fcharset0 Arial Unicode MS;}{\\f5\\fnil\\fcharset136 Arial Unicode MS;}{\\f6\\fnil\\fcharset0 MS" +
+                       " Shell Dlg;}}" +
+                       "{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green0\\blue0;}" +
+                       "{\\*\\generator Msftedit 5.41.15.1507;}\\viewkind4\\uc1\\pard\\f0\\fs20 I am in Arial 1" +
+                       "0pt\\par" +
+                       "\\fs24 I am in Arial 12pt\\par" +
+                       "\\f1 I am in Courier 12pt\\par" +
+                       "\\cf1 I am in Courier 12pt Red\\par" +
+                       "\\cf2\\f2\\fs20 I am in Arial 10pt\\par" +
+                       "\\b I am in Arial 10pt Bold\\par" +
+                       "\\i I am in Arial 10pt Bold Italic\\par" +
+                       "\\ul I am in Arial 10pt Bold Italic Underline\\par" +
+                       "\\ulnone\\b0\\i0\\strike I am in Arial 10pt Strikethrough\\par" +
+                       "\\cf0\\strike0\\f3\\fs23 Some cyrilic character: \\u1034?\\par" +
+                       "And 5 CJK characters: \\f4\\fs21\\u23854?\\u23854?\\u23854?\\u23854?\\u23854?\\f5\\fs17\\par" + 
+                       "Some special chars:\\par" +
+                       "\\tab Tilde: ~\\par" +
+                       "\\tab Questionmark:?\\par" +
+                       "\\tab Yen: \\f5\\u165?\\f6\\fs17\\par" +
+                       "\\tab Umlaut: \\'e4\\par" +
+                       "\\f0\\fs20\\par" +
+                       "}";
+
+               TextMap text;
+
+               public Test() {
+                       MemoryStream    stream;
+                       RTF             rtf;
+                       byte[]          buffer;
+
+                       text = new TextMap();
+                       TextMap.SetupStandardTable(text.Table);
+
+                       buffer = new byte[rtf_string.Length];
+                       for (int i = 0; i < buffer.Length; i++) {
+                               buffer[i] = (byte)rtf_string[i];
+                       }
+                       stream = new MemoryStream(buffer);
+                       rtf = new RTF(stream);
+
+                       skip_width = 0;
+                       skip_count = 0;
+
+                       rtf.ClassCallback[TokenClass.Text] = new ClassDelegate(HandleText);
+                       rtf.ClassCallback[TokenClass.Control] = new ClassDelegate(HandleControl);
+
+                       rtf.Read();
+
+                       stream.Close();
+               }
+
+               void HandleControl(RTF rtf) {
+                       switch(rtf.Major) {
+                               case Major.Unicode: {
+                                       switch(rtf.Minor) {
+                                               case Minor.UnicodeCharBytes: {
+                                                       skip_width = rtf.Param;
+                                                       break;
+                                               }
+
+                                               case Minor.UnicodeChar: {
+                                                       Console.Write("[Unicode {0:X4}]", rtf.Param);
+                                                       skip_count += skip_width;
+                                                       break;
+                                               }
+                                       }
+                                       break;
+                               }
+
+                               case Major.Destination: {
+                                       Console.Write("[Got Destination control {0}]", rtf.Minor);
+                                       rtf.SkipGroup();
+                                       break;
+                               }
+
+                               case Major.CharAttr: {
+                                       switch(rtf.Minor) {
+                                               case Minor.ForeColor: {
+                                                       System.Windows.Forms.RTF.Color  color;
+                                                       int     num;
+
+                                                       color = System.Windows.Forms.RTF.Color.GetColor(rtf, rtf.Param);
+                                                       if (color != null) {
+                                                               if (color.Red == -1 && color.Green == -1 && color.Blue == -1) {
+                                                                       Console.Write("[Default Color]");
+                                                               } else {
+                                                                       Console.Write("[Color {0} [{1:X2}{2:X2}{3:X}]]", rtf.Param, color.Red, color.Green, color.Blue);
+                                                               }
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.FontSize: {
+                                                       Console.Write("[Fontsize {0}]", rtf.Param);
+                                                       break;
+                                               }
+
+                                               case Minor.FontNum: {
+                                                       System.Windows.Forms.RTF.Font   font;
+
+                                                       font = System.Windows.Forms.RTF.Font.GetFont(rtf, rtf.Param);
+                                                       if (font != null) {
+                                                               Console.Write("[Font {0} [{1}]]", rtf.Param, font.Name);
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.Plain: {
+                                                       Console.Write("[Normal]");
+                                                       break;
+                                               }
+
+                                               case Minor.Bold: {
+                                                       if (rtf.Param == RTF.NoParam) {
+                                                               Console.Write("[Bold]");
+                                                       } else {
+                                                               Console.Write("[NoBold]");
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.Italic: {
+                                                       if (rtf.Param == RTF.NoParam) {
+                                                               Console.Write("[Italic]");
+                                                       } else {
+                                                               Console.Write("[NoItalic]");
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.StrikeThru: {
+                                                       if (rtf.Param == RTF.NoParam) {
+                                                               Console.Write("[StrikeThru]");
+                                                       } else {
+                                                               Console.Write("[NoStrikeThru]");
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.Underline: {
+                                                       if (rtf.Param == RTF.NoParam) {
+                                                               Console.Write("[Underline]");
+                                                       } else {
+                                                               Console.Write("[NoUnderline]");
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.NoUnderline: {
+                                                       Console.Write("[NoUnderline]");
+                                                       break;
+                                               }
+                                       }
+                                       break;
+                               }
+
+                               case Major.SpecialChar: {
+                                       Console.Write("[Got SpecialChar control {0}]", rtf.Minor);
+                                       SpecialChar(rtf);
+                                       break;
+                               }
+                       }
+               }
+
+               void SpecialChar(RTF rtf) {
+                       switch(rtf.Minor) {
+                               case Minor.Page:
+                               case Minor.Sect:
+                               case Minor.Row:
+                               case Minor.Line:
+                               case Minor.Par: {
+                                       Console.Write("\n");
+                                       break;
+                               }
+
+                               case Minor.Cell: {
+                                       Console.Write(" ");
+                                       break;
+                               }
+
+                               case Minor.NoBrkSpace: {
+                                       Console.Write(" ");
+                                       break;
+                               }
+
+                               case Minor.Tab: {
+                                       Console.Write("\t");
+                                       break;
+                               }
+
+                               case Minor.NoBrkHyphen: {
+                                       Console.Write("-");
+                                       break;
+                               }
+
+                               case Minor.Bullet: {
+                                       Console.Write("*");
+                                       break;
+                               }
+
+                               case Minor.EmDash: {
+                                       Console.Write("\97");
+                                       break;
+                               }
+
+                               case Minor.EnDash: {
+                                       Console.Write("\96");
+                                       break;
+                               }
+
+                               case Minor.LQuote: {
+                                       Console.Write("\91");
+                                       break;
+                               }
+
+                               case Minor.RQuote: {
+                                       Console.Write("\92");
+                                       break;
+                               }
+
+                               case Minor.LDblQuote: {
+                                       Console.Write("\93");
+                                       break;
+                               }
+
+                               case Minor.RDblQuote: {
+                                       Console.Write("\94");
+                                       break;
+                               }
+
+                               default: {
+                                       rtf.SkipGroup();
+                                       break;
+                               }
+                       }
+               }
+
+
+               void HandleText(RTF rtf) {
+                       if (skip_count > 0) {
+                               skip_count--;
+                               return;
+                       }
+                       if ((StandardCharCode)rtf.Minor != StandardCharCode.nothing) {
+                               Console.Write("{0}", text[(StandardCharCode)rtf.Minor]);
+                       } else {
+                               if ((int)rtf.Major > 31 && (int)rtf.Major < 128) {
+                                       Console.Write("{0}", (char)rtf.Major);
+                               } else {
+                                       Console.Write("[Literal:0x{0:X2}]", (int)rtf.Major);
+                               }
+                       }
+               }
+
+               public static void Main() {
+                       test = new Test();
+               }
+       }
+}
index 3d4f204bb5e17de9b7f6c25af34ebcdb09cfd981..373f6b66f4427b6c75f956a57d281b9a1f955729 100644 (file)
@@ -163,6 +163,7 @@ System.Windows.Forms/InputLanguageCollection.cs
 System.Windows.Forms/InputLanguage.cs
 System.Windows.Forms/InvalidateEventArgs.cs
 System.Windows.Forms/InvalidateEventHandler.cs
+System.Windows.Forms/IRootGridEntry.cs
 System.Windows.Forms/ItemActivation.cs
 System.Windows.Forms/ItemBoundsPortion.cs
 System.Windows.Forms/ItemChangedEventArgs.cs
@@ -248,7 +249,9 @@ System.Windows.Forms/Panel.cs
 System.Windows.Forms/PictureBox.cs
 System.Windows.Forms/PictureBoxSizeMode.cs
 System.Windows.Forms/ProgressBar.cs
+System.Windows.Forms/PropertiesTab.cs
 System.Windows.Forms/PropertyGrid.cs
+System.Windows.Forms/PropertyGridCommands.cs
 System.Windows.Forms/PropertyGridEntry.cs
 System.Windows.Forms/PropertyGridTextBox.cs
 System.Windows.Forms/PropertyGridView.cs
@@ -263,6 +266,7 @@ System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
 System.Windows.Forms/QueryContinueDragEventArgs.cs
 System.Windows.Forms/QueryContinueDragEventHandler.cs
 System.Windows.Forms/RadioButton.cs
+System.Windows.Forms/RichTextBox.cs
 System.Windows.Forms/RichTextBoxFinds.cs
 System.Windows.Forms/RichTextBoxScrollBars.cs
 System.Windows.Forms/RichTextBoxSelectionAttribute.cs
@@ -361,3 +365,25 @@ System.Windows.Forms/XplatUIOSX.cs
 System.Windows.Forms/XplatUIStructs.cs
 System.Windows.Forms/XplatUIWin32.cs
 System.Windows.Forms/XplatUIX11.cs
+System.Windows.Forms.RTF/Charcode.cs
+System.Windows.Forms.RTF/Charset.cs
+System.Windows.Forms.RTF/CharsetFlags.cs
+System.Windows.Forms.RTF/CharsetType.cs
+System.Windows.Forms.RTF/ClassDelegate.cs
+System.Windows.Forms.RTF/Color.cs
+System.Windows.Forms.RTF/DestinationDelegate.cs
+System.Windows.Forms.RTF/Font.cs
+System.Windows.Forms.RTF/KeysInit.cs
+System.Windows.Forms.RTF/KeyStruct.cs
+System.Windows.Forms.RTF/Major.cs
+System.Windows.Forms.RTF/Minor.cs
+System.Windows.Forms.RTF/RTF.cs
+System.Windows.Forms.RTF/RTFException.cs
+System.Windows.Forms.RTF/StandardCharCode.cs
+System.Windows.Forms.RTF/StandardCharName.cs
+System.Windows.Forms.RTF/Style.cs
+System.Windows.Forms.RTF/StyleElement.cs
+System.Windows.Forms.RTF/StyleType.cs
+System.Windows.Forms.RTF/TextMap.cs
+System.Windows.Forms.RTF/TokenClass.cs
+
index ec803801e8d41a06a57b2ad60dcdebf913086d00..e40f83545657d74880174c5230ddc5dc549906f7 100644 (file)
@@ -40,22 +40,15 @@ using System.Threading;
 
 namespace System.Windows.Forms {
        public sealed class Application {
-               private static bool                     browser_embedded;
-               private static bool                     exiting;
-               private static InputLanguage            input_language;
-               private static bool                     messageloop_started;
-               private static string                   safe_caption_format;
-               private static ArrayList                message_filters;
-               private static ApplicationContext       app_context;
+               private static bool                     browser_embedded        = false;
+               private static bool                     exiting                 = false;
+               private static InputLanguage            input_language          = InputLanguage.CurrentInputLanguage;
+               private static bool                     messageloop_started     = false;
+               private static string                   safe_caption_format     = "{1} - {0} - {2}";
+               private static ArrayList                message_filters         = new ArrayList();
+               private static ApplicationContext       app_context             = null;
 
                private Application () {
-                       input_language  = InputLanguage.CurrentInputLanguage;
-                       message_filters = new ArrayList();
-                       app_context     = null;
-                       browser_embedded= false;
-                       exiting         = false;
-                       messageloop_started = false;
-                       safe_caption_format = "{1} - {0} - {2}";
                }
 
                #region Private and Internal Methods
index a7cb0623b68a5674bef1d64b3883ecbc7c321a6b..fbb6a50eb96fe0174554ce504f3604ffa41229ca 100644 (file)
@@ -1,3 +1,165 @@
+2005-09-20  Alexander Olk  <alex.olk@googlemail.com>
+
+       * ThemeWin32Classic.cs:
+         - Change some private methods/fields to protected virtual so that 
+           they can be accessed and overriden in derived classes
+         - First refactoring of some methods. Derived themes now don't 
+           need to duplicate the complete code from ThemeWin32Classic
+       * ThemeNice.cs:
+         - Added nice StatusBar
+         - Derive from ThemeWin32Classic and not Theme
+         - Removed duplicate ThemeWin32Classic code
+
+2005-09-20  Miguel de Icaza  <miguel@novell.com>
+
+       * Control.cs (ControlCollection.Add): If the value null is passed
+       the control is ignored. 
+
+       Optimize this loop.
+
+2005-09-19  Peter Dennis Bartok  <pbartok@novell.com> 
+
+       * MenuAPI.cs: Replaced Application.Run() with a loop that tracks
+         PostQuitMessage state.
+       * XplatUIWin32.cs: Removed bogus PostQuitMessage P/Invoke with HWND arg
+
+2005-09-19  Peter Dennis Bartok  <pbartok@novell.com>
+
+       * Application.cs: Our constructor will never get called, move 
+         initialization to fields; fixes bug #75933
+
+2005-09-19 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+       * FileDialog.cs :
+               - Allow files to be selected properly using file name
+               combo box.
+               - Add ability to change diretory (absolute / relative)
+               using file name combo box.
+
+2005-09-16  Jordi Mas i Hernandez <jordi@ximian.com>
+        
+       * ListBox.cs: 
+               - Fixes Multicolumn listboxes item wrong calculations
+               - Allows to click when only one item is in the listbox
+               - Fixes crash when no items using keyboard navigation
+
+2005-09-16  Alexander Olk  <alex.olk@googlemail.com>
+
+       * ComboBox.cs: Reverted almost everything from the latest patch which
+         broke ComboBox
+
+2005-09-16  Kazuki Oikawa <kazuki@panicode.com>
+       
+       * ToolTip.cs:
+               - Fixed #Mtd2 of ToolTipTest.RemoveToolTipTest.
+       * ComboBox.cs:
+               - When DropDownStyle is Simple, it does not show scrollbar 
+               to the last item of the list.
+               - When DropDownStyle is Simple, it crashed when the list was 
+               scrolled down with the down cursor key.
+               - Fixed a bug that when DropDownStyle is DropDownList, the 
+               selected item was not shown.
+               - The position of the selected item was not preserved when 
+               the next dropdown happened.
+       * ThemeWin32Classic.cs:
+               - Items were wrapped at the right end.
+       * CheckedListBox.cs:
+               - Fixed Add method
+       * ListBox.cs:
+               - Items should be fully shown.
+               - When resizing and vertical scrollbar disappeared, the item 
+               of index 0 should be on the top of the list.
+               - GetItemRectangle should consider the size of ver. scrollbar
+       * StatusBar.cs:
+               - SizingGrip area should not be allocated when it is not 
+               displayed.
+               - Now it reflects MinWidth of the containing panel and 
+               fixed a crash that happens when its width becomes so small.
+
+2005-09-13  Jordi Mas i Hernandez <jordi@ximian.com>
+
+       * CheckedListBox.cs: Fixes bug 76028
+       * ListBox.cs: Fixes bug 76028
+
+2005-09-13  Jordi Mas i Hernandez <jordi@ximian.com>
+
+       * ThemeWin32Classic.cs: Sets clipping on DataGridPaintRowsHeaders
+       * DataGridDrawingLogic.cs: fixes issues with Datagrid drawing
+
+2005-09-12  Jordi Mas i Hernandez <jordi@ximian.com>
+
+       * XplatUIX11.cs: fixes System.NullReferenceException in some situations
+
+2005-09-09  Jonathan Chambers  <jonathan.chambers@ansys.com>
+
+       * IRootGridEntry.cs: Changed namespace to PropertyGridInternal 
+
+2005-09-09  Jonathan Chambers  <jonathan.chambers@ansys.com>
+
+       * IRootGridEntry.cs: Added
+       * PropertyGridCommands.cs: Added
+       * PropertiesTab.cs: Added missing methods and property
+       * PropertyGridView.cs: Made class internal
+       * PropertyGridTextBox.cs: Made class internal
+
+2005-09-09  Alexander Olk  <alex.olk@googlemail.com>
+
+       * MimeIcon.cs: Try to check some other environment variables
+         if "DESKTOP_SESSION" returns "default"
+
+2005-09-09  Alexander Olk  <alex.olk@googlemail.com>
+
+       * ThemeNice.cs: Corrected background colors (e.g. menus)
+       * ColorDialog.cs: Use correct background colors for controls
+
+2005-09-09  Alexander Olk  <alex.olk@googlemail.com>
+
+       * ThemeNice.cs: Merged r49535 from ThemeWin32Classic
+
+2005-09-08  Peter Dennis Bartok  <pbartok@novell.com>
+
+       * RichTextBox.cs: Added initial implementation
+       * lang.cs: Removed. Was accidentally checked in long time ago
+       * TODO: Removed. Contents were obsolete
+
+2005-09-06  Jonathan Chambers  <jonathan.chambers@ansys.com>
+                                                                                
+        * PropertiesTab.cs : Added
+
+2005-09-06  Jonathan Chambers  <jonathan.chambers@ansys.com>
+                                                                                
+        * PropertyGrid.cs : Update
+        * PropertyGridView.cs : Update
+        * System.Windows.Forms.resx : Added images and strings
+
+2005-09-06  Peter Dennis Bartok  <pbartok@novell.com> 
+
+       * ThemeNice.cs: Do not dispose Pens retrieved from ResPool
+2005-09-06  Peter Dennis Bartok  <pbartok@novell.com>
+
+       * XplatUIX11.cs: Force a flush after Ungrab; if case the app enters
+         a busy loop right after the Ungrab the X11 display is otherwise 
+         blocked
+
+2005-09-06  Jordi Mas i Hernandez <jordi@ximian.com>
+
+       * ThemeWin32Classic.cs: Optimise the use of clipping
+
+2005-09-05  Jordi Mas i Hernandez <jordi@ximian.com>
+
+       * DataGrid.cs: fixes recursion bug
+
+2005-09-03  Alexander Olk  <alex.olk@googlemail.com>
+
+       * ThemeNice.cs: 
+         - Draw RadioButton and CheckBox Buttons with DrawButtonBase
+         - Cleanup
+
+2005-09-02  Alexander Olk  <alex.olk@googlemail.com>
+
+       * ThemeNice.cs: Draw nice ProgressBars
+
 2005-09-01  Miguel de Icaza  <miguel@novell.com>
 
        * VScrollBar.cs: Another buglet found by Aaron's tool. 
index 4efcc71a4a9333f6459669395a28b74ce148360d..f569659e546a0cb0c4a019b53bc8cc50a19c38a8 100644 (file)
@@ -205,12 +205,6 @@ namespace System.Windows.Forms
                {
                        base.OnClick (e);
                        
-                       if (check_onclick) {
-                               if (focused_item != -1) {
-                                       SetItemChecked (focused_item, !GetItemChecked (focused_item));
-                               }
-                       }
-                       
                        if (Click != null)                      
                                Click (this, EventArgs.Empty);
                }
@@ -315,14 +309,18 @@ namespace System.Windows.Forms
                #region Private Methods
 
                internal override void OnMouseDownLB (object sender, MouseEventArgs e)
-               {
-                       base.OnMouseDownLB (sender, e);
-                       
+               {                       
                        Rectangle hit_rect, item_rect;
                        CheckState value =  CheckState.Checked;
                        bool set_value = false;
                        int index = IndexFromPointDisplayRectangle (e.X, e.Y);
 
+                       if (Click != null) {
+                               if (e.Button == MouseButtons.Left) {
+                                       Click (this, e);
+                               }
+                       }       
+
                        if (index == -1)
                                return;
                        
@@ -333,24 +331,24 @@ namespace System.Windows.Forms
                        hit_rect.Width = ThemeEngine.Current.CheckedListBoxCheckRectangle().Width;
                        hit_rect.Height = ThemeEngine.Current.CheckedListBoxCheckRectangle().Height;
                        
-                       if ((Items.GetListBoxItem (index)).State == CheckState.Checked)
-                                       value = CheckState.Unchecked;
-
-                       if (hit_rect.Contains (e.X, e.Y) == true)  {                            
+                       if ((Items.GetListBoxItem (index)).State == CheckState.Checked) { //From checked to unchecked
+                               value = CheckState.Unchecked;
                                set_value = true;
-
                        } else {
-                               if (item_rect.Contains (e.X, e.Y) == true) {
-                                       if (!check_onclick) {
-                                               if ((Items.GetListBoxItem (index)).Selected == true)
-                                                       set_value = true;
-                                       }
+                               
+                               if (check_onclick) {
+                                       set_value = true;
+                               } else {
+                                       if ((Items.GetListBoxItem (index)).Selected == true)
+                                               set_value = true;
                                }
                        }
 
                        if (set_value)
                                SetItemCheckState (index, value);
                        
+                       SelectedItemFromNavigation (index);
+                       SetFocusedItem (index);
                }
 
                internal override void UpdateItemInfo (UpdateOperation operation, int first, int last)
@@ -389,6 +387,7 @@ namespace System.Windows.Forms
                                listbox_items.Add (box_item);
                                if (check == CheckState.Checked)
                                        owner.OnItemCheck (new ItemCheckEventArgs (cnt, check, CheckState.Unchecked));
+                               owner.UpdateItemInfo (UpdateOperation.AddItems, cnt, cnt);
                                return cnt;
                        }
                }
index 8b978c5cd9902c0a7ac90c17572c06cb27df2671..5aedf53d3bc8c66cf4b8186694a3711a0f036b2d 100644 (file)
@@ -400,7 +400,6 @@ namespace System.Windows.Forms
                                baseColorControl.Size = new Size( 212, 231 );
                                baseColorControl.TabIndex = 13;
                                // colorMatrixControl
-                               //colorMatrixControl.BackColor = SystemColors.Control;
                                colorMatrixControl.Location = new Point( 227, 7 );
                                colorMatrixControl.Size = new Size( 179, 190 );
                                colorMatrixControl.TabIndex = 14;
@@ -1068,7 +1067,7 @@ namespace System.Windows.Forms
                                {
                                        base.OnPaint( pe );
                                        
-                                       pe.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.Control ), 0, 0, 26, 23 );
+                                       pe.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( BackColor ), 0, 0, 26, 23 );
                                        
                                        ControlPaint.DrawBorder3D( pe.Graphics, new Rectangle( 3, 3, 20, 18 ) );
                                        
@@ -2044,7 +2043,7 @@ namespace System.Windows.Forms
                        
                        private void Draw( PaintEventArgs e )
                        {
-                               e.Graphics.FillRectangle( new SolidBrush( SystemColors.Control ), new Rectangle( 0, 0, 16, 203 ) );
+                               e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( BackColor ), new Rectangle( 0, 0, 16, 203 ) );
                                
                                Point[] trianglePoints = new Point[ 3 ]
                                {
index 903275391287ee2d76bd4e74166e016c720c4220..848fca784bf831a242517dcf79cb210ab63cfcc3 100644 (file)
@@ -74,11 +74,11 @@ namespace System.Windows.Forms
                                this.handle = handle;
                        }
 
-                       public override string Name {\r
-                               get {\r
-                                       return base.Name;\r
-                               }\r
-                       }\r
+                       public override string Name {
+                               get {
+                                       return base.Name;
+                               }
+                       }
 
                        
                }
@@ -948,9 +948,9 @@ namespace System.Windows.Forms
                }
 
                private void textbox_ctrl_KeyPress(object sender, KeyPressEventArgs e) 
-               {\r
-                       OnKeyPress (e);\r
-               }\r
+               {
+                       OnKeyPress (e);
+               }
                
                // Calcs the text area size
                internal void CalcTextArea ()
@@ -1024,7 +1024,7 @@ namespace System.Windows.Forms
                                                        selected_index, state, ForeColor, BackColor));
                        }                                               
                        
-                       if (clip.IntersectsWith (combobox_info.listbox_area) == true) {
+                       if (DropDownStyle == ComboBoxStyle.Simple && clip.IntersectsWith (combobox_info.listbox_area) == true) {
                                dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (Parent.BackColor), 
                                                combobox_info.listbox_area);
                        }
@@ -1939,7 +1939,7 @@ namespace System.Windows.Forms
                        }                       
 
                        #endregion Private Methods
-               }\r
+               }
        }
 }
 
index 34dc8f39f296d5db9c64e8d932dd7bb7a8fcf131..87b579194d32ada7f87795c186a30856fe5ff0a4 100644 (file)
@@ -290,8 +290,12 @@ namespace System.Windows.Forms
                        #region ControlCollection Private Instance Methods
                        public virtual void Add (Control value)
                        {
+                               if (value == null)
+                                       return;
                                
-                               for (int i = 0; i < list.Count; i++) {
+                               for (int i = list.Count; i > 0; ) {
+                                       i--;
+                                       
                                        if (list [i] == value) {
                                                // Do we need to do anything here?
                                                return;
index 25ace7aeb591a939ed835114d56cc0e460185383..f857430936bb1501c0d277e3b8a28e6ccafd6b56 100644 (file)
@@ -128,6 +128,7 @@ namespace System.Windows.Forms
                private bool allow_navigation;
                private bool allow_sorting;
                private Color alternating_backcolor;
+               private Color backColor;
                private Color background_color;
                internal BorderStyle border_style;
                private Color caption_backcolor;
@@ -190,6 +191,7 @@ namespace System.Windows.Forms
                        allow_navigation = true;
                        allow_sorting = true;
                        begininit = false;
+                       backColor = ThemeEngine.Current.DataGridBackColor;
                        alternating_backcolor = def_alternating_backcolor;
                        background_color = def_background_color;
                        border_style = BorderStyle.Fixed3D;
@@ -299,10 +301,10 @@ namespace System.Windows.Forms
 
                public Color BackColor {
                        get {
-                               return base.BackColor;
+                               return backColor;
                        }
                        set {
-                               base.BackColor = value;
+                               backColor = value;
                        }
                }
 
@@ -1069,7 +1071,7 @@ namespace System.Windows.Forms
 
                protected virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop, bool isDefault)
                {
-                       return CreateGridColumn (prop, isDefault);
+                       throw new NotImplementedException();
                }
 
                protected override void Dispose (bool disposing)
index 8639900d5104ce78694d4bf6440e549ac5b53da3..7885bdb589079ffc2d3cf26a83c5d582fdad45bf 100644 (file)
@@ -173,8 +173,8 @@ namespace System.Windows.Forms
                                cells_area.Height -= grid.horiz_scrollbar.Height;
 
                                if (rowshdrs_area.Y + rowshdrs_area.Height > client_area.Y + client_area.Height) {
-                                       rowshdrs_area.Height -= grid.horiz_scrollbar.Width;
-                                       rowshdrs_maxheight -= grid.horiz_scrollbar.Width;
+                                       rowshdrs_area.Height -= grid.horiz_scrollbar.Height;
+                                       rowshdrs_maxheight -= grid.horiz_scrollbar.Height;
                                }
                        }
 
@@ -365,7 +365,9 @@ namespace System.Windows.Forms
                                grid.visiblerow_count = max_rows;
                        } else {
                                grid.visiblerow_count = total_rows;
-                       }                       
+                       }       
+
+                       CalcRowsHeaders (); // Height depends on num of visible rows            
                        
                        if (grid.visiblerow_count + grid.first_visiblerow > total_rows)
                                grid.visiblerow_count = total_rows - grid.first_visiblerow;
index 7e26fdee471e8f48a3c163427394495d059953ff..d4d2d97025fc3c89a40297fd6e038b00a02b15f0 100644 (file)
@@ -40,6 +40,8 @@ namespace System.Windows.Forms
                private IFormatProvider format_provider = null;
                private StringFormat string_format =  new StringFormat ();
                private DataGridTextBox textbox = null;
+               private static readonly int offset_x = 2;
+               private static readonly int offset_y = 2;
                #endregion      // Local Variables
 
                #region Constructors
@@ -182,16 +184,14 @@ namespace System.Windows.Forms
                        } else {
                                textbox.ReadOnly = false;
                        }                       
-
-                       textbox.Location = new Point (bounds.X, bounds.Y);
-                       bounds.X += 2; bounds.Y += 2;
-                       bounds.Width -= 2; bounds.Height -= 2;
-                       textbox.Size = new Size (bounds.Width, bounds.Height);
+                       
+                       textbox.Location = new Point (bounds.X + offset_x, bounds.Y + offset_y);
+                       textbox.Size = new Size (bounds.Width - offset_x, bounds.Height - offset_y);
 
                        obj = GetColumnValueAtRow (source, rowNum);
                        textbox.Text = GetFormattedString (obj);
                        textbox.Focus ();
-                       textbox.SelectAll ();
+                       textbox.SelectAll ();                   
                }
 
                protected void EndEdit ()
@@ -275,11 +275,15 @@ namespace System.Windows.Forms
                                break;
                        }                       
                                        
-                       g.FillRectangle (backBrush, textBounds);                        
+                       g.FillRectangle (backBrush, textBounds);
+                       PaintGridLine (g, textBounds);
+                       
+                       textBounds.Y += offset_y;
+                       textBounds.Height -= offset_y;
                        
                        string_format.FormatFlags |= StringFormatFlags.NoWrap;
                        g.DrawString (text, DataGridTableStyle.DataGrid.Font, foreBrush, textBounds, string_format);
-                       PaintGridLine (g, textBounds);
+                       
                }
                
                protected internal override void ReleaseHostedControl ()
index bd4c81b1f7be5329444559185efedba3d5c1cb63..5b36c67c8e8636711854e13642916629157d6eb4 100644 (file)
@@ -849,9 +849,29 @@ namespace System.Windows.Forms
                                if ( !multiSelect )
                                {
                                        string fileFromComboBox = fileNameComboBox.Text.Trim( );
-                                       
-                                       if ( fileFromComboBox.Length > 0 )
-                                               fileFromComboBox = Path.Combine( currentDirectoryName, fileFromComboBox );
+                                                                                                                       
+                                       if ( fileFromComboBox.Length > 0 ) {
+                                               if (!Path.IsPathRooted (fileFromComboBox))
+                                                 fileFromComboBox = Path.Combine( currentDirectoryName, fileFromComboBox );
+                                               
+                                               FileInfo fileInfo = new FileInfo (fileFromComboBox);
+                                               if (fileInfo.Exists)
+                                                 currentFileName = fileFromComboBox;
+                                               else {
+                                                       DirectoryInfo dirInfo = new DirectoryInfo (fileFromComboBox);
+                                                       if (dirInfo.Exists) {
+                                                                                                                               
+                                                               PushDirectory( dirInfo );                                                               
+                                                               directoryInfo = dirInfo.Parent;
+                                                               currentDirectoryName = dirInfo.FullName;
+                                                               dirComboBox.CurrentPath = currentDirectoryName;
+                                                               mwfFileView.UpdateFileView( dirInfo );
+                                                               
+                                                               currentFileName = "";                                                           
+                                                               return;
+                                                       }                                                               
+                                               }
+                                       }
                                        
                                        if ( currentFileName != fileFromComboBox )
                                                currentFileName = fileFromComboBox;
@@ -859,7 +879,7 @@ namespace System.Windows.Forms
                                        if ( currentFileName.Length == 0 )
                                                return;
                                        
-                                       
+
                                        if ( fileDialog.fileDialogType == FileDialogType.OpenFileDialog )
                                        {
                                                if ( fileDialog.CheckFileExists )
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IRootGridEntry.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IRootGridEntry.cs
new file mode 100755 (executable)
index 0000000..6d09551
--- /dev/null
@@ -0,0 +1,40 @@
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+// Copyright (c) 2005 Novell, Inc.\r
+//\r
+// Authors:\r
+//     Jonathan Chambers       jonathan.chambers@ansys.com\r
+//\r
+\r
+\r
+// COMPLETE\r
+\r
+using System;\r
+namespace System.Windows.Forms.PropertyGridInternal\r
+{\r
+       public interface IRootGridEntry\r
+       {\r
+               System.ComponentModel.AttributeCollection BrowsableAttributes { get; set; }\r
+\r
+               void ShowCategories ( bool showCategories );\r
+\r
+               void ResetBrowsableAttributes ();\r
+       }\r
+}\r
index 0b8aed031b4a42c74e31da4149a3b75eaba4fcdb..63a2ffeff44b376c7c025dd6e78929bf721c0af6 100644 (file)
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Copyright (c) 2004-2005 Novell, Inc.
-//
-// Authors:
-//     Jordi Mas i Hernandez, jordi@ximian.com
-//     Peter Bartok, pbartok@novell.com
-//
-//
-
-// COMPLETE
-
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Drawing;
-using System.Drawing.Text;
-using System.Drawing.Imaging;
-using System.Runtime.InteropServices;
-
-namespace System.Windows.Forms
-{
-       [DefaultProperty("Text")]
-       [Designer ("System.Windows.Forms.Design.LabelDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
-       public class Label : Control
-       {
-               private bool autosize;
-               private Image image;
-               private bool render_transparent;
-               private FlatStyle flat_style;
-               private int preferred_height;
-               private int preferred_width;
-               private bool use_mnemonic;
-               private int image_index = -1;
-               private ImageList image_list;
-               internal ContentAlignment image_align;
-               internal StringFormat string_format;
-               internal ContentAlignment text_align;                   
-               static SizeF req_witdthsize = new SizeF (0,0);
-
-               #region Events
-               public event EventHandler AutoSizeChanged;
-
-               [Browsable(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
-               public new event EventHandler BackgroundImageChanged;
-\r
-               [Browsable(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+//\r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+//\r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+// Copyright (c) 2004-2005 Novell, Inc.\r
+//\r
+// Authors:\r
+//     Jordi Mas i Hernandez, jordi@ximian.com\r
+//     Peter Bartok, pbartok@novell.com\r
+//\r
+//\r
+\r
+// COMPLETE\r
+\r
+using System.ComponentModel;\r
+using System.ComponentModel.Design;\r
+using System.Drawing;\r
+using System.Drawing.Text;\r
+using System.Drawing.Imaging;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace System.Windows.Forms\r
+{\r
+       [DefaultProperty("Text")]\r
+       [Designer ("System.Windows.Forms.Design.LabelDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]\r
+       public class Label : Control\r
+       {\r
+               private bool autosize;\r
+               private Image image;\r
+               private bool render_transparent;\r
+               private FlatStyle flat_style;\r
+               private int preferred_height;\r
+               private int preferred_width;\r
+               private bool use_mnemonic;\r
+               private int image_index = -1;\r
+               private ImageList image_list;\r
+               internal ContentAlignment image_align;\r
+               internal StringFormat string_format;\r
+               internal ContentAlignment text_align;                   \r
+               static SizeF req_witdthsize = new SizeF (0,0);\r
+\r
+               #region Events\r
+               public event EventHandler AutoSizeChanged;\r
+\r
+               [Browsable(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
+               public new event EventHandler BackgroundImageChanged;\r
+\r
+               [Browsable(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
                public new event EventHandler ImeModeChanged;                   \r
 \r
-               [Browsable(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
+               [Browsable(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
                public new event KeyEventHandler KeyDown;               \r
 \r
-               [Browsable(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
+               [Browsable(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
                public new event KeyPressEventHandler KeyPress;         \r
-
-               [Browsable(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
-               public new event KeyEventHandler KeyUp;
-
-               [Browsable(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
-               public new event EventHandler TabStopChanged;
-
-               public event EventHandler TextAlignChanged;
-               #endregion
-
-               public Label ()
-               {
-                       // Defaults in the Spec
-                       autosize = false;
-                       border_style = BorderStyle.None;
-                       string_format = new StringFormat();
-                       TextAlign = ContentAlignment.TopLeft;
-                       image = null;
-                       UseMnemonic = true;
-                       image_list = null;
-                       image_align = ContentAlignment.MiddleCenter;
-                       SetUseMnemonic (UseMnemonic);
-
-                       BackColor = ThemeEngine.Current.ColorButtonFace;
-                       ForeColor = ThemeEngine.Current.ColorWindowText;
-
-                       CalcPreferredHeight ();
-                       CalcPreferredWidth ();
-
-                       AutoSizeChanged = null;
-                       TextAlignChanged = null;
-
-                       SetStyle (ControlStyles.ResizeRedraw, true);
-                       SetStyle (ControlStyles.Selectable, false);
-                       SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
-                       
-                       HandleCreated += new EventHandler (OnHandleCreatedLB);
-               }
-
-               #region Public Properties
-               [DefaultValue(false)]
-               [Localizable(true)]
-               [RefreshProperties(RefreshProperties.All)]
-               public virtual bool AutoSize {
-                       get { return autosize; }
-                       set {
-                               if (autosize == value)
-                                       return;
-
-                               autosize = value;
-                               CalcAutoSize ();
-                               Refresh ();
-
-                               OnAutoSizeChanged (new EventArgs ());                                   
-                       }
-               }
-
-               [Browsable(false)]
-               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
-               public override Image BackgroundImage {
-                       get {
-                               return base.BackgroundImage;
-                       }
-                       set {
-                               if (base.BackgroundImage == value)
-                                       return;
-
-                               if (BackgroundImageChanged != null)
-                                       BackgroundImageChanged (this, EventArgs.Empty);
-
-                               base.BackgroundImage = value;
-                               Refresh ();
-                       }
-               }
-
-               [DefaultValue(BorderStyle.None)]
-               [DispId(-504)]
-               public virtual BorderStyle BorderStyle {
-                       get {
-                               return border_style;
-                       }
-                       set {
-                               if (!Enum.IsDefined (typeof (BorderStyle), value))
-                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for BorderStyle", value));
-
-                               if (border_style == value)
-                                       return;
-
-                               border_style = value;
-                               Refresh ();
-                       }
-               }
-
-               protected override CreateParams CreateParams {
-                       get { return base.CreateParams;}
-               }
-
-               protected override ImeMode DefaultImeMode {
-                       get { return ImeMode.Disable;}
-               }
-
-               protected override Size DefaultSize {
-                       get {return ThemeEngine.Current.LabelDefaultSize;}
-               }
-
-               [DefaultValue(FlatStyle.Standard)]
-               public FlatStyle FlatStyle {
-                       get {
-                               return flat_style;
-                       }
-                       set {
-                               if (!Enum.IsDefined (typeof (FlatStyle), value))
-                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for FlatStyle", value));
-
-                               if (flat_style == value)
-                                       return;
-
-                               flat_style = value;
-                               Refresh ();
-                       }
-               }
-
-               [Localizable(true)]
-               public Image Image {
-                       get {
-                               if (image != null) {
-                                       return image;
-                               }
-                               
-                               if (image_list != null && ImageIndex >= 0) {
-                                       return image_list.Images[ImageIndex];
-                               }
-                               
-                               return null;
-                       }
-                       set {
-                               if (image == value)
-                                       return;
-
-                               image = value;
-                               Refresh ();
-                       }
-               }
-
-               [DefaultValue(ContentAlignment.MiddleCenter)]
-               [Localizable(true)]
-               public ContentAlignment ImageAlign {
-                       get {
-                               return image_align;
-                       }
-                       set {
-                               if (!Enum.IsDefined (typeof (ContentAlignment), value))
-                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for ContentAlignment", value));
-
-                               if (image_align == value)
-                                       return;
-
-                               image_align = value;
-                               Refresh ();
-                       }
-               }
-
-               [DefaultValue (-1)]
-               [Editor ("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
-               [Localizable (true)]
-               [TypeConverter (typeof (ImageIndexConverter))]
-               public int ImageIndex {
-                       get { 
-                               if (ImageList == null) {
-                                       return -1;
-                               }
-                               
-                               if (image_index >= image_list.Images.Count) {
-                                       return image_list.Images.Count - 1;
-                               }
-                               
-                               return image_index;
-                       }
-                       set {
-
-                               if (value < -1)
-                                       throw new ArgumentException ();
-
-                               if (image_index == value)
-                                       return;
-
-                               image_index = value;
-
-                               if (ImageList != null && image_index !=-1)
-                                       Image = null;
-
-                               Refresh ();
-                       }
-               }
-
-               [DefaultValue(null)]
-               public ImageList ImageList {
-                       get { return image_list;}
-                       set {
-                               if (image_list == value)
-                                       return;
-                                       
-                               image_list = value;
-
-                               if (image_list != null && image_index !=-1)
-                                       Image = null;
-
-                               Refresh ();
-                       }
-               }
-
-               [Browsable(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
-               public new ImeMode ImeMode {
-                       get { return base.ImeMode; }
-                       set {
-                               if (value == ImeMode)
-                                       return;
-                               base.ImeMode = value;
-                               if (ImeModeChanged != null)
-                                       ImeModeChanged (this, EventArgs.Empty);
-                       }
-               }
-
-               [Browsable(false)]
-               [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
-               [EditorBrowsable(EditorBrowsableState.Advanced)]
-               public virtual int PreferredHeight {
-                       get { return preferred_height; }
-               }
-
-               [Browsable(false)]
-               [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
-               [EditorBrowsable(EditorBrowsableState.Advanced)]
-               public virtual int PreferredWidth {
-                       get {return preferred_width; }
-               }
-
-               protected virtual bool RenderTransparent {
-                       get { return render_transparent; }
-                       set { render_transparent = value;}
-               }
+\r
+               [Browsable(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
+               public new event KeyEventHandler KeyUp;\r
+\r
+               [Browsable(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
+               public new event EventHandler TabStopChanged;\r
+\r
+               public event EventHandler TextAlignChanged;\r
+               #endregion\r
+\r
+               public Label ()\r
+               {\r
+                       // Defaults in the Spec\r
+                       autosize = false;\r
+                       border_style = BorderStyle.None;\r
+                       string_format = new StringFormat();\r
+                       TextAlign = ContentAlignment.TopLeft;\r
+                       image = null;\r
+                       UseMnemonic = true;\r
+                       image_list = null;\r
+                       image_align = ContentAlignment.MiddleCenter;\r
+                       SetUseMnemonic (UseMnemonic);\r
+                       flat_style = FlatStyle.Standard;\r
+\r
+                       BackColor = ThemeEngine.Current.ColorButtonFace;\r
+                       ForeColor = ThemeEngine.Current.ColorWindowText;\r
+\r
+                       CalcPreferredHeight ();\r
+                       CalcPreferredWidth ();\r
+\r
+                       AutoSizeChanged = null;\r
+                       TextAlignChanged = null;\r
+\r
+                       SetStyle (ControlStyles.ResizeRedraw, true);\r
+                       SetStyle (ControlStyles.Selectable, false);\r
+                       SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);\r
+                       \r
+                       HandleCreated += new EventHandler (OnHandleCreatedLB);\r
+               }\r
+\r
+               #region Public Properties\r
+               [DefaultValue(false)]\r
+               [Localizable(true)]\r
+               [RefreshProperties(RefreshProperties.All)]\r
+               public virtual bool AutoSize {\r
+                       get { return autosize; }\r
+                       set {\r
+                               if (autosize == value)\r
+                                       return;\r
+\r
+                               autosize = value;\r
+                               CalcAutoSize ();\r
+                               Refresh ();\r
+\r
+                               OnAutoSizeChanged (new EventArgs ());                                   \r
+                       }\r
+               }\r
+\r
+               [Browsable(false)]\r
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
+               public override Image BackgroundImage {\r
+                       get {\r
+                               return base.BackgroundImage;\r
+                       }\r
+                       set {\r
+                               if (base.BackgroundImage == value)\r
+                                       return;\r
+\r
+                               if (BackgroundImageChanged != null)\r
+                                       BackgroundImageChanged (this, EventArgs.Empty);\r
+\r
+                               base.BackgroundImage = value;\r
+                               Refresh ();\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(BorderStyle.None)]\r
+               [DispId(-504)]\r
+               public virtual BorderStyle BorderStyle {\r
+                       get {\r
+                               return border_style;\r
+                       }\r
+                       set {\r
+                               if (!Enum.IsDefined (typeof (BorderStyle), value))\r
+                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for BorderStyle", value));\r
+\r
+                               if (border_style == value)\r
+                                       return;\r
+\r
+                               border_style = value;\r
+                               Refresh ();\r
+                       }\r
+               }\r
+\r
+               protected override CreateParams CreateParams {\r
+                       get { return base.CreateParams;}\r
+               }\r
+\r
+               protected override ImeMode DefaultImeMode {\r
+                       get { return ImeMode.Disable;}\r
+               }\r
+\r
+               protected override Size DefaultSize {\r
+                       get {return ThemeEngine.Current.LabelDefaultSize;}\r
+               }\r
+\r
+               [DefaultValue(FlatStyle.Standard)]\r
+               public FlatStyle FlatStyle {\r
+                       get {\r
+                               return flat_style;\r
+                       }\r
+                       set {\r
+                               if (!Enum.IsDefined (typeof (FlatStyle), value))\r
+                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for FlatStyle", value));\r
+\r
+                               if (flat_style == value)\r
+                                       return;\r
+\r
+                               flat_style = value;\r
+                               Refresh ();\r
+                       }\r
+               }\r
+\r
+               [Localizable(true)]\r
+               public Image Image {\r
+                       get {\r
+                               if (image != null) {\r
+                                       return image;\r
+                               }\r
+                               \r
+                               if (image_list != null && ImageIndex >= 0) {\r
+                                       return image_list.Images[ImageIndex];\r
+                               }\r
+                               \r
+                               return null;\r
+                       }\r
+                       set {\r
+                               if (image == value)\r
+                                       return;\r
+\r
+                               image = value;\r
+                               Refresh ();\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(ContentAlignment.MiddleCenter)]\r
+               [Localizable(true)]\r
+               public ContentAlignment ImageAlign {\r
+                       get {\r
+                               return image_align;\r
+                       }\r
+                       set {\r
+                               if (!Enum.IsDefined (typeof (ContentAlignment), value))\r
+                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for ContentAlignment", value));\r
+\r
+                               if (image_align == value)\r
+                                       return;\r
+\r
+                               image_align = value;\r
+                               Refresh ();\r
+                       }\r
+               }\r
+\r
+               [DefaultValue (-1)]\r
+               [Editor ("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]\r
+               [Localizable (true)]\r
+               [TypeConverter (typeof (ImageIndexConverter))]\r
+               public int ImageIndex {\r
+                       get { \r
+                               if (ImageList == null) {\r
+                                       return -1;\r
+                               }\r
+                               \r
+                               if (image_index >= image_list.Images.Count) {\r
+                                       return image_list.Images.Count - 1;\r
+                               }\r
+                               \r
+                               return image_index;\r
+                       }\r
+                       set {\r
+\r
+                               if (value < -1)\r
+                                       throw new ArgumentException ();\r
+\r
+                               if (image_index == value)\r
+                                       return;\r
+\r
+                               image_index = value;\r
+\r
+                               if (ImageList != null && image_index !=-1)\r
+                                       Image = null;\r
+\r
+                               Refresh ();\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(null)]\r
+               public ImageList ImageList {\r
+                       get { return image_list;}\r
+                       set {\r
+                               if (image_list == value)\r
+                                       return;\r
+                                       \r
+                               image_list = value;\r
+\r
+                               if (image_list != null && image_index !=-1)\r
+                                       Image = null;\r
+\r
+                               Refresh ();\r
+                       }\r
+               }\r
+\r
+               [Browsable(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
+               public new ImeMode ImeMode {\r
+                       get { return base.ImeMode; }\r
+                       set {\r
+                               if (value == ImeMode)\r
+                                       return;\r
+                               base.ImeMode = value;\r
+                               if (ImeModeChanged != null)\r
+                                       ImeModeChanged (this, EventArgs.Empty);\r
+                       }\r
+               }\r
+\r
+               [Browsable(false)]\r
+               [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]\r
+               [EditorBrowsable(EditorBrowsableState.Advanced)]\r
+               public virtual int PreferredHeight {\r
+                       get { return preferred_height; }\r
+               }\r
+\r
+               [Browsable(false)]\r
+               [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]\r
+               [EditorBrowsable(EditorBrowsableState.Advanced)]\r
+               public virtual int PreferredWidth {\r
+                       get {return preferred_width; }\r
+               }\r
+\r
+               protected virtual bool RenderTransparent {\r
+                       get { return render_transparent; }\r
+                       set { render_transparent = value;}\r
+               }\r
                \r
-               [Browsable(false)]
-               [DefaultValue(false)]
-               [EditorBrowsable(EditorBrowsableState.Never)]
-               public new bool TabStop  {
-                       get { return base.TabStop; }
-                       set {
-                               if (value == base.TabStop)
-                                       return;
-
-                               base.TabStop = value;
-                               if (TabStopChanged != null)
-                                       TabStopChanged (this, EventArgs.Empty);
-                       }
-               }
-
-               [DefaultValue(ContentAlignment.TopLeft)]
-               [Localizable(true)]
-               public virtual ContentAlignment TextAlign {
-                       get { return text_align; }
-
-                       set {
-                               if (!Enum.IsDefined (typeof (ContentAlignment), value))
-                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for ContentAlignment", value));
-
-                               if (text_align != value) {
-
-                                       text_align = value;
-
-                                       switch (value) {
-
-                                       case ContentAlignment.BottomLeft:
-                                               string_format.LineAlignment = StringAlignment.Far;
-                                               string_format.Alignment = StringAlignment.Near;
-                                               break;
-                                       case ContentAlignment.BottomCenter:
-                                               string_format.LineAlignment = StringAlignment.Far;
-                                               string_format.Alignment = StringAlignment.Center;
-                                               break;
-                                       case ContentAlignment.BottomRight:
-                                               string_format.LineAlignment = StringAlignment.Far;
-                                               string_format.Alignment = StringAlignment.Far;
-                                               break;
-                                       case ContentAlignment.TopLeft:
-                                               string_format.LineAlignment = StringAlignment.Near;
-                                               string_format.Alignment = StringAlignment.Near;
-                                               break;
-                                       case ContentAlignment.TopCenter:
-                                               string_format.LineAlignment = StringAlignment.Near;
-                                               string_format.Alignment = StringAlignment.Center;
-                                               break;
-                                       case ContentAlignment.TopRight:
-                                               string_format.LineAlignment = StringAlignment.Near;
-                                               string_format.Alignment = StringAlignment.Far;
-                                               break;
-                                       case ContentAlignment.MiddleLeft:
-                                               string_format.LineAlignment = StringAlignment.Center;
-                                               string_format.Alignment = StringAlignment.Near;
-                                               break;
-                                       case ContentAlignment.MiddleRight:
-                                               string_format.LineAlignment = StringAlignment.Center;
-                                               string_format.Alignment = StringAlignment.Far;
-                                               break;
-                                       case ContentAlignment.MiddleCenter:
-                                               string_format.LineAlignment = StringAlignment.Center;
-                                               string_format.Alignment = StringAlignment.Center;
-                                               break;
-                                       default:
-                                               break;
-                                       }
-
-                                       OnTextAlignChanged (new EventArgs ());
-                                       Refresh();
-                               }
-                       }
-               }
-
-               [DefaultValue(true)]
-               public bool UseMnemonic {
-                       get { return use_mnemonic; }
-                       set {
-                               if (use_mnemonic != value) {
-                                       use_mnemonic = value;
-                                       SetUseMnemonic (use_mnemonic);
-                                       Refresh ();
-                               }
-                       }
-               }
-
-               #endregion
-
-
-               #region Public Methods
-
-               protected Rectangle CalcImageRenderBounds (Image image, Rectangle area, ContentAlignment img_align)
-               {
-                       Rectangle rcImageClip = area;
-                       rcImageClip.Inflate (-2,-2);
-
-                       int X = area.X;
-                       int Y = area.Y;
-
-                       if (img_align == ContentAlignment.TopCenter ||
-                               img_align == ContentAlignment.MiddleCenter ||
-                               img_align == ContentAlignment.BottomCenter) {
-                               X += (area.Width - image.Width) / 2;
-                       }
-                       else if (img_align == ContentAlignment.TopRight ||
-                               img_align == ContentAlignment.MiddleRight||
-                               img_align == ContentAlignment.BottomRight) {
-                               X += (area.Width - image.Width);
-                       }
-
-                       if( img_align == ContentAlignment.BottomCenter ||
-                               img_align == ContentAlignment.BottomLeft ||
-                               img_align == ContentAlignment.BottomRight) {
-                               Y += area.Height - image.Height;
-                       }
-                       else if(img_align == ContentAlignment.MiddleCenter ||
-                                       img_align == ContentAlignment.MiddleLeft ||
-                                       img_align == ContentAlignment.MiddleRight) {
-                               Y += (area.Height - image.Height) / 2;
-                       }
-
-                       rcImageClip.X = X;
-                       rcImageClip.Y = Y;
-                       rcImageClip.Width = image.Width;
-                       rcImageClip.Height = image.Height;
-
-                       return rcImageClip;
-               }
-
+               [Browsable(false)]\r
+               [DefaultValue(false)]\r
+               [EditorBrowsable(EditorBrowsableState.Never)]\r
+               public new bool TabStop  {\r
+                       get { return base.TabStop; }\r
+                       set {\r
+                               if (value == base.TabStop)\r
+                                       return;\r
+\r
+                               base.TabStop = value;\r
+                               if (TabStopChanged != null)\r
+                                       TabStopChanged (this, EventArgs.Empty);\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(ContentAlignment.TopLeft)]\r
+               [Localizable(true)]\r
+               public virtual ContentAlignment TextAlign {\r
+                       get { return text_align; }\r
+\r
+                       set {\r
+                               if (!Enum.IsDefined (typeof (ContentAlignment), value))\r
+                                       throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for ContentAlignment", value));\r
+\r
+                               if (text_align != value) {\r
+\r
+                                       text_align = value;\r
+\r
+                                       switch (value) {\r
+\r
+                                       case ContentAlignment.BottomLeft:\r
+                                               string_format.LineAlignment = StringAlignment.Far;\r
+                                               string_format.Alignment = StringAlignment.Near;\r
+                                               break;\r
+                                       case ContentAlignment.BottomCenter:\r
+                                               string_format.LineAlignment = StringAlignment.Far;\r
+                                               string_format.Alignment = StringAlignment.Center;\r
+                                               break;\r
+                                       case ContentAlignment.BottomRight:\r
+                                               string_format.LineAlignment = StringAlignment.Far;\r
+                                               string_format.Alignment = StringAlignment.Far;\r
+                                               break;\r
+                                       case ContentAlignment.TopLeft:\r
+                                               string_format.LineAlignment = StringAlignment.Near;\r
+                                               string_format.Alignment = StringAlignment.Near;\r
+                                               break;\r
+                                       case ContentAlignment.TopCenter:\r
+                                               string_format.LineAlignment = StringAlignment.Near;\r
+                                               string_format.Alignment = StringAlignment.Center;\r
+                                               break;\r
+                                       case ContentAlignment.TopRight:\r
+                                               string_format.LineAlignment = StringAlignment.Near;\r
+                                               string_format.Alignment = StringAlignment.Far;\r
+                                               break;\r
+                                       case ContentAlignment.MiddleLeft:\r
+                                               string_format.LineAlignment = StringAlignment.Center;\r
+                                               string_format.Alignment = StringAlignment.Near;\r
+                                               break;\r
+                                       case ContentAlignment.MiddleRight:\r
+                                               string_format.LineAlignment = StringAlignment.Center;\r
+                                               string_format.Alignment = StringAlignment.Far;\r
+                                               break;\r
+                                       case ContentAlignment.MiddleCenter:\r
+                                               string_format.LineAlignment = StringAlignment.Center;\r
+                                               string_format.Alignment = StringAlignment.Center;\r
+                                               break;\r
+                                       default:\r
+                                               break;\r
+                                       }\r
+\r
+                                       OnTextAlignChanged (new EventArgs ());\r
+                                       Refresh();\r
+                               }\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(true)]\r
+               public bool UseMnemonic {\r
+                       get { return use_mnemonic; }\r
+                       set {\r
+                               if (use_mnemonic != value) {\r
+                                       use_mnemonic = value;\r
+                                       SetUseMnemonic (use_mnemonic);\r
+                                       Refresh ();\r
+                               }\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+\r
+\r
+               #region Public Methods\r
+\r
+               protected Rectangle CalcImageRenderBounds (Image image, Rectangle area, ContentAlignment img_align)\r
+               {\r
+                       Rectangle rcImageClip = area;\r
+                       rcImageClip.Inflate (-2,-2);\r
+\r
+                       int X = area.X;\r
+                       int Y = area.Y;\r
+\r
+                       if (img_align == ContentAlignment.TopCenter ||\r
+                               img_align == ContentAlignment.MiddleCenter ||\r
+                               img_align == ContentAlignment.BottomCenter) {\r
+                               X += (area.Width - image.Width) / 2;\r
+                       }\r
+                       else if (img_align == ContentAlignment.TopRight ||\r
+                               img_align == ContentAlignment.MiddleRight||\r
+                               img_align == ContentAlignment.BottomRight) {\r
+                               X += (area.Width - image.Width);\r
+                       }\r
+\r
+                       if( img_align == ContentAlignment.BottomCenter ||\r
+                               img_align == ContentAlignment.BottomLeft ||\r
+                               img_align == ContentAlignment.BottomRight) {\r
+                               Y += area.Height - image.Height;\r
+                       }\r
+                       else if(img_align == ContentAlignment.MiddleCenter ||\r
+                                       img_align == ContentAlignment.MiddleLeft ||\r
+                                       img_align == ContentAlignment.MiddleRight) {\r
+                               Y += (area.Height - image.Height) / 2;\r
+                       }\r
+\r
+                       rcImageClip.X = X;\r
+                       rcImageClip.Y = Y;\r
+                       rcImageClip.Width = image.Width;\r
+                       rcImageClip.Height = image.Height;\r
+\r
+                       return rcImageClip;\r
+               }\r
+\r
                \r
-               protected override AccessibleObject CreateAccessibilityInstance ()
-               {
-                       return base.CreateAccessibilityInstance ();
-               }
-
-               protected override void Dispose(bool disposing)
-               {
-                       base.Dispose (disposing);
-               }
-
-               protected void DrawImage (Graphics g, Image image, Rectangle area, ContentAlignment img_align)
-               {
-                       if (image == null || g == null)
-                               return;
-
-                       Rectangle rcImageClip = CalcImageRenderBounds (image, area, img_align);
-
-                       if (Enabled)
-                               g.DrawImage (image, rcImageClip.X, rcImageClip.Y, rcImageClip.Width, rcImageClip.Height);
-                       else
-                               ControlPaint.DrawImageDisabled (g, image, rcImageClip.X, rcImageClip.Y, BackColor);
-               }
-
-               protected virtual void OnAutoSizeChanged (EventArgs e)
-               {
-                       if (AutoSizeChanged != null)
-                               AutoSizeChanged (this, e);
-               }
-
-               protected override void OnEnabledChanged (EventArgs e)
-               {
-                       base.OnEnabledChanged (e);
-               }
-
-               protected override void OnFontChanged (EventArgs e)
-               {
-                       base.OnFontChanged (e);
-                       if (autosize) {
-                               CalcAutoSize();
-                       } else {
-                               CalcPreferredHeight ();
-                       }
-                       Refresh ();
-               }
-
-               protected override void OnPaint (PaintEventArgs pevent)
-               {
-                       ThemeEngine.Current.DrawLabel (pevent.Graphics, ClientRectangle, this);
-                       DrawImage (pevent.Graphics, Image, ClientRectangle, image_align);
-                       base.OnPaint(pevent);
-               }
-
-               protected override void OnParentChanged (EventArgs e)
-               {
-                       base.OnParentChanged (e);
-               }
-
-               protected virtual void OnTextAlignChanged (EventArgs e)
-               {
-                       if (TextAlignChanged != null)
-                               TextAlignChanged (this, e);
-               }
-
-               protected override void OnTextChanged (EventArgs e)
-               {
-                       base.OnTextChanged (e);                 
-                       if (autosize) {
-                               CalcAutoSize ();
-                       } else {
-                               CalcPreferredWidth ();
-                       }
-                       Refresh ();
-               }
-
-               protected override void OnVisibleChanged (EventArgs e)
-               {
-                       base.OnVisibleChanged (e);
-               }
-
-               protected override bool ProcessMnemonic (char charCode)
-               {
-                       if (IsMnemonic(charCode, Text) == true) {
-                               // Select item next in line in tab order
-                               if (this.parent != null) {
-                                       parent.SelectNextControl(this, true, false, false, false);
-                               }
-                               return true;
-                       }
-                       
-                       return base.ProcessMnemonic (charCode);
-               }
-
-               protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
-               {
-                       base.SetBoundsCore (x, y, width, height, specified);
-               }
-
-               public override string ToString()
-               {
-                       return base.ToString () + "Text: " + Text;
-               }
-
-               protected override void WndProc(ref Message m)
-               {
-                       switch ((Msg) m.Msg) {
-                               case Msg.WM_DRAWITEM: {
-                                       m.Result = (IntPtr)1;
-                               }
-                                       break;
-                               default:
-                                       base.WndProc (ref m);
-                                       break;
-                       }
-               }
-
-               #endregion Public Methods
-
-               #region Private Methods
-
-               private void CalcAutoSize ()
-               {
-                       if (IsHandleCreated == false || AutoSize == false)
-                               return;
-
-                       CalcPreferredWidth ();
-                       CalcPreferredHeight ();
-
-                       Width =  PreferredWidth;
-                       Height =  PreferredHeight;                      
-               }
-
-               private void CalcPreferredHeight ()
-               {
-                       preferred_height = Font.Height;
-
-                       switch (border_style) {
-                       case BorderStyle.None:
-                               preferred_height += 3;
-                               break;
-                       case BorderStyle.FixedSingle:
-                       case BorderStyle.Fixed3D:
-                               preferred_height += 6;
-                               break;
-                       default:
-                               break;
-                       }
-
-               }
-
-               private void CalcPreferredWidth ()
-               {
-                       SizeF size;
-                       size = DeviceContext.MeasureString (Text, Font, req_witdthsize, string_format);
-                       preferred_width = (int) size.Width + 3;
-               }
-
-               private void OnHandleCreatedLB (Object o, EventArgs e)
-               {
-                       if (autosize)
-                               CalcAutoSize ();
-               }
-
-               private void SetUseMnemonic (bool use)
-               {
-                       if (use)
-                               string_format.HotkeyPrefix = HotkeyPrefix.Show;
-                       else
-                               string_format.HotkeyPrefix = HotkeyPrefix.None;
-               }
-
-               #endregion Private Methods
-
-       }
-    }
+               protected override AccessibleObject CreateAccessibilityInstance ()\r
+               {\r
+                       return base.CreateAccessibilityInstance ();\r
+               }\r
+\r
+               protected override void Dispose(bool disposing)\r
+               {\r
+                       base.Dispose (disposing);\r
+               }\r
+\r
+               protected void DrawImage (Graphics g, Image image, Rectangle area, ContentAlignment img_align)\r
+               {\r
+                       if (image == null || g == null)\r
+                               return;\r
+\r
+                       Rectangle rcImageClip = CalcImageRenderBounds (image, area, img_align);\r
+\r
+                       if (Enabled)\r
+                               g.DrawImage (image, rcImageClip.X, rcImageClip.Y, rcImageClip.Width, rcImageClip.Height);\r
+                       else\r
+                               ControlPaint.DrawImageDisabled (g, image, rcImageClip.X, rcImageClip.Y, BackColor);\r
+               }\r
+\r
+               protected virtual void OnAutoSizeChanged (EventArgs e)\r
+               {\r
+                       if (AutoSizeChanged != null)\r
+                               AutoSizeChanged (this, e);\r
+               }\r
+\r
+               protected override void OnEnabledChanged (EventArgs e)\r
+               {\r
+                       base.OnEnabledChanged (e);\r
+               }\r
+\r
+               protected override void OnFontChanged (EventArgs e)\r
+               {\r
+                       base.OnFontChanged (e);\r
+                       if (autosize) {\r
+                               CalcAutoSize();\r
+                       } else {\r
+                               CalcPreferredHeight ();\r
+                       }\r
+                       Refresh ();\r
+               }\r
+\r
+               protected override void OnPaint (PaintEventArgs pevent)\r
+               {\r
+                       ThemeEngine.Current.DrawLabel (pevent.Graphics, ClientRectangle, this);\r
+                       DrawImage (pevent.Graphics, Image, ClientRectangle, image_align);\r
+                       base.OnPaint(pevent);\r
+               }\r
+\r
+               protected override void OnParentChanged (EventArgs e)\r
+               {\r
+                       base.OnParentChanged (e);\r
+               }\r
+\r
+               protected virtual void OnTextAlignChanged (EventArgs e)\r
+               {\r
+                       if (TextAlignChanged != null)\r
+                               TextAlignChanged (this, e);\r
+               }\r
+\r
+               protected override void OnTextChanged (EventArgs e)\r
+               {\r
+                       base.OnTextChanged (e);                 \r
+                       if (autosize) {\r
+                               CalcAutoSize ();\r
+                       } else {\r
+                               CalcPreferredWidth ();\r
+                       }\r
+                       Refresh ();\r
+               }\r
+\r
+               protected override void OnVisibleChanged (EventArgs e)\r
+               {\r
+                       base.OnVisibleChanged (e);\r
+               }\r
+\r
+               protected override bool ProcessMnemonic (char charCode)\r
+               {\r
+                       if (IsMnemonic(charCode, Text) == true) {\r
+                               // Select item next in line in tab order\r
+                               if (this.parent != null) {\r
+                                       parent.SelectNextControl(this, true, false, false, false);\r
+                               }\r
+                               return true;\r
+                       }\r
+                       \r
+                       return base.ProcessMnemonic (charCode);\r
+               }\r
+\r
+               protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)\r
+               {\r
+                       base.SetBoundsCore (x, y, width, height, specified);\r
+               }\r
+\r
+               public override string ToString()\r
+               {\r
+                       return base.ToString () + "Text: " + Text;\r
+               }\r
+\r
+               protected override void WndProc(ref Message m)\r
+               {\r
+                       switch ((Msg) m.Msg) {\r
+                               case Msg.WM_DRAWITEM: {\r
+                                       m.Result = (IntPtr)1;\r
+                               }\r
+                                       break;\r
+                               default:\r
+                                       base.WndProc (ref m);\r
+                                       break;\r
+                       }\r
+               }\r
+\r
+               #endregion Public Methods\r
+\r
+               #region Private Methods\r
+\r
+               private void CalcAutoSize ()\r
+               {\r
+                       if (IsHandleCreated == false || AutoSize == false)\r
+                               return;\r
+\r
+                       CalcPreferredWidth ();\r
+                       CalcPreferredHeight ();\r
+\r
+                       Width =  PreferredWidth;\r
+                       Height =  PreferredHeight;                      \r
+               }\r
+\r
+               private void CalcPreferredHeight ()\r
+               {\r
+                       preferred_height = Font.Height;\r
+\r
+                       switch (border_style) {\r
+                       case BorderStyle.None:\r
+                               preferred_height += 3;\r
+                               break;\r
+                       case BorderStyle.FixedSingle:\r
+                       case BorderStyle.Fixed3D:\r
+                               preferred_height += 6;\r
+                               break;\r
+                       default:\r
+                               break;\r
+                       }\r
+\r
+               }\r
+\r
+               private void CalcPreferredWidth ()\r
+               {\r
+                       SizeF size;\r
+                       size = DeviceContext.MeasureString (Text, Font, req_witdthsize, string_format);\r
+                       preferred_width = (int) size.Width + 3;\r
+               }\r
+\r
+               private void OnHandleCreatedLB (Object o, EventArgs e)\r
+               {\r
+                       if (autosize)\r
+                               CalcAutoSize ();\r
+               }\r
+\r
+               private void SetUseMnemonic (bool use)\r
+               {\r
+                       if (use)\r
+                               string_format.HotkeyPrefix = HotkeyPrefix.Show;\r
+                       else\r
+                               string_format.HotkeyPrefix = HotkeyPrefix.None;\r
+               }\r
+\r
+               #endregion Private Methods\r
+\r
+       }\r
+    }\r
index 20d613dcb54aef9acc1b71267a0b87c583cd731f..738c93b150cf775ba46e4fc7619924fdd3fa4084 100644 (file)
@@ -132,6 +132,7 @@ namespace System.Windows.Forms
                private bool ctrl_pressed;
                private bool shift_pressed;
                private bool has_focus;
+               private bool use_item_height;
                
                internal int focused_item;              
                internal ListBoxInfo listbox_info;
@@ -158,6 +159,7 @@ namespace System.Windows.Forms
                        ctrl_pressed = false;
                        shift_pressed = false;
                        has_focus = false;
+                       use_item_height = false;
 
                        items = new ObjectCollection (this);
                        selected_indices = new SelectedIndexCollection (this);
@@ -379,6 +381,7 @@ namespace System.Windows.Forms
                                        return;
 
                                listbox_info.item_height = value;
+                               use_item_height = true;
                                CalcClientArea ();
                        }
                }
@@ -747,18 +750,24 @@ namespace System.Windows.Forms
                                
                                if (DrawMode == DrawMode.OwnerDrawVariable) {
                                        rect.Y = 0;
-                                       for (int i = 0; i < index; i++) {
-                                               rect.Y += GetItemHeight (i);
-                                       }                                       
+                                       if (index >= listbox_info.top_item) {
+                                               for (int i = listbox_info.top_item; i < index; i++) {
+                                                       rect.Y += GetItemHeight (i);
+                                               }
+                                       } else {
+                                               for (int i = index; i < listbox_info.top_item; i++) {
+                                                       rect.Y -= GetItemHeight (i);
+                                               }
+                                       }
                                } else {
-                                       rect.Y = ItemHeight * index;    
+                                       rect.Y = ItemHeight * (index - listbox_info.top_item);  
                                }                               
                        }
                        else {
                                int which_page;
 
                                which_page = index / listbox_info.page_size;
-                               rect.Y = (index % listbox_info.page_size) * ItemHeight;
+                               rect.Y = ((index - listbox_info.top_item) % listbox_info.page_size) * ItemHeight;
                                rect.X = which_page * ColumnWidthInternal;
                                rect.Height = ItemHeight;
                                rect.Width = ColumnWidthInternal;
@@ -834,11 +843,14 @@ namespace System.Windows.Forms
                protected override void OnFontChanged (EventArgs e)
                {
                        base.OnFontChanged (e);
-                       listbox_info.item_height = FontHeight;
-
-                       RellocateScrollBars ();
-                       CalcClientArea ();
-                       UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+                       if (!use_item_height) {
+                               listbox_info.item_height = FontHeight;
+                               RellocateScrollBars ();
+                               CalcClientArea ();
+                               UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+                       } else {
+                               base.Refresh ();
+                       }
                }
 
                protected override void OnHandleCreated (EventArgs e)
@@ -1000,8 +1012,8 @@ namespace System.Windows.Forms
                        listbox_info.textdrawing_rect.Y += ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle);
                        listbox_info.textdrawing_rect.X += ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle);
                        //BUG: Top and Left decorations
-                       listbox_info.textdrawing_rect.Height -= ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle);
-                       listbox_info.textdrawing_rect.Width -= ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle);
+                       listbox_info.textdrawing_rect.Height -= ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle) + ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle);
+                       listbox_info.textdrawing_rect.Width -= ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle) + ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle);
 
                        if (listbox_info.show_verticalsb)
                                listbox_info.textdrawing_rect.Width -= vscrollbar_ctrl.Width;
@@ -1022,7 +1034,7 @@ namespace System.Windows.Forms
                                }
                                                                
                        } else {                        
-                               listbox_info.page_size = listbox_info.textdrawing_rect.Height / listbox_info.item_height;
+                               listbox_info.page_size = listbox_info.textdrawing_rect.Height / ItemHeight;
                        }
 
                        if (listbox_info.page_size == 0) {
@@ -1037,7 +1049,7 @@ namespace System.Windows.Forms
                                // items can still be partially shown if scroll bars are displayed.
 
                                int remaining =  (listbox_info.client_rect.Height -
-                                       ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle) -
+                                       ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle) -
                                        ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle)) %
                                        listbox_info.item_height;
 
@@ -1085,7 +1097,7 @@ namespace System.Windows.Forms
                                        if (has_focus == true && focused_item == i)
                                                state |= DrawItemState.Focus;
                                                
-                                       if (hscrollbar_ctrl != null && hscrollbar_ctrl.Visible) {
+                                       if (MultiColumn == false && hscrollbar_ctrl != null && hscrollbar_ctrl.Visible) {
                                                item_rect.X -= hscrollbar_ctrl.Value;
                                                item_rect.Width += hscrollbar_ctrl.Value;
                                        }
@@ -1109,7 +1121,7 @@ namespace System.Windows.Forms
 
                        item_rect.Y += ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle);
                        item_rect.X += ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle);
-                       item_rect.Width -= ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle);
+                       item_rect.Width -= ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle);// + ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle);
 
                        return item_rect;
                }
@@ -1128,11 +1140,11 @@ namespace System.Windows.Forms
                // Only returns visible points. The diference of with IndexFromPoint is that the rectangle
                // has screen coordinates
                internal int IndexFromPointDisplayRectangle (int x, int y)
-               {                               
-                       if (LBoxInfo.top_item == LBoxInfo.last_item)
+               {       
+                       if (Items.Count == 0)
                                return -1;
                        
-                       for (int i = LBoxInfo.top_item; i <= LBoxInfo.last_item; i++) {
+                       for (int i = LBoxInfo.top_item; i <= LBoxInfo.last_item; i++) {
                                if (GetItemDisplayRectangle (i, LBoxInfo.top_item).Contains (x, y) == true)
                                        return i;
                        }
@@ -1165,7 +1177,7 @@ namespace System.Windows.Forms
                                        }
                                        else {
                                                if (item_rect.Y + item_rect.Height > top_y)
-                                                       return i - 1;
+                                                       return i;
                                        }
                                }
                        }
@@ -1254,9 +1266,19 @@ namespace System.Windows.Forms
 
                        case ItemNavigation.Next: {
                                if (focused_item + 1 < Items.Count) {   
-                                       if (focused_item + 1 > LBoxInfo.last_item) {
-                                               LBoxInfo.top_item++;
-                                               UpdatedTopItem ();                                              
+                                       int actualHeight = 0;
+                                       if (draw_mode == DrawMode.OwnerDrawVariable) {
+                                               for (int i = LBoxInfo.top_item; i <= focused_item + 1; i++)
+                                                       actualHeight += GetItemHeight (i);
+                                       } else {
+                                               actualHeight = ((focused_item + 1) - LBoxInfo.top_item + 1) * ItemHeight;
+                                       }
+                                       if (actualHeight >= LBoxInfo.textdrawing_rect.Height) {
+                                               int bal = IntegralHeight ? 0 : (listbox_info.textdrawing_rect.Height == actualHeight ? 0 : 1);
+                                               if (focused_item + bal >= LBoxInfo.last_item) {
+                                                       LBoxInfo.top_item++;
+                                                       UpdatedTopItem ();                                              
+                                               }
                                        }
                                        selected_index = focused_item + 1;
                                }
@@ -1347,6 +1369,9 @@ namespace System.Windows.Forms
                private void OnKeyDownLB (object sender, KeyEventArgs e)
                {                                       
                        int new_item = -1;
+                       
+                       if (Items.Count == 0)
+                               return;
 
                        switch (e.KeyCode) {
                                
@@ -1507,7 +1532,7 @@ namespace System.Windows.Forms
                }               
                
                // An item navigation operation (mouse or keyboard) has caused to select a new item
-               private void SelectedItemFromNavigation (int index)
+               internal void SelectedItemFromNavigation (int index)
                {
                        switch (SelectionMode) {
                                case SelectionMode.None: // Do nothing
@@ -1594,7 +1619,7 @@ namespace System.Windows.Forms
                        }
                }
                
-               void SetFocusedItem (int index)
+               internal void SetFocusedItem (int index)
                {                       
                        Rectangle invalidate;
                        int prev = focused_item;                        
@@ -1798,6 +1823,8 @@ namespace System.Windows.Forms
                                        vscrollbar_ctrl.Maximum = Items.Count - listbox_info.page_size;
 
                                RellocateScrollBars ();
+                       } else if (vscrollbar_ctrl.Maximum > 0) {
+                               vscrollbar_ctrl.Maximum = 0;
                        }
 
                        CalcClientArea ();
index 0af4624a3237d30b1e270f86e9fd581a0c333434..34c4c48aabd40805048456bca87caeb721db08b5 100644 (file)
@@ -212,6 +212,8 @@ namespace System.Windows.Forms
                {
                        TRACKER tracker = new TRACKER ();                                               
                        MENU menu = null;
+                       MSG msg = new MSG();
+                       bool no_quit = true;
 
                        if (hMenu == IntPtr.Zero)       // No submenus to track
                                return true;                            
@@ -236,10 +238,19 @@ namespace System.Windows.Forms
                                ((PopUpWindow)menu.Wnd).RefreshItems ();
                                menu.menu.IsDirty = false;
                        }
-                       
                        ((PopUpWindow)menu.Wnd).ShowWindow ();
+                       
+                       while ((menu.Wnd != null) && menu.Wnd.Visible && no_quit) {
+                               no_quit = XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0);
+                               if ((msg.hwnd == menu.Wnd.Handle) || (msg.message == Msg.WM_PAINT)) {
+                                       XplatUI.TranslateMessage(ref msg);
+                                       XplatUI.DispatchMessage(ref msg);
+                               }
+                       }
 
-                       Application.Run ();
+                       if (!no_quit) {
+                               XplatUI.Exit();
+                       }
 
                        if (menu.Wnd == null) {
                                menu.Wnd.Dispose ();
index 1e5a2987754275b042bda83d660ea976e5e7ea2c..5d8863d01cef9ac07284f20d3b1d63284ef62804 100644 (file)
@@ -103,6 +103,21 @@ namespace System.Windows.Forms
                        if ( session != null )
                        {
                                session = session.ToUpper( );
+                               
+                               if ( session == "DEFAULT" )
+                               {
+                                       string helper = Environment.GetEnvironmentVariable( "KDE_FULL_SESSION" );
+                                       
+                                       if ( helper != null )
+                                               session = "KDE";
+                                       else
+                                       {
+                                               helper = Environment.GetEnvironmentVariable( "GNOME_DESKTOP_SESSION_ID" );
+                                               
+                                               if ( helper != null )
+                                                       session = "GNOME";
+                                       }
+                               }
                        }
                        else
                                session = "";
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertiesTab.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertiesTab.cs
new file mode 100755 (executable)
index 0000000..05cb7ef
--- /dev/null
@@ -0,0 +1,77 @@
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+// Copyright (c) 2005 Novell, Inc.\r
+//\r
+// Authors:\r
+//     Jonathan Chambers       jonathan.chambers@ansys.com\r
+//\r
+\r
+\r
+// NOT COMPLETE\r
+\r
+using System;\r
+\r
+namespace System.Windows.Forms.PropertyGridInternal\r
+{\r
+       /// <summary>\r
+       /// Summary description for PropertiesTab.\r
+       /// </summary>\r
+       public class PropertiesTab : System.Windows.Forms.Design.PropertyTab\r
+       {\r
+               public PropertiesTab()\r
+               {\r
+               }\r
+\r
+               public override System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes)\r
+               {\r
+                       return base.GetProperties(null, component, attributes);\r
+               }\r
+\r
+               public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object component, Attribute[] attributes)\r
+               {\r
+                       return base.GetProperties (context, component, attributes);\r
+               }\r
+\r
+               public override System.ComponentModel.PropertyDescriptor GetDefaultProperty (object component)\r
+               {\r
+                       return base.GetDefaultProperty(component);\r
+               }\r
+\r
+               public override string HelpKeyword\r
+               {\r
+                       get\r
+                       {\r
+                               return base.HelpKeyword;\r
+                       }\r
+               }\r
+\r
+\r
+               public override string TabName\r
+               {\r
+                       get\r
+                       {\r
+                               return string.Empty;\r
+                       }\r
+               }\r
+\r
+\r
+\r
+       }\r
+}\r
index 3568ec9fa333af8629e63da20ee21ac225a4a9fd..97a60df749cc83bdf0a2e744e1960ab61d17ed22 100644 (file)
@@ -87,6 +87,7 @@ namespace System.Windows.Forms
                public PropertyGrid() {
                        selected_objects = new object[1];
                        grid_items = new GridItemCollection();
+                       property_tabs = new PropertyTabCollection();
 
                        line_color = SystemColors.ScrollBar;
                        line_color = SystemColors.ScrollBar;
@@ -102,21 +103,33 @@ namespace System.Windows.Forms
 
                        help_panel = new Panel();
                        help_panel.Dock = DockStyle.Bottom;
-                       help_panel.DockPadding.All = 3;
+                       //help_panel.DockPadding.All = 3;
                        help_panel.Height = 50;
+                       help_panel.BackColor = SystemColors.Control;
 
-                       help_description_label = new Label();
-                       help_description_label.Dock = DockStyle.Fill;
-                       help_description_label.Name = "help_description_label";
-                       help_description_label.Font = this.Font;
 
                        help_title_label = new Label();
-                       help_title_label.Dock = DockStyle.Top;
+                       help_title_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        help_title_label.Name = "help_title_label";
-                       help_description_label.Font = new Font(this.Font,FontStyle.Bold);
+                       help_title_label.Font = new Font(this.Font,FontStyle.Bold);
+                       help_title_label.Text = "Title";
+                       help_title_label.Location = new Point(2,2);
+                       help_title_label.Height = 17;
+                       help_title_label.Width = help_panel.Width - 4;
+
+                       
+                       help_description_label = new Label();
+                       help_description_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+                       help_description_label.Name = "help_description_label";
+                       help_description_label.Font = this.Font;
+                       help_description_label.Text = "The long important Description";
+                       help_description_label.Location = new Point(2,help_title_label.Top+help_title_label.Height);
+                       help_description_label.Width = help_panel.Width - 4;
+                       help_description_label.Height = 17;
 
                        help_panel.Controls.Add(help_description_label);
                        help_panel.Controls.Add(help_title_label);
+                       help_panel.Paint+=new PaintEventHandler(help_panel_Paint);
 
                        toolbar = new ToolBar();
                        toolbar.Dock = DockStyle.Top;
@@ -126,15 +139,13 @@ namespace System.Windows.Forms
                        propertypages_toolbarbutton = new ToolBarButton();
                        context_menu = new ContextMenu();
 
-                       //help_title_label.Dock = DockStyle.Top;
-                       help_title_label.Name = "help_title_label";
-                       help_title_label.Location = new Point(2,20);
-                       help_title_label.Size = new Size(20,20);
-
                        toolbar_imagelist = new ImageList();
                        toolbar_imagelist.ColorDepth = ColorDepth.Depth32Bit;
                        toolbar_imagelist.ImageSize = new System.Drawing.Size(16, 16);
                        toolbar_imagelist.TransparentColor = System.Drawing.Color.Transparent;
+                       toolbar_imagelist.Images.Add( (Image)Locale.GetResource( "propertygrid_sort_category") );
+                       toolbar_imagelist.Images.Add( (Image)Locale.GetResource( "propertygrid_sort_alphabetical") );
+                       toolbar_imagelist.Images.Add( (Image)Locale.GetResource( "propertygrid_tab_properties") );
 
                        toolbar.Appearance = ToolBarAppearance.Flat;
                        toolbar.AutoSize = false;
@@ -153,21 +164,20 @@ namespace System.Windows.Forms
                        toolbar.TabIndex = 0;
                        toolbar.ButtonClick += new ToolBarButtonClickEventHandler(toolbar_ButtonClick);
 
+                       categorized_toolbarbutton.ImageIndex = 0;
                        categorized_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
-                       categorized_toolbarbutton.ToolTipText = "Categorized";
-                       categorized_toolbarbutton.Text = "C";
+                       categorized_toolbarbutton.ToolTipText = (string)Locale.GetResource( "Categorized");
 
+                       alphabetic_toolbarbutton.ImageIndex = 1;
                        alphabetic_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
-                       alphabetic_toolbarbutton.ToolTipText = "Alphabetic";
-                       alphabetic_toolbarbutton.Text = "A";
-                       alphabetic_toolbarbutton.ImageIndex = 0;
+                       alphabetic_toolbarbutton.ToolTipText = (string)Locale.GetResource( "Alphabetic");
 
                        separator_toolbarbutton.Style = ToolBarButtonStyle.Separator;
 
                        propertypages_toolbarbutton.Enabled = false;
+                       propertypages_toolbarbutton.ImageIndex = 2;
                        propertypages_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
                        propertypages_toolbarbutton.ToolTipText = "Property Pages";
-                       propertypages_toolbarbutton.Text = "P";
 
                        
                        reset_menuitem = context_menu.MenuItems.Add("Reset");
@@ -217,7 +227,6 @@ namespace System.Windows.Forms
                        }
                }
                
-               [MonoTODO]
                [Browsable(false)]
                [EditorBrowsable(EditorBrowsableState.Never)]
                public override bool AutoScroll {
@@ -242,7 +251,6 @@ namespace System.Windows.Forms
                        }
                }
                
-               [MonoTODO()]
                [Browsable(false)]
                [EditorBrowsable(EditorBrowsableState.Never)]
                public override Image BackgroundImage {
@@ -320,7 +328,6 @@ namespace System.Windows.Forms
                        }
                }
                
-               [MonoTODO()]
                [Browsable(false)]
                [EditorBrowsable(EditorBrowsableState.Never)]
                [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
@@ -330,7 +337,6 @@ namespace System.Windows.Forms
                        }
                }
                
-               [MonoTODO()]
                [Browsable(false)]
                [EditorBrowsable(EditorBrowsableState.Never)]
                public override Color ForeColor 
@@ -496,8 +502,18 @@ namespace System.Windows.Forms
 
                        set {
                                selected_objects = new object[] {value};
-                               ReflectObjects();
+                               if (this.SelectedObject == null)
+                                       return;
+                               PropertyTabAttribute[] propTabs = (PropertyTabAttribute[])this.SelectedObject.GetType().GetCustomAttributes(typeof(PropertyTabAttribute),true);
+                               if (propTabs.Length == 0)
+                                       return;
+                               foreach (Type tabType in propTabs[0].TabClasses)
+                               {
+                                       this.PropertyTabs.AddTabType(tabType);
+                               }
+                               RefreshTabs(PropertyTabScope.Component);
                                Console.WriteLine("SelectedObject");
+                               ReflectObjects();
                                property_grid_view.Refresh();
                        }
                }
@@ -594,7 +610,7 @@ namespace System.Windows.Forms
                [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
                protected virtual Type DefaultTabType {
                        get {
-                               return typeof(PropertyTab);
+                               return typeof(PropertiesTab);
                        }
                }
                
@@ -622,7 +638,7 @@ namespace System.Windows.Forms
                
                protected override void Dispose(bool val)
                {
-                       base.Dispose();
+                       base.Dispose(val);
                }
                
                public void CollapseAllGridItems () 
@@ -646,28 +662,42 @@ namespace System.Windows.Forms
                        base.Refresh ();
                }
 
-
-               [MonoTODO]
                public void RefreshTabs (PropertyTabScope tabScope) 
                {
-                       throw new NotImplementedException();
+                       
+                       /*button = new ToolBarButton("C");
+                       button.ImageIndex = 0;
+                       this.toolbar.Buttons.Add(button);
+                       button = new ToolBarButton();
+                       button.ImageIndex = 0;
+                       button.Style = ToolBarButtonStyle.Separator;
+                       this.toolbar.Buttons.Add(button);
+                       foreach (PropertyTab tab in this.PropertyTabs)
+                       {
+
+                               int index = toolbar.ImageList.Images.Count;
+                               this.toolbar.ImageList.Images.Add(tab.Bitmap);
+                               button = new ToolBarButton();
+                               button.ImageIndex = index;
+                               this.toolbar.Buttons.Add(button);
+                       }*/
+                       
                }
 
                public void ResetSelectedProperty() 
                {
                        if (selected_grid_item == null || selected_grid_item.PropertyDescriptor == null)
                                return;
-                       object[] attr = selected_grid_item.PropertyDescriptor.PropertyType.GetCustomAttributes(typeof(DefaultValueAttribute),true);
-                       if (attr.Length > 0)
-                               selected_grid_item.PropertyDescriptor.SetValue(SelectedObject,attr[0]);
+                       
+                       selected_grid_item.PropertyDescriptor.ResetValue(SelectedObject);
                }
                #endregion      // Public Instance Methods
 
                #region Protected Instance Methods
-               [MonoTODO]
+
                protected virtual PropertyTab CreatePropertyTab(Type tabType) 
                {
-                       throw new NotImplementedException();
+                       return (PropertyTab)Activator.CreateInstance(tabType);
                }
                
                [MonoTODO]
@@ -850,77 +880,68 @@ namespace System.Windows.Forms
                #region PropertyTabCollection Class
                public class PropertyTabCollection : ICollection, IEnumerable
                {
+                       System.Collections.ArrayList list;
                        #region Private Constructors
-                       private PropertyTabCollection() {
+                       internal PropertyTabCollection() {
+                               list = new ArrayList();
                        }
 
                        #endregion      // Private Constructors
-
-                       [MonoTODO]\r
+\r
                        public PropertyTab this[int index] {
                                get {\r
-                                       throw new NotImplementedException();
+                                       return (PropertyTab)list[index];
                                }
                        }
                
-                       #region ICollection Members
-                       [MonoTODO]\r
+                       #region ICollection Members\r
                        bool ICollection.IsSynchronized
                        {
                                get {\r
-                                       // TODO:  Add PropertyTabCollection.IsSynchronized getter implementation
-                                       return false;
+                                       return list.IsSynchronized;
                                }
                        }
 
-                       [MonoTODO]
                        void ICollection.CopyTo(Array array, int index)
                        {
-                               // TODO:  Add PropertyTabCollection.CopyTo implementation
+                               list.CopyTo(array, index);
                        }
-
-                       [MonoTODO]\r
+\r
                        object ICollection.SyncRoot
                        {
                                get {\r
-                                       // TODO:  Add PropertyTabCollection.SyncRoot getter implementation
-                                       return null;
+                                       return list.SyncRoot;
                                }
                        }
 
                        #endregion
 
                        #region IEnumerable Members
-                       [MonoTODO]
                        public IEnumerator GetEnumerator() {
-                               // TODO:  Add PropertyTabCollection.GetEnumerator implementation
-                               return null;
+                               return list.GetEnumerator();
                        }
 
                        #endregion
                
-                       #region ICollection Members
-                       [MonoTODO]\r
+                       #region ICollection Members\r
                        public int Count {
                                get {\r
-                                       // TODO:  Add PropertyTabCollection.Count getter implementation
-                                       return 0;
+                                       return list.Count;
                                }
                        }
 
                        #endregion
                        
                        #region Public Instance Methods
-                       [MonoTODO]
                        public void AddTabType(System.Type propertyTabType)
                        {
-                               throw new NotImplementedException();
+                               list.Add(Activator.CreateInstance(propertyTabType));
                        }
                        [MonoTODO]
                        public void AddTabType(System.Type propertyTabType,
                                System.ComponentModel.PropertyTabScope tabScope)
                        {
-                               throw new NotImplementedException();
+                               AddTabType(propertyTabType);
                        }
                        [MonoTODO]
                        public void Clear(System.ComponentModel.PropertyTabScope tabScope)
@@ -1000,26 +1021,30 @@ namespace System.Windows.Forms
 
                private void PopulateGridItemCollection (object obj, GridItemCollection grid_item_coll, GridItemCollection category_grid_item_coll) 
                {
-//                     TypeConverter converter = TypeDescriptor.GetConverter(obj);
+                       //TypeConverter converter = TypeDescriptor.GetConverter(obj);
                        PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj);\r
-                       for (int i = 0; i < properties.Count;i++) {
-                               bool not_browseable = properties[i].Attributes.Contains(new BrowsableAttribute(false));
-                               if (!not_browseable/*properties[i].IsBrowsable*/) {\r
-                                       GridEntry grid_entry = new GridEntry(obj, properties[i]);\r
-                                       grid_item_coll.Add(properties[i].Name,grid_entry);
+                       foreach (PropertyDescriptor property in properties) {
+                               if (property.IsBrowsable) {\r
+                                       GridEntry grid_entry = new GridEntry(obj, property);\r
+                                       grid_item_coll.Add(property.Name,grid_entry);
 
-                                       string category = properties[i].Category;
+                                       string category = property.Category;
                                        GridItem cat_item = category_grid_item_coll[category];
                                        if (cat_item == null) {
                                                cat_item = new CategoryGridEntry(category);
                                                category_grid_item_coll.Add(category,cat_item);
                                        }
-                                       cat_item.GridItems.Add(properties[i].Name,grid_entry);
+                                       cat_item.GridItems.Add(property.Name,grid_entry);
                                }
                        }
                }\r
 \r
-               #endregion      // Private Helper Methods
+               #endregion      // Private Helper Methods\r
 \r
+               private void help_panel_Paint(object sender, PaintEventArgs e)\r
+               {\r
+                       e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(help_panel.BackColor), help_panel.ClientRectangle );\r
+                       e.Graphics.DrawRectangle(SystemPens.ControlDark, 0,0,help_panel.Width-1,help_panel.Height-1 );\r
+               }\r
        }
 }
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridCommands.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridCommands.cs
new file mode 100755 (executable)
index 0000000..b0de7e8
--- /dev/null
@@ -0,0 +1,47 @@
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+// Copyright (c) 2005 Novell, Inc.\r
+//\r
+// Authors:\r
+//     Jonathan Chambers       jonathan.chambers@ansys.com\r
+//\r
+\r
+\r
+// COMPLETE\r
+\r
+using System;\r
+using System.ComponentModel.Design;\r
+\r
+namespace System.Windows.Forms.PropertyGridInternal\r
+{\r
+       public class PropertyGridCommands\r
+       {\r
+               public PropertyGridCommands()\r
+               {\r
+               }\r
+\r
+               public static readonly CommandID Commands;\r
+               public static readonly CommandID Description;\r
+               public static readonly CommandID Hide;\r
+               public static readonly CommandID Reset;\r
+               protected static readonly Guid wfcMenuCommand;\r
+               protected static readonly Guid wfcMenuGroup;\r
+       }\r
+}\r
index 1a1f330c4e0bdcaa5a7393d8df2dbddfc57bfe86..9d8d5b060d79861d0efa058ecfe8b6044abdde38 100644 (file)
@@ -1,7 +1,7 @@
 using System;\r
 \r
 namespace System.Windows.Forms.PropertyGridInternal {\r
-       public class PropertyGridTextBox : System.Windows.Forms.UserControl {\r
+       internal class PropertyGridTextBox : System.Windows.Forms.UserControl {\r
                private TextBox textbox;\r
                private Button dialog_button;\r
                private Button dropdown_button;\r
index 12c36eee986084b58966ef465aff8cde9621b607..0ee17b6993ab39f220253d216ae96a9b11732399 100644 (file)
@@ -35,7 +35,7 @@ using System.Windows.Forms.Design;
 \r
 namespace System.Windows.Forms.PropertyGridInternal \r
 {\r
-       public class PropertyGridView : System.Windows.Forms.ScrollableControl, IWindowsFormsEditorService\r
+       internal class PropertyGridView : System.Windows.Forms.ScrollableControl, IWindowsFormsEditorService\r
        {\r
 \r
                #region Private Members\r
@@ -111,6 +111,17 @@ namespace System.Windows.Forms.PropertyGridInternal
                \r
                protected override void OnPaint(PaintEventArgs e)\r
                {\r
+                       if (property_grid.SelectedGridItem != null && property_grid.SelectedGridItem.GridItemType == GridItemType.Property) \r
+                       {\r
+                               this.Controls.Add(grid_textbox);\r
+                               if (!grid_textbox.Focused)\r
+                                       grid_textbox.Focus();\r
+                       }\r
+                       else \r
+                       {\r
+                               this.Controls.Remove(grid_textbox);\r
+                       }\r
+\r
                        // Decide if we need a scrollbar
                        open_grid_item_count = 0;\r
 \r
@@ -126,20 +137,11 @@ namespace System.Windows.Forms.PropertyGridInternal
                        DrawGridItems(property_grid.grid_items, e, 1, ref yLoc);\r
 \r
                        DrawGrid(e, yLoc);\r
+                       e.Graphics.DrawRectangle(SystemPens.ControlDark, 0,0,Width-1,Height-1 );\r
                        \r
                        \r
 
 \r
-                       if (property_grid.SelectedGridItem != null && property_grid.SelectedGridItem.GridItemType == GridItemType.Property) \r
-                       {\r
-                               this.Controls.Add(grid_textbox);\r
-                               if (!grid_textbox.Focused)\r
-                                       grid_textbox.Focus();\r
-                       }\r
-                       else \r
-                       {\r
-                               this.Controls.Remove(grid_textbox);\r
-                       }\r
                        UpdateScrollBar();\r
                        \r
                        base.OnPaint(e);\r
@@ -555,12 +557,14 @@ namespace System.Windows.Forms.PropertyGridInternal
                                case ScrollEventType.SmallDecrement:\r
                                        XplatUI.ScrollWindow(Handle, 0, ROW_HEIGHT, false);\r
                                        grid_textbox.Top += ROW_HEIGHT;\r
-                                       Invalidate(new Rectangle(0,0,ClientRectangle.Width,ROW_HEIGHT));\r
+                                       Invalidate(ClientRectangle);\r
+                                       //Invalidate(new Rectangle(0,0,ClientRectangle.Width,ROW_HEIGHT));\r
                                        break;\r
                                case ScrollEventType.SmallIncrement:\r
                                        XplatUI.ScrollWindow(Handle, 0, -ROW_HEIGHT, false);\r
                                        grid_textbox.Top -= ROW_HEIGHT;\r
-                                       Invalidate(new Rectangle(0,ClientRectangle.Bottom-ROW_HEIGHT,ClientRectangle.Width,ROW_HEIGHT));\r
+                                       Invalidate(ClientRectangle);\r
+                                       //Invalidate(new Rectangle(0,ClientRectangle.Bottom-ROW_HEIGHT,ClientRectangle.Width,ROW_HEIGHT));\r
                                        break;\r
                                case ScrollEventType.LargeDecrement:\r
                                        XplatUI.ScrollWindow(Handle, 0, ROW_HEIGHT, false);\r
@@ -570,13 +574,13 @@ namespace System.Windows.Forms.PropertyGridInternal
                                        XplatUI.ScrollWindow(Handle, 0, -ROW_HEIGHT, false);\r
                                        Invalidate(ClientRectangle);\r
                                        break;\r
-                                       /*case ScrollEventType.ThumbTrack:\r
-                                               XplatUI.ScrollWindow(Handle, 0, -(vbar.Value-e.NewValue), false);\r
-                                               Invalidate(ClientRectangle);\r
-                                               break;\r
-                                       case ScrollEventType.ThumbPosition:\r
-                                               Invalidate(ClientRectangle);\r
-                                               break;*/\r
+                               case ScrollEventType.ThumbTrack:\r
+                                       XplatUI.ScrollWindow(Handle, 0, -(vbar.Value-e.NewValue), false);\r
+                                       Invalidate(ClientRectangle);\r
+                                       break;\r
+                               case ScrollEventType.ThumbPosition:\r
+                                       Invalidate(ClientRectangle);\r
+                                       break;\r
                        }\r
                }\r
 \r
@@ -645,8 +649,7 @@ namespace System.Windows.Forms.PropertyGridInternal
 \r
                public System.Windows.Forms.DialogResult ShowDialog(Form dialog)\r
                {\r
-                       // TODO:  Add PropertyGrid.ShowDialog implementation\r
-                       return DialogResult.OK;\r
+                       return dialog.ShowDialog(this);\r
                }\r
 \r
                #endregion\r
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
new file mode 100644 (file)
index 0000000..a374f69
--- /dev/null
@@ -0,0 +1,908 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    <pbartok@novell.com>
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.IO;
+using System.Text;
+using RTF=System.Windows.Forms.RTF;
+
+namespace System.Windows.Forms {
+       public class RichTextBox : TextBoxBase {
+               #region Local Variables
+               internal bool           auto_word_select;
+               internal int            bullet_indent;
+               internal bool           can_redo;
+               internal bool           detect_urls;
+               internal string         redo_action_name;
+               internal int            margin_right;
+               internal string         undo_action_name;
+               internal float          zoom;
+
+               private RTF.TextMap     rtf_text_map;
+               private int             rtf_skip_width;
+               private int             rtf_skip_count;
+               private StringBuilder   rtf_line;
+               private Font            rtf_font;
+               private SolidBrush      rtf_color;
+               private RTF.Font        rtf_rtffont;
+               private int             rtf_rtffont_size;
+               private FontStyle       rtf_rtfstyle;
+               private HorizontalAlignment rtf_rtfalign;
+               private int             rtf_cursor_x;
+               private int             rtf_cursor_y;
+               #endregion      // Local Variables
+
+               #region Public Constructors
+               public RichTextBox() {
+                       accepts_return = true;
+                       auto_word_select = false;
+                       bullet_indent = 0;
+                       can_redo = false;
+                       detect_urls = true;
+                       max_length = Int32.MaxValue;
+                       redo_action_name = string.Empty;
+                       margin_right = 0;
+                       undo_action_name = string.Empty;
+                       zoom = 1;
+                       base.Multiline = true;
+                       document.CRLFSize = 1;
+
+                       scrollbars = RichTextBoxScrollBars.Both;
+                       alignment = HorizontalAlignment.Left;
+                       this.LostFocus +=new EventHandler(RichTextBox_LostFocus);
+                       this.BackColor = ThemeEngine.Current.ColorWindow;
+                       this.ForeColor = ThemeEngine.Current.ColorWindowText;
+
+                       Console.WriteLine("A friendly request: Do not log a bug about debug messages being emitted when\n" +
+                               "using RichTextBox. It's not yet finished, it will spew debug information, and\n" +
+                               "it may not work the way you like it just yet. Some methods also are also not yet\n" + 
+                               "implemented. And we're also aware that text gets bolder with every change.");
+                       Console.WriteLine("To quote Sean Gilkes: Patience is a virtue, waiting doesn't hurt you :-)");
+               }
+               #endregion      // Public Constructors
+
+               #region Private & Internal Methods
+               private void RichTextBox_LostFocus(object sender, EventArgs e) {\r
+                       has_focus = false;\r
+                       Invalidate();\r
+               }\r
+               #endregion      // Private & Internal Methods
+
+               #region Public Instance Properties
+               public override bool AllowDrop {\r
+                       get {\r
+                               return base.AllowDrop;\r
+                       }\r
+\r
+                       set {\r
+                               base.AllowDrop = value;\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(false)]\r
+               public override bool AutoSize {\r
+                       get {\r
+                               return auto_size;\r
+                       }\r
+\r
+                       set {\r
+                               base.AutoSize = value;\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(false)]\r
+               public bool AutoWordSelection {\r
+                       get {\r
+                               return auto_word_select;\r
+                       }\r
+\r
+                       set {\r
+                               auto_word_select = true;\r
+                       }\r
+               }\r
+\r
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public override System.Drawing.Image BackgroundImage {\r
+                       get {\r
+                               return background_image;\r
+                       }\r
+\r
+                       set {\r
+                               base.BackgroundImage = value;\r
+                       }\r
+               }\r
+\r
+               [DefaultValue(0)]\r
+               [Localizable(true)]\r
+               public int BulletIndent {
+                       get {
+                               return bullet_indent;
+                       }
+
+                       set {
+                               bullet_indent = value;
+                       }
+               }
+
+               [Browsable(false)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public bool CanRedo {
+                       get {
+                               return can_redo;
+                       }
+               }
+
+               [DefaultValue(true)]
+               public bool DetectUrls {
+                       get {
+                               return detect_urls;
+                       }
+
+                       set {
+                               detect_urls = true;
+                       }
+               }
+
+               public override Font Font {\r
+                       get {\r
+                               return base.Font;\r
+                       }\r
+\r
+                       set {\r
+                               if (font != value) {\r
+                                       if (auto_size) {\r
+                                               if (PreferredHeight != Height) {
+                                                       Height = PreferredHeight;
+                                               }
+                                       }\r
+\r
+                                       base.Font = value;\r
+                               }\r
+                       }\r
+               }\r
+
+               public override Color ForeColor {\r
+                       get {\r
+                               return base.ForeColor;\r
+                       }\r
+\r
+                       set {\r
+                               base.ForeColor = value;\r
+                       }\r
+               }\r
+
+               [DefaultValue(Int32.MaxValue)]
+               public override int MaxLength {\r
+                       get {\r
+                               return base.max_length;\r
+                       }\r
+\r
+                       set {\r
+                               base.max_length = value;\r
+                       }\r
+               }\r
+
+               [DefaultValue(true)]
+               public override bool Multiline {\r
+                       get {\r
+                               return multiline;\r
+                       }\r
+\r
+                       set {\r
+                               base.Multiline = value;\r
+                       }\r
+               }\r
+
+               [Browsable(false)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [MonoTODO]
+               public string RedoActionName {
+                       get {
+                               return redo_action_name;
+                       }
+               }
+
+               [DefaultValue(0)]
+               [Localizable(true)]
+               [MonoTODO("Teach TextControl.RecalculateLine to consider the right margin as well")]
+               public int RightMargin {
+                       get {
+                               return margin_right;
+                       }
+
+                       set {
+                               margin_right = value;
+                       }
+               }
+
+               [Browsable(false)]
+               [DefaultValue("")]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [MonoTODO("finish and plug in the rtf parser/generator")]
+               public string Rtf {
+                       get {
+                               // FIXME
+                               return null;
+                       }
+
+                       set {
+                               // FIXME
+                       }
+               }
+
+               [DefaultValue(RichTextBoxScrollBars.Both)]
+               [Localizable(true)]
+               public RichTextBoxScrollBars ScrollBars {
+                       get {
+                               return scrollbars;
+                       }
+
+                       set {
+                               scrollbars = value;
+                       }
+               }
+
+               [MonoTODO("finish and plug in rtf parser/generator")]
+               public string SelectedRtf {
+                       get {
+                               // FIXME
+                               return null;
+                       }
+
+                       set {
+                               // FIXME
+                       }
+               }
+
+               public override string SelectedText {\r
+                       get {\r
+                               return base.SelectedText;\r
+                       }\r
+\r
+                       set {\r
+                               base.SelectedText = value;\r
+                       }\r
+               }\r
+
+               [Browsable(false)]
+               [DefaultValue(HorizontalAlignment.Left)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public HorizontalAlignment SelectionAlignment {
+                       get {
+                               HorizontalAlignment     align;
+                               int                     line_no;
+                               Line                    start;
+                               Line                    end;
+                               Line                    line;
+
+                               start = document.ParagraphStart(document.selection_start.line);
+                               align = start.alignment;
+                               line_no = start.line_no;
+
+                               end = document.ParagraphEnd(document.selection_end.line);
+
+                               line = start;
+
+                               while (true) {
+                                       if (line.alignment != align) {
+                                               return HorizontalAlignment.Left;
+                                       }
+
+                                       if (line == end) {
+                                               break;
+                                       }
+                                       line = document.GetLine(line.line_no + 1);
+                               }
+
+                               return align;
+                       }
+
+                       set {
+                               HorizontalAlignment     align;
+                               int                     line_no;
+                               Line                    start;
+                               Line                    end;
+                               Line                    line;
+
+                               start = document.ParagraphStart(document.selection_start.line);
+                               line_no = start.line_no;
+
+                               end = document.ParagraphEnd(document.selection_end.line);
+
+                               line = start;
+
+                               while (true) {
+                                       line.alignment = value;
+
+                                       if (line == end) {
+                                               break;
+                                       }
+                                       line = document.GetLine(line.line_no + 1);
+                               }
+                               this.CalculateDocument();
+                       }
+               }
+
+
+               public Font SelectionFont {
+                       get {
+                               Font    font;
+                               LineTag start;
+                               LineTag end;
+                               LineTag tag;
+
+                               start = document.selection_start.tag;
+                               end = document.selection_end.tag;
+                               font = document.selection_start.tag.font;
+
+                               tag = start;
+                               while (true) {
+                                       if (!font.Equals(tag.font)) {
+                                               return null;
+                                       }
+
+                                       if (tag == end) {
+                                               break;
+                                       }
+
+                                       tag = document.NextTag(tag);
+
+                                       if (tag == null) {
+                                               break;
+                                       }
+                               }
+
+                               return font;
+                       }
+
+                       set {
+                               int     sel_start;
+                               int     sel_end;
+
+                               sel_start = document.LineTagToCharIndex(document.selection_start.line, document.selection_start.pos);
+                               sel_end = document.LineTagToCharIndex(document.selection_end.line, document.selection_end.pos);
+
+                               document.FormatText(document.selection_start.line, document.selection_start.pos + 1, document.selection_end.line, document.selection_end.pos, value, document.selection_start.tag.color);
+
+                               document.CharIndexToLineTag(sel_start, out document.selection_start.line, out document.selection_start.tag, out document.selection_start.pos);
+                               document.CharIndexToLineTag(sel_end, out document.selection_end.line, out document.selection_end.tag, out document.selection_end.pos);
+
+                               document.UpdateView(document.selection_start.line, 0);
+                               document.AlignCaret();
+                               
+                       }
+               }
+
+               [Localizable(true)]
+               public override string Text {\r
+                       get {\r
+                               return base.Text;\r
+                       }\r
+\r
+                       set {\r
+                               base.Text = value;\r
+                       }\r
+               }\r
+
+               [Browsable(false)]
+               public override int TextLength {\r
+                       get {\r
+                               return base.TextLength;\r
+                       }\r
+               }\r
+
+               [Browsable(false)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public string UndoActionName {
+                       get {
+                               return undo_action_name;
+                       }
+               }
+
+               [Localizable(true)]
+               [DefaultValue(1)]
+               public float ZoomFactor {
+                       get {
+                               return zoom;
+                       }
+
+                       set {
+                               zoom = value;
+                       }
+               }
+               #endregion      // Public Instance Properties
+
+               #region Protected Instance Properties
+               protected override CreateParams CreateParams {\r
+                       get {\r
+                               return base.CreateParams;\r
+                       }\r
+               }\r
+
+               protected override Size DefaultSize {\r
+                       get {\r
+                               return new Size(100, 96);\r
+                       }\r
+               }\r
+               #endregion      // Protected Instance Properties
+
+               #region Public Instance Methods
+               public void LoadFile(System.IO.Stream data, RichTextBoxStreamType fileType) {
+                       RTF.RTF rtf;    // Not 'using SWF.RTF' to avoid ambiguities with font and color
+
+                       document.Empty();
+
+                       // FIXME - ignoring unicode
+                       if (fileType == RichTextBoxStreamType.PlainText) {
+                               StringBuilder   sb;\r
+                               int             count;\r
+                               byte[]          buffer;\r
+\r
+                               try {\r
+                                       sb = new StringBuilder((int)data.Length);\r
+                                       buffer = new byte[1024];\r
+                               }\r
+\r
+                               catch {\r
+                                       throw new IOException("Not enough memory to load document");\r
+                                       return;\r
+                               }\r
+\r
+                               count = 0;\r
+                               while (count < data.Length) {\r
+                                       count += data.Read(buffer, count, 1024);\r
+                                       sb.Append(buffer);\r
+                               }\r
+                               base.Text = sb.ToString();\r
+                               return;\r
+                       }\r
+
+
+                       rtf = new RTF.RTF(data);
+
+                       // Prepare
+                       rtf.ClassCallback[RTF.TokenClass.Text] = new RTF.ClassDelegate(HandleText);
+                       rtf.ClassCallback[RTF.TokenClass.Control] = new RTF.ClassDelegate(HandleControl);
+
+                       rtf_skip_width = 0;
+                       rtf_skip_count = 0;
+                       rtf_line = new StringBuilder();
+                       rtf_font = Font;
+                       rtf_color = new SolidBrush(ForeColor);
+                       rtf_rtffont_size = this.Font.Height;
+                       rtf_rtfalign = HorizontalAlignment.Left;
+                       rtf_rtffont = null;
+                       rtf_cursor_x = 0;
+                       rtf_cursor_y = 1;
+
+                       rtf_text_map = new RTF.TextMap();
+                       RTF.TextMap.SetupStandardTable(rtf_text_map.Table);
+
+                       rtf.Read();     // That's it
+                       document.RecalculateDocument(CreateGraphics());
+               }
+
+               public void LoadFile(string path) {
+                       if (path.EndsWith(".rtf")) {
+                               LoadFile(path, RichTextBoxStreamType.RichText);
+                       } else {
+                               LoadFile(path, RichTextBoxStreamType.PlainText);
+                       }
+               }
+
+               public void LoadFile(string path, RichTextBoxStreamType fileType) {
+                       FileStream      data;
+
+                       data = null;
+
+//                     try {
+                               data = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024);
+                               LoadFile(data, fileType);
+//                     }
+
+//                     catch {
+//                             throw new IOException("Could not open file " + path);
+//                     }
+
+//                     finally {
+                               if (data != null) {
+                                       data.Close();
+//                             }
+                       }
+               }
+
+               public void SaveFile(Stream data, RichTextBoxStreamType fileType) {
+               }
+
+               public void SaveFile(string path) {
+                       if (path.EndsWith(".rtf")) {
+                               SaveFile(path, RichTextBoxStreamType.RichText);
+                       } else {
+                               SaveFile(path, RichTextBoxStreamType.PlainText);
+                       }
+               }
+
+               public void SaveFile(string path, RichTextBoxStreamType fileType) {
+                       FileStream      data;
+                       Encoding        encoding;
+
+                       data = null;
+                       if (fileType == RichTextBoxStreamType.UnicodePlainText) {
+                               encoding = Encoding.Unicode;
+                       } else {
+                               encoding = Encoding.ASCII;
+                       }
+
+                       try {
+                               data = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 1024, false);
+                               SaveFile(data, fileType);
+                       }
+
+                       catch {
+                               throw new IOException("Could not write document to file " + path);
+                       }
+
+                       finally {
+                               if (data != null) {
+                                       data.Close();
+                               }
+                       }
+               }
+
+               #endregion      // Public Instance Methods
+
+               #region Protected Instance Methods
+               protected override void OnBackColorChanged(EventArgs e) {\r
+                       base.OnBackColorChanged (e);\r
+               }\r
+\r
+               protected override void OnContextMenuChanged(EventArgs e) {\r
+                       base.OnContextMenuChanged (e);\r
+               }\r
+\r
+               protected override void OnHandleCreated(EventArgs e) {\r
+                       base.OnHandleCreated (e);\r
+               }\r
+\r
+               protected override void OnHandleDestroyed(EventArgs e) {\r
+                       base.OnHandleDestroyed (e);\r
+               }\r
+\r
+               protected override void OnRightToLeftChanged(EventArgs e) {\r
+                       base.OnRightToLeftChanged (e);\r
+               }\r
+\r
+               protected override void OnSystemColorsChanged(EventArgs e) {\r
+                       base.OnSystemColorsChanged (e);\r
+               }\r
+\r
+               protected override void OnTextChanged(EventArgs e) {\r
+                       base.OnTextChanged (e);\r
+               }\r
+\r
+               protected override void WndProc(ref Message m) {\r
+                       base.WndProc (ref m);\r
+               }\r
+               #endregion      // Protected Instance Methods
+
+               #region Events
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event EventHandler                       BackgroundImageChanged;
+
+               public event ContentsResizedEventHandler        ContentsResized;
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event EventHandler                       DoubleClick;
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event DragEventHandler                   DragDrop;
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event DragEventHandler                   DragEnter;
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event EventHandler                       DragLeave;
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event DragEventHandler                   DragOver;
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event GiveFeedbackEventHandler           GiveFeedback;
+
+               public event EventHandler                       HScroll;
+               public event EventHandler                       ImeChange;
+               public event LinkClickedEventHandler            LinkClicked;
+               public event EventHandler                       Protected;
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event QueryContinueDragEventHandler      QueryContinueDrag;
+               public event EventHandler                       SelectionChanged;
+               public event EventHandler                       VScroll;
+               #endregion      // Events
+
+               #region Private Methods
+               void HandleControl(RTF.RTF rtf) {
+                       switch(rtf.Major) {
+                               case RTF.Major.Unicode: {
+                                       switch(rtf.Minor) {
+                                               case Minor.UnicodeCharBytes: {
+                                                       rtf_skip_width = rtf.Param;
+                                                       break;
+                                               }
+
+                                               case Minor.UnicodeChar: {
+                                                       rtf_skip_count += rtf_skip_width;
+                                                       rtf_line.Append((char)rtf.Param);
+                                                       break;
+                                               }
+                                       }
+                                       break;
+                               }
+
+                               case RTF.Major.Destination: {
+                                       Console.Write("[Got Destination control {0}]", rtf.Minor);
+                                       rtf.SkipGroup();
+                                       break;
+                               }
+
+                               case RTF.Major.CharAttr: {
+                                       switch(rtf.Minor) {
+                                               case Minor.ForeColor: {
+                                                       System.Windows.Forms.RTF.Color  color;
+                                                       int     num;
+
+                                                       color = System.Windows.Forms.RTF.Color.GetColor(rtf, rtf.Param);
+                                                       if (color != null) {
+                                                               FlushText(false);
+                                                               if (color.Red == -1 && color.Green == -1 && color.Blue == -1) {
+                                                                       this.rtf_color = new SolidBrush(ForeColor);
+                                                               } else {
+                                                                       this.rtf_color = new SolidBrush(Color.FromArgb(color.Red, color.Green, color.Blue));
+                                                               }
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.FontSize: {
+                                                       this.rtf_rtffont_size = rtf.Param / 2;
+                                                       break;
+                                               }
+
+                                               case Minor.FontNum: {
+                                                       System.Windows.Forms.RTF.Font   font;
+
+                                                       font = System.Windows.Forms.RTF.Font.GetFont(rtf, rtf.Param);
+                                                       if (font != null) {
+                                                               FlushText(false);
+                                                               this.rtf_rtffont = font;
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.Plain: {
+                                                       FlushText(false);
+                                                       rtf_rtfstyle = FontStyle.Regular;
+                                                       break;
+                                               }
+
+                                               case Minor.Bold: {
+                                                       FlushText(false);
+                                                       if (rtf.Param == RTF.RTF.NoParam) {
+                                                               rtf_rtfstyle |= FontStyle.Bold;
+                                                       } else {
+                                                               rtf_rtfstyle &= ~FontStyle.Bold;
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.Italic: {
+                                                       FlushText(false);
+                                                       if (rtf.Param == RTF.RTF.NoParam) {
+                                                               rtf_rtfstyle |= FontStyle.Italic;
+                                                       } else {
+                                                               rtf_rtfstyle &= ~FontStyle.Italic;
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.StrikeThru: {
+                                                       FlushText(false);
+                                                       if (rtf.Param == RTF.RTF.NoParam) {
+                                                               rtf_rtfstyle |= FontStyle.Strikeout;
+                                                       } else {
+                                                               rtf_rtfstyle &= ~FontStyle.Strikeout;
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.Underline: {
+                                                       FlushText(false);
+                                                       if (rtf.Param == RTF.RTF.NoParam) {
+                                                               rtf_rtfstyle |= FontStyle.Underline;
+                                                       } else {
+                                                               rtf_rtfstyle &= ~FontStyle.Underline;
+                                                       }
+                                                       break;
+                                               }
+
+                                               case Minor.NoUnderline: {
+                                                       FlushText(false);
+                                                       rtf_rtfstyle &= ~FontStyle.Underline;
+                                                       break;
+                                               }
+                                       }
+                                       break;
+                               }
+
+                               case RTF.Major.SpecialChar: {
+                                       Console.Write("[Got SpecialChar control {0}]", rtf.Minor);
+                                       SpecialChar(rtf);
+                                       break;
+                               }
+                       }
+               }
+
+               void SpecialChar(RTF.RTF rtf) {
+                       switch(rtf.Minor) {
+                               case Minor.Page:
+                               case Minor.Sect:
+                               case Minor.Row:
+                               case Minor.Line:
+                               case Minor.Par: {
+                                       FlushText(true);
+                                       break;
+                               }
+
+                               case Minor.Cell: {
+                                       Console.Write(" ");
+                                       break;
+                               }
+
+                               case Minor.NoBrkSpace: {
+                                       Console.Write(" ");
+                                       break;
+                               }
+
+                               case Minor.Tab: {
+                                       Console.Write("\t");
+                                       break;
+                               }
+
+                               case Minor.NoBrkHyphen: {
+                                       Console.Write("-");
+                                       break;
+                               }
+
+                               case Minor.Bullet: {
+                                       Console.Write("*");
+                                       break;
+                               }
+
+                               case Minor.EmDash: {
+                                       Console.Write("\97");
+                                       break;
+                               }
+
+                               case Minor.EnDash: {
+                                       Console.Write("\96");
+                                       break;
+                               }
+
+                               case Minor.LQuote: {
+                                       Console.Write("\91");
+                                       break;
+                               }
+
+                               case Minor.RQuote: {
+                                       Console.Write("\92");
+                                       break;
+                               }
+
+                               case Minor.LDblQuote: {
+                                       Console.Write("\93");
+                                       break;
+                               }
+
+                               case Minor.RDblQuote: {
+                                       Console.Write("\94");
+                                       break;
+                               }
+
+                               default: {
+                                       rtf.SkipGroup();
+                                       break;
+                               }
+                       }
+               }
+
+
+               void HandleText(RTF.RTF rtf) {
+                       if (rtf_skip_count > 0) {
+                               rtf_skip_count--;
+                               return;
+                       }
+
+                       if ((RTF.StandardCharCode)rtf.Minor != RTF.StandardCharCode.nothing) {
+                               rtf_line.Append(rtf_text_map[(RTF.StandardCharCode)rtf.Minor]);
+                       } else {
+                               if ((int)rtf.Major > 31 && (int)rtf.Major < 128) {
+                                       rtf_line.Append((char)rtf.Major);
+                               } else {
+                                       //rtf_line.Append((char)rtf.Major);
+                                       Console.Write("[Literal:0x{0:X2}]", (int)rtf.Major);
+                               }
+                       }
+               }
+
+               void FlushText(bool newline) {
+                       int             length;
+                       Font            font;
+
+                       length = rtf_line.Length;
+                       if (length == 0) {
+                               return;
+                       }
+
+                       if (rtf_rtffont != null) {
+                               font = new Font(rtf_rtffont.Name, rtf_rtffont_size, rtf_rtfstyle);
+                       } else {
+                               font = this.Font;
+                       }
+
+                       if (rtf_cursor_x == 0) {
+                               document.Add(rtf_cursor_y, rtf_line.ToString(), rtf_rtfalign, font, rtf_color);
+                       } else {
+                               Line    line;
+
+                               line = document.GetLine(rtf_cursor_y);
+                               document.InsertString(line, rtf_cursor_x, rtf_line.ToString());
+                               document.FormatText(line, rtf_cursor_x, line, rtf_cursor_x + length, font, rtf_color);
+                       }
+
+                       if (newline) {
+                               rtf_cursor_x = 0;
+                               rtf_cursor_y++;
+                       } else {
+                               rtf_cursor_x += length;
+                       }
+                       rtf_line.Length = 0;    // Empty line
+               }
+               #endregion      // Private Methods
+       }
+}
index 9c0a2eb56c549fbfb3dfb4095655306e5b840bb7..534c4c936806952114f4f6b6bbc798754bc11826 100644 (file)
@@ -324,7 +324,7 @@ namespace System.Windows.Forms {
                                }
                                if (p.AutoSize == StatusBarPanelAutoSize.Contents) {
                                        int len = (int) (DeviceContext.MeasureString (p.Text, Font).Width + 0.5F);
-                                       p.Width = (int) (len * 1.5F);
+                                       p.Width = (int) (len + 8);
                                        taken += p.Width;
                                        taken += gap;
                                        continue;
@@ -342,10 +342,11 @@ namespace System.Windows.Forms {
                                return;
 
                        int spring_total = springs.Count;
-                       int total_width = Width - taken - ThemeEngine.Current.StatusBarSizeGripWidth;
+                       int total_width = Width - taken - (SizingGrip ? ThemeEngine.Current.StatusBarSizeGripWidth : 0);
                        for (int i = 0; i < spring_total; i++) {
                                StatusBarPanel p = (StatusBarPanel) springs [i];
-                               p.Width = total_width / spring_total;
+                               int width = total_width / spring_total;
+                               p.Width = (width >= p.MinWidth ? width : p.MinWidth);
                        }
                }
 
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TODO b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TODO
deleted file mode 100644 (file)
index 00f989a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Things that need to be done:
-
-X11 Driver
-- 
index a357f326db78791b058d4d002f0bc2044431a54d..516be9356ee609e27b0cc251a3ba1ad1f3d7c852 100644 (file)
@@ -437,6 +437,7 @@ namespace System.Windows.Forms
                
                // Default colours
                public abstract Color DataGridAlternatingBackColor { get; }             
+               public abstract Color DataGridBackColor { get; }                
                public abstract Color DataGridBackgroundColor { get; }
                public abstract Color DataGridCaptionBackColor { get; }
                public abstract Color DataGridCaptionForeColor { get; }         
index 270edf801d8228f7ad044165a1b4530fc5d6d040..d9fd2c758d8b4129893194fa72426a562b79c3fa 100644 (file)
@@ -35,22 +35,22 @@ using System.Drawing.Text;
 namespace System.Windows.Forms
 {
        
-       internal class ThemeNice : Theme
+       internal class ThemeNice : ThemeWin32Classic
        {
                public override Version Version
                {
                        get {
-                               return new Version( 0, 1, 0, 0 );
+                               return new Version( 0, 0, 0, 1 );
                        }
                }
                
-               /* Default colors for Win32 classic theme */
+               /* Default colors for nice theme */
                uint [] theme_colors = {                                                        /* AARRGGBB */
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_SCROLLBAR,                   0xffc0c0c0,
-                       (uint) XplatUIWin32.GetSysColorIndex.COLOR_BACKGROUND,                  0xff008080,
+                       (uint) XplatUIWin32.GetSysColorIndex.COLOR_BACKGROUND,                  0xffefebe7,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_ACTIVECAPTION,               0xff000080,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTION,             0xff808080,
-                       (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENU,                        0xffc0c0c0,
+                       (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENU,                        0xffefebe7,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOW,                      0xffffffff,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOWFRAME,                 0xff000000,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENUTEXT,                    0xff000000,
@@ -61,7 +61,7 @@ namespace System.Windows.Forms
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_APPWORKSPACE,                0xff808080,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHT,                   0xff000080,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHTTEXT,               0xffffffff,
-                       (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNFACE,                     0xffefebe7, //0xffe7e8ec, //0xffc0c0c0,
+                       (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNFACE,                     0xffefebe7,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNSHADOW,                   0xff808080,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_GRAYTEXT,                    0xff808080,
                        (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNTEXT,                     0xff000000,
@@ -74,11 +74,6 @@ namespace System.Windows.Forms
                
                };
                
-               /* Hardcoded colour values not exposed in the API constants in all configurations */
-               static readonly Color arrow_color = Color.Black;
-               static readonly Color pen_ticks_color = Color.Black;
-               static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
-               
                static readonly Color NormalColor = Color.LightGray;
                static readonly Color MouseOverColor = Color.DarkGray;
                static readonly Color PressedColor = Color.Gray;
@@ -89,17 +84,6 @@ namespace System.Windows.Forms
                static readonly Color BorderColor = MouseOverColor;
                static readonly Color NiceBackColor  = Color.FromArgb( System.Convert.ToInt32( "0xffefebe7", 16 ) );
                
-               static StringFormat string_format_menu_text;
-               static StringFormat string_format_menu_shortcut;
-               static StringFormat string_format_menu_menubar_text;
-               static readonly Rectangle checkbox_rect = new Rectangle (2, 2, 11,11); // Position of the checkbox relative to the item
-               static ImageAttributes imagedisabled_attributes = null;
-               const int SEPARATOR_HEIGHT = 5;
-               const int SM_CXBORDER = 1;
-               const int SM_CYBORDER = 1;
-               const int MENU_TAB_SPACE = 8;           // Pixels added to the width of an item because of a tab
-               const int MENU_BAR_ITEMS_SPACE = 8;     // Space between menu bar items
-               
                #region Principal Theme Methods
                public ThemeNice( )
                {
@@ -108,80 +92,25 @@ namespace System.Windows.Forms
                        
                        for ( int i = 0; i < theme_colors.Length; i += 2 )
                                syscolors.SetValue( Color.FromArgb( (int)theme_colors[ i + 1 ] ), (int) theme_colors[ i ] );
-                       
-                       defaultWindowBackColor = SystemColors.Window;
-                       defaultWindowForeColor = ColorButtonText;
-                       default_font =  new Font( FontFamily.GenericSansSerif, 8.25f );
-                       
-                       /* Menu string formats */
-                       string_format_menu_text = new StringFormat( );
-                       string_format_menu_text.LineAlignment = StringAlignment.Center;
-                       string_format_menu_text.Alignment = StringAlignment.Near;
-                       string_format_menu_text.HotkeyPrefix = HotkeyPrefix.Show;
-                       
-                       string_format_menu_shortcut = new StringFormat( );
-                       string_format_menu_shortcut.LineAlignment = StringAlignment.Center;
-                       string_format_menu_shortcut.Alignment = StringAlignment.Far;
-                       
-                       string_format_menu_menubar_text = new StringFormat( );
-                       string_format_menu_menubar_text.LineAlignment = StringAlignment.Center;
-                       string_format_menu_menubar_text.Alignment = StringAlignment.Center;
-                       string_format_menu_menubar_text.HotkeyPrefix = HotkeyPrefix.Show;
-               }
-               
-               public override void ResetDefaults( )
-               {
-                       throw new NotImplementedException( "Need to implement ResetDefaults() for Nice theme" );
-               }
-               
-               public override bool DoubleBufferingSupported
-               {
-                       get {return true; }
                }
-               #endregion      // Principal Theme Methods
                
-               #region Internal Methods
-               protected SolidBrush GetControlBackBrush( Color c )
+               public override Color DefaultControlBackColor
                {
-                       if ( c == DefaultControlBackColor )
-                               return ResPool.GetSolidBrush( ColorButtonFace );
-                       return new SolidBrush( c );
+                       get { return NiceBackColor; }
                }
                
-               protected SolidBrush GetControlForeBrush( Color c )
+               public override Color DefaultWindowBackColor
                {
-                       if ( c == DefaultControlForeColor )
-                               return ResPool.GetSolidBrush( ColorButtonText );
-                       return new SolidBrush( c );
+                       get { return NiceBackColor; }                   
                }
                #endregion      // Internal Methods
                
-               #region OwnerDraw Support
-               public  override void DrawOwnerDrawBackground( DrawItemEventArgs e )
-               {
-                       if ( e.State == DrawItemState.Selected )
-                       {
-                               e.Graphics.FillRectangle( SystemBrushes.Highlight, e.Bounds );
-                               return;
-                       }
-                       
-                       e.Graphics.FillRectangle( GetControlBackBrush( e.BackColor ), e.Bounds );
-               }
-               
-               public  override void DrawOwnerDrawFocusRectangle( DrawItemEventArgs e )
-               {
-                       if ( e.State == DrawItemState.Focus )
-                               CPDrawFocusRectangle( e.Graphics, e.Bounds, e.ForeColor, e.BackColor );
-               }
-               #endregion      // OwnerDraw Support
-               
                #region ButtonBase
-               public override void DrawButtonBase( Graphics dc, Rectangle clip_area, ButtonBase button )
+               protected override void ButtonBase_DrawButton( ButtonBase button, Graphics dc )
                {
                        int             width;
                        int             height;
                        Rectangle buttonRectangle;
-                       //Rectangle borderRectangle;
                        
                        width = button.ClientSize.Width;
                        height = button.ClientSize.Height;
@@ -193,6 +122,12 @@ namespace System.Windows.Forms
                        
                        Color use_color;
                        
+                       if ( ( ( button.GetType( ) == typeof( CheckBox ) ) && ( ( (CheckBox)button ).check_state == CheckState.Checked ) ) ||
+                           ( ( button.GetType( ) == typeof( RadioButton ) ) && ( ( (RadioButton)button ).check_state == CheckState.Checked ) ) )
+                       {
+                               use_color = PressedColor;
+                       }
+                       else
                        if ( !button.is_enabled )
                        {
                                use_color = NormalColor;
@@ -235,5060 +170,781 @@ namespace System.Windows.Forms
                                dc.DrawCurve( pen, new Point[] { new Point( width - 4, 0 ), new Point( width, 4 ) } );
                                dc.DrawCurve( pen, new Point[] { new Point( width, height - 4 ), new Point( width - 4, height ) } );
                        }
+               }
+               
+               protected override void ButtonBase_DrawFocus( ButtonBase button, Graphics dc )
+               {
+                       int width = button.ClientSize.Width;
+                       int height = button.ClientSize.Height;
                        
-                       // Image
-                       if ( ( button.image != null ) || ( button.image_list != null ) )
-                       {
-                               // Need to draw a picture
-                               Image   i;
-                               int     image_x;
-                               int     image_y;
-                               int     image_width;
-                               int     image_height;
-                               
-                               if ( button.ImageIndex != -1 )
-                               {       // We use ImageIndex instead of image_index since it will return -1 if image_list is null
-                                       i = button.image_list.Images[ button.image_index ];
-                               }
-                               else
-                               {
-                                       i = button.image;
-                               }
-                               
-                               image_width = button.image.Width;
-                               image_height = button.image.Height;
-                               
-                               switch ( button.image_alignment )
-                               {
-                                       case ContentAlignment.TopLeft: {
-                                                       image_x = 0;
-                                                       image_y = 0;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopCenter: {
-                                                       image_x = ( width - image_width ) / 2;
-                                                       image_y = 0;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopRight: {
-                                                       image_x = width - image_width;
-                                                       image_y = 0;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.MiddleLeft: {
-                                                       image_x = 0;
-                                                       image_y = ( height - image_height ) / 2;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.MiddleCenter: {
-                                                       image_x = ( width - image_width ) / 2;
-                                                       image_y = ( height - image_height ) / 2;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.MiddleRight: {
-                                                       image_x = width - image_width;
-                                                       image_y = ( height - image_height ) / 2;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.BottomLeft: {
-                                                       image_x = 0;
-                                                       image_y = height - image_height;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.BottomCenter: {
-                                                       image_x = ( width - image_width ) / 2;
-                                                       image_y = height - image_height;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.BottomRight: {
-                                                       image_x = width - image_width;
-                                                       image_y = height - image_height;
-                                                       break;
-                                               }
-                                               
-                                       default: {
-                                                       image_x = 0;
-                                                       image_y = 0;
-                                                       break;
-                                               }
-                               }
-                               
-                               if ( button.is_pressed )
-                               {
-                                       image_x += 1;
-                                       image_y += 1;
-                               }
-                               
-                               if ( button.is_enabled )
-                               {
-                                       dc.DrawImage( i, image_x, image_y );
-                               }
-                               else
-                               {
-                                       CPDrawImageDisabled( dc, i, image_x, image_y, ColorButtonFace );
-                               }
-                       }
-                       
-                       // Focus
-                       if ( ( button.has_focus && button.flat_style != FlatStyle.Popup ) && button.is_enabled )
-                       {
-                               Pen pen = ResPool.GetPen( FocusColor );
-                               dc.DrawLine( pen, 4, 1, width - 5, 1 );
-                               dc.DrawLine( pen, width - 2, 4, width - 2, height - 5 );
-                               dc.DrawLine( pen, 4, height - 2, width - 5, height - 2 );
-                               dc.DrawLine( pen, 1, 4, 1, height - 5 );
-                               
-                               dc.DrawCurve( pen, new Point[] { new Point( 1, 5 ), new Point( 5, 1 ) } );
-                               dc.DrawCurve( pen, new Point[] { new Point( 1, height - 5 ), new Point( 5, height - 1 ) } );
-                               dc.DrawCurve( pen, new Point[] { new Point( width - 5, 1 ), new Point( width - 1, 5 ) } );
-                               dc.DrawCurve( pen, new Point[] { new Point( width - 1, height - 5 ), new Point( width - 5, height - 1 ) } );
-                       }
+                       Pen pen = ResPool.GetPen( FocusColor );
+                       dc.DrawLine( pen, 4, 1, width - 5, 1 );
+                       dc.DrawLine( pen, width - 2, 4, width - 2, height - 5 );
+                       dc.DrawLine( pen, 4, height - 2, width - 5, height - 2 );
+                       dc.DrawLine( pen, 1, 4, 1, height - 5 );
                        
-                       // Text
-                       if ( button.text != null && button.text != String.Empty )
+                       dc.DrawCurve( pen, new Point[] { new Point( 1, 5 ), new Point( 5, 1 ) } );
+                       dc.DrawCurve( pen, new Point[] { new Point( 1, height - 5 ), new Point( 5, height - 1 ) } );
+                       dc.DrawCurve( pen, new Point[] { new Point( width - 5, 1 ), new Point( width - 1, 5 ) } );
+                       dc.DrawCurve( pen, new Point[] { new Point( width - 1, height - 5 ), new Point( width - 5, height - 1 ) } );
+               }
+               
+               protected override void ButtonBase_DrawText( ButtonBase button, Graphics dc )
+               {
+                       if ( button.GetType( ) != typeof( CheckBox ) && button.GetType( ) != typeof( RadioButton ) )
                        {
-                               Rectangle text_rect = Rectangle.Inflate( buttonRectangle, -4, -4 );
-                               
-                               if ( button.is_pressed )
-                               {
-                                       text_rect.X++;
-                                       text_rect.Y++;
-                               }
-                               
-                               if ( button.is_enabled )
-                               {
-                                       dc.DrawString( button.text, button.Font, ResPool.GetSolidBrush( button.ForeColor ), text_rect, button.text_format );
-                                       
-                               }
-                               else
-                               {
-                                       if ( button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup )
-                                       {
-                                               dc.DrawString( button.text, button.Font, ResPool.GetSolidBrush( ControlPaint.DarkDark( this.ColorButtonFace ) ), text_rect, button.text_format );
-                                       }
-                                       else
-                                       {
-                                               CPDrawStringDisabled( dc, button.text, button.Font, ColorButtonText, text_rect, button.text_format );
-                                       }
-                               }
+                               base.ButtonBase_DrawText( button, dc );
                        }
                }
+               #endregion      // ButtonBase
                
-               // draw the flat style part of the rectangle
-               public void DrawFlatStyleButton( Graphics dc, Rectangle rectangle, ButtonBase button )
+               #region CheckBox
+               protected override void CheckBox_DrawCheckBox( Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle )
                {
-                       Color rect_back_color = button.BackColor;
-                       Color rect_fore_color = button.ForeColor;
-                       Rectangle trace_rectangle = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 1, 0 ), Math.Max( rectangle.Height - 1, 0 ) );
-                       
-                       if ( button.Enabled )
+                       dc.FillRectangle( ResPool.GetSolidBrush( checkbox.BackColor ), checkbox.ClientRectangle );
+                       // render as per normal button
+                       if ( checkbox.appearance == Appearance.Button )
                        {
-                               if ( button.Capture || button.is_entered )
-                               {
-                                       if ( button.FlatStyle == FlatStyle.Flat )
-                                       {
-                                               // fill the rectangle
-                                               dc.FillRectangle( ResPool.GetSolidBrush( rect_back_color ), rectangle );
-                                               
-                                               // now draw the outer border
-                                               if ( button.Capture && button.is_entered )
-                                               {
-                                                       rect_back_color = ControlPaint.LightLight( rect_back_color );
-                                               }
-                                               else
-                                               {
-                                                       rect_back_color = ControlPaint.Light( rect_back_color );
-                                               }
-                                               
-                                               // draw rectangle and fill it
-                                               dc.FillRectangle( ResPool.GetSolidBrush( rect_back_color ), rectangle );
-                                               dc.DrawRectangle( ResPool.GetPen( rect_fore_color ), trace_rectangle );
-                                       }
-                                       else
-                                       {
-                                               // else it must be a popup button
-                                               
-                                               if ( button.Capture && button.is_entered )
-                                               {
-                                                       dc.DrawRectangle( ResPool.GetPen( this.ColorButtonText ), trace_rectangle );
-                                               }
-                                               else
-                                               {
-                                                       // draw a 3d border
-                                                       CPDrawBorder3D( dc, rectangle, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top, button.BackColor );
-                                                       
-                                                       Pen pen = ResPool.GetPen( this.ColorButtonText );
-                                                       dc.DrawLine( pen, trace_rectangle.X, trace_rectangle.Bottom, trace_rectangle.Right, trace_rectangle.Bottom );
-                                                       dc.DrawLine( pen, trace_rectangle.Right, trace_rectangle.Y, trace_rectangle.Right, trace_rectangle.Bottom );
-                                               }
-                                       }
-                                       
-                                       // TODO: draw inner focus rectangle
-                                       
-                               }
-                               else
-                               {
-                                       // popup has a ButtonColorText forecolor, not a button.ForeCOlor
-                                       if ( button.FlatStyle == FlatStyle.Popup )
-                                       {
-                                               rect_fore_color = this.ColorButtonText;
-                                       }
-                                       
-                                       // fill then draw outer rect
-                                       dc.FillRectangle( ResPool.GetSolidBrush( rect_back_color ), rectangle );
-                                       dc.DrawRectangle( ResPool.GetPen( rect_fore_color ), trace_rectangle );
-                               }
-                               
-                               // finally some small tweaks to render radiobutton and checkbox
-                               CheckBox checkbox = button as CheckBox;
-                               RadioButton radiobutton = button as RadioButton;
-                               if ( ( checkbox != null && checkbox.Checked ) ||
-                                   ( radiobutton != null && radiobutton.Checked ) )
-                               {
-                                       if ( button.FlatStyle == FlatStyle.Flat && button.is_entered && !button.Capture )
-                                       {
-                                               // render the hover for flat flatstyle and cheked
-                                               dc.DrawRectangle( ResPool.GetPen( this.ColorButtonText ), trace_rectangle );
-                                       }
-                                       else if ( !button.is_entered && !button.Capture )
-                                       {
-                                               // render the checked state for popup when unhovered
-                                               CPDrawBorder3D( dc, rectangle, Border3DStyle.SunkenInner, Border3DSide.Right | Border3DSide.Bottom, button.BackColor );
-                                       }
-                               }
+                               DrawButtonBase( dc, checkbox.ClientRectangle, checkbox );
                        }
                        else
                        {
-                               // rendering checkbox or radio button style buttons
-                               CheckBox checkbox = button as CheckBox;
-                               RadioButton radiobutton = button as RadioButton;
-                               bool draw_popup_checked = false;
-                               
-                               if ( button.FlatStyle == FlatStyle.Popup )
+                               // establish if we are rendering a flat style of some sort
+                               if ( checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup )
                                {
-                                       rect_fore_color = this.ColorButtonText;
-                                       
-                                       // see if we should draw a disabled checked popup button
-                                       draw_popup_checked = ( ( checkbox != null && checkbox.Checked ) ||
-                                               ( radiobutton != null && radiobutton.Checked ) );
+                                       DrawFlatStyleCheckBox( dc, checkbox_rectangle, checkbox );
                                }
-                               
-                               dc.FillRectangle( ResPool.GetSolidBrush( rect_back_color ), rectangle );
-                               dc.DrawRectangle( ResPool.GetPen( rect_fore_color ), trace_rectangle );
-                               
-                               // finally draw the flatstyle checked effect if need
-                               if ( draw_popup_checked )
+                               else
                                {
-                                       // render the checked state for popup when unhovered
-                                       CPDrawBorder3D( dc, rectangle, Border3DStyle.SunkenInner, Border3DSide.Right | Border3DSide.Bottom, button.BackColor );
+                                       ControlPaint.DrawCheckBox( dc, checkbox_rectangle, state );
                                }
                        }
                }
+               #endregion      // CheckBox
+               
+               #region ComboBox
                
-               public override Size ButtonBaseDefaultSize
+               // Drawing
+               
+               public override void DrawComboBoxEditDecorations( Graphics dc, ComboBox ctrl, Rectangle cl )
                {
-                       get {
-                               return new Size( 75, 23 );
-                       }
+                       dc.DrawRectangle( ResPool.GetPen( BorderColor ) , cl.X + 1, cl.Y + 1, cl.Width - 3, cl.Height - 3 );
                }
-               #endregion      // ButtonBase
                
-               #region CheckBox
-               public override void DrawCheckBox( Graphics dc, Rectangle clip_area, CheckBox checkbox )
+               public override void DrawComboListBoxDecorations( Graphics dc, ComboBox ctrl, Rectangle cl )
                {
-                       StringFormat            text_format;
-                       Rectangle               client_rectangle;
-                       Rectangle               text_rectangle;
-                       Rectangle               checkbox_rectangle;
-                       SolidBrush              sb;
-                       int                     checkmark_size=13;
-                       int                     checkmark_space = 4;
-                       
-                       client_rectangle = checkbox.ClientRectangle;
-                       text_rectangle = client_rectangle;
-                       checkbox_rectangle = new Rectangle( text_rectangle.X, text_rectangle.Y, checkmark_size, checkmark_size );
-                       
-                       text_format = new StringFormat( );
-                       text_format.Alignment = StringAlignment.Near;
-                       text_format.LineAlignment = StringAlignment.Center;
-                       text_format.HotkeyPrefix = HotkeyPrefix.Show;
-                       
-                       /* Calculate the position of text and checkbox rectangle */
-                       if ( checkbox.appearance != Appearance.Button )
+                       if ( ctrl.DropDownStyle == ComboBoxStyle.Simple )
                        {
-                               switch ( checkbox.check_alignment )
-                               {
-                                       case ContentAlignment.BottomCenter: {
-                                                       checkbox_rectangle.X = ( client_rectangle.Right - client_rectangle.Left ) / 2 - checkmark_size / 2;
-                                                       checkbox_rectangle.Y = client_rectangle.Bottom - checkmark_size;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width;
-                                                       text_rectangle.Height = client_rectangle.Height - checkbox_rectangle.Y - checkmark_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.BottomLeft: {
-                                                       checkbox_rectangle.X = client_rectangle.Left;
-                                                       checkbox_rectangle.Y = client_rectangle.Bottom - checkmark_size;
-                                                       text_rectangle.X = client_rectangle.X + checkmark_size + checkmark_space;
-                                                       text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.BottomRight: {
-                                                       checkbox_rectangle.X = client_rectangle.Right - checkmark_size;
-                                                       checkbox_rectangle.Y = client_rectangle.Bottom - checkmark_size;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.MiddleCenter: {
-                                                       checkbox_rectangle.X = ( client_rectangle.Right - client_rectangle.Left ) / 2 - checkmark_size / 2;
-                                                       checkbox_rectangle.Y = ( client_rectangle.Bottom - client_rectangle.Top ) / 2 - checkmark_size / 2;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width;
-                                                       break;
-                                               }
-                                               
-                                       default:
-                                       case ContentAlignment.MiddleLeft: {
-                                                       checkbox_rectangle.X = client_rectangle.Left;
-                                                       checkbox_rectangle.Y = ( client_rectangle.Bottom - client_rectangle.Top ) / 2 - checkmark_size / 2;
-                                                       text_rectangle.X = client_rectangle.X + checkmark_size + checkmark_space;
-                                                       text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.MiddleRight: {
-                                                       checkbox_rectangle.X = client_rectangle.Right - checkmark_size;
-                                                       checkbox_rectangle.Y = ( client_rectangle.Bottom - client_rectangle.Top ) / 2 - checkmark_size / 2;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopCenter: {
-                                                       checkbox_rectangle.X = ( client_rectangle.Right - client_rectangle.Left ) / 2 - checkmark_size / 2;
-                                                       checkbox_rectangle.Y = client_rectangle.Top;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width;
-                                                       text_rectangle.Y = checkmark_size + checkmark_space;
-                                                       text_rectangle.Height = client_rectangle.Height - checkmark_size - checkmark_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopLeft: {
-                                                       checkbox_rectangle.X = client_rectangle.Left;
-                                                       text_rectangle.X = client_rectangle.X + checkmark_size + checkmark_space;
-                                                       text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopRight: {
-                                                       checkbox_rectangle.X = client_rectangle.Right - checkmark_size;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space;
-                                                       break;
-                                               }
-                               }
+                               DrawComboBoxEditDecorations( dc, ctrl, cl );
                        }
                        else
                        {
-                               text_rectangle.X = client_rectangle.X;
-                               text_rectangle.Width = client_rectangle.Width;
+                               dc.DrawRectangle( ResPool.GetPen( ThemeEngine.Current.ColorWindowFrame ), cl.X, cl.Y, cl.Width - 1, cl.Height - 1 );
                        }
+               }               
+               #endregion ComboBox
+               
+               #region Menus
+               public override void DrawMenuItem( MenuItem item, DrawItemEventArgs e )
+               {
+                       StringFormat string_format;
+                       Rectangle rect_text = e.Bounds;
                        
-                       /* Set the horizontal alignment of our text */
-                       switch ( checkbox.text_alignment )
-                       {
-                               case ContentAlignment.BottomLeft:
-                               case ContentAlignment.MiddleLeft:
-                               case ContentAlignment.TopLeft: {
-                                               text_format.Alignment = StringAlignment.Near;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.BottomCenter:
-                               case ContentAlignment.MiddleCenter:
-                               case ContentAlignment.TopCenter: {
-                                               text_format.Alignment = StringAlignment.Center;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.BottomRight:
-                               case ContentAlignment.MiddleRight:
-                               case ContentAlignment.TopRight: {
-                                               text_format.Alignment = StringAlignment.Far;
-                                               break;
-                                       }
-                       }
+                       if ( item.Visible == false )
+                               return;
                        
-                       /* Set the vertical alignment of our text */
-                       switch ( checkbox.text_alignment )
+                       if ( item.MenuBar )
                        {
-                               case ContentAlignment.TopLeft:
-                               case ContentAlignment.TopCenter:
-                               case ContentAlignment.TopRight: {
-                                               text_format.LineAlignment = StringAlignment.Near;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.BottomLeft:
-                               case ContentAlignment.BottomCenter:
-                               case ContentAlignment.BottomRight: {
-                                               text_format.LineAlignment = StringAlignment.Far;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.MiddleLeft:
-                               case ContentAlignment.MiddleCenter:
-                               case ContentAlignment.MiddleRight: {
-                                               text_format.LineAlignment = StringAlignment.Center;
-                                               break;
-                                       }
+                               string_format = string_format_menu_menubar_text;
                        }
-                       
-                       ButtonState state = ButtonState.Normal;
-                       if ( checkbox.FlatStyle == FlatStyle.Flat )
+                       else
                        {
-                               state |= ButtonState.Flat;
+                               string_format = string_format_menu_text;
                        }
                        
-                       if ( checkbox.Checked )
+                       if ( item.Separator == true )
                        {
-                               state |= ButtonState.Checked;
+                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( LightColor ),
+                                                   e.Bounds.X, e.Bounds.Y, e.Bounds.X + e.Bounds.Width, e.Bounds.Y );
+                               
+                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight ),
+                                                   e.Bounds.X, e.Bounds.Y + 1, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + 1 );
+                               
+                               return;
                        }
                        
-                       if ( checkbox.ThreeState && ( checkbox.CheckState == CheckState.Indeterminate ) )
-                       {
-                               state |= ButtonState.Checked;
-                               state |= ButtonState.Pushed;
-                       }
+                       if ( !item.MenuBar )
+                               rect_text.X += ThemeEngine.Current.MenuCheckSize.Width;
                        
-                       // finally make sure the pushed and inavtive states are rendered
-                       if ( !checkbox.Enabled )
-                       {
-                               state |= ButtonState.Inactive;
-                       }
-                       else if ( checkbox.is_pressed )
-                       {
-                               state |= ButtonState.Pushed;
+                       if ( item.BarBreak )
+                       { /* Draw vertical break bar*/
+                               Rectangle rect = e.Bounds;
+                               rect.Y++;
+                               rect.Width = 3;
+                               rect.Height = item.MenuHeight - 6;
+                               
+                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( LightColor ),
+                                                   rect.X, rect.Y , rect.X, rect.Y + rect.Height );
+                               
+                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight ),
+                                                   rect.X + 1, rect.Y , rect.X + 1, rect.Y + rect.Height );
                        }
                        
+                       Color color_text = ThemeEngine.Current.ColorMenuText;
+                       Color color_back;
                        
-                       // Start drawing
+                       /* Draw background */
+                       Rectangle rect_back = e.Bounds;
+                       rect_back.X++;
+                       rect_back.Width -= 2;
                        
-                       dc.FillRectangle( ResPool.GetSolidBrush( checkbox.BackColor ), checkbox.ClientRectangle );
-                       // render as per normal button
-                       if ( checkbox.appearance == Appearance.Button )
+                       if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
                        {
-                               if ( checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup )
-                               {
-                                       DrawFlatStyleButton( dc, checkbox.ClientRectangle, checkbox );
-                               }
-                               else
+                               color_text = ThemeEngine.Current.ColorMenuText;
+                               color_back = NormalColor;
+                               
+                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rect_back.X, rect_back.Y ), new Point( rect_back.Right, rect_back.Y ), Color.White, NormalColor ) )//NormalColor, Color.White ) )
                                {
-                                       CPDrawButton( dc, checkbox.ClientRectangle, state );
+                                       e.Graphics.FillRectangle( lgbr, rect_back );
                                }
+                               
+                               rect_back.Height--;
+                               e.Graphics.DrawRectangle( ResPool.GetPen( BorderColor ), rect_back );
                        }
                        else
                        {
-                               // establish if we are rendering a flat style of some sort
-                               if ( checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup )
-                               {
-                                       DrawFlatStyleCheckBox( dc, checkbox_rectangle, checkbox );
-                               }
-                               else
-                               {
-                                       ControlPaint.DrawCheckBox( dc, checkbox_rectangle, state );
-                               }
+                               color_text = ThemeEngine.Current.ColorMenuText;
+                               color_back = NiceBackColor;
+                               
+                               e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( NiceBackColor ), rect_back );
                        }
                        
-                       // offset the text if it's pressed and a button
-                       if ( checkbox.Appearance == Appearance.Button )
+                       if ( item.Enabled )
                        {
-                               if ( checkbox.Checked || ( checkbox.Capture && checkbox.FlatStyle != FlatStyle.Flat ) )
+                               e.Graphics.DrawString( item.Text, e.Font,
+                                                     ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
+                                                     rect_text, string_format );
+                               
+                               if ( !item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut )
                                {
-                                       text_rectangle.X ++;
-                                       text_rectangle.Y ++;
+                                       string str = item.GetShortCutText( );
+                                       Rectangle rect = rect_text;
+                                       rect.X = item.XTab;
+                                       rect.Width -= item.XTab;
+                                       
+                                       e.Graphics.DrawString( str, e.Font, ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
+                                                             rect, string_format_menu_shortcut );
                                }
-                               
-                               text_rectangle.Inflate( -4, -4 );
-                       }
-                       
-                       /* Place the text; to be compatible with Windows place it after the checkbox has been drawn */
-                       if ( checkbox.Enabled )
-                       {
-                               sb = ResPool.GetSolidBrush( checkbox.ForeColor );
-                               dc.DrawString( checkbox.Text, checkbox.Font, sb, text_rectangle, text_format );
-                       }
-                       else if ( checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup )
-                       {
-                               dc.DrawString( checkbox.Text, checkbox.Font, ResPool.GetSolidBrush( ControlPaint.DarkDark( this.ColorButtonFace ) ), text_rectangle, text_format );
                        }
                        else
                        {
-                               CPDrawStringDisabled( dc, checkbox.Text, checkbox.Font, ColorButtonText, text_rectangle, text_format );
+                               ControlPaint.DrawStringDisabled( e.Graphics, item.Text, e.Font,
+                                                               Color.Black, rect_text, string_format );
                        }
                        
-                       if ( checkbox.Focused )
+                       /* Draw arrow */
+                       if ( item.MenuBar == false && item.IsPopup )
                        {
-                               if ( checkbox.FlatStyle != FlatStyle.Flat )
+                               
+                               int cx = ThemeEngine.Current.MenuCheckSize.Width;
+                               int cy = ThemeEngine.Current.MenuCheckSize.Height;
+                               Bitmap  bmp = new Bitmap( cx, cy );
+                               Graphics gr = Graphics.FromImage( bmp );
+                               Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
+                               ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Arrow );
+                               bmp.MakeTransparent( );
+                               
+                               if ( item.Enabled )
                                {
-                                       DrawInnerFocusRectangle( dc, Rectangle.Inflate( text_rectangle, -1, -1 ), checkbox.BackColor );
+                                       e.Graphics.DrawImage( bmp, e.Bounds.X + e.Bounds.Width - cx,
+                                                            e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
                                }
                                else
                                {
-                                       dc.DrawRectangle( ResPool.GetPen( checkbox.ForeColor ), Rectangle.Inflate( text_rectangle, -1, -1 ) );
+                                       ControlPaint.DrawImageDisabled( e.Graphics, bmp, e.Bounds.X + e.Bounds.Width - cx,
+                                                                      e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ),  color_back );
                                }
-                       }
-               }
-               
-               // renders a checkBox with the Flat and Popup FlatStyle
-               private void DrawFlatStyleCheckBox( Graphics graphics, Rectangle rectangle, CheckBox checkbox )
-               {
-                       Pen                     pen;
-                       Rectangle       rect;
-                       Rectangle       checkbox_rectangle;
-                       Rectangle       fill_rectangle;
-                       int                     lineWidth;
-                       int                     Scale;
-                       
-                       // set up our rectangles first
-                       if ( checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered )
-                       {
-                               // clip one pixel from bottom right for non popup rendered checkboxes
-                               checkbox_rectangle = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 1, 0 ), Math.Max( rectangle.Height - 1, 0 ) );
-                               fill_rectangle = new Rectangle( checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max( checkbox_rectangle.Width - 3, 0 ), Math.Max( checkbox_rectangle.Height - 3, 0 ) );
-                       }
-                       else
-                       {
-                               // clip two pixels from bottom right for non popup rendered checkboxes
-                               checkbox_rectangle = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 2, 0 ), Math.Max( rectangle.Height - 2, 0 ) );
-                               fill_rectangle = new Rectangle( checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max( checkbox_rectangle.Width - 2, 0 ), Math.Max( checkbox_rectangle.Height - 2, 0 ) );
+                               
+                               gr.Dispose( );
+                               bmp.Dispose( );
                        }
                        
-                       // if disabled render in disabled state
-                       if ( checkbox.Enabled )
+                       /* Draw checked or radio */
+                       if ( item.MenuBar == false && item.Checked )
                        {
-                               // process the state of the checkbox
-                               if ( checkbox.is_entered || checkbox.Capture )
-                               {
-                                       // decide on which background color to use
-                                       if ( checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered && checkbox.Capture )
-                                       {
-                                               graphics.FillRectangle( ResPool.GetSolidBrush( checkbox.BackColor ), fill_rectangle );
-                                       }
-                                       else if ( checkbox.FlatStyle == FlatStyle.Flat && !( checkbox.is_entered && checkbox.Capture ) )
-                                       {
-                                               graphics.FillRectangle( ResPool.GetSolidBrush( ControlPaint.Light( checkbox.BackColor ) ), fill_rectangle );
-                                       }
-                                       else
-                                       {
-                                               // use regular window background color
-                                               graphics.FillRectangle( ResPool.GetSolidBrush( ControlPaint.LightLight( checkbox.BackColor ) ), fill_rectangle );
-                                       }
-                                       
-                                       // render the outer border
-                                       if ( checkbox.FlatStyle == FlatStyle.Flat )
-                                       {
-                                               ControlPaint.DrawBorder( graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid );
-                                       }
-                                       else
-                                       {
-                                               // draw sunken effect
-                                               CPDrawBorder3D( graphics, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.All, checkbox.BackColor );
-                                       }
-                               }
+                               
+                               Rectangle area = e.Bounds;
+                               int cx = ThemeEngine.Current.MenuCheckSize.Width;
+                               int cy = ThemeEngine.Current.MenuCheckSize.Height;
+                               Bitmap  bmp = new Bitmap( cx, cy );
+                               Graphics gr = Graphics.FromImage( bmp );
+                               Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
+                               
+                               if ( item.RadioCheck )
+                                       ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Bullet );
                                else
-                               {
-                                       graphics.FillRectangle( ResPool.GetSolidBrush( ControlPaint.LightLight( checkbox.BackColor ) ), fill_rectangle );
-                                       
-                                       if ( checkbox.FlatStyle == FlatStyle.Flat )
-                                       {
-                                               ControlPaint.DrawBorder( graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid );
-                                       }
-                                       else
-                                       {
-                                               // draw the outer border
-                                               ControlPaint.DrawBorder( graphics, checkbox_rectangle, ControlPaint.DarkDark( checkbox.BackColor ), ButtonBorderStyle.Solid );
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               if ( checkbox.FlatStyle == FlatStyle.Popup )
-                               {
-                                       graphics.FillRectangle( SystemBrushes.Control, fill_rectangle );
-                               }
+                                       ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Checkmark );
                                
-                               // draw disabled state,
-                               ControlPaint.DrawBorder( graphics, checkbox_rectangle, ColorButtonShadow, ButtonBorderStyle.Solid );
+                               bmp.MakeTransparent( );
+                               e.Graphics.DrawImage( bmp, area.X, e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
+                               
+                               gr.Dispose( );
+                               bmp.Dispose( );
                        }
+               }
+               #endregion // Menus
+               
+               #region ProgressBar
+               public override void DrawProgressBar( Graphics dc, Rectangle clip_rect, ProgressBar ctrl )
+               {
+                       Rectangle       client_area = ctrl.client_area;
+                       int             barpos_pixels;
+                       Rectangle bar = ctrl.client_area;
                        
-                       /* Make sure we've got at least a line width of 1 */
-                       lineWidth = Math.Max( 3, fill_rectangle.Width / 3 );
-                       Scale = Math.Max( 1, fill_rectangle.Width / 9 );
+                       barpos_pixels = ( ( ctrl.Value - ctrl.Minimum ) * client_area.Width ) / ( ctrl.Maximum - ctrl.Minimum );
                        
-                       // flat style check box is rendered inside a rectangle shifted down by one
-                       rect = new Rectangle( fill_rectangle.X, fill_rectangle.Y + 1, fill_rectangle.Width, fill_rectangle.Height );
-                       if ( checkbox.Enabled )
-                       {
-                               pen = ResPool.GetPen( checkbox.ForeColor );
-                       }
-                       else
+                       bar.Width = barpos_pixels;
+                       bar.Height += 1;
+                       
+                       // Draw bar background
+                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( client_area.Left, client_area.Top ), new Point( client_area.Left, client_area.Bottom ), LightColor, Color.White ) )
                        {
-                               pen = SystemPens.ControlDark;
+                               dc.FillRectangle( lgbr, client_area );
                        }
                        
-                       if ( checkbox.Checked )
+                       // Draw bar
+                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( bar.Location, new Point( bar.X, bar.Bottom ), Color.White, FocusColor ) )
                        {
-                               /* Need to draw a check-mark */
-                               for ( int i=0; i < lineWidth; i++ )
-                               {
-                                       graphics.DrawLine( pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i );
-                                       graphics.DrawLine( pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i );
-                               }
+                               dc.FillRectangle( lgbr, bar );
                        }
+                       
+                       /* Draw border */
+                       dc.DrawRectangle( ResPool.GetPen( BorderColor ), ctrl.ClientRectangle.X, ctrl.ClientRectangle.Y, ctrl.ClientRectangle.Width - 1, ctrl.ClientRectangle.Height - 1 );
+                       dc.DrawRectangle( ResPool.GetPen( LightColor ), ctrl.ClientRectangle.X + 1, ctrl.ClientRectangle.Y + 1, ctrl.ClientRectangle.Width - 2, ctrl.ClientRectangle.Height - 2 );
                }
+               #endregion      // ProgressBar
                
-               
-               #endregion      // CheckBox
-               
-               #region CheckedListBox
-               
-               public override Rectangle CheckedListBoxCheckRectangle( )
-               {
-                       return checkbox_rect;
-               }
-               
-               public override void DrawCheckedListBoxItem( CheckedListBox ctrl, DrawItemEventArgs e )
+               #region RadioButton
+               // TODO: fix RadioButton focus
+               protected override void RadioButton_DrawButton( RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle )
                {
-                       Color back_color, fore_color;
-                       Rectangle item_rect = e.Bounds;
-                       ButtonState state;
-                       StringFormat string_format = ctrl.GetFormatString( );
-                       
-                       /* Draw checkbox */
-                       
-                       if ( ( ctrl.Items.GetListBoxItem( e.Index ) ).State == CheckState.Checked )
-                               state = ButtonState.Checked;
-                       else
-                               state = ButtonState.Normal;
-                       
-                       if ( ctrl.ThreeDCheckBoxes == false )
-                               state |= ButtonState.Flat;
-                       
-                       ControlPaint.DrawCheckBox( e.Graphics,
-                                                 item_rect.X + checkbox_rect.X, item_rect.Y + checkbox_rect.Y,
-                                                 checkbox_rect.Width, checkbox_rect.Height,
-                                                 state );
-                       
-                       item_rect.X += checkbox_rect.Width + checkbox_rect.X * 2;
-                       item_rect.Width -= checkbox_rect.Width + checkbox_rect.X * 2;
+                       SolidBrush sb = new SolidBrush( radio_button.BackColor );
+                       dc.FillRectangle( sb, radio_button.ClientRectangle );
+                       sb.Dispose( );
                        
-                       /* Draw text*/
-                       if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
+                       if ( radio_button.appearance == Appearance.Button )
                        {
-                               back_color = ThemeEngine.Current.ColorHilight;
-                               fore_color = ThemeEngine.Current.ColorHilightText;
+                               DrawButtonBase( dc, radio_button.ClientRectangle, radio_button );
                        }
                        else
                        {
-                               back_color = e.BackColor;
-                               fore_color = e.ForeColor;
-                       }
-                       
-                       e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush
-                                                ( back_color ), item_rect );
-                       
-                       e.Graphics.DrawString( ctrl.GetItemText( ctrl.Items[ e.Index ] ), e.Font,
-                                             ThemeEngine.Current.ResPool.GetSolidBrush( fore_color ),
-                                             item_rect, string_format );
-                       
-                       if ( ( e.State & DrawItemState.Focus ) == DrawItemState.Focus )
-                       {
-                               ThemeEngine.Current.CPDrawFocusRectangle( e.Graphics, item_rect,
-                                                                        fore_color, back_color );
+                               // establish if we are rendering a flat style of some sort
+                               if ( radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup )
+                               {
+                                       DrawButtonBase( dc, radio_button.ClientRectangle, radio_button );
+                               }
+                               else
+                               {
+                                       ControlPaint.DrawRadioButton( dc, radiobutton_rectangle, state );
+                               }
                        }
                }
+               #endregion      // RadioButton
                
-               #endregion // CheckedListBox
-               
-               #region ComboBox
-               
-               // Drawing
-               
-               public override void DrawComboBoxEditDecorations( Graphics dc, ComboBox ctrl, Rectangle cl )
+               #region ScrollBar
+               protected override void ScrollBar_DrawThumb( ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
                {
-                       dc.DrawRectangle( ResPool.GetPen( BorderColor ) , cl.X + 1, cl.Y + 1, cl.Width - 3, cl.Height - 3 );
+                       if ( bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith( thumb_pos ) )
+                               DrawScrollBarThumb( dc, thumb_pos, bar );
                }
                
-               // Sizing
-               public override int DrawComboBoxEditDecorationTop( )
-               { return 2;}
-               public override int DrawComboBoxEditDecorationBottom( )
-               { return 2;}
-               public override int DrawComboBoxEditDecorationRight( )
-               { return 2;}
-               public override int DrawComboBoxEditDecorationLeft( )
-               { return 2;}
-               
-               private int DrawComboListBoxDecoration( ComboBoxStyle style )
+               protected override void ScrollBar_Vertical_Draw_ThumbMoving_None( int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc )
                {
-                       if ( style == ComboBoxStyle.Simple )
-                               return 2;
-                       else
-                               return 1;
+                       Rectangle r = new Rectangle( 0,
+                                                   scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty  )
+                       {
+                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
+                               {
+                                       dc.FillRectangle( lgbr, intersect );
+                               }
+                       }
                }
                
-               public override int DrawComboListBoxDecorationTop( ComboBoxStyle style )
+               protected override void ScrollBar_Vertical_Draw_ThumbMoving_Forward( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
                {
-                       return DrawComboListBoxDecoration( style );
+                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
+                                                   bar.ClientRectangle.Width, thumb_pos.Y  - scrollbutton_height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
+                       {
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
+                               
+                               r.X = 0;
+                               r.Y = thumb_pos.Y + thumb_pos.Height;
+                               r.Width = bar.ClientRectangle.Width;
+                               r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+                               
+                               intersect = Rectangle.Intersect( clip, r );
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
+                       }
                }
                
-               public override int DrawComboListBoxDecorationBottom( ComboBoxStyle style )
+               protected override void ScrollBar_Vertical_Draw_ThumbMoving_Backwards( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
                {
-                       return DrawComboListBoxDecoration( style );
+                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
+                                                   bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
+                       {
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
+                               
+                               r.X = 0;
+                               r.Y = thumb_pos.Y + thumb_pos.Height;
+                               r.Width = bar.ClientRectangle.Width;
+                               r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+                               
+                               intersect = Rectangle.Intersect( clip, r );
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
+                       }
                }
                
-               public override int DrawComboListBoxDecorationRight( ComboBoxStyle style )
+               protected override void ScrollBar_Horizontal_Draw_ThumbMoving_None( int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc )
                {
-                       return DrawComboListBoxDecoration( style );
+                       Rectangle r = new Rectangle( scrollbutton_width,
+                                                   0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty )
+                       {
+                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
+                               {
+                                       dc.FillRectangle( lgbr, intersect );
+                               }
+                       }
                }
                
-               public override int DrawComboListBoxDecorationLeft( ComboBoxStyle style )
+               protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Forward( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
                {
-                       return DrawComboListBoxDecoration( style );
+                       Rectangle r = new Rectangle( scrollbutton_width,  0,
+                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
+                       {
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
+                               
+                               r.X = thumb_pos.X + thumb_pos.Width;
+                               r.Y = 0;
+                               r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+                               r.Height = bar.ClientRectangle.Height;
+                               
+                               intersect = Rectangle.Intersect( clip, r );
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
+                       }
                }
                
-               public override void DrawComboListBoxDecorations( Graphics dc, ComboBox ctrl, Rectangle cl )
+               protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
                {
-                       if ( ctrl.DropDownStyle == ComboBoxStyle.Simple )
-                       {
-                               DrawComboBoxEditDecorations( dc, ctrl, cl );
-                       }
-                       else
+                       Rectangle r = new Rectangle( scrollbutton_width,  0,
+                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
                        {
-                               dc.DrawRectangle( ResPool.GetPen( ThemeEngine.Current.ColorWindowFrame ), cl.X, cl.Y, cl.Width - 1, cl.Height - 1 );
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
+                               
+                               r.X = thumb_pos.X + thumb_pos.Width;
+                               r.Y = 0;
+                               r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+                               r.Height = bar.ClientRectangle.Height;
+                               
+                               intersect = Rectangle.Intersect( clip, r );
+                               if ( intersect != Rectangle.Empty )
+                                       dc.FillRectangle( lgbr, intersect );
                        }
                }
+               #endregion      // ScrollBar
                
-               public override void DrawComboBoxItem( ComboBox ctrl, DrawItemEventArgs e )
+               #region StatusBar
+               protected override void DrawStatusBarPanel( Graphics dc, Rectangle area, int index,
+                                                          SolidBrush br_forecolor, StatusBarPanel panel )
                {
-                       Color back_color, fore_color;
-                       Rectangle text_draw = e.Bounds;
-                       StringFormat string_format = new StringFormat( );
-                       string_format.FormatFlags = StringFormatFlags.LineLimit;
+                       int border_size = 3; // this is actually const, even if the border style is none
                        
-                       if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
-                       {
-                               back_color = ThemeEngine.Current.ColorHilight;
-                               fore_color = ThemeEngine.Current.ColorHilightText;
-                       }
-                       else
+                       area.Height -= border_size;
+                       if ( panel.BorderStyle != StatusBarPanelBorderStyle.None )
                        {
-                               back_color = e.BackColor;
-                               fore_color = e.ForeColor;
+                               DrawNiceRoundedBorder( dc, area, BorderColor );
                        }
                        
-                       e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( back_color ), e.Bounds );
-                       
-                       if ( e.Index != -1 )
+                       if ( panel.Style == StatusBarPanelStyle.OwnerDraw )
                        {
-                               e.Graphics.DrawString( ctrl.GetItemText( ctrl.Items[ e.Index ] ), e.Font,
-                                                     ThemeEngine.Current.ResPool.GetSolidBrush( fore_color ),
-                                                     text_draw, string_format );
+                               StatusBarDrawItemEventArgs e = new StatusBarDrawItemEventArgs(
+                                       dc, panel.Parent.Font, area, index, DrawItemState.Default,
+                                       panel, panel.Parent.ForeColor, panel.Parent.BackColor );
+                               panel.Parent.OnDrawItemInternal( e );
+                               return;
                        }
                        
-                       if ( ( e.State & DrawItemState.Focus ) == DrawItemState.Focus )
-                       {
-                               ThemeEngine.Current.CPDrawFocusRectangle( e.Graphics, e.Bounds, fore_color, back_color );
-                       }
-               }
-               
-               #endregion ComboBox
-               
-               #region Datagrid
-               public override int DataGridPreferredColumnWidth
-               { get { return 75;} }
-               public override int DataGridMinimumColumnCheckBoxHeight
-               { get { return 16;} }
-               public override int DataGridMinimumColumnCheckBoxWidth
-               { get { return 16;} }
-               public override Color DataGridAlternatingBackColor
-               { get { return ColorWindow;} }
-               public override Color DataGridBackgroundColor
-               { get  { return  ColorAppWorkSpace;} }
-               public override Color DataGridCaptionBackColor
-               { get  { return ColorActiveTitle;} }
-               public override Color DataGridCaptionForeColor
-               { get  { return SystemColors.ActiveCaptionText;} }
-               public override Color DataGridGridLineColor
-               { get { return SystemColors.Control;} }
-               public override Color DataGridHeaderBackColor
-               { get  { return SystemColors.Control;} }
-               public override Color DataGridHeaderForeColor
-               { get  { return SystemColors.ControlText;} }
-               public override Color DataGridLinkColor
-               { get  { return SystemColors.HotTrack;} }
-               public override Color DataGridLinkHoverColor
-               { get  { return SystemColors.HotTrack;} }
-               public override Color DataGridParentRowsBackColor
-               { get  { return SystemColors.Control;} }
-               public override Color DataGridParentRowsForeColor
-               { get  { return SystemColors.WindowText;} }
-               public override Color DataGridSelectionBackColor
-               { get  { return ColorActiveTitle;} }
-               public override Color DataGridSelectionForeColor
-               { get  { return ColorTitleText;} }
-               
-               public override void DataGridPaint( PaintEventArgs pe, DataGrid grid )
-               {
-                       // Draw parent rows
-                       if ( pe.ClipRectangle.IntersectsWith( grid.grid_drawing.parent_rows ) )
+                       int left = area.Left;
+                       if ( panel.Icon != null )
                        {
-                               pe.Graphics.FillRectangle( ResPool.GetSolidBrush( grid.ParentRowsBackColor ), grid.grid_drawing.parent_rows );
+                               left += 2;
+                               dc.DrawIcon( panel.Icon, left, area.Top );
+                               left += panel.Icon.Width;
                        }
                        
-                       DataGridPaintCaption( pe.Graphics, pe.ClipRectangle, grid );
-                       DataGridPaintColumnsHdrs( pe.Graphics, pe.ClipRectangle, grid );
-                       DataGridPaintRowsHeaders( pe.Graphics, pe.ClipRectangle, grid );
-                       DataGridPaintRows( pe.Graphics, grid.grid_drawing.cells_area, pe.ClipRectangle, grid );
+                       if ( panel.Text == String.Empty )
+                               return;
+                       
+                       string text = panel.Text;
+                       StringFormat string_format = new StringFormat( );
+                       string_format.Trimming = StringTrimming.Character;
+                       string_format.FormatFlags = StringFormatFlags.NoWrap;
                        
-                       // Paint scrollBar corner
-                       if ( grid.vert_scrollbar.Visible && grid.horiz_scrollbar.Visible )
+                       if ( text[ 0 ] == '\t' )
                        {
-                               
-                               Rectangle corner = new Rectangle( grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width - grid.horiz_scrollbar.Height,
-                                                                grid.grid_drawing.client_area.Y + grid.grid_drawing.client_area.Height - grid.horiz_scrollbar.Height,
-                                                                grid.horiz_scrollbar.Height, grid.horiz_scrollbar.Height );
-                               
-                               if ( pe.ClipRectangle.IntersectsWith( corner ) )
+                               string_format.Alignment = StringAlignment.Center;
+                               text = text.Substring( 1 );
+                               if ( text[ 0 ] == '\t' )
                                {
-                                       pe.Graphics.FillRectangle( ResPool.GetSolidBrush( grid.ParentRowsBackColor ),
-                                                                 corner );
+                                       string_format.Alignment = StringAlignment.Far;
+                                       text = text.Substring( 1 );
                                }
                        }
                        
-                       ThemeEngine.Current.CPDrawBorderStyle( pe.Graphics, grid.ClientRectangle, grid.border_style );
+                       int x = left + border_size;
+                       int y = border_size + 2;
+                       Rectangle r = new Rectangle( x, y,
+                                                   area.Right - x - border_size,
+                                                   area.Bottom - y - border_size );
+                       
+                       dc.DrawString( text, panel.Parent.Font, br_forecolor, r, string_format );
                }
                
-               public override void DataGridPaintCaption( Graphics g, Rectangle clip, DataGrid grid )
+               private void DrawNiceRoundedBorder( Graphics dc, Rectangle area, Color color )
                {
-                       Rectangle modified_area = clip;
-                       modified_area.Intersect( grid.grid_drawing.caption_area );
+                       Pen pen = ResPool.GetPen( color ); 
                        
-                       g.FillRectangle( ResPool.GetSolidBrush( grid.CaptionBackColor ),
-                                       modified_area );
+                       Point[] points = new Point[] {
+                               new Point( area.Left + 2, area.Top ),
+                               new Point( area.Right - 3, area.Top ),
+                               new Point( area.Right, area.Top + 3 ),
+                               new Point( area.Right, area.Bottom - 2 ),
+                               new Point( area.Right - 3, area.Bottom ),
+                               new Point( area.Left + 2, area.Bottom ),
+                               new Point( area.Left, area.Bottom - 2 ),
+                               new Point( area.Left, area.Top + 3 ),
+                               new Point( area.Left + 2, area.Top )
+                       };
                        
-                       g.DrawString( grid.CaptionText, grid.CaptionFont,
-                                    ThemeEngine.Current.ResPool.GetSolidBrush( grid.CaptionForeColor ),
-                                    grid.grid_drawing.caption_area );
+                       dc.DrawLines( pen, points );
                }
+               #endregion      // StatusBar
                
-               public override void DataGridPaintColumnsHdrs( Graphics g, Rectangle clip, DataGrid grid )
+               public override void DrawTabControl( Graphics dc, Rectangle area, TabControl tab )
                {
-                       Rectangle columns_area = grid.grid_drawing.columnshdrs_area;
-                       
-                       if ( grid.CurrentTableStyle.CurrentRowHeadersVisible )
-                       { // Paint corner shared between row and column header
-                               Rectangle rect_bloc = grid.grid_drawing.columnshdrs_area;
-                               rect_bloc.Width = grid.RowHeaderWidth;
-                               rect_bloc.Height = grid.grid_drawing.columnshdrs_area.Height;
-                               if ( clip.IntersectsWith( rect_bloc ) )
-                               {
-                                       if ( grid.visiblecolumn_count > 0 )
-                                       {
-                                               g.FillRectangle( ResPool.GetSolidBrush( grid.CurrentTableStyle.CurrentHeaderBackColor ), rect_bloc );
-                                       }
-                                       else
-                                       {
-                                               g.FillRectangle( ResPool.GetSolidBrush( grid.BackgroundColor ), rect_bloc );
-                                       }
-                               }
-                               
-                               columns_area.X += grid.RowHeaderWidth;
-                               columns_area.Width -= grid.RowHeaderWidth;
-                       }
-                       
-                       // Set unused area
-                       Rectangle columnshdrs_area_complete = columns_area;
-                       columnshdrs_area_complete.Width = grid.grid_drawing.columnshdrs_maxwidth;
-                       
-                       if ( grid.CurrentTableStyle.CurrentRowHeadersVisible )
-                       {
-                               columnshdrs_area_complete.Width -= grid.RowHeaderWidth;
-                       }
-                       
-                       // Set column painting
-                       Rectangle rect_columnhdr = new Rectangle( );
-                       int col_pixel;
-                       Region prev_clip = g.Clip, current_clip;
-                       rect_columnhdr.Y = columns_area.Y;
-                       rect_columnhdr.Height = columns_area.Height;
-                       
-                       int column_cnt = grid.first_visiblecolumn + grid.visiblecolumn_count;
-                       for ( int column = grid.first_visiblecolumn; column < column_cnt; column++ )
-                       {
-                               
-                               col_pixel = grid.grid_drawing.GetColumnStartingPixel( column );
-                               rect_columnhdr.X = columns_area.X + col_pixel - grid.horz_pixeloffset;
-                               rect_columnhdr.Width = grid.CurrentTableStyle.GridColumnStyles[ column ].Width;
-                               
-                               if ( clip.IntersectsWith( rect_columnhdr ) == false )
-                                       continue;
-                               
-                               current_clip = new Region( columns_area );
-                               g.Clip = current_clip;
-                               
-                               grid.CurrentTableStyle.GridColumnStyles[ column ].PaintHeader( g, rect_columnhdr, column );
-                               
-                               g.Clip = prev_clip;
-                               current_clip.Dispose( );
-                       }
-                       
+                       // Do we need to fill the back color? It can't be changed...
+                       dc.FillRectangle( GetControlBackBrush( tab.BackColor ), area );
+                       Rectangle panel_rect = GetTabPanelRectExt( tab );
                        
-                       // This fills with background colour the unused part in the row headers
-                       if ( rect_columnhdr.X + rect_columnhdr.Height < grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width )
+                       if ( tab.Appearance == TabAppearance.Normal )
                        {
-                               
-                               Rectangle not_usedarea = columnshdrs_area_complete;
-                               not_usedarea.X = rect_columnhdr.X + rect_columnhdr.Width;
-                               not_usedarea.Width = grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width - rect_columnhdr.X - rect_columnhdr.Height;
-                               
-                               g.FillRectangle( ResPool.GetSolidBrush( grid.BackgroundColor ),
-                                               not_usedarea );
-                       }
-               }
-               
-               public override void DataGridPaintRowsHeaders( Graphics g, Rectangle clip, DataGrid grid )
-               {
-                       Rectangle rowshdrs_area_complete = grid.grid_drawing.rowshdrs_area;
-                       rowshdrs_area_complete.Height = grid.grid_drawing.rowshdrs_maxheight;
-                       Rectangle rect_row = new Rectangle( );
-                       rect_row.X = grid.grid_drawing.rowshdrs_area.X;
-                       int last_y = 0;
-                       int rowcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
-                       
-                       if ( rowcnt < grid.RowsCount )
-                       { // Paint one row more for partial rows
-                               rowcnt++;
+                               CPDrawBorder( dc, panel_rect, BorderColor, 1, ButtonBorderStyle.Solid, BorderColor, 1, ButtonBorderStyle.Solid,
+                                            BorderColor, 1, ButtonBorderStyle.Solid, BorderColor, 1, ButtonBorderStyle.Solid );
                        }
                        
-                       for ( int row = grid.FirstVisibleRow; row < rowcnt; row++ )
+                       if ( tab.Alignment == TabAlignment.Top )
                        {
-                               
-                               rect_row.Width = grid.grid_drawing.rowshdrs_area.Width;
-                               rect_row.Height = grid.RowHeight;
-                               rect_row.Y = grid.grid_drawing.rowshdrs_area.Y + ( ( row - grid.FirstVisibleRow ) * grid.RowHeight );
-                               
-                               if ( clip.IntersectsWith( rect_row ) )
+                               for ( int r = tab.TabPages.Count; r > 0; r-- )
                                {
-                                       DataGridPaintRowHeader( g, rect_row, row, grid );
-                                       last_y = rect_row.Y;
+                                       for ( int i = tab.SliderPos; i < tab.TabPages.Count; i++ )
+                                       {
+                                               if ( i == tab.SelectedIndex )
+                                                       continue;
+                                               if ( r != tab.TabPages[ i ].Row )
+                                                       continue;
+                                               Rectangle rect = tab.GetTabRect( i );
+                                               if ( !rect.IntersectsWith( area ) )
+                                                       continue;
+                                               DrawTab( dc, tab.TabPages[ i ], tab, rect, false );
+                                       }
                                }
                        }
-                       
-                       // This fills with background colour the unused part in the row headers
-                       if ( last_y > 0 && rect_row.Y + rect_row.Height < grid.grid_drawing.cells_area.Y + grid.grid_drawing.cells_area.Height )
-                       {
-                               Rectangle not_usedarea = clip;
-                               not_usedarea.Intersect( rowshdrs_area_complete );
-                               
-                               not_usedarea.Y = rect_row.Y + rect_row.Height;
-                               not_usedarea.Height = rowshdrs_area_complete.Y + rowshdrs_area_complete.Height - rect_row.Height - rect_row.Y;
-                               g.FillRectangle( ResPool.GetSolidBrush( grid.BackgroundColor ),
-                                               not_usedarea );
-                       }
-               }
-               
-               public override void DataGridPaintRowHeaderArrow( Graphics g, Rectangle bounds, DataGrid grid )
-               {
-                       Point[] arrow = new Point[ 3 ];
-                       Point P1, P2, P3;
-                       int centerX, centerY, shiftX;
-                       Rectangle rect;
-                       
-                       rect = new Rectangle( bounds.X + bounds.Width / 4,
-                                            bounds.Y + bounds.Height / 4, bounds.Width / 2, bounds.Height / 2 );
-                       
-                       centerX = rect.Left + rect.Width / 2;
-                       centerY = rect.Top + rect.Height / 2;
-                       shiftX = Math.Max( 1, rect.Width / 8 );
-                       rect.X -= shiftX;
-                       centerX -= shiftX;
-                       P1 = new Point( centerX, rect.Top - 1 );
-                       P2 = new Point( centerX, rect.Bottom );
-                       P3 = new Point( rect.Right, centerY );
-                       arrow[ 0 ] = P1;
-                       arrow[ 1 ] = P2;
-                       arrow[ 2 ] = P3;
-                       
-                       g.FillPolygon( ThemeEngine.Current.ResPool.GetSolidBrush
-                                     ( grid.CurrentTableStyle.CurrentHeaderForeColor ), arrow, FillMode.Winding );
-               }
-               
-               public override void DataGridPaintRowHeader( Graphics g, Rectangle bounds, int row, DataGrid grid )
-               {
-                       // Background
-                       g.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( grid.CurrentTableStyle.CurrentHeaderBackColor ),
-                                       bounds );
-                       
-                       if ( grid.FlatMode == false )
-                       {
-                               
-                               // Paint Borders
-                               Pen pen = ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight );
-                               g.DrawLine( pen, bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y );
-                               g.DrawLine( pen, bounds.X, bounds.Y + 1, bounds.X, bounds.Y + bounds.Height - 1 );
-                               
-                               pen = ResPool.GetPen( ThemeEngine.Current.ColorButtonShadow );
-                               g.DrawLine( pen, bounds.X + bounds.Width - 1, bounds.Y + 1 , bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1 );
-                               g.DrawLine( pen, bounds.X, bounds.Y + bounds.Height - 1, bounds.X + bounds.Width, bounds.Y  + bounds.Height - 1 );
-                       }
-                       
-                       if ( grid.ShowEditRow && row == grid.RowsCount  && !( row == grid.CurrentCell.RowNumber && grid.is_changing == true ) )
-                       {
-                               
-                               g.DrawString( "*", grid.grid_drawing.font_newrow, ResPool.GetSolidBrush( grid.CurrentTableStyle.CurrentHeaderForeColor ),
-                                            bounds );
-                               
-                       }
                        else
                        {
-                               // Draw arrow
-                               if ( row == grid.CurrentCell.RowNumber )
+                               for ( int r = 0; r < tab.TabPages.Count; r++ )
                                {
-                                       
-                                       if ( grid.is_changing == true )
-                                       {
-                                               g.DrawString( "...", grid.Font,
-                                                            ThemeEngine.Current.ResPool.GetSolidBrush( grid.CurrentTableStyle.CurrentHeaderForeColor ),
-                                                            bounds );
-                                               
-                                       }
-                                       else
+                                       for ( int i = tab.SliderPos; i < tab.TabPages.Count; i++ )
                                        {
-                                               
-                                               Rectangle rect = new Rectangle( bounds.X - 2, bounds.Y, 18, 18 );
-                                               DataGridPaintRowHeaderArrow( g, rect, grid );
+                                               if ( i == tab.SelectedIndex )
+                                                       continue;
+                                               if ( r != tab.TabPages[ i ].Row )
+                                                       continue;
+                                               Rectangle rect = tab.GetTabRect( i );
+                                               if ( !rect.IntersectsWith( area ) )
+                                                       continue;
+                                               DrawTab( dc, tab.TabPages[ i ], tab, rect, false );
                                        }
                                }
                        }
-               }
-               
-               public override void DataGridPaintRows( Graphics g, Rectangle cells, Rectangle clip, DataGrid grid )
-               {
-                       Rectangle rect_row = new Rectangle( );
-                       Rectangle not_usedarea = new Rectangle( );
-                       rect_row.X = cells.X;
-                       
-                       int rowcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
-                       
-                       if ( grid.ShowEditRow )
-                       {
-                               rowcnt--;
-                       }
-                       
-                       if ( rowcnt < grid.RowsCount )
-                       { // Paint one row more for partial rows
-                               rowcnt++;
-                       }
                        
-                       rect_row.Height = grid.RowHeight;
-                       rect_row.Width = cells.Width;
-                       for ( int row = grid.FirstVisibleRow; row < rowcnt; row++ )
+                       if ( tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos )
                        {
-                               rect_row.Y = cells.Y + ( ( row - grid.FirstVisibleRow ) * grid.RowHeight );
-                               if ( clip.IntersectsWith( rect_row ) )
-                               {
-                                       DataGridPaintRow( g, row, rect_row, false, grid );
-                               }
+                               Rectangle rect = tab.GetTabRect( tab.SelectedIndex );
+                               if ( rect.IntersectsWith( area ) )
+                                       DrawTab( dc, tab.TabPages[ tab.SelectedIndex ], tab, rect, true );
                        }
                        
-                       if ( grid.ShowEditRow && grid.FirstVisibleRow + grid.VisibleRowCount == grid.RowsCount + 1 )
+                       if ( tab.ShowSlider )
                        {
-                               rect_row.Y = cells.Y + ( ( rowcnt - grid.FirstVisibleRow ) * grid.RowHeight );
-                               if ( clip.IntersectsWith( rect_row ) )
-                               {
-                                       DataGridPaintRow( g, rowcnt, rect_row, true, grid );
-                               }
+                               Rectangle right = GetTabControlRightScrollRect( tab );
+                               Rectangle left = GetTabControlLeftScrollRect( tab );
+                               CPDrawScrollButton( dc, right, ScrollButton.Right, tab.RightSliderState );
+                               CPDrawScrollButton( dc, left, ScrollButton.Left, tab.LeftSliderState );
                        }
-                       
-                       not_usedarea.Height = cells.Y + cells.Height - rect_row.Y - rect_row.Height;
-                       not_usedarea.Y = rect_row.Y + rect_row.Height;
-                       not_usedarea.Width = rect_row.Width = cells.Width;
-                       not_usedarea.X = cells.X;
-                       
-                       g.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( grid.BackgroundColor ),
-                                       not_usedarea );
                }
                
-               public override void DataGridPaintRow( Graphics g, int row, Rectangle row_rect, bool is_newrow, DataGrid grid )
+               protected override int DrawTab( Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected )
                {
-                       Rectangle rect_cell = new Rectangle( );
-                       int col_pixel;
-                       Color backcolor, forecolor;
-                       Region prev_clip = g.Clip;
-                       Region current_clip;
-                       Rectangle not_usedarea = new Rectangle( );
+                       int FlatButtonSpacing = 8;
+                       Rectangle interior;
+                       int res = bounds.Width;
                        
-                       rect_cell.Y = row_rect.Y;
-                       rect_cell.Height = row_rect.Height;
+                       // we can't fill the background right away because the bounds might be adjusted if the tab is selected
                        
-                       // PaintCells at row, column
-                       int column_cnt = grid.first_visiblecolumn + grid.visiblecolumn_count;
-                       for ( int column = grid.first_visiblecolumn; column < column_cnt; column++ )
+                       if ( tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons )
                        {
+                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
                                
-                               col_pixel = grid.grid_drawing.GetColumnStartingPixel( column );
-                               
-                               rect_cell.X = row_rect.X + col_pixel - grid.horz_pixeloffset;
-                               rect_cell.Width = grid.CurrentTableStyle.GridColumnStyles[ column ].Width;
-                               
-                               current_clip = new Region( row_rect );
-                               g.Clip = current_clip;
-                               
-                               if ( grid.IsSelected( row ) )
-                               {
-                                       backcolor =  grid.SelectionBackColor;
-                                       forecolor =  grid.SelectionForeColor;
-                               }
-                               else
+                               // Separators
+                               if ( tab.Appearance == TabAppearance.FlatButtons )
                                {
-                                       if ( row % 2 == 0 )
-                                       {
-                                               backcolor =  grid.BackColor;
-                                       }
-                                       else
-                                       {
-                                               backcolor =  grid.AlternatingBackColor;
-                                       }
-                                       
-                                       forecolor =  grid.ForeColor;
+                                       int width = bounds.Width;
+                                       bounds.Width += ( FlatButtonSpacing - 2 );
+                                       res = bounds.Width;
+                                       CPDrawBorder3D( dc, bounds, Border3DStyle.Etched, Border3DSide.Right );
+                                       bounds.Width = width;
                                }
                                
-                               if ( is_newrow )
+                               if ( is_selected )
                                {
-                                       grid.CurrentTableStyle.GridColumnStyles[ column ].PaintNewRow( g, rect_cell,
-                                                                                                     ThemeEngine.Current.ResPool.GetSolidBrush( backcolor ),
-                                                                                                     ThemeEngine.Current.ResPool.GetSolidBrush( forecolor ) );
-                                       
+                                       CPDrawBorder3D( dc, bounds, Border3DStyle.Sunken, Border3DSide.All );
                                }
-                               else
+                               else if ( tab.Appearance != TabAppearance.FlatButtons )
                                {
-                                       grid.CurrentTableStyle.GridColumnStyles[ column ].Paint( g, rect_cell, grid.ListManager, row,
-                                                                                               ThemeEngine.Current.ResPool.GetSolidBrush( backcolor ),
-                                                                                               ThemeEngine.Current.ResPool.GetSolidBrush( forecolor ),
-                                                                                               grid.RightToLeft == RightToLeft.Yes );
+                                       CPDrawBorder3D( dc, bounds, Border3DStyle.Raised, Border3DSide.All );
                                }
                                
-                               g.Clip = prev_clip;
-                               current_clip.Dispose( );
-                       }
-                       
-                       if ( row_rect.X + row_rect.Width > rect_cell.X + rect_cell.Width )
-                       {
-                               
-                               not_usedarea.X = rect_cell.X + rect_cell.Width;
-                               not_usedarea.Width = row_rect.X + row_rect.Width - rect_cell.X - rect_cell.Width;
-                               not_usedarea.Y = row_rect.Y;
-                               not_usedarea.Height = row_rect.Height;
-                               g.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( grid.BackgroundColor ),
-                                               not_usedarea );
-                       }
-               }
-               
-               #endregion // Datagrid
-               
-               #region DateTimePicker
-               
-               public override void DrawDateTimePicker( Graphics dc,  Rectangle clip_rectangle, DateTimePicker dtp )
-               {
-                       // if not showing the numeric updown control then render border
-                       if ( !dtp.ShowUpDown && clip_rectangle.IntersectsWith( dtp.ClientRectangle ) )
-                       {
-                               // draw the outer border
-                               Rectangle button_bounds = dtp.ClientRectangle;
-                               this.CPDrawBorder3D( dc, button_bounds, Border3DStyle.Sunken, Border3DSide.All, dtp.BackColor );
-                               
-                               // deflate by the border width
-                               if ( clip_rectangle.IntersectsWith( dtp.drop_down_arrow_rect ) )
-                               {
-                                       button_bounds.Inflate( -2, -2 );
-                                       ButtonState state = dtp.is_drop_down_visible ? ButtonState.Pushed : ButtonState.Normal;
-                                       this.CPDrawComboButton(
-                                               dc,
-                                               dtp.drop_down_arrow_rect,
-                                               state );
-                               }
-                       }
-                       
-                       // render the date part
-                       if ( clip_rectangle.IntersectsWith( dtp.date_area_rect ) )
-                       {
-                               // fill the background
-                               dc.FillRectangle( ResPool.GetSolidBrush( ThemeEngine.Current.ColorWindow ), dtp.date_area_rect );
+                               interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 4, bounds.Height - 4 );
                                
-                               // fill the currently highlighted area
-                               if ( dtp.hilight_date_area != Rectangle.Empty )
-                               {
-                                       dc.FillRectangle( ResPool.GetSolidBrush( ThemeEngine.Current.ColorHilight ), dtp.hilight_date_area );
-                               }
+                                
+                               StringFormat string_format = new StringFormat( );
+                               string_format.Alignment = StringAlignment.Center;
+                               string_format.LineAlignment = StringAlignment.Center;
+                               string_format.FormatFlags = StringFormatFlags.NoWrap;
                                
-                               // draw the text part
-                               // TODO: if date format is CUstom then we need to draw the dates as separate parts
-                               StringFormat text_format = new StringFormat( );
-                               text_format.LineAlignment = StringAlignment.Center;
-                               text_format.Alignment = StringAlignment.Near;
-                               dc.DrawString( dtp.Text, dtp.Font, ResPool.GetSolidBrush( dtp.ForeColor ), Rectangle.Inflate( dtp.date_area_rect, -1, -1 ), text_format );
-                       }
-               }
-               
-               #endregion // DateTimePicker
-               
-               #region GroupBox
-               public override void DrawGroupBox( Graphics dc,  Rectangle area, GroupBox box )
-               {
-                       StringFormat    text_format;
-                       SizeF           size;
-                       int             width;
-                       int             y;
-                       Rectangle       rect;
-                       
-                       rect = box.ClientRectangle;
-                       
-                       // Needed once the Dark/Light code below is enabled again
-                       //Color disabled = ColorGrayText;
-                       
-                       Pen pen_light = ResPool.GetPen( Color.FromArgb( 255, 255, 255, 255 ) );
-                       Pen pen_dark = ResPool.GetPen( Color.FromArgb( 255, 128, 128, 128 ) );
-                       
-                       // TODO: When the Light and Dark methods work this code should be activate it
-                       //Pen pen_light = new Pen (ControlPaint.Light (disabled, 1));
-                       //Pen pen_dark = new Pen (ControlPaint.Dark (disabled, 0));
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( box.BackColor ), rect );
-                       
-                       text_format = new StringFormat( );
-                       text_format.HotkeyPrefix = HotkeyPrefix.Show;
-                       
-                       size = dc.MeasureString( box.Text, box.Font );
-                       width = (int) size.Width;
-                       
-                       if ( width > box.Width - 16 )
-                               width = box.Width - 16;
-                       
-                       y = box.Font.Height / 2;
-                       
-                       /* Draw group box*/
-                       dc.DrawLine( pen_dark, 0, y, 8, y ); // top
-                       dc.DrawLine( pen_light, 0, y + 1, 8, y + 1 );
-                       dc.DrawLine( pen_dark, 8 + width, y, box.Width, y );
-                       dc.DrawLine( pen_light, 8 + width, y + 1, box.Width, y + 1 );
-                       
-                       dc.DrawLine( pen_dark, 0, y + 1, 0, box.Height ); // left
-                       dc.DrawLine( pen_light, 1, y + 1, 1, box.Height );
-                       
-                       dc.DrawLine( pen_dark, 0, box.Height - 2, box.Width,  box.Height - 2 ); // bottom
-                       dc.DrawLine( pen_light, 0, box.Height - 1, box.Width,  box.Height - 1 );
-                       
-                       dc.DrawLine( pen_dark, box.Width - 2, y,  box.Width - 2, box.Height - 2 ); // right
-                       dc.DrawLine( pen_light, box.Width - 1, y, box.Width - 1, box.Height - 2 );
-                       
-                       
-                       /* Text */
-                       if ( box.Enabled )
-                       {
-                               dc.DrawString( box.Text, box.Font, ResPool.GetSolidBrush( box.ForeColor ), 10, 0, text_format );
-                       }
-                       else
-                       {
-                               CPDrawStringDisabled( dc, box.Text, box.Font, box.ForeColor,
-                                                    new RectangleF( 10, 0, width,  box.Font.Height ), text_format );
-                       }
-                       
-                       pen_dark.Dispose( );
-                       pen_light.Dispose( );
-               }
-               
-               public override Size GroupBoxDefaultSize
-               {
-                       get {
-                               return new Size( 200, 100 );
-                       }
-               }
-               #endregion
-               
-               #region HScrollBar
-               public override Size HScrollBarDefaultSize
-               {
-                       get {
-                               return new Size( 80, this.ScrollBarButtonSize );
-                       }
-               }
-               
-               #endregion      // HScrollBar
-               
-               #region Label
-               public  override void DrawLabel( Graphics dc, Rectangle clip_rectangle, Label label )
-               {
-                       dc.FillRectangle( ResPool.GetSolidBrush( label.BackColor ), clip_rectangle );
-                       
-                       CPDrawBorderStyle( dc, label.ClientRectangle, label.BorderStyle );
-                       
-                       if ( label.Enabled )
-                       {
-                               dc.DrawString( label.Text, label.Font, ResPool.GetSolidBrush( label.ForeColor ), clip_rectangle, label.string_format );
+                               interior.Y++;
+                               dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+                               interior.Y--;
                        }
                        else
                        {
-                               ControlPaint.DrawStringDisabled( dc, label.Text, label.Font, label.ForeColor, clip_rectangle, label.string_format );
-                       }
-                       
-               }
-               
-               public override Size LabelDefaultSize
-               {
-                       get {
-                               return new Size( 100, 23 );
-                       }
-               }
-               #endregion      // Label
-               
-               #region LinkLabel
-               public  override void DrawLinkLabel( Graphics dc, Rectangle clip_rectangle, LinkLabel label )
-               {
-                       Color color;
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( label.BackColor ), clip_rectangle );
-                       CPDrawBorderStyle( dc, label.ClientRectangle, label.BorderStyle );
-                       
-                       for ( int i = 0; i < label.num_pieces; i++ )
-                       {
-                               
-                               if ( clip_rectangle.IntersectsWith( label.pieces[ i ].rect ) == false )
-                               {
-                                       continue;
-                               }
-                               
-                               color = label.GetLinkColor( label.pieces[ i ], i );
-                               
-                               if ( label.pieces[ i ].link == null )
-                                       dc.DrawString( label.pieces[ i ].text, label.GetPieceFont( label.pieces[ i ] ), ResPool.GetSolidBrush( Color.Black ),
-                                                     label.pieces[ i ].rect.X, label.pieces[ i ].rect.Y );
-                               else
-                                       dc.DrawString( label.pieces[ i ].text, label.GetPieceFont( label.pieces[ i ] ), ResPool.GetSolidBrush( color ),
-                                                     label.pieces[ i ].rect.X, label.pieces[ i ].rect.Y );
+                               Pen border_pen = ResPool.GetPen( BorderColor );
                                
-                               if ( label.pieces[ i ].focused )
+                               switch ( tab.Alignment )
                                {
-                                       CPDrawFocusRectangle( dc, label.pieces[ i ].rect, label.ForeColor, label.BackColor );
-                               }
-                       }
-                       
-               }
-               #endregion      // LinkLabel
-               #region ListBox
-               
-               // Drawing
-               public override void DrawListBoxDecorations( Graphics dc, ListBox ctrl )
-               {
-                       Rectangle cl = ctrl.LBoxInfo.client_rect;
-                       
-                       // Draw decorations
-                       switch ( ctrl.BorderStyle )
-                       {
-                               case BorderStyle.Fixed3D: {
-                                               Pen pen = ResPool.GetPen( ColorButtonShadow );
-                                               dc.DrawLine( pen, cl.X, cl.Y, cl.X + cl.Width, cl.Y ); //top
-                                               dc.DrawLine( pen, cl.X, cl.Y, cl.X, cl.Y + cl.Height ); //left
+                                       case TabAlignment.Top:
                                                
-                                               pen = ResPool.GetPen( ColorButtonDkShadow );
-                                               dc.DrawLine( pen, cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1 );
-                                               dc.DrawLine( pen, cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2 );
+                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
                                                
-                                               pen = ResPool.GetPen( ColorButtonFace );
-                                               dc.DrawLine( pen, cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2 ); //down
-                                               dc.DrawLine( pen, cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height ); //right
+                                               if ( !is_selected )
+                                               {
+                                                       interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
+                                                       
+                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2  ), new Point( bounds.Left + 2, bounds.Bottom ), Color.White, LightColor ) )
+                                                       {
+                                                               dc.FillRectangle( lgbr, interior );
+                                                       }
+                                               }
                                                
-                                               pen = ResPool.GetPen( ColorButtonHilight );
-                                               dc.DrawLine( pen, cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1 );
-                                               dc.DrawLine( pen, cl.X + cl.Width - 1, cl.Y + 1 , cl.X + cl.Width - 1, cl.Y + cl.Height - 1 );
-                                               break;
-                                       }
-                               case BorderStyle.FixedSingle:
-                                       dc.DrawRectangle( ResPool.GetPen( ColorWindowFrame ), cl.X, cl.Y, cl.Width - 1, cl.Height - 1 );
-                                       break;
-                               case BorderStyle.None:
-                               default:
-                                       break;
-                       }
-               }
-               
-               private int DrawListBoxDecorationSize( BorderStyle border_style )
-               {
-                       switch ( border_style )
-                       {
-                               case BorderStyle.Fixed3D:
-                                       return 2;
-                               case BorderStyle.FixedSingle:
-                                       return 1;
-                               case BorderStyle.None:
-                               default:
-                                       break;
-                       }
-                       
-                       return 0;
-               }
-               
-               // Sizing
-               public override int DrawListBoxDecorationTop( BorderStyle border_style )
-               { return DrawListBoxDecorationSize( border_style );}
-               public override int DrawListBoxDecorationBottom( BorderStyle border_style )
-               { return DrawListBoxDecorationSize( border_style );}
-               public override int DrawListBoxDecorationRight( BorderStyle border_style )
-               { return DrawListBoxDecorationSize( border_style );}
-               public override int DrawListBoxDecorationLeft( BorderStyle border_style )
-               { return DrawListBoxDecorationSize( border_style );}
-               
-               public override void DrawListBoxItem( ListBox ctrl, DrawItemEventArgs e )
-               {
-                       Color back_color, fore_color;
-                       StringFormat string_format = ctrl.GetFormatString( );
-                       
-                       if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
-                       {
-                               back_color = ThemeEngine.Current.ColorHilight;
-                               fore_color = ThemeEngine.Current.ColorHilightText;
-                       }
-                       else
-                       {
-                               back_color = e.BackColor;
-                               fore_color = e.ForeColor;
-                       }
-                       
-                       e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush
-                                                ( back_color ), e.Bounds );
-                       
-                       e.Graphics.DrawString( ctrl.GetItemText( ctrl.Items[ e.Index ] ), e.Font,
-                                             ThemeEngine.Current.ResPool.GetSolidBrush( fore_color ),
-                                             e.Bounds, string_format );
-                       
-                       if ( ( e.State & DrawItemState.Focus ) == DrawItemState.Focus )
-                       {
-                               ThemeEngine.Current.CPDrawFocusRectangle( e.Graphics, e.Bounds,
-                                                                        fore_color, back_color );
-                       }
-               }
-               
-               #endregion ListBox
-               
-               #region ListView
-               // Drawing
-               public override void DrawListView( Graphics dc, Rectangle clip, ListView control )
-               {
-                       bool details = ( control.View == View.Details );
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( control.BackColor ), clip );
-                       
-                       // border is drawn directly in the Paint method
-                       if ( details && control.HeaderStyle != ColumnHeaderStyle.None )
-                       {
-                               dc.FillRectangle( ResPool.GetSolidBrush( SystemColors.Control ),
-                                                0, 0, control.TotalWidth, control.Font.Height + 5 );
-                               if ( control.Columns.Count > 0 )
-                               {
-                                       if ( control.HeaderStyle == ColumnHeaderStyle.Clickable )
-                                       {
-                                               foreach ( ColumnHeader col in control.Columns )
+                                               dc.DrawLine( border_pen, bounds.Left, bounds.Bottom, bounds.Left, bounds.Top + 3 );
+                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top + 3, bounds.Left + 3, bounds.Top );
+                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Top, bounds.Right - 3, bounds.Top );
+                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3 );
+                                               dc.DrawLine( border_pen, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom );
+                                               
+                                               if ( page.Focused )
                                                {
-                                                       this.CPDrawButton( dc, col.Rect,
-                                                                         ( col.Pressed ?
-                                                                         ButtonState.Pushed :
-                                                                         ButtonState.Normal ) );
-                                                       dc.DrawString( col.Text, ThemeEngine.Current.DefaultFont,
-                                                                     ResPool.GetSolidBrush
-                                                                     ( this.ColorButtonText ),
-                                                                     //col.Rect,
-                                                                     col.Rect.X + 3,
-                                                                     col.Rect.Y + col.Rect.Height / 2 + 1,
-                                                                     col.Format   );
+                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left - 1 , bounds.Top, bounds.Right - 1, bounds.Top );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Top + 1, bounds.Right , bounds.Top + 1 );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Top + 2, bounds.Right , bounds.Top + 2 );
                                                }
-                                       }
-                                       // Non-clickable columns
-                                       else
-                                       {
-                                               foreach ( ColumnHeader col in control.Columns )
+                                               
+                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+                                               
+                                               if ( page.Text != String.Empty )
                                                {
-                                                       this.CPDrawButton( dc, col.Rect, ButtonState.Flat );
-                                                       dc.DrawString( col.Text, ThemeEngine.Current.DefaultFont,
-                                                                     ResPool.GetSolidBrush
-                                                                     ( this.ColorButtonText ),
-                                                                     //col.Rect,
-                                                                     col.Rect.X + 3,
-                                                                     col.Rect.Y + col.Rect.Height / 2 + 1,
-                                                                     col.Format );
+                                                       StringFormat string_format = new StringFormat( );
+                                                       string_format.Alignment = StringAlignment.Center;
+                                                       string_format.LineAlignment = StringAlignment.Center;
+                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
+                                                       interior.Y++;
+                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+                                                       interior.Y--;
                                                }
-                                       }
-                               }
-                       }
-                       
-                       // In case of details view draw the items only if
-                       // columns are non-zero
-                       if ( !details || control.Columns.Count > 0 )
-                               foreach ( ListViewItem item in control.Items )
-                               {
-                                       if ( clip.IntersectsWith( item.EntireRect ) )
-                                               DrawListViewItem( dc, control, item );
-                               }
-                       
-                       // draw the gridlines
-                       if ( details && control.GridLines )
-                       {
-                               int top = ( control.HeaderStyle == ColumnHeaderStyle.None ) ?
-                                       2 : control.Font.Height + 2;
-                               
-                               // draw vertical gridlines
-                               Pen pen = ResPool.GetPen( this.ColorButtonFace );
-                               foreach ( ColumnHeader col in control.Columns )
-                                       dc.DrawLine( pen,
-                                                   col.Rect.Right, top,
-                                                   col.Rect.Right, control.TotalHeight );
-                               // draw horizontal gridlines
-                               ListViewItem last_item = null;
-                               foreach ( ListViewItem item in control.Items )
-                               {
-                                       dc.DrawLine( pen,
-                                                   item.EntireRect.Left, item.EntireRect.Top,
-                                                   control.TotalWidth, item.EntireRect.Top );
-                                       last_item = item;
-                               }
-                               
-                               // draw a line after at the bottom of the last item
-                               if ( last_item != null )
-                               {
-                                       dc.DrawLine( pen,
-                                                   last_item.EntireRect.Left,
-                                                   last_item.EntireRect.Bottom,
-                                                   control.TotalWidth,
-                                                   last_item.EntireRect.Bottom );
-                               }
-                       }
-               }
-               
-               // draws the ListViewItem of the given index
-               private void DrawListViewItem( Graphics dc, ListView control, ListViewItem item )
-               {
-                       if ( control.CheckBoxes )
-                       {
-                               if ( control.StateImageList == null )
-                               {
-                                       // Make sure we've got at least a line width of 1
-                                       int check_wd = Math.Max( 3, item.CheckRect.Width / 6 );
-                                       int scale = Math.Max( 1, item.CheckRect.Width / 12 );
-                                       
-                                       // set the checkbox background
-                                       dc.FillRectangle( this.ResPool.GetSolidBrush( this.ColorWindow ),
-                                                        item.CheckRect );
-                                       // define a rectangle inside the border area
-                                       Rectangle rect = new Rectangle( item.CheckRect.X + 2,
-                                                                      item.CheckRect.Y + 2,
-                                                                      item.CheckRect.Width - 4,
-                                                                      item.CheckRect.Height - 4 );
-                                       
-                                       using ( Pen pen = new Pen( this.ColorWindowText, 2 ) )
-                                       {
-                                               dc.DrawRectangle( pen, rect );
                                                
-                                               // Need to draw a check-mark
-                                               if ( item.Checked )
+                                               break;
+                                               
+                                       case TabAlignment.Bottom:
+                                               
+                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
+                                               
+                                               if ( !is_selected )
                                                {
-                                                       pen.Width = 1;
-                                                       // adjustments to get the check-mark at the right place
-                                                       rect.X ++; rect.Y ++;
-                                                       // following logic is taken from DrawFrameControl method
-                                                       for ( int i = 0; i < check_wd; i++ )
+                                                       interior = new Rectangle( bounds.Left + 3, bounds.Top, bounds.Width - 3, bounds.Height );
+                                                       
+                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 3, bounds.Top  ), new Point( bounds.Left + 3, bounds.Bottom  ), Color.White, LightColor ) )
                                                        {
-                                                               dc.DrawLine( pen, rect.Left + check_wd / 2,
-                                                                           rect.Top + check_wd + i,
-                                                                           rect.Left + check_wd / 2 + 2 * scale,
-                                                                           rect.Top + check_wd + 2 * scale + i );
-                                                               dc.DrawLine( pen,
-                                                                           rect.Left + check_wd / 2 + 2 * scale,
-                                                                           rect.Top + check_wd + 2 * scale + i,
-                                                                           rect.Left + check_wd / 2 + 6 * scale,
-                                                                           rect.Top + check_wd - 2 * scale + i );
+                                                               dc.FillRectangle( lgbr, interior );
                                                        }
                                                }
-                                       }
-                               }
-                               else
-                               {
-                                       if ( item.Checked && control.StateImageList.Images.Count > 1 )
-                                               control.StateImageList.Draw( dc,
-                                                                           item.CheckRect.Location, 1 );
-                                       else if ( ! item.Checked && control.StateImageList.Images.Count > 0 )
-                                               control.StateImageList.Draw( dc,
-                                                                           item.CheckRect.Location, 0 );
-                               }
-                       }
-                       
-                       // Item is drawn as a special case, as it is not just text
-                       if ( control.View == View.LargeIcon )
-                       {
-                               if ( item.ImageIndex > -1 &&
-                                   control.LargeImageList != null &&
-                                   item.ImageIndex < control.LargeImageList.Images.Count )
-                                       control.LargeImageList.Draw( dc, item.IconRect.Location,
-                                                                   item.ImageIndex );
-                       }
-                       else
-                       {
-                               if ( item.ImageIndex > -1 &&
-                                   control.SmallImageList != null &&
-                                   item.ImageIndex < control.SmallImageList.Images.Count )
-                                       control.SmallImageList.Draw( dc, item.IconRect.Location,
-                                                                   item.ImageIndex );
-                       }
-                       
-                       // draw the item text
-                       Rectangle text_rect = item.LabelRect;
-                       // format for the item text
-                       StringFormat format = new StringFormat( );
-                       format.LineAlignment = StringAlignment.Center;
-                       if ( control.View == View.LargeIcon )
-                               format.Alignment = StringAlignment.Center;
-                       else
-                               format.Alignment = StringAlignment.Near;
-                       
-                       if ( !control.LabelWrap )
-                               format.FormatFlags = StringFormatFlags.NoWrap;
-                       
-                       if ( item.Selected )
-                       {
-                               if ( control.View == View.Details )
-                               {
-                                       if ( control.FullRowSelect )
-                                       {
-                                               // fill the entire rect excluding the checkbox
-                                               Rectangle full_rect = item.EntireRect;
-                                               full_rect.Location = item.LabelRect.Location;
-                                               dc.FillRectangle( this.ResPool.GetSolidBrush
-                                                                ( this.ColorHilight ), full_rect );
-                                       }
-                                       else
-                                       {
-                                               Size text_size = Size.Ceiling( dc.MeasureString( item.Text,
-                                                                                               item.Font ) );
-                                               text_rect.Width = text_size.Width;
-                                               dc.FillRectangle( this.ResPool.GetSolidBrush
-                                                                ( this.ColorHilight ), text_rect );
-                                       }
-                               }
-                               else
-                               {
-                                       /*Size text_size = Size.Ceiling (dc.MeasureString (item.Text,
-                                        item.Font));
-                                        Point loc = text_rect.Location;
-                                        loc.X += (text_rect.Width - text_size.Width) / 2;
-                                        text_rect.Width = text_size.Width;*/
-                                       dc.FillRectangle( this.ResPool.GetSolidBrush( this.ColorHilight ),
-                                                        text_rect );
-                               }
-                       }
-                       else
-                               dc.FillRectangle( ResPool.GetSolidBrush( item.BackColor ), text_rect );
-                       
-                       if ( item.Text != null && item.Text.Length > 0 )
-                       {
-                               if ( item.Selected )
-                                       dc.DrawString( item.Text, item.Font, this.ResPool.GetSolidBrush
-                                                     ( this.ColorHilightText ), text_rect, format );
-                               else
-                                       dc.DrawString( item.Text, item.Font, this.ResPool.GetSolidBrush
-                                                     ( item.ForeColor ), text_rect, format );
-                       }
-                       
-                       if ( control.View == View.Details && control.Columns.Count > 0 )
-                       {
-                               // draw subitems for details view
-                               ListViewItem.ListViewSubItemCollection subItems = item.SubItems;
-                               int count = ( control.Columns.Count < subItems.Count ?
-                                       control.Columns.Count : subItems.Count );
-                               
-                               if ( count > 0 )
-                               {
-                                       ColumnHeader col;
-                                       ListViewItem.ListViewSubItem subItem;
-                                       Rectangle sub_item_rect = item.LabelRect;
-                                       
-                                       // set the format for subitems
-                                       format.FormatFlags = StringFormatFlags.NoWrap;
-                                       format.Alignment = StringAlignment.Near;
-                                       
-                                       // 0th subitem is the item already drawn
-                                       for ( int index = 1; index < count; index++ )
-                                       {
-                                               subItem = subItems[ index ];
-                                               col = control.Columns[ index ];
-                                               sub_item_rect.X = col.Rect.Left;
-                                               sub_item_rect.Width = col.Wd;
                                                
-                                               SolidBrush sub_item_back_br = null;
-                                               SolidBrush sub_item_fore_br = null;
-                                               Font sub_item_font = null;
+                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 3 );
+                                               dc.DrawLine( border_pen, bounds.Left, bounds.Bottom - 3, bounds.Left + 3, bounds.Bottom );
+                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Bottom, bounds.Right - 3, bounds.Bottom );
+                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Bottom, bounds.Right, bounds.Bottom - 3 );
+                                               dc.DrawLine( border_pen, bounds.Right, bounds.Bottom - 3, bounds.Right, bounds.Top );
                                                
-                                               if ( item.UseItemStyleForSubItems )
-                                               {
-                                                       sub_item_back_br = this.ResPool.GetSolidBrush
-                                                       ( item.BackColor );
-                                                       sub_item_fore_br = this.ResPool.GetSolidBrush
-                                                       ( item.ForeColor );
-                                                       sub_item_font = item.Font;
-                                               }
-                                               else
+                                               if ( page.Focused )
                                                {
-                                                       sub_item_back_br = this.ResPool.GetSolidBrush
-                                                       ( subItem.BackColor );
-                                                       sub_item_fore_br = this.ResPool.GetSolidBrush
-                                                       ( subItem.ForeColor );
-                                                       sub_item_font = subItem.Font;
+                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left - 1 , bounds.Bottom, bounds.Right - 1, bounds.Bottom );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Bottom - 1, bounds.Right , bounds.Bottom - 1 );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Bottom - 2, bounds.Right , bounds.Bottom - 2 );
                                                }
                                                
-                                               // In case of fullrowselect, background is filled
-                                               // for the entire rect above
-                                               if ( item.Selected && control.FullRowSelect )
+                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+                                               
+                                               if ( page.Text != String.Empty )
                                                {
-                                                       if ( subItem.Text != null && subItem.Text.Length > 0 )
-                                                               dc.DrawString( subItem.Text, sub_item_font,
-                                                                             this.ResPool.GetSolidBrush
-                                                                             ( this.ColorHilightText ),
-                                                                             sub_item_rect, format );
+                                                       StringFormat string_format = new StringFormat( );
+                                                       string_format.Alignment = StringAlignment.Center;
+                                                       string_format.LineAlignment = StringAlignment.Center;
+                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
+                                                       interior.Y++;
+                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+                                                       interior.Y--;
                                                }
-                                               else
+                                               
+                                               break;
+                                               
+                                       case TabAlignment.Left:
+                                               
+                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
+                                               
+                                               if ( !is_selected )
                                                {
-                                                       dc.FillRectangle( sub_item_back_br, sub_item_rect );
-                                                       if ( subItem.Text != null && subItem.Text.Length > 0 )
-                                                               dc.DrawString( subItem.Text, sub_item_font,
-                                                                             sub_item_fore_br,
-                                                                             sub_item_rect, format );
+                                                       interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
+                                                       
+                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2  ), new Point( bounds.Right, bounds.Top + 2 ), LightColor, Color.White ) )
+                                                       {
+                                                               dc.FillRectangle( lgbr, interior );
+                                                       }
                                                }
-                                               sub_item_rect.X += col.Wd;
-                                       }
-                               }
-                       }
-               }
-               
-               // Sizing
-               public override Size ListViewCheckBoxSize
-               {
-                       get { return new Size( 16, 16 ); }
-               }
-               
-               public override int ListViewColumnHeaderHeight
-               {
-                       get { return 16; }
-               }
-               
-               public override int ListViewDefaultColumnWidth
-               {
-                       get { return 60; }
-               }
-               
-               public override int ListViewVerticalSpacing
-               {
-                       get { return 22; }
-               }
-               
-               public override int ListViewEmptyColumnWidth
-               {
-                       get { return 10; }
-               }
-               
-               public override int ListViewHorizontalSpacing
-               {
-                       get { return 10; }
-               }
-               
-               public override Size ListViewDefaultSize
-               {
-                       get { return new Size( 121, 97 ); }
-               }
-               #endregion      // ListView
-               
-               #region Menus
-               public override void CalcItemSize( Graphics dc, MenuAPI.MENUITEM item, int y, int x, bool menuBar )
-               {
-                       item.rect.Y = y;
-                       item.rect.X = x;
-                       
-                       if ( item.item.Visible == false )
-                               return;
-                       
-                       if ( item.item.Separator == true )
-                       {
-                               item.rect.Height = SEPARATOR_HEIGHT / 2;
-                               item.rect.Width = -1;
-                               return;
-                       }
-                       
-                       if ( item.item.MeasureEventDefined )
-                       {
-                               MeasureItemEventArgs mi = new MeasureItemEventArgs( dc, item.pos );
-                               item.item.PerformMeasureItem( mi );
-                               item.rect.Height = mi.ItemHeight;
-                               item.rect.Width = mi.ItemWidth;
-                               return;
-                       }
-                       else
-                       {
-                               
-                               SizeF size;
-                               size =  dc.MeasureString( item.item.Text, ThemeEngine.Current.MenuFont );
-                               item.rect.Width = (int) size.Width;
-                               item.rect.Height = (int) size.Height;
-                               
-                               if ( !menuBar )
-                               {
-                                       
-                                       if ( item.item.Shortcut != Shortcut.None && item.item.ShowShortcut )
-                                       {
-                                               item.item.XTab = ThemeEngine.Current.MenuCheckSize.Width + MENU_TAB_SPACE + (int) size.Width;
-                                               size =  dc.MeasureString( " " + item.item.GetShortCutText( ), ThemeEngine.Current.MenuFont );
-                                               item.rect.Width += MENU_TAB_SPACE + (int) size.Width;
-                                       }
-                                       
-                                       item.rect.Width += 4 + ( ThemeEngine.Current.MenuCheckSize.Width * 2 );
-                               }
-                               else
-                               {
-                                       item.rect.Width += MENU_BAR_ITEMS_SPACE;
-                                       x += item.rect.Width;
-                               }
-                               
-                               if ( item.rect.Height < ThemeEngine.Current.MenuHeight )
-                                       item.rect.Height = ThemeEngine.Current.MenuHeight;
-                       }
-               }
-               
-               // Updates the menu rect and returns the height
-               public override int CalcMenuBarSize( Graphics dc, IntPtr hMenu, int width )
-               {
-                       int x = 0;
-                       int i = 0;
-                       int y = 0;
-                       MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
-                       menu.Height = 0;
-                       MenuAPI.MENUITEM item;
-                       
-                       while ( i < menu.items.Count )
-                       {
-                               
-                               item = (MenuAPI.MENUITEM) menu.items[ i ];
-                               CalcItemSize( dc, item, y, x, true );
-                               i = i + 1;
-                               
-                               if ( x + item.rect.Width > width )
-                               {
-                                       item.rect.X = 0;
-                                       y += item.rect.Height;
-                                       item.rect.Y = y;
-                                       x = 0;
-                               }
-                               
-                               x += item.rect.Width;
-                               item.item.MenuBar = true;
-                               
-                               if ( y + item.rect.Height > menu.Height )
-                                       menu.Height = item.rect.Height + y;
-                       }
-                       
-                       menu.Width = width;
-                       return menu.Height;
-               }
-               
-               
-               public override void CalcPopupMenuSize( Graphics dc, IntPtr hMenu )
-               {
-                       int x = 3;
-                       int start = 0;
-                       int i, n, y, max;
-                       
-                       MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
-                       menu.Height = 0;
-                       
-                       while ( start < menu.items.Count )
-                       {
-                               y = 2;
-                               max = 0;
-                               for ( i = start; i < menu.items.Count; i++ )
-                               {
-                                       MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[ i ];
-                                       
-                                       if ( ( i != start ) && ( item.item.Break || item.item.BarBreak ) )
-                                               break;
-                                       
-                                       CalcItemSize( dc, item, y, x, false );
-                                       y += item.rect.Height;
-                                       
-                                       if ( item.rect.Width > max )
-                                               max = item.rect.Width;
-                               }
-                               
-                               // Reemplace the -1 by the menu width (separators)
-                               for ( n = start; n < i; n++, start++ )
-                               {
-                                       MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[ n ];
-                                       item.rect.Width = max;
-                               }
-                               
-                               if ( y > menu.Height )
-                                       menu.Height = y;
-                               
-                               x += max;
-                       }
-                       
-                       menu.Width = x;
-                       
-                       //space for border
-                       menu.Width += 2;
-                       menu.Height += 2;
-                       
-                       menu.Width += SM_CXBORDER;
-                       menu.Height += SM_CYBORDER;
-               }
-               
-               // Draws a menu bar in a window
-               public override void DrawMenuBar( Graphics dc, IntPtr hMenu, Rectangle rect )
-               {
-                       MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
-                       
-                       Rectangle item_rect;
-                       
-                       if ( menu.Height == 0 )
-                               ThemeEngine.Current.CalcMenuBarSize( dc, hMenu, rect.Width );
-                       
-                       rect.Height = menu.Height;
-                       dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( menu.Wnd.BackColor ), rect );
-//                     dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( NiceBackColor ), rect );
-                       
-                       for ( int i = 0; i < menu.items.Count; i++ )
-                       {
-                               MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[ i ];
-                               item_rect = it.rect;
-                               item_rect.X += rect.X;
-                               item_rect.Y += rect.Y;
-                               it.item.MenuHeight = menu.Height;
-                               it.item.PerformDrawItem( new DrawItemEventArgs( dc, ThemeEngine.Current.MenuFont,
-                                                                              item_rect, i, it.item.Status ) );
-                       }
-               }
-               
-               public override void DrawMenuItem( MenuItem item, DrawItemEventArgs e )
-               {
-                       StringFormat string_format;
-                       Rectangle rect_text = e.Bounds;
-                       
-                       if ( item.Visible == false )
-                               return;
-                       
-                       if ( item.MenuBar )
-                       {
-                               string_format = string_format_menu_menubar_text;
-                       }
-                       else
-                       {
-                               string_format = string_format_menu_text;
-                       }
-                       
-                       if ( item.Separator == true )
-                       {
-                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( LightColor ),
-                                                   e.Bounds.X, e.Bounds.Y, e.Bounds.X + e.Bounds.Width, e.Bounds.Y );
-                               
-                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight ),
-                                                   e.Bounds.X, e.Bounds.Y + 1, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + 1 );
-                               
-                               return;
-                       }
-                       
-                       if ( !item.MenuBar )
-                               rect_text.X += ThemeEngine.Current.MenuCheckSize.Width;
-                       
-                       if ( item.BarBreak )
-                       { /* Draw vertical break bar*/
-                               Rectangle rect = e.Bounds;
-                               rect.Y++;
-                               rect.Width = 3;
-                               rect.Height = item.MenuHeight - 6;
-                               
-                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( LightColor ),
-                                                   rect.X, rect.Y , rect.X, rect.Y + rect.Height );
-                               
-                               e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight ),
-                                                   rect.X + 1, rect.Y , rect.X + 1, rect.Y + rect.Height );
-                       }
-                       
-                       Color color_text = ThemeEngine.Current.ColorMenuText;
-                       Color color_back;
-                       
-                       /* Draw background */
-                       Rectangle rect_back = e.Bounds;
-                       rect_back.X++;
-                       rect_back.Width -= 2;
-                       
-                       if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
-                       {
-                               color_text = ThemeEngine.Current.ColorMenuText;
-                               color_back = NormalColor;
-                               
-                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rect_back.X, rect_back.Y ), new Point( rect_back.Right, rect_back.Y ), Color.White, NormalColor ) )//NormalColor, Color.White ) )
-                               {
-                                       e.Graphics.FillRectangle( lgbr, rect_back );
-                               }
-                               
-//                             if ( item.MenuBar )
-//                             {
-//                                     e.Graphics.DrawLine( ResPool.GetPen( BorderColor ), rect_back.Left, rect_back.Bottom, rect_back.Left, rect_back.Top );
-//                                     e.Graphics.DrawLine( ResPool.GetPen( BorderColor ), rect_back.Left, rect_back.Top, rect_back.Right, rect_back.Top );
-//                                     e.Graphics.DrawLine( ResPool.GetPen( BorderColor ), rect_back.Right, rect_back.Top, rect_back.Right, rect_back.Bottom );
-//                             }
-//                             else
-                               rect_back.Height--;
-                               e.Graphics.DrawRectangle( ResPool.GetPen( BorderColor ), rect_back );
-                       }
-                       else
-                       {
-                               color_text = ThemeEngine.Current.ColorMenuText;
-                               color_back = NiceBackColor;
-                               
-                               e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( NiceBackColor ), rect_back );
-                       }
-                       
-                       if ( item.Enabled )
-                       {
-                               e.Graphics.DrawString( item.Text, e.Font,
-                                                     ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
-                                                     rect_text, string_format );
-                               
-                               if ( !item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut )
-                               {
-                                       string str = item.GetShortCutText( );
-                                       Rectangle rect = rect_text;
-                                       rect.X = item.XTab;
-                                       rect.Width -= item.XTab;
-                                       
-                                       e.Graphics.DrawString( str, e.Font, ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
-                                                             rect, string_format_menu_shortcut );
-                               }
-                       }
-                       else
-                       {
-                               ControlPaint.DrawStringDisabled( e.Graphics, item.Text, e.Font,
-                                                               Color.Black, rect_text, string_format );
-                       }
-                       
-                       /* Draw arrow */
-                       if ( item.MenuBar == false && item.IsPopup )
-                       {
-                               
-                               int cx = ThemeEngine.Current.MenuCheckSize.Width;
-                               int cy = ThemeEngine.Current.MenuCheckSize.Height;
-                               Bitmap  bmp = new Bitmap( cx, cy );
-                               Graphics gr = Graphics.FromImage( bmp );
-                               Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
-                               ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Arrow );
-                               bmp.MakeTransparent( );
-                               
-                               if ( item.Enabled )
-                               {
-                                       e.Graphics.DrawImage( bmp, e.Bounds.X + e.Bounds.Width - cx,
-                                                            e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
-                               }
-                               else
-                               {
-                                       ControlPaint.DrawImageDisabled( e.Graphics, bmp, e.Bounds.X + e.Bounds.Width - cx,
-                                                                      e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ),  color_back );
-                               }
-                               
-                               gr.Dispose( );
-                               bmp.Dispose( );
-                       }
-                       
-                       /* Draw checked or radio */
-                       if ( item.MenuBar == false && item.Checked )
-                       {
-                               
-                               Rectangle area = e.Bounds;
-                               int cx = ThemeEngine.Current.MenuCheckSize.Width;
-                               int cy = ThemeEngine.Current.MenuCheckSize.Height;
-                               Bitmap  bmp = new Bitmap( cx, cy );
-                               Graphics gr = Graphics.FromImage( bmp );
-                               Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
-                               
-                               if ( item.RadioCheck )
-                                       ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Bullet );
-                               else
-                                       ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Checkmark );
-                               
-                               bmp.MakeTransparent( );
-                               e.Graphics.DrawImage( bmp, area.X, e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
-                               
-                               gr.Dispose( );
-                               bmp.Dispose( );
-                       }
-               }
-               
-               public override void DrawPopupMenu( Graphics dc, IntPtr hMenu, Rectangle cliparea, Rectangle rect )
-               {
-                       MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
-                       
-                       dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush
-                                        ( ThemeEngine.Current.ColorMenu ), cliparea );
-                       
-                       /* Draw menu borders */
-                       dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorHilightText ), rect.X, rect.Y, rect.X + rect.Width, rect.Y );
-                       
-                       dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorHilightText ), rect.X, rect.Y, rect.X, rect.Y + rect.Height );
-                       
-                       dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonShadow ), rect.X + rect.Width - 1 , rect.Y , rect.X + rect.Width - 1, rect.Y + rect.Height );
-                       
-                       dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonDkShadow ), rect.X + rect.Width, rect.Y , rect.X + rect.Width, rect.Y + rect.Height );
-                       
-                       dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonShadow ), rect.X , rect.Y + rect.Height - 1 , rect.X + rect.Width - 1, rect.Y + rect.Height - 1 );
-                       
-                       dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonDkShadow ), rect.X , rect.Y + rect.Height, rect.X + rect.Width - 1, rect.Y + rect.Height );
-                       
-                       for ( int i = 0; i < menu.items.Count; i++ )
-                               if ( cliparea.IntersectsWith( ( (MenuAPI.MENUITEM) menu.items[ i ] ).rect ) )
-                               {
-                                       MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[ i ];
-                                       it.item.MenuHeight = menu.Height;
-                                       it.item.PerformDrawItem( new DrawItemEventArgs( dc, ThemeEngine.Current.MenuFont,
-                                                                                      it.rect, i, it.item.Status ) );
-                               }
-               }
-               
-               #endregion // Menus
-               
-               #region MonthCalendar
-               
-               // draw the month calendar
-               public override void DrawMonthCalendar( Graphics dc, Rectangle clip_rectangle, MonthCalendar mc )
-               {
-                       Rectangle client_rectangle = mc.ClientRectangle;
-                       Size month_size = mc.SingleMonthSize;
-                       // cache local copies of Marshal-by-ref internal members (gets around error CS0197)
-                       Size calendar_spacing = (Size)( (object)mc.calendar_spacing );
-                       Size date_cell_size = (Size)( (object)mc.date_cell_size );
-                       
-                       // draw the singlecalendars
-                       int x_offset = 1;
-                       int y_offset = 1;
-                       // adjust for the position of the specific month
-                       for ( int i=0; i < mc.CalendarDimensions.Height; i++ )
-                       {
-                               if ( i > 0 )
-                               {
-                                       y_offset += month_size.Height + calendar_spacing.Height;
-                               }
-                               // now adjust for x position
-                               for ( int j=0; j < mc.CalendarDimensions.Width; j++ )
-                               {
-                                       if ( j > 0 )
-                                       {
-                                               x_offset += month_size.Width + calendar_spacing.Width;
-                                       }
-                                       else
-                                       {
-                                               x_offset = 1;
-                                       }
-                                       
-                                       Rectangle month_rect = new Rectangle( x_offset, y_offset, month_size.Width, month_size.Height );
-                                       if ( month_rect.IntersectsWith( clip_rectangle ) )
-                                       {
-                                               DrawSingleMonth(
-                                                       dc,
-                                                       clip_rectangle,
-                                                       month_rect,
-                                                       mc,
-                                                       i,
-                                                       j );
-                                       }
-                               }
-                       }
-                       
-                       Rectangle bottom_rect = new Rectangle(
-                               client_rectangle.X,
-                               Math.Max( client_rectangle.Bottom - date_cell_size.Height - 3, 0 ),
-                               client_rectangle.Width,
-                               date_cell_size.Height + 2 );
-                       // draw the today date if it's set
-                       if ( mc.ShowToday && bottom_rect.IntersectsWith( clip_rectangle ) )
-                       {
-                               dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), bottom_rect );
-                               if ( mc.ShowToday )
-                               {
-                                       int today_offset = 5;
-                                       if ( mc.ShowTodayCircle )
-                                       {
-                                               Rectangle today_circle_rect = new Rectangle(
-                                                       client_rectangle.X + 5,
-                                                       Math.Max( client_rectangle.Bottom - date_cell_size.Height - 2, 0 ),
-                                                       date_cell_size.Width,
-                                                       date_cell_size.Height );
-                                               DrawTodayCircle( dc, today_circle_rect );
-                                               today_offset += date_cell_size.Width + 5;
-                                       }
-                                       // draw today's date
-                                       StringFormat text_format = new StringFormat( );
-                                       text_format.LineAlignment = StringAlignment.Center;
-                                       text_format.Alignment = StringAlignment.Near;
-                                       Font bold_font = new Font( mc.Font.FontFamily, mc.Font.Size, mc.Font.Style | FontStyle.Bold );
-                                       Rectangle today_rect = new Rectangle(
-                                               today_offset + client_rectangle.X,
-                                               Math.Max( client_rectangle.Bottom - date_cell_size.Height, 0 ),
-                                               Math.Max( client_rectangle.Width - today_offset, 0 ),
-                                               date_cell_size.Height );
-                                       dc.DrawString( "Today: " + DateTime.Now.ToShortDateString( ), bold_font, ResPool.GetSolidBrush( mc.ForeColor ), today_rect, text_format );
-                               }
-                       }
-                       
-                       // finally paint the borders of the calendars as required
-                       for ( int i = 0; i <= mc.CalendarDimensions.Width; i++ )
-                       {
-                               if ( i == 0 && clip_rectangle.X == client_rectangle.X )
-                               {
-                                       dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), new Rectangle( client_rectangle.X, client_rectangle.Y, 1, client_rectangle.Height ) );
-                               }
-                               else if ( i == mc.CalendarDimensions.Width && clip_rectangle.Right == client_rectangle.Right )
-                               {
-                                       dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), new Rectangle( client_rectangle.Right - 1, client_rectangle.Y, 1, client_rectangle.Height ) );
-                               }
-                               else
-                               {
-                                       Rectangle rect = new Rectangle(
-                                               client_rectangle.X + ( month_size.Width * i ) + ( calendar_spacing.Width * ( i - 1 ) ) + 1,
-                                               client_rectangle.Y,
-                                               calendar_spacing.Width,
-                                               client_rectangle.Height );
-                                       if ( i < mc.CalendarDimensions.Width && i > 0 && clip_rectangle.IntersectsWith( rect ) )
-                                       {
-                                               dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), rect );
-                                       }
-                               }
-                       }
-                       for ( int i = 0; i <= mc.CalendarDimensions.Height; i++ )
-                       {
-                               if ( i == 0 && clip_rectangle.Y == client_rectangle.Y )
-                               {
-                                       dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), new Rectangle( client_rectangle.X, client_rectangle.Y, client_rectangle.Width, 1 ) );
-                               }
-                               else if ( i == mc.CalendarDimensions.Height && clip_rectangle.Bottom == client_rectangle.Bottom )
-                               {
-                                       dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), new Rectangle( client_rectangle.X, client_rectangle.Bottom - 1, client_rectangle.Width, 1 ) );
-                               }
-                               else
-                               {
-                                       Rectangle rect = new Rectangle(
-                                               client_rectangle.X,
-                                               client_rectangle.Y + ( month_size.Height * i ) + ( calendar_spacing.Height * ( i - 1 ) ) + 1,
-                                               client_rectangle.Width,
-                                               calendar_spacing.Height );
-                                       if ( i < mc.CalendarDimensions.Height && i > 0 && clip_rectangle.IntersectsWith( rect ) )
-                                       {
-                                               dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), rect );
-                                       }
-                               }
-                       }
-                       
-                       // draw the drop down border if need
-                       if ( mc.owner != null )
-                       {
-                               Rectangle bounds = mc.ClientRectangle;
-                               if ( clip_rectangle.Contains( mc.Location ) )
-                               {
-                                       // find out if top or left line to draw
-                                       if ( clip_rectangle.Contains( new Point( bounds.Left, bounds.Bottom ) ) )
-                                       {
-                                               
-                                               dc.DrawLine( SystemPens.ControlText, bounds.X, bounds.Y, bounds.X, bounds.Bottom - 1 );
-                                       }
-                                       if ( clip_rectangle.Contains( new Point( bounds.Right, bounds.Y ) ) )
-                                       {
-                                               dc.DrawLine( SystemPens.ControlText, bounds.X, bounds.Y, bounds.Right - 1, bounds.Y );
-                                       }
-                               }
-                               if ( clip_rectangle.Contains( new Point( bounds.Right, bounds.Bottom ) ) )
-                               {
-                                       // find out if bottom or right line to draw
-                                       if ( clip_rectangle.Contains( new Point( bounds.Left, bounds.Bottom ) ) )
-                                       {
-                                               dc.DrawLine( SystemPens.ControlText, bounds.X, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1 );
-                                       }
-                                       if ( clip_rectangle.Contains( new Point( bounds.Right, bounds.Y ) ) )
-                                       {
-                                               dc.DrawLine( SystemPens.ControlText, bounds.Right - 1, bounds.Y, bounds.Right - 1, bounds.Bottom - 1 );
-                                       }
-                               }
-                       }
-               }
-               
-               // darws a single part of the month calendar (with one month)
-               private void DrawSingleMonth( Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col )
-               {
-                       // cache local copies of Marshal-by-ref internal members (gets around error CS0197)
-                       Size title_size = (Size)( (object)mc.title_size );
-                       Size date_cell_size = (Size)( (object)mc.date_cell_size );
-                       DateTime current_month = (DateTime)( (object)mc.current_month );
-                       
-                       // set up some standard string formating variables
-                       StringFormat text_format = new StringFormat( );
-                       text_format.LineAlignment = StringAlignment.Center;
-                       text_format.Alignment = StringAlignment.Center;
-                       
-                       
-                       // draw the title back ground
-                       DateTime this_month = current_month.AddMonths( row * mc.CalendarDimensions.Width + col );
-                       Rectangle title_rect = new Rectangle( rectangle.X, rectangle.Y, title_size.Width, title_size.Height );
-                       if ( title_rect.IntersectsWith( clip_rectangle ) )
-                       {
-                               dc.FillRectangle( ResPool.GetSolidBrush( mc.TitleBackColor ), title_rect );
-                               // draw the title
-                               string title_text = this_month.ToString( "MMMM yyyy" );
-                               dc.DrawString( title_text, mc.Font, ResPool.GetSolidBrush( mc.TitleForeColor ), title_rect, text_format );
-                               
-                               // draw previous and next buttons if it's time
-                               if ( row == 0 && col == 0 )
-                               {
-                                       // draw previous button
-                                       DrawMonthCalendarButton(
-                                               dc,
-                                               rectangle,
-                                               mc,
-                                               title_size,
-                                               mc.button_x_offset,
-                                               (System.Drawing.Size)( (object)mc.button_size ),
-                                               true );
-                               }
-                               if ( row == 0 && col == mc.CalendarDimensions.Width - 1 )
-                               {
-                                       // draw next button
-                                       DrawMonthCalendarButton(
-                                               dc,
-                                               rectangle,
-                                               mc,
-                                               title_size,
-                                               mc.button_x_offset,
-                                               (System.Drawing.Size)( (object)mc.button_size ),
-                                               false );
-                               }
-                       }
-                       
-                       // set the week offset and draw week nums if needed
-                       int col_offset = ( mc.ShowWeekNumbers ) ? 1 : 0;
-                       Rectangle day_name_rect = new Rectangle(
-                               rectangle.X,
-                               rectangle.Y + title_size.Height,
-                               ( 7 + col_offset ) * date_cell_size.Width,
-                               date_cell_size.Height );
-                       if ( day_name_rect.IntersectsWith( clip_rectangle ) )
-                       {
-                               dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), day_name_rect );
-                               // draw the day names
-                               DayOfWeek first_day_of_week = mc.GetDayOfWeek( mc.FirstDayOfWeek );
-                               for ( int i=0; i < 7; i++ )
-                               {
-                                       int position = i - (int) first_day_of_week;
-                                       if ( position < 0 )
-                                       {
-                                               position = 7 + position;
-                                       }
-                                       // draw it
-                                       Rectangle day_rect = new Rectangle(
-                                               day_name_rect.X + ( ( i + col_offset ) * date_cell_size.Width ),
-                                               day_name_rect.Y,
-                                               date_cell_size.Width,
-                                               date_cell_size.Height );
-                                       dc.DrawString( ( (DayOfWeek)i ).ToString( ).Substring( 0, 3 ), mc.Font, ResPool.GetSolidBrush( mc.TitleBackColor ), day_rect, text_format );
-                               }
-                               
-                               // draw the vertical divider
-                               int vert_divider_y = Math.Max( title_size.Height + date_cell_size.Height - 1, 0 );
-                               dc.DrawLine(
-                                       ResPool.GetPen( mc.ForeColor ),
-                                       rectangle.X + ( col_offset * date_cell_size.Width ) + mc.divider_line_offset,
-                                       rectangle.Y + vert_divider_y,
-                                       rectangle.Right - mc.divider_line_offset,
-                                       rectangle.Y + vert_divider_y );
-                       }
-                       
-                       
-                       // draw the actual date items in the grid (including the week numbers)
-                       Rectangle date_rect = new Rectangle(
-                               rectangle.X,
-                               rectangle.Y + title_size.Height + date_cell_size.Height,
-                               date_cell_size.Width,
-                               date_cell_size.Height );
-                       int month_row_count = 0;
-                       bool draw_week_num_divider = false;
-                       DateTime current_date = mc.GetFirstDateInMonthGrid( new DateTime( this_month.Year, this_month.Month, 1 ) );
-                       for ( int i=0; i < 6; i++ )
-                       {
-                               // establish if this row is in our clip_area
-                               Rectangle row_rect = new Rectangle(
-                                       rectangle.X,
-                                       rectangle.Y + title_size.Height + ( date_cell_size.Height * ( i + 1 ) ),
-                                       date_cell_size.Width * 7,
-                                       date_cell_size.Height );
-                               if ( mc.ShowWeekNumbers )
-                               {
-                                       row_rect.Width += date_cell_size.Width;
-                               }
-                               
-                               bool draw_row = row_rect.IntersectsWith( clip_rectangle );
-                               if ( draw_row )
-                               {
-                                       dc.FillRectangle( ResPool.GetSolidBrush( mc.BackColor ), row_rect );
-                               }
-                               // establish if this is a valid week to draw
-                               if ( mc.IsValidWeekToDraw( this_month, current_date, row, col ) )
-                               {
-                                       month_row_count = i;
-                               }
-                               
-                               // draw the week number if required
-                               if ( mc.ShowWeekNumbers && month_row_count == i )
-                               {
-                                       if ( !draw_week_num_divider )
-                                       {
-                                               draw_week_num_divider = draw_row;
-                                       }
-                                       // get the week for this row
-                                       int week = mc.GetWeekOfYear( current_date );
-                                       
-                                       if ( draw_row )
-                                       {
-                                               dc.DrawString(
-                                                       week.ToString( ),
-                                                       mc.Font,
-                                                       ResPool.GetSolidBrush( mc.TitleBackColor ),
-                                                       date_rect,
-                                                       text_format );
-                                       }
-                                       date_rect.Offset( date_cell_size.Width, 0 );
-                               }
-                               
-                               // only draw the days if we have to
-                               if ( month_row_count == i )
-                               {
-                                       for ( int j=0; j < 7; j++ )
-                                       {
-                                               if ( draw_row )
-                                               {
-                                                       DrawMonthCalendarDate(
-                                                               dc,
-                                                               date_rect,
-                                                               mc,
-                                                               current_date,
-                                                               this_month,
-                                                               row,
-                                                               col );
-                                               }
-                                               
-                                               // move the day on
-                                               current_date = current_date.AddDays( 1 );
-                                               date_rect.Offset( date_cell_size.Width, 0 );
-                                       }
-                                       
-                                       // shift the rectangle down one row
-                                       int offset = ( mc.ShowWeekNumbers ) ? -8 : -7;
-                                       date_rect.Offset( offset * date_cell_size.Width, date_cell_size.Height );
-                               }
-                       }
-                       
-                       // month_row_count is zero based, so add one
-                       month_row_count++;
-                       
-                       // draw week numbers if required
-                       if ( draw_week_num_divider )
-                       {
-                               col_offset = 1;
-                               dc.DrawLine(
-                                       ResPool.GetPen( mc.ForeColor ),
-                                       rectangle.X + date_cell_size.Width - 1,
-                                       rectangle.Y + title_size.Height + date_cell_size.Height + mc.divider_line_offset,
-                                       rectangle.X + date_cell_size.Width - 1,
-                                       rectangle.Y + title_size.Height + date_cell_size.Height + ( month_row_count * date_cell_size.Height ) - mc.divider_line_offset );
-                       }
-               }
-               
-               // draws the pervious or next button
-               private void DrawMonthCalendarButton( Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous )
-               {
-                       bool is_clicked = false;
-                       Rectangle button_rect;
-                       Rectangle arrow_rect = new Rectangle( rectangle.X, rectangle.Y, 4, 7 );
-                       Point[] arrow_path = new Point[ 3 ];
-                       // prepare the button
-                       if ( is_previous )
-                       {
-                               is_clicked = mc.is_previous_clicked;
-                               button_rect = new Rectangle(
-                                       rectangle.X + 1 + x_offset,
-                                       rectangle.Y + 1 + ( ( title_size.Height - button_size.Height ) / 2 ),
-                                       Math.Max( button_size.Width - 1, 0 ),
-                                       Math.Max( button_size.Height - 1, 0 ) );
-                               arrow_rect.X = button_rect.X + ( ( button_rect.Width - arrow_rect.Width ) / 2 );
-                               arrow_rect.Y = button_rect.Y + ( ( button_rect.Height - arrow_rect.Height ) / 2 );
-                               if ( is_clicked )
-                               {
-                                       arrow_rect.Offset( 1, 1 );
-                               }
-                               arrow_path[ 0 ] = new Point( arrow_rect.Right, arrow_rect.Y );
-                               arrow_path[ 1 ] = new Point( arrow_rect.X, arrow_rect.Y + arrow_rect.Height / 2 );
-                               arrow_path[ 2 ] = new Point( arrow_rect.Right, arrow_rect.Bottom );
-                       }
-                       else
-                       {
-                               is_clicked = mc.is_next_clicked;
-                               button_rect = new Rectangle(
-                                       rectangle.Right - 1 - x_offset - button_size.Width,
-                                       rectangle.Y + 1 + ( ( title_size.Height - button_size.Height ) / 2 ),
-                                       Math.Max( button_size.Width - 1, 0 ),
-                                       Math.Max( button_size.Height - 1, 0 ) );
-                               arrow_rect.X = button_rect.X + ( ( button_rect.Width - arrow_rect.Width ) / 2 );
-                               arrow_rect.Y = button_rect.Y + ( ( button_rect.Height - arrow_rect.Height ) / 2 );
-                               if ( is_clicked )
-                               {
-                                       arrow_rect.Offset( 1, 1 );
-                               }
-                               arrow_path[ 0 ] = new Point( arrow_rect.X, arrow_rect.Y );
-                               arrow_path[ 1 ] = new Point( arrow_rect.Right, arrow_rect.Y + arrow_rect.Height / 2 );
-                               arrow_path[ 2 ] = new Point( arrow_rect.X, arrow_rect.Bottom );
-                       }
-                       
-                       // fill the background
-                       dc.FillRectangle( SystemBrushes.Control, button_rect );
-                       // draw the border
-                       if ( is_clicked )
-                       {
-                               dc.DrawRectangle( SystemPens.ControlDark, button_rect );
-                       }
-                       else
-                       {
-                               CPDrawBorder3D( dc, button_rect, Border3DStyle.Raised, Border3DSide.All );
-                       }
-                       // draw the arrow
-                       dc.FillPolygon( SystemBrushes.ControlText, arrow_path );
-               }
-               
-               
-               // draws one day in the calendar grid
-               private void DrawMonthCalendarDate( Graphics dc, Rectangle rectangle, MonthCalendar mc, DateTime date, DateTime month, int row, int col )
-               {
-                       Color date_color = mc.ForeColor;
-                       Rectangle interior = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 1, 0 ), Math.Max( rectangle.Height - 1, 0 ) );
-                       
-                       // find out if we are the lead of the first calendar or the trail of the last calendar
-                       if ( date.Year != month.Year || date.Month != month.Month )
-                       {
-                               DateTime check_date = month.AddMonths( -1 );
-                               // check if it's the month before
-                               if ( check_date.Year == date.Year && check_date.Month == date.Month && row == 0 && col == 0 )
-                               {
-                                       date_color = mc.TrailingForeColor;
-                               }
-                               else
-                               {
-                                       // check if it's the month after
-                                       check_date = month.AddMonths( 1 );
-                                       if ( check_date.Year == date.Year && check_date.Month == date.Month && row == mc.CalendarDimensions.Height - 1 && col == mc.CalendarDimensions.Width - 1 )
-                                       {
-                                               date_color = mc.TrailingForeColor;
-                                       }
-                                       else
-                                       {
-                                               return;
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               date_color = mc.ForeColor;
-                       }
-                       
-                       
-                       if ( date == mc.SelectionStart && date == mc.SelectionEnd )
-                       {
-                               // see if the date is in the start of selection
-                               date_color = mc.BackColor;
-                               // draw the left hand of the back ground
-                               Rectangle selection_rect = Rectangle.Inflate( rectangle, -3, -3 );
-                               dc.FillPie( ResPool.GetSolidBrush( mc.TitleBackColor ), selection_rect, 0, 359 );
-                       }
-                       else if ( date == mc.SelectionStart )
-                       {
-                               // see if the date is in the start of selection
-                               date_color = mc.BackColor;
-                               // draw the left hand of the back ground
-                               Rectangle selection_rect = Rectangle.Inflate( rectangle, -3, -3 );
-                               dc.FillPie( ResPool.GetSolidBrush( mc.TitleBackColor ), selection_rect, 90, 180 );
-                               // fill the other side as a straight rect
-                               if ( date < mc.SelectionEnd )
-                               {
-                                       // use rectangle instead of rectangle to go all the way to edge of rect
-                                       selection_rect.X = (int) Math.Floor( (double)( rectangle.X + rectangle.Width / 2 ) );
-                                       selection_rect.Width = Math.Max( rectangle.Right - selection_rect.X, 0 );
-                                       dc.FillRectangle( ResPool.GetSolidBrush( mc.TitleBackColor ), selection_rect );
-                               }
-                       }
-                       else if ( date == mc.SelectionEnd )
-                       {
-                               // see if it is the end of selection
-                               date_color = mc.BackColor;
-                               // draw the left hand of the back ground
-                               Rectangle selection_rect = Rectangle.Inflate( rectangle, -3, -3 );
-                               dc.FillPie( ResPool.GetSolidBrush( mc.TitleBackColor ), selection_rect, 270, 180 );
-                               // fill the other side as a straight rect
-                               if ( date > mc.SelectionStart )
-                               {
-                                       selection_rect.X = rectangle.X;
-                                       selection_rect.Width = rectangle.Width - ( rectangle.Width / 2 );
-                                       dc.FillRectangle( ResPool.GetSolidBrush( mc.TitleBackColor ), selection_rect );
-                               }
-                       }
-                       else if ( date > mc.SelectionStart && date < mc.SelectionEnd )
-                       {
-                               // now see if it's in the middle
-                               date_color = mc.BackColor;
-                               // draw the left hand of the back ground
-                               Rectangle selection_rect = Rectangle.Inflate( rectangle, 0, -3 );
-                               dc.FillRectangle( ResPool.GetSolidBrush( mc.TitleBackColor ), selection_rect );
-                       }
-                       
-                       // set up some standard string formating variables
-                       StringFormat text_format = new StringFormat( );
-                       text_format.LineAlignment = StringAlignment.Center;
-                       text_format.Alignment = StringAlignment.Center;
-                       
-                       
-                       // establish if it's a bolded font
-                       Font font;
-                       if ( mc.IsBoldedDate( date ) )
-                       {
-                               font = new Font( mc.Font.FontFamily, mc.Font.Size, mc.Font.Style | FontStyle.Bold );
-                       }
-                       else
-                       {
-                               font = mc.Font;
-                       }
-                       
-                       // just draw the date now
-                       dc.DrawString( date.Day.ToString( ), font, ResPool.GetSolidBrush( date_color ), rectangle, text_format );
-                       
-                       // today circle if needed
-                       if ( mc.ShowTodayCircle && date == DateTime.Now.Date )
-                       {
-                               DrawTodayCircle( dc, interior );
-                       }
-                       
-                       // draw the selection grid
-                       if ( mc.is_date_clicked && mc.clicked_date == date )
-                       {
-                               using ( Pen pen = new Pen( Color.Black, 1 ) )
-                               {
-                                       pen.DashStyle = DashStyle.Dot;
-                                       dc.DrawRectangle( pen, interior );
-                               }
-                       }
-               }
-               
-               private void DrawTodayCircle( Graphics dc, Rectangle rectangle )
-               {
-                       Color circle_color = Color.FromArgb( 248, 0, 0 );
-                       // draw the left hand of the circle
-                       Rectangle lhs_circle_rect = new Rectangle( rectangle.X + 1, rectangle.Y + 4, Math.Max( rectangle.Width - 2, 0 ), Math.Max( rectangle.Height - 5, 0 ) );
-                       Rectangle rhs_circle_rect = new Rectangle( rectangle.X + 1, rectangle.Y + 1, Math.Max( rectangle.Width - 2, 0 ), Math.Max( rectangle.Height - 2, 0 ) );
-                       Point [] curve_points = new Point[ 3 ];
-                       curve_points[ 0 ] = new Point( lhs_circle_rect.X, rhs_circle_rect.Y + rhs_circle_rect.Height / 12 );
-                       curve_points[ 1 ] = new Point( lhs_circle_rect.X + lhs_circle_rect.Width / 9, rhs_circle_rect.Y );
-                       curve_points[ 2 ] = new Point( lhs_circle_rect.X + lhs_circle_rect.Width / 2 + 1, rhs_circle_rect.Y );
-                       
-                       using ( Pen pen = new Pen( circle_color, 2 ) )
-                       {
-                               dc.DrawArc( pen, lhs_circle_rect, 90, 180 );
-                               dc.DrawArc( pen, rhs_circle_rect, 270, 180 );
-                               dc.DrawCurve( pen, curve_points );
-                               dc.DrawLine( ResPool.GetPen( circle_color ), curve_points[ 2 ], new Point( curve_points[ 2 ].X, lhs_circle_rect.Y ) );
-                       }
-               }
-               
-               #endregion      // MonthCalendar
-               
-               #region Panel
-               public override Size PanelDefaultSize
-               {
-                       get {
-                               return new Size( 200, 100 );
-                       }
-               }
-               #endregion      // Panel
-               
-               #region PictureBox
-               public override void DrawPictureBox( Graphics dc, Rectangle clip, PictureBox pb )
-               {
-                       Rectangle client = pb.ClientRectangle;
-                       
-                       if ( pb.Image != null )
-                       {
-                               switch ( pb.SizeMode )
-                               {
-                                       case PictureBoxSizeMode.StretchImage:
-                                               dc.DrawImage( pb.Image, 0, 0, client.Width, client.Height );
-                                               break;
-                                               
-                                       case PictureBoxSizeMode.CenterImage:
-                                               dc.DrawImage( pb.Image, ( client.Width / 2 ) - ( pb.Image.Width / 2 ), ( client.Height / 2 ) - ( pb.Image.Height / 2 ) );
-                                               break;
-                                       default:
-                                               // Normal, AutoSize
-                                               dc.DrawImage( pb.Image, 0, 0, pb.Image.Width, pb.Image.Height );
-                                               break;
-                               }
-                       }
-                       CPDrawBorderStyle( dc, client, pb.BorderStyle );
-               }
-               
-               public override Size PictureBoxDefaultSize
-               {
-                       get {
-                               return new Size( 100, 50 );
-                       }
-               }
-               #endregion      // PictureBox
-               
-               #region ProgressBar
-//             public override void DrawProgressBar (Graphics dc, Rectangle clip_rect, ProgressBar ctrl)
-//             {
-//                     Rectangle       block_rect;
-//                     Rectangle       client_area = ctrl.client_area;
-//                     int             space_betweenblocks     = 2;
-//                     int             block_width;
-//                     int             increment;
-//                     int             barpos_pixels;
-//
-//                     block_width = ((client_area.Height) * 2 ) / 3;
-//                     barpos_pixels = ((ctrl.Value - ctrl.Minimum) * client_area.Width) / (ctrl.Maximum - ctrl.Minimum);
-//                     increment = block_width + space_betweenblocks;
-//
-//                     /* Draw border */
-//                     CPDrawBorder3D (dc, ctrl.ClientRectangle, Border3DStyle.SunkenInner, Border3DSide.All & ~Border3DSide.Middle, ColorButtonFace);
-//
-//                     /* Draw Blocks */
-//                     block_rect = new Rectangle (client_area.X, client_area.Y, block_width, client_area.Height);
-//                     while ((block_rect.X - client_area.X) < barpos_pixels) {
-//
-//                             if (clip_rect.IntersectsWith (block_rect) == true) {
-//                                     dc.FillRectangle (ResPool.GetSolidBrush (progressbarblock_color), block_rect);
-//                             }
-//
-//                             block_rect.X  += increment;
-//                     }
-//             }
-               
-               public override void DrawProgressBar( Graphics dc, Rectangle clip_rect, ProgressBar ctrl )
-               {
-                       Rectangle       block_rect;
-                       Rectangle       client_area = ctrl.client_area;
-                       int             space_betweenblocks     = 2;
-                       int             block_width;
-                       int             increment;
-                       int             barpos_pixels;
-                       
-                       block_width = ( ( client_area.Height ) * 2 ) / 3;
-                       barpos_pixels = ( ( ctrl.Value - ctrl.Minimum ) * client_area.Width ) / ( ctrl.Maximum - ctrl.Minimum );
-                       increment = block_width + space_betweenblocks;
-                       
-                       /* Draw border */
-                       CPDrawBorder3D( dc, ctrl.ClientRectangle, Border3DStyle.SunkenInner, Border3DSide.All & ~Border3DSide.Middle, ColorButtonFace );
-                       
-                       /* Draw Blocks */
-                       block_rect = new Rectangle( client_area.X, client_area.Y, block_width, client_area.Height );
-                       while ( ( block_rect.X - client_area.X ) < barpos_pixels )
-                       {
-                               
-                               if ( clip_rect.IntersectsWith( block_rect ) == true )
-                               {
-                                       dc.FillRectangle( ResPool.GetSolidBrush( progressbarblock_color ), block_rect );
-                               }
-                               
-                               block_rect.X  += increment;
-                       }
-               }
-               
-               public override Size ProgressBarDefaultSize
-               {
-                       get {
-                               return new Size( 100, 23 );
-                       }
-               }
-               
-               #endregion      // ProgressBar
-               
-               #region RadioButton
-               public override void DrawRadioButton( Graphics dc, Rectangle clip_rectangle, RadioButton radio_button )
-               {
-                       StringFormat    text_format;
-                       Rectangle       client_rectangle;
-                       Rectangle       text_rectangle;
-                       Rectangle       radiobutton_rectangle;
-                       SolidBrush      sb;
-                       int             radiobutton_size = 12;
-                       int     radiobutton_space = 4;
-                       
-                       client_rectangle = radio_button.ClientRectangle;
-                       text_rectangle = client_rectangle;
-                       radiobutton_rectangle = new Rectangle( text_rectangle.X, text_rectangle.Y, radiobutton_size, radiobutton_size );
-                       
-                       text_format = new StringFormat( );
-                       text_format.Alignment = StringAlignment.Near;
-                       text_format.LineAlignment = StringAlignment.Center;
-                       text_format.HotkeyPrefix = HotkeyPrefix.Show;
-                       
-                       /* Calculate the position of text and checkbox rectangle */
-                       if ( radio_button.appearance != Appearance.Button )
-                       {
-                               switch ( radio_button.radiobutton_alignment )
-                               {
-                                       case ContentAlignment.BottomCenter: {
-                                                       radiobutton_rectangle.X = ( client_rectangle.Right - client_rectangle.Left ) / 2 - radiobutton_size / 2;
-                                                       radiobutton_rectangle.Y = client_rectangle.Bottom - radiobutton_size;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width;
-                                                       text_rectangle.Height = client_rectangle.Height - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.BottomLeft: {
-                                                       radiobutton_rectangle.X = client_rectangle.Left;
-                                                       radiobutton_rectangle.Y = client_rectangle.Bottom - radiobutton_size;
-                                                       text_rectangle.X = client_rectangle.X + radiobutton_size + radiobutton_space;
-                                                       text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.BottomRight: {
-                                                       radiobutton_rectangle.X = client_rectangle.Right - radiobutton_size;
-                                                       radiobutton_rectangle.Y = client_rectangle.Bottom - radiobutton_size;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.MiddleCenter: {
-                                                       radiobutton_rectangle.X = ( client_rectangle.Right - client_rectangle.Left ) / 2 - radiobutton_size / 2;
-                                                       radiobutton_rectangle.Y = ( client_rectangle.Bottom - client_rectangle.Top ) / 2 - radiobutton_size / 2;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width;
-                                                       break;
-                                               }
-                                               
-                                       default:
-                                       case ContentAlignment.MiddleLeft: {
-                                                       radiobutton_rectangle.X = client_rectangle.Left;
-                                                       radiobutton_rectangle.Y = ( client_rectangle.Bottom - client_rectangle.Top ) / 2 - radiobutton_size / 2;
-                                                       text_rectangle.X = client_rectangle.X + radiobutton_size + radiobutton_space;
-                                                       text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.MiddleRight: {
-                                                       radiobutton_rectangle.X = client_rectangle.Right - radiobutton_size;
-                                                       radiobutton_rectangle.Y = ( client_rectangle.Bottom - client_rectangle.Top ) / 2 - radiobutton_size / 2;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopCenter: {
-                                                       radiobutton_rectangle.X = ( client_rectangle.Right - client_rectangle.Left ) / 2 - radiobutton_size / 2;
-                                                       radiobutton_rectangle.Y = client_rectangle.Top;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Y = radiobutton_size + radiobutton_space;
-                                                       text_rectangle.Width = client_rectangle.Width;
-                                                       text_rectangle.Height = client_rectangle.Height - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopLeft: {
-                                                       radiobutton_rectangle.X = client_rectangle.Left;
-                                                       radiobutton_rectangle.Y = client_rectangle.Top;
-                                                       text_rectangle.X = client_rectangle.X + radiobutton_size + radiobutton_space;
-                                                       text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                                               
-                                       case ContentAlignment.TopRight: {
-                                                       radiobutton_rectangle.X = client_rectangle.Right - radiobutton_size;
-                                                       radiobutton_rectangle.Y = client_rectangle.Top;
-                                                       text_rectangle.X = client_rectangle.X;
-                                                       text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space;
-                                                       break;
-                                               }
-                               }
-                       }
-                       else
-                       {
-                               text_rectangle.X = client_rectangle.X;
-                               text_rectangle.Width = client_rectangle.Width;
-                       }
-                       
-                       /* Set the horizontal alignment of our text */
-                       switch ( radio_button.text_alignment )
-                       {
-                               case ContentAlignment.BottomLeft:
-                               case ContentAlignment.MiddleLeft:
-                               case ContentAlignment.TopLeft: {
-                                               text_format.Alignment = StringAlignment.Near;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.BottomCenter:
-                               case ContentAlignment.MiddleCenter:
-                               case ContentAlignment.TopCenter: {
-                                               text_format.Alignment = StringAlignment.Center;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.BottomRight:
-                               case ContentAlignment.MiddleRight:
-                               case ContentAlignment.TopRight: {
-                                               text_format.Alignment = StringAlignment.Far;
-                                               break;
-                                       }
-                       }
-                       
-                       /* Set the vertical alignment of our text */
-                       switch ( radio_button.text_alignment )
-                       {
-                               case ContentAlignment.TopLeft:
-                               case ContentAlignment.TopCenter:
-                               case ContentAlignment.TopRight: {
-                                               text_format.LineAlignment = StringAlignment.Near;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.BottomLeft:
-                               case ContentAlignment.BottomCenter:
-                               case ContentAlignment.BottomRight: {
-                                               text_format.LineAlignment = StringAlignment.Far;
-                                               break;
-                                       }
-                                       
-                               case ContentAlignment.MiddleLeft:
-                               case ContentAlignment.MiddleCenter:
-                               case ContentAlignment.MiddleRight: {
-                                               text_format.LineAlignment = StringAlignment.Center;
-                                               break;
-                                       }
-                       }
-                       
-                       ButtonState state = ButtonState.Normal;
-                       if ( radio_button.FlatStyle == FlatStyle.Flat )
-                       {
-                               state |= ButtonState.Flat;
-                       }
-                       
-                       if ( radio_button.Checked )
-                       {
-                               state |= ButtonState.Checked;
-                       }
-                       
-                       // Start drawing
-                       
-                       sb = new SolidBrush( radio_button.BackColor );
-                       dc.FillRectangle( sb, radio_button.ClientRectangle );
-                       sb.Dispose( );
-                       
-                       
-                       
-                       if ( radio_button.appearance == Appearance.Button )
-                       {
-                               if ( radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup )
-                               {
-                                       DrawFlatStyleButton( dc, radio_button.ClientRectangle, radio_button );
-                               }
-                               else
-                               {
-                                       CPDrawButton( dc, radio_button.ClientRectangle, state );
-                               }
-                       }
-                       else
-                       {
-                               // establish if we are rendering a flat style of some sort
-                               if ( radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup )
-                               {
-                                       DrawFlatStyleRadioButton( dc, radiobutton_rectangle, radio_button );
-                               }
-                               else
-                               {
-                                       ControlPaint.DrawRadioButton( dc, radiobutton_rectangle, state );
-                               }
-                       }
-                       
-                       // offset the text if it's pressed and a button
-                       if ( radio_button.Appearance == Appearance.Button )
-                       {
-                               if ( radio_button.Checked || ( radio_button.Capture && radio_button.FlatStyle != FlatStyle.Flat ) )
-                               {
-                                       text_rectangle.X ++;
-                                       text_rectangle.Y ++;
-                               }
-                               
-                               text_rectangle.Inflate( -4, -4 );
-                       }
-                       
-                       /* Place the text; to be compatible with Windows place it after the radiobutton has been drawn */
-                       dc.DrawString( radio_button.Text, radio_button.Font, ThemeEngine.Current.ResPool.GetSolidBrush( radio_button.ForeColor ), text_rectangle, text_format );
-                       
-                       if ( radio_button.Enabled )
-                       {
-                               sb = ResPool.GetSolidBrush( radio_button.ForeColor );
-                               dc.DrawString( radio_button.Text, radio_button.Font, sb, text_rectangle, text_format );
-                       }
-                       else if ( radio_button.FlatStyle == FlatStyle.Flat )
-                       {
-                               dc.DrawString( radio_button.Text, radio_button.Font, ResPool.GetSolidBrush( ControlPaint.DarkDark( this.ColorButtonFace ) ), text_rectangle, text_format );
-                       }
-                       else
-                       {
-                               CPDrawStringDisabled( dc, radio_button.Text, radio_button.Font, this.ColorButtonText, text_rectangle, text_format );
-                       }
-                       
-                       if ( radio_button.Focused )
-                       {
-                               if ( radio_button.FlatStyle != FlatStyle.Flat )
-                               {
-                                       DrawInnerFocusRectangle( dc, text_rectangle, radio_button.BackColor );
-                               }
-                               else
-                               {
-                                       dc.DrawRectangle( ResPool.GetPen( radio_button.ForeColor ), text_rectangle );
-                               }
-                       }
-               }
-               
-               // renders a radio button with the Flat and Popup FlatStyle
-               private void DrawFlatStyleRadioButton( Graphics graphics, Rectangle rectangle, RadioButton radio_button )
-               {
-                       int     lineWidth;
-                       
-                       if ( radio_button.Enabled )
-                       {
-                               // draw the outer flatstyle arcs
-                               if ( radio_button.FlatStyle == FlatStyle.Flat )
-                               {
-                                       graphics.DrawArc( ResPool.GetPen( radio_button.ForeColor ), rectangle, 0, 359 );
-                                       
-                                       // fill in the area depending on whether or not the mouse is hovering
-                                       if ( radio_button.is_entered && radio_button.Capture )
-                                       {
-                                               graphics.FillPie( ResPool.GetSolidBrush( ControlPaint.Light( radio_button.BackColor ) ), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359 );
-                                       }
-                                       else
-                                       {
-                                               graphics.FillPie( ResPool.GetSolidBrush( ControlPaint.LightLight( radio_button.BackColor ) ), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359 );
-                                       }
-                               }
-                               else
-                               {
-                                       // must be a popup radio button
-                                       // fill the control
-                                       graphics.FillPie( ResPool.GetSolidBrush( ControlPaint.LightLight( radio_button.BackColor ) ), rectangle, 0, 359 );
-                                       
-                                       if ( radio_button.is_entered || radio_button.Capture )
-                                       {
-                                               // draw the popup 3d button knob
-                                               graphics.DrawArc( ResPool.GetPen( ControlPaint.Light( radio_button.BackColor ) ), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359 );
-                                               
-                                               graphics.DrawArc( ResPool.GetPen( ControlPaint.Dark( radio_button.BackColor ) ), rectangle, 135, 180 );
-                                               
-                                               graphics.DrawArc( ResPool.GetPen( ControlPaint.LightLight( radio_button.BackColor ) ), rectangle, 315, 180 );
-                                               
-                                       }
-                                       else
-                                       {
-                                               // just draw lighter flatstyle outer circle
-                                               graphics.DrawArc( ResPool.GetPen( ControlPaint.Dark( this.ColorButtonFace ) ), rectangle, 0, 359 );
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               // disabled
-                               // fill control background color regardless of actual backcolor
-                               graphics.FillPie( ResPool.GetSolidBrush( this.ColorButtonFace ), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359 );
-                               // draw the ark as control dark
-                               graphics.DrawArc( ResPool.GetPen( ControlPaint.Dark( this.ColorButtonFace ) ), rectangle, 0, 359 );
-                       }
-                       
-                       // draw the check
-                       lineWidth = Math.Max( 1, Math.Min( rectangle.Width, rectangle.Height ) / 3 );
-                       if ( radio_button.Checked )
-                       {
-                               SolidBrush buttonBrush;
-                               
-                               if ( !radio_button.Enabled )
-                               {
-                                       buttonBrush = ResPool.GetSolidBrush( ControlPaint.Dark( this.ColorButtonFace ) );
-                               }
-                               else if ( radio_button.FlatStyle == FlatStyle.Popup && radio_button.is_entered && radio_button.Capture )
-                               {
-                                       buttonBrush = ResPool.GetSolidBrush( this.ColorButtonText );
-                               }
-                               else
-                               {
-                                       buttonBrush = ResPool.GetSolidBrush( radio_button.ForeColor );
-                               }
-                               graphics.FillPie( buttonBrush, rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2, 0, 359 );
-                       }
-               }
-               
-               public override Size RadioButtonDefaultSize
-               {
-                       get {
-                               return new Size( 104, 24 );
-                       }
-               }
-               #endregion      // RadioButton
-               
-               #region ScrollBar
-               public override void DrawScrollBar( Graphics dc, Rectangle clip, ScrollBar bar )
-               {
-                       int             scrollbutton_width = bar.scrollbutton_width;
-                       int             scrollbutton_height = bar.scrollbutton_height;
-                       Rectangle       first_arrow_area;
-                       Rectangle       second_arrow_area;
-                       Rectangle       thumb_pos;
-                       
-                       thumb_pos = bar.ThumbPos;
-                       
-                       // FIXME: there seems to be a bug in ScrollBar, when firstbutton or secondbutton is pressed; the clip rectangle is to small
-                       // this results in artefacts on one side of the thumb
-                       
-                       if ( bar.vert )
-                       {
-                               first_arrow_area = new Rectangle( 0, 0, bar.Width, scrollbutton_height );
-                               bar.FirstArrowArea = first_arrow_area;
-                               
-                               second_arrow_area = new Rectangle( 0, bar.ClientRectangle.Height - scrollbutton_height, bar.Width, scrollbutton_height );
-                               bar.SecondArrowArea = second_arrow_area;
-                               
-                               thumb_pos.Width = bar.Width;
-                               bar.ThumbPos = thumb_pos;
-                               
-                               /* Buttons */
-                               if ( clip.IntersectsWith( first_arrow_area ) )
-                                       CPDrawScrollButton( dc, first_arrow_area, ScrollButton.Up, bar.firstbutton_state );
-                               if ( clip.IntersectsWith( second_arrow_area ) )
-                                       CPDrawScrollButton( dc, second_arrow_area, ScrollButton.Down, bar.secondbutton_state );
-                               
-                               /* Background */
-                               switch ( bar.thumb_moving   )
-                               {
-                                       case ScrollBar.ThumbMoving.None: {
-                                                       Rectangle r = new Rectangle( 0,
-                                                                                   scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
-                                                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                                                       
-                                                       if ( intersect != Rectangle.Empty  )
-                                                       {
-                                                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
-                                                               {
-                                                                       dc.FillRectangle( lgbr, intersect );
-                                                               }
-                                                       }
-                                                       break;
-                                               }
-                                       case ScrollBar.ThumbMoving.Forward: {
-                                                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
-                                                                                   bar.ClientRectangle.Width, thumb_pos.Y  - scrollbutton_height );
-                                                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                                                       
-                                                       LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White );
-                                                       
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       r.X = 0;
-                                                       r.Y = thumb_pos.Y + thumb_pos.Height;
-                                                       r.Width = bar.ClientRectangle.Width;
-                                                       r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
-                                                       
-                                                       intersect = Rectangle.Intersect( clip, r );
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       lgbr.Dispose( );
-                                                       
-                                                       break;
-                                               }
-                                               
-                                       case ScrollBar.ThumbMoving.Backwards: {
-                                                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
-                                                                                   bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
-                                                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                                                       
-                                                       LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White );
-                                                       
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       r.X = 0;
-                                                       r.Y = thumb_pos.Y + thumb_pos.Height;
-                                                       r.Width = bar.ClientRectangle.Width;
-                                                       r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
-                                                       
-                                                       intersect = Rectangle.Intersect( clip, r );
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       lgbr.Dispose( );
-                                                       
-                                                       break;
-                                               }
-                                               
-                                       default:
-                                               break;
-                               }
-                       }
-                       else
-                       {
-                               first_arrow_area = new Rectangle( 0, 0, scrollbutton_width, bar.Height );
-                               bar.FirstArrowArea = first_arrow_area;
-                               
-                               second_arrow_area = new Rectangle( bar.ClientRectangle.Width - scrollbutton_width, 0, scrollbutton_width, bar.Height );
-                               bar.SecondArrowArea = second_arrow_area;
-                               
-                               thumb_pos.Height = bar.Height;
-                               bar.ThumbPos = thumb_pos;
-                               
-                               /* Buttons */
-                               if ( clip.IntersectsWith( first_arrow_area ) )
-                                       CPDrawScrollButton( dc, first_arrow_area, ScrollButton.Left, bar.firstbutton_state );
-                               if ( clip.IntersectsWith( second_arrow_area ) )
-                                       CPDrawScrollButton( dc, second_arrow_area, ScrollButton.Right, bar.secondbutton_state );
-                               
-                               /* Background */
-                               switch ( bar.thumb_moving )
-                               {
-                                       case ScrollBar.ThumbMoving.None: {
-                                                       Rectangle r = new Rectangle( scrollbutton_width,
-                                                                                   0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
-                                                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                                                       
-                                                       if ( intersect != Rectangle.Empty )
-                                                       {
-                                                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
-                                                               {
-                                                                       dc.FillRectangle( lgbr, intersect );
-                                                               }
-                                                       }
-                                                       break;
-                                               }
-                                               
-                                       case ScrollBar.ThumbMoving.Forward: {
-                                                       Rectangle r = new Rectangle( scrollbutton_width,  0,
-                                                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
-                                                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                                                       
-                                                       LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White );
-                                                       
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       r.X = thumb_pos.X + thumb_pos.Width;
-                                                       r.Y = 0;
-                                                       r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
-                                                       r.Height = bar.ClientRectangle.Height;
-                                                       
-                                                       intersect = Rectangle.Intersect( clip, r );
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       lgbr.Dispose( );
-                                                       
-                                                       break;
-                                               }
-                                               
-                                       case ScrollBar.ThumbMoving.Backwards: {
-                                                       Rectangle r = new Rectangle( scrollbutton_width,  0,
-                                                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
-                                                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                                                       
-                                                       LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White );
-                                                       
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       r.X = thumb_pos.X + thumb_pos.Width;
-                                                       r.Y = 0;
-                                                       r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
-                                                       r.Height = bar.ClientRectangle.Height;
-                                                       
-                                                       intersect = Rectangle.Intersect( clip, r );
-                                                       if ( intersect != Rectangle.Empty )
-                                                               dc.FillRectangle( lgbr, intersect );
-                                                       
-                                                       lgbr.Dispose( );
-                                                       break;
-                                               }
-                               }
-                       }
-                       
-                       /* Thumb */
-                       if ( bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith( thumb_pos ) )
-                               DrawScrollBarThumb( dc, thumb_pos, bar );
-               }
-               
-               public override int ScrollBarButtonSize
-               {
-                       get { return 16; }
-               }
-               #endregion      // ScrollBar
-               
-               #region StatusBar
-               public  override void DrawStatusBar( Graphics dc, Rectangle clip, StatusBar sb )
-               {
-                       Rectangle area = sb.ClientRectangle;
-                       int horz_border = 2;
-                       int vert_border = 2;
-                       
-                       dc.FillRectangle( GetControlBackBrush( sb.BackColor ), clip );
-                       
-                       if ( sb.Panels.Count == 0 && sb.Text != String.Empty )
-                       {
-                               string text = sb.Text;
-                               StringFormat string_format = new StringFormat( );
-                               string_format.Trimming = StringTrimming.Character;
-                               string_format.FormatFlags = StringFormatFlags.NoWrap;
-                               
-                               if ( text[ 0 ] == '\t' )
-                               {
-                                       string_format.Alignment = StringAlignment.Center;
-                                       text = text.Substring( 1 );
-                                       if ( text[ 0 ] == '\t' )
-                                       {
-                                               string_format.Alignment = StringAlignment.Far;
-                                               text = text.Substring( 1 );
-                                       }
-                               }
-                               
-                               dc.DrawString( text, sb.Font, ResPool.GetSolidBrush( sb.ForeColor ),
-                                             new Rectangle( area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4 ), string_format );
-                       }
-                       else if ( sb.ShowPanels )
-                       {
-                               SolidBrush br_forecolor = GetControlForeBrush( sb.ForeColor );
-                               int prev_x = area.X + horz_border;
-                               int y = area.Y + vert_border;
-                               for ( int i = 0; i < sb.Panels.Count; i++ )
-                               {
-                                       Rectangle pr = new Rectangle( prev_x, y,
-                                                                    sb.Panels[ i ].Width, area.Height );
-                                       prev_x += pr.Width + StatusBarHorzGapWidth;
-                                       if ( pr.IntersectsWith( clip ) )
-                                               DrawStatusBarPanel( dc, pr, i, br_forecolor, sb.Panels[ i ] );
-                               }
-                       }
-                       
-                       if ( sb.SizingGrip )
-                               CPDrawSizeGrip( dc, ColorButtonFace, area );
-                       
-               }
-               
-               
-               private void DrawStatusBarPanel( Graphics dc, Rectangle area, int index,
-                                               SolidBrush br_forecolor, StatusBarPanel panel )
-               {
-                       int border_size = 3; // this is actually const, even if the border style is none
-                       
-                       area.Height -= border_size;
-                       if ( panel.BorderStyle != StatusBarPanelBorderStyle.None )
-                       {
-                               Border3DStyle border_style = Border3DStyle.SunkenInner;
-                               if ( panel.BorderStyle == StatusBarPanelBorderStyle.Raised )
-                                       border_style = Border3DStyle.RaisedOuter;
-                               CPDrawBorder3D( dc, area, border_style, Border3DSide.All, ColorButtonFace );
-                       }
-                       
-                       if ( panel.Style == StatusBarPanelStyle.OwnerDraw )
-                       {
-                               StatusBarDrawItemEventArgs e = new StatusBarDrawItemEventArgs(
-                                       dc, panel.Parent.Font, area, index, DrawItemState.Default,
-                                       panel, panel.Parent.ForeColor, panel.Parent.BackColor );
-                               panel.Parent.OnDrawItemInternal( e );
-                               return;
-                       }
-                       
-                       int left = area.Left;
-                       if ( panel.Icon != null )
-                       {
-                               left += 2;
-                               dc.DrawIcon( panel.Icon, left, area.Top );
-                               left += panel.Icon.Width;
-                       }
-                       
-                       if ( panel.Text == String.Empty )
-                               return;
-                       
-                       string text = panel.Text;
-                       StringFormat string_format = new StringFormat( );
-                       string_format.Trimming = StringTrimming.Character;
-                       string_format.FormatFlags = StringFormatFlags.NoWrap;
-                       
-                       if ( text[ 0 ] == '\t' )
-                       {
-                               string_format.Alignment = StringAlignment.Center;
-                               text = text.Substring( 1 );
-                               if ( text[ 0 ] == '\t' )
-                               {
-                                       string_format.Alignment = StringAlignment.Far;
-                                       text = text.Substring( 1 );
-                               }
-                       }
-                       
-                       int x = left + border_size;
-                       int y = border_size + 2;
-                       Rectangle r = new Rectangle( x, y,
-                                                   area.Right - x - border_size,
-                                                   area.Bottom - y - border_size );
-                       
-                       dc.DrawString( text, panel.Parent.Font, br_forecolor, r, string_format );
-               }
-               
-               public override int StatusBarSizeGripWidth
-               {
-                       get { return 15; }
-               }
-               
-               public override int StatusBarHorzGapWidth
-               {
-                       get { return 3; }
-               }
-               
-               public override Size StatusBarDefaultSize
-               {
-                       get {
-                               return new Size( 100, 22 );
-                       }
-               }
-               #endregion      // StatusBar
-               
-               public override void DrawTabControl( Graphics dc, Rectangle area, TabControl tab )
-               {
-                       // Do we need to fill the back color? It can't be changed...
-                       dc.FillRectangle( GetControlBackBrush( tab.BackColor ), area );
-                       Rectangle panel_rect = GetTabPanelRectExt( tab );
-                       
-                       if ( tab.Appearance == TabAppearance.Normal )
-                       {
-                               CPDrawBorder( dc, panel_rect, BorderColor, 1, ButtonBorderStyle.Solid, BorderColor, 1, ButtonBorderStyle.Solid,
-                                            BorderColor, 1, ButtonBorderStyle.Solid, BorderColor, 1, ButtonBorderStyle.Solid );
-                       }
-                       
-                       if ( tab.Alignment == TabAlignment.Top )
-                       {
-                               for ( int r = tab.TabPages.Count; r > 0; r-- )
-                               {
-                                       for ( int i = tab.SliderPos; i < tab.TabPages.Count; i++ )
-                                       {
-                                               if ( i == tab.SelectedIndex )
-                                                       continue;
-                                               if ( r != tab.TabPages[ i ].Row )
-                                                       continue;
-                                               Rectangle rect = tab.GetTabRect( i );
-                                               if ( !rect.IntersectsWith( area ) )
-                                                       continue;
-                                               DrawTab( dc, tab.TabPages[ i ], tab, rect, false );
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               for ( int r = 0; r < tab.TabPages.Count; r++ )
-                               {
-                                       for ( int i = tab.SliderPos; i < tab.TabPages.Count; i++ )
-                                       {
-                                               if ( i == tab.SelectedIndex )
-                                                       continue;
-                                               if ( r != tab.TabPages[ i ].Row )
-                                                       continue;
-                                               Rectangle rect = tab.GetTabRect( i );
-                                               if ( !rect.IntersectsWith( area ) )
-                                                       continue;
-                                               DrawTab( dc, tab.TabPages[ i ], tab, rect, false );
-                                       }
-                               }
-                       }
-                       
-                       if ( tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos )
-                       {
-                               Rectangle rect = tab.GetTabRect( tab.SelectedIndex );
-                               if ( rect.IntersectsWith( area ) )
-                                       DrawTab( dc, tab.TabPages[ tab.SelectedIndex ], tab, rect, true );
-                       }
-                       
-                       if ( tab.ShowSlider )
-                       {
-                               Rectangle right = GetTabControlRightScrollRect( tab );
-                               Rectangle left = GetTabControlLeftScrollRect( tab );
-                               CPDrawScrollButton( dc, right, ScrollButton.Right, tab.RightSliderState );
-                               CPDrawScrollButton( dc, left, ScrollButton.Left, tab.LeftSliderState );
-                       }
-               }
-               
-               public override Rectangle GetTabControlLeftScrollRect( TabControl tab )
-               {
-                       switch ( tab.Alignment )
-                       {
-                               case TabAlignment.Top:
-                                       return new Rectangle( tab.ClientRectangle.Right - 34, tab.ClientRectangle.Top + 1, 17, 17 );
-                               default:
-                                       Rectangle panel_rect = GetTabPanelRectExt( tab );
-                                       return new Rectangle( tab.ClientRectangle.Right - 34, panel_rect.Bottom + 2, 17, 17 );
-                       }
-               }
-               
-               public override Rectangle GetTabControlRightScrollRect( TabControl tab )
-               {
-                       switch ( tab.Alignment )
-                       {
-                               case TabAlignment.Top:
-                                       return new Rectangle( tab.ClientRectangle.Right - 17, tab.ClientRectangle.Top + 1, 17, 17 );
-                               default:
-                                       Rectangle panel_rect = GetTabPanelRectExt( tab );
-                                       return new Rectangle( tab.ClientRectangle.Right - 17, panel_rect.Bottom + 2, 17, 17 );
-                       }
-               }
-               
-               public override Size TabControlDefaultItemSize
-               {
-                       get { return new Size( 42, 21 ); }
-               }
-               
-               public override Point TabControlDefaultPadding
-               {
-                       get { return new Point( 6, 3 ); }
-               }
-               
-               public override int TabControlMinimumTabWidth
-               {
-                       get { return 42; }
-               }
-               
-               public override Rectangle GetTabControlDisplayRectangle( TabControl tab )
-               {
-                       Rectangle ext = GetTabPanelRectExt( tab );
-                       // Account for border size
-                       return new Rectangle( ext.Left + 2, ext.Top + 1, ext.Width - 6, ext.Height - 4 );
-               }
-               
-               public override Size TabControlGetSpacing( TabControl tab )
-               {
-                       switch ( tab.Appearance )
-                       {
-                               case TabAppearance.Normal:
-                                       return new Size( 1, -2 );
-                               case TabAppearance.Buttons:
-                                       return new Size( 3, 3 );
-                               case TabAppearance.FlatButtons:
-                                       return new Size( 9, 3 );
-                               default:
-                                       throw new Exception( "Invalid Appearance value: " + tab.Appearance );
-                       }
-               }
-               
-               private Rectangle GetTabPanelRectExt( TabControl tab )
-               {
-                       // Offset the tab from the top corner
-                       Rectangle res = new Rectangle( tab.ClientRectangle.X + 2,
-                                                     tab.ClientRectangle.Y,
-                                                     tab.ClientRectangle.Width - 2,
-                                                     tab.ClientRectangle.Height - 1 );
-                       
-                       if ( tab.TabCount == 0 )
-                               return res;
-                       
-                       int spacing = TabControlGetSpacing( tab ).Height;
-                       int offset = ( tab.ItemSize.Height + spacing ) * tab.RowCount + 3;
-                       
-                       switch ( tab.Alignment )
-                       {
-                               case TabAlignment.Left:
-                                       res.X += offset;
-                                       res.Width -= offset;
-                                       break;
-                               case TabAlignment.Right:
-                                       res.Width -= offset;
-                                       break;
-                               case TabAlignment.Top:
-                                       res.Y += offset;
-                                       res.Height -= offset;
-                                       break;
-                               case TabAlignment.Bottom:
-                                       res.Height -= offset;
-                                       break;
-                       }
-                       
-                       return res;
-               }
-               
-               private int DrawTab( Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected )
-               {
-                       int FlatButtonSpacing = 8;
-                       Rectangle interior;
-                       int res = bounds.Width;
-                       
-                       // we can't fill the background right away because the bounds might be adjusted if the tab is selected
-                       
-                       if ( tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons )
-                       {
-                               
-                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-                               
-                               // Separators
-                               if ( tab.Appearance == TabAppearance.FlatButtons )
-                               {
-                                       int width = bounds.Width;
-                                       bounds.Width += ( FlatButtonSpacing - 2 );
-                                       res = bounds.Width;
-                                       CPDrawBorder3D( dc, bounds, Border3DStyle.Etched, Border3DSide.Right );
-                                       bounds.Width = width;
-                               }
-                               
-                               if ( is_selected )
-                               {
-                                       CPDrawBorder3D( dc, bounds, Border3DStyle.Sunken, Border3DSide.All );
-                               }
-                               else if ( tab.Appearance != TabAppearance.FlatButtons )
-                               {
-                                       CPDrawBorder3D( dc, bounds, Border3DStyle.Raised, Border3DSide.All );
-                               }
-                               
-                               interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 4, bounds.Height - 4 );
-                               
-                                
-                               StringFormat string_format = new StringFormat( );
-                               string_format.Alignment = StringAlignment.Center;
-                               string_format.LineAlignment = StringAlignment.Center;
-                               string_format.FormatFlags = StringFormatFlags.NoWrap;
-                               
-                               interior.Y++;
-                               dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
-                               interior.Y--;
-                       }
-                       else
-                       {
-                               Pen border_pen = ResPool.GetPen( BorderColor );
-                               
-                               switch ( tab.Alignment )
-                               {
-                                       case TabAlignment.Top:
-                                               
-                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-                                               
-                                               if ( !is_selected )
-                                               {
-                                                       interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
-                                                       
-                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2  ), new Point( bounds.Left + 2, bounds.Bottom ), Color.White, LightColor ) )
-                                                       {
-                                                               dc.FillRectangle( lgbr, interior );
-                                                       }
-                                               }
-                                               
-                                               dc.DrawLine( border_pen, bounds.Left, bounds.Bottom, bounds.Left, bounds.Top + 3 );
-                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top + 3, bounds.Left + 3, bounds.Top );
-                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Top, bounds.Right - 3, bounds.Top );
-                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3 );
-                                               dc.DrawLine( border_pen, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom );
-                                               
-                                               if ( page.Focused )
-                                               {
-                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left - 1 , bounds.Top, bounds.Right - 1, bounds.Top );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Top + 1, bounds.Right , bounds.Top + 1 );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Top + 2, bounds.Right , bounds.Top + 2 );
-                                               }
-                                               
-                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
-                                               
-                                               if ( page.Text != String.Empty )
-                                               {
-                                                       StringFormat string_format = new StringFormat( );
-                                                       string_format.Alignment = StringAlignment.Center;
-                                                       string_format.LineAlignment = StringAlignment.Center;
-                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
-                                                       interior.Y++;
-                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
-                                                       interior.Y--;
-                                               }
-                                               
-                                               break;
-                                               
-                                       case TabAlignment.Bottom:
-                                               
-                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-                                               
-                                               if ( !is_selected )
-                                               {
-                                                       interior = new Rectangle( bounds.Left + 3, bounds.Top, bounds.Width - 3, bounds.Height );
-                                                       
-                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 3, bounds.Top  ), new Point( bounds.Left + 3, bounds.Bottom  ), Color.White, LightColor ) )
-                                                       {
-                                                               dc.FillRectangle( lgbr, interior );
-                                                       }
-                                               }
-                                               
-                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 3 );
-                                               dc.DrawLine( border_pen, bounds.Left, bounds.Bottom - 3, bounds.Left + 3, bounds.Bottom );
-                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Bottom, bounds.Right - 3, bounds.Bottom );
-                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Bottom, bounds.Right, bounds.Bottom - 3 );
-                                               dc.DrawLine( border_pen, bounds.Right, bounds.Bottom - 3, bounds.Right, bounds.Top );
-                                               
-                                               if ( page.Focused )
-                                               {
-                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left - 1 , bounds.Bottom, bounds.Right - 1, bounds.Bottom );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Bottom - 1, bounds.Right , bounds.Bottom - 1 );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Bottom - 2, bounds.Right , bounds.Bottom - 2 );
-                                               }
-                                               
-                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
-                                               
-                                               if ( page.Text != String.Empty )
-                                               {
-                                                       StringFormat string_format = new StringFormat( );
-                                                       string_format.Alignment = StringAlignment.Center;
-                                                       string_format.LineAlignment = StringAlignment.Center;
-                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
-                                                       interior.Y++;
-                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
-                                                       interior.Y--;
-                                               }
-                                               
-                                               break;
-                                               
-                                       case TabAlignment.Left:
-                                               
-                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-                                               
-                                               if ( !is_selected )
-                                               {
-                                                       interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
-                                                       
-                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2  ), new Point( bounds.Right, bounds.Top + 2 ), LightColor, Color.White ) )
-                                                       {
-                                                               dc.FillRectangle( lgbr, interior );
-                                                       }
-                                               }
-                                               
-                                               dc.DrawLine( border_pen, bounds.Right, bounds.Top, bounds.Left + 3, bounds.Top );
-                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Top, bounds.Left, bounds.Top + 3 );
-                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top + 3, bounds.Left, bounds.Bottom - 3 );
-                                               dc.DrawLine( border_pen, bounds.Left, bounds.Bottom - 3, bounds.Left + 3, bounds.Bottom );
-                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Bottom, bounds.Right, bounds.Bottom );
-                                               
-                                               if ( page.Focused )
-                                               {
-                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left , bounds.Top + 1, bounds.Left , bounds.Bottom - 1 );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left + 1 , bounds.Top, bounds.Left + 1 , bounds.Bottom );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left + 2 , bounds.Top, bounds.Left + 2 , bounds.Bottom );
-                                               }
-                                               
-                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
-                                               
-                                               if ( page.Text != String.Empty )
-                                               {
-                                                       StringFormat string_format = new StringFormat( );
-                                                       // Flip the text around
-                                                       string_format.Alignment = StringAlignment.Center;
-                                                       string_format.LineAlignment = StringAlignment.Center;
-                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
-                                                       string_format.FormatFlags = StringFormatFlags.DirectionVertical;
-                                                       int wo = interior.Width / 2;
-                                                       int ho = interior.Height / 2;
-                                                       dc.TranslateTransform( interior.X + wo, interior.Y + ho );
-                                                       dc.RotateTransform( 180 );
-                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), 0, 0, string_format );
-                                                       dc.ResetTransform( );
-                                               }
-                                               
-                                               break;
-                                               
-                                       default:
-                                               // TabAlignment.Right
-                                               
-                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-                                               
-                                               if ( !is_selected )
-                                               {
-                                                       interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
-                                                       
-                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2  ), new Point( bounds.Right, bounds.Top + 2 ), Color.White, LightColor ) )
-                                                       {
-                                                               dc.FillRectangle( lgbr, interior );
-                                                       }
-                                               }
-                                               
-                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top, bounds.Right - 3, bounds.Top );
-                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3 );
-                                               dc.DrawLine( border_pen, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom - 3 );
-                                               dc.DrawLine( border_pen, bounds.Right, bounds.Bottom - 3, bounds.Right - 3, bounds.Bottom );
-                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Bottom, bounds.Left, bounds.Bottom );
-                                               
-                                               if ( page.Focused )
-                                               {
-                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Right , bounds.Top + 1, bounds.Right , bounds.Bottom - 1 );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Right - 1 , bounds.Top, bounds.Right - 1 , bounds.Bottom );
-                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Right - 2 , bounds.Top, bounds.Right - 2 , bounds.Bottom );
-                                               }
-                                               
-                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
-                                               
-                                               if ( page.Text != String.Empty )
-                                               {
-                                                       StringFormat string_format = new StringFormat( );
-                                                       string_format.Alignment = StringAlignment.Center;
-                                                       string_format.LineAlignment = StringAlignment.Center;
-                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
-                                                       string_format.FormatFlags = StringFormatFlags.DirectionVertical;
-                                                       interior.X++;
-                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
-                                                       interior.X--;
-                                               }
-                                               
-                                               break;
-                               }
-                       }
-                       
-                       return res;
-               }
-               
-               #region ToolBar
-               public  override void DrawToolBar( Graphics dc, Rectangle clip_rectangle, ToolBar control )
-               {
-                       StringFormat    format = new StringFormat( );
-                       format.Trimming = StringTrimming.EllipsisWord;
-                       if ( control.textAlignment == ToolBarTextAlign.Underneath )
-                       {
-                               format.LineAlignment = StringAlignment.Center;
-                               format.Alignment = StringAlignment.Center;
-                       }
-                       else
-                       {
-                               format.LineAlignment = StringAlignment.Center;
-                               format.Alignment = StringAlignment.Near;
-                       }
-                       
-                       // Exclude the area for divider
-                       Rectangle paint_area = new Rectangle( 0, ToolBarGripWidth / 2,
-                                                            control.Width, control.Height - ToolBarGripWidth / 2 );
-                       bool flat = ( control.Appearance == ToolBarAppearance.Flat );
-                       dc.FillRectangle( SystemBrushes.Control, paint_area );
-                       CPDrawBorderStyle( dc, paint_area, control.BorderStyle );
-                       
-                       if ( control.Divider )
-                       {
-                               dc.DrawLine( ResPool.GetPen( ColorButtonHilight ), 0, 0, paint_area.Width, 0 );
-                       }
-                       
-                       foreach ( ToolBarButton button in control.Buttons )
-                       {
-                               
-                               Image image = null;
-                               Rectangle buttonArea = button.Rectangle;
-                               Rectangle imgRect = Rectangle.Empty;  // rect to draw the image
-                               Rectangle txtRect = buttonArea;       // rect to draw the text
-                               Rectangle ddRect = Rectangle.Empty;   // rect for the drop down arrow
-                               
-                               // calculate different rects and draw the frame if its not separator button
-                               if ( button.Style != ToolBarButtonStyle.Separator )
-                               {
-                                       /* Adjustment for drop down arrow */
-                                       if ( button.Style == ToolBarButtonStyle.DropDownButton && control.DropDownArrows )
-                                       {
-                                               ddRect.X = buttonArea.X + buttonArea.Width - this.ToolBarDropDownWidth;
-                                               ddRect.Y = buttonArea.Y;
-                                               ddRect.Width = this.ToolBarDropDownWidth;
-                                               ddRect.Height = buttonArea.Height;
-                                       }
-                                       
-                                       // calculate txtRect and imgRect, if imageIndex and imageList are present
-                                       if ( button.ImageIndex > -1 && control.ImageList != null )
-                                       {
-                                               if ( button.ImageIndex < control.ImageList.Images.Count )
-                                                       image = control.ImageList.Images[ button.ImageIndex ];
-                                               // draw the image at the centre if textalignment is underneath
-                                               if ( control.TextAlign == ToolBarTextAlign.Underneath )
-                                               {
-                                                       imgRect.X = buttonArea.X + ( ( buttonArea.Width - ddRect.Width
-                                                               - control.ImageSize.Width ) / 2 )
-                                                               + this.ToolBarImageGripWidth;
-                                                       imgRect.Y = buttonArea.Y + this.ToolBarImageGripWidth;
-                                                       imgRect.Width = control.ImageSize.Width;
-                                                       imgRect.Height = control.ImageSize.Height;
-                                                       
-                                                       txtRect.X = buttonArea.X;
-                                                       txtRect.Y = buttonArea.Y + imgRect.Height + 2 * this.ToolBarImageGripWidth;
-                                                       txtRect.Width = buttonArea.Width - ddRect.Width;
-                                                       txtRect.Height = buttonArea.Height - imgRect.Height
-                                                               - 2 * this.ToolBarImageGripWidth;
-                                               }
-                                               else
-                                               {
-                                                       imgRect.X = buttonArea.X + this.ToolBarImageGripWidth;
-                                                       imgRect.Y = buttonArea.Y + this.ToolBarImageGripWidth;
-                                                       imgRect.Width = control.ImageSize.Width;
-                                                       imgRect.Height = control.ImageSize.Height;
-                                                       
-                                                       txtRect.X = buttonArea.X + imgRect.Width + 2 * this.ToolBarImageGripWidth;
-                                                       txtRect.Y = buttonArea.Y;
-                                                       txtRect.Width = buttonArea.Width - imgRect.Width
-                                                               - 2 * this.ToolBarImageGripWidth - ddRect.Width;
-                                                       txtRect.Height = buttonArea.Height;
-                                               }
-                                       }
-                                       /* Draw the button frame, only if it is not a separator */
-                                       if ( flat )
-                                       {
-                                               if ( button.Pushed || button.Pressed )
-                                               {
-                                                       CPDrawBorder3D( dc, buttonArea, Border3DStyle.SunkenOuter, Border3DSide.All, ColorButtonFace );
-                                               }
-                                               else if ( button.Hilight )
-                                               {
-                                                       Pen pen = ResPool.GetPen( ColorButtonText );
-                                                       dc.DrawRectangle( pen, buttonArea );
-                                                       if ( ! ddRect.IsEmpty )
-                                                       {
-                                                               dc.DrawLine( pen, ddRect.X, ddRect.Y, ddRect.X,
-                                                                           ddRect.Y + ddRect.Height );
-                                                               buttonArea.Width -= this.ToolBarDropDownWidth;
-                                                       }
-                                               }
-                                       }
-                                       else
-                                       { // normal toolbar
-                                               if ( button.Pushed || button.Pressed )
-                                               {
-                                                       CPDrawBorder3D( dc, buttonArea, Border3DStyle.SunkenInner,
-                                                                      Border3DSide.All, ColorButtonFace );
-                                                       if ( ! ddRect.IsEmpty )
-                                                       {
-                                                               CPDrawBorder3D( dc, ddRect, Border3DStyle.SunkenInner,
-                                                                              Border3DSide.Left, ColorButtonFace );
-                                                               buttonArea.Width -= this.ToolBarDropDownWidth;
-                                                       }
-                                               }
-                                               else
-                                               {
-                                                       CPDrawBorder3D( dc, buttonArea, Border3DStyle.RaisedInner,
-                                                                      Border3DSide.All, ColorButtonFace );
-                                                       if ( ! ddRect.IsEmpty )
-                                                       {
-                                                               CPDrawBorder3D( dc, ddRect, Border3DStyle.RaisedInner,
-                                                                              Border3DSide.Left, ColorButtonFace );
-                                                               buttonArea.Width -= this.ToolBarDropDownWidth;
-                                                       }
-                                               }
-                                       }
-                               }
-                               DrawToolBarButton( dc, button, control.Font, format, paint_area, buttonArea,
-                                                 imgRect, image, txtRect, ddRect, flat );
-                       }
-               }
-               
-               private void DrawToolBarButton( Graphics dc, ToolBarButton button, Font font, StringFormat format,
-                                              Rectangle controlArea, Rectangle buttonArea, Rectangle imgRect,
-                                              Image image, Rectangle txtRect, Rectangle ddRect, bool flat )
-               {
-                       if ( ! button.Visible )
-                               return;
-                       
-                       switch ( button.Style )
-                       {
-                                       
-                               case ToolBarButtonStyle.Separator:
-                                       // separator is drawn only in the case of flat appearance
-                                       if ( flat )
-                                       {
-                                               Pen cbs_pen = ResPool.GetPen( ColorButtonShadow );
-                                               Pen cbh_pen = ResPool.GetPen( ColorButtonHilight );
-                                               Pen cbf_pen = ResPool.GetPen( ColorButtonFace );
-                                               dc.DrawLine( cbs_pen, buttonArea.X + 1, buttonArea.Y,
-                                                           buttonArea.X + 1, buttonArea.Height );
-                                               
-                                               dc.DrawLine( cbh_pen, buttonArea.X + 1 + (int) cbf_pen.Width,
-                                                           buttonArea.Y, buttonArea.X + 1 + (int) cbf_pen.Width, buttonArea.Height );
-                                               /* draw a horizontal separator */
-                                               if ( button.Wrapper )
-                                               {
-                                                       int y = buttonArea.Height + this.ToolBarSeparatorWidth / 2;
-                                                       dc.DrawLine( cbs_pen, 0, y, controlArea.Width, y );
-                                                       dc.DrawLine( cbh_pen, 0, y + 1 + (int) cbf_pen.Width, controlArea.Width,
-                                                                   y + 1 + (int) cbf_pen.Width );
-                                               }
-                                       }
-                                       break;
-                                       
-                               case ToolBarButtonStyle.ToggleButton:
-                                       Rectangle toggleArea = Rectangle.Empty;
-                                       toggleArea.X = buttonArea.X + this.ToolBarImageGripWidth;
-                                       toggleArea.Y = buttonArea.Y + this.ToolBarImageGripWidth;
-                                       toggleArea.Width = buttonArea.Width - 2 * this.ToolBarImageGripWidth;
-                                       toggleArea.Height = buttonArea.Height - 2 * this.ToolBarImageGripWidth;
-                                       if ( button.PartialPush && button.Pushed )
-                                       {
-                                               dc.FillRectangle( SystemBrushes.ControlLightLight, toggleArea );
-                                               if ( ! imgRect.IsEmpty )
-                                               {
-                                                       if ( button.Enabled && image != null )
-                                                               button.Parent.ImageList.Draw( dc, imgRect.X, imgRect.Y, imgRect.Width,
-                                                                                            imgRect.Height, button.ImageIndex );
-                                                       else
-                                                       {
-                                                               dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( ColorGrayText ), imgRect );
-                                                               ControlPaint.DrawBorder3D( dc, imgRect, Border3DStyle.SunkenOuter,
-                                                                                         Border3DSide.Right | Border3DSide.Bottom );
-                                                       }
-                                               }
-                                               if ( button.Enabled )
-                                                       dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
-                                               else
-                                                       CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight, txtRect, format );
-                                       }
-                                       
-                                       else if ( button.PartialPush )
-                                       {
-                                               dc.FillRectangle( SystemBrushes.ControlLight, toggleArea );
-                                               if ( ! imgRect.IsEmpty )
-                                               {
-                                                       if ( button.Enabled && image != null )
-                                                               button.Parent.ImageList.Draw( dc, imgRect.X, imgRect.Y, imgRect.Width,
-                                                                                            imgRect.Height, button.ImageIndex );
-                                                       else
-                                                       {
-                                                               dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( ColorGrayText ), imgRect );
-                                                               ControlPaint.DrawBorder3D( dc, imgRect, Border3DStyle.SunkenOuter,
-                                                                                         Border3DSide.Right | Border3DSide.Bottom );
-                                                       }
-                                               }
-                                               if ( button.Enabled )
-                                                       dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
-                                               else
-                                                       CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight,
-                                                                            txtRect, format );
-                                       }
-                                       
-                                       else if ( button.Pushed )
-                                       {
-                                               dc.FillRectangle( SystemBrushes.ControlLightLight, toggleArea );
-                                               if ( ! imgRect.IsEmpty )
-                                               {
-                                                       if ( button.Enabled && image != null )
-                                                               button.Parent.ImageList.Draw( dc, imgRect.X, imgRect.Y, imgRect.Width,
-                                                                                            imgRect.Height, button.ImageIndex );
-                                                       else
-                                                       {
-                                                               dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( ColorGrayText ), imgRect );
-                                                               CPDrawBorder3D( dc, imgRect, Border3DStyle.SunkenOuter,
-                                                                              Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
-                                                       }
-                                               }
-                                               if ( button.Enabled )
-                                                       dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
-                                               else
-                                                       CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight,
-                                                                            txtRect, format );
-                                       }
-                                       
-                                       else
-                                       {
-                                               dc.FillRectangle( SystemBrushes.Control, toggleArea );
-                                               if ( ! imgRect.IsEmpty )
-                                               {
-                                                       if ( button.Enabled && image != null )
-                                                               button.Parent.ImageList.Draw( dc, imgRect.X, imgRect.Y, imgRect.Width,
-                                                                                            imgRect.Height, button.ImageIndex );
-                                                       else
-                                                       {
-                                                               dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( ColorGrayText ), imgRect );
-                                                               CPDrawBorder3D( dc, imgRect, Border3DStyle.SunkenOuter,
-                                                                              Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
-                                                       }
-                                               }
-                                               if ( button.Enabled )
-                                                       dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
-                                               else
-                                                       CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight,
-                                                                            txtRect, format );
-                                       }
-                                       break;
-                                       
-                               case ToolBarButtonStyle.DropDownButton:
-                                       // draw the dropdown arrow
-                                       if ( ! ddRect.IsEmpty )
-                                       {
-                                               PointF [] vertices = new PointF[ 3 ];
-                                               PointF ddCenter = new PointF( ddRect.X + ( ddRect.Width / 2.0f ), ddRect.Y + ( ddRect.Height / 2.0f ) );
-                                               vertices[ 0 ].X = ddCenter.X - this.ToolBarDropDownArrowWidth / 2.0f + 0.5f;
-                                               vertices[ 0 ].Y = ddCenter.Y;
-                                               vertices[ 1 ].X = ddCenter.X + this.ToolBarDropDownArrowWidth / 2.0f + 0.5f;
-                                               vertices[ 1 ].Y = ddCenter.Y;
-                                               vertices[ 2 ].X = ddCenter.X + 0.5f; // 0.5 is added for adjustment
-                                               vertices[ 2 ].Y = ddCenter.Y + this.ToolBarDropDownArrowHeight;
-                                               dc.FillPolygon( SystemBrushes.ControlText, vertices );
-                                       }
-                                       goto case ToolBarButtonStyle.PushButton;
-                                       
-                               case ToolBarButtonStyle.PushButton:
-                                       if ( ! imgRect.IsEmpty )
-                                       {
-                                               if ( button.Enabled && image != null )
-                                                       button.Parent.ImageList.Draw( dc, imgRect.X, imgRect.Y, imgRect.Width, imgRect.Height,
-                                                                                    button.ImageIndex );
-                                               else
-                                               {
-                                                       dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( ColorGrayText ), imgRect );
-                                                       CPDrawBorder3D( dc, imgRect, Border3DStyle.SunkenOuter,
-                                                                      Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
-                                               }
-                                       }
-                                       if ( button.Enabled )
-                                               dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
-                                       else
-                                               CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight,
-                                                                    txtRect, format );
-                                       break;
-                       }
-               }
-               
-               // Grip width for the ToolBar
-               public override int ToolBarGripWidth
-               {
-                       get { return 2;}
-               }
-               
-               // Grip width for the Image on the ToolBarButton
-               public override int ToolBarImageGripWidth
-               {
-                       get { return 2;}
-               }
-               
-               // width of the separator
-               public override int ToolBarSeparatorWidth
-               {
-                       get { return 4; }
-               }
-               
-               // width of the dropdown arrow rect
-               public override int ToolBarDropDownWidth
-               {
-                       get { return 13; }
-               }
-               
-               // width for the dropdown arrow on the ToolBarButton
-               public override int ToolBarDropDownArrowWidth
-               {
-                       get { return 5;}
-               }
-               
-               // height for the dropdown arrow on the ToolBarButton
-               public override int ToolBarDropDownArrowHeight
-               {
-                       get { return 3;}
-               }
-               
-               public override Size ToolBarDefaultSize
-               {
-                       get {
-                               return new Size( 100, 42 );
-                       }
-               }
-               #endregion      // ToolBar
-               
-               #region ToolTip
-               public override void DrawToolTip( Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control )
-               {
-                       dc.FillRectangle( ResPool.GetSolidBrush( this.ColorInfoWindow ), control.client_rect );
-                       dc.DrawRectangle( ResPool.GetPen( this.ColorWindowFrame ), 0, 0, control.Width - 1, control.Height - 1 );
-                       dc.DrawString( control.text, control.Font, ResPool.GetSolidBrush( this.ColorInfoText ), control.client_rect, control.string_format );
-               }
-               
-               public override Size ToolTipSize( ToolTip.ToolTipWindow tt, string text )
-               {
-                       SizeF   sizef;
-                       
-                       sizef = tt.DeviceContext.MeasureString( text, tt.Font );
-                       return new Size( (int)sizef.Width + 2, (int)sizef.Height + 3 );         // Need space for the border
-               }
-               #endregion      // ToolTip
-               
-               #region TrackBar
-               private void DrawTrackBar_Vertical( Graphics dc, Rectangle clip_rectangle, TrackBar tb,
-                                                  ref Rectangle thumb_pos, ref Rectangle thumb_area,  Brush br_thumb,
-                                                  float ticks, int value_pos, bool mouse_value )
-               {
-                       
-                       Point toptick_startpoint = new Point( );
-                       Point bottomtick_startpoint = new Point( );
-                       Point channel_startpoint = new Point( );
-                       float pixel_len;
-                       float pixels_betweenticks;
-                       const int space_from_right = 8;
-                       const int space_from_left = 8;
-                       Rectangle area = tb.ClientRectangle;
-                       
-                       switch ( tb.TickStyle )
-                       {
-                               case TickStyle.BottomRight:
-                               case TickStyle.None:
-                                       channel_startpoint.Y = 8;
-                                       channel_startpoint.X = 9;
-                                       bottomtick_startpoint.Y = 13;
-                                       bottomtick_startpoint.X = 24;
-                                       break;
-                               case TickStyle.TopLeft:
-                                       channel_startpoint.Y = 8;
-                                       channel_startpoint.X = 19;
-                                       toptick_startpoint.Y = 13;
-                                       toptick_startpoint.X = 8;
-                                       break;
-                               case TickStyle.Both:
-                                       channel_startpoint.Y = 8;
-                                       channel_startpoint.X = 18;
-                                       bottomtick_startpoint.Y = 13;
-                                       bottomtick_startpoint.X = 32;
-                                       toptick_startpoint.Y = 13;
-                                       toptick_startpoint.X = 8;
-                                       break;
-                               default:
-                                       break;
-                       }
-                       
-                       thumb_area.X = area.X + channel_startpoint.X;
-                       thumb_area.Y = area.Y + channel_startpoint.Y;
-                       thumb_area.Height = area.Height - space_from_right - space_from_left;
-                       thumb_area.Width = 4;
-                       
-                       /* Draw channel */
-                       dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonShadow ), channel_startpoint.X, channel_startpoint.Y,
-                                        1, thumb_area.Height );
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonDkShadow ), channel_startpoint.X + 1, channel_startpoint.Y,
-                                        1, thumb_area.Height );
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonHilight ), channel_startpoint.X + 3, channel_startpoint.Y,
-                                        1, thumb_area.Height );
-                       
-                       pixel_len = thumb_area.Height - 11;
-                       pixels_betweenticks = pixel_len / ( tb.Maximum - tb.Minimum );
-                       
-                       /* Convert thumb position from mouse position to value*/
-                       if ( mouse_value )
-                       {
-                               
-                               if ( value_pos >= channel_startpoint.Y )
-                                       value_pos = (int)( ( (float) ( value_pos - channel_startpoint.Y ) ) / pixels_betweenticks );
-                               else
-                                       value_pos = 0;
-                               
-                               if ( value_pos + tb.Minimum > tb.Maximum )
-                                       value_pos = tb.Maximum - tb.Minimum;
-                                
-                               tb.Value = value_pos + tb.Minimum;
-                       }
-                       
-                       thumb_pos.Y = channel_startpoint.Y + (int) ( pixels_betweenticks * (float) value_pos );
-                       
-                       /* Draw thumb fixed 10x22 size */
-                       thumb_pos.Width = 10;
-                       thumb_pos.Height = 22;
-                       
-                       switch ( tb.TickStyle )
-                       {
-                               case TickStyle.BottomRight:
-                               case TickStyle.None: {
-                                               thumb_pos.X = channel_startpoint.X - 8;
-                                               
-                                               Pen pen = ResPool.GetPen( ColorButtonHilight );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X , thumb_pos.Y + 10 );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y );
-                                               dc.DrawLine( pen, thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonShadow );
-                                               dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 15, thumb_pos.Y  + 9 );
-                                               dc.DrawLine( pen, thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X + 16 + 4, thumb_pos.Y  + 9 - 4 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonDkShadow );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y  + 10, thumb_pos.X + 16, thumb_pos.Y + 10 );
-                                               dc.DrawLine( pen, thumb_pos.X + 16, thumb_pos.Y  + 10, thumb_pos.X  + 16 + 5, thumb_pos.Y + 10 - 5 );
-                                               
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 16, 8 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 17, thumb_pos.Y + 2, 1, 6 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 18, thumb_pos.Y + 3, 1, 4 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 19, thumb_pos.Y + 4, 1, 2 );
-                                               
-                                               break;
-                                       }
-                               case TickStyle.TopLeft: {
-                                               thumb_pos.X = channel_startpoint.X - 10;
-                                               
-                                               Pen pen = ResPool.GetPen( ColorButtonHilight );
-                                               dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y );
-                                               dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonShadow );
-                                               dc.DrawLine( pen, thumb_pos.X  + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16 , thumb_pos.Y + 9 );
-                                               dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y  + 9, thumb_pos.X, thumb_pos.Y + 5 );
-                                               dc.DrawLine( pen, thumb_pos.X  + 19, thumb_pos.Y + 9, thumb_pos.X  + 19 , thumb_pos.Y + 1 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonDkShadow );
-                                               dc.DrawLine( pen, thumb_pos.X  + 4, thumb_pos.Y + 10, thumb_pos.X  + 4 + 16, thumb_pos.Y + 10 );
-                                               dc.DrawLine( pen, thumb_pos.X  + 4, thumb_pos.Y + 10, thumb_pos.X  - 1, thumb_pos.Y + 5 );
-                                               dc.DrawLine( pen, thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y + 10 );
-                                               
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 15, 8 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 1, 6 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 1, 4 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 1, 2 );
-                                               
-                                               break;
-                                       }
-                                       
-                               case TickStyle.Both: {
-                                               thumb_pos.X = area.X + 10;
-                                               Pen pen = ResPool.GetPen( ColorButtonHilight );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9 );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonShadow );
-                                               dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 19, thumb_pos.Y  + 9 );
-                                               dc.DrawLine( pen, thumb_pos.X  + 10, thumb_pos.Y + 1, thumb_pos.X + 19, thumb_pos.Y  + 8 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonDkShadow );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X + 20, thumb_pos.Y  + 10 );
-                                               dc.DrawLine( pen, thumb_pos.X  + 20, thumb_pos.Y, thumb_pos.X  + 20, thumb_pos.Y + 9 );
-                                               
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 18, 8 );
-                                               
-                                               break;
-                                       }
-                                       
-                               default:
-                                       break;
-                       }
-                       
-                       pixel_len = thumb_area.Height - 11;
-                       pixels_betweenticks = pixel_len / ticks;
-                       
-                       thumb_area.X = thumb_pos.X;
-                       thumb_area.Y = channel_startpoint.Y;
-                       thumb_area.Width = thumb_pos.Height;
-                       
-                       /* Draw ticks*/
-                       Region outside = new Region( area );
-                       outside.Exclude( thumb_area );
-                       
-                       if ( outside.IsVisible( clip_rectangle ) )
-                       {
-                               Pen pen = ResPool.GetPen( pen_ticks_color );
-                               
-                               if ( pixels_betweenticks > 0 && ( ( tb.TickStyle & TickStyle.BottomRight ) == TickStyle.BottomRight ||
-                                   ( ( tb.TickStyle & TickStyle.Both ) == TickStyle.Both ) ) )
-                               {
-                                       for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks )
-                                       {
-                                               if ( inc == 0 || ( inc +  pixels_betweenticks ) >= pixel_len + 1 )
-                                                       dc.DrawLine( pen, area.X + bottomtick_startpoint.X , area.Y + bottomtick_startpoint.Y  + inc,
-                                                                   area.X + bottomtick_startpoint.X  + 3, area.Y + bottomtick_startpoint.Y + inc );
-                                               else
-                                                       dc.DrawLine( pen, area.X + bottomtick_startpoint.X, area.Y + bottomtick_startpoint.Y  + inc,
-                                                                   area.X + bottomtick_startpoint.X  + 2, area.Y + bottomtick_startpoint.Y + inc );
-                                       }
-                               }
-                               
-                               if ( pixels_betweenticks > 0 &&  ( ( tb.TickStyle & TickStyle.TopLeft ) == TickStyle.TopLeft ||
-                                   ( ( tb.TickStyle & TickStyle.Both ) == TickStyle.Both ) ) )
-                               {
-                                       
-                                       pixel_len = thumb_area.Height - 11;
-                                       pixels_betweenticks = pixel_len / ticks;
-                                       
-                                       for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks )
-                                       {
-                                               if ( inc == 0 || ( inc +  pixels_betweenticks ) >= pixel_len + 1 )
-                                                       dc.DrawLine( pen, area.X + toptick_startpoint.X  - 3 , area.Y + toptick_startpoint.Y + inc,
-                                                                   area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y + inc );
-                                               else
-                                                       dc.DrawLine( pen, area.X + toptick_startpoint.X  - 2, area.Y + toptick_startpoint.Y + inc,
-                                                                   area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y  + inc );
-                                       }
-                               }
-                       }
-                       
-                       outside.Dispose( );
-                       
-               }
-               
-               /*
-                Horizontal trackbar
-                
-                Does not matter the size of the control, Win32 always draws:
-                - Ticks starting from pixel 13, 8
-                - Channel starting at pos 8, 19 and ends at Width - 8
-                - Autosize makes always the control 40 pixels height
-                - Ticks are draw at (channel.Witdh - 10) / (Maximum - Minimum)
-                
-                */
-               private void DrawTrackBar_Horizontal( Graphics dc, Rectangle clip_rectangle, TrackBar tb,
-                                                    ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb,
-                                                    float ticks, int value_pos, bool mouse_value )
-               {
-                       Point toptick_startpoint = new Point( );
-                       Point bottomtick_startpoint = new Point( );
-                       Point channel_startpoint = new Point( );
-                       float pixel_len;
-                       float pixels_betweenticks;
-                       const int space_from_right = 8;
-                       const int space_from_left = 8;
-                       Rectangle area = tb.ClientRectangle;
-                       
-                       switch ( tb.TickStyle )
-                       {
-                               case TickStyle.BottomRight:
-                               case TickStyle.None:
-                                       channel_startpoint.X = 8;
-                                       channel_startpoint.Y = 9;
-                                       bottomtick_startpoint.X = 13;
-                                       bottomtick_startpoint.Y = 24;
-                                       break;
-                               case TickStyle.TopLeft:
-                                       channel_startpoint.X = 8;
-                                       channel_startpoint.Y = 19;
-                                       toptick_startpoint.X = 13;
-                                       toptick_startpoint.Y = 8;
-                                       break;
-                               case TickStyle.Both:
-                                       channel_startpoint.X = 8;
-                                       channel_startpoint.Y = 18;
-                                       bottomtick_startpoint.X = 13;
-                                       bottomtick_startpoint.Y = 32;
-                                       toptick_startpoint.X = 13;
-                                       toptick_startpoint.Y = 8;
-                                       break;
-                               default:
-                                       break;
-                       }
-                       
-                       thumb_area.X = area.X + channel_startpoint.X;
-                       thumb_area.Y = area.Y + channel_startpoint.Y;
-                       thumb_area.Width = area.Width - space_from_right - space_from_left;
-                       thumb_area.Height = 4;
-                       
-                       /* Draw channel */
-                       dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonShadow ), channel_startpoint.X, channel_startpoint.Y,
-                                        thumb_area.Width, 1 );
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonDkShadow ), channel_startpoint.X, channel_startpoint.Y + 1,
-                                        thumb_area.Width, 1 );
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonHilight ), channel_startpoint.X, channel_startpoint.Y + 3,
-                                        thumb_area.Width, 1 );
-                       
-                       pixel_len = thumb_area.Width - 11;
-                       pixels_betweenticks = pixel_len / ( tb.Maximum - tb.Minimum );
-                       
-                       /* Convert thumb position from mouse position to value*/
-                       if ( mouse_value )
-                       {
-                               if ( value_pos >= channel_startpoint.X )
-                                       value_pos = (int)( ( (float) ( value_pos - channel_startpoint.X ) ) / pixels_betweenticks );
-                               else
-                                       value_pos = 0;
-                               
-                               if ( value_pos + tb.Minimum > tb.Maximum )
-                                       value_pos = tb.Maximum - tb.Minimum;
-                                
-                               tb.Value = value_pos + tb.Minimum;
-                       }
-                       
-                       thumb_pos.X = channel_startpoint.X + (int) ( pixels_betweenticks * (float) value_pos );
-                       
-                       /* Draw thumb fixed 10x22 size */
-                       thumb_pos.Width = 10;
-                       thumb_pos.Height = 22;
-                       
-                       switch ( tb.TickStyle )
-                       {
-                               case TickStyle.BottomRight:
-                               case TickStyle.None: {
-                                               thumb_pos.Y = channel_startpoint.Y - 8;
-                                               
-                                               Pen pen = ResPool.GetPen( ColorButtonHilight );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16 );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonShadow );
-                                               dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 15 );
-                                               dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X + 9 - 4, thumb_pos.Y + 16 + 4 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonDkShadow );
-                                               dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 16 );
-                                               dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y + 16, thumb_pos.X + 10 - 5, thumb_pos.Y + 16 + 5 );
-                                               
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 16 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 2, thumb_pos.Y + 17, 6, 1 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 3, thumb_pos.Y + 18, 4, 1 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 4, thumb_pos.Y + 19, 2, 1 );
-                                               break;
-                                       }
-                               case TickStyle.TopLeft: {
-                                               thumb_pos.Y = channel_startpoint.Y - 10;
-                                               
-                                               Pen pen = ResPool.GetPen( ColorButtonHilight );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16 );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonShadow );
-                                               dc.DrawLine( pen, thumb_pos.X  + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16 );
-                                               dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y );
-                                               dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1 , thumb_pos.Y + 19 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonDkShadow );
-                                               dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16 );
-                                               dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y - 1 );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 10, thumb_pos.Y + 20 );
-                                               
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 8, 15 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 6, 1 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 4, 1 );
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 2, 1 );
-                                               break;
-                                       }
-                                       
-                               case TickStyle.Both: {
-                                               thumb_pos.Y = area.Y  + 10;
-                                               Pen pen = ResPool.GetPen( ColorButtonHilight );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonShadow );
-                                               dc.DrawLine( pen, thumb_pos.X  + 9, thumb_pos.Y + 1, thumb_pos.X  + 9, thumb_pos.Y + 19 );
-                                               dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19 );
-                                               
-                                               pen = ResPool.GetPen( ColorButtonDkShadow );
-                                               dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 20 );
-                                               dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 9, thumb_pos.Y + 20 );
                                                
-                                               dc.FillRectangle( br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 18 );
-                                               
-                                               break;
-                                       }
-                                       
-                               default:
-                                       break;
-                       }
-                       
-                       pixel_len = thumb_area.Width - 11;
-                       pixels_betweenticks = pixel_len / ticks;
-                       
-                       /* Draw ticks*/
-                       thumb_area.Y = thumb_pos.Y;
-                       thumb_area.X = channel_startpoint.X;
-                       thumb_area.Height = thumb_pos.Height;
-                       Region outside = new Region( area );
-                       outside.Exclude( thumb_area );
-                       
-                       if ( outside.IsVisible( clip_rectangle ) )
-                       {
-                               Pen pen = ResPool.GetPen( pen_ticks_color );
-                               
-                               if ( pixels_betweenticks > 0 && ( ( tb.TickStyle & TickStyle.BottomRight ) == TickStyle.BottomRight ||
-                                   ( ( tb.TickStyle & TickStyle.Both  ) == TickStyle.Both ) ) )
-                               {
-                                       
-                                       for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks )
-                                       {
-                                               if ( inc == 0 || ( inc +  pixels_betweenticks ) >= pixel_len + 1 )
-                                                       dc.DrawLine( pen, area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y,
-                                                                   area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y + 3 );
-                                               else
-                                                       dc.DrawLine( pen, area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y,
-                                                                   area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y + 2 );
-                                       }
-                               }
-                               
-                               if ( pixels_betweenticks > 0 && ( ( tb.TickStyle & TickStyle.TopLeft ) == TickStyle.TopLeft ||
-                                   ( ( tb.TickStyle & TickStyle.Both ) == TickStyle.Both ) ) )
-                               {
-                                       
-                                       for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks )
-                                       {
-                                               if ( inc == 0 || ( inc +  pixels_betweenticks ) >= pixel_len + 1 )
-                                                       dc.DrawLine( pen, area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y - 3,
-                                                                   area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y );
-                                               else
-                                                       dc.DrawLine( pen, area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y - 2,
-                                                                   area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y );
-                                       }
-                               }
-                       }
-                       
-                       outside.Dispose( );
-               }
-               
-               public override void DrawTrackBar( Graphics dc, Rectangle clip_rectangle, TrackBar tb )
-               {
-                       Brush           br_thumb;
-                       int             value_pos;
-                       bool            mouse_value;
-                       float           ticks = ( tb.Maximum - tb.Minimum ) / tb.tickFrequency; /* N of ticks draw*/
-                       Rectangle       area;
-                       Rectangle       thumb_pos = tb.ThumbPos;
-                       Rectangle       thumb_area = tb.ThumbArea;
-                       
-                       if ( tb.thumb_pressed )
-                       {
-                               value_pos = tb.thumb_mouseclick;
-                               mouse_value = true;
-                       }
-                       else
-                       {
-                               value_pos = tb.Value - tb.Minimum;
-                               mouse_value = false;
-                       }
-                       
-                       area = tb.ClientRectangle;
-                       
-                       if ( tb.thumb_pressed == true )
-                       {
-                               br_thumb = (Brush) ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace );
-                       }
-                       else
-                       {
-                               br_thumb = ResPool.GetSolidBrush( ColorButtonFace );
-                       }
-                       
-                       
-                       /* Control Background */
-                       if ( tb.BackColor == DefaultControlBackColor )
-                       {
-                               dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonFace ), clip_rectangle );
-                       }
-                       else
-                       {
-                               dc.FillRectangle( ResPool.GetSolidBrush( tb.BackColor ), clip_rectangle );
-                       }
-                       
-                       
-                       if ( tb.Focused )
-                       {
-                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, Color.Black ), area.X, area.Y, area.Width - 1, 1 );
-                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, Color.Black ), area.X, area.Y + area.Height - 1, area.Width - 1, 1 );
-                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, Color.Black ), area.X, area.Y, 1, area.Height - 1 );
-                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, Color.Black ), area.X + area.Width - 1, area.Y, 1, area.Height - 1 );
-                       }
-                       
-                       if ( tb.Orientation == Orientation.Vertical )
-                       {
-                               DrawTrackBar_Vertical( dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
-                                                     br_thumb, ticks, value_pos, mouse_value );
-                               
-                       }
-                       else
-                       {
-                               DrawTrackBar_Horizontal( dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
-                                                       br_thumb, ticks, value_pos, mouse_value );
-                       }
-                       
-                       tb.ThumbPos = thumb_pos;
-                       tb.ThumbArea = thumb_area;
-               }
-               
-               public override Size TrackBarDefaultSize
-               {
-                       get {
-                               return new Size( 104, 42 );
-                       }
-               }
-               
-               #endregion      // TrackBar
-               
-               #region VScrollBar
-               public override Size VScrollBarDefaultSize
-               {
-                       get {
-                               return new Size( this.ScrollBarButtonSize, 80 );
-                       }
-               }
-               #endregion      // VScrollBar
-               
-               #region TreeView
-               public override Size TreeViewDefaultSize
-               {
-                       get {
-                               return new Size( 121, 97 );
-                       }
-               }
-               
-               #endregion
-               
-               #region ControlPaint
-               private enum DrawFrameControlStates
-               {
-                       ButtonCheck             = 0x0000,
-                       ButtonRadioImage        = 0x0001,
-                       ButtonRadioMask         = 0x0002,
-                       ButtonRadio             = 0x0004,
-                       Button3State            = 0x0008,
-                       ButtonPush              = 0x0010,
-                       
-                       CaptionClose            = 0x0000,
-                       CaptionMin              = 0x0001,
-                       CaptionMax              = 0x0002,
-                       CaptionRestore          = 0x0004,
-                       CaptionHelp             = 0x0008,
-                       
-                       MenuArrow               = 0x0000,
-                       MenuCheck               = 0x0001,
-                       MenuBullet              = 0x0002,
-                       MenuArrowRight          = 0x0004,
-                       
-                       ScrollUp                = 0x0000,
-                       ScrollDown              = 0x0001,
-                       ScrollLeft              = 0x0002,
-                       ScrollRight             = 0x0003,
-                       ScrollComboBox          = 0x0005,
-                       ScrollSizeGrip          = 0x0008,
-                       ScrollSizeGripRight     = 0x0010,
-                       
-                       Inactive                = 0x0100,
-                       Pushed                  = 0x0200,
-                       Checked                 = 0x0400,
-                       Transparent             = 0x0800,
-                       Hot                     = 0x1000,
-                       AdjustRect              = 0x2000,
-                       Flat                    = 0x4000,
-                       Mono                    = 0x8000
-                       
-               }
-               
-               private enum DrawFrameControlTypes
-               {
-                       Caption = 1,
-                       Menu    = 2,
-                       Scroll  = 3,
-                       Button  = 4
-               }
-               
-               public override void CPDrawBorder( Graphics dc, Rectangle bounds, Color leftColor, int leftWidth,
-                                                 ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
-                                                 Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor,
-                                                 int bottomWidth, ButtonBorderStyle bottomStyle )
-               {
-                       DrawBorderInternal( dc, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 1, leftWidth, leftColor, leftStyle, Border3DSide.Left );
-                       DrawBorderInternal( dc, bounds.Left, bounds.Top, bounds.Right - 1, bounds.Top, topWidth, topColor, topStyle, Border3DSide.Top );
-                       DrawBorderInternal( dc, bounds.Right - 1, bounds.Top, bounds.Right - 1, bounds.Bottom - 1, rightWidth, rightColor, rightStyle, Border3DSide.Right );
-                       DrawBorderInternal( dc, bounds.Left, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1, bottomWidth, bottomColor, bottomStyle, Border3DSide.Bottom );
-               }
-               
-               public override void CPDrawBorder3D( Graphics dc, Rectangle rectangle, Border3DStyle style, Border3DSide sides )
-               {
-                       CPDrawBorder3D( dc, rectangle, style, sides, ColorButtonFace );
-               }
-               
-               private void CPDrawBorder3D( Graphics dc, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color )
-               {
-                       Pen             penTopLeft;
-                       Pen             penTopLeftInner;
-                       Pen             penBottomRight;
-                       Pen             penBottomRightInner;
-                       Rectangle       rect= new Rectangle( rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height );
-                       bool            doInner = false;
-                       
-                       if ( ( style & Border3DStyle.Adjust ) != 0 )
-                       {
-                               rect.Y -= 2;
-                               rect.X -= 2;
-                               rect.Width += 4;
-                               rect.Height += 4;
-                       }
-                       
-                       /* default to flat */
-                       penTopLeft = ResPool.GetPen( ControlPaint.Dark( control_color ) );
-                       penTopLeftInner = ResPool.GetPen( ControlPaint.Dark( control_color ) );
-                       penBottomRight = ResPool.GetPen( ControlPaint.Dark( control_color ) );
-                       penBottomRightInner = ResPool.GetPen( ControlPaint.Dark( control_color ) );
-                       
-                       if ( ( style & Border3DStyle.RaisedOuter ) != 0 )
-                       {
-                               penTopLeft = ResPool.GetPen( ControlPaint.LightLight( control_color ) );
-                               penBottomRight = ResPool.GetPen( ControlPaint.DarkDark( control_color ) );
-                               if ( ( style & ( Border3DStyle.RaisedInner | Border3DStyle.SunkenInner ) ) != 0 )
-                               {
-                                       doInner = true;
-                               }
-                       }
-                       else if ( ( style & Border3DStyle.SunkenOuter ) != 0 )
-                       {
-                               penTopLeft = ResPool.GetPen( ControlPaint.DarkDark( control_color ) );
-                               penBottomRight = ResPool.GetPen( ControlPaint.LightLight( control_color ) );
-                               if ( ( style & ( Border3DStyle.RaisedInner | Border3DStyle.SunkenInner ) ) != 0 )
-                               {
-                                       doInner = true;
-                               }
-                       }
-                       
-                       if ( ( style & Border3DStyle.RaisedInner ) != 0 )
-                       {
-                               if ( doInner )
-                               {
-                                       penTopLeftInner = ResPool.GetPen( control_color );
-                                       penBottomRightInner = ResPool.GetPen( ControlPaint.Dark( control_color ) );
-                               }
-                               else
-                               {
-                                       penTopLeft = ResPool.GetPen( ControlPaint.LightLight( control_color ) );
-                                       penBottomRight = ResPool.GetPen( ControlPaint.DarkDark( control_color ) );
-                               }
-                       }
-                       else if ( ( style & Border3DStyle.SunkenInner ) != 0 )
-                       {
-                               if ( doInner )
-                               {
-                                       penTopLeftInner = ResPool.GetPen( ControlPaint.Dark( control_color ) );
-                                       penBottomRightInner = ResPool.GetPen( control_color );
-                               }
-                               else
-                               {
-                                       penTopLeft = ResPool.GetPen( ControlPaint.DarkDark( control_color ) );
-                                       penBottomRight = ResPool.GetPen( ControlPaint.LightLight( control_color ) );
-                               }
-                       }
-                       
-                       if ( ( sides & Border3DSide.Middle ) != 0 )
-                       {
-                               dc.FillRectangle( ResPool.GetSolidBrush( control_color ), rect );
-                       }
-                       
-                       if ( ( sides & Border3DSide.Left ) != 0 )
-                       {
-                               dc.DrawLine( penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top );
-                               if ( doInner )
-                               {
-                                       dc.DrawLine( penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top );
-                               }
-                       }
-                       
-                       if ( ( sides & Border3DSide.Top ) != 0 )
-                       {
-                               dc.DrawLine( penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top );
-                               
-                               if ( doInner )
-                               {
-                                       if ( ( sides & Border3DSide.Left ) != 0 )
-                                       {
-                                               dc.DrawLine( penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1 );
-                                       }
-                                       else
-                                       {
-                                               dc.DrawLine( penTopLeftInner, rect.Left, rect.Top + 1, rect.Right - 3, rect.Top + 1 );
-                                       }
-                               }
-                       }
-                       
-                       if ( ( sides & Border3DSide.Right ) != 0 )
-                       {
-                               dc.DrawLine( penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1 );
-                               
-                               if ( doInner )
-                               {
-                                       if ( ( sides & Border3DSide.Top ) != 0 )
-                                       {
-                                               dc.DrawLine( penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2 );
-                                       }
-                                       else
-                                       {
-                                               dc.DrawLine( penBottomRightInner, rect.Right - 2, rect.Top, rect.Right - 2, rect.Bottom - 2 );
-                                       }
-                               }
-                       }
-                       
-                       if ( ( sides & Border3DSide.Bottom ) != 0 )
-                       {
-                               int     left=rect.Left;
-                               
-                               if ( ( sides & Border3DSide.Left ) != 0 )
-                               {
-                                       left += 1;
-                               }
-                               
-                               dc.DrawLine( penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1 );
-                               
-                               if ( doInner )
-                               {
-                                       if ( ( sides & Border3DSide.Right ) != 0 )
-                                       {
-                                               dc.DrawLine( penBottomRightInner, left, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2 );
-                                       }
-                                       else
-                                       {
-                                               dc.DrawLine( penBottomRightInner, left, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2 );
-                                       }
-                               }
-                       }
-               }
-               
-               
-               public override void CPDrawButton( Graphics dc, Rectangle rectangle, ButtonState state )
-               {
-                       DrawFrameControlStates  dfcs=DrawFrameControlStates.ButtonPush;
-                       
-                       if ( ( state & ButtonState.Pushed ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Pushed;
-                       }
-                       
-                       if ( ( state & ButtonState.Checked ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Checked;
-                       }
-                       
-                       if ( ( state & ButtonState.Flat ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Flat;
-                       }
-                       
-                       if ( ( state & ButtonState.Inactive ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Inactive;
-                       }
-                       DrawFrameControl( dc, rectangle, DrawFrameControlTypes.Button, dfcs );
-               }
-               
-               
-               public override void CPDrawCaptionButton( Graphics dc, Rectangle rectangle, CaptionButton button, ButtonState state )
-               {
-                       Rectangle       captionRect;
-                       int                     lineWidth;
-                       
-                       CPDrawButton( dc, rectangle, state );
-                       
-                       if ( rectangle.Width < rectangle.Height )
-                       {
-                               captionRect = new Rectangle( rectangle.X + 1, rectangle.Y + rectangle.Height / 2 - rectangle.Width / 2 + 1, rectangle.Width - 4, rectangle.Width - 4 );
-                       }
-                       else
-                       {
-                               captionRect = new Rectangle( rectangle.X + rectangle.Width / 2 - rectangle.Height / 2 + 1, rectangle.Y + 1, rectangle.Height - 4, rectangle.Height - 4 );
-                       }
-                       
-                       if ( ( state & ButtonState.Pushed ) != 0 )
-                       {
-                               captionRect = new Rectangle( rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 3, rectangle.Height - 3 );
-                       }
-                       
-                       /* Make sure we've got at least a line width of 1 */
-                       lineWidth = Math.Max( 1, captionRect.Width / 7 );
-                       
-                       switch ( button )
-                       {
-                               case CaptionButton.Close: {
-                                               if ( ( state & ButtonState.Inactive ) != 0 )
+                                               dc.DrawLine( border_pen, bounds.Right, bounds.Top, bounds.Left + 3, bounds.Top );
+                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Top, bounds.Left, bounds.Top + 3 );
+                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top + 3, bounds.Left, bounds.Bottom - 3 );
+                                               dc.DrawLine( border_pen, bounds.Left, bounds.Bottom - 3, bounds.Left + 3, bounds.Bottom );
+                                               dc.DrawLine( border_pen, bounds.Left + 3, bounds.Bottom, bounds.Right, bounds.Bottom );
+                                               
+                                               if ( page.Focused )
                                                {
-                                                       using ( Pen pen = new Pen( ColorButtonHilight, lineWidth ) )
-                                                       {
-                                                               DrawCaptionHelper( dc, ColorButtonHilight, pen, lineWidth, 1, captionRect, button );
-                                                       }
-                                                       
-                                                       using ( Pen pen = new Pen( ColorButtonShadow, lineWidth ) )
-                                                       {
-                                                               DrawCaptionHelper( dc, ColorButtonShadow, pen, lineWidth, 0, captionRect, button );
-                                                       }
-                                                       return;
+                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left , bounds.Top + 1, bounds.Left , bounds.Bottom - 1 );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left + 1 , bounds.Top, bounds.Left + 1 , bounds.Bottom );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left + 2 , bounds.Top, bounds.Left + 2 , bounds.Bottom );
+                                               }
+                                               
+                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+                                               
+                                               if ( page.Text != String.Empty )
+                                               {
+                                                       StringFormat string_format = new StringFormat( );
+                                                       // Flip the text around
+                                                       string_format.Alignment = StringAlignment.Center;
+                                                       string_format.LineAlignment = StringAlignment.Center;
+                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
+                                                       string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+                                                       int wo = interior.Width / 2;
+                                                       int ho = interior.Height / 2;
+                                                       dc.TranslateTransform( interior.X + wo, interior.Y + ho );
+                                                       dc.RotateTransform( 180 );
+                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), 0, 0, string_format );
+                                                       dc.ResetTransform( );
                                                }
-                                               else
+                                               
+                                               break;
+                                               
+                                       default:
+                                               // TabAlignment.Right
+                                               
+                                               dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
+                                               
+                                               if ( !is_selected )
                                                {
-                                                       using ( Pen pen = new Pen( ColorButtonText, lineWidth ) )
+                                                       interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
+                                                       
+                                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2  ), new Point( bounds.Right, bounds.Top + 2 ), Color.White, LightColor ) )
                                                        {
-                                                               DrawCaptionHelper( dc, ColorButtonText, pen, lineWidth, 0, captionRect, button );
+                                                               dc.FillRectangle( lgbr, interior );
                                                        }
-                                                       return;
                                                }
-                                       }
-                                       
-                               case CaptionButton.Help:
-                               case CaptionButton.Maximize:
-                               case CaptionButton.Minimize:
-                               case CaptionButton.Restore: {
-                                               if ( ( state & ButtonState.Inactive ) != 0 )
+                                               
+                                               dc.DrawLine( border_pen, bounds.Left, bounds.Top, bounds.Right - 3, bounds.Top );
+                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3 );
+                                               dc.DrawLine( border_pen, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom - 3 );
+                                               dc.DrawLine( border_pen, bounds.Right, bounds.Bottom - 3, bounds.Right - 3, bounds.Bottom );
+                                               dc.DrawLine( border_pen, bounds.Right - 3, bounds.Bottom, bounds.Left, bounds.Bottom );
+                                               
+                                               if ( page.Focused )
                                                {
-                                                       DrawCaptionHelper( dc, ColorButtonHilight, SystemPens.ControlLightLight, lineWidth, 1, captionRect, button );
-                                                       
-                                                       DrawCaptionHelper( dc, ColorButtonShadow, SystemPens.ControlDark, lineWidth, 0, captionRect, button );
-                                                       return;
+                                                       dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Right , bounds.Top + 1, bounds.Right , bounds.Bottom - 1 );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Right - 1 , bounds.Top, bounds.Right - 1 , bounds.Bottom );
+                                                       dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Right - 2 , bounds.Top, bounds.Right - 2 , bounds.Bottom );
                                                }
-                                               else
+                                               
+                                               interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+                                               
+                                               if ( page.Text != String.Empty )
                                                {
-                                                       DrawCaptionHelper( dc, ColorButtonText, SystemPens.ControlText, lineWidth, 0, captionRect, button );
-                                                       return;
+                                                       StringFormat string_format = new StringFormat( );
+                                                       string_format.Alignment = StringAlignment.Center;
+                                                       string_format.LineAlignment = StringAlignment.Center;
+                                                       string_format.FormatFlags = StringFormatFlags.NoWrap;
+                                                       string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+                                                       interior.X++;
+                                                       dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+                                                       interior.X--;
                                                }
-                                       }
-                       }
-               }
-               
-               
-               public override void CPDrawCheckBox( Graphics dc, Rectangle rectangle, ButtonState state )
-               {
-                       DrawFrameControlStates  dfcs=DrawFrameControlStates.ButtonCheck;
-                       
-                       if ( ( state & ButtonState.Pushed ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Pushed;
-                       }
-                       
-                       if ( ( state & ButtonState.Checked ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Checked;
-                       }
-                       
-                       if ( ( state & ButtonState.Flat ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Flat;
-                       }
-                       
-                       if ( ( state & ButtonState.Inactive ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Inactive;
+                                               
+                                               break;
+                               }
                        }
                        
-                       DrawFrameControl( dc, rectangle, DrawFrameControlTypes.Button, dfcs );
-                       
-               }
+                       return res;
+               }               
                
                public override void CPDrawComboButton( Graphics dc, Rectangle rectangle, ButtonState state )
                {
@@ -5316,7 +972,6 @@ namespace System.Windows.Forms
                        
                        if ( ( state & ButtonState.Flat ) != 0 )
                        {
-//                             ControlPaint.DrawBorder( graphics, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid );
                                first_color = NormalColor;
                                second_color = Color.White;
                        }
@@ -5324,10 +979,6 @@ namespace System.Windows.Forms
                        {
                                if ( ( state & ( ButtonState.Pushed | ButtonState.Checked ) ) != 0 )
                                {
-                                       // this needs to render like a pushed button - jba
-                                       // CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
-//                                     Rectangle trace_rectangle = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 1, 0 ), Math.Max( rectangle.Height - 1, 0 ) );
-//                                     graphics.DrawRectangle( ResPool.GetPen( ControlPaint.Dark( ColorButtonFace ) ), trace_rectangle );
                                        first_color = Color.White;
                                        second_color = PressedColor;
                                }
@@ -5397,389 +1048,25 @@ namespace System.Windows.Forms
                                arrow[ 2 ] = P3;
                                
                                using ( Pen pen = new Pen( SystemColors.ControlDark, 2 ) )
-                               {
-                                       dc.DrawLines( pen, arrow );
-                               }
-                       }
-                       else
-                       {
-                               using ( Pen pen = new Pen( SystemColors.ControlText, 2 ) )
-                               {
-                                       dc.DrawLines( pen, arrow );
-                               }
-                       }
-               }
-               
-               
-               public override void CPDrawContainerGrabHandle( Graphics dc, Rectangle bounds )
-               {
-                       
-                       Pen                     pen     = new Pen( Color.Black, 1 );
-                       Rectangle       rect    = new Rectangle( bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1 );     // Dunno why, but MS does it that way, too
-                       int                     X;
-                       int                     Y;
-                       
-                       dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonText ), rect );
-                       dc.DrawRectangle( pen, rect );
-                       
-                       X = rect.X + rect.Width / 2;
-                       Y = rect.Y + rect.Height / 2;
-                       
-                       /* Draw the cross */
-                       dc.DrawLine( pen, X, rect.Y + 2, X, rect.Bottom - 2 );
-                       dc.DrawLine( pen, rect.X + 2, Y, rect.Right - 2, Y );
-                       
-                       /* Draw 'arrows' for vertical lines */
-                       dc.DrawLine( pen, X - 1, rect.Y + 3, X + 1, rect.Y + 3 );
-                       dc.DrawLine( pen, X - 1, rect.Bottom - 3, X + 1, rect.Bottom - 3 );
-                       
-                       /* Draw 'arrows' for horizontal lines */
-                       dc.DrawLine( pen, rect.X + 3, Y - 1, rect.X + 3, Y + 1 );
-                       dc.DrawLine( pen, rect.Right - 3, Y - 1, rect.Right - 3, Y + 1 );
-                       
-                       pen.Dispose( );
-               }
-               
-               public virtual void DrawFlatStyleFocusRectangle( Graphics dc, Rectangle rectangle, ButtonBase button, Color foreColor, Color backColor )
-               {
-                       // make a rectange to trace around border of the button
-                       Rectangle trace_rectangle = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 1, 0 ), Math.Max( rectangle.Height - 1, 0 ) );
-                       
-                       Color outerColor = foreColor;
-                       // adjust focus color according to the flatstyle
-                       if ( button.FlatStyle == FlatStyle.Popup && !button.is_pressed )
-                       {
-                               outerColor = ( backColor == ColorButtonFace ) ? ControlPaint.Dark( ColorButtonFace ) : ColorButtonText;
-                       }
-                       
-                       // draw the outer rectangle
-                       dc.DrawRectangle( ResPool.GetPen( outerColor ), trace_rectangle );
-                       
-                       // draw the inner rectangle
-                       if ( button.FlatStyle == FlatStyle.Popup )
-                       {
-                               DrawInnerFocusRectangle( dc, Rectangle.Inflate( rectangle, -4, -4 ), backColor );
-                       }
-                       else
-                       {
-                               // draw a flat inner rectangle
-                               dc.DrawRectangle( ResPool.GetPen( ControlPaint.LightLight( backColor ) ), Rectangle.Inflate( trace_rectangle, -4, -4 ) );
-                       }
-               }
-               
-               public virtual void DrawInnerFocusRectangle( Graphics dc, Rectangle rectangle, Color backColor )
-               {
-                       // make a rectange to trace around border of the button
-                       Rectangle trace_rectangle = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 1, 0 ), Math.Max( rectangle.Height - 1, 0 ) );
-                       
-                       Color colorBackInverted = Color.FromArgb( Math.Abs( backColor.R - 255 ), Math.Abs( backColor.G - 255 ), Math.Abs( backColor.B - 255 ) );
-                       Pen pen = ResPool.GetPen( colorBackInverted );
-                       DashStyle oldStyle = pen.DashStyle;
-                       pen.DashStyle = DashStyle.Dot;
-                       dc.DrawRectangle( pen, trace_rectangle );
-                       pen.DashStyle = oldStyle;
-               }
-               
-               
-               public override void CPDrawFocusRectangle( Graphics dc, Rectangle rectangle, Color foreColor, Color backColor )
-               {
-                       Rectangle rect = rectangle;
-                       Pen pen;
-                       HatchBrush brush;
-                       
-                       if ( backColor.GetBrightness( ) >= 0.5 )
-                       {
-                               foreColor = Color.Transparent;
-                               backColor = Color.Black;
-                               
-                       }
-                       else
-                       {
-                               backColor = Color.FromArgb( Math.Abs( backColor.R - 255 ), Math.Abs( backColor.G - 255 ), Math.Abs( backColor.B - 255 ) );
-                               foreColor = Color.Black;
-                       }
-                       
-                       brush = ResPool.GetHatchBrush( HatchStyle.Percent50, backColor, foreColor );
-                       pen = new Pen( brush, 1 );
-                       
-                       rect.Width--;
-                       rect.Height--;
-                       
-                       dc.DrawRectangle( pen, rect );
-                       pen.Dispose( );
-               }
-               
-               public override void CPDrawGrabHandle( Graphics dc, Rectangle rectangle, bool primary, bool enabled )
-               {
-                       SolidBrush      sb;
-                       Pen                     pen;
-                       
-                       if ( primary == true )
-                       {
-                               pen = new Pen( Color.Black, 1 );
-                               if ( enabled == true )
-                               {
-                                       sb = ResPool.GetSolidBrush( ColorButtonText );
-                               }
-                               else
-                               {
-                                       sb = ResPool.GetSolidBrush( ColorButtonFace );
-                               }
-                       }
-                       else
-                       {
-                               pen = new Pen( Color.White, 1 );
-                               if ( enabled == true )
-                               {
-                                       sb = ThemeEngine.Current.ResPool.GetSolidBrush( Color.Black );
-                               }
-                               else
-                               {
-                                       sb = ResPool.GetSolidBrush( ColorButtonFace );
-                               }
-                       }
-                       dc.FillRectangle( sb, rectangle );
-                       dc.DrawRectangle( pen, rectangle );
-                       pen.Dispose( );
-               }
-               
-               
-               public override void CPDrawGrid( Graphics dc, Rectangle area, Size pixelsBetweenDots, Color backColor )
-               {
-                       Color   foreColor;
-                       int     h;
-                       int     b;
-                       int     s;
-                       
-                       ControlPaint.Color2HBS( backColor, out h, out b, out s );
-                       
-                       if ( b > 127 )
-                       {
-                               foreColor = Color.Black;
-                       }
-                       else
-                       {
-                               foreColor = Color.White;
-                       }
-                       
-                       #if false
-                       /* Commented out until I take the time and figure out
-                       which HatchStyle will match requirements. The code below
-                       is only correct for Percent50.
-                       */
-                       if (pixelsBetweenDots.Width==pixelsBetweenDots.Height) {
-                       HatchBrush      brush=null;
-                       
-                       switch(pixelsBetweenDots.Width) {
-                       case 2: brush=new HatchBrush(HatchStyle.Percent50, foreColor, backColor); break;
-                       case 4: brush=new HatchBrush(HatchStyle.Percent25, foreColor, backColor); break;
-                       case 5: brush=new HatchBrush(HatchStyle.Percent20, foreColor, backColor); break;
-                       default: {
-                       /* Have to do it the slow way */
-                       break;
-                       }
-                       }
-                       if (brush!=null) {
-                       graphics.FillRectangle(brush, area);
-                       pen.Dispose();
-                       brush.Dispose();
-                       return;
-                       }
-                       }
-                       #endif
-                       /* Slow method */
-                       
-                       Bitmap bitmap = new Bitmap( area.Width, area.Height, dc );
-                       
-                       for ( int x=0; x < area.Width; x += pixelsBetweenDots.Width )
-                       {
-                               for ( int y=0; y < area.Height; y += pixelsBetweenDots.Height )
-                               {
-                                       bitmap.SetPixel( x, y, foreColor );
-                               }
-                       }
-                       dc.DrawImage( bitmap, area.X, area.Y, area.Width, area.Height );
-                       bitmap.Dispose( );
-               }
-               
-               public override void CPDrawImageDisabled( Graphics dc, Image image, int x, int y, Color background )
-               {
-                       /*
-                        Microsoft seems to ignore the background and simply make
-                        the image grayscale. At least when having > 256 colors on
-                        the display.
-                        */
-                       
-                       if ( imagedisabled_attributes == null )
-                       {
-                               imagedisabled_attributes = new ImageAttributes( );
-                               ColorMatrix colorMatrix=new ColorMatrix( new float[][] {
-                                                                       // This table would create a perfect grayscale image, based on luminance
-                                                                       //                              new float[]{0.3f,0.3f,0.3f,0,0},
-                                                                       //                              new float[]{0.59f,0.59f,0.59f,0,0},
-                                                                       //                              new float[]{0.11f,0.11f,0.11f,0,0},
-                                                                       //                              new float[]{0,0,0,1,0,0},
-                                                                       //                              new float[]{0,0,0,0,1,0},
-                                                                       //                              new float[]{0,0,0,0,0,1}
-                                                                       
-                                                                       // This table generates a image that is grayscaled and then
-                                                                       // brightened up. Seems to match MS close enough.
-                                                                               new float[]{0.2f,0.2f,0.2f,0,0},
-                                                                               new float[]{0.41f,0.41f,0.41f,0,0},
-                                                                               new float[]{0.11f,0.11f,0.11f,0,0},
-                                                                               new float[]{0.15f,0.15f,0.15f,1,0,0},
-                                                                               new float[]{0.15f,0.15f,0.15f,0,1,0},
-                                                                               new float[]{0.15f,0.15f,0.15f,0,0,1}
-                                                                       } );
-                               
-                               imagedisabled_attributes.SetColorMatrix( colorMatrix );
-                       }
-                       
-                       dc.DrawImage( image, new Rectangle( x, y, image.Width, image.Height ), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imagedisabled_attributes );
-                       
-               }
-               
-               
-               public override void CPDrawLockedFrame( Graphics dc, Rectangle rectangle, bool primary )
-               {
-                       Pen     penBorder;
-                       Pen     penInside;
-                       
-                       if ( primary )
-                       {
-                               penBorder = new Pen( Color.White, 2 );
-                               penInside = new Pen( Color.Black, 1 );
-                       }
-                       else
-                       {
-                               penBorder = new Pen( Color.Black, 2 );
-                               penInside = new Pen( Color.White, 1 );
-                       }
-                       penBorder.Alignment = PenAlignment.Inset;
-                       penInside.Alignment = PenAlignment.Inset;
-                       
-                       dc.DrawRectangle( penBorder, rectangle );
-                       dc.DrawRectangle( penInside, rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 5, rectangle.Height - 5 );
-                       penBorder.Dispose( );
-                       penInside.Dispose( );
-               }
-               
-               
-               public override void CPDrawMenuGlyph( Graphics dc, Rectangle rectangle, MenuGlyph glyph )
-               {
-                       Rectangle       rect;
-                       int                     lineWidth;
-                       
-                       // MS draws always the background white
-                       dc.FillRectangle( ResPool.GetSolidBrush( Color.White ), rectangle );
-                       
-                       switch ( glyph )
-                       {
-                               case MenuGlyph.Arrow: {
-                                               Point[]                 arrow = new Point[ 3 ];
-                                               Point                           P1;
-                                               Point                           P2;
-                                               Point                           P3;
-                                               int                             centerX;
-                                               int                             centerY;
-                                               int                             shiftX;
-                                               
-                                               rect = new Rectangle( rectangle.X + rectangle.Width / 4, rectangle.Y + rectangle.Height / 4, rectangle.Width / 2, rectangle.Height / 2 );
-                                               centerX = rect.Left + rect.Width / 2;
-                                               centerY = rect.Top + rect.Height / 2;
-                                               shiftX = Math.Max( 1, rect.Width / 8 );
-                                               
-                                               rect.X -= shiftX;
-                                               centerX -= shiftX;
-                                               
-                                               P1 = new Point( centerX, rect.Top - 1 );
-                                               P2 = new Point( centerX, rect.Bottom );
-                                               P3 = new Point( rect.Right, centerY );
-                                               
-                                               arrow[ 0 ] = P1;
-                                               arrow[ 1 ] = P2;
-                                               arrow[ 2 ] = P3;
-                                               
-                                               dc.FillPolygon( SystemBrushes.ControlText, arrow, FillMode.Winding );
-                                               
-                                               return;
-                                       }
-                                       
-                               case MenuGlyph.Bullet: {
-                                               
-                                               lineWidth = Math.Max( 2, rectangle.Width / 3 );
-                                               rect = new Rectangle( rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2 );
-                                               
-                                               dc.FillEllipse( ResPool.GetSolidBrush( ColorButtonText ), rect );
-                                               
-                                               return;
-                                       }
-                                       
-                               case MenuGlyph.Checkmark: {
-                                               int                     Scale;
-                                               
-                                               lineWidth = Math.Max( 2, rectangle.Width / 6 );
-                                               Scale = Math.Max( 1, rectangle.Width / 12 );
-                                               
-                                               rect = new Rectangle( rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2 );
-                                               
-                                               for ( int i=0; i < lineWidth; i++ )
-                                               {
-                                                       dc.DrawLine( SystemPens.MenuText, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i );
-                                                       dc.DrawLine( SystemPens.MenuText, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i );
-                                               }
-                                               return;
-                                       }
-                       }
-                       
-               }
-               
-               public override void CPDrawRadioButton( Graphics dc, Rectangle rectangle, ButtonState state )
-               {
-                       DrawFrameControlStates  dfcs=DrawFrameControlStates.ButtonRadio;
-                       
-                       if ( ( state & ButtonState.Pushed ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Pushed;
-                       }
-                       
-                       if ( ( state & ButtonState.Checked ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Checked;
-                       }
-                       
-                       if ( ( state & ButtonState.Flat ) != 0 )
-                       {
-                               dfcs |= DrawFrameControlStates.Flat;
+                               {
+                                       dc.DrawLines( pen, arrow );
+                               }
                        }
-                       
-                       if ( ( state & ButtonState.Inactive ) != 0 )
+                       else
                        {
-                               dfcs |= DrawFrameControlStates.Inactive;
+                               using ( Pen pen = new Pen( SystemColors.ControlText, 2 ) )
+                               {
+                                       dc.DrawLines( pen, arrow );
+                               }
                        }
-                       DrawFrameControl( dc, rectangle, DrawFrameControlTypes.Button, dfcs );
-                       
-               }
-               
-               
-               public override void CPDrawReversibleFrame( Rectangle rectangle, Color backColor, FrameStyle style )
-               {
-                       
                }
                
-               
-               public override void CPDrawReversibleLine( Point start, Point end, Color backColor )
-               {
-                       
-               }
-               
-               
                /* Scroll button: regular button + direction arrow */
                public override void CPDrawScrollButton( Graphics dc, Rectangle area, ScrollButton scroll_button_type, ButtonState state )
                {
                        bool enabled = ( state == ButtonState.Inactive ) ? false: true;
                        
-                       DrawScrollButtonPrimitiveNice( dc, area, state, scroll_button_type );
+                       DrawScrollButtonPrimitive( dc, area, state, scroll_button_type );
                        
                        if ( area.Width < 12 || area.Height < 12 ) /* Cannot see a thing at smaller sizes */
                                return;
@@ -5838,535 +1125,24 @@ namespace System.Windows.Forms
                        pen.Dispose( );
                }
                
-               public  override void CPDrawSelectionFrame( Graphics dc, bool active, Rectangle outsideRect, Rectangle insideRect,
-                                                          Color backColor )
-               {
-                       
-               }
-               
                public override void CPDrawSizeGrip( Graphics dc, Color backColor, Rectangle bounds )
                {
-                       Point pt = new Point( bounds.Right - 2, bounds.Bottom - 1 );
-                       
-                       Pen pen = ResPool.GetPen( ColorButtonFace );
-                       dc.DrawLine( pen, pt.X - 12, pt.Y, pt.X, pt.Y );
-                       dc.DrawLine( pen, pt.X, pt.Y, pt.X, pt.Y - 13 );
-                       
-                       // diagonals
-                       pen = ResPool.GetPen( ColorButtonShadow );
-                       for ( int i = 0; i < 11; i += 4 )
-                       {
-                               dc.DrawLine( pen, pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 2 );
-                               dc.DrawLine( pen, pt.X - i - 1, pt.Y, pt.X + 1, pt.Y - i - 2 );
-                       }
-                       
-                       pen = ResPool.GetPen( ColorButtonHilight );
-                       for ( int i = 3; i < 13; i += 4 )
-                               dc.DrawLine( pen, pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 1 );
-               }
-               
-               
-               public  override void CPDrawStringDisabled( Graphics dc, string s, Font font, Color color, RectangleF layoutRectangle,
-                                                          StringFormat format )
-               {
-                       
-                       layoutRectangle.Offset( 1.0f, 1.0f );
-                       dc.DrawString( s, font, ResPool.GetSolidBrush( ControlPaint.Light( color, 95 ) ), layoutRectangle, format );
-                       layoutRectangle.Offset( -1.0f, -1.0f );
-                       dc.DrawString( s, font, ResPool.GetSolidBrush( ControlPaint.Light( color, 50 ) ), layoutRectangle, format );
-                       
-               }
-               
-               private static void DrawBorderInternal( Graphics dc, int startX, int startY, int endX, int endY,
-                                                      int width, Color color, ButtonBorderStyle style, Border3DSide side )
-               {
-                       
-                       Pen     pen=new Pen( color, 1 );
-                       
-                       switch ( style )
-                       {
-                               case ButtonBorderStyle.Solid: {
-                                               pen.DashStyle = DashStyle.Solid;
-                                               break;
-                                       }
-                                       
-                               case ButtonBorderStyle.Dashed: {
-                                               pen.DashStyle = DashStyle.Dash;
-                                               break;
-                                       }
-                                       
-                               case ButtonBorderStyle.Dotted: {
-                                               pen.DashStyle = DashStyle.Dot;
-                                               break;
-                                       }
-                                       
-                               case ButtonBorderStyle.Inset: {
-                                               pen.DashStyle = DashStyle.Solid;
-                                               break;
-                                       }
-                                       
-                               case ButtonBorderStyle.Outset: {
-                                               pen.DashStyle = DashStyle.Solid;
-                                               break;
-                                       }
-                                       
-                               default:
-                               case ButtonBorderStyle.None: {
-                                               pen.Dispose( );
-                                               return;
-                                       }
-                       }
-                       
+                       Point pt = new Point( bounds.Right - 4, bounds.Bottom - 4 );
                        
-                       switch ( style )
-                       {
-                               case ButtonBorderStyle.Outset: {
-                                               Color           colorGrade;
-                                               int             hue, brightness, saturation;
-                                               int             brightnessSteps;
-                                               int             brightnessDownSteps;
-                                               
-                                               ControlPaint.Color2HBS( color, out hue, out brightness, out saturation );
-                                               
-                                               brightnessDownSteps = brightness / width;
-                                               if ( brightness > 127 )
-                                               {
-                                                       brightnessSteps = Math.Max( 6, ( 160 - brightness ) / width );
-                                               }
-                                               else
-                                               {
-                                                       brightnessSteps = ( 127 - brightness ) / width;
-                                               }
-                                               
-                                               for ( int i=0; i < width; i++ )
-                                               {
-                                                       switch ( side )
-                                                       {
-                                                               case Border3DSide.Left: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Min( 255, brightness + brightnessSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX + i, startY + i, endX + i, endY - i );
-                                                                               break;
-                                                                       }
-                                                                       
-                                                               case Border3DSide.Right: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Max( 0, brightness - brightnessDownSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX - i, startY + i, endX - i, endY - i );
-                                                                               break;
-                                                                       }
-                                                                       
-                                                               case Border3DSide.Top: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Min( 255, brightness + brightnessSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX + i, startY + i, endX - i, endY + i );
-                                                                               break;
-                                                                       }
-                                                                       
-                                                               case Border3DSide.Bottom: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Max( 0, brightness - brightnessDownSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX + i, startY - i, endX - i, endY - i );
-                                                                               break;
-                                                                       }
-                                                       }
-                                               }
-                                               break;
-                                       }
-                                       
-                               case ButtonBorderStyle.Inset: {
-                                               Color           colorGrade;
-                                               int             hue, brightness, saturation;
-                                               int             brightnessSteps;
-                                               int             brightnessDownSteps;
-                                               
-                                               ControlPaint.Color2HBS( color, out hue, out brightness, out saturation );
-                                               
-                                               brightnessDownSteps = brightness / width;
-                                               if ( brightness > 127 )
-                                               {
-                                                       brightnessSteps = Math.Max( 6, ( 160 - brightness ) / width );
-                                               }
-                                               else
-                                               {
-                                                       brightnessSteps = ( 127 - brightness ) / width;
-                                               }
-                                               
-                                               for ( int i=0; i < width; i++ )
-                                               {
-                                                       switch ( side )
-                                                       {
-                                                               case Border3DSide.Left: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Max( 0, brightness - brightnessDownSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX + i, startY + i, endX + i, endY - i );
-                                                                               break;
-                                                                       }
-                                                                       
-                                                               case Border3DSide.Right: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Min( 255, brightness + brightnessSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX - i, startY + i, endX - i, endY - i );
-                                                                               break;
-                                                                       }
-                                                                       
-                                                               case Border3DSide.Top: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Max( 0, brightness - brightnessDownSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX + i, startY + i, endX - i, endY + i );
-                                                                               break;
-                                                                       }
-                                                                       
-                                                               case Border3DSide.Bottom: {
-                                                                               pen.Dispose( );
-                                                                               colorGrade = ControlPaint.HBS2Color( hue, Math.Min( 255, brightness + brightnessSteps * ( width - i ) ), saturation );
-                                                                               pen = new Pen( colorGrade, 1 );
-                                                                               dc.DrawLine( pen, startX + i, startY - i, endX - i, endY - i );
-                                                                               break;
-                                                                       }
-                                                       }
-                                               }
-                                               break;
-                                       }
-                                       
-                                       /*
-                                        I decided to have the for-loop duplicated for speed reasons;
-                                        that way we only have to switch once (as opposed to have the
-                                        for-loop around the switch)
-                                        */
-                               default: {
-                                               switch ( side )
-                                               {
-                                                       case Border3DSide.Left: {
-                                                                       for ( int i=0; i < width; i++ )
-                                                                       {
-                                                                               dc.DrawLine( pen, startX + i, startY + i, endX + i, endY - i );
-                                                                       }
-                                                                       break;
-                                                               }
-                                                               
-                                                       case Border3DSide.Right: {
-                                                                       for ( int i=0; i < width; i++ )
-                                                                       {
-                                                                               dc.DrawLine( pen, startX - i, startY + i, endX - i, endY - i );
-                                                                       }
-                                                                       break;
-                                                               }
-                                                               
-                                                       case Border3DSide.Top: {
-                                                                       for ( int i=0; i < width; i++ )
-                                                                       {
-                                                                               dc.DrawLine( pen, startX + i, startY + i, endX - i, endY + i );
-                                                                       }
-                                                                       break;
-                                                               }
-                                                               
-                                                       case Border3DSide.Bottom: {
-                                                                       for ( int i=0; i < width; i++ )
-                                                                       {
-                                                                               dc.DrawLine( pen, startX + i, startY - i, endX - i, endY - i );
-                                                                       }
-                                                                       break;
-                                                               }
-                                               }
-                                               break;
-                                       }
-                       }
-                       pen.Dispose( );
-               }
-               
-               /*
-                This function actually draws the various caption elements.
-                This way we can scale them nicely, no matter what size, and they
-                still look like MS's scaled caption buttons. (as opposed to scaling a bitmap)
-                */
-               
-               private static void DrawCaptionHelper( Graphics graphics, Color color, Pen pen, int lineWidth, int shift, Rectangle captionRect, CaptionButton button )
-               {
-                       switch ( button )
-                       {
-                               case CaptionButton.Close: {
-                                               pen.StartCap = LineCap.Triangle;
-                                               pen.EndCap = LineCap.Triangle;
-                                               if ( lineWidth < 2 )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + 2 * lineWidth + 1 + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - 2 * lineWidth + 1 + shift, captionRect.Bottom - 2 * lineWidth + shift );
-                                                       graphics.DrawLine( pen, captionRect.Right - 2 * lineWidth + 1 + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + 2 * lineWidth + 1 + shift, captionRect.Bottom - 2 * lineWidth + shift );
-                                               }
-                                               
-                                               graphics.DrawLine( pen, captionRect.Left + 2 * lineWidth + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - 2 * lineWidth + shift, captionRect.Bottom - 2 * lineWidth + shift );
-                                               graphics.DrawLine( pen, captionRect.Right - 2 * lineWidth + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + 2 * lineWidth + shift, captionRect.Bottom - 2 * lineWidth + shift );
-                                               return;
-                                       }
-                                       
-                               case CaptionButton.Help: {
-                                               StringFormat    sf = new StringFormat( );
-                                               Font                            font = new Font( "Microsoft Sans Serif", captionRect.Height, FontStyle.Bold, GraphicsUnit.Pixel );
-                                               
-                                               sf.Alignment = StringAlignment.Center;
-                                               sf.LineAlignment = StringAlignment.Center;
-                                               
-                                               
-                                               graphics.DrawString( "?", font, ThemeEngine.Current.ResPool.GetSolidBrush( color ), captionRect.X + captionRect.Width / 2 + shift, captionRect.Y + captionRect.Height / 2 + shift + lineWidth / 2, sf );
-                                               
-                                               sf.Dispose( );
-                                               font.Dispose( );
-                                               
-                                               return;
-                                       }
-                                       
-                               case CaptionButton.Maximize: {
-                                               /* Top 'caption bar' line */
-                                               for ( int i=0; i < Math.Max( 2, lineWidth ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + lineWidth + shift, captionRect.Top + 2 * lineWidth + shift + i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Top + 2 * lineWidth + shift + i );
-                                               }
-                                               
-                                               /* Left side line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + lineWidth + shift + i, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + lineWidth + shift + i, captionRect.Bottom - lineWidth + shift );
-                                               }
-                                               
-                                               /* Right side line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Right - lineWidth - lineWidth / 2 + shift + i, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - lineWidth - lineWidth / 2 + shift + i, captionRect.Bottom - lineWidth + shift );
-                                               }
-                                               
-                                               /* Bottom line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + lineWidth + shift, captionRect.Bottom - lineWidth + shift - i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Bottom - lineWidth + shift - i );
-                                               }
-                                               return;
-                                       }
-                                       
-                               case CaptionButton.Minimize: {
-                                               /* Bottom line */
-                                               for ( int i=0; i < Math.Max( 2, lineWidth ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + lineWidth + shift, captionRect.Bottom - lineWidth + shift - i, captionRect.Right - 3 * lineWidth + shift, captionRect.Bottom - lineWidth + shift - i );
-                                               }
-                                               return;
-                                       }
-                                       
-                               case CaptionButton.Restore: {
-                                               /** First 'window' **/
-                                               /* Top 'caption bar' line */
-                                               for ( int i=0; i < Math.Max( 2, lineWidth ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + 3 * lineWidth + shift, captionRect.Top + 2 * lineWidth + shift - i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Top + 2 * lineWidth + shift - i );
-                                               }
-                                               
-                                               /* Left side line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + 3 * lineWidth + shift + i, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + 3 * lineWidth + shift + i, captionRect.Top + 4 * lineWidth + shift );
-                                               }
-                                               
-                                               /* Right side line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Right - lineWidth - lineWidth / 2 + shift - i, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - lineWidth - lineWidth / 2 + shift - i, captionRect.Top + 5 * lineWidth - lineWidth / 2 + shift );
-                                               }
-                                               
-                                               /* Bottom line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift, captionRect.Top + 5 * lineWidth - lineWidth / 2 + shift + 1 + i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Top + 5 * lineWidth - lineWidth / 2 + shift + 1 + i );
-                                               }
-                                               
-                                               /** Second 'window' **/
-                                               /* Top 'caption bar' line */
-                                               for ( int i=0; i < Math.Max( 2, lineWidth ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + lineWidth + shift, captionRect.Top + 4 * lineWidth + shift + 1 - i, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift, captionRect.Top + 4 * lineWidth + shift + 1 - i );
-                                               }
-                                               
-                                               /* Left side line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + lineWidth + shift + i, captionRect.Top + 4 * lineWidth + shift + 1, captionRect.Left + lineWidth + shift + i, captionRect.Bottom - lineWidth + shift );
-                                               }
-                                               
-                                               /* Right side line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift - i, captionRect.Top + 4 * lineWidth + shift + 1, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift - i, captionRect.Bottom - lineWidth + shift );
-                                               }
-                                               
-                                               /* Bottom line */
-                                               for ( int i=0; i < Math.Max( 1, lineWidth / 2 ); i++ )
-                                               {
-                                                       graphics.DrawLine( pen, captionRect.Left + lineWidth + shift, captionRect.Bottom - lineWidth + shift - i, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift, captionRect.Bottom - lineWidth + shift - i );
-                                               }
-                                               
-                                               return;
-                                       }
-                                       
-                       }
-               }
-               
-               //[MonoTODO("Finish drawing code for Caption, Menu and Scroll")]
-               private void DrawFrameControl( Graphics dc, Rectangle rectangle, DrawFrameControlTypes Type, DrawFrameControlStates State )
-               {
-                       // make a rectange to trace around border of the button
-                       Rectangle trace_rectangle = new Rectangle( rectangle.X, rectangle.Y, Math.Max( rectangle.Width - 1, 0 ), Math.Max( rectangle.Height - 1, 0 ) );
-                       switch ( Type )
+                       using ( Bitmap bmp = new Bitmap( 4, 4 ) )
                        {
-                               case DrawFrameControlTypes.Button: {
-                                               
-                                               if ( ( State & DrawFrameControlStates.ButtonPush ) != 0 )
-                                               {
-// JBA 31 oct 2004 - I don't think that button style should be rendered like this
-//                                     /* Goes first, affects the background */
-//                                     if ((State & DrawFrameControlStates.Checked)!=0) {
-//                                             HatchBrush      hatchBrush=new HatchBrush(HatchStyle.Percent50, ColorButtonLight, ColorButtonHilight);
-//                                             graphics.FillRectangle(hatchBrush,rectangle);
-//                                             hatchBrush.Dispose();
-//                                     }
-                                                       
-                                                       // Clear the background
-                                                       dc.FillRectangle( SystemBrushes.Control, rectangle );
-                                                       
-                                                       if ( ( State & DrawFrameControlStates.Pushed ) != 0 || ( State & DrawFrameControlStates.Checked ) != 0 )
-                                                       {
-                                                               dc.DrawRectangle( ResPool.GetPen( ControlPaint.Dark( ColorButtonFace ) ), trace_rectangle );
-                                                       }
-                                                       else if ( ( State & DrawFrameControlStates.Flat ) != 0 )
-                                                       {
-                                                               ControlPaint.DrawBorder( dc, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid );
-                                                       }
-                                                       else if ( ( State & DrawFrameControlStates.Inactive ) != 0 )
-                                                       {
-                                                               /* Same as normal, it would seem */
-                                                               CPDrawBorder3D( dc, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
-                                                       }
-                                                       else
-                                                       {
-                                                               CPDrawBorder3D( dc, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
-                                                       }
-                                               }
-                                               else if ( ( State & DrawFrameControlStates.ButtonRadio ) != 0 )
-                                               {
-                                                       Pen                     penFatDark      = new Pen( ColorButtonShadow, 1 );
-                                                       Pen                     penFatLight     = new Pen( ColorButtonLight, 1 );
-                                                       int                     lineWidth;
-                                                       
-                                                       dc.FillPie( ResPool.GetSolidBrush( this.ColorWindow ), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359 );
-                                                       
-                                                       dc.DrawArc( penFatDark, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 135, 180 );
-                                                       dc.DrawArc( penFatLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 315, 180 );
-                                                       
-                                                       dc.DrawArc( SystemPens.ControlDark, rectangle, 135, 180 );
-                                                       dc.DrawArc( SystemPens.ControlLightLight, rectangle, 315, 180 );
-                                                       
-                                                       lineWidth = Math.Max( 1, Math.Min( rectangle.Width, rectangle.Height ) / 3 );
-                                                       
-                                                       if ( ( State & DrawFrameControlStates.Checked ) != 0 )
-                                                       {
-                                                               SolidBrush      buttonBrush;
-                                                               
-                                                               if ( ( State & DrawFrameControlStates.Inactive ) != 0 )
-                                                               {
-                                                                       buttonBrush = (SolidBrush)SystemBrushes.ControlDark;
-                                                               }
-                                                               else
-                                                               {
-                                                                       buttonBrush = (SolidBrush)SystemBrushes.ControlText;
-                                                               }
-                                                               dc.FillPie( buttonBrush, rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2, 0, 359 );
-                                                       }
-                                                       penFatDark.Dispose( );
-                                                       penFatLight.Dispose( );
-                                               }
-                                               else if ( ( State & DrawFrameControlStates.ButtonRadioImage ) != 0 )
-                                               {
-                                                       throw new NotImplementedException( ) ;
-                                               }
-                                               else if ( ( State & DrawFrameControlStates.ButtonRadioMask ) != 0 )
-                                               {
-                                                       throw new NotImplementedException( );
-                                               }
-                                               else
-                                               {       /* Must be Checkbox */
-                                                       Pen                     pen;
-                                                       int                     lineWidth;
-                                                       Rectangle       rect;
-                                                       int                     Scale;
-                                                       
-                                                       /* Goes first, affects the background */
-                                                       if ( ( State & DrawFrameControlStates.Pushed ) != 0 ||
-                                                           ( State & DrawFrameControlStates.Inactive ) != 0 )
-                                                       {
-                                                               dc.FillRectangle( SystemBrushes.Control, rectangle );
-                                                       }
-                                                       else
-                                                       {
-                                                               dc.FillRectangle( SystemBrushes.Window, rectangle );
-                                                       }
-                                                       
-                                                       /* Draw the sunken frame */
-                                                       if ( ( State & DrawFrameControlStates.Flat  ) != 0 )
-                                                       {
-                                                               ControlPaint.DrawBorder( dc, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid  );
-                                                       }
-                                                       else
-                                                       {
-                                                               CPDrawBorder3D( dc, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top  | Border3DSide.Right  | Border3DSide.Bottom, ColorButtonFace );
-                                                       }
-                                                       
-                                                       /* Make sure we've got at least a line width of 1 */
-                                                       lineWidth = Math.Max( 3, rectangle.Width / 6 );
-                                                       Scale = Math.Max( 1, rectangle.Width / 12 );
-                                                       
-                                                       // define a rectangle inside the border area
-                                                       rect = new Rectangle( rectangle.X + 2, rectangle.Y   + 2, rectangle.Width  - 4, rectangle.Height - 4 );
-                                                       if ( ( State & DrawFrameControlStates.Inactive  ) != 0 )
-                                                       {
-                                                               pen = SystemPens.ControlDark;
-                                                       }
-                                                       else
-                                                       {
-                                                               pen = SystemPens.ControlText;
-                                                       }
-                                                       
-                                                       if ( ( State & DrawFrameControlStates.Checked ) != 0 )
-                                                       {
-                                                               /* Need to draw a check-mark */
-                                                               for ( int i=0; i < lineWidth; i++ )
-                                                               {
-                                                                       dc.DrawLine( pen, rect.Left  + lineWidth / 2, rect.Top  + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top  + lineWidth + 2 * Scale + i );
-                                                                       dc.DrawLine( pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i );
-                                                               }
-                                                               
-                                                       }
-                                               }
-                                               return;
-                                       }
-                                       
-                               case DrawFrameControlTypes.Caption: {
-                                               // FIXME:
-                                               break;
-                                       }
-                                       
-                               case DrawFrameControlTypes.Menu: {
-                                               // FIXME:
-                                               break;
-                                       }
-                                       
-                               case DrawFrameControlTypes.Scroll: {
-                                               // FIXME:
-                                               break;
-                                       }
+                               using ( Graphics gr = Graphics.FromImage( bmp ) )
+                               {
+                                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 4, 4 ), PressedColor, Color.White ) )
+                                               gr.FillEllipse( lgbr, new Rectangle( 0, 0, 4, 4 ) );
+                               }
+                               
+                               dc.DrawImage( bmp, pt );
+                               dc.DrawImage( bmp, pt.X, pt.Y - 5 );
+                               dc.DrawImage( bmp, pt.X, pt.Y - 10 );
+                               dc.DrawImage( bmp, pt.X - 5, pt.Y );
+                               dc.DrawImage( bmp, pt.X - 10, pt.Y );
+                               dc.DrawImage( bmp, pt.X - 5, pt.Y - 5 );
                        }
                }
                
@@ -6379,7 +1155,7 @@ namespace System.Windows.Forms
                        else
                                lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.X, area.Bottom - 1 ), Color.White, NormalColor );
                        
-                       Pen pen = new Pen( BorderColor );
+                       Pen pen = ResPool.GetPen( BorderColor );
                        
                        Point[] points = new Point[] {
                                new Point( area.X + 2, area.Y ),
@@ -6401,15 +1177,20 @@ namespace System.Windows.Forms
                                // draw grip lines only if stere is enough space
                                if ( area.Height > 12 )
                                {
+                                       int mid_y = area.Y + ( area.Height / 2 );
+                                       int mid_x = area.X + ( area.Width / 2 );
+                                       
                                        using ( Pen lpen = new Pen( MouseOverColor, 2 ) )
                                        {
-                                               int mid_y = area.Y + ( area.Height / 2 );
-                                               int mid_x = area.X + ( area.Width / 2 );
-                                               
                                                dc.DrawLine( lpen, mid_x - 3, mid_y, mid_x + 3, mid_y );
                                                dc.DrawLine( lpen, mid_x - 3, mid_y - 4, mid_x + 3, mid_y - 4 );
                                                dc.DrawLine( lpen, mid_x - 3, mid_y + 4, mid_x + 3, mid_y + 4 );
                                        }
+                                       
+                                       Pen spen = ResPool.GetPen( Color.White );
+                                       dc.DrawLine( spen, mid_x - 3, mid_y - 1, mid_x + 3, mid_y - 1 );
+                                       dc.DrawLine( spen, mid_x - 3, mid_y - 5, mid_x + 3, mid_y - 5 );
+                                       dc.DrawLine( spen, mid_x - 3, mid_y + 3, mid_x + 3, mid_y + 3 );
                                }
                        }
                        else
@@ -6420,26 +1201,30 @@ namespace System.Windows.Forms
                                // draw grip lines only if stere is enough space
                                if ( area.Width > 12 )
                                {
+                                       int mid_x = area.X +  ( area.Width / 2 );
+                                       int mid_y = area.Y +  ( area.Height / 2 );
+                                       
                                        using ( Pen lpen = new Pen( MouseOverColor, 2 ) )
                                        {
-                                               int mid_x = area.X +  ( area.Width / 2 );
-                                               int mid_y = area.Y +  ( area.Height / 2 );
-                                               
                                                dc.DrawLine( lpen, mid_x, mid_y - 3, mid_x, mid_y + 3 );
                                                dc.DrawLine( lpen, mid_x - 4, mid_y - 3, mid_x - 4, mid_y + 3 );
                                                dc.DrawLine( lpen, mid_x + 4, mid_y - 3, mid_x + 4, mid_y + 3 );
                                        }
+                                       
+                                       Pen spen = ResPool.GetPen( Color.White );
+                                       dc.DrawLine( spen, mid_x - 1, mid_y - 3, mid_x - 1, mid_y + 3 );
+                                       dc.DrawLine( spen, mid_x - 5, mid_y - 3, mid_x - 5, mid_y + 3 );
+                                       dc.DrawLine( spen, mid_x + 3, mid_y - 3, mid_x + 3, mid_y + 3 );
                                }
                        }
                        
                        lgbr.Dispose( );
-                       pen.Dispose( );
                }
                
-               /* Generic scroll button */
-               public void DrawScrollButtonPrimitiveNice( Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type )
+               /* Nice scroll button */
+               public void DrawScrollButtonPrimitive( Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type )
                {
-                       Pen pen = new Pen( BorderColor );
+                       Pen pen = ResPool.GetPen( BorderColor );
                        
                        Color use_color;
                        
@@ -6487,82 +1272,7 @@ namespace System.Windows.Forms
                        }
                        
                        lgbr.Dispose( );
-                       
-                       pen.Dispose( );
-               }
-               
-//             /* Generic scroll button */
-//             public void DrawScrollButtonPrimitive( Graphics dc, Rectangle area, ButtonState state )
-//             {
-//                     if ( ( state & ButtonState.Pushed ) == ButtonState.Pushed )
-//                     {
-//                             dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonFace ), area.X + 1,
-//                                              area.Y + 1, area.Width - 2 , area.Height - 2 );
-//
-//                             dc.DrawRectangle( ResPool.GetPen( ColorButtonShadow ), area.X,
-//                                              area.Y, area.Width, area.Height );
-//
-//                             return;
-//                     }
-//
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonFace ), area.X, area.Y, area.Width, 1 );
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonFace ), area.X, area.Y, 1, area.Height );
-//
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonHilight ), area.X + 1, area.Y + 1, area.Width - 1, 1 );
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonHilight ), area.X + 1, area.Y + 2, 1,
-//                                      area.Height - 4 );
-//
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonShadow ), area.X + 1, area.Y + area.Height - 2,
-//                                      area.Width - 2, 1 );
-//
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonDkShadow ), area.X, area.Y + area.Height - 1,
-//                                      area.Width , 1 );
-//
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonShadow ), area.X + area.Width - 2,
-//                                      area.Y + 1, 1, area.Height - 3 );
-//
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonDkShadow ), area.X + area.Width - 1,
-//                                      area.Y, 1, area.Height - 1 );
-//
-//                     dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonFace ), area.X + 2,
-//                                      area.Y + 2, area.Width - 4, area.Height - 4 );
-//
-//             }
-               
-               public override void CPDrawBorderStyle( Graphics dc, Rectangle area, BorderStyle border_style )
-               {
-                       switch ( border_style )
-                       {
-                               case BorderStyle.Fixed3D:
-                                       Pen pen = ResPool.GetPen( ColorButtonShadow );
-                                       dc.DrawLine( pen, area.X, area.Y, area.X + area.Width, area.Y );
-                                       dc.DrawLine( pen, area.X, area.Y, area.X, area.Y + area.Height );
-                                       
-                                       pen = ResPool.GetPen( ColorButtonHilight );
-                                       dc.DrawLine( pen, area.X , area.Y + area.Height - 1, area.X + area.Width ,
-                                                   area.Y + area.Height - 1 );
-                                       dc.DrawLine( pen, area.X + area.Width - 1 , area.Y, area.X + area.Width - 1,
-                                                   area.Y + area.Height );
-                                       
-                                       pen = ResPool.GetPen( ColorActiveBorder );
-                                       dc.DrawLine( pen, area.X + 1, area.Bottom - 2, area.Right - 2, area.Bottom - 2 );
-                                       dc.DrawLine( pen, area.Right - 2, area.Top + 1, area.Right - 2, area.Bottom - 2 );
-                                       
-                                       pen = ResPool.GetPen( ColorButtonDkShadow );
-                                       dc.DrawLine( pen, area.X + 1, area.Top + 1, area.X + 1, area.Bottom - 3 );
-                                       dc.DrawLine( pen, area.X + 1, area.Top + 1, area.Right - 3, area.Top + 1 );
-                                       break;
-                               case BorderStyle.FixedSingle:
-                                       dc.DrawRectangle( ResPool.GetPen( BorderColor ), area.X, area.Y, area.Width - 1, area.Height - 1 );
-                                       break;
-                               case BorderStyle.None:
-                               default:
-                                       break;
-                       }
-                       
                }
-               #endregion      // ControlPaint
-               
-               
        } //class
 }
+
index b372b6fb49de746341adeda39d443e9c391462e9..5a22a7bc793a4b94c3a4d016f14dfca8a6ef91f0 100644 (file)
@@ -37,11 +37,11 @@ namespace System.Windows.Forms
 
        internal class ThemeWin32Classic : Theme
        {               
-               public override Version Version {\r
-                       get {\r
-                               return new Version(0, 1, 0, 0);\r
-                       }\r
-               }\r
+               public override Version Version {
+                       get {
+                               return new Version(0, 1, 0, 0);
+                       }
+               }
 
 
                /* Default colors for Win32 classic theme */
@@ -75,12 +75,12 @@ namespace System.Windows.Forms
                };              
                                
                /* Hardcoded colour values not exposed in the API constants in all configurations */
-               static readonly Color arrow_color = Color.Black;
-               static readonly Color pen_ticks_color = Color.Black;
-               static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
-               static StringFormat string_format_menu_text;
-               static StringFormat string_format_menu_shortcut;
-               static StringFormat string_format_menu_menubar_text;
+               protected static readonly Color arrow_color = Color.Black;
+               protected static readonly Color pen_ticks_color = Color.Black;
+               protected static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
+               protected static StringFormat string_format_menu_text;
+               protected static StringFormat string_format_menu_shortcut;
+               protected static StringFormat string_format_menu_menubar_text;
                static readonly Rectangle checkbox_rect = new Rectangle (2, 2, 11,11); // Position of the checkbox relative to the item
                static ImageAttributes imagedisabled_attributes = null;
                const int SEPARATOR_HEIGHT = 5;
@@ -161,15 +161,28 @@ namespace System.Windows.Forms
 
                #region ButtonBase
                public override void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button) {
-                       int             width;
-                       int             height;
+                       // Draw the button: fill rectangle, draw border, etc.
+                       ButtonBase_DrawButton(button, dc);
+                       
+                       // First, draw the image
+                       if ((button.image != null) || (button.image_list != null))
+                               ButtonBase_DrawImage(button, dc);
+                       
+                       // Draw the focus rectangle
+                       if (button.has_focus)
+                               ButtonBase_DrawFocus(button, dc);
+                       
+                       // Now the text
+                       if (button.text != null && button.text != String.Empty)
+                               ButtonBase_DrawText(button, dc);
+               }
+
+               protected virtual void ButtonBase_DrawButton(ButtonBase button, Graphics dc)
+               {
                        Rectangle buttonRectangle;
                        Rectangle borderRectangle;
-
-                       width = button.ClientSize.Width;
-                       height = button.ClientSize.Height;
                        
-                       dc.FillRectangle(ResPool.GetSolidBrush (button.BackColor), button.ClientRectangle);                     
+                       dc.FillRectangle(ResPool.GetSolidBrush (button.BackColor), button.ClientRectangle);
                        
                        // set up the button rectangle
                        buttonRectangle = button.ClientRectangle;
@@ -179,132 +192,136 @@ namespace System.Windows.Forms
                        } else {
                                borderRectangle = buttonRectangle;
                        }
-
+                       
                        if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
                                DrawFlatStyleButton (dc, borderRectangle, button);
                        } else {
-                               CPDrawButton(dc, borderRectangle, button.ButtonState);                          
+                               CPDrawButton(dc, borderRectangle, button.ButtonState);
                        }
-                       
-                       // First, draw the image
-                       if ((button.image != null) || (button.image_list != null)) {
-                               // Need to draw a picture
-                               Image   i;
-                               int     image_x;
-                               int     image_y;
-                               int     image_width;
-                               int     image_height;
-
-                               if (button.ImageIndex!=-1) {    // We use ImageIndex instead of image_index since it will return -1 if image_list is null
-                                       i = button.image_list.Images[button.image_index];
-                               } else {
-                                       i = button.image;
-                               }
-
-                               image_width = button.image.Width;
-                               image_height = button.image.Height;
+               }
 
-                               switch(button.image_alignment) {
+               protected virtual void ButtonBase_DrawImage(ButtonBase button, Graphics dc)
+               {
+                       // Need to draw a picture
+                       Image   i;
+                       int     image_x;
+                       int     image_y;
+                       int     image_width;
+                       int     image_height;
+                       
+                       int width = button.ClientSize.Width;
+                       int height = button.ClientSize.Height;
+                       
+                       if (button.ImageIndex != -1) {   // We use ImageIndex instead of image_index since it will return -1 if image_list is null
+                               i = button.image_list.Images[button.image_index];
+                       } else {
+                               i = button.image;
+                       }
+                       
+                       image_width = button.image.Width;
+                       image_height = button.image.Height;
+                       
+                       switch (button.image_alignment) {
                                case ContentAlignment.TopLeft: {
                                        image_x=0;
                                        image_y=0;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.TopCenter: {
                                        image_x=(width-image_width)/2;
                                        image_y=0;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.TopRight: {
                                        image_x=width-image_width;
                                        image_y=0;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.MiddleLeft: {
                                        image_x=0;
                                        image_y=(height-image_height)/2;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.MiddleCenter: {
                                        image_x=(width-image_width)/2;
                                        image_y=(height-image_height)/2;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.MiddleRight: {
                                        image_x=width-image_width;
                                        image_y=(height-image_height)/2;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.BottomLeft: {
                                        image_x=0;
                                        image_y=height-image_height;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.BottomCenter: {
                                        image_x=(width-image_width)/2;
                                        image_y=height-image_height;
                                        break;
                                }
-
+                                       
                                case ContentAlignment.BottomRight: {
                                        image_x=width-image_width;
                                        image_y=height-image_height;
                                        break;
                                }
-
+                                       
                                default: {
                                        image_x=0;
                                        image_y=0;
                                        break;
                                }
-                               }
-
-                               if (button.is_pressed) {
-                                       image_x+=1;
-                                       image_y+=1;
-                               }
-
-                               if (button.is_enabled) {
-                                       dc.DrawImage(i, image_x, image_y); 
-                               } else {
-                                       CPDrawImageDisabled(dc, i, image_x, image_y, ColorButtonFace);
-                               }
                        }
                        
-                       // Draw the focus rectangle
-                       if (button.has_focus) {
-                               if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
-                                       DrawFlatStyleFocusRectangle (dc, button.ClientRectangle, button, button.ForeColor, button.BackColor);
-                               } else { 
-                                       CPDrawFocusRectangle(dc, button.ClientRectangle, button.ForeColor, button.BackColor);
-                               }
+                       if (button.is_pressed) {
+                               image_x+=1;
+                               image_y+=1;
                        }
                        
-                       // Now the text
-                       if (button.text != null && button.text != String.Empty) {
-                               Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4);
-
-                               if (button.is_pressed) {
-                                       text_rect.X++;
-                                       text_rect.Y++;
-                               }
-
-                               if (button.is_enabled) {                                        
-                                       dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (button.ForeColor), text_rect, button.text_format);
-                                       
+                       if (button.is_enabled) {
+                               dc.DrawImage(i, image_x, image_y); 
+                       }
+                       else {
+                               CPDrawImageDisabled(dc, i, image_x, image_y, ColorButtonFace);
+                       }
+               }
+               
+               protected virtual void ButtonBase_DrawFocus(ButtonBase button, Graphics dc)
+               {
+                       if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+                               DrawFlatStyleFocusRectangle (dc, button.ClientRectangle, button, button.ForeColor, button.BackColor);
+                       } else { 
+                               CPDrawFocusRectangle(dc, button.ClientRectangle, button.ForeColor, button.BackColor);
+                       }
+               }
+               
+               protected virtual void ButtonBase_DrawText(ButtonBase button, Graphics dc)
+               {
+                       Rectangle buttonRectangle = button.ClientRectangle;
+                       Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4);
+                       
+                       if (button.is_pressed) {
+                               text_rect.X++;
+                               text_rect.Y++;
+                       }
+                       
+                       if (button.is_enabled) {                                        
+                               dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (button.ForeColor), text_rect, button.text_format);
+                       } else {
+                               if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+                                       dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rect, button.text_format);
                                } else {
-                                       if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
-                                               dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rect, button.text_format);
-                                       } else {
-                                               CPDrawStringDisabled(dc, button.text, button.Font, ColorButtonText, text_rect, button.text_format);
-                                       }
+                                       CPDrawStringDisabled(dc, button.text, button.Font, ColorButtonText, text_rect, button.text_format);
                                }
                        }
                }
@@ -408,7 +425,6 @@ namespace System.Windows.Forms
                        Rectangle               client_rectangle;
                        Rectangle               text_rectangle;
                        Rectangle               checkbox_rectangle;
-                       SolidBrush              sb;
                        int                     checkmark_size=13;
                        int                     checkmark_space = 4;
 
@@ -576,6 +592,15 @@ namespace System.Windows.Forms
                        
                        // Start drawing
                        
+                       CheckBox_DrawCheckBox(dc, checkbox, state, checkbox_rectangle);
+                       
+                       CheckBox_DrawText(checkbox, text_rectangle, dc, text_format);
+
+                       CheckBox_DrawFocus(checkbox, dc, text_rectangle);
+               }
+
+               protected virtual void CheckBox_DrawCheckBox( Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle )
+               {
                        dc.FillRectangle (ResPool.GetSolidBrush (checkbox.BackColor), checkbox.ClientRectangle);                        
                        // render as per normal button
                        if (checkbox.appearance==Appearance.Button) {
@@ -592,6 +617,11 @@ namespace System.Windows.Forms
                                        ControlPaint.DrawCheckBox(dc, checkbox_rectangle, state);
                                }
                        }
+               }
+               
+               protected virtual void CheckBox_DrawText( CheckBox checkbox, Rectangle text_rectangle, Graphics dc, StringFormat text_format )
+               {
+                       SolidBrush sb;
                        
                        // offset the text if it's pressed and a button
                        if (checkbox.Appearance == Appearance.Button) {
@@ -606,13 +636,16 @@ namespace System.Windows.Forms
                        /* Place the text; to be compatible with Windows place it after the checkbox has been drawn */
                        if (checkbox.Enabled) {
                                sb = ResPool.GetSolidBrush(checkbox.ForeColor);
-                               dc.DrawString(checkbox.Text, checkbox.Font, sb, text_rectangle, text_format);                           
+                               dc.DrawString(checkbox.Text, checkbox.Font, sb, text_rectangle, text_format);                   
                        } else if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
                                dc.DrawString(checkbox.Text, checkbox.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rectangle, text_format);
                        } else {
                                CPDrawStringDisabled(dc, checkbox.Text, checkbox.Font, ColorButtonText, text_rectangle, text_format);
                        }
-
+               }
+               
+               protected virtual void CheckBox_DrawFocus( CheckBox checkbox, Graphics dc, Rectangle text_rectangle )
+               {
                        if (checkbox.Focused) {
                                if (checkbox.FlatStyle != FlatStyle.Flat) {
                                        DrawInnerFocusRectangle (dc, Rectangle.Inflate (text_rectangle, -1, -1), checkbox.BackColor);
@@ -623,7 +656,7 @@ namespace System.Windows.Forms
                }
 
                // renders a checkBox with the Flat and Popup FlatStyle
-               private void DrawFlatStyleCheckBox (Graphics graphics, Rectangle rectangle, CheckBox checkbox)
+               protected virtual void DrawFlatStyleCheckBox (Graphics graphics, Rectangle rectangle, CheckBox checkbox)
                {
                        Pen                     pen;                    
                        Rectangle       rect;
@@ -861,6 +894,7 @@ namespace System.Windows.Forms
                public override int DataGridMinimumColumnCheckBoxHeight { get { return 16;} }
                public override int DataGridMinimumColumnCheckBoxWidth { get { return 16;} }
                public override Color DataGridAlternatingBackColor { get { return ColorWindow;} }
+               public override Color DataGridBackColor { get  { return  ColorWindow;} }                
                public override Color DataGridBackgroundColor { get  { return  ColorAppWorkSpace;} }
                public override Color DataGridCaptionBackColor { get  { return ColorActiveTitle;} }
                public override Color DataGridCaptionForeColor { get  { return SystemColors.ActiveCaptionText;} }
@@ -946,10 +980,12 @@ namespace System.Windows.Forms
                        // Set column painting
                        Rectangle rect_columnhdr = new Rectangle ();
                        int col_pixel;
-                       Region prev_clip = g.Clip, current_clip;
+                       Region current_clip;
                        rect_columnhdr.Y = columns_area.Y;
                        rect_columnhdr.Height = columns_area.Height;
                        
+                       current_clip = new Region (columns_area);
+                       g.Clip = current_clip;
                        int column_cnt = grid.first_visiblecolumn + grid.visiblecolumn_count;
                        for (int column = grid.first_visiblecolumn; column < column_cnt; column++) {
                                
@@ -959,16 +995,14 @@ namespace System.Windows.Forms
 
                                if (clip.IntersectsWith (rect_columnhdr) == false)
                                        continue;
-                                                                       
-                               current_clip = new Region (columns_area);
-                               g.Clip = current_clip;
 
                                grid.CurrentTableStyle.GridColumnStyles[column].PaintHeader (g, rect_columnhdr, column);
 
-                               g.Clip = prev_clip;
-                               current_clip.Dispose ();
+                               
                        }
 
+                       current_clip.Dispose ();
+                       g.ResetClip ();
                        
                        // This fills with background colour the unused part in the row headers
                        if (rect_columnhdr.X + rect_columnhdr.Height < grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width) {
@@ -995,6 +1029,7 @@ namespace System.Windows.Forms
                                rowcnt++;
                        }
 
+                       g.SetClip (grid.grid_drawing.rowshdrs_area);
                        for (int row = grid.FirstVisibleRow; row < rowcnt; row++) {
 
                                rect_row.Width = grid.grid_drawing.rowshdrs_area.Width;
@@ -1006,6 +1041,8 @@ namespace System.Windows.Forms
                                        last_y = rect_row.Y;
                                }
                        }
+                       
+                       g.ResetClip ();
 
                        // This fills with background colour the unused part in the row headers
                        if (last_y > 0 && rect_row.Y + rect_row.Height < grid.grid_drawing.cells_area.Y + grid.grid_drawing.cells_area.Height) {
@@ -1017,6 +1054,8 @@ namespace System.Windows.Forms
                                g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor),
                                        not_usedarea);
                        }                       
+
+                       
                }
                
                public override void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid) 
@@ -1289,7 +1328,7 @@ namespace System.Windows.Forms
                        
                        /* Text */
                        if (box.Enabled) {
-                               dc.DrawString (box.Text, box.Font, new SolidBrush (box.ForeColor), 10, 0, text_format);
+                               dc.DrawString (box.Text, box.Font, ResPool.GetSolidBrush (box.ForeColor), 10, 0, text_format);
                        } else {
                                CPDrawStringDisabled (dc, box.Text, box.Font, box.ForeColor, 
                                        new RectangleF (10, 0, width,  box.Font.Height), text_format);
@@ -1333,38 +1372,38 @@ namespace System.Windows.Forms
                                return new Size (100, 23);
                        }
                }
-               #endregion      // Label\r
-\r
-               #region LinkLabel\r
-               public  override void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label)\r
-               {\r
-                       Color color;\r
-\r
-                       dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);\r
+               #endregion      // Label
+
+               #region LinkLabel
+               public  override void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label)
+               {
+                       Color color;
+
+                       dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);
                        CPDrawBorderStyle (dc, label.ClientRectangle, label.BorderStyle);                                               
-\r
+
                        for (int i = 0; i < label.num_pieces; i++) {
                                
                                if (clip_rectangle.IntersectsWith (label.pieces[i].rect) == false) {
                                        continue;
                                }                               
-                               \r
-                               color = label.GetLinkColor (label.pieces[i], i);\r
-\r
-                               if (label.pieces[i].link == null)\r
-                                       dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (Color.Black),\r
-                                               label.pieces[i].rect.X, label.pieces[i].rect.Y);\r
-                               else\r
-                                       dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (color),\r
+                               
+                               color = label.GetLinkColor (label.pieces[i], i);
+
+                               if (label.pieces[i].link == null)
+                                       dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (Color.Black),
+                                               label.pieces[i].rect.X, label.pieces[i].rect.Y);
+                               else
+                                       dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (color),
                                                label.pieces[i].rect.X, label.pieces[i].rect.Y);
                                                
                                if (label.pieces[i].focused) {                                  
                                        CPDrawFocusRectangle (dc, label.pieces[i].rect, label.ForeColor, label.BackColor);
-                               }\r
+                               }
                        }                       
-                       \r
-               }\r
-               #endregion      // LinkLabel\r
+                       
+               }
+               #endregion      // LinkLabel
                #region ListBox
                
                // Drawing              
@@ -1434,7 +1473,7 @@ namespace System.Windows.Forms
 
                        e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
                                ThemeEngine.Current.ResPool.GetSolidBrush (fore_color),
-                               e.Bounds, string_format);
+                               e.Bounds.X, e.Bounds.Y, string_format);
                                        
                        if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
                                ThemeEngine.Current.CPDrawFocusRectangle (e.Graphics, e.Bounds,
@@ -1454,7 +1493,7 @@ namespace System.Windows.Forms
 
                        // border is drawn directly in the Paint method
                        if (details && control.HeaderStyle != ColumnHeaderStyle.None) {
-                               dc.FillRectangle (ResPool.GetSolidBrush (SystemColors.Control),
+                               dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor),
                                                  0, 0, control.TotalWidth, control.Font.Height + 5);
                                if (control.Columns.Count > 0) {
                                        if (control.HeaderStyle == ColumnHeaderStyle.Clickable) {
@@ -2055,7 +2094,7 @@ namespace System.Windows.Forms
                #region MonthCalendar
 
                // draw the month calendar
-               public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc) \r
+               public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc) 
                {
                        Rectangle client_rectangle = mc.ClientRectangle;
                        Size month_size = mc.SingleMonthSize;
@@ -2067,20 +2106,20 @@ namespace System.Windows.Forms
                        int x_offset = 1;
                        int y_offset = 1;
                        // adjust for the position of the specific month
-                       for (int i=0; i < mc.CalendarDimensions.Height; i++) \r
+                       for (int i=0; i < mc.CalendarDimensions.Height; i++) 
                        {
-                               if (i > 0) \r
+                               if (i > 0) 
                                {
                                        y_offset += month_size.Height + calendar_spacing.Height;
                                }
                                // now adjust for x position    
-                               for (int j=0; j < mc.CalendarDimensions.Width; j++) \r
+                               for (int j=0; j < mc.CalendarDimensions.Width; j++) 
                                {
-                                       if (j > 0) \r
+                                       if (j > 0) 
                                        {
                                                x_offset += month_size.Width + calendar_spacing.Width;
-                                       } \r
-                                       else \r
+                                       } 
+                                       else 
                                        {
                                                x_offset = 1;
                                        }
@@ -2104,12 +2143,12 @@ namespace System.Windows.Forms
                                                client_rectangle.Width,
                                                date_cell_size.Height + 2);
                        // draw the today date if it's set
-                       if (mc.ShowToday && bottom_rect.IntersectsWith (clip_rectangle)) \r
+                       if (mc.ShowToday && bottom_rect.IntersectsWith (clip_rectangle)) 
                        {
                                dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), bottom_rect);
                                if (mc.ShowToday) {
                                        int today_offset = 5;
-                                       if (mc.ShowTodayCircle) \r
+                                       if (mc.ShowTodayCircle) 
                                        {
                                                Rectangle today_circle_rect = new Rectangle (
                                                        client_rectangle.X + 5,
@@ -2193,7 +2232,7 @@ namespace System.Windows.Forms
                }
 
                // darws a single part of the month calendar (with one month)
-               private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col) \r
+               private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col) 
                {
                        // cache local copies of Marshal-by-ref internal members (gets around error CS0197)
                        Size title_size = (Size)((object)mc.title_size);
@@ -2216,7 +2255,7 @@ namespace System.Windows.Forms
                                dc.DrawString (title_text, mc.Font, ResPool.GetSolidBrush (mc.TitleForeColor), title_rect, text_format);
 
                                // draw previous and next buttons if it's time
-                               if (row == 0 && col == 0) \r
+                               if (row == 0 && col == 0) 
                                {
                                        // draw previous button
                                        DrawMonthCalendarButton (
@@ -2228,7 +2267,7 @@ namespace System.Windows.Forms
                                                (System.Drawing.Size)((object)mc.button_size),
                                                true);
                                }
-                               if (row == 0 && col == mc.CalendarDimensions.Width-1) \r
+                               if (row == 0 && col == mc.CalendarDimensions.Width-1) 
                                {
                                        // draw next button
                                        DrawMonthCalendarButton (
@@ -2253,10 +2292,10 @@ namespace System.Windows.Forms
                                dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), day_name_rect);
                                // draw the day names 
                                DayOfWeek first_day_of_week = mc.GetDayOfWeek(mc.FirstDayOfWeek);
-                               for (int i=0; i < 7; i++) \r
+                               for (int i=0; i < 7; i++) 
                                {
                                        int position = i - (int) first_day_of_week;
-                                       if (position < 0) \r
+                                       if (position < 0) 
                                        {
                                                position = 7 + position;
                                        }
@@ -2289,7 +2328,7 @@ namespace System.Windows.Forms
                        int month_row_count = 0;
                        bool draw_week_num_divider = false;
                        DateTime current_date = mc.GetFirstDateInMonthGrid ( new DateTime (this_month.Year, this_month.Month, 1));
-                       for (int i=0; i < 6; i++) \r
+                       for (int i=0; i < 6; i++) 
                        {
                                // establish if this row is in our clip_area
                                Rectangle row_rect = new Rectangle (
@@ -2331,7 +2370,7 @@ namespace System.Windows.Forms
                                                                
                                // only draw the days if we have to
                                if(month_row_count == i) {
-                                       for (int j=0; j < 7; j++) \r
+                                       for (int j=0; j < 7; j++) 
                                        {
                                                if (draw_row) {
                                                        DrawMonthCalendarDate (
@@ -2371,14 +2410,14 @@ namespace System.Windows.Forms
                }
 
                // draws the pervious or next button
-               private void DrawMonthCalendarButton (Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous) \r
+               private void DrawMonthCalendarButton (Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous) 
                {
                        bool is_clicked = false;
                        Rectangle button_rect;
                        Rectangle arrow_rect = new Rectangle (rectangle.X, rectangle.Y, 4, 7);
                        Point[] arrow_path = new Point[3];
                        // prepare the button
-                       if (is_previous) \r
+                       if (is_previous) 
                        {
                                is_clicked = mc.is_previous_clicked;
                                button_rect = new Rectangle (
@@ -2465,7 +2504,7 @@ namespace System.Windows.Forms
                                Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);                                
                                dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 90, 180);
                                // fill the other side as a straight rect
-                               if (date < mc.SelectionEnd) \r
+                               if (date < mc.SelectionEnd) 
                                {
                                        // use rectangle instead of rectangle to go all the way to edge of rect
                                        selection_rect.X = (int) Math.Floor((double)(rectangle.X + rectangle.Width / 2));
@@ -2623,7 +2662,6 @@ namespace System.Windows.Forms
                        Rectangle       client_rectangle;
                        Rectangle       text_rectangle;
                        Rectangle       radiobutton_rectangle;
-                       SolidBrush      sb;
                        int             radiobutton_size = 12;
                        int     radiobutton_space = 4;
 
@@ -2778,13 +2816,19 @@ namespace System.Windows.Forms
                        }
 
                        // Start drawing
+                       RadioButton_DrawButton(radio_button, dc, state, radiobutton_rectangle);
+                       
+                       RadioButton_DrawText(radio_button, text_rectangle, dc, text_format);
+
+                       RadioButton_DrawFocus(radio_button, dc, text_rectangle);                        
+               }
 
-                       sb=new SolidBrush(radio_button.BackColor);
+               protected virtual void RadioButton_DrawButton(RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle)
+               {
+                       SolidBrush sb = new SolidBrush(radio_button.BackColor);
                        dc.FillRectangle(sb, radio_button.ClientRectangle);
                        sb.Dispose();
                        
-               
-                       
                        if (radio_button.appearance==Appearance.Button) {
                                if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
                                        DrawFlatStyleButton(dc, radio_button.ClientRectangle, radio_button);
@@ -2799,6 +2843,11 @@ namespace System.Windows.Forms
                                        ControlPaint.DrawRadioButton (dc, radiobutton_rectangle, state);
                                }
                        }
+               }
+               
+               protected virtual void RadioButton_DrawText(RadioButton radio_button, Rectangle text_rectangle, Graphics dc, StringFormat text_format)
+               {
+                       SolidBrush sb;
                        
                        // offset the text if it's pressed and a button
                        if (radio_button.Appearance == Appearance.Button) {
@@ -2815,20 +2864,23 @@ namespace System.Windows.Forms
                        
                        if (radio_button.Enabled) {
                                sb = ResPool.GetSolidBrush(radio_button.ForeColor);
-                               dc.DrawString(radio_button.Text, radio_button.Font, sb, text_rectangle, text_format);                           
+                               dc.DrawString(radio_button.Text, radio_button.Font, sb, text_rectangle, text_format);
                        } else if (radio_button.FlatStyle == FlatStyle.Flat) {
                                dc.DrawString(radio_button.Text, radio_button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rectangle, text_format);
                        } else {
                                CPDrawStringDisabled(dc, radio_button.Text, radio_button.Font, this.ColorButtonText, text_rectangle, text_format);
                        }
-
+               }
+               
+               protected virtual void RadioButton_DrawFocus(RadioButton radio_button, Graphics dc, Rectangle text_rectangle)
+               {
                        if (radio_button.Focused) {
                                if (radio_button.FlatStyle != FlatStyle.Flat) {
                                        DrawInnerFocusRectangle (dc, text_rectangle, radio_button.BackColor);
                                } else {
                                        dc.DrawRectangle (ResPool.GetPen (radio_button.ForeColor), text_rectangle);
                                }
-                       }                       
+                       }
                }
 
                // renders a radio button with the Flat and Popup FlatStyle
@@ -2925,51 +2977,16 @@ namespace System.Windows.Forms
                                /* Background */
                                switch (bar.thumb_moving) {
                                case ScrollBar.ThumbMoving.None: {
-                                       Rectangle r = new Rectangle (0,  
-                                                       scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - (scrollbutton_height * 2));
-                                       Rectangle intersect = Rectangle.Intersect (clip, r);
-
-                                       if (intersect != Rectangle.Empty) {
-                                                Brush h = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace);
-                                               dc.FillRectangle (h, intersect);
-                                        }
+                                       ScrollBar_Vertical_Draw_ThumbMoving_None(scrollbutton_height, bar, clip, dc);
                                        break;
                                }
                                case ScrollBar.ThumbMoving.Forward: {
-                                       Rectangle r = new Rectangle (0,  scrollbutton_height,
-                                                       bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height);
-                                       Rectangle intersect = Rectangle.Intersect (clip, r);
-
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
-
-                                       r.X = 0;
-                                       r.Y = thumb_pos.Y + thumb_pos.Height;
-                                       r.Width = bar.ClientRectangle.Width;
-                                       r.Height = bar.ClientRectangle.Height -  (thumb_pos.Y + thumb_pos.Height) - scrollbutton_height;
-
-                                       intersect = Rectangle.Intersect (clip, r);
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
+                                       ScrollBar_Vertical_Draw_ThumbMoving_Forward(scrollbutton_height, bar, thumb_pos, clip, dc);
                                        break;
                                }
                                
                                case ScrollBar.ThumbMoving.Backwards: {
-                                       Rectangle r = new Rectangle (0,  scrollbutton_height,
-                                                       bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height);
-                                       Rectangle intersect = Rectangle.Intersect (clip, r);
-
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
-
-                                       r.X = 0;
-                                       r.Y = thumb_pos.Y + thumb_pos.Height;
-                                       r.Width = bar.ClientRectangle.Width; 
-                                       r.Height = bar.ClientRectangle.Height -  (thumb_pos.Y + thumb_pos.Height) - scrollbutton_height;
-
-                                       intersect = Rectangle.Intersect (clip, r);
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
+                                       ScrollBar_Vertical_Draw_ThumbMoving_Backwards(scrollbutton_height, bar, thumb_pos, clip, dc);
                                        break;
                                }
                                
@@ -2995,58 +3012,129 @@ namespace System.Windows.Forms
                                /* Background */                                        
                                switch (bar.thumb_moving) {
                                case ScrollBar.ThumbMoving.None: {
-                                       Rectangle r = new Rectangle (scrollbutton_width,
-                                                       0, bar.ClientRectangle.Width - (scrollbutton_width * 2), bar.ClientRectangle.Height);
-                                       Rectangle intersect = Rectangle.Intersect (clip, r);
-
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
+                                       ScrollBar_Horizontal_Draw_ThumbMoving_None(scrollbutton_width, bar, clip, dc);
                                        break;
                                }
                                
                                case ScrollBar.ThumbMoving.Forward: {
-                                       Rectangle r = new Rectangle (scrollbutton_width,  0,
-                                                       thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height);
-                                       Rectangle intersect = Rectangle.Intersect (clip, r);
-
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
-
-                                       r.X = thumb_pos.X + thumb_pos.Width;
-                                       r.Y = 0;
-                                       r.Width = bar.ClientRectangle.Width -  (thumb_pos.X + thumb_pos.Width) - scrollbutton_width;
-                                       r.Height = bar.ClientRectangle.Height;
-
-                                       intersect = Rectangle.Intersect (clip, r);
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
+                                       ScrollBar_Horizontal_Draw_ThumbMoving_Forward(scrollbutton_width, thumb_pos, bar, clip, dc);
                                        break;
                                }
                                
                                case ScrollBar.ThumbMoving.Backwards: {
-                                       Rectangle r = new Rectangle (scrollbutton_width,  0,
-                                                       thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height);
-                                       Rectangle intersect = Rectangle.Intersect (clip, r);
-
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
-
-                                       r.X = thumb_pos.X + thumb_pos.Width;
-                                       r.Y = 0;
-                                       r.Width = bar.ClientRectangle.Width -  (thumb_pos.X + thumb_pos.Width) - scrollbutton_width;
-                                       r.Height = bar.ClientRectangle.Height;
-
-                                       intersect = Rectangle.Intersect (clip, r);
-                                       if (intersect != Rectangle.Empty)
-                                               dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
+                                       ScrollBar_Horizontal_Draw_ThumbMoving_Backwards(scrollbutton_width, thumb_pos, bar, clip, dc);
                                        break;
                                }
                                }
                        }
 
                        /* Thumb */
-                       if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith (thumb_pos))
-                               DrawScrollButtonPrimitive (dc, thumb_pos, ButtonState.Normal);                          
+                       ScrollBar_DrawThumb(bar, thumb_pos, clip, dc);                          
+               }
+
+               protected virtual void ScrollBar_DrawThumb(ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc)
+               {
+                       if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith(thumb_pos))
+                               DrawScrollButtonPrimitive(dc, thumb_pos, ButtonState.Normal);
+               }
+
+               protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_None( int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc )
+               {
+                       Rectangle r = new Rectangle( 0,  
+                                                   scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty )
+                       {
+                               Brush h = ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace );
+                               dc.FillRectangle( h, intersect );
+                       }
+               }
+               
+               protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_Forward( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+               {
+                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
+                                                   bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace ), intersect );
+                       
+                       r.X = 0;
+                       r.Y = thumb_pos.Y + thumb_pos.Height;
+                       r.Width = bar.ClientRectangle.Width;
+                       r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+                       
+                       intersect = Rectangle.Intersect( clip, r );
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+               }
+               
+               protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_Backwards( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+               {
+                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
+                                                   bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+                       
+                       r.X = 0;
+                       r.Y = thumb_pos.Y + thumb_pos.Height;
+                       r.Width = bar.ClientRectangle.Width; 
+                       r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+                       
+                       intersect = Rectangle.Intersect( clip, r );
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace ), intersect );
+               }
+               
+               protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_None( int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc )
+               {
+                       Rectangle r = new Rectangle( scrollbutton_width,
+                                                   0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace ), intersect );
+               }
+               
+               protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_Forward( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+               {
+                       Rectangle r = new Rectangle( scrollbutton_width,  0,
+                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace ), intersect );
+                       
+                       r.X = thumb_pos.X + thumb_pos.Width;
+                       r.Y = 0;
+                       r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+                       r.Height = bar.ClientRectangle.Height;
+                       
+                       intersect = Rectangle.Intersect( clip, r );
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+               }
+               
+               protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+               {
+                       Rectangle r = new Rectangle( scrollbutton_width,  0,
+                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+                       Rectangle intersect = Rectangle.Intersect( clip, r );
+                       
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+                       
+                       r.X = thumb_pos.X + thumb_pos.Width;
+                       r.Y = 0;
+                       r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+                       r.Height = bar.ClientRectangle.Height;
+                       
+                       intersect = Rectangle.Intersect( clip, r );
+                       if ( intersect != Rectangle.Empty )
+                               dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace ), intersect );
                }
 
                public override int ScrollBarButtonSize {
@@ -3098,7 +3186,7 @@ namespace System.Windows.Forms
                }
 
 
-               private void DrawStatusBarPanel (Graphics dc, Rectangle area, int index,
+               protected virtual void DrawStatusBarPanel (Graphics dc, Rectangle area, int index,
                        SolidBrush br_forecolor, StatusBarPanel panel) {
                        int border_size = 3; // this is actually const, even if the border style is none
 
@@ -3273,7 +3361,7 @@ namespace System.Windows.Forms
                                }
                }
 
-               private Rectangle GetTabPanelRectExt (TabControl tab)
+               protected virtual Rectangle GetTabPanelRectExt (TabControl tab)
                {
                        // Offset the tab from the top corner
                        Rectangle res = new Rectangle (tab.ClientRectangle.X + 2,
@@ -3307,7 +3395,7 @@ namespace System.Windows.Forms
                        return res;
                }
 
-               private int DrawTab (Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected)
+               protected virtual int DrawTab (Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected)
                {
                        int FlatButtonSpacing = 8;                      
                        Rectangle interior;
@@ -3491,7 +3579,7 @@ namespace System.Windows.Forms
                        Rectangle paint_area = new Rectangle (0, ToolBarGripWidth / 2, 
                                control.Width, control.Height - ToolBarGripWidth / 2);
                        bool flat = (control.Appearance == ToolBarAppearance.Flat);
-                       dc.FillRectangle (SystemBrushes.Control, paint_area);
+                       dc.FillRectangle (ResPool.GetSolidBrush( DefaultControlBackColor ), paint_area);
                        CPDrawBorderStyle (dc, paint_area, control.BorderStyle);
 
                        if (control.Divider)
@@ -4228,11 +4316,11 @@ namespace System.Windows.Forms
                #endregion      // VScrollBar
 
                #region TreeView
-               public override Size TreeViewDefaultSize {\r
-                       get {\r
-                               return new Size (121, 97);\r
-                       }\r
-               }\r
+               public override Size TreeViewDefaultSize {
+                       get {
+                               return new Size (121, 97);
+                       }
+               }
 
                #endregion
 
index 31248b116317540b4a7b58466a346743208df358..d3f4f08b91613c569fdc4be762a6895ed3202c21 100644 (file)
@@ -270,7 +270,10 @@ namespace System.Windows.Forms {
                [Localizable (true)]
                [DefaultValue ("")]
                public string GetToolTip(Control control) {
-                       return (string)tooltip_strings[control];
+                       string tooltip = (string)tooltip_strings[control];
+                       if (tooltip == null)
+                               return "";
+                       return tooltip;
                }
 
                public void RemoveAll() {
index f4ec46e13093b732865c40b24823a09b7d895c4b..8df03c40f974d9d7696af8b7de0cf0530d3881cb 100644 (file)
@@ -2086,9 +2086,6 @@ Console.WriteLine("Hit Clear background");
                [DllImport ("user32.dll", EntryPoint="SetActiveWindow", CallingConvention=CallingConvention.StdCall)]
                private extern static IntPtr Win32SetActiveWindow(IntPtr hWnd);
 
-               [DllImport ("user32.dll", EntryPoint="PostQuitMessage", CallingConvention=CallingConvention.StdCall)]
-               private extern static IntPtr Win32PostQuitMessage(IntPtr hWnd);
-
                [DllImport ("user32.dll", EntryPoint="AdjustWindowRectEx", CallingConvention=CallingConvention.StdCall)]
                private extern static bool Win32AdjustWindowRectEx(ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);
 
index 3315e339bef7fa45d5f85c7a38b51f79dc8def77..f4acf673a2597fba0b49363c644189d1da0d448e 100644 (file)
@@ -2729,6 +2729,7 @@ namespace System.Windows.Forms {
                internal override void UngrabWindow(IntPtr hwnd) {
                        lock (XlibLock) {
                                XUngrabPointer(DisplayHandle, 0);
+                               XFlush(DisplayHandle);
                        }
                        Grab.Hwnd = IntPtr.Zero;
                        Grab.Confined = false;
@@ -2879,10 +2880,16 @@ namespace System.Windows.Forms {
 
                internal static void PostMessage (IntPtr handle, Msg message, IntPtr wparam, IntPtr lparam) {
                        XEvent xevent = new XEvent ();
+                       Hwnd hwnd = Hwnd.ObjectFromHandle(handle);
 
                        xevent.type = XEventName.ClientMessage;
                        xevent.ClientMessageEvent.display = DisplayHandle;
-                       xevent.ClientMessageEvent.window = Hwnd.ObjectFromHandle(handle).whole_window;
+
+                       if (hwnd != null)
+                               xevent.ClientMessageEvent.window = hwnd.whole_window;
+                       else
+                               xevent.ClientMessageEvent.window = IntPtr.Zero;
+
                        xevent.ClientMessageEvent.message_type = (IntPtr) PostAtom;
                        xevent.ClientMessageEvent.format = 32;
                        xevent.ClientMessageEvent.ptr1 = handle;
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/lang.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/lang.cs
deleted file mode 100644 (file)
index fe4e070..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows.Forms;
-
-namespace SWFTestClass {
-       public class SWFTestClass {
-                public static void Main() {
-                       int[]   culture = { 
-                               0x007f,
-                               0x0036,\r
-                               0x0436,\r
-                               0x001C,\r
-                               0x041C,\r
-                               0x0001,\r
-                               0x1401,\r
-                               0x3C01,\r
-                               0x0C01,\r
-                               0x0801,\r
-                               0x2C01,\r
-                               0x3401,\r
-                               0x3001,\r
-                               0x1001,\r
-                               0x1801,\r
-                               0x2001,\r
-                               0x4001,\r
-                               0x0401,\r
-                               0x2801,\r
-                               0x1C01,\r
-                               0x3801,\r
-                               0x2401,\r
-                               0x002B,\r
-                               0x042B,\r
-                               0x002C,\r
-                               0x082C,\r
-                               0x042C,\r
-                               0x002D,\r
-                               0x042D,\r
-                               0x0023,\r
-                               0x0423,\r
-                               0x0002,\r
-                               0x0402,\r
-                               0x0003,\r
-                               0x0403,\r
-                               0x0C04,\r
-                               0x1404,\r
-                               0x0804,\r
-                               0x0004,\r
-                               0x1004,\r
-                               0x0404,\r
-                               0x7C04,\r
-                               0x001A,\r
-                               0x041A,\r
-                               0x0005,\r
-                               0x0405,\r
-                               0x0006,\r
-                               0x0406,\r
-                               0x0065,\r
-                               0x0465,\r
-                               0x0013,\r
-                               0x0813,\r
-                               0x0413,\r
-                               0x0009,\r
-                               0x0C09,\r
-                               0x2809,\r
-                               0x1009,\r
-                               0x2409,\r
-                               0x1809,\r
-                               0x2009,\r
-                               0x1409,\r
-                               0x3409,\r
-                               0x1C09,\r
-                               0x2C09,\r
-                               0x0809,\r
-                               0x0409,\r
-                               0x3009,\r
-                               0x0025,\r
-                               0x0425,\r
-                               0x0038,\r
-                               0x0438,\r
-                               0x0029,\r
-                               0x0429,\r
-                               0x000B,\r
-                               0x040B,\r
-                               0x000C,\r
-                               0x080C,\r
-                               0x0C0C,\r
-                               0x040C,\r
-                               0x140C,\r
-                               0x180C,\r
-                               0x100C,\r
-                               0x0056,\r
-                               0x0456,\r
-                               0x0037,\r
-                               0x0437,\r
-                               0x0007,\r
-                               0x0C07,\r
-                               0x0407,\r
-                               0x1407,\r
-                               0x1007,\r
-                               0x0807,\r
-                               0x0008,\r
-                               0x0408,\r
-                               0x0047,\r
-                               0x0447,\r
-                               0x000D,\r
-                               0x040D,\r
-                               0x0039,\r
-                               0x0439,\r
-                               0x000E,\r
-                               0x040E,\r
-                               0x000F,\r
-                               0x040F,\r
-                               0x0021,\r
-                               0x0421,\r
-                               0x0010,\r
-                               0x0410,\r
-                               0x0810,\r
-                               0x0011,\r
-                               0x0411,\r
-                               0x004B,\r
-                               0x044B,\r
-                               0x003F,\r
-                               0x043F,\r
-                               0x0057,\r
-                               0x0457,\r
-                               0x0012,\r
-                               0x0412,\r
-                               0x0040,\r
-                               0x0440,\r
-                               0x0026,\r
-                               0x0426,\r
-                               0x0027,\r
-                               0x0427,\r
-                               0x002F,\r
-                               0x042F,\r
-                               0x003E,\r
-                               0x083E,\r
-                               0x043E,\r
-                               0x004E,\r
-                               0x044E,\r
-                               0x0050,\r
-                               0x0450,\r
-                               0x0014,\r
-                               0x0414,\r
-                               0x0814,\r
-                               0x0015,\r
-                               0x0415,\r
-                               0x0016,\r
-                               0x0416,\r
-                               0x0816,\r
-                               0x0046,\r
-                               0x0446,\r
-                               0x0018,\r
-                               0x0418,\r
-                               0x0019,\r
-                               0x0419,\r
-                               0x004F,\r
-                               0x044F,\r
-                               0x0C1A,\r
-                               0x081A,\r
-                               0x001B,\r
-                               0x041B,\r
-                               0x0024,\r
-                               0x0424,\r
-                               0x000A,\r
-                               0x2C0A,\r
-                               0x400A,\r
-                               0x340A,\r
-                               0x240A,\r
-                               0x140A,\r
-                               0x1C0A,\r
-                               0x300A,\r
-                               0x440A,\r
-                               0x100A,\r
-                               0x480A,\r
-                               0x080A,\r
-                               0x4C0A,\r
-                               0x180A,\r
-                               0x3C0A,\r
-                               0x280A,\r
-                               0x500A,\r
-                               0x0C0A,\r
-                               0x380A,\r
-                               0x200A,\r
-                               0x0041,\r
-                               0x0441,\r
-                               0x001D,\r
-                               0x081D,\r
-                               0x041D,\r
-                               0x005A,\r
-                               0x045A,\r
-                               0x0049,\r
-                               0x0449,\r
-                               0x0044,\r
-                               0x0444,\r
-                               0x004A,\r
-                               0x044A,\r
-                               0x001E,\r
-                               0x041E,\r
-                               0x001F,\r
-                               0x041F,\r
-                               0x0022,\r
-                               0x0422,\r
-                               0x0020,\r
-                               0x0420,\r
-                               0x0043,\r
-                               0x0843,\r
-                               0x0443,\r
-                               0x002A,\r
-                               0x042A\r
-                       };
-                       InputLanguage   l;
-                       CultureInfo     cultinfo;
-
-                       foreach (int c in culture) {
-                               cultinfo=new CultureInfo(c);
-                               l=InputLanguage.FromCulture(cultinfo);
-                               Console.WriteLine("Culture:{0}, layout:{1}", cultinfo, l);
-                       }
-
-                       l=InputLanguage.CurrentInputLanguage;
-                       Console.WriteLine("default layout:{0}", l.LayoutName);
-                }
-       }
-}
index 001b8c782359d291992b15cccabfac72843abd89..578a25971d9e41cf5bdfd7c9cbc2fd304ac46c71 100644 (file)
@@ -14,11 +14,14 @@ System.Windows.Forms/GridTableStylesCollectionTest.cs
 System.Windows.Forms/GroupBoxTest.cs
 System.Windows.Forms/ImageListTest.cs
 System.Windows.Forms/LabelPropertyTest.cs
+System.Windows.Forms/LabelTest.cs
 System.Windows.Forms/ListBoxEventTest.cs
 System.Windows.Forms/ListBoxTest.cs
 System.Windows.Forms/ListViewEventTest.cs
 System.Windows.Forms/ListViewTest.cs
 System.Windows.Forms/MenuTest.cs
+System.Windows.Forms/MonthCalendarTest.cs
+System.Windows.Forms/PictureBoxTest.cs
 System.Windows.Forms/ProgressBarTest.cs
 System.Windows.Forms/RadioButtonTest.cs
 System.Windows.Forms/ScrollBarTest.cs
index b8cbba4bdaf04bef249ddb654d024305dfe3ef99..f792e8de509b92b131fb0e8f17ec8c44a100ba40 100644 (file)
@@ -12,7 +12,8 @@ using NUnit.Framework;
 \r
 namespace MonoTests.System.Windows.Forms\r
 {\r
-       [TestFixture]\r
+       [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]\r
        public class ButtonTest\r
        {\r
                [Test]\r
index 6e94edba37f29f104da1a9bce5b12b398da23788..a5c01090939a1d8035a445b3896defadac74d228 100644 (file)
@@ -1,3 +1,25 @@
+2005-09-20  Ritvik Mayank  <mritvik@novell.com>
+
+        * ButtonTest.cs, LabelTest.cs, ControlEventTest.cs, ScrollBarTest.cs,
+       LabelPropertyTest.cs, ProgressBarTest.cs, StatusBarTest.cs,
+       ImageListTest.cs, MonthCalendarTest.cs, ControlTest.cs, 
+       ListBoxEventTest.cs, TreeViewTest.cs, TestImageIndexConverter.cs,       
+       ToolBarTest.cs, MenuTest.cs
+
+       Remove all the tests that are giving errors. All of them should 
+       be reviewed. Right now having this text throwing 40 errors do not
+       help at all to do regression testing. Peter has already assigned
+       a group of controls to every developer that will be tested and 
+       reviewed.
+
+2005-09-20  Ritvik Mayank  <mritvik@novell.com>
+
+       * PictureBoxTest.cs : Test case for PictureBox
+
+2005-09-08  Ritvik Mayank  <mritvik@novell.com>
+
+       * MonthCalendarTest.cs : Test case for MonthCalendar
+
 2005-08-29  Ritvik Mayank  <mritvik@novell.com>
        
        * ProgressBarTest.cs : Test case for ProgressBar
index 3fcfcb1170052e97613e58d129891a7f6974bf0d..e44734c03d30a0342e51490740abd7ed0c9a916a 100644 (file)
@@ -8,6 +8,7 @@ using System.Threading;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
        public class EventClass
        {
                static bool eventhandled = false;
index 9f8f89f5caf52996387c0c298fdc1c519e877efb..68b08bdde30acdc520797faa9a10182a772154a7 100644 (file)
@@ -16,7 +16,8 @@ using NUnit.Framework;
 \r
 namespace MWF.MonoTest\r
 {\r
-       [TestFixture]\r
+       [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]\r
        public class ControlTest\r
        {\r
                internal static void TestAccessibility(Control c, string Default, string Description, string Name, AccessibleRole Role) {\r
index 41102dbd5debbb0b8dd07fb6337cde2f2cb7b0a8..f2cf020089021d508f680bce3cdccc22480aba0e 100644 (file)
@@ -19,6 +19,7 @@ namespace MonoTests.System.Windows.Forms
 {
 
        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
        public class ImageListTest
        {
                [Test]
@@ -58,7 +59,8 @@ namespace MonoTests.System.Windows.Forms
                }
                
                [TestFixture]
-                       public class ImageListRecreateHandleEventClass
+               [Ignore ("This test has to be completly reviewed")]
+               public class ImageListRecreateHandleEventClass
                {
                        static bool eventhandled = false;
                        public static void RecreateHandle_EventHandler (object sender, EventArgs e)
index 3b01f7a323426d6a4a7171a12d5a8d618a5c1b8b..0a4718118429aa9066acdf470e2f6f72c864d712 100644 (file)
@@ -18,7 +18,8 @@ using System.Runtime.Remoting;
 \r
 namespace MonoTests.System.Windows.Forms\r
 {\r
-       [TestFixture]\r
+       [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]\r
        public class LabelTest {\r
 \r
                [Test]\r
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelTest.cs
new file mode 100644 (file)
index 0000000..194fb3b
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+//      Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+//
+                                                
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.Remoting;
+
+namespace MonoTests.System.Windows.Forms
+{
+        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
+        public class LabelTest2
+        {
+               
+               [Test]
+               public void PubPropTest ()
+               {
+                       Label l = new Label ();
+                       
+                       // A
+                       Assert.AreEqual (false, l.AutoSize, "A1");
+                       l.AutoSize = true;
+                       Assert.AreEqual (true, l.AutoSize, "A2");
+                       l.AutoSize = false;
+                       Assert.AreEqual (false, l.AutoSize, "A3");
+                       
+                       // B
+                       Assert.AreEqual (null, l.BackgroundImage, "B1");
+                       l.BackgroundImage = Image.FromFile ("a.png");;
+                       Assert.IsNotNull (l.BackgroundImage, "B2");
+                       Bitmap bmp = (Bitmap)l.BackgroundImage;
+                       Assert.IsNotNull (bmp.GetPixel (0, 0), "B3");
+                                                                       
+                       Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B4");
+                       l.BorderStyle = BorderStyle.FixedSingle;
+                       Assert.AreEqual (BorderStyle.FixedSingle, l.BorderStyle, "B5");
+                       l.BorderStyle = BorderStyle.Fixed3D;
+                       Assert.AreEqual (BorderStyle.Fixed3D, l.BorderStyle, "B6");
+                       l.BorderStyle = BorderStyle.None;
+                       Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B7");
+                       
+                       // C
+                       string name = l.CompanyName;
+                       if (!name.Equals("Mono Project, Novell, Inc.") && !name.Equals("Microsoft Corporation")) {
+                               Assert.Fail("CompanyName property does not match any accepted value - C1");
+                       }
+                       
+                       
+                       // F
+                       Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F1");
+                       l.FlatStyle = FlatStyle.Flat;
+                       Assert.AreEqual (FlatStyle.Flat, l.FlatStyle, "F1");
+                       l.FlatStyle = FlatStyle.Popup;
+                       Assert.AreEqual (FlatStyle.Popup, l.FlatStyle, "F2");
+                       l.FlatStyle = FlatStyle.Standard;
+                       Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F3");
+                       l.FlatStyle = FlatStyle.System;
+                       Assert.AreEqual (FlatStyle.System, l.FlatStyle, "F4");
+                       
+                       // I
+                       Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I1");
+                       l.ImageAlign = ContentAlignment.TopLeft;
+                       Assert.AreEqual (ContentAlignment.TopLeft, l.ImageAlign, "I2");
+                       l.ImageAlign = ContentAlignment.TopCenter;
+                       Assert.AreEqual (ContentAlignment.TopCenter, l.ImageAlign, "I3");
+                       l.ImageAlign = ContentAlignment.TopRight;
+                       Assert.AreEqual (ContentAlignment.TopRight, l.ImageAlign, "I4");
+                       l.ImageAlign = ContentAlignment.MiddleLeft;
+                       Assert.AreEqual (ContentAlignment.MiddleLeft, l.ImageAlign, "I5");
+                       l.ImageAlign = ContentAlignment.MiddleCenter;
+                       Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I6");
+                       l.ImageAlign = ContentAlignment.MiddleRight;
+                       Assert.AreEqual (ContentAlignment.MiddleRight, l.ImageAlign, "I7");
+                       l.ImageAlign = ContentAlignment.BottomLeft;
+                       Assert.AreEqual (ContentAlignment.BottomLeft, l.ImageAlign, "I8");
+                       l.ImageAlign = ContentAlignment.BottomCenter;
+                       Assert.AreEqual (ContentAlignment.BottomCenter, l.ImageAlign, "I9");
+                       l.ImageAlign = ContentAlignment.BottomRight;
+                       Assert.AreEqual (ContentAlignment.BottomRight, l.ImageAlign, "I10");
+                       Assert.AreEqual (-1, l.ImageIndex, "I11");
+                       Assert.AreEqual (null, l.ImageList, "I12");
+                       Assert.AreEqual (null, l.Image, "I13");
+                       l.Image = Image.FromFile ("a.png");
+                       Assert.IsNotNull (l.Image, "I14");
+                       bmp = (Bitmap)l.Image;
+                       Assert.IsNotNull (bmp.GetPixel (0, 0), "I15");
+                       
+                       
+                       ImageList il = new ImageList ();
+                       il.ColorDepth = ColorDepth.Depth32Bit;
+                       il.ImageSize = new Size (15, 15);
+                       il.Images.Add (Image.FromFile ("a.png"));
+                       l.ImageList = il;
+                       l.ImageIndex = 0;
+                       
+                       Assert.AreEqual (0, l.ImageIndex, "I16");
+                       Assert.IsNotNull (l.ImageList, "I17");
+                       
+                       // PreferredHeight
+                       // PregerredWidth
+                       // RenderTransparent
+                       
+                       // T
+                       // Assert.AreEqual (false, l.TabStop, "T1");
+                       Assert.AreEqual (ContentAlignment.TopLeft, l.TextAlign, "T2");
+                       
+                       // U
+                       Assert.AreEqual (true, l.UseMnemonic, "U1");
+                       l.UseMnemonic = false;
+                       Assert.AreEqual (false, l.UseMnemonic, "U2");
+               }
+               
+               [Test]
+               public void PubMethodTest ()
+               {
+                       Label l = new Label ();
+                       
+                       l.Text = "My Label";
+                       
+                       Assert.AreEqual ("System.Windows.Forms.LabelText: My Label", l.ToString (), "T1");
+                         
+               }
+       }
+}
+          
index 1a932dfddb8aad20544f3ad1aa58cb7586e1f65f..65d3551183207524c110c7e55b36d2743d23c045 100644 (file)
@@ -13,6 +13,7 @@ using System.Drawing;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
        public class ListBoxDrawItemEvent
        {       
                static bool eventhandled = false;
@@ -36,6 +37,7 @@ namespace MonoTests.System.Windows.Forms
                }
 
                [TestFixture]
+               [Ignore ("This test has to be completly reviewed")]
                public class ListBoxMeasureItemEvent
                {
                        static bool eventhandled = false;
index ffe8d52029a0fa4d9e4263c2e66c5f6d4bb7492b..20aa946a3c745ed1874837679d1f96f3804160c7 100644 (file)
@@ -16,6 +16,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
        public class MenuTest
        {
                [Test]
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MonthCalendarTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MonthCalendarTest.cs
new file mode 100644 (file)
index 0000000..a757475
--- /dev/null
@@ -0,0 +1,166 @@
+//
+// MonthCalendarTest.cs: Test case for MonthCalendar
+// 
+// Authors:
+//   Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.Syetem.Windows.Forms
+{
+       [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]     
+       public class MonthCalendarTest
+       {
+               [Test]
+               public void MonthCalendarPropertyTest ()
+               {
+                       Form myfrm = new Form ();
+                       MonthCalendar myMonthCal1 = new MonthCalendar ();
+                       MonthCalendar myMonthCal2 = new MonthCalendar ();
+                       myMonthCal1.Name = "MonthCendar";
+                       myMonthCal1.TabIndex = 1;
+                       DateTime myDateTime = new DateTime ();
+                       
+                       // A
+                       myMonthCal1.AddAnnuallyBoldedDate (new DateTime (2005, 09, 01));
+                       Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal1.AnnuallyBoldedDates.GetValue (0), "#A1");
+                     
+                       // B 
+                       Assert.AreEqual ("Window", myMonthCal1.BackColor.Name, "#B1");
+                       myMonthCal1.AddBoldedDate (new DateTime (2005, 09, 01));
+                       Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal1.BoldedDates.GetValue (0), "#B2");
+                               
+                       // C
+                       Assert.AreEqual (1, myMonthCal1.CalendarDimensions.Height, "#C1");
+                       Assert.AreEqual (1, myMonthCal1.CalendarDimensions.Width, "#C2");
+                       Assert.AreEqual (false, myMonthCal1.CalendarDimensions.IsEmpty, "#C3");
+
+                       // F
+                       Assert.AreEqual (Day.Default, myMonthCal1.FirstDayOfWeek, "#F1");
+                       myMonthCal1.FirstDayOfWeek = Day.Sunday;
+                       Assert.AreEqual (Day.Sunday, myMonthCal1.FirstDayOfWeek, "#F2");
+                       Assert.AreEqual ("WindowText", myMonthCal1.ForeColor.Name, "#F3");
+
+                       // M 
+                       Assert.AreEqual (new DateTime (9998,12,31), myMonthCal1.MaxDate, "#M1");
+                       Assert.AreEqual (7, myMonthCal1.MaxSelectionCount, "#M2");
+                       Assert.AreEqual (new DateTime (1753,1,1), myMonthCal1.MinDate, "#M3");
+                       myMonthCal1.AddMonthlyBoldedDate (new DateTime (2005, 09, 01));
+                       Assert.AreEqual (new DateTime(2005, 09, 01), myMonthCal1.MonthlyBoldedDates.GetValue (0), "#M4");
+                       
+                       // S 
+                       Assert.AreEqual (0, myMonthCal1.ScrollChange, "#S1");
+                       myMonthCal1.SelectionStart = new DateTime (2005,09,02);
+                       myMonthCal1.SelectionEnd = new DateTime (2005,09,03);
+                       Assert.AreEqual (new DateTime (2005,09,03), myMonthCal1.SelectionEnd, "#S2");
+                       //Assert.AreEqual (new SelectionRange (new DateTime(2005,09,02), new DateTime(2005,09,03)), myMonthCal1.SelectionRange, "#S3");
+                       Assert.AreEqual (new DateTime (2005,09,02), myMonthCal1.SelectionStart, "#S4");
+                       Assert.AreEqual (true, myMonthCal1.ShowToday, "#S5");
+                       Assert.AreEqual (true, myMonthCal1.ShowTodayCircle, "#S6");
+                       Assert.AreEqual (false, myMonthCal1.ShowWeekNumbers, "#S7");
+                       Assert.AreEqual (153, myMonthCal1.SingleMonthSize.Height, "#S8a");
+                       Assert.AreEqual (176, myMonthCal1.SingleMonthSize.Width, "#S8b");
+                       Assert.AreEqual (null, myMonthCal1.Site, "#S9");
+                       // T
+                       Assert.AreEqual ("ActiveCaption", myMonthCal1.TitleBackColor.Name, "#T1");
+                       Assert.AreEqual ("ActiveCaptionText", myMonthCal1.TitleForeColor.Name, "#T2");
+                       Assert.AreEqual (DateTime.Today, myMonthCal1.TodayDate, "#T3");
+                       Assert.AreEqual (false, myMonthCal1.TodayDateSet, "#T4");
+                       Assert.AreEqual ("GrayText", myMonthCal1.TrailingForeColor.Name, "#T5");
+               }
+       
+               [Test]          
+               [ExpectedException (typeof (ArgumentException))]
+               public void MonthCalMaxSelectionCountException ()
+               {
+                       MonthCalendar myMonthCal1 = new MonthCalendar ();
+                       myMonthCal1.MaxSelectionCount = 0 ; // value is less than 1
+               }
+
+               [Test]          
+               [ExpectedException (typeof (ArgumentException))]
+               public void MonthCalMaxDateException ()
+               {
+                       MonthCalendar myMonthCal1 = new MonthCalendar ();
+                       myMonthCal1.MaxDate = new DateTime (1752, 1, 1, 0, 0, 0, 0); // value is less than min date (01/01/1753)
+               }
+
+               [Test]          
+               [ExpectedException (typeof (ArgumentException))]
+               public void MonthCalMinDateException ()
+               {
+                       MonthCalendar myMonthCal1 = new MonthCalendar ();
+                       myMonthCal1.MinDate = new DateTime(1752, 1, 1, 0, 0, 0, 0); // Date earlier than 01/01/1753
+                       myMonthCal1.MinDate = new DateTime(9999, 12, 31, 0, 0, 0, 0); // Date greater than max date (01/01/1753)
+               }
+
+               [Test]          
+               [ExpectedException (typeof (ArgumentException))]
+               public void MonthCalSelectRangeException ()
+               {
+                       MonthCalendar myMonthCal1 = new MonthCalendar ();
+                       myMonthCal1.SelectionRange = new SelectionRange (new DateTime (1752, 01, 01), new DateTime (1752, 01, 02));
+                       myMonthCal1.SelectionRange = new SelectionRange (new DateTime (9999, 12, 30), new DateTime (9999, 12, 31));
+               }
+               
+               [Test]
+               public void AddAnnuallyBoldedDateTest ()
+               {
+                       Form myForm = new Form ();
+                       MonthCalendar myMonthCal = new MonthCalendar ();
+                       myMonthCal.AddAnnuallyBoldedDate (new DateTime (2005, 09, 01));
+                       myForm.Controls.Add (myMonthCal);
+                       Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal.AnnuallyBoldedDates.GetValue (0), "#add1");
+               }
+
+               [Test]
+               public void AddBoldedDateTest ()
+               {
+                       Form myForm = new Form ();
+                       MonthCalendar myMonthCal = new MonthCalendar ();
+                       myMonthCal.AddBoldedDate (new DateTime (2005, 09, 02));
+                       myForm.Controls.Add (myMonthCal);
+                       Assert.AreEqual (new DateTime (2005, 09, 02), myMonthCal.BoldedDates.GetValue (0), "#add2");
+               }
+
+               [Test]
+               public void AddMonthlyBoldedDateTest ()
+               {
+                       Form myForm = new Form ();
+                       MonthCalendar myMonthCal = new MonthCalendar ();
+                       myMonthCal.AddMonthlyBoldedDate (new DateTime (2005, 09, 03));
+                       myForm.Controls.Add (myMonthCal);
+                       Assert.AreEqual (new DateTime (2005, 09, 03), myMonthCal.MonthlyBoldedDates.GetValue (0), "#add2");
+               }
+               
+               [Test]
+               public void GetDispalyRangeTest ()
+               {
+                       Form myForm = new Form ();
+                       MonthCalendar myMonthCal = new MonthCalendar ();
+                       myForm.Controls.Add (myMonthCal);
+                       SelectionRange mySelRange = new SelectionRange ();
+                       mySelRange.Start = new DateTime (2005, 09, 01); 
+                       mySelRange.End = new DateTime (2005, 09, 30);
+                       Assert.AreEqual (mySelRange.Start, myMonthCal.GetDisplayRange (true).Start, "#Get1");
+                       Assert.AreEqual (mySelRange.End, myMonthCal.GetDisplayRange (true).End, "#Get22");
+               }
+               
+               [Test]
+               public void HitTest ()
+               {
+                       Form myForm = new Form ();
+                       MonthCalendar myMonthCal = new MonthCalendar ();
+                       myForm.Controls.Add (myMonthCal);
+                       Assert.AreEqual (new DateTime (01, 01, 01), myMonthCal.HitTest(10, 10).Time, "#Hit1");
+               }
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PictureBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PictureBoxTest.cs
new file mode 100644 (file)
index 0000000..c8bb8cd
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// PictureBoxTest.cs: Test cases for PictureBox.
+//
+// Author:
+//   Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+using System.Threading;
+
+namespace MonoTests.System.Windows.Forms
+{
+       [TestFixture]
+       public class PictureBoxTest
+       {
+               [Test]
+               public void PictureBoxPropertyTest ()
+               {
+                       Form myForm = new Form ();
+                       PictureBox myPicBox = new PictureBox ();
+                       myForm.Controls.Add (myPicBox);
+                       
+                       // B 
+                       Assert.AreEqual (BorderStyle.None, myPicBox.BorderStyle, "#B1");
+                       myPicBox.BorderStyle = BorderStyle.Fixed3D;
+                       Assert.AreEqual (BorderStyle.Fixed3D, myPicBox.BorderStyle, "#B2");
+
+                       // I 
+                       Assert.AreEqual (null, myPicBox.Image, "#I1");
+                       Image myImage = Image.FromFile("M.gif");
+                       myPicBox.Image = myImage;
+                       Assert.AreEqual (60, myPicBox.Image.Height, "#I2");
+                       Assert.AreEqual (150, myPicBox.Image.Width, "#I3");
+                       
+                       // P 
+                       Assert.AreEqual (PictureBoxSizeMode.Normal, myPicBox.SizeMode, "#P1");
+                       myPicBox.SizeMode = PictureBoxSizeMode.AutoSize;
+                       Assert.AreEqual (PictureBoxSizeMode.AutoSize, myPicBox.SizeMode, "#P2");
+               }
+                       
+               
+               [Test]
+               public void ToStringMethodTest () 
+               {
+                       PictureBox myPicBox = new PictureBox ();
+                       Assert.AreEqual ("System.Windows.Forms.PictureBox, SizeMode: Normal", myPicBox.ToString (), "#T1");
+               }
+               
+               [TestFixture]
+               public class PictureBoxSizeModeEventClass
+               {
+                       static bool eventhandled = false;
+                       public static void SizeMode_EventHandler (object sender, EventArgs e)
+                       {
+                               eventhandled = true;
+                       }
+
+                       [Test]
+                       public void PictureBoxEvenTest ()
+                       {
+                               Form myForm = new Form ();
+                               PictureBox myPicBox = new PictureBox ();
+                               myForm.Controls.Add (myPicBox);
+                               myPicBox.SizeModeChanged += new EventHandler (SizeMode_EventHandler);
+                               myPicBox.SizeMode = PictureBoxSizeMode.AutoSize;                                
+                               Assert.AreEqual (true, eventhandled, "#SM1");
+                               eventhandled = false;
+                               myPicBox.SizeMode = PictureBoxSizeMode.CenterImage;
+                               Assert.AreEqual (true, eventhandled, "#SM2");
+                               eventhandled = false;
+                               myPicBox.SizeMode = PictureBoxSizeMode.StretchImage;
+                               Assert.AreEqual (true, eventhandled, "#SM3");   
+                       }
+               }
+       }
+}
index ba19f4a2601521457cb63e6551df8517db55299e..0b93e3db00b93fb0ba061f558945bbe9fb008c92 100644 (file)
@@ -16,6 +16,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
        public class ProgressBarBaseTest
        {
                [Test]
index 76fed42204593380b135622304c83497a5e28b15..40e2eaeac25ba99776c85477258850a3250aa3c7 100644 (file)
@@ -1,12 +1,12 @@
 //
-// ScrollBarTest.cs: Test cases for ScrollBar.
+// Copyright (c) 2005 Novell, Inc.
 //
-// Author:
-//   Ritvik Mayank (mritvik@novell.com)
+// Authors:
+//      Ritvik Mayank (mritvik@novell.com)
+//      Hisham Mardam Bey (hisham.mardambey@gmail.com)
 //
-// (C) 2005 Novell, Inc. (http://www.novell.com)
 //
-
+                                                
 
 using System;
 using NUnit.Framework;
@@ -16,94 +16,98 @@ using System.Runtime.Remoting;
 
 namespace MonoTests.System.Windows.Forms
 {
-       [TestFixture]
-       public class ScrollBarTest 
-       {
-
+        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
+        public class ScrollbarTest
+        {
+               
                [Test]
-               public void ScrollBarPropertyTest ()
-               {       
-                       ScrollBar myscrlbar = new HScrollBar (); // Could be checked for VScrollBar as well 
-                               
+               public void PubPropTest ()
+               {
+                       ScrollBar myscrlbar = new HScrollBar ();
+                       
                        // B
-                       Assert.AreEqual ("Control", myscrlbar.BackColor.Name, "#B1");
                        myscrlbar.BackColor = Color.Red;
                        Assert.AreEqual (255, myscrlbar.BackColor.R, "#B2");
-                       myscrlbar.BackgroundImage = Image.FromFile ("M.gif");
-                       Assert.AreEqual (60, myscrlbar.BackgroundImage.Height, "#B3");
-
+                       myscrlbar.BackgroundImage = Image.FromFile ("a.png");
+                       Assert.AreEqual (16, myscrlbar.BackgroundImage.Height, "#B3");
+                       
                        // F
-                       Assert.AreEqual ("ControlText", myscrlbar.ForeColor.Name, "#F1");
-       
-                       // I 
-                       Assert.AreEqual (ImeMode.Disable, myscrlbar.ImeMode, "#I1");
+                       Assert.AreEqual ("ff000000", myscrlbar.ForeColor.Name, "#F1");
+                       
+                       // I
+                       //Assert.AreEqual (ImeMode.Disable, myscrlbar.ImeMode, "#I1");
                        
                        // L
-                       Assert.AreEqual (10, myscrlbar.LargeChange, "#L1");
+                        Assert.AreEqual (10, myscrlbar.LargeChange, "#L1");
                        
                        // M
                        Assert.AreEqual (100, myscrlbar.Maximum, "#M1");
                        Assert.AreEqual (0, myscrlbar.Minimum, "#M2");
-
+                       myscrlbar.Maximum = 300;
+                       myscrlbar.Minimum = 100;
+                       Assert.AreEqual (300, myscrlbar.Maximum, "#M3");
+                       Assert.AreEqual (100, myscrlbar.Minimum, "#M4");
+                       
                        // S
                        Assert.AreEqual (null, myscrlbar.Site, "#S1");
                        Assert.AreEqual (1, myscrlbar.SmallChange, "#S2");
+                       myscrlbar.SmallChange = 10;
+                       Assert.AreEqual (10, myscrlbar.SmallChange, "#S3");
                        
                        // T
-                       Assert.AreEqual ("", myscrlbar.Text, "#T1");
+                       Assert.AreEqual (false, myscrlbar.TabStop, "#T1");
+                       myscrlbar.TabStop = true;
+                       Assert.AreEqual (true, myscrlbar.TabStop, "#T2");
+                       Assert.AreEqual ("", myscrlbar.Text, "#T3");
                        myscrlbar.Text = "MONO SCROLLBAR";
-                       Assert.AreEqual ("MONO SCROLLBAR", myscrlbar.Text, "#T2");
-
+                       Assert.AreEqual ("MONO SCROLLBAR", myscrlbar.Text, "#T4");
+                       
                        // V
-                       Assert.AreEqual (0, myscrlbar.Value, "#V1");
-               }
-
-               [Test]
-               [ExpectedException (typeof (ArgumentException))]
-               public void ExceptionChangeTest ()
-               {
-                       ScrollBar myHscrlbar = new HScrollBar ();
-                       myHscrlbar.LargeChange = -1; // LargeChange must be greater than 0
-                       myHscrlbar.SmallChange = -1; // SmallChange must be greater than 0      
+                        Assert.AreEqual (100, myscrlbar.Value, "#V1");
+                       myscrlbar.Value = 150;                  
+                       Assert.AreEqual (150, myscrlbar.Value, "#V2");
                }
                
                [Test]
                [ExpectedException (typeof (ArgumentException))]
-               public void ExceptionValTest ()
+               public void ExceptionValueTest ()
                {
-                       ScrollBar myHscrlbar1 = new HScrollBar ();
-                       ScrollBar myHscrlbar2 = new HScrollBar ();
-                       myHscrlbar1.Value = -1 ;
-                       myHscrlbar2.Value = 101 ;
+                       ScrollBar myscrlbar = new HScrollBar ();
+                       myscrlbar.Minimum = 10;
+                       myscrlbar.Maximum = 20;                 
+                       myscrlbar.Value = 9;
+                       myscrlbar.Value = 21;
                }
                
                [Test]
-               public void ToStringMethodTest () 
+               public void PubMethodTest ()
                {
-                       ScrollBar myHscrlbar = new HScrollBar ();
-                       myHscrlbar.Text = "New HScrollBar";
+                       ScrollBar myscrlbar = new HScrollBar ();
+                       myscrlbar.Text = "New HScrollBar";
                        Assert.AreEqual ("System.Windows.Forms.HScrollBar, Minimum: 0, Maximum: 100, Value: 0",
-                                        myHscrlbar.ToString (), "#T3");
-               }
+                                        myscrlbar.ToString (), "#T5");
+               }                               
        }
-       
-       [TestFixture]
-       public class ScrollBarValueChangedEventClass
-       {
+   
+        [TestFixture]
+        public class ScrollBarValueChangedEventClass
+        {
                static bool eventhandled = false;
                public static void ValueChange_EventHandler (object sender, EventArgs e)
                {
                        eventhandled = true;
                }
-
+               
                [Test]
-               public void ValueChangeEventTest ()
-               {
+               public void ValueChangeEventTest ()
+               {
                        ScrollBar myHscrlbar = new HScrollBar ();
                        myHscrlbar.Value = 40 ;
                        myHscrlbar.ValueChanged += new EventHandler (ValueChange_EventHandler);
                        myHscrlbar.Value = 50 ;
                        Assert.AreEqual (true, eventhandled, "#1");
                }
-       }       
+       }   
 }
+          
index 2a3555ff969fe7b50720c80e42de4f1a0bd5984f..a2bfe31912404dd96826bc40ad9dfb8da3745c1e 100644 (file)
@@ -16,6 +16,7 @@ using System.Runtime.Remoting;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
        public class StatusBarTest 
        {
 
index 6ec68d48a0e162efe598c0cedd6a7d1174354ce6..679dcef4ea27ac1e1edba4331dcba9a1ce4a4198 100644 (file)
 // Authors:
 //     Ravindra (rkumar@novell.com)
 //
-// $Revision: 1.1 $
-// $Modtime: $
-// $Log: TestImageIndexConverter.cs,v $
-// Revision 1.1  2004/08/27 22:17:37  ravindra
-// Adding test for ImageIndexConverter.cs
-//
-//
 //
 
 using NUnit.Framework;
@@ -40,6 +33,7 @@ using System.Globalization;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]   
+       [Ignore ("This test has to be completly reviewed")]     
        public class ImageIndexConverterTest
        {
                ToolBarButton button;
index 810d0f69e002139264f8c24f68905914c000564b..271671a0825e808e97cb28441b4a323e92f58b2f 100644 (file)
@@ -16,6 +16,7 @@ using System.Runtime.Remoting;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
+       [Ignore ("This test has to be completly reviewed")]
        public class ToolBarTest 
        {
 
index 9f06ce129d80dfed16cf8e34e6968f8548a87e52..226fccf177495cd59c775019678db24af824e2ad 100644 (file)
@@ -7,6 +7,7 @@ using System.Drawing;
 public class TreeViewTest {
 
        [Test]
+       [Ignore ("This test has to be completly reviewed")]     
        public void DefaultCtor ()
        {
                TreeView tv = new TreeView ();
index 31a37956262ccfd68eb08d5118d430b83f9dfa01..3b863f5f6dcc2ee24430f1d8d431473c5444239e 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-07 Jonathan Chambers  <jonathan.chambers@ansys.com>
+
+       * System.Windows.Forms.resources.prebuilt: Update
+       * System.Windows.Forms.resx: Added images and strings for PropertyGrid
+         toolbar buttons.
+
 2005-05-05  Peter Bartok  <pbartok@novell.com>
 
        * System.Windows.Forms.resx, System.Windows.Forms.en.resx,
index c464fe68fba488433c2552f5432dfe732c18de92..83f71d432ff2c9a4ad3aba82308f58962848e132 100644 (file)
Binary files a/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resources.prebuilt and b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resources.prebuilt differ
index 42e3c4c9e06b114e0616f130dd2191e7e6c83520..696ab4b11a164a7fed141711370724ce56470467 100644 (file)
         8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B\r
         bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe\r
         incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==\r
+</value>\r
+  </data>\r
+  <data name="propertygrid_sort_category" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+    <value>\r
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAIZJREFUOE+tUgkO\r
+        wCAI237ma3inP2NCwlIRdIuaEA+waQt3rZVLKVe2Wj7NaUIA2say+8jesW4AwE/+LHcLA+kAfMExBkTE\r
+        Uaj8Yx4g/UirZ9B5gK5KYdSR7E0lbANk9LELUwlSGK1fbTQABDOAT20UAJRi95Wh7xzMGNisTEd524PV\r
+        IGVSHnpbhD8B8EhyAAAAAElFTkSuQmCC\r
 </value>\r
   </data>\r
   <data name="Yes">\r
         9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==\r
 </value>\r
   </data>\r
+  <data name="propertygrid_categorized">\r
+    <value>Categorized</value>\r
+  </data>\r
   <data name="mbox_warn.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
     <value>\r
         iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
   <data name="Cancel">\r
     <value>Cancel</value>\r
   </data>\r
+  <data name="propertygrid_tab_properties" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+    <value>\r
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAGVJREFUOE9jPHDg\r
+        wH8GIoCjoyMjsrL9+/dD9IEMoATDDQCaBTKRaAyzFMUAYl0CsginATBXQMMGw0Uw8VEXIAUiIyMjOCaQ\r
+        Q5ZQbKDEAroBJMcCVV1AVkqEuYCQv3HJUy8zkesCAKyXZMNS2ukhAAAAAElFTkSuQmCC\r
+</value>\r
+  </data>\r
   <data name="last_open" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
     <value>\r
         iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
         N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=\r
 </value>\r
   </data>\r
+  <data name="propertygrid_sort_alphabetical" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+    <value>\r
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAI5JREFUOE+tklEO\r
+        gCAMQ/XfK3j/E/gNN1NLLCljRoeaLGZQXrfBnHPepy8fACmlGieryS8DmHRR9hSgIkKtAdehdQEQaBUe\r
+        gPsNgO4EqOiuxQ7gCW2LmrsV2DnwAHtWk8cKIOAteLOoAOuq+atrpNPIv7yDSKzL1ujDAJgppACwMBJ1\r
+        iJEW3AoigF9moIYHlA+UIAsfXwEAAAAASUVORK5CYII=\r
+</value>\r
+  </data>\r
+  <data name="errorProvider.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+    <value>\r
+        AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA\r
+        AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////\r
+        //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP\r
+        +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
+        +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/\r
+        //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP\r
+        +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA\r
+        AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
+        +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg\r
+        /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP\r
+        +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP\r
+        +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX\r
+        +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////\r
+        //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA\r
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\r
+</value>\r
+  </data>\r
+  <data name="propertygrid_alphabetic">\r
+    <value>Alphabetic</value>\r
+  </data>\r
   <data name="Ignore">\r
     <value>Ignore</value>\r
   </data>\r
         Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J\r
         9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l\r
         IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC\r
-</value>\r
-  </data>\r
-  <data name="errorProvider.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
-    <value>\r
-        AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA\r
-        AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////\r
-        //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP\r
-        +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
-        +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/\r
-        //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP\r
-        +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA\r
-        AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
-        +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg\r
-        /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP\r
-        +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP\r
-        +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX\r
-        +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////\r
-        //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA\r
-        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\r
 </value>\r
   </data>\r
 </root>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Build.Engine/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..e0db356
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Marek Sieradzki (mare.sieradzki@gmail.com
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the Microsoft.Build.Engine assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyTitle("Microsoft.Build.Engine.dll")]
+[assembly: AssemblyDescription("Microsoft.Build.Engine.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("Marek Sieradzki")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2005 Marek Sieradzki")]
+[assembly: AssemblyTrademark("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: AssemblyDefaultAlias("Microsoft.Build.Engine.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: ComVisible(false)]
+[assembly: AllowPartiallyTrustedCallers]
+
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
diff --git a/mcs/class/Microsoft.Build.Engine/ChangeLog b/mcs/class/Microsoft.Build.Engine/ChangeLog
new file mode 100644 (file)
index 0000000..7b30ad0
--- /dev/null
@@ -0,0 +1,6 @@
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Microsoft.Build.Engine_test.dll.sources: Added.
+       * Microsoft.Build.Engine.dll.sources: Renamed from
+       Microsoft.Build.Engine.sources.
+
diff --git a/mcs/class/Microsoft.Build.Engine/Makefile b/mcs/class/Microsoft.Build.Engine/Makefile
new file mode 100644 (file)
index 0000000..98e4c18
--- /dev/null
@@ -0,0 +1,21 @@
+thisdir = class/Microsoft.Build.Engine
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = Microsoft.Build.Engine.dll
+
+ifeq (1.0, $(FRAMEWORK_VERSION))
+LIBRARY_NAME = dummy-Microsoft.Build.Engine.dll
+NO_INSTALL = yes
+NO_TEST = yes
+NO_SIGN_ASSEMBLY = yes
+endif
+
+LIB_MCS_FLAGS = \
+       /r:$(corlib)                            \
+       /r:System.dll                           \
+       /r:System.Xml.dll                       \
+       /r:Microsoft.Build.Framework.dll        \
+       /r:Microsoft.Build.Utilities.dll
+
+include ../../build/library.make
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BatchingImpl.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BatchingImpl.cs
new file mode 100644 (file)
index 0000000..88b05de
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// BatchingImpl.cs: Class that implements BatchingAlgorithm from the wiki.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class BatchingImpl {
+       
+               string          inputs;
+               string          outputs;
+               Project         project;
+       
+               public BatchingImpl (Project project, XmlElement targetElement)
+               {
+                       if (targetElement == null)
+                               throw new ArgumentNullException ("targetElement");
+                       if (project == null)
+                               throw new ArgumentNullException ("project");
+               
+                       this.project = project;
+                       
+                       inputs = targetElement.GetAttribute ("Inputs");
+                       outputs = targetElement.GetAttribute ("Outputs");
+               }
+               
+               public bool BuildNeeded ()
+               {
+                       // FIXME: change this to ITaskItem instead of string
+               
+                       Expression inputExpr, outputExpr;
+                       string[] inputFiles, outputFiles;
+                       DateTime oldestInput, youngestOutput;
+               
+                       if (inputs == String.Empty) {
+                               return true;
+                       }
+                       if (outputs == String.Empty) {
+                               return true;
+                       }
+                       
+                       inputExpr = new Expression (project, inputs);
+                       outputExpr = new Expression (project, outputs);
+                       
+                       inputFiles = (string[]) inputExpr.ToArray (typeof (string[]));
+                       outputFiles = (string[]) outputExpr.ToArray (typeof (string[]));
+                       
+                       if (inputFiles == null) {
+                               return true;
+                       }
+                       if (outputFiles == null) {
+                               return true;
+                       }
+                       if (inputFiles.Length == 0) {
+                               return true;
+                       }
+                       if (outputFiles.Length == 0) {
+                               return true;
+                       }
+                       
+                       if (File.Exists (inputFiles [0])) {
+                               oldestInput = File.GetLastWriteTime (inputFiles [0]);
+                       } else {
+                               return true;
+                       }
+                       if (File.Exists (outputFiles [0])) {
+                               youngestOutput = File.GetLastWriteTime (outputFiles [0]);
+                       } else {
+                               return true;
+                       }
+                               
+                       foreach (string file in inputFiles) {
+                               if (file.Trim () == String.Empty)
+                                       continue;
+                       
+                               if (File.Exists (file.Trim ())) {
+                                       if (File.GetLastWriteTime (file.Trim ()) > oldestInput)
+                                               oldestInput = File.GetLastWriteTime (file.Trim ());
+                               } else {
+                                       return true;
+                               }
+                       }
+                       foreach (string file in outputFiles) {
+                               if (file.Trim () == String.Empty)
+                                       continue;
+                       
+                               if (File.Exists (file.Trim ())) {
+                                       if (File.GetLastWriteTime (file.Trim ()) < youngestOutput)
+                                               youngestOutput = File.GetLastWriteTime (file.Trim ());
+                               } else {
+                                       return true;
+                               }
+                       }
+                       
+                       if (oldestInput > youngestOutput) {
+                               return true;
+                       }
+                       else {
+                               return false;
+                       }
+               }
+               
+               public bool BatchTaskElement (TaskElement taskElement)
+               {
+                       return taskElement.Execute ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs
new file mode 100644 (file)
index 0000000..5800761
--- /dev/null
@@ -0,0 +1,66 @@
+//
+// BuildChoose.cs: Represents <Choose>.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class BuildChoose {
+               
+               bool            isImported;
+               BuildWhen       otherwise;
+               Project         project;
+               IList           whens;
+               
+               public BuildChoose (bool imported, Project project)
+               {
+                       this.isImported = imported;
+                       this.project = project; 
+                       this.whens = new ArrayList ();
+               }
+               
+               public void BindToXml (XmlElement chooseElement)
+               {
+               }
+               
+               public bool IsImported {
+                       get { return isImported; }
+                       set { isImported = value; }
+               }
+               
+               public BuildWhen Otherwise {
+                       get { return otherwise; }
+                       set { otherwise = value; }
+               }
+               
+               public IList Whens {
+                       get { return whens; }
+                       set { whens = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildEngine.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildEngine.cs
new file mode 100644 (file)
index 0000000..4969296
--- /dev/null
@@ -0,0 +1,107 @@
+//
+// BuildEngine.cs: Class that can be accessed by task.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class BuildEngine : IBuildEngine {
+       
+               Engine  engine;
+               int     columnNumberOfTaskNode;
+               bool    continueOnError;
+               int     lineNumberOfTaskNode;
+               string  projectFileOfTaskNode;
+               
+               public BuildEngine (Engine engine, int column, int line,
+                                   bool continueOnError, string projectFile)
+               {
+                       this.engine = engine;
+                       this.columnNumberOfTaskNode = column;
+                       this.continueOnError = continueOnError;
+                       this.lineNumberOfTaskNode = line;
+                       this.projectFileOfTaskNode = projectFile;
+               }
+       
+               // Initiates a build of a project file. If the build is
+               // successful, the outputs (if any) of the specified targets
+               // are returned.
+               public bool BuildProjectFile (string projectFileName,
+                                      string[] targetNames,
+                                      IDictionary globalProperties,
+                                      IDictionary targetOutputs)
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       foreach (DictionaryEntry de in globalProperties)
+                               bpg.AddNewProperty ((string) de.Key, (string) de.Value);
+                       return engine.BuildProjectFile (projectFileName,
+                               targetNames, bpg, targetOutputs);
+               }
+
+               // Raises a custom event to all registered loggers.
+               public void LogCustomEvent (CustomBuildEventArgs e)
+               {
+                       engine.EventSource.FireCustomEventRaised (this, e);
+               }
+
+               // Raises an error to all registered loggers.
+               public void LogErrorEvent (BuildErrorEventArgs e)
+               {
+                       engine.EventSource.FireErrorRaised (this, e);
+               }
+
+               // Raises a message event to all registered loggers.
+               public void LogMessageEvent (BuildMessageEventArgs e)
+               {
+                       engine.EventSource.FireMessageRaised (this, e);
+               }
+
+               // Raises a warning to all registered loggers.
+               public void LogWarningEvent (BuildWarningEventArgs e)
+               {
+                       engine.EventSource.FireWarningRaised (this, e);
+               }
+
+               public int ColumnNumberOfTaskNode {
+                       get { return columnNumberOfTaskNode; }
+               }
+
+               public bool ContinueOnError {
+                       get { return continueOnError; }
+               }
+
+               public int LineNumberOfTaskNode {
+                       get { return lineNumberOfTaskNode; }
+               }
+
+               public string ProjectFileOfTaskNode {
+                       get { return projectFileOfTaskNode; }
+               }
+               
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs
new file mode 100644 (file)
index 0000000..f3e0bc6
--- /dev/null
@@ -0,0 +1,345 @@
+//
+// BuildItem.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using System.Xml;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       public class BuildItem : IBuildItem {
+
+               BuildItemGroup  childs;
+               XmlAttribute    condition;
+               XmlAttribute    exclude;
+               string          evaluatedItemSpec;
+               Hashtable       evaluatedMetadata;
+               string          finalItemSpec;
+               XmlAttribute    include;
+               bool            isImported;
+               XmlElement      itemElement;
+               string          name;
+               BuildItem       parentItem;
+               BuildItemGroup  parentItemGroup;
+               string          recursiveDir;
+               Hashtable       unevaluatedMetadata;
+       
+               public BuildItem ()
+               {
+                       this.isImported = false;
+                       unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
+                       evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
+               }
+
+               public BuildItem (string itemName, ITaskItem taskItem)
+                       : this ()
+               {
+                       this.name = itemName;
+               }
+
+               public BuildItem (string itemName, string itemInclude)
+                       : this ()
+               {
+                       this.name = itemName;
+                       this.finalItemSpec = itemInclude;
+                       this.evaluatedItemSpec = itemInclude;
+               }
+
+               public BuildItem (XmlDocument ownerDocument, string itemName,
+                                 string itemInclude)
+                       : this ()
+               {
+                       this.name = itemName;
+                       this.finalItemSpec = itemInclude;
+                       this.evaluatedItemSpec = itemInclude;
+               }
+               
+               internal BuildItem (string name, BuildItemGroup parentItemGroup)
+                       : this ()
+               {
+                       this.name = name;
+                       this.parentItemGroup = parentItemGroup;
+               }
+               
+               internal BuildItem (BuildItem parent)
+               {
+                       this.isImported = parent.isImported;
+                       this.name = parent.name;
+                       this.parentItem = parent;
+                       this.parentItemGroup = parent.parentItemGroup;
+                       this.unevaluatedMetadata = (Hashtable) parent.unevaluatedMetadata.Clone ();
+                       this.evaluatedMetadata = (Hashtable) parent.evaluatedMetadata.Clone ();
+                       this.include = parent.include;
+                       this.exclude = parent.exclude;
+               }
+               
+               internal BuildItem (string name, ITaskItem item,
+                                   BuildItemGroup parentItemGroup)
+               {
+                       this.isImported = false;
+                       this.name = name;
+                       this.finalItemSpec = item.ItemSpec;
+                       this.evaluatedMetadata = (Hashtable) item.CloneCustomMetadata ();
+                       this.unevaluatedMetadata = (Hashtable) item.CloneCustomMetadata ();
+               }
+               
+               public void CopyCustomMetadataTo (IBuildItem destinationItem)
+               {
+                       foreach (DictionaryEntry de in unevaluatedMetadata)
+                               destinationItem.SetMetadata ((string) de.Key, (string) de.Value);
+               }
+
+               public string GetEvaluatedMetadata (string metadataName)
+               {
+                       if (evaluatedMetadata.Contains (metadataName))
+                               return (string) evaluatedMetadata [metadataName];
+                       else
+                               return null;
+               }
+
+               public string GetMetadata (string metadataName)
+               {
+                       if (evaluatedMetadata.Contains (metadataName) == true)
+                               return (string) evaluatedMetadata [metadataName];
+                       else
+                               return CheckBuiltinMetadata (metadataName);
+               }
+               
+               private string CheckBuiltinMetadata (string metadataName)
+               {
+                       if (File.Exists (finalItemSpec)) {
+                               switch (metadataName.ToLower ()) {
+                               case "fullpath":
+                                       return Path.GetFullPath (finalItemSpec);
+                               case "rootdir":
+                                       return "/";
+                               case "filename":
+                                       return Path.GetFileNameWithoutExtension (finalItemSpec);
+                               case "extension":
+                                       return Path.GetExtension (finalItemSpec);
+                               case "relativedir":
+                                       return Path.GetDirectoryName (finalItemSpec);
+                               case "directory":
+                                       return Path.GetDirectoryName (Path.GetFullPath (finalItemSpec));
+                               case "recursivedir":
+                                       return recursiveDir;
+                               case "identity":
+                                       return Path.Combine (Path.GetDirectoryName (finalItemSpec), Path.GetFileName (finalItemSpec));
+                               case "modifiedtime":
+                                       return File.GetLastWriteTime (finalItemSpec).ToString ();
+                               case "createdtime":
+                                       return File.GetCreationTime (finalItemSpec).ToString ();
+                               case "accessedtime":
+                                       return File.GetLastAccessTime (finalItemSpec).ToString ();
+                               default:
+                                       return String.Empty;
+                               }
+                       } else
+                               return String.Empty;
+               }
+
+               public bool HasMetadata (string metadataName)
+               {
+                       return evaluatedMetadata.Contains (metadataName);
+               }
+
+               public void RemoveMetadata (string metadataName)
+               {
+                       if (evaluatedMetadata.Contains (metadataName))
+                               evaluatedMetadata.Remove (metadataName);
+                       if (unevaluatedMetadata.Contains (metadataName))
+                               unevaluatedMetadata.Remove (metadataName);
+               }
+
+               public void SetMetadata (string metadataName,
+                                        string metadataValue)
+               {
+                       RemoveMetadata (metadataName);
+                       unevaluatedMetadata.Add (metadataName, metadataValue);
+                       Expression finalValue = new Expression (parentItemGroup.Project, metadataValue);
+                       evaluatedMetadata.Add (metadataName, (string) finalValue.ToNonArray (typeof (string)));
+               }
+               
+               internal void BindToXml (XmlElement xmlElement)
+               {
+                       DirectoryScanner directoryScanner;
+                       Expression includeExpr, excludeExpr;
+                       string includes, excludes;
+                       
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+                       this.itemElement = xmlElement;
+                       this.condition = xmlElement.GetAttributeNode ("Condition");
+                       this.exclude = xmlElement.GetAttributeNode ("Exclude");
+                       this.include = xmlElement.GetAttributeNode ("Include"); 
+                       if (include == null)
+                               throw new InvalidProjectFileException ("Item must have Include attribute.");
+                       foreach (XmlElement xe in xmlElement.ChildNodes) {
+                               this.SetMetadata (xe.Name, xe.InnerText);
+                       }
+                       
+                       includeExpr = new Expression (parentItemGroup.Project, Include);
+                       excludeExpr = new Expression (parentItemGroup.Project, Exclude);
+                       
+                       includes = (string) includeExpr.ToNonArray (typeof (string));
+                       excludes = (string) excludeExpr.ToNonArray (typeof (string));
+                       
+                       this.evaluatedItemSpec = includes;
+                       this.finalItemSpec = includes;
+                       
+                       directoryScanner = new DirectoryScanner ();
+                       
+                       directoryScanner.Includes = includes;
+                       directoryScanner.Excludes = excludes;
+                       directoryScanner.BaseDirectory = new DirectoryInfo (Path.GetDirectoryName (parentItemGroup.Project.FullFileName));
+                       
+                       directoryScanner.Scan ();
+                       
+                       foreach (string matchedFile in directoryScanner.MatchedFilenames) {
+                               AddChildItem (matchedFile);
+                       }
+               }
+               
+               private void AddChildItem (string itemSpec)
+               {
+                       Project project = this.parentItemGroup.Project;
+                       
+                       if (this.childs == null)
+                               childs = new BuildItemGroup (project);
+                       BuildItem bi = childs.AddFromParentItem (this);
+                       bi.finalItemSpec = itemSpec;
+                       bi.evaluatedItemSpec = itemSpec;
+                       project.EvaluatedItems.AddItem (bi);
+                       if (project.EvaluatedItemsByName.Contains (bi.name) == false) {
+                               BuildItemGroup big = new BuildItemGroup (project);
+                               project.EvaluatedItemsByName.Add (bi.name, big);
+                               big.AddItem (bi);
+                       } else {
+                               ((BuildItemGroup) project.EvaluatedItemsByName [bi.name]).AddItem (bi);
+                       }
+               }
+               
+               internal string ToString (Expression transform)
+               {
+                       return GetItemSpecFromTransform (transform);
+               }
+               
+               internal ITaskItem ToITaskItem (Expression transform)
+               {
+                       TaskItem taskItem;
+                       taskItem = new TaskItem (GetItemSpecFromTransform (transform), (IDictionary) evaluatedMetadata.Clone ());
+                       return taskItem;
+               }
+
+               private string GetItemSpecFromTransform (Expression transform)
+               {
+                       StringBuilder sb;
+               
+                       if (transform == null)
+                               return finalItemSpec;
+                       else {
+                               sb = new StringBuilder ();
+                               foreach (object o in transform) {
+                                       if (o is string) {
+                                               sb.Append ((string)o);
+                                       } else if (o is PropertyReference) {
+                                               sb.Append (((PropertyReference)o).ToString ());
+                                       } else if (o is ItemReference) {
+                                               sb.Append (((ItemReference)o).ToString ());
+                                       } else if (o is MetadataReference) {
+                                               sb.Append (GetMetadata (((MetadataReference)o).MetadataName));
+                                       }
+                               }
+                               return sb.ToString ();
+                       }
+               }
+
+               public string Condition {
+                       get {
+                               if (condition == null)
+                                       return null;
+                               else
+                                       return condition.Value;
+                       }
+                       set {
+                               if (condition != null)
+                                       condition.Value = value;
+                       }
+               }
+
+               public string Exclude {
+                       get {
+                               if (exclude == null)
+                                       return String.Empty;
+                               else
+                                       return exclude.Value;
+                       }
+                       set {
+                               if (exclude != null)
+                                       exclude.Value = value;
+                       }
+               }
+
+               public string FinalItemSpec {
+                       get {
+                               return finalItemSpec;
+                       }
+               }
+
+               public string Include {
+                       get {
+                               if (include == null)
+                                       return String.Empty;
+                               else
+                                       return include.Value;
+                       }
+                       set {
+                               if (include != null)
+                                       include.Value = value;
+                       }
+               }
+
+               public bool IsImported {
+                       get {
+                               return isImported;
+                       }
+               }
+
+               public string Name {
+                       get {
+                               return name;
+                       }
+                       set {
+                               name = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs
new file mode 100644 (file)
index 0000000..279cd21
--- /dev/null
@@ -0,0 +1,205 @@
+//
+// BuildItemGroup.cs: Represents a group of build items.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Xml;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       public class BuildItemGroup : ItemPropertyGroupingBase, IBuildItemGroup, IEnumerable {
+       
+               XmlAttribute            condition;
+               bool                    isImported;
+               IList                   buildItems;
+               GroupingCollection      parentCollection;
+               Project                 parentProject;
+               XmlElement              itemGroupElement;
+               
+               public BuildItemGroup ()
+                       : this (null)
+               {
+               }
+               
+               internal BuildItemGroup (Project project)
+               {
+                       this.buildItems = new ArrayList ();
+                       this.isImported = false;
+                       this.parentProject = project;
+               }
+
+               public BuildItem AddNewItem (string itemName,
+                                            string itemInclude)
+               {
+                       BuildItem bi = new BuildItem (itemName, itemInclude);
+                       buildItems.Add (bi);
+                       return bi;
+               }
+               
+               internal BuildItem AddFromParentItem (BuildItem bi)
+               {
+                       BuildItem buildItem = new BuildItem (bi);
+                       buildItems.Add (buildItem);
+                       return buildItem;
+               }
+               
+               internal void AddItem (BuildItem buildItem)
+               {
+                       buildItems.Add (buildItem);
+               }
+               
+               internal void AddItem (string name, ITaskItem taskItem)
+               {
+                       BuildItem buildItem;
+                       buildItem = new BuildItem (name, taskItem, this);
+                       buildItems.Add (buildItem);
+               }
+
+               public void Clear ()
+               {
+                       //FIXME: should this remove all build items?
+                       buildItems = new ArrayList ();
+               }
+
+               public BuildItemGroup Clone (bool deepClone)
+               {
+                       BuildItemGroup big = new BuildItemGroup ();
+                       // FIXME: add copying of items
+                       return big;
+               }
+
+               public override void Evaluate (BuildPropertyGroup parentPropertyBag,
+                                              bool ignoreCondition,
+                                              bool honorCondition,
+                                              Hashtable conditionedPropertiesTable,
+                                              ProcessingPass pass)
+               {
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                       return buildItems.GetEnumerator ();
+               }
+
+               public void RemoveItem (BuildItem itemToRemove)
+               {
+                       buildItems.Remove (itemToRemove);
+               }
+
+               public void RemoveItemAt (int index)
+               {
+                       buildItems.RemoveAt (index);
+               }
+
+               public BuildItem[] ToArray ()
+               {
+                       BuildItem[] array;
+                       array = new BuildItem [Count];
+                       buildItems.CopyTo (array,0);
+                       return array;
+               }
+               
+               internal void BindToXml (XmlElement xmlElement)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+                       this.condition = xmlElement.GetAttributeNode ("Condition");
+                       this.itemGroupElement = xmlElement;
+                       foreach (XmlNode xn in xmlElement.ChildNodes) {
+                               if (xn is XmlElement) {
+                                       XmlElement xe = (XmlElement) xn;
+                                       BuildItem bi = new BuildItem (xe.Name, this);
+                                       bi.BindToXml (xe);
+                                       buildItems.Add (bi);
+                               }
+                       }
+               }
+               
+               internal string ToString (Expression transform, string separator)
+               {
+                       string[] items = new string [buildItems.Count];
+                       int i = 0;
+                       foreach (BuildItem bi in  buildItems)
+                               items [i++] = bi.ToString (transform);
+                       return String.Join (separator,items);
+               }
+               
+               internal ITaskItem[] ToITaskItemArray (Expression transform)
+               {
+                       ITaskItem[] array = new ITaskItem [buildItems.Count];
+                       int i = 0;
+                       foreach (BuildItem item in buildItems)
+                               array [i++] = item.ToITaskItem (transform);
+                       return array;
+               }
+
+               public string Condition {
+                       get {
+                               if (condition != null)
+                                       return condition.Value;
+                               else
+                                       return null;
+                       }
+                       set {
+                               if (condition != null)
+                                       condition.Value = value;
+                       }
+               }
+
+               public int Count {
+                       get {
+                               if (buildItems != null)
+                                       return buildItems.Count;
+                               else
+                                       return 0;
+                       }
+               }
+
+               public bool IsImported {
+                       get {
+                               return isImported;
+                       }
+               }
+
+               public BuildItem this[int index] {
+                       get {
+                               return (BuildItem) buildItems [index];
+                       }
+               }
+               
+               internal GroupingCollection GroupingCollection {
+                       get { return parentCollection; }
+                       set { parentCollection = value; }
+               }
+               
+               internal Project Project {
+                       get { return parentProject; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroupCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroupCollection.cs
new file mode 100644 (file)
index 0000000..4b1026f
--- /dev/null
@@ -0,0 +1,116 @@
+//
+// BuildItemGroupCollection.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public class BuildItemGroupCollection : IBuildItemGroupCollection, ICollection, IEnumerable {
+                       
+               GroupingCollection      groupingCollection;
+               
+               public BuildItemGroupCollection ()
+               {
+                       groupingCollection = new GroupingCollection ();
+               }
+
+               public BuildItemGroupCollection (GroupingCollection groupingCollection)
+               {
+                       this.groupingCollection = groupingCollection;
+               }
+
+               public void CopyTo (Array array, int index)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("index");
+                       if (array.Rank > 1)
+                               throw new ArgumentException ("array is multidimensional");
+                       if ((array.Length > 0) && (index >= array.Length))
+                               throw new ArgumentException ("index is equal or greater than array.Length");
+                       if (index + this.Count > array.Length)
+                               throw new ArgumentException ("Not enough room from index to end of array for this BuildItemGroupCollection");
+               
+                       IEnumerator it = GetEnumerator ();
+                       int i = index;
+                       while (it.MoveNext ()) {
+                               array.SetValue(it.Current, i++);
+                       }
+               }
+
+               public void CopyToStronglyTypedArray (BuildItemGroup[] array,
+                                                     int index)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("index");
+                       if (array.Rank > 1)
+                               throw new ArgumentException ("array is multidimensional");
+                       if ((array.Length > 0) && (index >= array.Length))
+                               throw new ArgumentException ("index is equal or greater than array.Length");
+                       if (index + this.Count > array.Length)
+                               throw new ArgumentException ("Not enough room from index to end of array for this BuildPropertyGroupCollection");
+               
+                       IEnumerator it = GetEnumerator ();
+                       int i = index;
+                       while (it.MoveNext ()) {
+                               array.SetValue((BuildItemGroup) it.Current, i++);
+                       }
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                       return groupingCollection.GetItemGroupEnumerator ();
+               }
+               
+               internal void Add (BuildItemGroup buildItemGroup)
+               {
+                       buildItemGroup.GroupingCollection = this.groupingCollection;
+                       groupingCollection.Add (buildItemGroup);
+               }
+
+               public int Count {
+                       get {
+                               return groupingCollection.ItemGroups;
+                       }
+               }
+
+               public bool IsSynchronized {
+                       get {
+                               return false;
+                       }
+               }
+
+               public object SyncRoot {
+                       get {
+                               return this;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildProperty.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildProperty.cs
new file mode 100644 (file)
index 0000000..6470ada
--- /dev/null
@@ -0,0 +1,151 @@
+//
+// BuildProperty.cs: Represents a property
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Text;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       public class BuildProperty : IBuildProperty {
+       
+               XmlElement      propertyElement;
+               XmlAttribute    condition;
+               string          finalValue;
+               string          value;
+               string          name;
+               PropertyType    propertyType;
+       
+               public BuildProperty ()
+                       : this (null, null)
+               {
+               }
+
+               public BuildProperty (string propertyName,
+                               string propertyValue)
+               {
+                       this.name = propertyName;
+                       this.value = propertyValue;
+               }
+
+               public BuildProperty Clone (bool deepClone)
+               {
+                       BuildProperty bp;
+                       
+                       bp = new BuildProperty ();
+                       bp.condition = this.condition;
+                       bp.finalValue = this.finalValue;
+                       bp.name = this.name;
+                       bp.propertyElement = this.propertyElement;
+                       bp.propertyType = this.propertyType;
+                       bp.value = this.value;
+                       
+                       return bp;
+               }
+
+               public static implicit operator string (BuildProperty propertyToCast)
+               {
+                       if (propertyToCast == null)
+                               throw new ArgumentNullException ("propertyToCast");
+                       return propertyToCast.ToString ();
+               }
+
+               public override string ToString ()
+               {
+                       if (finalValue != null)
+                               return finalValue;
+                       else
+                               return Value;
+               }
+
+               
+               internal void BindToXml (XmlElement propertyElement)
+               {
+                       if (propertyElement == null)
+                               throw new ArgumentNullException ("propertyElement");
+                       this.propertyElement = propertyElement;
+                       this.condition = propertyElement.GetAttributeNode ("Condition");
+                       this.name = propertyElement.Name;
+                       this.value = propertyElement.InnerText;
+               }
+               
+               internal void UpdateXml ()
+               {
+               }
+               
+               public string Condition {
+                       get {
+                               if (condition == null)
+                                       return null;
+                               else
+                                       return condition.Value;
+                       }
+                       set {
+                               if (condition != null)
+                                       condition.Value = value;
+                       }
+               }
+
+               public string FinalValue {
+                       get {
+                               if (finalValue == null) {
+                                       return this.@value;
+                               } else
+                                       return finalValue;
+                       }
+                       internal set {
+                               finalValue = value;
+                       }
+               }
+
+               public string Name {
+                       get {
+                               return name;
+                       }
+               }
+
+               public string Value {
+                       get {
+                               return value;
+                       }
+                       set {
+                               this.@value = value;
+                       }
+               }
+
+               internal PropertyType PropertyType {
+                       get { return propertyType; }
+                       set { propertyType = value; }
+               }
+       }
+
+       internal enum PropertyType {
+               Reserved,
+               CommandLine,
+               Normal,
+               Environment
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
new file mode 100644 (file)
index 0000000..51abe40
--- /dev/null
@@ -0,0 +1,263 @@
+//
+// BuildPropertyGroup.cs: Represents a group of properties
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       public class BuildPropertyGroup : ItemPropertyGroupingBase, IBuildPropertyGroup, IEnumerable {
+       
+               XmlElement              propertyGroup;
+               XmlAttribute            condition;
+               string                  importedFromFilename;
+               bool                    isImported;
+               GroupingCollection      parentCollection;
+               Project                 parentProject;
+               IList                   properties;
+               IDictionary             propertiesByName;
+       
+               public BuildPropertyGroup ()
+                       : this (true, null)
+               {
+               }
+               
+               internal BuildPropertyGroup (bool forXml, Project project)
+               {
+                       this.propertyGroup = null;
+                       this.condition = null;
+                       this.importedFromFilename = null;
+                       this.isImported = false;
+                       this.parentCollection = null;
+                       this.parentProject = project;
+                       if (forXml == true)
+                               this.properties = new ArrayList ();
+                       else
+                               this.propertiesByName = new Hashtable (new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer ());
+               }
+
+               public BuildProperty AddNewProperty (string propertyName,
+                                                    string propertyValue)
+               {
+                       return AddNewProperty (propertyName, propertyValue,
+                               PropertyType.Normal);
+               }
+               
+               internal BuildProperty AddNewProperty (string propertyName,
+                                                      string propertyValue,
+                                                      PropertyType propertyType)
+               {
+                       BuildProperty added, existing;
+                       
+                       added = new BuildProperty (propertyName, propertyValue);
+                       added.PropertyType = propertyType;
+                       if (properties != null) {
+                               properties.Add (added);
+                       } else if (propertiesByName != null) {
+                               if (propertiesByName.Contains (propertyName) == true) {
+                                       existing = (BuildProperty) propertiesByName [added.Name];
+                                       if (added.PropertyType <= existing.PropertyType) {
+                                               propertiesByName.Remove (added.Name);
+                                               propertiesByName.Add (added.Name, added);
+                                       }
+                               } else {
+                                       propertiesByName.Add (added.Name, added);
+                               }
+                       } else
+                               throw new Exception ("PropertyGroup is not initialized.");
+                       return added;
+               }
+               
+               internal void AddFromExistingProperty (BuildProperty buildProperty)
+               {
+                       BuildProperty added, existing;
+                       
+                       added = buildProperty.Clone (false);
+                       if (propertiesByName.Contains (added.Name) == true) {
+                               existing = (BuildProperty) propertiesByName [added.Name];
+                               if (added.PropertyType <= existing.PropertyType) {
+                                       propertiesByName.Remove (added.Name);
+                                       propertiesByName.Add (added.Name, added);
+                               }
+                       } else
+                               propertiesByName.Add (added.Name, added);
+               }
+               
+               public void Clear ()
+               {
+               }
+
+               public BuildPropertyGroup Clone (bool deepClone)
+               {
+                       return null;
+               }
+
+               // FIXME: what it is doing?
+               public override void Evaluate (BuildPropertyGroup evaluatedPropertyBag,
+                                              bool ignoreCondition,
+                                              bool honorCondition,
+                                              Hashtable conditionedPropertiesTable,
+                                              ProcessingPass pass)
+               {
+               }
+               
+               public IEnumerator GetEnumerator ()
+               {
+                       if (properties != null)
+                               foreach (BuildProperty bp in properties)
+                                       yield return bp;
+                       else if (propertiesByName != null)
+                               foreach (DictionaryEntry de in propertiesByName)
+                                       yield return (BuildProperty) de.Value;
+                       else
+                               throw new Exception ("PropertyGroup is not initialized.");
+               }
+
+               public void GetStringArraysForAllProperties (out string[] propertyNames,
+                                                            out string[] propertyValues,
+                                                            out string[] propertyFinalValues)
+               {
+                       propertyNames = null;
+                       propertyValues = null;
+                       propertyFinalValues = null;
+                       int i = 0;
+                       if (properties != null) {
+                               foreach (BuildProperty bp in properties) {
+                                       propertyNames [i] = bp.Name;
+                                       propertyValues [i] = bp.Value;
+                                       propertyFinalValues [i] = bp.FinalValue;
+                                       i++;
+                               }
+                       } else if (propertiesByName != null) {
+                               foreach (DictionaryEntry de in propertiesByName) {
+                                       propertyNames [i] = ((BuildProperty) de.Value).Name;
+                                       propertyValues [i] = ((BuildProperty) de.Value).Value;
+                                       propertyFinalValues [i] = ((BuildProperty) de.Value).FinalValue;
+                                       i++;
+                               }
+                       }
+               }
+
+               public void RemoveProperty (BuildProperty propertyToRemove)
+               {
+                       if (properties == null)
+                               throw new Exception ("PropertyGroup is not initialized.");
+                       properties.Remove (propertyToRemove);
+               }
+
+               public void RemovePropertyByName (string propertyNameToRemove)
+               {
+                       if (propertiesByName == null)
+                               throw new Exception ("PropertyGroup is not initialized.");
+                       propertiesByName.Remove (propertyNameToRemove);
+               }
+
+               public void SetProperty (string propertyName,
+                                        string propertyValue)
+               {
+                       if (propertiesByName.Contains (propertyName) == false) {
+                               AddNewProperty (propertyName, propertyValue);
+                       }
+                       ((BuildProperty) propertiesByName [propertyName]).Value = propertyValue;
+               }
+               
+               internal void BindToXml (XmlElement propertyGroupElement)
+               {
+                       if (propertyGroupElement == null)
+                               throw new ArgumentNullException ();
+                       this.properties = new ArrayList ();
+                       this.propertyGroup = propertyGroupElement;
+                       this.condition = propertyGroupElement.GetAttributeNode ("Condition");
+                       this.importedFromFilename = null;
+                       this.isImported = false;
+                       foreach (XmlElement xe in propertyGroupElement.ChildNodes) {
+                               BuildProperty bp = AddNewProperty(xe.Name, xe.InnerText);
+                               bp.PropertyType = PropertyType.Normal;
+                               bp.BindToXml (xe);
+                               Expression finalValue = new Expression (parentProject, bp.Value);
+                               bp.FinalValue = (string) finalValue.ToNonArray (typeof (string));
+                               parentProject.EvaluatedProperties.AddFromExistingProperty (bp);
+                       } 
+               }
+               
+               public string Condition {
+                       get {
+                               if (condition == null)
+                                       return null;
+                               else
+                                       return condition.Value;
+                       }
+                       set {
+                               if (condition != null)
+                                       condition.Value = value;
+                       }
+               }
+
+               public int Count {
+                       get {
+                               if (properties != null)
+                                       return properties.Count;
+                               else if (propertiesByName != null)
+                                       return propertiesByName.Count;
+                               else
+                                       throw new Exception ("PropertyGroup is not initialized.");
+                       }
+               }
+
+               public string ImportedFromFilename {
+                       get {
+                               return importedFromFilename;
+                       }
+               }
+
+               public bool IsImported {
+                       get {
+                               return isImported;
+                       }
+               }
+
+               public BuildProperty this[string propertyName] {
+                       get {
+                               if (propertiesByName.Contains (propertyName)) {
+                                       return (BuildProperty) propertiesByName [propertyName];
+                               } else {
+                                       return null;
+                               }
+                       }
+                       set {
+                               propertiesByName [propertyName] = value;
+                       }
+               }
+               
+               internal GroupingCollection GroupingCollection {
+                       get { return parentCollection; }
+                       set { parentCollection = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroupCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroupCollection.cs
new file mode 100644 (file)
index 0000000..78a8e69
--- /dev/null
@@ -0,0 +1,116 @@
+//
+// BuildPropertyGroupCollection.cs: Collection for group of properties
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public class BuildPropertyGroupCollection : IBuildPropertyGroupCollection, ICollection, IEnumerable {
+
+               GroupingCollection      groupingCollection;
+       
+               public BuildPropertyGroupCollection ()
+               {
+                       groupingCollection = new GroupingCollection ();
+               }
+
+               public BuildPropertyGroupCollection (GroupingCollection groupingCollection)
+               {
+                       this.groupingCollection = groupingCollection;
+               }
+               
+               public void CopyTo (Array array, int index)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("index");
+                       if (array.Rank > 1)
+                               throw new ArgumentException ("array is multidimensional");
+                       if ((array.Length > 0) && (index >= array.Length))
+                               throw new ArgumentException ("index is equal or greater than array.Length");
+                       if (index + this.Count > array.Length)
+                               throw new ArgumentException ("Not enough room from index to end of array for this BuildPropertyGroupCollection");
+               
+                       IEnumerator it = GetEnumerator ();
+                       int i = index;
+                       while (it.MoveNext ()) {
+                               array.SetValue(it.Current, i++);
+                       }
+               }
+
+               public void CopyToStronglyTypedArray (BuildPropertyGroup[] array,
+                                                     int index)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("index");
+                       if (array.Rank > 1)
+                               throw new ArgumentException ("array is multidimensional");
+                       if ((array.Length > 0) && (index >= array.Length))
+                               throw new ArgumentException ("index is equal or greater than array.Length");
+                       if (index + this.Count > array.Length)
+                               throw new ArgumentException ("Not enough room from index to end of array for this BuildPropertyGroupCollection");
+               
+                       IEnumerator it = GetEnumerator ();
+                       int i = index;
+                       while (it.MoveNext ()) {
+                               array.SetValue((BuildPropertyGroup) it.Current, i++);
+                       }
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                       return groupingCollection.GetPropertyGroupEnumerator ();
+               }
+               
+               internal void Add (BuildPropertyGroup bpg)
+               {
+                       bpg.GroupingCollection = groupingCollection;
+                       groupingCollection.Add (bpg);
+               }
+
+               public int Count {
+                       get {
+                               return groupingCollection.PropertyGroups;
+                       }
+               }
+
+               public bool IsSynchronized {
+                       get {
+                               return false;
+                       }
+               }
+
+               public object SyncRoot {
+                       get {
+                               return this;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildSettings.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildSettings.cs
new file mode 100644 (file)
index 0000000..c41a59a
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// BuildSettings.cs: Enum for build settings
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.BuildEngine {
+       [Flags]
+       public enum BuildSettings {
+               None,
+               DoNotResetPreviouslyBuiltTargets
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildWhen.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildWhen.cs
new file mode 100644 (file)
index 0000000..61df15d
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// BuildWhen.cs: Represents <When>.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class BuildWhen {
+               XmlAttribute            condition;
+               Project                 parentProject;
+               GroupingCollection      groupingCollection;
+               XmlElement              whenElement;
+       
+               public BuildWhen (Project parentProject)
+               {
+                       this.parentProject = parentProject;
+                       this.groupingCollection = new GroupingCollection ();
+               }
+               
+               public void BindToXml (XmlElement whenElement)
+               {
+                       if (whenElement == null)
+                               throw new ArgumentNullException ("whenElement");
+                       this.whenElement = whenElement;
+                       if (whenElement.GetAttribute ("Condition") != String.Empty)
+                               condition = whenElement.GetAttributeNode ("Condition");
+                       foreach (XmlElement xe in whenElement.ChildNodes) {
+                               if (xe.Name == "ItemGroup") {
+                                       BuildItemGroup big = new BuildItemGroup ();
+                                       //big.BindToXml (xe);
+                                       groupingCollection.Add (big);
+                               // FIXME: add nested chooses
+                               } else if (xe.Name == "PropertyGroup") {
+                                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                                       //bpg.BindToXml (xe);
+                                       groupingCollection.Add (bpg);
+                               } else
+                                       throw new InvalidProjectFileException ("Invalid element in When.");
+                       }
+               }
+               
+               public string Condition {
+                       get { return condition.Value; }
+                       set { condition.Value = value; }
+               }
+               
+               public GroupingCollection GroupingCollection {
+                       get { return groupingCollection; }
+                       set { groupingCollection = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
new file mode 100644 (file)
index 0000000..38bb8d6
--- /dev/null
@@ -0,0 +1,166 @@
+2005-09-11  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskDatabase.cs: Added handling of LoadInfoType.AssemblyName.
+       * Engine.cs, Project.cs: Added handling of MSBuildBinPath reserved
+       property.
+
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * InternalLoggerException.cs: Changed protected fields to private.
+
+2005-09-03  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Engine.cs: Added check for globalProperties.
+       * Project.cs: Added using path from importedProject.FullFileName when
+       adding UsingTask elements.
+
+2005-09-01  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskElement.cs: Changed ReflectedType to PropertyType.
+       * ChangeType.cs (TransformToString): Changed to pass proper Type to
+       TemporaryTransform. 
+
+2005-09-01  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildPropertyGroup.cs: Added check for PropertyType when adding a
+       new property.
+       * BuildProperty.cs: Organized PropertyType enum.
+       * Engine.cs: Added setting CommandLine PropertyType of global
+       properties.
+
+2005-08-31  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * InvalidProjectFileException.cs: Changed Message property.
+       * ChangeType.cs (TransformToString): Added separator between items.
+       * TaskEngineAssemblyResolver.cs: Formatting.
+
+2005-08-31  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * DirectoryScanner.cs: Added.
+       * BuildItem.cs: Moved file scanning code to DirectoryScanner.
+       * BuildPropertyGroup.cs: Changed Project.Evaluate to Expression.
+       * Project.cs: Removed Evalute* ().
+
+2005-08-30  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Target.cs: Formatting.
+       * Expression.cs: Added check if array == null.
+       * BuildItem.cs: Removed 'break' to remove warnings.
+       * ConsoleLogger.cs: Formatting.
+       * Engine.cs: Added handling of default target(s).
+       * Project.cs: Added handling of default target(s).
+
+2005-08-29  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskElement.cs: Added check for parameters.
+       * Target.cs: Added logging of target skipping.
+       * Expression.cs: Changed returning object[] to string[], bool[]... in
+       ToArray ().
+       * ItemReference.cs: Fixed for item references without custom
+       separators.
+       * BatchingImpl.cs: Added real inputs/outputs checking.
+       * Engine.cs: Moved global properties setting.
+       * Project.cs: Moved global properties setting.
+
+2005-08-27  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Target.cs: Added checks for target existence.
+       * BuildItemGroup.cs: Changed to use transforms.
+       * MetadataReference.cs: Wrote real implementation.
+       * ItemReference.cs: Rewritten to use transforms.
+       * BuildItem.cs: Changes for transforms and metadata.
+       * ConsoleLogger.cs: Added verbosity checking and fixed error/warning
+       formatting.
+       * Project.cs: Fixed project importing.
+       * ImportedProject.cs: Changed to throw exceptions instead of returning
+       bool.
+
+2005-08-24  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Engine.cs: Removed FIXME.
+       * Project.cs: Splitted ProcessElements and added project importing.
+       * ImportedProject.cs: Rewritten.
+
+2005-08-20  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskElement.cs: Added getting of objects of every type.
+       * BuildItemGroup.cs: Added ToITaskItemArray ().
+       * Expression.cs: Implemented part that is not using metadata.
+       * ItemReference.cs: Implemented parsing item references. Need to fix
+       validity checking.
+       * BuildItem.cs: Fixed ToITaskItem ().
+       * PropertyReference.cs: Implemented parsing property references. This
+       also needs validity checking.
+
+2005-08-19  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskElement.cs: Added Output element handling.
+       * Target.cs: Cleaned up.
+       * BuildItemGroup.cs: Added creating BuildItem from TaskItem.
+       * Expression.cs, MetadataReference.cs, PropertyReference.cs,
+       ItemReference.cs, ChangeType.cs: Added.
+       * BuildItem.cs: Added creating BuildItem from TaskItem.
+       * BuildPropertyGroup.cs: Small changes.
+       * BatchingImpl.cs: Fixed to return real task execution result.
+       * BuildProperty.cs: Fixed FinalValue property.
+       * Engine.cs: Reformatted logging.
+       * Project.cs: Added check to EvaluateProperty.
+
+2005-08-16  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskElement.cs: Added part of execution engine.
+       * BuildEngine.cs: Added handling of TaskStarted and TaskFinished.
+       * BuildItemGroup.cs: Iterating by XmlNode casted to XmlElement.
+       * EventSource.cs: Added FireTaskStarted and FireTaskFinished.
+       * BuildItem.cs: Added handling of built-in metadata and referencing
+       Items by name not FullName.
+       * BatchingImpl.cs: Added temporary task "batching".
+       * ConsoleLogger.cs: Added temporary workaround to not show sender.
+       * Project.cs: Added Evaluate. It will be moved to separate class.
+
+2005-08-14  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * EventSource.cs, Engine.cs: Added CriticalEvents.
+       * BuildItem.cs, BuildItemGroup.cs, BuildItemGroupCollection.cs,
+       Project.cs: Added some support for items.
+       * BuildProperty.cs, BuildPropertyGroup.cs: Cleaned up.
+
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildProperty.cs, BuildPropertyGroup.cs, Project.cs: Added loading
+       of properties.
+
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BatchingImpl.cs: Added.
+       * BuildWhen.cs, BuildEngine.cs, Target.cs,
+       BuildPropertyGroupCollection.cs, BuildChoose.cs, EventSource.cs,
+       BuildItem.cs, BuildPropertyGroup.cs, ConsoleLogger.cs,
+       TargetCollection.cs, BuildProperty.cs, Engine.cs, Project.cs,
+       GroupingCollection.cs: Updated.
+
+2005-08-06  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildChoose.cs, BuildEngine.cs, BuildItem.cs,
+       BuildItemGroupCollection.cs, BuildItemGroup.cs, BuildProperty.cs,
+       BuildPropertyGroupCollection.cs, BuildPropertyGroup.cs,
+       BuildSettings.cs, BuildWhen.cs, ConsoleLogger.cs, Engine.cs,
+       EventSource.cs, FileLogger.cs, GlobalEngineAccessor.cs,
+       GroupingCollection.cs, HostLogger.cs, ImportedProject.cs,
+       InternalLoggerException.cs, InvalidProjectFileException.cs,
+       ItemPropertyGroupingBase.cs, ProcessingPass.cs, Project.cs,
+       ProjectFileEncoding.cs, PropertyPosition.cs, SolutionParser.cs,
+       TargetCollection.cs, Target.cs, TaskDatabase.cs, TaskElement.cs,
+       TaskEngineAssemblyResolver.cs, Utilities.cs, WriteHandler.cs, Xml.cs:
+       Initial check-in of implementations.
+
+2005-07-16  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * conditions.jay, IBuildItem.cs, IBuildItemGroup.cs,
+       IBuildItemGroupCollection.cs, IBuildProperty.cs,
+       IBuildPropertyGroup.cs, IBuildPropertyGroupCollection.cs,
+       ICultureStringUtilities.cs, IEngine.cs, IGlobalEngineAccessor.cs,
+       IHostFeedback.cs, IHostLogger.cs, ILangSecurityLevelChecker.cs,
+       IProject.cs, ITargetCollection.cs, ITarget.cs, ITaskElement.cs:
+       Initial check-in of interfaces and a syntax file, real classes are
+       changing a lot so I'll wait a moment with checking them in.
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeType.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeType.cs
new file mode 100644 (file)
index 0000000..b67375c
--- /dev/null
@@ -0,0 +1,148 @@
+//
+// ChangeType.cs: Changes types for output properties or items.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class ChangeType {
+       
+               private static string TemporaryTransform (object o, Type type)
+               {
+                       string output = String.Empty;
+                       if (type == typeof (bool)) {
+                               bool t = (bool) o;
+                               output =  t.ToString (); 
+                       } else if (type == typeof (string)) {
+                               string t = (string) o;
+                               output =  t.ToString ();
+                       } else if (type == typeof (DateTime)) {
+                               DateTime t = (DateTime) o;
+                               output =  t.ToString ();
+                       } else if (type == typeof (int)) {
+                               int t = (int) o;
+                               output =  t.ToString ();
+                       } else if (type == typeof (uint)) {
+                               uint t = (uint) o;
+                               output =  t.ToString ();
+                       } else {
+                       }
+                       return output;
+               }
+               
+               public static string TransformToString (object o, Type type)
+               {
+                       return TemporaryTransform (o, type);
+               }
+               
+               public static string TransformToString (object[] o, Type type)
+               {
+                       ArrayList al = new ArrayList ();
+                       foreach (object obj in o ) {
+                               if (type == typeof (bool[])) {
+                                       al.Add (TemporaryTransform (obj, typeof (bool)));
+                               } else if (type == typeof (string[])) {
+                                       al.Add (TemporaryTransform (obj, typeof (string)));
+                               } else if (type == typeof (DateTime[])) {
+                                       al.Add (TemporaryTransform (obj, typeof (DateTime)));
+                               } else if (type == typeof (int[])) {
+                                       al.Add (TemporaryTransform (obj, typeof (int)));
+                               } else if (type == typeof (uint[])) {
+                                       al.Add (TemporaryTransform (obj, typeof (uint)));
+                               } else
+                                       throw new Exception (String.Format ("Invalid type: {0}", type.ToString ()));
+                       }
+                       string[] output = new string [al.Count];
+                       int i  = 0;
+                       foreach (string s in al)
+                               output [i++] = s;
+                       return String.Join (";", output);
+               }
+               
+               public static BuildProperty TransformToBuildProperty (string name, string items)
+               {
+                       return new BuildProperty (name, items);
+               }
+               
+               public static BuildProperty TransformToBuildProperty (string name, ITaskItem[] items)
+               {
+                       BuildProperty buildProperty;
+                       buildProperty = new BuildProperty (name, TransformToString (items));
+                       return buildProperty;
+               }
+               
+               public static BuildProperty TransformToBuildProperty (string name, ITaskItem item)
+               {
+                       BuildProperty buildProperty;
+                       buildProperty = new BuildProperty (name, TransformToString (item));
+                       return buildProperty;
+               }
+               
+               public static BuildItemGroup TransformToBuildItemGroup (string name, string items)
+               {
+                       string[] splittedItems = items.Split (';');
+                       BuildItemGroup big = new BuildItemGroup ();
+                       foreach (string item in splittedItems)
+                               big.AddItem (name, new TaskItem (item));
+                       return big;
+               }
+               
+               public static BuildItemGroup TransformToBuildItemGroup (string name, ITaskItem[] items)
+               {
+                       BuildItemGroup big = new BuildItemGroup ();
+                       foreach (ITaskItem item in items) {
+                               big.AddItem (name, item);
+                       }
+                       return big;
+               }
+               
+               public static BuildItemGroup TransformToBuildItemGroup (string name, ITaskItem item)
+               {
+                       BuildItemGroup big = new BuildItemGroup ();
+                       big.AddItem (name, item);
+                       return big;
+               }
+               
+               private static string TransformToString (ITaskItem[] items)
+               {
+                       string[] text = new string [items.Length];
+                       int i = 0;
+                       foreach (ITaskItem item in items)
+                               text [i++] = item.ItemSpec;
+                       return String.Join (";", text);
+               }
+               
+               private static string TransformToString (ITaskItem item)
+               {
+                       return item.ItemSpec;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs
new file mode 100644 (file)
index 0000000..351e427
--- /dev/null
@@ -0,0 +1,304 @@
+//
+// ConsoleLogger.cs: Outputs to the console
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Runtime.InteropServices;
+using System.IO;
+using System.Security;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       public class ConsoleLogger : ILogger {
+       
+               string          parameters;
+               int             indent;
+               LoggerVerbosity verbosity;
+               WriteHandler    writeHandler;
+               int             errorCount;
+               int             warningCount;
+               DateTime                buildStart;
+               bool            performanceSummary;
+               bool            summary;
+               
+               public ConsoleLogger ()
+                       : this (LoggerVerbosity.Normal)
+               {
+               }
+
+               public ConsoleLogger (LoggerVerbosity verbosity)
+               {
+                       this.verbosity = verbosity;
+                       this.indent = 0;
+                       this.errorCount = 0;
+                       this.warningCount = 0;
+                       this.writeHandler += new WriteHandler (WriteHandlerFunction);
+                       this.performanceSummary = false;
+                       this.summary = true;
+               }
+               
+               public virtual void ApplyParameter (string parameterName,
+                                                   string parameterValue)
+               {
+                       // FIXME: what we should do here? in msbuild it isn't
+                       // changing "parameters" property
+               }
+
+               public virtual void Initialize (IEventSource eventSource)
+               {
+                        eventSource.BuildStarted +=  new BuildStartedEventHandler (BuildStarted);
+                        eventSource.BuildFinished += new BuildFinishedEventHandler (BuildFinished);
+                        eventSource.ProjectStarted += new ProjectStartedEventHandler (ProjectStarted);
+                        eventSource.ProjectFinished += new ProjectFinishedEventHandler (ProjectFinished);
+                        eventSource.TargetStarted += new TargetStartedEventHandler (TargetStarted);
+                        eventSource.TargetFinished += new TargetFinishedEventHandler (TargetFinished);
+                        eventSource.TaskStarted += new TaskStartedEventHandler (TaskStarted);
+                        eventSource.TaskFinished += new TaskFinishedEventHandler (TaskFinished);
+                        eventSource.MessageRaised += new BuildMessageEventHandler (MessageRaised);
+                        eventSource.WarningRaised += new BuildWarningEventHandler (WarningRaised);
+                        eventSource.ErrorRaised += new BuildErrorEventHandler (ErrorRaised);
+               }
+               
+               public void BuildStarted (object sender, BuildStartedEventArgs args)
+               {
+                       WriteLine ("");
+                       WriteLine (String.Format ("Build started {0}.", args.TimeStamp));
+                       WriteLine ("__________________________________________________");
+                       buildStart = args.TimeStamp;
+               }
+               
+               public void BuildFinished (object sender, BuildFinishedEventArgs args)
+               {
+                       if (args.Succeeded == true) {
+                               WriteLine ("Build succeeded.");
+                       } else {
+                               WriteLine ("Build failed.");
+                       }
+                       if (performanceSummary == true)
+                               ;
+                       if (summary == true){
+                               TimeSpan timeElapsed = args.TimeStamp - buildStart;
+                               WriteLine (String.Format ("\t {0} Warning(s)", warningCount));
+                               WriteLine (String.Format ("\t {0} Error(s)", errorCount));
+                               WriteLine ("");
+                               WriteLine (String.Format ("Time Elapsed {0}", timeElapsed));
+                       } 
+               }
+
+               public void ProjectStarted (object sender, ProjectStartedEventArgs args)
+               {
+                       WriteLine (String.Format ("Project \"{0}\" ({1} target(s)):", args.ProjectFile, args.TargetNames));
+                       WriteLine ("");
+               }
+               
+               public void ProjectFinished (object sender, ProjectFinishedEventArgs args)
+               {
+                       if (IsVerbosityGreaterOrEqual (LoggerVerbosity.Diagnostic)) {
+                               WriteLine (String.Format ("Done building project \"{0}\".", args.ProjectFile));
+                               WriteLine ("");
+                       }
+               }
+               
+               public void TargetStarted (object sender, TargetStartedEventArgs args)
+               {
+                       WriteLine (String.Format ("Target {0}:",args.TargetName));
+                       indent++;
+               }
+               
+               public void TargetFinished (object sender, TargetFinishedEventArgs args)
+               {
+                       indent--;
+                       if (IsVerbosityGreaterOrEqual (LoggerVerbosity.Diagnostic))
+                               WriteLine (String.Format ("Done building target \"{0}\" in project \"{1}\".",
+                                       args.TargetName, args.ProjectFile));
+                       WriteLine ("");
+               }
+               
+               public void TaskStarted (object sender, TaskStartedEventArgs args)
+               {
+                       if (this.verbosity == LoggerVerbosity.Diagnostic)
+                               WriteLine (String.Format ("Task \"{0}\"",args.TaskName));
+                       indent++;
+               }
+               
+               public void TaskFinished (object sender, TaskFinishedEventArgs args)
+               {
+                       indent--;
+                       if (this.verbosity == LoggerVerbosity.Diagnostic)
+                               WriteLine (String.Format ("Done executing task \"{0}\"",args.TaskName));
+               }
+               
+               public void MessageRaised (object sender, BuildMessageEventArgs args)
+               {
+                       if (IsMessageOk (args)) {
+                               WriteLine (args.Message);
+                       }
+               }
+               
+               public void WarningRaised (object sender, BuildWarningEventArgs args)
+               {
+                       if (IsVerbosityGreaterOrEqual (LoggerVerbosity.Normal)) 
+                               WriteLineWithoutIndent (FormatWarningEvent (args));
+                       warningCount++;
+               }
+               
+               public void ErrorRaised (object sender, BuildErrorEventArgs args)
+               {
+                       if (IsVerbosityGreaterOrEqual (LoggerVerbosity.Minimal)) 
+                               WriteLineWithoutIndent (FormatErrorEvent (args));
+                       errorCount++;
+               }
+               
+               private void WriteLine (string message)
+               {
+                       for (int i = 0; i < indent; i++)
+                               Console.Write ('\t');
+                       writeHandler (message);
+               }
+               
+               private void WriteLineWithoutIndent (string message)
+               {
+                       writeHandler (message);
+               }
+               
+               private void WriteLineWithSender (object sender, string message)
+               {
+                       if ((string) sender == "MSBuild")
+                               WriteLine (message);
+                       else
+                               WriteLine ((string) sender + ": " + message);
+               }
+               
+               private void WriteHandlerFunction (string message)
+               {
+                       Console.WriteLine (message);
+               }
+               
+               private void ParseParameters ()
+               {
+                       string[] splittedParameters = parameters.Split (';');
+                       foreach (string s in splittedParameters ) {
+                               switch (s) {
+                               case "PerformanceSummary":
+                                       this.performanceSummary = true;
+                                       break;
+                               case "NoSummary":
+                                       this.summary = false;
+                                       break;
+                               default:
+                                       throw new ArgumentException ("Invalid parameter.");
+                               }
+                       }
+               }
+               
+               public virtual void Shutdown ()
+               {
+               }
+               
+               private string FormatErrorEvent (BuildErrorEventArgs args)
+               {
+                       // FIXME: show more complicated args
+                       if (args.LineNumber != 0 && args.ColumnNumber != 0) {
+                               return String.Format ("{0}({1},{2}): {3} error {4}: {5}", args.File, args.LineNumber, args.ColumnNumber,
+                                       args.Subcategory, args.Code, args.Message);
+                       } else {
+                               return String.Format ("{0}: {1} error {2}: {3}", args.File, args.Subcategory, args.Code,
+                                       args.Message);
+                       }
+               }
+
+               private string FormatWarningEvent (BuildWarningEventArgs args)
+               {
+                       // FIXME: show more complicated args
+                       if (args.LineNumber != 0 && args.ColumnNumber != 0) {
+                               return String.Format ("{0}({1},{2}): {3} warning {4}: {5}", args.File, args.LineNumber, args.ColumnNumber,
+                                       args.Subcategory, args.Code, args.Message);
+                       } else {
+                               return String.Format ("{0}: {1} warning {2}: {3}", args.File, args.Subcategory, args.Code,
+                                       args.Message);
+                       }
+               }
+               
+               private bool IsMessageOk (BuildMessageEventArgs bsea)
+               {
+                       if (bsea.Importance == MessageImportance.High && IsVerbosityGreaterOrEqual (LoggerVerbosity.Minimal)) {
+                               return true;
+                       } else if (bsea.Importance == MessageImportance.Normal && IsVerbosityGreaterOrEqual (LoggerVerbosity.Normal)) {
+                               return true;
+                       } else if (bsea.Importance == MessageImportance.Low && IsVerbosityGreaterOrEqual (LoggerVerbosity.Detailed)) {
+                               return true;
+                       } else
+                               return false;
+               }
+               
+                private bool IsVerbosityGreaterOrEqual (LoggerVerbosity v)
+                {
+                               if (v == LoggerVerbosity.Diagnostic) {
+                                       return LoggerVerbosity.Diagnostic <= verbosity;
+                               } else if (v == LoggerVerbosity.Detailed) {
+                                       return LoggerVerbosity.Detailed <= verbosity;
+                               } else if (v == LoggerVerbosity.Normal) {
+                                       return LoggerVerbosity.Normal <= verbosity;
+                               } else if (v == LoggerVerbosity.Minimal) {
+                                       return LoggerVerbosity.Minimal <= verbosity;
+                               } else if (v == LoggerVerbosity.Quiet) {
+                                       return true;
+                               } else
+                                       return false;
+                }
+
+               public string Parameters {
+                       get {
+                               return parameters;
+                       }
+                       set {
+                               if (value == null)
+                                       throw new ArgumentNullException ();
+                               parameters = value;
+                               if (parameters != String.Empty)
+                                       ParseParameters ();
+                       }
+               }
+
+               public LoggerVerbosity Verbosity {
+                       get {
+                               return verbosity;
+                       }
+                       set {
+                               verbosity = value;
+                       }
+               }
+
+               protected WriteHandler WriteHandler {
+                       get {
+                               return writeHandler;
+                       }
+                       set {
+                               writeHandler = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/DirectoryScanner.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/DirectoryScanner.cs
new file mode 100644 (file)
index 0000000..9722eda
--- /dev/null
@@ -0,0 +1,173 @@
+//
+// DirectoryScanner.cs: Class used by BuildItem.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class DirectoryScanner {
+               
+               DirectoryInfo   baseDirectory;
+               string          includes;
+               string          excludes;
+               string[]        matchedFilenames;
+               
+               public DirectoryScanner ()
+               {
+               }
+               
+               public void Scan ()
+               {
+                       Hashtable temporaryItems;
+                       string[] splittedInclude, splittedExclude;
+               
+                       if (includes == null)
+                               throw new ArgumentNullException ("Includes");
+                       if (excludes == null)
+                               throw new ArgumentNullException ("Excludes");
+                       if (baseDirectory == null)
+                               throw new ArgumentNullException ("BaseDirectory");
+                       
+                       temporaryItems = new Hashtable ();
+                       
+                       splittedInclude = includes.Split (';');
+                       splittedExclude = excludes.Split (';');
+                       
+                       foreach (string si in splittedInclude) {
+                               ProcessInclude (si, temporaryItems);
+                       }
+                       if (excludes != String.Empty) {
+                               foreach (string si in splittedExclude) {
+                                       ProcessExclude (si, temporaryItems);
+                               }
+                       }
+                       
+                       matchedFilenames = new string [temporaryItems.Count];
+                       int i = 0;
+                       foreach (DictionaryEntry de in temporaryItems)
+                               matchedFilenames [i++] = (string) de.Value; 
+               }
+               
+               private void ProcessInclude (string name, Hashtable temporaryItems)
+               {
+                       string[] separatedPath;
+                       FileInfo[] fileInfo;
+                       
+                       if (name.IndexOf ('?') == -1 && name.IndexOf ('*') == -1)
+                               temporaryItems.Add (Path.GetFullPath (name), name);
+                       else {
+                               if (name.Split (Path.DirectorySeparatorChar).Length > name.Split (Path.AltDirectorySeparatorChar).Length) {
+                                       separatedPath = name.Split (Path.DirectorySeparatorChar);
+                               } else {
+                                       separatedPath = name.Split (Path.AltDirectorySeparatorChar);
+                               }
+                               if (separatedPath.Length == 1 && separatedPath [0] == String.Empty)
+                                       return;
+                               fileInfo = ParseIncludeExclude (separatedPath, 0, baseDirectory);
+                               foreach (FileInfo fi in fileInfo)
+                                       temporaryItems.Add (fi.FullName, fi.FullName);
+                       }
+               }
+               
+               private void ProcessExclude (string name, Hashtable temporaryItems)
+               {
+                       string[] separatedPath;
+                       FileInfo[] fileInfo;
+                       
+                       if (name.IndexOf ('?') == -1 && name.IndexOf ('*') == -1) {
+                               if (temporaryItems.Contains (Path.GetFullPath (name)))
+                                       temporaryItems.Remove (Path.GetFullPath (name));
+                       } else {
+                               if (name.Split (Path.DirectorySeparatorChar).Length > name.Split (Path.AltDirectorySeparatorChar).Length) {
+                                       separatedPath = name.Split (Path.DirectorySeparatorChar);
+                               } else {
+                                       separatedPath = name.Split (Path.AltDirectorySeparatorChar);
+                               }
+                               if (separatedPath.Length == 1 && separatedPath [0] == String.Empty)
+                                       return;
+                               fileInfo = ParseIncludeExclude (separatedPath, 0, baseDirectory);
+                               foreach (FileInfo fi in fileInfo)
+                                       if (temporaryItems.Contains (fi.FullName))
+                                               temporaryItems.Remove (fi.FullName);
+                       }
+               }
+               
+               private FileInfo[] ParseIncludeExclude (string[] input, int ptr, DirectoryInfo directory)
+               {
+                       if (input.Length > 1 && ptr == 0 && input [0] == String.Empty)
+                               ptr++;
+                       if (input.Length == ptr + 1) {
+                               FileInfo[] fi;
+                               fi = directory.GetFiles (input [ptr]);
+                               return fi;
+                       } else {
+                               DirectoryInfo[] di;
+                               FileInfo[] fi;
+                               ArrayList fileInfos = new ArrayList ();
+                               if (input [ptr] == ".") {
+                                       di = new DirectoryInfo [1];
+                                       di [0] = directory;
+                               } else if (input [ptr] == "..") {
+                                       di = new DirectoryInfo [1];
+                                       di [0] = directory.Parent;
+                               } else
+                                       di = directory.GetDirectories (input [ptr]);
+                               foreach (DirectoryInfo info in di) {
+                                       fi = ParseIncludeExclude (input, ptr + 1, info);
+                                       foreach (FileInfo file in fi)
+                                               fileInfos.Add (file);
+                               }
+                               fi = new FileInfo [fileInfos.Count];
+                               int i = 0;
+                               foreach (FileInfo file in fileInfos)
+                                       fi [i++] = file;
+                               return fi;
+                       }
+               }
+               
+               public DirectoryInfo BaseDirectory {
+                       get { return baseDirectory; }
+                       set { baseDirectory = value; }
+               }
+               
+               public string Includes {
+                       get { return includes; }
+                       set { includes = value; }
+               }
+               
+               public string Excludes {
+                       get { return excludes; }
+                       set { excludes = value; }
+               }
+               
+               public string[] MatchedFilenames {
+                       get { return matchedFilenames; }
+               }
+               
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
new file mode 100644 (file)
index 0000000..fe5e5ab
--- /dev/null
@@ -0,0 +1,236 @@
+//
+// Engine.cs: Main engine of XBuild.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       public class Engine : IEngine {
+               
+               string                  binPath;
+               bool                    buildEnabled;
+               const string            engineVersion = "0.1";
+               BuildPropertyGroup      environmentProperties;
+               EventSource             eventSource;
+               bool                    buildStarted;
+               BuildPropertyGroup      globalProperties;
+               IDictionary             importedProjects;
+               IList                   loggers;
+               bool                    onlyLogCriticalEvents;
+               IDictionary             projects;
+               BuildPropertyGroup      reservedProperties;
+
+               // FIXME: GlobalEngine static property uses this but what about GlobalEngineAccessor?
+               static Engine           globalEngine;
+
+               
+               public Engine ()
+                       : this (null)
+               {
+               }
+
+               // engine should be invoked with path where binary files are
+               // to find microsoft.build.tasks
+               public Engine (string binPath)
+               {
+                       this.binPath = binPath;
+                       this.projects = new Hashtable ();
+                       this.eventSource = new EventSource ();
+                       this.loggers = new ArrayList ();
+                       this.buildStarted = false;
+                       this.LoadEnvironmentProperties ();
+                       this.reservedProperties = new BuildPropertyGroup ();
+                       this.reservedProperties.AddNewProperty ("MSBuildBinPath", binPath, PropertyType.Reserved);
+               }
+
+               public bool BuildProject (Project project,
+                                         string[] targetNames,
+                                         IDictionary targetOutputs)
+               {
+                       bool result;
+                       
+                       LogProjectStarted (project, targetNames);
+                               
+                       result =  project.Build (targetNames, targetOutputs);
+                       
+                       LogProjectFinished (project, result);
+                       
+                       return result;
+               }
+
+               public bool BuildProjectFile (string projectFileName,
+                                         string[] targetNames,
+                                         BuildPropertyGroup globalPropertiesToUse,
+                                         IDictionary targetOutputs)
+               {
+                       bool result;
+                       Project project;
+                       
+                       if (projects.Contains (projectFileName)) {
+                               project = (Project) projects [projectFileName];
+                               LogProjectStarted (project, targetNames);
+                               result = project.Build (targetNames, targetOutputs);
+                       }
+                       else
+                               return false;
+                       
+                       LogProjectFinished (project, result);
+                       
+                       return result;
+               }
+
+               public void ClearAllProjects ()
+               {
+                       projects.Clear ();
+               }
+
+               public Project CreateNewProject ()
+               {
+                       if (buildStarted == false) {
+                               LogBuildStarted ();
+                               buildStarted = true;
+                       }
+                       Project p = new Project (this);
+                       p.EnvironmentProperties = this.environmentProperties;
+                       p.ReservedProperties = this.reservedProperties;
+                       if (globalProperties != null) {
+                               BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                               foreach (BuildProperty bp in globalProperties)
+                                       bpg.AddNewProperty (bp.Name, bp.Value, PropertyType.CommandLine);
+                               p.GlobalProperties = bpg;
+                       }
+                       return p;
+               }
+
+               public string Escape (string input)
+               {
+                       // FIXME: test it, probably returns XML escaped string
+                       return null;
+               }
+
+               public Project GetLoadedProject (string projectFullFileName)
+               {
+                       return (Project) projects [projectFullFileName];
+               }
+
+               public void RegisterLogger (ILogger logger)
+               {
+                       if (logger == null)
+                               throw new ArgumentNullException ("logger");
+                       logger.Initialize (eventSource);
+                       loggers.Add (logger);
+               }
+
+               public void UnregisterAllLoggers ()
+               {
+                       // FIXME: check if build succeeded
+                       LogBuildFinished (true);
+                       foreach (ILogger i in loggers) {
+                               i.Shutdown ();
+                       }
+                       loggers.Clear ();
+               }
+               
+               private void LoadEnvironmentProperties ()
+               {
+                       environmentProperties = new BuildPropertyGroup ();
+                       IDictionary environment = Environment.GetEnvironmentVariables ();
+                       foreach (DictionaryEntry de in environment) {
+                               environmentProperties.AddNewProperty ((string) de.Key, (string) de.Value, PropertyType.Environment);
+                       }
+               }
+               
+               private void LogProjectStarted (Project project, string[] targetNames)
+               {
+                       ProjectStartedEventArgs psea;
+                       if (targetNames.Length == 0) {
+                               if (project.DefaultTargets != String.Empty)
+                                       psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName,
+                                               project.DefaultTargets);
+                               else
+                                       psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName, "default");
+                       } else
+                       psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName, String.Join (";",
+                               targetNames));
+                       eventSource.FireProjectStarted (this, psea);
+               }
+               
+               private void LogProjectFinished (Project project, bool succeeded)
+               {
+                       ProjectFinishedEventArgs pfea;
+                       pfea = new ProjectFinishedEventArgs ("Project started.", null, project.FullFileName, succeeded);
+                       eventSource.FireProjectFinished (this, pfea);
+               }
+               
+               private void LogBuildStarted ()
+               {
+                       BuildStartedEventArgs bsea;
+                       bsea = new BuildStartedEventArgs ("Build started.", null);
+                       eventSource.FireBuildStarted (this, bsea);
+               }
+               
+               private void LogBuildFinished (bool succeeded)
+               {
+                       BuildFinishedEventArgs bfea;
+                       bfea = new BuildFinishedEventArgs ("Build finished.", null, succeeded);
+                       eventSource.FireBuildFinished (this, bfea);
+               }
+
+               public string BinPath {
+                       get { return binPath; }
+                       set { binPath = value; }
+               }
+
+               public bool BuildEnabled {
+                       get { return buildEnabled; }
+                       set { buildEnabled = value; }
+               }
+
+               public static string EngineVersion {
+                       get { return engineVersion; }
+               }
+
+               public static Engine GlobalEngine {
+                       get { return globalEngine; }
+               }
+
+               public BuildPropertyGroup GlobalProperties {
+                       get { return globalProperties; }
+                       set { globalProperties = value; }
+               }
+
+               public bool OnlyLogCriticalEvents {
+                       get { return eventSource.OnlyLogCriticalEvents; }
+                       set { eventSource.OnlyLogCriticalEvents = value; }
+               }
+               
+               internal EventSource EventSource {
+                       get { return eventSource; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/EventSource.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/EventSource.cs
new file mode 100644 (file)
index 0000000..f6d405c
--- /dev/null
@@ -0,0 +1,282 @@
+//
+// EventSource.cs: Implements IEventSource.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class EventSource : IEventSource {
+               
+               AnyEventHandler                 anyEventRaised;
+               BuildFinishedEventHandler       buildFinished;
+               BuildStartedEventHandler        buildStarted;
+               CustomBuildEventHandler         customEventRaised;
+               BuildErrorEventHandler          errorRaised;
+               BuildMessageEventHandler        messageRaised;
+               ProjectFinishedEventHandler     projectFinished;
+               ProjectStartedEventHandler      projectStarted;
+               BuildStatusEventHandler         statusEventRaised;
+               TargetFinishedEventHandler      targetFinished;
+               TargetStartedEventHandler       targetStarted;
+               TaskFinishedEventHandler        taskFinished;
+               TaskStartedEventHandler         taskStarted;
+               BuildWarningEventHandler        warningRaised;
+               bool                            onlyLogCriticalEvents;
+
+               public EventSource ()
+               {
+                       this.onlyLogCriticalEvents = false;
+               }
+               
+               public void FireCustomEventRaised (object sender, CustomBuildEventArgs cbea)
+               {
+                       if (customEventRaised != null)
+                               customEventRaised (sender, cbea);
+               }
+               public void FireErrorRaised (object sender, BuildErrorEventArgs beea)
+               {
+                       if (errorRaised != null)
+                               errorRaised (sender, beea);
+               }
+               public void FireMessageRaised (object sender, BuildMessageEventArgs bmea)
+               {
+                       if (messageRaised != null)
+                               messageRaised (sender, bmea);
+               }
+               public void FireWarningRaised (object sender, BuildWarningEventArgs bwea)
+               {
+                       if (warningRaised != null)
+                               warningRaised (sender, bwea);
+               }
+               
+               public void FireTargetStarted (object sender, TargetStartedEventArgs tsea)
+               {
+                       if (targetStarted != null)
+                               targetStarted (sender, tsea);
+               }
+               
+               public void FireTargetFinished (object sender, TargetFinishedEventArgs tfea)
+               {
+                       if (targetFinished != null)
+                               targetFinished (sender, tfea);
+               }
+               
+               public void FireBuildStarted (object sender, BuildStartedEventArgs bsea)
+               {
+                       if (buildStarted != null)
+                               buildStarted (sender, bsea);
+               }
+               
+               public void FireBuildFinished (object sender, BuildFinishedEventArgs bfea)
+               {
+                       if (buildFinished != null)
+                               buildFinished (sender, bfea);
+               }
+               
+               public void FireProjectStarted (object sender, ProjectStartedEventArgs psea)
+               {
+                       if (projectStarted != null)
+                               projectStarted (sender, psea);
+               }
+               
+               public void FireProjectFinished (object sender, ProjectFinishedEventArgs pfea)
+               {
+                       if (projectFinished != null)
+                               projectFinished (sender, pfea);
+               }
+               
+               public void FireTaskStarted (object sender, TaskStartedEventArgs tsea)
+               {
+                       if (taskStarted != null)
+                               taskStarted (sender, tsea);
+               }
+               
+               public void FireTaskFinished (object sender, TaskFinishedEventArgs tfea)
+               {
+                       if (taskFinished != null)
+                               taskFinished (sender, tfea);
+               }
+
+               public event AnyEventHandler AnyEventRaised {
+                       add {
+                               lock (this)
+                                       anyEventRaised += value;
+                       }
+                       remove {
+                               lock (this)
+                                       anyEventRaised -= value;
+                       }
+               }
+               
+               public event BuildFinishedEventHandler BuildFinished {
+                       add {
+                               lock (this)
+                                       buildFinished += value;
+                       }
+                       remove {
+                               lock (this)
+                                       buildFinished -= value;
+                       }
+               }
+               
+               public event BuildStartedEventHandler BuildStarted {
+                       add {
+                               lock (this)
+                                       buildStarted += value;
+                       }
+                       remove {
+                               lock (this)
+                                       buildStarted -= value;
+                       }
+               }
+               
+               public event CustomBuildEventHandler CustomEventRaised {
+                       add {
+                               lock (this)
+                                       customEventRaised += value;
+                       }
+                       remove {
+                               lock (this)
+                                       customEventRaised -= value;
+                       }
+               }
+               
+               public event BuildErrorEventHandler ErrorRaised {
+                       add {
+                               lock (this)
+                                       errorRaised += value;
+                       }
+                       remove {
+                               lock (this)
+                                       errorRaised -= value;
+                       }
+               }
+               
+               public event BuildMessageEventHandler MessageRaised {
+                       add {
+                               lock (this)
+                                       messageRaised += value;
+                       }
+                       remove {
+                               lock (this)
+                                       messageRaised -= value;
+                       }
+               }
+               
+               public event ProjectFinishedEventHandler ProjectFinished {
+                       add {
+                               lock (this)
+                                       projectFinished += value;
+                       }
+                       remove {
+                               lock (this)
+                                       projectFinished -= value;
+                       }
+               }
+               
+               public event ProjectStartedEventHandler ProjectStarted {
+                       add {
+                               lock (this)
+                                       projectStarted += value;
+                       }
+                       remove {
+                               lock (this)
+                                       projectStarted -= value;
+                       }
+               }
+               
+               public event BuildStatusEventHandler StatusEventRaised {
+                       add {
+                               lock (this)
+                                       statusEventRaised += value;
+                       }
+                       remove {
+                               lock (this)
+                                       statusEventRaised -= value;
+                       }
+               }
+               
+               public event TargetFinishedEventHandler TargetFinished {
+                       add {
+                               lock (this)
+                                       targetFinished += value;
+                       }
+                       remove {
+                               lock (this)
+                                       targetFinished -= value;
+                       }
+               }
+               
+               public event TargetStartedEventHandler TargetStarted {
+                       add {
+                               lock (this)
+                                       targetStarted += value;
+                       }
+                       remove {
+                               lock (this)
+                                       targetStarted -= value;
+                       }
+               }
+               
+               public event TaskFinishedEventHandler TaskFinished {
+                       add {
+                               lock (this)
+                                       taskFinished += value;
+                       }
+                       remove {
+                               lock (this)
+                                       taskFinished -= value;
+                       }
+               }
+               
+               public event TaskStartedEventHandler TaskStarted {
+                       add {
+                               lock (this)
+                                       taskStarted += value;
+                       }
+                       remove {
+                               lock (this)
+                                       taskStarted -= value;
+                       }
+               }
+               
+               public event BuildWarningEventHandler WarningRaised {
+                       add {
+                               lock (this)
+                                       warningRaised += value;
+                       }
+                       remove {
+                               lock (this)
+                                       warningRaised -= value;
+                       }
+               }
+               
+               public bool OnlyLogCriticalEvents {
+                       get { return onlyLogCriticalEvents; }
+                       set { onlyLogCriticalEvents = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Expression.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Expression.cs
new file mode 100644 (file)
index 0000000..fe2c984
--- /dev/null
@@ -0,0 +1,373 @@
+//
+// Expression.cs: Stores references to items or properties.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Text;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class Expression {
+       
+               IList   objects;
+               Project project;
+               ItemReference parentItemReference;
+       
+               public Expression (Project project)
+               {
+                       this.objects = new ArrayList ();
+                       this.project = project;
+               }
+               
+               public Expression (Project project, string source)
+                       : this (project)
+               {
+                       ParseSource (source);
+               }
+               
+               public void ParseSource (string source)
+               {
+                       // FIXME: change StringBuilder to substrings 
+                       if (source == null)
+                               throw new ArgumentNullException ("source");                             
+                       
+                       StringBuilder temp = new StringBuilder ();
+                       CharEnumerator it = source.GetEnumerator ();
+                       EvaluationState eState = EvaluationState.Out;
+                       ParenState pState = ParenState.Out;
+                       ApostropheState aState = ApostropheState.Out;
+                       int start = 0;
+                       int current = -1;
+                       
+                       while (it.MoveNext ()) {
+                               current++;
+                               switch (eState) {
+                               case EvaluationState.Out:
+                                       switch (it.Current) {
+                                       case '@':
+                                               if (temp.Length > 0) {
+                                                       objects.Add (temp.ToString ());
+                                                       temp = new StringBuilder ();
+                                               }
+                                               eState = EvaluationState.InItem;
+                                               start = current;
+                                               break;
+                                       case '$':
+                                               if (temp.Length > 0) {
+                                                       objects.Add (temp.ToString ());
+                                                       temp = new StringBuilder ();
+                                               }
+                                               eState = EvaluationState.InProperty;
+                                               start = current;
+                                               break;
+                                       case '%':
+                                               if (temp.Length > 0) {
+                                                       objects.Add (temp.ToString ());
+                                                       temp = new StringBuilder ();
+                                               }
+                                               eState = EvaluationState.InMetadata;
+                                               start = current;
+                                               break;
+                                       default:
+                                               temp.Append (it.Current);
+                                               if (current == source.Length - 1)
+                                                       objects.Add (temp.ToString ());
+                                               break;
+                                       }
+                                       break;
+                               case EvaluationState.InItem:
+                                       switch (it.Current) {
+                                       case '(':
+                                               if (pState == ParenState.Out && aState == ApostropheState.Out)
+                                                       pState = ParenState.Left;
+                                               else if (aState == ApostropheState.Out)
+                                                       throw new Exception ("'(' not expected.");
+                                               break;
+                                       case ')':
+                                               if (pState == ParenState.Left && aState == ApostropheState.Out) {
+                                                       objects.Add (new ItemReference (this, source.Substring (start, current - start + 1)));
+                                                       eState = EvaluationState.Out;
+                                                       pState = ParenState.Out;
+                                               }
+                                               break;
+                                       case '\'':
+                                               if (aState == ApostropheState.In)
+                                                       aState = ApostropheState.Out;
+                                               else
+                                                       aState = ApostropheState.In;
+                                               break;
+                                       default:
+                                               break;
+                                       }
+                                       break;
+                               case EvaluationState.InProperty:
+                                       switch (it.Current) {
+                                       case '(':
+                                               if (pState == ParenState.Out)
+                                                       pState = ParenState.Left;
+                                               else
+                                                       throw new Exception ("'(' expected.");
+                                               break;
+                                       case ')':
+                                               if (pState == ParenState.Left) {
+                                                       objects.Add (new PropertyReference (this, source.Substring (start, current - start + 1)));
+                                                       eState = EvaluationState.Out;
+                                                       pState = ParenState.Out;
+                                               }
+                                               break;
+                                       default:
+                                               break;
+                                       }
+                                       break;
+                               case EvaluationState.InMetadata:
+                                       switch (it.Current) {
+                                       case '(':
+                                               if (pState == ParenState.Out)
+                                                       pState = ParenState.Left;
+                                               break;
+                                       case ')':
+                                               if (pState == ParenState.Left) {
+                                                       objects.Add (new MetadataReference (this, source.Substring (start, current - start + 1)));
+                                                       eState = EvaluationState.Out;
+                                                       pState = ParenState.Out;
+                                               }
+                                               break;
+                                       default:
+                                               break;
+                                       }
+                                       break;
+                               default:
+                                       throw new Exception ("Invalid evaluation state.");
+                               }
+                       }
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                       foreach (object o in objects)
+                               yield return o;
+               }
+               
+               public object ToNonArray (Type type)
+               {
+                       if (type.IsArray == true)
+                               throw new ArgumentException ("Type specified can not be array type.");
+                       
+                       return ToObject (ToString (), type);
+               }
+               
+               public object ToArray (Type type)
+               {
+                       if (type.IsArray == false)
+                               throw new ArgumentException ("Type specified can not be element type.");
+                       
+                       string[] rawTable = ToString ().Split (';');
+                       int i = 0;
+                       
+                       if (type == typeof (bool[])) {
+                               bool[] array = new bool [rawTable.Length];
+                               foreach (string raw in rawTable)
+                                       array [i++] = (bool) ToObject (raw, typeof (bool));
+                               return array;
+                       } else if (type == typeof (string[])) {
+                               string[] array = new string [rawTable.Length];
+                               foreach (string raw in rawTable)
+                                       array [i++] = (string) ToObject (raw, typeof (string));
+                               return array;
+                       } else if (type == typeof (int[])) {
+                               int[] array = new int [rawTable.Length];
+                               foreach (string raw in rawTable)
+                                       array [i++] = (int) ToObject (raw, typeof (int));
+                               return array;
+                       } else if (type == typeof (uint[])) {
+                               uint[] array = new uint [rawTable.Length];
+                               foreach (string raw in rawTable)
+                                       array [i++] = (uint) ToObject (raw, typeof (uint));
+                               return array;
+                       } else if (type == typeof (DateTime[])) {
+                               DateTime[] array = new DateTime [rawTable.Length];
+                               foreach (string raw in rawTable)
+                                       array [i++] = (DateTime) ToObject (raw, typeof (DateTime));
+                               return array;
+                       } else throw new Exception ("Invalid type.");
+               }
+               
+               private object ToObject (string raw, Type type)
+               {
+                       if (type == typeof (bool)) {
+                               return Boolean.Parse (raw);
+                       } else if (type == typeof (string)) {
+                               return raw;
+                       } else if (type == typeof (int)) {
+                               return Int32.Parse (raw);
+                       } else if (type == typeof (uint)) {
+                               return UInt32.Parse (raw);
+                       } else if (type == typeof (DateTime)) {
+                               return DateTime.Parse (raw);
+                       } else {
+                               throw new Exception (String.Format ("Unknown type: {0}", type.ToString ()));
+                       }
+               }
+               
+               private new string ToString ()
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       
+                       foreach (object o in this) {
+                               if (o is string) {
+                                       sb.Append ((string) o);
+                               } else if (o is ItemReference) {
+                                       sb.Append (((ItemReference)o).ToString ());
+                               } else if (o is PropertyReference) {
+                                       sb.Append (((PropertyReference)o).ToString ());
+                               } else if (o is MetadataReference) {
+                                       // FIXME: we don't handle them yet
+                               } else {
+                                       throw new Exception ("Invalid type in objects collection.");
+                               }
+                       }
+                       return sb.ToString ();
+               }
+
+               public ITaskItem ToITaskItem ()
+               {
+                       ITaskItem item;
+                       
+                       if (objects == null)
+                               throw new Exception ("Cannot cast empty expression to ITaskItem.");
+                       
+                       if (objects [0] is ItemReference) {
+                               ItemReference ir = (ItemReference) objects [0];
+                               ITaskItem[] array = ir.ToITaskItemArray ();
+                               if (array.Length == 1) {
+                                       return array [0];
+                               } else {
+                                       throw new Exception ("TaskItem array too long");
+                               }
+                       } else {
+                               item = new TaskItem (ToString ());
+                               return item;
+                       }
+               }
+               
+               public ITaskItem[] ToITaskItemArray ()
+               {
+                       ArrayList finalItems = new ArrayList ();
+                       ArrayList tempItems = new ArrayList ();
+                       ITaskItem[] array;
+                       ITaskItem[] finalArray;
+                       
+                       foreach (object o in objects) {
+                               if (o is ItemReference) {
+                                       tempItems.Add (o);
+                               } else if (o is PropertyReference) {
+                                       PropertyReference pr = (PropertyReference) o;
+                                       tempItems.Add (pr.ToString ());
+                               } else if (o is MetadataReference) {
+                                       // FIXME: not handled yet
+                               } else if (o is string) {
+                                       tempItems.Add (o);
+                               } else {
+                                       throw new Exception ("Invalid type in objects collection.");
+                               }
+                       }
+                       foreach (object o in tempItems) {
+                               if (o is ItemReference) {
+                                       ItemReference ir = (ItemReference) o;
+                                       array = ir.ToITaskItemArray ();
+                                       if (array != null)
+                                               foreach (ITaskItem item in array)
+                                                       finalItems.Add (item);
+                               } else if (o is string) {
+                                       string s = (string) o;
+                                       array = ITaskItemArrayFromString (s);
+                                       foreach (ITaskItem item in array)
+                                               finalItems.Add (item);
+                               } else {
+                                       throw new Exception ("Invalid type in tempItems collection.");
+                               }
+                       }
+                       
+                       finalArray = new ITaskItem [finalItems.Count];
+                       int i = 0;
+                       foreach (ITaskItem item in finalItems)
+                               finalArray [i++] = item;
+                       return finalArray;
+               }
+               
+               // FIXME: quite stupid name
+               private ITaskItem[] ITaskItemArrayFromString (string source)
+               {
+                       ArrayList tempItems = new ArrayList ();
+                       ITaskItem[] finalArray;
+                       string[] splittedSource = source.Split (';');
+                       foreach (string s in splittedSource) {
+                               if (s != String.Empty) {
+                                       tempItems.Add (new TaskItem (s));
+                               }
+                       }
+                       finalArray = new ITaskItem [tempItems.Count];
+                       int i = 0;
+                       foreach (ITaskItem item in tempItems)
+                               finalArray [i++] = item;
+                       return finalArray;
+               }
+               
+               public Project Project {
+                       get { return project; }
+               }
+               
+               public ItemReference ParentItemReference {
+                       get { return parentItemReference; }
+               }
+       }
+
+       internal enum EvaluationState {
+               Out,
+               InItem,
+               InMetadata,
+               InProperty
+       }
+       
+       internal enum ParenState {
+               Out,
+               Left
+       }
+       
+       internal enum ApostropheState {
+               In,
+               Out
+       }
+       
+       internal enum ItemParsingState {
+               Name,
+               Transform1,
+               Transform2,
+               Separator
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/FileLogger.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/FileLogger.cs
new file mode 100644 (file)
index 0000000..11f7603
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// FileLogger.cs: Logs to file
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       public class FileLogger : ConsoleLogger {
+               public FileLogger ()
+               {
+               }
+               
+               public override void ApplyParameter (string parameterName,
+                                                    string parameterValue)
+               {
+               }
+
+               // FIXME: add our handlers to the events
+               public override void Initialize (IEventSource eventSource)
+               {
+               }
+
+               public override void Shutdown ()
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GlobalEngineAccessor.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GlobalEngineAccessor.cs
new file mode 100644 (file)
index 0000000..d8ba59b
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// GlobalEngineAccessor.cs: Returns global engine
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public class GlobalEngineAccessor : IGlobalEngineAccessor {
+               public GlobalEngineAccessor ()
+               {
+               }
+
+               public Engine GlobalEngine {
+                       get {
+                               return null;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs
new file mode 100644 (file)
index 0000000..c791ddf
--- /dev/null
@@ -0,0 +1,137 @@
+//
+// GroupingCollection.cs: Represents group of BuildItemGroup,
+// BuildPropertyGroup and BuildChoose.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public class GroupingCollection : IEnumerable {
+               
+               IList   allGroups;
+               int     itemGroups;
+               int     propertyGroups;
+               int     chooses;
+       
+               public GroupingCollection ()
+               {
+                       allGroups = new ArrayList ();
+               }
+
+               public IEnumerator GetChooseEnumerator ()
+               {
+                       foreach (object o in allGroups)
+                               if (o is BuildChoose)
+                                       yield return o;
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                       foreach (object o in allGroups) {
+                               if (o is BuildItemGroup) {
+                                       yield return o;
+                                       continue;
+                               }
+                               if (o is BuildPropertyGroup) {
+                                       yield return o;
+                                       continue;
+                               }
+                               if (o is BuildChoose) {
+                                       yield return o;
+                               }
+                       }
+               }
+
+               public IEnumerator GetItemGroupAndChooseEnumerator ()
+               {
+                       foreach (object o in allGroups) {
+                               if (o is BuildItemGroup) {
+                                       yield return o;
+                                       continue;
+                               }
+                               if (o is BuildChoose) {
+                                       yield return o;
+                               }
+                       }
+               }
+
+               public IEnumerator GetItemGroupEnumerator ()
+               {
+                       foreach (object o in allGroups)
+                               if (o is BuildItemGroup)
+                                       yield return o;
+               }
+
+               public IEnumerator GetPropertyGroupAndChooseEnumerator ()
+               {
+                       foreach (object o in allGroups) {
+                               if (o is BuildPropertyGroup) {
+                                       yield return o;
+                                       continue;
+                               }
+                               if (o is BuildChoose) {
+                                       yield return o;
+                               }
+                       }
+               }
+
+               public IEnumerator GetPropertyGroupEnumerator ()
+               {
+                       foreach (object o in allGroups) {
+                               if (o is BuildPropertyGroup)
+                                       yield return o;
+                       }
+               }
+               
+               internal void Add (BuildPropertyGroup bpg) {
+                       bpg.GroupingCollection = this;
+                       allGroups.Add (bpg);
+                       propertyGroups++;
+               }
+               
+               internal void Add (BuildItemGroup big) {
+                       allGroups.Add (big);
+                       itemGroups++;
+               }
+               
+               internal void Add (BuildChoose bc) {
+                       allGroups.Add (bc);
+                       chooses++;
+               }
+               
+               internal int ItemGroups {
+                       get { return this.itemGroups; }
+               }
+               
+               internal int PropertyGroups {
+                       get { return this.propertyGroups; }
+               }
+               
+               internal int Chooses {
+                       get { return this.chooses; }
+               } 
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/HostLogger.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/HostLogger.cs
new file mode 100644 (file)
index 0000000..e64f1f0
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// HostLogger.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       public class HostLogger : ILogger, IHostLogger {
+               
+               IHostFeedback   hostFeedbackObject;
+               string          parameters;
+               LoggerVerbosity verbosity;
+       
+               public HostLogger ()
+               {
+               }
+
+               public void Initialize (IEventSource eventSource)
+               {
+               }
+
+               public void Shutdown ()
+               {
+               }
+
+               public IHostFeedback HostFeedbackObject {
+                       get {
+                               return hostFeedbackObject;
+                       }
+                       set {
+                               hostFeedbackObject = value;
+                       }
+               }
+
+               public string Parameters {
+                       get {
+                               return parameters;
+                       }
+                       set {
+                               parameters = value;
+                       }
+               }
+
+               public LoggerVerbosity Verbosity {
+                       get {
+                               return verbosity;
+                       }
+                       set {
+                               verbosity = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItem.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItem.cs
new file mode 100644 (file)
index 0000000..f2c415a
--- /dev/null
@@ -0,0 +1,70 @@
+//
+// IBuildItem.cs: Interface for build items
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IBuildItem {
+               void CopyCustomMetadataTo (IBuildItem destinationItem);
+
+               string GetEvaluatedMetadata (string metadataName);
+
+               string GetMetadata (string metadataName);
+
+               bool HasMetadata (string metadataName);
+
+               void RemoveMetadata (string metadataName);
+
+               void SetMetadata (string metadataName, string metadataValue);
+
+               string Condition {
+                       get;
+                       set;
+               }
+
+               string Exclude {
+                       get;
+                       set;
+               }
+
+               string FinalItemSpec {
+                       get;
+               }
+
+               string Include {
+                       get;
+                       set;
+               }
+
+               bool IsImported {
+                       get;
+               }
+
+               string Name {
+                       get;
+                       set;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItemGroup.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItemGroup.cs
new file mode 100644 (file)
index 0000000..b166966
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// IBuildItemGroup.cs: Interface for group of build items.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IBuildItemGroup {
+               BuildItem AddNewItem (string itemName, string itemInclude);
+
+               void Clear ();
+
+               BuildItemGroup Clone (bool deepClone);
+
+               IEnumerator GetEnumerator ();
+
+               void RemoveItem (BuildItem itemToRemove);
+
+               void RemoveItemAt (int index);
+
+               BuildItem[] ToArray ();
+
+               string Condition {
+                       get;
+                       set;
+               }
+
+               int Count {
+                       get;
+               }
+
+               bool IsImported {
+                       get;
+               }
+
+               BuildItem this[int index] {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItemGroupCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildItemGroupCollection.cs
new file mode 100644 (file)
index 0000000..de2d6c0
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// IBuildItemCollection.cs: Interface for collection holding build items.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IBuildItemGroupCollection {
+               void CopyTo (Array array, int index);
+
+               void CopyToStronglyTypedArray (BuildItemGroup[] array,
+                                              int index);
+
+               IEnumerator GetEnumerator ();
+
+               int Count {
+                       get;
+               }
+
+               bool IsSynchronized {
+                       get;
+               }
+
+               object SyncRoot {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildProperty.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildProperty.cs
new file mode 100644 (file)
index 0000000..6ebe21c
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// IBuildProperty.cs: Interface for build property.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IBuildProperty {
+               BuildProperty Clone (bool deepClone);
+
+               string ToString ();
+
+               string Condition {
+                       get;
+                       set;
+               }
+
+               string FinalValue {
+                       get;
+               }
+
+               string Name {
+                       get;
+               }
+
+               string Value {
+                       get;
+                       set;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildPropertyGroup.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildPropertyGroup.cs
new file mode 100644 (file)
index 0000000..7e531d3
--- /dev/null
@@ -0,0 +1,69 @@
+//
+// IBuildPropertyGroup.cs: Interface for group of build properties.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IBuildPropertyGroup {
+               BuildProperty AddNewProperty (string propertyName,
+                                             string propertyValue);
+
+               void Clear ();
+
+               BuildPropertyGroup Clone (bool deepClone);
+
+               IEnumerator GetEnumerator ();
+
+               void GetStringArraysForAllProperties (out string[] propertyNames,
+                                                     out string[] propertyValues,
+                                                     out string[] propertyFinalValues);
+
+               void RemoveProperty (BuildProperty propertyToRemove);
+
+               void RemovePropertyByName (string propertyNameToRemove);
+
+               void SetProperty (string propertyName, string propertyValue);
+
+               string Condition {
+                       get;
+                       set;
+               }
+
+               int Count {
+                       get;
+               }
+
+               bool IsImported {
+                       get;
+               }
+
+               BuildProperty this[string propertyName] {
+                       get;
+                       set;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildPropertyGroupCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildPropertyGroupCollection.cs
new file mode 100644 (file)
index 0000000..d17a6fc
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// IBuildPropertyGroupCollection.cs: Holds group of build properties.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IBuildPropertyGroupCollection {
+               void CopyTo (Array array, int index);
+
+               void CopyToStronglyTypedArray (BuildPropertyGroup[] array,
+                                              int index);
+
+               IEnumerator GetEnumerator ();
+
+               int Count {
+                       get;
+               }
+
+               bool IsSynchronized {
+                       get;
+               }
+
+               object SyncRoot {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ICultureStringUtilities.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ICultureStringUtilities.cs
new file mode 100644 (file)
index 0000000..913e3fc
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// ICultureStringUtilities.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public interface ICultureStringUtilities {
+               string[] GetSupportedCultures ();
+
+               bool ValidateCulture (string culture);
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IEngine.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IEngine.cs
new file mode 100644 (file)
index 0000000..b759bed
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// IEngine.cs: Interface for build engine
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System.Collections;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IEngine {
+               bool BuildProject (Project project, string[] targetNames,
+                                  IDictionary targetOutputs);
+
+               bool BuildProjectFile (string projectFileName,
+                                      string[] targetNames,
+                                      BuildPropertyGroup globalProperties,
+                                      IDictionary targetOutputs);
+
+               void ClearAllProjects ();
+               
+               Project CreateNewProject ();
+               
+               string Escape (string input);
+               
+               Project GetLoadedProject (string projectFullFileName);
+
+               void RegisterLogger (ILogger logger);
+
+               void UnregisterAllLoggers ();
+
+               string BinPath {
+                       get;
+                       set;
+               }
+
+               bool BuildEnabled {
+                       get;
+                       set;
+               }
+
+               BuildPropertyGroup GlobalProperties {
+                       get;
+                       set;
+               }
+
+               bool OnlyLogCriticalEvents {
+                       get;
+                       set;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IGlobalEngineAccessor.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IGlobalEngineAccessor.cs
new file mode 100644 (file)
index 0000000..f51f062
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// IGlobalEngineAccessor.cs: Interface for accessor to global engine
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IGlobalEngineAccessor {
+               Engine GlobalEngine {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IHostFeedback.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IHostFeedback.cs
new file mode 100644 (file)
index 0000000..b8fedef
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// IHostFeedback.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IHostFeedback {
+               void BeginLogging ();
+
+               void LogFormattedError (string message, string errorCode,
+                                       string helpKeyword, int line,
+                                       int column, int endingLine,
+                                       int endingColumn, string file,
+                                       object additionalInfo);
+               void LogFormattedWarning (string message, string warningCode,
+                                         string helpKeyword, int line,
+                                         int column, int endingLine,
+                                         int endingColumn, string file,
+                                         object additionalInfo);
+               void LogTextMessage (string message);
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IHostLogger.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IHostLogger.cs
new file mode 100644 (file)
index 0000000..b9ce889
--- /dev/null
@@ -0,0 +1,35 @@
+//
+// IHostLogger.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IHostLogger {
+               IHostFeedback HostFeedbackObject {
+                       get;
+                       set;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ILangSecurityLevelChecker.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ILangSecurityLevelChecker.cs
new file mode 100644 (file)
index 0000000..bcc63a5
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// ILangSecurityLevelChecker.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public interface ILangSecurityLevelChecker {
+               bool CheckPath (string path, int zone);
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IProject.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IProject.cs
new file mode 100644 (file)
index 0000000..1026ffd
--- /dev/null
@@ -0,0 +1,182 @@
+//
+// IProject.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface IProject {
+               void AddNewImport (string importLocation,
+                                  string importCondition);
+
+               BuildItem AddNewItem (string itemName, string itemInclude);
+
+               BuildItemGroup AddNewItemGroup ();
+
+               BuildPropertyGroup AddNewPropertyGroup (bool insertAtEndOfProject);
+
+               bool Build (string[] targetNamesToBuild,
+                           IDictionary targetOutputs);
+
+               bool BuildTarget (string targetName,
+                                 IDictionary targetOutputs);
+
+               bool BuildTargetWithFlags (string targetName,
+                                          IDictionary targetOutputs,
+                                          BuildSettings buildFlags);
+
+               string[] GetConditionedPropertyValues (string propertyName);
+
+               string[] GetDirectlyImportedProjects ();
+
+               BuildItemGroup GetEvaluatedItemsByName (string itemName);
+
+               BuildItemGroup GetEvaluatedItemsByNameIgnoringCondition (string itemName);
+
+               string GetEvaluatedProperty (string propertyName);
+
+               string[] GetNonImportedItemNames ();
+
+               string[] GetNonImportedPropertyNames ();
+
+               string[] GetNonImportedTargetNames ();
+
+               string[] GetNonImportedUsingTasks ();
+
+               string GetProjectExtensions (string id);
+
+               void LoadFromFile (string projectFileName);
+
+               void LoadFromXml (XmlDocument projectXml);
+
+               void MarkProjectAsDirty ();
+
+               void RemoveAllItemGroups ();
+
+               void RemoveAllItemsGroupsByCondition (string condition);
+
+               void RemoveAllPropertyGroups ();
+
+               void RemoveAllPropertyGroupsByCondition (string condition);
+
+               void RemoveItem (BuildItem itemToRemove);
+
+               void RemoveItemGroup (BuildItemGroup itemGroupToRemove);
+
+               void RemoveItemsByName (string itemName);
+
+               void RemovePropertyGroup (BuildPropertyGroup propertyGroupToRemove);
+
+               void ResetBuildStatus ();
+
+               void SaveToFile (string projectFileName);
+
+               void SaveToFile (string projectFileName,
+                               ProjectFileEncoding encoding);
+
+               void SaveToTextWriter (TextWriter outTextWriter);
+
+               void SetImportedProperty (string propertyName,
+                                         string propertyValue,
+                                         string condition,
+                                         Project importedProject);
+
+               void SetImportedPropertyAt (string propertyName,
+                                           string propertyValue,
+                                           string condition,
+                                           Project importedProject,
+                                           PropertyPosition position);
+
+               void SetProjectExtensions (string id, string xmlText);
+
+               void SetProperty (string propertyName, string propertyValue,
+                                 string condition);
+
+               void SetPropertyAt (string propertyName, string propertyValue,
+                                   string condition,
+                                   PropertyPosition postition);
+
+               void Unload ();
+
+               bool BuildEnabled {
+                       get;
+                       set;
+               }
+
+               ProjectFileEncoding CurrentProjectFileEncoding {
+                       get;
+               }
+
+               string DefaultTargets {
+                       get;
+                       set;
+               }
+
+               BuildItemGroup EvaluatedItems {
+                       get;
+               }
+
+               BuildItemGroup EvaluatedItemsIgnoringCondition {
+                       get;
+               }
+
+               BuildPropertyGroup EvaluatedProperties {
+                       get;
+               }
+
+               string FullFileName {
+                       get;
+               }
+
+               BuildPropertyGroup GlobalProperties {
+                       get;
+                       set;
+               }
+
+               bool IsDirty {
+                       get;
+               }
+
+               BuildItemGroupCollection ItemGroups {
+                       get;
+               }
+
+               Engine ParentEngine {
+                       get;
+               }
+
+               BuildPropertyGroupCollection PropertyGroups {
+                       get;
+               }
+
+               DateTime TimeOfLastDirty {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITarget.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITarget.cs
new file mode 100644 (file)
index 0000000..857ce3c
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// ITarget.cs: Interface for target.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface ITarget {
+               IEnumerator GetEnumerator ();
+
+               string Condition {
+                       get;
+                       set;
+               }
+
+               string DependsOnTargets {
+                       get;
+                       set;
+               }
+
+               string Name {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITargetCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITargetCollection.cs
new file mode 100644 (file)
index 0000000..330439d
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// ITargetCollection.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface ITargetCollection {
+               void CopyTo (Array array, int index);
+
+               void CopyToStronglyTypedArray (Target[] array, int index);
+
+               bool Exists (string targetName);
+
+               IEnumerator GetEnumerator ();
+
+               int Count {
+                       get;
+               }
+
+               bool IsSynchronized {
+                       get;
+               }
+
+               object SyncRoot {
+                       get;
+               }
+
+               Target this[string index] {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITaskElement.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ITaskElement.cs
new file mode 100644 (file)
index 0000000..087e8f5
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// ITaskElement.cs: Interface for element of a task.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.BuildEngine {
+       public interface ITaskElement {
+               bool Execute ();
+
+               string[] GetParameterNames ();
+
+               string GetParameterValue (string attributeName);
+
+               void SetParameterValue (string parameterName,
+                                       string parameterValue);
+
+               string Condition {
+                       get;
+                       set;
+               }
+
+               bool ContinueOnError {
+                       get;
+                       set;
+               }
+
+               object HostObject {
+                       get;
+                       set;
+               }
+
+               string Name {
+                       get;
+               }
+
+               Type Type {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportedProject.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportedProject.cs
new file mode 100644 (file)
index 0000000..1d6f385
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// ImportedProject.cs: Text file that is inserted when <Import> is found.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class ImportedProject {
+       
+               DateTime        lastWrite;
+               XmlDocument     xmlDocument;
+               int             size;
+               string          fullFileName;
+       
+               public ImportedProject ()
+               {
+               }
+               
+               public void Load (string filename)
+               {
+                       if (filename == null)
+                               throw new ArgumentNullException ("filename");
+                       
+                       StreamReader sr = new StreamReader (filename);
+                       try {
+                               string text = sr.ReadToEnd ();
+                               size = text.Length;
+                               xmlDocument = new XmlDocument ();
+                               xmlDocument.LoadXml (text);
+                               lastWrite = File.GetLastWriteTime (filename);
+                               fullFileName = filename;
+                       }
+                       catch (Exception ex) {
+                               throw;
+                       }
+                       finally {
+                               sr.Close ();
+                       }
+               }
+               
+               public XmlDocument XmlDocument {
+                       get { return xmlDocument; }
+               }
+               
+               public DateTime LastWrite {
+                       get { return lastWrite; }
+               }
+               
+               public int Size {
+                       get { return size; }
+               }
+               
+               public string FullFileName {
+                       get { return fullFileName; }
+               }
+       }
+}
+
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InternalLoggerException.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InternalLoggerException.cs
new file mode 100644 (file)
index 0000000..9a35337
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// InternalLoggerException.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Runtime.Serialization;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       [Serializable]
+       public sealed class InternalLoggerException : Exception {
+               
+               BuildEventArgs  buildEventArgs;
+               string          errorCode;
+               string          helpKeyword;
+               
+               public InternalLoggerException ()
+                       : base ("Internal logger exception has occured.")
+               {
+               }
+
+               public InternalLoggerException (string message)
+                       : base (message)
+               {
+               }
+
+               public InternalLoggerException (string message,
+                                               Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+
+               public override void GetObjectData (SerializationInfo info,
+                                                   StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("BuildEventArgs", buildEventArgs);
+                       info.AddValue ("ErrorCode", errorCode);
+                       info.AddValue ("HelpKeywordPrefix", helpKeyword);
+               }
+
+               public BuildEventArgs BuildEventArgs {
+                       get {
+                               return buildEventArgs;
+                       }
+               }
+
+               public string ErrorCode {
+                       get {
+                               return errorCode;
+                       }
+               }
+
+               public string HelpKeyword {
+                       get {
+                               return helpKeyword;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InvalidProjectFileException.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InvalidProjectFileException.cs
new file mode 100644 (file)
index 0000000..1450fae
--- /dev/null
@@ -0,0 +1,186 @@
+//
+// InvalidProjectFileException.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Runtime.Serialization;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+       [Serializable]
+       public sealed class InvalidProjectFileException : Exception {
+               
+               string  baseMessage;
+               int     columnNumber;
+               int     endColumnNumber;
+               string  errorCode;
+               string  errorSubcategory;
+               bool    hasBeenLogged;
+               string  helpKeyword;
+               int     lineNumber;
+               int     endLineNumber;
+               string  message;
+               string  projectFile;
+               
+               public InvalidProjectFileException ()
+                       : base ("Invalid project file exception has occured")
+               {
+                       this.message = "Invalid project file exception has occured";
+               }
+
+               public InvalidProjectFileException (string message)
+                       : base (message)
+               {
+                       this.message = message;
+               }
+
+               public InvalidProjectFileException (string projectFile,
+                                                   int lineNumber,
+                                                   int columnNumber,
+                                                   int endLineNumber,
+                                                   int endColumnNumber,
+                                                   string message,
+                                                   string errorSubcategory,
+                                                   string errorCode,
+                                                   string helpKeyword)
+                       : base (message)
+               {
+                       this.projectFile = projectFile;
+                       this.lineNumber = lineNumber;
+                       this.columnNumber = columnNumber;
+                       this.endLineNumber = endLineNumber;
+                       this.endColumnNumber = endColumnNumber;
+                       this.message = message;
+                       this.errorSubcategory = errorSubcategory;
+                       this.errorCode = errorCode;
+                       this.helpKeyword = helpKeyword;
+               }
+
+               public InvalidProjectFileException (string message,
+                                                   Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+
+               public InvalidProjectFileException (XmlNode xmlNode,
+                                                   string message,
+                                                   string errorSubcategory,
+                                                   string errorCode,
+                                                   string helpKeyword)
+                       : base (message)
+               {
+                       this.message = message;
+                       this.errorSubcategory = errorSubcategory;
+                       this.errorCode = errorCode;
+                       this.helpKeyword = helpKeyword;
+               }
+
+               public override void GetObjectData (SerializationInfo info,
+                                                   StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("BaseMessage", baseMessage);
+                       info.AddValue ("ColumnNumber", columnNumber);
+                       info.AddValue ("EndColumnNumber", endColumnNumber);
+                       info.AddValue ("ErrorCode", errorCode);
+                       info.AddValue ("ErrorSubcategory", errorSubcategory);
+                       info.AddValue ("HasBeenLogged", hasBeenLogged);
+                       info.AddValue ("HelpKeyword", helpKeyword);
+                       info.AddValue ("LineNumber", lineNumber);
+                       info.AddValue ("EndLineNumber", endLineNumber);
+                       info.AddValue ("ProjectFile", projectFile);
+               }
+
+               public string BaseMessage {
+                       get {
+                               return baseMessage;
+                       }
+               }
+
+               public int ColumnNumber {
+                       get {
+                               return columnNumber;
+                       }
+               }
+
+               public int EndColumnNumber {
+                       get {
+                               return endColumnNumber;
+                       }
+               }
+
+               public int EndLineNumber {
+                       get {
+                               return endLineNumber;
+                       }
+               }
+
+               public string ErrorCode {
+                       get {
+                               return errorCode;
+                       }
+               }
+
+               public string ErrorSubcategory {
+                       get {
+                               return errorSubcategory;
+                       }
+               }
+
+               public bool HasBeenLogged {
+                       get {
+                               return hasBeenLogged;
+                       }
+                       set {
+                               hasBeenLogged = value;
+                       }
+               }
+
+               public string HelpKeyword {
+                       get {
+                               return helpKeyword;
+                       }
+               }
+
+               public int LineNumber {
+                       get {
+                               return lineNumber;
+                       }
+               }
+
+               public override string Message {
+                       get {
+                               return base.Message;
+                       }
+               }
+
+               public string ProjectFile {
+                       get {
+                               return projectFile;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ItemPropertyGroupingBase.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ItemPropertyGroupingBase.cs
new file mode 100644 (file)
index 0000000..04f1d98
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// ItemPropertyGroupingBase.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine {
+       public abstract class ItemPropertyGroupingBase {
+
+               protected ItemPropertyGroupingBase ()
+               {
+               }
+               
+               public abstract void Evaluate (BuildPropertyGroup parentPropertyBag,
+                                              bool ignoreCondition,
+                                              bool honorCondition,
+                                              Hashtable conditionedPropertiesTable,
+                                              ProcessingPass pass);
+
+               public enum EvaluationType {
+                       PropertyGroup,
+                       ItemGroup
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ItemReference.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ItemReference.cs
new file mode 100644 (file)
index 0000000..0aa8d35
--- /dev/null
@@ -0,0 +1,156 @@
+//
+// ItemReference.cs: Represents "@(Reference)" in expression.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class ItemReference {
+       
+               string          itemName;
+               string          separator;
+               Expression      parent;
+               Expression      transform;
+       
+               public ItemReference (Expression parent)
+               {
+                       if (parent == null)
+                               throw new Exception ("Parent Expression needed to find project.");
+                       this.parent = parent;
+                       this.itemName = null;
+                       this.separator = ";";
+               }
+               
+               public ItemReference (Expression parent, string source)
+                       : this (parent)
+               {
+                       ParseSource (source);
+               }
+               
+               public void ParseSource (string source)
+               {
+                       string sourceWithoutParens;
+                       ApostropheState aState = ApostropheState.Out;
+                       ItemParsingState iState = ItemParsingState.Name;
+                       int c = -1;
+                       int itemNameEnd;
+                       int transformEnd = -1;
+                       int separatorStart = -1;
+               
+                       if (source == null)
+                               throw new ArgumentNullException ("source");
+               
+                       if (source.Length < 3)
+                               throw new ArgumentException ("Invalid item.");
+                       
+                       sourceWithoutParens = source.Substring (2, source.Length - 3);
+                       itemNameEnd = sourceWithoutParens.Length - 1;
+                       CharEnumerator it = sourceWithoutParens.GetEnumerator ();
+
+                       while (it.MoveNext ()) {
+                               c++;
+                               if (it.Current == '\'') {
+                                       if (aState == ApostropheState.In)
+                                               aState = ApostropheState.Out;
+                                       else
+                                               aState = ApostropheState.In;
+                               }
+                               if (it.Current == '-' && iState == ItemParsingState.Name && aState == ApostropheState.Out) {
+                                       iState = ItemParsingState.Transform1;
+                                       itemNameEnd = c - 1;
+                               } else if (it.Current == '>' && iState == ItemParsingState.Transform1 && aState == ApostropheState.Out) {
+                                       iState = ItemParsingState.Transform2;
+                               } else if (iState == ItemParsingState.Transform2 && aState == ApostropheState.Out && c == sourceWithoutParens.Length - 1) {
+                                       transformEnd = c;
+                               } else if (iState == ItemParsingState.Transform2 && aState == ApostropheState.Out && it.Current == ',') {
+                                       transformEnd = c - 1;
+                                       separatorStart = c + 1;
+                                       break;
+                               } else if (iState == ItemParsingState.Name && aState == ApostropheState.Out && it.Current == ',') {
+                                       separatorStart = c + 1;
+                                       itemNameEnd = c - 1;
+                                       break;
+                               }
+                       }
+                       itemName = sourceWithoutParens.Substring (0, itemNameEnd + 1);
+                       if (transformEnd != -1) {
+                               if (separatorStart != -1) {
+                                       separator = sourceWithoutParens.Substring (separatorStart + 1, sourceWithoutParens.Length
+                                               - separatorStart - 2);
+                                       transform = new Expression (parent.Project, sourceWithoutParens.Substring (itemNameEnd + 4,
+                                       transformEnd - itemNameEnd - 4));
+                               } else {
+                                       transform = new Expression (parent.Project, sourceWithoutParens.Substring (itemNameEnd + 4,
+                                       sourceWithoutParens.Length - itemNameEnd - 5));
+                               }
+                       } else {
+                               if (separatorStart != -1) {
+                                       separator = sourceWithoutParens.Substring (separatorStart + 1, sourceWithoutParens.Length
+                                               - separatorStart - 2);
+                               }
+                       }
+               }
+               
+               public ITaskItem[] ToITaskItemArray ()
+               {
+                       if (itemName != String.Empty) {
+                               Project p = parent.Project;
+                               BuildItemGroup big;
+                               if (p.EvaluatedItemsByName.Contains (itemName)) {
+                                       big = (BuildItemGroup)p.EvaluatedItemsByName [itemName];
+                                       return big.ToITaskItemArray (transform);
+                               } else
+                                       return null;
+                       } else
+                               return null;
+               }
+               
+               public new string ToString ()
+               {
+                       if (itemName != String.Empty) {
+                               Project p = parent.Project;
+                               BuildItemGroup big;
+                               if (p.EvaluatedItemsByName.Contains (itemName)) {
+                                       big = (BuildItemGroup)p.EvaluatedItemsByName [itemName];
+                                       return big.ToString (transform, separator);
+                               } else
+                                       return String.Empty;
+                       } else
+                               return String.Empty;
+               }
+               
+               public string ItemName {
+                       get { return itemName; }
+               }
+               
+               public string Separator {
+                       get { return separator; }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MetadataReference.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MetadataReference.cs
new file mode 100644 (file)
index 0000000..601fb1d
--- /dev/null
@@ -0,0 +1,90 @@
+//
+// MetadataReference.cs: Represents a metadata reference in expression.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class MetadataReference {
+       
+               string          itemName;
+               string          metadataName;
+               Expression      parent;
+       
+               public MetadataReference (Expression parent)
+               {
+                       this.itemName = null;
+                       this.metadataName = null;
+                       this.parent = parent;
+               }
+               
+               public MetadataReference (Expression parent, string source)
+               {
+                       this.parent = parent;
+                       ParseSource (source);
+               }
+               
+               public MetadataReference (Expression parent, string itemName, string metadataName)
+               {
+                       this.parent = parent;
+                       this.itemName = itemName;
+                       this.metadataName = metadataName;
+               }
+               
+               public void ParseSource (string source)
+               {
+                       string sourceWithoutParens;
+                       int dot;
+               
+                       if (source.Length < 4)
+                               throw new ArgumentException ("source is too short.");
+                       
+                       sourceWithoutParens = source.Substring (2, source.Length - 3);
+                       dot = sourceWithoutParens.IndexOf ('.');
+                       
+                       if (dot != -1) {
+                               itemName = sourceWithoutParens.Substring (0, dot);
+                               metadataName = sourceWithoutParens.Substring (dot + 1, sourceWithoutParens.Length - dot - 1); 
+                       } else {
+                               metadataName = sourceWithoutParens;
+                       }
+               }
+               
+               public string ItemName {
+                       get { return itemName; }
+               }
+               
+               public string MetadataName {
+                       get { return metadataName; }
+               }
+               
+               public bool IsQualified {
+                       get { return (itemName == null) ? false : true; }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MonoTODOAttribute.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MonoTODOAttribute.cs
new file mode 100644 (file)
index 0000000..7c986cf
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// MonoTODOAttribute.cs
+//
+// Author:
+//   Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System {
+       
+       [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+       internal sealed class MonoTODOAttribute : Attribute {
+
+               string comment;
+               
+               public MonoTODOAttribute ()
+               {
+               }
+
+               public MonoTODOAttribute (string comment)
+               {
+                       this.comment = comment;
+               }
+
+               public string Comment {
+                       get { return comment; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ProcessingPass.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ProcessingPass.cs
new file mode 100644 (file)
index 0000000..3c9c141
--- /dev/null
@@ -0,0 +1,33 @@
+//
+// ProcessingPass.cs: 
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public enum ProcessingPass {
+               Pass1,
+               Pass2
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
new file mode 100644 (file)
index 0000000..3192259
--- /dev/null
@@ -0,0 +1,653 @@
+//
+// Project.cs: Project class
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Schema;
+using Microsoft.Build.Framework;
+using Mono.XBuild.Shared;
+
+namespace Microsoft.Build.BuildEngine {
+       public class Project : IProject {
+               static string separator = ";";
+       
+               bool                            buildEnabled;
+               IDictionary                     conditionedProperties;
+               Encoding                                currentEncoding;
+               string[]                        defaultTargets;
+               IList                           directlyImportedProjects;
+               BuildPropertyGroup              environmentProperties;
+               BuildItemGroup                  evaluatedItems;
+               BuildItemGroup                  evaluatedItemsIgnoringCondition;
+               IDictionary                     evaluatedItemsByName;
+               IDictionary                     evaluatedItemsByNameIgnoringCondition;
+               BuildPropertyGroup              evaluatedProperties;
+               string                          firstTargetName;
+               string                          fullFileName;
+               BuildPropertyGroup              globalProperties;
+               GroupingCollection              groups;
+               bool                            isDirty;
+               bool                            isValidated;
+               bool                            isReset;
+               BuildItemGroupCollection        itemGroups;
+               IDictionary                     importedProjects;
+               Engine                          parentEngine;
+               BuildPropertyGroupCollection    propertyGroups;
+               BuildPropertyGroup              reservedProperties;
+               string                          schemaFile;
+               TaskDatabase                    taskDatabase;
+               TargetCollection                targets;
+               DateTime                        timeOfLastDirty;
+               IList                           usingTaskElements;
+               XmlDocument                     xmlDocument;
+               XmlElement                      xmlElement;
+
+               public Project ()
+                       : this (null)
+               {
+               }
+
+               public Project (Engine engine)
+               {
+                       parentEngine  = engine;
+                       xmlDocument = new XmlDocument ();
+                       evaluatedItems = new BuildItemGroup (this);
+                       evaluatedItemsByName = new Hashtable (new CaseInsensitiveHashCodeProvider (), new CaseInsensitiveComparer ());
+                       evaluatedItemsByNameIgnoringCondition = new Hashtable (new CaseInsensitiveHashCodeProvider (), new CaseInsensitiveComparer ());
+                       evaluatedItemsIgnoringCondition = new BuildItemGroup (this);
+                       evaluatedProperties = new BuildPropertyGroup (false, null);
+                       groups = new GroupingCollection ();
+                       itemGroups = new BuildItemGroupCollection (groups);
+                       propertyGroups = new BuildPropertyGroupCollection (groups);
+                       targets = new TargetCollection (this);
+                       usingTaskElements = new ArrayList ();
+                       taskDatabase = new TaskDatabase ();
+               }
+
+               public void AddNewImport (string importLocation,
+                                         string importCondition)
+               {
+               }
+
+               public BuildItem AddNewItem (string itemName,
+                                            string itemInclude)
+               {
+                       // add it to rawitemgroups, maybe to evaluated items then?
+                       return null;
+               }
+
+               public BuildItemGroup AddNewItemGroup ()
+               {
+                       return null;
+               }
+
+               public BuildPropertyGroup AddNewPropertyGroup (bool insertAtEndOfProject)
+               {
+                       return null;
+               }
+
+               public bool Build (string[] targetNamesToBuild,
+                                  IDictionary targetOutputs)
+               {
+                       if (targetNamesToBuild.Length == 0) {
+                               if (defaultTargets.Length != 0) {
+                                       targetNamesToBuild = defaultTargets;
+                               }
+                               else if (firstTargetName != null) {
+                                       targetNamesToBuild = new string [1] { firstTargetName};
+                               }
+                               else
+                                       return false;
+                       }
+                       foreach (string target in targetNamesToBuild) {
+                               if (BuildTarget (target, targetOutputs) == false) {
+                                       return false;
+                               }
+                       }
+                       return true;
+               }
+
+               public bool BuildTarget (string targetName,
+                                        IDictionary targetOutputs)
+               {
+                       return BuildTargetWithFlags (targetName, targetOutputs, BuildSettings.None);
+               }
+
+               public bool BuildTargetWithFlags (string targetName,
+                                                 IDictionary targetOutputs,
+                                                 BuildSettings buildFlags)
+               {
+                       if (targets.Exists (targetName) == false)
+                               throw new Exception ("Target specified to build does not exist.");
+                       
+                       this.targets [targetName].Build ();
+                       return true;
+               }
+               
+               public string[] GetConditionedPropertyValues (string propertyName)
+               {
+                       StringCollection sc = (StringCollection) conditionedProperties [propertyName];
+                       string[] propertyValues = new string [sc.Count];
+                       int i  = 0;
+                       foreach (string propertyValue in sc)
+                               propertyValues [i++] = propertyValue;
+                       return propertyValues;
+               }
+
+               public string[] GetDirectlyImportedProjects ()
+               {
+                       string[] dip = new string [directlyImportedProjects.Count];
+                       int i = 0;
+                       foreach (string importedProject in directlyImportedProjects)
+                               dip [i++] = importedProject;
+                       return dip;
+               }
+
+               public BuildItemGroup GetEvaluatedItemsByName (string itemName)
+               {
+                       return (BuildItemGroup) evaluatedItemsByName [itemName];
+               }
+
+               public BuildItemGroup GetEvaluatedItemsByNameIgnoringCondition (string itemName)
+               {
+                       return (BuildItemGroup) evaluatedItemsByNameIgnoringCondition [itemName];
+               }
+
+               public string GetEvaluatedProperty (string propertyName)
+               {
+                       return evaluatedProperties [propertyName];
+               }
+
+               public string[] GetNonImportedItemNames ()
+               {
+                       return null;
+               }
+
+               public string[] GetNonImportedPropertyNames ()
+               {
+                       return null;
+               }
+
+               public string[] GetNonImportedTargetNames ()
+               {
+                       ArrayList temporaryNonImportedTargets = new ArrayList ();
+                       foreach (Target target in targets)
+                               if (target.IsImported == false)
+                                       temporaryNonImportedTargets.Add (target);
+                       string[] nonImportedTargetNames = new string [temporaryNonImportedTargets.Count];
+                       int i = 0;
+                       foreach (Target target in temporaryNonImportedTargets)
+                               nonImportedTargetNames [i++] = target.Name;
+                       return nonImportedTargetNames;
+               }
+
+               public string[] GetNonImportedUsingTasks ()
+               {
+                       return null;
+               }
+
+               public string GetProjectExtensions (string id)
+               {
+                       return null;
+               }
+
+               public void LoadFromFile (string projectFileName)
+               {
+                       this.fullFileName = Path.GetFullPath (projectFileName);
+                       XmlSchemaCollection xmlSchemaCollection = null;
+                       XmlTextReader xmlTextReader = null;
+                       XmlValidatingReader xmlValidatingReader = null;
+                       
+                       if (this.schemaFile != null) {
+                               xmlSchemaCollection = new XmlSchemaCollection ();
+                               xmlSchemaCollection.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
+                               xmlSchemaCollection.Add (null, this.schemaFile);
+                               if (xmlSchemaCollection.Count > 0) {
+                                       xmlTextReader = new XmlTextReader (projectFileName);
+                                       xmlValidatingReader = new XmlValidatingReader (xmlTextReader);
+                                       xmlValidatingReader.ValidationType = ValidationType.Schema;
+                                       xmlValidatingReader.Schemas.Add (xmlSchemaCollection);
+                                       xmlValidatingReader.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
+                               }
+                       } else {
+                               xmlTextReader = new XmlTextReader (projectFileName);
+                       }
+                       if (xmlValidatingReader != null)
+                               xmlDocument.Load (xmlValidatingReader);
+                       else if (xmlTextReader != null)
+                               xmlDocument.Load (xmlTextReader);
+                       else
+                               throw new Exception ();
+                       xmlElement = xmlDocument.DocumentElement;
+                       if (xmlElement.Name != "Project")
+                               throw new InvalidProjectFileException ("Invalid root element.");
+                       if (xmlElement.GetAttributeNode ("DefaultTargets") != null)
+                               defaultTargets = xmlElement.GetAttribute ("DefaultTargets").Split (';');
+                       else
+                               defaultTargets = new string [0];
+                       
+                       ProcessElements (xmlElement, null);
+                       
+                       isDirty = false;
+               }
+
+               public void LoadFromXml (XmlDocument projectXml)
+               {
+                       fullFileName = "";
+                       xmlDocument = projectXml;
+                       xmlElement = xmlDocument.DocumentElement;
+                       if (xmlElement.Name != "Project")
+                               throw new InvalidProjectFileException ("Invalid root element.");
+                       if (xmlElement.GetAttributeNode ("DefaultTargets") != null)
+                               defaultTargets = xmlElement.GetAttribute ("DefaultTargets").Split (';');
+                       else
+                               defaultTargets = new string [0];
+                       
+                       ProcessElements (xmlElement, null);
+                       
+                       isDirty = false;
+               }
+
+               public void MarkProjectAsDirty ()
+               {
+                       isDirty = true;
+               }
+
+               public void RemoveAllItemGroups ()
+               {
+               }
+
+               public void RemoveAllItemsGroupsByCondition (string condition)
+               {
+               }
+
+               public void RemoveAllPropertyGroups ()
+               {
+               }
+
+               public void RemoveAllPropertyGroupsByCondition (string condition)
+               {
+               }
+
+               public void RemoveItem (BuildItem itemToRemove)
+               {
+               }
+
+               public void RemoveItemGroup (BuildItemGroup itemGroupToRemove)
+               {
+               }
+
+               public void RemoveItemsByName (string itemName)
+               {
+               }
+
+               public void RemovePropertyGroup (BuildPropertyGroup propertyGroupToRemove)
+               {
+                       
+               }
+
+               public void ResetBuildStatus ()
+               {
+               }
+
+               public void SaveToFile (string projectFileName)
+               {
+                       xmlDocument.Save (projectFileName);
+               }
+
+               public void SaveToFile (string projectFileName,
+                                       ProjectFileEncoding encoding)
+               {
+                       SaveToFile (projectFileName);
+               }
+
+               public void SaveToTextWriter (TextWriter outTextWriter)
+               {
+                       xmlDocument.Save (outTextWriter);
+               }
+
+               public void SetImportedProperty (string propertyName,
+                                                string propertyValue,
+                                                string condition,
+                                                Project importProject)
+               {
+               }
+
+               public void SetImportedPropertyAt (string propertyName,
+                                                  string propertyValue,
+                                                  string condition,
+                                                  Project importedProject,
+                                                  PropertyPosition position)
+               {
+               }
+
+               public void SetProjectExtensions (string id, string xmlText)
+               {
+               }
+
+               public void SetProperty (string propertyName,
+                                        string propertyValue,
+                                        string condition)
+               {
+               }
+
+               public void SetPropertyAt (string propertyName,
+                                          string propertyValue,
+                                          string condition,
+                                          PropertyPosition position)
+               {
+               }
+
+               public void Unload ()
+               {
+               }
+               
+               private void ProcessElements (XmlElement rootElement, ImportedProject ip)
+               {
+                       foreach (XmlNode xn in rootElement.ChildNodes) {
+                               if (xn is XmlElement) {
+                                       XmlElement xe = (XmlElement) xn;
+                                       switch (xe.Name) {
+                                       case "ProjectExtensions":
+                                               AddProjectExtensions (xe);
+                                               break;
+                                       case "Warning":
+                                       case "Message":
+                                       case "Error":
+                                               AddMessage (xe);
+                                               break;
+                                       case "Target":
+                                               AddTarget (xe, ip);
+                                               break;
+                                       case "UsingTask":
+                                               AddUsingTask (xe, ip);
+                                               break;
+                                       case "Import":
+                                               AddImport (xe, ip);
+                                               break;
+                                       case "ItemGroup":
+                                               AddItemGroup (xe);
+                                               break;
+                                       case "PropertyGroup":
+                                               AddPropertyGroup (xe);
+                                               break;
+                                       case  "Choose":
+                                               AddChoose (xe);
+                                               break;
+                                       default:
+                                               throw new InvalidProjectFileException ("Invalid element in project file.");
+                                       }
+                               }
+                       }
+               }
+               
+               private void AddProjectExtensions (XmlElement xmlElement)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+               }
+               
+               private void AddMessage (XmlElement xmlElement)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+               }
+               
+               private void AddTarget (XmlElement xmlElement, ImportedProject importedProject)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+                       Target target = targets.AddNewTarget (xmlElement.GetAttribute ("Name"));
+                       target.BindToXml (xmlElement);
+                       if (importedProject == null) {
+                               target.IsImported = false;
+                               if (firstTargetName == null)
+                                       firstTargetName = target.Name;
+                       } else
+                               target.IsImported = true;
+               }
+               
+               private void AddUsingTask (XmlElement xmlElement, ImportedProject importedProject)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+                               
+                       if (xmlElement.GetAttribute ("TaskName") == String.Empty)
+                               throw new InvalidProjectFileException ("TaskName attribute must be specified.");
+
+                       usingTaskElements.Add (xmlElement);
+
+                       AssemblyLoadInfo loadInfo = null;
+                       string filename = null;
+                       string name = null;
+                       string taskName = xmlElement.GetAttribute ("TaskName");
+                       
+                       if (xmlElement.GetAttribute ("AssemblyName") != String.Empty) {
+                               name  = xmlElement.GetAttribute ("AssemblyName");
+                               loadInfo  = new AssemblyLoadInfo (name, taskName);
+                               taskDatabase.RegisterTask (taskName, loadInfo);
+                       } else if (xmlElement.GetAttribute ("AssemblyFile") != String.Empty) {
+                               filename = xmlElement.GetAttribute ("AssemblyFile");
+                               if (Path.IsPathRooted (filename) == false) {
+                                       if (importedProject == null)
+                                               filename = Path.Combine (Path.GetDirectoryName (fullFileName), filename);
+                                       else
+                                               filename = Path.Combine (Path.GetDirectoryName (importedProject.FullFileName), filename);
+                               }
+                               loadInfo  = new AssemblyLoadInfo (LoadInfoType.AssemblyFilename, filename, null, null, null, null, taskName);
+                               taskDatabase.RegisterTask (taskName, loadInfo);
+                       } else
+                               throw new InvalidProjectFileException ("AssemblyName or AssemblyFile attribute must be specified.");
+               }
+               
+               private void AddImport (XmlElement xmlElement, ImportedProject importingProject)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+                       
+                       string importedFile;
+                       Expression importedFileExpr;
+                       ImportedProject ImportedProject;
+
+                       importedFileExpr = new Expression (this, xmlElement.GetAttribute ("Project"));
+                       importedFile = (string) importedFileExpr.ToNonArray (typeof (string));
+                       
+                       if (importedFile == String.Empty)
+                               throw new InvalidProjectFileException ("Project attribute must be specified.");
+                       
+                       if (Path.IsPathRooted (importedFile) == false) {
+                               if (importingProject == null)
+                                       importedFile = Path.Combine (Path.GetDirectoryName (fullFileName), importedFile);
+                               else
+                                       importedFile = Path.Combine (Path.GetDirectoryName (importingProject.FullFileName), importedFile);
+                       }
+                       
+                       ImportedProject importedProject = new ImportedProject ();
+                       try {
+                               importedProject.Load (importedFile);
+                               ProcessElements (importedProject.XmlDocument.DocumentElement, importedProject);
+                       }
+                       catch (Exception ex) {
+                               Console.WriteLine (ex);
+                       }
+               }
+               
+               private void AddItemGroup (XmlElement xmlElement)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+                       BuildItemGroup big = new BuildItemGroup (this);
+                       big.BindToXml (xmlElement);
+                       itemGroups.Add (big);
+               }
+               
+               private void AddPropertyGroup (XmlElement xmlElement)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+                       BuildPropertyGroup bpg = new BuildPropertyGroup (true, this);
+                       bpg.BindToXml (xmlElement);
+                       propertyGroups.Add (bpg);
+               }
+               
+               private void AddChoose (XmlElement xmlElement)
+               {
+                       if (xmlElement == null)
+                               throw new ArgumentNullException ("xmlElement");
+               }
+               
+               private static void ValidationCallBack (object sender, ValidationEventArgs e)
+               {
+                       Console.WriteLine ("Validation Error: {0}", e.Message);
+               }
+               
+               public bool BuildEnabled {
+                       get {
+                               return buildEnabled;
+                       }
+                       set {
+                               buildEnabled = value;
+                       }
+               }
+
+               public ProjectFileEncoding CurrentProjectFileEncoding {
+                       get {
+                               if (currentEncoding == Encoding.UTF8)
+                                       return ProjectFileEncoding.Utf8;
+                               if (currentEncoding == Encoding.Unicode)
+                                       return ProjectFileEncoding.Unicode;
+                               if (currentEncoding == Encoding.GetEncoding ("ANSI"))
+                                       return ProjectFileEncoding.Ansi;
+                               throw new Exception ();
+                       }
+               }
+
+               public string DefaultTargets {
+                       get { return xmlElement.GetAttribute ("DefaultTargets"); }
+                       set {
+                               xmlElement.SetAttribute ("DefaultTargets",value);
+                               defaultTargets = value.Split (';');
+                       }
+               }
+
+               public BuildItemGroup EvaluatedItems {
+                       get { return evaluatedItems; }
+               }
+
+               public BuildItemGroup EvaluatedItemsIgnoringCondition {
+                       get { return evaluatedItemsIgnoringCondition; }
+               }
+               
+               internal IDictionary EvaluatedItemsByName {
+                       get { return evaluatedItemsByName; }
+               }
+               
+               internal IDictionary EvaluatedItemsByNameIgnoringCondition {
+                       get { return evaluatedItemsByNameIgnoringCondition; }
+               }
+
+               public BuildPropertyGroup EvaluatedProperties {
+                       get { return evaluatedProperties; }
+               }
+
+               public string FullFileName {
+                       get { return fullFileName; }
+                       set { fullFileName = value; }
+               }
+
+               public BuildPropertyGroup GlobalProperties {
+                       get { return globalProperties; }
+                       set {
+                               globalProperties = value;
+                               foreach (BuildProperty bp in globalProperties)
+                                       evaluatedProperties.AddFromExistingProperty (bp);
+                       }
+               }
+
+               public bool IsDirty {
+                       get { return isDirty; }
+               }
+
+               public bool IsValidated {
+                       get { return isValidated; }
+                       set { isValidated = value; }
+               }
+
+               public BuildItemGroupCollection ItemGroups {
+                       get { return itemGroups; }
+               }
+
+               public Engine ParentEngine {
+                       get { return parentEngine; }
+               }
+
+               public BuildPropertyGroupCollection PropertyGroups {
+                       get { return propertyGroups; }
+               }
+
+               public string SchemaFile {
+                       get { return schemaFile; }
+                       set { schemaFile = value; }
+               }
+
+               public TargetCollection Targets {
+                       get { return targets; }
+               }
+
+               public DateTime TimeOfLastDirty {
+                       get { return timeOfLastDirty; }
+               }
+
+               public XmlDocument Xml {
+                       get { return xmlDocument; }
+               }
+               
+               internal TaskDatabase TaskDatabase {
+                       get { return taskDatabase; }
+               }
+               
+               internal BuildPropertyGroup EnvironmentProperties {
+                       set {
+                               environmentProperties = value;
+                               foreach (BuildProperty bp in environmentProperties)
+                                       evaluatedProperties.AddFromExistingProperty (bp);
+                       }
+               }
+               
+               internal BuildPropertyGroup ReservedProperties {
+                       set {
+                               reservedProperties = value;
+                               foreach (BuildProperty bp in reservedProperties)
+                                       evaluatedProperties.AddFromExistingProperty (bp);
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ProjectFileEncoding.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ProjectFileEncoding.cs
new file mode 100644 (file)
index 0000000..0be3d74
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// ProjectFileEncoding.cs: Enum for encoding of project.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public enum ProjectFileEncoding {
+               Unicode,
+               Ansi,
+               Utf8
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/PropertyPosition.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/PropertyPosition.cs
new file mode 100644 (file)
index 0000000..549c7ff
--- /dev/null
@@ -0,0 +1,33 @@
+//
+// PropertyPosition.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public enum PropertyPosition {
+               UseExistingOrCreateAfterLastPropertyGroup,
+               UseExistingOrCreateAfterLastImport
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/PropertyReference.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/PropertyReference.cs
new file mode 100644 (file)
index 0000000..5818764
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// PropertyReference.cs
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class PropertyReference {
+       
+               Expression      parent;
+               string          propertyName;
+       
+               public PropertyReference (Expression parent)
+               {
+                       if (parent == null)
+                               throw new Exception ("Parent Expression needed to find project.");
+                       this.parent = parent;
+               }
+               
+               public PropertyReference (Expression parent, string source)
+                       : this (parent)
+               {
+                       ParseSource (source);
+               }
+               
+               public void ParseSource (string source)
+               {
+                       if (source.Length < 3)
+                               throw new ArgumentException ("Invalid property.");
+                       propertyName  = source.Substring (2, source.Length - 3);
+               }
+               
+               public new string ToString ()
+               {
+                       if (propertyName != String.Empty) {
+                               Project p = parent.Project;
+                               BuildProperty bp;
+                               bp = p.EvaluatedProperties [propertyName];
+                               if (bp != null)
+                                       return bp.FinalValue;
+                               else
+                                       return String.Empty;
+                       } else
+                               return String.Empty;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/SolutionParser.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/SolutionParser.cs
new file mode 100644 (file)
index 0000000..328b2ad
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// SolutionParser.cs: Class that parses the .sln files.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public class SolutionParser {
+               private string solutionFile;
+       
+               public SolutionParser ()
+               {
+               }
+
+               public string GetProjectRelativePathByGuid (string projectGuid)
+               {
+                       return null;
+               }
+
+               public string GetProjectUniqueNameByGuid (string projectGuid)
+               {
+                       return null;
+               }
+
+               public void ParseSolutionFile ()
+               {
+               }
+
+               public string SolutionFile {
+                       get {
+                               return solutionFile;
+                       }
+                       set {
+                               solutionFile = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
new file mode 100644 (file)
index 0000000..718ff99
--- /dev/null
@@ -0,0 +1,234 @@
+//
+// Target.cs: Represents a target.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Xml;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine {
+       public class Target : ITarget, IEnumerable {
+       
+               BatchingImpl    batchingImpl;
+               BuildState      buildState;
+               XmlAttribute    condition;
+               XmlAttribute    dependsOnTargets;
+               Engine          engine;
+               bool            isImported;
+               string          name;
+               Project         project;
+               XmlElement      targetElement;
+               ArrayList       taskElements;
+               ArrayList       onErrorElements;
+               
+               internal Target (Project project, string name)
+               {
+                       if (project == null)
+                               throw new ArgumentNullException ("project");
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+                       this.buildState = BuildState.NotStarted;
+                       this.project = project;
+                       this.engine = project.ParentEngine;
+                       this.name = name;
+                       this.isImported = false;;
+                       taskElements = new ArrayList ();
+                       onErrorElements  = new ArrayList ();
+               }
+               
+               internal void BindToXml (XmlElement targetElement)
+               {
+                       if (targetElement == null)
+                               throw new ArgumentNullException ("targetElement");
+                       this.targetElement = targetElement;
+                       // FIXME: check if Target element is valid
+                       this.condition = targetElement.GetAttributeNode ("Condition");
+                       this.dependsOnTargets = targetElement.GetAttributeNode ("DependsOnTargets");
+                       this.batchingImpl = new BatchingImpl (project, this.targetElement);
+                       foreach (XmlNode xn in targetElement.ChildNodes) {
+                               if (xn is XmlElement) {
+                                       XmlElement xe = (XmlElement) xn;
+                                       if (xe.Name == "OnError") {
+                                               onErrorElements.Add (xe);
+                                               continue;
+                                       }
+                                       TaskElement te = new TaskElement ();
+                                       te.BindToXml (xe, this);
+                                       taskElements.Add (te);
+                               }
+                       }
+               }
+               
+               internal void Build ()
+               {
+                       buildState = BuildState.Started;
+                       if (dependsOnTargets == null) {
+                               ;
+                       } else if (dependsOnTargets.Value == "") {
+                               ;
+                       } else {
+                               Expression dependencies = new Expression (Project, dependsOnTargets.Value);
+                               string[] targetsToBuildFirst = (string[]) dependencies.ToArray (typeof (string[]));
+                               foreach (string target in targetsToBuildFirst) {
+                                       string trimmed = target.Trim ();
+                                       Target t = (Target) project.Targets [trimmed];
+                                       if (t == null)
+                                               throw new InvalidProjectFileException (String.Format ("Target {0} not found.", trimmed));
+                                       if (t.BuildState == BuildState.NotStarted) {
+                                               t.Build ();
+                                       }
+                                       if (t.BuildState == BuildState.Started)
+                                               throw new InvalidProjectFileException ("Cycle in target dependencies detected.");
+                               }
+                       }
+                       RealBuild ();
+                       buildState = BuildState.Finished;
+               }
+               
+               private void RealBuild ()
+               {
+                       bool executeOnErrors = false;
+                       bool result = true;
+               
+                       LogTargetStarted ();
+                       
+                       if (this.batchingImpl.BuildNeeded ()) {
+                               foreach (TaskElement te in taskElements) {
+                                       if (this.batchingImpl.BatchTaskElement (te) == false && te.ContinueOnError == false) {
+                                               executeOnErrors = true;
+                                               result = false;
+                                               break;
+                                       }
+                               }
+                       } else {
+                               LogTargetSkipped ();
+                       }
+
+                       LogTargetFinished (result);
+                       
+                       if (executeOnErrors == true)
+                               ExecuteOnErrors ();
+               }
+               
+               private void ExecuteOnErrors ()
+               {
+                       foreach (XmlElement onError in onErrorElements) {
+                               // FIXME: add condition
+                               if (onError.GetAttribute ("ExecuteTargets") == String.Empty)
+                                       throw new InvalidProjectFileException ("ExecuteTargets attribute is required in OnError element.");
+                               string[] targetsToExecute = onError.GetAttribute ("ExecuteTargets").Split (';');
+                               foreach (string t in targetsToExecute)
+                                       this.project.Targets [t].Build ();
+                       }
+               }
+               
+               private void LogTargetSkipped ()
+               {
+                       BuildMessageEventArgs bmea;
+                       bmea = new BuildMessageEventArgs (String.Format ("Skipping target \"{0}\" because its outputs are up-to-date.",
+                               name), null, "MSBuild", MessageImportance.Normal);
+                       engine.EventSource.FireMessageRaised (this, bmea);
+               }
+               
+               private void LogTargetStarted ()
+               {
+                       TargetStartedEventArgs tsea;
+                       string projectFile = project.FullFileName;
+                       tsea = new TargetStartedEventArgs ("Target " + name + " started.", null, name, projectFile, null);
+                       engine.EventSource.FireTargetStarted (this, tsea);
+               }
+               
+               private void LogTargetFinished (bool succeeded)
+               {
+                       TargetFinishedEventArgs tfea;
+                       string projectFile = project.FullFileName;
+                       tfea = new TargetFinishedEventArgs ("Target " + name + " finished.", null, name, projectFile, null, succeeded);
+                       engine.EventSource.FireTargetFinished (this, tfea);
+               }
+               
+               public TaskElement AddNewTaskElement (string taskName)
+               {
+                       TaskElement te = new TaskElement ();
+                       taskElements.Add (te);
+                       return te;
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                       foreach (TaskElement te in taskElements) {
+                               yield return te;
+                       }
+               }
+
+               public void RemoveTaskElement (TaskElement taskElement)
+               {
+                       taskElements.Remove (taskElement);
+               }
+
+               public string Condition {
+                       get { return condition.Value; }
+                       set { condition.Value = value; }
+               }
+
+               public string DependsOnTargets {
+                       get {
+                               if (dependsOnTargets == null)
+                                       return null;
+                               else
+                                       return dependsOnTargets.Value;
+                       }
+                       set {
+                               if (dependsOnTargets != null)
+                                       dependsOnTargets.Value = value;
+                       }
+               }
+
+               public bool IsImported {
+                       get { return isImported; }
+                       internal set { isImported = value; }
+               }
+
+               public string Name {
+                       get { return name; }
+               }
+               
+               internal Project Project {
+                       get { return project; }
+               }
+               
+               internal BuildState BuildState {
+                       get { return buildState; }
+               }
+       }
+       
+       internal enum BuildState {
+               NotStarted,
+               Started,
+               Finished,
+               Skipped
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TargetCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TargetCollection.cs
new file mode 100644 (file)
index 0000000..4c9722f
--- /dev/null
@@ -0,0 +1,121 @@
+//
+// TargetCollection.cs: Collection of targets.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace Microsoft.Build.BuildEngine {
+       public class TargetCollection : ITargetCollection, ICollection, IEnumerable {
+               
+               IDictionary     targetsByName;
+               Project         parentProject;
+       
+               internal TargetCollection (Project project)
+               {
+                       this.targetsByName = new Hashtable ();
+                       this.parentProject = project;
+               }
+       
+               public Target AddNewTarget (string targetName)
+               {
+                       Target t;
+                       
+                       t = new Target (parentProject, targetName);
+                       targetsByName.Add (targetName, t);
+                       
+                       return t;
+               }
+
+               public void CopyTo (Array array, int index)
+               {
+                       targetsByName.Values.CopyTo (array, index);
+               }
+
+               public void CopyToStronglyTypedArray (Target[] array,
+                                                     int index)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("index");
+                       if (array.Rank > 1)
+                               throw new ArgumentException ("array is multidimensional");
+                       if ((array.Length > 0) && (index >= array.Length))
+                               throw new ArgumentException ("index is equal or greater than array.Length");
+                       if (index + targetsByName.Count > array.Length)
+                               throw new ArgumentException ("Not enough room from index to end of array for this BuildPropertyGroupCollection");
+               
+                       IEnumerator it = GetEnumerator ();
+                       int i = index;
+                       while (it.MoveNext ()) {
+                               array.SetValue((Target) it.Current, i++);
+                       }
+               }
+
+               public bool Exists (string targetName)
+               {
+                       return targetsByName.Contains (targetName);
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                       foreach (DictionaryEntry de in targetsByName) {
+                               yield return (Target)de.Key;
+                       }
+               }
+
+               public void RemoveTarget (Target targetToRemove)
+               {
+                       targetsByName.Remove (targetToRemove.Name);
+               }
+
+               public int Count {
+                       get {
+                               return targetsByName.Count;
+                       }
+               }
+
+               public bool IsSynchronized {
+                       get {
+                               return false;
+                       }
+               }
+
+               public object SyncRoot {
+                       get {
+                               return this;
+                       }
+               }
+
+               public Target this[string index] {
+                       get {
+                               return (Target) targetsByName [index];
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskDatabase.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskDatabase.cs
new file mode 100644 (file)
index 0000000..32b4c05
--- /dev/null
@@ -0,0 +1,85 @@
+//
+// TaskDatabase.cs: Provides information about tasks.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Reflection;
+using Microsoft.Build.Framework;
+using Mono.XBuild.Shared;
+
+namespace Microsoft.Build.BuildEngine {
+       internal class TaskDatabase {
+               
+               // full name -> AssemblyLoadInfo
+               IDictionary     assemblyInformation;
+               // full name -> Type
+               IDictionary     typesByFullName;
+               // short name -> Type
+               IDictionary     typesByShortName;
+       
+               public TaskDatabase ()
+               {
+                       assemblyInformation = new Hashtable ();
+                       typesByFullName = new Hashtable ();
+                       typesByShortName = new Hashtable ();
+               }
+               
+               public void RegisterTask (string classname, AssemblyLoadInfo assemblyLoadInfo)
+               {
+                       assemblyInformation.Add (classname, assemblyLoadInfo);
+                       Assembly assembly;
+                       if (assemblyLoadInfo.InfoType == LoadInfoType.AssemblyFilename) {
+                               assembly = Assembly.LoadFrom (assemblyLoadInfo.Filename);
+                       } else if (assemblyLoadInfo.InfoType == LoadInfoType.AssemblyName) {
+                               assembly = Assembly.Load (assemblyLoadInfo.AssemblyName);
+                       } else {
+                               assembly = Assembly.Load (assemblyLoadInfo.AssemblyNameString);
+                       }
+                       Type type = assembly.GetType (classname);
+                       typesByFullName.Add (classname, type);
+                       typesByShortName.Add (GetShortName (classname), type);
+               }
+               
+               public Type GetTypeFromClassName (string classname)
+               {
+                       if (typesByFullName.Contains (classname) == false) {
+                               if (typesByShortName.Contains (classname) == false)
+                                       throw new Exception ("Not registered task.");
+                               else {
+                                       return (Type) typesByShortName [classname];
+                               }
+                       } else
+                               return (Type) typesByFullName [classname];
+               }
+               
+               private string GetShortName (string fullname)
+               {
+                       string[] parts = fullname.Split ('.');
+                       return parts [parts.Length - 1];
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskElement.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskElement.cs
new file mode 100644 (file)
index 0000000..da5a7c0
--- /dev/null
@@ -0,0 +1,341 @@
+//
+// TaskElement.cs: Represents XML element that is a task.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Reflection;
+using System.Xml;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.BuildEngine {
+       public class TaskElement : ITaskElement {
+       
+               XmlAttribute    condition;
+               XmlAttribute    continueOnError;
+               XmlElement      taskElement;
+               Target          parentTarget;
+               object          hostObject;
+               string          name;
+               bool            isImported;
+               
+               static Type     requiredAttribute;
+               static Type     outputAttribute;
+               
+               public TaskElement ()
+               {
+                       this.isImported = false;
+               }
+               
+               static TaskElement ()
+               {
+                       requiredAttribute = typeof (Microsoft.Build.Framework.RequiredAttribute);
+                       outputAttribute = typeof (Microsoft.Build.Framework.OutputAttribute);
+               }
+
+               public bool Execute ()
+               {
+                       bool result;
+                       string rawParameter;
+                       string[] parameterNames;
+                       PropertyInfo[] properties;
+                       PropertyInfo currentProperty;
+                       Hashtable values = new Hashtable ();
+                       Task task;
+                       object value;
+               
+                       LogTaskStarted ();
+                       
+                       task = (Task)Activator.CreateInstance (Type);
+                       task.BuildEngine = new BuildEngine (parentTarget.Project.ParentEngine, 0, 0,
+                               ContinueOnError, parentTarget.Project.FullFileName);
+                       parameterNames = GetParameterNames ();
+                       foreach (string parameter in parameterNames) {
+                               currentProperty = GetType ().GetProperty (parameter);
+                               if (currentProperty == null)
+                                       throw new InvalidProjectFileException (String.Format ("Task does not have property \"{0}\" defined",
+                                               parameter));
+                               rawParameter = GetParameterValue (parameter);
+                               value = GetObjectFromString (rawParameter, currentProperty.PropertyType);
+                               values.Add (parameter, value);
+                       }
+                       
+                       properties = GetType().GetProperties ();
+                       foreach (PropertyInfo pi in properties) {
+                               if (pi.IsDefined (requiredAttribute, false) && values.ContainsKey (pi.Name) == false) {
+                                       throw new InvalidProjectFileException ("Required property not set.");
+                               }
+                               if (values.ContainsKey (pi.Name)) {
+                                       pi.SetValue (task, values [pi.Name], null);
+                               }
+                       }
+                       
+                       result = task.Execute ();
+                       
+                       // output
+                       
+                       foreach (XmlNode xn in taskElement.ChildNodes) {
+                               if (xn is XmlElement) {
+                                       XmlElement xe = (XmlElement) xn;
+                                       PropertyInfo pi;
+                                       string property, parameter, item;
+                                       object o;
+                                       Project p;
+                                       
+                                       if (xe.Name != "Output")
+                                               throw new InvalidProjectFileException ("Only Output elements can be Task's child nodes.");
+                                       if (xe.GetAttribute ("ItemName") != "" && xe.GetAttribute ("PropertyName") != "")
+                                               throw new InvalidProjectFileException ("Only one of ItemName and ProperytyName attributes can be specified.");
+                                       if (xe.GetAttribute ("TaskParameter") == "")
+                                               throw new InvalidProjectFileException ("TaskParameter attribute must be specified.");
+                                               
+                                       property = xe.GetAttribute ("PropertyName");
+                                       parameter = xe.GetAttribute ("TaskParameter");
+                                       item = xe.GetAttribute ("ItemName");
+                                       p = parentTarget.Project;
+                                       
+                                       pi = GetType ().GetProperty (parameter);
+                                       if (pi == null)
+                                               throw new Exception ("Could not get property info.");
+                                       if (pi.IsDefined (outputAttribute, false) == false)
+                                               throw new Exception ("This is not output property.");
+                                       
+                                       o = pi.GetValue (task, null);
+                                       if (o == null)
+                                               continue;
+                                       if (xe.GetAttribute ("ItemName") != "") {
+                                               BuildItemGroup newItems = HandleItemGroup (pi, o, item);
+                                               if (p.EvaluatedItemsByName.Contains (item)) {
+                                                       BuildItemGroup big = (BuildItemGroup) p.EvaluatedItemsByName [item];
+                                                       big.Clear ();
+                                                       p.EvaluatedItemsByName.Remove (item);
+                                                       p.EvaluatedItemsByName.Add (item, newItems);
+                                               } else {
+                                                       p.EvaluatedItemsByName.Add (item, newItems);
+                                               }
+                                       } else {
+                                               BuildProperty bp = HandleProperty (pi, o, property);
+                                               p.EvaluatedProperties.AddFromExistingProperty (bp);
+                                       }
+                               }
+                       }
+                       
+                       // end of output
+                       
+                       LogTaskFinished (result);
+                       
+                       return result;
+               }
+               
+               private BuildProperty HandleProperty (PropertyInfo propertyInfo, object o, string name)
+               {
+                       string output = null;
+                       BuildProperty bp;
+                       
+                       if (propertyInfo == null)
+                               throw new ArgumentNullException ("propertyInfo");
+                       if (o == null)
+                               throw new ArgumentNullException ("o");
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+                       
+                       if (propertyInfo.PropertyType == typeof (ITaskItem)) {
+                               ITaskItem item = (ITaskItem) o;
+                               bp = ChangeType.TransformToBuildProperty (name, item);
+                       } else if (propertyInfo.PropertyType == typeof (ITaskItem[])) {
+                               ITaskItem[] items = (ITaskItem[]) o;
+                               bp = ChangeType.TransformToBuildProperty (name, items);
+                       } else {
+                               if (propertyInfo.PropertyType.IsArray == true) {
+                                       output = ChangeType.TransformToString ((object[])o, propertyInfo.PropertyType);
+                       } else {
+                                       output = ChangeType.TransformToString (o, propertyInfo.PropertyType);
+                               }
+                               bp = ChangeType.TransformToBuildProperty (name, output);
+                       }
+                       return bp;
+               }
+               
+               private BuildItemGroup HandleItemGroup (PropertyInfo propertyInfo, object o, string name)
+               {
+                       BuildItemGroup big;
+                       string temp;
+                       
+                       if (propertyInfo == null)
+                               throw new ArgumentNullException ("propertyInfo");
+                       if (o == null)
+                               throw new ArgumentNullException ("o");
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+                               
+                       if (propertyInfo.PropertyType == typeof (ITaskItem)) {
+                               ITaskItem item = (ITaskItem) o;
+                               big = ChangeType.TransformToBuildItemGroup (name, item);
+                       } else if (propertyInfo.PropertyType == typeof (ITaskItem[])) {
+                               ITaskItem[] items = (ITaskItem[]) o;
+                               big = ChangeType.TransformToBuildItemGroup (name, items);
+                       } else {
+                               if (propertyInfo.PropertyType.IsArray == true) {
+                                       temp = ChangeType.TransformToString ((object[]) o, propertyInfo.PropertyType);
+                               } else {
+                                       temp = ChangeType.TransformToString (o, propertyInfo.PropertyType);
+                               }
+                               big = ChangeType.TransformToBuildItemGroup (name, temp);
+                       }
+                       return big;     
+               }
+
+               public string[] GetParameterNames ()
+               {
+                       int attributesCount = 0;
+                       ArrayList tempNames = new ArrayList ();
+                       string[] names;
+                       
+                       foreach (XmlAttribute xmlAttribute in taskElement.Attributes) {
+                               if (xmlAttribute.Name == "Condition")
+                                       continue;
+                               if (xmlAttribute.Name == "ContinueOnError")
+                                       continue;
+                               tempNames.Add (xmlAttribute.Name);
+                       }
+                       names = new string [tempNames.Count];
+                       foreach (string name in tempNames)
+                               names [attributesCount++] = name;
+                       return names;
+               }
+
+               public string GetParameterValue (string attributeName)
+               {
+                       return taskElement.GetAttribute (attributeName);
+               }
+               
+               private object GetObjectFromString (string raw, Type type)
+               {
+                       Expression e;
+                       object result;
+                       
+                       e = new Expression (parentTarget.Project, raw);
+                       
+                       if (type == typeof (ITaskItem)) {
+                               result = (object) e.ToITaskItem ();
+                       } else if (type == typeof (ITaskItem[])) {
+                               result = (object) e.ToITaskItemArray ();
+                       } else {
+                               if (type.IsArray) {
+                                       result = e.ToArray (type);
+                               } else {
+                                       result = e.ToNonArray (type);
+                               }
+                       }
+                       
+                       return result;
+               }
+
+               public void SetParameterValue (string parameterName,
+                                              string parameterValue)
+               {
+                       taskElement.SetAttribute (parameterName, parameterValue);
+               }
+               
+               internal void BindToXml (XmlElement taskElement,
+                                        Target parentTarget)
+               {
+                       if (taskElement == null)
+                               throw new ArgumentNullException ("taskElement");
+                       if (parentTarget == null)
+                               throw new ArgumentNullException ("parentTarget");
+                       this.taskElement =  taskElement;
+                       this.parentTarget = parentTarget;
+                       this.condition = taskElement.GetAttributeNode ("Condition");
+                       this.continueOnError = taskElement.GetAttributeNode ("ContinueOnError");
+                       this.name  = taskElement.Name;
+               }
+               
+               private void LogTaskStarted ()
+               {
+                       TaskStartedEventArgs tsea = new TaskStartedEventArgs ("Task started.", null, parentTarget.Project.FullFileName,
+                               parentTarget.Project.FullFileName, taskElement.Name);
+                       parentTarget.Project.ParentEngine.EventSource.FireTaskStarted (this, tsea);
+               }
+               
+               private void LogTaskFinished (bool succeeded)
+               {
+                       TaskFinishedEventArgs tfea = new TaskFinishedEventArgs ("Task finished.", null, parentTarget.Project.FullFileName,
+                               parentTarget.Project.FullFileName, taskElement.Name, succeeded);
+                       parentTarget.Project.ParentEngine.EventSource.FireTaskFinished (this, tfea);
+               }
+               
+               private new Type GetType ()
+               {
+                       return parentTarget.Project.TaskDatabase.GetTypeFromClassName (name);
+               }
+
+               public string Condition {
+                       get {
+                               return condition.Value;
+                       }
+                       set {
+                               condition.Value = value;
+                       }
+               }
+
+               public bool ContinueOnError {
+                       get {
+                               // FIXME: insert here text parsing
+                               if (continueOnError == null)
+                                       return false;
+                               else
+                                       return Boolean.Parse (continueOnError.Value);
+                       }
+                       set {
+                               continueOnError.Value = value.ToString ();
+                       }
+               }
+
+               public object HostObject {
+                       get {
+                               return hostObject;
+                       }
+                       set {
+                               hostObject = value;
+                       }
+               }
+
+               public string Name {
+                       get {
+                               return name;
+                       }
+               }
+
+               public Type Type {
+                       get {
+                               return GetType ();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskEngineAssemblyResolver.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskEngineAssemblyResolver.cs
new file mode 100644 (file)
index 0000000..dae9c69
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// TaskEngineAssemblyResolver.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.BuildEngine {
+       public class TaskEngineAssemblyResolver : MarshalByRefObject {
+               public TaskEngineAssemblyResolver ()
+               {
+               }
+
+               public override object InitializeLifetimeService ()
+               {
+                       return null;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Utilities.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Utilities.cs
new file mode 100644 (file)
index 0000000..4c455e0
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// Utilities.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public class Utilities : ILangSecurityLevelChecker, ICultureStringUtilities {
+               public Utilities ()
+               {
+               }
+
+               public bool CheckPath (string path, int zone)
+               {
+                       return true;
+               }
+
+               public string[] GetSupportedCultures ()
+               {
+                       return null;
+               }
+
+               public bool ValidateCulture (string culture)
+               {
+                       return true;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/WriteHandler.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/WriteHandler.cs
new file mode 100644 (file)
index 0000000..d60bd5b
--- /dev/null
@@ -0,0 +1,30 @@
+//
+// WriteHandler.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       public delegate void WriteHandler (string message);
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Xml.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Xml.cs
new file mode 100644 (file)
index 0000000..80bb186
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// Xml.cs: Contains definitions of XML namespaces.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.BuildEngine {
+       internal class Xml {
+               public static string Namespace = "http://schemas.microsoft.com/developer/msbuild/2003"; 
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/conditions.jay b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/conditions.jay
new file mode 100644 (file)
index 0000000..fe603ab
--- /dev/null
@@ -0,0 +1,40 @@
+Expr           :       Expr TOKEN_AND Boolean-term
+               |       Boolean-term
+               ;       
+
+Boolean-term   :       Boolean-term TOKEN_OR Relational-expr
+               |       Relational-expr
+               ;       
+
+Relational-expr        :       Factor TOKEN_LT Factor
+               |       Factor TOKEN_GT Factor
+               |       Factor TOKEN_GTE Factor
+               |       Factor TOKEN_LTE Factor
+               |       Factor TOKEN_EQ Factor
+               |       Factor TOKEN_NEQ Factor
+               |       Factor
+               ;
+
+Factor         :       TOKEN_LPAREN Expr TOKEN_RPAREN
+               |       TOKEN_STRING
+               |       TOKEN_NUMBER
+               |       TOKEN_PROPERTY
+               |       TOKEN_ITEMLIST
+               |       TOKEN_FUNCTIONNAME TOKEN_LPAREN Arg-list TOKEN_RPAREN
+               |       TOKEN_NOT Factor
+               ;
+
+Arg-list       :       Args
+               |       ε /*empty sign in utf-8 probably should be just empty*/
+               ;
+
+Args           :       Arg TOKEN_COMMA Args
+               |       Arg
+               ;
+
+Arg            :       TOKEN_STRING
+               |       TOKEN_NUMBER
+               |       TOKEN_PROPERTY
+               |       TOKEN_ITEMLIST
+               ;
+
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
new file mode 100644 (file)
index 0000000..6f95701
--- /dev/null
@@ -0,0 +1,60 @@
+../../build/common/Consts.cs
+Assembly/AssemblyInfo.cs
+Microsoft.Build.BuildEngine/BatchingImpl.cs
+Microsoft.Build.BuildEngine/BuildChoose.cs
+Microsoft.Build.BuildEngine/BuildEngine.cs
+Microsoft.Build.BuildEngine/BuildItem.cs
+Microsoft.Build.BuildEngine/BuildItemGroupCollection.cs
+Microsoft.Build.BuildEngine/BuildItemGroup.cs
+Microsoft.Build.BuildEngine/BuildProperty.cs
+Microsoft.Build.BuildEngine/BuildPropertyGroupCollection.cs
+Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
+Microsoft.Build.BuildEngine/BuildSettings.cs
+Microsoft.Build.BuildEngine/BuildWhen.cs
+Microsoft.Build.BuildEngine/ChangeType.cs
+Microsoft.Build.BuildEngine/ConsoleLogger.cs
+Microsoft.Build.BuildEngine/DirectoryScanner.cs
+Microsoft.Build.BuildEngine/Engine.cs
+Microsoft.Build.BuildEngine/EventSource.cs
+Microsoft.Build.BuildEngine/Expression.cs
+Microsoft.Build.BuildEngine/FileLogger.cs
+Microsoft.Build.BuildEngine/GlobalEngineAccessor.cs
+Microsoft.Build.BuildEngine/GroupingCollection.cs
+Microsoft.Build.BuildEngine/HostLogger.cs
+Microsoft.Build.BuildEngine/IBuildItem.cs
+Microsoft.Build.BuildEngine/IBuildItemGroupCollection.cs
+Microsoft.Build.BuildEngine/IBuildItemGroup.cs
+Microsoft.Build.BuildEngine/IBuildProperty.cs
+Microsoft.Build.BuildEngine/IBuildPropertyGroupCollection.cs
+Microsoft.Build.BuildEngine/IBuildPropertyGroup.cs
+Microsoft.Build.BuildEngine/ICultureStringUtilities.cs
+Microsoft.Build.BuildEngine/IEngine.cs
+Microsoft.Build.BuildEngine/IGlobalEngineAccessor.cs
+Microsoft.Build.BuildEngine/IHostFeedback.cs
+Microsoft.Build.BuildEngine/IHostLogger.cs
+Microsoft.Build.BuildEngine/ILangSecurityLevelChecker.cs
+Microsoft.Build.BuildEngine/ImportedProject.cs
+Microsoft.Build.BuildEngine/InternalLoggerException.cs
+Microsoft.Build.BuildEngine/InvalidProjectFileException.cs
+Microsoft.Build.BuildEngine/IProject.cs
+Microsoft.Build.BuildEngine/ITargetCollection.cs
+Microsoft.Build.BuildEngine/ITarget.cs
+Microsoft.Build.BuildEngine/ITaskElement.cs
+Microsoft.Build.BuildEngine/ItemPropertyGroupingBase.cs
+Microsoft.Build.BuildEngine/ItemReference.cs
+Microsoft.Build.BuildEngine/MetadataReference.cs
+Microsoft.Build.BuildEngine/MonoTODOAttribute.cs
+Microsoft.Build.BuildEngine/ProcessingPass.cs
+Microsoft.Build.BuildEngine/Project.cs
+Microsoft.Build.BuildEngine/ProjectFileEncoding.cs
+Microsoft.Build.BuildEngine/PropertyPosition.cs
+Microsoft.Build.BuildEngine/PropertyReference.cs
+Microsoft.Build.BuildEngine/SolutionParser.cs
+Microsoft.Build.BuildEngine/TargetCollection.cs
+Microsoft.Build.BuildEngine/Target.cs
+Microsoft.Build.BuildEngine/TaskDatabase.cs
+Microsoft.Build.BuildEngine/TaskElement.cs
+Microsoft.Build.BuildEngine/TaskEngineAssemblyResolver.cs
+Microsoft.Build.BuildEngine/Utilities.cs
+Microsoft.Build.BuildEngine/WriteHandler.cs
+Microsoft.Build.BuildEngine/Xml.cs
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.mdp b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.mdp
new file mode 100644 (file)
index 0000000..c9c6336
--- /dev/null
@@ -0,0 +1,85 @@
+<Project name="Microsoft.Build.Engine" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="Microsoft.Build.Engine" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="Microsoft.Build.Engine" />
+      <Build debugmode="False" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./Microsoft.Build.BuildEngine/BatchingImpl.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildChoose.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildEngine.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildItem.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildItemGroup.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildItemGroupCollection.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildProperty.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildPropertyGroup.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildPropertyGroupCollection.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildSettings.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildWhen.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ConsoleLogger.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/Engine.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/EventSource.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/FileLogger.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/GlobalEngineAccessor.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/GroupingCollection.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/HostLogger.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IBuildItem.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IBuildItemGroup.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IBuildItemGroupCollection.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IBuildProperty.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IBuildPropertyGroup.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IBuildPropertyGroupCollection.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ICultureStringUtilities.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IEngine.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IGlobalEngineAccessor.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IHostFeedback.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IHostLogger.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ILangSecurityLevelChecker.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ImportedProject.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/InternalLoggerException.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/InvalidProjectFileException.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/IProject.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ITarget.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ITargetCollection.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ITaskElement.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ItemPropertyGroupingBase.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/MonoTODOAttribute.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ProcessingPass.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/Project.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ProjectFileEncoding.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/PropertyPosition.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/SolutionParser.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/Target.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/TargetCollection.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/TaskDatabase.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/TaskElement.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/TaskEngineAssemblyResolver.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/Utilities.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/WriteHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/Xml.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/Expression.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/PropertyReference.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ItemReference.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/MetadataReference.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ChangeType.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/DirectoryScanner.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Framework" />
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Utilities" />
+    <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+    <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.mds b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.mds
new file mode 100644 (file)
index 0000000..ec1d230
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="Microsoft.Build.Engine" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Engine" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Engine" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="Microsoft.Build.Engine" single="True">
+    <Execute type="None" entry="Microsoft.Build.Engine" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./Microsoft.Build.Engine.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.targets b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.targets
new file mode 100644 (file)
index 0000000..5890f43
--- /dev/null
@@ -0,0 +1,21 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <ItemGroup>
+               <MicrosoftBuildEngineSources Include="Microsoft.Build.Engine/Microsoft.Build.BuildEngine/*.cs" />
+               <MicrosoftBuildEngineDll Include="Microsoft.Build.Engine.dll" />
+               <MicrosoftBuildEngineReferences Include="Microsoft.Build.Framework.dll;Microsoft.Build.Utilities.dll" />
+       </ItemGroup>
+       <Target
+               Name="MicrosoftBuildEngine"
+               DependsOnTargets="MicrosoftBuildFramework;MicrosoftBuildUtilities"
+               Inputs="@(MicrosoftBuildEngineSources)"
+               Outputs="@(MicrosoftBuildEngineDll)"
+       >
+               <Csc
+                       Sources="@(MicrosoftBuildEngineSources)"
+                       TargetType="library"
+                       OutputAssembly="@(MicrosoftBuildEngineDll)"
+                       References="@(MicrosoftBuildEngineReferences)"
+                       WarningLevel="3"
+               />
+       </Target>
+</Project>
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources
new file mode 100644 (file)
index 0000000..66590b8
--- /dev/null
@@ -0,0 +1,4 @@
+Microsoft.Build.BuildEngine/EngineTest.cs
+Microsoft.Build.BuildEngine/InternalLoggerExceptionTest.cs
+Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs
+Microsoft.Build.BuildEngine/ProjectTest.cs
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
new file mode 100644 (file)
index 0000000..2153c50
--- /dev/null
@@ -0,0 +1,8 @@
+2005-09-03  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * ProjectTest.cs, EngineTest.cs: Added next simple tests.
+
+2005-08-31  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * InternalLoggerExceptionTest.cs, InvalidProjectFileExceptionTest.cs:
+       Added simple tests.
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
new file mode 100644 (file)
index 0000000..9ab95df
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// EngineTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine {
+       [TestFixture]
+       public class EngineTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       IEngine engine;
+                       string binPath = "binPath";
+                       
+                       engine = new Engine (binPath);
+                       
+                       Assert.AreEqual (binPath, engine.BinPath, "BinPath");
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InternalLoggerExceptionTest.cs b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InternalLoggerExceptionTest.cs
new file mode 100644 (file)
index 0000000..ab35ad5
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// InternalLoggerExceptionTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine {
+       [TestFixture]
+       public class InternalLoggerExceptionTest {
+               [Test]
+               public void CtorMessageTest ()
+               {
+                       InternalLoggerException ile;
+                       string message = "message";
+                       
+                       ile = new InternalLoggerException (message);
+                       
+                       Assert.AreEqual (message, ile.Message, "Message");
+               }
+               
+               [Test]
+               public void CtorMessageExceptionTest ()
+               {
+                       InternalLoggerException ile;
+                       string message = "message";
+                       Exception e = new Exception ("Inner exception message.");
+                       
+                       ile = new InternalLoggerException (message, e);
+                       
+                       Assert.AreEqual (message, ile.Message, "Message");
+                       Assert.AreEqual (e, ile.InnerException, "InnerException");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs
new file mode 100644 (file)
index 0000000..4f782fb
--- /dev/null
@@ -0,0 +1,107 @@
+//
+// InvalidProjectFileExceptionTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine {
+       [TestFixture]
+       public class InvalidProjectFileExceptionTest {
+               [Test]
+               public void CtorMessageTest ()
+               {
+                       InvalidProjectFileException ipfe;
+                       string message = "message";
+                       
+                       ipfe = new InvalidProjectFileException (message);
+                       
+                       Assert.AreEqual (message, ipfe.Message, "Message");
+               }
+               
+               [Test]
+               public void CtorProjectFileTest ()
+               {
+                       InvalidProjectFileException ipfe;
+                       string projectFile = "projectFile";
+                       int lineNumber = 1;
+                       int columnNumber = 2;
+                       int endLineNumber = 3;
+                       int endColumnNumber = 4;
+                       string message = "message";
+                       string errorSubcategory = "errorSubcategory";
+                       string errorCode = "CS0000";
+                       string helpKeyword = "helpKeyword";
+                       
+                       ipfe = new InvalidProjectFileException (projectFile, lineNumber, columnNumber, endLineNumber, endColumnNumber,
+                               message, errorSubcategory, errorCode, helpKeyword);
+                       
+                       Assert.AreEqual (projectFile, ipfe.ProjectFile, "ProjectFile");
+                       Assert.AreEqual (lineNumber, ipfe.LineNumber, "LineNumber");
+                       Assert.AreEqual (columnNumber, ipfe.ColumnNumber, "ColumnNumber");
+                       Assert.AreEqual (endLineNumber, ipfe.EndLineNumber, "EndLineNumber");
+                       Assert.AreEqual (endColumnNumber, ipfe.EndColumnNumber, "EndColumnNumber");
+                       Assert.AreEqual (message, ipfe.Message, "Message");
+                       Assert.AreEqual (errorSubcategory, ipfe.ErrorSubcategory, "ErrorSubcategory");
+                       Assert.AreEqual (errorCode, ipfe.ErrorCode, "ErrorCode");
+                       Assert.AreEqual (helpKeyword, ipfe.HelpKeyword, "HelpKeyword");
+               }
+               
+               [Test]
+               public void CtorMessageExceptionTest ()
+               {
+                       InvalidProjectFileException ipfe;
+                       string message = "message";
+                       Exception e = new Exception ("Exception message");
+                       
+                       ipfe = new InvalidProjectFileException (message, e);
+                       
+                       Assert.AreEqual (message, ipfe.Message, "Message");
+                       Assert.AreEqual (e, ipfe.InnerException, "InnerException");
+               }
+               
+               [Test]
+               public void CtorNode ()
+               {
+                       InvalidProjectFileException ipfe;
+                       XmlDocument xd = new XmlDocument ();
+                       XmlNode xn = xd.CreateElement ("Element");
+                       string message = "message";
+                       string errorSubcategory = "errorSubcategory";
+                       string errorCode = "CS0000";
+                       string helpKeyword = "helpKeyword";
+                       
+                       ipfe = new InvalidProjectFileException (xn, message, errorSubcategory, errorCode, helpKeyword);
+                       
+                       Assert.AreEqual (message, ipfe.Message, "Message");
+                       Assert.AreEqual (errorSubcategory, ipfe.ErrorSubcategory, "ErrorSubcategory");
+                       Assert.AreEqual (errorCode, ipfe.ErrorCode, "ErrorCode");
+                       Assert.AreEqual (helpKeyword, ipfe.HelpKeyword, "HelpKeyword");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
new file mode 100644 (file)
index 0000000..c9c8676
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// ProjectTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine {
+       [TestFixture]
+       public class ProjectTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       IEngine engine;
+                       IProject project;
+                       string binPath = "binPath";
+                       XmlDocument xd;
+                       string documentString =
+                       "<Project></Project>";
+                       
+                       engine = new Engine (binPath);
+                       project = engine.CreateNewProject ();
+                       xd = new XmlDocument ();
+                       xd.LoadXml (documentString);
+                       project.LoadFromXml (xd);
+                       
+                       Assert.AreEqual (String.Empty, project.FullFileName, "FullFileName");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp
new file mode 100644 (file)
index 0000000..a932eb2
--- /dev/null
@@ -0,0 +1,31 @@
+<Project name="Microsoft.Build.Engine.Test" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="Microsoft.Build.Engine.Test" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="Microsoft.Build.Engine.Test" />
+      <Build debugmode="False" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./Microsoft.Build.BuildEngine/InternalLoggerExceptionTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/EngineTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/ProjectTest.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+    <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+    <ProjectReference type="Gac" localcopy="True" refto="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Engine" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mds b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mds
new file mode 100644 (file)
index 0000000..c8e69ea
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="Microsoft.Build.Engine.Test" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Engine.Test" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Engine.Test" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="Microsoft.Build.Engine.Test" single="True">
+    <Execute type="None" entry="Microsoft.Build.Engine.Test" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./Microsoft.Build.Engine.Test.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Build.Framework/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..0593ebf
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Marek Sieradzki (mare.sieradzki@gmail.com
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the Microsoft.Build.Framework assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyTitle("Microsoft.Build.Framework.dll")]
+[assembly: AssemblyDescription("Microsoft.Build.Framework.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("Marek Sieradzki")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2005 Marek Sieradzki")]
+[assembly: AssemblyTrademark("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: AssemblyDefaultAlias("Microsoft.Build.Framework.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: ComVisible(false)]
+[assembly: AllowPartiallyTrustedCallers]
+
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
diff --git a/mcs/class/Microsoft.Build.Framework/ChangeLog b/mcs/class/Microsoft.Build.Framework/ChangeLog
new file mode 100644 (file)
index 0000000..5ce56e3
--- /dev/null
@@ -0,0 +1,3 @@
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Microsoft.Build.Framework_test.dll.sources: Added.
diff --git a/mcs/class/Microsoft.Build.Framework/Makefile b/mcs/class/Microsoft.Build.Framework/Makefile
new file mode 100644 (file)
index 0000000..dad3d4c
--- /dev/null
@@ -0,0 +1,18 @@
+thisdir = class/Microsoft.Build.Framework
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = Microsoft.Build.Framework.dll
+
+ifeq (1.0, $(FRAMEWORK_VERSION))
+LIBRARY_NAME = dummy-Microsoft.Build.Framework.dll
+NO_INSTALL = yes
+NO_TEST = yes
+NO_SIGN_ASSEMBLY = yes
+endif
+
+LIB_MCS_FLAGS = \
+       /r:$(corlib)                            \
+       /r:System.dll
+
+include ../../build/library.make
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources
new file mode 100644 (file)
index 0000000..4747e72
--- /dev/null
@@ -0,0 +1,43 @@
+../../build/common/Consts.cs
+Assembly/AssemblyInfo.cs
+Microsoft.Build.Framework/AnyEventHandler.cs
+Microsoft.Build.Framework/BuildErrorEventArgs.cs
+Microsoft.Build.Framework/BuildErrorEventHandler.cs
+Microsoft.Build.Framework/BuildEventArgs.cs
+Microsoft.Build.Framework/BuildFinishedEventArgs.cs
+Microsoft.Build.Framework/BuildFinishedEventHandler.cs
+Microsoft.Build.Framework/BuildMessageEventArgs.cs
+Microsoft.Build.Framework/BuildMessageEventHandler.cs
+Microsoft.Build.Framework/BuildStartedEventArgs.cs
+Microsoft.Build.Framework/BuildStartedEventHandler.cs
+Microsoft.Build.Framework/BuildStatusEventArgs.cs
+Microsoft.Build.Framework/BuildStatusEventHandler.cs
+Microsoft.Build.Framework/BuildWarningEventArgs.cs
+Microsoft.Build.Framework/BuildWarningEventHandler.cs
+Microsoft.Build.Framework/CustomBuildEventArgs.cs
+Microsoft.Build.Framework/CustomBuildEventHandler.cs
+Microsoft.Build.Framework/IBuildEngine.cs
+Microsoft.Build.Framework/IEventSource.cs
+Microsoft.Build.Framework/ILogger.cs
+Microsoft.Build.Framework/ITask.cs
+Microsoft.Build.Framework/ITaskItem.cs
+Microsoft.Build.Framework/LoadInSeparateAppDomainAttribute.cs
+Microsoft.Build.Framework/LoggerException.cs
+Microsoft.Build.Framework/LoggerVerbosity.cs
+Microsoft.Build.Framework/MessageImportance.cs
+Microsoft.Build.Framework/MonoTODOAttribute.cs
+Microsoft.Build.Framework/OutputAttribute.cs
+Microsoft.Build.Framework/ProjectFinishedEventArgs.cs
+Microsoft.Build.Framework/ProjectFinishedEventHandler.cs
+Microsoft.Build.Framework/ProjectStartedEventArgs.cs
+Microsoft.Build.Framework/ProjectStartedEventHandler.cs
+Microsoft.Build.Framework/RequiredAttribute.cs
+Microsoft.Build.Framework/TargetFinishedEventArgs.cs
+Microsoft.Build.Framework/TargetFinishedEventHandler.cs
+Microsoft.Build.Framework/TargetStartedEventArgs.cs
+Microsoft.Build.Framework/TargetStartedEventHandler.cs
+Microsoft.Build.Framework/TaskFinishedEventArgs.cs
+Microsoft.Build.Framework/TaskFinishedEventHandler.cs
+Microsoft.Build.Framework/TaskStartedEventArgs.cs
+Microsoft.Build.Framework/TaskStartedEventHandler.cs
+Mono.XBuild.Shared/AssemblyLoadInfo.cs
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mdp b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mdp
new file mode 100644 (file)
index 0000000..96dbb43
--- /dev/null
@@ -0,0 +1,63 @@
+<Project name="Microsoft.Build.Framework" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="Microsoft.Build.Framework" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="Microsoft.Build.Framework" />
+      <Build debugmode="False" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./Microsoft.Build.Framework/AnyEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildErrorEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildErrorEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildFinishedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildFinishedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildMessageEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildMessageEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildStartedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildStartedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildStatusEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildStatusEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildWarningEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildWarningEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/CustomBuildEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/CustomBuildEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/IBuildEngine.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/IEventSource.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ILogger.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ITask.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ITaskItem.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/LoadInSeparateAppDomainAttribute.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/LoggerException.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/LoggerVerbosity.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/MessageImportance.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/MonoTODOAttribute.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/OutputAttribute.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ProjectFinishedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ProjectFinishedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ProjectStartedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ProjectStartedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/RequiredAttribute.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TargetFinishedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TargetFinishedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TargetStartedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TargetStartedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TaskFinishedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TaskFinishedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TaskStartedEventArgs.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TaskStartedEventHandler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Mono.XBuild.Shared/AssemblyLoadInfo.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References />
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mds b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mds
new file mode 100644 (file)
index 0000000..a857791
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="Microsoft.Build.Framework" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Framework" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Framework" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="Microsoft.Build.Framework" single="True">
+    <Execute type="None" entry="Microsoft.Build.Framework" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./Microsoft.Build.Framework.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.targets b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.targets
new file mode 100644 (file)
index 0000000..c8f6ce8
--- /dev/null
@@ -0,0 +1,19 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <ItemGroup>
+               <MicrosoftBuildFrameworkSources Include="Microsoft.Build.Framework/Microsoft.Build.Framework/*.cs" />
+               <MicrosoftBuildFrameworkSources Include="Microsoft.Build.Framework/Mono.XBuild.Shared/*.cs" />
+               <MicrosoftBuildFrameworkDll Include="Microsoft.Build.Framework.dll" />
+       </ItemGroup>
+       <Target
+               Name="MicrosoftBuildFramework"
+               Inputs="@(MicrosoftBuildFrameworkSources)"
+               Outputs="@(MicrosoftBuildFrameworkDll)"
+       >
+               <Csc
+                       Sources="@(MicrosoftBuildFrameworkSources)"
+                       TargetType="library"
+                       OutputAssembly="@(MicrosoftBuildFrameworkDll)"
+                       WarningLevel="3"
+               />
+       </Target>
+</Project>
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/AnyEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/AnyEventHandler.cs
new file mode 100644 (file)
index 0000000..165201d
--- /dev/null
@@ -0,0 +1,31 @@
+//
+// AnyEventHandler.cs: Represents the method that will handle the Microsoft.
+// Build.Framework.IEventSource.AnyEventRaised event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void AnyEventHandler (object sender, BuildEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildErrorEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildErrorEventArgs.cs
new file mode 100644 (file)
index 0000000..a62e2b2
--- /dev/null
@@ -0,0 +1,107 @@
+//
+// BuildErrorEventArgs.cs: Provides data for the Microsoft.Build.Framework
+// .IEventSource.ErrorRaised event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class BuildErrorEventArgs : BuildEventArgs {
+       
+               string  code;
+               int     columnNumber;
+               int     endColumnNumber;
+               int     endLineNumber;
+               string  file;
+               int     lineNumber;
+               string  subcategory;
+               
+               protected BuildErrorEventArgs ()
+               {
+               }
+
+               public BuildErrorEventArgs (string subcategory, string code,
+                                           string file, int lineNumber,
+                                           int columnNumber,
+                                           int endLineNumber,
+                                           int endColumnNumber,
+                                           string message, string helpKeyword,
+                                           string senderName)
+                       : base (message, helpKeyword, senderName)
+               {
+                       this.subcategory = subcategory;
+                       this.code = code;
+                       this.file = file;
+                       this.lineNumber = lineNumber;
+                       this.columnNumber = columnNumber;
+                       this.endLineNumber = endLineNumber;
+                       this.endColumnNumber = endColumnNumber;
+               }
+
+               public string Code {
+                       get {
+                               return code;
+                       }
+               }
+
+               public int ColumnNumber {
+                       get {
+                               return columnNumber;
+                       }
+               }
+
+               public int EndColumnNumber {
+                       get {
+                               return endColumnNumber;
+                       }
+               }
+
+               public int EndLineNumber {
+                       get {
+                               return endLineNumber;
+                       }
+               }
+
+               public string File {
+                       get {
+                               return file;
+                       }
+               }
+
+               public int LineNumber {
+                       get {
+                               return lineNumber;
+                       }
+               }
+               
+               public string Subcategory {
+                       get {
+                               return subcategory;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildErrorEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildErrorEventHandler.cs
new file mode 100644 (file)
index 0000000..21ceba0
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// BuildErrorEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.ErrorRaised event of a build.
+//
+// Author:
+//   Marek Sieradzki
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void BuildErrorEventHandler (object sender,
+                                                    BuildErrorEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildEventArgs.cs
new file mode 100644 (file)
index 0000000..7a13b48
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// BuildEventArgs.cs: Provides data for the Microsoft.Framework.IEventSource.
+// AnyEventRaised event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Threading;
+
+namespace Microsoft.Build.Framework
+{
+       [Serializable]          
+       public abstract class BuildEventArgs : System.EventArgs {
+       
+               string  helpKeyword;
+               string  message;
+               string  senderName;
+               int     threadId;
+               DateTime        timeStamp;
+               
+               protected BuildEventArgs ()
+                       : this (null, null, null)
+               {
+               }
+
+               protected BuildEventArgs (string message, string helpKeyword,
+                                         string senderName)
+               {
+                       this.message = message;
+                       this.helpKeyword = helpKeyword;
+                       this.senderName = senderName;
+                       this.threadId = Thread.CurrentThread.GetHashCode ();
+                       this.timeStamp = DateTime.Now;
+               }
+
+               public string HelpKeyword {
+                       get {
+                               return helpKeyword;
+                       }
+               }
+
+               public string Message {
+                       get {
+                               return message;
+                       }
+               }
+
+               public string SenderName {
+                       get {
+                               return senderName;
+                       }
+               }
+               // Gets the integer hash code value of the thread that raised
+               // the event
+               public int ThreadId {
+                       get {
+                               return threadId;
+                       }
+               }
+               // Time when event was fired
+               public DateTime TimeStamp {
+                       get {
+                               return timeStamp;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildFinishedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildFinishedEventArgs.cs
new file mode 100644 (file)
index 0000000..3c11741
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// BuildFinishedEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.BuildFinished event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class BuildFinishedEventArgs : BuildStatusEventArgs {
+       
+               bool succeeded;
+               
+               protected BuildFinishedEventArgs ()
+               {
+               }
+
+               public BuildFinishedEventArgs (string message,
+                                                 string helpKeyword,
+                                                 bool succeeded)
+                       : base (message, helpKeyword, null)
+               {
+                       this.succeeded = succeeded;
+               }
+
+               public bool Succeeded {
+                       get {
+                               return succeeded;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildFinishedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildFinishedEventHandler.cs
new file mode 100644 (file)
index 0000000..cd41936
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// BuildFinishedEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.BuildFinished event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void BuildFinishedEventHandler (object sender,
+                                                       BuildFinishedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildMessageEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildMessageEventArgs.cs
new file mode 100644 (file)
index 0000000..bdaa6fb
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// BuildMessageEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.MessageRaised event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class BuildMessageEventArgs : BuildEventArgs {
+       
+               MessageImportance importance;
+               
+               protected BuildMessageEventArgs ()
+               {
+               }
+
+               public BuildMessageEventArgs (string message,
+                                             string helpKeyword,
+                                             string senderName,
+                                             MessageImportance importance)
+                       : base (message, helpKeyword, senderName)
+               {
+                       this.importance = importance;
+               }
+
+               public MessageImportance Importance {
+                       get {
+                               return importance;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildMessageEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildMessageEventHandler.cs
new file mode 100644 (file)
index 0000000..617a368
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// BuildMessageEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.MessageRaised event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void BuildMessageEventHandler (object sender,
+                                                      BuildMessageEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStartedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStartedEventArgs.cs
new file mode 100644 (file)
index 0000000..fb62159
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// BuildStartedEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.BuildStarted event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class BuildStartedEventArgs : BuildStatusEventArgs {
+       
+               protected BuildStartedEventArgs ()
+               {
+               }
+
+               public BuildStartedEventArgs (string message,
+                                             string helpKeyword)
+                       : base (message, helpKeyword, null)
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStartedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStartedEventHandler.cs
new file mode 100644 (file)
index 0000000..cfa218c
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// BuildStartedEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.BuildStarted event of a build.
+//
+// Authors:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void BuildStartedEventHandler (object sender,
+                                                      BuildStartedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStatusEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStatusEventArgs.cs
new file mode 100644 (file)
index 0000000..2fd899a
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// BuildStatusEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.StatusEventRaised event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework
+{
+       [Serializable]
+       public abstract class BuildStatusEventArgs : BuildEventArgs {
+       
+               protected BuildStatusEventArgs ()
+               {
+               }
+
+               protected BuildStatusEventArgs (string message,
+                                               string helpKeyword,
+                                               string senderName)
+                       : base (message, helpKeyword, senderName)
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStatusEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildStatusEventHandler.cs
new file mode 100644 (file)
index 0000000..62d824f
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// BuildStatusEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.StatusEventRaised event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void BuildStatusEventHandler (object sender,
+                                                BuildStatusEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildWarningEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildWarningEventArgs.cs
new file mode 100644 (file)
index 0000000..c33391c
--- /dev/null
@@ -0,0 +1,108 @@
+//
+// BuildWarningEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.WariningRaised event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class BuildWarningEventArgs : BuildEventArgs {
+       
+               string  subcategory;
+               string  code;
+               string  file;
+               int     lineNumber;
+               int     columnNumber;
+               int     endLineNumber;
+               int     endColumnNumber;
+               
+               protected BuildWarningEventArgs ()
+               {
+               }
+
+               public BuildWarningEventArgs (string subcategory, string code,
+                                             string file, int lineNumber,
+                                             int columnNumber,
+                                             int endLineNumber,
+                                             int endColumnNumber,
+                                             string message,
+                                             string helpKeyword,
+                                             string senderName)
+                       : base (message, helpKeyword, senderName)
+               {
+                       this.subcategory = subcategory;
+                       this.code = code;
+                       this.file = file;
+                       this.lineNumber = lineNumber;
+                       this.columnNumber = columnNumber;
+                       this.endLineNumber = endLineNumber;
+                       this.endColumnNumber = endColumnNumber;
+               }
+
+               public string Code {
+                       get {
+                               return code;
+                       }
+               }
+
+               public int ColumnNumber {
+                       get {
+                               return columnNumber;
+                       }
+               }
+
+               public int EndColumnNumber {
+                       get {
+                               return endColumnNumber;
+                       }
+               }
+
+               public int EndLineNumber {
+                       get {
+                               return endLineNumber;
+                       }
+               }
+
+               public string File {
+                       get {
+                               return file;
+                       }
+               }
+
+               public int LineNumber {
+                       get {
+                               return lineNumber;
+                       }
+               }
+
+               public string Subcategory {
+                       get {
+                               return subcategory;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildWarningEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/BuildWarningEventHandler.cs
new file mode 100644 (file)
index 0000000..4f15937
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// BuildWarningEventHandler.cs: Represens the method that will handle the
+// Microsoft.Build.Framework.IEventSource.WarningRaised event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void BuildWarningEventHandler (object sender,
+                                                      BuildWarningEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog
new file mode 100644 (file)
index 0000000..4f8fa53
--- /dev/null
@@ -0,0 +1,73 @@
+2005-09-08  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TargetFinishedEventArgs.cs, BuildStatusEventArgs.cs,
+       BuildMessageEventArgs.cs, BuildErrorEventArgs.cs,
+       BuildFinishedEventArgs.cs, BuildWarningEventArgs.cs,
+       BuildStartedEventArgs.cs, TaskStartedEventArgs.cs,
+       CustomBuildEventArgs.cs, ProjectStartedEventArgs.cs,
+       BuildEventArgs.cs, TaskFinishedEventArgs.cs,
+       TargetStartedEventArgs.cs, ProjectFinishedEventArgs.cs: Changed
+       protected field to private.
+       * LoggerException.cs: Formatting.
+
+2005-08-30  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TargetFinishedEventArgs.cs: Added 'succeeded' setting.
+       * BuildFinishedEventArgs.cs: Formatting.
+       * ProjectFinishedEventArgs.cs: Formatting.
+
+2005-08-27  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildErrorEventArgs.cs: Formatting.
+       * BuildWarningEventArgs.cs: Fixed ctor.
+       * BuildEventArgs.cs: Formatting.
+
+2005-08-19  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TargetFinishedEventArgs.cs: Added Succeeded property.
+
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * ProjectStartedEventArgs.cs: Added TargetNames property.
+
+2005-08-06  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildFinishedEventArgs.cs, BuildFinishedEventArgs.cs,
+       BuildMessageEventArgs.cs, BuildStartedEventArgs.cs,
+       BuildStatusEventArgs.cs, BuildWarningEventArgs.cs,
+       CustomBuildEventArgs.cs, CustomBuildEventHandler.cs,
+       LoadInSeparateDomainAttribute.cs, LoggerException.cs,
+       OutputAttribute.cs, ProjectFinishedEventArgs.cs,
+       ProjectStartedEventArgs.cs, RequiredAttribute.cs,
+       TargetFinishedEventArgs.cs, TargetStartedEventArgs.cs,
+       TaskFinishedEventArgs.cs, TaskStartedEventArgs.cs: Various fixes.
+
+2005-07-13  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildEventArgs.cs: Fixed threadId
+
+2005-07-04  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * *.cs: Updated copyright, license notices and line endings info
+       * LoggerException.cs, BuildEventArgs.cs: Fixed
+
+2005-06-30  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AnyEventHandler.cs, BuildErrorEventArgs.cs, BuildErrorEventHandler.cs,
+       BuildEventArgs.cs, BuildFinishedEventArgs.cs, BuildFinishedEventHandler.cs,
+       BuildMessageEventArgs.cs, BuildMessageEventHandler.cs,
+       BuildStartedEventArgs.cs, BuildStartedEventHandler.cs,
+       BuildStatusEventArgs.cs, BuildStatusEventHandler.cs,
+       BuildWarningEventArgs.cs, BuildWarningEventHandler.cs,
+       CustomBuildEventArgs.cs, CustomBuildEventHandler.cs, IBuildEngine.cs,
+       IEventSource.cs, ILogger.cs, ITask.cs, ITaskItem.cs,
+       LoadInSeparateAppDomainAttribute.cs, LoggerException.cs,
+       LoggerVerbosity.cs, MessageImportance.cs, MonoTODOAttribute.cs,
+       OutputAttribute.cs, ProjectFinishedEventArgs.cs,
+       ProjectFinishedEventHandler.cs, ProjectStartedEventArgs.cs,
+       ProjectStartedEventHandler.cs, RequiredAttribute.cs,
+       TargetFinishedEventArgs.cs, TargetFinishedEventHandler.cs,
+       TargetStartedEventArgs.cs, TargetStartedEventHandler.cs,
+       TaskFinishedEventArgs.cs, TaskFinishedEventHandler.cs
+       TaskStartedEventArgs.cs, TaskStartedEventHandler.cs: Added
+
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/CustomBuildEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/CustomBuildEventArgs.cs
new file mode 100644 (file)
index 0000000..b476c4f
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// CustomBuildEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.CustomEventRaised event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class CustomBuildEventArgs : BuildEventArgs {
+       
+               protected CustomBuildEventArgs ()
+               {
+               }
+
+               public CustomBuildEventArgs (string message,
+                                            string helpKeyword,
+                                            string senderName)
+                       : base (message, helpKeyword, senderName)
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/CustomBuildEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/CustomBuildEventHandler.cs
new file mode 100644 (file)
index 0000000..6a94b66
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// CustomBuildEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.CustomEventRaised event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void CustomBuildEventHandler (object sender,
+                                                     CustomBuildEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IBuildEngine.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IBuildEngine.cs
new file mode 100644 (file)
index 0000000..ff0118f
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// IBuildEngine.cs: Provides a way for task authors to use the functionality
+// of the MSBuild engine.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.Framework
+{
+       public interface IBuildEngine
+       {
+               // Initiates a build of a project file. If the build is
+               // successful, the outputs (if any) of the specified targets
+               // are returned.
+               bool BuildProjectFile (string projectFileName,
+                                      string[] targetNames,
+                                      IDictionary globalProperties,
+                                      IDictionary targetOutputs);
+
+               // Raises a custom event to all registered loggers.
+               void LogCustomEvent (CustomBuildEventArgs e);
+
+               // Raises an error to all registered loggers.
+               void LogErrorEvent (BuildErrorEventArgs e);
+
+               // Raises a message event to all registered loggers.
+               void LogMessageEvent (BuildMessageEventArgs e);
+
+               // Raises a warning to all registered loggers.
+               void LogWarningEvent (BuildWarningEventArgs e);
+
+               int ColumnNumberOfTaskNode {
+                       get;
+               }
+
+               bool ContinueOnError {
+                       get;
+               }
+
+               int LineNumberOfTaskNode {
+                       get;
+               }
+
+               string ProjectFileOfTaskNode {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IEventSource.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IEventSource.cs
new file mode 100644 (file)
index 0000000..738c908
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// IEventSource.cs: Specifies the events raised by the build engine.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework
+{
+       public interface IEventSource
+       {
+               event AnyEventHandler AnyEventRaised;
+               event BuildFinishedEventHandler BuildFinished;
+               event BuildStartedEventHandler BuildStarted;
+               event CustomBuildEventHandler CustomEventRaised;
+               event BuildErrorEventHandler ErrorRaised;
+               event BuildMessageEventHandler MessageRaised;
+               event ProjectFinishedEventHandler ProjectFinished;
+               event ProjectStartedEventHandler ProjectStarted;
+               event BuildStatusEventHandler StatusEventRaised;
+               event TargetFinishedEventHandler TargetFinished;
+               event TargetStartedEventHandler TargetStarted;
+               event TaskFinishedEventHandler TaskFinished;
+               event TaskStartedEventHandler TaskStarted;
+               event BuildWarningEventHandler WarningRaised;
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ILogger.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ILogger.cs
new file mode 100644 (file)
index 0000000..b6ea263
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// ILogger.cs: Defines an MSBuild logger, which subscribes to build system
+// events.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework
+{
+       [System.Runtime.InteropServices.ComVisible (true)]
+       public interface ILogger
+       {
+               // Subscribes loggers to specifices events.
+               void Initialize (IEventSource eventSource);
+               
+               // Releases the resources allocated to the logger at the time
+               // of initialization or during the build.
+               void Shutdown ();
+
+               string Parameters {
+                       get;
+                       set;
+               }
+
+               LoggerVerbosity Verbosity {
+                       get;
+                       set;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITask.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITask.cs
new file mode 100644 (file)
index 0000000..abc9ded
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// ITask.cs: Defines a task, which is a unit of executable code us by MSBuild
+// to perform build operations.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework
+{
+       public interface ITask
+       {
+               bool Execute ();
+
+               IBuildEngine BuildEngine {
+                       get;
+                       set;
+               }
+
+               object HostObject {
+                       get;
+                       set;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITaskItem.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITaskItem.cs
new file mode 100644 (file)
index 0000000..079147e
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// ITaskItem.cs: Defines an MSBuild item that can be consumed and emitted by
+// tasks.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.Framework
+{
+       [System.Runtime.InteropServices.GuidAttribute ("8661674F-2148-4F71-A92A-49875511C528")]
+       [System.Runtime.InteropServices.ComVisible (true)]
+       public interface ITaskItem
+       {
+               IDictionary CloneCustomMetadata ();
+
+               void CopyMetadataTo (ITaskItem destinationItem);
+
+               string GetMetadata (string metadataName);
+
+               void RemoveMetadata (string metadataName);
+
+               void SetMetadata (string metadataName, string metadataValue);
+
+               string ItemSpec {
+                       get;
+                       set;
+               }
+
+               int MetadataCount {
+                       get;
+               }
+
+               ICollection MetadataNames {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoadInSeparateAppDomainAttribute.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoadInSeparateAppDomainAttribute.cs
new file mode 100644 (file)
index 0000000..4cb5467
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// LoadInSeperateAppDomainAttribute.cs: Defines the metadata attribute that
+// MSBuild uses to identify tasks that must be executed in their own
+// application domains.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework
+{
+       [AttributeUsage(AttributeTargets.Class, AllowMultiple=false,
+               Inherited = true)]
+       public sealed class LoadInSeparateAppDomainAttribute : Attribute
+       {
+               public LoadInSeparateAppDomainAttribute ()
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoggerException.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoggerException.cs
new file mode 100644 (file)
index 0000000..d458a6e
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// LoggerException.cs: Exception class for logger.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class LoggerException : Exception {
+       
+               string errorCode;
+               string helpKeyword;
+
+               public LoggerException ()
+                       : base ("Logger exception has occured.")
+               {
+               }
+
+               public LoggerException (string message)
+                       : base (message)
+               {
+               }
+
+               public LoggerException (string message,
+                                       Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+
+               public LoggerException (string message,
+                                       Exception innerException,
+                                       string errorCode, string helpKeyword)
+                       : base (message, innerException)
+               {
+                       this.errorCode = errorCode;
+                       this.helpKeyword = helpKeyword;
+               }
+
+               protected LoggerException (SerializationInfo info,
+                                          StreamingContext context)
+                       : base (info, context)
+               {
+                       errorCode = info.GetString ("ErrorCode");
+                       helpKeyword = info.GetString ("HelpKeyword");
+               }
+               
+               public override void GetObjectData (SerializationInfo info,
+                                                   StreamingContext context)
+               {
+                       base.GetObjectData (info,context);
+                       info.AddValue ("ErrorCode", errorCode);
+                       info.AddValue ("HelpKeyword", helpKeyword);
+               }
+
+               public string ErrorCode {
+                       get {
+                               return errorCode;
+                       }
+               }
+
+               public string HelpKeyword {
+                       get {
+                               return helpKeyword;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoggerVerbosity.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/LoggerVerbosity.cs
new file mode 100644 (file)
index 0000000..f264c91
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// LoggerVerbosity.cs: Specifies the available levels of a Microsoft.Build.
+// Utilities.Logger.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework
+{
+       public enum LoggerVerbosity
+       {
+               // Quiet verbosity, which displays a build summary.
+               Quiet,
+               // Minimal verbosity, which displays errors, warnings,
+               // messages with MessageImportance values of High, and a build
+               // summary.
+               Minimal,
+               // Normal verbosity, which displays error, warning, messages
+               // with MessageImportance values of High, some status events,
+               // and a build summary.
+               Normal,
+               // Minimal verbosity, which displays error, warnings, messages
+               // with MessageImportance values of High or Normal, all status
+               // events, and a build summary.
+               Detailed,
+               // Diagnostic verbosity, which displays all errors, warnings,
+               // messages, status events, and a build summary.
+               Diagnostic
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/MessageImportance.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/MessageImportance.cs
new file mode 100644 (file)
index 0000000..d3be452
--- /dev/null
@@ -0,0 +1,35 @@
+//
+// MessageImportance.cs: Specifies constants that define the importance of a
+// build message.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public enum MessageImportance {
+               High,
+               Normal,
+               Low
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/MonoTODOAttribute.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/MonoTODOAttribute.cs
new file mode 100644 (file)
index 0000000..7c986cf
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// MonoTODOAttribute.cs
+//
+// Author:
+//   Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System {
+       
+       [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+       internal sealed class MonoTODOAttribute : Attribute {
+
+               string comment;
+               
+               public MonoTODOAttribute ()
+               {
+               }
+
+               public MonoTODOAttribute (string comment)
+               {
+                       this.comment = comment;
+               }
+
+               public string Comment {
+                       get { return comment; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/OutputAttribute.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/OutputAttribute.cs
new file mode 100644 (file)
index 0000000..24330ae
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// OutputAttribute.cs: Defines the metadata attribute that task authors use to
+// identify task parameters that output from the task.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework
+{
+       [AttributeUsage(AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
+       public sealed class OutputAttribute : Attribute
+       {
+               public OutputAttribute ()
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectFinishedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectFinishedEventArgs.cs
new file mode 100644 (file)
index 0000000..59312e5
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// ProjectFinishedEventArgs.cs: Provides data for the Microsoft.Build.Framework
+// .IEventSource.ProjectFinished event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class ProjectFinishedEventArgs : BuildStatusEventArgs {
+       
+               string  projectFile;
+               bool    succeeded;
+
+               protected ProjectFinishedEventArgs ()
+               {
+               }
+
+               public ProjectFinishedEventArgs (string message,
+                                                string helpKeyword,
+                                                string projectFile,
+                                                bool succeeded)
+                       : base (message, helpKeyword, null)
+               {
+                       this.projectFile = projectFile;
+                       this.succeeded = succeeded;
+               }
+
+               public string ProjectFile {
+                       get {
+                               return projectFile;
+                       }
+               }
+
+               public bool Succeeded {
+                       get {
+                               return succeeded;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectFinishedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectFinishedEventHandler.cs
new file mode 100644 (file)
index 0000000..f6d3404
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// ProjectFinishedEventHandler.cs: Represents the method that will handle
+// Microsoft.Build.Framework.IEventSource.ProjectFinished event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void ProjectFinishedEventHandler (object sender,
+                                                         ProjectFinishedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectStartedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectStartedEventArgs.cs
new file mode 100644 (file)
index 0000000..118b325
--- /dev/null
@@ -0,0 +1,69 @@
+//
+// ProjectStartedEventArgs.cs: Provides data for the Microsoft.Build.Framework
+// .IEventSource.ProjectStarted event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class ProjectStartedEventArgs : BuildStatusEventArgs {
+       
+               string  projectFile;
+               string  targetNames;
+               bool    succeeded;      
+       
+               protected ProjectStartedEventArgs ()
+               {
+               }
+
+               public ProjectStartedEventArgs (string message,
+                                               string helpKeyword,
+                                               string projectFile,
+                                               string targetNames)
+                       : base (message, helpKeyword, null)
+               {
+                       this.projectFile = projectFile;
+                       this.targetNames = targetNames;
+               }
+
+               public string ProjectFile {
+                       get {
+                               return projectFile;
+                       }
+               }
+
+               public bool Succeeded {
+                       get {
+                               return succeeded;
+                       }
+               }
+               
+               public string TargetNames {
+                       get { return targetNames; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectStartedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ProjectStartedEventHandler.cs
new file mode 100644 (file)
index 0000000..bc6d78f
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// ProjectStartedEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.ProjectStarted event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void ProjectStartedEventHandler (object sender,
+                                                        ProjectStartedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/RequiredAttribute.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/RequiredAttribute.cs
new file mode 100644 (file)
index 0000000..783f3d9
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// RequiredAttribute.cs: Defines the metadata attribute that task author use to
+// identify required task parameters. 
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework
+{
+       [AttributeUsage(AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
+       public sealed class RequiredAttribute : Attribute
+       {
+               // It should stop build process if property is of non-array type
+               // and is null
+               // It should pass empty table if property is of array type
+               // and is null
+               public RequiredAttribute ()
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetFinishedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetFinishedEventArgs.cs
new file mode 100644 (file)
index 0000000..de08cb7
--- /dev/null
@@ -0,0 +1,74 @@
+//
+// TargetFinishedEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.TargetStarted event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class TargetFinishedEventArgs : BuildStatusEventArgs {
+       
+               string  targetName;
+               string  projectFile;
+               string  targetFile;
+               bool    succeeded;
+                               
+               protected TargetFinishedEventArgs ()
+               {
+               }
+
+               public TargetFinishedEventArgs (string message,
+                                               string helpKeyword,
+                                               string targetName,
+                                               string projectFile,
+                                               string targetFile,
+                                               bool succeeded)
+                       : base (message, helpKeyword, null)
+               {
+                       this.targetName = targetName;
+                       this.projectFile = projectFile;
+                       this.targetFile = targetFile;  
+                       this.succeeded = succeeded;
+               }
+
+               public string ProjectFile {
+                       get { return projectFile; }
+               }
+
+               public string TargetFile {
+                       get { return targetFile; }
+               }
+
+               public string TargetName {
+                       get { return targetName; }
+               }
+               
+               public bool Succeeded {
+                       get { return succeeded; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetFinishedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetFinishedEventHandler.cs
new file mode 100644 (file)
index 0000000..9bfa6e9
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// TargetFinishedEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.TargetFinished event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void TargetFinishedEventHandler (object sender,
+                                                        TargetFinishedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetStartedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetStartedEventArgs.cs
new file mode 100644 (file)
index 0000000..57419ec
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// TargetStartedEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.TargetStarted event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class TargetStartedEventArgs : BuildStatusEventArgs {
+       
+               string targetName;
+               string projectFile;
+               string targetFile;
+               
+               protected TargetStartedEventArgs ()
+               {
+               }
+
+               public TargetStartedEventArgs (string message,
+                                              string helpKeyword,
+                                              string targetName,
+                                              string projectFile,
+                                              string targetFile)
+                       : base (message, helpKeyword, null)
+               {
+                       this.targetName = targetName;
+                       this.projectFile = projectFile;
+                       this.targetFile = targetFile;
+               }
+
+               public string ProjectFile {
+                       get {
+                               return projectFile;
+                       }
+               }
+
+               public string TargetFile {
+                       get {
+                               return targetFile;
+                       }
+               }
+
+               public string TargetName {
+                       get {
+                               return targetName;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetStartedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TargetStartedEventHandler.cs
new file mode 100644 (file)
index 0000000..873a032
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// TargetStartedEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.TargetStarted event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void TargetStartedEventHandler (object sender,
+                                                       TargetStartedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskFinishedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskFinishedEventArgs.cs
new file mode 100644 (file)
index 0000000..df83626
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// TaskFinishedEventArgs.cs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.TaskFinished event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class TaskFinishedEventArgs : BuildStatusEventArgs {
+       
+               string  projectFile;
+               string  taskFile;
+               string  taskName;
+               bool    succeeded;
+               
+               protected TaskFinishedEventArgs ()
+               {
+               }
+
+               public TaskFinishedEventArgs (string message,
+                                             string helpKeyword,
+                                             string projectFile,
+                                             string taskFile,
+                                             string taskName,
+                                             bool succeeded)
+                       : base (message, helpKeyword, null)
+               {
+                       this.projectFile = projectFile;
+                       this.taskFile = taskFile;
+                       this.taskName = taskName;
+                       this.succeeded = succeeded;
+               }
+
+               public string ProjectFile {
+                       get {
+                               return projectFile;
+                       }
+               }
+
+               public bool Succeeded {
+                       get {
+                               return succeeded;
+                       }
+               }
+
+               public string TaskFile {
+                       get {
+                               return taskFile;
+                       }
+               }
+
+               public string TaskName {
+                       get {
+                               return taskName;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskFinishedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskFinishedEventHandler.cs
new file mode 100644 (file)
index 0000000..2596860
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// TaskFinishedEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.TaskFinished event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void TaskFinishedEventHandler (object sender,
+                                                      TaskFinishedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskStartedEventArgs.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskStartedEventArgs.cs
new file mode 100644 (file)
index 0000000..d3294a6
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// TaskStartedEventArgs: Provides data for the Microsoft.Build.Framework.
+// IEventSource.TaskStarted event.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Framework {
+       [Serializable]
+       public class TaskStartedEventArgs : BuildStatusEventArgs {
+       
+               string projectFile;
+               string taskFile;
+               string taskName;
+
+               protected TaskStartedEventArgs ()
+               {
+               }
+
+               public TaskStartedEventArgs (string message, string helpKeyword,
+                                            string projectFile,
+                                            string taskFile, string taskName)
+                       : base (message, helpKeyword, null)
+               {
+                       this.projectFile = projectFile;
+                       this.taskFile = taskFile;
+                       this.taskName = taskName;
+               }
+
+               public string ProjectFile {
+                       get {
+                               return projectFile;
+                       }
+               }
+
+               public string TaskFile {
+                       get {
+                               return taskFile;
+                               
+                       }
+               }
+
+               public string TaskName {
+                       get {
+                               return taskName;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskStartedEventHandler.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/TaskStartedEventHandler.cs
new file mode 100644 (file)
index 0000000..17cc7fa
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// TaskStartedEventHandler.cs: Represents the method that will handle the
+// Microsoft.Build.Framework.IEventSource.TaskStarted event of a build.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Framework {
+       public delegate void TaskStartedEventHandler (object sender,
+                                                     TaskStartedEventArgs e);
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework_test.dll.sources b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework_test.dll.sources
new file mode 100644 (file)
index 0000000..c36824f
--- /dev/null
@@ -0,0 +1,13 @@
+Microsoft.Build.Framework/BuildErrorEventArgsTest.cs
+Microsoft.Build.Framework/BuildFinishedEventArgsTest.cs
+Microsoft.Build.Framework/BuildMessageEventArgsTest.cs
+Microsoft.Build.Framework/BuildStartedEventArgsTest.cs
+Microsoft.Build.Framework/BuildWarningEventArgsTest.cs
+Microsoft.Build.Framework/CustomBuildEventArgsTest.cs
+Microsoft.Build.Framework/LoggerExceptionTest.cs
+Microsoft.Build.Framework/ProjectFinishedEventArgsTest.cs
+Microsoft.Build.Framework/ProjectStartedEventArgsTest.cs
+Microsoft.Build.Framework/TargetFinishedEventArgsTest.cs
+Microsoft.Build.Framework/TargetStartedEventArgsTest.cs
+Microsoft.Build.Framework/TaskFinishedEventArgsTest.cs
+Microsoft.Build.Framework/TaskStartedEventArgsTest.cs
diff --git a/mcs/class/Microsoft.Build.Framework/Mono.XBuild.Shared/AssemblyLoadInfo.cs b/mcs/class/Microsoft.Build.Framework/Mono.XBuild.Shared/AssemblyLoadInfo.cs
new file mode 100644 (file)
index 0000000..97234f8
--- /dev/null
@@ -0,0 +1,147 @@
+//
+// AssemblyLoadInfo.cs: Information needed to load logger or task class.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Globalization;
+using System.Reflection;
+
+namespace Mono.XBuild.Shared {
+       public class AssemblyLoadInfo {
+       
+               AssemblyName    assemblyName;
+               string          assemblyNameString;
+               string          className;
+               string          filename;
+               LoadInfoType    infoType;
+       
+               public AssemblyLoadInfo ()
+               {
+               }
+               
+               public AssemblyLoadInfo (string assemblyName, string className)
+               {
+                       string name, version, culture, publicKeyToken;
+                       string[] whole, versionArr, cultureArr, publicKeyTokenArr;
+                       name = null;
+                       version = null;
+                       culture = null;
+                       publicKeyToken = null;
+               
+                       whole = assemblyName.Split (',');
+                       
+                       if (whole.Length < 4)
+                               throw new ArgumentException ("Invalid assembly name string.");
+                       
+                       name = whole [0].Trim ();
+                       
+                       versionArr = (whole [1].Trim ()).Split ('=');
+                       if (versionArr.Length != 2)
+                               throw new ArgumentException ("Invalid version.");
+                       version = versionArr [1];
+
+                       cultureArr = (whole [2].Trim ()).Split ('=');
+                       if (cultureArr.Length != 2)
+                               throw new ArgumentException ("Invalid culture.");
+                       culture = cultureArr [1];
+
+                       publicKeyTokenArr = (whole [1].Trim ()).Split ('=');
+                       if (publicKeyTokenArr.Length != 2)
+                               throw new ArgumentException ("Invalid public key token.");
+                       publicKeyToken = publicKeyTokenArr [1];
+                       
+                       
+                       SetAssemblyName (LoadInfoType.AssemblyName, null, name, version, culture, publicKeyToken, className);
+               }
+               
+               public AssemblyLoadInfo (LoadInfoType loadInfoType, string filename, string name,
+                                        string version, string culture, string publicKeyToken, string className)
+               {
+                       SetAssemblyName (loadInfoType, filename, name, version, culture, publicKeyToken, className);
+               }
+               
+               protected void SetAssemblyName (LoadInfoType loadInfoType, string filename, string name, string version,
+                                               string culture, string publicKeyToken, string className)
+               {
+                       assemblyName = new AssemblyName ();
+                       this.infoType = loadInfoType;
+                       this.className = className;
+                       if (infoType == LoadInfoType.AssemblyName) {
+                               if (version != null)
+                                       assemblyName.Version = new Version (version);
+                               if (culture != null) {
+                                       if (culture == "neutral")
+                                               culture = "";
+                                       assemblyName.CultureInfo = new CultureInfo (culture);
+                               }
+                               if (publicKeyToken != null) {
+                                       char[] chars = publicKeyToken.ToCharArray ();
+                                       byte[] bytes = new byte [Buffer.ByteLength (chars)];
+                                       
+                                       for (int i  = 0; i < Buffer.ByteLength (chars); i++)
+                                               bytes [i] = Buffer.GetByte (chars, i); 
+                                       assemblyName.SetPublicKeyToken (bytes);
+                               }
+                               
+                               assemblyName.Name = name;
+                       } else if (infoType == LoadInfoType.AssemblyFilename) {
+                               this.filename = filename;
+                       } else {
+                               ;
+                       }
+               }
+               
+               public AssemblyName AssemblyName {
+                       get { return assemblyName; }
+               }
+               
+               public string AssemblyNameString {
+                       get { return assemblyNameString; }
+               }
+               
+               public string Filename {
+                       get { return filename; }
+               }
+               
+               public LoadInfoType InfoType {
+                       get { return infoType; }
+               }
+               
+               public string ClassName {
+                       get { return className; }
+               }
+               
+               public Type Type {
+                       get { return Type.GetType (className); }
+               }
+       }
+
+       public enum LoadInfoType {
+               AssemblyName,
+               AssemblyFilename,
+               AssemblyNameFromString
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Mono.XBuild.Shared/ChangeLog b/mcs/class/Microsoft.Build.Framework/Mono.XBuild.Shared/ChangeLog
new file mode 100644 (file)
index 0000000..2f8490c
--- /dev/null
@@ -0,0 +1,11 @@
+2005-09-11  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AssemblyLoadInfo.cs: Added public key token support.
+
+2005-08-29  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AssemblyLoadInfo.cs: Moved setting assembly name to new function.
+
+2005-08-06  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AssemblyLoadInfo.cs: Initial check-in.
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework.Test.mdp b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework.Test.mdp
new file mode 100644 (file)
index 0000000..e41d3bd
--- /dev/null
@@ -0,0 +1,38 @@
+<Project name="Microsoft.Build.Framework.Test" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="Microsoft.Build.Framework.Test" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="Microsoft.Build.Framework.Test" />
+      <Build debugmode="False" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./Microsoft.Build.Framework/BuildErrorEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildFinishedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildMessageEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildStartedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/BuildWarningEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/CustomBuildEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/LoggerExceptionTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ProjectFinishedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/ProjectStartedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TaskFinishedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TaskStartedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TargetStartedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Framework/TargetFinishedEventArgsTest.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Framework" />
+    <ProjectReference type="Gac" localcopy="True" refto="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework.Test.mds b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework.Test.mds
new file mode 100644 (file)
index 0000000..20397f0
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="Microsoft.Build.Framework.Test" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Framework.Test" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Framework.Test" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="Microsoft.Build.Framework.Test" single="True">
+    <Execute type="None" entry="Microsoft.Build.Framework.Test" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./Microsoft.Build.Framework.Test.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildErrorEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildErrorEventArgsTest.cs
new file mode 100644 (file)
index 0000000..ecbe3a9
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// AnyEventHandlerTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class BuildErrorEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       BuildErrorEventArgs beea;
+                       string subcategory = "subcategory";
+                       string code = "CS0000";
+                       string file = "file";
+                       int lineNumber = 1;
+                       int columnNumber = 2;
+                       int endLineNumber = 3;
+                       int endColumnNumber = 4;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string senderName = "MSBuild";
+                       
+                       beea = new BuildErrorEventArgs (subcategory, code, file, lineNumber, columnNumber, endLineNumber,
+                               endColumnNumber, message, helpKeyword, senderName);
+                       
+                       Assert.AreEqual (subcategory, beea.Subcategory, "Subcategory");
+                       Assert.AreEqual (code, beea.Code, "Code");
+                       Assert.AreEqual (file, beea.File, "File");
+                       Assert.AreEqual (lineNumber, beea.LineNumber, "LineNumber");
+                       Assert.AreEqual (columnNumber, beea.ColumnNumber, "ColumnNumber");
+                       Assert.AreEqual (endLineNumber, beea.EndLineNumber, "EndLineNumber");
+                       Assert.AreEqual (endColumnNumber, beea.EndColumnNumber, "EndColumnNumber");
+                       Assert.AreEqual (message, beea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, beea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (senderName, beea.SenderName, "SenderName");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildFinishedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildFinishedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..36f3543
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// BuildFinishedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class BuildFinishedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       BuildFinishedEventArgs bfea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       bool succeeded = true;
+                       
+                       bfea = new BuildFinishedEventArgs (message, helpKeyword, succeeded);
+                       
+                       Assert.AreEqual (message, bfea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, bfea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (succeeded, bfea.Succeeded, "Succeeded");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildMessageEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildMessageEventArgsTest.cs
new file mode 100644 (file)
index 0000000..bd1104e
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// BuildMessageEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class BuildMessageEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       BuildMessageEventArgs bmea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string senderName = "senderName";
+                       MessageImportance messageImportance = MessageImportance.High;
+                       
+                       bmea = new BuildMessageEventArgs (message, helpKeyword, senderName, messageImportance);
+                       
+                       Assert.AreEqual (message, bmea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, bmea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (senderName, bmea.SenderName, "SenderName");
+                       Assert.AreEqual (messageImportance, bmea.Importance, "Importance");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildStartedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildStartedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..abef8ae
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// BuildStartedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class BuildStartedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       BuildStartedEventArgs bsea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       
+                       bsea = new BuildStartedEventArgs (message, helpKeyword);
+                       
+                       Assert.AreEqual (message, bsea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, bsea.HelpKeyword, "HelpKeyword");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildWarningEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/BuildWarningEventArgsTest.cs
new file mode 100644 (file)
index 0000000..694d2f3
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// BuildWarningEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class BuildWarningEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       BuildWarningEventArgs bwea;
+                       string subcategory = "subcategory";
+                       string code = "CS0000";
+                       string file = "file";
+                       int lineNumber = 1;
+                       int columnNumber = 2;
+                       int endLineNumber = 3;
+                       int endColumnNumber = 4;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string senderName = "senderName";
+                       
+                       bwea = new BuildWarningEventArgs (subcategory, code, file, lineNumber, columnNumber, endLineNumber,
+                               endColumnNumber, message, helpKeyword, senderName);
+                       
+                       Assert.AreEqual (subcategory, bwea.Subcategory, "Subcategory");
+                       Assert.AreEqual (code, bwea.Code, "Code");
+                       Assert.AreEqual (file, bwea.File, "File");
+                       Assert.AreEqual (lineNumber, bwea.LineNumber, "LineNumber");
+                       Assert.AreEqual (columnNumber, bwea.ColumnNumber, "ColumnNumber");
+                       Assert.AreEqual (endLineNumber, bwea.EndLineNumber, "EndLineNumber");
+                       Assert.AreEqual (endColumnNumber, bwea.EndColumnNumber, "EndColumnNumber");
+                       Assert.AreEqual (message, bwea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, bwea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (senderName, bwea.SenderName, "SenderName");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ChangeLog b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ChangeLog
new file mode 100644 (file)
index 0000000..3792662
--- /dev/null
@@ -0,0 +1,9 @@
+2005-08-30  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskFinishedEventArgsTest.cs, TargetStartedEventArgsTest.cs,
+       ProjectStartedEventArgsTest.cs, LoggerExceptionTest.cs,
+       TargetFinishedEventArgsTest.cs, ProjectFinishedEventArgsTest.cs,
+       BuildMessageEventArgsTest.cs, BuildWarningEventArgsTest.cs,
+       BuildStartedEventArgsTest.cs, TaskStartedEventArgsTest.cs,
+       BuildErrorEventArgsTest.cs, BuildFinishedEvenetArgsTest.cs,
+       CustomBuildEventArgsTest.cs: Added.
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/CustomBuildEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/CustomBuildEventArgsTest.cs
new file mode 100644 (file)
index 0000000..9fd98a0
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// CustomBuildEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class CustomBuildEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       CustomBuildEventArgs cbea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string senderName = "senderName";
+                       
+                       cbea = new CustomBuildEventArgs (message, helpKeyword, senderName);
+                       
+                       Assert.AreEqual (message, cbea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, cbea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (senderName, cbea.SenderName, "SenderName");
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/LoggerExceptionTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/LoggerExceptionTest.cs
new file mode 100644 (file)
index 0000000..4bb7160
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// LoggerExceptionTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class LoggerExceptionTest {
+               [Test]
+               public void CtorMessageTest ()
+               {
+                       LoggerException le;
+                       string message = "message";     
+               
+                       le = new LoggerException (message);
+                       
+                       Assert.AreEqual (message, le.Message, "Message");
+                       Assert.AreEqual (null, le.ErrorCode, "ErrorCode");
+                       Assert.AreEqual (null, le.HelpKeyword, "HelpKeyword");
+               }
+               
+               [Test]
+               public void CtorMessageExceptionTest ()
+               {
+                       LoggerException le;
+                       string message = "message";
+                       Exception e = new Exception ("Inner exception message");        
+               
+                       le = new LoggerException (message, e);
+                       
+                       Assert.AreEqual (message, le.Message, "Message");
+                       Assert.AreEqual (e, le.InnerException, "InnerException");
+                       Assert.AreEqual (null, le.ErrorCode, "ErrorCode");
+                       Assert.AreEqual (null, le.HelpKeyword, "HelpKeyword");
+               }
+               
+               [Test]
+               public void CtorMessageExceptionCodeTest ()
+               {
+                       LoggerException le;
+                       string message = "message";
+                       string errorCode = "CS0000";
+                       string helpKeyword = "helpKeyword";
+                       Exception e = new Exception ("Inner exception message");        
+               
+                       le = new LoggerException (message, e, errorCode, helpKeyword);
+                       
+                       Assert.AreEqual (message, le.Message, "Message");
+                       Assert.AreEqual (e, le.InnerException, "InnerException");
+                       Assert.AreEqual (errorCode, le.ErrorCode, "ErrorCode");
+                       Assert.AreEqual (helpKeyword, le.HelpKeyword, "HelpKeyword");
+               } 
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ProjectFinishedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ProjectFinishedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..b9367fb
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// ProjectFinishedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class ProjectFinishedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       ProjectFinishedEventArgs pfea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string projectFile = "projectFile";
+                       bool succeeded = true;
+                       
+                       pfea = new ProjectFinishedEventArgs (message, helpKeyword, projectFile, succeeded);
+                       
+                       Assert.AreEqual (message, pfea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, pfea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (projectFile, pfea.ProjectFile, "ProjectFile");
+                       Assert.AreEqual (succeeded, pfea.Succeeded, "Succeeded");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ProjectStartedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/ProjectStartedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..dc3bc81
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// ProjectStartedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class ProjectStartedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       ProjectStartedEventArgs psea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string projectFile = "projectFile";
+                       string targetNames = "targetNames";
+                       
+                       psea = new ProjectStartedEventArgs (message, helpKeyword, projectFile, targetNames);
+                       
+                       Assert.AreEqual (message, psea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, psea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (projectFile, psea.ProjectFile, "ProjectFile");
+                       Assert.AreEqual (targetNames, psea.TargetNames, "TargetNames");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TargetFinishedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TargetFinishedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..3ff68c6
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// TargetFinishedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class TargetFinishedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       TargetFinishedEventArgs tfea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string targetName = "targetName";
+                       string projectFile = "projectFile";
+                       string targetFile = "targetFile";
+                       bool succeeded = true;
+                       
+                       tfea = new TargetFinishedEventArgs (message, helpKeyword, targetName, projectFile, targetFile, succeeded);
+                       
+                       Assert.AreEqual (message, tfea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, tfea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (targetName, tfea.TargetName, "TargetName");
+                       Assert.AreEqual (projectFile, tfea.ProjectFile, "ProjectFile");
+                       Assert.AreEqual (targetFile, tfea.TargetFile, "TargetFile");
+                       Assert.AreEqual (succeeded, tfea.Succeeded, "Succeeded"); 
+               } 
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TargetStartedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TargetStartedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..52408be
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// TargetStartedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class TargetStartedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       TargetStartedEventArgs tsea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string targetName = "targetName";
+                       string projectFile = "projectFile";
+                       string targetFile = "targetFile";
+                       
+                       tsea = new TargetStartedEventArgs (message, helpKeyword, targetName, projectFile, targetFile);
+                       
+                       Assert.AreEqual (message, tsea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, tsea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (targetName, tsea.TargetName, "TargetName");
+                       Assert.AreEqual (projectFile, tsea.ProjectFile, "ProjectFile");
+                       Assert.AreEqual (targetFile, tsea.TargetFile, "TargetFile");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TaskFinishedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TaskFinishedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..0fdf20d
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// TaskFinishedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class TaskFinishedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       TaskFinishedEventArgs tfea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string projectFile = "projectFile";
+                       string taskFile = "taskFile";
+                       string taskName = "taskName";
+                       bool succeeded = true;
+                       
+                       tfea = new TaskFinishedEventArgs (message, helpKeyword, projectFile, taskFile, taskName, succeeded);
+                       
+                       Assert.AreEqual (message, tfea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, tfea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (projectFile, tfea.ProjectFile, "ProjectFile");
+                       Assert.AreEqual (taskFile, tfea.TaskFile, "TaskFile");
+                       Assert.AreEqual (taskName, tfea.TaskName, "TaskName");
+                       Assert.AreEqual (succeeded, tfea.Succeeded, "Succeeded");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TaskStartedEventArgsTest.cs b/mcs/class/Microsoft.Build.Framework/Test/Microsoft.Build.Framework/TaskStartedEventArgsTest.cs
new file mode 100644 (file)
index 0000000..2de023f
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// TaskStartedEventArgsTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Framework {
+       [TestFixture]
+       public class TaskStartedEventArgsTest {
+               [Test]
+               public void AssignmentTest ()
+               {
+                       TaskStartedEventArgs tsea;
+                       string message = "message";
+                       string helpKeyword = "helpKeyword";
+                       string projectFile = "projectFile";
+                       string taskFile = "taskFile";
+                       string taskName = "taskName";
+                       
+                       tsea = new TaskStartedEventArgs (message, helpKeyword, projectFile, taskFile, taskName);
+                       
+                       Assert.AreEqual (message, tsea.Message, "Message");
+                       Assert.AreEqual (helpKeyword, tsea.HelpKeyword, "HelpKeyword");
+                       Assert.AreEqual (projectFile, tsea.ProjectFile, "ProjectFile");
+                       Assert.AreEqual (taskFile, tsea.TaskFile, "TaskFile");
+                       Assert.AreEqual (taskName, tsea.TaskName, "TaskName");
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Tasks/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Build.Tasks/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..b9536fc
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Marek Sieradzki (mare.sieradzki@gmail.com
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the Microsoft.Build.Tasks assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyTitle("Microsoft.Build.Tasks.dll")]
+[assembly: AssemblyDescription("Microsoft.Build.Tasks.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("Marek Sieradzki")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2005 Marek Sieradzki")]
+[assembly: AssemblyTrademark("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: AssemblyDefaultAlias("Microsoft.Build.Tasks.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: ComVisible(false)]
+[assembly: AllowPartiallyTrustedCallers]
+
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
diff --git a/mcs/class/Microsoft.Build.Tasks/ChangeLog b/mcs/class/Microsoft.Build.Tasks/ChangeLog
new file mode 100644 (file)
index 0000000..a40484c
--- /dev/null
@@ -0,0 +1,6 @@
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Microsoft.Build.Tasks.dll.sources: Renamed from
+       Microsoft.Build.Tasks.sources.
+       * Makefile: Added reference to System.Windows.Forms.
+
diff --git a/mcs/class/Microsoft.Build.Tasks/Makefile b/mcs/class/Microsoft.Build.Tasks/Makefile
new file mode 100644 (file)
index 0000000..4762509
--- /dev/null
@@ -0,0 +1,20 @@
+thisdir = class/Microsoft.Build.Tasks
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = Microsoft.Build.Tasks.dll
+ifeq (1.0, $(FRAMEWORK_VERSION))
+LIBRARY_NAME = dummy-Microsoft.Build.Tasks.dll
+NO_INSTALL = yes
+NO_TEST = yes
+NO_SIGN_ASSEMBLY = yes
+endif
+
+LIB_MCS_FLAGS = \
+       /r:$(corlib)                            \
+       /r:System.dll                           \
+       /r:System.Windows.Forms.dll             \
+       /r:Microsoft.Build.Utilities.dll        \
+       /r:Microsoft.Build.Framework.dll
+
+include ../../build/library.make
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/ChangeLog b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/ChangeLog
new file mode 100644 (file)
index 0000000..77b09e4
--- /dev/null
@@ -0,0 +1,12 @@
+2005-08-29  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CscHostObject.cs: Removed.
+
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CscHostObject.cs: Added.
+       * ICscHostObject.cs: Updated.
+
+2005-07-13  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * ICscHostObject.cs, IVbcHostObject.cs: initial check-in
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/ICscHostObject.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/ICscHostObject.cs
new file mode 100644 (file)
index 0000000..76907b1
--- /dev/null
@@ -0,0 +1,120 @@
+//
+// ICscHostObject.cs: Host object interface for C# compiler.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks.Hosting {
+       public interface ICscHostObject {
+       
+               void BeginInitialization ();
+               
+               bool Compile ();
+               
+               bool EndInitialization (out string errorMessage, out int errorCode);
+               
+               bool IsDesignTime ();
+               
+               bool IsUpToDate ();
+               
+               bool SetAdditionalLibPaths (string[] additionalLibPaths);
+               
+               bool SetAddModules (string[] addModules);
+               
+               bool SetAllowUnsafeBlocks (bool allowUnsafeBlocks);
+               
+               bool SetBaseAddress (string baseAddress);
+               
+               bool SetCheckForOverflowUnderflow (bool checkForOverflowUnderflow);
+               
+               bool SetCodePage (int codePage);
+               
+               bool SetDebugType (string debugType);
+               
+               bool SetDefineConstants (string defineConstants);
+               
+               bool SetDelaySign (bool delaySignExplicitlySet, bool delaySign);
+               
+               bool SetDisabledWarnings (string disabledWarnings);
+               
+               bool SetDocumentationFile (string documentationFile);
+               
+               bool SetEmitDebugInformation (bool emitDebugInformation);
+               
+               bool SetErrorReport (string errorReport);
+               
+               bool SetFileAlignment (int fileAlignment);
+               
+               bool SetGenerateFullPaths (bool generateFullPaths);
+               
+               bool SetKeyContainer (string keyContainer);
+               
+               bool SetKeyFile (string keyFile);
+               
+               bool SetLangVersion (string langVersion);
+               
+               bool SetLinkResources (ITaskItem[] linkResources);
+               
+               bool SetMainEntryPoint (string targetType, string mainEntryPoint);
+               
+               bool SetModuleAssemblyName (string moduleAssemblyName);
+               
+               bool SetNoConfig (bool noConfig);
+               
+               bool SetNoStandardLib (bool noStandardLib);
+               
+               bool SetOptimize (bool optimize);
+               
+               bool SetOutputAssembly (string outputAssembly);
+               
+               bool SetPlatform (string platform);
+               
+               bool SetReferences (ITaskItem[] references);
+               
+               bool SetResources (ITaskItem[] resources);
+               
+               bool SetResponseFiles (ITaskItem[] responseFiles);
+               
+               bool SetSources (ITaskItem[] sources);
+               
+               bool SetTargetType (string targetType);
+               
+               bool SetTreatWarningsAsErrors (bool treatWarningsAsErrors);
+               
+               bool SetWarningLevel (int warningLevel);
+               
+               bool SetWarningsAsErrors (string warningsAsErrors);
+               
+               bool SetWarningsNotAsErrors (string warningsNotAsErrors);
+               
+               bool SetWin32Icon (string win32Icon);
+               
+               bool SetWin32Resource (string win32Resource);
+       }
+}
+
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/IVbcHostObject.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/IVbcHostObject.cs
new file mode 100644 (file)
index 0000000..3f13e9d
--- /dev/null
@@ -0,0 +1,125 @@
+//
+// IVbcHostObject.cs: Host object interface for VB.NET compiler.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.Build.Tasks.Hosting {
+       public interface IVbcHostObject {
+               void BeginInitialization ();
+               
+               bool Compile ();
+               
+               void EndInitialization ();
+               
+               bool IsDesignTime ();
+               
+               bool IsUpToDate ();
+               
+               bool SetAdditionalLibPaths (string[] additionalLibPaths);
+               
+               bool SetAddModules (string[] addModules);
+               
+               bool SetBaseAddress (string targetType, string baseAddress);
+               
+               bool SetCodePage (int codePage);
+               
+               bool SetDebugType (bool emitDebugInformation, string debugType);
+               
+               bool SetDefineConstants (string defineConstants);
+               
+               bool SetDelaySign (bool delaySign);
+               
+               bool SetDisabledWarnings (string disabledWarnings);
+               
+               bool SetDocumentationFile (string documentationFile);
+               
+               bool SetErrorReport (string errorReport);
+               
+               bool SetFileAlignment (int fileAlignment);
+               
+               bool SetGenerateDocumentation (bool generateDocumentation);
+               
+               bool SetImports (ITaskItem[] importsList);
+               
+               bool SetKeyContainer (string keyContainer);
+               
+               bool SetKeyFile (string keyFile);
+               
+               bool SetLinkResources (ITaskItem[] linkResources);
+               
+               bool SetMainEntryPoint (string mainEntryPoint);
+               
+               bool SetNoConfig (bool noConfig);
+               
+               bool SetNoStandardLib (bool noStandardLib);
+               
+               bool SetNoWarnings (bool noWarnings);
+               
+               bool SetOptimize (bool optimize);
+               
+               bool SetOptionCompare (string optionCompare);
+               
+               bool SetOptionExplicit (bool optionExplicit);
+               
+               bool SetOptionStrict (bool optionStrict);
+               
+               bool SetOutputAssembly (string outputAssembly);
+               
+               bool SetPlatform (string platform);
+               
+               bool SetReferences (ITaskItem[] references);
+               
+               bool SetRemoveIntegerChecks (bool removeIntegerChecks);
+               
+               bool SetResources (ITaskItem[] resources);
+               
+               bool SetResponseFiles (ITaskItem[] responseFiles);
+               
+               bool SetRootNamespace (string rootNamespace);
+               
+               bool SetSdkPath (string sdkPath);
+               
+               bool SetSources (ITaskItem[] sources);
+               
+               bool SetTargetCompactFramework (bool targetCompactFramework);
+               
+               bool SetTargetType (string targetType);
+               
+               bool SetTreatWarningsAsErrors (bool treatWarningsAsErrors);
+               
+               bool SetWarningsAsErrors (string warningsAsErrors);
+               
+               bool SetWarningsNotAsErrors (string warningsNotAsErrors);
+               
+               bool SetWin32Icon (string win32Icon);
+               
+               bool SetWin32Resource (string win32Resource);
+       }
+}
+
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.dll.sources b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.dll.sources
new file mode 100644 (file)
index 0000000..f4760b3
--- /dev/null
@@ -0,0 +1,38 @@
+../../build/common/Consts.cs
+Assembly/AssemblyInfo.cs
+Microsoft.Build.Tasks/AL.cs
+Microsoft.Build.Tasks/AppDomainIsolatedTaskExtension.cs
+Microsoft.Build.Tasks/CommandLineBuilderExtension.cs
+Microsoft.Build.Tasks/Copy.cs
+Microsoft.Build.Tasks/CreateItem.cs
+Microsoft.Build.Tasks/CreateProperty.cs
+Microsoft.Build.Tasks/Csc.cs
+Microsoft.Build.Tasks/Delete.cs
+Microsoft.Build.Tasks/Error.cs
+Microsoft.Build.Tasks/Exec.cs
+Microsoft.Build.Tasks/FindUnderPath.cs
+Microsoft.Build.Tasks/GenerateResource.cs
+Microsoft.Build.Tasks/GenerateTrustInfo.cs
+Microsoft.Build.Tasks/GetFrameworkPath.cs
+Microsoft.Build.Tasks/GetFrameworkSdkPath.cs
+Microsoft.Build.Tasks.Hosting/ICscHostObject.cs
+Microsoft.Build.Tasks.Hosting/IVbcHostObject.cs
+Microsoft.Build.Tasks/MakeDir.cs
+Microsoft.Build.Tasks/ManagedCompiler.cs
+Microsoft.Build.Tasks/Message.cs
+Microsoft.Build.Tasks/MonoTODOAttribute.cs
+Microsoft.Build.Tasks/MSBuild.cs
+Microsoft.Build.Tasks/ReadLinesFromFile.cs
+Microsoft.Build.Tasks/RegisterAssembly.cs
+Microsoft.Build.Tasks/RemoveDir.cs
+Microsoft.Build.Tasks/SignFile.cs
+Microsoft.Build.Tasks/TaskExtension.cs
+Microsoft.Build.Tasks/ToolTaskExtension.cs
+Microsoft.Build.Tasks/Touch.cs
+Microsoft.Build.Tasks/UnregisterAssembly.cs
+Microsoft.Build.Tasks/Warning.cs
+Microsoft.Build.Tasks/WriteLinesToFile.cs
+Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceReader.cs
+Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceWriter.cs
+Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceReader.cs
+Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceWriter.cs
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.mdp b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.mdp
new file mode 100644 (file)
index 0000000..8f86f43
--- /dev/null
@@ -0,0 +1,63 @@
+<Project name="Microsoft.Build.Tasks" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="Microsoft.Build.Tasks" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="Microsoft.Build.Tasks" />
+      <Build debugmode="False" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./Microsoft.Build.Tasks/AL.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/AppDomainIsolatedTaskExtension.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/CommandLineBuilderExtension.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Copy.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/CreateItem.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/CreateProperty.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Csc.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Delete.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Error.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Exec.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/FindUnderPath.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/GenerateResource.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/GenerateTrustInfo.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/GetFrameworkPath.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/GetFrameworkSdkPath.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/MakeDir.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/ManagedCompiler.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Message.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/MonoTODOAttribute.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/MSBuild.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/ReadLinesFromFile.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/RegisterAssembly.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/RemoveDir.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/SignFile.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/TaskExtension.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/ToolTaskExtension.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Touch.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/UnregisterAssembly.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/Warning.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks/WriteLinesToFile.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks.Hosting/ICscHostObject.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Tasks.Hosting/IVbcHostObject.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceReader.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceWriter.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceReader.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceWriter.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Framework" />
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Utilities" />
+    <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+    <ProjectReference type="Gac" localcopy="True" refto="System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.mds b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.mds
new file mode 100644 (file)
index 0000000..b657aa5
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="Microsoft.Build.Tasks" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Tasks" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Tasks" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="Microsoft.Build.Tasks" single="True">
+    <Execute type="None" entry="Microsoft.Build.Tasks" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./Microsoft.Build.Tasks.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.targets b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks.targets
new file mode 100644 (file)
index 0000000..efa17f9
--- /dev/null
@@ -0,0 +1,28 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <ItemGroup>
+               <MicrosoftBuildTasksSources Include="Microsoft.Build.Tasks/Microsoft.Build.Tasks/*.cs" />
+               <MicrosoftBuildTasksSources
+                       Include="Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/*.cs"
+                       Exclude="Microsoft.Build.Tasks/Microsoft.Build.Tasks.Hosting/CscHostObject.cs"
+                />
+               <MicrosoftBuildTasksSources Include="Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/*.cs" />
+               <MicrosoftBuildTasksDll Include="Microsoft.Build.Tasks.dll" />
+               <MicrosoftBuildTasksReferences Include="Microsoft.Build.Framework.dll" />
+               <MicrosoftBuildTasksReferences Include="Microsoft.Build.Utilities.dll" />
+               <MicrosoftBuildTasksReferences Include="System.Windows.Forms" />
+       </ItemGroup>
+       <Target
+               Name="MicrosoftBuildTasks"
+               DependsOnTargets="MicrosoftBuildFramework;MicrosoftBuildUtilities"
+               Inputs="@(MicrosoftBuildTasksSources)"
+               Outputs="@(MicrosoftBuildTasksDll)"
+       >
+               <Csc
+                       Sources="@(MicrosoftBuildTasksSources)"
+                       TargetType="library"
+                       OutputAssembly="@(MicrosoftBuildTasksDll)"
+                       References="@(MicrosoftBuildTasksReferences)"
+                       WarningLevel="3"
+               />
+       </Target>
+</Project>
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AL.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AL.cs
new file mode 100644 (file)
index 0000000..cbec3b5
--- /dev/null
@@ -0,0 +1,290 @@
+//
+// AL.cs: Task for assembly linker
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class AL : ToolTaskExtension {
+       
+               // FIXME: replace all variables with Bag
+               string          algorithmId;
+               string          baseAddress;
+               string          companyName;
+               string          configuration;
+               string          copyright;
+               string          culture;
+               bool            delaySign;
+               string          description;
+               ITaskItem[]     embedResources;
+               string          evidenceFile;
+               string          fileVersion;
+               string          flags;
+               bool            generateFullPaths;
+               string          keyContainer;
+               string          keyFile;
+               ITaskItem[]     linkResources;
+               string          mainEntryPoint;
+               ITaskItem       outputAssembly;
+               string          platform;
+               string          productName;
+               string          productVersion;
+               string[]        responseFiles;
+               ITaskItem[]     sourceModules;
+               string          targetType;
+               string          templateFile;
+               string          title;
+               string          trademark;
+               string          version;
+               string          win32Icon;
+               string          win32Resource;
+
+               Process alProcess;
+       
+               public AL ()
+               {
+               }
+               
+               protected internal override void AddResponseFileCommands (
+                                                CommandLineBuilderExtension commandLine)
+               {
+                       commandLine.AppendSwitchIfNotNull ("/algid:", algorithmId);
+                       commandLine.AppendSwitchIfNotNull ("/baseaddress:", baseAddress);
+                       commandLine.AppendSwitchIfNotNull ("/company:", companyName);
+                       commandLine.AppendSwitchIfNotNull ("/configuration:", configuration);
+                       commandLine.AppendSwitchIfNotNull ("/copyright:", copyright);
+                       commandLine.AppendSwitchIfNotNull ("/culture:", culture);
+                       if (delaySign == true)
+                               commandLine.AppendSwitch ("/delaysign");
+                       foreach (ITaskItem item in embedResources)
+                               commandLine.AppendSwitchIfNotNull ("/embedresource:", item.ItemSpec);
+                       commandLine.AppendSwitchIfNotNull ("/evidence:", evidenceFile);
+                       commandLine.AppendSwitchIfNotNull ("/fileversion:", fileVersion);
+                       commandLine.AppendSwitchIfNotNull ("/flags:", flags);
+                       if (generateFullPaths == true)
+                               commandLine.AppendSwitch ("/fullpaths");
+                       commandLine.AppendSwitchIfNotNull ("/keyname:", keyContainer);
+                       commandLine.AppendSwitchIfNotNull ("/keyfile:", keyFile);
+                       foreach (ITaskItem item in linkResources)
+                               commandLine.AppendSwitchIfNotNull ("/linkresource:", item.ItemSpec);
+                       commandLine.AppendSwitchIfNotNull ("/main:", mainEntryPoint);
+                       commandLine.AppendSwitchIfNotNull ("/out:", outputAssembly.ItemSpec);
+                       //platform
+                       commandLine.AppendSwitchIfNotNull ("/product:", productName);
+                       commandLine.AppendSwitchIfNotNull ("/productversion:", productVersion);
+                       foreach (string s in responseFiles)
+                               commandLine.AppendFileNameIfNotNull (String.Format ("@{0}", s));
+                       foreach (ITaskItem item in sourceModules)
+                               commandLine.AppendFileNameIfNotNull (item.ItemSpec);
+                       commandLine.AppendSwitchIfNotNull ("/target:", targetType);
+                       commandLine.AppendSwitchIfNotNull ("/template:", templateFile);
+                       commandLine.AppendSwitchIfNotNull ("/title:", title);
+                       commandLine.AppendSwitchIfNotNull ("/trademark:", trademark);
+                       commandLine.AppendSwitchIfNotNull ("/version:", version);
+                       commandLine.AppendSwitchIfNotNull ("/win32icon:", win32Icon);
+                       commandLine.AppendSwitchIfNotNull ("/win32res:", win32Resource);
+               }
+               
+               public override bool Execute ()
+               {
+                       CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
+                       AddResponseFileCommands (clbe);
+                       
+                       alProcess = new Process ();
+                       alProcess.StartInfo.Arguments = clbe.ToString ();
+                       alProcess.StartInfo.FileName = GenerateFullPathToTool ();
+                       alProcess.Start ();
+                       alProcess.WaitForExit ();
+                       return true;
+               }
+
+               protected override string GenerateFullPathToTool ()
+               {
+                       return Path.Combine (ToolPath, ToolName);
+               }
+
+               public string AlgorithmId {
+                       get { return algorithmId; }
+                       set { algorithmId = value; }
+               }
+
+               public string BaseAddress {
+                       get { return baseAddress; }
+                       set { baseAddress = value; }
+               }
+
+               public string CompanyName {
+                       get { return companyName; }
+                       set { companyName = value; }
+               }
+
+               public string Configuration {
+                       get { return configuration; }
+                       set { configuration = value; }
+               }
+
+               public string Copyright {
+                       get { return copyright; }
+                       set { copyright = value; }
+               }
+
+               public string Culture {
+                       get { return culture; }
+                       set { culture = value; }
+               }
+
+               public bool DelaySign {
+                       get { return delaySign; }
+                       set { delaySign = value; }
+               }
+
+               public string Description {
+                       get { return description; }
+                       set { description = value; }
+               }
+
+               public ITaskItem[] EmbedResources {
+                       get { return embedResources; }
+                       set { embedResources = value; }
+               }
+
+               public string EvidenceFile {
+                       get { return evidenceFile; }
+                       set { evidenceFile = value; }
+               }
+
+               public string FileVersion {
+                       get { return fileVersion; }
+                       set { fileVersion = value; }
+               }
+
+               public string Flags {
+                       get { return flags; }
+                       set { flags = value; }
+               }
+
+               public bool GenerateFullPaths {
+                       get { return generateFullPaths; }
+                       set { generateFullPaths = value; }
+               }
+
+               public string KeyContainer {
+                       get { return keyContainer; }
+                       set { keyContainer = value; }
+               }
+
+               public string KeyFile {
+                       get { return keyFile; }
+                       set { keyFile = value; }
+               }
+
+               public ITaskItem[] LinkResources {
+                       get { return linkResources; }
+                       set { linkResources = value; }
+               }
+
+               public string MainEntryPoint {
+                       get { return mainEntryPoint; }
+                       set { mainEntryPoint = value; }
+               }
+
+               [Required]
+               public ITaskItem OutputAssembly {
+                       get { return outputAssembly; }
+                       set { outputAssembly = value; }
+               }
+
+               public string Platform {
+                       get { return platform; }
+                       set { platform = value; }
+               }
+
+               public string ProductName {
+                       get { return productName; }
+                       set { productName = value; }
+               }
+
+               public string ProductVersion {
+                       get { return productVersion; }
+                       set { productVersion = value; }
+               }
+
+               public string[] ResponseFiles {
+                       get { return responseFiles; }
+                       set { responseFiles = value; }
+               }
+
+               public ITaskItem[] SourceModules {
+                       get { return sourceModules; }
+                       set { sourceModules = value; }
+               }
+
+               public string TargetType {
+                       get { return targetType; }
+                       set { targetType = value; }
+               }
+
+               public string TemplateFile {
+                       get { return templateFile; }
+                       set { templateFile = value; }
+               }
+
+               public string Title {
+                       get { return title; }
+                       set { title = value; }
+               }
+
+               protected override string ToolName {
+                       get {
+                               return "al";
+                       }
+               }
+
+               public string Trademark {
+                       get { return trademark; }
+                       set { trademark = value; }
+               }
+
+               public string Version {
+                       get { return version; }
+                       set { version = value; }
+               }
+
+               public string Win32Icon {
+                       get { return win32Icon; }
+                       set { win32Icon = value; }
+               }
+
+               public string Win32Resource {
+                       get { return win32Resource; }
+                       set { win32Resource = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AppDomainIsolatedTaskExtension.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AppDomainIsolatedTaskExtension.cs
new file mode 100644 (file)
index 0000000..64104b6
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// AppDomainIsolatedTaskExtension.cs: Used by task that need to be run in
+// separate appdomains.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public abstract class AppDomainIsolatedTaskExtension : AppDomainIsolatedTask {
+               public new TaskLoggingHelper Log {
+                       get {
+                               return base.Log;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
new file mode 100644 (file)
index 0000000..3cf9985
--- /dev/null
@@ -0,0 +1,77 @@
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AppDomainIsolatedTaskExtension.cs: Changed Log property to base.Log
+       instead of previous protected log field.
+
+2005-09-03  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Touch.cs: Changed to use full paths and fixed stream closing.
+       * ReadLinesFromFile.cs: Formatting.
+       * WriteLineToFile.cs: Changed to use full paths.
+       * AL.cs: Changed ToolName.
+
+2005-08-30  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Touch.cs: Changed Console.WriteLine to Log.LogErrorFromException.
+
+2005-08-27  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Exec.cs: Removed "exited".
+       * AL.cs: Removed Regex.
+       * Csc.cs: Changed default GenerateFullPaths to false.
+
+2005-08-24  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Exec.cs: Reformatted and added try/catch.
+       * Error.cs, RemoveDir.cs, Warning.cs, Message.cs, FindUnderPath.cs,
+       GenerateResource.cs, Copy.cs: Changed to use properties.
+       * ToolTaskExtension.cs: Rewritten.
+       * TaskExtension.cs: Changed to use base property.
+       * GetFrameworkSdkPath.cs: Formatting.
+       * ManagedCompiler.cs: Changed to use Bag instead of fields.
+       * AL.cs: Moved command line arguments generation to proper method.
+       * Csc.cs: Changed to use Bag instead of fields and added support for
+       compilation.
+
+2005-08-19  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Exec.cs: Fixed arguments.
+
+2005-08-16  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Exec.cs: Added redirection of output and removed timeout handling.
+       * Copy.cs: Formatting.
+       * CommandLineBuilderExtension.cs: Formatting.
+
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CommandLineBuilderExtension.cs: Added.
+       * ToolTaskExtension.cs, GenerateTrustInfo.cs, GetFrameworkSdkPath.cs,
+       CreateItem.cs, ManagedCompiler.cs, AL.cs, MSBuild.cs,
+       GenerateResource.cs, Csc.cs, CreateProperty.cs, GetFrameworkPath.cs:
+       Updated.
+
+2005-08-11  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Exec.cs: First implementation.
+       * MakeDir.cs, GetFrameworkSdkPath.cs, RegisterAssembly.cs, Message.cs,
+       ManagedCompiler.cs, Error.cs, FindUnderPath.cs, RemoveDir.cs, AL.cs,
+       ToolTaskExtension.cs, SignFile.cs, Delete.cs, GenerateResource.cs,
+       Warnings.cs, Csc.cs, GetFrameworkPath.cs: Various fixes.
+
+2005-08-06  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CreateItem.cs, CreateProperty.cs, MSBuild.cs,: Initial check-in.
+       * Copy.cs, ReadLinesFromFile.cs, TaskExtension.cs, Touch.cs,
+       Warning.cs, WriteLinesToFile.cs: First implementation.
+
+2005-07-13  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AL.cs, AppDomainIsolatedTaskExtension.cs, Copy.cs, Csc.cs,
+       Delete.cs, Error.cs, Exec.cs, FindUnderPath.cs, GenerateResource.cs,
+       GenerateTrustInfo.cs, GetFrameworkPath.cs, GetFrameworkSdkPath.cs,
+       MSBuild.cs, MakeDir.cs, ManagedCompiler.cs, Message.cs,
+       MonoTODOAttribute.cs, ReadLinesFromFile.cs, RegisterAssembly.cs,
+       RemoveDir.cs, SignFile.cs, TaskExtension.cs, ToolTaskExtension.cs,
+       Touch.cs, UnregisterAssembly.cs, Warning.cs, WriteLinesToFile.cs:
+       initial check-in
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CommandLineBuilderExtension.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CommandLineBuilderExtension.cs
new file mode 100644 (file)
index 0000000..033ea27
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// CommandLineBuilderExtension.cs: 
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class CommandLineBuilderExtension : CommandLineBuilder {
+               
+               public CommandLineBuilderExtension ()
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Copy.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Copy.cs
new file mode 100644 (file)
index 0000000..3ac95a7
--- /dev/null
@@ -0,0 +1,165 @@
+//
+// Copy.cs: Task that can copy files
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class Copy : TaskExtension {
+       
+               ITaskItem[]     copiedFiles;
+               ITaskItem[]     destinationFiles;
+               ITaskItem       destinationFolder;
+               bool            skipUnchangedFiles;
+               ITaskItem[]     sourceFiles;
+               
+               public Copy ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       try {
+                               ArrayList temporaryCopiedFiles = new ArrayList ();
+                       
+                               if (sourceFiles.Length != destinationFiles.Length)
+                                       throw new Exception ("Number of source files is different than number of destination files.");
+                               if (destinationFiles != null && destinationFolder != null)
+                                       throw new Exception ("You must specify only one attribute from DestinationFiles and DestinationFolder");
+                               if (destinationFiles != null) {
+                                       IEnumerator source, destination;
+                                       source = sourceFiles.GetEnumerator ();
+                                       destination = destinationFiles.GetEnumerator ();
+                                       source.Reset ();
+                                       destination.Reset ();
+                                       while (source.MoveNext ()) {
+                                               destination.MoveNext ();
+                                               ITaskItem sourceItem = (ITaskItem) source.Current;
+                                               ITaskItem destinationItem = (ITaskItem) destination.Current;
+                                               string sourceFile = sourceItem.GetMetadata ("FullPath");
+                                               string destinationFile = destinationItem.GetMetadata ("FullPath");
+
+                                               if (skipUnchangedFiles == true) {
+                                                       FileInfo sourceInfo = new FileInfo (sourceFile);
+                                                       FileInfo destinationInfo = new FileInfo (destinationFile);
+                                                       if (sourceInfo.Length == destinationInfo.Length && File.GetLastWriteTime(sourceFile) <=
+                                                               File.GetLastWriteTime (destinationFile))
+                                                               continue;
+                                               }
+                                               File.Copy (sourceFile, destinationFile);
+                                               temporaryCopiedFiles.Add (source.Current);
+                                       }
+                                       
+                               } else if (destinationFolder != null) {
+                                       bool directoryCreated = false;
+                                       string destinationDirectory = destinationFolder.GetMetadata ("FullPath");
+                                       if (Directory.Exists (destinationDirectory) == false) {
+                                               Directory.CreateDirectory (destinationDirectory);
+                                               directoryCreated = true;
+                                       }
+                                       
+                                       IEnumerator source;
+                                       source = sourceFiles.GetEnumerator ();
+                                       source.Reset ();
+                                       while (source.MoveNext ()) {
+                                               ITaskItem sourceItem = (ITaskItem) source.Current;
+                                               string sourceFile = sourceItem.GetMetadata ("FullPath");
+                                               string filename = sourceItem.GetMetadata ("Filename") + sourceItem.GetMetadata ("Extension");
+                                               string destinationFile = Path.Combine (destinationDirectory,filename);
+
+                                               if (skipUnchangedFiles == true && directoryCreated == false) {
+                                                       FileInfo sourceInfo = new FileInfo (sourceFile);
+                                                       FileInfo destinationInfo = new FileInfo (destinationFile);
+                                                       if (sourceInfo.Length == destinationInfo.Length && File.GetLastWriteTime(sourceFile) <=
+                                                               File.GetLastWriteTime (destinationFile))
+                                                               continue;
+                                               }
+                                               File.Copy (sourceFile, destinationFile);
+                                               temporaryCopiedFiles.Add (source.Current);
+                                       }
+                               } else {
+                                       throw new Exception ("You must specify DestinationFolder or DestinationFiles attribute.");
+                               }
+                               copiedFiles = new ITaskItem [temporaryCopiedFiles.Count];
+                               int i  = 0;
+                               foreach (ITaskItem file in temporaryCopiedFiles)
+                                       copiedFiles [i++] = file;
+                               return true;
+                       }
+                       catch (Exception ex) {
+                               Log.LogErrorFromException (ex);
+                               return false;
+                       }
+               }
+
+               [Output]
+               public ITaskItem[] CopiedFiles {
+                       get {
+                               return copiedFiles;
+                       }
+               }
+
+               public ITaskItem[] DestinationFiles {
+                       get {
+                               return destinationFiles;
+                       }
+                       set {
+                               destinationFiles = value;
+                       }
+               }
+
+               public ITaskItem DestinationFolder {
+                       get {
+                               return destinationFolder;
+                       }
+                       set {
+                               destinationFolder = value;
+                       }
+               }
+
+               public bool SkipUnchangedFiles {
+                       get {
+                               return skipUnchangedFiles;
+                       }
+                       set {
+                               skipUnchangedFiles = value;
+                       }
+               }
+
+               public ITaskItem[] SourceFiles {
+                       get {
+                               return sourceFiles;
+                       }
+                       set {
+                               sourceFiles = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CreateItem.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CreateItem.cs
new file mode 100644 (file)
index 0000000..c8fd5cf
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// CreateItem.cs: Creates build item.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class CreateItem : TaskExtension {
+       
+               string          additionalMetadata;
+               ITaskItem[]     exclude;
+               ITaskItem[]     include;
+       
+               public CreateItem ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       return true;
+               }
+
+               public string AdditionalMetadata {
+                       get { return additionalMetadata; }
+                       set { additionalMetadata = value; }
+               }
+
+               public ITaskItem[] Exclude {
+                       get { return exclude; }
+                       set { exclude = value; }
+               }
+
+               public ITaskItem[] Include {
+                       get { return include; }
+                       set { include = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CreateProperty.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CreateProperty.cs
new file mode 100644 (file)
index 0000000..6cc2012
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// CreateProperty: Create build property.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class CreateProperty : TaskExtension {
+       
+               string value;
+               string valueSetByTask;
+       
+               public CreateProperty ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       return true;
+               }
+
+               public string Value {
+                       get { return this.@value; }
+                       set { this.@value = value; }
+               }
+
+               // FIXME: is this value after evaluation?
+               public string ValueSetByTask {
+                       get { return valueSetByTask; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Csc.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Csc.cs
new file mode 100644 (file)
index 0000000..6a3f20c
--- /dev/null
@@ -0,0 +1,220 @@
+//
+// Csc.cs: Task that runs C# compiler
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks.Hosting;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class Csc : ManagedCompiler {
+       
+               public Csc ()
+               {
+               }
+
+               // FIXME: move some commands to managedcompiler
+               protected internal override void AddResponseFileCommands (CommandLineBuilderExtension commandLine)
+               {
+                       base.AddResponseFileCommands (commandLine);
+                       
+                       commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
+                       commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ",");
+                       if (AllowUnsafeBlocks == true)
+                               commandLine.AppendSwitch ("/unsafe");
+                       //baseAddress
+                       //checkForOverflowUnderflow
+                       //commandLine.AppendSwitchIfNotNull ("/codepage:", CodePage.ToString ());
+                       //debugType
+                       commandLine.AppendSwitchIfNotNull ("/define:", DefineConstants);
+                       //delaySign
+                       commandLine.AppendSwitchIfNotNull ("/nowarn:", DisabledWarnings);
+                       commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);
+                       if (EmitDebugInformation)
+                               commandLine.AppendSwitch ("/debug");
+                       //errorReport
+                       //fileAlignment
+                       commandLine.AppendSwitchIfNotNull ("/keycontainer:", KeyContainer);
+                       commandLine.AppendSwitchIfNotNull ("/keyfile:", KeyFile);
+                       commandLine.AppendSwitchIfNotNull ("/langversion:", LangVersion);
+                       // FIXME: add ids from metadata
+                       if (LinkResources != null) {
+                               foreach (ITaskItem item in LinkResources) {
+                                       if (GenerateFullPaths)
+                                               commandLine.AppendSwitchIfNotNull ("/linkresource:", item.GetMetadata ("FullPath"));
+                                       else
+                                               commandLine.AppendSwitchIfNotNull ("/linkresource:", item.ItemSpec);
+                               }
+                       }
+                       commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
+                       //moduleAssemblyName
+                       if (NoConfig)
+                               commandLine.AppendSwitch ("/noconfig");
+                       if (NoStandardLib)
+                               commandLine.AppendSwitch ("/nostdlib");
+                       if (Optimize)
+                               commandLine.AppendSwitch ("/optimize");
+                       commandLine.AppendSwitchIfNotNull ("/out:", OutputAssembly.ItemSpec);
+                       //platform
+                       if (References != null) {
+                               foreach (ITaskItem item in References) {
+                                       commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
+                               }
+                       }
+                       if (Resources != null) {
+                               foreach (ITaskItem item in Resources) {
+                                       if (GenerateFullPaths)
+                                               commandLine.AppendSwitchIfNotNull ("/resource:", item.GetMetadata ("FullPath"));
+                                       else
+                                               commandLine.AppendSwitchIfNotNull ("/resource:", item.ItemSpec);
+                               }
+                       }
+                       if (ResponseFiles != null) {
+                               foreach (ITaskItem item in ResponseFiles) {
+                                       if (GenerateFullPaths)
+                                               commandLine.AppendFileNameIfNotNull (String.Format ("@{0}",item.GetMetadata ("FullPath")));
+                                       else
+                                               commandLine.AppendFileNameIfNotNull (String.Format ("@{0}",item.ItemSpec));
+                               }
+                       }
+                       if (Sources != null) {
+                               foreach (ITaskItem item in Sources) {
+                                       if (GenerateFullPaths)
+                                               commandLine.AppendFileNameIfNotNull (item.GetMetadata ("FullPath"));
+                                       else
+                                               commandLine.AppendFileNameIfNotNull (item.ItemSpec);
+                               }
+                       }
+                       commandLine.AppendSwitchIfNotNull ("/target:", TargetType);
+                       if (TreatWarningsAsErrors)
+                               commandLine.AppendSwitch ("/warnaserror");
+                       commandLine.AppendSwitchIfNotNull ("/warn:", WarningLevel.ToString ());
+                       //warningsAsErrors
+                       //warningNotAsErrors
+                       commandLine.AppendSwitchIfNotNull ("/win32icon:", Win32Icon);
+                       commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
+               }
+
+               protected override bool CallHostObjectToExecute ()
+               {
+                       return true;
+               }
+
+               protected override string GenerateFullPathToTool ()
+               {
+                       return "/usr/local/bin/mcs";
+               }
+
+               protected override bool InitializeHostObject (out bool appropriateHostObjectExists,
+                                                             out bool continueBuild)
+               {
+                       appropriateHostObjectExists = true;
+                       continueBuild = true;
+                       return true;
+               }
+
+               public bool AllowUnsafeBlocks {
+                       get { return GetBoolParameterWithDefault ("AllowUnsafeBlocks", false); }
+                       set { Bag ["AllowUnsafeBlocks"] = value; }
+               }
+
+               public string BaseAddress {
+                       get { return (string) Bag ["BaseAddress"]; }
+                       set { Bag ["BaseAddress"] = value; }
+               }
+
+               public bool CheckForOverflowUnderFlow {
+                       get { return GetBoolParameterWithDefault ("CheckForOverflowUnderFlow", false); }
+                       set { Bag ["CheckForOverflowUnderFlow"] = value; }
+               }
+
+               public string DisabledWarnings {
+                       get { return (string) Bag ["DisabledWarnings"]; }
+                       set { Bag ["DisabledWarnings"] = value; }
+               }
+
+               public string DocumentationFile {
+                       get { return (string) Bag ["DocumentationFile"]; }
+                       set { Bag ["DocumentationFile"] = value; }
+               }
+
+               public string ErrorReport {
+                       get { return (string) Bag ["ErrorReport"]; }
+                       set { Bag ["ErrorReport"] = value; }
+               }
+
+               public bool GenerateFullPaths {
+                       get { return GetBoolParameterWithDefault ("GenerateFullPaths", false); }
+                       set { Bag ["GenerateFullPaths"] = value; }
+               }
+
+               public string LangVersion {
+                       get { return (string) Bag ["LangVersion"]; }
+                       set { Bag ["LangVersion"] = value; }
+               }
+
+               public string ModuleAssemblyName {
+                       get { return (string) Bag ["ModuleAssemblyName"]; }
+                       set { Bag ["ModuleAssemblyName"] = value; }
+               }
+
+               public bool NoStandardLib {
+                       get { return GetBoolParameterWithDefault ("NoStandardLib", false); }
+                       set { Bag ["NoStandardLib"] = value; }
+               }
+
+               public string Platform {
+                       get { return (string) Bag ["Platform"]; }
+                       set { Bag ["Platform"] = value; }
+               }
+
+               protected override string ToolName {
+                       get { return "mcs"; }
+               }
+
+               public bool UseHostCompilerIfAvailable {
+                       get { return GetBoolParameterWithDefault ("UseHostCompilerIfAvailable", false); }
+                       set { Bag ["UseHostCompilerIfAvailable"] = value; }
+               }
+
+               public int WarningLevel {
+                       get { return GetIntParameterWithDefault ("WarningLevel", 2); }
+                       set { Bag ["WarningLevel"] = value; }
+               }
+
+               public string WarningsAsErrors {
+                       get { return (string) Bag ["WarningsAsErrors"]; }
+                       set { Bag ["WarningsAsErrors"] = value; }
+               }
+
+               public string WarningsNotAsErrors {
+                       get { return (string) Bag ["WarningsNotAsErrors"]; }
+                       set { Bag ["WarningsNotAsErrors"] = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Delete.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Delete.cs
new file mode 100644 (file)
index 0000000..fafacce
--- /dev/null
@@ -0,0 +1,126 @@
+//
+// Delete.cs: Task that deletes files.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Security;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public sealed class Delete : TaskExtension {
+       
+               ITaskItem[]     deletedFiles;
+               ITaskItem[]     files;
+               bool            treatErrorsAsWarnings;
+               
+               public Delete ()
+               {
+                       this.treatErrorsAsWarnings = false;
+               }
+
+               public override bool Execute ()
+               {
+                       ArrayList temporaryDeletedFiles = new ArrayList ();
+               
+                       foreach (ITaskItem file in files) {
+                               try {
+                                       File.Delete (file.GetMetadata ("FullPath"));
+                                       temporaryDeletedFiles.Add (file);
+                               }
+                               catch (ArgumentNullException ex) {
+                                       LogException (ex);
+                               }
+                               catch (ArgumentException ex) {
+                                       LogException (ex);
+                               }
+                               catch (DirectoryNotFoundException ex) {
+                                       LogException (ex);
+                               }
+                               catch (SecurityException ex) {
+                                       LogException (ex);
+                               }
+                               catch (UnauthorizedAccessException ex) {
+                                       LogException (ex);
+                               }
+                               catch (PathTooLongException ex) {
+                                       LogException (ex);
+                               }
+                               catch (IOException ex) {
+                                       LogException (ex);
+                               }
+                               catch (Exception ex) {
+                                       LogException (ex);
+                               }
+                       }
+                       
+                       deletedFiles = new ITaskItem [temporaryDeletedFiles.Count];
+                       int i = 0;
+                       foreach (ITaskItem file in temporaryDeletedFiles)
+                               deletedFiles [i++] = file;
+                       
+                       return true;
+               }
+               
+               private void LogException (Exception ex)
+               {
+                       if (treatErrorsAsWarnings == true)
+                               Log.LogWarningFromException (ex);
+                       else
+                               Log.LogErrorFromException (ex);
+               }
+
+               [Output]
+               public ITaskItem[] DeletedFiles {
+                       get {
+                               return deletedFiles;
+                       }
+                       set {
+                               deletedFiles = value;
+                       }
+               }
+
+               [Required]
+               public ITaskItem[] Files {
+                       get {
+                               return files;
+                       }
+                       set {
+                               files = value;
+                       }
+               }
+
+               public bool TreatErrorsAsWarnings {
+                       get {
+                               return treatErrorsAsWarnings;
+                       }
+                       set {
+                               treatErrorsAsWarnings = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Error.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Error.cs
new file mode 100644 (file)
index 0000000..7202a02
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// Error.cs: Task that reports an error.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+namespace Microsoft.Build.Tasks {
+       public sealed class Error : TaskExtension {
+               private string text;
+               
+               public Error ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       this.Log.LogError (null, null, null, BuildEngine.ProjectFileOfTaskNode,
+                               BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                               BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                               text, null);
+                       return true;
+               }
+
+               public string Text {
+                       get {
+                               return text;
+                       }
+                       set {
+                               text = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Exec.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Exec.cs
new file mode 100644 (file)
index 0000000..2f2ae18
--- /dev/null
@@ -0,0 +1,142 @@
+//
+// Exec.cs: Task that executes commands.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Threading;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class Exec : TaskExtension {
+       
+               string          command;
+               int             exitCode;
+               bool            ignoreExitCode;
+               ITaskItem[]     outputs;
+               int             timeout;
+               string          workingDirectory;
+               
+               Process         process;
+               int             executionTime;
+               
+               public Exec ()
+               {
+                       process = new Process ();
+                       timeout = Int32.MaxValue;
+                       ignoreExitCode = false;
+                       executionTime = 0;
+               }
+
+               public override bool Execute ()
+               {
+                       StringCollection temporaryOutputs = new StringCollection ();
+                       string line = null;
+                       string[] commandTable = command.Split (null, 2);
+                       string filename = commandTable [0];
+                       string arguments = "";
+                       if (commandTable.Length == 2)
+                               arguments = commandTable [1];
+               
+                       if (workingDirectory != null)
+                               process.StartInfo.WorkingDirectory = workingDirectory;
+                       process.StartInfo.FileName = filename;
+                       process.StartInfo.Arguments = arguments;
+                       process.StartInfo.RedirectStandardOutput = true;
+                       process.StartInfo.RedirectStandardError = true;
+                       process.StartInfo.UseShellExecute = false;
+                       
+                       try {
+                               process.Start ();
+                               process.WaitForExit ();
+
+                               exitCode = process.ExitCode;
+                               while ((line = process.StandardOutput.ReadLine ()) != null)
+                                       temporaryOutputs.Add (line);
+                               outputs = new ITaskItem [temporaryOutputs.Count];
+                               int i  = 0;
+                               foreach (string s in temporaryOutputs)
+                                       outputs [i++] = new TaskItem (s);
+                       }
+                       catch (Exception ex) {
+                               Log.LogErrorFromException (ex);
+                               return false;
+                       }
+                       
+                       if (exitCode != 0 && ignoreExitCode == false)
+                               return false;
+                       else
+                               return true;
+               }
+               
+               [Required]
+               public string Command {
+                       get { return command; }
+                       set { command = value; }
+               }
+
+               [Output]
+               public int ExitCode {
+                       get { return exitCode; }
+               }
+
+               public bool IgnoreExitCode {
+                       get { return ignoreExitCode; }
+                       set { ignoreExitCode = value; }
+               }
+
+               [Output]
+               public ITaskItem[] Outputs {
+                       get { return outputs; }
+                       set { outputs = value; }
+               }
+
+               public Encoding StandardErrorEncoding {
+                       get { return Console.Error.Encoding; }
+                       set { Console.SetError (new StreamWriter(Console.OpenStandardError (), value)); }
+               }
+
+               public Encoding StandardOutputEncoding {
+                       get { return Console.Out.Encoding; }
+                       set { Console.SetOut (new StreamWriter (Console.OpenStandardOutput (), value)); }
+               }
+
+               public int Timeout {
+                       get { return timeout; }
+                       set { timeout = value; }
+               }
+
+               public string WorkingDirectory {
+                       get { return workingDirectory; }
+                       set { workingDirectory = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/FindUnderPath.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/FindUnderPath.cs
new file mode 100644 (file)
index 0000000..f626ab5
--- /dev/null
@@ -0,0 +1,134 @@
+//
+// FindUnderPath.cs: Find files under the path.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class FindUnderPath : TaskExtension {
+       
+               ITaskItem[]     files;
+               ITaskItem[]     inPath;
+               ITaskItem[]     outOfPath;
+               ITaskItem       path;
+               
+               public FindUnderPath ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       ArrayList temporaryInPath = new ArrayList ();
+                       ArrayList temporaryOutOfPath = new ArrayList ();
+                       
+                       if (path == null) {
+                               Log.LogError (null, null, null, BuildEngine.ProjectFileOfTaskNode,
+                                       BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                                       BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                                       "Path attribute must be specified", null);
+                               return false;
+                       }
+                       
+                       foreach (ITaskItem file in files) {
+                               try {
+                                       string fullPath = path.GetMetadata ("FullPath");;
+                                       string fileFullPath = file.GetMetadata ("FullPath");
+                                       if (System.IO.Path.GetDirectoryName (fullPath) != null) {
+                                               string fullPath1 = fullPath + System.IO.Path.DirectorySeparatorChar;
+                                               string fullPath2 = fullPath + System.IO.Path.AltDirectorySeparatorChar;
+                                               if (fileFullPath.StartsWith (fullPath1) || fileFullPath.StartsWith (fullPath2))
+                                                       temporaryInPath.Add (file);
+                                               else
+                                                       temporaryOutOfPath.Add (file);
+                                       } else if (System.IO.Path.GetDirectoryName (fullPath) == String.Empty) {
+                                               throw new Exception ("Path contains no directory information.");
+                                       } else {
+                                               if (fileFullPath.StartsWith (fullPath))
+                                                       temporaryInPath.Add (file);
+                                               else
+                                                       temporaryOutOfPath.Add (file);
+                                       }
+                               }
+                               catch (Exception ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                       }
+                       
+                       inPath = new ITaskItem [temporaryInPath.Count];
+                       int i = 0;
+                       foreach (ITaskItem file in temporaryInPath)
+                               inPath [i++] = file;
+                       outOfPath = new ITaskItem [temporaryOutOfPath.Count];
+                       i = 0;
+                       foreach (ITaskItem file in temporaryOutOfPath)
+                               outOfPath [i++] = file;
+                       
+                       return true;
+               }
+
+               public ITaskItem[] Files {
+                       get {
+                               return files;
+                       }
+                       set {
+                               files = value;
+                       }
+               }
+
+               [Output]
+               public ITaskItem[] InPath {
+                       get {
+                               return inPath;
+                       }
+                       set {
+                               inPath = value;
+                       }
+               }
+
+               [Output]
+               public ITaskItem[] OutOfPath {
+                       get {
+                               return outOfPath;
+                       }
+                       set {
+                               outOfPath = value;
+                       }
+               }
+
+               [Required]
+               public ITaskItem Path {
+                       get {
+                               return path;
+                       }
+                       set {
+                               path = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GenerateResource.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GenerateResource.cs
new file mode 100644 (file)
index 0000000..80b385d
--- /dev/null
@@ -0,0 +1,270 @@
+//
+// GenerateResource.cs: Task that generates the resources.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// FIXME: code from monoresgen, add authors
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Text;
+using System.IO;
+using System.Collections;
+using System.Resources;
+using System.Reflection;
+using Microsoft.Build.Framework;
+using Mono.XBuild.Tasks.GenerateResourceInternal;
+
+namespace Microsoft.Build.Tasks {
+       public sealed class GenerateResource : TaskExtension {
+       
+               ITaskItem[]     filesWritten;
+               //bool          neverLockTypeAssemblies;
+               ITaskItem[]     outputResources;
+               ITaskItem[]     references;
+               ITaskItem[]     sources;
+               ITaskItem       stateFile;
+               string          stronglyTypedClassName;
+               string          stronglyTypedFilename;
+               string          stronglyTypedLanguage;
+               string          stronglyTypedNamespace;
+               bool            useSourcePath;
+               
+               public GenerateResource ()
+               {
+                       useSourcePath = false;
+               }
+
+               public override bool Execute ()
+               {
+                       ArrayList temporaryFilesWritten = new ArrayList ();
+                       if (sources.Length != outputResources.Length) {
+                               Log.LogErrorFromException (new Exception ("Sources count is different than OutputResources count."));
+                               return false;
+                       }
+                       
+                       if (outputResources == null) {
+                               foreach (ITaskItem source in sources) {
+                                       string sourceFile = source.ItemSpec;
+                                       string outputFile = Path.ChangeExtension (sourceFile, "resources");
+                                       CompileResourceFile (sourceFile, outputFile);
+                               }
+                       } else {
+                               IEnumerator sourceEnum, outputEnum;
+                               sourceEnum = sources.GetEnumerator ();
+                               outputEnum = outputResources.GetEnumerator ();
+                               while (sourceEnum.MoveNext ()) {
+                                       outputEnum.MoveNext ();
+                                       string sourceFile = ((ITaskItem) sourceEnum.Current).ItemSpec;
+                                       string outputFile = ((ITaskItem) outputEnum.Current).ItemSpec;
+                                       if (outputFile == String.Empty) {
+                                               Log.LogErrorFromException (new Exception ("Filename of output can not be empty."));
+                                               return false;
+                                       }
+                                       if (CompileResourceFile (sourceFile, outputFile) == false)
+                                               Log.LogErrorFromException (new Exception ("Error during compiling resource file."));
+                                               return false;
+                                       temporaryFilesWritten.Add (outputEnum.Current);
+                               }
+                       }
+                       
+                       filesWritten = new ITaskItem [temporaryFilesWritten.Count];
+                       int i = 0;
+                       foreach (ITaskItem item in temporaryFilesWritten)
+                               filesWritten [i++] = item;
+                       
+                       return true;
+               }
+               
+               private IResourceReader GetReader (Stream stream, string name)
+               {
+                       string format = Path.GetExtension (name);
+                       switch (format.ToLower ()) {
+                       case ".po":
+                               return new PoResourceReader (stream);
+                       case ".txt":
+                       case ".text":
+                               return new TxtResourceReader (stream);
+                       case ".resources":
+                               return new ResourceReader (stream);
+                       case ".resx":
+                               return new System.Resources.ResXResourceReader (stream);
+                       default:
+                               throw new Exception ("Unknown format in file " + name);
+                       }
+               }
+               
+               private IResourceWriter GetWriter (Stream stream, string name)
+               {
+                       string format = Path.GetExtension (name);
+                       switch (format.ToLower ()) {
+                       case ".po":
+                               return new PoResourceWriter (stream);
+                       case ".txt":
+                       case ".text":
+                               return new TxtResourceWriter (stream);
+                       case ".resources":
+                               return new ResourceWriter (stream);
+                       case ".resx":
+                               return new System.Resources.ResXResourceWriter (stream);
+                       default:
+                               throw new Exception ("Unknown format in file " + name);
+                       }
+               }
+               
+               private bool CompileResourceFile (string sname, string dname )
+               {
+                       FileStream source, dest;
+                       IResourceReader reader;
+                       IResourceWriter writer;
+
+                       try {
+                               source = new FileStream (sname, FileMode.Open, FileAccess.Read);
+
+                               reader = GetReader (source, sname);
+
+                               dest = new FileStream (dname, FileMode.Create, FileAccess.Write);
+                               writer = GetWriter (dest, dname);
+
+                               int rescount = 0;
+                               foreach (DictionaryEntry e in reader) {
+                                       rescount++;
+                                       object val = e.Value;
+                                       if (val is string)
+                                               writer.AddResource ((string)e.Key, (string)e.Value);
+                                       else
+                                               writer.AddResource ((string)e.Key, e.Value);
+                               }
+
+                               reader.Close ();
+                               writer.Close ();
+                       } catch (Exception e) {
+                               Log.LogErrorFromException (e);
+                               return false;
+                       }
+                       return true;
+               }
+
+               [Output]
+               public ITaskItem[] FilesWritten {
+                       get {
+                               return filesWritten;
+                       }
+                       set {
+                               filesWritten = value;
+                       }
+               }
+
+               /*public bool NeverLockTypeAssemblies {
+                       get {
+                               return neverLockTypeAssemblies;
+                       }
+                       set {
+                               neverLockTypeAssemblies = value;
+                       }
+               }*/
+
+               [Output]
+               public ITaskItem[] OutputResources {
+                       get {
+                               return outputResources;
+                       }
+                       set {
+                               outputResources = value;
+                       }
+               }
+
+               public ITaskItem[] References {
+                       get {
+                               return references;
+                       }
+                       set {
+                               references = value;
+                       }
+               }
+
+               [Required]
+               public ITaskItem[] Sources {
+                       get {
+                               return sources;
+                       }
+                       set {
+                               sources = value;
+                       }
+               }
+
+               public ITaskItem StateFile {
+                       get {
+                               return stateFile;
+                       }
+                       set {
+                               stateFile = value;
+                       }
+               }
+
+               public string StronglyTypedClassName {
+                       get {
+                               return stronglyTypedClassName;
+                       }
+                       set {
+                               stronglyTypedClassName = value;
+                       }
+               }
+
+               public string StronglyTypedFilename {
+                       get {
+                               return stronglyTypedFilename;
+                       }
+                       set {
+                               stronglyTypedFilename = value;
+                       }
+               }
+
+               public string StronglyTypedLanguage {
+                       get {
+                               return stronglyTypedLanguage;
+                       }
+                       set {
+                               stronglyTypedLanguage = value;
+                       }
+               }
+
+               public string StronglyTypedNamespace {
+                       get {
+                               return stronglyTypedNamespace;
+                       }
+                       set {
+                               stronglyTypedNamespace = value;
+                       }
+               }
+
+               public bool UseSourcePath {
+                       get {
+                               return useSourcePath;
+                       }
+                       set {
+                               useSourcePath = value;
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GenerateTrustInfo.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GenerateTrustInfo.cs
new file mode 100644 (file)
index 0000000..ba6fa3f
--- /dev/null
@@ -0,0 +1,87 @@
+//
+// GenerateTrustInfo.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// 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.
+
+// DO WE NEED IT?
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public sealed class GenerateTrustInfo : TaskExtension {
+       
+               private ITaskItem baseManifest;
+               private string excludedPermissions;
+               private string targetZone;
+               private ITaskItem trustInfoFile;
+               
+               public GenerateTrustInfo ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       return true;
+               }
+
+               public ITaskItem BaseManifest {
+                       get {
+                               return baseManifest;
+                       }
+                       set {
+                               baseManifest = value;
+                       }
+               }
+
+               public string ExcludedPermissions {
+                       get {
+                               return excludedPermissions;
+                       }
+                       set {
+                               excludedPermissions = value;
+                       }
+               }
+
+               [Required]
+               public string TargetZone {
+                       get {
+                               return targetZone;
+                       }
+                       set {
+                               targetZone = value;
+                       }
+               }
+
+               [Required]
+               public ITaskItem TrustInfoFile {
+                       get {
+                               return trustInfoFile;
+                       }
+                       set {
+                               trustInfoFile = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetFrameworkPath.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetFrameworkPath.cs
new file mode 100644 (file)
index 0000000..f991741
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// GetFrameworkPath.cs: Task that gets path to framework.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Tasks;
+
+namespace Microsoft.Build.Tasks {
+       public class GetFrameworkPath : TaskExtension {
+               
+               string  path;
+       
+               public GetFrameworkPath ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       path = "/usr/local/bin";
+                       return true;
+               }
+
+               public string Path {
+                       get {
+                               return path;
+                       }
+                       set {
+                               path = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetFrameworkSdkPath.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetFrameworkSdkPath.cs
new file mode 100644 (file)
index 0000000..5932e97
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// GetFrameworkSdkPath.cs: Gets path to SDK.
+// 
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Tasks;
+
+namespace Microsoft.Build.Tasks {
+       public class GetFrameworkSdkPath : TaskExtension {
+               
+               string  path;
+       
+               public GetFrameworkSdkPath ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       path = "/usr/local/bin";
+                       return true;
+               }
+
+               public string Path {
+                       get {
+                               return path;
+                       }
+                       set {
+                               path = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs
new file mode 100644 (file)
index 0000000..7c348c1
--- /dev/null
@@ -0,0 +1,111 @@
+//
+// MSBuild.cs: Task that can run .*proj files
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class MSBuild : TaskExtension {
+       
+               ITaskItem[]     projects;
+               string          properties;
+               bool            rebaseOutputs;
+               bool            runEachTargetSeparately;
+               bool            stopOnFirstFailure;
+               ITaskItem[]     targetOutputs;
+               string[]        targets;
+       
+               public MSBuild ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       return true;
+               }
+
+               [Required]
+               public ITaskItem[] Projects {
+                       get {
+                               return projects;
+                       }
+                       set {
+                               projects = value;
+                       }
+               }
+
+               public string Properties {
+                       get {
+                               return properties;
+                       }
+                       set {
+                               properties = value;
+                       }
+               }
+
+               public bool RebaseOutputs {
+                       get {
+                               return rebaseOutputs;
+                       }
+                       set {
+                               rebaseOutputs = value;
+                       }
+               }
+
+               public bool RunEachTargetSeparately {
+                       get {
+                               return runEachTargetSeparately;
+                       }
+                       set {
+                               runEachTargetSeparately = value;
+                       }
+               }
+
+               public bool StopOnFirstFailure {
+                       get {
+                               return stopOnFirstFailure;
+                       }
+                       set {
+                               stopOnFirstFailure = value;
+                       }
+               }
+
+               public ITaskItem[] TargetOutputs {
+                       get {
+                               return targetOutputs;
+                       }
+               }
+
+               public string[] Targets {
+                       get {
+                               return targets;
+                       }
+                       set {
+                               targets = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MakeDir.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MakeDir.cs
new file mode 100644 (file)
index 0000000..d6c411d
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// MakeDir.cs: Creates a new directory.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class MakeDir : TaskExtension {
+       
+               ITaskItem[]     directories;
+               ITaskItem[]     directoriesCreated;
+       
+               public MakeDir ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       ArrayList temporaryDirectoriesCreated = new ArrayList ();
+                       
+                       foreach (ITaskItem directory in directories) {
+                               try {
+                                       Directory.CreateDirectory (directory.GetMetadata ("FullPath"));
+                                       temporaryDirectoriesCreated.Add (directory);
+                               }
+                               catch (Exception ex) {
+                               }
+                       }
+                       
+                       directoriesCreated = new ITaskItem [temporaryDirectoriesCreated.Count];
+                       int i = 0;
+                       foreach (ITaskItem directory in temporaryDirectoriesCreated)
+                               directoriesCreated [i++] = directory;
+                       return true;
+               }
+
+               [Required]
+               public ITaskItem[] Directories {
+                       get {
+                               return directories;
+                       }
+                       set {
+                               directories = value;
+                       }
+               }
+
+               [Output]
+               public ITaskItem[] DirectoriesCreated {
+                       get {
+                               return directoriesCreated;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ManagedCompiler.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ManagedCompiler.cs
new file mode 100644 (file)
index 0000000..a454de7
--- /dev/null
@@ -0,0 +1,208 @@
+//
+// ManagedCompiler.cs: Task for compilers
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Text;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public abstract class ManagedCompiler : ToolTaskExtension {
+       
+               protected ManagedCompiler ()
+               {
+               }
+
+               protected internal override void AddCommandLineCommands (
+                                                CommandLineBuilderExtension commandLine)
+               {
+               }
+
+               protected internal override void AddResponseFileCommands (
+                                                CommandLineBuilderExtension commandLine)
+               {
+               }
+
+               protected bool CheckAllReferencesExistOnDisk ()
+               {
+                       foreach (ITaskItem item in (ITaskItem[])Bag ["References"]) 
+                               if (File.Exists (item.GetMetadata ("FullPath")) == false)
+                                       return false;
+                       return true;
+               }
+
+               protected void CheckHostObjectSupport (string parameterName,
+                                                      bool resultFromHostObjectSetOperation)
+               {
+               }
+               
+               protected override bool HandleTaskExecutionErrors (int exitCode,
+                                                                  bool taskLoggedErrors)
+               {
+                       return true;
+               }
+
+               protected override bool ValidateParameters ()
+               {
+                       return true;
+               }
+
+               public string[] AdditionalLibPaths {
+                       get { return (string[]) Bag ["AdditionalLibPaths"]; }
+                       set { Bag ["AdditionalLibPaths"] = value; }
+               }
+
+               public string[] AddModules {
+                       get { return (string[]) Bag ["AddModules"]; }
+                       set { Bag ["AddModules"] = value; }
+               }
+
+               public int CodePage {
+                       get { return GetIntParameterWithDefault ("CodePage", 0); }
+                       set { Bag ["CodePage"] = value; }
+               }
+
+               public string DebugType {
+                       get { return (string) Bag ["DebugType"]; }
+                       set { Bag ["DebugType"] = value; }
+               }
+
+               public string DefineConstants {
+                       get { return (string) Bag ["DefineConstants"]; }
+                       set { Bag ["DefineConstants"] = value; }
+               }
+
+               public bool DelaySign {
+                       get { return GetBoolParameterWithDefault ("DelaySign", false); }
+                       set { Bag ["DelaySign"] = value; }
+               }
+
+               public bool EmitDebugInformation {
+                       get { return GetBoolParameterWithDefault ("EmitDebugInformation", false); }
+                       set { Bag ["EmitDebugInformation"] = value; }
+               }
+
+               public int FileAlignment {
+                       get { return GetIntParameterWithDefault ("FileAlignment", 0); }
+                       set { Bag ["FileAlignment"] = value; }
+               }
+
+               protected bool HostCompilerSupportsAllParameters {
+                       get { return true; }
+                       set { Bag ["HostCompilerSupportsAllParameters"] = value; }
+               }
+
+               public string KeyContainer {
+                       get { return (string) Bag ["KeyContainer"]; }
+                       set { Bag ["KeyContainer"] = value; }
+               }
+
+               public string KeyFile {
+                       get { return (string) Bag ["KeyFile"]; }
+                       set { Bag ["KeyFile"] = value; }
+               }
+
+               public ITaskItem[] LinkResources {
+                       get { return (ITaskItem[]) Bag ["LinkResources"]; }
+                       set { Bag ["LinkResources"] = value; }
+               }
+
+               public string MainEntryPoint {
+                       get { return (string) Bag ["MainEntryPoint"]; }
+                       set { Bag ["MainEntryPoint"] = value; }
+               }
+
+               public bool NoConfig {
+                       get { return GetBoolParameterWithDefault ("NoConfig", false); }
+                       set { Bag ["NoConfig"] = value; }
+               }
+
+               public bool NoLogo {
+                       get { return GetBoolParameterWithDefault ("NoLogo", false); }
+                       set { Bag ["NoLogo"] = value; }
+               }
+
+               public bool Optimize {
+                       get { return GetBoolParameterWithDefault ("Optimize", false); }
+                       set { Bag ["Optimize"] = value; }
+               }
+
+               public ITaskItem OutputAssembly {
+                       get { return (ITaskItem) Bag ["OutputAssembly"]; }
+                       set { Bag ["OutputAssembly"] = value; }
+               }
+
+               public ITaskItem[] References {
+                       get { return (ITaskItem[]) Bag ["References"]; }
+                       set { Bag ["References"] = value; }
+               }
+
+               public ITaskItem[] Resources {
+                       get { return (ITaskItem[]) Bag ["Resources"]; }
+                       set { Bag ["Resources"] = value; }
+               }
+
+               public ITaskItem[] ResponseFiles {
+                       get { return (ITaskItem[]) Bag ["ResponseFiles"]; }
+                       set { Bag ["ResponseFiles"] = value; }
+               }
+
+               public ITaskItem[] Sources {
+                       get { return (ITaskItem[]) Bag ["Sources"]; }
+                       set { Bag ["Sources"] = value; }
+               }
+
+               protected override Encoding StandardOutputEncoding {
+                       get { return Console.Error.Encoding; }
+               }
+
+               public string TargetType {
+                       get { return (string) Bag ["TargetType"]; }
+                       set { Bag ["TargetType"] = value; }
+               }
+
+               public bool TreatWarningsAsErrors {
+                       get { return GetBoolParameterWithDefault ("TreatWarningsAsErrors", false); }
+                       set { Bag ["TreatWarningsAsErrors"] = value; }
+               }
+
+               public bool Utf8Output {
+                       get { return GetBoolParameterWithDefault ("Utf8Output", false); }
+                       set { Bag ["Utf8Output"] = value; }
+               }
+
+               public string Win32Icon {
+                       get { return (string) Bag ["Win32Icon"]; }
+                       set { Bag ["Win32Icon"] = value; }
+               }
+
+               public string Win32Resource {
+                       get { return (string) Bag ["Win32Resource"]; }
+                       set { Bag ["Win32Resource"] = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Message.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Message.cs
new file mode 100644 (file)
index 0000000..90ce07f
--- /dev/null
@@ -0,0 +1,81 @@
+//
+// Message.cs: Represents a message.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework; 
+using Microsoft.Build.Tasks;
+
+namespace Microsoft.Build.Tasks {
+       public sealed class Message : TaskExtension {
+       
+               MessageImportance       messageImportance;
+               string                  importance;
+               string                  text;
+       
+               public Message ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       if (importance == null)
+                               messageImportance = MessageImportance.Normal;
+                       else if (importance == "Low")
+                               messageImportance = MessageImportance.Low;
+                       else if (importance == "Normal")
+                               messageImportance = MessageImportance.Normal;
+                       else if (importance == "High")
+                               messageImportance = MessageImportance.High;
+                       else {
+                               Log.LogError (null, null, null, BuildEngine.ProjectFileOfTaskNode,
+                                       BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                                       BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                                       "Invalid Importance attribute.", null);
+                               return false;
+                       }
+                       Log.LogMessage (messageImportance, text, null);
+                       return true;
+               }
+               
+               public string Importance {
+                       get {
+                               return importance;
+                       }
+                       set {
+                               importance = value;
+                       }
+               }
+
+               public string Text {
+                       get {
+                               return text;
+                       }
+                       set {
+                               text = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MonoTODOAttribute.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MonoTODOAttribute.cs
new file mode 100644 (file)
index 0000000..7c986cf
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// MonoTODOAttribute.cs
+//
+// Author:
+//   Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System {
+       
+       [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+       internal sealed class MonoTODOAttribute : Attribute {
+
+               string comment;
+               
+               public MonoTODOAttribute ()
+               {
+               }
+
+               public MonoTODOAttribute (string comment)
+               {
+                       this.comment = comment;
+               }
+
+               public string Comment {
+                       get { return comment; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ReadLinesFromFile.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ReadLinesFromFile.cs
new file mode 100644 (file)
index 0000000..e21a826
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// ReadLinesFromFile.cs: Task that reads from file.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class ReadLinesFromFile : TaskExtension {
+       
+               ITaskItem       file;
+               ITaskItem[]     lines;
+               StreamReader    streamReader;
+       
+               public ReadLinesFromFile ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       if ( file == null)
+                               throw new ArgumentNullException ("File", "File property must be set.");
+                       try {
+                               streamReader = new StreamReader(file.GetMetadata ("FullPath"));
+                               string line;
+                               ArrayList temporaryLines = new ArrayList ();
+                               while ((line = streamReader.ReadLine ()) != null) {
+                                       temporaryLines.Add (line);
+                               }
+                               this.lines = new TaskItem [temporaryLines.Count];
+                               int i = 0;
+                               foreach (string s in temporaryLines) {
+                                       this.lines [i++] = new TaskItem (s);
+                               }
+                               return true;
+                       }
+                       catch (Exception ex) {
+                               Log.LogErrorFromException (ex);
+                               return false;
+                       }
+                       finally {
+                               streamReader.Close ();
+                       }
+                       
+               }
+
+               public ITaskItem File {
+                       get {
+                               return file;
+                       }
+                       set {
+                               file = value;
+                       }
+               }
+
+               [Output]
+               public ITaskItem[] Lines {
+                       get {
+                               return lines;
+                       }
+                       set {
+                               lines = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RegisterAssembly.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RegisterAssembly.cs
new file mode 100644 (file)
index 0000000..b48d2af
--- /dev/null
@@ -0,0 +1,98 @@
+//
+// RegisterAssembly.cs: Register an assembly into GAC.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class RegisterAssembly : AppDomainIsolatedTaskExtension, ITypeLibExporterNotifySink {
+       
+               ITaskItem[]     assemblies;
+               bool            createCodeBase;
+               ITaskItem       stateFile;
+               ITaskItem[]     typeLibFiles;
+       
+               public RegisterAssembly ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       return true;
+               }
+
+               public void ReportEvent (ExporterEventKind kind, int code,
+                                        string msg)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public object ResolveRef (Assembly assemblyToResolve)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [Required]
+               public ITaskItem[] Assemblies {
+                       get {
+                               return assemblies;
+                       }
+                       set {
+                               assemblies = value;
+                       }
+               }
+
+               public bool CreateCodeBase  {
+                       get {
+                               return createCodeBase;
+                       }
+                       set {
+                               createCodeBase = value;
+                       }
+               }
+
+               public ITaskItem StateFile {
+                       get {
+                               return stateFile;
+                       }
+                       set {
+                               stateFile = value;
+                       }
+               }
+
+               public ITaskItem[] TypeLibFiles {
+                       get {
+                               return typeLibFiles;
+                       }
+                       set {
+                               typeLibFiles = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RemoveDir.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RemoveDir.cs
new file mode 100644 (file)
index 0000000..df22223
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// RemoveDir.cs: Removes a directory.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// 
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Security;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class RemoveDir : TaskExtension {
+       
+               ITaskItem[]     directories;
+               ITaskItem[]     removedDirectories;
+       
+               public RemoveDir ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       ArrayList temporaryRemovedDirectories = new ArrayList ();
+                       
+                       foreach (ITaskItem directory in directories) {
+                               try {
+                                       Directory.Delete (directory.GetMetadata ("FullPath"), true);
+                                       temporaryRemovedDirectories.Add (directory);
+                               }
+                               catch (DirectoryNotFoundException ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                               catch (PathTooLongException ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                               catch (ArgumentNullException ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                               catch (ArgumentException ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                               catch (IOException ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                               catch (SecurityException ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                               catch (Exception ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                       }
+                       
+                       removedDirectories = new ITaskItem [temporaryRemovedDirectories.Count];
+                       int i = 0;
+                       foreach (ITaskItem directory in temporaryRemovedDirectories)
+                               removedDirectories [i++] = directory;
+                       
+                       return true;
+               }
+               
+               [Required]
+               public ITaskItem[] Directories {
+                       get {
+                               return directories;
+                       }
+                       set {
+                               directories = value;
+                       }
+               }
+
+               [Output]
+               public ITaskItem[] RemovedDirectories {
+                       get {
+                               return removedDirectories;
+                       }
+                       set {
+                               removedDirectories = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/SignFile.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/SignFile.cs
new file mode 100644 (file)
index 0000000..fa8c339
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// SignFile.cs: Signs a file.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public sealed class SignFile : Task {
+       
+               string certificateThumbprint;
+               ITaskItem signingTarget;
+               string timestampUrl;
+       
+               public SignFile ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       return true;
+               }
+
+               [Required]
+               public string CertificateThumbprint {
+                       get {
+                               return certificateThumbprint;
+                       }
+                       set {
+                               certificateThumbprint = value;
+                       }
+               }
+
+               [Required]
+               public ITaskItem SigningTarget {
+                       get {
+                               return signingTarget;
+                       }
+                       set {
+                               signingTarget = value;
+                       }
+               }
+
+               public string TimestampUrl {
+                       get {
+                               return timestampUrl;
+                       }
+                       set {
+                               timestampUrl = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/TaskExtension.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/TaskExtension.cs
new file mode 100644 (file)
index 0000000..83c7858
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// TaskExtension.cs: Extended Task that is used as a base class by most of
+// tasks.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public abstract class TaskExtension : Task {
+               public new TaskLoggingHelper Log {
+                       get { return base.Log; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ToolTaskExtension.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ToolTaskExtension.cs
new file mode 100644 (file)
index 0000000..3725137
--- /dev/null
@@ -0,0 +1,90 @@
+//
+// ToolTaskExtension.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System.Collections;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public abstract class ToolTaskExtension : ToolTask {
+       
+               Hashtable bag;
+
+               protected internal virtual void AddCommandLineCommands (
+                                               CommandLineBuilderExtension commandLine)
+               {
+               }
+
+               protected internal virtual void AddResponseFileCommands (
+                                               CommandLineBuilderExtension commandLine)
+               {
+               }
+       
+               protected override string GenerateCommandLineCommands ()
+               {
+                       CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
+                       AddCommandLineCommands (clbe);
+                       return clbe.ToString ();
+               }
+
+               protected override string GenerateResponseFileCommands ()
+               {
+                       CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
+                       AddResponseFileCommands (clbe);
+                       return clbe.ToString ();
+               }
+
+               protected internal bool GetBoolParameterWithDefault (string parameterName,
+                                                                    bool defaultValue)
+               {
+                       if (Bag.Contains (parameterName))
+                               return (bool) Bag [parameterName];
+                       else
+                               return defaultValue;
+               }
+
+               protected internal int GetIntParameterWithDefault (string parameterName,
+                                                                  int defaultValue)
+               {
+                       if (Bag.Contains (parameterName))
+                               return (int) Bag [parameterName];
+                       else
+                               return defaultValue;
+               }
+
+               protected internal Hashtable Bag {
+                       get {
+                               if (bag == null)
+                                       bag = new Hashtable ();
+                               return bag;
+                       }
+               }
+
+               public new TaskLoggingHelper Log {
+                       get { return base.Log; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Touch.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Touch.cs
new file mode 100644 (file)
index 0000000..d433bc1
--- /dev/null
@@ -0,0 +1,137 @@
+//
+// Touch.cs: Creates a new file.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class Touch : TaskExtension {
+               bool            alwaysCreate;
+               ITaskItem[]     files;
+               bool            forceTouch;
+               DateTime        time;
+               ITaskItem[]     touchedFiles;
+       
+               public Touch ()
+               {
+                       time = DateTime.Now;
+               }
+
+               public override bool Execute ()
+               {
+                       bool returnBoolean = false;
+                       ArrayList successfulFiles = new ArrayList ();
+                       Stream stream = null;
+                       
+                       foreach (ITaskItem file in files) {
+                               string fullname = file.GetMetadata ("FullPath");
+                               try {
+                                       if (File.Exists (file.ItemSpec)) {
+                                               if ((File.GetAttributes (fullname) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) {
+                                                       if (forceTouch) {
+                                                               File.SetLastAccessTime (fullname, time);
+                                                               File.SetLastWriteTime (fullname, time);
+                                                               successfulFiles.Add (file);
+                                                       }
+                                               } else {
+                                                       File.SetLastAccessTime (fullname, time);
+                                                       File.SetLastWriteTime (fullname, time);
+                                                       successfulFiles.Add (file);
+                                               }
+                                       } else if (alwaysCreate == true) {
+                                               stream = File.Create (fullname);
+                                               stream.Close ();
+                                               File.SetLastAccessTime (fullname, time);
+                                               File.SetLastWriteTime (fullname, time);
+                                               successfulFiles.Add (file);
+                                               returnBoolean = true;
+                                       } else {
+                                               ;
+                                       }
+                                       touchedFiles = new TaskItem [successfulFiles.Count];
+                                       int i = 0;
+                                       foreach (ITaskItem item in successfulFiles)
+                                               touchedFiles [i++] = item;
+                               }
+                               catch (Exception ex) {
+                                       Log.LogErrorFromException (ex);
+                               }
+                       }
+                       return returnBoolean;
+               }
+
+               public bool AlwaysCreate {
+                       get {
+                               return alwaysCreate;
+                       }
+                       set {
+                               alwaysCreate = value;
+                       }
+               }
+
+               [Required]
+               public ITaskItem[] Files {
+                       get {
+                               return files;
+                       }
+                       set {
+                               files = value;
+                       }
+               }
+
+               public bool ForceTouch {
+                       get {
+                               return forceTouch;
+                       }
+                       set {
+                               forceTouch = value;
+                       }
+               }
+
+               public string Time {
+                       get {
+                               return time.ToString ();
+                       }
+                       set {
+                               time = DateTime.Parse (value);
+                       }
+               }
+
+               [Output]
+               public ITaskItem[] TouchedFiles {
+                       get {
+                               return touchedFiles;
+                       }
+                       set {
+                               touchedFiles = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/UnregisterAssembly.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/UnregisterAssembly.cs
new file mode 100644 (file)
index 0000000..6e8d4e4
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// UnregisterAssembly.cs: Unregister an assembly from GAC.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Tasks {
+       public class UnregisterAssembly : AppDomainIsolatedTaskExtension {
+               private ITaskItem[] assemblies;
+               private ITaskItem stateFile;
+               private ITaskItem[] typeLibFiles;
+       
+               public UnregisterAssembly ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       return true;
+               }
+
+               // [Required]
+               public ITaskItem[] Assemblies {
+                       get {
+                               return assemblies;
+                       }
+                       set {
+                               assemblies = value;
+                       }
+               }
+
+               public ITaskItem StateFile {
+                       get {
+                               return stateFile;
+                       }
+                       set {
+                               stateFile = value;
+                       }
+               }
+
+               public ITaskItem[] TypeLibFiles {
+                       get {
+                               return typeLibFiles;
+                       }
+                       set {
+                               typeLibFiles = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Warning.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Warning.cs
new file mode 100644 (file)
index 0000000..b8b84d9
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// Warning.cs: Task that reports a warning.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public sealed class Warning : TaskExtension {
+               
+               string  text;
+       
+               public Warning ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       if (text == null)
+                               text = String.Empty;
+                       Log.LogWarning (null, null, null, BuildEngine.ProjectFileOfTaskNode,
+                               BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                               BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
+                               text, null);
+                       return true;
+               }
+
+               public string Text {
+                       get {
+                               return text;
+                       }
+                       set {
+                               text = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/WriteLinesToFile.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/WriteLinesToFile.cs
new file mode 100644 (file)
index 0000000..93bb202
--- /dev/null
@@ -0,0 +1,100 @@
+//
+// WriteLineToFile.cs: Writes lines to file.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.Build.Tasks {
+       public class WriteLinesToFile : TaskExtension {
+       
+               ITaskItem       file;
+               ITaskItem[]     lines;
+               bool            overwrite;
+               
+               StreamWriter    streamWriter;
+       
+               public WriteLinesToFile ()
+               {
+               }
+
+               public override bool Execute ()
+               {
+                       if (file == null)
+                               throw new ArgumentNullException  ("file", "File TaskItem must be set.");
+                       if (file.ItemSpec == String.Empty)
+                               throw new ArgumentException ("File must be specified in ItemSpec.");
+                       try {
+                               streamWriter = new StreamWriter (file.GetMetadata ("FullPath"), !overwrite);
+                               foreach (ITaskItem line in lines) {
+                                       streamWriter.WriteLine (line);
+                               }
+                               return true;
+                       }
+                       catch (Exception ex) {
+                               Log.LogErrorFromException (ex);
+                               return false;
+                       }
+                       finally {
+                               if (streamWriter != null)
+                                       streamWriter.Close ();
+                       }
+               }
+
+               [Required]
+               public ITaskItem File {
+                       get {
+                               return file;
+                       }
+                       set {
+                               file = value;
+                       }
+               }
+
+               [Required]
+               public ITaskItem[] Lines {
+                       get {
+                               return lines;
+                       }
+                       set {
+                               lines  = value;
+                       }
+               }
+
+               public bool Overwrite {
+                       get {
+                               return overwrite;
+                       }
+                       set {
+                               overwrite = value;
+                       }
+               }
+       }
+}
+
diff --git a/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/ChangeLog b/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/ChangeLog
new file mode 100644 (file)
index 0000000..c9383ad
--- /dev/null
@@ -0,0 +1,5 @@
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * PoResourceReader.cs, PoResourceWriter.cs, TxtResourceReader.cs,
+       TxtResourceWriter.cs: First implementation
+
diff --git a/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceReader.cs b/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceReader.cs
new file mode 100644 (file)
index 0000000..b66b665
--- /dev/null
@@ -0,0 +1,163 @@
+//
+// PoResourceReader.cs: Reader from monoresgen.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// FIXME: code from monoresgen, add authors
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Resources;
+using System.Text;
+
+namespace Mono.XBuild.Tasks.GenerateResourceInternal {
+       internal class PoResourceReader : IResourceReader {
+               Hashtable data;
+               Stream s;
+               int line_num;
+
+               public PoResourceReader (Stream stream)
+               {
+                       data = new Hashtable ();
+                       s = stream;
+                       Load ();
+               }
+
+               public virtual void Close ()
+               {
+                       s.Close ();
+               }
+
+               public IDictionaryEnumerator GetEnumerator()
+               {
+                       return data.GetEnumerator ();
+               }
+
+               string GetValue (string line)
+               {
+                       int begin = line.IndexOf ('"');
+                       if (begin == -1)
+                               throw new FormatException (String.Format ("No begin quote at line {0}: {1}", line_num, line));
+
+                       int end = line.LastIndexOf ('"');
+                       if (end == -1)
+                               throw new FormatException (String.Format ("No closing quote at line {0}: {1}", line_num, line));
+
+                       return line.Substring (begin + 1, end - begin - 1);
+               }
+
+               void Load ()
+               {
+                       StreamReader reader = new StreamReader (s);
+                       string line;
+                       string msgid = null;
+                       string msgstr = null;
+                       bool ignoreNext = false;
+
+                       while ((line = reader.ReadLine ()) != null) {
+                               line_num++;
+                               line = line.Trim ();
+                               if (line.Length == 0)
+                                       continue;
+                                       
+                               if (line [0] == '#') {
+                                       if (line.Length == 1 || line [1] != ',')
+                                               continue;
+
+                                       if (line.IndexOf ("fuzzy") != -1) {
+                                               ignoreNext = true;
+                                               if (msgid != null) {
+                                                       if (msgstr == null)
+                                                               throw new FormatException ("Error. Line: " + line_num);
+                                                       data.Add (msgid, msgstr);
+                                                       msgid = null;
+                                                       msgstr = null;
+                                               }
+                                       }
+                                       continue;
+                               }
+                               
+                               if (line.StartsWith ("msgid ")) {
+                                       if (msgid == null && msgstr != null)
+                                               throw new FormatException ("Found 2 consecutive msgid. Line: " + line_num);
+
+                                       if (msgstr != null) {
+                                               if (!ignoreNext)
+                                                       data.Add (msgid, msgstr);
+
+                                               ignoreNext = false;
+                                               msgid = null;
+                                               msgstr = null;
+                                       }
+
+                                       msgid = GetValue (line);
+                                       continue;
+                               }
+
+                               if (line.StartsWith ("msgstr ")) {
+                                       if (msgid == null)
+                                               throw new FormatException ("msgstr with no msgid. Line: " + line_num);
+
+                                       msgstr = GetValue (line);
+                                       continue;
+                               }
+
+                               if (line [0] == '"') {
+                                       if (msgid == null || msgstr == null)
+                                               throw new FormatException ("Invalid format. Line: " + line_num);
+
+                                       msgstr += GetValue (line);
+                                       continue;
+                               }
+
+                               throw new FormatException ("Unexpected data. Line: " + line_num);
+                       }
+
+                       if (msgid != null) {
+                               if (msgstr == null)
+                                       throw new FormatException ("Expecting msgstr. Line: " + line_num);
+
+                               if (!ignoreNext)
+                                       data.Add (msgid, msgstr);
+                       }
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return GetEnumerator();
+               }
+
+               void IDisposable.Dispose ()
+               {
+                       if (data != null)
+                               data = null;
+
+                       if (s != null) {
+                               s.Close ();
+                               s = null;
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceWriter.cs b/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/PoResourceWriter.cs
new file mode 100644 (file)
index 0000000..fd547a6
--- /dev/null
@@ -0,0 +1,131 @@
+//
+// PoResourceWriter.cs: Writer from monoresgen.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// FIXME: code from monoresgen, add authors
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Resources;
+using System.Text;
+
+namespace Mono.XBuild.Tasks.GenerateResourceInternal {
+       internal class PoResourceWriter : IResourceWriter
+       {
+               TextWriter s;
+               bool headerWritten;
+               
+               public PoResourceWriter (Stream stream)
+               {
+                       s = new StreamWriter (stream);
+               }
+               
+               public void AddResource (string name, byte [] value)
+               {
+                       throw new InvalidOperationException ("Binary data not valid in a po resource file");
+               }
+               
+               public void AddResource (string name, object value)
+               {
+                       if (value is string) {
+                               AddResource (name, (string) value);
+                               return;
+                       }
+                       throw new InvalidOperationException ("Objects not valid in a po resource file");
+               }
+
+               StringBuilder ebuilder = new StringBuilder ();
+               
+               public string Escape (string ns)
+               {
+                       ebuilder.Length = 0;
+
+                       foreach (char c in ns){
+                               switch (c){
+                               case '"':
+                               case '\\':
+                                       ebuilder.Append ('\\');
+                                       ebuilder.Append (c);
+                                       break;
+                               case '\a':
+                                       ebuilder.Append ("\\a");
+                                       break;
+                               case '\n':
+                                       ebuilder.Append ("\\n");
+                                       break;
+                               case '\r':
+                                       ebuilder.Append ("\\r");
+                                       break;
+                               default:
+                                       ebuilder.Append (c);
+                                       break;
+                               }
+                       }
+                       return ebuilder.ToString ();
+               }
+               
+               public void AddResource (string name, string value)
+               {
+                       if (!headerWritten) {
+                               headerWritten = true;
+                               WriteHeader ();
+                       }
+                       
+                       s.WriteLine ("msgid \"{0}\"", Escape (name));
+                       s.WriteLine ("msgstr \"{0}\"", Escape (value));
+                       s.WriteLine ("");
+               }
+               
+               void WriteHeader ()
+               {
+                       s.WriteLine ("msgid \"\"");
+                       s.WriteLine ("msgstr \"\"");
+                       s.WriteLine ("\"MIME-Version: 1.0\\n\"");
+                       s.WriteLine ("\"Content-Type: text/plain; charset=UTF-8\\n\"");
+                       s.WriteLine ("\"Content-Transfer-Encoding: 8bit\\n\"");
+                       s.WriteLine ("\"X-Generator: Mono resgen 0.1\\n\"");
+                       s.WriteLine ("#\"Project-Id-Version: FILLME\\n\"");
+                       s.WriteLine ("#\"POT-Creation-Date: yyyy-MM-dd HH:MM+zzzz\\n\"");
+                       s.WriteLine ("#\"PO-Revision-Date: yyyy-MM-dd HH:MM+zzzz\\n\"");
+                       s.WriteLine ("#\"Last-Translator: FILLME\\n\"");
+                       s.WriteLine ("#\"Language-Team: FILLME\\n\"");
+                       s.WriteLine ("#\"Report-Msgid-Bugs-To: \\n\"");
+                       s.WriteLine ();
+               }
+
+               public void Close ()
+               {
+                       s.Close ();
+               }
+               
+               public void Dispose ()
+               {
+               }
+               
+               public void Generate ()
+               {
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceReader.cs b/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceReader.cs
new file mode 100644 (file)
index 0000000..60ba973
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// TxtResourceReader: Reader from monoresgen.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// FIXME: code from monoresgen, add authors
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Resources;
+using System.Text;
+
+namespace Mono.XBuild.Tasks.GenerateResourceInternal {
+       internal class TxtResourceReader : IResourceReader {
+               Hashtable data;
+               Stream s;
+
+               public TxtResourceReader (Stream stream)
+               {
+                       data = new Hashtable ();
+                       s = stream;
+                       Load ();
+               }
+
+               public virtual void Close ()
+               {
+               }
+
+               public IDictionaryEnumerator GetEnumerator()
+               {
+                       return data.GetEnumerator ();
+               }
+
+               void Load ()
+               {
+                       StreamReader reader = new StreamReader (s);
+                       string line, key, val;
+                       int epos, line_num = 0;
+                       while ((line = reader.ReadLine ()) != null) {
+                               line_num++;
+                               line = line.Trim ();
+                               if (line.Length == 0 || line [0] == '#' ||
+                                   line [0] == ';')
+                                       continue;
+                               epos = line.IndexOf ('=');
+                               if (epos < 0) 
+                                       throw new Exception ("Invalid format at line " + line_num);
+                               key = line.Substring (0, epos);
+                               val = line.Substring (epos + 1);
+                               key = key.Trim ();
+                               val = val.Trim ();
+                               if (key.Length == 0) 
+                                       throw new Exception ("Key is empty at line " + line_num);
+                               data.Add (key, val);
+                       }
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return ((IResourceReader) this).GetEnumerator();
+               }
+
+               void IDisposable.Dispose ()
+               {
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceWriter.cs b/mcs/class/Microsoft.Build.Tasks/Mono.XBuild.Tasks.GenerateResourceInternal/TxtResourceWriter.cs
new file mode 100644 (file)
index 0000000..04fa865
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// TxtResourceWriter: Writer from monoresgen.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+// FIXME: code from monoresgen, add authors
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Resources;
+using System.Text;
+
+namespace Mono.XBuild.Tasks.GenerateResourceInternal {
+       internal class TxtResourceWriter : IResourceWriter {
+               StreamWriter s;
+
+               public TxtResourceWriter (Stream stream)
+               {
+                       s = new StreamWriter (stream);
+               }
+
+               public void AddResource (string name, byte[] value)
+               {
+                       throw new Exception ("Binary data not valid in a text resource file");
+               }
+
+               public void AddResource (string name, object value)
+               {
+                       if (value is string) {
+                               AddResource (name, (string)value);
+                               return;
+                       }
+                       throw new Exception ("Objects not valid in a text resource file");
+               }
+
+               public void AddResource (string name, string value)
+               {
+                       s.WriteLine ("{0}={1}", name, value);
+               }
+
+               public void Close ()
+               {
+                       s.Close ();
+               }
+
+               public void Dispose ()
+               {
+               }
+
+               public void Generate ()
+               {
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Utilities/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Build.Utilities/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..37b0385
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Marek Sieradzki (mare.sieradzki@gmail.com
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the Microsoft.Build.Utilities assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyTitle("Microsoft.Build.Utilities.dll")]
+[assembly: AssemblyDescription("Microsoft.Build.Utilities.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("Marek Sieradzki")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2005 Marek Sieradzki")]
+[assembly: AssemblyTrademark("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: AssemblyDefaultAlias("Microsoft.Build.Utilities.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: ComVisible(false)]
+[assembly: AllowPartiallyTrustedCallers]
+
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
diff --git a/mcs/class/Microsoft.Build.Utilities/ChangeLog b/mcs/class/Microsoft.Build.Utilities/ChangeLog
new file mode 100644 (file)
index 0000000..f4f2cbf
--- /dev/null
@@ -0,0 +1,6 @@
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Microsoft.Build.Utilities.dll.sources: Renamed from
+       Microsoft.Build.Utilities.sources.
+       * Microsoft.Build.Utilities_test.dll.sources: Added.
+       * Makefile: Added Microsoft.Build.Framework.dll to test references.
diff --git a/mcs/class/Microsoft.Build.Utilities/Makefile b/mcs/class/Microsoft.Build.Utilities/Makefile
new file mode 100644 (file)
index 0000000..5cee6a1
--- /dev/null
@@ -0,0 +1,20 @@
+thisdir = class/Microsoft.Build.Utilities
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = Microsoft.Build.Utilities.dll
+ifeq (1.0, $(FRAMEWORK_VERSION))
+LIBRARY_NAME = dummy-Microsoft.Build.Utilities.dll
+NO_INSTALL = yes
+NO_TEST = yes
+NO_SIGN_ASSEMBLY = yes
+endif
+
+LIB_MCS_FLAGS = \
+       /r:$(corlib)                            \
+       /r:System.dll                           \
+       /r:Microsoft.Build.Framework.dll
+
+TEST_MCS_FLAGS = /r:Microsoft.Build.Framework.dll
+
+include ../../build/library.make
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.dll.sources b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.dll.sources
new file mode 100644 (file)
index 0000000..be4a8a3
--- /dev/null
@@ -0,0 +1,13 @@
+../../build/common/Consts.cs
+Assembly/AssemblyInfo.cs
+Microsoft.Build.Utilities/AppDomainIsolatedTask.cs
+Microsoft.Build.Utilities/CommandLineBuilder.cs
+Microsoft.Build.Utilities/ConcurrentLoggingHelper.cs
+Microsoft.Build.Utilities/Logger.cs
+Microsoft.Build.Utilities/MonoTODOAttribute.cs
+Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs
+Microsoft.Build.Utilities/Task.cs
+Microsoft.Build.Utilities/TaskItem.cs
+Microsoft.Build.Utilities/TaskLoggingHelper.cs
+Microsoft.Build.Utilities/ToolLocationHelper.cs
+Microsoft.Build.Utilities/ToolTask.cs
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.mdp b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.mdp
new file mode 100644 (file)
index 0000000..146de35
--- /dev/null
@@ -0,0 +1,36 @@
+<Project name="Microsoft.Build.Utilities" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="Microsoft.Build.Utilities" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="Microsoft.Build.Utilities" />
+      <Build debugmode="False" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./Microsoft.Build.Utilities/AppDomainIsolatedTask.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/CommandLineBuilder.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/ConcurrentLoggingHelper.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/Logger.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/MonoTODOAttribute.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/Task.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/TaskItem.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/TaskLoggingHelper.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/ToolLocationHelper.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.Utilities/ToolTask.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Framework" />
+    <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.mds b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.mds
new file mode 100644 (file)
index 0000000..20971ee
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="Microsoft.Build.Utilities" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Utilities" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Utilities" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="Microsoft.Build.Utilities" single="True">
+    <Execute type="None" entry="Microsoft.Build.Utilities" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./Microsoft.Build.Utilities.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.targets b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities.targets
new file mode 100644 (file)
index 0000000..53c612c
--- /dev/null
@@ -0,0 +1,21 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <ItemGroup>
+               <MicrosoftBuildUtilitiesSources Include="Microsoft.Build.Utilities/Microsoft.Build.Utilities/*.cs" />
+               <MicrosoftBuildUtilitiesDll Include="Microsoft.Build.Utilities.dll" />
+               <MicrosoftBuildUtilitiesReferences Include="Microsoft.Build.Framework.dll" />
+       </ItemGroup>
+       <Target
+               Name="MicrosoftBuildUtilities"
+               DependsOnTargets="MicrosoftBuildFramework"
+               Inputs="@(MicrosoftBuildUtilitiesSources)"
+               Outputs="@(MicrosoftBuildUtilitiesDll)"
+       >
+               <Csc
+                       Sources="@(MicrosoftBuildUtilitiesSources)"
+                       TargetType="library"
+                       OutputAssembly="@(MicrosoftBuildUtilitiesDll)"
+                       References="@(MicrosoftBuildUtilitiesReferences)"
+                       WarningLevel="3"
+                />
+       </Target>
+</Project>
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/AppDomainIsolatedTask.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/AppDomainIsolatedTask.cs
new file mode 100644 (file)
index 0000000..8cd7073
--- /dev/null
@@ -0,0 +1,109 @@
+//
+// AppDomainIsolatedTask.cs: Task that should be run separate appdomain.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Resources;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       [LoadInSeparateAppDomainAttribute]
+       public abstract class AppDomainIsolatedTask : MarshalByRefObject, ITask
+       {
+               IBuildEngine            buildEngine;
+               string                  helpKeywordPrefix;
+               object                  hostObject;
+               TaskLoggingHelper       log;
+               ResourceManager         taskResources;
+               
+               protected AppDomainIsolatedTask ()
+                       : this (null, null)
+               {
+               }
+
+               protected AppDomainIsolatedTask (ResourceManager taskResources)
+                       : this (taskResources, null)
+               {
+               }
+
+               protected AppDomainIsolatedTask (ResourceManager taskResources,
+                                                string helpKeywordPrefix)
+               {
+                       this.taskResources = taskResources;
+                       this.helpKeywordPrefix = helpKeywordPrefix;
+               }
+
+               public abstract bool Execute ();
+
+               public override object InitializeLifetimeService ()
+               {
+                       return null;
+               }
+
+               public IBuildEngine BuildEngine {
+                       get {
+                               return buildEngine;
+                       }
+                       set {
+                               buildEngine = value;
+                       }
+               }
+
+               protected string HelpKeywordPrefix {
+                       get {
+                               return helpKeywordPrefix;
+                       }
+                       set {
+                               helpKeywordPrefix = value;
+                       }
+               }
+
+               public object HostObject {
+                       get {
+                               return hostObject;
+                       }
+                       set {
+                               hostObject = value;
+                       }
+               }
+
+               public TaskLoggingHelper Log {
+                       get {
+                               return log;
+                       }
+               }
+
+               protected ResourceManager TaskResources {
+                       get {
+                               return taskResources;
+                       }
+                       set {
+                               taskResources = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ChangeLog b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ChangeLog
new file mode 100644 (file)
index 0000000..910ba7a
--- /dev/null
@@ -0,0 +1,60 @@
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CommandLineBuilder.cs, Logger.cs, AppDomainIsolatedTask.cs,
+       ConcurrentLoggingHelper.cs, TaskLoggingHelper.cs: Changed protected
+       fields to private.
+
+2005-08-30  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskItem.cs, TaskLoggingHelper.cs: Formatting.
+
+2005-08-27  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Logger.cs: Formatting.
+       * ToolTask.cs: Added error/warning handling.
+       * TaskLoggingHelper.cs: Fixed LogErrorFromException ().
+
+2005-08-24  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CommandLineBuilder.cs: Added checking for null values.
+       * ToolTask.cs: Added real execution.
+       * Task.cs: Changed all fields to private.
+       * TaskLoggingHelper.cs: Formatting.
+
+2005-08-19  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskItem.cs: MetadataCount fixed.
+
+2005-08-16  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Task.cs: Added creation of TaskLoggingHelper.cs.
+       * TaskLoggingHelper.cs: Ctor uses Task's BuildEngine.
+
+2005-08-14  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * TaskItem.cs: Added GetMetadata and fixed other functions.
+
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CommandLineBuilder.cs: Add appending spaces (currently commented)
+       * ToolTask.cs: Add process.
+
+2005-08-06  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AppDomainIsolatedTask.cs, CommandLineBuilder.cs,
+       ConcurrentLoggingHelper.cs, Logger.cs, Task.cs, TaskItem.cs,
+       TaskLoggingHelper.cs, ToolTask.cs: Various fixes.
+
+2005-07-13  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Logger.cs, AppDomainIsolatedTask.cs, ToolTask.cs, TaskItem.cs,
+       ConcurrentLoggingHelper.cs, TaskLoggingHelper.cs: Small fixes, still
+       unusable
+
+2005-07-05  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AppDomainIsolatedTask.cs, CommandLineBuilder.cs,
+       ConcurrentLoggingHelper.cs, Logger.cs, MonoTODOAttribute.cs,
+       TargetDotNetFrameworkVersion.cs, Task.cs, TaskItem.cs,
+       TaskLoggingHelper.cs, ToolLocationHelper.cs, ToolTask.cs: Initial
+       check-in, very buggy
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/CommandLineBuilder.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/CommandLineBuilder.cs
new file mode 100644 (file)
index 0000000..8910d1d
--- /dev/null
@@ -0,0 +1,283 @@
+//
+// CommandLineBuilder.cs: Builds command line options string
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+using System;
+using System.Text;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       public class CommandLineBuilder
+       {
+               StringBuilder commandLine;
+       
+               public CommandLineBuilder ()
+               {
+                       commandLine = new StringBuilder ();
+               }
+               
+               public void AppendFileNameIfNotNull (string fileName)
+               {
+                       if (fileName == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.Append (fileName);
+               }
+               
+               public void AppendFileNameIfNotNull (ITaskItem fileItem)
+               {
+                       if (fileItem == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.Append (fileItem.ToString());
+               }
+               
+               public void AppendFileNamesIfNotNull (string[] fileNames,
+                                                     string delimiter)
+               {
+                       if (fileNames == null)
+                               return;
+                       bool appendDelimiter = false;
+                       AppendSpaceIfNotEmpty ();
+                       for (int i = 0; i < fileNames.Length; i++) {
+                               if (fileNames [i] == null)
+                                       continue;
+                               if (appendDelimiter) {
+                                       commandLine.Append (delimiter);
+                                       commandLine.Append (fileNames [i]);
+                               } else {
+                                       commandLine.Append (fileNames [i]);
+                                       appendDelimiter = true;
+                               }
+                       }
+               }
+               
+               public void AppendFileNamesIfNotNull (ITaskItem[] fileItems,
+                                                     string delimiter)
+               {
+                       if (fileItems == null)
+                               return;
+                       bool appendDelimiter = false;
+                       AppendSpaceIfNotEmpty ();
+                       for (int i = 0; i < fileItems.Length; i++) {
+                               if (fileItems [i] == null)
+                                       continue;
+                               if (appendDelimiter) {
+                                       commandLine.Append (delimiter);
+                                       commandLine.Append (fileItems [i].ToString ());
+                               } else {
+                                       commandLine.Append (fileItems [i].ToString ());
+                                       appendDelimiter = true;
+                               }
+                       }
+               }
+               
+               protected void AppendFileNamesWithQuoting (string fileName)
+               {
+                       if (IsQuotingRequired (fileName))
+                               commandLine.AppendFormat ("\"{0}\"",fileName);
+                       else
+                               commandLine.Append (fileName);
+               }
+               
+               protected void AppendSpaceIfNotEmpty ()
+               {
+                       if (commandLine.Length != 0)
+                               commandLine.Append (' ');
+               }
+               
+               public void AppendSwitch (string switchName)
+               {
+                       if (switchName == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.Append (switchName);
+               }
+               
+               public void AppendSwitchIfNotNull (string switchName,
+                                                  string parameter)
+               {
+                       if (switchName == null || parameter == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}{1}",switchName,
+                               parameter);
+               }
+               
+               public void AppendSwitchIfNotNull (string switchName,
+                                                  ITaskItem parameter)
+               {
+                       if (switchName == null || parameter == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}{1}",switchName,
+                               parameter.ToString ());
+               }
+               
+               public void AppendSwitchIfNotNull (string switchName,
+                                                  string[] parameters,
+                                                  string delimiter)
+               {
+                       if (switchName == null || parameters == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}",switchName);
+                       bool appendDelimiter = false;
+                       for (int i = 0; i < parameters.Length; i++) {
+                               if (parameters [i] == null)
+                                       continue;
+                               if (appendDelimiter) {
+                                       commandLine.Append (delimiter);
+                                       commandLine.Append (parameters [i]);
+                               } else {
+                                       commandLine.Append (parameters [i]);
+                                       appendDelimiter = true;
+                               }
+                       }
+               }
+               
+               public void AppendSwitchIfNotNull (string switchName,
+                                                  ITaskItem[] parameters,
+                                                  string delimiter)
+               {
+                       if (switchName == null || parameters == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}",switchName);
+                       bool appendDelimiter = false;
+                       for (int i = 0; i < parameters.Length; i++) {
+                               if (parameters [i] == null)
+                                       continue;
+                               if (appendDelimiter) {
+                                       commandLine.Append (delimiter);
+                                       commandLine.Append (parameters [i].ToString ());
+                               } else {
+                                       commandLine.Append (parameters [i].ToString ());
+                                       appendDelimiter = true;
+                               }
+                       }
+               }
+               
+               public void AppendSwitchUnquotedIfNotNull (string switchName,
+                                                          string parameter)
+               {
+                       if (switchName == null || parameter == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}{1}", switchName, parameter);
+               }
+
+               public void AppendSwitchUnquotedIfNotNull (string switchName,
+                                                          ITaskItem parameter)
+               {
+                       if (switchName == null || parameter == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}{1}", switchName, parameter.GetMetadata ("Include"));
+               }
+
+               public void AppendSwitchUnquotedIfNotNull (string switchName,
+                                                          string[] parameters,
+                                                          string delimiter)
+               {
+                       if (switchName == null || delimiter == null || parameters == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}",switchName);
+                       bool appendDelimiter = false;
+                       for (int i = 0; i < parameters.Length; i++) {
+                               if (parameters [i] == null)
+                                       continue; 
+                               if (appendDelimiter) {
+                                       commandLine.Append (delimiter);
+                                       commandLine.Append (parameters [i]);
+                               } else {
+                                       commandLine.Append (parameters [i]);
+                                       appendDelimiter = true;
+                               }
+                       }
+               }
+
+               public void AppendSwitchUnquotedIfNotNull (string switchName,
+                                                          ITaskItem[] parameters,
+                                                          string delimiter)
+               {
+                       if (switchName == null || delimiter == null || parameters == null)
+                               return;
+                       AppendSpaceIfNotEmpty ();
+                       commandLine.AppendFormat ("{0}",switchName);
+                       bool appendDelimiter = false;
+                       for (int i = 0; i < parameters.Length; i++) {
+                               if (parameters [i] == null)
+                                       continue;
+                               if (appendDelimiter) {
+                                       commandLine.Append (delimiter);
+                                       commandLine.Append (parameters [i].ToString ());
+                               } else {
+                                       commandLine.Append (parameters [i].ToString ());
+                                       appendDelimiter = true;
+                               }
+                       }
+               }
+               
+               protected void AppendTextUnquoted (string textToAppend)
+               {
+                       commandLine.Append (textToAppend);
+               }
+               
+               protected void AppendTextWithQuoting (string textToAppend)
+               {
+                       if (IsQuotingRequired (textToAppend))
+                               commandLine.AppendFormat ("\"{0}\"",textToAppend);
+                       else
+                               commandLine.Append (textToAppend);
+               }
+               
+               protected virtual bool IsQuotingRequired (string parameter)
+               {
+                       parameter.Trim ();
+                       // FIXME: change this to regex
+                       foreach (char c in parameter) {
+                               if (c == ' ' || c == '\t' || c == '\u000b' || c == '\u000c')
+                                       return true;
+                       }
+                       return false;
+               }
+               
+               public override string ToString ()
+               {
+                       return commandLine.ToString ();
+               }
+               
+               protected StringBuilder CommandLine {
+                       get {
+                               return commandLine;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ConcurrentLoggingHelper.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ConcurrentLoggingHelper.cs
new file mode 100644 (file)
index 0000000..1961bb6
--- /dev/null
@@ -0,0 +1,111 @@
+//
+// ConcurrentLoggingHelper.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+using System;
+using System.IO;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       public class ConcurrentLoggingHelper
+       {
+               bool                    hasLoggedErrors;
+               MessageImportance       messageImportance;
+               StreamReader            messageStream;
+               TaskLoggingHelper       taskLog;
+               
+               public ConcurrentLoggingHelper ()
+                       : this (null, null, MessageImportance.Normal)
+               {
+               }
+               
+               public ConcurrentLoggingHelper (TaskLoggingHelper taskLog,
+                                               StreamReader messageStream,
+                                               MessageImportance messageImportance)
+               {
+                       this.taskLog = taskLog;
+                       this.messageStream = messageStream;
+                       this.messageImportance = messageImportance;
+                       this.hasLoggedErrors = false;
+               }
+               
+               [MonoTODO]
+               public void AbortLogging ()
+               {
+               }
+               
+               [MonoTODO]
+               public void StartLogging ()
+               {
+               }
+               
+               [MonoTODO]
+               public void StopLogging ()
+               {
+               }
+               
+               [MonoTODO]
+               public bool StopLogging (TimeSpan timeout)
+               {
+                       return true;
+               }
+               
+               public bool HasLoggedErrors {
+                       get {
+                               return hasLoggedErrors;
+                       }
+               }
+               
+               public MessageImportance MessageImportance {
+                       get {
+                               return messageImportance;
+                       }
+                       set {
+                               messageImportance = value;
+                       }
+               }
+               
+               public StreamReader MessageStream {
+                       get {
+                               return messageStream;
+                       }
+                       set {
+                               messageStream = value;
+                       }
+               }
+               
+               public TaskLoggingHelper TaskLog {
+                       get {
+                               return taskLog;
+                       }
+                       set {
+                               taskLog = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Logger.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Logger.cs
new file mode 100644 (file)
index 0000000..7d38a22
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// Logger.cs: Logs warning and errors.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       public abstract class Logger : ILogger
+       {
+               string          parameters;
+               LoggerVerbosity verbosity;
+       
+               protected Logger ()
+               {
+               }
+
+               public string Parameters {
+                       get {
+                               return parameters;
+                       }
+                       set {
+                               parameters = value;
+                       }
+               }
+
+               public LoggerVerbosity Verbosity {
+                       get {
+                               return verbosity;
+                       }
+                       set {
+                               verbosity = value;
+                       }
+               }
+
+               public virtual string FormatErrorEvent (BuildErrorEventArgs args)
+               {
+                       return String.Format ("{0}({1},{2},{3},{4}): {5} error {6}: {7}",
+                               args.File, args.LineNumber, args.ColumnNumber, args.EndLineNumber, args.EndColumnNumber,
+                               args.Subcategory, args.Code, args.Message);
+               }
+
+               public virtual string FormatWarningEvent (BuildWarningEventArgs args)
+               {
+                       return String.Format ("{0}({1},{2},{3},{4}): {5} warning {6}: {7}",
+                               args.File, args.LineNumber, args.ColumnNumber, args.EndLineNumber, args.EndColumnNumber,
+                               args.Subcategory, args.Code, args.Message);
+               }
+
+               public abstract void Initialize (IEventSource eventSource);
+
+               public virtual void Shutdown ()
+               {
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/MonoTODOAttribute.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/MonoTODOAttribute.cs
new file mode 100644 (file)
index 0000000..7c986cf
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// MonoTODOAttribute.cs
+//
+// Author:
+//   Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System {
+       
+       [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+       internal sealed class MonoTODOAttribute : Attribute {
+
+               string comment;
+               
+               public MonoTODOAttribute ()
+               {
+               }
+
+               public MonoTODOAttribute (string comment)
+               {
+                       this.comment = comment;
+               }
+
+               public string Comment {
+                       get { return comment; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs
new file mode 100644 (file)
index 0000000..2dfa78d
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// TargetDotNetFrameworkVersion.cs: Represents framework version.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+namespace Microsoft.Build.Utilities
+{
+       public enum TargetDotNetFrameworkVersion
+       {
+               Version11,
+               Version20,
+               VersionLatest = Version20
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Task.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Task.cs
new file mode 100644 (file)
index 0000000..18c1913
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// Task.cs: Represents a task.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Resources;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       public abstract class Task : ITask
+       {
+               IBuildEngine            buildEngine;
+               string                  helpKeywordPrefix;
+               object                  hostObject;
+               TaskLoggingHelper       log;
+               ResourceManager         taskResources;
+               
+               protected Task()
+                       : this (null, null)
+               {
+               }
+
+               protected Task(ResourceManager taskResources)
+                       : this (taskResources, null)
+               {
+               }
+
+               protected Task(ResourceManager taskResources,
+                              string helpKeywordPrefix)
+               {
+                       this.taskResources = taskResources;
+                       this.helpKeywordPrefix = helpKeywordPrefix;
+               }
+
+               public abstract bool Execute();
+
+               public IBuildEngine BuildEngine {
+                       get {
+                               return buildEngine;
+                       }
+                       set {
+                               buildEngine = value;
+                               log = new TaskLoggingHelper (this); 
+                       }
+               }
+
+               protected string HelpKeywordPrefix {
+                       get {
+                               return helpKeywordPrefix;
+                       }
+                       set {
+                               helpKeywordPrefix = value;
+                       }
+               }
+
+               public object HostObject {
+                       get {
+                               return hostObject;
+                       }
+                       set {
+                               hostObject = value;
+                       }
+               }
+
+               public TaskLoggingHelper Log {
+                       get {
+                               return log;
+                       }
+               }
+
+               protected ResourceManager TaskResources {
+                       get {
+                               return taskResources;
+                       }
+                       set {
+                               taskResources = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TaskItem.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TaskItem.cs
new file mode 100644 (file)
index 0000000..7a94e63
--- /dev/null
@@ -0,0 +1,156 @@
+//
+// TaskItem.cs: Represents an item belonging to a task.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.IO;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       public sealed class TaskItem : MarshalByRefObject, ITaskItem
+       {
+               IDictionary     metadata;
+               string          itemSpec;
+               string          recursiveDir;
+               
+               public TaskItem ()
+               {
+                       this.itemSpec = String.Empty;
+                       this.recursiveDir = String.Empty;
+                       this.metadata = new Hashtable (new CaseInsensitiveHashCodeProvider (), new CaseInsensitiveComparer ());
+               }
+
+               public TaskItem (ITaskItem sourceItem)
+               {
+                       this.itemSpec = sourceItem.ItemSpec;
+                       this.recursiveDir = String.Empty;
+                       this.metadata = sourceItem.CloneCustomMetadata ();
+               }
+
+               public TaskItem (string itemSpec)
+               {
+                       this.ItemSpec = itemSpec;
+                       this.recursiveDir = String.Empty;
+                       metadata = new Hashtable (new CaseInsensitiveHashCodeProvider (), new CaseInsensitiveComparer ());
+               }
+
+               public TaskItem (string itemSpec, IDictionary itemMetadata)
+               {
+                       this.itemSpec = itemSpec;
+                       this.recursiveDir = String.Empty;
+                       this.metadata = itemMetadata;
+               }
+
+               public IDictionary CloneCustomMetadata ()
+               {
+                       IDictionary clonedMetadata = new Hashtable (new CaseInsensitiveHashCodeProvider (), new CaseInsensitiveComparer ());
+                       foreach (DictionaryEntry de in metadata)
+                               clonedMetadata.Add (de.Key, de.Value);
+                       return clonedMetadata;
+               }
+
+               public void CopyMetadataTo (ITaskItem destinationItem)
+               {
+                       foreach (DictionaryEntry e in metadata) {
+                               destinationItem.SetMetadata ((string)e.Key, (string)e.Value);
+                       }
+               }
+
+               public static explicit operator string (TaskItem taskItemToCast)
+               {
+                       return taskItemToCast.ToString ();
+               }
+
+               public string GetMetadata (string metadataName)
+               {
+                       switch (metadataName.ToLower ()) {
+                       case "fullpath":
+                               return Path.GetFullPath (itemSpec);
+                       case "rootdir":
+                               return "/";
+                       case "filename":
+                               return Path.GetFileNameWithoutExtension (itemSpec);
+                       case "extension":
+                               return Path.GetExtension (itemSpec);
+                       case "relativedir":
+                               return Path.GetDirectoryName (itemSpec);
+                       case "directory":
+                               return Path.GetDirectoryName (Path.GetFullPath (itemSpec));
+                       case "recursivedir":
+                               return recursiveDir;
+                       case "identity":
+                               return Path.Combine (Path.GetDirectoryName (itemSpec), Path.GetFileName (itemSpec));
+                       case "modifiedtime":
+                               return File.GetLastWriteTime (itemSpec).ToString ();
+                       case "createdtime":
+                               return File.GetCreationTime (itemSpec).ToString ();
+                       case "accessedtime":
+                               return File.GetLastAccessTime (itemSpec).ToString ();
+                       default:
+                               return (string) metadata [metadataName];
+                       }
+               }
+
+               public override object InitializeLifetimeService ()
+               {
+                       return null;
+               }
+
+               public void RemoveMetadata (string metadataName)
+               {
+                       if (metadata.Contains (metadataName))
+                               metadata.Remove (metadataName);
+               }
+
+               public void SetMetadata (string metadataName, string metadataValue)
+               {
+                       if (metadata.Contains (metadataName))
+                               metadata.Remove (metadataName);
+                       metadata.Add (metadataName, metadataValue);
+               }
+
+               public override string ToString ()
+               {
+                       return itemSpec;
+               }
+
+               public string ItemSpec {
+                       get { return itemSpec; }
+                       set { itemSpec = value; }
+               }
+
+               public int MetadataCount {
+               // predefined metadata
+                       get { return metadata.Count + 11; }
+               }
+
+               public ICollection MetadataNames {
+                       get { return metadata.Keys; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TaskLoggingHelper.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TaskLoggingHelper.cs
new file mode 100644 (file)
index 0000000..e23c793
--- /dev/null
@@ -0,0 +1,364 @@
+//
+// TaskLoggingHelper.cs: Wrapper aroudn IBuildEngine.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Resources;
+using System.Text;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       public class TaskLoggingHelper : MarshalByRefObject
+       {
+               IBuildEngine    buildEngine;
+               bool            hasLoggedErrors;
+               string          helpKeywordPrefix;
+               string          taskName;
+               ResourceManager taskResources;
+       
+               public TaskLoggingHelper (ITask taskInstance)
+               {
+                       this.buildEngine = taskInstance.BuildEngine;
+               }
+
+               [MonoTODO]
+               public string ExtractMessageCode (string message,
+                                                 out string messageWithoutCodePrefix)
+               {
+                       messageWithoutCodePrefix = "";
+                       return "";
+               }
+
+               [MonoTODO]
+               public virtual string FormatResourceString (string resourceName,
+                                                           params object[] args)
+               {
+                       return null;
+               }
+
+               [MonoTODO]
+               public virtual string FormatString (string unformatted,
+                                                  params object[] args)
+               {
+                       return "";
+               }
+
+               public void LogError (string message,
+                                    params object[] messageArgs)
+               {
+                       BuildErrorEventArgs beea = new BuildErrorEventArgs (
+                               null, null, null, 0, 0, 0, 0, message,
+                               helpKeywordPrefix, null);
+                       buildEngine.LogErrorEvent (beea);
+                       hasLoggedErrors = true;
+               }
+
+               public void LogError (string subcategory, string errorCode,
+                                     string helpKeyword, string file,
+                                     int lineNumber, int columnNumber,
+                                     int endLineNumber, int endColumnNumber,
+                                     string message,
+                                     params object[] messageArgs)
+               {
+                       BuildErrorEventArgs beea = new BuildErrorEventArgs (
+                               subcategory, errorCode, file, lineNumber,
+                               columnNumber, endLineNumber, endColumnNumber,
+                               message, helpKeywordPrefix /*it's helpKeyword*/,
+                               null /*it's senderName*/);
+                       // FIXME: what with messageArgs?
+                       buildEngine.LogErrorEvent (beea);
+                       hasLoggedErrors = true;
+               }
+
+               public void LogErrorFromException (Exception e)
+               {
+                       LogErrorFromException (e, false);
+               }
+
+               public void LogErrorFromException (Exception e,
+                                                  bool showStackTrace)
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.Append (e.Message);
+                       if (showStackTrace == true)
+                               sb.Append (e.StackTrace);
+                       BuildErrorEventArgs beea = new BuildErrorEventArgs (
+                               null, null, null, 0, 0, 0, 0, sb.ToString (),
+                               e.HelpLink, e.Source);
+                       buildEngine.LogErrorEvent (beea);
+                       hasLoggedErrors = true;
+               }
+
+               public void LogErrorFromResources (string messageResourceName,
+                                                  params object[] messageArgs)
+               {
+                       LogErrorFromResources (null, null, null, null, 0, 0, 0,
+                               0, messageResourceName, null);
+               }
+
+               public void LogErrorFromResources (string subcategoryResourceName,
+                                                  string errorCode,
+                                                  string helpKeyword,
+                                                  string file, int lineNumber,
+                                                  int columnNumber,
+                                                  int endLineNumber,
+                                                  int endColumnNumber,
+                                                  string messageResourceName,
+                                                  params object[] messageArgs)
+               {
+                       BuildErrorEventArgs beea = new BuildErrorEventArgs (
+                               taskResources.GetString (subcategoryResourceName),
+                               errorCode, file, lineNumber, columnNumber,
+                               endLineNumber, endColumnNumber,
+                               taskResources.GetString (messageResourceName),
+                               helpKeyword, null );
+                       buildEngine.LogErrorEvent (beea);
+                       hasLoggedErrors = true;
+               }
+
+               public void LogErrorWithCodeFromResources (string messageResourceName,
+                                                         params object[] messageArgs)
+               {
+                       // FIXME: there should be something different than normal
+                       // LogErrorFromResources
+                       LogErrorFromResources (messageResourceName, messageArgs);
+               }
+
+               public void LogErrorWithCodeFromResources (string subcategoryResourceName,
+                                                         string file,
+                                                         int lineNumber,
+                                                         int columnNumber,
+                                                         int endLineNumber,
+                                                         int endColumnNumber,
+                                                         string messageResourceName,
+                                                         params object[] messageArgs)
+               {
+                       // FIXME: there should be something different than normal
+                       // LogErrorFromResources
+                       LogErrorFromResources (subcategoryResourceName, file,
+                               lineNumber, columnNumber, endLineNumber,
+                               endColumnNumber, messageResourceName,
+                               messageArgs);
+               }
+
+               public void LogMessage (string message,
+                                      params object[] messageArgs)
+               {
+                       LogMessage (MessageImportance.Normal, message,
+                               messageArgs); 
+               }
+
+               public void LogMessage (MessageImportance importance,
+                                       string message,
+                                       params object[] messageArgs)
+               {
+                       BuildMessageEventArgs bmea = new BuildMessageEventArgs (
+                               message, helpKeywordPrefix, /*helpKeyword*/
+                               null /*sender*/, importance);
+                       // FIXME: probably messageArgs contain helpKeyword or
+                       // senderName
+                       buildEngine.LogMessageEvent (bmea);
+               }
+
+               public void LogMessageFromResources (string messageResourceName,
+                                                    params object[] messageArgs)
+               {
+                       LogMessage (taskResources.GetString (messageResourceName),
+                               messageArgs);
+               }
+
+               public void LogMessageFromResources (MessageImportance importance,
+                                                    string messageResourceName,
+                                                    params object[] messageArgs)
+               {
+                       LogMessage (importance, taskResources.GetString (
+                               messageResourceName), messageArgs);
+               }
+
+               public bool LogMessagesFromFile (string filename)
+               {
+                       return LogMessagesFromFile (filename, MessageImportance.Normal);
+               }
+
+               public bool LogMessagesFromFile (string filename,
+                                                MessageImportance messageImportance)
+               {
+                       try {
+                               StreamReader sr = new StreamReader (filename);
+                               LogMessage (messageImportance, sr.ReadToEnd (),
+                                       null);
+                               sr.Close ();
+                               return true;
+                       }
+                       catch (Exception ex) {
+                               return false;
+                       }
+               }
+
+               public bool LogMessagesFromStream (TextReader stream,
+                                                  MessageImportance messageImportance,
+                                                  bool synchronize)
+               // FIXME: what about synchronize
+               {
+                       try {
+                               LogMessage (messageImportance, stream.ReadToEnd (), null);
+                               return true;
+                       }
+                       catch (Exception ex) {
+                               return false;
+                       }
+                       finally {
+                               // FIXME: should it be done here?
+                               stream.Close ();
+                       }
+               }
+
+               public void LogWarning (string message,
+                                      params object[] messageArgs)
+               {
+                       // FIXME: what about all the parameters?
+                       BuildWarningEventArgs bwea = new BuildWarningEventArgs (
+                               null, null, null, 0, 0, 0, 0, message,
+                               helpKeywordPrefix, null);
+                       buildEngine.LogWarningEvent (bwea);
+               }
+
+               public void LogWarning (string subcategory, string warningCode,
+                                       string helpKeyword, string file,
+                                       int lineNumber, int columnNumber,
+                                       int endLineNumber, int endColumnNumber,
+                                       string message,
+                                       params object[] messageArgs)
+               {
+                       BuildWarningEventArgs bwea = new BuildWarningEventArgs (
+                               subcategory, warningCode, file, lineNumber,
+                               columnNumber, endLineNumber, endColumnNumber,
+                               message, helpKeywordPrefix, null);
+                       buildEngine.LogWarningEvent (bwea);
+               }
+
+               public void LogWarningFromException (Exception e)
+               {
+                       LogWarningFromException (e, false);
+               }
+
+               public void LogWarningFromException (Exception e,
+                                                    bool showStackTrace)
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.Append (e.Message);
+                       if (showStackTrace)
+                               sb.Append (e.StackTrace);
+                       LogWarning (null, null, null, null, 0, 0, 0, 0,
+                               sb.ToString (), null);
+               }
+
+               public void LogWarningFromResources (string messageResourceName,
+                                                    params object[] messageArgs)
+               {
+                       LogWarning (taskResources.GetString (messageResourceName),
+                               messageArgs);
+               }
+
+               public void LogWarningFromResources (string subcategoryResourceName,
+                                                    string warningCode,
+                                                    string helpKeyword,
+                                                    string file,
+                                                    int lineNumber,
+                                                    int columnNumber,
+                                                    int endLineNumber,
+                                                    int endColumnNumber,
+                                                    string messageResourceName,
+                                                    params object[] messageArgs)
+               {
+                       LogWarning (taskResources.GetString (subcategoryResourceName),
+                               warningCode, helpKeyword, file, lineNumber,
+                               columnNumber, endLineNumber, endColumnNumber,
+                               taskResources.GetString (messageResourceName),
+                               messageArgs);
+               }
+
+               public void LogWarningWithCodeFromResources (string messageResourceName,
+                                                            params object[] messageArgs)
+               {
+                       // FIXME: what's different from normal logwarning?
+                       LogWarningFromResources (messageResourceName, messageArgs);
+               }
+
+               public void LogWarningWithCodeFromResources (string subcategoryResourceName,
+                                                            string file,
+                                                            int lineNumber,
+                                                            int columnNumber,
+                                                            int endLineNumber,
+                                                            int endColumnNumber,
+                                                            string messageResourceName,
+                                                            params object[] messageArgs)
+               {
+                       LogWarningFromResources (subcategoryResourceName, file,
+                               lineNumber, columnNumber, endLineNumber,
+                               endColumnNumber, messageResourceName,
+                               messageArgs);
+               }
+
+               protected IBuildEngine BuildEngine {
+                       get {
+                               return buildEngine;
+                       }
+               }
+
+               public bool HasLoggedErrors {
+                       get {
+                               return hasLoggedErrors;
+                       }
+               }
+
+               public string HelpKeywordPrefix {
+                       get {
+                               return helpKeywordPrefix;
+                       }
+                       set {
+                               helpKeywordPrefix = value;
+                       }
+               }
+
+               protected string TaskName {
+                       get {
+                               return taskName;
+                       }
+               }
+
+               public ResourceManager TaskResources {
+                       get {
+                               return taskResources;
+                       }
+                       set {
+                               taskResources = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs
new file mode 100644 (file)
index 0000000..59059a9
--- /dev/null
@@ -0,0 +1,90 @@
+// 
+// ToolLocationHelper.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace Microsoft.Build.Utilities
+{
+       public static class ToolLocationHelper
+       {
+               [MonoTODO]
+               public static string GetDotNetFrameworkRootRegistryKey (TargetDotNetFrameworkVersion version)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string GetDotNetFrameworkSdkInstallKeyValue (TargetDotNetFrameworkVersion version)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string GetDotNetFrameworkVersionFolderPrefix (TargetDotNetFrameworkVersion version)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string GetPathToDotNetFramework (TargetDotNetFrameworkVersion version)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string GetPathToDotNetFrameworkFile (string fileName,
+                                                                 TargetDotNetFrameworkVersion version)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string GetPathToDotNetFrameworkSdk (TargetDotNetFrameworkVersion version)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string GetPathToDotNetFrameworkSdkFile (string fileName,
+                                                                     TargetDotNetFrameworkVersion version)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string GetPathToSystemFile (string fileName) {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static string PathToSystem {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs
new file mode 100644 (file)
index 0000000..dff2a81
--- /dev/null
@@ -0,0 +1,282 @@
+//
+// ToolTask.cs: Base class for command line tool tasks. 
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Diagnostics;
+using System.Collections.Specialized;
+using System.Resources;
+using System.Text;
+using System.Text.RegularExpressions;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Utilities
+{
+       public abstract class ToolTask : Task
+       {
+               StringDictionary                environmentOverride;
+               int                     timeout;
+               string                  toolPath;
+               Process                 process;
+               
+               static Regex            regex;
+               
+               protected ToolTask ()
+                       : this (null, null)
+               {
+               }
+
+               protected ToolTask (ResourceManager taskResources)
+                       : this (taskResources, null)
+               {
+               }
+
+               protected ToolTask (ResourceManager taskResources,
+                                  string helpKeywordPrefix)
+               {
+                       this.TaskResources = taskResources;
+                       this.HelpKeywordPrefix = helpKeywordPrefix;
+               }
+
+               static ToolTask ()
+               {
+                       regex = new Regex (
+                               @"^\s*"
+                               + @"(((?<ORIGIN>(((\d+>)?[a-zA-Z]?:[^:]*)|([^:]*))):)"
+                               + "|())"
+                               + "(?<SUBCATEGORY>(()|([^:]*? )))"
+                               + "(?<CATEGORY>(error|warning)) "
+                               + "(?<CODE>[^:]*):"
+                               + "(?<TEXT>.*)$",
+                               RegexOptions.IgnoreCase);
+               }
+
+               protected virtual bool CallHostObjectToExecute ()
+               {
+                       return true;
+               }
+
+               public override bool Execute ()
+               {
+                       string arguments, toolFilename;
+                       
+                       arguments = String.Concat (GenerateCommandLineCommands (), " ", GenerateResponseFileCommands ());
+                       toolFilename = GenerateFullPathToTool (); 
+                       return RealExecute (toolFilename, arguments);
+               }
+               
+               private bool RealExecute (string filename, string arguments)
+               {
+                       string line;
+               
+                       if (filename == null)
+                               throw new ArgumentNullException ("filename");
+                       if (arguments == null)
+                               throw new ArgumentNullException ("arguments");
+                       
+                       process = new Process ();
+                       process.StartInfo.Arguments = arguments;
+                       process.StartInfo.CreateNoWindow = true;
+                       process.StartInfo.FileName = filename;
+                       process.StartInfo.RedirectStandardError = true;
+                       process.StartInfo.RedirectStandardOutput = true;
+                       process.StartInfo.UseShellExecute = false;
+                       
+                       Log.LogMessage (MessageImportance.Low, String.Format ("Tool {0} execution started with arguments: {1}",
+                               filename, arguments));
+                       
+                       process.Start ();
+                       process.WaitForExit ();
+                       
+                       while ((line = process.StandardError.ReadLine ()) != null) {
+                               HandleError (line);
+                       }
+                       
+                       Log.LogMessage (MessageImportance.Low, String.Format ("Tool {0} execution finished.", filename));
+                       
+                       return !Log.HasLoggedErrors;
+               }
+               
+               private void HandleError (string line)
+               {
+                       string filename, origin, category, code, subcategory, text;
+                       int lineNumber, columnNumber, endLineNumber, endColumnNumber;
+               
+                       Match m = regex.Match (line);
+                       origin = m.Groups [regex.GroupNumberFromName ("ORIGIN")].Value;
+                       category = m.Groups [regex.GroupNumberFromName ("CATEGORY")].Value;
+                       code = m.Groups [regex.GroupNumberFromName ("CODE")].Value;
+                       subcategory = m.Groups [regex.GroupNumberFromName ("SUBCATEGORY")].Value;
+                       text = m.Groups [regex.GroupNumberFromName ("TEXT")].Value;
+                       
+                       ParseOrigin (origin, out filename, out lineNumber, out columnNumber, out endLineNumber, out endColumnNumber);
+                       
+                       if (category == "warning") {
+                               Log.LogWarning (subcategory, code, null, filename, lineNumber, columnNumber, endLineNumber,
+                                       endColumnNumber, text, null);
+                       } else if (category == "error") {
+                               Log.LogError (subcategory, code, null, filename, lineNumber, columnNumber, endLineNumber,
+                                       endColumnNumber, text, null);
+                       }
+               }
+               
+               private void ParseOrigin (string origin, out string filename,
+                                    out int lineNumber, out int columnNumber,
+                                    out int endLineNumber, out int endColumnNumber)
+               {
+                       int lParen;
+                       string[] temp;
+                       string[] left, right;
+                       
+                       if (origin.IndexOf ('(') != -1 ) {
+                               lParen = origin.IndexOf ('(');
+                               filename = origin.Substring (0, lParen);
+                               temp = origin.Substring (lParen + 1, origin.Length - lParen - 2).Split (',');
+                               if (temp.Length == 1) {
+                                       left = temp [0].Split ('-');
+                                       if (left.Length == 1) {
+                                               lineNumber = Int32.Parse (left [0]);
+                                               columnNumber = 0;
+                                               endLineNumber = 0;
+                                               endColumnNumber = 0;
+                                       } else if (left.Length == 2) {
+                                               lineNumber = Int32.Parse (left [0]);
+                                               columnNumber = 0;
+                                               endLineNumber = Int32.Parse (left [1]);
+                                               endColumnNumber = 0;
+                                       } else
+                                               throw new Exception ("Invalid line/column format.");
+                               } else if (temp.Length == 2) {
+                                       right = temp [1].Split ('-');
+                                       lineNumber = Int32.Parse (temp [0]);
+                                       endLineNumber = 0;
+                                       if (right.Length == 1) {
+                                               columnNumber = Int32.Parse (right [0]);
+                                               endColumnNumber = 0;
+                                       } else if (right.Length == 2) {
+                                               columnNumber = Int32.Parse (right [0]);
+                                               endColumnNumber = Int32.Parse (right [0]);
+                                       } else
+                                               throw new Exception ("Invalid line/column format.");
+                               } else if (temp.Length == 4) {
+                                       lineNumber = Int32.Parse (temp [0]);
+                                       endLineNumber = Int32.Parse (temp [2]);
+                                       columnNumber = Int32.Parse (temp [1]);
+                                       endColumnNumber = Int32.Parse (temp [3]);
+                               } else
+                                       throw new Exception ("Invalid line/column format.");
+                       } else {
+                               filename = origin;
+                               lineNumber = 0;
+                               columnNumber = 0;
+                               endLineNumber = 0;
+                               endColumnNumber = 0;
+                       }
+               }
+
+               protected virtual string GenerateCommandLineCommands ()
+               {
+                       return null;
+               }
+
+               protected abstract string GenerateFullPathToTool ();
+
+               protected virtual string GenerateResponseFileCommands ()
+               {
+                       return null;
+               }
+
+               protected virtual string GetResponseFileSwitch (string responseFilePath)
+               {
+                       return String.Format ("@{0}", responseFilePath);
+               }
+
+               protected virtual bool HandleTaskExecutionErrors (int exitCode,
+                                                                bool hasTaskLoggedErrors)
+               {
+                       return true;
+               }
+
+               protected virtual bool InitializeHostObject (out bool appropriateHostObjectExists,
+                                                           out bool continueBuild)
+               {
+                       appropriateHostObjectExists = (HostObject != null) ? true : false;
+                       continueBuild = true;
+                       return true;
+               }
+
+               protected virtual void LogToolCommand (string message)
+               {
+               }
+
+               protected virtual bool SkipTaskExecution()
+               {
+                       return false;
+               }
+
+               protected virtual bool ValidateParameters()
+               {
+                       return true;
+               }
+
+               protected virtual StringDictionary EnvironmentOverride
+               {
+                       get { return environmentOverride; }
+               }
+
+               protected virtual Encoding ResponseFileEncoding
+               {
+                       get { return Encoding.UTF8; }
+               }
+
+               protected virtual Encoding StandardErrorEncoding
+               {
+                       get { return Console.Error.Encoding; }
+               }
+
+               protected virtual Encoding StandardOutputEncoding
+               {
+                       get { return Console.Out.Encoding; }
+               }
+
+               public int Timeout
+               {
+                       get { return timeout; }
+                       set { timeout = value; }
+               }
+
+               protected abstract string ToolName
+               {
+                       get;
+               }
+
+               public string ToolPath
+               {
+                       get { return toolPath; }
+                       set { toolPath  = value; }
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities_test.dll.sources b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities_test.dll.sources
new file mode 100644 (file)
index 0000000..0f30978
--- /dev/null
@@ -0,0 +1 @@
+Microsoft.Build.Utilities/TaskItemTest.cs
diff --git a/mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities.Test.mdp b/mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities.Test.mdp
new file mode 100644 (file)
index 0000000..e79de11
--- /dev/null
@@ -0,0 +1,27 @@
+<Project name="Microsoft.Build.Utilities.Test" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="Microsoft.Build.Utilities.Test" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="Microsoft.Build.Utilities.Test" />
+      <Build debugmode="False" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./Microsoft.Build.Utilities/TaskItemTest.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Utilities" />
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Framework" />
+    <ProjectReference type="Gac" localcopy="True" refto="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities.Test.mds b/mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities.Test.mds
new file mode 100644 (file)
index 0000000..586eac9
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="Microsoft.Build.Utilities.Test" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Utilities.Test" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="Microsoft.Build.Utilities.Test" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="Microsoft.Build.Utilities.Test" single="True">
+    <Execute type="None" entry="Microsoft.Build.Utilities.Test" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./Microsoft.Build.Utilities.Test.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities/TaskItemTest.cs b/mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities/TaskItemTest.cs
new file mode 100644 (file)
index 0000000..4092680
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// TaskItemTest.cs:
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+[TestFixture]
+public class TaskItemTest {
+
+       ITaskItem item,item1,item2;
+
+       [SetUp]
+       public void SetUp ()
+       {
+       }
+       
+       [Test]
+       public void SetMetadataTest ()
+       {
+               item = new TaskItem ("itemSpec");
+               item.SetMetadata ("Metadata", "Value");
+               Assert.AreEqual (item.MetadataCount, 12, "MetadataCount");
+       }
+       
+       [Test]
+       public void GetMetadataTest ()
+       {
+               item = new TaskItem ("itemSpec");
+               item.SetMetadata ("Metadata", "Value");
+               Assert.AreEqual (item.GetMetadata ("Metadata"), "Value", "Metadata value");
+       }
+       
+       [Test]
+       public void CopyMetadataToTest ()
+       {
+               item1 = new TaskItem ("itemSpec");
+               item2 = new TaskItem ("itemSpec");
+               item1.SetMetadata ("1","2");
+               item1.CopyMetadataTo (item2);
+               Assert.AreEqual (item2.GetMetadata ("1"), item1.GetMetadata ("1"),"Metadata in items");
+       }
+}
\ No newline at end of file
index fd63784e4997332cf9bc614b3a4498e6afa05132..c2ed553e2f234d9f784ac158a1f564a679f443f3 100644 (file)
@@ -1,3 +1,13 @@
+2005-09-15  Raja R Harinath  <rharinath@novell.com>
+
+       * Makefile (COMPILER): New.  Points to mcs.exe or gmcs.exe
+       depending on the profile.
+       (LIB_MCS_FLAGS): Pick the profile dependent compiler.
+
+2005-09-14  Ritvik Mayank  <mritvik@novell.com>
+       
+       * Makefile : Added mcs.exe path
+
 2005-08-08  Florian Gross  <flgr@ccan.de>
 
        * Imported Test/Mozilla
index 664415e8eeebf2fa7df1b94400624bd8ccdc3763..ca418d7dfeb967f4e99781da683d531b91589d65 100644 (file)
@@ -3,7 +3,14 @@ SUBDIRS =
 include ../../build/rules.make
 
 LIBRARY = Microsoft.JScript.dll
-LIB_MCS_FLAGS = /r:System.dll /r:Microsoft.Vsa.dll
+
+ifeq (net_2_0, $(PROFILE))
+COMPILER = gmcs.exe
+else
+COMPILER = mcs.exe
+endif
+
+LIB_MCS_FLAGS = -r:System.dll -r:Microsoft.Vsa.dll -r:$(topdir)/class/lib/$(PROFILE)/$(COMPILER) -debug+
 
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
 
index 5080a74cab09ac8e25d4c1a9d6eb9e5c94750fff..d83e2bb3dc5a1c48e92d8e8c1f6dee4123602b67 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-13  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * VsaEngine.cs: Override method Compile and SetOption from BaseVsaEngine,
+
 2005-08-31  Cesar Lopez Nataren  <cnataren@novell.com>
 
        * VsaEngine.cs: Added method GetParser, eval needs it.
index eb3b6304d99fc9b63de2f558a5d7241c49894201..2ae89769529a237b597ae3423b3002002a68e242 100644 (file)
@@ -4,6 +4,7 @@
 // Author: Cesar Octavio Lopez Nataren
 //
 // (C) Cesar Octavio Lopez Nataren, <cesar@ciencias.unam.mx>
+// Copyright (C) 2005 Novell, Inc (http://novell.com)
 //
 
 //
@@ -62,6 +63,28 @@ namespace Microsoft.JScript.Vsa {
                        throw new NotImplementedException ();
                }
 
+               public override bool Compile ()
+               {
+                       ArrayList code_items = new ArrayList ();
+                       
+                       foreach (IVsaItem item in Items) {
+                               if (item is IVsaCodeItem)
+                                       code_items.Add (item);
+                               else if (item is IVsaReferenceItem)
+                                       continue;
+                               else
+                                       throw new Exception ("FIXME: VsaItemType.AppGlobal");
+                       }
+                       Parser parser = new Parser (code_items);
+                       ScriptBlock block = (ScriptBlock) parser.ParseAll ();
+                       if (block != null) {
+                               SemanticAnalyser.Run (block, (Assembly []) GetOption ("assemblies"));
+                               CodeGenerator.Run ((string) GetOption ("first_source"), block);
+                               Console.WriteLine ("Compilation succeeded");
+                       }
+                       return false;
+               }
+
                public virtual void ConectEvents ()
                {
                        throw new NotImplementedException ();
@@ -258,6 +281,11 @@ namespace Microsoft.JScript.Vsa {
                        return opt;
                }
 
+               public override void SetOption (string name, object value)
+               {
+                       SetSpecificOption (name, value);
+               }
+
                protected override void SetSpecificOption (string name, object val)
                {
                        try {
index 27136574268ee6e3a733e1d6d68f871de9a18230..00d040cb0bfa83113f6ea6d4ad899f8b786478b2 100644 (file)
@@ -1,3 +1,54 @@
+2005-09-13  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * SemanticAnalyser.cs: Add field assemblies. Run now receives the
+       assembly's array, add method ComputeNamespaces,
+       * Parser.cs: Add support for the 'import' statement. Add field
+       code_items, new constructor, methods ParseAll and Import.
+       * Import.cs: Implement Resolve and Emit methods.
+       * ScriptBlock.cs: Add default ctr.
+
+2005-09-11  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * expression.cs (Identifier::emit_undeclared_assignment): Fix
+       small regression related to the value/refs patch. All works again
+       for undeclared variables.
+
+2005-09-09  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * SemanticAnalyser.cs, expression.cs (Unary): Fixes for delete
+       operator.
+
+2005-09-08  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * Relational.cs: The loading of true or false it's generated by
+       EmitRelationalComp not in Relational.Emit as is not always needed.
+       * CodeGenerator.cs: Add EmitRelationalComp.
+       * expression.cs (Args.Emit, emit_default_args_case): take care of
+       Relational operator case.
+
+2005-09-06  Florian Gross  <flgr@ccan.de>
+
+       * ObjectPrototype.cs: Implemented better working hasOwnProperty
+       * In.cs: Implemented JScriptIn
+       * LateBinding.cs: Added LateBinding.Delete, HasObjectProperty,
+       DirectHasObjectProperty
+
+2005-09-06  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * CodeGenerator.cs (GetBoxType): Take into account the case where
+       the type is relational whose operator is In.
+
+2005-09-02  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * SemanticAnalyser.cs: Added IsDeletable, check if a property is
+       in an object's constructor.
+       * CodeGenerator.cs: Added JSToken.Delete to GetBoxType.
+       * expression.cs: (Unary) Added field deletable. Take care of the
+       case when the property that we are trying to delete is not
+       deletable, we use late binding's method Delete for that. (Binary)
+       Added property IsDeletable. (Args) Do not pop the values of
+       arguments which implement Exp.
+
 2005-08-28  Florian Gross  <flgr@ccan.de>
 
        * Try.cs: Implemented JScriptExceptionValue
index b34696dd9513cae0a9c2b7aabc0b5fe6d1d91a50..ee13b93a4583616a430e6c3c92a88e6774590aa8 100644 (file)
@@ -607,7 +607,7 @@ namespace Microsoft.JScript {
                                    oper == JSToken.Increment || oper == JSToken.Decrement ||
                                    oper == JSToken.BitwiseNot)
                                        return GetBoxType (operand);
-                               else if (oper == JSToken.LogicalNot)
+                               else if (oper == JSToken.LogicalNot || oper == JSToken.Delete)
                                        return typeof (bool);
                        } else if (obj is Identifier) {
                                Identifier id = (Identifier) obj;
@@ -622,6 +622,10 @@ namespace Microsoft.JScript {
                                        if (member_type == MemberTypes.Property)
                                                return ((PropertyInfo) binding).PropertyType;
                                }
+                       } else if (obj is Relational) {
+                               Relational re = (Relational) obj;
+                               if (re.op == JSToken.In)
+                                       return typeof (bool);
                        }
                        return null;
                }
@@ -637,5 +641,50 @@ namespace Microsoft.JScript {
                        else
                                throw new NotImplementedException ();
                }
+
+               internal static void EmitRelationalComp (ILGenerator ig, Relational re)
+               {
+                       JSToken op = re.op;
+
+                       if (op == JSToken.Instanceof)
+                               return;
+
+                       Label true_case = ig.DefineLabel ();
+                       Label box_to_bool = ig.DefineLabel ();
+
+                       ig.Emit (OpCodes.Ldc_I4_0);
+                       ig.Emit (OpCodes.Conv_R8);
+
+                       OpCode opcode;
+
+                       switch (op) {
+                       case JSToken.LessThan:
+                               opcode = OpCodes.Blt;
+                               break;
+
+                       case JSToken.LessThanEqual:
+                               opcode = OpCodes.Ble;
+                               break;
+
+                       case JSToken.GreaterThan:
+                               opcode = OpCodes.Bgt;
+                               break;
+
+                       case JSToken.GreaterThanEqual:
+                               opcode = OpCodes.Bge;
+                               break;
+
+                       default:
+                               Console.WriteLine (re.Location.LineNumber);
+                               throw new NotImplementedException ();
+                       }
+                       ig.Emit (opcode, true_case);
+                       ig.Emit (OpCodes.Ldc_I4_0);
+                       ig.Emit (OpCodes.Br, box_to_bool);
+                       ig.MarkLabel (true_case);
+                       ig.Emit (OpCodes.Ldc_I4_1);
+                       ig.MarkLabel (box_to_bool);
+                       ig.Emit (OpCodes.Box, typeof (bool));
+               }
        }
 }
index fd445928b50505f5ec93cdf2b1c8b4c41439b141..59aedab22221e12ebf1d8f1d59e4688e1b59a4a6 100644 (file)
@@ -4,6 +4,7 @@
 // Author: Cesar Octavio Lopez Nataren
 //
 // (C) 2003, Cesar Octavio Lopez Nataren, <cesar@ciencias.unam.mx>
+// (C) 2005 Copyright , Novell Inc (http://novell.com)
 //
 
 //
@@ -27,8 +28,9 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using Microsoft.JScript.Vsa;
 using System;
+using Microsoft.JScript.Vsa;
+using System.Reflection.Emit;
 
 namespace Microsoft.JScript {
 
@@ -36,22 +38,32 @@ namespace Microsoft.JScript {
 
                string name;
 
-               internal Import (AST parent, Location location)
+               internal Import (AST parent, string name, Location location)
                        : base (parent, location)
                {
+                       this.name = name;
                }
 
                public static void JScriptImport (string name, VsaEngine engine)
-               {}
+               {
+               }
 
                internal override bool Resolve (IdentificationTable context)
                {
-                       throw new NotImplementedException ();
+                       if (InFunction) {
+                               string err = location.SourceName + "(" + location.LineNumber + ",0) : " +
+                               "error JS1229: The import statement is not valid in this context";
+                               throw new Exception (err);
+                       }
+                       return Mono.CSharp.Namespace.IsNamespace (name);
                }
 
                internal override void Emit (EmitContext ec)
                {
-                       throw new NotImplementedException ();
+                       ILGenerator ig = ec.ig;
+                       ig.Emit (OpCodes.Ldstr, name);
+                       CodeGenerator.load_engine (false, ig);
+                       ig.Emit (OpCodes.Call, GetType ().GetMethod ("JScriptImport"));
                }
        }
 }
index cb386de56a9cd8ddf93a095a40d11bc38473263a..486ceca326d50532f5a42d0f8a43204b89175073 100644 (file)
@@ -41,7 +41,11 @@ namespace Microsoft.JScript {
 
                public static bool JScriptIn (object v1, object v2)
                {
-                       return false;
+                       ScriptObject obj = v2 as ScriptObject;
+                       if (obj == null)
+                               return false;
+                       string key = Convert.ToString (v1);
+                       return LateBinding.HasObjectProperty (obj, key);
                }
 
                internal override bool Resolve (IdentificationTable context)
index bc0649f553d5a2522a88109f2d4ce805a9c43f0f..4ce0910c57678cfbbe88e262c302efe23982cc76 100644 (file)
@@ -283,7 +283,9 @@ namespace Microsoft.JScript {
 
                public bool Delete ()
                {
-                       throw new NotImplementedException ();
+                       // We are currently only calling LateBinding.Delete where we know that the
+                       // properties can't be deleted.
+                       return false;
                }
 
 
@@ -454,6 +456,42 @@ namespace Microsoft.JScript {
                        return null;
                }
 
+               internal static bool HasObjectProperty (ScriptObject obj, string key)
+               {
+                       return HasObjectProperty (obj, key, 0);
+               }
+
+               private static bool HasObjectProperty (ScriptObject obj, string key, int nesting)
+               {
+                       ScriptObject prop_obj;
+                       if (nesting > 0 && GetCacheEntry (out prop_obj, obj, key))
+                               return prop_obj != null;
+
+                       if (DirectHasObjectProperty (obj, key)) {
+                               if (nesting > 0)
+                                       SetCacheEntry (obj, key, obj);
+                               return true;
+                       }
+
+                       ScriptObject cur_obj = obj.proto as ScriptObject;
+                       if (cur_obj != null) {
+                               bool success = HasObjectProperty (cur_obj, key, nesting + 1);
+                               if (nesting > 0)
+                                       SetCacheEntry (obj, key, cur_obj);
+                               return success;
+                       }
+
+                       if (nesting > 0)
+                               SetCacheEntry (obj, key, null);
+                       return false;
+               }
+
+               internal static bool DirectHasObjectProperty (ScriptObject obj, string key)
+               {
+                       object result;
+                       return TryDirectGetObjectProperty (out result, obj, key);
+               }
+
                private static bool TryDirectGetObjectProperty (out object result, ScriptObject obj, string rhs)
                {
                        ArrayObject ary = obj as ArrayObject;
index 492da9dd4e376be995b386ef6990cfd006694958..99012fb2e3599a898f499fb300eb2f3499068a89 100644 (file)
@@ -48,11 +48,11 @@ namespace Microsoft.JScript {
                [JSFunctionAttribute (JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Object_hasOwnProperty)]
                public static bool hasOwnProperty (object thisObj, object name)
                {
-                       if (thisObj == null || name == null)
+                       ScriptObject obj = thisObj as ScriptObject;
+                       if (obj == null)
                                return false;
-                       Type type = thisObj.GetType ();
-                       FieldInfo res = type.GetField (Convert.ToString (name));
-                       return res == null;
+                       string key = Convert.ToString (name);
+                       return LateBinding.DirectHasObjectProperty (obj, key);
                }
 
                [JSFunctionAttribute (JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Object_isPrototypeOf)]
index 14a6683b05b596f7c62c96fd2059c94a5cc6412a..7e73ed41a768f5a82ebfc9651636d2f64c37d991 100644 (file)
@@ -91,11 +91,27 @@ namespace Microsoft.JScript {
                int nesting_of_with;
                bool allow_member_expr_as_function_name;
                Decompiler decompiler; 
+               ArrayList code_items;
 
                internal Parser ()
                {
                }
 
+               internal Parser (ArrayList code_items)
+               {
+                       this.code_items = code_items;
+               }
+
+               internal AST ParseAll ()
+               {
+                       ScriptBlock block = new ScriptBlock ();
+
+                       foreach (VsaCodeItem item in code_items)
+                               block.Add (Parse (item.SourceText, item.Name, 0));
+
+                       return block;
+               }
+
                internal Decompiler CreateDecompiler ()
                {
                        return new Decompiler ();
@@ -399,6 +415,21 @@ namespace Microsoft.JScript {
                        return pn;
                }
 
+               AST Import (AST parent)
+               {
+                       System.Text.StringBuilder @namespace = new System.Text.StringBuilder ();
+
+                       while (true) {
+                               MustMatchToken (Token.NAME, "msg.bad.namespace.name");
+                               @namespace.Append (ts.GetString);
+                               if (ts.MatchToken (Token.DOT))
+                                       @namespace.Append (".");
+                               else
+                                       break;
+                       }
+                       return new Import (parent, @namespace.ToString (), new Location (ts.SourceName, ts.LineNumber));
+               }
+
                void CheckWellTerminated ()
                {
                        int tt = ts.PeekTokenSameLine ();
@@ -742,6 +773,9 @@ namespace Microsoft.JScript {
                                skip_semi = true;
                        } else if (tt == Token.FUNCTION) {
                                pn = Function (parent, FunctionType.ExpressionStatement);
+                       } else if (tt == Token.IMPORT) {
+                               decompiler.AddToken (Token.IMPORT);
+                               pn = Import (parent);
                        } else {
                                int last_expr_type = tt;
                                int token_number = ts.TokenNumber;
index 6d2ac76761f041821df698d246cdd1027d261110..5ee5b6591276098f2273e8567e7430cb3ce0fb68 100644 (file)
@@ -150,38 +150,8 @@ namespace Microsoft.JScript {
                        
                        ig.Emit (OpCodes.Call, t.GetMethod ("EvaluateRelational"));
 
-                       ig.Emit (OpCodes.Ldc_I4_0);
-                       ig.Emit (OpCodes.Conv_R8);
-
-                       Label a, b;
-                       a = ig.DefineLabel ();
-                       b = ig.DefineLabel ();
-                               
-                       switch (op) {
-                       case JSToken.GreaterThan:
-                               ig.Emit (OpCodes.Bgt_S, a);
-                               break;
-                       case JSToken.LessThan:
-                               ig.Emit (OpCodes.Blt_S, a);
-                               break;
-                       case JSToken.LessThanEqual:
-                               ig.Emit (OpCodes.Ble_S, a);
-                               break;
-                       case JSToken.GreaterThanEqual:
-                               ig.Emit (OpCodes.Bge_S, a);
-                               break;
-                       }                       
-
-                       ig.Emit (OpCodes.Ldc_I4_0);
-                       ig.Emit (OpCodes.Br_S, b);
-                       ig.MarkLabel (a);
-                       ig.Emit (OpCodes.Ldc_I4_1);
-                       ig.MarkLabel (b);
-
                        if (no_effect)
                                ig.Emit (OpCodes.Pop);
-                       else
-                               ig.Emit (OpCodes.Box, typeof (bool));
                }
        }
 }
index 20a88a9b5d4976aa4c1cfa22e68fd1d4651d7f72..7d45cac1c1106bce341290b994d323ebe67270b6 100644 (file)
@@ -33,6 +33,12 @@ namespace Microsoft.JScript {
 
                internal Block src_elems;
 
+               internal ScriptBlock ()
+                       : base (null, null)
+               {
+                       src_elems = new Block (null, null);
+               }
+
                internal ScriptBlock (Location location)
                        : base (null, location)
                {
index 55afd66b76a6df257c3d7b6295ed6a066ceb7489..d1ed6b2149a8e159e984c6c2a141666151f41c8e 100644 (file)
@@ -54,6 +54,7 @@ namespace Microsoft.JScript {
                private static Type global_obj = typeof (GlobalObject);
 
                internal static bool NoFast = true;
+               private static Assembly [] assemblies;
 
                static SemanticAnalyser ()
                {
@@ -132,8 +133,11 @@ namespace Microsoft.JScript {
                        return name.Substring (i + 1);
                }
 
-               internal static bool Run (ScriptBlock prog)
+               internal static bool Run (ScriptBlock prog, Assembly [] ref_items)
                {
+                       assemblies = ref_items;                 
+                       ComputeNamespaces ();
+
                        context = new IdentificationTable ();
                        context.BuildGlobalEnv ();
                        return prog.Resolve (context);
@@ -350,5 +354,58 @@ namespace Microsoft.JScript {
                                        return true;
                        return false;
                }
+
+               internal static bool IsDeletable (Identifier left, Identifier right, out bool isCtr)
+               {
+                       Type ctr = SemanticAnalyser.map_to_ctr (left.name.Value);
+                       isCtr = ctr != null ? true : false;
+
+                       if (isCtr)
+                               return SemanticAnalyser.get_member (left, right) == null;
+
+                       Console.WriteLine ("ctr = {0}, left = {1} ({2}); right = {3} ({4})",
+                                  ctr, left, left.GetType (), right, right.GetType ());
+                       return false;
+               }
+
+               /// <summary>
+               ///   Computes the namespaces that we import from the assemblies we reference.
+               /// </summary>
+               public static void ComputeNamespaces ()
+               {
+                       MethodInfo assembly_get_namespaces = typeof (Assembly).GetMethod ("GetNamespaces", BindingFlags.Instance|BindingFlags.NonPublic);
+
+                       Hashtable cache = null;
+
+                       //
+                       // First add the assembly namespaces
+                       //
+                       if (assembly_get_namespaces != null){
+                               int count = assemblies.Length;
+
+                               for (int i = 0; i < count; i++){
+                                       Assembly a = assemblies [i];
+                                       string [] namespaces = (string []) assembly_get_namespaces.Invoke (a, null);
+                                       foreach (string ns in namespaces){
+                                               if (ns == "")
+                                                       continue;
+                                               Mono.CSharp.Namespace.LookupNamespace (ns, true);
+                                       }
+                               }
+                       } else {
+                               cache = new Hashtable ();
+                               cache.Add ("", null);
+                               foreach (Assembly a in assemblies) {
+                                       foreach (Type t in a.GetExportedTypes ()) {
+                                               string ns = t.Namespace;
+                                               if (ns == null || cache.Contains (ns))
+                                                       continue;
+
+                                               Mono.CSharp.Namespace.LookupNamespace (ns, true);
+                                               cache.Add (ns, null);
+                                       }
+                               }
+                       }
+               }
        }
 }
index 927f70c9edc5abf8c4fee8be3da3df7cb3c94810..5826fc4eaf8b38a8d27d77d19f8be012122b11eb 100644 (file)
@@ -50,6 +50,9 @@ namespace Microsoft.JScript {
        
        internal class Unary : UnaryOp {
 
+               private bool deletable = false;
+               private bool isCtr = false;
+
                internal Unary (AST parent, JSToken oper, Location location)
                        : base (parent, location)
                {               
@@ -73,7 +76,12 @@ namespace Microsoft.JScript {
                {
                        bool r = false;                
 
-                       if (operand is Exp) {
+                       if (operand is Binary) {
+                               Binary bin = (Binary) operand;
+                               if (oper == JSToken.Delete && bin.AccessField)
+                                       this.deletable = bin.IsDeletable (out isCtr);
+                               bin.Resolve (context);
+                       } else if (operand is Exp) {
                                if (oper != JSToken.Increment && oper != JSToken.Decrement)
                                        r = ((Exp) operand).Resolve (context, no_effect);
                        } else 
@@ -111,9 +119,38 @@ namespace Microsoft.JScript {
 
                                Binary arg = operand as Binary;
                                if (arg != null) {
-                                       if (arg.op == JSToken.LeftBracket || arg.op == JSToken.AccessField) {
-                                               arg.left.Emit (ec);
-                                               arg.right.Emit (ec);
+                                       if (arg.op == JSToken.LeftBracket || arg.op == JSToken.AccessField ) {
+                                               if (deletable) {
+                                                       arg.left.Emit (ec);
+                                                       arg.right.Emit (ec);
+                                                       ig.Emit (OpCodes.Ldc_I4_1);
+                                                       ig.Emit (OpCodes.Call, typeof (Convert).GetMethod ("ToString",
+                                                                                                          new Type [] { typeof (object), typeof (bool) }));
+                                                       ig.Emit (OpCodes.Call, typeof (LateBinding).GetMethod ("DeleteMember",
+                                                                                                              new Type [] { typeof (object), typeof (string) }));
+                                               } else {
+                                                       if (isCtr)
+                                                               Console.WriteLine ("{0}({1},0) : warning: " +
+                                                                          "JS1164: '{2}' is not deletable", 
+                                                                          location.SourceName, location.LineNumber, arg.ToString ());
+
+                                                       if (arg.left is Identifier && arg.right is Identifier) {
+                                                               string _base = ((Identifier) arg.left).name.Value;
+                                                               string property = ((Identifier) arg.right).name.Value;
+
+                                                               Type lb_type = typeof (LateBinding);
+                                                               LocalBuilder lb = ig.DeclareLocal (lb_type);
+                                                               
+                                                               ig.Emit (OpCodes.Ldstr, property);
+                                                               ig.Emit (OpCodes.Newobj, lb_type.GetConstructor (new Type [] { typeof (string) }));
+                                                               ig.Emit (OpCodes.Stloc, lb);
+                                                               ig.Emit (OpCodes.Ldloc, lb);
+                                                               ig.Emit (OpCodes.Dup);
+                                                               arg.left.Emit (ec);
+                                                               ig.Emit (OpCodes.Stfld, lb_type.GetField ("obj"));
+                                                               ig.Emit (OpCodes.Call, lb_type.GetMethod ("Delete"));
+                                                       }
+                                               }
                                        } else {
                                                Console.WriteLine ("emit_unary_op: Delete: unknown operand type {0}", arg.op);
                                                throw new NotImplementedException ();
@@ -123,12 +160,9 @@ namespace Microsoft.JScript {
                                        throw new NotImplementedException ();
                                }
 
-                               ig.Emit (OpCodes.Ldc_I4_1);
-                               ig.Emit (OpCodes.Call, typeof (Convert).GetMethod ("ToString",
-                                       new Type [] { typeof (object), typeof (bool) }));
-                               ig.Emit (OpCodes.Call, typeof (LateBinding).GetMethod ("DeleteMember",
-                                       new Type [] { typeof (object), typeof (string) }));
-                               ig.Emit (OpCodes.Pop);
+
+                               if (no_effect)
+                                       ig.Emit (OpCodes.Pop);
                                break;
 
                        case JSToken.Plus:
@@ -215,10 +249,11 @@ namespace Microsoft.JScript {
                public override string ToString ()
                {
                        StringBuilder sb = new StringBuilder ();
-                       sb.Append (left.ToString () + " ");
+                       sb.Append (left.ToString ());
                        
-                       if (op != JSToken.None)
-                               sb.Append (op + " ");
+                       if (op == JSToken.AccessField)
+                               sb.Append (".");
+                       else sb.Append (op);
                        
                        if (right != null)
                                sb.Append (right.ToString ());
@@ -511,8 +546,8 @@ namespace Microsoft.JScript {
                        case JSToken.RightShift:
                        case JSToken.UnsignedRightShift:
                                ig.Emit (OpCodes.Call, typeof (BitwiseBinary).GetMethod ("EvaluateBitwiseBinary"));
-                                        break;
-                       }                       
+                               break;
+                       }
                }
 
                internal void emit_jumping_code (EmitContext ec)
@@ -588,6 +623,14 @@ namespace Microsoft.JScript {
                        ig.Emit (OpCodes.Stloc, local_builder);
                        ig.Emit (OpCodes.Ldloc, local_builder);
                }
+
+               internal bool IsDeletable (out bool isCtr)
+               {
+                       if (left is Identifier && right is Identifier)
+                               return SemanticAnalyser.IsDeletable ((Identifier) left, (Identifier) right, out isCtr);
+                       isCtr = false;
+                       return false;
+               }
        }
 
        internal class Conditional : Exp {
@@ -856,7 +899,11 @@ namespace Microsoft.JScript {
                        for (int i = 0; i <= n; i++) {
                                ast = args.get_element (i);
                                ast.Emit (ec);
-                               CodeGenerator.EmitBox (ig, ast);
+
+                               if (ast is Relational) 
+                                       CodeGenerator.EmitRelationalComp (ig, (Relational) ast);
+                               else
+                                       CodeGenerator.EmitBox (ig, ast);
 
                                if (ast is StringLiteral)
                                        ;
@@ -1368,7 +1415,7 @@ namespace Microsoft.JScript {
                        ig.Emit (OpCodes.Ldloc, lb_local);
 
                        right_side.Emit (ec);
-                       ig.Emit (OpCodes.Box, typeof (object));
+                       CodeGenerator.EmitBox (ec.ig, right_side);
 
                        ig.Emit (OpCodes.Ldloc, field_builder);         
                        ig.Emit (OpCodes.Ldnull);
@@ -1626,6 +1673,8 @@ namespace Microsoft.JScript {
                        for (int i = 0; i < n; i++) {
                                tmp = (AST) elems [i];
                                if (tmp != null)
+                                       if (tmp is Exp)
+                                               r &= ((Exp) tmp).Resolve (context, false);
                                        r &= tmp.Resolve (context);
                        }
                        return r;
@@ -1715,7 +1764,12 @@ namespace Microsoft.JScript {
                                                ig.Emit (OpCodes.Dup);
                                                ig.Emit (OpCodes.Ldc_I4, k);
                                                ast.Emit (ec);
-                                               CodeGenerator.EmitBox (ig, ast);
+
+                                               if (ast is Relational)
+                                                       CodeGenerator.EmitRelationalComp (ig, (Relational) ast);
+                                               else
+                                                       CodeGenerator.EmitBox (ig, ast);
+
                                                ig.Emit (OpCodes.Stelem_Ref);
                                        }
                                }
@@ -1744,7 +1798,10 @@ namespace Microsoft.JScript {
                                ast = get_element (i);
                                if (ast != null) {
                                        ast.Emit (ec);
-                                       if (strong_type)
+
+                                       if (ast is Relational)
+                                               CodeGenerator.EmitRelationalComp (ig, (Relational) ast);
+                                       else if (strong_type)
                                                force_strong_type (ig, ast, parameters [j]);
                                        else
                                                CodeGenerator.EmitBox (ig, ast);
index 4a57d6b43aa4792d8513a77b67dbb7e25ade282e..0b1ed104e546063d185bc8594d8324fa5f3e36d7 100644 (file)
@@ -242,7 +242,9 @@ namespace Microsoft.Vsa {
                                else if (!initNewCalled)
                                        throw new VsaException (VsaError.EngineNotInitialized);
 
-                               items = new VsaItems ((VsaEngine) this);
+                               if (items == null)
+                                       items = new VsaItems ((VsaEngine) this);
+
                                return items;
                        }
                }
@@ -477,32 +479,6 @@ namespace Microsoft.Vsa {
                //
                public virtual bool Compile ()
                {
-                       if (closed)
-                               throw new VsaException (VsaError.EngineClosed);
-                       else if (busy)
-                               throw new VsaException (VsaError.EngineBusy);
-                       else if (empty)
-                               throw new VsaException (VsaError.EngineEmpty);
-                       else if (running)
-                               throw new VsaException (VsaError.EngineRunning);
-                       else if (!initNewCalled)
-                               throw new VsaException (VsaError.EngineNotInitialized);
-                       else if (namespaceNotSet)
-                               throw new VsaException (VsaError.RootNamespaceNotSet);
-
-                       foreach (IVsaItem item in items) {
-                               if (item is VsaCodeItem) {
-                                       VsaCodeItem code_item = (VsaCodeItem) item;
-                                       Parser parser = new Parser ();
-                                       ScriptBlock block = (ScriptBlock) parser.Parse (code_item.SourceText, code_item.Name, 0);
-                                       if (block != null) {
-                                               SemanticAnalyser.Run (block);
-                                               CodeGenerator.Run (code_item.Name, block);
-                                               Console.WriteLine ("Compilation succeeded");
-                                       }                                               
-                               } else // FIXME: implement compilation process when VsaItem is AppGlobal and Reference.
-                                       throw new Exception ();
-                       }
                        return false;
                }
 
index d8adc17ce55a057b85e4c53ea6c570e0c7c78b4a..11b1cd6369b8313eac77eec08876df4c5398b0a5 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-13  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * BaseVsaEngine.cs: Move the code from Compile to the VsaEngine.
+
 2005-02-14  Cesar Lopez Nataren  <cnataren@novell.com>
 
        * BaseVsaEngine.cs (Compile): Guide the compilation process when
index c0b7ffb112e3698278bf15aeaaa8e654c40db849..4a2aea77593b3a11f9de4f6b8162910cac89b68f 100644 (file)
@@ -1,3 +1,42 @@
+2005-09-08  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * mjs-most.tests: enable more tests.
+
+       * mjs-most.tests: Add ecma/String/15.5.3.1-3.js,
+       ecma/String/15.5.4.4-1.js, ecma/String/15.5.4.5-1.js,
+       ecma/String/15.5.4.5-4.js, ecma/String/15.5.4.5-5.js,
+       ecma/String/15.5.4.5-5.js, ecma/String/15.5.4.8-2.js,
+       ecma/Types/8.4.js, ecma_2/RegExp/hex-001.js,
+       ecma_2/RegExp/multiline-001.js, ecma_2/RegExp/regress-001.js,
+       ecma_2/Statements/dowhile-001.js,
+       ecma_2/Statements/dowhile-005.js, ecma_2/Statements/label-001.js,
+       ecma_2/String/match-001.js, ecma_2/String/match-002.js,
+       ecma_2/String/match-003.js, ecma_2/String/match-004.js,
+       ecma_2/String/split-001.js, ecma_2/String/split-003.js,
+       js1_2/Array/general2.js, js1_2/regexp/control_characters.js,
+       js1_2/statements/break.js, js1_3/inherit/proto_2.js,
+       js1_3/inherit/proto_5.js, js1_4/Regress/function-003.js.
+
+       * mjs-most.tests: Bug fixes let us run ecma/Array/15.4.4.2.js and
+       ecma/Array/15.4.4.5-3.js now.
+
+2005-09-03  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * mjs-most.fail:Added ecma/FunctionObjects/15.3.3.1-3.js,
+       ecma/Number/15.7.3.3-2.js, ecma/Number/15.7.3.5-2.js,
+       ecma/ObjectObjects/15.2.3.1-2.js, ecma/Number/15.7.3.5-2.js as
+       they throw NotImplementedException at runtime when invoking
+       LateBinding::Delete.
+       * mjs-most.test:Enable ecma/FunctionObjects/15.3.3.1-3.js,
+       ecma/Number/15.7.3.3-2.js, ecma/Number/15.7.3.5-2.jsc,
+       ecma/ObjectObjects/15.2.3.1-2.js.
+
+
+2005-09-02  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * mjs-most.fail: Added ecma/Array/15.4.3.1-2.js, Convert:ToForInObject throws NotImplementedException.
+       * mjs-most.test: Enable ecma/Array/15.4.3.1-2.js
+
 2005-08-30  Florian Gross  <flgr@ccan.de>
 
        * Cleaned up mjs-most.fail, added failure reasons
index 2c72b465aa188b410b4218d9c64029c09eaa1cf8..52781c3dbf08c10ffdfd045b793fa7ef5b4ee859 100644 (file)
@@ -90,3 +90,16 @@ js1_2/statements/switch2.js
 # System.Text.RegularExpressions. It's available at http://flgr.dyndns.org/mono/RegEx2+3.patch
 js1_2/regexp/octal.js
 js1_2/regexp/special_characters.js
+
+# Throw NotImplementedException when invoking Convert:ToForInObject
+ecma/Array/15.4.3.1-2.js
+
+# Throw NotImplementedException when invoking LateBinding::Delete
+ecma/FunctionObjects/15.3.3.1-3.js
+ecma/Number/15.7.3.3-2.js
+ecma/Number/15.7.3.5-2.jsc
+ecma/ObjectObjects/15.2.3.1-2.js
+ecma/Number/15.7.3.5-2.js
+
+# runtime error
+js1_4/Regress/function-003.js
index a567457210d88461d686f45e154ba14ecb363d3e..e7a0ec86188a0c343533b6c58a3b73453a8f3619 100644 (file)
@@ -40,23 +40,21 @@ ecma/Array/15.4.2.1-1.js
 ecma/Array/15.4.2.2-1.js
 ecma/Array/15.4.2.2-2.js
 ecma/Array/15.4.2.3.js
-# Invalid IL
-#ecma/Array/15.4.3.1-2.js
+ecma/Array/15.4.3.1-2.js
 ecma/Array/15.4.3.2.js
 ecma/Array/15.4.3.js
 ecma/Array/15.4.4.1.js
-# Invalid IL
-#ecma/Array/15.4.4.2.js
+ecma/Array/15.4.4.2.js
+# Invalid IL, possible guilty: Array.prototype.join.length
 #ecma/Array/15.4.4.3-1.js
 #ecma/Array/15.4.4.4-1.js
 #ecma/Array/15.4.4.4-2.js
 # Need eval
 #ecma/Array/15.4.4.5-1.js
 #ecma/Array/15.4.4.5-2.js
-# Invalid IL
-#ecma/Array/15.4.4.5-3.js
+ecma/Array/15.4.4.5-3.js
 ecma/Array/15.4.4.js
-# Invalid IL
+# Invalid IL, TryDirectGetObjectProperty throws NullReferenceException
 #ecma/Array/15.4.5.1-1.js
 ecma/Array/15.4.5.1-2.js
 # Needs ToForInObject
@@ -67,8 +65,8 @@ ecma/Array/15.4.5.1-2.js
 ecma/Boolean/15.6.2.js
 # Need to implement for in loops first
 #ecma/Boolean/15.6.3.1-1.js
-# Needs delete
-#ecma/Boolean/15.6.3.1-2.js
+ecma/Boolean/15.6.3.1-2.js
+# invalid IL
 #ecma/Boolean/15.6.3.1-3.js
 # Invalid IL
 #ecma/Boolean/15.6.3.1-4.js
@@ -113,12 +111,11 @@ ecma/Date/15.9.3.2-2.js
 ecma/Date/15.9.3.2-3.js
 ecma/Date/15.9.3.2-4.js
 ecma/Date/15.9.3.2-5.js
-# These cause freezes
-#ecma/Date/15.9.3.8-1.js
-#ecma/Date/15.9.3.8-2.js
-#ecma/Date/15.9.3.8-3.js
-#ecma/Date/15.9.3.8-4.js
-#ecma/Date/15.9.3.8-5.js
+ecma/Date/15.9.3.8-1.js
+ecma/Date/15.9.3.8-2.js
+ecma/Date/15.9.3.8-3.js
+ecma/Date/15.9.3.8-4.js
+ecma/Date/15.9.3.8-5.js
 ecma/Date/15.9.4.2-1.js
 ecma/Date/15.9.4.2.js
 # for blocks seem to be disconnected from their parent scopes and this file needs that
@@ -152,7 +149,7 @@ ecma/Date/15.9.5.1.js
 #ecma/Date/15.9.5.12-5.js
 #ecma/Date/15.9.5.12-6.js
 #ecma/Date/15.9.5.12-7.js
-#ecma/Date/15.9.5.12-8.js
+ecma/Date/15.9.5.12-8.js
 #ecma/Date/15.9.5.13-1.js
 #ecma/Date/15.9.5.13-2.js
 #ecma/Date/15.9.5.13-3.js
@@ -160,27 +157,28 @@ ecma/Date/15.9.5.1.js
 #ecma/Date/15.9.5.13-5.js
 #ecma/Date/15.9.5.13-6.js
 #ecma/Date/15.9.5.13-7.js
-#ecma/Date/15.9.5.13-8.js
+ecma/Date/15.9.5.13-8.js
 #ecma/Date/15.9.5.14.js
-#ecma/Date/15.9.5.15.js
+ecma/Date/15.9.5.15.js
 #ecma/Date/15.9.5.16.js
-#ecma/Date/15.9.5.17.js
+ecma/Date/15.9.5.17.js
 #ecma/Date/15.9.5.18.js
-#ecma/Date/15.9.5.19.js
+ecma/Date/15.9.5.19.js
 ecma/Date/15.9.5.2-1.js
 # Needs new Function
 #ecma/Date/15.9.5.2-2-n.js
 ecma/Date/15.9.5.2.js
 # Invalid IL
 #ecma/Date/15.9.5.20.js
-#ecma/Date/15.9.5.21-1.js
-#ecma/Date/15.9.5.21-2.js
-#ecma/Date/15.9.5.21-3.js
-#ecma/Date/15.9.5.21-4.js
-#ecma/Date/15.9.5.21-5.js
-#ecma/Date/15.9.5.21-6.js
-#ecma/Date/15.9.5.21-7.js
-#ecma/Date/15.9.5.21-8.js
+ecma/Date/15.9.5.21-1.js
+ecma/Date/15.9.5.21-2.js
+ecma/Date/15.9.5.21-3.js
+ecma/Date/15.9.5.21-4.js
+ecma/Date/15.9.5.21-5.js
+ecma/Date/15.9.5.21-6.js
+ecma/Date/15.9.5.21-7.js
+ecma/Date/15.9.5.21-8.js
+# invalid IL
 #ecma/Date/15.9.5.22-1.js
 #ecma/Date/15.9.5.22-2.js
 #ecma/Date/15.9.5.22-3.js
@@ -188,7 +186,7 @@ ecma/Date/15.9.5.2.js
 #ecma/Date/15.9.5.22-5.js
 #ecma/Date/15.9.5.22-6.js
 #ecma/Date/15.9.5.22-7.js
-#ecma/Date/15.9.5.22-8.js
+ecma/Date/15.9.5.22-8.js
 #ecma/Date/15.9.5.23-1.js
 #ecma/Date/15.9.5.23-10.js
 #ecma/Date/15.9.5.23-11.js
@@ -289,8 +287,7 @@ ecma/ExecutionContexts/10.1.4-10.js
 #ecma/ExecutionContexts/10.2.2-1.js
 # Needs eval
 #ecma/ExecutionContexts/10.2.2-2.js
-# Endless loop
-#ecma/ExecutionContexts/10.2.3-1.js
+ecma/ExecutionContexts/10.2.3-1.js
 #ecma/ExecutionContexts/10.2.3-2.js
 # Needs eval
 #ecma/Expressions/11.1.1.js
@@ -352,7 +349,7 @@ ecma/Expressions/11.4.6.js
 #ecma/Expressions/11.4.9.js
 ecma/Expressions/11.5.1.js
 ecma/Expressions/11.5.2.js
-#ecma/Expressions/11.5.3.js
+ecma/Expressions/11.5.3.js
 # Needs new Function
 #ecma/Expressions/11.6.1-1.js
 #ecma/Expressions/11.6.1-2.js
@@ -385,8 +382,7 @@ ecma/Expressions/11.6.3.js
 ecma/FunctionObjects/15.3.3.1-1.js
 # Needs for in
 #ecma/FunctionObjects/15.3.3.1-2.js
-# Invalid IL
-#ecma/FunctionObjects/15.3.3.1-3.js
+ecma/FunctionObjects/15.3.3.1-3.js
 #ecma/FunctionObjects/15.3.3.1-4.js
 ecma/FunctionObjects/15.3.3.2.js
 ecma/FunctionObjects/15.3.4-1.js
@@ -539,7 +535,7 @@ ecma/Math/15.8-2-n.js
 #ecma/Math/15.8.2.11.js
 #ecma/Math/15.8.2.12.js
 #ecma/Math/15.8.2.13.js
-# Invalid IL
+# SemanticAnalyser:NeedsToBoolean throw NotImplementedException
 #ecma/Math/15.8.2.14.js
 # NotImplementedException from Binary:emit_access
 #ecma/Math/15.8.2.15.js
@@ -573,8 +569,7 @@ ecma/Number/15.7.3.2-1.js
 # Needs for in
 #ecma/Number/15.7.3.2-4.js
 ecma/Number/15.7.3.3-1.js
-# Invalid IL
-#ecma/Number/15.7.3.3-2.js
+ecma/Number/15.7.3.3-2.js
 #ecma/Number/15.7.3.3-3.js
 # Needs for in
 #ecma/Number/15.7.3.3-4.js
@@ -585,8 +580,7 @@ ecma/Number/15.7.3.4-1.js
 # Needs for in
 #ecma/Number/15.7.3.4-4.js
 ecma/Number/15.7.3.5-1.js
-# Invalid IL
-#ecma/Number/15.7.3.5-2.js
+ecma/Number/15.7.3.5-2.js
 #ecma/Number/15.7.3.5-3.js
 # Needs for in
 #ecma/Number/15.7.3.5-4.js
@@ -617,8 +611,8 @@ ecma/ObjectObjects/15.2.2.2.js
 ecma/ObjectObjects/15.2.3-1.js
 # Needs eval
 #ecma/ObjectObjects/15.2.3.1-1.js
-# Invalid IL
-#ecma/ObjectObjects/15.2.3.1-2.js
+ecma/ObjectObjects/15.2.3.1-2.js
+# invalid IL
 #ecma/ObjectObjects/15.2.3.1-3.js
 #ecma/ObjectObjects/15.2.3.1-4.js
 ecma/ObjectObjects/15.2.3.js
@@ -647,7 +641,7 @@ ecma/Statements/12.5-2.js
 #ecma/Statements/12.6.2-4.js
 #ecma/Statements/12.6.2-5.js
 #ecma/Statements/12.6.2-6.js
-# Invalid IL
+# endless runtime loop
 #ecma/Statements/12.6.2-7.js
 #ecma/Statements/12.6.2-8.js
 # Needs eval
@@ -682,7 +676,8 @@ ecma/String/15.5.2.js
 #ecma/String/15.5.3.1-1.js
 # Invalid IL
 #ecma/String/15.5.3.1-2.js
-#ecma/String/15.5.3.1-3.js
+ecma/String/15.5.3.1-3.js
+# invalid IL
 #ecma/String/15.5.3.1-4.js
 # NotImplementedException from Binary:emit_access
 #ecma/String/15.5.3.2-1.js
@@ -717,30 +712,30 @@ ecma/String/15.5.4.3-1.js
 ecma/String/15.5.4.3-2.js
 # Needs eval
 #ecma/String/15.5.4.3-3-n.js
-# Invalid IL
-#ecma/String/15.5.4.4-1.js
+ecma/String/15.5.4.4-1.js
 # Needs new Function
 #ecma/String/15.5.4.4-2.js
 #ecma/String/15.5.4.4-3.js
 #ecma/String/15.5.4.4-4.js
-# Invalid IL
-#ecma/String/15.5.4.5-1.js
+ecma/String/15.5.4.5-1.js
 # Needs new Function
 #ecma/String/15.5.4.5-2.js
 #ecma/String/15.5.4.5-3.js
-# Invalid IL
-#ecma/String/15.5.4.5-4.js
-#ecma/String/15.5.4.5-5.js
+ecma/String/15.5.4.5-4.js
+ecma/String/15.5.4.5-5.js
+# Convert:ToNumber throws InvalidCastException
 #ecma/String/15.5.4.5-6.js
-#ecma/String/15.5.4.6-1.js
+ecma/String/15.5.4.6-1.js
+# error JS5040: 'f' it's read only
 #ecma/String/15.5.4.6-2.js
+# invalid IL
 #ecma/String/15.5.4.7-1.js
 # Needs eval
 #ecma/String/15.5.4.7-2.js
 ecma/String/15.5.4.7-3.js
 # Invalid IL
 #ecma/String/15.5.4.8-1.js
-#ecma/String/15.5.4.8-2.js
+ecma/String/15.5.4.8-2.js
 # Needs for in
 #ecma/String/15.5.4.8-3.js
 # Invalid IL
@@ -769,8 +764,7 @@ ecma/TypeConversion/9.8.1.js
 # Needs new Function
 #ecma/TypeConversion/9.9-1.js
 ecma/Types/8.1.js
-# Invalid IL
-#ecma/Types/8.4.js
+ecma/Types/8.4.js
 # Needs new Function
 #ecma/Types/8.6.2.1-1.js
 ecma_2/Exceptions/boolean-001.js
@@ -903,29 +897,27 @@ ecma_2/RegExp/constructor-001.js
 ecma_2/RegExp/exec-001.js
 ecma_2/RegExp/exec-002.js
 ecma_2/RegExp/function-001.js
-# Invalid IL
-#ecma_2/RegExp/hex-001.js
-#ecma_2/RegExp/multiline-001.js
+ecma_2/RegExp/hex-001.js
+ecma_2/RegExp/multiline-001.js
 ecma_2/RegExp/octal-001.js
 ecma_2/RegExp/octal-002.js
-# Invalid IL
+# Convert:ToObject throws JScriptException
 #ecma_2/RegExp/octal-003.js
 ecma_2/RegExp/properties-001.js
 ecma_2/RegExp/properties-002.js
 # Needs for in
 #ecma_2/RegExp/regexp-enumerate-001.js
-# Invalid IL
-#ecma_2/RegExp/regress-001.js
+ecma_2/RegExp/regress-001.js
+# RegExpObject:Initialize throws JScriptException
 #ecma_2/RegExp/unicode-001.js
-#ecma_2/Statements/dowhile-001.js
+ecma_2/Statements/dowhile-001.js
 # Endless loop
 #ecma_2/Statements/dowhile-002.js
 # Invalid IL
 #ecma_2/Statements/dowhile-003.js
 # Endless loop
 #ecma_2/Statements/dowhile-004.js
-# Invalid IL
-#ecma_2/Statements/dowhile-005.js
+ecma_2/Statements/dowhile-005.js
 ecma_2/Statements/dowhile-006.js
 ecma_2/Statements/dowhile-007.js
 # Needs for in
@@ -933,7 +925,7 @@ ecma_2/Statements/dowhile-007.js
 #ecma_2/Statements/forin-002.js
 # Invalid IL
 #ecma_2/Statements/if-001.js
-#ecma_2/Statements/label-001.js
+ecma_2/Statements/label-001.js
 ecma_2/Statements/label-002.js
 ecma_2/Statements/switch-001.js
 ecma_2/Statements/switch-002.js
@@ -957,15 +949,15 @@ ecma_2/Statements/while-002.js
 ecma_2/Statements/while-003.js
 # Invalid IL
 #ecma_2/Statements/while-004.js
-#ecma_2/String/match-001.js
-#ecma_2/String/match-002.js
-#ecma_2/String/match-003.js
-#ecma_2/String/match-004.js
+ecma_2/String/match-001.js
+ecma_2/String/match-002.js
+ecma_2/String/match-003.js
+ecma_2/String/match-004.js
 ecma_2/String/replace-001.js
+ecma_2/String/split-001.js
 # Invalid IL
-#ecma_2/String/split-001.js
 #ecma_2/String/split-002.js
-#ecma_2/String/split-003.js
+ecma_2/String/split-003.js
 # Invalid IL
 #ecma_2/instanceof/instanceof-001.js
 ecma_2/instanceof/instanceof-002.js
@@ -975,13 +967,13 @@ ecma_2/instanceof/instanceof-003.js
 #js1_1/regress/function-001.js
 js1_2/Array/array_split_1.js
 js1_2/Array/general1.js
+js1_2/Array/general2.js
 # Invalid IL
-#js1_2/Array/general2.js
 #js1_2/Array/slice.js
 # NullReferenceException from Binary:emit_access
 #js1_2/Array/splice1.js
 #js1_2/Array/splice2.js
-# Invalid IL
+# LateBinding:CallValue throws NullReferenceException
 #js1_2/Array/tostring_1.js
 js1_2/Array/tostring_2.js
 # Invalid IL
@@ -1006,9 +998,8 @@ js1_2/function/regexparg-2-n.js
 # Needs new Function
 #js1_2/function/tostring-1.js
 #js1_2/function/tostring-2.js
-# Endless loop
-#js1_2/operator/equality.js
-#js1_2/operator/strictEquality.js
+js1_2/operator/equality.js
+js1_2/operator/strictEquality.js
 js1_2/regexp/RegExp_dollar_number.js
 # Invalid IL
 #js1_2/regexp/RegExp_input.js
@@ -1026,7 +1017,7 @@ js1_2/regexp/RegExp_multiline_as_array.js
 js1_2/regexp/RegExp_object.js
 js1_2/regexp/RegExp_rightContext.js
 js1_2/regexp/RegExp_rightContext_as_array.js
-# Invalid IL
+# LateBinding:CallValue throws InvalidCastException
 #js1_2/regexp/alphanumeric.js
 js1_2/regexp/asterisk.js
 js1_2/regexp/backslash.js
@@ -1035,8 +1026,8 @@ js1_2/regexp/backspace.js
 #js1_2/regexp/beginLine.js
 js1_2/regexp/character_class.js
 js1_2/regexp/compile.js
-# Invalid IL
-#js1_2/regexp/control_characters.js
+js1_2/regexp/control_characters.js
+# LateBinding:CallValue throws InvalidCastException
 #js1_2/regexp/digit.js
 js1_2/regexp/dot.js
 # Invalid IL
@@ -1064,13 +1055,13 @@ js1_2/regexp/string_split.js
 js1_2/regexp/test.js
 js1_2/regexp/toString.js
 js1_2/regexp/vertical_bar.js
-# Invalid IL
+# LateBinding:CallValue  throws InvalidCastException
 #js1_2/regexp/whitespace.js
 #js1_2/regexp/word_boundary.js
 # Need for in
 #js1_2/regress/regress-7703.js
-# Invalid IL
-#js1_2/statements/break.js
+js1_2/statements/break.js
+# infinite loop caused by bad generated IL.
 #js1_2/statements/continue.js
 js1_2/statements/do_while.js
 js1_2/statements/switch.js
@@ -1093,12 +1084,10 @@ js1_3/inherit/proto_1.js
 # Invalid IL
 #js1_3/inherit/proto_11.js
 #js1_3/inherit/proto_12.js
-# Endless loop
-#js1_3/inherit/proto_2.js
+js1_3/inherit/proto_2.js
 js1_3/inherit/proto_3.js
 js1_3/inherit/proto_4.js
-# Endless loop
-#js1_3/inherit/proto_5.js
+js1_3/inherit/proto_5.js
 js1_3/inherit/proto_6.js
 js1_3/inherit/proto_7.js
 js1_3/inherit/proto_8.js
@@ -1122,8 +1111,7 @@ js1_4/Regress/date-001-n.js
 js1_4/Regress/function-001.js
 # Needs JScriptEvaluate
 #js1_4/Regress/function-002.js
-# Invalid IL
-#js1_4/Regress/function-003.js
+js1_4/Regress/function-003.js
 # Needs eval
 #js1_4/Regress/function-004-n.js
 # Needs new Function
index 6af63d647989984c0d9d562a17ae495e0e761976..ec2aba818a3225128e888c20f3fc676eb0d63b6c 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-06 Satya Sudha K <ksathyasudha@novell.com>
+       * Strings.cs, FileSystem.cs : Minor fixes to the 'Join' and 'FileOpen'
+                methods respectively.
+
 2005-08-30 Manjula GHM <mmanjula@novell.com>
        * BinaryVBFile.cs : Handle trailing '#" for bool and date 
        * OutPutVBFile.cs : Minor fixes
index acf3f49780cfb2d9694346c85d59ed11ba82e115..0f574d32bba944ecdf768b690a9ba23233186876 100644 (file)
@@ -154,7 +154,8 @@ namespace Microsoft.VisualBasic
                                VBFile vbFile = new BinaryVBFile(fileName,mode,access,recordLength);
                                _openFilesMap.Add(fileNumber, vbFile);
                        }
-                       _fileNameIdMap.Add(Path.GetFullPath(string.Intern(fileName)),fileNumber);
+                       if (share != OpenShare.Shared && !_fileNameIdMap.ContainsKey(Path.GetFullPath(string.Intern(fileName))))
+                               _fileNameIdMap.Add(Path.GetFullPath(string.Intern(fileName)),fileNumber);
                }
 
                public static void FilePut(int fileNumber,
index e74c59acf43b1b6a6f731662d46b4d65f576a37e..c82320e9afc5f62b2f22c31e88a6aeb7a844ec65 100644 (file)
@@ -723,7 +723,8 @@ namespace Microsoft.VisualBasic
                                string[] dest;
                                dest = new string[SourceArray.Length];
 
-                               SourceArray.CopyTo(dest, 0);
+                               for (int i = 0; i < SourceArray.Length; i++)
+                                       dest [i] = StringType.FromObject (SourceArray [i]);
                                return string.Join(Delimiter, dest);
                        }
                        catch (System.InvalidCastException ie){
index 114fb9d5b7d55a0cc8c6e477a0726ddd509c303d..240eca3d9677e08b5972f28852ffeb34e1181c45 100644 (file)
@@ -24,8 +24,7 @@ Public Class TestClass
     Public Function Test() As String
         Dim fn As Integer
         Dim c1 As Char
-        Dim cVBCr As Char
-        Dim cVBLf As Char
+        Dim cVBCrLf As Char
         Dim strFileName As String
         Dim strPathName As String
         
@@ -49,11 +48,9 @@ Public Class TestClass
         FileGet(fn, c1)
         FileGet(fn, c1)
         FileGet(fn, c1)
-        FileGet(fn, cVBCr) 'read the Carridge
-        FileGet(fn, cVBLf) 'read the line feed
+        FileGet(fn, cVBCrLf) 'read the Carriage return
         FileClose(fn)
-        If Asc(cVBCr) <> 13 Then Return "failed"
-        If Asc(cVBLf) <> 10 Then Return "failed"
+        If Asc(cVBCrLf) <> 10 Then Return "failed"
         Return "success"
     End Function
 End Class
index 3f3d763bf9db32d22b0d7141c8f8b5a375f0390a..62f272c33e3a623f7fc1b246f36fb925b634ca0a 100644 (file)
@@ -24,8 +24,7 @@ Public Class TestClass
     Public Function Test() As String
         Dim fn As Integer
         Dim c1 As Char
-        Dim cVBCr As Char
-        Dim cVBLf As Char
+        Dim cVBCrLf As Char
         Dim strFileName As String
         Dim strPathName As String
         
@@ -51,11 +50,9 @@ Public Class TestClass
         FileGet(fn, c1)
         FileGet(fn, c1)
         FileGet(fn, c1) 'read the "
-        FileGet(fn, cVBCr) 'read the Carridge
-        FileGet(fn, cVBLf) 'read the line feed
+        FileGet(fn, cVBCrLf) 'read the Carridge
         FileClose(fn)
-        If Asc(cVBCr) <> 13 Then Return "failed"
-        If Asc(cVBLf) <> 10 Then Return "failed"
+        If Asc(cVBCrLf) <> 10 Then Return "failed"
         Return "success"
     End Function
 End Class
index 47df6936d36a433073bbf00555af11b4bf3775f8..cccb6b65a40f9077b729f41cf32dc9338eb5f159 100644 (file)
@@ -24,7 +24,6 @@ Public Class TestClass
     Public Function Test() As String
         Dim fn As Integer
         Dim c1 As Char
-        Dim cVBCr As Char
         Dim cVBLf As Char
         Dim strFileName As String
         Dim strPathName As String
@@ -60,10 +59,8 @@ Public Class TestClass
         FileGet(fn, c1)
         str1 = str1 & c1
         FileGet(fn, c1) 'read "
-        FileGet(fn, cVBCr) 'read the Carridge
         FileGet(fn, cVBLf) 'read the line feed
         'omit output
-        FileGet(fn, cVBCr) 'read the Carridge
         FileGet(fn, cVBLf) 'read the line feed
         FileGet(fn, c1) 'read "
         FileGet(fn, c1) 'read the second string
@@ -76,7 +73,6 @@ Public Class TestClass
         str2 = str2 & c1
         FileGet(fn, c1) 'read "
         FileClose(fn)
-        If Asc(cVBCr) <> 13 Then Return "failed to get Carrige Return"
         If Asc(cVBLf) <> 10 Then Return "failed to get Line Feed"
         If str1 <> "1234" Then Return "failed to get fisrt string"
         If str2 <> "abcd" Then Return "failed to get second string"
diff --git a/mcs/class/Microsoft.Web.Atlas/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Web.Atlas/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..f885f49
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc.  http://www.novell.com
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Web.UI;
+
+// General Information about the System.Web assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyTitle("Microsoft.Web.Atlas.dll")]
+[assembly: AssemblyDescription("Microsoft.Web.Atlas.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("MONO development team")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2005 Various Authors")]
+[assembly: AssemblyTrademark("")]
+#if TARGET_JVM
+[assembly: CLSCompliant(false)]
+#else
+[assembly: CLSCompliant(true)]
+#endif
+
+[assembly: ComVisible(false)]
+[assembly: AssemblyDefaultAlias("Microsoft.Web.Atlas.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+#if !TARGET_JVM
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/ChangeLog b/mcs/class/Microsoft.Web.Atlas/ChangeLog
new file mode 100644 (file)
index 0000000..c2e54b1
--- /dev/null
@@ -0,0 +1,273 @@
+2005-09-16  Chris Toshok  <toshok@ximian.com>
+
+       * Test/Microsoft.Web.UI/LabelTest.cs: new test.
+
+       * Test/Microsoft.Web.UI/ListViewTest.cs: new test.
+
+       * Test/Microsoft.Web.UI/TextBoxTest.cs: new test.
+
+2005-09-15  Chris Toshok  <toshok@ximian.com>
+
+       * Makefile (LIB_MCS_FLAGS): fix this up.
+
+       * Microsoft.Web.Services/ScriptHandlerFactory.cs
+       (ScriptHandlerFactory.GetHandler): implement by returning a
+       JSProxyGenerator if PathInfo == "/js", otherwise we fallback to
+       using WebServiceHandlerFactory.
+       (JSProxyGenerator): brain dead and simple proxy generator that
+       uses S.R. to emit the JS.
+
+       * Microsoft.Web.UI/Script.cs: always render the <script> tags for
+       the time being - eventually we'll compare Page.Browser and
+       Script.Browser.
+
+       * resources/AtlasCore.js: include portions of prototype.js to get
+       the Ajax stuff working.  Their stuff is MIT, and why reinvent the
+       wheel?
+       (Web.Net.ServiceMethodRequest): implement this in terms of
+       Ajax.Request from prototype.js.
+
+2005-09-15  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Services/ScriptHandlerFactory.cs: new (stub) file.
+
+       * Microsoft.Web.Services/ScriptModule.cs: same.
+
+2005-09-15  Chris Toshok  <toshok@ximian.com>
+
+       * Assembly/AssemblyInfo.cs: new file.
+
+       * Microsoft.Web.Atlas.dll.sources: add the assemblyinfo stuff.
+
+2005-09-15  Chris Toshok  <toshok@ximian.com>
+
+       * resources/AtlasControls.js: new file.
+
+       * resources/AtlasCore.js: new file.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.UI/Option.cs: new implementation.
+
+       * Test/Microsoft.Web.UI/OptionTest.cs: new test.
+
+       * Microsoft.Web.Atlas_test.dll.sources: add OptionTest.cs
+
+       * Microsoft.Web.Atlas.dll.sources: add Option.cs
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.UI/PropertyFilter.cs: new implementation.
+
+       * Microsoft.Web.UI/Filter.cs: new implementation.
+
+       * Test/Microsoft.Web.UI/PropertyFilterTest.cs: new test.
+
+       * Microsoft.Web.Atlas_test.dll.sources: add PropertyFilterTest.cs
+
+       * Microsoft.Web.Atlas.dll.sources: add PropertyFilter.cs
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas.dll.sources: add DraggableListItem.cs
+
+       * Microsoft.Web.UI/HoverBehavior.cs (AddAttributesToElement): add
+       comment about how MS NRE's here in our tests.
+       (InitializeTypeDescriptor): fix the ServerPropertyName for
+       "hoverElement".
+
+       * Microsoft.Web.UI/DraggableListItem.cs (AddAttributesToElement):
+       add comment about how MS NRE's here in our tests.
+
+       * Microsoft.Web.UI/DataSourceDropTarget.cs
+       (AddAttributesToElement): add comment about how MS NRE's here in
+       our tests.
+
+       * Microsoft.Web.UI/FloatingBehavior.cs (AddAttributesToElement):
+       add comment about how MS NRE's here in our tests.
+       
+       * Microsoft.Web/Binding.cs: new implementation.
+
+       * Microsoft.Web/BindingDirection.cs: fix ordering on enum.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas_test.dll.sources: add BindingTest and
+       DraggableListItemTest.
+
+       * Test/Microsoft.Web/*: lots of new test work.
+
+       * Test/Microsoft.Web.UI/*: lots of new test work.
+       
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas_test.dll.sources: add DragDropListTest.cs
+
+       * Microsoft.Web.Atlas.dll.sources: add DragDropList.cs
+
+       * Microsoft.Web.UI/DragDropList.cs: new implementation.
+
+       * Test/Microsoft.Web.UI/DragDropListTest.cs: new tests.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Test/Microsoft.Web.UI/DataSourceDropTargetTest.cs: expand the
+       property tests.
+
+       * Microsoft.Web.UI/DataSourceDropTarget.cs: fix up the default
+       values and behavior of properties.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas_test.dll.sources: add DataSourceDropTargetTest.cs
+
+       * Microsoft.Web.Atlas.dll.sources: add DataSourceDropTarget.cs
+
+       * Microsoft.Web.UI/DataSourceDropTarget.cs: new implementation.
+
+       * Test/Microsoft.Web.UI/DataSourceDropTargetTest.cs: new tests.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas_test.dll.sources: add HoverBehaviorTest.cs
+
+       * Microsoft.Web.Atlas.dll.sources: add HoverBehavior.cs
+
+       * Microsoft.Web.UI/HoverBehavior.cs: new implementation.
+
+       * Test/Microsoft.Web.UI/HoverBehaviorTest.cs: new tests.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.UI/ClickBehavior.cs: fix a nullref in kind of a
+       stupid way.. leave an XXX.
+
+       * Microsoft.Web.Atlas_test.dll.sources: add FloatingBehaviorTest.cs
+
+       * Microsoft.Web.Atlas.dll.sources: add FloatingBehavior.cs
+
+       * Microsoft.Web.UI/FloatingBehavior.cs: new implementation.
+
+       * Test/Microsoft.Web.UI/FloatingBehaviorTest.cs: new tests.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas.dll_sources: add implementations.
+
+       * Microsoft.Web.Atlas_test.dll_sources: add tests.
+
+       * Microsoft.Web/Behavior.cs: this class is pretty much empty.
+
+       * Microsoft.Web/ActionCollection.cs: make the readonly stuff work.
+       someone with more experience with this crap should tell me whether
+       i did it right..
+
+       * Microsoft.Web/ScriptMemberDescriptor.cs: cleanup.
+
+       * Microsoft.Web/ScriptComponent.cs: cleanup.
+
+       * Microsoft.Web/ScriptTypeDescriptor.cs (.ctor): cleanup.
+
+       * Microsoft.Web/ScriptComponentBase.cs (RenderScript): make this
+       an explicit interface implementation.
+
+       * Microsoft.Web/Action.cs (InitializeTypeDescriptor): move some of
+       the propertydescriptors from ScriptComponentBase to here, as they
+       don't show up when we get type descriptors for Behaviors.
+
+       * Microsoft.Web/BehaviorCollection.cs: this class should be
+       public.
+
+       * Microsoft.Web/ScriptControl.cs: stubs.
+
+       * Microsoft.Web.UI/Button.cs: stubs.
+
+       * Test/Microsoft.Web.UI/ClickBehavior.cs: new tests.
+
+       * Microsoft.Web.UI/ClickBehavior: new implementation.
+       
+       * Test/Microsoft.Web/ScriptEventTest.cs: new tests.
+
+       * Microsoft.Web/ScriptEvent.cs: round out implementation.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Test/Microsoft.Web/ActionTest.cs,
+       Microsoft.Web/BehaviorCollection.cs,
+       Microsoft.Web/ScriptComponentBase.cs,
+       Microsoft.Web/BindingCollection.cs,
+       Microsoft.Web/ActionCollection.cs, Microsoft.Web/Behavior.cs,
+       Microsoft.Web/IScriptObject.cs, Microsoft.Web/Binding.cs: fix a
+       missing method in IScriptObject.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Test/Microsoft.Web/SetPropertyActionTest.cs,
+       Test/Microsoft.Web/InvokeMethodActionTest.cs: new tests.
+
+       * Microsoft.Web/SetPropertyAction.cs,
+       Microsoft.Web/InvokeMethodAction.cs: new implementations.
+
+       * Microsoft.Web.Atlas.dll_sources: add implementations.
+
+       * Microsoft.Web.Atlas_test.dll_sources: add tests.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas_test.dll.sources: add
+       ScriptComponentBaseTest.
+
+       * Test/Microsoft.Web/ScriptComponentBaseTest.cs: new tests.
+
+       * Microsoft.Web/ScriptEventCollection.cs: naive, untested,
+       implementation to get the other tests running.
+
+       * Microsoft.Web/ScriptEvent.cs: same.
+
+       * Microsoft.Web/BindingCollection.cs: same.
+
+       * Microsoft.Web/ActionCollection.cs: same.
+
+       * Microsoft.Web/ScriptComponentBase.cs: round out implementation.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web/ScriptComponentBase.cs (InitializeTypeDescriptor):
+       implement.
+
+       * Microsoft.Web/ScriptType.cs: fix enum.
+
+       * Microsoft.Web/Action.cs: round out implementation.
+
+       * Test/Microsoft.Web/ActionTest.cs: more tests.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web/ScriptMemberDescriptor.cs: new implementation.
+
+       * Microsoft.Web/ScriptTypeDescriptor.cs: new implementation.
+
+       * Microsoft.Web/ScriptMethodDescriptor.cs: new implementation.
+
+       * Microsoft.Web/ScriptEventDescriptor.cs: new implementation.
+
+       * Microsoft.Web/ScriptPropertyDescriptor.cs: new implementation.
+
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Test/Microsoft.Web/ScriptEventDescriptorTest.cs,
+       Test/Microsoft.Web/ScriptMethodDescriptorTest.cs,
+       Test/Microsoft.Web/ScriptPropertyDescriptorTest.cs: new tests.
+
+       * Microsoft.Web.Atlas_test.dll.sources: add the descriptor tests.
+       
+2005-09-14  Chris Toshok  <toshok@ximian.com>
+
+       * Microsoft.Web.Atlas_test.dll.sources: add
+       ScriptTypeDescriptorTest
+
+       * Test/Microsoft.Web/ScriptTypeDescriptorTest.cs: new test.
+
+2005-09-13  Chris Toshok  <toshok@ximian.com>
+
+       * *: Initial import.. I was bored so I got started.
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Web.Atlas/Makefile b/mcs/class/Microsoft.Web.Atlas/Makefile
new file mode 100644 (file)
index 0000000..ceb1bd4
--- /dev/null
@@ -0,0 +1,27 @@
+thisdir = class/Microsoft.Web.Atlas
+include ../../build/rules.make
+
+#RESOURCE_FILES = \
+#      ...
+
+LIBRARY = Microsoft.Web.Atlas.dll
+LIB_MCS_FLAGS = \
+       -unsafe \
+       -nowarn:649     \
+       -r:$(corlib)                    \
+       -r:System.dll                   \
+       -r:System.Configuration.dll     \
+       -r:System.Drawing.dll           \
+       -r:System.Data.dll              \
+       -r:System.Web.dll               \
+       -r:System.Web.Services.dll      \
+       -r:System.Xml.dll               \
+       -r:System.EnterpriseServices.dll \
+       -r:System.Design.dll            \
+       $(RESOURCE_FILES:%=/resource:%)
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:219 -nowarn:169
+
+EXTRA_DISTFILES = $(RESOURCE_FILES)
+
+include ../../build/library.make
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Atlas.dll.sources b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Atlas.dll.sources
new file mode 100644 (file)
index 0000000..d37f81e
--- /dev/null
@@ -0,0 +1,51 @@
+Assembly/AssemblyInfo.cs
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Microsoft.Web/ActionCollection.cs
+Microsoft.Web/Action.cs
+Microsoft.Web/ActionMemberConverter.cs
+Microsoft.Web/ActionSequence.cs
+Microsoft.Web/ActionTargetConverter.cs
+Microsoft.Web/BehaviorCollection.cs
+Microsoft.Web/Behavior.cs
+Microsoft.Web/BindingCollection.cs
+Microsoft.Web/Binding.cs
+Microsoft.Web/BindingDirection.cs
+Microsoft.Web/IDConverter.cs
+Microsoft.Web/InvokeMethodAction.cs
+Microsoft.Web/IScriptComponent.cs
+Microsoft.Web/IScriptObject.cs
+Microsoft.Web/ScriptComponentBase.cs
+Microsoft.Web/ScriptComponent.cs
+Microsoft.Web/ScriptControl.cs
+Microsoft.Web/ScriptEventCollection.cs
+Microsoft.Web/ScriptEvent.cs
+Microsoft.Web/ScriptEventDescriptor.cs
+Microsoft.Web/ScriptMemberDescriptor.cs
+Microsoft.Web/ScriptMethodDescriptor.cs
+Microsoft.Web/ScriptPropertyDescriptor.cs
+Microsoft.Web/ScriptTextWriter.cs
+Microsoft.Web/ScriptType.cs
+Microsoft.Web/ScriptTypeDescriptor.cs
+Microsoft.Web/SetPropertyAction.cs
+Microsoft.Web/TransformScriptEvent.cs
+Microsoft.Web/VisibilityMode.cs
+Microsoft.Web.Services/ScriptHandlerFactory.cs
+Microsoft.Web.Services/ScriptModule.cs
+Microsoft.Web.UI/ActivationType.cs
+Microsoft.Web.UI/Button.cs
+Microsoft.Web.UI/ClickBehavior.cs
+Microsoft.Web.UI/DataSourceDropTarget.cs
+Microsoft.Web.UI/DragDropList.cs
+Microsoft.Web.UI/DraggableListItem.cs
+Microsoft.Web.UI/DragMode.cs
+Microsoft.Web.UI/Filter.cs
+Microsoft.Web.UI/FloatingBehavior.cs
+Microsoft.Web.UI/HoverBehavior.cs
+Microsoft.Web.UI/MapStyle.cs
+Microsoft.Web.UI/Option.cs
+Microsoft.Web.UI/PositioningMode.cs
+Microsoft.Web.UI/PropertyFilter.cs
+Microsoft.Web.UI/Script.cs
+Microsoft.Web.UI/ScriptManager.cs
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Atlas_test.dll.sources b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Atlas_test.dll.sources
new file mode 100644 (file)
index 0000000..11216b0
--- /dev/null
@@ -0,0 +1,21 @@
+Microsoft.Web/ActionTest.cs
+Microsoft.Web/BindingTest.cs
+Microsoft.Web/InvokeMethodActionTest.cs
+Microsoft.Web/SetPropertyActionTest.cs
+Microsoft.Web/ScriptComponentBaseTest.cs
+Microsoft.Web/ScriptEventDescriptorTest.cs
+Microsoft.Web/ScriptEventTest.cs
+Microsoft.Web/ScriptMethodDescriptorTest.cs
+Microsoft.Web/ScriptPropertyDescriptorTest.cs
+Microsoft.Web/ScriptTypeDescriptorTest.cs
+Microsoft.Web.UI/ClickBehaviorTest.cs
+Microsoft.Web.UI/DragDropListTest.cs
+Microsoft.Web.UI/DraggableListItemTest.cs
+Microsoft.Web.UI/DataSourceDropTargetTest.cs
+Microsoft.Web.UI/FloatingBehaviorTest.cs
+Microsoft.Web.UI/HoverBehaviorTest.cs
+Microsoft.Web.UI/LabelTest.cs
+Microsoft.Web.UI/ListViewTest.cs
+Microsoft.Web.UI/OptionTest.cs
+Microsoft.Web.UI/PropertyFilterTest.cs
+Microsoft.Web.UI/TextBoxTest.cs
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Services/ScriptHandlerFactory.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Services/ScriptHandlerFactory.cs
new file mode 100644 (file)
index 0000000..4ace866
--- /dev/null
@@ -0,0 +1,112 @@
+//
+// Microsoft.Web.Services.ScriptHandlerFactory
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.IO;
+using System.Web;
+using System.Web.UI;
+using System.Reflection;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+
+namespace Microsoft.Web.Services
+{
+       class JSProxyGenerator : IHttpHandler
+       {
+               Type type;
+               string virtualPath;
+
+               public JSProxyGenerator (Type type, string virtualPath)
+               {
+                       this.type = type;
+                       this.virtualPath = virtualPath;
+               }
+
+               public bool IsReusable {
+                       get {
+                               return false;
+                       }
+               }
+
+               public void ProcessRequest (HttpContext context)
+               {
+                       TextWriter output = context.Response.Output;
+
+                       output.Write (String.Format ("Type.registerNamespace('{0}'); ", type.Namespace));
+                       output.Write (String.Format (@"{0} = {{ path: ""{1}""", type.FullName, virtualPath));
+
+                       foreach (MethodInfo m in type.GetMethods()) {
+                               object[] attrs = m.GetCustomAttributes (typeof (WebMethodAttribute), false);
+                               if (m.IsPublic && attrs != null && attrs.Length > 0) {
+                                       /* it's a webmethod, output it */
+                                       output.Write (", {0}:function (", m.Name);
+                                       foreach (ParameterInfo p in m.GetParameters()) {
+                                               output.Write (p.Name + ",");
+                                       }
+                                       output.Write (String.Format (" onMethodComplete, onMethodTimeout) {{ return Web.Net.ServiceMethodRequest.callMethod(this.path, \"{0}\", {{", m.Name));
+                                       foreach (ParameterInfo p in m.GetParameters()) {
+                                               output.Write ("{0}:{0}", p.Name);
+                                       }
+                                       output.Write ("}, onMethodComplete,onMethodTimeout); } }");
+                               }
+                       }
+               }
+       }
+
+       public class ScriptHandlerFactory : IHttpHandlerFactory
+       {
+               WebServiceHandlerFactory fallback;
+
+               public ScriptHandlerFactory ()
+               {
+                       fallback = new WebServiceHandlerFactory();
+               }
+
+               public virtual IHttpHandler GetHandler (HttpContext context, string requestType, string virtualPath, string path)
+               {
+                       if (context.Request.PathInfo == "/js") {
+                               Type type = WebServiceParser.GetCompiledType (path, context);
+
+                               return new JSProxyGenerator (type, virtualPath);
+                       }
+                       else {
+                               return fallback.GetHandler (context, requestType, virtualPath, path);
+                       }
+
+               }
+
+               public virtual void ReleaseHandler (IHttpHandler handler)
+               {
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Services/ScriptModule.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.Services/ScriptModule.cs
new file mode 100644 (file)
index 0000000..5a18f79
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// Microsoft.Web.Services.ScriptModule
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web;
+
+namespace Microsoft.Web.Services
+{
+       public class ScriptModule : IHttpModule
+       {
+               public ScriptModule ()
+               {
+                       Console.WriteLine ("in ScriptModule..ctor");
+               }
+
+               void IHttpModule.Dispose()
+               {
+                       Console.WriteLine ("in ScriptModule.Dispose");
+               }
+
+               void IHttpModule.Init (HttpApplication context)
+               {
+                       Console.WriteLine ("in ScriptModult.Init");
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ActivationType.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ActivationType.cs
new file mode 100644 (file)
index 0000000..d9c9a44
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Microsoft.Web.UI.ActivationType
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web.UI
+{
+       public enum ActivationType
+       {
+               Click,
+               Hover,
+               None
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Button.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Button.cs
new file mode 100644 (file)
index 0000000..c6b7820
--- /dev/null
@@ -0,0 +1,85 @@
+//
+// Microsoft.Web.UI.Button
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Web.UI;
+using Microsoft.Web;
+
+namespace Microsoft.Web.UI
+{
+       public class Button : ScriptControl
+       {
+               public Button ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+               }
+
+               protected override void OnPreRender (EventArgs e)
+               {
+               }
+
+               protected override void Render (HtmlTextWriter writer)
+               {
+               }
+
+               public ScriptEvent Click {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public string Text {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ClickBehavior.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ClickBehavior.cs
new file mode 100644 (file)
index 0000000..89e718b
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// Microsoft.Web.UI.ClickBehavior
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web.UI
+{
+       public class ClickBehavior : Behavior
+       {
+               public ClickBehavior ()
+               {
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       /* XXX should make this use Click, but Owner == null is causing exceptions */
+                       typeDescriptor.AddEvent (new ScriptEventDescriptor ("click", true));
+               }
+
+               ScriptEvent click;
+               public ScriptEvent Click {
+                       get {
+                               if (click == null)
+                                       click = new ScriptEvent (Owner, "click", true);
+
+                               return click;
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "clickBehavior";
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DataSourceDropTarget.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DataSourceDropTarget.cs
new file mode 100644 (file)
index 0000000..fcf2571
--- /dev/null
@@ -0,0 +1,110 @@
+//
+// Microsoft.Web.UI.DataSourceDropTarget
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web.UI
+{
+       public class DataSourceDropTarget : Behavior
+       {
+               public DataSourceDropTarget ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       // MS raises a NRE when this is called from
+                       // our tests.  speculation: they're accessing
+                       // Browser or Page to figure out if they
+                       // should be rendering attributes.
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("acceptedDataTypes", ScriptType.Array, false, "AcceptedDataTypes"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("append", ScriptType.Boolean, false, "Append"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("target", ScriptType.String, false, "Target"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("property", ScriptType.String, false, "Property"));
+               }
+
+               string acceptedDataTypes = null;
+               public string AcceptedDataTypes {
+                       get {
+                               return acceptedDataTypes;
+                       }
+                       set {
+                               acceptedDataTypes = value;
+                       }
+               }
+
+               bool append = true;
+               public bool Append {
+                       get {
+                               return append;
+                       }
+                       set {
+                               append = value;
+                       }
+               }
+
+               string property = "data";
+               public string Property {
+                       get {
+                               return property;
+                       }
+                       set {
+                               property = value;
+                       }
+               }
+
+               string target = null;
+               public string Target {
+                       get {
+                               return target;
+                       }
+                       set {
+                               target = value;
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "dataSourceDropTarget";
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DragDropList.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DragDropList.cs
new file mode 100644 (file)
index 0000000..b42f968
--- /dev/null
@@ -0,0 +1,135 @@
+//
+// Microsoft.Web.UI.DragDropList
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace Microsoft.Web.UI
+{
+       public class DragDropList : Behavior
+       {
+               public DragDropList ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       // MS raises a NRE when this is called from
+                       // our tests.  speculation: they're accessing
+                       // Browser or Page to figure out if they
+                       // should be rendering attributes.
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("acceptedDataTypes", ScriptType.Array, false, "AcceptedDataTypes"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("dataType", ScriptType.String, false, "DataType"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("dragMode", ScriptType.Enum, false, "DragMode"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("direction", ScriptType.Enum, false, "Direction"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("dropCueTemplate", ScriptType.Object, false));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("emptyTemplate", ScriptType.Object, false));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("floatContainerTemplate", ScriptType.Object, false));
+               }
+
+               string acceptedDataTypes = null;
+               public string AcceptedDataTypes {
+                       get {
+                               return acceptedDataTypes;
+                       }
+                       set {
+                               acceptedDataTypes = value;
+                       }
+               }
+
+               string dataType = null;
+               public string DataType {
+                       get {
+                               return dataType;
+                       }
+                       set {
+                               dataType = value;
+                       }
+               }
+
+               RepeatDirection direction = RepeatDirection.Vertical;
+               public RepeatDirection Direction {
+                       get {
+                               return direction;
+                       }
+                       set {
+                               direction = value;
+                       }
+               }
+
+               DragMode dragMode = DragMode.Copy;
+               public Microsoft.Web.UI.DragMode DragMode {
+                       get {
+                               return dragMode;
+                       }
+                       set {
+                               dragMode = value;
+                       }
+               }
+
+               string floatContainerCssClass = null;
+               public string FloatContainerCssClass {
+                       get {
+                               return floatContainerCssClass;
+                       }
+                       set {
+                               floatContainerCssClass = value;
+                       }
+               }
+
+               HtmlTextWriterTag floatContainerTag = HtmlTextWriterTag.Div;
+               public HtmlTextWriterTag FloatContainerTag {
+                       get {
+                               return floatContainerTag;
+                       }
+                       set {
+                               floatContainerTag = value;
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "dragDropList";
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DragMode.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DragMode.cs
new file mode 100644 (file)
index 0000000..ebf2a47
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// Microsoft.Web.UI.DragMode
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web.UI
+{
+       public enum DragMode
+       {
+               Copy,
+               Mode
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DraggableListItem.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/DraggableListItem.cs
new file mode 100644 (file)
index 0000000..7156f7e
--- /dev/null
@@ -0,0 +1,81 @@
+//
+// Microsoft.Web.UI.DraggableListItem
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace Microsoft.Web.UI
+{
+       public class DraggableListItem : Behavior
+       {
+               public DraggableListItem ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       // MS raises a NRE when this is called from
+                       // our tests.  speculation: they're accessing
+                       // Browser or Page to figure out if they
+                       // should be rendering attributes.
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("data", ScriptType.Object, false, ""));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("handle", ScriptType.Object, false, "Handle"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("dragVisualTemplate", ScriptType.Object, false, ""));
+               }
+
+               string handle = null;
+               public string Handle {
+                       get {
+                               return handle;
+                       }
+                       set {
+                               handle = value;
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "draggableListItem";
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Filter.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Filter.cs
new file mode 100644 (file)
index 0000000..a3ba5a2
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// Microsoft.Web.UI.Filter
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Web.UI;
+using Microsoft.Web;
+
+namespace Microsoft.Web.UI
+{
+       public abstract class Filter : ScriptComponentBase
+       {
+               protected Filter ()
+               {
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/FloatingBehavior.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/FloatingBehavior.cs
new file mode 100644 (file)
index 0000000..b299161
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// Microsoft.Web.UI.FloatingBehavior
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web.UI
+{
+       public class FloatingBehavior : Behavior
+       {
+               public FloatingBehavior ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       // MS raises a NRE when this is called from
+                       // our tests.  speculation: they're accessing
+                       // Browser or Page to figure out if they
+                       // should be rendering attributes.
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("handle", ScriptType.Object, false, "Handle"));
+               }
+
+               string handle = "";
+               public string Handle {
+                       get {
+                               return handle;
+                       }
+                       set {
+                               handle = (value == null ? "" : value);
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "floatingBehavior";
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/HoverBehavior.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/HoverBehavior.cs
new file mode 100644 (file)
index 0000000..73844f0
--- /dev/null
@@ -0,0 +1,113 @@
+//
+// Microsoft.Web.UI.HoverBehavior
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web.UI
+{
+       public class HoverBehavior : Behavior
+       {
+               public HoverBehavior ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       // MS raises a NRE when this is called from
+                       // our tests.  speculation: they're accessing
+                       // Browser or Page to figure out if they
+                       // should be rendering attributes.
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       /* XXX should make this use Hover/Unhover, but Owner == null is causing exceptions */
+                       typeDescriptor.AddEvent (new ScriptEventDescriptor ("hover", true));
+                       typeDescriptor.AddEvent (new ScriptEventDescriptor ("unhover", true));
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("hoverElement", ScriptType.Object, false, ""));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("unhoverDelay", ScriptType.Number, false, "UnhoverDelay"));
+               }
+
+               ScriptEvent hover;
+               public ScriptEvent Hover {
+                       get {
+                               if (hover == null)
+                                       hover = new ScriptEvent (Owner, "hover", true);
+
+                               return hover;
+                       }
+               }
+
+               string hoverElementID = "";
+               public string HoverElementID {
+                       get {
+                               return hoverElementID;
+                       }
+                       set {
+                               hoverElementID = (value == null ? "" : value);
+                       }
+               }
+
+
+               ScriptEvent unhover;
+               public ScriptEvent Unhover {
+                       get {
+                               if (unhover == null)
+                                       unhover = new ScriptEvent (Owner, "unhover", true);
+
+                               return unhover;
+                       }
+               }
+
+               int unhoverDelay = 0;
+               public int UnhoverDelay {
+                       get {
+                               return unhoverDelay;
+                       }
+                       set {
+                               unhoverDelay = value;
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "hoverBehavior";
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/MapStyle.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/MapStyle.cs
new file mode 100644 (file)
index 0000000..21fd826
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Microsoft.Web.UI.MapStyle
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web.UI
+{
+       public enum MapStyle
+       {
+               Aerial,
+               Hybrid,
+               Road
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Option.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Option.cs
new file mode 100644 (file)
index 0000000..ecf6ae4
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// Microsoft.Web.UI.Option
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Web.UI;
+using Microsoft.Web;
+
+namespace Microsoft.Web.UI
+{
+       public sealed class Option
+       {
+               public Option ()
+                       : this ("", "")
+               {
+               }
+
+               public Option (string text, string value)
+               {
+                       this.text = text;
+                       this.value = value;
+               }
+
+               string cssClass = "";
+               public string CssClass {
+                       get {
+                               return cssClass;
+                       }
+                       set {
+                               cssClass = (value == null ? "" : value);
+                       }
+               }
+
+               string text;
+               public string Text {
+                       get {
+                               return text;
+                       }
+                       set {
+                               text = (value == null ? "" : value);
+                       }
+               }
+
+               string value;
+               public string Value {
+                       get {
+                               return value;
+                       }
+                       set {
+                               this.value = (value == null ? "" : value);
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/PositioningMode.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/PositioningMode.cs
new file mode 100644 (file)
index 0000000..d13f4e2
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// Microsoft.Web.UI.PositioningMode
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web.UI
+{
+       public enum PositioningMode
+       {
+               Absolute,
+               BottomLeft,
+               BottomRight,
+               Center,
+               TopLeft,
+               TopRight
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/PropertyFilter.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/PropertyFilter.cs
new file mode 100644 (file)
index 0000000..2cab6d9
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// Microsoft.Web.UI.PropertyFilter
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Web.UI;
+using Microsoft.Web;
+
+namespace Microsoft.Web.UI
+{
+       public class PropertyFilter : Filter
+       {
+               public PropertyFilter ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       if (Property != "")
+                               writer.WriteAttributeString ("property", Property);
+                       if (Value != "")
+                               writer.WriteAttributeString ("value", Value);
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("property", ScriptType.String, false, "Property"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("value", ScriptType.String, false, "Value"));
+               }
+
+               string property = "";
+               public string Property {
+                       get {
+                               return property;
+                       }
+                       set {
+                               property = (value == null ? "" : value);
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "propertyFilter";
+                       }
+               }
+
+               string value = "";
+               public string Value {
+                       get {
+                               return value;
+                       }
+                       set {
+                               this.value = (value == null ? "" : value);
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Script.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/Script.cs
new file mode 100644 (file)
index 0000000..3fb9949
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// Microsoft.Web.UI.Script
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Web.UI;
+using System.Web.Util;
+
+namespace Microsoft.Web.UI
+{
+       public class Script : Control
+       {
+               public Script ()
+               {
+               }
+
+               protected override void Render (HtmlTextWriter writer)
+               {
+                       /* check to see if Browser matches the browser
+                        * that's looking at the page, and only render
+                        * ourselves if there's a match */
+
+                       if (Path != "") {
+                               writer.AddAttribute ("language", "text/javascript");
+                               /* XXX there should be a way to get this done using Control's methods */
+                               writer.AddAttribute ("href", Page.MapPath (Path));
+                               writer.RenderBeginTag (HtmlTextWriterTag.Script);
+                               writer.RenderEndTag ();
+                       }
+               }
+
+               string browser = "";
+               public string Browser {
+                       get {
+                               return browser;
+                       }
+                       set {
+                               browser = (value == null ? "" : value);
+                       }
+               }
+
+               string path = "";
+               public string Path {
+                       get {
+                               return path;
+                       }
+                       set {
+                               path = (value == null ? "" : value);
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ScriptManager.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web.UI/ScriptManager.cs
new file mode 100644 (file)
index 0000000..12b287c
--- /dev/null
@@ -0,0 +1,71 @@
+//
+// Microsoft.Web.UI.ScriptManager
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+
+namespace Microsoft.Web.UI
+{
+       public class ScriptManager : Control
+       {
+               public ScriptManager ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static ScriptManager GetCurrentScriptManager (Page page)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void RegisterComponent (IScriptComponent component)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void RegisterScriptNamespace (string prefix, string namespaceUri)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void RegisterScriptReference (string scriptPath, bool commonScript)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void RegisterScriptReference (string scriptPath)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Action.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Action.cs
new file mode 100644 (file)
index 0000000..3d09e4d
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// Microsoft.Web.Action
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public abstract class Action : ScriptComponentBase
+       {
+               protected Action ()
+               {
+               }
+
+               ActionSequence sequence = ActionSequence.AfterEventHandler;
+               public ActionSequence Sequence {
+                       get {
+                               return sequence;
+                       }
+                       set {
+                               sequence = value;
+                       }
+               }
+
+               string target = "";
+               public string Target {
+                       get {
+                               return target;
+                       }
+                       set {
+                               target = (value == null) ? "" : value;
+                       }
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       if (Target != "")
+                               writer.WriteAttributeString ("target", Target);
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("eventArgs", ScriptType.Object));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("result", ScriptType.Object));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("sender", ScriptType.Object));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("sequence", ScriptType.Enum, "Sequence"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("target", ScriptType.Object, "Target"));
+               }
+
+               public void RenderAction (ScriptTextWriter writer)
+               {
+                       ((IScriptComponent)this).RenderScript (writer);
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionCollection.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionCollection.cs
new file mode 100644 (file)
index 0000000..b8cbb64
--- /dev/null
@@ -0,0 +1,97 @@
+//
+// Microsoft.Web.ActionCollection
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace Microsoft.Web
+{
+       public class ActionCollection : Collection<Action>, IScriptObject
+       {
+               string id;
+               IScriptObject owner;
+
+               public ActionCollection (IScriptObject owner)
+                       : this (owner, false)
+               {
+               }
+
+               public ActionCollection (IScriptObject owner, bool readOnly)
+                       : base (readOnly ? ((IList<Action>)new List<Action>().AsReadOnly()) : new List<Action>())
+               {
+                       this.owner = owner;
+                       this.id = "";
+               }
+
+               protected void ClearItems ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void InsertItem (int index, Action item)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void RemoveItem (int index)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void SetItem (int index, Action item)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IScriptObject.ID {
+                       get {
+                               return id;
+                       }
+                       set {
+                               id = (value == null ? "" : value);
+                       }
+               }
+
+               IScriptObject IScriptObject.Owner {
+                       get {
+                               return owner;
+                       }
+               }
+
+               ScriptTypeDescriptor IScriptObject.GetTypeDescriptor ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionMemberConverter.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionMemberConverter.cs
new file mode 100644 (file)
index 0000000..19e16dd
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// Microsoft.Web.ActionMemberConverter
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+
+namespace Microsoft.Web
+{
+       class ActionMemberConverter : StringConverter
+       {
+               protected ActionMemberConverter ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected StandardValuesCollection GetStandardValues (ScriptTypeDescriptor targetTypeDescriptor)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionSequence.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionSequence.cs
new file mode 100644 (file)
index 0000000..8f9fdd6
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Microsoft.Web.ActionSequence
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+
+       public enum ActionSequence
+       {
+               AfterEventHandler,
+               BeforeEventHandler
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionTargetConverter.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ActionTargetConverter.cs
new file mode 100644 (file)
index 0000000..474f840
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Microsoft.Web.ActionTargetConverter
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+       public class ActionTargetConverter : IDConverter
+       {
+               public ActionTargetConverter ()
+               {
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Behavior.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Behavior.cs
new file mode 100644 (file)
index 0000000..cd3638b
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// Microsoft.Web.Behavior
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public abstract class Behavior : ScriptComponentBase, IScriptObject
+       {
+               protected Behavior ()
+               {
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BehaviorCollection.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BehaviorCollection.cs
new file mode 100644 (file)
index 0000000..40c696d
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// Microsoft.Web.BehaviorCollection
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.ObjectModel;
+
+namespace Microsoft.Web
+{
+       public class BehaviorCollection : Collection<Behavior>, IScriptObject
+       {
+               public BehaviorCollection (IScriptObject owner)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public BehaviorCollection (IScriptObject owner, bool readOnly)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void ClearItems ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void InsertItem (int index, Behavior item)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void RemoveItem (int index)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void SetItem (int index, Behavior item)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public string ID {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public IScriptObject Owner {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               ScriptTypeDescriptor IScriptObject.GetTypeDescriptor ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Binding.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Binding.cs
new file mode 100644 (file)
index 0000000..7e0b21c
--- /dev/null
@@ -0,0 +1,194 @@
+//
+// Microsoft.Web.Binding
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public class Binding : IScriptObject
+       {
+               public Binding ()
+               {
+               }
+
+               bool automatic = true;
+               public bool Automatic {
+                       get {
+                               return automatic;
+                       }
+                       set {
+                               automatic = value;
+                       }
+               }
+
+               string dataContext = "";
+               public string DataContext {
+                       get {
+                               return dataContext;
+                       }
+                       set {
+                               dataContext = (value == null ? "" : value);
+                       }
+               }
+
+               string dataPath = "";
+               public string DataPath {
+                       get {
+                               return dataPath;
+                       }
+                       set {
+                               dataPath = (value == null ? "" : value);
+                       }
+               }
+
+               BindingDirection direction = BindingDirection.In;
+               public BindingDirection Direction {
+                       get {
+                               return direction;
+                       }
+                       set {
+                               direction = value;
+                       }
+               }
+
+               string id = "";
+               public string ID {
+                       get {
+                               return id;
+                       }
+                       set {
+                               id = (value == null ? "" : value);
+                       }
+               }
+
+               string property = "";
+               public string Property {
+                       get {
+                               return property;
+                       }
+                       set {
+                               property = (value == null ? "" : value);
+                       }
+               }
+
+               string propertyKey = "";
+               public string PropertyKey {
+                       get {
+                               return propertyKey;
+                       }
+                       set {
+                               propertyKey = (value == null ? "" : value);
+                       }
+               }
+
+               TransformScriptEvent transform;
+               public TransformScriptEvent Transform {
+                       get {
+                               if (transform == null)
+                                       transform = new TransformScriptEvent (this);
+
+                               return transform;
+                       }
+               }
+
+               string transformerArgument = "";
+               public string TransformerArgument {
+                       get {
+                               return transformerArgument;
+                       }
+                       set {
+                               transformerArgument = (value == null ? "" : value);
+                       }
+               }
+
+               public void RenderScript (ScriptTextWriter writer)
+               {
+                       writer.WriteStartElement ("binding");
+
+                       if (Automatic == false)
+                               writer.WriteAttributeString ("automatic", Automatic.ToString());
+
+                       if (DataContext != "")
+                               writer.WriteAttributeString ("dataContext", DataContext);
+
+                       if (DataPath != "")
+                               writer.WriteAttributeString ("dataPath", DataPath);
+
+                       if (Direction != BindingDirection.In)
+                               writer.WriteAttributeString ("direction", Direction.ToString());
+
+                       if (ID != "")
+                               writer.WriteAttributeString ("id", ID);
+
+                       if (Property != "")
+                               writer.WriteAttributeString ("property", Property);
+
+                       if (PropertyKey != "")
+                               writer.WriteAttributeString ("propertyKey", PropertyKey);
+
+                       if (TransformerArgument != "")
+                               writer.WriteAttributeString ("transformerArgument", TransformerArgument);
+
+                       writer.WriteEndElement ();
+               }
+
+               public IScriptObject Owner {
+                       get {
+                               return null;
+                       }
+               }
+
+               ScriptTypeDescriptor IScriptObject.GetTypeDescriptor ()
+               {
+                       ScriptTypeDescriptor d = new ScriptTypeDescriptor (this);
+
+                       d.AddEvent (new ScriptEventDescriptor ("transform", false));
+
+                       d.AddMethod (new ScriptMethodDescriptor ("evaluateIn", new string[0]));
+                       d.AddMethod (new ScriptMethodDescriptor ("evaluateOut", new string[0]));
+
+                       d.AddProperty (new ScriptPropertyDescriptor ("automatic", ScriptType.Boolean, false, "Automatic"));
+                       d.AddProperty (new ScriptPropertyDescriptor ("dataContext", ScriptType.Object, false, "DataContext"));
+                       d.AddProperty (new ScriptPropertyDescriptor ("dataPath", ScriptType.String, false, "DataPath"));
+                       d.AddProperty (new ScriptPropertyDescriptor ("direction", ScriptType.Enum, false, "Direction"));
+                       d.AddProperty (new ScriptPropertyDescriptor ("id", ScriptType.String, false, "ID"));
+                       d.AddProperty (new ScriptPropertyDescriptor ("property", ScriptType.String, false, "Property"));
+                       d.AddProperty (new ScriptPropertyDescriptor ("propertyKey", ScriptType.String, false, "PropertyKey"));
+                       d.AddProperty (new ScriptPropertyDescriptor ("transformerArgument", ScriptType.String, false, "TransformerArgument"));
+
+                       d.Close ();
+
+                       return d;
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingCollection.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingCollection.cs
new file mode 100644 (file)
index 0000000..3ed85df
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// Microsoft.Web.BindingCollection
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.ObjectModel;
+
+namespace Microsoft.Web
+{
+       public class BindingCollection : Collection<Binding>, IScriptObject
+       {
+               IScriptObject owner;
+               string id;
+               bool readOnly;
+
+               public BindingCollection (IScriptObject owner)
+                       : this (owner, false)
+               {
+               }
+
+               public BindingCollection (IScriptObject owner, bool readOnly)
+               {
+                       this.id = "";
+                       this.owner = owner;
+                       this.readOnly = readOnly;
+               }
+
+               protected void ClearItems ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void InsertItem (int index, Binding item)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void RemoveItem (int index)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void SetItem (int index, Binding item)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IScriptObject.ID {
+                       get { return id; }
+                       set { id = (value == null ? "" : value); }
+               }
+
+               IScriptObject IScriptObject.Owner {
+                       get { return owner; }
+               }
+
+               ScriptTypeDescriptor IScriptObject.GetTypeDescriptor ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingDirection.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingDirection.cs
new file mode 100644 (file)
index 0000000..5505741
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Microsoft.Web.BindingDirection
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+       public enum BindingDirection
+       {
+               In,
+               Out,
+               InOut
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IDConverter.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IDConverter.cs
new file mode 100644 (file)
index 0000000..84a3654
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// Microsoft.Web.IDConverter
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+
+namespace Microsoft.Web
+{
+       public class IDConverter : StringConverter
+       {
+
+               protected IDConverter ()
+               {
+               }
+
+               protected IScriptObject GetScriptObject (object instance)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptComponent.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptComponent.cs
new file mode 100644 (file)
index 0000000..b267927
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Microsoft.Web.IScriptComponent
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+
+       public interface IScriptComponent : IScriptObject
+       {
+               void RenderScript (ScriptTextWriter writer);
+       }
+
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptObject.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptObject.cs
new file mode 100644 (file)
index 0000000..e663061
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// Microsoft.Web.IScriptObject
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+
+       public interface IScriptObject
+       {
+               ScriptTypeDescriptor GetTypeDescriptor ();
+               string ID { get; set; }
+               IScriptObject Owner { get; }
+       }
+
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/InvokeMethodAction.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/InvokeMethodAction.cs
new file mode 100644 (file)
index 0000000..a462811
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// Microsoft.Web.InvokeMethodAction
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public sealed class InvokeMethodAction : Action
+       {
+               public InvokeMethodAction ()
+               {
+               }
+
+               string method = "";
+               public string Method {
+                       get {
+                               return method;
+                       }
+                       set {
+                               method = (value == null ? "" : value);
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "invokeMethod";
+                       }
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       if (Method != "")
+                               writer.WriteAttributeString ("method", Method);
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("method", ScriptType.String, false, "Method"));
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponent.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponent.cs
new file mode 100644 (file)
index 0000000..6b29d00
--- /dev/null
@@ -0,0 +1,138 @@
+//
+// Microsoft.Web.ScriptComponent
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Web.UI;
+
+namespace Microsoft.Web
+{
+
+       public abstract class ScriptComponent :  Control, IScriptComponent, IScriptObject
+       {
+               protected ScriptComponent ()
+               {
+               }
+
+               protected virtual void AddAttributesToElement (ScriptTextWriter writer)
+               {
+               }
+
+               ScriptTypeDescriptor IScriptObject.GetTypeDescriptor ()
+               {
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor(this);
+                       InitializeTypeDescriptor (td);
+                       td.Close();
+                       return td;
+               }
+
+               protected virtual void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+               }
+
+               public ScriptTypeDescriptor GetTypeDescriptor ()
+               {
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor(this);
+                       InitializeTypeDescriptor (td);
+                       td.Close();
+                       return td;
+               }
+
+               protected override void OnInit (EventArgs e)
+               {
+                       base.OnInit (e);
+               }
+
+               void IScriptComponent.RenderScript (ScriptTextWriter writer)
+               {
+                       RenderScriptBeginTag (writer);
+                       AddAttributesToElement (writer);
+                       RenderScriptTagContents (writer);
+                       RenderScriptEndTag (writer);
+               }
+
+               protected virtual void RenderScriptBeginTag (ScriptTextWriter writer)
+               {
+                       writer.WriteStartElement (TagName);
+               }
+
+               protected virtual void RenderScriptEndTag (ScriptTextWriter writer)
+               {
+                       writer.WriteEndElement ();
+               }
+
+               protected virtual void RenderScriptTagContents (ScriptTextWriter writer)
+               {
+               }
+
+               public BindingCollection Bindings {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+#if notyet
+               public IScriptComponentContainer Container {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+#endif
+
+               public ScriptEvent PropertyChanged {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public ScriptEventCollection ScriptEvents {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public Microsoft.Web.UI.ScriptManager ScriptManager {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public abstract string TagName { get; }
+
+               IScriptObject IScriptObject.Owner {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentBase.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentBase.cs
new file mode 100644 (file)
index 0000000..d605f83
--- /dev/null
@@ -0,0 +1,152 @@
+//
+// Microsoft.Web.ScriptComponentBase
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Web
+{
+
+       public abstract class ScriptComponentBase: IScriptComponent, IScriptObject
+       {
+               IScriptObject owner;
+               BindingCollection bindings;
+               ScriptEventCollection scriptEvents;
+
+               protected ScriptComponentBase ()
+               {
+               }
+
+               public BindingCollection Bindings {
+                       get {
+                               if (bindings == null)
+                                       bindings = new BindingCollection (this);
+                               return bindings;
+                       }
+               }
+
+               string id = "";
+               public string ID {
+                       get {
+                               return id;
+                       }
+                       set {
+                               id = (value == null ? "" : value);
+                       }
+               }
+
+               protected IScriptObject Owner {
+                       get {
+                               return owner;
+                       }
+               }
+
+               ScriptEvent propertyChanged = null;
+               public ScriptEvent PropertyChanged {
+                       get {
+                               if (propertyChanged == null)
+                                       propertyChanged = new ScriptEvent (this, "propertyChanged", true);
+                               return propertyChanged;
+                       }
+               }
+
+               protected ScriptEventCollection ScriptEvents {
+                       get {
+                               if (scriptEvents == null) {
+                                       scriptEvents = new ScriptEventCollection (this);
+                                       scriptEvents.Add (PropertyChanged);
+                               }
+
+                               return scriptEvents;
+                       }
+               }
+
+               public abstract string TagName { get; }
+
+               protected virtual void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       if (ID != "")
+                               writer.WriteAttributeString ("id", id);
+               }
+
+               ScriptTypeDescriptor IScriptObject.GetTypeDescriptor ()
+               {
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor(this);
+                       InitializeTypeDescriptor (td);
+                       td.Close();
+                       return td;
+               }
+
+               protected virtual void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       foreach (ScriptEvent ev in ((IEnumerable<ScriptEvent>)ScriptEvents))
+                               typeDescriptor.AddEvent (new ScriptEventDescriptor (ev.Name, ev.SupportsActions));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("bindings", ScriptType.Array, true, "Bindings"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("dataContext", ScriptType.Object));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("id", ScriptType.String, "ID"));
+               }
+
+               void IScriptComponent.RenderScript (ScriptTextWriter writer)
+               {
+                       RenderScriptBeginTag (writer);
+                       AddAttributesToElement (writer);
+                       RenderScriptTagContents (writer);
+                       RenderScriptEndTag (writer);
+               }
+
+               protected virtual void RenderScriptBeginTag (ScriptTextWriter writer)
+               {
+                       writer.WriteStartElement (TagName);
+               }
+
+               protected virtual void RenderScriptEndTag (ScriptTextWriter writer)
+               {
+                       writer.WriteEndElement ();
+               }
+
+               protected virtual void RenderScriptTagContents (ScriptTextWriter writer)
+               {
+               }
+
+               public void SetOwner (IScriptObject owner)
+               {
+                       this.owner = owner;
+               }
+
+               IScriptObject IScriptObject.Owner {
+                       get {
+                               return Owner;
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptControl.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptControl.cs
new file mode 100644 (file)
index 0000000..cfec547
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// Microsoft.Web.ScriptControl
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Web.UI;
+
+namespace Microsoft.Web
+{
+       public abstract class ScriptControl : ScriptComponent
+       {
+               protected ScriptControl ()
+               {
+               }
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+               }
+
+               protected override void RenderScriptTagContents (ScriptTextWriter writer)
+               {
+               }
+
+               public BehaviorCollection Behaviors {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public string CssClass {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public bool Enabled {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public VisibilityMode VisibilityMode {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public new bool Visible {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEvent.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEvent.cs
new file mode 100644 (file)
index 0000000..0828925
--- /dev/null
@@ -0,0 +1,103 @@
+//
+// Microsoft.Web.ScriptEvent
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public class ScriptEvent
+       {
+               IScriptObject owner;
+               string name;
+               bool supportsActions;
+               string handler;
+               ActionCollection actions;
+
+               public ScriptEvent (IScriptObject owner, string name, bool supportsActions)
+               {
+                       if (owner == null)
+                               throw new ArgumentNullException ("owner");
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+
+                       this.owner = owner;
+                       this.name = name;
+                       this.supportsActions = supportsActions;
+                       this.handler = "";
+               }
+
+               public ActionCollection Actions {
+                       get {
+                               if (actions == null)
+                                       actions = new ActionCollection(owner, !supportsActions);
+
+                               return actions;
+                       }
+               }
+
+               public string Handler {
+                       get { return handler; }
+                       set { handler = (value == null ? "" : value); }
+               }
+
+               public string Name {
+                       get { return name; }
+               }
+
+               public bool SupportsActions {
+                       get { return supportsActions; }
+               }
+
+               public void RenderActions (ScriptTextWriter writer)
+               {
+                       if (Actions.Count == 0)
+                               return;
+
+                       writer.WriteStartElement (Name);
+                       writer.WriteWhitespace ("\r\n");
+
+                       foreach (Action a in Actions) {
+                               writer.WriteWhitespace ("  ");
+                               a.RenderAction (writer);
+                               writer.WriteWhitespace ("\r\n");
+                       }
+
+                       writer.WriteEndElement ();
+               }
+
+               public void RenderHandlers (ScriptTextWriter writer)
+               {
+                       writer.WriteAttributeString (Name, Handler);
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEventCollection.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEventCollection.cs
new file mode 100644 (file)
index 0000000..5a10a42
--- /dev/null
@@ -0,0 +1,95 @@
+//
+// Microsoft.Web.ScriptEventCollection
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Microsoft.Web
+{
+       public class ScriptEventCollection : IEnumerable<ScriptEvent>, IEnumerable, ICollection
+       {
+               IScriptObject owner;
+               List<ScriptEvent> events;
+
+               public ScriptEventCollection (IScriptObject owner)
+               {
+                       this.owner = owner;
+                       events = new List<ScriptEvent>();
+               }
+
+               public ScriptEvent this [string eventName, bool supportsActions] {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               internal void Add (ScriptEvent ev)
+               {
+                       events.Add (ev);
+               }
+
+               void ICollection.CopyTo (Array array, int index)
+               {
+                       events.CopyTo ((ScriptEvent[])array, index);
+               }
+
+               int ICollection.Count {
+                       get {
+                               return events.Count;
+                       }
+               }
+
+               bool ICollection.IsSynchronized {
+                       get {
+                               return false;
+                       }
+               }
+
+               object ICollection.SyncRoot {
+                       get {
+                               return null;
+                       }
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return events.GetEnumerator();
+               }
+
+               IEnumerator<ScriptEvent> IEnumerable<ScriptEvent>.GetEnumerator ()
+               {
+                       return events.GetEnumerator();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEventDescriptor.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEventDescriptor.cs
new file mode 100644 (file)
index 0000000..931053c
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// Microsoft.Web.ScriptEventDescriptor
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public sealed class ScriptEventDescriptor : ScriptMemberDescriptor
+       {
+               string eventName;
+               string serverPropertyName;
+               bool supportsActions;
+
+               public ScriptEventDescriptor (string eventName, bool supportsActions)
+                       : this (eventName, supportsActions, null)
+               {
+               }
+
+               public ScriptEventDescriptor (string eventName, bool supportsActions, string serverPropertyName)
+                       : base (eventName)
+               {
+                       this.eventName = eventName;
+                       this.supportsActions = supportsActions;
+                       this.serverPropertyName = (serverPropertyName == null ? "" : serverPropertyName);
+               }
+
+               public string EventName {
+                       get {
+                               return eventName;
+                       }
+               }
+
+               public string ServerPropertyName {
+                       get {
+                               return serverPropertyName;
+                       }
+               }
+
+               public bool SupportsActions {
+                       get {
+                               return supportsActions;
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptMemberDescriptor.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptMemberDescriptor.cs
new file mode 100644 (file)
index 0000000..4ff0a48
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// Microsoft.Web.ScriptMemberDescriptor
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public class ScriptMemberDescriptor
+       {
+               string memberName;
+
+               public ScriptMemberDescriptor (string memberName)
+               {
+                       if (memberName == null)
+                               throw new ArgumentNullException ("memberName");
+                       this.memberName = memberName;
+               }
+
+               public string MemberName {
+                       get {
+                               return memberName;
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptMethodDescriptor.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptMethodDescriptor.cs
new file mode 100644 (file)
index 0000000..4bacfd8
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// Microsoft.Web.ScriptMethodDescriptor
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public class ScriptMethodDescriptor : ScriptMemberDescriptor
+       {
+               string methodName;
+               string[] parameters;
+
+               public ScriptMethodDescriptor (string methodName)
+                       : this (methodName, null)
+               {
+               }
+
+               public ScriptMethodDescriptor (string methodName, string[] parameters)
+                       : base (methodName)
+               {
+                       this.methodName = methodName;
+                       this.parameters = (parameters == null ? new string [0] : parameters);
+               }
+
+               public string MethodName {
+                       get {
+                               return methodName;
+                       }
+               }
+
+               public string[] Parameters {
+                       get {
+                               return parameters;
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptPropertyDescriptor.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptPropertyDescriptor.cs
new file mode 100644 (file)
index 0000000..f836e5b
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// Microsoft.Web.ScriptPropertyDescriptor
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public class ScriptPropertyDescriptor : ScriptMemberDescriptor
+       {
+               string propertyName;
+               ScriptType type;
+               bool readOnly;
+               string serverPropertyName;
+
+               public ScriptPropertyDescriptor (string propertyName, ScriptType type)
+                       : this (propertyName, type, false, null)
+               {
+               }
+
+               public ScriptPropertyDescriptor (string propertyName, ScriptType type, string serverPropertyName)
+                       : this (propertyName, type, false, serverPropertyName)
+               {
+               }
+
+               public ScriptPropertyDescriptor (string propertyName, ScriptType type, bool readOnly)
+                       : this (propertyName, type, readOnly, null)
+               {
+               }
+
+               public ScriptPropertyDescriptor (string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+                       : base (propertyName)
+               {
+                       this.propertyName = propertyName;
+                       this.type = type;
+                       this.readOnly = readOnly;
+                       this.serverPropertyName = (serverPropertyName == null ? "" : serverPropertyName);
+               }
+
+               public string PropertyName {
+                       get {
+                               return propertyName;
+                       }
+               }
+
+               public bool ReadOnly {
+                       get {
+                               return readOnly;
+                       }
+               }
+
+               public string ServerPropertyName {
+                       get {
+                               return serverPropertyName;
+                       }
+               }
+
+               public ScriptType Type {
+                       get {
+                               return type;
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTextWriter.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTextWriter.cs
new file mode 100644 (file)
index 0000000..c7ed600
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// Microsoft.Web.ScriptTextWriter
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Xml;
+using System.IO;
+
+namespace Microsoft.Web
+{
+       public class ScriptTextWriter : XmlTextWriter
+       {
+               public ScriptTextWriter (TextWriter writer)
+                       : base (writer)
+               {
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptType.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptType.cs
new file mode 100644 (file)
index 0000000..0eb55a2
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// Microsoft.Web.ScriptType
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+       public enum ScriptType {
+               Object,
+               Number,
+               String,
+               Date,
+               Array,
+               Boolean,
+               Enum,
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTypeDescriptor.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTypeDescriptor.cs
new file mode 100644 (file)
index 0000000..936dd26
--- /dev/null
@@ -0,0 +1,105 @@
+//
+// Microsoft.Web.ScriptTypeDescriptor
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Web
+{
+       public sealed class ScriptTypeDescriptor
+       {
+               IScriptObject scriptObject;
+               bool closed;
+               List<ScriptEventDescriptor> events;
+               List<ScriptMethodDescriptor> methods;
+               List<ScriptPropertyDescriptor> props;
+
+               public ScriptTypeDescriptor (IScriptObject scriptObject)
+               {
+                       if (scriptObject == null)
+                               throw new ArgumentNullException ("scriptObject");
+
+                       this.scriptObject = scriptObject;
+                       this.events = new List<ScriptEventDescriptor>();
+                       this.methods = new List<ScriptMethodDescriptor>();
+                       this.props = new List<ScriptPropertyDescriptor>();
+               }
+
+               public IScriptObject ScriptObject {
+                       get {
+                               return scriptObject;
+                       }
+               }
+
+               public void AddEvent (ScriptEventDescriptor eventDescriptor)
+               {
+                       if (closed)
+                               throw new InvalidOperationException ("Items cannot be added to a type descriptor that has been closed.");
+                       events.Add (eventDescriptor);
+               }
+
+               public void AddMethod (ScriptMethodDescriptor methodDescriptor)
+               {
+                       if (closed)
+                               throw new InvalidOperationException ("Items cannot be added to a type descriptor that has been closed.");
+                       methods.Add (methodDescriptor);
+               }
+
+               public void AddProperty (ScriptPropertyDescriptor propertyDescriptor)
+               {
+                       if (closed)
+                               throw new InvalidOperationException ("Items cannot be added to a type descriptor that has been closed.");
+                       props.Add (propertyDescriptor);
+               }
+
+               public void Close ()
+               {
+                       closed = true;
+               }
+
+               public IEnumerable<ScriptEventDescriptor> GetEvents ()
+               {
+                       return events;
+               }
+
+               public IEnumerable<ScriptMethodDescriptor> GetMethods()
+               {
+                       return methods;
+               }
+
+               public IEnumerable<ScriptPropertyDescriptor> GetProperties ()
+               {
+                       return props;
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/SetPropertyAction.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/SetPropertyAction.cs
new file mode 100644 (file)
index 0000000..26c87c6
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// Microsoft.Web.SetPropertyAction
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace Microsoft.Web
+{
+       public sealed class SetPropertyAction : Action
+       {
+               public SetPropertyAction ()
+               {
+               }
+
+               string property = "";
+               public string Property {
+                       get {
+                               return property;
+                       }
+                       set {
+                               property = (value == null ? "" : value);
+                       }
+               }
+
+               string propertyKey = "";
+               public string PropertyKey {
+                       get {
+                               return propertyKey;
+                       }
+                       set {
+                               propertyKey = (value == null ? "" : value);
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return "setProperty";
+                       }
+               }
+
+               string value = "";
+               public string Value {
+                       get {
+                               return Value;
+                       }
+                       set {
+                               this.value = (value == null ? "" : value);
+                       }
+               }
+
+
+               protected override void AddAttributesToElement (ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       if (Property != "")
+                               writer.WriteAttributeString ("property", Property);
+
+                       if (PropertyKey != "")
+                               writer.WriteAttributeString ("propertykey", PropertyKey);
+
+                       if (Value != "")
+                               writer.WriteAttributeString ("value", Value);
+               }
+
+               protected override void InitializeTypeDescriptor (ScriptTypeDescriptor typeDescriptor)
+               {
+                       base.InitializeTypeDescriptor (typeDescriptor);
+
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("property", ScriptType.String, false, "Property"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("propertykey", ScriptType.String, false, "PropertyKey"));
+                       typeDescriptor.AddProperty (new ScriptPropertyDescriptor ("value", ScriptType.String, false, "Value"));
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/TransformScriptEvent.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/TransformScriptEvent.cs
new file mode 100644 (file)
index 0000000..e1c6b3d
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// Microsoft.Web.TransformScriptEvent
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+       public class TransformScriptEvent : ScriptEvent
+       {
+               public TransformScriptEvent (IScriptObject owner)
+                       : base (owner, "transform", true)
+               {
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/VisibilityMode.cs b/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/VisibilityMode.cs
new file mode 100644 (file)
index 0000000..67618ef
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// Microsoft.Web.VisibilityMode
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace Microsoft.Web
+{
+       public enum VisibilityMode {
+               Collapse,
+               Hide
+       }
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/ClickBehaviorTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/ClickBehaviorTest.cs
new file mode 100644 (file)
index 0000000..78b4403
--- /dev/null
@@ -0,0 +1,135 @@
+//
+// Tests for Microsoft.Web.UI.ClickBehavior
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class ClickBehaviorTest
+       {
+               [Test]
+               public void Properties ()
+               {
+                       ClickBehavior b = new ClickBehavior ();
+
+                       // default
+                       Assert.AreEqual ("clickBehavior", b.TagName, "A1");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       ClickBehavior c = new ClickBehavior ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       ((IScriptComponent)c).RenderScript (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       ClickBehavior a = new ClickBehavior();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsTrue (ee.MoveNext(), "A4");
+                       DoEvent (ee.Current, "click", true);
+                       Assert.IsFalse (ee.MoveNext(), "A5");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A6");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A7");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsFalse (pe.MoveNext(), "A11");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       ClickBehavior a = new ClickBehavior();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DataSourceDropTargetTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DataSourceDropTargetTest.cs
new file mode 100644 (file)
index 0000000..05a0078
--- /dev/null
@@ -0,0 +1,186 @@
+//
+// Tests for Microsoft.Web.UI.DataSourceDropTarget
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class DataSourceDropTargetTest
+       {
+               class TargetPoker : DataSourceDropTarget {
+                       public void AddAttributes (ScriptTextWriter w)
+                       {
+                               AddAttributesToElement (w);
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       DataSourceDropTarget b = new DataSourceDropTarget ();
+
+                       // default
+                       Assert.AreEqual ("dataSourceDropTarget", b.TagName, "A1");
+                       Assert.AreEqual (null, b.AcceptedDataTypes, "A2");
+                       Assert.AreEqual (true, b.Append, "A3");
+                       Assert.AreEqual ("data", b.Property, "A4");
+                       Assert.AreEqual (null, b.Target, "A5");
+
+                       // getter/setter
+                       b.AcceptedDataTypes = "foo";
+                       Assert.AreEqual ("foo", b.AcceptedDataTypes, "A6");
+                       b.Append = false;
+                       Assert.AreEqual (false, b.Append, "A7");
+                       b.Property = "Property";
+                       Assert.AreEqual ("Property", b.Property, "A8");
+                       b.Target = "Target";
+                       Assert.AreEqual ("Target", b.Target, "A9");
+
+                       // null setter
+                       b.AcceptedDataTypes = null;
+                       Assert.AreEqual (null, b.AcceptedDataTypes, "A10");
+                       b.Property = null;
+                       Assert.AreEqual (null, b.Property, "A11");
+                       b.Target = null;
+                       Assert.AreEqual (null, b.Target, "A12");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       DataSourceDropTarget c = new DataSourceDropTarget ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       ((IScriptComponent)c).RenderScript (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       DataSourceDropTarget a = new DataSourceDropTarget();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A6");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "acceptedDataTypes", ScriptType.Array, false, "AcceptedDataTypes");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "append", ScriptType.Boolean, false, "Append");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "target", ScriptType.String, false, "Target");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "property", ScriptType.String, false, "Property");
+                       Assert.IsFalse (pe.MoveNext(), "A13");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       DataSourceDropTarget a = new DataSourceDropTarget();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))] // this happens with MS anyway.
+               public void Attributes ()
+               {
+                       TargetPoker c = new TargetPoker ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       c.AddAttributes (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DragDropListTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DragDropListTest.cs
new file mode 100644 (file)
index 0000000..9d2d128
--- /dev/null
@@ -0,0 +1,198 @@
+//
+// Tests for Microsoft.Web.UI.DragDropList
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class DragDropListTest
+       {
+               class Poker : DataSourceDropTarget {
+                       public void AddAttributes (ScriptTextWriter w)
+                       {
+                               AddAttributesToElement (w);
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       DragDropList b = new DragDropList ();
+
+                       // default
+                       Assert.AreEqual ("dragDropList", b.TagName, "A1");
+                       Assert.AreEqual (null, b.AcceptedDataTypes, "A2");
+                       Assert.AreEqual (null, b.DataType, "A3");
+                       Assert.AreEqual (RepeatDirection.Vertical, b.Direction, "A4");
+                       Assert.AreEqual (DragMode.Copy, b.DragMode, "A5");
+                       Assert.AreEqual (null, b.FloatContainerCssClass, "A6");
+                       Assert.AreEqual (HtmlTextWriterTag.Div, b.FloatContainerTag, "A7");
+
+                       // getter/setter
+                       b.AcceptedDataTypes = "foo";
+                       Assert.AreEqual ("foo", b.AcceptedDataTypes, "A8");
+                       b.DataType = "DataType";
+                       Assert.AreEqual ("DataType", b.DataType, "A9");
+                       b.Direction = RepeatDirection.Vertical;
+                       Assert.AreEqual (RepeatDirection.Vertical, b.Direction, "A10");
+                       b.FloatContainerCssClass = "cssclass";
+                       Assert.AreEqual ("cssclass", b.FloatContainerCssClass, "A11");
+                       b.FloatContainerTag = HtmlTextWriterTag.Span;
+                       Assert.AreEqual (HtmlTextWriterTag.Span, b.FloatContainerTag, "A12");
+
+                       // null setter
+                       b.AcceptedDataTypes = null;
+                       Assert.AreEqual (null, b.AcceptedDataTypes, "A13");
+                       b.DataType = null;
+                       Assert.AreEqual (null, b.DataType, "A14");
+                       b.FloatContainerCssClass = null;
+                       Assert.AreEqual (null, b.FloatContainerCssClass, "A15");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       DragDropList b = new DragDropList ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       ((IScriptComponent)b).RenderScript (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       DragDropList a = new DragDropList();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A6");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "acceptedDataTypes", ScriptType.Array, false, "AcceptedDataTypes");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "dataType", ScriptType.String, false, "DataType");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "dragMode", ScriptType.Enum, false, "DragMode");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "direction", ScriptType.Enum, false, "Direction");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "dropCueTemplate", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A13");
+                       DoProperty (pe.Current, "emptyTemplate", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A14");
+                       DoProperty (pe.Current, "floatContainerTemplate", ScriptType.Object, false, "");
+                       Assert.IsFalse (pe.MoveNext(), "A15");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       DragDropList a = new DragDropList();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))] // this happens with MS anyway.
+               public void Attributes ()
+               {
+                       Poker c = new Poker ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       c.AddAttributes (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DraggableListItemTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/DraggableListItemTest.cs
new file mode 100644 (file)
index 0000000..e5a1825
--- /dev/null
@@ -0,0 +1,173 @@
+//
+// Tests for Microsoft.Web.UI.DraggableListItem
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class DraggableListItemTest
+       {
+               class Poker : DraggableListItem {
+                       public void AddAttributes (ScriptTextWriter w)
+                       {
+                               AddAttributesToElement (w);
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       DraggableListItem b = new DraggableListItem ();
+
+                       // default
+                       Assert.AreEqual ("draggableListItem", b.TagName, "A1");
+                       Assert.AreEqual (null, b.Handle, "A2");
+
+                       // getter/setter
+                       b.Handle = "foo";
+                       Assert.AreEqual ("foo", b.Handle, "A3");
+
+                       // null setter
+                       b.Handle = null;
+                       Assert.AreEqual (null, b.Handle, "A4");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       DraggableListItem b = new DraggableListItem ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       ((IScriptComponent)b).RenderScript (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       DraggableListItem a = new DraggableListItem ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A6");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "data", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "handle", ScriptType.Object, false, "Handle");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "dragVisualTemplate", ScriptType.Object, false, "");
+                       Assert.IsFalse (pe.MoveNext(), "A12");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       DraggableListItem a = new DraggableListItem ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))] // this happens with MS anyway.
+               public void Attributes ()
+               {
+                       Poker c = new Poker ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       c.AddAttributes (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/FloatingBehaviorTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/FloatingBehaviorTest.cs
new file mode 100644 (file)
index 0000000..94b27a2
--- /dev/null
@@ -0,0 +1,157 @@
+//
+// Tests for Microsoft.Web.UI.FloatingBehavior
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class FloatingBehaviorTest
+       {
+               class Poker : FloatingBehavior {
+                       public void AddAttributes (ScriptTextWriter w)
+                       {
+                               AddAttributesToElement (w);
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       FloatingBehavior b = new FloatingBehavior ();
+
+                       // default
+                       Assert.AreEqual ("floatingBehavior", b.TagName, "A1");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       FloatingBehavior c = new FloatingBehavior ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       ((IScriptComponent)c).RenderScript (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       FloatingBehavior a = new FloatingBehavior();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A6");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "handle", ScriptType.Object, false, "Handle");
+                       Assert.IsFalse (pe.MoveNext(), "A11");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       FloatingBehavior a = new FloatingBehavior();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))] // this happens with MS anyway.
+               public void Attributes ()
+               {
+                       Poker c = new Poker ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       c.AddAttributes (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/HoverBehaviorTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/HoverBehaviorTest.cs
new file mode 100644 (file)
index 0000000..4f07dd1
--- /dev/null
@@ -0,0 +1,177 @@
+//
+// Tests for Microsoft.Web.UI.HoverBehavior
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class HoverBehaviorTest
+       {
+               class Poker : FloatingBehavior {
+                       public void AddAttributes (ScriptTextWriter w)
+                       {
+                               AddAttributesToElement (w);
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       HoverBehavior b = new HoverBehavior ();
+
+                       // default
+                       Assert.AreEqual ("hoverBehavior", b.TagName, "A1");
+                       Assert.AreEqual ("", b.HoverElementID, "A2");
+                       Assert.AreEqual (0, b.UnhoverDelay, "A3");
+
+                       // getter/setter
+                       b.HoverElementID = "hi";
+                       Assert.AreEqual ("hi", b.HoverElementID, "A4");
+                       b.UnhoverDelay = 5;
+                       Assert.AreEqual (5, b.UnhoverDelay, "A5");
+                       // XXX negative delay?
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       HoverBehavior b = new HoverBehavior ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       b.HoverElementID = "hi";
+                       b.UnhoverDelay = 100;
+
+                       ((IScriptComponent)b).RenderScript (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       HoverBehavior a = new HoverBehavior();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "hover", true);
+                       Assert.IsTrue (ee.MoveNext(), "A4");
+                       DoEvent (ee.Current, "unhover", true);
+                       Assert.IsFalse (ee.MoveNext(), "A5");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A6");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A7");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "hoverElement", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "unhoverDelay", ScriptType.Number, false, "UnhoverDelay");
+                       Assert.IsFalse (pe.MoveNext(), "A13");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       HoverBehavior a = new HoverBehavior();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))] // this happens with MS anyway.
+               public void Attributes ()
+               {
+                       Poker c = new Poker ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       c.AddAttributes (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/LabelTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/LabelTest.cs
new file mode 100644 (file)
index 0000000..d160110
--- /dev/null
@@ -0,0 +1,170 @@
+//
+// Tests for Microsoft.Web.UI.Label
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class LabelTest
+       {
+               [Test]
+               public void Properties ()
+               {
+                       Label l = new Label ();
+
+                       // defaults
+                       Assert.AreEqual ("label", l.TagName, "A1");
+                       Assert.AreEqual ("", l.Text, "A2");
+
+                       // get/set
+                       l.Text = "hi";
+                       Assert.AreEqual ("hi", l.Text, "A3");
+
+                       // null set
+                       l.Text = null;
+                       Assert.AreEqual ("", l.Text, "A4");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoMethod (ScriptMethodDescriptor m, string methodName, string[] args)
+               {
+                       Assert.AreEqual (methodName, m.MethodName, methodName + " MethodName");
+                       Assert.AreEqual (methodName, m.MemberName, methodName + " MemberName");
+                       Assert.AreEqual (args.Length, m.Parameters.Length, methodName + " Parameter count");
+                       for (int i = 0; i < args.Length; i ++)
+                               Assert.AreEqual (args[i], m.Parameters[i], methodName + " Parameter " + i.ToString());
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       Label l = new Label();
+                       ScriptTypeDescriptor desc = ((IScriptObject)l).GetTypeDescriptor ();
+
+                       Assert.AreEqual (l, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       string[] args;
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsTrue (me.MoveNext(), "A6");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "addCssClass", args);
+                       Assert.IsTrue (me.MoveNext(), "A7");
+                       DoMethod (me.Current, "focus", new string[0]);
+                       Assert.IsTrue (me.MoveNext(), "A8");
+                       DoMethod (me.Current, "scrollIntoView", new string[0]);
+                       Assert.IsTrue (me.MoveNext(), "A9");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "removeCssClass", args);
+                       Assert.IsTrue (me.MoveNext(), "A10");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "toggleCssClass", args);
+                       Assert.IsFalse (me.MoveNext (), "A10");
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A11");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A13");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A14");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A15");
+                       DoProperty (pe.Current, "associatedElement", ScriptType.Object, true, "");
+                       Assert.IsTrue (pe.MoveNext(), "A16");
+                       DoProperty (pe.Current, "behaviors", ScriptType.Array, true, "Behaviors");
+                       Assert.IsTrue (pe.MoveNext(), "A17");
+                       DoProperty (pe.Current, "cssClass", ScriptType.String, false, "CssClass");
+                       Assert.IsTrue (pe.MoveNext(), "A18");
+                       DoProperty (pe.Current, "enabled", ScriptType.Boolean, false, "Enabled");
+                       Assert.IsTrue (pe.MoveNext(), "A19");
+                       DoProperty (pe.Current, "style", ScriptType.Object, true, "");
+                       Assert.IsTrue (pe.MoveNext(), "A20");
+                       DoProperty (pe.Current, "visible", ScriptType.Boolean, false, "Visible");
+                       Assert.IsTrue (pe.MoveNext(), "A21");
+                       DoProperty (pe.Current, "visibilityMode", ScriptType.Enum, false, "VisibilityMode");
+                       Assert.IsTrue (pe.MoveNext(), "A21");
+                       DoProperty (pe.Current, "text", ScriptType.String, false, "Text");
+                       Assert.IsFalse (pe.MoveNext(), "A22");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       Label l = new Label ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)l).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/ListViewTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/ListViewTest.cs
new file mode 100644 (file)
index 0000000..b4e5aca
--- /dev/null
@@ -0,0 +1,199 @@
+//
+// Tests for Microsoft.Web.UI.ListView
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class ListViewTest
+       {
+               [Test]
+               public void Properties ()
+               {
+                       ListView l = new ListView ();
+
+                       // defaults
+                       Assert.AreEqual ("listView", l.TagName, "A1");
+                       Assert.AreEqual ("", l.AlternatingItemCssClass, "A2");
+                       Assert.AreEqual ("", l.ItemCssClass, "A3");
+                       Assert.AreEqual ("", l.ItemTemplateControlID, "A3");
+                       Assert.AreEqual ("", l.SeparatorTemplateControlID, "A3");
+
+                       // get/set
+                       l.AlternatingItemCssClass = "AlternatingItemCssClass";
+                       Assert.AreEqual ("AlternatingItemCssClass", l.AlternatingItemCssClass, "A4");
+                       l.ItemCssClass = "ItemCssClass";
+                       Assert.AreEqual ("ItemCssClass", l.ItemCssClass, "A5");
+                       l.ItemTemplateControlID = "ItemTemplateControlID";
+                       Assert.AreEqual ("ItemTemplateControlID", l.ItemTemplateControlID, "A6");
+                       l.SeparatorTemplateControlID = "SeparatorTemplateControlID";
+                       Assert.AreEqual ("SeparatorTemplateControlID", l.SeparatorTemplateControlID, "A7");
+
+                       // null set
+                       l.AlternatingItemCssClass = null;
+                       Assert.AreEqual ("", l.AlternatingItemCssClass, "A4");
+                       l.ItemCssClass = null;
+                       Assert.AreEqual ("", l.ItemCssClass, "A5");
+                       l.ItemTemplateControlID = null;
+                       Assert.AreEqual ("", l.ItemTemplateControlID, "A6");
+                       l.SeparatorTemplateControlID = null;
+                       Assert.AreEqual ("", l.SeparatorTemplateControlID, "A7");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoMethod (ScriptMethodDescriptor m, string methodName, string[] args)
+               {
+                       Assert.AreEqual (methodName, m.MethodName, methodName + " MethodName");
+                       Assert.AreEqual (methodName, m.MemberName, methodName + " MemberName");
+                       Assert.AreEqual (args.Length, m.Parameters.Length, methodName + " Parameter count");
+                       for (int i = 0; i < args.Length; i ++)
+                               Assert.AreEqual (args[i], m.Parameters[i], methodName + " Parameter " + i.ToString());
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       ListView l = new ListView();
+                       ScriptTypeDescriptor desc = ((IScriptObject)l).GetTypeDescriptor ();
+
+                       Assert.AreEqual (l, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       string[] args;
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsTrue (me.MoveNext(), "A6");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "addCssClass", args);
+                       Assert.IsTrue (me.MoveNext(), "A7");
+                       DoMethod (me.Current, "focus", new string[0]);
+                       Assert.IsTrue (me.MoveNext(), "A8");
+                       DoMethod (me.Current, "scrollIntoView", new string[0]);
+                       Assert.IsTrue (me.MoveNext(), "A9");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "removeCssClass", args);
+                       Assert.IsTrue (me.MoveNext(), "A10");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "toggleCssClass", args);
+                       Assert.IsFalse (me.MoveNext (), "A10");
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A11");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A13");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A14");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A15");
+                       DoProperty (pe.Current, "associatedElement", ScriptType.Object, true, "");
+                       Assert.IsTrue (pe.MoveNext(), "A16");
+                       DoProperty (pe.Current, "behaviors", ScriptType.Array, true, "Behaviors");
+                       Assert.IsTrue (pe.MoveNext(), "A17");
+                       DoProperty (pe.Current, "cssClass", ScriptType.String, false, "CssClass");
+                       Assert.IsTrue (pe.MoveNext(), "A18");
+                       DoProperty (pe.Current, "enabled", ScriptType.Boolean, false, "Enabled");
+                       Assert.IsTrue (pe.MoveNext(), "A19");
+                       DoProperty (pe.Current, "style", ScriptType.Object, true, "");
+                       Assert.IsTrue (pe.MoveNext(), "A20");
+                       DoProperty (pe.Current, "visible", ScriptType.Boolean, false, "Visible");
+                       Assert.IsTrue (pe.MoveNext(), "A21");
+                       DoProperty (pe.Current, "visibilityMode", ScriptType.Enum, false, "VisibilityMode");
+                       Assert.IsTrue (pe.MoveNext(), "A21");
+                       DoProperty (pe.Current, "alternatingItemCssClass", ScriptType.String, false, "AlternatingItemCssClass");
+                       Assert.IsTrue (pe.MoveNext(), "A22");
+                       DoProperty (pe.Current, "data", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A23");
+                       DoProperty (pe.Current, "length", ScriptType.Number, true, "");
+                       Assert.IsTrue (pe.MoveNext(), "A24");
+                       DoProperty (pe.Current, "layoutTemplate", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A25");
+                       DoProperty (pe.Current, "itemCssClass", ScriptType.String, false, "ItemCssClass");
+                       Assert.IsTrue (pe.MoveNext(), "A26");
+                       DoProperty (pe.Current, "itemTemplateParentElementId", ScriptType.String, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A27");
+                       DoProperty (pe.Current, "separatorTemplate", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A28");
+                       DoProperty (pe.Current, "emptyTemplate", ScriptType.Object, false, "");
+                       Assert.IsFalse (pe.MoveNext(), "A30");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       ListView l = new ListView ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)l).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/OptionTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/OptionTest.cs
new file mode 100644 (file)
index 0000000..b532052
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// Tests for Microsoft.Web.UI.Option
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class OptionTest
+       {
+               [Test]
+               public void Ctor1 ()
+               {
+                       Option o = new Option ();
+
+                       Assert.AreEqual ("", o.Text, "A1");
+                       Assert.AreEqual ("", o.Value, "A2");
+               }
+
+               [Test]
+               public void Ctor2 ()
+               {
+                       Option o = new Option ("Text", "Value");
+
+                       Assert.AreEqual ("Text", o.Text, "A1");
+                       Assert.AreEqual ("Value", o.Value, "A2");
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       Option o = new Option ();
+
+                       // non ctor defaults
+                       Assert.AreEqual ("", o.CssClass, "A1");
+
+                       // get/set
+                       o.Text = "Text";
+                       Assert.AreEqual ("Text", o.Text, "A2");
+                       o.Value = "Value";
+                       Assert.AreEqual ("Value", o.Value, "A3");
+                       o.CssClass = "CssClass";
+                       Assert.AreEqual ("CssClass", o.CssClass, "A4");
+
+                       // null setters
+                       o.Text = null;
+                       Assert.AreEqual ("", o.Text, "A2");
+                       o.Value = null;
+                       Assert.AreEqual ("", o.Value, "A3");
+                       o.CssClass = null;
+                       Assert.AreEqual ("", o.CssClass, "A4");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/PropertyFilterTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/PropertyFilterTest.cs
new file mode 100644 (file)
index 0000000..a8a8aa1
--- /dev/null
@@ -0,0 +1,177 @@
+//
+// Tests for Microsoft.Web.UI.PropertyFilter
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class PropertyFilterTest
+       {
+               class Poker : PropertyFilter {
+                       public void AddAttributes (ScriptTextWriter w)
+                       {
+                               AddAttributesToElement (w);
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       PropertyFilter f = new PropertyFilter ();
+
+                       // default
+                       Assert.AreEqual ("propertyFilter", f.TagName, "A1");
+                       Assert.AreEqual ("", f.Property, "A2");
+                       Assert.AreEqual ("", f.Value, "A3");
+
+                       // getter/setter
+                       f.Property = "Property";
+                       Assert.AreEqual ("Property", f.Property, "A4");
+                       f.Value = "Value";
+                       Assert.AreEqual ("Value", f.Value, "A5");
+
+                       // null setter
+                       f.Property = null;
+                       Assert.AreEqual ("", f.Property, "A6");
+                       f.Value = null;
+                       Assert.AreEqual ("", f.Value, "A7");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       PropertyFilter f = new PropertyFilter ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       f.Property = "Property";
+                       f.Value = "Value";
+
+                       ((IScriptComponent)f).RenderScript (w);
+
+                       Assert.AreEqual ("<propertyFilter property=\"Property\" value=\"Value\" />", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       PropertyFilter f = new PropertyFilter();
+                       ScriptTypeDescriptor desc = ((IScriptObject)f).GetTypeDescriptor ();
+
+                       Assert.AreEqual (f, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A6");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A7");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "property", ScriptType.String, false, "Property");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "value", ScriptType.String, false, "Value");
+                       Assert.IsFalse (pe.MoveNext(), "A13");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       HoverBehavior a = new HoverBehavior();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+
+               [Test]
+               public void Attributes ()
+               {
+                       Poker c = new Poker ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       c.AddAttributes (w);
+
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/TextBoxTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web.UI/TextBoxTest.cs
new file mode 100644 (file)
index 0000000..c1a5a82
--- /dev/null
@@ -0,0 +1,194 @@
+//
+// Tests for Microsoft.Web.UI.TextBox
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+using Microsoft.Web.UI;
+
+namespace MonoTests.Microsoft.Web.UI
+{
+       [TestFixture]
+       public class TextBoxTest
+       {
+               [Test]
+               public void Properties ()
+               {
+                       TextBox t = new TextBox ();
+
+                       // defaults
+                       Assert.AreEqual ("textBox", t.TagName, "A1");
+                       Assert.AreEqual (1000, t.AutoCompletionInterval, "A2");
+                       Assert.AreEqual (3, t.AutoCompletionMinimumPrefixLength, "A3");
+                       Assert.AreEqual (null, t.AutoCompletionServiceMethod, "A4");
+                       Assert.AreEqual (null, t.AutoCompletionServiceUrl, "A5");
+                       Assert.AreEqual (10, t.AutoCompletionSetCount, "A6");
+                       Assert.AreEqual (0, t.Size, "A7");
+                       Assert.AreEqual ("", t.Text, "A8");
+
+                       // get/set
+                       t.AutoCompletionInterval = 5;
+                       Assert.AreEqual (5, t.AutoCompletionInterval, "A9");
+                       t.AutoCompletionMinimumPrefixLength = 50;
+                       Assert.AreEqual (50, t.AutoCompletionMinimumPrefixLength, "A10");
+                       t.AutoCompletionServiceMethod = "foo";
+                       Assert.AreEqual ("foo", t.AutoCompletionServiceMethod, "A11");
+                       t.AutoCompletionServiceUrl = "bar";
+                       Assert.AreEqual ("bar", t.AutoCompletionServiceUrl, "A12");
+                       t.AutoCompletionSetCount = 25;
+                       Assert.AreEqual (25, t.AutoCompletionSetCount, "A13");
+                       t.Size = 50;
+                       Assert.AreEqual (50, t.Size, "A14");
+                       t.Text = "hi";
+                       Assert.AreEqual ("hi", t.Text, "A15");
+
+                       // null set
+                       t.AutoCompletionServiceMethod = null;
+                       Assert.AreEqual (null, t.AutoCompletionServiceMethod, "A16");
+                       t.AutoCompletionServiceUrl = null;
+                       Assert.AreEqual (null, t.AutoCompletionServiceUrl, "A17");
+                       t.Text = null;
+                       Assert.AreEqual ("", t.Text, "A18");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoMethod (ScriptMethodDescriptor m, string methodName, string[] args)
+               {
+                       Assert.AreEqual (methodName, m.MethodName, methodName + " MethodName");
+                       Assert.AreEqual (methodName, m.MemberName, methodName + " MemberName");
+                       Assert.AreEqual (args.Length, m.Parameters.Length, methodName + " Parameter count");
+                       for (int i = 0; i < args.Length; i ++)
+                               Assert.AreEqual (args[i], m.Parameters[i], methodName + " Parameter " + i.ToString());
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       TextBox t = new TextBox();
+                       ScriptTypeDescriptor desc = ((IScriptObject)t).GetTypeDescriptor ();
+
+                       Assert.AreEqual (t, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       string[] args;
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsTrue (me.MoveNext(), "A6");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "addCssClass", args);
+                       Assert.IsTrue (me.MoveNext(), "A7");
+                       DoMethod (me.Current, "focus", new string[0]);
+                       Assert.IsTrue (me.MoveNext(), "A8");
+                       DoMethod (me.Current, "scrollIntoView", new string[0]);
+                       Assert.IsTrue (me.MoveNext(), "A9");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "removeCssClass", args);
+                       Assert.IsTrue (me.MoveNext(), "A10");
+                       args = new string[1];
+                       args[0] = "className";
+                       DoMethod (me.Current, "toggleCssClass", args);
+                       Assert.IsFalse (me.MoveNext (), "A10");
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A11");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A13");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A14");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A15");
+                       DoProperty (pe.Current, "associatedElement", ScriptType.Object, true, "");
+                       Assert.IsTrue (pe.MoveNext(), "A16");
+                       DoProperty (pe.Current, "behaviors", ScriptType.Array, true, "Behaviors");
+                       Assert.IsTrue (pe.MoveNext(), "A17");
+                       DoProperty (pe.Current, "cssClass", ScriptType.String, false, "CssClass");
+                       Assert.IsTrue (pe.MoveNext(), "A18");
+                       DoProperty (pe.Current, "enabled", ScriptType.Boolean, false, "Enabled");
+                       Assert.IsTrue (pe.MoveNext(), "A19");
+                       DoProperty (pe.Current, "style", ScriptType.Object, true, "");
+                       Assert.IsTrue (pe.MoveNext(), "A20");
+                       DoProperty (pe.Current, "visible", ScriptType.Boolean, false, "Visible");
+                       Assert.IsTrue (pe.MoveNext(), "A21");
+                       DoProperty (pe.Current, "visibilityMode", ScriptType.Enum, false, "VisibilityMode");
+                       Assert.IsTrue (pe.MoveNext(), "A21");
+                       DoProperty (pe.Current, "validators", ScriptType.Array, true, "Validators");
+                       Assert.IsTrue (pe.MoveNext(), "A22");
+                       DoProperty (pe.Current, "text", ScriptType.String, false, "Text");
+                       Assert.IsFalse (pe.MoveNext(), "A23");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       TextBox t = new TextBox ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)t).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ActionTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ActionTest.cs
new file mode 100644 (file)
index 0000000..e47cf2d
--- /dev/null
@@ -0,0 +1,251 @@
+//
+// Tests for Microsoft.Web.Action
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class ActionTest
+       {
+               class ScriptTextWriterPoker : ScriptTextWriter {
+                       public ScriptTextWriterPoker (TextWriter w) : base (w) {}
+
+#if SPEW
+                       public override void WriteStartElement (string prefix, string localName, string ns) {
+                               Console.WriteLine ("WriteStartElement ({0}, {1}, {2})", prefix, localName, ns);
+                               Console.WriteLine (Environment.StackTrace);
+                               base.WriteStartElement (prefix, localName, ns);
+                       }
+
+                       public override void WriteEndElement () {
+                               Console.WriteLine ("WriteEndElement");
+                               Console.WriteLine (Environment.StackTrace);
+                               base.WriteEndElement ();
+                       }
+
+                       public override void WriteString (string s) {
+                               Console.WriteLine ("WriteString {0}", s);
+                               base.WriteString (s);
+                       }
+
+                       public override void WriteName (string name) {
+                               Console.WriteLine ("WriteName {0}", name);
+                               base.WriteName (name);
+                       }
+
+                       public override void WriteWhitespace (string ws) {
+                               Console.WriteLine ("WriteWhitespace");
+                               base.WriteWhitespace (ws);
+                       }
+
+                       public override void WriteRaw (string data) {
+                               Console.WriteLine ("ScriptTextWriter.WriteRaw ({0}) {1}", data, Environment.StackTrace);
+                               base.WriteRaw (data);
+                       }
+#endif
+               }
+
+               class ActionPoker : Action {
+                       public StringWriter Writer;
+
+#if SPEW
+                       protected override void AddAttributesToElement (ScriptTextWriter writer) {
+                               Console.WriteLine ("'" + Writer.ToString() + "'");
+                               Console.WriteLine (Environment.StackTrace);
+                               base.AddAttributesToElement (writer);
+                       }
+
+                       protected override void RenderScriptBeginTag (ScriptTextWriter writer) {
+                               Console.WriteLine ("'" + Writer.ToString() + "'");
+                               Console.WriteLine (Environment.StackTrace);
+                               base.RenderScriptBeginTag (writer);
+                       }
+
+                       protected override void RenderScriptEndTag (ScriptTextWriter writer) {
+                               Console.WriteLine ("'" + Writer.ToString() + "'");
+                               Console.WriteLine (Environment.StackTrace);
+                               base.RenderScriptEndTag (writer);
+                       }
+
+                       protected override void RenderScriptTagContents (ScriptTextWriter writer) {
+                               Console.WriteLine ("'" + Writer.ToString() + "'");
+                               Console.WriteLine (Environment.StackTrace);
+                               base.RenderScriptTagContents (writer);
+                       }
+#endif
+
+                       public override string TagName {
+                               get {
+                                       return "poker";
+                               }
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       ActionPoker a = new ActionPoker ();
+
+                       // default
+                       Assert.AreEqual ("", a.Target, "A1");
+                       Assert.AreEqual (ActionSequence.AfterEventHandler, a.Sequence, "A2");
+
+                       // getter/setter
+                       a.Target = "foo";
+                       Assert.AreEqual ("foo", a.Target, "A3");
+
+                       a.Sequence = ActionSequence.BeforeEventHandler;
+                       Assert.AreEqual (ActionSequence.BeforeEventHandler, a.Sequence, "A4");
+
+                       // setting to null
+                       a.Target = null;
+                       Assert.AreEqual ("", a.Target, "A5");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       // test an empty action
+                       sw = new StringWriter();
+                       w = new ScriptTextWriterPoker (sw);
+                       a.Writer = sw;
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<poker />", sw.ToString(), "A1");
+
+                       // test with a target
+                       a.Target = "foo";
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriterPoker (sw);
+                       a.Writer = sw;
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<poker target=\"foo\" />", sw.ToString(), "A2");
+
+                       // test with a target and id
+                       a.ID = "poker_action";
+                       a.Target = "foo";
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriterPoker (sw);
+                       a.Writer = sw;
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<poker id=\"poker_action\" target=\"foo\" />", sw.ToString(), "A3");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext());
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext());
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A3");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A4");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A5");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A6");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "eventArgs", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "result", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "sender", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "sequence", ScriptType.Enum, false, "Sequence");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "target", ScriptType.Object, false, "Target");
+                       Assert.IsFalse (pe.MoveNext(), "A13");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/BindingTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/BindingTest.cs
new file mode 100644 (file)
index 0000000..d1d4721
--- /dev/null
@@ -0,0 +1,247 @@
+//
+// Tests for Microsoft.Web.Binding
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class BindingTest
+       {
+               class ScriptTextWriterPoker : ScriptTextWriter {
+                       public ScriptTextWriterPoker (TextWriter w) : base (w) {}
+
+#if SPEW
+                       public override void WriteStartElement (string prefix, string localName, string ns) {
+                               Console.WriteLine ("WriteStartElement ({0}, {1}, {2})", prefix, localName, ns);
+                               Console.WriteLine (Environment.StackTrace);
+                               base.WriteStartElement (prefix, localName, ns);
+                       }
+
+                       public override void WriteEndElement () {
+                               Console.WriteLine ("WriteEndElement");
+                               Console.WriteLine (Environment.StackTrace);
+                               base.WriteEndElement ();
+                       }
+
+                       public override void WriteString (string s) {
+                               Console.WriteLine ("WriteString {0}", s);
+                               base.WriteString (s);
+                       }
+
+                       public override void WriteName (string name) {
+                               Console.WriteLine ("WriteName {0}", name);
+                               base.WriteName (name);
+                       }
+
+                       public override void WriteWhitespace (string ws) {
+                               Console.WriteLine ("WriteWhitespace");
+                               base.WriteWhitespace (ws);
+                       }
+
+                       public override void WriteRaw (string data) {
+                               Console.WriteLine ("ScriptTextWriter.WriteRaw ({0}) {1}", data, Environment.StackTrace);
+                               base.WriteRaw (data);
+                       }
+#endif
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       Binding b = new Binding ();
+
+                       // default
+                       Assert.AreEqual (true, b.Automatic, "A1");
+                       Assert.AreEqual ("", b.DataContext, "A2");
+                       Assert.AreEqual ("", b.DataPath, "A3");
+                       Assert.AreEqual (BindingDirection.In, b.Direction, "A4");
+                       Assert.AreEqual ("", b.ID, "A5");
+                       Assert.AreEqual ("", b.Property, "A6");
+                       Assert.AreEqual ("", b.PropertyKey, "A7");
+                       Assert.IsNotNull (b.Transform, "A8");
+                       Assert.AreEqual ("", b.TransformerArgument, "A9");
+
+                       // getter/setter
+                       b.Automatic = false;
+                       Assert.AreEqual (false, b.Automatic, "A10");
+                       b.DataContext = "DataContext";
+                       Assert.AreEqual ("DataContext", b.DataContext, "A11");
+                       b.DataPath = "DataPath";
+                       Assert.AreEqual ("DataPath", b.DataPath, "A12");
+                       b.Direction = BindingDirection.InOut;
+                       Assert.AreEqual (BindingDirection.InOut, b.Direction, "A13");
+                       b.ID = "ID";
+                       Assert.AreEqual ("ID", b.ID, "A14");
+                       b.Property = "Property";
+                       Assert.AreEqual ("Property", b.Property, "A15");
+                       b.PropertyKey = "PropertyKey";
+                       Assert.AreEqual ("PropertyKey", b.PropertyKey, "A16");
+                       b.TransformerArgument = "TransformerArgument";
+                       Assert.AreEqual ("TransformerArgument", b.TransformerArgument, "A17");
+
+                       // setting to null
+                       b.DataContext = null;
+                       Assert.AreEqual ("", b.DataContext, "A18");
+                       b.DataPath = null;
+                       Assert.AreEqual ("", b.DataPath, "A19");
+                       b.ID = null;
+                       Assert.AreEqual ("", b.ID, "A20");
+                       b.Property = null;
+                       Assert.AreEqual ("", b.Property, "A21");
+                       b.PropertyKey = null;
+                       Assert.AreEqual ("", b.PropertyKey, "A22");
+                       b.TransformerArgument = null;
+                       Assert.AreEqual ("", b.TransformerArgument, "A23");
+               }
+
+               [Test]
+               public void TransformEvent ()
+               {
+                       Binding b = new Binding ();
+
+                       Assert.AreEqual ("", b.Transform.Handler, "A1");
+                       Assert.AreEqual (0, b.Transform.Actions.Count, "A2");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       Binding b = new Binding();
+                       StringWriter sw = new StringWriter();
+                       ScriptTextWriterPoker w = new ScriptTextWriterPoker (sw);
+
+                       b.Automatic = false;
+                       b.DataContext = "DataContext";
+                       b.DataPath = "DataPath";
+                       b.Direction = BindingDirection.InOut;
+                       b.ID = "ID";
+                       b.Property = "Property";
+                       b.PropertyKey = "PropertyKey";
+                       b.TransformerArgument = "TransformerArgument";
+
+                       b.RenderScript (w);
+
+                       Assert.AreEqual ("<binding automatic=\"False\" dataContext=\"DataContext\" dataPath=\"DataPath\" direction=\"InOut\" id=\"ID\" property=\"Property\" propertyKey=\"PropertyKey\" transformerArgument=\"TransformerArgument\" />", sw.ToString(), "A1");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoMethod (ScriptMethodDescriptor m, string methodName, string[] args)
+               {
+                       Assert.AreEqual (methodName, m.MethodName, methodName + " MethodName");
+                       Assert.AreEqual (methodName, m.MemberName, methodName + " MemberName");
+                       Assert.AreEqual (args.Length, m.Parameters.Length, methodName + " Parameter count");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       Binding b = new Binding ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)b).GetTypeDescriptor ();
+
+                       Assert.AreEqual (b, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext(), "A3");
+                       DoEvent (ee.Current, "transform", false);
+                       Assert.IsFalse (ee.MoveNext(), "A4");
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A5");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsTrue (me.MoveNext (), "A6");
+                       DoMethod (me.Current, "evaluateIn", new string[0]);
+                       Assert.IsTrue (me.MoveNext (), "A6");
+                       DoMethod (me.Current, "evaluateOut", new string[0]);
+                       Assert.IsFalse (me.MoveNext (), "A7");
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A8");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "automatic", ScriptType.Boolean, false, "Automatic");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "DataContext");
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "dataPath", ScriptType.String, false, "DataPath");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "direction", ScriptType.Enum, false, "Direction");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "property", ScriptType.String, false, "Property");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "propertyKey", ScriptType.String, false, "PropertyKey");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "transformerArgument", ScriptType.String, false, "TransformerArgument");
+                       Assert.IsFalse (pe.MoveNext(), "A13");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       Binding b = new Binding ();
+                       ScriptTypeDescriptor desc = ((IScriptObject)b).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/InvokeMethodActionTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/InvokeMethodActionTest.cs
new file mode 100644 (file)
index 0000000..24b4c7e
--- /dev/null
@@ -0,0 +1,173 @@
+//
+// Tests for Microsoft.Web.InvokeMethodAction
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class InvokeMethodActionTest
+       {
+               [Test]
+               public void Properties ()
+               {
+                       InvokeMethodAction a = new InvokeMethodAction ();
+
+                       // default
+                       Assert.AreEqual ("", a.Method, "A1");
+                       Assert.AreEqual ("invokeMethod", a.TagName, "A2");
+
+                       // getter/setter
+                       a.Method = "method";
+                       Assert.AreEqual ("method", a.Method, "A3");
+
+                       // setting to null
+                       a.Method = null;
+                       Assert.AreEqual ("", a.Method, "A4");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       InvokeMethodAction a = new InvokeMethodAction ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       // test an empty action
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<invokeMethod />", sw.ToString(), "A1");
+
+                       // test with a target
+                       a.Method = "method";
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<invokeMethod method=\"method\" />", sw.ToString(), "A2");
+
+                       // test with a target and id
+                       a.ID = "invoke_id";
+                       a.Method = "method";
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<invokeMethod id=\"invoke_id\" method=\"method\" />", sw.ToString(), "A3");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       InvokeMethodAction a = new InvokeMethodAction();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext());
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext());
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A3");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A4");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A5");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A6");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "eventArgs", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "result", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "sender", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "sequence", ScriptType.Enum, false, "Sequence");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "target", ScriptType.Object, false, "Target");
+                       Assert.IsTrue (pe.MoveNext(), "A13");
+                       DoProperty (pe.Current, "method", ScriptType.String, false, "Method");
+                       Assert.IsFalse (pe.MoveNext(), "A14");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       InvokeMethodAction a = new InvokeMethodAction();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptComponentBaseTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptComponentBaseTest.cs
new file mode 100644 (file)
index 0000000..94d79e4
--- /dev/null
@@ -0,0 +1,126 @@
+//
+// Tests for Microsoft.Web.ScriptComponentBase
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class ScriptComponentBaseTest
+       {
+               class ScriptComponentBasePoker : ScriptComponentBase {
+                       
+                       public IScriptObject GetOwner () {
+                               return base.Owner;
+                       }
+
+                       public ScriptEvent GetPropertyChanged () {
+                               return base.PropertyChanged;
+                       }
+
+                       public ScriptEventCollection GetScriptEvents () {
+                               return base.ScriptEvents;
+                       }
+
+                       public override string TagName {
+                               get {
+                                       return "poker";
+                               }
+                       }
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       ScriptComponentBasePoker poker = new ScriptComponentBasePoker ();
+
+                       Assert.AreEqual ("", poker.ID, "A1");
+                       Assert.IsNull (poker.GetOwner(), "A2");
+
+                       BindingCollection bindings = poker.Bindings;
+                       Assert.IsNotNull (bindings, "A3");
+                       DoBindings (poker, bindings);
+
+                       Assert.IsNotNull (poker.GetPropertyChanged(), "A7");
+                       DoPropertyChanged (poker, poker.GetPropertyChanged());
+
+                       Assert.IsNotNull (poker.GetScriptEvents(), "A8");
+                       DoScriptEvents (poker, poker.GetScriptEvents());
+               }
+
+               void DoBindings (IScriptObject owner, BindingCollection bindings)
+               {
+                       Assert.AreEqual (owner, ((IScriptObject)bindings).Owner, "A4");
+                       Assert.AreEqual (0, bindings.Count, "b1");
+                       Assert.AreEqual ("", ((IScriptObject)bindings).ID, "b2");
+               }
+
+               void DoPropertyChanged (IScriptObject owner, ScriptEvent PropertyChanged)
+               {
+                       Assert.AreEqual ("propertyChanged", PropertyChanged.Name, "p1");
+                       Assert.AreEqual (true, PropertyChanged.SupportsActions, "p2");
+                       Assert.AreEqual ("", PropertyChanged.Handler, "p3");
+                       Assert.IsNotNull (PropertyChanged.Actions, "p4");
+
+                       DoActions (owner, PropertyChanged.Actions);
+               }
+
+               void DoActions (IScriptObject owner, ActionCollection Actions)
+               {
+                       Assert.AreEqual (owner, ((IScriptObject)Actions).Owner, "a1");
+                       Assert.AreEqual (0, Actions.Count, "a2");
+               }
+
+               void DoScriptEvents (IScriptObject owner, ScriptEventCollection ScriptEvents)
+               {
+                       Assert.AreEqual (1, ((ICollection)ScriptEvents).Count, "e1");
+                       IEnumerator<ScriptEvent> e = ((IEnumerable<ScriptEvent>)ScriptEvents).GetEnumerator();
+
+                       e.MoveNext();
+
+                       ScriptEvent ev = e.Current;
+
+                       Assert.AreEqual ("propertyChanged", ev.Name, "p1");
+                       Assert.AreEqual (true, ev.SupportsActions, "p2");
+                       Assert.AreEqual ("", ev.Handler, "p3");
+                       Assert.IsNotNull (ev.Actions, "p4");
+
+                       DoActions (owner, ev.Actions);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptEventDescriptorTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptEventDescriptorTest.cs
new file mode 100644 (file)
index 0000000..efd76f2
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// Tests for Microsoft.Web.ScriptEventDescriptor
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class ScriptEventDescriptorTest
+       {
+               [Test]
+               public void ctor1 ()
+               {
+                       ScriptEventDescriptor sd = new ScriptEventDescriptor ("eventName", true);
+                       Assert.AreEqual ("eventName", sd.EventName, "A1");
+                       Assert.AreEqual ("eventName", sd.MemberName, "A2");
+                       Assert.AreEqual (true, sd.SupportsActions, "A3");
+                       Assert.AreEqual ("", sd.ServerPropertyName, "A4");
+               }
+
+               [Test]
+               public void ctor2 ()
+               {
+                       ScriptEventDescriptor sd = new ScriptEventDescriptor ("eventName", true, "serverPropertyName");
+                       Assert.AreEqual ("eventName", sd.EventName, "A1");
+                       Assert.AreEqual ("eventName", sd.MemberName, "A2");
+                       Assert.AreEqual (true, sd.SupportsActions, "A3");
+                       Assert.AreEqual ("serverPropertyName", sd.ServerPropertyName, "A4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void nulltest1 ()
+               {
+                       ScriptEventDescriptor sd = new ScriptEventDescriptor (null, true);
+               }
+
+               [Test]
+               public void nulltest2 ()
+               {
+                       ScriptEventDescriptor sd = new ScriptEventDescriptor ("eventName", true, null);
+
+                       Assert.AreEqual ("", sd.ServerPropertyName, "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptEventTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptEventTest.cs
new file mode 100644 (file)
index 0000000..ff02685
--- /dev/null
@@ -0,0 +1,163 @@
+//
+// Tests for Microsoft.Web.ScriptEvent
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class ScriptEventTest
+       {
+               class ActionPoker : Action {
+                       public override string TagName {
+                               get {
+                                       return "poker";
+                               }
+                       }
+               }
+
+               [Test]
+               public void Ctor ()
+               {
+                       ActionPoker a = new ActionPoker();
+                       ScriptEvent e = new ScriptEvent (a, "HelloEvent", true);
+
+                       Assert.AreEqual ("HelloEvent", e.Name, "A1");
+                       Assert.IsTrue (e.SupportsActions, "A2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void Null_Ctor1 ()
+               {
+                       ScriptEvent e = new ScriptEvent (null, "HelloEvent", true);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void Null_Ctor2 ()
+               {
+                       ActionPoker a = new ActionPoker();
+                       ScriptEvent e = new ScriptEvent (a, null, true);
+               }
+
+               [Test]
+               public void Properties ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       ScriptEvent e = new ScriptEvent (a, "HelloEvent", true);
+
+                       // defaults not specified in the ctor
+                       Assert.AreEqual ("", e.Handler, "A1");
+
+                       // getter/setter
+                       e.Handler = "foo";
+                       Assert.AreEqual ("foo", e.Handler, "A2");
+
+                       // setting to null
+                       e.Handler = null;
+                       Assert.AreEqual ("", e.Handler, "A5");
+               }
+               
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void No_SupportsActions ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       ScriptEvent e = new ScriptEvent (a, "HelloEvent", false);
+
+                       Assert.IsNotNull (e.Actions, "A1");
+                       e.Actions.Add (new ActionPoker ());
+               }
+
+               [Test]
+               public void SupportsActions ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       ScriptEvent e = new ScriptEvent (a, "HelloEvent", true);
+
+                       Assert.IsNotNull (e.Actions, "A1");
+                       e.Actions.Add (new ActionPoker ());
+                       Assert.AreEqual (1, e.Actions.Count, "A2");
+               }
+
+               [Test]
+               public void RenderActions ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       ScriptEvent e = new ScriptEvent (a, "HelloEvent", true);
+
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       // test an empty event
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       e.RenderActions (w);
+                       Assert.AreEqual ("", sw.ToString(), "A1");
+
+                       // now add an action and see what happens
+                       ActionPoker action = new ActionPoker ();
+                       action.ID = "action_id";
+                       action.Target = "action_target";
+
+                       e.Actions.Add (action);
+
+                       e.RenderActions (w);
+                       Assert.AreEqual ("<HelloEvent>\r\n  <poker id=\"action_id\" target=\"action_target\" />\r\n</HelloEvent>", sw.ToString(), "A2");
+               }
+
+               [Test]
+               public void RenderHandlers ()
+               {
+                       ActionPoker a = new ActionPoker ();
+                       ScriptEvent e = new ScriptEvent (a, "HelloEvent", true);
+
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+
+                       e.Handler = "hi there";
+
+                       e.RenderHandlers (w);
+                       Assert.AreEqual ("HelloEvent=\"hi there\"", sw.ToString(), "A1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptMethodDescriptorTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptMethodDescriptorTest.cs
new file mode 100644 (file)
index 0000000..95a6623
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// Tests for Microsoft.Web.ScriptMethodDescriptor
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class ScriptMethodDescriptorTest
+       {
+               [Test]
+               public void ctor1 ()
+               {
+                       ScriptMethodDescriptor sd = new ScriptMethodDescriptor ("methodName");
+                       Assert.AreEqual ("methodName", sd.MethodName, "A1");
+                       Assert.AreEqual ("methodName", sd.MemberName, "A2");
+                       Assert.IsNotNull (sd.Parameters, "A3");
+                       Assert.AreEqual (0, sd.Parameters.Length, "A4");
+               }
+
+               [Test]
+               public void ctor2 ()
+               {
+                       string[] args = new string[2];
+                       args[0] = "arg1";
+                       args[1] = "arg2";
+
+                       ScriptMethodDescriptor sd = new ScriptMethodDescriptor ("methodName", args);
+                       Assert.AreEqual ("methodName", sd.MethodName, "A1");
+                       Assert.AreEqual ("methodName", sd.MemberName, "A2");
+                       Assert.IsNotNull (sd.Parameters, "A3");
+                       Assert.AreEqual (2, sd.Parameters.Length, "A4");
+                       Assert.AreEqual ("arg1", sd.Parameters[0], "A5");
+                       Assert.AreEqual ("arg2", sd.Parameters[1], "A6");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void nulltest1 ()
+               {
+                       ScriptMethodDescriptor sd = new ScriptMethodDescriptor (null);
+               }
+
+               [Test]
+               public void nulltest2 ()
+               {
+                       ScriptMethodDescriptor sd = new ScriptMethodDescriptor ("methodName", null);
+
+                       Assert.IsNotNull (sd.Parameters, "A1");
+                       Assert.AreEqual (0, sd.Parameters.Length, "A2");
+               }
+
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptPropertyDescriptorTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptPropertyDescriptorTest.cs
new file mode 100644 (file)
index 0000000..9bc8ae4
--- /dev/null
@@ -0,0 +1,105 @@
+//
+// Tests for Microsoft.Web.ScriptPropertyDescriptor
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class ScriptPropertyDescriptorTest
+       {
+               [Test]
+               public void ctor1 ()
+               {
+                       ScriptPropertyDescriptor sd = new ScriptPropertyDescriptor ("propertyName", ScriptType.Object);
+                       Assert.AreEqual ("propertyName", sd.PropertyName, "A1");
+                       Assert.AreEqual ("propertyName", sd.MemberName, "A2");
+                       Assert.AreEqual (ScriptType.Object, sd.Type, "A3");
+                       Assert.IsFalse (sd.ReadOnly, "A4");
+                       Assert.AreEqual ("", sd.ServerPropertyName, "A5");
+               }
+
+               [Test]
+               public void ctor2 ()
+               {
+                       ScriptPropertyDescriptor sd = new ScriptPropertyDescriptor ("propertyName", ScriptType.Object, "serverPropertyName");
+                       Assert.AreEqual ("propertyName", sd.PropertyName, "A1");
+                       Assert.AreEqual ("propertyName", sd.MemberName, "A2");
+                       Assert.AreEqual (ScriptType.Object, sd.Type, "A3");
+                       Assert.IsFalse (sd.ReadOnly, "A4");
+                       Assert.AreEqual ("serverPropertyName", sd.ServerPropertyName, "A5");
+               }
+
+               [Test]
+               public void ctor3 ()
+               {
+                       ScriptPropertyDescriptor sd = new ScriptPropertyDescriptor ("propertyName", ScriptType.Object, true);
+                       Assert.AreEqual ("propertyName", sd.PropertyName, "A1");
+                       Assert.AreEqual ("propertyName", sd.MemberName, "A2");
+                       Assert.AreEqual (ScriptType.Object, sd.Type, "A3");
+                       Assert.IsTrue (sd.ReadOnly, "A4");
+                       Assert.AreEqual ("", sd.ServerPropertyName, "A5");
+               }
+
+               [Test]
+               public void ctor4 ()
+               {
+                       ScriptPropertyDescriptor sd = new ScriptPropertyDescriptor ("propertyName", ScriptType.Object, true, "serverPropertyName");
+                       Assert.AreEqual ("propertyName", sd.PropertyName, "A1");
+                       Assert.AreEqual ("propertyName", sd.MemberName, "A2");
+                       Assert.AreEqual (ScriptType.Object, sd.Type, "A3");
+                       Assert.IsTrue (sd.ReadOnly, "A4");
+                       Assert.AreEqual ("serverPropertyName", sd.ServerPropertyName, "A5");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void nulltest1 ()
+               {
+                       ScriptPropertyDescriptor sd = new ScriptPropertyDescriptor (null, ScriptType.Object);
+               }
+
+               [Test]
+               public void nulltest2 ()
+               {
+                       ScriptPropertyDescriptor sd = new ScriptPropertyDescriptor ("propertyName", ScriptType.Object, null);
+
+                       Assert.AreEqual ("", sd.ServerPropertyName, "A1");
+               }
+
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptTypeDescriptorTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/ScriptTypeDescriptorTest.cs
new file mode 100644 (file)
index 0000000..7d4bc8d
--- /dev/null
@@ -0,0 +1,109 @@
+//
+// Tests for Microsoft.Web.ScriptTypeDescriptor
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class ScriptTypeDescriptorTest
+       {
+               class ActionPoker : Action {
+                       public override string TagName {
+                               get {
+                                       return "poker";
+                               }
+                       }
+               }
+
+               [Test]
+               public void ScriptObject() {
+                       ActionPoker a = new ActionPoker();
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor (a);
+                       Assert.AreEqual (a, td.ScriptObject, "A1");
+               }
+
+               [Test]
+               [ExpectedException (typeof(ArgumentNullException))]
+               public void NullScriptObject() {
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor (null);
+                       Assert.AreEqual (null, td.ScriptObject, "A1");
+               }
+
+               [Test]
+               public void EmptyLists () {
+                       ActionPoker a = new ActionPoker();
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor (a);
+
+                       IEnumerable<ScriptEventDescriptor> events;
+                       IEnumerable<ScriptMethodDescriptor> methods;
+                       IEnumerable<ScriptPropertyDescriptor> props;
+
+                       events = td.GetEvents();
+                       Assert.IsNotNull (events, "A1");
+                       Assert.IsFalse (events.GetEnumerator().MoveNext(), "A2");
+
+                       methods = td.GetMethods();
+                       Assert.IsNotNull (methods, "A3");
+                       Assert.IsFalse (methods.GetEnumerator().MoveNext(), "A4");
+
+                       props = td.GetProperties();
+                       Assert.IsNotNull (props, "A5");
+                       Assert.IsFalse (props.GetEnumerator().MoveNext(), "A6");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void AddAfterClose () {
+                       ActionPoker a = new ActionPoker();
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor (a);
+
+                       td.Close ();
+
+                       td.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+
+               [Test]
+               public void CloseAfterClose () {
+                       ActionPoker a = new ActionPoker();
+                       ScriptTypeDescriptor td = new ScriptTypeDescriptor (a);
+
+                       td.Close ();
+                       td.Close ();
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/SetPropertyActionTest.cs b/mcs/class/Microsoft.Web.Atlas/Test/Microsoft.Web/SetPropertyActionTest.cs
new file mode 100644 (file)
index 0000000..eecddbe
--- /dev/null
@@ -0,0 +1,197 @@
+#if false
+//
+// Tests for Microsoft.Web.SetPropertyAction
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.Web;
+
+namespace MonoTests.Microsoft.Web
+{
+       [TestFixture]
+       public class SetPropertyActionTest
+       {
+               [Test]
+               public void Properties ()
+               {
+                       SetPropertyAction a = new SetPropertyAction ();
+
+                       // default
+                       Assert.AreEqual ("", a.Property, "A1");
+                       Assert.AreEqual ("", a.PropertyKey, "A2");
+                       Assert.AreEqual ("", a.Value, "A3");
+                       Assert.AreEqual ("setProperty", a.TagName, "A4");
+
+                       // getter/setter
+                       a.Property = "property";
+                       Assert.AreEqual ("property", a.Property, "A5");
+
+                       a.PropertyKey = "propertykey";
+                       Assert.AreEqual ("propertykey", a.PropertyKey, "A6");
+
+                       a.Value = "value";
+                       Assert.AreEqual ("value", a.Value, "A7");
+
+                       // setting to null
+                       a.Property = null;
+                       Assert.AreEqual ("", a.Property, "A8");
+                       a.PropertyKey = null;
+                       Assert.AreEqual ("", a.PropertyKey, "A9");
+                       a.Value = null;
+                       Assert.AreEqual ("", a.Value, "A10");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       SetPropertyAction a = new SetPropertyAction ();
+                       StringWriter sw;
+                       ScriptTextWriter w;
+
+                       // test an empty action
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<setProperty />", sw.ToString(), "A1");
+
+                       // test with a property
+                       a.Target = "target";
+                       a.Property = "property";
+                       a.PropertyKey = "propertyKey";
+                       a.Value = "value";
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<setProperty target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A2");
+
+                       // test with a target and id
+                       a.ID = "set_id";
+                       a.Target = "target";
+                       a.Property = "property";
+                       a.PropertyKey = "propertyKey";
+                       a.Value = "value";
+
+                       sw = new StringWriter();
+                       w = new ScriptTextWriter (sw);
+                       a.RenderAction (w);
+
+                       Assert.AreEqual ("<setProperty id=\"set_id\" target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A3");
+               }
+
+               void DoEvent (ScriptEventDescriptor e, string eventName, bool supportsActions)
+               {
+                       Assert.AreEqual (eventName, e.EventName, eventName + " EventName");
+                       Assert.AreEqual (eventName, e.MemberName, eventName + " MemberName");
+                       Assert.AreEqual (supportsActions, e.SupportsActions, eventName + " SupportsActions");
+               }
+
+               void DoProperty (ScriptPropertyDescriptor p, string propertyName, ScriptType type, bool readOnly, string serverPropertyName)
+               {
+                       Assert.AreEqual (propertyName, p.PropertyName, propertyName + " PropertyName");
+                       Assert.AreEqual (propertyName, p.MemberName, propertyName + " MemberName");
+                       Assert.AreEqual (serverPropertyName, p.ServerPropertyName, propertyName + " ServerPropertyName");
+                       Assert.AreEqual (readOnly, p.ReadOnly, propertyName + " ReadOnly");
+                       Assert.AreEqual (type, p.Type, propertyName + " Type");
+               }
+
+               [Test]
+               public void TypeDescriptor ()
+               {
+                       SetPropertyAction a = new SetPropertyAction();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       Assert.AreEqual (a, desc.ScriptObject, "A1");
+
+                       // events
+                       IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
+                       Assert.IsNotNull (events, "A2");
+
+                       IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
+                       Assert.IsTrue (ee.MoveNext());
+                       DoEvent (ee.Current, "propertyChanged", true);
+                       Assert.IsFalse (ee.MoveNext());
+
+                       // methods
+                       IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
+                       Assert.IsNotNull (methods, "A3");
+
+                       IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
+                       Assert.IsFalse (me.MoveNext ());
+
+                       // properties
+                       IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
+                       Assert.IsNotNull (props, "A4");
+
+                       IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
+                       Assert.IsTrue (pe.MoveNext(), "A5");
+                       DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
+                       Assert.IsTrue (pe.MoveNext(), "A6");
+                       DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A7");
+                       DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
+                       Assert.IsTrue (pe.MoveNext(), "A8");
+                       DoProperty (pe.Current, "eventArgs", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A9");
+                       DoProperty (pe.Current, "result", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A10");
+                       DoProperty (pe.Current, "sender", ScriptType.Object, false, "");
+                       Assert.IsTrue (pe.MoveNext(), "A11");
+                       DoProperty (pe.Current, "sequence", ScriptType.Enum, false, "Sequence");
+                       Assert.IsTrue (pe.MoveNext(), "A12");
+                       DoProperty (pe.Current, "target", ScriptType.Object, false, "Target");
+                       Assert.IsTrue (pe.MoveNext(), "A13");
+                       DoProperty (pe.Current, "property", ScriptType.String, false, "Property");
+                       Assert.IsTrue (pe.MoveNext(), "A14");
+                       DoProperty (pe.Current, "propertyKey", ScriptType.String, false, "PropertyKey");
+                       Assert.IsTrue (pe.MoveNext(), "A15");
+                       DoProperty (pe.Current, "value", ScriptType.String, false, "Value");
+                       Assert.IsFalse (pe.MoveNext(), "A16");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void IsTypeDescriptorClosed ()
+               {
+                       SetPropertyAction a = new SetPropertyAction();
+                       ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();
+
+                       desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
+               }
+       }
+}
+#endif
+#endif
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/standalone/HelloWorld/HelloWorld.aspx b/mcs/class/Microsoft.Web.Atlas/Test/standalone/HelloWorld/HelloWorld.aspx
new file mode 100644 (file)
index 0000000..1a14c65
--- /dev/null
@@ -0,0 +1,26 @@
+<%@ Page Language="C#" %>
+
+<html>
+<head>
+<script type="text/javascript" src="../../ScriptLibrary/AtlasCore.js"></script>
+<script type="text/javascript" src="/HelloWorld/HelloWorldService.asmx/js"></script>
+
+<script type="text/javascript">
+function onMethodComplete (result)
+{
+  document.getElementById ('label').innerHTML = result;
+}
+
+function button_click ()
+{
+   Samples.AspNet.HelloWorldService.HelloWorld ("hi there", onMethodComplete);
+}
+</script>
+
+</head>
+
+<body>
+  <span id='label'>foo</span>
+  <button id='button' onclick='button_click()'>click me</button>
+</body>
+</html>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/standalone/HelloWorld/HelloWorldService.asmx b/mcs/class/Microsoft.Web.Atlas/Test/standalone/HelloWorld/HelloWorldService.asmx
new file mode 100644 (file)
index 0000000..54a93e5
--- /dev/null
@@ -0,0 +1,27 @@
+<%@ WebService Language="C#" Class="Samples.AspNet.HelloWorldService" %>
+
+using System;
+using System.Web;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+
+namespace Samples.AspNet {
+       [WebService (Namespace = "http://tempuri.org/")]
+//     [WebServiceBinding (ConformsTo = WsiProfiles.BasicProfile1_1)]
+       public class HelloWorldService : System.Web.Services.WebService
+       {
+               [WebMethod]
+               public string HelloWorld (string query)
+               {
+                       string inputString = Server.HtmlEncode (query);
+                       if (!string.IsNullOrEmpty (inputString))
+                       {
+                               return String.Format ("Hello, you queried for {0}.  The current time " +
+                                                     "is {1}", query, DateTime.Now);
+                       }
+                       else {
+                               return "The query string was null or empty";
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/standalone/script_samples/inheritance.html b/mcs/class/Microsoft.Web.Atlas/Test/standalone/script_samples/inheritance.html
new file mode 100644 (file)
index 0000000..32e08d8
--- /dev/null
@@ -0,0 +1,69 @@
+<!-- adapted from the inheritance example at: http://atlas.asp.net/quickstart/atlas/doc/javascript/default.aspx -->
+<html>
+<head>
+<script type="text/javascript" src="../../ScriptLibrary/AtlasCore.js"></script>
+<script type="text/javascript">
+Type.registerNamespace("Demo");
+
+Demo.Person = function(firstName, lastName, emailAddress) {
+    var _firstName = firstName;
+    var _lastName = lastName;
+    var _emailAddress = emailAddress;
+    
+    this.getFirstName = function() {
+        return _firstName;
+    }
+
+    this.getLastName = function() {
+        return _LastName;
+    }
+
+    this.getName = function() {
+        return _firstName + " " + _lastName;
+    }
+
+    this.getEmailAddress = function() {
+        return _emailAddress;
+    }
+
+    this.dispose = function() {
+        alert('bye ' + this.getName());
+    }
+}
+Type.registerClass('Demo.Person', null, Web.IDisposable);
+
+Demo.Person.prototype.toString = function() {
+    return this.getName() + ' (' + this.getEmailAddress() + ')';
+}
+
+Demo.Employee = function(firstName, lastName, emailAddress, team, title) {
+    Demo.Employee.initializeBase(this, [firstName, lastName, emailAddress]);
+    
+    var _team = team;
+    var _title = title;
+    
+    this.getTeam = function() {
+        return _team;
+    }
+    this.setTeam = function(team) {
+        _team = team;
+    }
+    this.getTitle = function() {
+        return _title;
+    }
+}
+Type.registerClass('Demo.Employee', Demo.Person);
+
+Demo.Employee.prototype.toString = function() {
+    return Demo.Employee.callBaseMethod(this, 'toString') + '\r\n' + this.getTitle() + '\r\n' + this.getTeam();
+}
+
+var Frank = new Demo.Person ("Frank", "Smith", "franksmith@yoyodyne.com");
+alert (Frank.toString());
+
+var Molly = new Demo.Employee ("Molly", "Hatchett", "molly@whoknew.com", "Marketing", "Vice President");
+alert (Molly.toString());
+
+</script>
+</head>
+</html>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Web.Atlas/Test/standalone/script_samples/interfaces.html b/mcs/class/Microsoft.Web.Atlas/Test/standalone/script_samples/interfaces.html
new file mode 100644 (file)
index 0000000..3fd2e4a
--- /dev/null
@@ -0,0 +1,101 @@
+<!-- adapted from the inheritance example at: http://atlas.asp.net/quickstart/atlas/doc/javascript/default.aspx -->
+<html>
+<head>
+<script type="text/javascript" src="../ScriptLibrary/AtlasCore.js"></script>
+<script type="text/javascript">
+
+Type.registerNamespace("Demo.Animals");
+
+Demo.Animals.IPet = function() {
+    this.getFriendlyName = Function.abstractMethod;
+}
+Type.registerInterface('Demo.Animals.IPet');
+
+
+Demo.Animals.Animal = function(name) {
+    var _name = name;
+    
+    this.getName = function() {
+        return _name;
+    }
+}
+Type.registerAbstractClass('Demo.Animals.Animal');
+
+Demo.Animals.Animal.prototype.toStringCustom = function() {
+    return this.getName();
+}
+Demo.Animals.Animal.prototype.speak = Function.abstractMethod;
+
+
+Demo.Animals.Pet = function(name, friendlyName) {
+    Demo.Animals.Pet.initializeBase(this, [name]);
+    
+    var _friendlyName = friendlyName;
+    this.getFriendlyName = function() {
+        return _friendlyName;
+    }
+}
+Type.registerAbstractClass('Demo.Animals.Pet', Demo.Animals.Animal, Demo.Animals.IPet);
+
+
+Demo.Animals.Cat = function(friendlyName) {
+    Demo.Animals.Cat.initializeBase(this, ['Cat', friendlyName]);
+}
+Type.registerClass('Demo.Animals.Cat', Demo.Animals.Pet);
+
+Demo.Animals.Cat.prototype.speak = function() {
+    alert('meow');
+}
+
+Demo.Animals.Cat.prototype.toStringCustom = function() {
+    return 'Pet ' + Demo.Animals.Cat.callBaseMethod(this, 'toStringCustom');
+}
+
+Demo.Animals.Felix = function() {
+    Demo.Animals.Felix.initializeBase(this, ['Felix']);
+}
+Type.registerClass('Demo.Animals.Felix', Demo.Animals.Cat);
+
+Demo.Animals.Felix.prototype.toStringCustom = function() {
+    return Demo.Animals.Felix.callBaseMethod(this, 'toStringCustom') + ' ... its Felix!';
+}
+
+
+Demo.Animals.Dog = function(friendlyName) {
+    Demo.Animals.Dog.initializeBase(this, ['Dog', friendlyName]);
+}
+Type.registerClass('Demo.Animals.Dog', Demo.Animals.Pet);
+
+Demo.Animals.Dog.prototype.speak = function() {
+    alert('woof');
+}
+
+
+Demo.Animals.Tiger = function() {
+    Demo.Animals.Tiger.initializeBase(this, ['Tiger']);
+}
+Type.registerClass('Demo.Animals.Tiger', Demo.Animals.Animal);
+
+Demo.Animals.Tiger.prototype.speak = function() {
+    alert('grrr');
+}
+
+
+alert ("about to do stuff");
+
+try {
+var Tony = new Demo.Animals.Tiger();
+Tony.speak();
+
+var IPet = new Demo.Animals.IPet();
+IPet.getFriendlyName();
+
+var Pet = new Demo.Animals.Pet("Pet");
+alert (Pet.getName());
+
+alert ("hi");
+} catch (e) { alert (e.toString()); }
+
+</script>
+</head>
+</html>
\ No newline at end of file
diff --git a/mcs/class/Microsoft.Web.Atlas/resources/AtlasControls.js b/mcs/class/Microsoft.Web.Atlas/resources/AtlasControls.js
new file mode 100644 (file)
index 0000000..7997eee
--- /dev/null
@@ -0,0 +1,39 @@
+Type.registerNamespace ('Web.UI');
+
+// Button
+Web.UI.Button = function(ele) {
+   Web.UI.Button.initializeBase(ele);
+}
+Type.registerClass ('Web.UI.Button', Web.UI.Control, null /* interface(s) */);
+
+Web.UI.Button.prototype.initialize = function () {
+    Web.UI.Button.callBaseMethod ()
+
+    return Demo.Employee.callBaseMethod(this, 'toString') + '\r\n' + this.getTitle() + '\r\n' + this.getTeam();        
+}
+
+
+// Control
+//
+Web.UI.Control = function(ele) {
+   Web.UI.Control.initializeBase(ele);
+}
+Type.registerClass ('Web.UI.Control', null, null /* interface(s) */);
+
+// Select
+//
+Web.UI.Select = function(ele) {
+    Web.UI.Button.initializeBase(ele);
+}
+Type.registerClass ('Web.UI.Select', Web.UI.Control, null /* interface(s) */);
+
+
+
+// TextBox
+//
+Web.UI.TextBox = function(ele) {
+    Web.UI.Control.initializeBase(ele);
+}
+Type.registerClass ('Web.UI.TextBox', Web.UI.Control, null /* interface(s) */);
+
+
diff --git a/mcs/class/Microsoft.Web.Atlas/resources/AtlasCore.js b/mcs/class/Microsoft.Web.Atlas/resources/AtlasCore.js
new file mode 100644 (file)
index 0000000..fdfc538
--- /dev/null
@@ -0,0 +1,259 @@
+/* Portions of the code in this file is from: Prototype JavaScript
+   framework, version 1.3.1, and is (c) 2005 Sam Stephenson
+   <sam@conio.net> */
+
+// stuff from prototype.js
+
+var Prototype = {
+  Version: '1.3.1',
+  emptyFunction: function() {}
+}
+
+var Class = {
+  create: function() {
+    return function() { 
+      this.initialize.apply(this, arguments);
+    }
+  }
+}
+
+Object.extend = function(destination, source) {
+  for (property in source) {
+    destination[property] = source[property];
+  }
+  return destination;
+}
+
+Object.prototype.extend = function(object) {
+  return Object.extend.apply(this, [this, object]);
+}
+
+Function.prototype.bind = function(object) {
+  var __method = this;
+  return function() {
+    __method.apply(object, arguments);
+  }
+}
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0; i < arguments.length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) {}
+    }
+
+    return returnValue;
+  }
+}
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')},
+      function() {return new XMLHttpRequest()}
+    ) || false;
+  }
+}
+
+Ajax.Base = function() {};
+Ajax.Base.prototype = {
+  setOptions: function(options) {
+    this.options = {
+      method:       'post',
+      asynchronous: true,
+      parameters:   ''
+    }.extend(options || {});
+  },
+
+  responseIsSuccess: function() {
+    return this.transport.status == undefined
+        || this.transport.status == 0 
+        || (this.transport.status >= 200 && this.transport.status < 300);
+  },
+
+  responseIsFailure: function() {
+    return !this.responseIsSuccess();
+  }
+}
+
+Ajax.Request = Class.create();
+Ajax.Request.Events = 
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Request.prototype = (new Ajax.Base()).extend({
+  initialize: function(url, options) {
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+    this.request(url);
+  },
+
+  request: function(url) {
+    var parameters = this.options.parameters || '';
+    if (parameters.length > 0) parameters += '&_=';
+
+    try {
+      if (this.options.method == 'get')
+        url += '?' + parameters;
+
+      this.transport.open(this.options.method, url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous) {
+        this.transport.onreadystatechange = this.onStateChange.bind(this);
+        setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
+      }
+
+      this.setRequestHeaders();
+
+      var body = this.options.postBody ? this.options.postBody : parameters;
+      this.transport.send(this.options.method == 'post' ? body : null);
+
+    } catch (e) {
+    }
+  },
+
+  setRequestHeaders: function() {
+    var requestHeaders = 
+      ['X-Requested-With', 'XMLHttpRequest',
+       'X-Prototype-Version', Prototype.Version];
+
+    if (this.options.method == 'post') {
+      requestHeaders.push('Content-type', 
+        'application/x-www-form-urlencoded');
+
+      /* Force "Connection: close" for Mozilla browsers to work around
+       * a bug where XMLHttpReqeuest sends an incorrect Content-length
+       * header. See Mozilla Bugzilla #246651. 
+       */
+      if (this.transport.overrideMimeType)
+        requestHeaders.push('Connection', 'close');
+    }
+
+    if (this.options.requestHeaders)
+      requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
+
+    for (var i = 0; i < requestHeaders.length; i += 2)
+      this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState != 1)
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  respondToReadyState: function(readyState) {
+    var event = Ajax.Request.Events[readyState];
+
+    if (event == 'Complete')
+      (this.options['on' + this.transport.status]
+       || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
+       || Prototype.emptyFunction)(this.transport);
+
+    (this.options['on' + event] || Prototype.emptyFunction)(this.transport);
+
+    /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
+    if (event == 'Complete')
+      this.transport.onreadystatechange = Prototype.emptyFunction;
+  }
+});
+
+// end stuff from prototype.js
+
+
+
+function $ (a) {
+       return document.getElementById(a);
+}
+
+// provide a way for classes/interfaces to specify abstract methods
+Function.prototype.abstractMethod = function () {
+       throw "Abstract method should be implemented";
+}
+
+// get a reference to the global object so we can register namespaces off it.
+var __global = this;
+
+var types = new Array();
+var Type = {
+       registerNamespace: function (name) {
+               var segments = name.split ('.');
+
+               var parent = __global;
+               for (i = 0; i < segments.length; i ++) {
+                       var new_parent = parent[segments[i]];
+                       if (new_parent == null) {
+                               new_parent = new Object();
+                               parent[segments[i]] = new_parent;
+                       }
+                       parent = new_parent;
+               }
+       },
+
+       registerClass: function (name, parent, interfaces) {
+               var new_type = eval (name); /* XXX ew... */
+
+               new_type.initializeBase = function (o, a) {
+                       parent.apply (o, a);
+               }
+               new_type.callBaseMethod = function (o, m, a) {
+                       var fun = parent.prototype[m];
+                       return fun.apply (o, a);
+               }
+
+               types[name] = new_type;
+       },
+
+       registerAbstractClass: function (name, parent, interfaces) {
+               /* not really sure what to do about this one... */
+               this.registerClass (name, parent, interfaces);
+       },
+
+       registerInterface: function (name) {
+               /* not really sure what to do about this one... */
+               var new_type = eval (name); /* XXX ew... */
+
+               types[name] = new_type;
+       }
+}
+
+// Web namespace
+Type.registerNamespace ("Web");
+
+Web.IDisposable = function () {
+       this.dispose = Function.abstractMethod;
+}
+Type.registerInterface ("Web.IDisposable");
+
+
+// Web.Net namespace
+Type.registerNamespace ("Web.Net");
+
+Web.Net.ServiceMethodRequest = {
+       callMethod: function (path, service, args, completeHandler, timeoutHandler) {
+               this.completeHandler = completeHandler;
+               this.timeoutHandler = timeoutHandler;
+
+               var params = '';
+               for (var v in args) {
+                       if (v != "extend") {
+                               if (params != '')
+                                       params += "&";
+                               params += v + "=" + args[v];
+                       }
+               }
+
+               var options = {
+                       parameters: params,
+                       onComplete: function (transport) { completeHandler (transport.responseText); }
+               };
+
+               var req = new Ajax.Request(path + "/" + service, options);
+       }
+}
\ No newline at end of file
index a4ad1080365fa64bf1ca2b8a0cef7dafd43d7b11..feb2981baed5f2478b9a901527143524cfb2e8b7 100644 (file)
@@ -161,7 +161,7 @@ namespace C5.HasherBuilder
         {\r
             Type t = typeof(T);\r
 \r
-            if (!t.HasGenericArguments)\r
+            if (!t.IsGenericType)\r
             {\r
                 if (t.Equals(typeof(int)))\r
                     return (IHasher<T>)(new IntHasher());\r
index de4fcdbeaa803f2238ee357536b158acd37cf7ed..134b1bac8204db865afab700616b67fefde77d0c 100644 (file)
@@ -1,3 +1,108 @@
+2005-09-19  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Graphics.cs: add SelectFontFace and SetFontSize
+
+2005-09-12  Hisham Mardam Bey  <hisham.mardambey@gmail.com>
+
+        * Samples/: Fix all samples to work with new API changes.
+
+2005-09-12  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Surface.cs: add two ImageSurface ctors
+       Obsolete Surface CreateForImage methods in favor of
+       the new ImageSurface ctors
+       * Mono.Cairo/Cairo.cs: add cairo_text_extents
+       * Mono.Cairo/Graphics.cs: add TextExtents ()
+       
+       
+2005-09-07  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Graphics.cs: the Relative path methods
+       should use a Distance not a PointD, and update some
+       parameter names for better documentation purposes
+       remove SetTargetImage (), and SetTargetDrawable ()
+       use Graphics.Target = Surface instead
+       * Mono.Cairo/Surface.cs: don't reference the surface after
+       we create it as it is not necessary
+       add the new surfaces to the surfaces hashtable on instantiation 
+       * Mono.Cairo/Pattern.cs: don't reference the pattern after
+       we create it as it is not necessary
+       
+2005-09-07 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+       * Samples/png: Fixed samples with new changes.
+       * Samples/x11: Fixed samples with new changes.
+       * Samples/gtk: Fixed samples with new changes.  
+
+2005-09-06  John Luke  <john.luke@gmail.com>
+
+       * Samples/gtk/circles.cs: fix partially broken sample
+
+2005-09-06  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Surface.cs: make CreateSimilar non-static
+       and use Content instead of Format, add Surface.Status
+       * Mono.Cairo/Graphics.cs: add convenience
+       ctor to Color with an alpha of 1.0
+       add Tolerance getter, Change SetDash to compute
+       the length automatically, rename TargetSurface to Target,
+       add SetSourceRGB, SetSourceRGBA, and SetSourceSurface (),
+       add Paint, PaintWithAlpha, Mask, and MaskSurface (),
+       add StrokeExtents, FillExtents, ClipPreserve (), and CopyPage ()
+       * Mono.Cairo/Cairo.cs: add new imports:
+       cairo_stroke_extents, cairo_fill_extents,
+       cairo_clip_preserve, cairo_mask, cairo_mask_surface,
+       cairo_paint_with_alpha, cairo_surface_status
+       add Content enum and fix cairo_surface_create_similar to use
+       Content not Format
+       
+2005-09-05  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Samples/gtk/Graphics.cs:
+       add gtk-cairo helper that will work on win32 and
+       x11 based on gtk-dotnet in gtk#, not yet tested on
+       windows
+
+2005-09-05  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Samples/win32/compile.sh: add this
+       
+2005-09-04  John Luke  <john.luke@gmail.com>
+       * Mono.Cairo/Cairo.cs: remove symbols not in cairo 1.0:
+         cairo_copy, cairo_current_path, cairo_arc_to, cairo_transform_font,
+         cairo_font_set_transform, cairo_font_current_transform,
+         cairo_font_reference, cairo_font_destroy, cairo_status_string,
+         cairo_surface_create_similar_solid
+         rename cairo_current_line_cap to cairo_get_line_cap,
+         remove now unused delegates
+       * Mono.Cairo/Graphics.cs:
+       * Mono.Cairo/Surface.cs: update for above all found 
+         with help of mono-shlib-cop
+
+2005-09-04  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Cairo.cs: add new values to Cairo.Status
+       
+2005-09-02  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Cairo.cs: only use operators in cairo_operator_t
+       
+2005-09-01  John Luke  <john.luke@gmail.com>
+
+       * Mono.Cairo/Cairo.cs: add some imports used by
+       the extra surface types
+       * Mono.Cairo/Surface.cs: add XlibSurface and Win32Surface
+       remove Surface.CreateForXlib () 
+       add PdfSurface and PsSurface for future use (#if'ed out)
+       * Mono.Cairo/Graphics.cs: add ShowPage() method
+       * Samples/win32/arc.cs: add win32 sample
+       * Samples/gtk/sysdraw.cs: use XlibSurface instead of
+       Surface.CreateForXlib ()
+       * Samples/x11/*.cs: use XlibSurface instead of
+       Surface.CreateForXlib ()
+
 2005-09-01  John Luke  <john.luke@gmail.com>
 
        * Mono.Cairo/Cairo.cs: p/invoke the windows dll name
index 5db81859bd7211a67f0c13968a297e27680cb2be..5b455865f65ce69c3d943e8bfeef2e44c8df43a6 100644 (file)
@@ -59,9 +59,6 @@ namespace Cairo {
                [DllImport (CairoImp)]
                public static extern void cairo_restore (IntPtr cr);
 
-                [DllImport (CairoImp)]
-               public static extern void cairo_copy (out IntPtr dest, IntPtr src);
-
                 //
                 // Modify state
                 //
@@ -141,27 +138,6 @@ namespace Cairo {
                [DllImport (CairoImp)]
                public static extern void cairo_new_path (IntPtr cr);
                
-               internal delegate void MoveToCallbackPriv (IntPtr closure, 
-                                                         double x, double y);
-
-               internal delegate void LineToCallbackPriv (IntPtr closure, 
-                                                         double x, double y);
-               
-               internal delegate void CurveToCallbaclPriv (IntPtr closure, 
-                                                          double x1, double y1,
-                                                          double x2, double y2,
-                                                          double x3, double y3);
-               
-               internal delegate void ClosePathCallbackPriv (IntPtr closure);          
-               
-               [DllImport (CairoImp)]
-                internal static extern void cairo_current_path (IntPtr cr, 
-                                                               MoveToCallbackPriv move_to,
-                                                               LineToCallbackPriv line_to,
-                                                               CurveToCallbaclPriv curve_to,
-                                                               ClosePathCallbackPriv close_path,
-                                                               IntPtr closure);
-               
                [DllImport (CairoImp)]
                public static extern void cairo_move_to (IntPtr cr, double x, double y);
 
@@ -180,10 +156,6 @@ namespace Cairo {
                 public static extern void cairo_arc_negative (
                         IntPtr cr, double xc, double yc, double radius, double angel1, double angel2);
                
-                [DllImport (CairoImp)]
-                public static extern void cairo_arc_to (
-                        IntPtr cr, double x1, double y1, double x2, double y2, double radius);
-
                [DllImport (CairoImp)]
                public static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
 
@@ -209,9 +181,15 @@ namespace Cairo {
                 [DllImport (CairoImp)]
                 public static extern void cairo_stroke_preserve (IntPtr cr);
 
+                [DllImport (CairoImp)]
+                public static extern void cairo_stroke_extents (IntPtr cr, double x1, double y1, double x2, double y2);
+
                 [DllImport (CairoImp)]
                 public static extern void cairo_fill (IntPtr cr);
 
+                [DllImport (CairoImp)]
+                public static extern void cairo_fill_extents (IntPtr cr, double x1, double y1, double x2, double y2);
+
                [DllImport (CairoImp)]
                 public static extern void cairo_fill_preserve (IntPtr cr);
                
@@ -223,6 +201,9 @@ namespace Cairo {
 
                 [DllImport (CairoImp)]
                 public static extern void cairo_clip (IntPtr cr);
+
+                [DllImport (CairoImp)]
+                public static extern void cairo_clip_preserve (IntPtr cr);
                
                 [DllImport (CairoImp)]
                 public static extern void cairo_reset_clip (IntPtr cr);
@@ -244,24 +225,9 @@ namespace Cairo {
                 public static extern void cairo_set_font_matrix (IntPtr cr,
                                                             Matrix_T matrix);
                
-                [DllImport (CairoImp)]
-                public static extern void cairo_transform_font (IntPtr cr, IntPtr matrix);
-
                 [DllImport (CairoImp)]
                 public static extern void cairo_show_text (IntPtr cr, string utf8);
 
-                [DllImport (CairoImp)]
-                public static extern void cairo_font_set_transform (IntPtr font, IntPtr matrix);
-
-                [DllImport (CairoImp)]
-                public static extern void cairo_font_current_transform (IntPtr font, IntPtr matrix);
-
-                [DllImport (CairoImp)]
-                public static extern void cairo_font_reference (IntPtr font);
-
-                [DllImport (CairoImp)]
-                public static extern void cairo_font_destroy (IntPtr font);
-
                 [DllImport (CairoImp)]
                 public static extern void cairo_font_extents (IntPtr source, ref FontExtents extents);
 
@@ -272,7 +238,7 @@ namespace Cairo {
                 public static extern void cairo_text_path  (IntPtr ct, string utf8);
 
                [DllImport (CairoImp)]
-                public static extern void cairo_text_path  (IntPtr ct, string utf8, ref TextExtents extents);
+                public static extern void cairo_text_extents  (IntPtr cr, string utf8, ref TextExtents extents);
 
                 [DllImport (CairoImp)]
                 public static extern void cairo_glyph_path (IntPtr ct, IntPtr glyphs, int num_glyphs);
@@ -283,8 +249,17 @@ namespace Cairo {
                [DllImport (CairoImp)]
                 public static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, int width, int height);
                
+                [DllImport (CairoImp)]
+                internal static extern void cairo_mask (IntPtr cr, IntPtr pattern);
+                
+                               [DllImport (CairoImp)]
+                internal static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
+                               
                 [DllImport (CairoImp)]
                 public static extern void cairo_paint (IntPtr cr);
+
+                [DllImport (CairoImp)]
+                public static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
                
                [DllImport (CairoImp)]
                 public static extern IntPtr cairo_image_surface_create_from_png  (string filename);
@@ -321,7 +296,7 @@ namespace Cairo {
                public static extern double cairo_get_line_width (IntPtr cr);
 
                 [DllImport (CairoImp)]
-               public static extern LineCap cairo_current_line_cap (IntPtr cr);
+               public static extern LineCap cairo_get_line_cap (IntPtr cr);
 
                        [DllImport (CairoImp)]
                public static extern LineJoin cairo_get_line_join (IntPtr cr);
@@ -341,14 +316,6 @@ namespace Cairo {
                 [DllImport (CairoImp)]
                 public static extern Cairo.Status cairo_status (IntPtr cr);
 
-               [DllImport (CairoImp, EntryPoint="cairo_status_string")]
-               static extern IntPtr _cairo_status_string (IntPtr cr);
-
-               public static string cairo_status_string (IntPtr cr)
-               {
-                       return Marshal.PtrToStringAnsi (_cairo_status_string (cr));
-               }
-               
                 //
                 // Surface Manipulation
                 //
@@ -356,6 +323,9 @@ namespace Cairo {
                [DllImport (CairoImp)]
                 public static extern IntPtr cairo_xlib_surface_create (IntPtr dpi,
                        IntPtr win, IntPtr visual, int w, int h);
+
+               [DllImport (CairoImp)]
+                public static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
                
                [DllImport (CairoImp)]
                 public static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
@@ -363,6 +333,9 @@ namespace Cairo {
                [DllImport (CairoImp)]                
                 public static extern Cairo.Status cairo_surface_finish (IntPtr surface);
                
+               [DllImport (CairoImp)]                
+                internal static extern Cairo.Status cairo_surface_status (IntPtr surface);
+               
                [DllImport (CairoImp)]                
                 public static extern void cairo_surface_set_device_offset (IntPtr surface,
                                                                       double x, double y);
@@ -378,12 +351,7 @@ namespace Cairo {
 
                 [DllImport (CairoImp)]
                 public static extern IntPtr cairo_surface_create_similar (
-                        IntPtr surface, Cairo.Format format, int width, int height);
-
-                [DllImport (CairoImp)]                
-                public static extern IntPtr cairo_surface_create_similar_solid (
-                        IntPtr surface, Cairo.Format format,
-                        int width, int height, double red, double green, double blue, double alpha);
+                        IntPtr surface, Cairo.Content content, int width, int height);
 
                 [DllImport (CairoImp)]
                 public static extern void cairo_surface_reference (IntPtr surface);
@@ -394,6 +362,21 @@ namespace Cairo {
                 [DllImport (CairoImp)]                
                 public static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
 
+                [DllImport (CairoImp)]                
+                public static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
+
+                [DllImport (CairoImp)]                
+                public static extern void cairo_pdf_surface_set_dpi (IntPtr surface, double x_dpi, double y_dpi);
+
+                [DllImport (CairoImp)]                
+                public static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
+
+                [DllImport (CairoImp)]                
+                public static extern void cairo_ps_surface_set_dpi (IntPtr surface, double x_dpi, double y_dpi);
+                               
+                [DllImport (CairoImp)]                
+                public static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
+
                 //
                 // Matrix
                 //
@@ -524,6 +507,12 @@ namespace Cairo {
                                Gray,
                                Subpixel,
                }
+
+               public enum Content {
+                       Color,
+                       Alpha,
+                       ColorAlpha,
+               }
                
         public enum Format {
                 ARGB32 = 0,
@@ -533,46 +522,23 @@ namespace Cairo {
         }
 
         public enum Operator {
-                Clear = 0,
-                Src = 1,
-                Dst = 2,
-                Over = 3,
-                OverReverse = 4,
-                In = 5,
-                InReverse = 6,
-                Out = 7,
-                OutReverse = 8,
-                Atop = 9,
-                AtopReverse = 10,
-                Xor = 11,
-                Add = 12,
-                Saturate = 13,
-                
-                DisjointClear = 16,
-                DisjointSrc = 17,
-                DisjointDst = 18,
-                DisjointOver = 19,
-                DisjointOverReverse = 20,
-                DisjointIn = 21,
-                DisjointInReverse = 22,
-                DisjointOut = 23,
-                DisjointOutReverse = 24,
-                DisjointAtop = 25,
-                DisjointAtopReverse = 26,
-                DisjointXor = 27,
-
-                ConjointClear = 32,
-                ConjointSrc = 33,
-                ConjointDst = 34,
-                ConjointOver = 35,
-                ConjointOverReverse = 36,
-                ConjointIn = 37,
-                ConjointInReverse = 38,
-                ConjointOut = 39,
-                ConjointOutReverse = 40,
-                ConjointAtop = 41,
-                ConjointAtopReverse = 42,
-                ConjointXor = 43
+               Clear,
+
+               Source,
+               Over,
+               In,
+               Out,
+               Atop,
+
+               Dest,
+               DestOver,
+               DestIn,
+               DestOut,
+               DestAtop,
+
+               Xor,
+               Add,
+               Saturate,
         }
 
         public enum FillRule {
@@ -594,7 +560,21 @@ namespace Cairo {
                 InvalidRestore,
                 InvalidPopGroup,
                 NoCurrentPoint,
-                InvalidMatrix
+                InvalidMatrix,
+                               InvalidStatus,
+                               NullPointer,
+                               InvalidString,
+                               InvalidPathData,
+                               ReadError,
+                               WriteError,
+                               SurfaceFinished,
+                               SurfaceTypeMismatch,
+                               PatternTypeMismatch,
+                               InvalidContent,
+                               InvalidFormat,
+                               InvalidVisual,
+                               FileNotFound,
+                               InvalidDash
         }
 
         public enum Filter {
@@ -626,39 +606,30 @@ namespace Cairo {
         [StructLayout(LayoutKind.Sequential)]
         public struct FontExtents
         {
-                public  double ascent;
-                public  double descent;
-                public  double height;
-                public  double max_x_advance;
-                public  double max_y_advance;
+                public  double Ascent;
+                public  double Descent;
+                public  double Height;
+                public  double MaxXAdvance;
+                public  double MaxYAdvance;
         }        
    
    
         [StructLayout(LayoutKind.Sequential)]
         public struct TextExtents
         {
-                public  double x_bearing;
-                public  double y_bearing;
-                public  double width;
-                public  double height;
-                public  double x_advance;
-                public  double y_advance;
+                public  double XBearing;
+                public  double YBearing;
+                public  double Width;
+                public  double Height;
+                public  double XAdvance;
+                public  double YAdvance;
         }
 
         [StructLayout(LayoutKind.Sequential)]
         public struct Glyph
         {
-                public  long index;
-                public  double x;
-                public  double y;
+                public  long Index;
+                public  double X;
+                public  double Y;
         }
-
-               public  delegate void ClosePathCallback (object closure);
-
-               public  delegate void CurveToCallback (object closure, PointD p1, PointD p2, PointD p3);
-
-               public  delegate void MoveToCallback (object closure, PointD p);
-
-               public  delegate void LineToCallback (object closure, PointD p);
-
 }
index 8e98cece52ebf334742350bba339dcc3f376eae8..764cca63df4f758aa3f7690a36e731cec4e1e4db 100644 (file)
@@ -83,6 +83,10 @@ namespace Cairo {
                public double B;
                public double A;
                
+               public Color(double r, double g, double b) : this (r, g, b, 1.0)
+               {
+               }
+
                public Color(double r, double g, double b, double a)
                {
                        R = r;
@@ -95,7 +99,6 @@ namespace Cairo {
         public class Graphics : IDisposable 
         {
                 internal IntPtr state = IntPtr.Zero;
-               //private Surface surface;
                
                 public Graphics (Surface surface)
                 {
@@ -132,13 +135,6 @@ namespace Cairo {
                        state = IntPtr.Zero;
                 }
 
-                public Cairo.Graphics Copy ()
-                {
-                        IntPtr dest;
-                        CairoAPI.cairo_copy (out dest, state);
-                        return new Cairo.Graphics (dest);
-                }
-                
                 public void Save ()
                 {
                         CairoAPI.cairo_save (state);
@@ -160,13 +156,6 @@ namespace Cairo {
                         }
                 }
                
-               /*
-                public string StatusString {
-                get {
-                                return CairoAPI.cairo_status_to_string (state);
-                        }
-                }
-                */ 
                 public IntPtr Handle {
                         get {
                                 return state;
@@ -199,6 +188,7 @@ namespace Cairo {
                 }              
 
                 public double Tolerance {
+                                               get { return CairoAPI.cairo_get_tolerance (state); }
                         set {
                                 CairoAPI.cairo_set_tolerance (state, value);
                         }
@@ -230,7 +220,7 @@ namespace Cairo {
                         }
 
                         get {
-                                return CairoAPI.cairo_current_line_cap (state);
+                                return CairoAPI.cairo_get_line_cap (state);
                         }
                 }
 
@@ -244,9 +234,9 @@ namespace Cairo {
                         }
                 }
 
-                public void SetDash (double [] dashes, int ndash, double offset)
+                public void SetDash (double [] dashes, double offset)
                 {
-                        CairoAPI.cairo_set_dash (state, dashes, ndash, offset);
+                        CairoAPI.cairo_set_dash (state, dashes, dashes.Length, offset);
                 }
                
                 public Pattern Pattern {
@@ -287,10 +277,9 @@ namespace Cairo {
                         }
                 }
 
-                public Cairo.Surface TargetSurface {
+                public Cairo.Surface Target {
                         set {
                                state = CairoAPI.cairo_create (value.Pointer);                          
-                                //CairoAPI.cairo_set_target_surface (state, value.Handle);
                         }
 
                         get {
@@ -299,6 +288,21 @@ namespace Cairo {
                         }
                 }
 
+                               public void SetSourceRGB (double r, double g, double b)
+                               {
+                                       CairoAPI.cairo_set_source_rgb (state, r, g, b);
+                               }
+
+                               public void SetSourceRGBA (double r, double g, double b, double a)
+                               {
+                                       CairoAPI.cairo_set_source_rgba (state, r, g, b, a);
+                               }
+
+                               public void SetSourceSurface (Surface source, int x, int y)
+                               {
+                                       CairoAPI.cairo_set_source_surface (state, source.Handle, x, y);
+                               }
+
 #region Path methods
                 
                 public void NewPath ()
@@ -306,15 +310,6 @@ namespace Cairo {
                         CairoAPI.cairo_new_path (state);
                 }
         
-               public void CurrentPath (MoveToCallback move_to, 
-                                        LineToCallback line_to,
-                                        CurveToCallback curve_to,
-                                        ClosePathCallback close_path,
-                                        object closure)
-               {
-                       
-               }
-               
                 public void MoveTo (PointD p)
                 {
                                                MoveTo (p.X, p.Y);
@@ -345,51 +340,46 @@ namespace Cairo {
                         CairoAPI.cairo_curve_to (state, x1, y1, x2, y2, x3, y3);
                 }
 
-                public void RelMoveTo (PointD p)
+                public void RelMoveTo (Distance d)
                                {
-                                               RelMoveTo (p.X, p.Y);
+                                               RelMoveTo (d.Dx, d.Dy);
                                }
                                
-                public void RelMoveTo (double x, double y)
+                public void RelMoveTo (double dx, double dy)
                 {
-                        CairoAPI.cairo_rel_move_to (state, x, y);
+                        CairoAPI.cairo_rel_move_to (state, dx, dy);
                 }
 
-                public void RelLineTo (PointD p)
+                public void RelLineTo (Distance d)
                 {
-                                               RelLineTo (p.X, p.Y);
+                                               RelLineTo (d.Dx, d.Dy);
                 }
 
-                public void RelLineTo (double x, double y)
+                public void RelLineTo (double dx, double dy)
                                {
-                        CairoAPI.cairo_rel_line_to (state, x, y);
+                        CairoAPI.cairo_rel_line_to (state, dx, dy);
                                }
 
+                public void RelCurveTo (Distance d1, Distance d2, Distance d3)
+               {
+                       RelCurveTo (d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy);
+               }
+
                 public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
                 {
                         CairoAPI.cairo_rel_curve_to (state, dx1, dy1, dx2, dy2, dx3, dy3); 
                 }
 
-                public void Arc (double xc, double yc, double radius, double angel1, double angel2)
+                public void Arc (double xc, double yc, double radius, double angle1, double angle2)
                 {
-                        CairoAPI.cairo_arc (state, xc, yc, radius, angel1, angel2);
+                        CairoAPI.cairo_arc (state, xc, yc, radius, angle1, angle2);
                 }
 
-                public void ArcNegative (double xc, double yc, double radius, double angel1, double angel2)
+                public void ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
                 {
-                        CairoAPI.cairo_arc_negative (state, xc, yc, radius, angel1, angel2);
+                        CairoAPI.cairo_arc_negative (state, xc, yc, radius, angle1, angle2);
                 }
                
-               public void ArcTo (PointD p1, PointD p2, double radius)
-               {
-                               ArcTo (p1.X, p1.Y, p2.X, p2.Y, radius);
-               }
-               
-               public void ArcTo (double x1, double y1, double x2, double y2, double radius)
-               {
-                       CairoAPI.cairo_arc_to (state, x1, y1, x2, y2, radius);
-               }
-                
                 public void Rectangle (PointD p, double width, double height)
                                {
                                                Rectangle (p.X, p.Y, width, height);
@@ -407,6 +397,25 @@ namespace Cairo {
 #endregion
 
 #region Painting Methods
+                               public void Paint ()
+                               {
+                                       CairoAPI.cairo_paint (state);
+                               }
+
+                               public void PaintWithAlpha (double alpha)
+                               {
+                                       CairoAPI.cairo_paint_with_alpha (state, alpha);
+                               }
+
+                               public void Mask (Pattern pattern)
+                               {
+                                       CairoAPI.cairo_mask (state, pattern.Pointer);
+                               }
+
+                               public void MaskSurface (Surface surface, double x, double y)
+                               {
+                                       CairoAPI.cairo_mask_surface (state, surface.Handle, x, y);
+                               }
 
                 public void Stroke ()
                 {
@@ -418,11 +427,21 @@ namespace Cairo {
                         CairoAPI.cairo_stroke_preserve (state);
                 }              
 
+                               public void StrokeExtents (double x1, double y1, double x2, double y2)
+                               {
+                        CairoAPI.cairo_stroke_extents (state, x1, y1, x2, y2);
+                               }
+
                 public void Fill ()
                 {
                         CairoAPI.cairo_fill (state);
                 }
-               
+
+                public void FillExtents (double x1, double y1, double x2, double y2)
+                               {
+                                       CairoAPI.cairo_fill_extents (state, x1, y1, x2, y2);
+                               }
+
                public void FillPreserve ()
                {
                        CairoAPI.cairo_fill_preserve (state);
@@ -435,7 +454,12 @@ namespace Cairo {
                         CairoAPI.cairo_clip (state);
                 }
 
-               public void ClipReset ()
+                               public void ClipPreserve ()
+                               {
+                                       CairoAPI.cairo_clip_preserve (state);
+                               }
+
+               public void ResetClip ()
                {
                        CairoAPI.cairo_reset_clip (state);
                }
@@ -450,21 +474,6 @@ namespace Cairo {
                        return CairoAPI.cairo_in_fill (state, x, y);
                }
 
-
-#region Modified state
-
-                public void SetTargetImage (
-                        string data, Cairo.Format format, int width, int height, int stride)
-                {
-                        CairoAPI.cairo_image_surface_create_for_data (data, format, width, height, stride);
-                }
-
-               public void SetTargetDrawable (IntPtr dpy, IntPtr drawable, IntPtr visual, int width, int height)
-               {
-                       CairoAPI.cairo_xlib_surface_create (dpy, drawable, visual, width, height);
-               }               
-#endregion
-
                 public void Rotate (double angle)
                 {
                         CairoAPI.cairo_rotate (state, angle);
@@ -618,6 +627,26 @@ namespace Cairo {
                public double FontSize {
                        set { CairoAPI.cairo_set_font_size (state, value); }
                }
+
+               public void CopyPage ()
+               {
+                       CairoAPI.cairo_copy_page (state);
+               }
+
+               public void SelectFontFace (string family, FontSlant slant, FontWeight weight)
+               {
+                       CairoAPI.cairo_select_font_face (state, family, slant, weight);
+               }
+
+               public void SetFontSize (double scale)
+               {
+                       CairoAPI.cairo_set_font_size (state, scale);
+               }
+
+               public void ShowPage ()
+               {
+                       CairoAPI.cairo_show_page (state);
+               }
                
                 public void ShowText (string str)
                 {
@@ -628,5 +657,12 @@ namespace Cairo {
                 {
                         CairoAPI.cairo_text_path  (state, str);
                 }              
+
+               public TextExtents TextExtents (string utf8)
+               {
+                       TextExtents extents = new TextExtents ();
+                       CairoAPI.cairo_text_extents (state, utf8, ref extents);
+                       return extents;
+               }
         }
 }
index 3c994bd49b78b896148abc797e1e62955bfca760..aa4e14a3e6a9e3577cc24aac5243bf5fb1057baf 100644 (file)
@@ -33,34 +33,68 @@ using Cairo;
 
 namespace Cairo {
    
-        public class PatternLinear : Pattern
+        public class LinearGradient : Gradient
         {              
-               public PatternLinear (double x0, double y0, double x1, double y1) : base()
+               public LinearGradient (double x0, double y0, double x1, double y1) : base()
                 {
                         pattern = CairoAPI.cairo_pattern_create_linear (x0, y0, x1, y1);
-                       Reference ();
                 }              
        }
    
-        public class PatternRadial : Pattern
-        {
-               public PatternRadial (double cx0, double cy0, double radius0,
+        public class RadialGradient : Gradient
+               {
+               public RadialGradient (double cx0, double cy0, double radius0,
                                      double cx1, double cy1, double radius1) : base()
                 {
                         pattern = CairoAPI.cairo_pattern_create_radial (cx0, cy0, radius0,
                                                                    cx1, cy1, radius1);
-                       Reference ();
                 }
        }
 
-        public class PatternRgba : Pattern
-        {
-               public PatternRgba (double r, double g, double b, double a) : base ()
+               public class Gradient : Pattern
+               {
+                public Status AddColorStop (double offset, Cairo.Color c)
+                {
+                        return CairoAPI.cairo_pattern_add_color_stop_rgba (pattern, offset, 
+                                                                 c.R, c.G, c.B, c.A);                
+                }
+
+                public Status AddColorStopRgb (double offset, Cairo.Color c)
+                {
+                        return CairoAPI.cairo_pattern_add_color_stop_rgb (pattern, offset, 
+                                                                 c.R, c.G, c.B);
+                }              
+               }
+
+               // FIXME: probably will change to a better name at some point
+               public class SolidPattern : Pattern
                {
-                       pattern = CairoAPI.cairo_pattern_create_rgba (r, g, b, a);
-                       Reference();
+                       public SolidPattern (Color color, bool solid)
+                       {
+                               if (solid)
+                                       pattern = CairoAPI.cairo_pattern_create_rgb (color.R, color.G, color.B);
+                               else
+                                       pattern = CairoAPI.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A);
+                       }
+               }
+
+               public class SurfacePattern : Pattern
+               {
+                       public SurfacePattern (Surface surface)
+                       {
+                               pattern = CairoAPI.cairo_pattern_create_for_surface (surface.Pointer);
+                       }
+
+                       public Extend Extend {
+                               set { CairoAPI.cairo_pattern_set_extend (pattern, value); }
+                               get { return CairoAPI.cairo_pattern_get_extend (pattern); }
+                       }
+
+                       public Filter Filter {
+                               set { CairoAPI.cairo_pattern_set_filter (pattern, value); }
+                               get { return CairoAPI.cairo_pattern_get_filter (pattern); }
+                       }
                }
-       }
    
         public class Pattern
         {
@@ -89,18 +123,6 @@ namespace Cairo {
                 {
                         CairoAPI.cairo_pattern_destroy (pattern);
                 }
-
-                public Status AddColorStop (double offset, Cairo.Color c)
-                {
-                        return CairoAPI.cairo_pattern_add_color_stop_rgba (pattern, offset, 
-                                                                 c.R, c.G, c.B, c.A);                
-                }
-               
-                public Status AddColorStopRgb (double offset, Cairo.Color c)
-                {
-                        return CairoAPI.cairo_pattern_add_color_stop_rgb (pattern, offset, 
-                                                                 c.R, c.G, c.B);
-                }              
                
                public Status Status
                {
@@ -123,16 +145,6 @@ namespace Cairo {
                                return new Cairo.Matrix (matrix);
                         }
                 }
-               
-                public Extend Extend {
-                        set { CairoAPI.cairo_pattern_set_extend (pattern, value); }
-                        get { return CairoAPI.cairo_pattern_get_extend (pattern); }
-                }
-
-                public Filter Filter {
-                        set { CairoAPI.cairo_pattern_set_filter (pattern, value); }
-                        get { return CairoAPI.cairo_pattern_get_filter (pattern); }
-                }
 
                 public IntPtr Pointer {
                         get { return pattern; }
index f85ef4781d10a0cbc0429b7cab9e6574b8474b3d..d34c8b443e81d8e4c63182330546f6637d1c6d76 100644 (file)
@@ -37,17 +37,30 @@ using System.Collections;
 
 namespace Cairo {
 
-        public class SurfaceImage : Surface
+        public class ImageSurface : Surface
         {
+               public ImageSurface (Format format, int width, int height)
+               {
+                       surface = CairoAPI.cairo_image_surface_create (format, width, height);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
+
+               public ImageSurface (string data, Cairo.Format format, int width, int height, int stride)
+               {
+                       surface = CairoAPI.cairo_image_surface_create_for_data (data, format, width, height, stride);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
                
-               public SurfaceImage (string filename)
+               public ImageSurface (string filename)
                {
                        surface = CairoAPI.cairo_image_surface_create_from_png (filename);
                        lock (surfaces.SyncRoot){
                                surfaces [surface] = this;
                        }
-                       
-                       CairoAPI.cairo_surface_reference (surface);
                }
                
                public int Width {
@@ -59,6 +72,82 @@ namespace Cairo {
                }
                
        }
+
+       #if UNSTABLE
+       public class PdfSurface : Surface
+       {
+               public PdfSurface (string filename, double width, double height)
+               {
+                       surface = CairoAPI.cairo_pdf_surface_create (filename, width, height);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
+
+               public void SetDPI (double x_dpi, double y_dpi)
+               {
+                       CairoAPI.cairo_pdf_surface_set_dpi (surface, x_dpi, y_dpi);
+               }
+       }
+
+       public class PostscriptSurface : Surface
+       {
+               public PostscriptSurface (string filename, double width, double height)
+               {
+                       surface = CairoAPI.cairo_ps_surface_create (filename, width, height);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
+
+               public void SetDPI (double x_dpi, double y_dpi)
+               {
+                       CairoAPI.cairo_ps_surface_set_dpi (surface, x_dpi, y_dpi);
+               }
+       }
+       #endif
+
+       public class Win32Surface : Surface
+       {
+               public Win32Surface (IntPtr hdc)
+               {
+                       surface = CairoAPI.cairo_win32_surface_create (hdc);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
+       }
+
+       public class XlibSurface : Surface
+       {
+               public XlibSurface (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height)
+               {
+                       surface = CairoAPI.cairo_xlib_surface_create (display, drawable, visual, width, height);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
+
+               /* FIXME: has the same parameters as above
+               public XlibSurface (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
+               {
+                       surface = CairoAPI.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, height);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
+               */
+
+               public void SetDrawable (IntPtr drawable, int width, int height)
+               {
+                       CairoAPI.cairo_xlib_surface_set_drawable (surface, drawable, width, height);
+               }
+
+               public void SetSize (int width, int height)
+               {
+                       CairoAPI.cairo_xlib_surface_set_size (surface, width, height);
+               }
+       }
    
        public class Surface : IDisposable 
         {                                              
@@ -89,16 +178,7 @@ namespace Cairo {
                        }
                }               
                
-               public static Cairo.Surface CreateForXlib (IntPtr display, IntPtr win,
-                                                          IntPtr visual, int w, 
-                                                          int h)
-               {
-                       IntPtr p = CairoAPI.cairo_xlib_surface_create (display, win,
-                                                                  visual, w, h);
-                       if(p == IntPtr.Zero) System.Console.WriteLine("Failed creating surface");
-                       return new Cairo.Surface (p, false);
-               }
-               
+               [Obsolete ("Use an ImageSurface constructor instead.")]
                 public static Cairo.Surface CreateForImage (
                         string data, Cairo.Format format, int width, int height, int stride)
                 {
@@ -108,6 +188,7 @@ namespace Cairo {
                         return new Cairo.Surface (p, true);
                 }
 
+               [Obsolete ("Use an ImageSurface constructor instead.")]
                 public static Cairo.Surface CreateForImage (
                         Cairo.Format format, int width, int height)
                 {
@@ -118,21 +199,11 @@ namespace Cairo {
                 }
 
 
-                public static Cairo.Surface CreateSimilar (
-                        Cairo.Surface surface, Cairo.Format format, int width, int height)
+                public Cairo.Surface CreateSimilar (
+                        Cairo.Content content, int width, int height)
                 {
                         IntPtr p = CairoAPI.cairo_surface_create_similar (
-                                surface.Handle, format, width, height);
-
-                        return new Cairo.Surface (p, true);
-                }
-
-                public static Cairo.Surface CreateSimilarSolid (
-                        Cairo.Surface surface, Cairo.Format format,
-                        int width, int height, double red, double green, double blue, double alpha)
-                {
-                        IntPtr p = CairoAPI.cairo_surface_create_similar_solid (
-                                surface.Handle, format, width, height, red, green, blue, alpha);
+                                this.Handle, content, width, height);
 
                         return new Cairo.Surface (p, true);
                 }
@@ -181,11 +252,6 @@ namespace Cairo {
                        }
                }
                
-               public void XlibSetSize (int w, int h)
-               {
-                       CairoAPI.cairo_xlib_surface_set_size (surface, w, h);
-               }
-               
                public void Destroy()
                {
                        CairoAPI.cairo_surface_destroy (surface);
@@ -200,5 +266,9 @@ namespace Cairo {
                         get { return surface; }
                 }
 
+                               public Status Status {
+                                       get { return CairoAPI.cairo_surface_status (surface); }
+                               }
+
         }
 }
diff --git a/mcs/class/Mono.Cairo/Samples/gtk/Graphics.cs b/mcs/class/Mono.Cairo/Samples/gtk/Graphics.cs
new file mode 100644 (file)
index 0000000..5b6993f
--- /dev/null
@@ -0,0 +1,70 @@
+using System;
+using System.Runtime.InteropServices;
+using Cairo;
+
+namespace Gdk
+{
+       public class Graphics
+       {
+               private Graphics () {}
+
+               // Note: we don't need or want a .dll.config since we p/invoke
+               // the proper lib based on the os check below
+
+               // win32 only imports
+               [DllImport("libgdk-win32-2.0-0.dll")]
+               internal static extern IntPtr gdk_win32_hdc_get(IntPtr drawable, IntPtr gc, int usage);
+               
+               [DllImport("libgdk-win32-2.0-0.dll")]
+               internal static extern void gdk_win32_hdc_release(IntPtr drawable,IntPtr gc,int usage);
+
+               // x11 only imports
+               [DllImport("libgdk-x11-2.0.so.0")]
+               internal static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr handle);
+
+               [DllImport("libgdk-x11-2.0.so.0")]
+               internal static extern IntPtr gdk_drawable_get_visual (IntPtr handle);
+
+               [DllImport("libgdk-x11-2.0.so.0")]
+               internal static extern IntPtr gdk_x11_visual_get_xvisual (IntPtr handle);
+
+               [DllImport("libgdk-x11-2.0.so.0")]
+               internal static extern IntPtr gdk_x11_drawable_get_xid (IntPtr handle);
+               
+               public static Cairo.Graphics CreateDrawable (Gdk.Drawable drawable)
+               {
+                       return CreateDrawable (drawable, true);
+               }
+
+               public static Cairo.Graphics CreateDrawable (Gdk.Drawable drawable, bool double_buffered)
+               {
+                       int x = 0, y = 0;
+                       Cairo.Surface surface;
+                       
+                       PlatformID os = Environment.OSVersion.Platform;
+
+                       if (drawable is Gdk.Window && double_buffered)
+                           ((Gdk.Window)drawable).GetInternalPaintInfo (out drawable, out x, out y);
+
+                       if (os == PlatformID.Win32Windows || os == PlatformID.Win32NT ||
+                           os == PlatformID.Win32S || os == PlatformID.WinCE) {
+
+                               Gdk.GC gcc = new Gdk.GC (drawable);
+                               IntPtr windc = gdk_win32_hdc_get (drawable.Handle, gcc.Handle, 0);
+                               surface = new Win32Surface (windc);
+                               
+                               if (double_buffered)
+                                       gdk_win32_hdc_release (drawable.Handle, gcc.Handle, 0);
+                       } else {
+                               IntPtr display = gdk_x11_drawable_get_xdisplay (drawable.Handle);
+                               IntPtr visual = gdk_drawable_get_visual (drawable.Handle);
+                               IntPtr xvisual = gdk_x11_visual_get_xvisual (visual);
+                               IntPtr xdrawable = gdk_x11_drawable_get_xid (drawable.Handle);
+                               surface = new XlibSurface (display, xdrawable, xvisual, x, y);
+                       }
+                       
+                       return new Cairo.Graphics (surface);
+               }
+       }
+}
+
index a89d163fca9075ba65d98561aa94da2fb098cc8c..4ef11d8fc3727e48ef8846919ebf7d0a9559f0b6 100644 (file)
@@ -29,8 +29,6 @@
 //
 
 using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
 using Cairo;
 using Gtk;
        
@@ -63,16 +61,11 @@ public class CairoGraphic : DrawingArea
    
        static void oval_path (Cairo.Graphics gr, double xc, double yc, double xr, double yr)
        {
-               Matrix matrix  = gr.Matrix;
-               
                gr.Translate (xc, yc);
                gr.Scale (1.0, yr / xr);
                gr.MoveTo (new PointD (xr, 0.0) );
                gr.Arc (0, 0, xr, 0, 2 * M_PI);
                gr.ClosePath ();
-               
-               gr.Matrix = matrix;
-               //matrix.Destroy();
        }
        
        /* 
@@ -119,12 +112,13 @@ public class CairoGraphic : DrawingArea
                double xc = width / 2;
                double yc = height / 2;
                
-               overlay = Surface.CreateSimilar (gr.TargetSurface, Format.ARGB32, width, height);               
-               punch = Surface.CreateSimilar (gr.TargetSurface, Format.A8, width, height);             
-               circles = Surface.CreateSimilar (gr.TargetSurface, Format.ARGB32, width, height);
+               Surface target = gr.Target;
+               overlay = target.CreateSimilar (Content.ColorAlpha, width, height);             
+               punch = target.CreateSimilar (Content.Alpha, width, height);            
+               circles = target.CreateSimilar (Content.ColorAlpha, width, height);
                
                gr.Save ();
-               gr.TargetSurface = overlay;
+               gr.Target = overlay;
                
                /* Draw a black circle on the overlay
                */
@@ -134,7 +128,7 @@ public class CairoGraphic : DrawingArea
                oval_path (gr, xc, yc, radius, radius);
                gr.Fill ();             
                gr.Save ();
-               gr.TargetSurface =  punch;
+               gr.Target =  punch;
                
                
                /* Draw 3 circles to the punch surface, then cut
@@ -144,7 +138,7 @@ public class CairoGraphic : DrawingArea
                
                gr.Restore ();
                
-               gr.Operator = Operator.OutReverse;
+               gr.Operator = Operator.DestOut;
                punch.Show (gr, width, height);
                
                
@@ -153,7 +147,7 @@ public class CairoGraphic : DrawingArea
                * without seams.
                */
                gr.Save ();
-               gr.TargetSurface =  circles;
+               gr.Target =  circles;
                
                //gr.Alpha = 0.5;
                gr.Operator = Operator.Over;
index dd7c4ce7f90a035d8404926c32d18bb8d27323a8..aee47540045ec97a63fafa5efce74dc9268fb873 100644 (file)
@@ -62,7 +62,7 @@ public class CairoGraphic : DrawingArea
        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
 
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
@@ -71,7 +71,7 @@ public class CairoGraphic : DrawingArea
                gr.Clip ();
                gr.NewPath ();
 
-               image = new SurfaceImage("data/e.png");
+               image = new ImageSurface("data/e.png");
                w = image.Width;
                h = image.Height;
 
index c04e677c63d30121c0e8cef8f34713a040364fd9..ba9db10da47a93f4b16661daab834048e28d64d8 100644 (file)
@@ -66,7 +66,7 @@ public class CairoGraphic : DrawingArea
                
                gr.MoveTo ( new PointD (0.5, 0.1) );
                gr.LineTo ( new PointD (0.9, 0.9) );
-               gr.RelLineTo ( new PointD (-0.4, 0.0) );
+               gr.RelLineTo ( new Distance (-0.4, 0.0) );
                gr.CurveTo ( new PointD (0.2, 0.9),
                             new PointD ( 0.2, 0.5),
                             new PointD (0.5, 0.5)
@@ -74,9 +74,9 @@ public class CairoGraphic : DrawingArea
                gr.ClosePath ();
                
                gr.MoveTo ( new PointD (0.25, 0.1) );
-               gr.RelLineTo ( new PointD (0.2, 0.2) );
-               gr.RelLineTo ( new PointD ( -0.2, 0.2) );
-               gr.RelLineTo ( new PointD (-0.2, -0.2) );
+               gr.RelLineTo ( new Distance (0.2, 0.2) );
+               gr.RelLineTo ( new Distance ( -0.2, 0.2) );
+               gr.RelLineTo ( new Distance (-0.2, -0.2) );
                gr.ClosePath ();               
                
                gr.Color = new Color (0, 0, 1, 1);
index edfd501911e013723284d53d8f4d9329575fa94d..7f27c1597846313a71d8e2e9ee3bae65127990f8 100644 (file)
@@ -65,9 +65,9 @@ public class CairoGraphic : DrawingArea
        {
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
-               Pattern pat;            
+               LinearGradient pat;             
                
-               pat = new PatternLinear (0.0, 0.0,  0.0, 1.0);
+               pat = new LinearGradient (0.0, 0.0,  0.0, 1.0);
                pat.AddColorStop (1, new Color (0, 0, 0, 1) );
                pat.AddColorStop (0, new Color (1, 1, 1, 1) );
                gr.Rectangle ( new PointD (0, 0),
@@ -78,15 +78,15 @@ public class CairoGraphic : DrawingArea
                gr.Fill ();
                pat.Destroy ();
 
-               pat = new PatternRadial (0.45, 0.4, 0.1,
+               RadialGradient pat2 = new RadialGradient (0.45, 0.4, 0.1,
                                     0.4,  0.4, 0.5);
                
-               pat.AddColorStop (0, new Color (1, 1, 1, 1) );
-               pat.AddColorStop (1, new Color (0, 0, 0, 1) );
-               gr.Pattern =  pat;              
+               pat2.AddColorStop (0, new Color (1, 1, 1, 1) );
+               pat2.AddColorStop (1, new Color (0, 0, 0, 1) );
+               gr.Pattern =  pat2;
                gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
                gr.Fill ();
-               pat.Destroy ();
+               pat2.Destroy ();
        }
        
        
index 11c0547e1a75a2ca466572e2dcbfd84915281ce6..4cf1330190121c682f7df014026fdf1fe6abfbab 100644 (file)
@@ -64,12 +64,12 @@ public class CairoGraphic : DrawingArea
        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
                
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
                                
-               image = new SurfaceImage ("data/e.png");
+               image = new ImageSurface ("data/e.png");
                w = image.Width;
                h = image.Height;
                
index d07c71d4e94f2211a50f71fe082c849a473a1556..b7b86c22917de9f769e802a8af9a84e3f94ad7d4 100644 (file)
@@ -64,18 +64,18 @@ public class CairoGraphic : DrawingArea
        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
                Matrix matrix;
-               Pattern pattern;
+               SurfacePattern pattern;
                
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
 
-               image = new SurfaceImage ("data/e.png");
+               image = new ImageSurface ("data/e.png");
                w = image.Width;
                h = image.Height;
                
-               pattern = new Pattern (image);
+               pattern = new SurfacePattern (image);
                pattern.Extend = Cairo.Extend.Repeat;
                
                gr.Translate (0.5, 0.5);
index 778c33d194b7aa055ef88d244880c1941eb5f73a..ddd682c256b54e63331a372509130c4095043721 100644 (file)
@@ -71,7 +71,7 @@ namespace Gdk
                        IntPtr Xvisual = gdk_x11_visual_get_xvisual(visual);
                        IntPtr Xdrawable = gdk_x11_drawable_get_xid (x_drawable);
                        
-                       Cairo.Surface s = Cairo.Surface.CreateForXlib(Xdisplay,
+                       Cairo.XlibSurface s = new Cairo.XlibSurface (Xdisplay,
                                                                   Xdrawable,
                                                                   Xvisual,
                                                                   w, h);
index ea842d70164c878f373fca00da6e124569605242..ee7548d859b3e4b816d30cfa3072ecb5c4565ac4 100644 (file)
@@ -64,7 +64,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index b5eb38920796ad05a9da000cecc62ee12c94c1aa..ecf6277743634c9b38ad506707f0c7c97ec98cc8 100644 (file)
@@ -63,7 +63,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index 36437fe5a07f34bb69a3bcd4ee7e9491afecbc55..6c156fa4d5e20f3ec17f17944d5003a5c0a0e72f 100644 (file)
@@ -92,12 +92,12 @@ public class CairoTest
                double xc = width / 2;
                double yc = height / 2;
                
-               overlay = Surface.CreateSimilar (gr.TargetSurface, Format.ARGB32, width, height);               
-               punch = Surface.CreateSimilar (gr.TargetSurface, Format.A8, width, height);             
-               circles = Surface.CreateSimilar (gr.TargetSurface, Format.ARGB32, width, height);
+               overlay = gr.Target.CreateSimilar (Content.ColorAlpha, width, height);
+               punch = gr.Target.CreateSimilar (Content.Color, width, height);
+               circles = gr.Target.CreateSimilar (Content.ColorAlpha, width, height);
                
                gr.Save ();
-               gr.TargetSurface = overlay;
+               gr.Target = overlay;
                
                /* Draw a black circle on the overlay
                */
@@ -107,7 +107,7 @@ public class CairoTest
                oval_path (gr, xc, yc, radius, radius);
                gr.Fill ();             
                gr.Save ();
-               gr.TargetSurface =  punch;
+               gr.Target =  punch;
                
                
                /* Draw 3 circles to the punch surface, then cut
@@ -117,7 +117,8 @@ public class CairoTest
                
                gr.Restore ();
                
-               gr.Operator = Operator.OutReverse;
+               // FIXME: OutReverse is not in 1.0
+               //gr.Operator = Operator.OutReverse;
                punch.Show (gr, width, height);
                
                
@@ -126,7 +127,7 @@ public class CairoTest
                * without seams.
                */
                gr.Save ();
-               gr.TargetSurface =  circles;
+               gr.Target =  circles;
                
                //gr.Alpha = 0.5;
                gr.Operator = Operator.Over;
@@ -145,7 +146,7 @@ public class CairoTest
                
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index 84dac78540240e8dd5793bb6720eb035606cf17c..23ba79c7c78790999cd3cf9b27a65464cff5e509 100644 (file)
@@ -56,7 +56,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index cc539f7720cb57707c6e53feb42bb0569b841b6e..1cc033a4fba251d2684aa187ebddd1d8c2ff2f46 100644 (file)
@@ -37,7 +37,7 @@ public class CairoTest
        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
 
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
@@ -46,7 +46,7 @@ public class CairoTest
                gr.Clip ();
                gr.NewPath ();
 
-               image = new SurfaceImage("data/e.png");
+               image = new ImageSurface("data/e.png");
                w = image.Width;
                h = image.Height;
 
@@ -73,7 +73,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index 0b9f6ecfe78de0549b2f88a1a24e6d06767abe40..adf1d7c32ea83a8cb050b1308b9ffa05360fdca7 100644 (file)
@@ -167,7 +167,7 @@ public class CairoTest
                
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index 9122db8614cb32e2b7857bb41f8f1bea60900181..fa09b2177b6f6efb47c61eeaa92274fb3c6a710c 100644 (file)
@@ -62,7 +62,7 @@ public class CairoTest
                
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index 932cb36a15a9ea0ee9249ad762a034d4ba178fd0..dc89c3a53783b0b566a8e5b91ef7536dabffcacc 100644 (file)
@@ -40,7 +40,7 @@ public class CairoTest
                
                gr.MoveTo ( new PointD (0.5, 0.1) );
                gr.LineTo ( new PointD (0.9, 0.9) );
-               gr.RelLineTo ( new PointD (-0.4, 0.0) );
+               gr.RelLineTo ( new Distance (-0.4, 0.0) );
                gr.CurveTo ( new PointD (0.2, 0.9),
                             new PointD ( 0.2, 0.5),
                             new PointD (0.5, 0.5)
@@ -48,9 +48,9 @@ public class CairoTest
                gr.ClosePath ();
                
                gr.MoveTo ( new PointD (0.25, 0.1) );
-               gr.RelLineTo ( new PointD (0.2, 0.2) );
-               gr.RelLineTo ( new PointD ( -0.2, 0.2) );
-               gr.RelLineTo ( new PointD (-0.2, -0.2) );
+               gr.RelLineTo ( new Distance (0.2, 0.2) );
+               gr.RelLineTo ( new Distance ( -0.2, 0.2) );
+               gr.RelLineTo ( new Distance (-0.2, -0.2) );
                gr.ClosePath ();               
                
                gr.Color = new Color (0, 0, 1, 1);
@@ -61,7 +61,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index bdb24e0e65584a88efed3d9863e99f18ad8832b6..611fff39c143c595dc75f6612d1e4154d132243e 100644 (file)
@@ -40,9 +40,9 @@ public class CairoTest
        {
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
-               Pattern pat;            
+               LinearGradient pat;             
                
-               pat = new PatternLinear (0.0, 0.0,  0.0, 1.0);
+               pat = new LinearGradient (0.0, 0.0,  0.0, 1.0);
                pat.AddColorStop (1, new Color (0, 0, 0, 1) );
                pat.AddColorStop (0, new Color (1, 1, 1, 1) );
                gr.Rectangle ( new PointD (0, 0),
@@ -53,20 +53,20 @@ public class CairoTest
                gr.Fill ();
                pat.Destroy ();
 
-               pat = new PatternRadial (0.45, 0.4, 0.1,
+               RadialGradient pat2 = new RadialGradient (0.45, 0.4, 0.1,
                                     0.4,  0.4, 0.5);
                
-               pat.AddColorStop (0, new Color (1, 1, 1, 1) );
-               pat.AddColorStop (1, new Color (0, 0, 0, 1) );
-               gr.Pattern =  pat;              
+               pat2.AddColorStop (0, new Color (1, 1, 1, 1) );
+               pat2.AddColorStop (1, new Color (0, 0, 0, 1) );
+               gr.Pattern =  pat2;
                gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
                gr.Fill ();
-               pat.Destroy ();
+               pat2.Destroy ();
        }
                
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index fc0cfdf371f2d7121b76dc5df6ccdb80dbfb27de..a00084d94576414c35bd4395eb5792c6bdc1a064 100644 (file)
@@ -39,12 +39,12 @@ public class CairoTest
        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
                
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
                                
-               image = new SurfaceImage ("data/e.png");
+               image = new ImageSurface ("data/e.png");
                w = image.Width;
                h = image.Height;
                
@@ -59,7 +59,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index afc652a4726e13f2bf2de29138dda1f7c2363c4a..3dd190276ebb886aeb659832c998902f60f49a31 100644 (file)
@@ -37,18 +37,18 @@ public class CairoTest
        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
                Matrix matrix;
-               Pattern pattern;
+               SurfacePattern pattern;
                
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
 
-               image = new SurfaceImage ("data/e.png");
+               image = new ImageSurface ("data/e.png");
                w = image.Width;
                h = image.Height;
                
-               pattern = new Pattern (image);
+               pattern = new SurfacePattern (image);
                pattern.Extend = Cairo.Extend.Repeat;
                
                gr.Translate (0.5, 0.5);
@@ -73,7 +73,7 @@ public class CairoTest
                
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index 5ca06602e1613418d67bf37310f4b2b59d10623c..835eb8f5a850942dd75c05a97f0f660192fb3233 100644 (file)
@@ -135,7 +135,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
index 24e2534da7a262d774ed7efd856775bc53c32038..4916b003ef35889fb4b816bc954356f0ec376c0e 100644 (file)
@@ -61,7 +61,7 @@ public class CairoTest
        
        static void Main ()
        {               
-               Surface s = Surface.CreateForImage (Format.ARGB32, 500, 500);
+               Surface s = new ImageSurface (Format.ARGB32, 500, 500);
                Cairo.Graphics g = new Cairo.Graphics (s);
 
                draw (g, 500, 500);
diff --git a/mcs/class/Mono.Cairo/Samples/win32/arc.cs b/mcs/class/Mono.Cairo/Samples/win32/arc.cs
new file mode 100644 (file)
index 0000000..0dd73fb
--- /dev/null
@@ -0,0 +1,74 @@
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Cairo;
+using System.Windows.Forms;
+       
+public class SwfCairo : Form
+{
+       const double M_PI = Math.PI;
+               
+       static void Main ()
+       {               
+               SwfCairo f = new SwfCairo ();
+               f.ShowDialog ();
+       }
+
+       protected override void OnPaint (PaintEventArgs a)
+       {
+               IntPtr hdc = a.Graphics.GetHdc ();
+               Win32Surface s = new Win32Surface (hdc);
+               Graphics g = new Graphics (s);
+               draw (g, this.Width, this.Height);
+               
+               a.Graphics.ReleaseHdc (hdc);
+       }
+       
+       static void draw (Cairo.Graphics gr, int width, int height)
+       {
+               double xc = 0.5;
+               double yc = 0.5;
+               double radius = 0.4;
+               double angle1 = 45.0  * (M_PI/180.0);  // angles are specified
+               double angle2 = 180.0 * (M_PI/180.0);  // in radians
+               
+               gr.Scale (width, height);
+               gr.LineWidth = 0.04;
+
+               
+               gr.Arc (xc, yc, radius, angle1, angle2);
+               gr.Stroke ();
+               
+               // draw helping lines
+               gr.Color = new Color(1, 0.2, 0.2, 0.6);
+               gr.Arc (xc, yc, 0.05, 0, 2*M_PI);
+               gr.Fill ();
+               gr.LineWidth = 0.03;
+               gr.Arc (xc, yc, radius, angle1, angle1);
+               gr.LineTo (new PointD(xc, yc));
+               gr.Arc (xc, yc, radius, angle2, angle2);
+               gr.LineTo (new PointD(xc, yc));
+               gr.Stroke ();
+               
+       }
+}
+
diff --git a/mcs/class/Mono.Cairo/Samples/win32/compile.sh b/mcs/class/Mono.Cairo/Samples/win32/compile.sh
new file mode 100755 (executable)
index 0000000..97853c6
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+mcs -r:Mono.Cairo.dll -r:System.Windows.Forms.dll arc.cs
index 120656780f678e5f193b1c563f7e493c5484ab38..08f5de911c4a21f71a76dcafbb70fb37f5517059 100644 (file)
@@ -70,7 +70,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index bde9a7f779f575a90c7964c5ebec51fb64856065..4cb1211d38d7c025b5863bdead1f8449cee86354 100644 (file)
@@ -69,7 +69,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 5905b69ac8043d51f188e8b9c478c7cc4bc00674..2cd135442df53f0214213a03709dbc016ad4f0c8 100644 (file)
@@ -62,7 +62,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 2091466b15ca24109c516d3332d4618311cc7da2..f8b1364ee1b034b12e6cdb64cc4d8b8219908dbd 100644 (file)
@@ -40,7 +40,7 @@ public class X11Test
        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
                
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
@@ -49,7 +49,7 @@ public class X11Test
                gr.Clip ();
                gr.NewPath ();
                
-               image = new SurfaceImage("data/e.png");
+               image = new ImageSurface("data/e.png");
                w = image.Width;
                h = image.Height;
                
@@ -79,7 +79,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index e37533d82bf048a9026925de103588bcc8f86621..922cbf0adfd8b0b53b69771d32f1db45d6a113cb 100644 (file)
@@ -172,7 +172,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 36f0bd451d0773edc2c8842e571b9d7d85622090..aaf7112d6332e872abb8119ac20a242ebac916b2 100644 (file)
@@ -67,7 +67,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 663aaf719419fdd05b76ac55b357c262c8d4b7e3..b1275338cefae694f2d40f880e17ec2425662d40 100644 (file)
@@ -41,7 +41,7 @@ public class X11Test
                
                gr.MoveTo ( new PointD (0.5, 0.1) );
                gr.LineTo ( new PointD (0.9, 0.9) );
-               gr.RelLineTo ( new PointD (-0.4, 0.0) );
+               gr.RelLineTo ( new Distance (-0.4, 0.0) );
                gr.CurveTo ( new PointD (0.2, 0.9),
                                             new PointD ( 0.2, 0.5),
                                             new PointD (0.5, 0.5)
@@ -49,9 +49,9 @@ public class X11Test
                gr.ClosePath ();
                
                gr.MoveTo ( new PointD (0.25, 0.1) );
-               gr.RelLineTo ( new PointD (0.2, 0.2) );
-               gr.RelLineTo ( new PointD ( -0.2, 0.2) );
-               gr.RelLineTo ( new PointD (-0.2, -0.2) );
+               gr.RelLineTo ( new Distance (0.2, 0.2) );
+               gr.RelLineTo ( new Distance ( -0.2, 0.2) );
+               gr.RelLineTo ( new Distance (-0.2, -0.2) );
                gr.ClosePath ();
                
                gr.Color = new Color (0, 0, 1, 1);
@@ -67,7 +67,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 04d3bf634dd65fec9d685ea93bd9177f89fe9064..4e3598997b9badb407809350e565a16a99fbf729 100644 (file)
@@ -40,9 +40,8 @@ public class X11Test
        {
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
-               Pattern pat;
                
-               pat = new PatternLinear (0.0, 0.0,  0.0, 1.0);
+               LinearGradient pat = new LinearGradient (0.0, 0.0,  0.0, 1.0);
                pat.AddColorStop (1, new Color (0, 0, 0, 1) );
                pat.AddColorStop (0, new Color (1, 1, 1, 1) );
                gr.Rectangle ( new PointD (0, 0),
@@ -53,15 +52,15 @@ public class X11Test
                gr.Fill ();
                pat.Destroy ();
                
-               pat = new PatternRadial (0.45, 0.4, 0.1,
+               RadialGradient pat2 = new RadialGradient (0.45, 0.4, 0.1,
                                                         0.4,  0.4, 0.5);
                
-               pat.AddColorStop (0, new Color (1, 1, 1, 1) );
-               pat.AddColorStop (1, new Color (0, 0, 0, 1) );
-               gr.Pattern =  pat;
+               pat2.AddColorStop (0, new Color (1, 1, 1, 1) );
+               pat2.AddColorStop (1, new Color (0, 0, 0, 1) );
+               gr.Pattern =  pat2;
                gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
                gr.Fill ();
-               pat.Destroy ();
+               pat2.Destroy ();
        }
        
        
@@ -71,7 +70,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index b219bb1ee32fbd0c107a4fec9520842554699aaa..80b6f16076d41baa8b98a8af4baa59d2323dff29 100644 (file)
@@ -39,12 +39,12 @@ public class X11Test
         static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
                
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
                
-               image = new SurfaceImage ("data/e.png");
+               image = new ImageSurface ("data/e.png");
                w = image.Width;
                h = image.Height;
                
@@ -65,7 +65,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 2aacc1ee9f0ee4d4ec8314cd310d609765439626..4f76a25f4616a7655c321a0082b9d90c3e3b18d2 100644 (file)
@@ -39,18 +39,18 @@ public class X11Test
         static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
-               SurfaceImage image;
+               ImageSurface image;
                Matrix matrix;
-               Pattern pattern;
+               SurfacePattern pattern;
                
                gr.Scale (width, height);
                gr.LineWidth = 0.04;
                
-               image = new SurfaceImage ("data/e.png");
+               image = new ImageSurface ("data/e.png");
                w = image.Width;
                h = image.Height;
                
-               pattern = new Pattern (image);
+               pattern = new SurfacePattern (image);
                pattern.Extend = Cairo.Extend.Repeat;
                
                gr.Translate (0.5, 0.5);
@@ -81,7 +81,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 0212272d910f1554ce31b53f8116b7513a22c475..b92cf70b240c9f4b0ad767fd3bd48d1e4ef705ec 100644 (file)
@@ -67,7 +67,7 @@ public class X11Test
                
                win.Show ();
                
-               Cairo.Surface s = Cairo.Surface.CreateForXlib (win.Display,
+               Cairo.XlibSurface s = new Cairo.XlibSurface (win.Display,
                               win.XWindow,
                               X11.XDefaultVisual (win.Display, win.Screen),
                               (int)win.Width, (int)win.Height);
index 3118c134e69ba3a93cce6f3636774086f69f818a..fe24a38eb09ebc000091005e10a92c3326e9e07b 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-14  Martin Baulig  <martin@ximian.com>
+
+       * MonoSymbolTable.cs (OffsetTable): Bump version to 39.
+       (LocalVariableEntry.Index): New field.
+
+       * MonoSymbolWriter.cs
+       (MonoSymbolWriter.DefineLocalVariable): Added `int index' argument.
+
+       * MonoSymbolFile.cs
+       (MonoDebuggerSupport.GetLocalIndex): New method.
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       * MonoSymbolFile.cs (MonoDebuggerSupport): Make this internal and
+       move everything we don't need here into the debugger.
+
 2005-06-20  Chris Toshok  <toshok@ximian.com>
 
        * MonoSymbolFile.cs (MonoSymbolFile.Dispose): make public.
index 343fb930169bc84ddf19cf25fb9478c86b45f242..84e4f9c0deae69081f095ca7feb71bfbf86202a9 100644 (file)
@@ -30,6 +30,7 @@
 
 using System;
 using System.Reflection;
+using SRE = System.Reflection.Emit;
 using System.Collections;
 using System.Text;
 using System.Threading;
@@ -72,29 +73,15 @@ namespace Mono.CompilerServices.SymbolWriter
                }
        }
 
-       public class MonoDebuggerSupport
+       internal class MonoDebuggerSupport
        {
-               static GetTypeFunc get_type;
                static GetMethodTokenFunc get_method_token;
-               static GetMethodFunc get_method;
-               static GetLocalTypeFromSignatureFunc local_type_from_sig;
                static GetGuidFunc get_guid;
-               static CheckRuntimeVersionFunc check_runtime_version;
-               static GetMethodIndexFunc get_method_index;
-               static MakeArrayTypeFunc make_array_type;
-               static ResolveTypeFunc resolve_type;
-               static GetTypeTokenFunc get_type_token;
-
-               delegate Type GetTypeFunc (Assembly assembly, int token);
-               delegate int GetMethodTokenFunc (Assembly assembly, MethodBase method);
-               delegate MethodBase GetMethodFunc (Assembly assembly, int token);
-               delegate Type GetLocalTypeFromSignatureFunc (Assembly assembly, byte[] sig);
+               static GetLocalIndexFunc get_local_index;
+
+               delegate int GetMethodTokenFunc (MethodBase method);
                delegate Guid GetGuidFunc (Module module);
-               delegate string CheckRuntimeVersionFunc (string filename);
-               delegate int GetMethodIndexFunc (MethodBase method);
-               delegate Type MakeArrayTypeFunc (Type type, int rank);
-               delegate Type ResolveTypeFunc (Module module, int token);
-               delegate int GetTypeTokenFunc (Type type);
+               delegate int GetLocalIndexFunc (SRE.LocalBuilder local);
 
                static Delegate create_delegate (Type type, Type delegate_type, string name)
                {
@@ -108,74 +95,21 @@ namespace Mono.CompilerServices.SymbolWriter
 
                static MonoDebuggerSupport ()
                {
-                       get_type = (GetTypeFunc) create_delegate (
-                               typeof (Assembly), typeof (GetTypeFunc),
-                               "MonoDebugger_GetType");
-
                        get_method_token = (GetMethodTokenFunc) create_delegate (
                                typeof (Assembly), typeof (GetMethodTokenFunc),
                                "MonoDebugger_GetMethodToken");
 
-                       get_method = (GetMethodFunc) create_delegate (
-                               typeof (Assembly), typeof (GetMethodFunc),
-                               "MonoDebugger_GetMethod");
-
-                       local_type_from_sig = (GetLocalTypeFromSignatureFunc) create_delegate (
-                               typeof (Assembly), typeof (GetLocalTypeFromSignatureFunc),
-                               "MonoDebugger_GetLocalTypeFromSignature");
-
                        get_guid = (GetGuidFunc) create_delegate (
                                typeof (Module), typeof (GetGuidFunc), "Mono_GetGuid");
 
-                       check_runtime_version = (CheckRuntimeVersionFunc) create_delegate (
-                               typeof (Assembly), typeof (CheckRuntimeVersionFunc),
-                               "MonoDebugger_CheckRuntimeVersion");
-
-                       get_method_index = (GetMethodIndexFunc) create_delegate (
-                               typeof (Assembly), typeof (GetMethodIndexFunc),
-                               "MonoDebugger_GetMethodIndex");
-
-                       make_array_type = (MakeArrayTypeFunc) create_delegate (
-                               typeof (Assembly), typeof (MakeArrayTypeFunc),
-                               "MonoDebugger_MakeArrayType");
-
-                       resolve_type = (ResolveTypeFunc) create_delegate (
-                               typeof (Module), typeof (ResolveTypeFunc),
-                               "MonoDebugger_ResolveType");
-
-                       get_type_token = (GetTypeTokenFunc) create_delegate (
-                               typeof (Assembly), typeof (GetTypeTokenFunc),
-                               "MonoDebugger_GetTypeToken");
-               }
-
-               public static Type GetType (Assembly assembly, int token)
-               {
-                       return get_type (assembly, token);
+                       get_local_index = (GetLocalIndexFunc) create_delegate (
+                               typeof (SRE.LocalBuilder), typeof (GetLocalIndexFunc),
+                               "Mono_GetLocalIndex");
                }
 
                public static int GetMethodToken (MethodBase method)
                {
-                       return get_method_token (method.ReflectedType.Assembly, method);
-               }
-
-               public static MethodBase GetMethod (Assembly assembly, int token)
-               {
-                       return get_method (assembly, token);
-               }
-
-               public static Type GetLocalTypeFromSignature (Assembly assembly, byte[] sig)
-               {
-                       return local_type_from_sig (assembly, sig);
-               }
-
-               public static string CheckRuntimeVersion (string filename)
-               {
-                       return check_runtime_version (filename);
-               }
-
-               public static int GetMethodIndex (MethodBase method)
-               {
-                       return get_method_index (method);
+                       return get_method_token (method);
                }
 
                public static Guid GetGuid (Module module)
@@ -183,19 +117,9 @@ namespace Mono.CompilerServices.SymbolWriter
                        return get_guid (module);
                }
 
-               public static Type MakeArrayType (Type type, int rank)
-               {
-                       return make_array_type (type, rank);
-               }
-
-               public static Type ResolveType (Module module, int token)
-               {
-                       return resolve_type (module, token);
-               }
-
-               public static int GetTypeToken (Type type)
+               public static int GetLocalIndex (SRE.LocalBuilder local)
                {
-                       return get_type_token (type);
+                       return get_local_index (local);
                }
        }
 
index 4fadaf1e18b467e5411801c0d61b7bc920e55401..739550464f8ac7f06b7192871b04c70a25a20950 100644 (file)
@@ -71,7 +71,7 @@ namespace Mono.CompilerServices.SymbolWriter
 {
        public struct OffsetTable
        {
-               public const int  Version = 38;
+               public const int  Version = 39;
                public const long Magic   = 0x45e82623fd7fa614;
 
                #region This is actually written to the symbol file
@@ -234,13 +234,15 @@ namespace Mono.CompilerServices.SymbolWriter
        public struct LocalVariableEntry
        {
                #region This is actually written to the symbol file
+               public readonly int Index;
                public readonly string Name;
                public readonly byte[] Signature;
                public readonly int BlockIndex;
                #endregion
 
-               public LocalVariableEntry (string Name, byte[] Signature, int BlockIndex)
+               public LocalVariableEntry (int Index, string Name, byte[] Signature, int BlockIndex)
                {
+                       this.Index = Index;
                        this.Name = Name;
                        this.Signature = Signature;
                        this.BlockIndex = BlockIndex;
@@ -248,6 +250,7 @@ namespace Mono.CompilerServices.SymbolWriter
 
                internal LocalVariableEntry (MyBinaryReader reader)
                {
+                       Index = reader.ReadLeb128 ();
                        Name = reader.ReadString ();
                        int sig_length = reader.ReadLeb128 ();
                        Signature = reader.ReadBytes (sig_length);
@@ -256,6 +259,7 @@ namespace Mono.CompilerServices.SymbolWriter
 
                internal void Write (MonoSymbolFile file, MyBinaryWriter bw)
                {
+                       bw.WriteLeb128 (Index);
                        bw.Write (Name);
                        bw.WriteLeb128 ((int) Signature.Length);
                        bw.Write (Signature);
index 31314a41c67d69cd31ee74970701881cd9912696..7a38a2e10248935a1c0b0f7c3e0fcc39471b5621 100644 (file)
@@ -96,12 +96,12 @@ namespace Mono.CompilerServices.SymbolWriter
                public void CloseNamespace ()
                { }
 
-               public void DefineLocalVariable (string name, byte[] signature)
+               public void DefineLocalVariable (int index, string name, byte[] signature)
                {
                        if (current_method == null)
                                return;
 
-                       current_method.AddLocal (name, signature);
+                       current_method.AddLocal (index, name, signature);
                }
 
                public void MarkSequencePoint (int offset, int line, int column)
@@ -273,12 +273,12 @@ namespace Mono.CompilerServices.SymbolWriter
                                }
                        }
 
-                       public void AddLocal (string name, byte[] signature)
+                       public void AddLocal (int index, string name, byte[] signature)
                        {
                                if (_locals == null)
                                        _locals = new ArrayList ();
                                _locals.Add (new LocalVariableEntry (
-                                                    name, signature, CurrentBlock.Index));
+                                                    index, name, signature, CurrentBlock.Index));
                        }
 
                        public ISourceFile SourceFile {
index 35f7cd8dff4e16a5bf73e722f3c20c8c11490855..4d4bc83a0a3637274085765188ad52c4854aad81 100644 (file)
@@ -46,6 +46,7 @@ namespace Mono.CompilerServices.SymbolWriter
                delegate Guid GetGuidFunc (ModuleBuilder mb);
                GetGuidFunc get_guid_func;
                
+               int nextLocalIndex;
                int currentToken;
                string methodName;
                Stack namespaceStack = new Stack ();
@@ -76,6 +77,7 @@ namespace Mono.CompilerServices.SymbolWriter
                {
                        if (methodOpened) {
                                methodOpened = false;
+                               nextLocalIndex = 0;
                                msw.CloseMethod ();
                        }
                }
@@ -139,7 +141,7 @@ namespace Mono.CompilerServices.SymbolWriter
                        int startOffset,
                        int endOffset)
                {
-                       msw.DefineLocalVariable (name, signature);
+                       msw.DefineLocalVariable (nextLocalIndex++, name, signature);
                }
                
                public void DefineParameter (
index 5fd338d15f245a819c7ea7e9955ad0b22ffecd99..8914d43621c1871859d9815205e3af5d237f543f 100644 (file)
@@ -3,21 +3,23 @@ SUBDIRS =
 include ../../build/rules.make
 
 LIBRARY = Mono.Posix.dll
-LIB_MCS_FLAGS = /unsafe /r:$(corlib) /r:System.dll
+# Don't warn about [Obsolete] members, as there are now *lots* of [Obsolete]
+# members, generating volumes of output.
+LIB_MCS_FLAGS = /unsafe /r:$(corlib) /r:System.dll /nowarn:0618
 TEST_MCS_FLAGS = /r:Mono.Posix.dll /r:System.dll /nowarn:0219,0618
 
 include ../../build/library.make
 
-EXTRA_DISTFILES = Mono.Unix/make-map.cs
+EXTRA_DISTFILES = Mono.Unix.Native/make-map.cs
 
-all-local: Mono.Unix/make-map.exe 
+all-local: Mono.Unix.Native/make-map.exe 
 
-Mono.Unix/make-map.exe: Mono.Unix/make-map.cs $(the_lib)
-       cp $(the_lib) Mono.Unix/
+Mono.Unix.Native/make-map.exe: Mono.Unix.Native/make-map.cs $(the_lib)
+       cp $(the_lib) Mono.Unix.Native/
 ifneq ($(PLATFORM),win32)
-       $(CSCOMPILE)  -out:Mono.Unix/make-map.exe -r:Mono.Posix.dll Mono.Unix/make-map.cs
+       $(CSCOMPILE) -debug+ -out:Mono.Unix.Native/make-map.exe -r:Mono.Posix.dll Mono.Unix.Native/make-map.cs
 else
-       $(CSCOMPILE)  -out:Mono.Unix/make-map.exe -r:Mono.Posix.dll Mono.Unix\\make-map.cs
+       $(CSCOMPILE) -debug+ -out:Mono.Unix.Native/make-map.exe -r:Mono.Posix.dll Mono.Unix.Native\\make-map.cs
 endif
 
-CLEAN_FILES = Mono.Unix/make-map.exe Mono.Unix/Mono.Posix.dll
+CLEAN_FILES = Mono.Unix.Native/make-map.exe Mono.Unix.Native/Mono.Posix.dll
index e51d826041bd81fa4d5969fd1bb6717ad2746820..839569fc527423d3af4b719e8596223f81d52da5 100644 (file)
 ./Mono.Unix/UnixSymbolicLinkInfo.cs
 ./Mono.Unix/UnixUser.cs
 ./Mono.Unix/UnixUserInfo.cs
+./Mono.Unix.Native/CdeclFunction.cs
+./Mono.Unix.Native/HeaderAttribute.cs
+./Mono.Unix.Native/NativeConvert.cs
+./Mono.Unix.Native/NativeConvert.generated.cs
+./Mono.Unix.Native/Stdlib.cs
+./Mono.Unix.Native/Syscall.cs
 ./Mono.Posix/Catalog.cs
 ./Mono.Posix/PeerCred.cs
 ./Mono.Posix/Syscall.cs
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/CdeclFunction.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/CdeclFunction.cs
new file mode 100644 (file)
index 0000000..d60e4ce
--- /dev/null
@@ -0,0 +1,188 @@
+//
+// Mono.Unix/CdeclFunction.cs
+//
+// Authors:
+//   Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2004 Jonathan Pryor
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Mono.Unix.Native {
+
+       // This class represents a single unmanaged function with "cdecl" calling
+       // convention -- that is, it can accept a variable number of arguments which
+       // are passed on the runtime stack.
+       //
+       // To use, create an instance:
+       //
+       //    CdeclFunction printf = new CdeclFunction ("the library", 
+       //        "the function name", /* optional */ typeof (ReturnType));
+       //
+       // Then call the Invoke method with the appropriate number of arguments:
+       //
+       //    printf.Invoke (new object[]{"hello, %s\n", "world!"});
+       //
+       // In the background a P/Invoke definition for the method with the
+       // requested argument types will be generated and invoked, invoking the
+       // unmanaged function.  The generated methods are cached, so that subsequent
+       // calls with the same argument list do not generate new code, speeding up
+       // the call sequence.
+       //
+       // Invoking Cdecl functions is not guaranteed to be portable across all 
+       // platforms.  For example, AMD64 requires that the caller set EAX to the 
+       // number of floating point arguments passed in the SSE registers.  This 
+       // is only required for variable argument/cdecl functions; consequently, 
+       // the overload technique used by this class wouldn't normally work.  
+       // Mono's AMD64 JIT works around this by always setting EAX on P/Invoke
+       // invocations, allowing CdeclFunction to work properly, but it will not
+       // necessarily always work.  See also: 
+       //
+       //     http://lwn.net/Articles/5201/?format=printable
+       //
+       // Due to potential portability issues, cdecl functions should be avoided 
+       // on most platforms.
+       //
+       // This class is intended to be thread-safe.
+       public sealed class CdeclFunction
+       {
+               // The readonly fields (1) shouldn't be modified, and (2) should only be
+               // used when `overloads' is locked.
+               private readonly string library;
+               private readonly string method;
+               private readonly Type returnType;
+               private readonly AssemblyName assemblyName;
+               private readonly AssemblyBuilder assemblyBuilder;
+               private readonly ModuleBuilder moduleBuilder;
+
+               private Hashtable overloads;
+
+               public CdeclFunction (string library, string method)
+                       : this (library, method, typeof(void))
+               {
+               }
+
+               public CdeclFunction (string library, string method, Type returnType)
+               {
+                       this.library = library;
+                       this.method = method;
+                       this.returnType = returnType;
+                       this.overloads = new Hashtable ();
+                       this.assemblyName = new AssemblyName ();
+                       this.assemblyName.Name = "Mono.Posix.Imports." + library;
+                       this.assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (
+                                       assemblyName, AssemblyBuilderAccess.Run);
+                       this.moduleBuilder = assemblyBuilder.DefineDynamicModule (assemblyName.Name);
+               }
+
+               public object Invoke (object[] parameters)
+               {
+                       Type[] parameterTypes = GetParameterTypes (parameters);
+                       MethodInfo m = CreateMethod (parameterTypes);
+                       return m.Invoke (null, parameters);
+               }
+
+               private MethodInfo CreateMethod (Type[] parameterTypes)
+               {
+                       string typeName = GetTypeName (parameterTypes);
+
+                       lock (overloads) {
+                               MethodInfo mi = (MethodInfo) overloads [typeName];
+
+                               if (mi != null) {
+                                       return mi;
+                               }
+
+                               TypeBuilder tb = CreateType (typeName);
+                               /* MethodBuilder mb = */ tb.DefinePInvokeMethod (
+                                               method, 
+                                               library, 
+                                               MethodAttributes.PinvokeImpl | MethodAttributes.Static | MethodAttributes.Public,
+                                               CallingConventions.Standard, 
+                                               returnType, 
+                                               parameterTypes, 
+                                               CallingConvention.Cdecl,
+                                               CharSet.Ansi);
+                               mi = tb.CreateType ().GetMethod (method);
+                               overloads.Add (typeName, mi);
+                               return mi;
+                       }
+               }
+
+               private TypeBuilder CreateType (string typeName)
+               {
+                       return moduleBuilder.DefineType (typeName, TypeAttributes.Public);
+               }
+
+               private static Type GetMarshalType (Type t)
+               {
+                       switch (Type.GetTypeCode (t)) {
+                               // types < sizeof(int) are marshaled as ints
+                               case TypeCode.Boolean: case TypeCode.Char: case TypeCode.SByte: 
+                               case TypeCode.Int16: case TypeCode.Int32: 
+                                       return typeof(int);
+                               case TypeCode.Byte: case TypeCode.UInt16: case TypeCode.UInt32:
+                                       return typeof(uint);
+                               case TypeCode.Int64:
+                                       return typeof(long);
+                               case TypeCode.UInt64:
+                                       return typeof(ulong);
+                               case TypeCode.Single: case TypeCode.Double:
+                                       return typeof(double);
+                               default:
+                                       return t;
+                       }
+               }
+
+               private string GetTypeName (Type[] parameterTypes)
+               {
+                       StringBuilder sb = new StringBuilder ();
+
+                       sb.Append ("[").Append (library).Append ("] ").Append (method);
+                       sb.Append ("(");
+
+                       if (parameterTypes.Length > 0)
+                               sb.Append (parameterTypes [0]);
+                       for (int i = 1; i < parameterTypes.Length; ++i)
+                               sb.Append (",").Append (parameterTypes [i]);
+
+                       sb.Append (") : ").Append (returnType.FullName);
+
+                       return sb.ToString ();
+               }
+
+               private static Type[] GetParameterTypes (object[] parameters)
+               {
+                       Type[] parameterTypes = new Type [parameters.Length];
+                       for (int i = 0; i < parameters.Length; ++i)
+                               parameterTypes [i] = GetMarshalType (parameters [i].GetType ());
+                       return parameterTypes;
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/ChangeLog b/mcs/class/Mono.Posix/Mono.Unix.Native/ChangeLog
new file mode 100644 (file)
index 0000000..12a3413
--- /dev/null
@@ -0,0 +1,20 @@
+2005-09-20  Jonathan Pryor <jonpryor@vt.edu>
+
+       * ChangeLog: Started.
+       * CdeclFunction.cs: Copied from ../Mono.Unix; change namespace.
+       * HeaderAttribute.cs: Added
+       * make-map.cs: Copied from ../Mono.Unix; sort type and member names in
+         output (makes for a more stable svn history, as types/members won't change
+         position anymore within generated code); look for HeaderAttribute not
+         IncludeAttribute for getting headers & #defines; generate NativeConvert
+         partial class.
+       * NativeConvert.cs: Copied from ../Mono.Unix; change namespace; turn into a
+         partial class; Remove generated code (generated code is in
+         NativeConvert.generated.cs).
+       * NativeConvert.generated.cs: Added
+       * Stdlib.cs: Copied from ../Mono.Unix; change namespace; rename Error to
+         Errno (as Error is a "reserved word" in FxCop); [CLSCompliant(false)]
+         support.
+       * Syscall.cs: Use HeaderAttribute, not IncludeAttribute, for CLS compliance; 
+         add [CLSCompliant(false)] as needed; use NativeConvert, not UnixConvert.
+
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/HeaderAttribute.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/HeaderAttribute.cs
new file mode 100644 (file)
index 0000000..50f6ac4
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// IncludeAttribute.cs
+//
+// Author:
+//   Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) Novell, Inc.  
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Mono.Unix.Native {
+
+       [AttributeUsage (AttributeTargets.Assembly)]
+       internal class HeaderAttribute : Attribute {
+               string includes = "";
+               string defines = "";
+               
+               public string Includes {
+                       get {return includes;}
+                       set {includes = value;}
+               }
+
+               public string Defines {
+                       get {return defines;}
+                       set {defines = value;}
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.cs
new file mode 100644 (file)
index 0000000..8076676
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * This file was automatically generated by make-map from Mono.Posix.dll.
+ *
+ * DO NOT MODIFY.
+ */
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using Mono.Unix.Native;
+
+namespace Mono.Unix.Native {
+
+       [CLSCompliant (false)]
+       public sealed /* static */ partial class NativeConvert
+       {
+               //
+               // Non-generated exports
+               //
+
+               // convert from octal representation.
+               public static FilePermissions FromOctalPermissionString (string value)
+               {
+                       uint n = Convert.ToUInt32 (value, 8);
+                       return ToFilePermissions (n);
+               }
+
+               public static string ToOctalPermissionString (FilePermissions value)
+               {
+                       string s = Convert.ToString ((int) (value & ~FilePermissions.S_IFMT), 8);
+                       return new string ('0', 4-s.Length) + s;
+               }
+
+               public static FilePermissions FromUnixPermissionString (string value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       if (value.Length != 9 && value.Length != 10)
+                               throw new ArgumentException ("value", "must contain 9 or 10 characters");
+
+                       int i = 0;
+                       FilePermissions perms = new FilePermissions ();
+
+                       if (value.Length == 10) {
+                               perms |= GetUnixPermissionDevice (value [i]);
+                               ++i;
+                       }
+
+                       perms |= GetUnixPermissionGroup (
+                               value [i++], FilePermissions.S_IRUSR,
+                               value [i++], FilePermissions.S_IWUSR,
+                               value [i++], FilePermissions.S_IXUSR,
+                               's', 'S', FilePermissions.S_ISUID);
+
+                       perms |= GetUnixPermissionGroup (
+                               value [i++], FilePermissions.S_IRGRP,
+                               value [i++], FilePermissions.S_IWGRP,
+                               value [i++], FilePermissions.S_IXGRP,
+                               's', 'S', FilePermissions.S_ISGID);
+
+                       perms |= GetUnixPermissionGroup (
+                               value [i++], FilePermissions.S_IROTH,
+                               value [i++], FilePermissions.S_IWOTH,
+                               value [i++], FilePermissions.S_IXOTH,
+                               't', 'T', FilePermissions.S_ISVTX);
+
+                       return perms;
+               }
+
+               private static FilePermissions GetUnixPermissionDevice (char value)
+               {
+                       switch (value) {
+                       case 'd': return FilePermissions.S_IFDIR;
+                       case 'c': return FilePermissions.S_IFCHR;
+                       case 'b': return FilePermissions.S_IFBLK;
+                       case '-': return FilePermissions.S_IFREG;
+                       case 'p': return FilePermissions.S_IFIFO;
+                       case 'l': return FilePermissions.S_IFLNK;
+                       case 's': return FilePermissions.S_IFSOCK;
+                       }
+                       throw new ArgumentException ("value", "invalid device specification: " + 
+                               value);
+               }
+
+               private static FilePermissions GetUnixPermissionGroup (
+                       char read, FilePermissions readb, 
+                       char write, FilePermissions writeb, 
+                       char exec, FilePermissions execb,
+                       char xboth, char xbitonly, FilePermissions xbit)
+               {
+                       FilePermissions perms = new FilePermissions ();
+                       if (read == 'r')
+                               perms |= readb;
+                       if (write == 'w')
+                               perms |= writeb;
+                       if (exec == 'x')
+                               perms |= execb;
+                       else if (exec == xbitonly)
+                               perms |= xbit;
+                       else if (exec == xboth)
+                               perms |= (execb | xbit);
+                       return perms;
+               }
+
+               // Create ls(1) drwxrwxrwx permissions display
+               public static string ToUnixPermissionString (FilePermissions value)
+               {
+                       char [] access = new char[] {
+                               '-',            // device
+                               '-', '-', '-',  // owner
+                               '-', '-', '-',  // group
+                               '-', '-', '-',  // other
+                       };
+                       bool have_device = true;
+                       switch (value & FilePermissions.S_IFMT) {
+                               case FilePermissions.S_IFDIR:   access [0] = 'd'; break;
+                               case FilePermissions.S_IFCHR:   access [0] = 'c'; break;
+                               case FilePermissions.S_IFBLK:   access [0] = 'b'; break;
+                               case FilePermissions.S_IFREG:   access [0] = '-'; break;
+                               case FilePermissions.S_IFIFO:   access [0] = 'p'; break;
+                               case FilePermissions.S_IFLNK:   access [0] = 'l'; break;
+                               case FilePermissions.S_IFSOCK:  access [0] = 's'; break;
+                               default:                        have_device = false; break;
+                       }
+                       SetUnixPermissionGroup (value, access, 1, 
+                               FilePermissions.S_IRUSR, FilePermissions.S_IWUSR, FilePermissions.S_IXUSR,
+                               's', 'S', FilePermissions.S_ISUID);
+                       SetUnixPermissionGroup (value, access, 4, 
+                               FilePermissions.S_IRGRP, FilePermissions.S_IWGRP, FilePermissions.S_IXGRP,
+                               's', 'S', FilePermissions.S_ISGID);
+                       SetUnixPermissionGroup (value, access, 7, 
+                               FilePermissions.S_IROTH, FilePermissions.S_IWOTH, FilePermissions.S_IXOTH,
+                               't', 'T', FilePermissions.S_ISVTX);
+                       return have_device 
+                               ? new string (access)
+                               : new string (access, 1, 9);
+               }
+
+               private static void SetUnixPermissionGroup (FilePermissions value,
+                       char[] access, int index,
+                       FilePermissions read, FilePermissions write, FilePermissions exec,
+                       char both, char setonly, FilePermissions setxbit)
+               {
+                       if (UnixFileSystemInfo.IsType (value, read))
+                               access [index] = 'r';
+                       if (UnixFileSystemInfo.IsType (value, write))
+                               access [index+1] = 'w';
+                       access [index+2] = GetSymbolicMode (value, exec, both, setonly, setxbit);
+               }
+
+               // Implement the GNU ls(1) permissions spec; see `info coreutils ls`,
+               // section 10.1.2, the `-l' argument information.
+               private static char GetSymbolicMode (FilePermissions value, 
+                       FilePermissions xbit, char both, char setonly, FilePermissions setxbit)
+               {
+                       bool is_x  = UnixFileSystemInfo.IsType (value, xbit);
+                       bool is_sx = UnixFileSystemInfo.IsType (value, setxbit);
+                       
+                       if (is_x && is_sx)
+                               return both;
+                       if (is_sx)
+                               return setonly;
+                       if (is_x)
+                               return 'x';
+                       return '-';
+               }
+
+               public static readonly DateTime LocalUnixEpoch = 
+                       new DateTime (1970, 1, 1).ToLocalTime();
+
+               public static DateTime ToDateTime (long time)
+               {
+                       return FromTimeT (time);
+               }
+
+               public static long FromDateTime (DateTime time)
+               {
+                       return ToTimeT (time);
+               }
+
+               public static DateTime FromTimeT (long time)
+               {
+                       DateTime r = LocalUnixEpoch.AddSeconds (time);
+                       return r;
+               }
+
+               public static long ToTimeT (DateTime time)
+               {
+                       return (long) time.Subtract (LocalUnixEpoch).TotalSeconds;
+               }
+
+               public static OpenFlags ToOpenFlags (FileMode mode, FileAccess access)
+               {
+                       OpenFlags flags = 0;
+                       switch (mode) {
+                       case FileMode.CreateNew:
+                               flags = OpenFlags.O_CREAT | OpenFlags.O_EXCL;
+                               break;
+                       case FileMode.Create:
+                               flags = OpenFlags.O_CREAT | OpenFlags.O_TRUNC;
+                               break;
+                       case FileMode.Open:
+                               // do nothing
+                               break;
+                       case FileMode.OpenOrCreate:
+                               flags = OpenFlags.O_CREAT;
+                               break;
+                       case FileMode.Truncate:
+                               flags = OpenFlags.O_TRUNC;
+                               break;
+                       case FileMode.Append:
+                               flags = OpenFlags.O_APPEND;
+                               break;
+                       default:
+                               throw new ArgumentException (Locale.GetText ("Unsupported mode value"), "mode");
+                       }
+
+                       // Is O_LARGEFILE supported?
+                       int _v;
+                       if (TryFromOpenFlags (OpenFlags.O_LARGEFILE, out _v))
+                               flags |= OpenFlags.O_LARGEFILE;
+
+                       switch (access) {
+                       case FileAccess.Read:
+                               flags |= OpenFlags.O_RDONLY;
+                               break;
+                       case FileAccess.Write:
+                               flags |= OpenFlags.O_WRONLY;
+                               break;
+                       case FileAccess.ReadWrite:
+                               flags |= OpenFlags.O_RDWR;
+                               break;
+                       default:
+                               throw new ArgumentOutOfRangeException (Locale.GetText ("Unsupported access value"), "access");
+                       }
+
+                       return flags;
+               }
+
+               public static string ToFopenMode (FileAccess access)
+               {
+                       switch (access) {
+                               case FileAccess.Read:       return "rb";
+                               case FileAccess.Write:      return "wb";
+                               case FileAccess.ReadWrite:  return "r+b";
+                               default:                    throw new ArgumentOutOfRangeException ("access");
+                       }
+               }
+
+               public static string ToFopenMode (FileMode mode)
+               {
+                       switch (mode) {
+                               case FileMode.CreateNew: case FileMode.Create:        return "w+b";
+                               case FileMode.Open:      case FileMode.OpenOrCreate:  return "r+b";
+                               case FileMode.Truncate: return "w+b";
+                               case FileMode.Append:   return "a+b";
+                               default:                throw new ArgumentOutOfRangeException ("mode");
+                       }
+               }
+
+               private static readonly string[][] fopen_modes = new string[][]{
+                       //                                         Read                       Write ReadWrite
+                       /*    FileMode.CreateNew: */  new string[]{"Can't Read+Create",       "wb", "w+b"},
+                       /*       FileMode.Create: */  new string[]{"Can't Read+Create",       "wb", "w+b"},
+                       /*         FileMode.Open: */  new string[]{"rb",                      "wb", "r+b"},
+                       /* FileMode.OpenOrCreate: */  new string[]{"rb",                      "wb", "r+b"},
+                       /*     FileMode.Truncate: */  new string[]{"Cannot Truncate and Read","wb", "w+b"},
+                       /*       FileMode.Append: */  new string[]{"Cannot Append and Read",  "ab", "a+b"},
+               };
+
+               public static string ToFopenMode (FileMode mode, FileAccess access)
+               {
+                       int fm = -1, fa = -1;
+                       switch (mode) {
+                               case FileMode.CreateNew:    fm = 0; break;
+                               case FileMode.Create:       fm = 1; break;
+                               case FileMode.Open:         fm = 2; break;
+                               case FileMode.OpenOrCreate: fm = 3; break;
+                               case FileMode.Truncate:     fm = 4; break;
+                               case FileMode.Append:       fm = 5; break;
+                       }
+                       switch (access) {
+                               case FileAccess.Read:       fa = 0; break;
+                               case FileAccess.Write:      fa = 1; break;
+                               case FileAccess.ReadWrite:  fa = 2; break;
+                       }
+
+                       if (fm == -1)
+                               throw new ArgumentOutOfRangeException ("mode");
+                       if (fa == -1)
+                               throw new ArgumentOutOfRangeException ("access");
+
+                       string fopen_mode = fopen_modes [fm][fa];
+                       if (fopen_mode [0] != 'r' && fopen_mode [0] != 'w' && fopen_mode [0] != 'a')
+                               throw new ArgumentException (fopen_mode);
+                       return fopen_mode;
+               }
+       }
+}
+
+// vim: noexpandtab
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.generated.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/NativeConvert.generated.cs
new file mode 100644 (file)
index 0000000..db47116
--- /dev/null
@@ -0,0 +1,928 @@
+/*
+ * This file was automatically generated by make-map from Mono.Posix.dll.
+ *
+ * DO NOT MODIFY.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Mono.Unix.Native;
+
+namespace Mono.Unix.Native {
+
+       [CLSCompliant (false)]
+       public sealed /* static */ partial class NativeConvert
+       {
+               private NativeConvert () {}
+
+               private const string LIB = "MonoPosixHelper";
+
+               private static void ThrowArgumentException (object value)
+               {
+                       throw new ArgumentOutOfRangeException ("value", value,
+                               Locale.GetText ("Current platform doesn't support this value."));
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromError")]
+               private static extern int FromError (Error value, out Int32 rval);
+
+               [Obsolete ("Use Mono.Unix.Native.Errno")]
+               public static bool TryFromError (Error value, out Int32 rval)
+               {
+                       return FromError (value, out rval) == 0;
+               }
+
+               [Obsolete ("Use Mono.Unix.Native.Errno")]
+               public static Int32 FromError (Error value)
+               {
+                       Int32 rval;
+                       if (FromError (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToError")]
+               private static extern int ToError (Int32 value, out Error rval);
+
+               [Obsolete ("Use Mono.Unix.Native.Errno")]
+               public static bool TryToError (Int32 value, out Error rval)
+               {
+                       return ToError (value, out rval) == 0;
+               }
+
+               [Obsolete ("Use Mono.Unix.Native.Errno")]
+               public static Error ToError (Int32 value)
+               {
+                       Error rval;
+                       if (ToError (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromAccessModes")]
+               private static extern int FromAccessModes (AccessModes value, out Int32 rval);
+
+               public static bool TryFromAccessModes (AccessModes value, out Int32 rval)
+               {
+                       return FromAccessModes (value, out rval) == 0;
+               }
+
+               public static Int32 FromAccessModes (AccessModes value)
+               {
+                       Int32 rval;
+                       if (FromAccessModes (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToAccessModes")]
+               private static extern int ToAccessModes (Int32 value, out AccessModes rval);
+
+               public static bool TryToAccessModes (Int32 value, out AccessModes rval)
+               {
+                       return ToAccessModes (value, out rval) == 0;
+               }
+
+               public static AccessModes ToAccessModes (Int32 value)
+               {
+                       AccessModes rval;
+                       if (ToAccessModes (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromConfStr")]
+               private static extern int FromConfStr (ConfStr value, out Int32 rval);
+
+               public static bool TryFromConfStr (ConfStr value, out Int32 rval)
+               {
+                       return FromConfStr (value, out rval) == 0;
+               }
+
+               public static Int32 FromConfStr (ConfStr value)
+               {
+                       Int32 rval;
+                       if (FromConfStr (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToConfStr")]
+               private static extern int ToConfStr (Int32 value, out ConfStr rval);
+
+               public static bool TryToConfStr (Int32 value, out ConfStr rval)
+               {
+                       return ToConfStr (value, out rval) == 0;
+               }
+
+               public static ConfStr ToConfStr (Int32 value)
+               {
+                       ConfStr rval;
+                       if (ToConfStr (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromDirectoryNotifyFlags")]
+               private static extern int FromDirectoryNotifyFlags (DirectoryNotifyFlags value, out Int32 rval);
+
+               public static bool TryFromDirectoryNotifyFlags (DirectoryNotifyFlags value, out Int32 rval)
+               {
+                       return FromDirectoryNotifyFlags (value, out rval) == 0;
+               }
+
+               public static Int32 FromDirectoryNotifyFlags (DirectoryNotifyFlags value)
+               {
+                       Int32 rval;
+                       if (FromDirectoryNotifyFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToDirectoryNotifyFlags")]
+               private static extern int ToDirectoryNotifyFlags (Int32 value, out DirectoryNotifyFlags rval);
+
+               public static bool TryToDirectoryNotifyFlags (Int32 value, out DirectoryNotifyFlags rval)
+               {
+                       return ToDirectoryNotifyFlags (value, out rval) == 0;
+               }
+
+               public static DirectoryNotifyFlags ToDirectoryNotifyFlags (Int32 value)
+               {
+                       DirectoryNotifyFlags rval;
+                       if (ToDirectoryNotifyFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromErrno")]
+               private static extern int FromErrno (Errno value, out Int32 rval);
+
+               public static bool TryFromErrno (Errno value, out Int32 rval)
+               {
+                       return FromErrno (value, out rval) == 0;
+               }
+
+               public static Int32 FromErrno (Errno value)
+               {
+                       Int32 rval;
+                       if (FromErrno (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToErrno")]
+               private static extern int ToErrno (Int32 value, out Errno rval);
+
+               public static bool TryToErrno (Int32 value, out Errno rval)
+               {
+                       return ToErrno (value, out rval) == 0;
+               }
+
+               public static Errno ToErrno (Int32 value)
+               {
+                       Errno rval;
+                       if (ToErrno (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromFcntlCommand")]
+               private static extern int FromFcntlCommand (FcntlCommand value, out Int32 rval);
+
+               public static bool TryFromFcntlCommand (FcntlCommand value, out Int32 rval)
+               {
+                       return FromFcntlCommand (value, out rval) == 0;
+               }
+
+               public static Int32 FromFcntlCommand (FcntlCommand value)
+               {
+                       Int32 rval;
+                       if (FromFcntlCommand (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToFcntlCommand")]
+               private static extern int ToFcntlCommand (Int32 value, out FcntlCommand rval);
+
+               public static bool TryToFcntlCommand (Int32 value, out FcntlCommand rval)
+               {
+                       return ToFcntlCommand (value, out rval) == 0;
+               }
+
+               public static FcntlCommand ToFcntlCommand (Int32 value)
+               {
+                       FcntlCommand rval;
+                       if (ToFcntlCommand (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromFilePermissions")]
+               private static extern int FromFilePermissions (FilePermissions value, out UInt32 rval);
+
+               public static bool TryFromFilePermissions (FilePermissions value, out UInt32 rval)
+               {
+                       return FromFilePermissions (value, out rval) == 0;
+               }
+
+               public static UInt32 FromFilePermissions (FilePermissions value)
+               {
+                       UInt32 rval;
+                       if (FromFilePermissions (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToFilePermissions")]
+               private static extern int ToFilePermissions (UInt32 value, out FilePermissions rval);
+
+               public static bool TryToFilePermissions (UInt32 value, out FilePermissions rval)
+               {
+                       return ToFilePermissions (value, out rval) == 0;
+               }
+
+               public static FilePermissions ToFilePermissions (UInt32 value)
+               {
+                       FilePermissions rval;
+                       if (ToFilePermissions (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromLockType")]
+               private static extern int FromLockType (LockType value, out Int16 rval);
+
+               public static bool TryFromLockType (LockType value, out Int16 rval)
+               {
+                       return FromLockType (value, out rval) == 0;
+               }
+
+               public static Int16 FromLockType (LockType value)
+               {
+                       Int16 rval;
+                       if (FromLockType (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToLockType")]
+               private static extern int ToLockType (Int16 value, out LockType rval);
+
+               public static bool TryToLockType (Int16 value, out LockType rval)
+               {
+                       return ToLockType (value, out rval) == 0;
+               }
+
+               public static LockType ToLockType (Int16 value)
+               {
+                       LockType rval;
+                       if (ToLockType (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromLockfCommand")]
+               private static extern int FromLockfCommand (LockfCommand value, out Int32 rval);
+
+               public static bool TryFromLockfCommand (LockfCommand value, out Int32 rval)
+               {
+                       return FromLockfCommand (value, out rval) == 0;
+               }
+
+               public static Int32 FromLockfCommand (LockfCommand value)
+               {
+                       Int32 rval;
+                       if (FromLockfCommand (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToLockfCommand")]
+               private static extern int ToLockfCommand (Int32 value, out LockfCommand rval);
+
+               public static bool TryToLockfCommand (Int32 value, out LockfCommand rval)
+               {
+                       return ToLockfCommand (value, out rval) == 0;
+               }
+
+               public static LockfCommand ToLockfCommand (Int32 value)
+               {
+                       LockfCommand rval;
+                       if (ToLockfCommand (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromMlockallFlags")]
+               private static extern int FromMlockallFlags (MlockallFlags value, out Int32 rval);
+
+               public static bool TryFromMlockallFlags (MlockallFlags value, out Int32 rval)
+               {
+                       return FromMlockallFlags (value, out rval) == 0;
+               }
+
+               public static Int32 FromMlockallFlags (MlockallFlags value)
+               {
+                       Int32 rval;
+                       if (FromMlockallFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToMlockallFlags")]
+               private static extern int ToMlockallFlags (Int32 value, out MlockallFlags rval);
+
+               public static bool TryToMlockallFlags (Int32 value, out MlockallFlags rval)
+               {
+                       return ToMlockallFlags (value, out rval) == 0;
+               }
+
+               public static MlockallFlags ToMlockallFlags (Int32 value)
+               {
+                       MlockallFlags rval;
+                       if (ToMlockallFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromMmapFlags")]
+               private static extern int FromMmapFlags (MmapFlags value, out Int32 rval);
+
+               public static bool TryFromMmapFlags (MmapFlags value, out Int32 rval)
+               {
+                       return FromMmapFlags (value, out rval) == 0;
+               }
+
+               public static Int32 FromMmapFlags (MmapFlags value)
+               {
+                       Int32 rval;
+                       if (FromMmapFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToMmapFlags")]
+               private static extern int ToMmapFlags (Int32 value, out MmapFlags rval);
+
+               public static bool TryToMmapFlags (Int32 value, out MmapFlags rval)
+               {
+                       return ToMmapFlags (value, out rval) == 0;
+               }
+
+               public static MmapFlags ToMmapFlags (Int32 value)
+               {
+                       MmapFlags rval;
+                       if (ToMmapFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromMmapProts")]
+               private static extern int FromMmapProts (MmapProts value, out Int32 rval);
+
+               public static bool TryFromMmapProts (MmapProts value, out Int32 rval)
+               {
+                       return FromMmapProts (value, out rval) == 0;
+               }
+
+               public static Int32 FromMmapProts (MmapProts value)
+               {
+                       Int32 rval;
+                       if (FromMmapProts (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToMmapProts")]
+               private static extern int ToMmapProts (Int32 value, out MmapProts rval);
+
+               public static bool TryToMmapProts (Int32 value, out MmapProts rval)
+               {
+                       return ToMmapProts (value, out rval) == 0;
+               }
+
+               public static MmapProts ToMmapProts (Int32 value)
+               {
+                       MmapProts rval;
+                       if (ToMmapProts (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromMountFlags")]
+               private static extern int FromMountFlags (MountFlags value, out UInt64 rval);
+
+               public static bool TryFromMountFlags (MountFlags value, out UInt64 rval)
+               {
+                       return FromMountFlags (value, out rval) == 0;
+               }
+
+               public static UInt64 FromMountFlags (MountFlags value)
+               {
+                       UInt64 rval;
+                       if (FromMountFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToMountFlags")]
+               private static extern int ToMountFlags (UInt64 value, out MountFlags rval);
+
+               public static bool TryToMountFlags (UInt64 value, out MountFlags rval)
+               {
+                       return ToMountFlags (value, out rval) == 0;
+               }
+
+               public static MountFlags ToMountFlags (UInt64 value)
+               {
+                       MountFlags rval;
+                       if (ToMountFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromMremapFlags")]
+               private static extern int FromMremapFlags (MremapFlags value, out UInt64 rval);
+
+               public static bool TryFromMremapFlags (MremapFlags value, out UInt64 rval)
+               {
+                       return FromMremapFlags (value, out rval) == 0;
+               }
+
+               public static UInt64 FromMremapFlags (MremapFlags value)
+               {
+                       UInt64 rval;
+                       if (FromMremapFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToMremapFlags")]
+               private static extern int ToMremapFlags (UInt64 value, out MremapFlags rval);
+
+               public static bool TryToMremapFlags (UInt64 value, out MremapFlags rval)
+               {
+                       return ToMremapFlags (value, out rval) == 0;
+               }
+
+               public static MremapFlags ToMremapFlags (UInt64 value)
+               {
+                       MremapFlags rval;
+                       if (ToMremapFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromMsyncFlags")]
+               private static extern int FromMsyncFlags (MsyncFlags value, out Int32 rval);
+
+               public static bool TryFromMsyncFlags (MsyncFlags value, out Int32 rval)
+               {
+                       return FromMsyncFlags (value, out rval) == 0;
+               }
+
+               public static Int32 FromMsyncFlags (MsyncFlags value)
+               {
+                       Int32 rval;
+                       if (FromMsyncFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToMsyncFlags")]
+               private static extern int ToMsyncFlags (Int32 value, out MsyncFlags rval);
+
+               public static bool TryToMsyncFlags (Int32 value, out MsyncFlags rval)
+               {
+                       return ToMsyncFlags (value, out rval) == 0;
+               }
+
+               public static MsyncFlags ToMsyncFlags (Int32 value)
+               {
+                       MsyncFlags rval;
+                       if (ToMsyncFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromOpenFlags")]
+               private static extern int FromOpenFlags (OpenFlags value, out Int32 rval);
+
+               public static bool TryFromOpenFlags (OpenFlags value, out Int32 rval)
+               {
+                       return FromOpenFlags (value, out rval) == 0;
+               }
+
+               public static Int32 FromOpenFlags (OpenFlags value)
+               {
+                       Int32 rval;
+                       if (FromOpenFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToOpenFlags")]
+               private static extern int ToOpenFlags (Int32 value, out OpenFlags rval);
+
+               public static bool TryToOpenFlags (Int32 value, out OpenFlags rval)
+               {
+                       return ToOpenFlags (value, out rval) == 0;
+               }
+
+               public static OpenFlags ToOpenFlags (Int32 value)
+               {
+                       OpenFlags rval;
+                       if (ToOpenFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromPathConf")]
+               private static extern int FromPathConf (PathConf value, out Int32 rval);
+
+               public static bool TryFromPathConf (PathConf value, out Int32 rval)
+               {
+                       return FromPathConf (value, out rval) == 0;
+               }
+
+               public static Int32 FromPathConf (PathConf value)
+               {
+                       Int32 rval;
+                       if (FromPathConf (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToPathConf")]
+               private static extern int ToPathConf (Int32 value, out PathConf rval);
+
+               public static bool TryToPathConf (Int32 value, out PathConf rval)
+               {
+                       return ToPathConf (value, out rval) == 0;
+               }
+
+               public static PathConf ToPathConf (Int32 value)
+               {
+                       PathConf rval;
+                       if (ToPathConf (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromPollEvents")]
+               private static extern int FromPollEvents (PollEvents value, out Int16 rval);
+
+               public static bool TryFromPollEvents (PollEvents value, out Int16 rval)
+               {
+                       return FromPollEvents (value, out rval) == 0;
+               }
+
+               public static Int16 FromPollEvents (PollEvents value)
+               {
+                       Int16 rval;
+                       if (FromPollEvents (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToPollEvents")]
+               private static extern int ToPollEvents (Int16 value, out PollEvents rval);
+
+               public static bool TryToPollEvents (Int16 value, out PollEvents rval)
+               {
+                       return ToPollEvents (value, out rval) == 0;
+               }
+
+               public static PollEvents ToPollEvents (Int16 value)
+               {
+                       PollEvents rval;
+                       if (ToPollEvents (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromPosixFadviseAdvice")]
+               private static extern int FromPosixFadviseAdvice (PosixFadviseAdvice value, out Int32 rval);
+
+               public static bool TryFromPosixFadviseAdvice (PosixFadviseAdvice value, out Int32 rval)
+               {
+                       return FromPosixFadviseAdvice (value, out rval) == 0;
+               }
+
+               public static Int32 FromPosixFadviseAdvice (PosixFadviseAdvice value)
+               {
+                       Int32 rval;
+                       if (FromPosixFadviseAdvice (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToPosixFadviseAdvice")]
+               private static extern int ToPosixFadviseAdvice (Int32 value, out PosixFadviseAdvice rval);
+
+               public static bool TryToPosixFadviseAdvice (Int32 value, out PosixFadviseAdvice rval)
+               {
+                       return ToPosixFadviseAdvice (value, out rval) == 0;
+               }
+
+               public static PosixFadviseAdvice ToPosixFadviseAdvice (Int32 value)
+               {
+                       PosixFadviseAdvice rval;
+                       if (ToPosixFadviseAdvice (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromPosixMadviseAdvice")]
+               private static extern int FromPosixMadviseAdvice (PosixMadviseAdvice value, out Int32 rval);
+
+               public static bool TryFromPosixMadviseAdvice (PosixMadviseAdvice value, out Int32 rval)
+               {
+                       return FromPosixMadviseAdvice (value, out rval) == 0;
+               }
+
+               public static Int32 FromPosixMadviseAdvice (PosixMadviseAdvice value)
+               {
+                       Int32 rval;
+                       if (FromPosixMadviseAdvice (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToPosixMadviseAdvice")]
+               private static extern int ToPosixMadviseAdvice (Int32 value, out PosixMadviseAdvice rval);
+
+               public static bool TryToPosixMadviseAdvice (Int32 value, out PosixMadviseAdvice rval)
+               {
+                       return ToPosixMadviseAdvice (value, out rval) == 0;
+               }
+
+               public static PosixMadviseAdvice ToPosixMadviseAdvice (Int32 value)
+               {
+                       PosixMadviseAdvice rval;
+                       if (ToPosixMadviseAdvice (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromSeekFlags")]
+               private static extern int FromSeekFlags (SeekFlags value, out Int16 rval);
+
+               public static bool TryFromSeekFlags (SeekFlags value, out Int16 rval)
+               {
+                       return FromSeekFlags (value, out rval) == 0;
+               }
+
+               public static Int16 FromSeekFlags (SeekFlags value)
+               {
+                       Int16 rval;
+                       if (FromSeekFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToSeekFlags")]
+               private static extern int ToSeekFlags (Int16 value, out SeekFlags rval);
+
+               public static bool TryToSeekFlags (Int16 value, out SeekFlags rval)
+               {
+                       return ToSeekFlags (value, out rval) == 0;
+               }
+
+               public static SeekFlags ToSeekFlags (Int16 value)
+               {
+                       SeekFlags rval;
+                       if (ToSeekFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromSignum")]
+               private static extern int FromSignum (Signum value, out Int32 rval);
+
+               public static bool TryFromSignum (Signum value, out Int32 rval)
+               {
+                       return FromSignum (value, out rval) == 0;
+               }
+
+               public static Int32 FromSignum (Signum value)
+               {
+                       Int32 rval;
+                       if (FromSignum (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToSignum")]
+               private static extern int ToSignum (Int32 value, out Signum rval);
+
+               public static bool TryToSignum (Int32 value, out Signum rval)
+               {
+                       return ToSignum (value, out rval) == 0;
+               }
+
+               public static Signum ToSignum (Int32 value)
+               {
+                       Signum rval;
+                       if (ToSignum (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromSysConf")]
+               private static extern int FromSysConf (SysConf value, out Int32 rval);
+
+               public static bool TryFromSysConf (SysConf value, out Int32 rval)
+               {
+                       return FromSysConf (value, out rval) == 0;
+               }
+
+               public static Int32 FromSysConf (SysConf value)
+               {
+                       Int32 rval;
+                       if (FromSysConf (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToSysConf")]
+               private static extern int ToSysConf (Int32 value, out SysConf rval);
+
+               public static bool TryToSysConf (Int32 value, out SysConf rval)
+               {
+                       return ToSysConf (value, out rval) == 0;
+               }
+
+               public static SysConf ToSysConf (Int32 value)
+               {
+                       SysConf rval;
+                       if (ToSysConf (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromSyslogFacility")]
+               private static extern int FromSyslogFacility (SyslogFacility value, out Int32 rval);
+
+               public static bool TryFromSyslogFacility (SyslogFacility value, out Int32 rval)
+               {
+                       return FromSyslogFacility (value, out rval) == 0;
+               }
+
+               public static Int32 FromSyslogFacility (SyslogFacility value)
+               {
+                       Int32 rval;
+                       if (FromSyslogFacility (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToSyslogFacility")]
+               private static extern int ToSyslogFacility (Int32 value, out SyslogFacility rval);
+
+               public static bool TryToSyslogFacility (Int32 value, out SyslogFacility rval)
+               {
+                       return ToSyslogFacility (value, out rval) == 0;
+               }
+
+               public static SyslogFacility ToSyslogFacility (Int32 value)
+               {
+                       SyslogFacility rval;
+                       if (ToSyslogFacility (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromSyslogLevel")]
+               private static extern int FromSyslogLevel (SyslogLevel value, out Int32 rval);
+
+               public static bool TryFromSyslogLevel (SyslogLevel value, out Int32 rval)
+               {
+                       return FromSyslogLevel (value, out rval) == 0;
+               }
+
+               public static Int32 FromSyslogLevel (SyslogLevel value)
+               {
+                       Int32 rval;
+                       if (FromSyslogLevel (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToSyslogLevel")]
+               private static extern int ToSyslogLevel (Int32 value, out SyslogLevel rval);
+
+               public static bool TryToSyslogLevel (Int32 value, out SyslogLevel rval)
+               {
+                       return ToSyslogLevel (value, out rval) == 0;
+               }
+
+               public static SyslogLevel ToSyslogLevel (Int32 value)
+               {
+                       SyslogLevel rval;
+                       if (ToSyslogLevel (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromSyslogOptions")]
+               private static extern int FromSyslogOptions (SyslogOptions value, out Int32 rval);
+
+               public static bool TryFromSyslogOptions (SyslogOptions value, out Int32 rval)
+               {
+                       return FromSyslogOptions (value, out rval) == 0;
+               }
+
+               public static Int32 FromSyslogOptions (SyslogOptions value)
+               {
+                       Int32 rval;
+                       if (FromSyslogOptions (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToSyslogOptions")]
+               private static extern int ToSyslogOptions (Int32 value, out SyslogOptions rval);
+
+               public static bool TryToSyslogOptions (Int32 value, out SyslogOptions rval)
+               {
+                       return ToSyslogOptions (value, out rval) == 0;
+               }
+
+               public static SyslogOptions ToSyslogOptions (Int32 value)
+               {
+                       SyslogOptions rval;
+                       if (ToSyslogOptions (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromWaitOptions")]
+               private static extern int FromWaitOptions (WaitOptions value, out Int32 rval);
+
+               public static bool TryFromWaitOptions (WaitOptions value, out Int32 rval)
+               {
+                       return FromWaitOptions (value, out rval) == 0;
+               }
+
+               public static Int32 FromWaitOptions (WaitOptions value)
+               {
+                       Int32 rval;
+                       if (FromWaitOptions (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToWaitOptions")]
+               private static extern int ToWaitOptions (Int32 value, out WaitOptions rval);
+
+               public static bool TryToWaitOptions (Int32 value, out WaitOptions rval)
+               {
+                       return ToWaitOptions (value, out rval) == 0;
+               }
+
+               public static WaitOptions ToWaitOptions (Int32 value)
+               {
+                       WaitOptions rval;
+                       if (ToWaitOptions (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_FromXattrFlags")]
+               private static extern int FromXattrFlags (XattrFlags value, out Int32 rval);
+
+               public static bool TryFromXattrFlags (XattrFlags value, out Int32 rval)
+               {
+                       return FromXattrFlags (value, out rval) == 0;
+               }
+
+               public static Int32 FromXattrFlags (XattrFlags value)
+               {
+                       Int32 rval;
+                       if (FromXattrFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+               [DllImport (LIB, EntryPoint="Mono_Posix_ToXattrFlags")]
+               private static extern int ToXattrFlags (Int32 value, out XattrFlags rval);
+
+               public static bool TryToXattrFlags (Int32 value, out XattrFlags rval)
+               {
+                       return ToXattrFlags (value, out rval) == 0;
+               }
+
+               public static XattrFlags ToXattrFlags (Int32 value)
+               {
+                       XattrFlags rval;
+                       if (ToXattrFlags (value, out rval) == -1)
+                               ThrowArgumentException (value);
+                       return rval;
+               }
+
+       }
+}
+
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/Stdlib.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/Stdlib.cs
new file mode 100644 (file)
index 0000000..d0f84f2
--- /dev/null
@@ -0,0 +1,983 @@
+//
+// Mono.Unix/Stdlib.cs
+//
+// Authors:
+//   Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2004-2005 Jonathan Pryor
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Text;
+using Mono.Unix.Native;
+
+namespace Mono.Unix.Native {
+
+       #region Enumerations
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum Errno : int {
+               // errors & their values liberally copied from
+               // FC2 /usr/include/asm/errno.h
+               
+               EPERM           =   1, // Operation not permitted 
+               ENOENT          =   2, // No such file or directory 
+               ESRCH           =   3, // No such process 
+               EINTR           =   4, // Interrupted system call 
+               EIO             =   5, // I/O error 
+               ENXIO           =   6, // No such device or address 
+               E2BIG           =   7, // Arg list too long 
+               ENOEXEC         =   8, // Exec format error 
+               EBADF           =   9, // Bad file number 
+               ECHILD          =  10, // No child processes 
+               EAGAIN          =  11, // Try again 
+               ENOMEM          =  12, // Out of memory 
+               EACCES          =  13, // Permission denied 
+               EFAULT          =  14, // Bad address 
+               ENOTBLK         =  15, // Block device required 
+               EBUSY           =  16, // Device or resource busy 
+               EEXIST          =  17, // File exists 
+               EXDEV           =  18, // Cross-device link 
+               ENODEV          =  19, // No such device 
+               ENOTDIR         =  20, // Not a directory 
+               EISDIR          =  21, // Is a directory 
+               EINVAL          =  22, // Invalid argument 
+               ENFILE          =  23, // File table overflow 
+               EMFILE          =  24, // Too many open files 
+               ENOTTY          =  25, // Not a typewriter 
+               ETXTBSY         =  26, // Text file busy 
+               EFBIG           =  27, // File too large 
+               ENOSPC          =  28, // No space left on device 
+               ESPIPE          =  29, // Illegal seek 
+               EROFS           =  30, // Read-only file system 
+               EMLINK          =  31, // Too many links 
+               EPIPE           =  32, // Broken pipe 
+               EDOM            =  33, // Math argument out of domain of func 
+               ERANGE          =  34, // Math result not representable 
+               EDEADLK         =  35, // Resource deadlock would occur 
+               ENAMETOOLONG    =  36, // File name too long 
+               ENOLCK          =  37, // No record locks available 
+               ENOSYS          =  38, // Function not implemented 
+               ENOTEMPTY       =  39, // Directory not empty 
+               ELOOP           =  40, // Too many symbolic links encountered 
+               EWOULDBLOCK     =  EAGAIN, // Operation would block 
+               ENOMSG          =  42, // No message of desired type 
+               EIDRM           =  43, // Identifier removed 
+               ECHRNG          =  44, // Channel number out of range 
+               EL2NSYNC        =  45, // Level 2 not synchronized 
+               EL3HLT          =  46, // Level 3 halted 
+               EL3RST          =  47, // Level 3 reset 
+               ELNRNG          =  48, // Link number out of range 
+               EUNATCH         =  49, // Protocol driver not attached 
+               ENOCSI          =  50, // No CSI structure available 
+               EL2HLT          =  51, // Level 2 halted 
+               EBADE           =  52, // Invalid exchange 
+               EBADR           =  53, // Invalid request descriptor 
+               EXFULL          =  54, // Exchange full 
+               ENOANO          =  55, // No anode 
+               EBADRQC         =  56, // Invalid request code 
+               EBADSLT         =  57, // Invalid slot 
+                      
+               EDEADLOCK             =  EDEADLK,
+                      
+               EBFONT          =  59, // Bad font file format 
+               ENOSTR          =  60, // Device not a stream 
+               ENODATA         =  61, // No data available 
+               ETIME           =  62, // Timer expired 
+               ENOSR           =  63, // Out of streams resources 
+               ENONET          =  64, // Machine is not on the network 
+               ENOPKG          =  65, // Package not installed 
+               EREMOTE         =  66, // Object is remote 
+               ENOLINK         =  67, // Link has been severed 
+               EADV            =  68, // Advertise error 
+               ESRMNT          =  69, // Srmount error 
+               ECOMM           =  70, // Communication error on send 
+               EPROTO          =  71, // Protocol error 
+               EMULTIHOP       =  72, // Multihop attempted 
+               EDOTDOT         =  73, // RFS specific error 
+               EBADMSG         =  74, // Not a data message 
+               EOVERFLOW       =  75, // Value too large for defined data type 
+               ENOTUNIQ        =  76, // Name not unique on network 
+               EBADFD          =  77, // File descriptor in bad state 
+               EREMCHG         =  78, // Remote address changed 
+               ELIBACC         =  79, // Can not access a needed shared library 
+               ELIBBAD         =  80, // Accessing a corrupted shared library 
+               ELIBSCN         =  81, // .lib section in a.out corrupted 
+               ELIBMAX         =  82, // Attempting to link in too many shared libraries 
+               ELIBEXEC        =  83, // Cannot exec a shared library directly 
+               EILSEQ          =  84, // Illegal byte sequence 
+               ERESTART        =  85, // Interrupted system call should be restarted 
+               ESTRPIPE        =  86, // Streams pipe error 
+               EUSERS          =  87, // Too many users 
+               ENOTSOCK        =  88, // Socket operation on non-socket 
+               EDESTADDRREQ    =  89, // Destination address required 
+               EMSGSIZE        =  90, // Message too long 
+               EPROTOTYPE      =  91, // Protocol wrong type for socket 
+               ENOPROTOOPT     =  92, // Protocol not available 
+               EPROTONOSUPPORT =  93, // Protocol not supported 
+               ESOCKTNOSUPPORT =  94, // Socket type not supported 
+               EOPNOTSUPP      =  95, // Operation not supported on transport endpoint 
+               EPFNOSUPPORT    =  96, // Protocol family not supported 
+               EAFNOSUPPORT    =  97, // Address family not supported by protocol 
+               EADDRINUSE      =  98, // Address already in use 
+               EADDRNOTAVAIL   =  99, // Cannot assign requested address 
+               ENETDOWN        = 100, // Network is down 
+               ENETUNREACH     = 101, // Network is unreachable 
+               ENETRESET       = 102, // Network dropped connection because of reset 
+               ECONNABORTED    = 103, // Software caused connection abort 
+               ECONNRESET      = 104, // Connection reset by peer 
+               ENOBUFS         = 105, // No buffer space available 
+               EISCONN         = 106, // Transport endpoint is already connected 
+               ENOTCONN        = 107, // Transport endpoint is not connected 
+               ESHUTDOWN       = 108, // Cannot send after transport endpoint shutdown 
+               ETOOMANYREFS    = 109, // Too many references: cannot splice 
+               ETIMEDOUT       = 110, // Connection timed out 
+               ECONNREFUSED    = 111, // Connection refused 
+               EHOSTDOWN       = 112, // Host is down 
+               EHOSTUNREACH    = 113, // No route to host 
+               EALREADY        = 114, // Operation already in progress 
+               EINPROGRESS     = 115, // Operation now in progress 
+               ESTALE          = 116, // Stale NFS file handle 
+               EUCLEAN         = 117, // Structure needs cleaning 
+               ENOTNAM         = 118, // Not a XENIX named type file 
+               ENAVAIL         = 119, // No XENIX semaphores available 
+               EISNAM          = 120, // Is a named type file 
+               EREMOTEIO       = 121, // Remote I/O error 
+               EDQUOT          = 122, // Quota exceeded 
+
+               ENOMEDIUM       = 123, // No medium found 
+               EMEDIUMTYPE     = 124, // Wrong medium type 
+       }
+
+       #endregion
+
+       #region Classes
+
+       public sealed class FilePosition : IDisposable {
+
+               private static readonly int FilePositionDumpSize = 
+                       Stdlib.DumpFilePosition (null, new HandleRef (null, IntPtr.Zero), 0);
+
+               private HandleRef pos;
+
+               public FilePosition ()
+               {
+                       IntPtr p = Stdlib.CreateFilePosition ();
+                       if (p == IntPtr.Zero)
+                               throw new OutOfMemoryException ("Unable to malloc fpos_t!");
+                       pos = new HandleRef (this, p);
+               }
+
+               internal HandleRef Handle {
+                       get {return pos;}
+               }
+
+               public void Dispose ()
+               {
+                       Cleanup ();
+                       GC.SuppressFinalize (this);
+               }
+
+               private void Cleanup ()
+               {
+                       if (pos.Handle != IntPtr.Zero) {
+                               Stdlib.free (pos.Handle);
+                               pos = new HandleRef (this, IntPtr.Zero);
+                       }
+               }
+
+               public override string ToString ()
+               {
+                       return "(" + base.ToString () + " " + GetDump () + ")";
+               }
+
+               private string GetDump ()
+               {
+                       if (FilePositionDumpSize <= 0)
+                               return "internal error";
+
+                       StringBuilder buf = new StringBuilder (FilePositionDumpSize+1);
+
+                       if (Stdlib.DumpFilePosition (buf, Handle, FilePositionDumpSize+1) <= 0)
+                               return "internal error dumping fpos_t";
+
+                       return buf.ToString ();
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType() != obj.GetType())
+                               return false;
+                       return ToString().Equals (obj.ToString());
+               }
+
+               public override int GetHashCode ()
+               {
+                       return ToString ().GetHashCode ();
+               }
+
+               ~FilePosition ()
+               {
+                       Cleanup ();
+               }
+
+               public static bool operator== (FilePosition lhs, FilePosition rhs)
+               {
+                       return Object.Equals (lhs, rhs);
+               }
+
+               public static bool operator!= (FilePosition lhs, FilePosition rhs)
+               {
+                       return !Object.Equals (lhs, rhs);
+               }
+       }
+
+
+       //
+       // Right now using this attribute gives an assert because it
+       // isn't implemented.
+       //
+#if NET_2_0 && UNMANAGED_FN_PTR_SUPPORT_FIXED
+       [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
+#endif
+       public delegate void SignalHandler (int signal);
+
+#if !NET_2_0
+       internal sealed class SignalWrapper {
+               private IntPtr handler;
+
+               internal SignalWrapper (IntPtr handler)
+               {
+                       this.handler = handler;
+               }
+
+               public void InvokeSignalHandler (int signum)
+               {
+                       Stdlib.InvokeSignalHandler (signum, handler);
+               }
+       }
+#endif
+
+       internal class XPrintfFunctions
+       {
+               internal delegate object XPrintf (object[] parameters);
+
+               internal static XPrintf printf;
+               internal static XPrintf fprintf;
+               internal static XPrintf snprintf;
+               internal static XPrintf syslog;
+
+               static XPrintfFunctions ()
+               {
+                       CdeclFunction _printf = new CdeclFunction (Stdlib.LIBC, "printf", typeof(int));
+                       printf = new XPrintf (_printf.Invoke);
+
+                       CdeclFunction _fprintf = new CdeclFunction (Stdlib.LIBC, "fprintf", typeof(int));
+                       fprintf = new XPrintf (_fprintf.Invoke);
+
+                       CdeclFunction _snprintf = new CdeclFunction (Stdlib.MPH, 
+                                       "Mono_Posix_Stdlib_snprintf", typeof(int));
+                       snprintf = new XPrintf (_snprintf.Invoke);
+
+                       CdeclFunction _syslog = new CdeclFunction (Syscall.LIBC, "syslog", typeof(void));
+                       syslog = new XPrintf (_syslog.Invoke);
+               }
+       }
+
+       //
+       // Convention: Functions that are part of the C standard library go here.
+       //
+       // For example, the man page should say something similar to:
+       //
+       //    CONFORMING TO
+       //           ISO 9899 (''ANSI C'')
+       //
+       // The intent is that members of this class should be portable to any system
+       // supporting the C runtime (read: non-Unix, including Windows).  Using
+       // anything from Syscall is non-portable, but restricting yourself to just
+       // Stdlib is intended to be portable.
+       //
+       public class Stdlib
+       {
+               internal const string LIBC = "msvcrt";
+               internal const string MPH  = "MonoPosixHelper";
+
+               internal Stdlib () {}
+
+               #region <errno.h> Declarations
+               //
+               // <errno.h>  -- COMPLETE
+               //
+
+               [CLSCompliant (false)]
+               public static Errno GetLastError ()
+               {
+                       int errno = Marshal.GetLastWin32Error ();
+                       return NativeConvert.ToErrno (errno);
+               }
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_SetLastError")]
+               private static extern void SetLastError (int error);
+
+               [CLSCompliant (false)]
+               public static void SetLastError (Errno error)
+               {
+                       int _error = NativeConvert.FromErrno (error);
+                       SetLastError (_error);
+               }
+               #endregion
+
+               //
+               // <signal.h>
+               //
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_InvokeSignalHandler")]
+               internal static extern void InvokeSignalHandler (int signum, IntPtr handler);
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_SIG_DFL")]
+               private static extern IntPtr GetDefaultSignal ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_SIG_ERR")]
+               private static extern IntPtr GetErrorSignal ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_SIG_IGN")]
+               private static extern IntPtr GetIgnoreSignal ();
+
+               private static readonly IntPtr _SIG_DFL = GetDefaultSignal ();
+               private static readonly IntPtr _SIG_ERR = GetErrorSignal ();
+               private static readonly IntPtr _SIG_IGN = GetIgnoreSignal ();
+
+               private static void _ErrorHandler (int signum)
+               {
+                       Console.Error.WriteLine ("Error handler invoked for signum " + 
+                                       signum + ".  Don't do that.");
+               }
+
+               private static void _DefaultHandler (int signum)
+               {
+                       Console.Error.WriteLine ("Default handler invoked for signum " + 
+                                       signum + ".  Don't do that.");
+               }
+
+               private static void _IgnoreHandler (int signum)
+               {
+                       Console.Error.WriteLine ("Ignore handler invoked for signum " + 
+                                       signum + ".  Don't do that.");
+               }
+
+               [CLSCompliant (false)]
+               public static readonly SignalHandler SIG_DFL = new SignalHandler (_DefaultHandler);
+               [CLSCompliant (false)]
+               public static readonly SignalHandler SIG_ERR = new SignalHandler (_ErrorHandler);
+               [CLSCompliant (false)]
+               public static readonly SignalHandler SIG_IGN = new SignalHandler (_IgnoreHandler);
+
+               private static readonly SignalHandler[] registered_signals;
+
+               static Stdlib ()
+               {
+                       Array signals = Enum.GetValues(typeof(Signum));
+                       registered_signals = new SignalHandler [(int) signals.GetValue (signals.Length-1)];
+               }
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="signal")]
+               private static extern IntPtr sys_signal (int signum, SignalHandler handler);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="signal")]
+               private static extern IntPtr sys_signal (int signum, IntPtr handler);
+
+               [CLSCompliant (false)]
+               public static SignalHandler signal (Signum signum, SignalHandler handler)
+               {
+                       int _sig = NativeConvert.FromSignum (signum);
+
+                       lock (registered_signals) {
+                               registered_signals [(int) signum] = handler;
+                       }
+
+                       IntPtr r;
+                       if (handler == SIG_DFL)
+                               r = sys_signal (_sig, _SIG_DFL);
+                       else if (handler == SIG_ERR)
+                               r = sys_signal (_sig, _SIG_ERR);
+                       else if (handler == SIG_IGN)
+                               r = sys_signal (_sig, _SIG_IGN);
+                       else
+                               r = sys_signal (_sig, handler);
+                       return TranslateHandler (r);
+               }
+
+               private static SignalHandler TranslateHandler (IntPtr handler)
+               {
+                       if (handler == _SIG_DFL)
+                               return SIG_DFL;
+                       if (handler == _SIG_ERR)
+                               return SIG_ERR;
+                       if (handler == _SIG_IGN)
+                               return SIG_IGN;
+#if NET_2_0
+                       return (SignalHandler) Marshal.GetDelegateForFunctionPointer (handler, typeof(SignalHandler));
+#else
+                       return new SignalHandler (new SignalWrapper (handler).InvokeSignalHandler);
+#endif
+               }
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, EntryPoint="raise")]
+               private static extern int sys_raise (int sig);
+
+               [CLSCompliant (false)]
+               public static int raise (Signum sig)
+               {
+                       int _sig = NativeConvert.FromSignum (sig);
+                       return sys_raise (_sig);
+               }
+
+               //
+               // <stdio.h> -- COMPLETE except for :
+               //    - the scanf(3) family .
+               //    - vararg functions.
+               //    - Horribly unsafe functions (gets(3)).
+               //
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib__IOFBF")]
+               private static extern int GetFullyBuffered ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib__IOLBF")]
+               private static extern int GetLineBuffered ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib__IONBF")]
+               private static extern int GetNonBuffered ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_BUFSIZ")]
+               private static extern int GetBufferSize ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_CreateFilePosition")]
+               internal static extern IntPtr CreateFilePosition ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_DumpFilePosition")]
+               internal static extern int DumpFilePosition (StringBuilder buf, HandleRef handle, int len);
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_EOF")]
+               private static extern int GetEOF ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_FILENAME_MAX")]
+               private static extern int GetFilenameMax ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_FOPEN_MAX")]
+               private static extern int GetFopenMax ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_L_tmpnam")]
+               private static extern int GetTmpnamLength ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_stdin")]
+               private static extern IntPtr GetStandardInput ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_stdout")]
+               private static extern IntPtr GetStandardOutput ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_stderr")]
+               private static extern IntPtr GetStandardError ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_TMP_MAX")]
+               private static extern int GetTmpMax ();
+
+               [CLSCompliant (false)]
+               public static readonly int    _IOFBF       = GetFullyBuffered ();
+               [CLSCompliant (false)]
+               public static readonly int    _IOLBF       = GetLineBuffered ();
+               [CLSCompliant (false)]
+               public static readonly int    _IONBF       = GetNonBuffered ();
+               [CLSCompliant (false)]
+               public static readonly int    BUFSIZ       = GetBufferSize ();
+               [CLSCompliant (false)]
+               public static readonly int    EOF          = GetEOF ();
+               [CLSCompliant (false)]
+               public static readonly int    FOPEN_MAX    = GetFopenMax ();
+               [CLSCompliant (false)]
+               public static readonly int    FILENAME_MAX = GetFilenameMax ();
+               [CLSCompliant (false)]
+               public static readonly int    L_tmpnam     = GetTmpnamLength ();
+               public static readonly IntPtr stderr       = GetStandardError ();
+               public static readonly IntPtr stdin        = GetStandardInput ();
+               public static readonly IntPtr stdout       = GetStandardOutput ();
+               [CLSCompliant (false)]
+               public static readonly int    TMP_MAX      = GetTmpMax ();
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int remove (string filename);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int rename (string oldpath, string newpath);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern IntPtr tmpfile ();
+
+               private static object tmpnam_lock = new object ();
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="tmpnam")]
+               private static extern IntPtr sys_tmpnam (StringBuilder s);
+
+               [Obsolete ("Syscall.mkstemp() should be preferred.")]
+               public static string tmpnam (StringBuilder s)
+               {
+                       if (s != null && s.Capacity < L_tmpnam)
+                               throw new ArgumentOutOfRangeException ("s", "s.Capacity < L_tmpnam");
+                       lock (tmpnam_lock) {
+                               IntPtr r = sys_tmpnam (s);
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               [Obsolete ("Syscall.mkstemp() should be preferred.")]
+               public static string tmpnam ()
+               {
+                       lock (tmpnam_lock) {
+                               IntPtr r = sys_tmpnam (null);
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int fclose (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int fflush (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern IntPtr fopen (string path, string mode);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern IntPtr freopen (string path, string mode, IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern void setbuf (IntPtr stream, IntPtr buf);
+
+               [CLSCompliant (false)]
+               public static unsafe void setbuf (IntPtr stream, byte* buf)
+               {
+                       setbuf (stream, (IntPtr) buf);
+               }
+
+               [CLSCompliant (false)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_setvbuf")]
+               public static extern int setvbuf (IntPtr stream, IntPtr buf, int mode, ulong size);
+
+               [CLSCompliant (false)]
+               public static unsafe int setvbuf (IntPtr stream, byte* buf, int mode, ulong size)
+               {
+                       return setvbuf (stream, (IntPtr) buf, mode, size);
+               }
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="fprintf")]
+               private static extern int sys_fprintf (IntPtr stream, string format, string message);
+
+               public static int fprintf (IntPtr stream, string message)
+               {
+                       return sys_fprintf (stream, "%s", message);
+               }
+
+               [Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
+                               "Use fprintf (IntPtr, string) instead.")]
+               public static int fprintf (IntPtr stream, string format, params object[] parameters)
+               {
+                       object[] _parameters = new object[checked(parameters.Length+2)];
+                       _parameters [0] = stream;
+                       _parameters [1] = format;
+                       Array.Copy (parameters, 0, _parameters, 2, parameters.Length);
+                       return (int) XPrintfFunctions.fprintf (_parameters);
+               }
+
+               /* SKIP: fscanf(3) */
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="printf")]
+               private static extern int sys_printf (string format, string message);
+
+               public static int printf (string message)
+               {
+                       return sys_printf ("%s", message);
+               }
+
+               [Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
+                               "Use printf (string) instead.")]
+               public static int printf (string format, params object[] parameters)
+               {
+                       object[] _parameters = new object[checked(parameters.Length+1)];
+                       _parameters [0] = format;
+                       Array.Copy (parameters, 0, _parameters, 1, parameters.Length);
+                       return (int) XPrintfFunctions.printf (_parameters);
+               }
+
+               /* SKIP: scanf(3) */
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_snprintf")]
+               private static extern int sys_snprintf (StringBuilder s, ulong n, 
+                               string format, string message);
+
+               [CLSCompliant (false)]
+               public static int snprintf (StringBuilder s, ulong n, string message)
+               {
+                       if (n > (ulong) s.Capacity)
+                               throw new ArgumentOutOfRangeException ("n", "n must be <= s.Capacity");
+                       return sys_snprintf (s, n, "%s", message);
+               }
+
+               public static int snprintf (StringBuilder s, string message)
+               {
+                       return sys_snprintf (s, (ulong) s.Capacity, "%s", message);
+               }
+
+               [CLSCompliant (false)]
+               [Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
+                               "Use snprintf (StringBuilder, string) instead.")]
+               public static int snprintf (StringBuilder s, ulong n, 
+                               string format, params object[] parameters)
+               {
+                       if (n > (ulong) s.Capacity)
+                               throw new ArgumentOutOfRangeException ("n", "n must be <= s.Capacity");
+
+                       object[] _parameters = new object[checked(parameters.Length+3)];
+                       _parameters [0] = s;
+                       _parameters [1] = n;
+                       _parameters [2] = format;
+                       Array.Copy (parameters, 0, _parameters, 3, parameters.Length);
+                       return (int) XPrintfFunctions.snprintf (_parameters);
+               }
+
+               [CLSCompliant (false)]
+               [Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
+                               "Use snprintf (StringBuilder, string) instead.")]
+               public static int snprintf (StringBuilder s,
+                               string format, params object[] parameters)
+               {
+                       object[] _parameters = new object[checked(parameters.Length+3)];
+                       _parameters [0] = s;
+                       _parameters [1] = (ulong) s.Capacity;
+                       _parameters [2] = format;
+                       Array.Copy (parameters, 0, _parameters, 3, parameters.Length);
+                       return (int) XPrintfFunctions.snprintf (_parameters);
+               }
+
+               /*
+                * SKIP:
+                *    sprintf(3)
+                *    sscanf(3)
+                *    vfprintf(3)
+                *    vfscanf(3)
+                *    vprintf(3)
+                *    vscanf(3)
+                *    vsnprintf(3)
+                *    vsprint(3)
+                *    vsscanf(3)
+                */
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int fgetc (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="fgets")]
+               private static extern IntPtr sys_fgets (StringBuilder sb, int size, IntPtr stream);
+
+               public static StringBuilder fgets (StringBuilder sb, int size, IntPtr stream)
+               {
+                       IntPtr r = sys_fgets (sb, size, stream);
+                       if (r == IntPtr.Zero)
+                               return null;
+                       return sb;
+               }
+
+               public static StringBuilder fgets (StringBuilder sb, IntPtr stream)
+               {
+                       return fgets (sb, sb.Capacity, stream);
+               }
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int fputc (int c, IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int fputs (string s, IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int getc (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int getchar ();
+
+               /* SKIP: gets(3) */
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int putc (int c, IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int putchar (int c);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int puts (string s);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int ungetc (int c, IntPtr stream);
+
+               [CLSCompliant (false)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fread")]
+               public static extern ulong fread (IntPtr ptr, ulong size, ulong nmemb, IntPtr stream);
+
+               [CLSCompliant (false)]
+               public static unsafe ulong fread (void* ptr, ulong size, ulong nmemb, IntPtr stream)
+               {
+                       return fread ((IntPtr) ptr, size, nmemb, stream);
+               }
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fread")]
+               private static extern ulong sys_fread ([Out] byte[] ptr, 
+                               ulong size, ulong nmemb, IntPtr stream);
+
+               [CLSCompliant (false)]
+               public static ulong fread (byte[] ptr, ulong size, ulong nmemb, IntPtr stream)
+               {
+                       if ((size * nmemb) > (ulong) ptr.Length)
+                               throw new ArgumentOutOfRangeException ("nmemb");
+                       return sys_fread (ptr, size, nmemb, stream);
+               }
+
+               [CLSCompliant (false)]
+               public static ulong fread (byte[] ptr, IntPtr stream)
+               {
+                       return fread (ptr, 1, (ulong) ptr.Length, stream);
+               }
+
+               [CLSCompliant (false)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fwrite")]
+               public static extern ulong fwrite (IntPtr ptr, ulong size, ulong nmemb, IntPtr stream);
+
+               [CLSCompliant (false)]
+               public static unsafe ulong fwrite (void* ptr, ulong size, ulong nmemb, IntPtr stream)
+               {
+                       return fwrite ((IntPtr) ptr, size, nmemb, stream);
+               }
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fwrite")]
+               private static extern ulong sys_fwrite (byte[] ptr, 
+                               ulong size, ulong nmemb, IntPtr stream);
+
+               [CLSCompliant (false)]
+               public static ulong fwrite (byte[] ptr, ulong size, ulong nmemb, IntPtr stream)
+               {
+                       if ((size * nmemb) > (ulong) ptr.Length)
+                               throw new ArgumentOutOfRangeException ("nmemb");
+                       return sys_fwrite (ptr, size, nmemb, stream);
+               }
+
+               [CLSCompliant (false)]
+               public static ulong fwrite (byte[] ptr, IntPtr stream)
+               {
+                       return fwrite (ptr, 1, (ulong) ptr.Length, stream);
+               }
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fgetpos")]
+               private static extern int sys_fgetpos (IntPtr stream, HandleRef pos);
+
+               public static int fgetpos (IntPtr stream, FilePosition pos)
+               {
+                       return sys_fgetpos (stream, pos.Handle);
+               }
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fseek")]
+               private static extern int sys_fseek (IntPtr stream, long offset, int origin);
+
+               [CLSCompliant (false)]
+               public static int fseek (IntPtr stream, long offset, SeekFlags origin)
+               {
+                       int _origin = NativeConvert.FromSeekFlags (origin);
+                       return sys_fseek (stream, offset, _origin);
+               }
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fsetpos")]
+               private static extern int sys_fsetpos (IntPtr stream, HandleRef pos);
+
+               public static int fsetpos (IntPtr stream, FilePosition pos)
+               {
+                       return sys_fsetpos (stream, pos.Handle);
+               }
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_ftell")]
+               public static extern long ftell (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void rewind (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void clearerr (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern int feof (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern int ferror (IntPtr stream);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern void perror (string s);
+
+               //
+               // <stdlib.h>
+               //
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_EXIT_FAILURE")]
+               private static extern int GetExitFailure();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_EXIT_SUCCESS")]
+               private static extern int GetExitSuccess ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_MB_CUR_MAX")]
+               private static extern int GetMbCurMax ();
+
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_RAND_MAX")]
+               private static extern int GetRandMax ();
+
+               [CLSCompliant (false)]
+               public static readonly int  EXIT_FAILURE = GetExitFailure ();
+               [CLSCompliant (false)]
+               public static readonly int  EXIT_SUCCESS = GetExitSuccess ();
+               [CLSCompliant (false)]
+               public static readonly int  MB_CUR_MAX   = GetMbCurMax ();
+               [CLSCompliant (false)]
+               public static readonly int  RAND_MAX     = GetRandMax ();
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern int rand ();
+
+               [CLSCompliant (false)]
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void srand (uint seed);
+
+               // calloc(3):
+               //    void *calloc (size_t nmemb, size_t size);
+               [CLSCompliant (false)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_calloc")]
+               public static extern IntPtr calloc (ulong nmemb, ulong size);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void free (IntPtr ptr);
+
+               // malloc(3):
+               //    void *malloc(size_t size);
+               [CLSCompliant (false)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_malloc")]
+               public static extern IntPtr malloc (ulong size);
+
+               // realloc(3):
+               //    void *realloc(void *ptr, size_t size);
+               [CLSCompliant (false)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_realloc")]
+               public static extern IntPtr realloc (IntPtr ptr, ulong size);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void abort ();
+
+               /* SKIP: atexit(3) -- the GC should have collected most references by the
+                * time this runs, so no delegates should exist, making it pointless. */
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void exit (int status);
+
+               [CLSCompliant (false)]
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void _Exit (int status);
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, EntryPoint="getenv")]
+               private static extern IntPtr sys_getenv (string name);
+
+               public static string getenv (string name)
+               {
+                       IntPtr r = sys_getenv (name);
+                       return UnixMarshal.PtrToString (r);
+               }
+
+               [CLSCompliant (false)]
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               public static extern int system (string @string);
+
+               //
+               // <string.h>
+               //
+
+               private static object strerror_lock = new object ();
+
+               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="strerror")]
+               private static extern IntPtr sys_strerror (int errnum);
+
+               [CLSCompliant (false)]
+               public static string strerror (Errno errnum)
+               {
+                       int e = NativeConvert.FromErrno (errnum);
+                       lock (strerror_lock) {
+                               IntPtr r = sys_strerror (e);
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+       }
+
+       #endregion // Classes
+}
+
+// vim: noexpandtab
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs
new file mode 100644 (file)
index 0000000..a9f715e
--- /dev/null
@@ -0,0 +1,3201 @@
+//
+// Mono.Unix/Syscall.cs
+//
+// Authors:
+//   Miguel de Icaza (miguel@novell.com)
+//   Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2003 Novell, Inc.
+// (C) 2004-2005 Jonathan Pryor
+//
+// This file implements the low-level syscall interface to the POSIX
+// subsystem.
+//
+// This file tries to stay close to the low-level API as much as possible
+// using enumerations, structures and in a few cases, using existing .NET
+// data types.
+//
+// Implementation notes:
+//
+//    Since the values for the various constants on the API changes
+//    from system to system (even Linux on different architectures will
+//    have different values), we define our own set of values, and we
+//    use a set of C helper routines to map from the constants we define
+//    to the values of the native OS.
+//
+//    Bitfields are flagged with the [Map] attribute, and a helper program
+//    generates a set of routines that we can call to convert from our value 
+//    definitions to the value definitions expected by the OS; see
+//    NativeConvert for the conversion routines.
+//
+//    Methods that require tuning are bound as `private sys_NAME' methods
+//    and then a `NAME' method is exposed.
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+using System.Text;
+using Mono.Unix.Native;
+
+[assembly:Mono.Unix.Native.HeaderAttribute (
+       Includes=
+               "sys/types.h," + 
+               "sys/stat.h," + 
+               "ah:sys/poll.h," + 
+               "ah:sys/wait.h," +
+               "ah:sys/statvfs.h," +
+               "ah:sys/xattr.h," +
+               "unistd.h," + 
+               "fcntl.h," + 
+               "signal.h," + 
+               "ah:poll.h," + 
+               "ah:grp.h," + 
+               "errno.h," + 
+               "ah:syslog.h",
+       Defines=
+               "_GNU_SOURCE," +
+               "_XOPEN_SOURCE"
+)]
+
+namespace Mono.Unix.Native {
+
+       #region Enumerations
+
+       [Flags][Map]
+       [CLSCompliant (false)]
+       public enum SyslogOptions {
+               LOG_PID    = 0x01,  // log the pid with each message
+               LOG_CONS   = 0x02,  // log on the console if errors in sending
+               LOG_ODELAY = 0x04,  // delay open until first syslog (default)
+               LOG_NDELAY = 0x08,  // don't delay open
+               LOG_NOWAIT = 0x10,  // don't wait for console forks; DEPRECATED
+               LOG_PERROR = 0x20   // log to stderr as well
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum SyslogFacility {
+               LOG_KERN      = 0 << 3,
+               LOG_USER      = 1 << 3,
+               [Obsolete ("use SyslogFacility.LOG_USER")]
+               LOG_USRE      = 1 << 3,
+               LOG_MAIL      = 2 << 3,
+               LOG_DAEMON    = 3 << 3,
+               LOG_AUTH      = 4 << 3,
+               LOG_SYSLOG    = 5 << 3,
+               LOG_LPR       = 6 << 3,
+               LOG_NEWS      = 7 << 3,
+               LOG_UUCP      = 8 << 3,
+               LOG_CRON      = 9 << 3,
+               LOG_AUTHPRIV  = 10 << 3,
+               LOG_FTP       = 11 << 3,
+               LOG_LOCAL0    = 16 << 3,
+               LOG_LOCAL1    = 17 << 3,
+               LOG_LOCAL2    = 18 << 3,
+               LOG_LOCAL3    = 19 << 3,
+               LOG_LOCAL4    = 20 << 3,
+               LOG_LOCAL5    = 21 << 3,
+               LOG_LOCAL6    = 22 << 3,
+               LOG_LOCAL7    = 23 << 3,
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum SyslogLevel {
+               LOG_EMERG   = 0,  // system is unusable
+               LOG_ALERT   = 1,  // action must be taken immediately
+               LOG_CRIT    = 2,  // critical conditions
+               LOG_ERR     = 3,  // warning conditions
+               LOG_WARNING = 4,  // warning conditions
+               LOG_NOTICE  = 5,  // normal but significant condition
+               LOG_INFO    = 6,  // informational
+               LOG_DEBUG   = 7   // debug-level messages
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum OpenFlags : int {
+               //
+               // One of these
+               //
+               O_RDONLY    = 0x00000000,
+               O_WRONLY    = 0x00000001,
+               O_RDWR      = 0x00000002,
+
+               //
+               // Or-ed with zero or more of these
+               //
+               O_CREAT     = 0x00000040,
+               O_EXCL      = 0x00000080,
+               O_NOCTTY    = 0x00000100,
+               O_TRUNC     = 0x00000200,
+               O_APPEND    = 0x00000400,
+               O_NONBLOCK  = 0x00000800,
+               O_SYNC      = 0x00001000,
+
+               //
+               // These are non-Posix.  Using them will result in errors/exceptions on
+               // non-supported platforms.
+               //
+               // (For example, "C-wrapped" system calls -- calls with implementation in
+               // MonoPosixHelper -- will return -1 with errno=EINVAL.  C#-wrapped system
+               // calls will generate an exception in NativeConvert, as the value can't be
+               // converted on the target platform.)
+               //
+               
+               O_NOFOLLOW  = 0x00020000,
+               O_DIRECTORY = 0x00010000,
+               O_DIRECT    = 0x00004000,
+               O_ASYNC     = 0x00002000,
+               O_LARGEFILE = 0x00008000
+       }
+       
+       // mode_t
+       [Flags][Map]
+       [CLSCompliant (false)]
+       public enum FilePermissions : uint {
+               S_ISUID     = 0x0800, // Set user ID on execution
+               S_ISGID     = 0x0400, // Set gorup ID on execution
+               S_ISVTX     = 0x0200, // Save swapped text after use (sticky).
+               S_IRUSR     = 0x0100, // Read by owner
+               S_IWUSR     = 0x0080, // Write by owner
+               S_IXUSR     = 0x0040, // Execute by owner
+               S_IRGRP     = 0x0020, // Read by group
+               S_IWGRP     = 0x0010, // Write by group
+               S_IXGRP     = 0x0008, // Execute by group
+               S_IROTH     = 0x0004, // Read by other
+               S_IWOTH     = 0x0002, // Write by other
+               S_IXOTH     = 0x0001, // Execute by other
+
+               S_IRWXG     = (S_IRGRP | S_IWGRP | S_IXGRP),
+               S_IRWXU     = (S_IRUSR | S_IWUSR | S_IXUSR),
+               S_IRWXO     = (S_IROTH | S_IWOTH | S_IXOTH),
+               ACCESSPERMS = (S_IRWXU | S_IRWXG | S_IRWXO), // 0777
+               ALLPERMS    = (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO), // 07777
+               DEFFILEMODE = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH), // 0666
+
+               // Device types
+               // Why these are held in "mode_t" is beyond me...
+               S_IFMT      = 0xF000, // Bits which determine file type
+               S_IFDIR     = 0x4000, // Directory
+               S_IFCHR     = 0x2000, // Character device
+               S_IFBLK     = 0x6000, // Block device
+               S_IFREG     = 0x8000, // Regular file
+               S_IFIFO     = 0x1000, // FIFO
+               S_IFLNK     = 0xA000, // Symbolic link
+               S_IFSOCK    = 0xC000, // Socket
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum FcntlCommand : int {
+               // Form /usr/include/bits/fcntl.h
+               F_DUPFD    =    0, // Duplicate file descriptor.
+               F_GETFD    =    1, // Get file descriptor flags.
+               F_SETFD    =    2, // Set file descriptor flags.
+               F_GETFL    =    3, // Get file status flags.
+               F_SETFL    =    4, // Set file status flags.
+               F_GETLK    =   12, // Get record locking info. [64]
+               F_SETLK    =   13, // Set record locking info (non-blocking). [64]
+               F_SETLKW   =   14, // Set record locking info (blocking). [64]
+               F_SETOWN   =    8, // Set owner of socket (receiver of SIGIO).
+               F_GETOWN   =    9, // Get owner of socket (receiver of SIGIO).
+               F_SETSIG   =   10, // Set number of signal to be sent.
+               F_GETSIG   =   11, // Get number of signal to be sent.
+               F_SETLEASE = 1024, // Set a lease.
+               F_GETLEASE = 1025, // Enquire what lease is active.
+               F_NOTIFY   = 1026, // Required notifications on a directory
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum LockType : short {
+               F_RDLCK = 0, // Read lock.
+               F_WRLCK = 1, // Write lock.
+               F_UNLCK = 2, // Remove lock.
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum SeekFlags : short {
+               // values liberally copied from /usr/include/unistd.h
+               SEEK_SET = 0, // Seek from beginning of file.
+               SEEK_CUR = 1, // Seek from current position.
+               SEEK_END = 2, // Seek from end of file.
+
+               L_SET    = SEEK_SET, // BSD alias for SEEK_SET
+               L_INCR   = SEEK_CUR, // BSD alias for SEEK_CUR
+               L_XTND   = SEEK_END, // BSD alias for SEEK_END
+       }
+       
+       [Map, Flags]
+       [CLSCompliant (false)]
+       public enum DirectoryNotifyFlags : int {
+               // from /usr/include/bits/fcntl.h
+               DN_ACCESS    = 0x00000001, // File accessed.
+               DN_MODIFY    = 0x00000002, // File modified.
+               DN_CREATE    = 0x00000004, // File created.
+               DN_DELETE    = 0x00000008, // File removed.
+               DN_RENAME    = 0x00000010, // File renamed.
+               DN_ATTRIB    = 0x00000020, // File changed attributes.
+               DN_MULTISHOT = unchecked ((int)0x80000000), // Don't remove notifier
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum PosixFadviseAdvice : int {
+               POSIX_FADV_NORMAL     = 0,  // No further special treatment.
+               POSIX_FADV_RANDOM     = 1,  // Expect random page references.
+               POSIX_FADV_SEQUENTIAL = 2,  // Expect sequential page references.
+               POSIX_FADV_WILLNEED   = 3,  // Will need these pages.
+               POSIX_FADV_DONTNEED   = 4,  // Don't need these pages.
+               POSIX_FADV_NOREUSE    = 5,  // Data will be accessed once.
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum PosixMadviseAdvice : int {
+               POSIX_MADV_NORMAL     = 0,  // No further special treatment.
+               POSIX_MADV_RANDOM     = 1,  // Expect random page references.
+               POSIX_MADV_SEQUENTIAL = 2,  // Expect sequential page references.
+               POSIX_MADV_WILLNEED   = 3,  // Will need these pages.
+               POSIX_MADV_DONTNEED   = 4,  // Don't need these pages.
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum Signum : int {
+               SIGHUP    =  1, // Hangup (POSIX).
+               SIGINT    =  2, // Interrupt (ANSI).
+               SIGQUIT   =  3, // Quit (POSIX).
+               SIGILL    =  4, // Illegal instruction (ANSI).
+               SIGTRAP   =  5, // Trace trap (POSIX).
+               SIGABRT   =  6, // Abort (ANSI).
+               SIGIOT    =  6, // IOT trap (4.2 BSD).
+               SIGBUS    =  7, // BUS error (4.2 BSD).
+               SIGFPE    =  8, // Floating-point exception (ANSI).
+               SIGKILL   =  9, // Kill, unblockable (POSIX).
+               SIGUSR1   = 10, // User-defined signal 1 (POSIX).
+               SIGSEGV   = 11, // Segmentation violation (ANSI).
+               SIGUSR2   = 12, // User-defined signal 2 (POSIX).
+               SIGPIPE   = 13, // Broken pipe (POSIX).
+               SIGALRM   = 14, // Alarm clock (POSIX).
+               SIGTERM   = 15, // Termination (ANSI).
+               SIGSTKFLT = 16, // Stack fault.
+               SIGCLD    = SIGCHLD, // Same as SIGCHLD (System V).
+               SIGCHLD   = 17, // Child status has changed (POSIX).
+               SIGCONT   = 18, // Continue (POSIX).
+               SIGSTOP   = 19, // Stop, unblockable (POSIX).
+               SIGTSTP   = 20, // Keyboard stop (POSIX).
+               SIGTTIN   = 21, // Background read from tty (POSIX).
+               SIGTTOU   = 22, // Background write to tty (POSIX).
+               SIGURG    = 23, // Urgent condition on socket (4.2 BSD).
+               SIGXCPU   = 24, // CPU limit exceeded (4.2 BSD).
+               SIGXFSZ   = 25, // File size limit exceeded (4.2 BSD).
+               SIGVTALRM = 26, // Virtual alarm clock (4.2 BSD).
+               SIGPROF   = 27, // Profiling alarm clock (4.2 BSD).
+               SIGWINCH  = 28, // Window size change (4.3 BSD, Sun).
+               SIGPOLL   = SIGIO, // Pollable event occurred (System V).
+               SIGIO     = 29, // I/O now possible (4.2 BSD).
+               SIGPWR    = 30, // Power failure restart (System V).
+               SIGSYS    = 31, // Bad system call.
+               SIGUNUSED = 31
+       }
+
+       [Flags][Map]
+       [CLSCompliant (false)]
+       public enum WaitOptions : int {
+               WNOHANG   = 1,  // Don't block waiting
+               WUNTRACED = 2,  // Report status of stopped children
+       }
+
+  [Flags][Map]
+       [CLSCompliant (false)]
+       public enum AccessModes : int {
+               R_OK = 1,
+               W_OK = 2,
+               X_OK = 4,
+               F_OK = 8,
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum PathConf : int {
+               _PC_LINK_MAX,
+               _PC_MAX_CANON,
+               _PC_MAX_INPUT,
+               _PC_NAME_MAX,
+               _PC_PATH_MAX,
+               _PC_PIPE_BUF,
+               _PC_CHOWN_RESTRICTED,
+               _PC_NO_TRUNC,
+               _PC_VDISABLE,
+               _PC_SYNC_IO,
+               _PC_ASYNC_IO,
+               _PC_PRIO_IO,
+               _PC_SOCK_MAXBUF,
+               _PC_FILESIZEBITS,
+               _PC_REC_INCR_XFER_SIZE,
+               _PC_REC_MAX_XFER_SIZE,
+               _PC_REC_MIN_XFER_SIZE,
+               _PC_REC_XFER_ALIGN,
+               _PC_ALLOC_SIZE_MIN,
+               _PC_SYMLINK_MAX,
+               _PC_2_SYMLINKS
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum SysConf : int {
+               _SC_ARG_MAX,
+               _SC_CHILD_MAX,
+               _SC_CLK_TCK,
+               _SC_NGROUPS_MAX,
+               _SC_OPEN_MAX,
+               _SC_STREAM_MAX,
+               _SC_TZNAME_MAX,
+               _SC_JOB_CONTROL,
+               _SC_SAVED_IDS,
+               _SC_REALTIME_SIGNALS,
+               _SC_PRIORITY_SCHEDULING,
+               _SC_TIMERS,
+               _SC_ASYNCHRONOUS_IO,
+               _SC_PRIORITIZED_IO,
+               _SC_SYNCHRONIZED_IO,
+               _SC_FSYNC,
+               _SC_MAPPED_FILES,
+               _SC_MEMLOCK,
+               _SC_MEMLOCK_RANGE,
+               _SC_MEMORY_PROTECTION,
+               _SC_MESSAGE_PASSING,
+               _SC_SEMAPHORES,
+               _SC_SHARED_MEMORY_OBJECTS,
+               _SC_AIO_LISTIO_MAX,
+               _SC_AIO_MAX,
+               _SC_AIO_PRIO_DELTA_MAX,
+               _SC_DELAYTIMER_MAX,
+               _SC_MQ_OPEN_MAX,
+               _SC_MQ_PRIO_MAX,
+               _SC_VERSION,
+               _SC_PAGESIZE,
+               _SC_RTSIG_MAX,
+               _SC_SEM_NSEMS_MAX,
+               _SC_SEM_VALUE_MAX,
+               _SC_SIGQUEUE_MAX,
+               _SC_TIMER_MAX,
+               /* Values for the argument to `sysconf'
+                        corresponding to _POSIX2_* symbols.  */
+               _SC_BC_BASE_MAX,
+               _SC_BC_DIM_MAX,
+               _SC_BC_SCALE_MAX,
+               _SC_BC_STRING_MAX,
+               _SC_COLL_WEIGHTS_MAX,
+               _SC_EQUIV_CLASS_MAX,
+               _SC_EXPR_NEST_MAX,
+               _SC_LINE_MAX,
+               _SC_RE_DUP_MAX,
+               _SC_CHARCLASS_NAME_MAX,
+               _SC_2_VERSION,
+               _SC_2_C_BIND,
+               _SC_2_C_DEV,
+               _SC_2_FORT_DEV,
+               _SC_2_FORT_RUN,
+               _SC_2_SW_DEV,
+               _SC_2_LOCALEDEF,
+               _SC_PII,
+               _SC_PII_XTI,
+               _SC_PII_SOCKET,
+               _SC_PII_INTERNET,
+               _SC_PII_OSI,
+               _SC_POLL,
+               _SC_SELECT,
+               _SC_UIO_MAXIOV,
+               _SC_IOV_MAX = _SC_UIO_MAXIOV,
+               _SC_PII_INTERNET_STREAM,
+               _SC_PII_INTERNET_DGRAM,
+               _SC_PII_OSI_COTS,
+               _SC_PII_OSI_CLTS,
+               _SC_PII_OSI_M,
+               _SC_T_IOV_MAX,
+               /* Values according to POSIX 1003.1c (POSIX threads).  */
+               _SC_THREADS,
+               _SC_THREAD_SAFE_FUNCTIONS,
+               _SC_GETGR_R_SIZE_MAX,
+               _SC_GETPW_R_SIZE_MAX,
+               _SC_LOGIN_NAME_MAX,
+               _SC_TTY_NAME_MAX,
+               _SC_THREAD_DESTRUCTOR_ITERATIONS,
+               _SC_THREAD_KEYS_MAX,
+               _SC_THREAD_STACK_MIN,
+               _SC_THREAD_THREADS_MAX,
+               _SC_THREAD_ATTR_STACKADDR,
+               _SC_THREAD_ATTR_STACKSIZE,
+               _SC_THREAD_PRIORITY_SCHEDULING,
+               _SC_THREAD_PRIO_INHERIT,
+               _SC_THREAD_PRIO_PROTECT,
+               _SC_THREAD_PROCESS_SHARED,
+               _SC_NPROCESSORS_CONF,
+               _SC_NPROCESSORS_ONLN,
+               _SC_PHYS_PAGES,
+               _SC_AVPHYS_PAGES,
+               _SC_ATEXIT_MAX,
+               _SC_PASS_MAX,
+               _SC_XOPEN_VERSION,
+               _SC_XOPEN_XCU_VERSION,
+               _SC_XOPEN_UNIX,
+               _SC_XOPEN_CRYPT,
+               _SC_XOPEN_ENH_I18N,
+               _SC_XOPEN_SHM,
+               _SC_2_CHAR_TERM,
+               _SC_2_C_VERSION,
+               _SC_2_UPE,
+               _SC_XOPEN_XPG2,
+               _SC_XOPEN_XPG3,
+               _SC_XOPEN_XPG4,
+               _SC_CHAR_BIT,
+               _SC_CHAR_MAX,
+               _SC_CHAR_MIN,
+               _SC_INT_MAX,
+               _SC_INT_MIN,
+               _SC_LONG_BIT,
+               _SC_WORD_BIT,
+               _SC_MB_LEN_MAX,
+               _SC_NZERO,
+               _SC_SSIZE_MAX,
+               _SC_SCHAR_MAX,
+               _SC_SCHAR_MIN,
+               _SC_SHRT_MAX,
+               _SC_SHRT_MIN,
+               _SC_UCHAR_MAX,
+               _SC_UINT_MAX,
+               _SC_ULONG_MAX,
+               _SC_USHRT_MAX,
+               _SC_NL_ARGMAX,
+               _SC_NL_LANGMAX,
+               _SC_NL_MSGMAX,
+               _SC_NL_NMAX,
+               _SC_NL_SETMAX,
+               _SC_NL_TEXTMAX,
+               _SC_XBS5_ILP32_OFF32,
+               _SC_XBS5_ILP32_OFFBIG,
+               _SC_XBS5_LP64_OFF64,
+               _SC_XBS5_LPBIG_OFFBIG,
+               _SC_XOPEN_LEGACY,
+               _SC_XOPEN_REALTIME,
+               _SC_XOPEN_REALTIME_THREADS,
+               _SC_ADVISORY_INFO,
+               _SC_BARRIERS,
+               _SC_BASE,
+               _SC_C_LANG_SUPPORT,
+               _SC_C_LANG_SUPPORT_R,
+               _SC_CLOCK_SELECTION,
+               _SC_CPUTIME,
+               _SC_THREAD_CPUTIME,
+               _SC_DEVICE_IO,
+               _SC_DEVICE_SPECIFIC,
+               _SC_DEVICE_SPECIFIC_R,
+               _SC_FD_MGMT,
+               _SC_FIFO,
+               _SC_PIPE,
+               _SC_FILE_ATTRIBUTES,
+               _SC_FILE_LOCKING,
+               _SC_FILE_SYSTEM,
+               _SC_MONOTONIC_CLOCK,
+               _SC_MULTI_PROCESS,
+               _SC_SINGLE_PROCESS,
+               _SC_NETWORKING,
+               _SC_READER_WRITER_LOCKS,
+               _SC_SPIN_LOCKS,
+               _SC_REGEXP,
+               _SC_REGEX_VERSION,
+               _SC_SHELL,
+               _SC_SIGNALS,
+               _SC_SPAWN,
+               _SC_SPORADIC_SERVER,
+               _SC_THREAD_SPORADIC_SERVER,
+               _SC_SYSTEM_DATABASE,
+               _SC_SYSTEM_DATABASE_R,
+               _SC_TIMEOUTS,
+               _SC_TYPED_MEMORY_OBJECTS,
+               _SC_USER_GROUPS,
+               _SC_USER_GROUPS_R,
+               _SC_2_PBS,
+               _SC_2_PBS_ACCOUNTING,
+               _SC_2_PBS_LOCATE,
+               _SC_2_PBS_MESSAGE,
+               _SC_2_PBS_TRACK,
+               _SC_SYMLOOP_MAX,
+               _SC_STREAMS,
+               _SC_2_PBS_CHECKPOINT,
+               _SC_V6_ILP32_OFF32,
+               _SC_V6_ILP32_OFFBIG,
+               _SC_V6_LP64_OFF64,
+               _SC_V6_LPBIG_OFFBIG,
+               _SC_HOST_NAME_MAX,
+               _SC_TRACE,
+               _SC_TRACE_EVENT_FILTER,
+               _SC_TRACE_INHERIT,
+               _SC_TRACE_LOG,
+               _SC_LEVEL1_ICACHE_SIZE,
+               _SC_LEVEL1_ICACHE_ASSOC,
+               _SC_LEVEL1_ICACHE_LINESIZE,
+               _SC_LEVEL1_DCACHE_SIZE,
+               _SC_LEVEL1_DCACHE_ASSOC,
+               _SC_LEVEL1_DCACHE_LINESIZE,
+               _SC_LEVEL2_CACHE_SIZE,
+               _SC_LEVEL2_CACHE_ASSOC,
+               _SC_LEVEL2_CACHE_LINESIZE,
+               _SC_LEVEL3_CACHE_SIZE,
+               _SC_LEVEL3_CACHE_ASSOC,
+               _SC_LEVEL3_CACHE_LINESIZE,
+               _SC_LEVEL4_CACHE_SIZE,
+               _SC_LEVEL4_CACHE_ASSOC,
+               _SC_LEVEL4_CACHE_LINESIZE
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum ConfStr : int {
+               _CS_PATH,                       /* The default search path.  */
+               _CS_V6_WIDTH_RESTRICTED_ENVS,
+               _CS_GNU_LIBC_VERSION,
+               _CS_GNU_LIBPTHREAD_VERSION,
+               _CS_LFS_CFLAGS = 1000,
+               _CS_LFS_LDFLAGS,
+               _CS_LFS_LIBS,
+               _CS_LFS_LINTFLAGS,
+               _CS_LFS64_CFLAGS,
+               _CS_LFS64_LDFLAGS,
+               _CS_LFS64_LIBS,
+               _CS_LFS64_LINTFLAGS,
+               _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
+               _CS_XBS5_ILP32_OFF32_LDFLAGS,
+               _CS_XBS5_ILP32_OFF32_LIBS,
+               _CS_XBS5_ILP32_OFF32_LINTFLAGS,
+               _CS_XBS5_ILP32_OFFBIG_CFLAGS,
+               _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
+               _CS_XBS5_ILP32_OFFBIG_LIBS,
+               _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
+               _CS_XBS5_LP64_OFF64_CFLAGS,
+               _CS_XBS5_LP64_OFF64_LDFLAGS,
+               _CS_XBS5_LP64_OFF64_LIBS,
+               _CS_XBS5_LP64_OFF64_LINTFLAGS,
+               _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
+               _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
+               _CS_XBS5_LPBIG_OFFBIG_LIBS,
+               _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
+               _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
+               _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
+               _CS_POSIX_V6_ILP32_OFF32_LIBS,
+               _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
+               _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
+               _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
+               _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
+               _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
+               _CS_POSIX_V6_LP64_OFF64_CFLAGS,
+               _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
+               _CS_POSIX_V6_LP64_OFF64_LIBS,
+               _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
+               _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
+               _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
+               _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
+               _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+       }
+
+       [Map]
+       [CLSCompliant (false)]
+       public enum LockfCommand : int {
+               F_ULOCK = 0, // Unlock a previously locked region.
+               F_LOCK  = 1, // Lock a region for exclusive use.
+               F_TLOCK = 2, // Test and lock a region for exclusive use.
+               F_TEST  = 3, // Test a region for other process locks.
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum PollEvents : short {
+               POLLIN      = 0x0001, // There is data to read
+               POLLPRI     = 0x0002, // There is urgent data to read
+               POLLOUT     = 0x0004, // Writing now will not block
+               POLLERR     = 0x0008, // Error condition
+               POLLHUP     = 0x0010, // Hung up
+               POLLNVAL    = 0x0020, // Invalid request; fd not open
+               // XPG4.2 definitions (via _XOPEN_SOURCE)
+               POLLRDNORM  = 0x0040, // Normal data bay be read
+               POLLRDBAND  = 0x0080, // Priority data may be read
+               POLLWRNORM  = 0x0100, // Writing now will not block
+               POLLWRBAND  = 0x0200, // Priority data may be written
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum XattrFlags : int {
+               XATTR_AUTO = 0,
+               XATTR_CREATE = 1,
+               XATTR_REPLACE = 2,
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum MountFlags : ulong {
+               ST_RDONLY      =    1,  // Mount read-only
+               ST_NOSUID      =    2,  // Ignore suid and sgid bits
+               ST_NODEV       =    4,  // Disallow access to device special files
+               ST_SYNCHRONOUS =   16,  // Writes are synced at once
+               ST_MANDLOCK    =   64,  // Allow mandatory locks on an FS
+               ST_WRITE       =  128,  // Write on file/directory/symlink
+               ST_APPEND      =  256,  // Append-only file
+               ST_IMMUTABLE   =  512,  // Immutable file
+               ST_NOATIME     = 1024,  // Do not update access times
+               ST_NODIRATIME  = 2048,  // Do not update directory access times
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum MmapFlags : int {
+               MAP_SHARED      = 0x01,     // Share changes.
+               MAP_PRIVATE     = 0x02,     // Changes are private.
+               MAP_TYPE        = 0x0f,     // Mask for type of mapping.
+               MAP_FIXED       = 0x10,     // Interpret addr exactly.
+               MAP_FILE        = 0,
+               MAP_ANONYMOUS   = 0x20,     // Don't use a file.
+               MAP_ANON        = MAP_ANONYMOUS,
+
+               // These are Linux-specific.
+               MAP_GROWSDOWN   = 0x00100,  // Stack-like segment.
+               MAP_DENYWRITE   = 0x00800,  // ETXTBSY
+               MAP_EXECUTABLE  = 0x01000,  // Mark it as an executable.
+               MAP_LOCKED      = 0x02000,  // Lock the mapping.
+               MAP_NORESERVE   = 0x04000,  // Don't check for reservations.
+               MAP_POPULATE    = 0x08000,  // Populate (prefault) pagetables.
+               MAP_NONBLOCK    = 0x10000,  // Do not block on IO.
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum MmapProts : int {
+               PROT_READ       = 0x1,  // Page can be read.
+               PROT_WRITE      = 0x2,  // Page can be written.
+               PROT_EXEC       = 0x4,  // Page can be executed.
+               PROT_NONE       = 0x0,  // Page can not be accessed.
+               PROT_GROWSDOWN  = 0x01000000, // Extend change to start of
+                                             //   growsdown vma (mprotect only).
+               PROT_GROWSUP    = 0x02000000, // Extend change to start of
+                                             //   growsup vma (mprotect only).
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum MsyncFlags : int {
+               MS_ASYNC      = 0x1,  // Sync memory asynchronously.
+               MS_SYNC       = 0x4,  // Synchronous memory sync.
+               MS_INVALIDATE = 0x2,  // Invalidate the caches.
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum MlockallFlags : int {
+               MCL_CURRENT     = 0x1,  // Lock all currently mapped pages.
+               MCL_FUTURE  = 0x2,      // Lock all additions to address
+       }
+
+       [Map][Flags]
+       [CLSCompliant (false)]
+       public enum MremapFlags : ulong {
+               MREMAP_MAYMOVE = 0x1,
+       }
+
+       #endregion
+
+       #region Structures
+
+       public struct Flock {
+               [CLSCompliant (false)]
+               public LockType         l_type;    // Type of lock: F_RDLCK, F_WRLCK, F_UNLCK
+               [CLSCompliant (false)]
+               public SeekFlags        l_whence;  // How to interpret l_start
+               public /* off_t */ long l_start;   // Starting offset for lock
+               public /* off_t */ long l_len;     // Number of bytes to lock
+               public /* pid_t */ int  l_pid;     // PID of process blocking our lock (F_GETLK only)
+       }
+
+       [StructLayout(LayoutKind.Sequential)]
+       public struct Pollfd {
+               public int fd;
+               [CLSCompliant (false)]
+               public PollEvents events;
+               [CLSCompliant (false)]
+               public PollEvents revents;
+       }
+
+       public struct Stat {
+               [CLSCompliant (false)]
+               public  /* dev_t */     ulong   st_dev;     // device
+               [CLSCompliant (false)]
+               public  /* ino_t */     ulong   st_ino;     // inode
+               [CLSCompliant (false)]
+               public  FilePermissions         st_mode;    // protection
+               [CLSCompliant (false)]
+               private uint                    _padding_;  // padding for structure alignment
+               [CLSCompliant (false)]
+               public  /* nlink_t */   ulong   st_nlink;   // number of hard links
+               [CLSCompliant (false)]
+               public  /* uid_t */     uint    st_uid;     // user ID of owner
+               [CLSCompliant (false)]
+               public  /* gid_t */     uint    st_gid;     // group ID of owner
+               [CLSCompliant (false)]
+               public  /* dev_t */     ulong   st_rdev;    // device type (if inode device)
+               public  /* off_t */     long    st_size;    // total size, in bytes
+               public  /* blksize_t */ long    st_blksize; // blocksize for filesystem I/O
+               public  /* blkcnt_t */  long    st_blocks;  // number of blocks allocated
+               public  /* time_t */    long    st_atime;   // time of last access
+               public  /* time_t */    long    st_mtime;   // time of last modification
+               public  /* time_t */    long    st_ctime;   // time of last status change
+       }
+
+       [CLSCompliant (false)]
+       public struct Statvfs {
+               public                  ulong f_bsize;    // file system block size
+               public                  ulong f_frsize;   // fragment size
+               public /* fsblkcnt_t */ ulong f_blocks;   // size of fs in f_frsize units
+               public /* fsblkcnt_t */ ulong f_bfree;    // # free blocks
+               public /* fsblkcnt_t */ ulong f_bavail;   // # free blocks for non-root
+               public /* fsfilcnt_t */ ulong f_files;    // # inodes
+               public /* fsfilcnt_t */ ulong f_ffree;    // # free inodes
+               public /* fsfilcnt_t */ ulong f_favail;   // # free inodes for non-root
+               public                  ulong f_fsid;     // file system id
+               public MountFlags             f_flag;     // mount flags
+               public                  ulong f_namemax;  // maximum filename length
+       }
+
+       public struct Timeval {
+               public  /* time_t */      long    tv_sec;   // seconds
+               public  /* suseconds_t */ long    tv_usec;  // microseconds
+       }
+
+       public struct Timezone {
+               public  int tz_minuteswest; // minutes W of Greenwich
+               private int tz_dsttime;     // type of dst correction (OBSOLETE)
+       }
+
+       public struct Utimbuf {
+               public  /* time_t */      long    actime;   // access time
+               public  /* time_t */      long    modtime;  // modification time
+       }
+
+       #endregion
+
+       #region Classes
+
+       [CLSCompliant (false)]
+       public sealed class Dirent
+       {
+               [CLSCompliant (false)]
+               public /* ino_t */ ulong  d_ino;
+               public /* off_t */ long   d_off;
+               [CLSCompliant (false)]
+               public ushort             d_reclen;
+               public byte               d_type;
+               public string             d_name;
+
+               public override int GetHashCode ()
+               {
+                       return d_ino.GetHashCode () ^ d_off.GetHashCode () ^ 
+                               d_reclen.GetHashCode () ^ d_type.GetHashCode () ^
+                               d_name.GetHashCode ();
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType() != obj.GetType())
+                               return false;
+                       Dirent d = (Dirent) obj;
+                       return d.d_ino == d_ino && d.d_off == d_off &&
+                               d.d_reclen == d_reclen && d.d_type == d_type &&
+                               d.d_name == d_name;
+               }
+
+               public override string ToString ()
+               {
+                       return d_name;
+               }
+
+               public static bool operator== (Dirent lhs, Dirent rhs)
+               {
+                       return Object.Equals (lhs, rhs);
+               }
+
+               public static bool operator!= (Dirent lhs, Dirent rhs)
+               {
+                       return !Object.Equals (lhs, rhs);
+               }
+       }
+
+       public sealed class Fstab
+       {
+               public string fs_spec;
+               public string fs_file;
+               public string fs_vfstype;
+               public string fs_mntops;
+               public string fs_type;
+               public int    fs_freq;
+               public int    fs_passno;
+
+               public override int GetHashCode ()
+               {
+                       return fs_spec.GetHashCode () ^ fs_file.GetHashCode () ^
+                               fs_vfstype.GetHashCode () ^ fs_mntops.GetHashCode () ^
+                               fs_type.GetHashCode () ^ fs_freq ^ fs_passno;
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType() != obj.GetType())
+                               return false;
+                       Fstab  f = (Fstab) obj;
+                       return f.fs_spec == fs_spec && f.fs_file == fs_file &&
+                               f.fs_vfstype == fs_vfstype && f.fs_mntops == fs_mntops &&
+                               f.fs_type == fs_type && f.fs_freq == fs_freq && 
+                               f.fs_passno == fs_passno;
+               }
+
+               public override string ToString ()
+               {
+                       return fs_spec;
+               }
+
+               public static bool operator== (Fstab lhs, Fstab rhs)
+               {
+                       return Object.Equals (lhs, rhs);
+               }
+
+               public static bool operator!= (Fstab lhs, Fstab rhs)
+               {
+                       return !Object.Equals (lhs, rhs);
+               }
+       }
+
+       public sealed class Group
+       {
+               public string           gr_name;
+               public string           gr_passwd;
+               [CLSCompliant (false)]
+               public /* gid_t */ uint gr_gid;
+               public string[]         gr_mem;
+
+               public override int GetHashCode ()
+               {
+                       int memhc = 0;
+                       for (int i = 0; i < gr_mem.Length; ++i)
+                               memhc ^= gr_mem[i].GetHashCode ();
+
+                       return gr_name.GetHashCode () ^ gr_passwd.GetHashCode () ^ 
+                               gr_gid.GetHashCode () ^ memhc;
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType() != obj.GetType())
+                               return false;
+                       Group g = (Group) obj;
+                       if (g.gr_gid != gr_gid)
+                               return false;
+                       if (g.gr_gid == gr_gid && g.gr_name == gr_name &&
+                               g.gr_passwd == gr_passwd) {
+                               if (g.gr_mem == gr_mem)
+                                       return true;
+                               if (g.gr_mem == null || gr_mem == null)
+                                       return false;
+                               if (g.gr_mem.Length != gr_mem.Length)
+                                       return false;
+                               for (int i = 0; i < gr_mem.Length; ++i)
+                                       if (gr_mem[i] != g.gr_mem[i])
+                                               return false;
+                               return true;
+                       }
+                       return false;
+               }
+
+               // Generate string in /etc/group format
+               public override string ToString ()
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.AppendFormat ("{0}:{1}:{2}:", gr_name, gr_passwd, gr_gid);
+                       GetMembers (sb, gr_mem);
+                       return sb.ToString ();
+               }
+
+               private static void GetMembers (StringBuilder sb, string[] members)
+               {
+                       if (members.Length > 0)
+                               sb.Append (members[0]);
+                       for (int i = 1; i < members.Length; ++i) {
+                               sb.Append (",");
+                               sb.Append (members[i]);
+                       }
+               }
+
+               public static bool operator== (Group lhs, Group rhs)
+               {
+                       return Object.Equals (lhs, rhs);
+               }
+
+               public static bool operator!= (Group lhs, Group rhs)
+               {
+                       return !Object.Equals (lhs, rhs);
+               }
+       }
+
+       public sealed class Passwd
+       {
+               public string           pw_name;
+               public string           pw_passwd;
+               [CLSCompliant (false)]
+               public /* uid_t */ uint pw_uid;
+               [CLSCompliant (false)]
+               public /* gid_t */ uint pw_gid;
+               public string           pw_gecos;
+               public string           pw_dir;
+               public string           pw_shell;
+
+               public override int GetHashCode ()
+               {
+                       return pw_name.GetHashCode () ^ pw_passwd.GetHashCode () ^ 
+                               pw_uid.GetHashCode () ^ pw_gid.GetHashCode () ^
+                               pw_gecos.GetHashCode () ^ pw_dir.GetHashCode () ^
+                               pw_dir.GetHashCode () ^ pw_shell.GetHashCode ();
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType() != obj.GetType())
+                               return false;
+                       Passwd p = (Passwd) obj;
+                       return p.pw_uid == pw_uid && p.pw_gid == pw_gid && p.pw_name == pw_name && 
+                               p.pw_passwd == pw_passwd && p.pw_gecos == pw_gecos && 
+                               p.pw_dir == pw_dir && p.pw_shell == pw_shell;
+               }
+
+               // Generate string in /etc/passwd format
+               public override string ToString ()
+               {
+                       return string.Format ("{0}:{1}:{2}:{3}:{4}:{5}:{6}",
+                               pw_name, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell);
+               }
+
+               public static bool operator== (Passwd lhs, Passwd rhs)
+               {
+                       return Object.Equals (lhs, rhs);
+               }
+
+               public static bool operator!= (Passwd lhs, Passwd rhs)
+               {
+                       return !Object.Equals (lhs, rhs);
+               }
+       }
+
+       //
+       // Convention: Functions *not* part of the standard C library AND part of
+       // a POSIX and/or Unix standard (X/Open, SUS, XPG, etc.) go here.
+       //
+       // For example, the man page should be similar to:
+       //
+       //    CONFORMING TO (or CONFORMS TO)
+       //           XPG2, SUSv2, POSIX, etc.
+       //
+       // BSD- and GNU-specific exports can also be placed here.
+       //
+       // Non-POSIX/XPG/etc. functions can also be placed here if:
+       //  (a) They'd be likely to be covered in a Steven's-like book
+       //  (b) The functions would be present in libc.so (or equivalent).
+       //
+       // If a function has its own library, that's a STRONG indicator that the
+       // function should get a different binding, probably in its own assembly, 
+       // so that package management can work sanely.  (That is, we'd like to avoid
+       // scenarios where FooLib.dll is installed, but it requires libFooLib.so to
+       // run, and libFooLib.so doesn't exist.  That would be confusing.)
+       //
+       // The only methods in here should be:
+       //  (1) low-level functions
+       //  (2) "Trivial" function overloads.  For example, if the parameters to a
+       //      function are related (e.g. getgroups(2))
+       //  (3) The return type SHOULD NOT be changed.  If you want to provide a
+       //      convenience function with a nicer return type, place it into one of
+       //      the Mono.Unix.Unix* wrapper classes, and give it a .NET-styled name.
+       //  (4) Exceptions SHOULD NOT be thrown.  EXCEPTIONS: 
+       //      - If you're wrapping *broken* methods which make assumptions about 
+       //        input data, such as that an argument refers to N bytes of data.  
+       //        This is currently limited to cuserid(3) and encrypt(3).
+       //      - If you call functions which themselves generate exceptions.  
+       //        This is the case for using NativeConvert, which will throw an
+       //        exception if an invalid/unsupported value is used.
+       //
+       // Naming Conventions:
+       //  - Syscall method names should have the same name as the function being
+       //    wrapped (e.g. Syscall.read ==> read(2)).  This allows people to
+       //    consult the appropriate man page if necessary.
+       //  - Methods need not have the same arguments IF this simplifies or
+       //    permits correct usage.  The current example is syslog, in which
+       //    syslog(3)'s single `priority' argument is split into SyslogFacility
+       //    and SyslogLevel arguments.
+       //  - Type names (structures, classes, enumerations) are always PascalCased.
+       //  - Enumerations are named as <MethodName><ArgumentName>, and are located
+       //    in the Mono.Unix namespace.  For readability, if ArgumentName is
+       //    "cmd", use Command instead.  For example, fcntl(2) takes a
+       //    FcntlCommand argument.  This naming convention is to provide an
+       //    assocation between an enumeration and where it should be used, and
+       //    allows a single method to accept multiple different enumerations 
+       //    (see mmap(2), which takes MmapProts and MmapFlags).
+       //    - EXCEPTION: if an enumeration is shared between multiple different
+       //      methods, AND/OR the "obvious" enumeration name conflicts with an
+       //      existing .NET type, a more appropriate name should be used.
+       //      Example: FilePermissions
+       //    - EXCEPTION: [Flags] enumerations should get plural names to follow
+       //      .NET name guidelines.  Usually this doesn't result in a change
+       //      (OpenFlags is the `flags' parameter for open(2)), but it can
+       //      (mmap(2) prot ==> MmapProts, access(2) mode ==> AccessModes).
+       //  - Enumerations should have the [Map] and (optional) [Flags] attributes.
+       //    [Map] is required for make-map to find the type and generate the
+       //    appropriate NativeConvert conversion functions.
+       //  - Enumeration contents should match the original Unix names.  This helps
+       //    with documentation (the existing man pages are still useful), and is
+       //    required for use with the make-map generation program.
+       //  - Structure names should be the PascalCased version of the actual
+       //    structure name (struct flock ==> Flock).  Structure members should
+       //    have the same names, or a (reasonably) portable subset (Dirent being
+       //    the poster child for questionable members).
+       //    - Whether the managed type should be a reference type (class) or a 
+       //      value type (struct) should be determined on a case-by-case basis: 
+       //      if you ever need to be able to use NULL for it (such as with Dirent, 
+       //      Group, Passwd, as these are method return types and `null' is used 
+       //      to signify the end), it should be a reference type; otherwise, use 
+       //      your discretion, and keep any expected usage patterns in mind.
+       //  - Syscall should be a Single Point Of Truth (SPOT).  There should be
+       //    only ONE way to do anything.  By convention, the Linux function names
+       //    are used, but that need not always be the case (use your discretion).
+       //    It SHOULD NOT be required that developers know what platform they're
+       //    on, and choose among a set of similar functions.  In short, anything
+       //    that requires a platform check is BAD -- Mono.Unix is a wrapper, and
+       //    we can afford to clean things up whenever possible.
+       //    - Examples: 
+       //      - Syscall.statfs: Solaris/Mac OS X provide statfs(2), Linux provides
+       //        statvfs(2).  MonoPosixHelper will "thunk" between the two,
+       //        exporting a statvfs that works across platforms.
+       //      - Syscall.getfsent: Glibc export which Solaris lacks, while Solaris
+       //        instead provides getvfsent(3).  MonoPosixHelper provides wrappers
+       //        to convert getvfsent(3) into Fstab data.
+       //    - Exception: If it isn't possible to cleanly wrap platforms, then the
+       //      method shouldn't be exported.  The user will be expected to do their
+       //      own platform check and their own DllImports.
+       //      Examples: mount(2), umount(2), etc.
+       //    - Note: if a platform doesn't support a function AT ALL, the
+       //      MonoPosixHelper wrapper won't be compiled, resulting in a
+       //      EntryPointNotFoundException.  This is also consistent with a missing 
+       //      P/Invoke into libc.so.
+       //
+       [CLSCompliant (false)]
+       public sealed class Syscall : Stdlib
+       {
+               new internal const string LIBC  = "libc";
+                   private  const string CRYPT = "crypt";
+
+               private Syscall () {}
+
+               //
+               // <aio.h>
+               //
+
+               // TODO: aio_cancel(3), aio_error(3), aio_fsync(3), aio_read(3), 
+               // aio_return(3), aio_suspend(3), aio_write(3)
+               //
+               // Then update UnixStream.BeginRead to use the aio* functions.
+
+
+               #region <attr/xattr.h> Declarations
+               //
+               // <attr/xattr.h> -- COMPLETE
+               //
+
+               // setxattr(2)
+               //    int setxattr (const char *path, const char *name,
+               //        const void *value, size_t size, int flags);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_setxattr")]
+               public static extern int setxattr (string path, string name, byte[] value, ulong size, XattrFlags flags);
+
+               public static int setxattr (string path, string name, byte [] value, ulong size)
+               {
+                       return setxattr (path, name, value, size, XattrFlags.XATTR_AUTO);
+               }
+
+               public static int setxattr (string path, string name, byte [] value, XattrFlags flags)
+               {
+                       return setxattr (path, name, value, (ulong) value.Length, flags);
+               }
+
+               public static int setxattr (string path, string name, byte [] value)
+               {
+                       return setxattr (path, name, value, (ulong) value.Length);
+               }
+
+               // lsetxattr(2)
+               //        int lsetxattr (const char *path, const char *name,
+               //                   const void *value, size_t size, int flags);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_lsetxattr")]
+               public static extern int lsetxattr (string path, string name, byte[] value, ulong size, XattrFlags flags);
+
+               public static int lsetxattr (string path, string name, byte [] value, ulong size)
+               {
+                       return lsetxattr (path, name, value, size, XattrFlags.XATTR_AUTO);
+               }
+
+               public static int lsetxattr (string path, string name, byte [] value, XattrFlags flags)
+               {
+                       return lsetxattr (path, name, value, (ulong) value.Length, flags);
+               }
+
+               public static int lsetxattr (string path, string name, byte [] value)
+               {
+                       return lsetxattr (path, name, value, (ulong) value.Length);
+               }
+
+               // fsetxattr(2)
+               //        int fsetxattr (int fd, const char *name,
+               //                   const void *value, size_t size, int flags);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_fsetxattr")]
+               public static extern int fsetxattr (int fd, string name, byte[] value, ulong size, XattrFlags flags);
+
+               public static int fsetxattr (int fd, string name, byte [] value, ulong size)
+               {
+                       return fsetxattr (fd, name, value, size, XattrFlags.XATTR_AUTO);
+               }
+
+               public static int fsetxattr (int fd, string name, byte [] value, XattrFlags flags)
+               {
+                       return fsetxattr (fd, name, value, (ulong) value.Length, flags);
+               }
+
+               public static int fsetxattr (int fd, string name, byte [] value)
+               {
+                       return fsetxattr (fd, name, value, (ulong) value.Length);
+               }
+
+               // getxattr(2)
+               //        ssize_t getxattr (const char *path, const char *name,
+               //                      void *value, size_t size);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getxattr")]
+               public static extern long getxattr (string path, string name, byte[] value, ulong size);
+
+               public static long getxattr (string path, string name, byte [] value)
+               {
+                       return getxattr (path, name, value, (ulong) value.Length);
+               }
+
+               public static long getxattr (string path, string name, out byte [] value)
+               {
+                       value = null;
+                       long size = getxattr (path, name, value, 0);
+                       if (size <= 0)
+                               return size;
+
+                       value = new byte [size];
+                       return getxattr (path, name, value, (ulong) size);
+               }
+
+               // lgetxattr(2)
+               //        ssize_t lgetxattr (const char *path, const char *name,
+               //                       void *value, size_t size);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_lgetxattr")]
+               public static extern long lgetxattr (string path, string name, byte[] value, ulong size);
+
+               public static long lgetxattr (string path, string name, byte [] value)
+               {
+                       return lgetxattr (path, name, value, (ulong) value.Length);
+               }
+
+               public static long lgetxattr (string path, string name, out byte [] value)
+               {
+                       value = null;
+                       long size = lgetxattr (path, name, value, 0);
+                       if (size <= 0)
+                               return size;
+
+                       value = new byte [size];
+                       return lgetxattr (path, name, value, (ulong) size);
+               }
+
+               // fgetxattr(2)
+               //        ssize_t fgetxattr (int fd, const char *name, void *value, size_t size);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_fgetxattr")]
+               public static extern long fgetxattr (int fd, string name, byte[] value, ulong size);
+
+               public static long fgetxattr (int fd, string name, byte [] value)
+               {
+                       return fgetxattr (fd, name, value, (ulong) value.Length);
+               }
+
+               public static long fgetxattr (int fd, string name, out byte [] value)
+               {
+                       value = null;
+                       long size = fgetxattr (fd, name, value, 0);
+                       if (size <= 0)
+                               return size;
+
+                       value = new byte [size];
+                       return fgetxattr (fd, name, value, (ulong) size);
+               }
+
+               // listxattr(2)
+               //        ssize_t listxattr (const char *path, char *list, size_t size);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_listxattr")]
+               public static extern long listxattr (string path, byte[] list, ulong size);
+
+               // Slight modification: returns 0 on success, negative on error
+               public static long listxattr (string path, Encoding encoding, out string [] values)
+               {
+                       values = null;
+                       long size = listxattr (path, null, 0);
+                       if (size == 0)
+                               values = new string [0];
+                       if (size <= 0)
+                               return (int) size;
+
+                       byte[] list = new byte [size];
+                       long ret = listxattr (path, list, (ulong) size);
+                       if (ret < 0)
+                               return (int) ret;
+
+                       string [] output = encoding.GetString (list).Split((char) 0);
+                       values = new string [output.Length - 1];
+                       Array.Copy (output, 0, values, 0, output.Length - 1);
+                       return 0;
+               }
+
+               // llistxattr(2)
+               //        ssize_t llistxattr (const char *path, char *list, size_t size);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_llistxattr")]
+               public static extern long llistxattr (string path, byte[] list, ulong size);
+
+               // Slight modification: returns 0 on success, negative on error
+               public static long llistxattr (string path, Encoding encoding, out string [] values)
+               {
+                       values = null;
+                       long size = llistxattr (path, null, 0);
+                       if (size == 0)
+                               values = new string [0];
+                       if (size <= 0)
+                               return (int) size;
+
+                       byte[] list = new byte [size];
+                       long ret = llistxattr (path, list, (ulong) size);
+                       if (ret < 0)
+                               return (int) ret;
+
+                       string [] output = encoding.GetString (list).Split((char) 0);
+                       values = new string [output.Length - 1];
+                       Array.Copy (output, 0, values, 0, output.Length - 1);
+                       return 0;
+               }
+
+               // flistxattr(2)
+               //        ssize_t flistxattr (int fd, char *list, size_t size);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_flistxattr")]
+               public static extern long flistxattr (int fd, byte[] list, ulong size);
+
+               // Slight modification: returns 0 on success, negative on error
+               public static long flistxattr (int fd, Encoding encoding, out string [] values)
+               {
+                       values = null;
+                       long size = flistxattr (fd, null, 0);
+                       if (size == 0)
+                               values = new string [0];
+                       if (size <= 0)
+                               return (int) size;
+
+                       byte[] list = new byte [size];
+                       long ret = flistxattr (fd, list, (ulong) size);
+                       if (ret < 0)
+                               return (int) ret;
+
+                       string [] output = encoding.GetString (list).Split((char) 0);
+                       values = new string [output.Length - 1];
+                       Array.Copy (output, 0, values, 0, output.Length - 1);
+                       return 0;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_removexattr")]
+               public static extern int removexattr (string path, string name);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_lremovexattr")]
+               public static extern int lremovexattr (string path, string name);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_fremovexattr")]
+               public static extern int fremovexattr (int fd, string name);
+               #endregion
+
+               #region <dirent.h> Declarations
+               //
+               // <dirent.h>
+               //
+               // TODO: scandir(3), alphasort(3), versionsort(3), getdirentries(3)
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern IntPtr opendir (string name);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int closedir (IntPtr dir);
+
+               // seekdir(3):
+               //    void seekdir (DIR *dir, off_t offset);
+               //    Slight modification.  Returns -1 on error, 0 on success.
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_seekdir")]
+               public static extern int seekdir (IntPtr dir, long offset);
+
+               // telldir(3)
+               //    off_t telldir(DIR *dir);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_telldir")]
+               public static extern long telldir (IntPtr dir);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern void rewinddir (IntPtr dir);
+
+               private struct _Dirent {
+                       public /* ino_t */ ulong  d_ino;
+                       public /* off_t */ long   d_off;
+                       public ushort             d_reclen;
+                       public byte               d_type;
+                       public IntPtr             d_name;
+               }
+
+               private static void CopyDirent (Dirent to, ref _Dirent from)
+               {
+                       try {
+                               to.d_ino    = from.d_ino;
+                               to.d_off    = from.d_off;
+                               to.d_reclen = from.d_reclen;
+                               to.d_type   = from.d_type;
+                               to.d_name   = UnixMarshal.PtrToString (from.d_name);
+                       }
+                       finally {
+                               Stdlib.free (from.d_name);
+                               from.d_name = IntPtr.Zero;
+                       }
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_readdir")]
+               private static extern int sys_readdir (IntPtr dir, out _Dirent dentry);
+
+               public static Dirent readdir (IntPtr dir)
+               {
+                       _Dirent dentry;
+                       int r = sys_readdir (dir, out dentry);
+                       if (r != 0)
+                               return null;
+                       Dirent d = new Dirent ();
+                       CopyDirent (d, ref dentry);
+                       return d;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_readdir_r")]
+               private static extern int sys_readdir_r (IntPtr dirp, out _Dirent entry, out IntPtr result);
+
+               public static int readdir_r (IntPtr dirp, Dirent entry, out IntPtr result)
+               {
+                       entry.d_ino    = 0;
+                       entry.d_off    = 0;
+                       entry.d_reclen = 0;
+                       entry.d_type   = 0;
+                       entry.d_name   = null;
+
+                       _Dirent _d;
+                       int r = sys_readdir_r (dirp, out _d, out result);
+
+                       if (r == 0 && result != IntPtr.Zero) {
+                               CopyDirent (entry, ref _d);
+                       }
+
+                       return r;
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int dirfd (IntPtr dir);
+               #endregion
+
+               #region <fcntl.h> Declarations
+               //
+               // <fcntl.h> -- COMPLETE
+               //
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_fcntl")]
+               public static extern int fcntl (int fd, FcntlCommand cmd);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_fcntl_arg")]
+               public static extern int fcntl (int fd, FcntlCommand cmd, long arg);
+
+               public static int fcntl (int fd, FcntlCommand cmd, DirectoryNotifyFlags arg)
+               {
+                       if (cmd != FcntlCommand.F_NOTIFY) {
+                               SetLastError (Errno.EINVAL);
+                               return -1;
+                       }
+                       long _arg = NativeConvert.FromDirectoryNotifyFlags (arg);
+                       return fcntl (fd, FcntlCommand.F_NOTIFY, _arg);
+               }
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_fcntl_lock")]
+               public static extern int fcntl (int fd, FcntlCommand cmd, ref Flock @lock);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_open")]
+               public static extern int open (string pathname, OpenFlags flags);
+
+               // open(2)
+               //    int open(const char *pathname, int flags, mode_t mode);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_open_mode")]
+               public static extern int open (string pathname, OpenFlags flags, FilePermissions mode);
+
+               // creat(2)
+               //    int creat(const char *pathname, mode_t mode);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_creat")]
+               public static extern int creat (string pathname, FilePermissions mode);
+
+               // posix_fadvise(2)
+               //    int posix_fadvise(int fd, off_t offset, off_t len, int advice);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_posix_fadvise")]
+               public static extern int posix_fadvise (int fd, long offset, 
+                       long len, PosixFadviseAdvice advice);
+
+               // posix_fallocate(P)
+               //    int posix_fallocate(int fd, off_t offset, size_t len);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_posix_fallocate")]
+               public static extern int posix_fallocate (int fd, long offset, ulong len);
+               #endregion
+
+               #region <fstab.h> Declarations
+               //
+               // <fstab.h>  -- COMPLETE
+               //
+               private struct _Fstab {
+                       public IntPtr fs_spec;
+                       public IntPtr fs_file;
+                       public IntPtr fs_vfstype;
+                       public IntPtr fs_mntops;
+                       public IntPtr fs_type;
+                       public int    fs_freq;
+                       public int    fs_passno;
+                       public IntPtr _fs_buf_;
+               }
+
+               private static void CopyFstab (Fstab to, ref _Fstab from)
+               {
+                       try {
+                               to.fs_spec     = UnixMarshal.PtrToString (from.fs_spec);
+                               to.fs_file     = UnixMarshal.PtrToString (from.fs_file);
+                               to.fs_vfstype  = UnixMarshal.PtrToString (from.fs_vfstype);
+                               to.fs_mntops   = UnixMarshal.PtrToString (from.fs_mntops);
+                               to.fs_type     = UnixMarshal.PtrToString (from.fs_type);
+                               to.fs_freq     = from.fs_freq;
+                               to.fs_passno   = from.fs_passno;
+                       }
+                       finally {
+                               Stdlib.free (from._fs_buf_);
+                               from._fs_buf_ = IntPtr.Zero;
+                       }
+               }
+
+               internal static object fstab_lock = new object ();
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_endfsent")]
+               private static extern void sys_endfsent ();
+
+               public static void endfsent ()
+               {
+                       lock (fstab_lock) {
+                               sys_endfsent ();
+                       }
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getfsent")]
+               private static extern int sys_getfsent (out _Fstab fs);
+
+               public static Fstab getfsent ()
+               {
+                       _Fstab fsbuf;
+                       int r;
+                       lock (fstab_lock) {
+                               r = sys_getfsent (out fsbuf);
+                       }
+                       if (r != 0)
+                               return null;
+                       Fstab fs = new Fstab ();
+                       CopyFstab (fs, ref fsbuf);
+                       return fs;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getfsfile")]
+               private static extern int sys_getfsfile (string mount_point, out _Fstab fs);
+
+               public static Fstab getfsfile (string mount_point)
+               {
+                       _Fstab fsbuf;
+                       int r;
+                       lock (fstab_lock) {
+                               r = sys_getfsfile (mount_point, out fsbuf);
+                       }
+                       if (r != 0)
+                               return null;
+                       Fstab fs = new Fstab ();
+                       CopyFstab (fs, ref fsbuf);
+                       return fs;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getfsspec")]
+               private static extern int sys_getfsspec (string special_file, out _Fstab fs);
+
+               public static Fstab getfsspec (string special_file)
+               {
+                       _Fstab fsbuf;
+                       int r;
+                       lock (fstab_lock) {
+                               r = sys_getfsspec (special_file, out fsbuf);
+                       }
+                       if (r != 0)
+                               return null;
+                       Fstab fs = new Fstab ();
+                       CopyFstab (fs, ref fsbuf);
+                       return fs;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_setfsent")]
+               private static extern int sys_setfsent ();
+
+               public static int setfsent ()
+               {
+                       lock (fstab_lock) {
+                               return sys_setfsent ();
+                       }
+               }
+
+               #endregion
+
+               #region <grp.h> Declarations
+               //
+               // <grp.h>
+               //
+               // TODO: putgrent(3), fgetgrent_r(), getgrouplist(2), initgroups(3)
+
+               // setgroups(2)
+               //    int setgroups (size_t size, const gid_t *list);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_setgroups")]
+               public static extern int setgroups (ulong size, uint[] list);
+
+               public static int setgroups (uint [] list)
+               {
+                       return setgroups ((ulong) list.Length, list);
+               }
+
+               private struct _Group
+               {
+                       public IntPtr           gr_name;
+                       public IntPtr           gr_passwd;
+                       public /* gid_t */ uint gr_gid;
+                       public int              _gr_nmem_;
+                       public IntPtr           gr_mem;
+                       public IntPtr           _gr_buf_;
+               }
+
+               private static void CopyGroup (Group to, ref _Group from)
+               {
+                       try {
+                               to.gr_gid    = from.gr_gid;
+                               to.gr_name   = UnixMarshal.PtrToString (from.gr_name);
+                               to.gr_passwd = UnixMarshal.PtrToString (from.gr_passwd);
+                               to.gr_mem    = UnixMarshal.PtrToStringArray (from._gr_nmem_, from.gr_mem);
+                       }
+                       finally {
+                               Stdlib.free (from.gr_mem);
+                               Stdlib.free (from._gr_buf_);
+                               from.gr_mem   = IntPtr.Zero;
+                               from._gr_buf_ = IntPtr.Zero;
+                       }
+               }
+
+               internal static object grp_lock = new object ();
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getgrnam")]
+               private static extern int sys_getgrnam (string name, out _Group group);
+
+               public static Group getgrnam (string name)
+               {
+                       _Group group;
+                       int r;
+                       lock (grp_lock) {
+                               r = sys_getgrnam (name, out group);
+                       }
+                       if (r != 0)
+                               return null;
+                       Group gr = new Group ();
+                       CopyGroup (gr, ref group);
+                       return gr;
+               }
+
+               // getgrgid(3)
+               //    struct group *getgrgid(gid_t gid);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getgrgid")]
+               private static extern int sys_getgrgid (uint uid, out _Group group);
+
+               public static Group getgrgid (uint uid)
+               {
+                       _Group group;
+                       int r;
+                       lock (grp_lock) {
+                               r = sys_getgrgid (uid, out group);
+                       }
+                       if (r != 0)
+                               return null;
+                       Group gr = new Group ();
+                       CopyGroup (gr, ref group);
+                       return gr;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getgrnam_r")]
+               private static extern int sys_getgrnam_r (string name, out _Group grbuf, out IntPtr grbufp);
+
+               public static int getgrnam_r (string name, Group grbuf, out Group grbufp)
+               {
+                       grbufp = null;
+                       _Group group;
+                       IntPtr _grbufp;
+                       int r = sys_getgrnam_r (name, out group, out _grbufp);
+                       if (r == 0 && _grbufp != IntPtr.Zero) {
+                               CopyGroup (grbuf, ref group);
+                               grbufp = grbuf;
+                       }
+                       return r;
+               }
+
+               // getgrgid_r(3)
+               //    int getgrgid_r(gid_t gid, struct group *gbuf, char *buf,
+               //        size_t buflen, struct group **gbufp);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getgrgid_r")]
+               private static extern int sys_getgrgid_r (uint uid, out _Group grbuf, out IntPtr grbufp);
+
+               public static int getgrgid_r (uint uid, Group grbuf, out Group grbufp)
+               {
+                       grbufp = null;
+                       _Group group;
+                       IntPtr _grbufp;
+                       int r = sys_getgrgid_r (uid, out group, out _grbufp);
+                       if (r == 0 && _grbufp != IntPtr.Zero) {
+                               CopyGroup (grbuf, ref group);
+                               grbufp = grbuf;
+                       }
+                       return r;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getgrent")]
+               private static extern int sys_getgrent (out _Group grbuf);
+
+               public static Group getgrent ()
+               {
+                       _Group group;
+                       int r;
+                       lock (grp_lock) {
+                               r = sys_getgrent (out group);
+                       }
+                       if (r != 0)
+                               return null;
+                       Group gr = new Group();
+                       CopyGroup (gr, ref group);
+                       return gr;
+               }
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="setgrent")]
+               private static extern void sys_setgrent ();
+
+               public static void setgrent ()
+               {
+                       lock (grp_lock) {
+                               sys_setgrent ();
+                       }
+               }
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="endgrent")]
+               private static extern void sys_endgrent ();
+
+               public static void endgrent ()
+               {
+                       lock (grp_lock) {
+                               sys_endgrent ();
+                       }
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_fgetgrent")]
+               private static extern int sys_fgetgrent (IntPtr stream, out _Group grbuf);
+
+               public static Group fgetgrent (IntPtr stream)
+               {
+                       _Group group;
+                       int r;
+                       lock (grp_lock) {
+                               r = sys_fgetgrent (stream, out group);
+                       }
+                       if (r != 0)
+                               return null;
+                       Group gr = new Group ();
+                       CopyGroup (gr, ref group);
+                       return gr;
+               }
+               #endregion
+
+               #region <pwd.h> Declarations
+               //
+               // <pwd.h>
+               //
+               // TODO: putpwent(3), fgetpwent_r()
+               //
+               // SKIPPING: getpw(3): it's dangerous.  Use getpwuid(3) instead.
+
+               private struct _Passwd
+               {
+                       public IntPtr           pw_name;
+                       public IntPtr           pw_passwd;
+                       public /* uid_t */ uint pw_uid;
+                       public /* gid_t */ uint pw_gid;
+                       public IntPtr           pw_gecos;
+                       public IntPtr           pw_dir;
+                       public IntPtr           pw_shell;
+                       public IntPtr           _pw_buf_;
+               }
+
+               private static void CopyPasswd (Passwd to, ref _Passwd from)
+               {
+                       try {
+                               to.pw_name   = UnixMarshal.PtrToString (from.pw_name);
+                               to.pw_passwd = UnixMarshal.PtrToString (from.pw_passwd);
+                               to.pw_uid    = from.pw_uid;
+                               to.pw_gid    = from.pw_gid;
+                               to.pw_gecos  = UnixMarshal.PtrToString (from.pw_gecos);
+                               to.pw_dir    = UnixMarshal.PtrToString (from.pw_dir);
+                               to.pw_shell  = UnixMarshal.PtrToString (from.pw_shell);
+                       }
+                       finally {
+                               Stdlib.free (from._pw_buf_);
+                               from._pw_buf_ = IntPtr.Zero;
+                       }
+               }
+
+               internal static object pwd_lock = new object ();
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getpwnam")]
+               private static extern int sys_getpwnam (string name, out _Passwd passwd);
+
+               public static Passwd getpwnam (string name)
+               {
+                       _Passwd passwd;
+                       int r;
+                       lock (pwd_lock) {
+                               r = sys_getpwnam (name, out passwd);
+                       }
+                       if (r != 0)
+                               return null;
+                       Passwd pw = new Passwd ();
+                       CopyPasswd (pw, ref passwd);
+                       return pw;
+               }
+
+               // getpwuid(3)
+               //    struct passwd *getpwnuid(uid_t uid);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getpwuid")]
+               private static extern int sys_getpwuid (uint uid, out _Passwd passwd);
+
+               public static Passwd getpwuid (uint uid)
+               {
+                       _Passwd passwd;
+                       int r;
+                       lock (pwd_lock) {
+                               r = sys_getpwuid (uid, out passwd);
+                       }
+                       if (r != 0)
+                               return null;
+                       Passwd pw = new Passwd ();
+                       CopyPasswd (pw, ref passwd);
+                       return pw;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getpwnam_r")]
+               private static extern int sys_getpwnam_r (string name, out _Passwd pwbuf, out IntPtr pwbufp);
+
+               public static int getpwnam_r (string name, Passwd pwbuf, out Passwd pwbufp)
+               {
+                       pwbufp = null;
+                       _Passwd passwd;
+                       IntPtr _pwbufp;
+                       int r = sys_getpwnam_r (name, out passwd, out _pwbufp);
+                       if (r == 0 && _pwbufp != IntPtr.Zero) {
+                               CopyPasswd (pwbuf, ref passwd);
+                               pwbufp = pwbuf;
+                       }
+                       return r;
+               }
+
+               // getpwuid_r(3)
+               //    int getpwuid_r(uid_t uid, struct passwd *pwbuf, char *buf, size_t
+               //        buflen, struct passwd **pwbufp);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getpwuid_r")]
+               private static extern int sys_getpwuid_r (uint uid, out _Passwd pwbuf, out IntPtr pwbufp);
+
+               public static int getpwuid_r (uint uid, Passwd pwbuf, out Passwd pwbufp)
+               {
+                       pwbufp = null;
+                       _Passwd passwd;
+                       IntPtr _pwbufp;
+                       int r = sys_getpwuid_r (uid, out passwd, out _pwbufp);
+                       if (r == 0 && _pwbufp != IntPtr.Zero) {
+                               CopyPasswd (pwbuf, ref passwd);
+                               pwbufp = pwbuf;
+                       }
+                       return r;
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getpwent")]
+               private static extern int sys_getpwent (out _Passwd pwbuf);
+
+               public static Passwd getpwent ()
+               {
+                       _Passwd passwd;
+                       int r;
+                       lock (pwd_lock) {
+                               r = sys_getpwent (out passwd);
+                       }
+                       if (r != 0)
+                               return null;
+                       Passwd pw = new Passwd ();
+                       CopyPasswd (pw, ref passwd);
+                       return pw;
+               }
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="setpwent")]
+               private static extern void sys_setpwent ();
+
+               public static void setpwent ()
+               {
+                       lock (pwd_lock) {
+                               sys_setpwent ();
+                       }
+               }
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="endpwent")]
+               private static extern void sys_endpwent ();
+
+               public static void endpwent ()
+               {
+                       lock (pwd_lock) {
+                               sys_endpwent ();
+                       }
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_fgetpwent")]
+               private static extern int sys_fgetpwent (IntPtr stream, out _Passwd pwbuf);
+
+               public static Passwd fgetpwent (IntPtr stream)
+               {
+                       _Passwd passwd;
+                       int r;
+                       lock (pwd_lock) {
+                               r = sys_fgetpwent (stream, out passwd);
+                       }
+                       if (r != 0)
+                               return null;
+                       Passwd pw = new Passwd ();
+                       CopyPasswd (pw, ref passwd);
+                       return pw;
+               }
+               #endregion
+
+               #region <signal.h> Declarations
+               //
+               // <signal.h>
+               //
+               [DllImport (LIBC, SetLastError=true)]
+               private static extern void psignal (int sig, string s);
+
+               public static void psignal (Signum sig, string s)
+               {
+                       int signum = NativeConvert.FromSignum (sig);
+                       psignal (signum, s);
+               }
+
+               // kill(2)
+               //    int kill(pid_t pid, int sig);
+               [DllImport (LIBC, SetLastError=true, EntryPoint="kill")]
+               private static extern int sys_kill (int pid, int sig);
+
+               public static int kill (int pid, Signum sig)
+               {
+                       int _sig = NativeConvert.FromSignum (sig);
+                       return sys_kill (pid, _sig);
+               }
+
+               private static object signal_lock = new object ();
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="strsignal")]
+               private static extern IntPtr sys_strsignal (int sig);
+
+               public static string strsignal (Signum sig)
+               {
+                       int s = NativeConvert.FromSignum (sig);
+                       lock (signal_lock) {
+                               IntPtr r = sys_strsignal (s);
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               // TODO: sigaction(2)
+               // TODO: sigsuspend(2)
+               // TODO: sigpending(2)
+
+               #endregion
+
+               #region <stdio.h> Declarations
+               //
+               // <stdio.h>
+               //
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_L_ctermid")]
+               private static extern int _L_ctermid ();
+
+               public static readonly int L_ctermid = _L_ctermid ();
+
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_L_cuserid")]
+               private static extern int _L_cuserid ();
+
+               public static readonly int L_cuserid = _L_cuserid ();
+
+               internal static object getlogin_lock = new object ();
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="cuserid")]
+               private static extern IntPtr sys_cuserid ([Out] StringBuilder @string);
+
+               [Obsolete ("\"Nobody knows precisely what cuserid() does... " + 
+                               "DO NOT USE cuserid().\n" +
+                               "`string' must hold L_cuserid characters.  Use getlogin_r instead.")]
+               public static string cuserid (StringBuilder @string)
+               {
+                       if (@string.Capacity < L_cuserid) {
+                               throw new ArgumentOutOfRangeException ("string", "string.Capacity < L_cuserid");
+                       }
+                       lock (getlogin_lock) {
+                               IntPtr r = sys_cuserid (@string);
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               #endregion
+
+               #region <stdlib.h> Declarations
+               //
+               // <stdlib.h>
+               //
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int mkstemp (StringBuilder template);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int ttyslot ();
+
+               [DllImport (CRYPT, SetLastError=true)]
+               public static extern void setkey (string key);
+
+               #endregion
+
+               #region <string.h> Declarations
+               //
+               // <string.h>
+               //
+
+               // strerror_r(3)
+               //    int strerror_r(int errnum, char *buf, size_t n);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_strerror_r")]
+               private static extern int sys_strerror_r (int errnum, 
+                               [Out] StringBuilder buf, ulong n);
+
+               public static int strerror_r (Errno errnum, StringBuilder buf, ulong n)
+               {
+                       int e = NativeConvert.FromErrno (errnum);
+                       return sys_strerror_r (e, buf, n);
+               }
+
+               public static int strerror_r (Errno errnum, StringBuilder buf)
+               {
+                       return strerror_r (errnum, buf, (ulong) buf.Capacity);
+               }
+
+               #endregion
+
+               #region <sys/mman.h> Declarations
+               //
+               // <sys/mman.h>
+               //
+
+               // posix_madvise(P)
+               //    int posix_madvise(void *addr, size_t len, int advice);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_posix_madvise")]
+               public static extern int posix_madvise (IntPtr addr, ulong len, 
+                       PosixMadviseAdvice advice);
+
+               public static readonly IntPtr MAP_FAILED = unchecked((IntPtr)(-1));
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_mmap")]
+               public static extern IntPtr mmap (IntPtr start, ulong length, 
+                               MmapProts prot, MmapFlags flags, int fd, long offset);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_munmap")]
+               public static extern int munmap (IntPtr start, ulong length);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_mprotect")]
+               public static extern int mprotect (IntPtr start, ulong len, MmapProts prot);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_msync")]
+               public static extern int msync (IntPtr start, ulong len, MsyncFlags flags);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_mlock")]
+               public static extern int mlock (IntPtr start, ulong len);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_munlock")]
+               public static extern int munlock (IntPtr start, ulong len);
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="mlockall")]
+               private static extern int sys_mlockall (int flags);
+
+               public static int mlockall (MlockallFlags flags)
+               {
+                       int _flags = NativeConvert.FromMlockallFlags (flags);
+                       return sys_mlockall (_flags);
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int munlockall ();
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_mremap")]
+               public static extern IntPtr mremap (IntPtr old_address, ulong old_size, 
+                               ulong new_size, MremapFlags flags);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_mincore")]
+               public static extern int mincore (IntPtr start, ulong length, byte[] vec);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_remap_file_pages")]
+               public static extern int remap_file_pages (IntPtr start, ulong size,
+                               MmapProts prot, long pgoff, MmapFlags flags);
+
+               #endregion
+
+               #region <sys/poll.h> Declarations
+               //
+               // <sys/poll.h> -- COMPLETE
+               //
+
+               private struct _pollfd {
+                       public int fd;
+                       public short events;
+                       public short revents;
+               }
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="poll")]
+               private static extern int sys_poll (_pollfd[] ufds, uint nfds, int timeout);
+
+               public static int poll (Pollfd [] fds, uint nfds, int timeout)
+               {
+                       if (fds.Length < nfds)
+                               throw new ArgumentOutOfRangeException ("fds", "Must refer to at least `nfds' elements");
+
+                       _pollfd[] send = new _pollfd[nfds];
+
+                       for (int i = 0; i < send.Length; i++) {
+                               send [i].fd     = fds [i].fd;
+                               send [i].events = NativeConvert.FromPollEvents (fds [i].events);
+                       }
+
+                       int r = sys_poll (send, nfds, timeout);
+
+                       for (int i = 0; i < send.Length; i++) {
+                               fds [i].revents = NativeConvert.ToPollEvents (send [i].revents);
+                       }
+
+                       return r;
+               }
+
+               public static int poll (Pollfd [] fds, int timeout)
+               {
+                       return poll (fds, (uint) fds.Length, timeout);
+               }
+
+               //
+               // <sys/ptrace.h>
+               //
+
+               // TODO: ptrace(2)
+
+               //
+               // <sys/resource.h>
+               //
+
+               // TODO: setrlimit(2)
+               // TODO: getrlimit(2)
+               // TODO: getrusage(2)
+
+               #endregion
+
+               #region <sys/sendfile.h> Declarations
+               //
+               // <sys/sendfile.h> -- COMPLETE
+               //
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_sendfile")]
+               public static extern long sendfile (int out_fd, int in_fd, 
+                               ref long offset, ulong count);
+
+               #endregion
+
+               #region <sys/stat.h> Declarations
+               //
+               // <sys/stat.h>  -- COMPLETE
+               //
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_stat")]
+               public static extern int stat (string file_name, out Stat buf);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_fstat")]
+               public static extern int fstat (int filedes, out Stat buf);
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_lstat")]
+               public static extern int lstat (string file_name, out Stat buf);
+
+               // TODO:
+               // S_ISDIR, S_ISCHR, S_ISBLK, S_ISREG, S_ISFIFO, S_ISLNK, S_ISSOCK
+               // All take FilePermissions
+
+               // chmod(2)
+               //    int chmod(const char *path, mode_t mode);
+               [DllImport (LIBC, SetLastError=true, EntryPoint="chmod")]
+               private static extern int sys_chmod (string path, uint mode);
+
+               public static int chmod (string path, FilePermissions mode)
+               {
+                       uint _mode = NativeConvert.FromFilePermissions (mode);
+                       return sys_chmod (path, _mode);
+               }
+
+               // fchmod(2)
+               //    int chmod(int filedes, mode_t mode);
+               [DllImport (LIBC, SetLastError=true, EntryPoint="fchmod")]
+               private static extern int sys_fchmod (int filedes, uint mode);
+
+               public static int fchmod (int filedes, FilePermissions mode)
+               {
+                       uint _mode = NativeConvert.FromFilePermissions (mode);
+                       return sys_fchmod (filedes, _mode);
+               }
+
+               // umask(2)
+               //    mode_t umask(mode_t mask);
+               [DllImport (LIBC, SetLastError=true, EntryPoint="umask")]
+               private static extern uint sys_umask (uint mask);
+
+               public static FilePermissions umask (FilePermissions mask)
+               {
+                       uint _mask = NativeConvert.FromFilePermissions (mask);
+                       uint r = sys_umask (_mask);
+                       return NativeConvert.ToFilePermissions (r);
+               }
+
+               // mkdir(2)
+               //    int mkdir(const char *pathname, mode_t mode);
+               [DllImport (LIBC, SetLastError=true, EntryPoint="mkdir")]
+               private static extern int sys_mkdir (string oldpath, uint mode);
+
+               public static int mkdir (string oldpath, FilePermissions mode)
+               {
+                       uint _mode = NativeConvert.FromFilePermissions (mode);
+                       return sys_mkdir (oldpath, _mode);
+               }
+
+               // mknod(2)
+               //    int mknod (const char *pathname, mode_t mode, dev_t dev);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_mknod")]
+               public static extern int mknod (string pathname, FilePermissions mode, ulong dev);
+
+               // mkfifo(3)
+               //    int mkfifo(const char *pathname, mode_t mode);
+               [DllImport (LIBC, SetLastError=true, EntryPoint="mkfifo")]
+               private static extern int sys_mkfifo (string pathname, uint mode);
+
+               public static int mkfifo (string pathname, FilePermissions mode)
+               {
+                       uint _mode = NativeConvert.FromFilePermissions (mode);
+                       return sys_mkfifo (pathname, _mode);
+               }
+
+               #endregion
+
+               #region <sys/stat.h> Declarations
+               //
+               // <sys/statvfs.h>
+               //
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_statvfs")]
+               public static extern int statvfs (string path, out Statvfs buf);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_fstatvfs")]
+               public static extern int fstatvfs (int fd, out Statvfs buf);
+
+               #endregion
+
+               #region <sys/time.h> Declarations
+               //
+               // <sys/time.h>
+               //
+               // TODO: adjtime(), getitimer(2), setitimer(2), lutimes(), futimes()
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_gettimeofday")]
+               public static extern int gettimeofday (out Timeval tv, out Timezone tz);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_gettimeofday")]
+               private static extern int gettimeofday (out Timeval tv, IntPtr ignore);
+
+               public static int gettimeofday (out Timeval tv)
+               {
+                       return gettimeofday (out tv, IntPtr.Zero);
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_gettimeofday")]
+               private static extern int gettimeofday (IntPtr ignore, out Timezone tz);
+
+               public static int gettimeofday (out Timezone tz)
+               {
+                       return gettimeofday (IntPtr.Zero, out tz);
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_settimeofday")]
+               public static extern int settimeofday (ref Timeval tv, ref Timezone tz);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_gettimeofday")]
+               private static extern int settimeofday (ref Timeval tv, IntPtr ignore);
+
+               public static int settimeofday (ref Timeval tv)
+               {
+                       return settimeofday (ref tv, IntPtr.Zero);
+               }
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_utimes")]
+               public static extern int utimes (string filename, ref Timeval tvp);
+
+               #endregion
+
+               //
+               // <sys/timeb.h>
+               //
+
+               // TODO: ftime(3)
+
+               //
+               // <sys/times.h>
+               //
+
+               // TODO: times(2)
+
+               //
+               // <sys/utsname.h>
+               //
+
+               // TODO: uname(2)
+
+               #region <sys/wait.h> Declarations
+               //
+               // <sys/wait.h>
+               //
+
+               // wait(2)
+               //    pid_t wait(int *status);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int wait (out int status);
+
+               // waitpid(2)
+               //    pid_t waitpid(pid_t pid, int *status, int options);
+               [DllImport (LIBC, SetLastError=true)]
+               private static extern int waitpid (int pid, out int status, int options);
+
+               public static int waitpid (int pid, out int status, WaitOptions options)
+               {
+                       int _options = NativeConvert.FromWaitOptions (options);
+                       return waitpid (pid, out status, _options);
+               }
+
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_WIFEXITED")]
+               private static extern int _WIFEXITED (int status);
+
+               public static bool WIFEXITED (int status)
+               {
+                       return _WIFEXITED (status) != 0;
+               }
+
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_WEXITSTATUS")]
+               public static extern int WEXITSTATUS (int status);
+
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_WIFSIGNALED")]
+               private static extern int _WIFSIGNALED (int status);
+
+               public static bool WIFSIGNALED (int status)
+               {
+                       return _WIFSIGNALED (status) != 0;
+               }
+
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_WTERMSIG")]
+               private static extern int _WTERMSIG (int status);
+
+               public static Signum WTERMSIG (int status)
+               {
+                       int r = _WTERMSIG (status);
+                       return NativeConvert.ToSignum (r);
+               }
+
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_WIFSTOPPED")]
+               private static extern int _WIFSTOPPED (int status);
+
+               public static bool WIFSTOPPED (int status)
+               {
+                       return _WIFSTOPPED (status) != 0;
+               }
+
+               [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_WSTOPSIG")]
+               private static extern int _WSTOPSIG (int status);
+
+               public static Signum WSTOPSIG (int status)
+               {
+                       int r = _WSTOPSIG (status);
+                       return NativeConvert.ToSignum (r);
+               }
+
+               //
+               // <termios.h>
+               //
+
+               #endregion
+
+               #region <syslog.h> Declarations
+               //
+               // <syslog.h>
+               //
+
+               [DllImport (LIBC, EntryPoint="openlog")]
+               private static extern void sys_openlog (IntPtr ident, int option, int facility);
+
+               public static void openlog (IntPtr ident, SyslogOptions option, 
+                               SyslogFacility defaultFacility)
+               {
+                       int _option   = NativeConvert.FromSyslogOptions (option);
+                       int _facility = NativeConvert.FromSyslogFacility (defaultFacility);
+
+                       sys_openlog (ident, _option, _facility);
+               }
+
+               [DllImport (LIBC, EntryPoint="syslog")]
+               private static extern void sys_syslog (int priority, string message);
+
+               public static void syslog (SyslogFacility facility, SyslogLevel level, string message)
+               {
+                       int _facility = NativeConvert.FromSyslogFacility (facility);
+                       int _level = NativeConvert.FromSyslogLevel (level);
+                       sys_syslog (_facility | _level, GetSyslogMessage (message));
+               }
+
+               public static void syslog (SyslogLevel level, string message)
+               {
+                       int _level = NativeConvert.FromSyslogLevel (level);
+                       sys_syslog (_level, GetSyslogMessage (message));
+               }
+
+               private static string GetSyslogMessage (string message)
+               {
+                       return UnixMarshal.EscapeFormatString (message, new char[]{'m'});
+               }
+
+               [Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
+                               "Use syslog(SyslogFacility, SyslogLevel, string) instead.")]
+               public static void syslog (SyslogFacility facility, SyslogLevel level, 
+                               string format, params object[] parameters)
+               {
+                       int _facility = NativeConvert.FromSyslogFacility (facility);
+                       int _level = NativeConvert.FromSyslogLevel (level);
+
+                       object[] _parameters = new object[checked(parameters.Length+2)];
+                       _parameters [0] = _facility | _level;
+                       _parameters [1] = format;
+                       Array.Copy (parameters, 0, _parameters, 2, parameters.Length);
+                       XPrintfFunctions.syslog (_parameters);
+               }
+
+               [Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
+                               "Use syslog(SyslogLevel, string) instead.")]
+               public static void syslog (SyslogLevel level, string format, 
+                               params object[] parameters)
+               {
+                       int _level = NativeConvert.FromSyslogLevel (level);
+
+                       object[] _parameters = new object[checked(parameters.Length+2)];
+                       _parameters [0] = _level;
+                       _parameters [1] = format;
+                       Array.Copy (parameters, 0, _parameters, 2, parameters.Length);
+                       XPrintfFunctions.syslog (_parameters);
+               }
+
+               [DllImport (LIBC)]
+               public static extern void closelog ();
+
+               [DllImport (LIBC, EntryPoint="setlogmask")]
+               private static extern int sys_setlogmask (int mask);
+
+               public static int setlogmask (SyslogLevel mask)
+               {
+                       int _mask = NativeConvert.FromSyslogLevel (mask);
+                       return sys_setlogmask (_mask);
+               }
+
+               #endregion
+
+               #region <time.h> Declarations
+
+               //
+               // <time.h>
+               //
+
+               // stime(2)
+               //    int stime(time_t *t);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_stime")]
+               public static extern int stime (ref long t);
+
+               // time(2)
+               //    time_t time(time_t *t);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_time")]
+               public static extern long time (out long t);
+
+               //
+               // <ulimit.h>
+               //
+
+               // TODO: ulimit(3)
+
+               #endregion
+
+               #region <unistd.h> Declarations
+               //
+               // <unistd.h>
+               //
+               // TODO: euidaccess(), usleep(3), get_current_dir_name(), group_member(),
+               //       other TODOs listed below.
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="access")]
+               private static extern int sys_access (string pathname, int mode);
+
+               public static int access (string pathname, AccessModes mode)
+               {
+                       int _mode = NativeConvert.FromAccessModes (mode);
+                       return sys_access (pathname, _mode);
+               }
+
+               // lseek(2)
+               //    off_t lseek(int filedes, off_t offset, int whence);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_lseek")]
+               private static extern long sys_lseek (int fd, long offset, int whence);
+
+               public static long lseek (int fd, long offset, SeekFlags whence)
+               {
+                       short _whence = NativeConvert.FromSeekFlags (whence);
+                       return sys_lseek (fd, offset, _whence);
+               }
+
+    [DllImport (LIBC, SetLastError=true)]
+               public static extern int close (int fd);
+
+               // read(2)
+               //    ssize_t read(int fd, void *buf, size_t count);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_read")]
+               public static extern long read (int fd, IntPtr buf, ulong count);
+
+               public static unsafe long read (int fd, void *buf, ulong count)
+               {
+                       return read (fd, (IntPtr) buf, count);
+               }
+
+               // write(2)
+               //    ssize_t write(int fd, const void *buf, size_t count);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_write")]
+               public static extern long write (int fd, IntPtr buf, ulong count);
+
+               public static unsafe long write (int fd, void *buf, ulong count)
+               {
+                       return write (fd, (IntPtr) buf, count);
+               }
+
+               // pread(2)
+               //    ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_pread")]
+               public static extern long pread (int fd, IntPtr buf, ulong count, long offset);
+
+               public static unsafe long pread (int fd, void *buf, ulong count, long offset)
+               {
+                       return pread (fd, (IntPtr) buf, count, offset);
+               }
+
+               // pwrite(2)
+               //    ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_pwrite")]
+               public static extern long pwrite (int fd, IntPtr buf, ulong count, long offset);
+
+               public static unsafe long pwrite (int fd, void *buf, ulong count, long offset)
+               {
+                       return pwrite (fd, (IntPtr) buf, count, offset);
+               }
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_pipe")]
+               public static extern int pipe (out int reading, out int writing);
+
+               public static int pipe (int[] filedes)
+               {
+                       if (filedes == null || filedes.Length != 2) {
+                               // TODO: set errno
+                               return -1;
+                       }
+                       int reading, writing;
+                       int r = pipe (out reading, out writing);
+                       filedes[0] = reading;
+                       filedes[1] = writing;
+                       return r;
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern uint alarm (uint seconds);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern uint sleep (uint seconds);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern uint ualarm (uint usecs, uint interval);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int pause ();
+
+               // chown(2)
+               //    int chown(const char *path, uid_t owner, gid_t group);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int chown (string path, uint owner, uint group);
+
+               // fchown(2)
+               //    int fchown(int fd, uid_t owner, gid_t group);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int fchown (int fd, uint owner, uint group);
+
+               // lchown(2)
+               //    int lchown(const char *path, uid_t owner, gid_t group);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int lchown (string path, uint owner, uint group);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int chdir (string path);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int fchdir (int fd);
+
+               // getcwd(3)
+               //    char *getcwd(char *buf, size_t size);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getcwd")]
+               public static extern IntPtr getcwd ([Out] StringBuilder buf, ulong size);
+
+               public static StringBuilder getcwd (StringBuilder buf)
+               {
+                       getcwd (buf, (ulong) buf.Capacity);
+                       return buf;
+               }
+
+               // getwd(2) is deprecated; don't expose it.
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int dup (int fd);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int dup2 (int fd, int fd2);
+
+               // TODO: does Mono marshal arrays properly?
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int execve (string path, string[] argv, string[] envp);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int fexecve (int fd, string[] argv, string[] envp);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int execv (string path, string[] argv);
+
+               // TODO: execle, execl, execlp
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int execvp (string path, string[] argv);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int nice (int inc);
+
+               [DllImport (LIBC, SetLastError=true)]
+               [CLSCompliant (false)]
+               public static extern int _exit (int status);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_fpathconf")]
+               public static extern long fpathconf (int filedes, PathConf name);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_pathconf")]
+               public static extern long pathconf (string path, PathConf name);
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_sysconf")]
+               public static extern long sysconf (SysConf name);
+
+               // confstr(3)
+               //    size_t confstr(int name, char *buf, size_t len);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_confstr")]
+               public static extern ulong confstr (ConfStr name, [Out] StringBuilder buf, ulong len);
+
+               // getpid(2)
+               //    pid_t getpid(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getpid ();
+
+               // getppid(2)
+               //    pid_t getppid(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getppid ();
+
+               // setpgid(2)
+               //    int setpgid(pid_t pid, pid_t pgid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setpgid (int pid, int pgid);
+
+               // getpgid(2)
+               //    pid_t getpgid(pid_t pid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getpgid (int pid);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setpgrp ();
+
+               // getpgrp(2)
+               //    pid_t getpgrp(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getpgrp ();
+
+               // setsid(2)
+               //    pid_t setsid(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setsid ();
+
+               // getsid(2)
+               //    pid_t getsid(pid_t pid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getsid (int pid);
+
+               // getuid(2)
+               //    uid_t getuid(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern uint getuid ();
+
+               // geteuid(2)
+               //    uid_t geteuid(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern uint geteuid ();
+
+               // getgid(2)
+               //    gid_t getgid(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern uint getgid ();
+
+               // getegid(2)
+               //    gid_t getgid(void);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern uint getegid ();
+
+               // getgroups(2)
+               //    int getgroups(int size, gid_t list[]);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getgroups (int size, uint[] list);
+
+               public static int getgroups (uint[] list)
+               {
+                       return getgroups (list.Length, list);
+               }
+
+               // setuid(2)
+               //    int setuid(uid_t uid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setuid (uint uid);
+
+               // setreuid(2)
+               //    int setreuid(uid_t ruid, uid_t euid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setreuid (uint ruid, uint euid);
+
+               // setregid(2)
+               //    int setregid(gid_t ruid, gid_t euid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setregid (uint rgid, uint egid);
+
+               // seteuid(2)
+               //    int seteuid(uid_t euid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int seteuid (uint euid);
+
+               // setegid(2)
+               //    int setegid(gid_t euid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setegid (uint uid);
+
+               // setgid(2)
+               //    int setgid(gid_t gid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setgid (uint gid);
+
+               // getresuid(2)
+               //    int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getresuid (out uint ruid, out uint euid, out uint suid);
+
+               // getresgid(2)
+               //    int getresgid(gid_t *ruid, gid_t *euid, gid_t *suid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getresgid (out uint rgid, out uint egid, out uint sgid);
+
+               // setresuid(2)
+               //    int setresuid(uid_t ruid, uid_t euid, uid_t suid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setresuid (uint ruid, uint euid, uint suid);
+
+               // setresgid(2)
+               //    int setresgid(gid_t ruid, gid_t euid, gid_t suid);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setresgid (uint rgid, uint egid, uint sgid);
+
+               // fork(2)
+               //    pid_t fork(void);
+               [DllImport (LIBC, SetLastError=true)]
+               [Obsolete ("DO NOT directly call fork(2); it bypasses essential " + 
+                               "shutdown code.\nUse System.Diagnostics.Process instead")]
+               private static extern int fork ();
+
+               // vfork(2)
+               //    pid_t vfork(void);
+               [DllImport (LIBC, SetLastError=true)]
+               [Obsolete ("DO NOT directly call vfork(2); it bypasses essential " + 
+                               "shutdown code.\nUse System.Diagnostics.Process instead")]
+               private static extern int vfork ();
+
+               private static object tty_lock = new object ();
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="ttyname")]
+               private static extern IntPtr sys_ttyname (int fd);
+
+               public static string ttyname (int fd)
+               {
+                       lock (tty_lock) {
+                               IntPtr r = sys_ttyname (fd);
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               // ttyname_r(3)
+               //    int ttyname_r(int fd, char *buf, size_t buflen);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_ttyname_r")]
+               public static extern int ttyname_r (int fd, [Out] StringBuilder buf, ulong buflen);
+
+               public static int ttyname_r (int fd, StringBuilder buf)
+               {
+                       return ttyname_r (fd, buf, (ulong) buf.Capacity);
+               }
+
+               [DllImport (LIBC, EntryPoint="isatty")]
+               private static extern int sys_isatty (int fd);
+
+               public static bool isatty (int fd)
+               {
+                       return sys_isatty (fd) == 1;
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int link (string oldpath, string newpath);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int symlink (string oldpath, string newpath);
+
+               // readlink(2)
+               //    int readlink(const char *path, char *buf, size_t bufsize);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_readlink")]
+               public static extern int readlink (string path, [Out] StringBuilder buf, ulong bufsiz);
+
+               public static int readlink (string path, [Out] StringBuilder buf)
+               {
+                       return readlink (path, buf, (ulong) buf.Capacity);
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int unlink (string pathname);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int rmdir (string pathname);
+
+               // tcgetpgrp(3)
+               //    pid_t tcgetpgrp(int fd);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int tcgetpgrp (int fd);
+
+               // tcsetpgrp(3)
+               //    int tcsetpgrp(int fd, pid_t pgrp);
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int tcsetpgrp (int fd, int pgrp);
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="getlogin")]
+               private static extern IntPtr sys_getlogin ();
+
+               public static string getlogin ()
+               {
+                       lock (getlogin_lock) {
+                               IntPtr r = sys_getlogin ();
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               // getlogin_r(3)
+               //    int getlogin_r(char *buf, size_t bufsize);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getlogin_r")]
+               public static extern int getlogin_r ([Out] StringBuilder name, ulong bufsize);
+
+               public static int getlogin_r (StringBuilder name)
+               {
+                       return getlogin_r (name, (ulong) name.Capacity);
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int setlogin (string name);
+
+               // gethostname(2)
+               //    int gethostname(char *name, size_t len);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_gethostname")]
+               public static extern int gethostname ([Out] StringBuilder name, ulong len);
+
+               public static int gethostname (StringBuilder name)
+               {
+                       return gethostname (name, (ulong) name.Capacity);
+               }
+
+               // sethostname(2)
+               //    int gethostname(const char *name, size_t len);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_sethostname")]
+               public static extern int sethostname (string name, ulong len);
+
+               public static int sethostname (string name)
+               {
+                       return sethostname (name, (ulong) name.Length);
+               }
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_gethostid")]
+               public static extern long gethostid ();
+
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_sethostid")]
+               public static extern int sethostid (long hostid);
+
+               // getdomainname(2)
+               //    int getdomainname(char *name, size_t len);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_getdomainname")]
+               public static extern int getdomainname ([Out] StringBuilder name, ulong len);
+
+               public static int getdomainname (StringBuilder name)
+               {
+                       return getdomainname (name, (ulong) name.Capacity);
+               }
+
+               // setdomainname(2)
+               //    int setdomainname(const char *name, size_t len);
+               [DllImport (MPH, SetLastError=true,
+                               EntryPoint="Mono_Posix_Syscall_setdomainname")]
+               public static extern int setdomainname (string name, ulong len);
+
+               public static int setdomainname (string name)
+               {
+                       return setdomainname (name, (ulong) name.Length);
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int vhangup ();
+
+               // Revoke doesn't appear to be POSIX.  Include it?
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int revoke (string file);
+
+               // TODO: profil?  It's not POSIX.
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int acct (string filename);
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="getusershell")]
+               private static extern IntPtr sys_getusershell ();
+
+               internal static object usershell_lock = new object ();
+
+               public static string getusershell ()
+               {
+                       lock (usershell_lock) {
+                               IntPtr r = sys_getusershell ();
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="setusershell")]
+               private static extern void sys_setusershell ();
+
+               public static void setusershell ()
+               {
+                       lock (usershell_lock) {
+                               sys_setusershell ();
+                       }
+               }
+
+               [DllImport (LIBC, SetLastError=true, EntryPoint="endusershell")]
+               private static extern void sys_endusershell ();
+
+               public static void endusershell ()
+               {
+                       lock (usershell_lock) {
+                               sys_endusershell ();
+                       }
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               private static extern int daemon (int nochdir, int noclose);
+
+               public static int daemon (bool nochdir, bool noclose)
+               {
+                       return daemon (nochdir ? 1 : 0, noclose ? 1 : 0);
+               }
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int chroot (string path);
+
+               // skipping getpass(3) as the man page states:
+               //   This function is obsolete.  Do not use it.
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int fsync (int fd);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int fdatasync (int fd);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern void sync ();
+
+               [DllImport (LIBC, SetLastError=true)]
+               [Obsolete ("Dropped in POSIX 1003.1-2001.  " +
+                               "Use Unistd.sysconf (SysConf._SC_PAGESIZE).")]
+               public static extern int getpagesize ();
+
+               // truncate(2)
+               //    int truncate(const char *path, off_t length);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_truncate")]
+               public static extern int truncate (string path, long length);
+
+               // ftruncate(2)
+               //    int ftruncate(int fd, off_t length);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_ftruncate")]
+               public static extern int ftruncate (int fd, long length);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int getdtablesize ();
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern int brk (IntPtr end_data_segment);
+
+               [DllImport (LIBC, SetLastError=true)]
+               public static extern IntPtr sbrk (IntPtr increment);
+
+               // TODO: syscall(2)?
+               // Probably safer to skip entirely.
+
+               // lockf(3)
+               //    int lockf(int fd, int cmd, off_t len);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_lockf")]
+               public static extern int lockf (int fd, LockfCommand cmd, long len);
+
+               internal static object crypt_lock = new object ();
+
+               [DllImport (CRYPT, SetLastError=true, EntryPoint="crypt")]
+               private static extern IntPtr sys_crypt (string key, string salt);
+
+               public static string crypt (string key, string salt)
+               {
+                       lock (crypt_lock) {
+                               IntPtr r = sys_crypt (key, salt);
+                               return UnixMarshal.PtrToString (r);
+                       }
+               }
+
+               internal static object encrypt_lock = new object ();
+
+               [DllImport (CRYPT, SetLastError=true, EntryPoint="encrypt")]
+               private static extern void sys_encrypt ([In, Out] byte[] block, int edflag);
+
+               public static void encrypt (byte[] block, bool decode)
+               {
+                       if (block.Length < 64)
+                               throw new ArgumentOutOfRangeException ("block", "Must refer to at least 64 bytes");
+                       lock (encrypt_lock) {
+                               sys_encrypt (block, decode ? 1 : 0);
+                       }
+               }
+
+               // swab(3)
+               //    void swab(const void *from, void *to, ssize_t n);
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_swab")]
+               public static extern void swab (IntPtr from, IntPtr to, long n);
+
+               public static unsafe void swab (void* from, void* to, long n)
+               {
+                       swab ((IntPtr) from, (IntPtr) to, n);
+               }
+
+               #endregion
+
+               #region <utime.h> Declarations
+               //
+               // <utime.h>  -- COMPLETE
+               //
+
+               [DllImport (MPH, SetLastError=true, 
+                               EntryPoint="Mono_Posix_Syscall_utime")]
+               private static extern int sys_utime (string filename, ref Utimbuf buf, int use_buf);
+
+               public static int utime (string filename, ref Utimbuf buf)
+               {
+                       return sys_utime (filename, ref buf, 1);
+               }
+
+               public static int utime (string filename)
+               {
+                       Utimbuf buf = new Utimbuf ();
+                       return sys_utime (filename, ref buf, 0);
+               }
+               #endregion
+       }
+
+       #endregion
+}
+
+// vim: noexpandtab
diff --git a/mcs/class/Mono.Posix/Mono.Unix.Native/make-map.cs b/mcs/class/Mono.Posix/Mono.Unix.Native/make-map.cs
new file mode 100644 (file)
index 0000000..e179921
--- /dev/null
@@ -0,0 +1,683 @@
+//
+// MakeMap.cs: Builds a C map of constants defined on C# land
+//
+// Authors:
+//  Miguel de Icaza (miguel@novell.com)
+//  Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2003 Novell, Inc.
+// (C) 2004 Jonathan Pryor
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+delegate void CreateFileHandler (string assembly_name, string file_prefix);
+delegate void AssemblyAttributesHandler (Assembly assembly);
+delegate void TypeHandler (Type t, string ns, string fn);
+delegate void CloseFileHandler (string file_prefix);
+
+class MakeMap {
+
+       public static int Main (string [] args)
+       {
+               FileGenerator[] generators = new FileGenerator[]{
+                       new HeaderFileGenerator (),
+                       new SourceFileGenerator (),
+                       new ConvertFileGenerator (),
+                       new MphPrototypeFileGenerator (),
+               };
+
+               MakeMap composite = new MakeMap ();
+               foreach (FileGenerator g in generators) {
+                       composite.FileCreators += new CreateFileHandler (g.CreateFile);
+                       composite.AssemblyAttributesHandler += 
+                               new AssemblyAttributesHandler (g.WriteAssemblyAttributes);
+                       composite.TypeHandler += new TypeHandler (g.WriteType);
+                       composite.FileClosers += new CloseFileHandler (g.CloseFile);
+               }
+
+               return composite.Run (args);
+       }
+
+       event CreateFileHandler FileCreators;
+       event AssemblyAttributesHandler AssemblyAttributesHandler;
+       event TypeHandler TypeHandler;
+       event CloseFileHandler FileClosers;
+
+       int Run (string[] args)
+       {
+               if (args.Length != 2){
+                       Console.WriteLine ("Usage is: make-map assembly output");
+                       return 1;
+               }
+               
+               string assembly_name = args[0];
+               string output = args[1];
+
+               FileCreators (assembly_name, output);
+
+               Assembly assembly = Assembly.LoadFrom (assembly_name);
+               AssemblyAttributesHandler (assembly);
+               
+               Type [] exported_types = assembly.GetTypes ();
+               Array.Sort (exported_types, new TypeFullNameComparer ());
+                       
+               foreach (Type t in exported_types) {
+                       string ns = t.Namespace;
+                       if (ns == null || !ns.StartsWith ("Mono"))
+                               continue;
+                       string fn = GetNativeName (t.FullName);
+                       ns = GetNativeName (ns);
+
+                       TypeHandler (t, ns, fn);
+               }
+               FileClosers (output);
+
+               return 0;
+       }
+
+       private class TypeFullNameComparer : IComparer {
+               public int Compare (object o1, object o2)
+               {
+                       Type t1 = o1 as Type;
+                       Type t2 = o2 as Type;
+                       if (t1 == t2)
+                               return 0;
+                       if (t1 == null)
+                               return 1;
+                       if (t2 == null)
+                               return -1;
+                       return Comparer.DefaultInvariant.Compare (t1.FullName, t2.FullName);
+               }
+       }
+
+       private class _MemberNameComparer : IComparer {
+               public int Compare (object o1, object o2)
+               {
+                       MemberInfo m1 = o1 as MemberInfo;
+                       MemberInfo m2 = o2 as MemberInfo;
+                       if (m1 == m2)
+                               return 0;
+                       if (m1 == null)
+                               return 1;
+                       if (m2 == null)
+                               return -1;
+                       return Comparer.DefaultInvariant.Compare (m1.Name, m2.Name);
+               }
+       }
+
+       internal static IComparer MemberNameComparer = new _MemberNameComparer ();
+
+       internal static string GetNativeName (string fn)
+       {
+               fn = fn.Replace ('.', '_');
+               if (fn.StartsWith ("Mono_Unix_Native"))
+                       return fn.Replace ("Mono_Unix_Native", "Mono_Posix");
+               return fn.Replace ("Mono_Unix", "Mono_Posix");
+       }
+}
+
+abstract class FileGenerator {
+       public abstract void CreateFile (string assembly_name, string file_prefix);
+
+       public virtual void WriteAssemblyAttributes (Assembly assembly)
+       {
+       }
+
+       public abstract void WriteType (Type t, string ns, string fn);
+       public abstract void CloseFile (string file_prefix);
+
+       protected static void WriteHeader (StreamWriter s, string assembly)
+       {
+               WriteHeader (s, assembly, false);
+       }
+
+       protected static void WriteHeader (StreamWriter s, string assembly, bool noConfig)
+       {
+               s.WriteLine (
+                       "/*\n" +
+                       " * This file was automatically generated by make-map from {0}.\n" +
+                       " *\n" +
+                       " * DO NOT MODIFY.\n" +
+                       " */",
+                       assembly);
+               if (!noConfig) {
+                       s.WriteLine ("#include <config.h>");
+               }
+               s.WriteLine ();
+       }
+
+       protected static bool CanMapType (Type t, out bool bits)
+       {
+               object [] attributes = t.GetCustomAttributes (false);
+               bool map = false;
+               bits = false;
+               
+               foreach (object attr in attributes) {
+                       if (attr.GetType ().Name == "MapAttribute")
+                               map = true;
+                       if (attr.GetType ().Name == "FlagsAttribute")
+                               bits = true;
+               }
+               return map;
+       }
+
+       protected static string GetNativeType (Type t)
+       {
+               string ut = t.Name;
+               if (t.IsEnum)
+                       ut = Enum.GetUnderlyingType (t).Name;
+               Type et = t.GetElementType ();
+               if (et != null && et.IsEnum)
+                       ut = Enum.GetUnderlyingType (et).Name;
+
+               string type = null;
+
+               switch (ut) {
+                       case "Boolean":       type = "int";             break;
+                       case "Byte":          type = "unsigned char";   break;
+                       case "SByte":         type = "signed char";     break;
+                       case "Int16":         type = "short";           break;
+                       case "UInt16":        type = "unsigned short";  break;
+                       case "Int32":         type = "int";             break;
+                       case "UInt32":        type = "unsigned int";    break;
+                       case "UInt32[]":      type = "unsigned int*";   break;
+                       case "Int64":         type = "gint64";          break;
+                       case "UInt64":        type = "guint64";         break;
+                       case "IntPtr":        type = "void*";           break;
+                       case "Byte[]":        type = "void*";           break;
+                       case "String":        type = "const char*";     break;
+                       case "StringBuilder": type = "char*";           break;
+                       case "Void":          type = "void";            break;
+                       case "HandleRef":     type = "void*";           break;
+               }
+               if (type != null)
+                       return string.Format ("{0}{1}", type,
+                                       t.IsByRef ? "*" : "");
+               return GetTypeName (t);
+       }
+
+       private static string GetTypeName (Type t)
+       {
+               if (t.Namespace.StartsWith ("System"))
+                       return "int /* warning: unknown mapping for type: " + t.Name + " */";
+               string ts = "struct " +
+                       MakeMap.GetNativeName (t.FullName).Replace ("+", "_").Replace ("&", "*");
+               return ts;
+       }
+}
+
+class HeaderFileGenerator : FileGenerator {
+       StreamWriter sh;
+
+       public override void CreateFile (string assembly_name, string file_prefix)
+       {
+               sh = File.CreateText (file_prefix + ".h");
+               WriteHeader (sh, assembly_name);
+               sh.WriteLine ("#ifndef INC_Mono_Posix_" + file_prefix + "_H");
+               sh.WriteLine ("#define INC_Mono_Posix_" + file_prefix + "_H\n");
+               sh.WriteLine ("#include <glib/gtypes.h>\n");
+               sh.WriteLine ("G_BEGIN_DECLS\n");
+       }
+
+       public override void WriteType (Type t, string ns, string fn)
+       {
+               bool bits;
+               if (!CanMapType (t, out bits))
+                       return;
+               string etype = GetNativeType (t);
+
+               WriteLiteralValues (sh, t, fn);
+               sh.WriteLine ("int {1}_From{2} ({0} x, {0} *r);", etype, ns, t.Name);
+               sh.WriteLine ("int {1}_To{2} ({0} x, {0} *r);", etype, ns, t.Name);
+               sh.WriteLine ();
+       }
+
+       static void WriteLiteralValues (StreamWriter sh, Type t, string n)
+       {
+               object inst = Activator.CreateInstance (t);
+               FieldInfo[] fields = t.GetFields ();
+               Array.Sort (fields, MakeMap.MemberNameComparer);
+               foreach (FieldInfo fi in fields) {
+                       if (!fi.IsLiteral)
+                               continue;
+                       sh.WriteLine ("#define {0}_{1} 0x{2:x}", n, fi.Name, fi.GetValue (inst));
+               }
+       }
+
+       public override void CloseFile (string file_prefix)
+       {
+               sh.WriteLine ("G_END_DECLS\n");
+               sh.WriteLine ("#endif /* ndef INC_Mono_Posix_" + file_prefix + "_H */\n");
+               sh.Close ();
+       }
+}
+
+class SourceFileGenerator : FileGenerator {
+       StreamWriter sc;
+
+       public override void CreateFile (string assembly_name, string file_prefix)
+       {
+               sc = File.CreateText (file_prefix + ".c");
+               WriteHeader (sc, assembly_name);
+
+               if (file_prefix.IndexOf ("/") != -1)
+                       file_prefix = file_prefix.Substring (file_prefix.IndexOf ("/") + 1);
+               sc.WriteLine ("#include \"{0}.h\"", file_prefix);
+               sc.WriteLine ();
+       }
+
+       public override void WriteAssemblyAttributes (Assembly assembly)
+       {
+               object [] x = assembly.GetCustomAttributes (false);
+               Console.WriteLine ("Got: " + x.Length);
+               foreach (object aattr in assembly.GetCustomAttributes (false)) {
+                       Console.WriteLine ("Got: " + aattr.GetType ().Name);
+                       if (aattr.GetType ().Name == "HeaderAttribute"){
+                               WriteDefines (sc, aattr);
+                               WriteIncludes (sc, aattr);
+                       }
+               }
+       }
+
+       static void WriteDefines (TextWriter writer, object o)
+       {
+               PropertyInfo prop = o.GetType ().GetProperty ("Defines");
+               if (prop == null)
+                       throw new Exception ("Cannot find 'Defines' property");
+
+               MethodInfo method = prop.GetGetMethod ();
+               string [] defines = method.Invoke (o, null).ToString ().Split (',');
+               foreach (string def in defines) {
+                       writer.WriteLine ("#ifndef {0}", def);
+                       writer.WriteLine ("#define {0}", def);
+                       writer.WriteLine ("#endif /* ndef {0} */", def);
+               }
+       }
+
+       static void WriteIncludes (TextWriter writer, object o)
+       {
+               PropertyInfo prop = o.GetType ().GetProperty ("Includes");
+               if (prop == null)
+                       throw new Exception ("Cannot find 'Includes' property");
+
+               MethodInfo method = prop.GetGetMethod ();
+               string [] includes = method.Invoke (o, null).ToString ().Split (',');;
+               foreach (string inc in includes){
+                       if (inc.Length > 3 && 
+                                       string.CompareOrdinal (inc, 0, "ah:", 0, 3) == 0) {
+                               string i = inc.Substring (3);
+                               writer.WriteLine ("#ifdef HAVE_" + (i.ToUpper ().Replace ("/", "_").Replace (".", "_")));
+                               writer.WriteLine ("#include <{0}>", i);
+                               writer.WriteLine ("#endif");
+                       } else 
+                               writer.WriteLine ("#include <{0}>", inc);
+               }
+               writer.WriteLine ();
+       }
+
+       public override void WriteType (Type t, string ns, string fn)
+       {
+               bool bits;
+               if (!CanMapType (t, out bits))
+                       return;
+               string etype = GetNativeType (t);
+
+               WriteFromManagedType (t, ns, fn, etype, bits);
+               WriteToManagedType (t, ns, fn, etype, bits);
+       }
+
+       private void WriteFromManagedType (Type t, string ns, string fn, string etype, bool bits)
+       {
+               sc.WriteLine ("int {1}_From{2} ({0} x, {0} *r)", etype, ns, t.Name);
+               sc.WriteLine ("{");
+               sc.WriteLine ("\t*r = 0;");
+               // For many values, 0 is a valid value, but doesn't have it's own symbol.
+               // Examples: Error (0 means "no error"), WaitOptions (0 means "no options").
+               // Make 0 valid for all conversions.
+               sc.WriteLine ("\tif (x == 0)\n\t\treturn 0;");
+               FieldInfo[] fields = t.GetFields ();
+               Array.Sort (fields, MakeMap.MemberNameComparer);
+               foreach (FieldInfo fi in fields) {
+                       if (!fi.IsLiteral)
+                               continue;
+                       if (Attribute.GetCustomAttribute (fi, 
+                               typeof(ObsoleteAttribute), false) != null) {
+                               sc.WriteLine ("\t/* {0}_{1} is obsolete; ignoring */", fn, fi.Name);
+                               continue;
+                       }
+                       if (bits)
+                               // properly handle case where [Flags] enumeration has helper
+                               // synonyms.  e.g. DEFFILEMODE and ACCESSPERMS for mode_t.
+                               sc.WriteLine ("\tif ((x & {0}_{1}) == {0}_{1})", fn, fi.Name);
+                       else
+                               sc.WriteLine ("\tif (x == {0}_{1})", fn, fi.Name);
+                       sc.WriteLine ("#ifdef {0}", fi.Name);
+                       if (bits)
+                               sc.WriteLine ("\t\t*r |= {1};", fn, fi.Name);
+                       else
+                               sc.WriteLine ("\t\t{{*r = {1}; return 0;}}", fn, fi.Name);
+                       sc.WriteLine ("#else /* def {0} */\n\t\t{{errno = EINVAL; return -1;}}", fi.Name);
+                       sc.WriteLine ("#endif /* ndef {0} */", fi.Name);
+               }
+               if (bits)
+                       sc.WriteLine ("\treturn 0;");
+               else
+                       sc.WriteLine ("\terrno = EINVAL; return -1;"); // return error if not matched
+               sc.WriteLine ("}\n");
+       }
+
+       private void WriteToManagedType (Type t, string ns, string fn, string etype, bool bits)
+       {
+               sc.WriteLine ("int {1}_To{2} ({0} x, {0} *r)", etype, ns, t.Name);
+               sc.WriteLine ("{");
+               sc.WriteLine ("\t*r = 0;", etype);
+               // For many values, 0 is a valid value, but doesn't have it's own symbol.
+               // Examples: Error (0 means "no error"), WaitOptions (0 means "no options").
+               // Make 0 valid for all conversions.
+               sc.WriteLine ("\tif (x == 0)\n\t\treturn 0;");
+               FieldInfo[] fields = t.GetFields ();
+               Array.Sort (fields, MakeMap.MemberNameComparer);
+               foreach (FieldInfo fi in fields) {
+                       if (!fi.IsLiteral)
+                               continue;
+                       sc.WriteLine ("#ifdef {0}", fi.Name);
+                       if (bits)
+                               // properly handle case where [Flags] enumeration has helper
+                               // synonyms.  e.g. DEFFILEMODE and ACCESSPERMS for mode_t.
+                               sc.WriteLine ("\tif ((x & {1}) == {1})\n\t\t*r |= {0}_{1};", fn, fi.Name);
+                       else
+                               sc.WriteLine ("\tif (x == {1})\n\t\t{{*r = {0}_{1}; return 0;}}", fn, fi.Name);
+                       sc.WriteLine ("#endif /* ndef {0} */", fi.Name);
+               }
+               if (bits)
+                       sc.WriteLine ("\treturn 0;");
+               else
+                       sc.WriteLine ("\terrno = EINVAL; return -1;");
+               sc.WriteLine ("}\n");
+       }
+
+       public override void CloseFile (string file_prefix)
+       {
+               sc.Close ();
+       }
+}
+
+class ConvertFileGenerator : FileGenerator {
+       StreamWriter scs;
+
+       public override void CreateFile (string assembly_name, string file_prefix)
+       {
+               scs = File.CreateText (file_prefix + ".cs");
+               WriteHeader (scs, assembly_name, true);
+               scs.WriteLine ("using System;");
+               scs.WriteLine ("using System.Runtime.InteropServices;");
+               scs.WriteLine ("using Mono.Unix.Native;\n");
+               scs.WriteLine ("namespace Mono.Unix.Native {\n");
+               scs.WriteLine ("\t[CLSCompliant (false)]");
+               scs.WriteLine ("\tpublic sealed /* static */ partial class NativeConvert");
+               scs.WriteLine ("\t{");
+               scs.WriteLine ("\t\tprivate NativeConvert () {}\n");
+               scs.WriteLine ("\t\tprivate const string LIB = \"MonoPosixHelper\";\n");
+               scs.WriteLine ("\t\tprivate static void ThrowArgumentException (object value)");
+               scs.WriteLine ("\t\t{");
+               scs.WriteLine ("\t\t\tthrow new ArgumentOutOfRangeException (\"value\", value,");
+               scs.WriteLine ("\t\t\t\tLocale.GetText (\"Current platform doesn't support this value.\"));");
+               scs.WriteLine ("\t\t}\n");
+       }
+
+       public override void WriteType (Type t, string ns, string fn)
+       {
+               bool bits;
+               if (!CanMapType (t, out bits))
+                       return;
+
+               string mtype = Enum.GetUnderlyingType(t).Name;
+               ObsoleteAttribute oa = (ObsoleteAttribute) Attribute.GetCustomAttribute (t, 
+                                       typeof(ObsoleteAttribute), false);
+               string obsolete = "";
+               if (oa != null) {
+                       obsolete = "[Obsolete (\"" + oa.Message + "\")]\n\t\t";
+               }
+               scs.WriteLine ("\t\t[DllImport (LIB, " + 
+                       "EntryPoint=\"{0}_From{1}\")]\n" +
+                       "\t\tprivate static extern int From{1} ({1} value, out {2} rval);\n",
+                       ns, t.Name, mtype);
+               scs.WriteLine ("\t\t{3}public static bool TryFrom{1} ({1} value, out {2} rval)\n" +
+                       "\t\t{{\n" +
+                       "\t\t\treturn From{1} (value, out rval) == 0;\n" +
+                       "\t\t}}\n", ns, t.Name, mtype, obsolete);
+               scs.WriteLine ("\t\t{2}public static {0} From{1} ({1} value)", mtype, t.Name, obsolete);
+               scs.WriteLine ("\t\t{");
+               scs.WriteLine ("\t\t\t{0} rval;", mtype);
+               scs.WriteLine ("\t\t\tif (From{0} (value, out rval) == -1)\n" + 
+                               "\t\t\t\tThrowArgumentException (value);", t.Name);
+               scs.WriteLine ("\t\t\treturn rval;");
+               scs.WriteLine ("\t\t}\n");
+               scs.WriteLine ("\t\t[DllImport (LIB, " + 
+                       "EntryPoint=\"{0}_To{1}\")]\n" +
+                       "\t\tprivate static extern int To{1} ({2} value, out {1} rval);\n",
+                       ns, t.Name, mtype);
+               scs.WriteLine ("\t\t{2}public static bool TryTo{1} ({0} value, out {1} rval)\n" +
+                       "\t\t{{\n" +
+                       "\t\t\treturn To{1} (value, out rval) == 0;\n" +
+                       "\t\t}}\n", mtype, t.Name, obsolete);
+               scs.WriteLine ("\t\t{2}public static {1} To{1} ({0} value)", mtype, t.Name, obsolete);
+               scs.WriteLine ("\t\t{");
+               scs.WriteLine ("\t\t\t{0} rval;", t.Name);
+               scs.WriteLine ("\t\t\tif (To{0} (value, out rval) == -1)\n" + 
+                               "\t\t\t\tThrowArgumentException (value);", t.Name);
+               scs.WriteLine ("\t\t\treturn rval;");
+               scs.WriteLine ("\t\t}\n");
+       }
+
+       public override void CloseFile (string file_prefix)
+       {
+               scs.WriteLine ("\t}");
+               scs.WriteLine ("}\n");
+               scs.Close ();
+       }
+}
+
+class MphPrototypeFileGenerator : FileGenerator {
+       StreamWriter icall;
+       Hashtable methods = new Hashtable ();
+       Hashtable structs = new Hashtable ();
+
+       public override void CreateFile (string assembly_name, string file_prefix)
+       {
+               icall = File.CreateText (file_prefix + "-icalls.h");
+               WriteHeader (icall, assembly_name);
+               icall.WriteLine ("#ifndef INC_Mono_Posix_" + file_prefix + "_ICALLS_H");
+               icall.WriteLine ("#define INC_Mono_Posix_" + file_prefix + "_ICALLS_H\n");
+               icall.WriteLine ("#include <glib/gtypes.h>\n");
+               icall.WriteLine ("G_BEGIN_DECLS\n");
+
+               // Kill warning about unused method
+               DumpTypeInfo (null);
+       }
+
+       public override void WriteType (Type t, string ns, string fn)
+       {
+               BindingFlags bf = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
+               foreach (MethodInfo m in t.GetMethods (bf)) {
+                       if ((m.Attributes & MethodAttributes.PinvokeImpl) == 0)
+                               continue;
+                       DllImportAttribute dia = GetDllImportInfo (m);
+                       if (dia == null) {
+                               Console.WriteLine ("Unable to emit native prototype for P/Invoke " + 
+                                               "method: {0}", m);
+                               continue;
+                       }
+                       // we shouldn't declare prototypes for POSIX, etc. functions.
+                       if (dia.Value != "MonoPosixHelper" || IsOnExcludeList (dia.EntryPoint))
+                               continue;
+                       methods [dia.EntryPoint] = m;
+                       RecordStructs (m);
+               }
+       }
+
+       private static DllImportAttribute GetDllImportInfo (MethodInfo method)
+       {
+               // .NET 2.0 synthesizes pseudo-attributes such as DllImport
+               DllImportAttribute dia = (DllImportAttribute) Attribute.GetCustomAttribute (method, 
+                                       typeof(DllImportAttribute), false);
+               if (dia != null)
+                       return dia;
+
+               // We're not on .NET 2.0; assume we're on Mono and use some internal
+               // methods...
+               Type MonoMethod = Type.GetType ("System.Reflection.MonoMethod", false);
+               if (MonoMethod == null) {
+                       Console.WriteLine ("cannot find MonoMethod");
+                       return null;
+               }
+               MethodInfo GetDllImportAttribute = 
+                       MonoMethod.GetMethod ("GetDllImportAttribute", 
+                                       BindingFlags.Static | BindingFlags.NonPublic);
+               if (GetDllImportAttribute == null) {
+                       Console.WriteLine ("cannot find GetDllImportAttribute");
+                       return null;
+               }
+               IntPtr mhandle = method.MethodHandle.Value;
+               return (DllImportAttribute) GetDllImportAttribute.Invoke (null, 
+                               new object[]{mhandle});
+       }
+
+       private static string[] ExcludeList = new string[]{
+               "Mono_Posix_Stdlib_snprintf",
+       };
+
+       private bool IsOnExcludeList (string method)
+       {
+               int idx = Array.BinarySearch (ExcludeList, method);
+               return (idx >= 0 && idx < ExcludeList.Length) ? true : false;
+       }
+
+       private void RecordStructs (MethodInfo method)
+       {
+               ParameterInfo[] parameters = method.GetParameters ();
+               foreach (ParameterInfo pi in parameters) {
+                       string s = GetNativeType (pi.ParameterType);
+                       if (s.StartsWith ("struct"))
+                               structs [s] = s;
+               }
+       }
+
+       public override void CloseFile (string file_prefix)
+       {
+               icall.WriteLine ("/*\n * Structure Declarations\n */");
+               foreach (string s in Sort (structs.Keys))
+                       icall.WriteLine ("{0};", s.Replace ("*", ""));
+
+               icall.WriteLine ();
+
+               icall.WriteLine ("/*\n * Function Declarations\n */");
+               foreach (string method in Sort (methods.Keys)) {
+                       WriteMethodDeclaration ((MethodInfo) methods [method], method);
+               }
+
+               icall.WriteLine ("\nG_END_DECLS\n");
+               icall.WriteLine ("#endif /* ndef INC_Mono_Posix_" + file_prefix + "_ICALLS_H */\n");
+               icall.Close ();
+       }
+
+       private static IEnumerable Sort (ICollection c)
+       {
+               ArrayList al = new ArrayList (c);
+               al.Sort ();
+               return al;
+       }
+
+       private void WriteMethodDeclaration (MethodInfo method, string entryPoint)
+       {
+               icall.Write ("{0} ", GetNativeType (method.ReturnType));
+               icall.Write ("{0} ", entryPoint);
+               ParameterInfo[] parameters = method.GetParameters();
+               if (parameters.Length == 0) {
+                       icall.WriteLine ("(void);");
+                       return;
+               }
+               if (parameters.Length > 0) {
+                       icall.Write ("(");
+                       WriteParameterDeclaration (parameters [0]);
+               }
+               for (int i = 1; i < parameters.Length; ++i) {
+                       icall.Write (", ");
+                       WriteParameterDeclaration (parameters [i]);
+               }
+               icall.WriteLine (");");
+       }
+
+       private void DumpTypeInfo (Type t)
+       {
+               if (t == null)
+                       return;
+
+               icall.WriteLine ("\t\t/* Type Info for " + t.FullName + ":");
+               foreach (MemberInfo mi in typeof(Type).GetMembers()) {
+                       icall.WriteLine ("\t\t\t{0}={1}", mi.Name, GetMemberValue (mi, t));
+               }
+               icall.WriteLine ("\t\t */");
+       }
+
+       private static string GetMemberValue (MemberInfo mi, Type t)
+       {
+               try {
+               switch (mi.MemberType) {
+                       case MemberTypes.Constructor:
+                       case MemberTypes.Method: {
+                               MethodBase b = (MethodBase) mi;
+                               if (b.GetParameters().Length == 0)
+                                       return b.Invoke (t, new object[]{}).ToString();
+                               return "<<cannot invoke>>";
+                       }
+                       case MemberTypes.Field:
+                               return ((FieldInfo) mi).GetValue (t).ToString ();
+                       case MemberTypes.Property: {
+                               PropertyInfo pi = (PropertyInfo) mi;
+                               if (!pi.CanRead)
+                                       return "<<cannot read>>";
+                               return pi.GetValue (t, null).ToString ();
+                       }
+                       default:
+                               return "<<unknown value>>";
+               }
+               }
+               catch (Exception e) {
+                       return "<<exception reading member: " + e.Message + ">>";
+               }
+       }
+
+       private void WriteParameterDeclaration (ParameterInfo pi)
+       {
+               // DumpTypeInfo (pi.ParameterType);
+               icall.Write ("{0} {1}", GetNativeType (pi.ParameterType), pi.Name);
+       }
+}
+
+// vim: noexpandtab
index 80b5d18426135d452429ae5966eb49432df093e2..bb7caff0fa63f8364073183d2e475eabbffb419b 100644 (file)
@@ -69,6 +69,7 @@ namespace Mono.Unix {
        // on most platforms.
        //
        // This class is intended to be thread-safe.
+       [Obsolete ("Use Mono.Unix.Native.CdeclFunction")]
        public sealed class CdeclFunction
        {
                // The readonly fields (1) shouldn't be modified, and (2) should only be
index 8028dfef526d7330cee41bdb31152a59d69a6c20..fdc9ff6bb7afb38f6a009f944fbfd0fb1de93fa3 100644 (file)
@@ -1,3 +1,34 @@
+2005-09-20  Jonathan Pryor <jonpryor@vt.edu>
+
+       * CdeclFunction.cs: [Obsolete]d by Mono.Unix.Native.CdeclFunction.
+       * make-map.cs: Remove.
+       * Stdlib.cs: [Obsolete] the types; use the Mono.Unix.Native.* types instead.
+       * StdioFileStream.cs: Add GC.KeepAlive statements to prevent premature GC's
+         (FxCop suggestion).
+       * Syscall.cs: Remove [Map] attribute from all types; [CLSCompliant(false)]
+         work; [Obsolete] all types and suggest using the Mono.Unix.Native.*
+         replacements; remove [IncludeAttribute] -- superseded by
+               Mono.Unix.Native/Syscall.cs's [HeaderAttribte] for CLS compliance.
+       * UnixConvert.cs: [Obsolete]d by Mono.Unix.Native.NativeConvert.
+       * UnixDirectory.cs, UnixDriveInfo.cs, UnixEnvironment.cs, 
+         UnixGroup.cs, UnixGroupInfo.cs, 
+         UnixSymbolicLinkInfo.cs, UnixUser.cs, UnixUserInfo.cs:
+         Add [CLSCompliant(false)] as necessary.
+       * UnixFile.cs, UnixDirectory.cs, UnixFileInfo.cs, UnixFileSystemInfo.cs: 
+         [CLSCompliant(false)], addition of method overloads for [Obsolete]d types, 
+         warn about changing return types.
+       * UnixProcess.cs, UnixStream.cs: Add [CLSCompliant(false)] as necessary, 
+         and warn about changing property types.
+
+2005-09-02  Jonathan Pryor <jonpryor@vt.edu>
+
+       * Stdlib.cs: Cache delegates passed to Stdlib.signal() so that they survive
+         garbage collections.  Delegates can be removed by calling Stdlib.signal()
+         again with one of the Stdlib.SIG_* values (or the original return value of
+         Stdlib.signal()).
+       * UnixUser.cs, UnixGroup.cs, UnixEnvironment.cs: Clarify "Id" (int) vs. 
+         "Name" (string) differences by always using a Id or Name suffix.
+
 2005-07-01  Daniel Drake  <dsd@gentoo.org>
 
        * Syscall.cs: The entire extended attribute API now goes through MPH, to
index 4dd8644d7745de4c35f5911437eae3c7eb8470be..cd16c9b1ffea76096849d23eee157d4ef49141e3 100644 (file)
@@ -123,6 +123,7 @@ namespace Mono.Unix {
                        catch (Exception e) {
                                throw new ArgumentException (Locale.GetText ("Invalid file stream"), "fileStream");
                        }
+                       GC.KeepAlive (this);
                }
 
                private void InitCanReadWrite (FileAccess access)
@@ -184,7 +185,11 @@ namespace Mono.Unix {
                }
 
                public IntPtr Handle {
-                       get {AssertNotDisposed (); return file;}
+                       get {
+                               AssertNotDisposed (); 
+                               GC.KeepAlive (this);
+                               return file;
+                       }
                }
 
                public override bool CanRead {
@@ -217,6 +222,7 @@ namespace Mono.Unix {
                                r = Stdlib.fseek (file, curPos, SeekFlags.SEEK_SET);
                                UnixMarshal.ThrowExceptionForLastErrorIf (r);
 
+                               GC.KeepAlive (this);
                                return endPos;
                        }
                }
@@ -229,6 +235,7 @@ namespace Mono.Unix {
                                long pos = Stdlib.ftell (file);
                                if (pos == -1)
                                        UnixMarshal.ThrowExceptionForLastError ();
+                               GC.KeepAlive (this);
                                return (long) pos;
                        }
                        set {
@@ -242,6 +249,7 @@ namespace Mono.Unix {
                        AssertNotDisposed ();
                        int r = Stdlib.fgetpos (file, pos);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
+                       GC.KeepAlive (this);
                }
 
                public void RestoreFilePosition (FilePosition pos)
@@ -251,6 +259,7 @@ namespace Mono.Unix {
                                throw new ArgumentNullException ("value");
                        int r = Stdlib.fsetpos (file, pos);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
+                       GC.KeepAlive (this);
                }
 
                public override void Flush ()
@@ -259,6 +268,7 @@ namespace Mono.Unix {
                        int r = Stdlib.fflush (file);
                        if (r != 0)
                                UnixMarshal.ThrowExceptionForLastError ();
+                       GC.KeepAlive (this);
                }
 
                public override unsafe int Read ([In, Out] byte[] buffer, int offset, int count)
@@ -276,6 +286,7 @@ namespace Mono.Unix {
                                if (Stdlib.ferror (file) != 0)
                                        throw new IOException ();
                        }
+                       GC.KeepAlive (this);
                        return (int) r;
                }
 
@@ -297,6 +308,7 @@ namespace Mono.Unix {
                {
                        AssertNotDisposed ();
                        Stdlib.rewind (file);
+                       GC.KeepAlive (this);
                }
 
                public override long Seek (long offset, SeekOrigin origin)
@@ -323,6 +335,7 @@ namespace Mono.Unix {
                                throw new IOException ("Unable to get current file position",
                                                UnixMarshal.CreateExceptionForLastError ());
 
+                       GC.KeepAlive (this);
                        return pos;
                }
 
@@ -344,6 +357,7 @@ namespace Mono.Unix {
                        }
                        if (r != (ulong) count)
                                UnixMarshal.ThrowExceptionForLastError ();
+                       GC.KeepAlive (this);
                }
                
                ~StdioFileStream ()
@@ -369,6 +383,7 @@ namespace Mono.Unix {
                        canWrite = false;
 
                        GC.SuppressFinalize (this);
+                       GC.KeepAlive (this);
                }
                
                private bool canSeek  = false;
index 5ff2e253eb16ba663092ffbe069d22251c6b0250..0eda499976ac5cef2b5905c3e5b6f0361663fee4 100644 (file)
@@ -5,6 +5,20 @@
 //   Jonathan Pryor (jonpryor@vt.edu)
 //
 // (C) 2004-2005 Jonathan Pryor
+//
+
+// Deprecated Warning:
+//
+//    This class is deprecated, and exists only for backward compatibility
+//    with development versions of Mono 1.1.x.  It will be removed with 
+//    Mono 1.2.  Migrate to the Mono.Unix.Native types, or use the Unix*
+//    wrapper classes instead.
+//
+//    The [Map] attributes have been removed.  However, since the type names
+//    are identical to those in Mono.Unix.Native, the MonoPosixHelper methods
+//    will continue to exist and function correctly.
+//
+
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -27,6 +41,7 @@
 //
 
 using System;
+using System.Collections;
 using System.IO;
 using System.Runtime.InteropServices;
 using System.Text;
@@ -36,6 +51,7 @@ namespace Mono.Unix {
 
        #region Enumerations
 
+       [Obsolete ("Use Mono.Unix.Native.Errno")]
        [Map]
        public enum Error : int {
                // errors & their values liberally copied from
@@ -174,6 +190,7 @@ namespace Mono.Unix {
 
        #region Classes
 
+       [Obsolete ("Use Mono.Unix.Native.FilePosition")]
        public sealed class FilePosition : IDisposable {
 
                private static readonly int FilePositionDumpSize = 
@@ -261,8 +278,10 @@ namespace Mono.Unix {
 #if NET_2_0 && UNMANAGED_FN_PTR_SUPPORT_FIXED
        [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
 #endif
+       [Obsolete ("Use Mono.Unix.Native.SignalHandler")]
        public delegate void SignalHandler (int signal);
 
+#if !NET_2_0
        internal sealed class SignalWrapper {
                private IntPtr handler;
 
@@ -276,6 +295,7 @@ namespace Mono.Unix {
                        Stdlib.InvokeSignalHandler (signum, handler);
                }
        }
+#endif
 
        internal class XPrintfFunctions
        {
@@ -316,6 +336,8 @@ namespace Mono.Unix {
        // anything from Syscall is non-portable, but restricting yourself to just
        // Stdlib is intended to be portable.
        //
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Stdlib")]
        public class Stdlib
        {
                internal const string LIBC = "msvcrt";
@@ -390,6 +412,14 @@ namespace Mono.Unix {
                public static readonly SignalHandler SIG_ERR = new SignalHandler (_ErrorHandler);
                public static readonly SignalHandler SIG_IGN = new SignalHandler (_IgnoreHandler);
 
+               private static readonly SignalHandler[] registered_signals;
+
+               static Stdlib ()
+               {
+                       Array signals = Enum.GetValues(typeof(Signum));
+                       registered_signals = new SignalHandler [(int) signals.GetValue (signals.Length-1)];
+               }
+
                [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
                                SetLastError=true, EntryPoint="signal")]
                private static extern IntPtr sys_signal (int signum, SignalHandler handler);
@@ -401,6 +431,11 @@ namespace Mono.Unix {
                public static SignalHandler signal (Signum signum, SignalHandler handler)
                {
                        int _sig = UnixConvert.FromSignum (signum);
+
+                       lock (registered_signals) {
+                               registered_signals [(int) signum] = handler;
+                       }
+
                        IntPtr r;
                        if (handler == SIG_DFL)
                                r = sys_signal (_sig, _SIG_DFL);
@@ -421,7 +456,11 @@ namespace Mono.Unix {
                                return SIG_ERR;
                        if (handler == _SIG_IGN)
                                return SIG_IGN;
+#if NET_2_0
+                       return (SignalHandler) Marshal.GetDelegateForFunctionPointer (handler, typeof(SignalHandler));
+#else
                        return new SignalHandler (new SignalWrapper (handler).InvokeSignalHandler);
+#endif
                }
 
                [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, EntryPoint="raise")]
index f3ae00d9bf0d0247540f512b166cf482f4cc4b3e..8981f510ca5326b5d2ee0e976927d70774c3a7c8 100644 (file)
 //    Methods that require tuning are bound as `private sys_NAME' methods
 //    and then a `NAME' method is exposed.
 //
+// Deprecated Warning:
+//
+//    This class is deprecated, and exists only for backward compatibility
+//    with development versions of Mono 1.1.x.  It will be removed with 
+//    Mono 1.2.  Migrate to the Mono.Unix.Native types, or use the Unix*
+//    wrapper classes instead.
+//
+//    The [Map] attributes have been removed.  However, since the type names
+//    are identical to those in Mono.Unix.Native, the MonoPosixHelper methods
+//    will continue to exist and function correctly.
+//
 
 //
 // Permission is hereby granted, free of charge, to any person obtaining
@@ -59,32 +70,13 @@ using System.Runtime.InteropServices;
 using System.Text;
 using Mono.Unix;
 
-[assembly:Mono.Unix.IncludeAttribute (
-       new string [] {
-               "sys/types.h", 
-               "sys/stat.h", 
-               "ah:sys/poll.h", 
-               "ah:sys/wait.h",
-               "ah:sys/statvfs.h",
-               "ah:sys/xattr.h",
-               "unistd.h", 
-               "fcntl.h", 
-               "signal.h", 
-               "ah:poll.h", 
-               "ah:grp.h", 
-               "errno.h", 
-               "ah:syslog.h",
-       }, 
-       new string [] {
-               "_GNU_SOURCE", 
-               "_XOPEN_SOURCE",
-       })]
-
 namespace Mono.Unix {
 
        #region Enumerations
 
-       [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SyslogOptions")]
        public enum SyslogOptions {
                LOG_PID    = 0x01,  // log the pid with each message
                LOG_CONS   = 0x02,  // log on the console if errors in sending
@@ -94,7 +86,8 @@ namespace Mono.Unix {
                LOG_PERROR = 0x20   // log to stderr as well
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SyslogFacility")]
        public enum SyslogFacility {
                LOG_KERN      = 0 << 3,
                LOG_USER      = 1 << 3,
@@ -120,7 +113,8 @@ namespace Mono.Unix {
                LOG_LOCAL7    = 23 << 3,
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SyslogLevel")]
        public enum SyslogLevel {
                LOG_EMERG   = 0,  // system is unusable
                LOG_ALERT   = 1,  // action must be taken immediately
@@ -132,7 +126,9 @@ namespace Mono.Unix {
                LOG_DEBUG   = 7   // debug-level messages
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.OpenFlags")]
        public enum OpenFlags : int {
                //
                // One of these
@@ -170,7 +166,9 @@ namespace Mono.Unix {
        }
        
        // mode_t
-       [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.FilePermissions")]
        public enum FilePermissions : uint {
                S_ISUID     = 0x0800, // Set user ID on execution
                S_ISGID     = 0x0400, // Set gorup ID on execution
@@ -204,7 +202,8 @@ namespace Mono.Unix {
                S_IFSOCK    = 0xC000, // Socket
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.FcntlCommand")]
        public enum FcntlCommand : int {
                // Form /usr/include/bits/fcntl.h
                F_DUPFD    =    0, // Duplicate file descriptor.
@@ -224,14 +223,16 @@ namespace Mono.Unix {
                F_NOTIFY   = 1026, // Required notifications on a directory
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.LockType")]
        public enum LockType : short {
                F_RDLCK = 0, // Read lock.
                F_WRLCK = 1, // Write lock.
                F_UNLCK = 2, // Remove lock.
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SeekFlags")]
        public enum SeekFlags : short {
                // values liberally copied from /usr/include/unistd.h
                SEEK_SET = 0, // Seek from beginning of file.
@@ -243,7 +244,9 @@ namespace Mono.Unix {
                L_XTND   = SEEK_END, // BSD alias for SEEK_END
        }
        
-       [Map, Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.DirectoryNotifyFlags")]
        public enum DirectoryNotifyFlags : int {
                // from /usr/include/bits/fcntl.h
                DN_ACCESS    = 0x00000001, // File accessed.
@@ -255,7 +258,8 @@ namespace Mono.Unix {
                DN_MULTISHOT = unchecked ((int)0x80000000), // Don't remove notifier
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PosixFadviseAdvice")]
        public enum PosixFadviseAdvice : int {
                POSIX_FADV_NORMAL     = 0,  // No further special treatment.
                POSIX_FADV_RANDOM     = 1,  // Expect random page references.
@@ -265,7 +269,8 @@ namespace Mono.Unix {
                POSIX_FADV_NOREUSE    = 5,  // Data will be accessed once.
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PosixMadviseAdvice")]
        public enum PosixMadviseAdvice : int {
                POSIX_MADV_NORMAL     = 0,  // No further special treatment.
                POSIX_MADV_RANDOM     = 1,  // Expect random page references.
@@ -274,7 +279,8 @@ namespace Mono.Unix {
                POSIX_MADV_DONTNEED   = 4,  // Don't need these pages.
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Signum")]
        public enum Signum : int {
                SIGHUP    =  1, // Hangup (POSIX).
                SIGINT    =  2, // Interrupt (ANSI).
@@ -313,13 +319,17 @@ namespace Mono.Unix {
                SIGUNUSED = 31
        }
 
-       [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.WaitOptions")]
        public enum WaitOptions : int {
                WNOHANG   = 1,  // Don't block waiting
                WUNTRACED = 2,  // Report status of stopped children
        }
 
-  [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.AccessModes")]
        public enum AccessMode : int {
                R_OK = 1,
                W_OK = 2,
@@ -327,7 +337,8 @@ namespace Mono.Unix {
                F_OK = 8,
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PathConf")]
        public enum PathConf : int {
                _PC_LINK_MAX,
                _PC_MAX_CANON,
@@ -352,7 +363,8 @@ namespace Mono.Unix {
                _PC_2_SYMLINKS
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SysConf")]
        public enum SysConf : int {
                _SC_ARG_MAX,
                _SC_CHILD_MAX,
@@ -560,7 +572,8 @@ namespace Mono.Unix {
                _SC_LEVEL4_CACHE_LINESIZE
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.ConfStr")]
        public enum ConfStr : int {
                _CS_PATH,                       /* The default search path.  */
                _CS_V6_WIDTH_RESTRICTED_ENVS,
@@ -608,7 +621,8 @@ namespace Mono.Unix {
                _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.LockfCommand")]
        public enum LockfCommand : int {
                F_ULOCK = 0, // Unlock a previously locked region.
                F_LOCK  = 1, // Lock a region for exclusive use.
@@ -616,7 +630,9 @@ namespace Mono.Unix {
                F_TEST  = 3, // Test a region for other process locks.
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PollEvents")]
        public enum PollEvents : short {
                POLLIN      = 0x0001, // There is data to read
                POLLPRI     = 0x0002, // There is urgent data to read
@@ -631,14 +647,18 @@ namespace Mono.Unix {
                POLLWRBAND  = 0x0200, // Priority data may be written
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.XattrFlags")]
        public enum XattrFlags : int {
                XATTR_AUTO = 0,
                XATTR_CREATE = 1,
                XATTR_REPLACE = 2,
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MountFlags")]
        public enum MountFlags : ulong {
                ST_RDONLY      =    1,  // Mount read-only
                ST_NOSUID      =    2,  // Ignore suid and sgid bits
@@ -652,7 +672,9 @@ namespace Mono.Unix {
                ST_NODIRATIME  = 2048,  // Do not update directory access times
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MmapFlags")]
        public enum MmapFlags : int {
                MAP_SHARED      = 0x01,     // Share changes.
                MAP_PRIVATE     = 0x02,     // Changes are private.
@@ -672,7 +694,9 @@ namespace Mono.Unix {
                MAP_NONBLOCK    = 0x10000,  // Do not block on IO.
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MmapProts")]
        public enum MmapProt : int {
                PROT_READ       = 0x1,  // Page can be read.
                PROT_WRITE      = 0x2,  // Page can be written.
@@ -684,20 +708,26 @@ namespace Mono.Unix {
                                              //   growsup vma (mprotect only).
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MsyncFlags")]
        public enum MsyncFlags : int {
                MS_ASYNC      = 0x1,  // Sync memory asynchronously.
                MS_SYNC       = 0x4,  // Synchronous memory sync.
                MS_INVALIDATE = 0x2,  // Invalidate the caches.
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MlockallFlags")]
        public enum MlockallFlags : int {
                MCL_CURRENT     = 0x1,  // Lock all currently mapped pages.
                MCL_FUTURE  = 0x2,      // Lock all additions to address
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MremapFlags")]
        public enum MremapFlags : ulong {
                MREMAP_MAYMOVE = 0x1,
        }
@@ -706,6 +736,8 @@ namespace Mono.Unix {
 
        #region Structures
 
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Flock")]
        public struct Flock {
                public LockType         l_type;    // Type of lock: F_RDLCK, F_WRLCK, F_UNLCK
                public SeekFlags        l_whence;  // How to interpret l_start
@@ -714,6 +746,8 @@ namespace Mono.Unix {
                public /* pid_t */ int  l_pid;     // PID of process blocking our lock (F_GETLK only)
        }
 
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Pollfd")]
        [StructLayout(LayoutKind.Sequential)]
        public struct Pollfd {
                public int fd;
@@ -721,14 +755,22 @@ namespace Mono.Unix {
                public PollEvents revents;
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Stat")]
        public struct Stat {
+               [CLSCompliant (false)]
                public  /* dev_t */     ulong   st_dev;     // device
+               [CLSCompliant (false)]
                public  /* ino_t */     ulong   st_ino;     // inode
+               [CLSCompliant (false)]
                public  FilePermissions         st_mode;    // protection
                private uint                    _padding_;  // padding for structure alignment
+               [CLSCompliant (false)]
                public  /* nlink_t */   ulong   st_nlink;   // number of hard links
+               [CLSCompliant (false)]
                public  /* uid_t */     uint    st_uid;     // user ID of owner
+               [CLSCompliant (false)]
                public  /* gid_t */     uint    st_gid;     // group ID of owner
+               [CLSCompliant (false)]
                public  /* dev_t */     ulong   st_rdev;    // device type (if inode device)
                public  /* off_t */     long    st_size;    // total size, in bytes
                public  /* blksize_t */ long    st_blksize; // blocksize for filesystem I/O
@@ -738,6 +780,8 @@ namespace Mono.Unix {
                public  /* time_t */    long    st_ctime;   // time of last status change
        }
 
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Statvfs")]
        public struct Statvfs {
                public                  ulong f_bsize;    // file system block size
                public                  ulong f_frsize;   // fragment size
@@ -752,16 +796,19 @@ namespace Mono.Unix {
                public                  ulong f_namemax;  // maximum filename length
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Timeval")]
        public struct Timeval {
                public  /* time_t */      long    tv_sec;   // seconds
                public  /* suseconds_t */ long    tv_usec;  // microseconds
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Timezone")]
        public struct Timezone {
                public  int tz_minuteswest; // minutes W of Greenwich
                private int tz_dsttime;     // type of dst correction (OBSOLETE)
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Utimbuf")]
        public struct Utimbuf {
                public  /* time_t */      long    actime;   // access time
                public  /* time_t */      long    modtime;  // modification time
@@ -771,10 +818,13 @@ namespace Mono.Unix {
 
        #region Classes
 
+       [Obsolete ("Use Mono.Unix.Native.Dirent")]
        public sealed class Dirent
        {
+               [CLSCompliant (false)]
                public /* ino_t */ ulong  d_ino;
                public /* off_t */ long   d_off;
+               [CLSCompliant (false)]
                public ushort             d_reclen;
                public byte               d_type;
                public string             d_name;
@@ -812,6 +862,7 @@ namespace Mono.Unix {
                }
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Fstab")]
        public sealed class Fstab
        {
                public string fs_spec;
@@ -856,10 +907,12 @@ namespace Mono.Unix {
                }
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Group")]
        public sealed class Group
        {
                public string           gr_name;
                public string           gr_passwd;
+               [CLSCompliant (false)]
                public /* gid_t */ uint gr_gid;
                public string[]         gr_mem;
 
@@ -926,11 +979,14 @@ namespace Mono.Unix {
                }
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Passwd")]
        public sealed class Passwd
        {
                public string           pw_name;
                public string           pw_passwd;
+               [CLSCompliant (false)]
                public /* uid_t */ uint pw_uid;
+               [CLSCompliant (false)]
                public /* gid_t */ uint pw_gid;
                public string           pw_gecos;
                public string           pw_dir;
@@ -1067,6 +1123,8 @@ namespace Mono.Unix {
        //      EntryPointNotFoundException.  This is also consistent with a missing 
        //      P/Invoke into libc.so.
        //
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Syscall")]
        public sealed class Syscall : Stdlib
        {
                new internal const string LIBC  = "libc";
@@ -2338,6 +2396,12 @@ namespace Mono.Unix {
 
                // TODO: times(2)
 
+               //
+               // <sys/utsname.h>
+               //
+
+               // TODO: uname(2)
+
                #region <sys/wait.h> Declarations
                //
                // <sys/wait.h>
index 0b169c2dd6b0f0142b66567e346436cc2e359887..ee885da1f890746cc9691261870152254592b608 100644 (file)
@@ -11,6 +11,8 @@ using Mono.Unix;
 
 namespace Mono.Unix {
 
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.NativeConvert")]
        public sealed /* static */ class UnixConvert
        {
                private UnixConvert () {}
index 8e7566959262c5fe96c344af4859149f4088d94d..88e8e6a38b39162dc0ea09874f772e9d32798a78 100644 (file)
@@ -39,6 +39,7 @@ namespace Mono.Unix {
        {
                private UnixDirectory () {}
 
+               [CLSCompliant (false)]
                public static UnixDirectoryInfo CreateDirectory (string path, FilePermissions mode)
                {
                        int r = Syscall.mkdir (path, mode);
index 29c533a42bd388c2dbf7b04b7256faf0d553e6c2..2b6e066e6d8706e371f843ed4dff665fb865b3d5 100644 (file)
@@ -50,7 +50,7 @@ namespace Mono.Unix {
                public override string Name {
                        get {
                                string r = UnixPath.GetFileName (FullPath);
-                               if (r == null || r == "")
+                               if (r == null || r.Length == 0)
                                        return FullPath;
                                return r;
                        }
@@ -74,16 +74,27 @@ namespace Mono.Unix {
                        }
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use Create(Mono.Unix.Native.FilePermissions)")]
                public void Create (FilePermissions mode)
                {
-                       int r = Syscall.mkdir (FullPath, mode);
+                       Mono.Unix.Native.FilePermissions _mode = 
+                               (Mono.Unix.Native.FilePermissions) mode;
+                       Create (_mode);
+               }
+
+               [CLSCompliant (false)]
+               public void Create (Mono.Unix.Native.FilePermissions mode)
+               {
+                       int r = Mono.Unix.Native.Syscall.mkdir (FullPath, mode);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                        base.Refresh ();
                }
 
                public void Create ()
                {
-                       FilePermissions mode = FilePermissions.ACCESSPERMS;
+                       Mono.Unix.Native.FilePermissions mode = 
+                               Mono.Unix.Native.FilePermissions.ACCESSPERMS;
                        Create (mode);
                }
 
index 2a0159e3eafcb6ae3f87e016017da7d459a9fb8e..c2280980b103cd2b049a4eadc30d2ec00178c8f0 100644 (file)
@@ -77,7 +77,7 @@ namespace Mono.Unix {
                }
 
                public long AvailableFreeSpace {
-                       get {Refresh (); return (long) (stat.f_bavail * stat.f_bsize);}
+                       get {Refresh (); return Convert.ToInt64 (stat.f_bavail * stat.f_bsize);}
                }
 
                public string DriveFormat {
@@ -115,6 +115,8 @@ namespace Mono.Unix {
                        // set {}
                }
 
+               [CLSCompliant(false)]
+               [Obsolete ("The return type of this property will change in the next release.")]
                public ulong MaximumFilenameLength {
                        get {Refresh (); return stat.f_namemax;}
                }
index 725d489255b7b6161470262aabd589606d47d2d9..96bf5b3c96a6bb58110b1c4c0f9151ec21af6f15 100644 (file)
@@ -65,6 +65,7 @@ namespace Mono.Unix {
                        }
                }
 
+               [CLSCompliant (false)]
                public static long GetConfigurationValue (SysConf name)
                {
                        long r = Syscall.sysconf (name);
@@ -73,6 +74,7 @@ namespace Mono.Unix {
                        return r;
                }
 
+               [CLSCompliant (false)]
                public static string GetConfigurationString (ConfStr name)
                {
                        ulong len = Syscall.confstr (name, null, 0);
@@ -89,8 +91,15 @@ namespace Mono.Unix {
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use UserId")]
                public static uint User {
-                       get {return UnixUser.GetCurrentUser ();}
+                       get {return UnixUser.GetCurrentUserId ();}
+               }
+
+               [CLSCompliant (false)]
+               public static uint UserId {
+                       get {return UnixUser.GetCurrentUserId ();}
                }
 
                public static string UserName {
@@ -117,7 +126,15 @@ namespace Mono.Unix {
                        return Syscall.getpgrp ();
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use GetSupplementaryGroupIds")]
                public static uint[] GetSupplementaryGroups ()
+               {
+                       return GetSupplementaryGroupIds ();
+               }
+
+               [CLSCompliant (false)]
+               public static uint[] GetSupplementaryGroupIds ()
                {
                        int ngroups = Syscall.getgroups (0, new uint[]{});
                        if (ngroups == -1)
@@ -128,7 +145,15 @@ namespace Mono.Unix {
                        return groups;
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use SetSupplementaryGroupIds")]
                public static void SetSupplementaryGroups (uint[] list)
+               {
+                       SetSupplementaryGroupIds (list);
+               }
+
+               [CLSCompliant (false)]
+               public static void SetSupplementaryGroupIds (uint[] list)
                {
                        int r = Syscall.setgroups (list);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
index cfe960adb93e0409d1af67c750fd06d4849d42cb..8b315e713b71afce2f1c1de9810232fc3b0540b6 100644 (file)
@@ -49,12 +49,21 @@ namespace Mono.Unix {
        {
                private UnixFile () {}
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use CanAccess(string, Mono.Unix.Native.AccessModes)")]
                public static bool CanAccess (string path, AccessMode mode)
                {
                        int r = Syscall.access (path, mode);
                        return r == 0;
                }
 
+               [CLSCompliant (false)]
+               public static bool CanAccess (string path, Native.AccessModes mode)
+               {
+                       int r = Native.Syscall.access (path, mode);
+                       return r == 0;
+               }
+
                public static void Delete (string path)
                {
                        int r = Syscall.unlink (path);
@@ -69,6 +78,8 @@ namespace Mono.Unix {
                        return false;
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use GetConfigurationValue(string, Mono.Unix.Native.PathConf)")]
                public static long GetConfigurationValue (string path, PathConf name)
                {
                        Syscall.SetLastError ((Error) 0);
@@ -78,6 +89,16 @@ namespace Mono.Unix {
                        return r;
                }
 
+               [CLSCompliant (false)]
+               public static long GetConfigurationValue (string path, Native.PathConf name)
+               {
+                       Native.Stdlib.SetLastError ((Native.Errno) 0);
+                       long r = Native.Syscall.pathconf (path, name);
+                       if (r == -1 && Native.Stdlib.GetLastError() != (Native.Errno) 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return r;
+               }
+
                public static DateTime GetLastAccessTime (string path)
                {
                        return new UnixFileInfo (path).LastAccessTime;
@@ -101,6 +122,8 @@ namespace Mono.Unix {
                        return new UnixFileInfo (path).LastStatusChangeTime;
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Return Type will change in next release")]
                public static FilePermissions GetPermissions (string path)
                {
                        return new UnixFileInfo (path).Permissions;
@@ -125,12 +148,21 @@ namespace Mono.Unix {
                        return sb.ToString (0, r);
                }
 
+               [CLSCompliant (false)]
+               [Obsolete("Use SetPermissions(string, Mono.Unix.Native.FilePermissions)")]
                public static void SetPermissions (string path, FilePermissions perms)
                {
                        int r = Syscall.chmod (path, perms);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
 
+               [CLSCompliant (false)]
+               public static void SetPermissions (string path, Native.FilePermissions perms)
+               {
+                       int r = Native.Syscall.chmod (path, perms);
+                       UnixMarshal.ThrowExceptionForLastErrorIf (r);
+               }
+
                public static UnixStream Create (string path)
                {
                        FilePermissions mode = // 0644
@@ -139,6 +171,8 @@ namespace Mono.Unix {
                        return Create (path, mode);
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use Create(string, Mono.Unix.Native.FilePermissions)")]
                public static UnixStream Create (string path, FilePermissions mode)
                {
                        int fd = Syscall.creat (path, mode);
@@ -147,6 +181,15 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public static UnixStream Create (string path, Native.FilePermissions mode)
+               {
+                       int fd = Native.Syscall.creat (path, mode);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return new UnixStream (fd);
+               }
+
                public static UnixPipes CreatePipes ()
                {
                        int reading, writing;
@@ -155,6 +198,8 @@ namespace Mono.Unix {
                        return new UnixPipes (new UnixStream (reading), new UnixStream (writing));
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use Open(string, Mono.Unix.Native.OpenFlags)")]
                public static UnixStream Open (string path, OpenFlags flags)
                {
                        int fd = Syscall.open (path, flags);
@@ -163,6 +208,17 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public static UnixStream Open (string path, Native.OpenFlags flags)
+               {
+                       int fd = Native.Syscall.open (path, flags);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return new UnixStream (fd);
+               }
+
+               [CLSCompliant (false)]
+               [Obsolete ("Use Open(string, Mono.Unix.Native.OpenFlags, Mono.Unix.Native.FilePermissions)")]
                public static UnixStream Open (string path, OpenFlags flags, FilePermissions mode)
                {
                        int fd = Syscall.open (path, flags, mode);
@@ -171,6 +227,15 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public static UnixStream Open (string path, Native.OpenFlags flags, Native.FilePermissions mode)
+               {
+                       int fd = Native.Syscall.open (path, flags, mode);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return new UnixStream (fd);
+               }
+
                public static UnixStream Open (string path, FileMode mode)
                {
                        OpenFlags flags = UnixConvert.ToOpenFlags (mode, FileAccess.ReadWrite);
@@ -189,6 +254,8 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use Open(string, FileMode, FileAccess, Mono.Unix.Native.FilePermissions)")]
                public static UnixStream Open (string path, FileMode mode, FileAccess access, FilePermissions perms)
                {
                        OpenFlags flags = UnixConvert.ToOpenFlags (mode, access);
@@ -198,6 +265,16 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public static UnixStream Open (string path, FileMode mode, FileAccess access, Native.FilePermissions perms)
+               {
+                       Native.OpenFlags flags = Native.NativeConvert.ToOpenFlags (mode, access);
+                       int fd = Native.Syscall.open (path, flags, perms);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return new UnixStream (fd);
+               }
+
                public static UnixStream OpenRead (string path)
                {
                        return Open (path, FileMode.Open, FileAccess.Read);
@@ -208,6 +285,7 @@ namespace Mono.Unix {
                        return Open (path, FileMode.OpenOrCreate, FileAccess.Write);
                }
 
+               [CLSCompliant (false)]
                public static void SetOwner (string path, uint owner, uint group)
                {
                        int r = Syscall.chown (path, owner, group);
@@ -232,6 +310,7 @@ namespace Mono.Unix {
                        SetOwner (path, uid, gid);
                }
 
+               [CLSCompliant (false)]
                public static void SetLinkOwner (string path, uint owner, uint group)
                {
                        int r = Syscall.lchown (path, owner, group);
index 5a12445768f93657fb92056610337c037c1bf0d8..905c53c0b0dda4fe5f017ebe8bd7a74c4cb20dac 100644 (file)
@@ -72,6 +72,8 @@ namespace Mono.Unix {
                        return Create (mode);
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use Create(Mono.Unix.Native.FilePermissions)")]
                public UnixStream Create (FilePermissions mode)
                {
                        int fd = Syscall.creat (FullPath, mode);
@@ -81,6 +83,18 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public UnixStream Create (Native.FilePermissions mode)
+               {
+                       int fd = Native.Syscall.creat (FullPath, mode);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       base.Refresh ();
+                       return new UnixStream (fd);
+               }
+
+               [CLSCompliant (false)]
+               [Obsolete ("Use Open(Mono.Unix.Native.OpenFlags)")]
                public UnixStream Open (OpenFlags flags)
                {
                        int fd = Syscall.open (FullPath, flags);
@@ -89,6 +103,17 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public UnixStream Open (Native.OpenFlags flags)
+               {
+                       int fd = Native.Syscall.open (FullPath, flags);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return new UnixStream (fd);
+               }
+
+               [CLSCompliant (false)]
+               [Obsolete ("Use Open(Mono.Unix.Native.OpenFlags,Mono.Unix.Native.FilePermissions)")]
                public UnixStream Open (OpenFlags flags, FilePermissions mode)
                {
                        int fd = Syscall.open (FullPath, flags, mode);
@@ -97,6 +122,15 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public UnixStream Open (Native.OpenFlags flags, Native.FilePermissions mode)
+               {
+                       int fd = Native.Syscall.open (FullPath, flags, mode);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return new UnixStream (fd);
+               }
+
                public UnixStream Open (FileMode mode)
                {
                        OpenFlags flags = UnixConvert.ToOpenFlags (mode, FileAccess.ReadWrite);
@@ -115,6 +149,8 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use Open (System.IO.FileMode,System.IO.FileAccess,Mono.Unix.Native.FilePermissions)")]
                public UnixStream Open (FileMode mode, FileAccess access, FilePermissions perms)
                {
                        OpenFlags flags = UnixConvert.ToOpenFlags (mode, access);
@@ -124,6 +160,16 @@ namespace Mono.Unix {
                        return new UnixStream (fd);
                }
 
+               [CLSCompliant (false)]
+               public UnixStream Open (FileMode mode, FileAccess access, Native.FilePermissions perms)
+               {
+                       Native.OpenFlags flags = Native.NativeConvert.ToOpenFlags (mode, access);
+                       int fd = Native.Syscall.open (FullPath, flags, perms);
+                       if (fd < 0)
+                               UnixMarshal.ThrowExceptionForLastError ();
+                       return new UnixStream (fd);
+               }
+
                public UnixStream OpenRead ()
                {
                        return Open (FileMode.Open, FileAccess.Read);
index 1f1786e699e9e56119ef6c376b58716f670f9132..bfb6c98de71f59514af594d11340ac771888eb58 100644 (file)
@@ -88,38 +88,48 @@ namespace Mono.Unix {
                        }
                }
 
+               [CLSCompliant (false)]
                public ulong Device {
                        get {AssertValid (); return stat.st_dev;}
                }
 
+               [CLSCompliant (false)]
                public ulong Inode {
                        get {AssertValid (); return stat.st_ino;}
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("The type of this property will change in the next release.")]
                public FilePermissions Mode {
                        get {AssertValid (); return stat.st_mode;}
                }
 
+               [CLSCompliant (false)]
                public FilePermissions Permissions {
                        get {AssertValid (); return stat.st_mode & ~FilePermissions.S_IFMT;}
                }
 
+               [CLSCompliant (false)]
                public FilePermissions FileType {
                        get {AssertValid (); return stat.st_mode & FilePermissions.S_IFMT;}
                }
 
+               [CLSCompliant (false)]
                public ulong LinkCount {
                        get {AssertValid (); return (ulong) stat.st_nlink;}
                }
 
+               [CLSCompliant (false)]
                public uint OwnerUser {
                        get {AssertValid (); return stat.st_uid;}
                }
 
+               [CLSCompliant (false)]
                public uint OwnerGroup {
                        get {AssertValid (); return stat.st_gid;}
                }
 
+               [CLSCompliant (false)]
                public ulong DeviceType {
                        get {AssertValid (); return stat.st_rdev;}
                }
@@ -205,6 +215,12 @@ namespace Mono.Unix {
                        return (mode & type) == type;
                }
 
+               internal static bool IsType (Native.FilePermissions mode, Native.FilePermissions type)
+               {
+                       return (mode & type) == type;
+               }
+
+               [CLSCompliant (false)]
                public bool CanAccess (AccessMode mode)
                {
                        int r = Syscall.access (FullPath, mode);
@@ -227,6 +243,7 @@ namespace Mono.Unix {
 
                public abstract void Delete ();
 
+               [CLSCompliant (false)]
                public long GetConfigurationValue (PathConf name)
                {
                        Syscall.SetLastError ((Error) 0);
@@ -263,12 +280,14 @@ namespace Mono.Unix {
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
 
+               [CLSCompliant (false)]
                public void SetPermissions (FilePermissions perms)
                {
                        int r = Syscall.chmod (FullPath, perms);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
 
+               [CLSCompliant (false)]
                public virtual void SetOwner (uint owner, uint group)
                {
                        int r = Syscall.chown (FullPath, owner, group);
index 45876c25c0ebbcdbb84bc232920c974ce8cf84e8..0a353e9948bceebd5fe16887fd730f0d9a53b262 100644 (file)
@@ -36,6 +36,7 @@ namespace Mono.Unix {
        {
                private UnixGroup () {}
 
+               [CLSCompliant (false)]
                public static uint GetGroupId (string group)
                {
                        return new UnixGroupInfo (group).GroupId;
@@ -46,21 +47,31 @@ namespace Mono.Unix {
                        return new UnixGroupInfo (group).Members;
                }
 
+               [CLSCompliant (false)]
                public static string[] GetMembers (uint group)
                {
                        return new UnixGroupInfo (group).Members;
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use GetGroupName")]
                public static string GetName (uint group)
                {
                        return new UnixGroupInfo (group).GroupName;
                }
 
+               [CLSCompliant (false)]
+               public static string GetGroupName (uint group)
+               {
+                       return new UnixGroupInfo (group).GroupName;
+               }
+
                public static string GetPassword (string group)
                {
                        return new UnixGroupInfo (group).Password;
                }
 
+               [CLSCompliant (false)]
                public static string GetPassword (uint group)
                {
                        return new UnixGroupInfo (group).Password;
index 9df96e9012ae2bd71a3449f68b939624c78b62fb..a057cbaf14c5a5dc5e67a30abb59c47a693ce2bf 100644 (file)
@@ -45,6 +45,7 @@ namespace Mono.Unix {
                                throw new ArgumentException (Locale.GetText ("invalid group name"), "group");
                }
 
+               [CLSCompliant (false)]
                public UnixGroupInfo (uint group)
                {
                        this.group = new Group ();
@@ -67,14 +68,21 @@ namespace Mono.Unix {
                        get {return group.gr_passwd;}
                }
 
+               [CLSCompliant (false)]
                public uint GroupId {
                        get {return group.gr_gid;}
                }
 
+               [Obsolete ("Use GetMembers()")]
                public string[] Members {
                        get {return group.gr_mem;}
                }
 
+               public string[] GetMembers ()
+               {
+                       return group.gr_mem;
+               }
+
                public override int GetHashCode ()
                {
                        return group.GetHashCode ();
index d8b4318e501baebc358f7744e297951795138dec..54b0906900281467c2bece03ba1751cd6d99019b 100644 (file)
@@ -77,6 +77,8 @@ namespace Mono.Unix {
                        }
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("The type of this property will change in the next release.")]
                public Signum TerminationSignal {
                        get {
                                if (!HasSignaled)
@@ -94,6 +96,8 @@ namespace Mono.Unix {
                        }
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("The type of this property will change in the next release.")]
                public Signum StopSignal {
                        get {
                                if (!HasStopped)
@@ -135,12 +139,21 @@ namespace Mono.Unix {
                        Signal (Signum.SIGKILL);
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use Signal (Mono.Unix.Native.Signum)")]
                public void Signal (Signum signal)
                {
                        int r = Syscall.kill (pid, signal);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
 
+               [CLSCompliant (false)]
+               public void Signal (Native.Signum signal)
+               {
+                       int r = Native.Syscall.kill (pid, signal);
+                       UnixMarshal.ThrowExceptionForLastErrorIf (r);
+               }
+
                public void WaitForExit ()
                {
                        int status;
index 4b128767642b3f1906549c6b715c921c0265bcfd..49a3218647759f08eb03030f0a8fa7f7304863f9 100644 (file)
@@ -112,6 +112,8 @@ namespace Mono.Unix {
                        }
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("The type of this property will change in the next release.")]
                public FilePermissions Permissions {
                        get {
                                Stat stat;
@@ -318,11 +320,13 @@ namespace Mono.Unix {
                        SendTo (output, (ulong) output.Length);
                }
 
+               [CLSCompliant (false)]
                public void SendTo (UnixStream output, ulong count)
                {
                        SendTo (output.Handle, count);
                }
 
+               [CLSCompliant (false)]
                public void SendTo (int out_fd, ulong count)
                {
                        if (!CanWrite)
@@ -333,6 +337,7 @@ namespace Mono.Unix {
                                UnixMarshal.ThrowExceptionForLastError ();
                }
                
+               [CLSCompliant (false)]
                public void SetOwner (uint user, uint group)
                {
                        AssertNotDisposed ();
@@ -362,6 +367,7 @@ namespace Mono.Unix {
                        SetOwner (uid, gid);
                }
 
+               [CLSCompliant (false)]
                public long GetConfigurationValue (PathConf name)
                {
                        AssertNotDisposed ();
index 914bce3d388a129ec546467c37f0fbab5d80da97..c4336ebb402af1045482b0caa701d8662fccb4c2 100644 (file)
@@ -86,6 +86,7 @@ namespace Mono.Unix {
                        base.Refresh ();
                }
 
+               [CLSCompliant (false)]
                public override void SetOwner (uint owner, uint group)
                {
                        int r = Syscall.lchown (FullPath, owner, group);
index 4cc495d6b559da8230be11274ba2f3b78786df34..dcb0c12ca74253cb278683ab8df7ed3cc934ca13 100644 (file)
@@ -37,19 +37,26 @@ namespace Mono.Unix {
        {
                private UnixUser () {}
 
+               [CLSCompliant (false)]
                public static uint GetUserId (string user)
                {
                        return new UnixUserInfo (user).UserId;
                }
 
-               public static uint GetCurrentUser ()
+               [CLSCompliant (false)]
+               public static uint GetCurrentUserId ()
                {
                        return Syscall.getuid ();
                }
 
                public static string GetCurrentUserName ()
                {
-                       return GetName (GetCurrentUser());
+                       return GetName (GetCurrentUserId ());
+               }
+
+               public static UnixUserInfo GetCurrentUser ()
+               {
+                       return new UnixUserInfo (GetCurrentUserId ());
                }
 
                // I would hope that this is the same as GetCurrentUserName, but it is a
@@ -66,11 +73,13 @@ namespace Mono.Unix {
                        return buf.ToString ();
                }
 
+               [CLSCompliant (false)]
                public static uint GetGroupId (string user)
                {
                        return new UnixUserInfo (user).GroupId;
                }
 
+               [CLSCompliant (false)]
                public static uint GetGroupId (uint user)
                {
                        return new UnixUserInfo (user).GroupId;
@@ -81,6 +90,7 @@ namespace Mono.Unix {
                        return new UnixUserInfo (user).RealName;
                }
 
+               [CLSCompliant (false)]
                public static string GetRealName (uint user)
                {
                        return new UnixUserInfo (user).RealName;
@@ -91,21 +101,31 @@ namespace Mono.Unix {
                        return new UnixUserInfo (user).HomeDirectory;
                }
 
+               [CLSCompliant (false)]
                public static string GetHomeDirectory (uint user)
                {
                        return new UnixUserInfo (user).HomeDirectory;
                }
 
+               [CLSCompliant (false)]
+               [Obsolete ("Use GetUserName")]
                public static string GetName (uint user)
                {
                        return new UnixUserInfo (user).UserName;
                }
 
+               [CLSCompliant (false)]
+               public static string GetUserName (uint user)
+               {
+                       return new UnixUserInfo (user).UserName;
+               }
+
                public static string GetPassword (string user)
                {
                        return new UnixUserInfo (user).Password;
                }
 
+               [CLSCompliant (false)]
                public static string GetPassword (uint user)
                {
                        return new UnixUserInfo (user).Password;
@@ -116,6 +136,7 @@ namespace Mono.Unix {
                        return new UnixUserInfo (user).ShellProgram;
                }
 
+               [CLSCompliant (false)]
                public static string GetShellProgram (uint user)
                {
                        return new UnixUserInfo (user).ShellProgram;
index 52515892387287a74a3c75582f09925bb58ea8ec..bb0748e6ad9305fde09863948ccc498caf1101e5 100644 (file)
@@ -46,6 +46,7 @@ namespace Mono.Unix {
                                throw new ArgumentException (Locale.GetText ("invalid username"), "user");
                }
 
+               [CLSCompliant (false)]
                public UnixUserInfo (uint user)
                {
                        passwd = new Passwd ();
@@ -68,10 +69,12 @@ namespace Mono.Unix {
                        get {return passwd.pw_passwd;}
                }
 
+               [CLSCompliant (false)]
                public uint UserId {
                        get {return passwd.pw_uid;}
                }
 
+               [CLSCompliant (false)]
                public uint GroupId {
                        get {return passwd.pw_gid;}
                }
diff --git a/mcs/class/Mono.Posix/Mono.Unix/make-map.cs b/mcs/class/Mono.Posix/Mono.Unix/make-map.cs
deleted file mode 100644 (file)
index d5ef929..0000000
+++ /dev/null
@@ -1,632 +0,0 @@
-//
-// MakeMap.cs: Builds a C map of constants defined on C# land
-//
-// Authors:
-//  Miguel de Icaza (miguel@novell.com)
-//  Jonathan Pryor (jonpryor@vt.edu)
-//
-// (C) 2003 Novell, Inc.
-// (C) 2004 Jonathan Pryor
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-delegate void CreateFileHandler (string assembly_name, string file_prefix);
-delegate void AssemblyAttributesHandler (Assembly assembly);
-delegate void TypeHandler (Type t, string ns, string fn);
-delegate void CloseFileHandler (string file_prefix);
-
-class MakeMap {
-
-       public static int Main (string [] args)
-       {
-               FileGenerator[] generators = new FileGenerator[]{
-                       new HeaderFileGenerator (),
-                       new SourceFileGenerator (),
-                       new ConvertFileGenerator (),
-                       new MphPrototypeFileGenerator (),
-               };
-
-               MakeMap composite = new MakeMap ();
-               foreach (FileGenerator g in generators) {
-                       composite.FileCreators += new CreateFileHandler (g.CreateFile);
-                       composite.AssemblyAttributesHandler += 
-                               new AssemblyAttributesHandler (g.WriteAssemblyAttributes);
-                       composite.TypeHandler += new TypeHandler (g.WriteType);
-                       composite.FileClosers += new CloseFileHandler (g.CloseFile);
-               }
-
-               return composite.Run (args);
-       }
-
-       event CreateFileHandler FileCreators;
-       event AssemblyAttributesHandler AssemblyAttributesHandler;
-       event TypeHandler TypeHandler;
-       event CloseFileHandler FileClosers;
-
-       int Run (string[] args)
-       {
-               if (args.Length != 2){
-                       Console.WriteLine ("Usage is: make-map assembly output");
-                       return 1;
-               }
-               
-               string assembly_name = args[0];
-               string output = args[1];
-
-               FileCreators (assembly_name, output);
-
-               Assembly assembly = Assembly.LoadFrom (assembly_name);
-               AssemblyAttributesHandler (assembly);
-               
-               Type [] exported_types = assembly.GetTypes ();
-                       
-               foreach (Type t in exported_types) {
-                       string ns = t.Namespace;
-                       if (ns == null || !ns.StartsWith ("Mono"))
-                               continue;
-                       string fn = GetNativeName (t.FullName);
-                       ns = GetNativeName (ns);
-
-                       TypeHandler (t, ns, fn);
-               }
-               FileClosers (output);
-
-               return 0;
-       }
-
-       internal static string GetNativeName (string fn)
-       {
-               return fn.Replace (".", "_").Replace ("Mono_Unix", "Mono_Posix");
-       }
-}
-
-abstract class FileGenerator {
-       public abstract void CreateFile (string assembly_name, string file_prefix);
-
-       public virtual void WriteAssemblyAttributes (Assembly assembly)
-       {
-       }
-
-       public abstract void WriteType (Type t, string ns, string fn);
-       public abstract void CloseFile (string file_prefix);
-
-       protected static void WriteHeader (StreamWriter s, string assembly)
-       {
-               s.WriteLine (
-                       "/*\n" +
-                       " * This file was automatically generated by make-map from {0}.\n" +
-                       " *\n" +
-                       " * DO NOT MODIFY.\n" +
-                       " */\n" +
-                       "#include <config.h>\n",
-                       assembly);
-       }
-
-       protected static bool CanMapType (Type t, out bool bits)
-       {
-               object [] attributes = t.GetCustomAttributes (false);
-               bool map = false;
-               bits = false;
-               
-               foreach (object attr in attributes) {
-                       if (attr.GetType ().Name == "MapAttribute")
-                               map = true;
-                       if (attr.GetType ().Name == "FlagsAttribute")
-                               bits = true;
-               }
-               return map;
-       }
-
-       protected static string GetNativeType (Type t)
-       {
-               string ut = t.Name;
-               if (t.IsEnum)
-                       ut = Enum.GetUnderlyingType (t).Name;
-               Type et = t.GetElementType ();
-               if (et != null && et.IsEnum)
-                       ut = Enum.GetUnderlyingType (et).Name;
-
-               string type = null;
-
-               switch (ut) {
-                       case "Boolean":       type = "int";             break;
-                       case "Byte":          type = "unsigned char";   break;
-                       case "SByte":         type = "signed char";     break;
-                       case "Int16":         type = "short";           break;
-                       case "UInt16":        type = "unsigned short";  break;
-                       case "Int32":         type = "int";             break;
-                       case "UInt32":        type = "unsigned int";    break;
-                       case "UInt32[]":      type = "unsigned int*";   break;
-                       case "Int64":         type = "gint64";          break;
-                       case "UInt64":        type = "guint64";         break;
-                       case "IntPtr":        type = "void*";           break;
-                       case "Byte[]":        type = "void*";           break;
-                       case "String":        type = "const char*";     break;
-                       case "StringBuilder": type = "char*";           break;
-                       case "Void":          type = "void";            break;
-                       case "HandleRef":     type = "void*";           break;
-               }
-               if (type != null)
-                       return string.Format ("{0}{1}", type,
-                                       t.IsByRef ? "*" : "");
-               return GetTypeName (t);
-       }
-
-       private static string GetTypeName (Type t)
-       {
-               if (t.Namespace.StartsWith ("System"))
-                       return "int /* warning: unknown mapping for type: " + t.Name + " */";
-               string ts = "struct " +
-                       MakeMap.GetNativeName (t.FullName).Replace ("+", "_").Replace ("&", "*");
-               return ts;
-       }
-}
-
-class HeaderFileGenerator : FileGenerator {
-       StreamWriter sh;
-
-       public override void CreateFile (string assembly_name, string file_prefix)
-       {
-               sh = File.CreateText (file_prefix + ".h");
-               WriteHeader (sh, assembly_name);
-               sh.WriteLine ("#ifndef INC_Mono_Posix_" + file_prefix + "_H");
-               sh.WriteLine ("#define INC_Mono_Posix_" + file_prefix + "_H\n");
-               sh.WriteLine ("#include <glib/gtypes.h>\n");
-               sh.WriteLine ("G_BEGIN_DECLS\n");
-       }
-
-       public override void WriteType (Type t, string ns, string fn)
-       {
-               bool bits;
-               if (!CanMapType (t, out bits))
-                       return;
-               string etype = GetNativeType (t);
-
-               WriteLiteralValues (sh, t, fn);
-               sh.WriteLine ("int {1}_From{2} ({0} x, {0} *r);", etype, ns, t.Name);
-               sh.WriteLine ("int {1}_To{2} ({0} x, {0} *r);", etype, ns, t.Name);
-               sh.WriteLine ();
-       }
-
-       static void WriteLiteralValues (StreamWriter sh, Type t, string n)
-       {
-               object inst = Activator.CreateInstance (t);
-               foreach (FieldInfo fi in t.GetFields ()){
-                       if (!fi.IsLiteral)
-                               continue;
-                       sh.WriteLine ("#define {0}_{1} 0x{2:x}", n, fi.Name, fi.GetValue (inst));
-               }
-       }
-
-       public override void CloseFile (string file_prefix)
-       {
-               sh.WriteLine ("G_END_DECLS\n");
-               sh.WriteLine ("#endif /* ndef INC_Mono_Posix_" + file_prefix + "_H */\n");
-               sh.Close ();
-       }
-}
-
-class SourceFileGenerator : FileGenerator {
-       StreamWriter sc;
-
-       public override void CreateFile (string assembly_name, string file_prefix)
-       {
-               sc = File.CreateText (file_prefix + ".c");
-               WriteHeader (sc, assembly_name);
-
-               if (file_prefix.IndexOf ("/") != -1)
-                       file_prefix = file_prefix.Substring (file_prefix.IndexOf ("/") + 1);
-               sc.WriteLine ("#include \"{0}.h\"", file_prefix);
-               sc.WriteLine ();
-       }
-
-       public override void WriteAssemblyAttributes (Assembly assembly)
-       {
-               object [] x = assembly.GetCustomAttributes (false);
-               Console.WriteLine ("Got: " + x.Length);
-               foreach (object aattr in assembly.GetCustomAttributes (false)) {
-                       Console.WriteLine ("Got: " + aattr.GetType ().Name);
-                       if (aattr.GetType ().Name == "IncludeAttribute"){
-                               WriteDefines (sc, aattr);
-                               WriteIncludes (sc, aattr);
-                       }
-               }
-       }
-
-       static void WriteDefines (TextWriter writer, object o)
-       {
-               PropertyInfo prop = o.GetType ().GetProperty ("Defines");
-               if (prop == null)
-                       throw new Exception ("Cannot find 'Defines' property");
-
-               MethodInfo method = prop.GetGetMethod ();
-               string [] defines = (string []) method.Invoke (o, null);
-               foreach (string def in defines) {
-                       writer.WriteLine ("#ifndef {0}", def);
-                       writer.WriteLine ("#define {0}", def);
-                       writer.WriteLine ("#endif /* ndef {0} */", def);
-               }
-       }
-
-       static void WriteIncludes (TextWriter writer, object o)
-       {
-               PropertyInfo prop = o.GetType ().GetProperty ("Includes");
-               if (prop == null)
-                       throw new Exception ("Cannot find 'Includes' property");
-
-               MethodInfo method = prop.GetGetMethod ();
-               string [] includes = (string []) method.Invoke (o, null);
-               foreach (string inc in includes){
-                       if (inc.Length > 3 && 
-                                       string.CompareOrdinal (inc, 0, "ah:", 0, 3) == 0) {
-                               string i = inc.Substring (3);
-                               writer.WriteLine ("#ifdef HAVE_" + (i.ToUpper ().Replace ("/", "_").Replace (".", "_")));
-                               writer.WriteLine ("#include <{0}>", i);
-                               writer.WriteLine ("#endif");
-                       } else 
-                               writer.WriteLine ("#include <{0}>", inc);
-               }
-               writer.WriteLine ();
-       }
-
-       public override void WriteType (Type t, string ns, string fn)
-       {
-               bool bits;
-               if (!CanMapType (t, out bits))
-                       return;
-               string etype = GetNativeType (t);
-
-               WriteFromManagedType (t, ns, fn, etype, bits);
-               WriteToManagedType (t, ns, fn, etype, bits);
-       }
-
-       private void WriteFromManagedType (Type t, string ns, string fn, string etype, bool bits)
-       {
-               sc.WriteLine ("int {1}_From{2} ({0} x, {0} *r)", etype, ns, t.Name);
-               sc.WriteLine ("{");
-               sc.WriteLine ("\t*r = 0;");
-               // For many values, 0 is a valid value, but doesn't have it's own symbol.
-               // Examples: Error (0 means "no error"), WaitOptions (0 means "no options").
-               // Make 0 valid for all conversions.
-               sc.WriteLine ("\tif (x == 0)\n\t\treturn 0;");
-               foreach (FieldInfo fi in t.GetFields ()) {
-                       if (!fi.IsLiteral)
-                               continue;
-                       if (Attribute.GetCustomAttribute (fi, 
-                               typeof(ObsoleteAttribute), false) != null) {
-                               sc.WriteLine ("\t/* {0}_{1} is obsolete; ignoring */", fn, fi.Name);
-                               continue;
-                       }
-                       if (bits)
-                               // properly handle case where [Flags] enumeration has helper
-                               // synonyms.  e.g. DEFFILEMODE and ACCESSPERMS for mode_t.
-                               sc.WriteLine ("\tif ((x & {0}_{1}) == {0}_{1})", fn, fi.Name);
-                       else
-                               sc.WriteLine ("\tif (x == {0}_{1})", fn, fi.Name);
-                       sc.WriteLine ("#ifdef {0}", fi.Name);
-                       if (bits)
-                               sc.WriteLine ("\t\t*r |= {1};", fn, fi.Name);
-                       else
-                               sc.WriteLine ("\t\t{{*r = {1}; return 0;}}", fn, fi.Name);
-                       sc.WriteLine ("#else /* def {0} */\n\t\t{{errno = EINVAL; return -1;}}", fi.Name);
-                       sc.WriteLine ("#endif /* ndef {0} */", fi.Name);
-               }
-               if (bits)
-                       sc.WriteLine ("\treturn 0;");
-               else
-                       sc.WriteLine ("\terrno = EINVAL; return -1;"); // return error if not matched
-               sc.WriteLine ("}\n");
-       }
-
-       private void WriteToManagedType (Type t, string ns, string fn, string etype, bool bits)
-       {
-               sc.WriteLine ("int {1}_To{2} ({0} x, {0} *r)", etype, ns, t.Name);
-               sc.WriteLine ("{");
-               sc.WriteLine ("\t*r = 0;", etype);
-               // For many values, 0 is a valid value, but doesn't have it's own symbol.
-               // Examples: Error (0 means "no error"), WaitOptions (0 means "no options").
-               // Make 0 valid for all conversions.
-               sc.WriteLine ("\tif (x == 0)\n\t\treturn 0;");
-               foreach (FieldInfo fi in t.GetFields ()) {
-                       if (!fi.IsLiteral)
-                               continue;
-                       sc.WriteLine ("#ifdef {0}", fi.Name);
-                       if (bits)
-                               // properly handle case where [Flags] enumeration has helper
-                               // synonyms.  e.g. DEFFILEMODE and ACCESSPERMS for mode_t.
-                               sc.WriteLine ("\tif ((x & {1}) == {1})\n\t\t*r |= {0}_{1};", fn, fi.Name);
-                       else
-                               sc.WriteLine ("\tif (x == {1})\n\t\t{{*r = {0}_{1}; return 0;}}", fn, fi.Name);
-                       sc.WriteLine ("#endif /* ndef {0} */", fi.Name);
-               }
-               if (bits)
-                       sc.WriteLine ("\treturn 0;");
-               else
-                       sc.WriteLine ("\terrno = EINVAL; return -1;");
-               sc.WriteLine ("}\n");
-       }
-
-       public override void CloseFile (string file_prefix)
-       {
-               sc.Close ();
-       }
-}
-
-class ConvertFileGenerator : FileGenerator {
-       StreamWriter scs;
-
-       public override void CreateFile (string assembly_name, string file_prefix)
-       {
-               scs = File.CreateText (file_prefix + ".cs");
-               WriteHeader (scs, assembly_name);
-               scs.WriteLine ("using System;");
-               scs.WriteLine ("using System.Runtime.InteropServices;");
-               scs.WriteLine ("using Mono.Unix;\n");
-               scs.WriteLine ("namespace Mono.Unix {\n");
-               scs.WriteLine ("\tpublic sealed /* static */ class UnixConvert");
-               scs.WriteLine ("\t{");
-               scs.WriteLine ("\t\tprivate UnixConvert () {}\n");
-               scs.WriteLine ("\t\tprivate const string LIB = \"MonoPosixHelper\";\n");
-               scs.WriteLine ("\t\tprivate static void ThrowArgumentException (object value)");
-               scs.WriteLine ("\t\t{");
-               scs.WriteLine ("\t\t\tthrow new ArgumentOutOfRangeException (\"value\", value,");
-               scs.WriteLine ("\t\t\t\tLocale.GetText (\"Current platform doesn't support this value.\"));");
-               scs.WriteLine ("\t\t}\n");
-       }
-
-       public override void WriteType (Type t, string ns, string fn)
-       {
-               bool bits;
-               if (!CanMapType (t, out bits))
-                       return;
-
-               string mtype = Enum.GetUnderlyingType(t).Name;
-               ObsoleteAttribute oa = (ObsoleteAttribute) Attribute.GetCustomAttribute (t, 
-                                       typeof(ObsoleteAttribute), false);
-               string obsolete = "";
-               if (oa != null) {
-                       obsolete = "[Obsolete (\"" + oa.Message + "\")]\n\t\t";
-               }
-               scs.WriteLine ("\t\t[DllImport (LIB, " + 
-                       "EntryPoint=\"{0}_From{1}\")]\n" +
-                       "\t\tprivate static extern int From{1} ({1} value, out {2} rval);\n",
-                       ns, t.Name, mtype);
-               scs.WriteLine ("\t\t{3}public static bool TryFrom{1} ({1} value, out {2} rval)\n" +
-                       "\t\t{{\n" +
-                       "\t\t\treturn From{1} (value, out rval) == 0;\n" +
-                       "\t\t}}\n", ns, t.Name, mtype, obsolete);
-               scs.WriteLine ("\t\t{2}public static {0} From{1} ({1} value)", mtype, t.Name, obsolete);
-               scs.WriteLine ("\t\t{");
-               scs.WriteLine ("\t\t\t{0} rval;", mtype);
-               scs.WriteLine ("\t\t\tif (From{0} (value, out rval) == -1)\n" + 
-                               "\t\t\t\tThrowArgumentException (value);", t.Name);
-               scs.WriteLine ("\t\t\treturn rval;");
-               scs.WriteLine ("\t\t}\n");
-               scs.WriteLine ("\t\t[DllImport (LIB, " + 
-                       "EntryPoint=\"{0}_To{1}\")]\n" +
-                       "\t\tprivate static extern int To{1} ({2} value, out {1} rval);\n",
-                       ns, t.Name, mtype);
-               scs.WriteLine ("\t\t{2}public static bool TryTo{1} ({0} value, out {1} rval)\n" +
-                       "\t\t{{\n" +
-                       "\t\t\treturn To{1} (value, out rval) == 0;\n" +
-                       "\t\t}}\n", mtype, t.Name, obsolete);
-               scs.WriteLine ("\t\t{2}public static {1} To{1} ({0} value)", mtype, t.Name, obsolete);
-               scs.WriteLine ("\t\t{");
-               scs.WriteLine ("\t\t\t{0} rval;", t.Name);
-               scs.WriteLine ("\t\t\tif (To{0} (value, out rval) == -1)\n" + 
-                               "\t\t\t\tThrowArgumentException (value);", t.Name);
-               scs.WriteLine ("\t\t\treturn rval;");
-               scs.WriteLine ("\t\t}\n");
-       }
-
-       public override void CloseFile (string file_prefix)
-       {
-               scs.WriteLine ("\t}");
-               scs.WriteLine ("}\n");
-               scs.Close ();
-       }
-}
-
-class MphPrototypeFileGenerator : FileGenerator {
-       StreamWriter icall;
-       Hashtable methods = new Hashtable ();
-       Hashtable structs = new Hashtable ();
-
-       public override void CreateFile (string assembly_name, string file_prefix)
-       {
-               icall = File.CreateText (file_prefix + "-icalls.h");
-               WriteHeader (icall, assembly_name);
-               icall.WriteLine ("#ifndef INC_Mono_Posix_" + file_prefix + "_ICALLS_H");
-               icall.WriteLine ("#define INC_Mono_Posix_" + file_prefix + "_ICALLS_H\n");
-               icall.WriteLine ("#include <glib/gtypes.h>\n");
-               icall.WriteLine ("G_BEGIN_DECLS\n");
-
-               // Kill warning about unused method
-               DumpTypeInfo (null);
-       }
-
-       public override void WriteType (Type t, string ns, string fn)
-       {
-               BindingFlags bf = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
-               foreach (MethodInfo m in t.GetMethods (bf)) {
-                       if ((m.Attributes & MethodAttributes.PinvokeImpl) == 0)
-                               continue;
-                       DllImportAttribute dia = GetDllImportInfo (m);
-                       if (dia == null) {
-                               Console.WriteLine ("Unable to emit native prototype for P/Invoke " + 
-                                               "method: {0}", m);
-                               continue;
-                       }
-                       // we shouldn't declare prototypes for POSIX, etc. functions.
-                       if (dia.Value != "MonoPosixHelper" || IsOnExcludeList (dia.EntryPoint))
-                               continue;
-                       methods [dia.EntryPoint] = m;
-                       RecordStructs (m);
-               }
-       }
-
-       private static DllImportAttribute GetDllImportInfo (MethodInfo method)
-       {
-               // .NET 2.0 synthesizes pseudo-attributes such as DllImport
-               DllImportAttribute dia = (DllImportAttribute) Attribute.GetCustomAttribute (method, 
-                                       typeof(DllImportAttribute), false);
-               if (dia != null)
-                       return dia;
-
-               // We're not on .NET 2.0; assume we're on Mono and use some internal
-               // methods...
-               Type MonoMethod = Type.GetType ("System.Reflection.MonoMethod", false);
-               if (MonoMethod == null) {
-                       Console.WriteLine ("cannot find MonoMethod");
-                       return null;
-               }
-               MethodInfo GetDllImportAttribute = 
-                       MonoMethod.GetMethod ("GetDllImportAttribute", 
-                                       BindingFlags.Static | BindingFlags.NonPublic);
-               if (GetDllImportAttribute == null) {
-                       Console.WriteLine ("cannot find GetDllImportAttribute");
-                       return null;
-               }
-               IntPtr mhandle = method.MethodHandle.Value;
-               return (DllImportAttribute) GetDllImportAttribute.Invoke (null, 
-                               new object[]{mhandle});
-       }
-
-       private static string[] ExcludeList = new string[]{
-               "Mono_Posix_Stdlib_snprintf",
-       };
-
-       private bool IsOnExcludeList (string method)
-       {
-               int idx = Array.BinarySearch (ExcludeList, method);
-               return (idx >= 0 && idx < ExcludeList.Length) ? true : false;
-       }
-
-       private void RecordStructs (MethodInfo method)
-       {
-               ParameterInfo[] parameters = method.GetParameters ();
-               foreach (ParameterInfo pi in parameters) {
-                       string s = GetNativeType (pi.ParameterType);
-                       if (s.StartsWith ("struct"))
-                               structs [s] = s;
-               }
-       }
-
-       public override void CloseFile (string file_prefix)
-       {
-               icall.WriteLine ("/*\n * Structure Declarations\n */");
-               foreach (string s in Sort (structs.Keys))
-                       icall.WriteLine ("{0};", s.Replace ("*", ""));
-
-               icall.WriteLine ();
-
-               icall.WriteLine ("/*\n * Function Declarations\n */");
-               foreach (string method in Sort (methods.Keys)) {
-                       WriteMethodDeclaration ((MethodInfo) methods [method], method);
-               }
-
-               icall.WriteLine ("\nG_END_DECLS\n");
-               icall.WriteLine ("#endif /* ndef INC_Mono_Posix_" + file_prefix + "_ICALLS_H */\n");
-               icall.Close ();
-       }
-
-       private static IEnumerable Sort (ICollection c)
-       {
-               ArrayList al = new ArrayList (c);
-               al.Sort ();
-               return al;
-       }
-
-       private void WriteMethodDeclaration (MethodInfo method, string entryPoint)
-       {
-               icall.Write ("{0} ", GetNativeType (method.ReturnType));
-               icall.Write ("{0} ", entryPoint);
-               ParameterInfo[] parameters = method.GetParameters();
-               if (parameters.Length == 0) {
-                       icall.WriteLine ("(void);");
-                       return;
-               }
-               if (parameters.Length > 0) {
-                       icall.Write ("(");
-                       WriteParameterDeclaration (parameters [0]);
-               }
-               for (int i = 1; i < parameters.Length; ++i) {
-                       icall.Write (", ");
-                       WriteParameterDeclaration (parameters [i]);
-               }
-               icall.WriteLine (");");
-       }
-
-       private void DumpTypeInfo (Type t)
-       {
-               if (t == null)
-                       return;
-
-               icall.WriteLine ("\t\t/* Type Info for " + t.FullName + ":");
-               foreach (MemberInfo mi in typeof(Type).GetMembers()) {
-                       icall.WriteLine ("\t\t\t{0}={1}", mi.Name, GetMemberValue (mi, t));
-               }
-               icall.WriteLine ("\t\t */");
-       }
-
-       private static string GetMemberValue (MemberInfo mi, Type t)
-       {
-               try {
-               switch (mi.MemberType) {
-                       case MemberTypes.Constructor:
-                       case MemberTypes.Method: {
-                               MethodBase b = (MethodBase) mi;
-                               if (b.GetParameters().Length == 0)
-                                       return b.Invoke (t, new object[]{}).ToString();
-                               return "<<cannot invoke>>";
-                       }
-                       case MemberTypes.Field:
-                               return ((FieldInfo) mi).GetValue (t).ToString ();
-                       case MemberTypes.Property: {
-                               PropertyInfo pi = (PropertyInfo) mi;
-                               if (!pi.CanRead)
-                                       return "<<cannot read>>";
-                               return pi.GetValue (t, null).ToString ();
-                       }
-                       default:
-                               return "<<unknown value>>";
-               }
-               }
-               catch (Exception e) {
-                       return "<<exception reading member: " + e.Message + ">>";
-               }
-       }
-
-       private void WriteParameterDeclaration (ParameterInfo pi)
-       {
-               // DumpTypeInfo (pi.ParameterType);
-               icall.Write ("{0} {1}", GetNativeType (pi.ParameterType), pi.Name);
-       }
-}
-
-// vim: noexpandtab
index bfbd4a935090252e7d803c76d46e38c8c2a35387..3f2b6551adcdf50939ac03935b54a3d0aa6b1126 100644 (file)
@@ -3,7 +3,7 @@ SUBDIRS =
 include ../../build/rules.make
 
 LIBRARY = Mono.Security.dll
-LIB_MCS_FLAGS = /r:System.dll /unsafe
-TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 -nowarn:0672
+LIB_MCS_FLAGS = -r:System.dll -unsafe
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:169,219,618,672
 
 include ../../build/library.make
index 7f243c2954aa31906a12c875d9f9d2367e024e3d..1b38a8be1350f250b2ca5b0158fe0a6714090efd 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * SslStreamBase.cs, ServerRecordProtocol.cs, SslClientStream.cs,
+       ClientRecordProtocol.cs, RecordProtocol.cs, SslServerStream.cs:
+       Re-written async support for Ssl[Client|Server]Stream from JD Conley
+       <jd.conley@coversant.net> with minor changes. Fix bug #75687 (and a 
+       lot of other known problems).
+
 2005-07-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * ServerContext.cs: Build the list of trusted certificates from all
index 262c3c2b4cf624402e0e765b8af2440d5daff780..92dd6166f5cd8debf15f5c44daaef5400fa163dc 100644 (file)
@@ -45,22 +45,11 @@ namespace Mono.Security.Protocol.Tls
 
                #region Send Messages
 
-               public override void SendRecord(HandshakeType type)
+               public override HandshakeMessage GetMessage(HandshakeType type)
                {
-                       // Create and process the record message
                        HandshakeMessage msg = this.createClientHandshakeMessage(type);
-                       msg.Process();
 
-                       DebugHelper.WriteLine(">>>> Write handshake record ({0}|{1})", context.Protocol, msg.ContentType);
-
-                       // Write record
-                       this.SendRecord(msg.ContentType, msg.EncodeMessage());
-
-                       // Update session
-                       msg.Update();
-
-                       // Reset message contents
-                       msg.Reset();
+                       return msg;
                }
 
                #endregion
index 0cd3f075408cc27a7999f69f44c6b2721d1f397e..5572096b9b648c49db32f2064584f2aa62b8ab42 100644 (file)
@@ -27,6 +27,7 @@ using System.Collections;
 using System.IO;
 using System.Security.Cryptography;
 using System.Security.Cryptography.X509Certificates;
+using System.Threading;
 
 using Mono.Security.Protocol.Tls.Handshake;
 
@@ -64,102 +65,348 @@ namespace Mono.Security.Protocol.Tls
 
                #region Abstract Methods
 
-               public abstract void SendRecord(HandshakeType type);
+               public virtual void SendRecord(HandshakeType type)
+               {
+
+                       IAsyncResult ar = this.BeginSendRecord(type, null, null);
+
+                       this.EndSendRecord(ar);
+
+               }
+
                protected abstract void ProcessHandshakeMessage(TlsStream handMsg);
                protected abstract void ProcessChangeCipherSpec();
-                               
+
+               public virtual HandshakeMessage GetMessage(HandshakeType type)
+               {
+                       throw new NotSupportedException();
+               }
+
                #endregion
 
-               #region Reveive Record Methods
+               #region Receive Record Async Result
+               private class ReceiveRecordAsyncResult : IAsyncResult
+               {
+                       private AsyncCallback _userCallback;
+                       private object _userState;
+                       private Exception _asyncException;
+                       private ManualResetEvent _complete;
+                       private byte[] _resultingBuffer;
+                       private Stream _record;
 
-               public byte[] ReceiveRecord(Stream record)
+                       private byte[] _initialBuffer;
+
+                       public ReceiveRecordAsyncResult(AsyncCallback userCallback, object userState, byte[] initialBuffer, Stream record)
+                       {
+                               _userCallback = userCallback;
+                               _userState = userState;
+                               _complete = new ManualResetEvent(false);
+                               _initialBuffer = initialBuffer;
+                               _record = record;
+                       }
+
+                       public Stream Record
+                       {
+                               get { return _record; }
+                       }
+
+                       public byte[] ResultingBuffer
+                       {
+                               get { return _resultingBuffer; }
+                       }
+
+                       public byte[] InitialBuffer
+                       {
+                               get { return _initialBuffer; }
+                       }
+
+                       public object AsyncState
+                       {
+                               get { return _userState; }
+                       }
+
+                       public Exception AsyncException
+                       {
+                               get { return _asyncException; }
+                       }
+
+                       public bool CompletedWithError
+                       {
+                               get { return null != _asyncException; }
+                       }
+
+                       public WaitHandle AsyncWaitHandle
+                       {
+                               get { return _complete; }
+                       }
+
+                       public bool CompletedSynchronously
+                       {
+                               get { return false; }
+                       }
+
+                       public bool IsCompleted
+                       {
+                               get { return _complete.WaitOne(0, false); }
+                       }
+
+                       private void SetComplete(Exception ex, byte[] resultingBuffer)
+                       {
+                               if (this.IsCompleted)
+                                       return;
+
+                               lock (this)
+                               {
+                                       if (this.IsCompleted)
+                                               return;
+
+                                       _asyncException = ex;
+                                       _resultingBuffer = resultingBuffer;
+                                       _complete.Set();
+                               }
+
+                               if (null != _userCallback)
+                                       _userCallback (this);
+
+                       }
+
+                       public void SetComplete(Exception ex)
+                       {
+                               SetComplete(ex, null);
+                       }
+
+                       public void SetComplete(byte[] resultingBuffer)
+                       {
+                               SetComplete(null, resultingBuffer);
+                       }
+
+                       public void SetComplete()
+                       {
+                               SetComplete(null, null);
+                       }
+               }
+               #endregion
+
+               #region Receive Record Async Result
+               private class SendRecordAsyncResult : IAsyncResult
                {
-                       if (this.context.ConnectionEnd)
+                       private AsyncCallback _userCallback;
+                       private object _userState;
+                       private Exception _asyncException;
+                       private ManualResetEvent _complete;
+                       private HandshakeMessage _message;
+
+                       public SendRecordAsyncResult(AsyncCallback userCallback, object userState, HandshakeMessage message)
                        {
-                               throw new TlsException(
-                                       AlertDescription.InternalError,
-                                       "The session is finished and it's no longer valid.");
+                               _userCallback = userCallback;
+                               _userState = userState;
+                               _complete = new ManualResetEvent(false);
+                               _message = message;
                        }
 
-                       // Try to read the Record Content Type
-                       int type = record.ReadByte ();
-                       if (type == -1)
+                       public HandshakeMessage Message
                        {
-                               return null;
+                               get { return _message; }
                        }
 
-                       // Set last handshake message received to None
-                       this.context.LastHandshakeMsg = HandshakeType.ClientHello;
+                       public object AsyncState
+                       {
+                               get { return _userState; }
+                       }
 
-                       ContentType     contentType     = (ContentType)type;
-                       byte[] buffer = this.ReadRecordBuffer(type, record);
-                       if (buffer == null)
+                       public Exception AsyncException
                        {
-                               // record incomplete (at the moment)
-                               return null;
+                               get { return _asyncException; }
                        }
 
-                       // Decrypt message contents if needed
-                       if (contentType == ContentType.Alert && buffer.Length == 2)
+                       public bool CompletedWithError
                        {
+                               get { return null != _asyncException; }
                        }
-                       else
+
+                       public WaitHandle AsyncWaitHandle
+                       {
+                               get { return _complete; }
+                       }
+
+                       public bool CompletedSynchronously
+                       {
+                               get { return false; }
+                       }
+
+                       public bool IsCompleted
+                       {
+                               get { return _complete.WaitOne(0, false); }
+                       }
+
+                       public void SetComplete(Exception ex)
                        {
-                               if (this.context.IsActual && contentType != ContentType.ChangeCipherSpec)
+                               if (this.IsCompleted)
+                                       return;
+
+                               lock (this)
                                {
-                                       buffer = this.decryptRecordFragment(contentType, buffer);
-                                       DebugHelper.WriteLine("Decrypted record data", buffer);
+                                       if (this.IsCompleted)
+                                               return;
+
+                                       _asyncException = ex;
+                                       _complete.Set();
                                }
+
+                               if (null != _userCallback)
+                                       _userCallback (this);
+
                        }
 
-                       // Process record
-                       switch (contentType)
+                       public void SetComplete()
                        {
-                               case ContentType.Alert:
-                                       this.ProcessAlert((AlertLevel)buffer [0], (AlertDescription)buffer [1]);
-                                       if (record.CanSeek) 
-                                       {
-                                               // don't reprocess that memory block
-                                               record.SetLength (0); 
-                                       }
-                                       buffer = null;
-                                       break;
+                               SetComplete(null);
+                       }
+               }
+               #endregion
+
+               #region Reveive Record Methods
+
+               public IAsyncResult BeginReceiveRecord(Stream record, AsyncCallback callback, object state)
+               {
+                       if (this.context.ConnectionEnd)
+                       {
+                               throw new TlsException(
+                                       AlertDescription.InternalError,
+                                       "The session is finished and it's no longer valid.");
+                       }
 
-                               case ContentType.ChangeCipherSpec:
-                                       this.ProcessChangeCipherSpec();
-                                       break;
+                       byte[] recordTypeBuffer = new byte[1];
 
-                               case ContentType.ApplicationData:
-                                       break;
+                       ReceiveRecordAsyncResult internalResult = new ReceiveRecordAsyncResult(callback, state, recordTypeBuffer, record);
 
-                               case ContentType.Handshake:
-                                       TlsStream message = new TlsStream (buffer);
-                                       while (!message.EOF)
-                                       {
-                                               this.ProcessHandshakeMessage(message);
-                                       }
+                       record.BeginRead(internalResult.InitialBuffer, 0, internalResult.InitialBuffer.Length, new AsyncCallback(InternalReceiveRecordCallback), internalResult);
 
-                                       // Update handshakes of current messages
-                                       this.context.HandshakeMessages.Write(buffer);
-                                       break;
+                       return internalResult;
+               }
 
-// FIXME / MCS bug - http://bugzilla.ximian.com/show_bug.cgi?id=67711
-//                             case (ContentType)0x80:
-//                                     this.context.HandshakeMessages.Write (result);
-//                                     break;
+               private void InternalReceiveRecordCallback(IAsyncResult asyncResult)
+               {
+                       ReceiveRecordAsyncResult internalResult = asyncResult.AsyncState as ReceiveRecordAsyncResult;
+                       Stream record = internalResult.Record;
 
-                               default:
-                                       if (contentType != (ContentType)0x80)
+                       try
+                       {
+                               
+                               int bytesRead = internalResult.Record.EndRead(asyncResult);
+
+                               //We're at the end of the stream. Time to bail.
+                               if (bytesRead == 0)
+                               {
+                                       internalResult.SetComplete((byte[])null);
+                                       return;
+                               }
+
+                               // Try to read the Record Content Type
+                               int type = internalResult.InitialBuffer[0];
+
+                               // Set last handshake message received to None
+                               this.context.LastHandshakeMsg = HandshakeType.ClientHello;
+
+                               ContentType     contentType     = (ContentType)type;
+                               byte[] buffer = this.ReadRecordBuffer(type, record);
+                               if (buffer == null)
+                               {
+                                       // record incomplete (at the moment)
+                                       internalResult.SetComplete((byte[])null);
+                                       return;
+                               }
+
+                               // Decrypt message contents if needed
+                               if (contentType == ContentType.Alert && buffer.Length == 2)
+                               {
+                               }
+                               else
+                               {
+                                       if (this.context.IsActual && contentType != ContentType.ChangeCipherSpec)
                                        {
-                                               throw new TlsException(
-                                                       AlertDescription.UnexpectedMessage,
-                                                       "Unknown record received from server.");
+                                               buffer = this.decryptRecordFragment(contentType, buffer);
+                                               DebugHelper.WriteLine("Decrypted record data", buffer);
                                        }
-                                       this.context.HandshakeMessages.Write (buffer);
-                                       break;
+                               }
+
+                               // Process record
+                               switch (contentType)
+                               {
+                                       case ContentType.Alert:
+                                               this.ProcessAlert((AlertLevel)buffer [0], (AlertDescription)buffer [1]);
+                                               if (record.CanSeek) 
+                                               {
+                                                       // don't reprocess that memory block
+                                                       record.SetLength (0); 
+                                               }
+                                               buffer = null;
+                                               break;
+
+                                       case ContentType.ChangeCipherSpec:
+                                               this.ProcessChangeCipherSpec();
+                                               break;
+
+                                       case ContentType.ApplicationData:
+                                               break;
+
+                                       case ContentType.Handshake:
+                                               TlsStream message = new TlsStream (buffer);
+                                               while (!message.EOF)
+                                               {
+                                                       this.ProcessHandshakeMessage(message);
+                                               }
+
+                                               // Update handshakes of current messages
+                                               this.context.HandshakeMessages.Write(buffer);
+                                               break;
+
+       // FIXME / MCS bug - http://bugzilla.ximian.com/show_bug.cgi?id=67711
+       //                              case (ContentType)0x80:
+       //                                      this.context.HandshakeMessages.Write (result);
+       //                                      break;
+
+                                       default:
+                                               if (contentType != (ContentType)0x80)
+                                               {
+                                                       throw new TlsException(
+                                                               AlertDescription.UnexpectedMessage,
+                                                               "Unknown record received from server.");
+                                               }
+                                               this.context.HandshakeMessages.Write (buffer);
+                                               break;
+                               }
+
+                               internalResult.SetComplete(buffer);
+                       }
+                       catch (Exception ex)
+                       {
+                               internalResult.SetComplete(ex);
                        }
 
-                       return buffer;
+               }
+
+               public byte[] EndReceiveRecord(IAsyncResult asyncResult)
+               {
+                       ReceiveRecordAsyncResult internalResult = asyncResult as ReceiveRecordAsyncResult;
+
+                       if (null == internalResult)
+                               throw new ArgumentException("Either the provided async result is null or was not created by this RecordProtocol.");
+
+                       internalResult.AsyncWaitHandle.WaitOne();
+
+                       if (internalResult.CompletedWithError)
+                               throw internalResult.AsyncException;
+                       else
+                               return internalResult.ResultingBuffer;
+               }
+
+               public byte[] ReceiveRecord(Stream record)
+               {
+
+                       IAsyncResult ar = this.BeginReceiveRecord(record, null, null);
+                       return this.EndReceiveRecord(ar);
+
                }
 
                private byte[] ReadRecordBuffer (int contentType, Stream record)
@@ -256,11 +503,19 @@ namespace Mono.Security.Protocol.Tls
                        }
                        
                        // Read Record data
-                       int             received        = 0;
+                       int     totalReceived = 0;
                        byte[]  buffer          = new byte[length];
-                       while (received != length)
+                       while (totalReceived != length)
                        {
-                               received += record.Read(buffer, received, buffer.Length - received);
+                               int justReceived = record.Read(buffer, totalReceived, buffer.Length - totalReceived);
+
+                               //Make sure we get some data so we don't end up in an infinite loop here before shutdown.
+                               if (0 == justReceived)
+                               {
+                                       throw new TlsException(AlertDescription.CloseNotify, "Received 0 bytes from stream. It must be closed.");
+                               }
+
+                               totalReceived += justReceived;
                        }
 
                        // Check that the message has a valid protocol version
@@ -359,7 +614,44 @@ namespace Mono.Security.Protocol.Tls
                        this.SendRecord(HandshakeType.Finished);                        
                }
 
-               public void SendRecord(ContentType contentType, byte[] recordData)
+               public IAsyncResult BeginSendRecord(HandshakeType handshakeType, AsyncCallback callback, object state)
+               {
+                       HandshakeMessage msg = this.GetMessage(handshakeType);
+
+                       msg.Process();
+
+                       DebugHelper.WriteLine(">>>> Write handshake record ({0}|{1})", context.Protocol, msg.ContentType);
+
+                       SendRecordAsyncResult internalResult = new SendRecordAsyncResult(callback, state, msg);
+
+                       this.BeginSendRecord(msg.ContentType, msg.EncodeMessage(), new AsyncCallback(InternalSendRecordCallback), internalResult);
+
+                       return internalResult;
+               }
+
+               private void InternalSendRecordCallback(IAsyncResult ar)
+               {
+                       SendRecordAsyncResult internalResult = ar.AsyncState as SendRecordAsyncResult;
+                       
+                       try
+                       {
+                               this.EndSendRecord(ar);
+
+                               // Update session
+                               internalResult.Message.Update();
+
+                               // Reset message contents
+                               internalResult.Message.Reset();
+
+                               internalResult.SetComplete();
+                       }
+                       catch (Exception ex)
+                       {
+                               internalResult.SetComplete(ex);
+                       }
+               }
+
+               public IAsyncResult BeginSendRecord(ContentType contentType, byte[] recordData, AsyncCallback callback, object state)
                {
                        if (this.context.ConnectionEnd)
                        {
@@ -370,7 +662,29 @@ namespace Mono.Security.Protocol.Tls
 
                        byte[] record = this.EncodeRecord(contentType, recordData);
 
-                       this.innerStream.Write(record, 0, record.Length);
+                       return this.innerStream.BeginWrite(record, 0, record.Length, callback, state);
+               }
+
+               public void EndSendRecord(IAsyncResult asyncResult)
+               {
+                       if (asyncResult is SendRecordAsyncResult)
+                       {
+                               SendRecordAsyncResult internalResult = asyncResult as SendRecordAsyncResult;
+                               internalResult.AsyncWaitHandle.WaitOne();
+                               if (internalResult.CompletedWithError)
+                                       throw internalResult.AsyncException;
+                       }
+                       else
+                       {
+                               this.innerStream.EndWrite(asyncResult);
+                       }
+               }
+
+               public void SendRecord(ContentType contentType, byte[] recordData)
+               {
+                       IAsyncResult ar = this.BeginSendRecord(contentType, recordData, null, null);
+
+                       this.EndSendRecord(ar);
                }
 
                public byte[] EncodeRecord(ContentType contentType, byte[] recordData)
index 0c1c97750644a01549b12d1bf30af29b0967ff5a..10200d416ecb12685b5f508e25d6f52d6f6e2960 100644 (file)
@@ -45,20 +45,12 @@ namespace Mono.Security.Protocol.Tls
 
                #region Send Messages
 
-               public override void SendRecord(HandshakeType type)
+               public override HandshakeMessage GetMessage(HandshakeType type)
                {
-                       // Create the record message
+                       // Create and process the record message
                        HandshakeMessage msg = this.createServerHandshakeMessage(type);
-                       msg.Process();
-                       
-                       // Write record
-                       this.SendRecord(msg.ContentType, msg.EncodeMessage());
 
-                       // Update session
-                       msg.Update();
-
-                       // Reset message contents
-                       msg.Reset();
+                       return msg;
                }
 
                #endregion
index 0fd5c89cb4eae9271c3acfa866c2c295d3606e64..0f4e3b44e477b637d409daa0d68cb5f43c200ca9 100644 (file)
@@ -51,10 +51,9 @@ namespace Mono.Security.Protocol.Tls
                X509Certificate certificate, 
                string                  targetHost);
 
-       delegate int ReadDelegate (byte [] buffer, int offset, int count);
        #endregion
 
-       public class SslClientStream : Stream, IDisposable
+       public class SslClientStream : SslStreamBase
        {
                #region Internal Events
                
@@ -64,187 +63,24 @@ namespace Mono.Security.Protocol.Tls
                
                #endregion
 
-               #region Fields
-
-               private Stream                                                  innerStream;
-               private MemoryStream                                    inputBuffer;
-               private ClientContext                                   context;
-               private ClientRecordProtocol                    protocol;
-               private bool                                                    ownsStream;
-               private bool                                                    disposed;
-               private bool                                                    checkCertRevocationStatus;
-               private object                                                  negotiate;
-               private object                                                  read;
-               private object                                                  write;
-               private ReadDelegate                                            rd;
-
-               #endregion
-
                #region Properties
 
-               public override bool CanRead
-               {
-                       get { return this.innerStream.CanRead; }
-               }
-
-               public override bool CanSeek
-               {
-                       get { return false; }
-               }
-
-               public override bool CanWrite
-               {
-                       get { return this.innerStream.CanWrite; }
-               }
-
-               public override long Length
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public override long Position
-               {
-                       get { throw new NotSupportedException(); }
-                       set { throw new NotSupportedException(); }
-               }
-
                // required by HttpsClientStream for proxy support
-               internal Stream InputBuffer {
-                       get { return inputBuffer; }
-               }
-               #endregion
-
-               #region Security Properties
-
-               public bool CheckCertRevocationStatus 
+               internal Stream InputBuffer 
                {
-                       get { return this.checkCertRevocationStatus ; }
-                       set { this.checkCertRevocationStatus = value; }
+                       get { return base.inputBuffer; }
                }
 
-               public CipherAlgorithmType CipherAlgorithm 
+               public X509CertificateCollection ClientCertificates
                {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.CipherAlgorithmType;
-                               }
-
-                               return CipherAlgorithmType.None;
-                       }
+                       get { return this.context.ClientSettings.Certificates; }
                }
-               
-               public int CipherStrength 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.EffectiveKeyBits;
-                               }
 
-                               return 0;
-                       }
-               }
-               
-               public X509CertificateCollection ClientCertificates 
-               {
-                       get { return this.context.ClientSettings.Certificates;}
-               }
-               
-               public HashAlgorithmType HashAlgorithm 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.HashAlgorithmType; 
-                               }
-
-                               return HashAlgorithmType.None;
-                       }
-               }
-               
-               public int HashStrength
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.HashSize * 8; 
-                               }
-
-                               return 0;
-                       }
-               }
-               
-               public int KeyExchangeStrength 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.ServerSettings.Certificates[0].RSA.KeySize;
-                               }
-
-                               return 0;
-                       }
-               }
-               
-               public ExchangeAlgorithmType KeyExchangeAlgorithm 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.ExchangeAlgorithmType; 
-                               }
-
-                               return ExchangeAlgorithmType.None;
-                       }
-               }
-               
-               public SecurityProtocolType SecurityProtocol 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.SecurityProtocol; 
-                               }
-
-                               return 0;
-                       }
-               }
-               
-               public X509Certificate SelectedClientCertificate 
+               public X509Certificate SelectedClientCertificate
                {
                        get { return this.context.ClientSettings.ClientCertificate; }
                }
 
-               public X509Certificate ServerCertificate 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       if (this.context.ServerSettings.Certificates != null &&
-                                               this.context.ServerSettings.Certificates.Count > 0)
-                                       {
-                                               return new X509Certificate(this.context.ServerSettings.Certificates[0].RawData);
-                                       }
-                               }
-
-                               return null;
-                       }
-               } 
-
-               // this is used by Mono's certmgr tool to download certificates
-               internal Mono.Security.X509.X509CertificateCollection ServerCertificates {
-                       get { return context.ServerSettings.Certificates; }
-               }
-
                #endregion
 
                #region Callback Properties
@@ -261,12 +97,12 @@ namespace Mono.Security.Protocol.Tls
                        set { this.ClientCertSelection = value; }
                }
 
-               public PrivateKeySelectionCallback PrivateKeyCertSelectionDelegate 
+               public PrivateKeySelectionCallback PrivateKeyCertSelectionDelegate
                {
                        get { return this.PrivateKeySelection; }
                        set { this.PrivateKeySelection = value; }
                }
-
+               
                #endregion
 
                #region Constructors
@@ -317,16 +153,9 @@ namespace Mono.Security.Protocol.Tls
                        string                                          targetHost,
                        bool                                            ownsStream,
                        SecurityProtocolType            securityProtocolType,
-                       X509CertificateCollection       clientCertificates)
+                       X509CertificateCollection       clientCertificates):
+                       base(stream, ownsStream)
                {
-                       if (stream == null)
-                       {
-                               throw new ArgumentNullException("stream is null.");
-                       }
-                       if (!stream.CanRead || !stream.CanWrite)
-                       {
-                               throw new ArgumentNullException("stream is not both readable and writable.");
-                       }
                        if (targetHost == null || targetHost.Length == 0)
                        {
                                throw new ArgumentNullException("targetHost is null or an empty string.");
@@ -338,13 +167,7 @@ namespace Mono.Security.Protocol.Tls
                                targetHost, 
                                clientCertificates);
 
-                       this.inputBuffer        = new MemoryStream();
-                       this.innerStream        = stream;
-                       this.ownsStream         = ownsStream;
-                       this.negotiate                  = new object ();
-                       this.read                       = new object ();
-                       this.write                      = new object ();
-                       this.protocol           = new ClientRecordProtocol(innerStream, context);
+                       this.protocol = new ClientRecordProtocol(innerStream, (ClientContext)this.context);
                }
 
                #endregion
@@ -353,536 +176,174 @@ namespace Mono.Security.Protocol.Tls
 
                ~SslClientStream()
                {
-                       this.Dispose(false);
+                       base.Dispose(false);
                }
 
                #endregion
 
-        #region IDisposable Methods
+               #region IDisposable Methods
 
-               void IDisposable.Dispose()
+               protected override void Dispose(bool disposing)
                {
-                       this.Dispose(true);
-                       GC.SuppressFinalize(this);
-               }
+                       base.Dispose(disposing);
 
-               protected virtual void Dispose(bool disposing)
-               {
-                       if (!this.disposed)
+                       if (disposing)
                        {
-                               if (disposing)
-                               {
-                                       if (this.innerStream != null)
-                                       {
-                                               if (this.context.HandshakeState == HandshakeState.Finished &&
-                                                       !this.context.ConnectionEnd)
-                                               {
-                                                       // Write close notify                                                   
-                                                       this.protocol.SendAlert(AlertDescription.CloseNotify);
-                                               }
-
-                                               if (this.ownsStream)
-                                               {
-                                                       // Close inner stream
-                                                       this.innerStream.Close();
-                                               }
-                                       }
-                                       this.ownsStream                         = false;
-                                       this.innerStream                        = null;
-                                       this.ClientCertSelection        = null;
-                                       this.ServerCertValidation       = null;
-                                       this.PrivateKeySelection        = null;
-                               }
-
-                               this.disposed = true;
+                               this.ServerCertValidation = null;
+                               this.ClientCertSelection = null;
+                               this.PrivateKeySelection = null;
                        }
                }
 
                #endregion
 
-               #region Methods
+               #region Handshake Methods
 
-               public override IAsyncResult BeginRead(
-                       byte[]                  buffer,
-                       int                             offset,
-                       int                             count,
-                       AsyncCallback   callback,
-                       object                  state)
-               {
-                       this.checkDisposed ();
-                       
-                       if (buffer == null)
-                       {
-                               throw new ArgumentNullException("buffer is a null reference.");
-                       }
-                       if (offset < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is less than 0.");
-                       }
-                       if (offset > buffer.Length)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is greater than the length of buffer.");
-                       }
-                       if (count < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("count is less than 0.");
-                       }
-                       if (count > (buffer.Length - offset))
-                       {
-                               throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter.");
-                       }
+               /*
+                       Client                                                                                  Server
 
-                       if (this.context.HandshakeState == HandshakeState.None)
-                       {
-                               // Note: Async code may have problem if they can't ensure that
-                               // the Negotiate phase isn't done during a read operation.
-                               // System.Net.HttpWebRequest protects itself from that problem
-                               lock (this.negotiate)
-                               {
-                                       if (this.context.HandshakeState == HandshakeState.None)
-                                       {
-                                               this.NegotiateHandshake();
-                                       }
-                               }
-                       }
+                       ClientHello                 -------->
+                                                                                                                       ServerHello
+                                                                                                                       Certificate*
+                                                                                                                       ServerKeyExchange*
+                                                                                                                       CertificateRequest*
+                                                                               <--------                       ServerHelloDone
+                       Certificate*
+                       ClientKeyExchange
+                       CertificateVerify*
+                       [ChangeCipherSpec]
+                       Finished                    -------->
+                                                                                                                       [ChangeCipherSpec]
+                                                                               <--------           Finished
+                       Application Data            <------->                   Application Data
 
-                       IAsyncResult asyncResult = null;
+                                       Fig. 1 - Message flow for a full handshake              
+               */
 
-                       lock (this.read)
+               internal override IAsyncResult OnBeginNegotiateHandshake(AsyncCallback callback, object state)
+               {
+                       try
                        {
-                               try
-                               {
-                                       // If actual buffer is full readed reset it
-                                       if (this.inputBuffer.Position == this.inputBuffer.Length &&
-                                               this.inputBuffer.Length > 0)
-                                       {
-                                               this.resetBuffer();
-                                       }
-
-                                       if (!this.context.ConnectionEnd)
-                                       {
-                                               if ((this.inputBuffer.Length == this.inputBuffer.Position) && (count > 0))
-                                               {
-                                                       // bigger than max record length for SSL/TLS
-                                                       byte[] recbuf = new byte[16384]; 
-
-                                                       // this will read data from the network until we have (at least) one
-                                                       // record to send back to the caller
-                                                       this.innerStream.BeginRead (recbuf, 0, recbuf.Length, 
-                                                               new AsyncCallback (NetworkReadCallback), recbuf);
-
-                                                       if (!recordEvent.WaitOne ()) // 300000, false)) // 5 minutes
-                                                       {
-                                                               // FAILSAFE
-                                                               DebugHelper.WriteLine ("TIMEOUT length {0}, position {1}, count {2} - {3}\n{4}", 
-                                                                       this.inputBuffer.Length, this.inputBuffer.Position, count, GetHashCode (),
-                                                                       Environment.StackTrace);
-                                                               throw new TlsException (AlertDescription.InternalError);
-                                                       }
-                                               }
-                                       }
-
-                                       // return the record(s) to the caller
-                                       rd = new ReadDelegate (this.inputBuffer.Read);
-                                       asyncResult = rd.BeginInvoke (buffer, offset, count, callback, state);
-                               }
-                               catch (TlsException ex)
-                               {
-                                       this.protocol.SendAlert(ex.Alert);
-                                       this.Close();
-
-                                       throw new IOException("The authentication or decryption has failed.");
-                               }
-                               catch (Exception)
+                               if (this.context.HandshakeState != HandshakeState.None)
                                {
-                                       throw new IOException("IO exception during read.");
+                                       this.context.Clear();
                                }
 
-                       }
-
-                       return asyncResult;
-               }
+                               // Obtain supported cipher suites
+                               this.context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(this.context.SecurityProtocol);
 
-               private ManualResetEvent recordEvent = new ManualResetEvent (false);
-               private MemoryStream recordStream = new MemoryStream ();
+                               // Set handshake state
+                               this.context.HandshakeState = HandshakeState.Started;
 
-               // read encrypted data until we have enough to decrypt (at least) one
-               // record and return are the records (may be more than one) we have
-               private void NetworkReadCallback (IAsyncResult result)
-               {
-                       if (this.disposed) {
-                               recordEvent.Set ();
-                               return;
+                               // Send client hello
+                               return this.protocol.BeginSendRecord(HandshakeType.ClientHello, callback, state);
                        }
-
-                       byte[] recbuf = (byte[])result.AsyncState;
-                       int n = innerStream.EndRead (result);
-                       if (n > 0)
+                       catch (TlsException ex)
                        {
-                               // add the just received data to the waiting data
-                               recordStream.Write (recbuf, 0, n);
-                       }
-
-                       bool dataToReturn = false;
-                       long pos = recordStream.Position;
-
-                       recordStream.Position = 0;
-                       byte[] record = null;
+                               this.protocol.SendAlert(ex.Alert);
 
-                       // don't try to decode record unless we have at least 5 bytes
-                       // i.e. type (1), protocol (2) and length (2)
-                       if (recordStream.Length >= 5)
-                       {
-                               record = this.protocol.ReceiveRecord (recordStream);
+                               throw new IOException("The authentication or decryption has failed.", ex);
                        }
-
-                       // a record of 0 length is valid (and there may be more record after it)
-                       while (record != null)
+                       catch (Exception ex)
                        {
-                               // we probably received more stuff after the record, and we must keep it!
-                               long remainder = recordStream.Length - recordStream.Position;
-                               byte[] outofrecord = null;
-                               if (remainder > 0)
-                               {
-                                       outofrecord = new byte[remainder];
-                                       recordStream.Read (outofrecord, 0, outofrecord.Length);
-                               }
-
-                               long position = this.inputBuffer.Position;
-
-                               if (record.Length > 0)
-                               {
-                                       // Write new data to the inputBuffer
-                                       this.inputBuffer.Seek (0, SeekOrigin.End);
-                                       this.inputBuffer.Write (record, 0, record.Length);
-
-                                       // Restore buffer position
-                                       this.inputBuffer.Seek (position, SeekOrigin.Begin);
-                                       dataToReturn = true;
-                               }
-
-                               recordStream.SetLength (0);
-                               record = null;
-
-                               if (remainder > 0)
-                               {
-                                       recordStream.Write (outofrecord, 0, outofrecord.Length);
-                                       // type (1), protocol (2) and length (2)
-                                       if (recordStream.Length >= 5)
-                                       {
-                                               // try to see if another record is available
-                                               recordStream.Position = 0;
-                                               record = this.protocol.ReceiveRecord (recordStream);
-                                               if (record == null)
-                                                       pos = recordStream.Length;
-                                       }
-                                       else
-                                               pos = remainder;
-                               }
-                               else
-                                       pos = 0;
-                       }
+                               this.protocol.SendAlert(AlertDescription.InternalError);
 
-                       if (!dataToReturn && (n > 0))
-                       {
-                               // there is no record to return to caller and (possibly) more data waiting
-                               // so continue reading from network (and appending to stream)
-                               recordStream.Position = recordStream.Length;
-                               this.innerStream.BeginRead (recbuf, 0, recbuf.Length, 
-                                       new AsyncCallback (NetworkReadCallback), recbuf);
-                       }
-                       else
-                       {
-                               // we have record(s) to return -or- no more available to read from network
-                               // reset position for further reading
-                               recordStream.Position = pos;
-                               recordEvent.Set ();
+                               throw new IOException("The authentication or decryption has failed.", ex);
                        }
                }
 
-               public override IAsyncResult BeginWrite(
-                       byte[]                  buffer,
-                       int                             offset,
-                       int                             count,
-                       AsyncCallback   callback,
-                       object                  state)
+               internal override void OnNegotiateHandshakeCallback(IAsyncResult asyncResult)
                {
-                       this.checkDisposed();
+                       this.protocol.EndSendRecord(asyncResult);
 
-                       if (buffer == null)
-                       {
-                               throw new ArgumentNullException("buffer is a null reference.");
-                       }
-                       if (offset < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is less than 0.");
-                       }
-                       if (offset > buffer.Length)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is greater than the length of buffer.");
-                       }
-                       if (count < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("count is less than 0.");
-                       }
-                       if (count > (buffer.Length - offset))
+                       // Read server response
+                       while (this.context.LastHandshakeMsg != HandshakeType.ServerHelloDone)
                        {
-                               throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter.");
+                               // Read next record
+                               this.protocol.ReceiveRecord(this.innerStream);
                        }
 
-                       if (this.context.HandshakeState == HandshakeState.None)
+                       // Send client certificate if requested
+                       // even if the server ask for it it _may_ still be optional
+                       bool clientCertificate = this.context.ServerSettings.CertificateRequest;
+
+                       // NOTE: sadly SSL3 and TLS1 differs in how they handle this and
+                       // the current design doesn't allow a very cute way to handle 
+                       // SSL3 alert warning for NoCertificate (41).
+                       if (this.context.SecurityProtocol == SecurityProtocolType.Ssl3)
                        {
-                               lock (this.negotiate)
-                               {
-                                       if (this.context.HandshakeState == HandshakeState.None)
-                                       {
-                                               this.NegotiateHandshake();
-                                       }
-                               }
+                               clientCertificate = ((this.context.ClientSettings.Certificates != null) &&
+                                       (this.context.ClientSettings.Certificates.Count > 0));
+                               // this works well with OpenSSL (but only for SSL3)
                        }
 
-                       IAsyncResult asyncResult;
-
-                       lock (this.write)
+                       if (clientCertificate)
                        {
-                               try
-                               {
-                                       // Send the buffer as a TLS record
-                                       
-                                       byte[] record = this.protocol.EncodeRecord(
-                                               ContentType.ApplicationData, buffer, offset, count);
-                               
-                                       asyncResult = this.innerStream.BeginWrite(
-                                               record, 0, record.Length, callback, state);
-                               }
-                               catch (TlsException ex)
-                               {
-                                       this.protocol.SendAlert(ex.Alert);
-                                       this.Close();
-
-                                       throw new IOException("The authentication or decryption has failed.");
-                               }
-                               catch (Exception)
-                               {
-                                       throw new IOException("IO exception during Write.");
-                               }
+                               this.protocol.SendRecord(HandshakeType.Certificate);
                        }
 
-                       return asyncResult;
-               }
+                       // Send Client Key Exchange
+                       this.protocol.SendRecord(HandshakeType.ClientKeyExchange);
 
-               public override int EndRead(IAsyncResult asyncResult)
-               {
-                       this.checkDisposed();
+                       // Now initialize session cipher with the generated keys
+                       this.context.Cipher.InitializeCipher();
 
-                       if (asyncResult == null)
+                       // Send certificate verify if requested (optional)
+                       if (clientCertificate && (this.context.ClientSettings.ClientCertificate != null))
                        {
-                               throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead.");
+                               this.protocol.SendRecord(HandshakeType.CertificateVerify);
                        }
 
-                       recordEvent.Reset ();
-                       return this.rd.EndInvoke (asyncResult);
-               }
-
-               public override void EndWrite(IAsyncResult asyncResult)
-               {
-                       this.checkDisposed();
+                       // Send Cipher Spec protocol
+                       this.protocol.SendChangeCipherSpec();
 
-                       if (asyncResult == null)
+                       // Read record until server finished is received
+                       while (this.context.HandshakeState != HandshakeState.Finished)
                        {
-                               throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead.");
+                               // If all goes well this will process messages:
+                               //              Change Cipher Spec
+                               //              Server finished
+                               this.protocol.ReceiveRecord(this.innerStream);
                        }
 
-                       this.innerStream.EndWrite (asyncResult);
-               }
-
-               public override void Close()
-               {
-                       ((IDisposable)this).Dispose();
-               }
-
-               public override void Flush()
-               {
-                       this.checkDisposed();
+                       // Clear Key Info
+                       this.context.ClearKeyInfo();
 
-                       this.innerStream.Flush();
-               }
-
-               public int Read(byte[] buffer)
-               {
-                       return this.Read(buffer, 0, buffer.Length);
-               }
-
-               public override int Read(byte[] buffer, int offset, int count)
-               {
-                       IAsyncResult res = this.BeginRead(buffer, offset, count, null, null);
-
-                       return this.EndRead(res);
-               }
-
-               public override long Seek(long offset, SeekOrigin origin)
-               {
-                       throw new NotSupportedException();
-               }
-               
-               public override void SetLength(long value)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public void Write(byte[] buffer)
-               {
-                       this.Write(buffer, 0, buffer.Length);
-               }
-
-               public override void Write(byte[] buffer, int offset, int count)
-               {
-                       IAsyncResult res = this.BeginWrite (buffer, offset, count, null, null);
-
-                       this.EndWrite(res);
                }
 
                #endregion
 
-               #region Misc Methods
-
-               private void resetBuffer()
-               {
-                       this.inputBuffer.SetLength(0);
-                       this.inputBuffer.Position = 0;
-               }
+               #region Event Methods
 
-               private void checkDisposed()
+               internal override X509Certificate OnLocalCertificateSelection(X509CertificateCollection clientCertificates, X509Certificate serverCertificate, string targetHost, X509CertificateCollection serverRequestedCertificates)
                {
-                       if (this.disposed)
+                       if (this.ClientCertSelection != null)
                        {
-                               throw new ObjectDisposedException("The SslClientStream is closed.");
+                               return this.ClientCertSelection(
+                                       clientCertificates,
+                                       serverCertificate,
+                                       targetHost,
+                                       serverRequestedCertificates);
                        }
-               }
-
-               #endregion
 
-               #region Handsake Methods
-
-               /*
-                       Client                                                                                  Server
-
-                       ClientHello                 -------->
-                                                                                                                       ServerHello
-                                                                                                                       Certificate*
-                                                                                                                       ServerKeyExchange*
-                                                                                                                       CertificateRequest*
-                                                                               <--------                       ServerHelloDone
-                       Certificate*
-                       ClientKeyExchange
-                       CertificateVerify*
-                       [ChangeCipherSpec]
-                       Finished                    -------->
-                                                                                                                       [ChangeCipherSpec]
-                                                                               <--------           Finished
-                       Application Data            <------->                   Application Data
-
-                                       Fig. 1 - Message flow for a full handshake              
-               */
-
-               internal void NegotiateHandshake()
+                       return null;
+               }
+               
+               internal override bool OnRemoteCertificateValidation(X509Certificate certificate, int[] errors)
                {
-                       try
-                       {
-                               if (this.context.HandshakeState != HandshakeState.None)
-                               {
-                                       this.context.Clear();
-                               }
-
-                               // Obtain supported cipher suites
-                               this.context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(this.context.SecurityProtocol);
-
-                               // Send client hello
-                               this.protocol.SendRecord(HandshakeType.ClientHello);
-
-                               // Read server response
-                               while (this.context.LastHandshakeMsg != HandshakeType.ServerHelloDone)
-                               {
-                                       // Read next record
-                                       this.protocol.ReceiveRecord (this.innerStream);
-                               }
-
-                               // Send client certificate if requested
-                               // even if the server ask for it it _may_ still be optional
-                               bool clientCertificate = this.context.ServerSettings.CertificateRequest;
-
-                               // NOTE: sadly SSL3 and TLS1 differs in how they handle this and
-                               // the current design doesn't allow a very cute way to handle 
-                               // SSL3 alert warning for NoCertificate (41).
-                               if (this.context.SecurityProtocol == SecurityProtocolType.Ssl3)
-                               {
-                                       clientCertificate = ((this.context.ClientSettings.Certificates != null) &&
-                                               (this.context.ClientSettings.Certificates.Count > 0));
-                                       // this works well with OpenSSL (but only for SSL3)
-                               }
-
-                               if (clientCertificate)
-                               {
-                                       this.protocol.SendRecord(HandshakeType.Certificate);
-                               }
-
-                               // Send Client Key Exchange
-                               this.protocol.SendRecord(HandshakeType.ClientKeyExchange);
-
-                               // Now initialize session cipher with the generated keys
-                               this.context.Cipher.InitializeCipher();
-
-                               // Send certificate verify if requested (optional)
-                               if (clientCertificate && (this.context.ClientSettings.ClientCertificate != null))
-                               {
-                                       this.protocol.SendRecord(HandshakeType.CertificateVerify);
-                               }
-
-                               // Send Cipher Spec protocol
-                               this.protocol.SendChangeCipherSpec();                   
-                       
-                               // Read record until server finished is received
-                               while (this.context.HandshakeState != HandshakeState.Finished)
-                               {
-                                       // If all goes well this will process messages:
-                                       //              Change Cipher Spec
-                                       //              Server finished
-                                       this.protocol.ReceiveRecord (this.innerStream);
-                               }
-
-                               // Clear Key Info
-                               this.context.ClearKeyInfo();
-                       }
-                       catch (TlsException ex)
+                       if (this.ServerCertValidation != null)
                        {
-                               this.protocol.SendAlert(ex.Alert);
-                               this.Close();
-
-                               throw new IOException("The authentication or decryption has failed.");
+                               return this.ServerCertValidation(certificate, errors);
                        }
-                       catch (Exception)
-                       {
-                               this.protocol.SendAlert(AlertDescription.InternalError);
-                               this.Close();
 
-                               throw new IOException("The authentication or decryption has failed.");
-                       }
+                       return (errors != null && errors.Length == 0);
                }
 
-               #endregion
-
-               #region Event Methods
-
                internal virtual bool RaiseServerCertificateValidation(
                        X509Certificate certificate, 
                        int[]                   certificateErrors)
                {
-                       if (this.ServerCertValidation != null)
-                       {
-                               return this.ServerCertValidation(certificate, certificateErrors);
-                       }
-
-                       return (certificateErrors != null && certificateErrors.Length == 0);
+                       return base.RaiseRemoteCertificateValidation(certificate, certificateErrors);
                }
 
                internal X509Certificate RaiseClientCertificateSelection(
@@ -891,21 +352,10 @@ namespace Mono.Security.Protocol.Tls
                        string                                          targetHost, 
                        X509CertificateCollection       serverRequestedCertificates)
                {
-                       if (this.ClientCertSelection != null)
-                       {
-                               return this.ClientCertSelection(
-                                       clientCertificates,
-                                       serverCertificate,
-                                       targetHost,
-                                       serverRequestedCertificates);
-                       }
-
-                       return null;
+                       return base.RaiseLocalCertificateSelection(clientCertificates, serverCertificate, targetHost, serverRequestedCertificates);
                }
 
-               internal AsymmetricAlgorithm RaisePrivateKeySelection(
-                       X509Certificate certificate, 
-                       string                  targetHost)
+               internal override AsymmetricAlgorithm OnLocalPrivateKeySelection(X509Certificate certificate, string targetHost)
                {
                        if (this.PrivateKeySelection != null)
                        {
@@ -915,6 +365,13 @@ namespace Mono.Security.Protocol.Tls
                        return null;
                }
 
+               internal AsymmetricAlgorithm RaisePrivateKeySelection(
+                       X509Certificate certificate,
+                       string targetHost)
+               {
+                       return base.RaiseLocalPrivateKeySelection(certificate, targetHost);
+               }
+
                #endregion
        }
 }
index a706974f8876bda69eab46f0a6043ef625510051..03010d878bc3a728532ac90975fbf778295d89dd 100644 (file)
@@ -34,7 +34,7 @@ using Mono.Security.Protocol.Tls.Handshake;
 
 namespace Mono.Security.Protocol.Tls
 {
-       public class SslServerStream : Stream, IDisposable
+       public class SslServerStream : SslStreamBase
        {
                #region Internal Events
                
@@ -43,88 +43,12 @@ namespace Mono.Security.Protocol.Tls
                
                #endregion
 
-               #region Fields
-
-               private ServerRecordProtocol    protocol;
-               private BufferedStream                  inputBuffer;
-               private ServerContext                   context;
-               private Stream                                  innerStream;
-               private bool                                    disposed;
-               private bool                                    ownsStream;
-               private bool                                    checkCertRevocationStatus;
-               private object                                  read;
-               private object                                  write;          
-
-               #endregion
-
                #region Properties
 
-               public override bool CanRead
-               {
-                       get { return this.innerStream.CanRead; }
-               }
-
-               public override bool CanWrite
-               {
-                       get { return this.innerStream.CanWrite; }
-               }
-
-               public override bool CanSeek
-               {
-                       get { return this.innerStream.CanSeek; }
-               }
-
-               public override long Length
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public override long Position
-               {
-                       get { throw new NotSupportedException(); }
-                       set { throw new NotSupportedException(); }
-               }
-
-               #endregion
-
-               #region Security Properties
-
-               public bool CheckCertRevocationStatus 
-               {
-                       get { return this.checkCertRevocationStatus ; }
-                       set { this.checkCertRevocationStatus = value; }
-               }
-
-               public CipherAlgorithmType CipherAlgorithm 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.CipherAlgorithmType;
-                               }
-
-                               return CipherAlgorithmType.None;
-                       }
-               }
-
-               public int CipherStrength 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.EffectiveKeyBits;
-                               }
-
-                               return 0;
-                       }
-               }
-               
                public X509Certificate ClientCertificate
                {
-                       get 
-                       { 
+                       get
+                       {
                                if (this.context.HandshakeState == HandshakeState.Finished)
                                {
                                        return this.context.ClientSettings.ClientCertificate;
@@ -132,89 +56,7 @@ namespace Mono.Security.Protocol.Tls
 
                                return null;
                        }
-               }               
-               
-               public HashAlgorithmType HashAlgorithm 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.HashAlgorithmType; 
-                               }
-
-                               return HashAlgorithmType.None;
-                       }
                }
-               
-               public int HashStrength
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.HashSize * 8; 
-                               }
-
-                               return 0;
-                       }
-               }
-               
-               public int KeyExchangeStrength 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.ServerSettings.Certificates[0].RSA.KeySize;
-                               }
-
-                               return 0;
-                       }
-               }
-               
-               public ExchangeAlgorithmType KeyExchangeAlgorithm 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.Cipher.ExchangeAlgorithmType; 
-                               }
-
-                               return ExchangeAlgorithmType.None;
-                       }
-               }
-               
-               public SecurityProtocolType SecurityProtocol 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       return this.context.SecurityProtocol; 
-                               }
-
-                               return 0;
-                       }
-               }
-
-               public X509Certificate ServerCertificate 
-               {
-                       get 
-                       { 
-                               if (this.context.HandshakeState == HandshakeState.Finished)
-                               {
-                                       if (this.context.ServerSettings.Certificates != null &&
-                                               this.context.ServerSettings.Certificates.Count > 0)
-                                       {
-                                               return new X509Certificate(this.context.ServerSettings.Certificates[0].RawData);
-                                       }
-                               }
-
-                               return null;
-                       }
-               } 
 
                #endregion
 
@@ -226,7 +68,7 @@ namespace Mono.Security.Protocol.Tls
                        set { this.ClientCertValidation = value; }
                }
 
-               public PrivateKeySelectionCallback PrivateKeyCertSelectionDelegate 
+               public PrivateKeySelectionCallback PrivateKeyCertSelectionDelegate
                {
                        get { return this.PrivateKeySelection; }
                        set { this.PrivateKeySelection = value; }
@@ -266,28 +108,15 @@ namespace Mono.Security.Protocol.Tls
                        bool                                    clientCertificateRequired,
                        bool                                    ownsStream,
                        SecurityProtocolType    securityProtocolType)
+                       : base(stream, ownsStream)
                {
-                       if (stream == null)
-                       {
-                               throw new ArgumentNullException("stream is null.");
-                       }
-                       if (!stream.CanRead || !stream.CanWrite)
-                       {
-                               throw new ArgumentNullException("stream is not both readable and writable.");
-                       }
-
                        this.context = new ServerContext(
                                this,
                                securityProtocolType,
                                serverCertificate,
                                clientCertificateRequired);
 
-                       this.inputBuffer        = new BufferedStream(new MemoryStream());
-                       this.innerStream        = stream;
-                       this.ownsStream         = ownsStream;
-                       this.read                       = new object ();
-                       this.write                      = new object ();
-                       this.protocol           = new ServerRecordProtocol(innerStream, context);
+                       this.protocol = new ServerRecordProtocol(innerStream, (ServerContext)this.context);
                }
 
                #endregion
@@ -303,308 +132,14 @@ namespace Mono.Security.Protocol.Tls
 
                #region IDisposable Methods
 
-               void IDisposable.Dispose()
+               protected override void Dispose(bool disposing)
                {
-                       this.Dispose(true);
-                       GC.SuppressFinalize(this);
-               }
+                       base.Dispose(disposing);
 
-               protected virtual void Dispose(bool disposing)
-               {
-                       if (!this.disposed)
+                       if (disposing)
                        {
-                               if (disposing)
-                               {
-                                       if (this.innerStream != null)
-                                       {
-                                               if (this.context.HandshakeState == HandshakeState.Finished)
-                                               {
-                                                       // Write close notify
-                                                       this.protocol.SendAlert(AlertDescription.CloseNotify);
-                                               }
-
-                                               if (this.ownsStream)
-                                               {
-                                                       // Close inner stream
-                                                       this.innerStream.Close();
-                                               }
-                                       }
-                                       this.ownsStream                         = false;
-                                       this.innerStream                        = null;
-                                       this.ClientCertValidation       = null;
-                                       this.PrivateKeySelection        = null;
-                               }
-
-                               this.disposed = true;
-                       }
-               }
-
-               #endregion
-
-               #region Methods
-
-               public override IAsyncResult BeginRead(
-                       byte[]                  buffer,
-                       int                             offset,
-                       int                             count,
-                       AsyncCallback   callback,
-                       object                  state)
-               {
-                       this.checkDisposed();
-                       
-                       if (buffer == null)
-                       {
-                               throw new ArgumentNullException("buffer is a null reference.");
-                       }
-                       if (offset < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is less than 0.");
-                       }
-                       if (offset > buffer.Length)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is greater than the length of buffer.");
-                       }
-                       if (count < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("count is less than 0.");
-                       }
-                       if (count > (buffer.Length - offset))
-                       {
-                               throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter.");
-                       }
-
-                       lock (this)
-                       {
-                               if (this.context.HandshakeState == HandshakeState.None)
-                               {
-                                       this.doHandshake();     // Handshake negotiation
-                               }
-                       }
-
-                       IAsyncResult asyncResult;
-
-                       lock (this.read)
-                       {
-                               try
-                               {
-                                       // If actual buffer is full readed reset it
-                                       if (this.inputBuffer.Position == this.inputBuffer.Length &&
-                                               this.inputBuffer.Length > 0)
-                                       {
-                                               this.resetBuffer();
-                                       }
-
-                                       if (!this.context.ConnectionEnd)
-                                       {
-                                               // Check if we have space in the middle buffer
-                                               // if not Read next TLS record and update the inputBuffer
-                                               while ((this.inputBuffer.Length - this.inputBuffer.Position) < count)
-                                               {
-                                                       // Read next record and write it into the inputBuffer
-                                                       long    position        = this.inputBuffer.Position;                                    
-                                                       byte[]  record          = this.protocol.ReceiveRecord(this.innerStream);
-                                       
-                                                       if (record != null && record.Length > 0)
-                                                       {
-                                                               // Write new data to the inputBuffer
-                                                               this.inputBuffer.Seek(0, SeekOrigin.End);
-                                                               this.inputBuffer.Write(record, 0, record.Length);
-
-                                                               // Restore buffer position
-                                                               this.inputBuffer.Seek(position, SeekOrigin.Begin);
-                                                       }
-                                                       else
-                                                       {
-                                                               if (record == null)
-                                                               {
-                                                                       break;
-                                                               }
-                                                       }
-
-                                                       // TODO: Review if we need to check the Length
-                                                       // property of the innerStream for other types
-                                                       // of streams, to check that there are data available
-                                                       // for read
-                                                       if (this.innerStream is NetworkStream &&
-                                                               !((NetworkStream)this.innerStream).DataAvailable)
-                                                       {
-                                                               break;
-                                                       }
-                                               }
-                                       }
-
-                                       asyncResult = this.inputBuffer.BeginRead(
-                                               buffer, offset, count, callback, state);
-                               }
-                               catch (TlsException ex)
-                               {
-                                       this.protocol.SendAlert(ex.Alert);
-                                       this.Close();
-
-                                       throw new IOException("The authentication or decryption has failed.");
-                               }
-                               catch (Exception)
-                               {
-                                       throw new IOException("IO exception during read.");
-                               }
-                       }
-
-                       return asyncResult;
-               }
-
-               public override IAsyncResult BeginWrite(
-                       byte[]                  buffer,
-                       int                             offset,
-                       int                             count,
-                       AsyncCallback   callback,
-                       object                  state)
-               {
-                       this.checkDisposed();
-
-                       if (buffer == null)
-                       {
-                               throw new ArgumentNullException("buffer is a null reference.");
-                       }
-                       if (offset < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is less than 0.");
-                       }
-                       if (offset > buffer.Length)
-                       {
-                               throw new ArgumentOutOfRangeException("offset is greater than the length of buffer.");
-                       }
-                       if (count < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("count is less than 0.");
-                       }
-                       if (count > (buffer.Length - offset))
-                       {
-                               throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter.");
-                       }
-
-                       lock (this)
-                       {
-                               if (this.context.HandshakeState == HandshakeState.None)
-                               {
-                                       // Start handshake negotiation
-                                       this.doHandshake();
-                               }
-                       }
-
-                       IAsyncResult asyncResult;
-
-                       lock (this.write)
-                       {
-                               try
-                               {
-                                       // Send the buffer as a TLS record                                      
-                                       byte[] record = this.protocol.EncodeRecord(
-                                               ContentType.ApplicationData, buffer, offset, count);
-                               
-                                       asyncResult = this.innerStream.BeginWrite(
-                                               record, 0, record.Length, callback, state);
-                               }
-                               catch (TlsException ex)
-                               {
-                                       this.protocol.SendAlert(ex.Alert);
-                                       this.Close();
-
-                                       throw new IOException("The authentication or decryption has failed.");
-                               }
-                               catch (Exception)
-                               {
-                                       throw new IOException("IO exception during Write.");
-                               }
-                       }
-
-                       return asyncResult;
-               }
-
-               public override int EndRead(IAsyncResult asyncResult)
-               {
-                       this.checkDisposed();
-
-                       if (asyncResult == null)
-                       {
-                               throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead.");
-                       }
-
-                       return this.inputBuffer.EndRead(asyncResult);
-               }
-
-               public override void EndWrite(IAsyncResult asyncResult)
-               {
-                       this.checkDisposed();
-
-                       if (asyncResult == null)
-                       {
-                               throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead.");
-                       }
-
-                       this.innerStream.EndWrite (asyncResult);
-               }
-
-               public override void Close()
-               {
-                       ((IDisposable)this).Dispose();
-               }
-
-               public override void Flush()
-               {
-                       this.checkDisposed();
-
-                       this.innerStream.Flush();
-               }
-
-               public int Read(byte[] buffer)
-               {
-                       return this.Read(buffer, 0, buffer.Length);
-               }
-
-               public override int Read(byte[] buffer, int offset, int count)
-               {
-                       IAsyncResult res = this.BeginRead(buffer, offset, count, null, null);
-
-                       return this.EndRead(res);
-               }
-
-               public override long Seek(long offset, SeekOrigin origin)
-               {
-                       throw new NotSupportedException();
-               }
-               
-               public override void SetLength(long value)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public void Write(byte[] buffer)
-               {
-                       this.Write(buffer, 0, buffer.Length);
-               }
-
-               public override void Write(byte[] buffer, int offset, int count)
-               {
-                       IAsyncResult res = this.BeginWrite (buffer, offset, count, null, null);
-
-                       this.EndWrite(res);
-               }
-
-               #endregion
-
-               #region Misc Methods
-
-               private void resetBuffer()
-               {
-                       this.inputBuffer.SetLength(0);
-                       this.inputBuffer.Position = 0;
-               }
-
-               private void checkDisposed()
-               {
-                       if (this.disposed)
-                       {
-                               throw new ObjectDisposedException("The SslClientStream is closed.");
+                               this.ClientCertValidation = null;
+                               this.PrivateKeySelection = null;
                        }
                }
 
@@ -633,123 +168,121 @@ namespace Mono.Security.Protocol.Tls
                                        Fig. 1 - Message flow for a full handshake              
                */
 
-               private void doHandshake()
+               internal override IAsyncResult OnBeginNegotiateHandshake(AsyncCallback callback, object state)
                {
-                       try
+                       // Reset the context if needed
+                       if (this.context.HandshakeState != HandshakeState.None)
                        {
-                               // Reset the context if needed
-                               if (this.context.HandshakeState != HandshakeState.None)
-                               {
-                                       this.context.Clear();
-                               }
-
-                               // Obtain supported cipher suites
-                               this.context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(this.context.SecurityProtocol);
+                               this.context.Clear();
+                       }
 
-                               // Set handshake state
-                               this.context.HandshakeState = HandshakeState.Started;
+                       // Obtain supported cipher suites
+                       this.context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(this.context.SecurityProtocol);
 
-                               // Receive Client Hello message
-                               this.protocol.ReceiveRecord (this.innerStream);
+                       // Set handshake state
+                       this.context.HandshakeState = HandshakeState.Started;
 
-                               // If received message is not an ClientHello send a
-                               // Fatal Alert
-                               if (this.context.LastHandshakeMsg != HandshakeType.ClientHello)
-                               {
-                                       this.protocol.SendAlert(AlertDescription.UnexpectedMessage);
-                               }
+                       // Receive Client Hello message
+                       return this.protocol.BeginReceiveRecord(this.innerStream, callback, state);
 
-                               // Send ServerHello message
-                               this.protocol.SendRecord(HandshakeType.ServerHello);
+               }
 
-                               // Send ServerCertificate message
-                               this.protocol.SendRecord(HandshakeType.Certificate);
+               internal override void OnNegotiateHandshakeCallback(IAsyncResult asyncResult)
+               {
+                       // Receive Client Hello message and ignore it
+                       this.protocol.EndReceiveRecord(asyncResult);
 
-                               // If the negotiated cipher is a KeyEx cipher send ServerKeyExchange
-                               if (this.context.Cipher.ExchangeAlgorithmType == ExchangeAlgorithmType.RsaKeyX)
-                               {
-                                       this.protocol.SendRecord(HandshakeType.ServerKeyExchange);
-                               }
+                       // If received message is not an ClientHello send a
+                       // Fatal Alert
+                       if (this.context.LastHandshakeMsg != HandshakeType.ClientHello)
+                       {
+                               this.protocol.SendAlert(AlertDescription.UnexpectedMessage);
+                       }
 
-                               bool certRequested = false;
+                       // Send ServerHello message
+                       this.protocol.SendRecord(HandshakeType.ServerHello);
 
-                               // If the negotiated cipher is a KeyEx cipher or
-                               // the client certificate is required send the CertificateRequest message
-                               if (this.context.Cipher.ExchangeAlgorithmType == ExchangeAlgorithmType.RsaKeyX ||
-                                       this.context.ClientCertificateRequired)
-                               {
-                                       this.protocol.SendRecord(HandshakeType.CertificateRequest);
-                                       certRequested = true;
-                               }
+                       // Send ServerCertificate message
+                       this.protocol.SendRecord(HandshakeType.Certificate);
 
-                               // Send ServerHelloDone message
-                               this.protocol.SendRecord(HandshakeType.ServerHelloDone);
+                       // If the negotiated cipher is a KeyEx cipher send ServerKeyExchange
+                       if (this.context.Cipher.ExchangeAlgorithmType == ExchangeAlgorithmType.RsaKeyX)
+                       {
+                               this.protocol.SendRecord(HandshakeType.ServerKeyExchange);
+                       }
 
-                               // Receive client response, until the Client Finished message
-                               // is received
-                               while (this.context.LastHandshakeMsg != HandshakeType.Finished)
-                               {
-                                       this.protocol.ReceiveRecord (this.innerStream);
-                                       if (this.context.LastHandshakeMsg == HandshakeType.Certificate)
-                                               certRequested = false;
-                               }
+                       bool certRequested = false;
 
-                               if (certRequested)
-                               {
-                                       // we asked for a certificate but didn't receive one
-                                       // e.g. wget for SSL3
-                                       if (!RaiseClientCertificateValidation (null, new int [0])) 
-                                       {
-                                               throw new TlsException(
-                                                       AlertDescription.BadCertificate,
-                                                       "No certificate received from client.");
-                                       }
-                               }
-                               
-                               // Send ChangeCipherSpec and ServerFinished messages
-                               this.protocol.SendChangeCipherSpec();
+                       // If the negotiated cipher is a KeyEx cipher or
+                       // the client certificate is required send the CertificateRequest message
+                       if (this.context.Cipher.ExchangeAlgorithmType == ExchangeAlgorithmType.RsaKeyX ||
+                               ((ServerContext)this.context).ClientCertificateRequired)
+                       {
+                               this.protocol.SendRecord(HandshakeType.CertificateRequest);
+                               certRequested = true;
+                       }
 
-                               // The handshake is finished
-                               this.context.HandshakeState = HandshakeState.Finished;
+                       // Send ServerHelloDone message
+                       this.protocol.SendRecord(HandshakeType.ServerHelloDone);
 
-                               // Clear Key Info
-                               this.context.ClearKeyInfo();
-                       }
-                       catch (TlsException ex)
+                       // Receive client response, until the Client Finished message
+                       // is received
+                       while (this.context.LastHandshakeMsg != HandshakeType.Finished)
                        {
-                               this.protocol.SendAlert(ex.Alert);
-                               this.Close();
-
-                               throw new IOException("The authentication or decryption has failed.", ex);
+                               this.protocol.ReceiveRecord(this.innerStream);
+                               if (this.context.LastHandshakeMsg == HandshakeType.Certificate)
+                                       certRequested = false;
                        }
-                       catch (Exception e)
-                       {
-                               this.protocol.SendAlert(AlertDescription.InternalError);
-                               this.Close();
 
-                               throw new IOException("The authentication or decryption has failed.", e);
+                       if (certRequested)
+                       {
+                               // we asked for a certificate but didn't receive one
+                               // e.g. wget for SSL3
+                               if (!RaiseClientCertificateValidation(null, new int[0]))
+                               {
+                                       throw new TlsException(
+                                               AlertDescription.BadCertificate,
+                                               "No certificate received from client.");
+                               }
                        }
+
+                       // Send ChangeCipherSpec and ServerFinished messages
+                       this.protocol.SendChangeCipherSpec();
+
+                       // The handshake is finished
+                       this.context.HandshakeState = HandshakeState.Finished;
+
+                       // Clear Key Info
+                       this.context.ClearKeyInfo();
                }
 
                #endregion
 
                #region Event Methods
 
-               internal bool RaiseClientCertificateValidation(
-                       X509Certificate certificate, 
-                       int[]                   certificateErrors)
+               internal override X509Certificate OnLocalCertificateSelection(X509CertificateCollection clientCertificates, X509Certificate serverCertificate, string targetHost, X509CertificateCollection serverRequestedCertificates)
+               {
+                       throw new NotSupportedException();
+               }
+
+               internal override bool OnRemoteCertificateValidation(X509Certificate certificate, int[] errors)
                {
                        if (this.ClientCertValidation != null)
                        {
-                               return this.ClientCertValidation(certificate, certificateErrors);
+                               return this.ClientCertValidation(certificate, errors);
                        }
 
-                       return (certificateErrors != null && certificateErrors.Length == 0);
+                       return (errors != null && errors.Length == 0);
                }
 
-               internal AsymmetricAlgorithm RaisePrivateKeySelection(
+               internal bool RaiseClientCertificateValidation(
                        X509Certificate certificate, 
-                       string                  targetHost)
+                       int[]                   certificateErrors)
+               {
+                       return base.RaiseRemoteCertificateValidation(certificate, certificateErrors);
+               }
+
+               internal override AsymmetricAlgorithm OnLocalPrivateKeySelection(X509Certificate certificate, string targetHost)
                {
                        if (this.PrivateKeySelection != null)
                        {
@@ -759,6 +292,13 @@ namespace Mono.Security.Protocol.Tls
                        return null;
                }
 
+               internal AsymmetricAlgorithm RaisePrivateKeySelection(
+                       X509Certificate certificate,
+                       string targetHost)
+               {
+                       return base.RaiseLocalPrivateKeySelection(certificate, targetHost);
+               }
+
                #endregion
        }
 }
diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs
new file mode 100755 (executable)
index 0000000..9b6df73
--- /dev/null
@@ -0,0 +1,1023 @@
+// Transport Security Layer (TLS)
+// Copyright (c) 2003-2004 Carlos Guzman Alvarez
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading;
+
+namespace Mono.Security.Protocol.Tls
+{
+       public abstract class SslStreamBase: Stream, IDisposable
+       {
+               private delegate void AsyncHandshakeDelegate(InternalAsyncResult asyncResult, bool fromWrite);
+               
+               #region Fields
+
+               internal Stream innerStream;
+               internal MemoryStream inputBuffer;
+               internal Context context;
+               internal RecordProtocol protocol;
+               internal bool ownsStream;
+               private volatile bool disposed;
+               private bool checkCertRevocationStatus;
+               private object negotiate;
+               private object read;
+               private object write;
+               private ManualResetEvent negotiationComplete;
+
+               #endregion
+
+
+               #region Constructors
+
+               protected SslStreamBase(
+                       Stream stream,
+                       bool ownsStream)
+               {
+                       if (stream == null)
+                       {
+                               throw new ArgumentNullException("stream is null.");
+                       }
+                       if (!stream.CanRead || !stream.CanWrite)
+                       {
+                               throw new ArgumentNullException("stream is not both readable and writable.");
+                       }
+
+                       this.inputBuffer = new MemoryStream();
+                       this.innerStream = stream;
+                       this.ownsStream = ownsStream;
+                       this.negotiate = new object();
+                       this.read = new object();
+                       this.write = new object();
+                       this.negotiationComplete = new ManualResetEvent(false);
+               }
+
+               #endregion
+
+               #region Handshakes
+               private void AsyncHandshakeCallback(IAsyncResult asyncResult)
+               {
+                       InternalAsyncResult internalResult = asyncResult.AsyncState as InternalAsyncResult;
+
+                       try
+                       {
+                               try
+                               {
+                                       this.OnNegotiateHandshakeCallback(asyncResult);
+                               }
+                               catch (TlsException ex)
+                               {
+                                       this.protocol.SendAlert(ex.Alert);
+
+                                       throw new IOException("The authentication or decryption has failed.", ex);
+                               }
+                               catch (Exception ex)
+                               {
+                                       this.protocol.SendAlert(AlertDescription.InternalError);
+
+                                       throw new IOException("The authentication or decryption has failed.", ex);
+                               }
+
+                               negotiationComplete.Set();
+
+                               if (internalResult.ProceedAfterHandshake)
+                               {
+                                       //kick off the read or write process (whichever called us) after the handshake is complete
+                                       if (internalResult.FromWrite)
+                                       {
+                                               InternalBeginWrite(internalResult);
+                                       }
+                                       else
+                                       {
+                                               InternalBeginRead(internalResult);
+                                       }
+                               }
+                               else
+                               {
+                                       negotiationComplete.Set();
+                                       internalResult.SetComplete();
+                               }
+
+                       }
+                       catch (Exception ex)
+                       {
+                               negotiationComplete.Set();
+                               internalResult.SetComplete(ex);
+                       }
+               }
+
+               internal bool MightNeedHandshake
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return false;
+                               }
+                               else
+                               {
+                                       lock (this.negotiate)
+                                       {
+                                               return (this.context.HandshakeState != HandshakeState.Finished);
+                                       }
+                               }
+                       }
+               }
+
+               internal void NegotiateHandshake()
+               {
+                       if (this.MightNeedHandshake)
+                       {
+                               InternalAsyncResult ar = new InternalAsyncResult(null, null, null, 0, 0, false, false);
+
+                               //if something already started negotiation, wait for it.
+                               //otherwise end it ourselves.
+                               if (!BeginNegotiateHandshake(ar))
+                               {
+                                       this.negotiationComplete.WaitOne();
+                               }
+                               else
+                               {
+                                       this.EndNegotiateHandshake(ar);
+                               }
+                       }
+               }
+
+               #endregion
+
+               #region Abstracts/Virtuals
+
+               internal abstract IAsyncResult OnBeginNegotiateHandshake(AsyncCallback callback, object state);
+               internal abstract void OnNegotiateHandshakeCallback(IAsyncResult asyncResult);
+
+               internal abstract X509Certificate OnLocalCertificateSelection(X509CertificateCollection clientCertificates,
+                                                                                                                       X509Certificate serverCertificate,
+                                                                                                                       string targetHost,
+                                                                                                                       X509CertificateCollection serverRequestedCertificates);
+
+               internal abstract bool OnRemoteCertificateValidation(X509Certificate certificate, int[] errors);
+
+               internal abstract AsymmetricAlgorithm OnLocalPrivateKeySelection(X509Certificate certificate, string targetHost);
+
+               #endregion
+
+               #region Event Methods
+
+               internal X509Certificate RaiseLocalCertificateSelection(X509CertificateCollection certificates,
+                                                                                                                       X509Certificate remoteCertificate,
+                                                                                                                       string targetHost,
+                                                                                                                       X509CertificateCollection requestedCertificates)
+               {
+                       return OnLocalCertificateSelection(certificates, remoteCertificate, targetHost, requestedCertificates);
+               }
+
+               internal bool RaiseRemoteCertificateValidation(X509Certificate certificate, int[] errors)
+               {
+                       return OnRemoteCertificateValidation(certificate, errors);
+               }
+
+               internal AsymmetricAlgorithm RaiseLocalPrivateKeySelection(
+                       X509Certificate certificate,
+                       string targetHost)
+               {
+                       return OnLocalPrivateKeySelection(certificate, targetHost);
+               }
+               #endregion
+
+               #region Security Properties
+
+               public bool CheckCertRevocationStatus
+               {
+                       get { return this.checkCertRevocationStatus; }
+                       set { this.checkCertRevocationStatus = value; }
+               }
+
+               public CipherAlgorithmType CipherAlgorithm
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return this.context.Cipher.CipherAlgorithmType;
+                               }
+
+                               return CipherAlgorithmType.None;
+                       }
+               }
+
+               public int CipherStrength
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return this.context.Cipher.EffectiveKeyBits;
+                               }
+
+                               return 0;
+                       }
+               }
+
+               public HashAlgorithmType HashAlgorithm
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return this.context.Cipher.HashAlgorithmType;
+                               }
+
+                               return HashAlgorithmType.None;
+                       }
+               }
+
+               public int HashStrength
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return this.context.Cipher.HashSize * 8;
+                               }
+
+                               return 0;
+                       }
+               }
+
+               public int KeyExchangeStrength
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return this.context.ServerSettings.Certificates[0].RSA.KeySize;
+                               }
+
+                               return 0;
+                       }
+               }
+
+               public ExchangeAlgorithmType KeyExchangeAlgorithm
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return this.context.Cipher.ExchangeAlgorithmType;
+                               }
+
+                               return ExchangeAlgorithmType.None;
+                       }
+               }
+
+               public SecurityProtocolType SecurityProtocol
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       return this.context.SecurityProtocol;
+                               }
+
+                               return 0;
+                       }
+               }
+
+               public X509Certificate ServerCertificate
+               {
+                       get
+                       {
+                               if (this.context.HandshakeState == HandshakeState.Finished)
+                               {
+                                       if (this.context.ServerSettings.Certificates != null &&
+                                               this.context.ServerSettings.Certificates.Count > 0)
+                                       {
+                                               return new X509Certificate(this.context.ServerSettings.Certificates[0].RawData);
+                                       }
+                               }
+
+                               return null;
+                       }
+               }
+
+               // this is used by Mono's certmgr tool to download certificates
+               internal Mono.Security.X509.X509CertificateCollection ServerCertificates
+               {
+                       get { return context.ServerSettings.Certificates; }
+               }
+
+               #endregion
+
+               #region Internal Async Result/State Class
+
+               private class InternalAsyncResult : IAsyncResult
+               {
+                       private AsyncCallback _userCallback;
+                       private object _userState;
+                       private Exception _asyncException;
+                       private ManualResetEvent _complete;
+                       private int _bytesRead;
+                       private bool _fromWrite;
+                       private bool _proceedAfterHandshake;
+
+                       private byte[] _buffer;
+                       private int _offset;
+                       private int _count;
+
+                       public InternalAsyncResult(AsyncCallback userCallback, object userState, byte[] buffer, int offset, int count, bool fromWrite, bool proceedAfterHandshake)
+                       {
+                               _userCallback = userCallback;
+                               _userState = userState;
+                               _complete = new ManualResetEvent(false);
+                               _buffer = buffer;
+                               _offset = offset;
+                               _count = count;
+                               _fromWrite = fromWrite;
+                               _proceedAfterHandshake = proceedAfterHandshake;
+                       }
+
+                       public bool ProceedAfterHandshake
+                       {
+                               get { return _proceedAfterHandshake; }
+                       }
+
+                       public bool FromWrite
+                       {
+                               get { return _fromWrite; }
+                       }
+
+                       public byte[] Buffer
+                       {
+                               get { return _buffer; }
+                       }
+
+                       public int Offset
+                       {
+                               get { return _offset; }
+                       }
+
+                       public int Count
+                       {
+                               get { return _count; }
+                       }
+
+                       public int BytesRead
+                       {
+                               get { return _bytesRead; }
+                       }
+
+                       public object AsyncState
+                       {
+                               get { return _userState; }
+                       }
+
+                       public Exception AsyncException
+                       {
+                               get { return _asyncException; }
+                       }
+
+                       public bool CompletedWithError
+                       {
+                               get { return null != _asyncException; }
+                       }
+
+                       public WaitHandle AsyncWaitHandle
+                       {
+                               get { return _complete; }
+                       }
+
+                       public bool CompletedSynchronously
+                       {
+                               get { return false; }
+                       }
+
+                       public bool IsCompleted
+                       {
+                               get { return _complete.WaitOne(0, false); }
+                       }
+
+                       private void SetComplete(Exception ex, int bytesRead)
+                       {
+                               if (this.IsCompleted)
+                                       return;
+
+                               lock (this)
+                               {
+                                       if (this.IsCompleted)
+                                               return;
+
+                                       _asyncException = ex;
+                                       _bytesRead = bytesRead;
+                                       _complete.Set();
+                               }
+
+                               if (null != _userCallback)
+                                       _userCallback (this);
+
+                       }
+
+                       public void SetComplete(Exception ex)
+                       {
+                               SetComplete(ex, 0);
+                       }
+
+                       public void SetComplete(int bytesRead)
+                       {
+                               SetComplete(null, bytesRead);
+                       }
+
+                       public void SetComplete()
+                       {
+                               SetComplete(null, 0);
+                       }
+               }
+               #endregion
+
+               #region Stream Overrides and Async Stream Operations
+
+               private bool BeginNegotiateHandshake(InternalAsyncResult asyncResult)
+               {
+                       try
+                       {
+                               lock (this.negotiate)
+                               {
+                                       if (this.context.HandshakeState == HandshakeState.None)
+                                       {
+                                               this.OnBeginNegotiateHandshake(new AsyncCallback(AsyncHandshakeCallback), asyncResult);
+
+                                               return true;
+                                       }
+                                       else
+                                       {
+                                               return false;
+                                       }
+                               }
+                       }
+                       catch (TlsException ex)
+                       {
+                               this.negotiationComplete.Set();
+                               this.protocol.SendAlert(ex.Alert);
+
+                               throw new IOException("The authentication or decryption has failed.", ex);
+                       }
+                       catch (Exception ex)
+                       {
+                               this.negotiationComplete.Set();
+                               this.protocol.SendAlert(AlertDescription.InternalError);
+
+                               throw new IOException("The authentication or decryption has failed.", ex);
+                       }
+               }
+
+               private void EndNegotiateHandshake(InternalAsyncResult asyncResult)
+               {
+                       asyncResult.AsyncWaitHandle.WaitOne();
+
+                       if (asyncResult.CompletedWithError)
+                       {
+                               throw asyncResult.AsyncException;
+                       }
+               }
+
+               public override IAsyncResult BeginRead(
+                       byte[] buffer,
+                       int offset,
+                       int count,
+                       AsyncCallback callback,
+                       object state)
+               {
+                       this.checkDisposed();
+
+                       if (buffer == null)
+                       {
+                               throw new ArgumentNullException("buffer is a null reference.");
+                       }
+                       if (offset < 0)
+                       {
+                               throw new ArgumentOutOfRangeException("offset is less than 0.");
+                       }
+                       if (offset > buffer.Length)
+                       {
+                               throw new ArgumentOutOfRangeException("offset is greater than the length of buffer.");
+                       }
+                       if (count < 0)
+                       {
+                               throw new ArgumentOutOfRangeException("count is less than 0.");
+                       }
+                       if (count > (buffer.Length - offset))
+                       {
+                               throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter.");
+                       }
+
+                       InternalAsyncResult asyncResult = new InternalAsyncResult(callback, state, buffer, offset, count, false, true);
+
+                       if (this.MightNeedHandshake)
+                       {
+                               if (! BeginNegotiateHandshake(asyncResult))
+                               {
+                                       //we made it down here so the handshake was not started.
+                                       //another thread must have started it in the mean time.
+                                       //wait for it to complete and then perform our original operation
+                                       this.negotiationComplete.WaitOne();
+
+                                       InternalBeginRead(asyncResult);
+                               }
+                       }
+                       else
+                       {
+                               InternalBeginRead(asyncResult);
+                       }
+
+                       return asyncResult;
+               }
+
+               private void InternalBeginRead(InternalAsyncResult asyncResult)
+               {
+                       try
+                       {
+                               int preReadSize = 0;
+
+                               lock (this.read)
+                               {
+                                       // If actual buffer is fully read, reset it
+                                       bool shouldReset = this.inputBuffer.Position == this.inputBuffer.Length && this.inputBuffer.Length > 0;
+
+                                       // If the buffer isn't fully read, but does have data, we need to immediately
+                                       // read the info from the buffer and let the user know that they have more data.
+                                       bool shouldReadImmediately = (this.inputBuffer.Length > 0) && (asyncResult.Count > 0);
+
+                                       if (shouldReset)
+                                       {
+                                               this.resetBuffer();
+                                       }
+                                       else if (shouldReadImmediately)
+                                       {
+                                               preReadSize = this.inputBuffer.Read(asyncResult.Buffer, asyncResult.Offset, asyncResult.Count);
+                                       }
+                               }
+
+                               // This is explicitly done outside the synclock to avoid 
+                               // any potential deadlocks in the delegate call.
+                               if (0 < preReadSize)
+                               {
+                                       asyncResult.SetComplete(preReadSize);
+                               }
+                               else if (!this.context.ConnectionEnd)
+                               {
+                                       // bigger than max record length for SSL/TLS
+                                       byte[] recbuf = new byte[16384];
+
+                                       // this will read data from the network until we have (at least) one
+                                       // record to send back to the caller
+                                       this.innerStream.BeginRead(recbuf, 0, recbuf.Length,
+                                               new AsyncCallback(InternalReadCallback), new object[] { recbuf, asyncResult });
+                               }
+                               else
+                               {
+                                       // We're done with the connection so we need to let the caller know with 0 bytes read
+                                       asyncResult.SetComplete(0);
+                               }
+                       }
+                       catch (TlsException ex)
+                       {
+                               this.protocol.SendAlert(ex.Alert);
+
+                               throw new IOException("The authentication or decryption has failed.", ex);
+                       }
+                       catch (Exception ex)
+                       {
+                               throw new IOException("IO exception during read.", ex);
+                       }
+               }
+
+
+               private MemoryStream recordStream = new MemoryStream();
+
+               // read encrypted data until we have enough to decrypt (at least) one
+               // record and return are the records (may be more than one) we have
+               private void InternalReadCallback(IAsyncResult result)
+               {
+                       if (this.disposed)
+                               return;
+
+                       object[] state = (object[])result.AsyncState;
+                       byte[] recbuf = (byte[])state[0];
+                       InternalAsyncResult internalResult = (InternalAsyncResult)state[1];
+
+                       try
+                       {
+                               int n = innerStream.EndRead(result);
+                               if (n > 0)
+                               {
+                                       // Add the just received data to the waiting data
+                                       recordStream.Write(recbuf, 0, n);
+                               }
+                               else
+                               {
+                                       // 0 length data means this read operation is done (lost connection in the case of a network stream).
+                                       internalResult.SetComplete(0);
+                                       return;
+                               }
+
+                               bool dataToReturn = false;
+                               long pos = recordStream.Position;
+
+                               recordStream.Position = 0;
+                               byte[] record = null;
+
+                               // don't try to decode record unless we have at least 5 bytes
+                               // i.e. type (1), protocol (2) and length (2)
+                               if (recordStream.Length >= 5)
+                               {
+                                       record = this.protocol.ReceiveRecord(recordStream);
+                               }
+
+                               // a record of 0 length is valid (and there may be more record after it)
+                               while (record != null)
+                               {
+                                       // we probably received more stuff after the record, and we must keep it!
+                                       long remainder = recordStream.Length - recordStream.Position;
+                                       byte[] outofrecord = null;
+                                       if (remainder > 0)
+                                       {
+                                               outofrecord = new byte[remainder];
+                                               recordStream.Read(outofrecord, 0, outofrecord.Length);
+                                       }
+
+                                       lock (this.read)
+                                       {
+                                               long position = this.inputBuffer.Position;
+
+                                               if (record.Length > 0)
+                                               {
+                                                       // Write new data to the inputBuffer
+                                                       this.inputBuffer.Seek(0, SeekOrigin.End);
+                                                       this.inputBuffer.Write(record, 0, record.Length);
+
+                                                       // Restore buffer position
+                                                       this.inputBuffer.Seek(position, SeekOrigin.Begin);
+                                                       dataToReturn = true;
+                                               }
+                                       }
+
+                                       recordStream.SetLength(0);
+                                       record = null;
+
+                                       if (remainder > 0)
+                                       {
+                                               recordStream.Write(outofrecord, 0, outofrecord.Length);
+                                               // type (1), protocol (2) and length (2)
+                                               if (recordStream.Length >= 5)
+                                               {
+                                                       // try to see if another record is available
+                                                       recordStream.Position = 0;
+                                                       record = this.protocol.ReceiveRecord(recordStream);
+                                                       if (record == null)
+                                                               pos = recordStream.Length;
+                                               }
+                                               else
+                                                       pos = remainder;
+                                       }
+                                       else
+                                               pos = 0;
+                               }
+
+                               if (!dataToReturn && (n > 0))
+                               {
+                                       // there is no record to return to caller and (possibly) more data waiting
+                                       // so continue reading from network (and appending to stream)
+                                       recordStream.Position = recordStream.Length;
+                                       this.innerStream.BeginRead(recbuf, 0, recbuf.Length,
+                                               new AsyncCallback(InternalReadCallback), state);
+                               }
+                               else
+                               {
+                                       // we have record(s) to return -or- no more available to read from network
+                                       // reset position for further reading
+                                       recordStream.Position = pos;
+
+                                       int bytesRead = 0;
+                                       lock (this.read)
+                                       {
+                                               bytesRead = this.inputBuffer.Read(internalResult.Buffer, internalResult.Offset, internalResult.Count);
+                                       }
+
+                                       internalResult.SetComplete(bytesRead);
+                               }
+                       }
+                       catch (Exception ex)
+                       {
+                               internalResult.SetComplete(ex);
+                       }
+
+               }
+
+               private void InternalBeginWrite(InternalAsyncResult asyncResult)
+               {
+                       try
+                       {
+                               // Send the buffer as a TLS record
+
+                               lock (this.write)
+                               {
+                                       byte[] record = this.protocol.EncodeRecord(
+                                               ContentType.ApplicationData, asyncResult.Buffer, asyncResult.Offset, asyncResult.Count);
+
+                                       this.innerStream.BeginWrite(
+                                               record, 0, record.Length, new AsyncCallback(InternalWriteCallback), asyncResult);
+                               }
+                       }
+                       catch (TlsException ex)
+                       {
+                               this.protocol.SendAlert(ex.Alert);
+                               this.Close();
+
+                               throw new IOException("The authentication or decryption has failed.", ex);
+                       }
+                       catch (Exception ex)
+                       {
+                               throw new IOException("IO exception during Write.", ex);
+                       }
+               }
+
+               private void InternalWriteCallback(IAsyncResult ar)
+               {
+                       if (this.disposed)
+                               return;
+
+                       InternalAsyncResult internalResult = (InternalAsyncResult)ar.AsyncState;
+
+                       try
+                       {
+                               this.innerStream.EndWrite(ar);
+                               internalResult.SetComplete(0);
+                       }
+                       catch (Exception ex)
+                       {
+                               internalResult.SetComplete(ex);
+                       }
+               }
+
+               public override IAsyncResult BeginWrite(
+                       byte[] buffer,
+                       int offset,
+                       int count,
+                       AsyncCallback callback,
+                       object state)
+               {
+                       this.checkDisposed();
+
+                       if (buffer == null)
+                       {
+                               throw new ArgumentNullException("buffer is a null reference.");
+                       }
+                       if (offset < 0)
+                       {
+                               throw new ArgumentOutOfRangeException("offset is less than 0.");
+                       }
+                       if (offset > buffer.Length)
+                       {
+                               throw new ArgumentOutOfRangeException("offset is greater than the length of buffer.");
+                       }
+                       if (count < 0)
+                       {
+                               throw new ArgumentOutOfRangeException("count is less than 0.");
+                       }
+                       if (count > (buffer.Length - offset))
+                       {
+                               throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter.");
+                       }
+
+
+                       InternalAsyncResult asyncResult = new InternalAsyncResult(callback, state, buffer, offset, count, true, true);
+
+                       if (this.MightNeedHandshake)
+                       {
+                               if (! BeginNegotiateHandshake(asyncResult))
+                               {
+                                       //we made it down here so the handshake was not started.
+                                       //another thread must have started it in the mean time.
+                                       //wait for it to complete and then perform our original operation
+                                       this.negotiationComplete.WaitOne();
+
+                                       InternalBeginWrite(asyncResult);
+                               }
+                       }
+                       else
+                       {
+                               InternalBeginWrite(asyncResult);
+                       }
+
+                       return asyncResult;
+               }
+
+               public override int EndRead(IAsyncResult asyncResult)
+               {
+                       this.checkDisposed();
+
+                       InternalAsyncResult internalResult = asyncResult as InternalAsyncResult;
+
+                       // Always wait until the read is complete
+                       internalResult.AsyncWaitHandle.WaitOne();
+
+                       if (internalResult == null)
+                       {
+                               throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead.");
+                       }
+
+                       if (internalResult.CompletedWithError)
+                       {
+                               throw internalResult.AsyncException;
+                       }
+
+                       return internalResult.BytesRead;
+               }
+
+               public override void EndWrite(IAsyncResult asyncResult)
+               {
+                       this.checkDisposed();
+
+                       InternalAsyncResult internalResult = asyncResult as InternalAsyncResult;
+
+                       internalResult.AsyncWaitHandle.WaitOne();
+
+                       if (asyncResult == null)
+                       {
+                               throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginWrite.");
+                       }
+
+                       if (internalResult.CompletedWithError)
+                       {
+                               throw internalResult.AsyncException;
+                       }
+               }
+
+               public override void Close()
+               {
+                       ((IDisposable)this).Dispose();
+               }
+
+               public override void Flush()
+               {
+                       this.checkDisposed();
+
+                       this.innerStream.Flush();
+               }
+
+               public int Read(byte[] buffer)
+               {
+                       return this.Read(buffer, 0, buffer.Length);
+               }
+
+               public override int Read(byte[] buffer, int offset, int count)
+               {
+                       IAsyncResult res = this.BeginRead(buffer, offset, count, null, null);
+
+                       return this.EndRead(res);
+               }
+
+               public override long Seek(long offset, SeekOrigin origin)
+               {
+                       throw new NotSupportedException();
+               }
+
+               public override void SetLength(long value)
+               {
+                       throw new NotSupportedException();
+               }
+
+               public void Write(byte[] buffer)
+               {
+                       this.Write(buffer, 0, buffer.Length);
+               }
+
+               public override void Write(byte[] buffer, int offset, int count)
+               {
+                       IAsyncResult res = this.BeginWrite(buffer, offset, count, null, null);
+
+                       this.EndWrite(res);
+               }
+
+               public override bool CanRead
+               {
+                       get { return this.innerStream.CanRead; }
+               }
+
+               public override bool CanSeek
+               {
+                       get { return false; }
+               }
+
+               public override bool CanWrite
+               {
+                       get { return this.innerStream.CanWrite; }
+               }
+
+               public override long Length
+               {
+                       get { throw new NotSupportedException(); }
+               }
+
+               public override long Position
+               {
+                       get
+                       {
+                               throw new NotSupportedException();
+                       }
+                       set
+                       {
+                               throw new NotSupportedException();
+                       }
+               }
+               #endregion
+
+               #region IDisposable Members and Finalizer
+
+               ~SslStreamBase()
+               {
+                       this.Dispose(false);
+               }
+
+               public void Dispose()
+               {
+                       this.Dispose(true);
+                       GC.SuppressFinalize(this);
+               }
+
+               protected virtual void Dispose(bool disposing)
+               {
+                       if (!this.disposed)
+                       {
+                               if (disposing)
+                               {
+                                       if (this.innerStream != null)
+                                       {
+                                               if (this.context.HandshakeState == HandshakeState.Finished &&
+                                                       !this.context.ConnectionEnd)
+                                               {
+                                                       // Write close notify                                                   
+                                                       this.protocol.SendAlert(AlertDescription.CloseNotify);
+                                               }
+
+                                               if (this.ownsStream)
+                                               {
+                                                       // Close inner stream
+                                                       this.innerStream.Close();
+                                               }
+                                       }
+                                       this.ownsStream = false;
+                                       this.innerStream = null;
+                               }
+
+                               this.disposed = true;
+                       }
+               }
+
+               #endregion
+
+               #region Misc Methods
+
+               private void resetBuffer()
+               {
+                       this.inputBuffer.SetLength(0);
+                       this.inputBuffer.Position = 0;
+               }
+
+               internal void checkDisposed()
+               {
+                       if (this.disposed)
+                       {
+                               throw new ObjectDisposedException("The Stream is closed.");
+                       }
+               }
+
+               #endregion
+
+       }
+}
index 5feb6f793e568adf1c1eca04a692aa5b6a5591c5..13e469c78e9957edcd4225389cd31bc484b5d9c3 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * X509Certificate.cs: Fixed version property (bug #76012). Added
+       ISerializable (for 2.0 so we're not breaking current compatibility).
+
 2005-08-29  Sebastien Pouliot  <sebastien@ximian.com>
 
        * X501Name.cs: Fixed quoted (bug #75780) and escaped values. Added
index 263e09ba3351279baeb7e1913017bcaec32a982e..e145b30e6c296e77c54f68bc1ef43c53175f0039 100644 (file)
 //
 
 using System;
+using System.Runtime.Serialization;
 using System.Security.Cryptography;
 using SSCX = System.Security.Cryptography.X509Certificates;
+using System.Security.Permissions;
 using System.Text;
 
 namespace Mono.Security.X509 {
@@ -41,11 +43,12 @@ namespace Mono.Security.X509 {
        //      http://www.itu.int/ITU-T/studygroups/com17/languages/
 
 #if INSIDE_CORLIB
-       internal
+       internal class X509Certificate : ISerializable {
+#elif NET_2_0
+       public class X509Certificate : ISerializable {
 #else
-       public 
+       public class X509Certificate {
 #endif
-       class X509Certificate {
 
                private ASN1 decoder;
 
@@ -111,9 +114,9 @@ namespace Mono.Security.X509 {
                                // Certificate / TBSCertificate / Version
                                ASN1 v = decoder [0][tbs];
                                version = 1;                    // DEFAULT v1
-                               if (v.Tag == 0xA0) {
+                               if ((v.Tag == 0xA0) && (v.Count > 0)) {
                                        // version (optional) is present only in v2+ certs
-                                       version += v.Value [0]; // zero based
+                                       version += v [0].Value [0];     // zero based
                                        tbs++;
                                }
 
@@ -498,5 +501,19 @@ namespace Mono.Security.X509 {
                                        return false;
                        }
                }
+
+#if INSIDE_CORLIB || NET_2_0
+               protected X509Certificate (SerializationInfo info, StreamingContext context)
+               {
+                       Parse ((byte[]) info.GetValue ("raw", typeof (byte[])));
+               }
+
+               [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
+               public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       info.AddValue ("raw", m_encodedcert);
+                       // note: we NEVER serialize the private key
+               }
+#endif
        }
 }
index cf9f3b184be338942147454d66bffabaec2afbc9..8a5ff91beb5f473a10ba463a2a1518bfebe443b6 100644 (file)
@@ -96,6 +96,7 @@
 ./Mono.Security.Protocol.Tls/SslCipherSuite.cs
 ./Mono.Security.Protocol.Tls/SslHandshakeHash.cs
 ./Mono.Security.Protocol.Tls/SslServerStream.cs
+./Mono.Security.Protocol.Tls/SslStreamBase.cs
 ./Mono.Security.Protocol.Tls/TlsCipherSuite.cs
 ./Mono.Security.Protocol.Tls/TlsClientSettings.cs
 ./Mono.Security.Protocol.Tls/TlsException.cs
index 64d36848e9f05c1b9a34edfb2d9a5b7b56aeb6c4..3d7a0c4508145b65eb2b5dc3babba789aaf6215e 100644 (file)
@@ -1,3 +1,6 @@
+2005-15-09  Boris Kirzner <borisk@mainsoft.com>
+       * Novell.Directory.Ldap.vmwcsproj: added reference to Consts.cs.in
+
 2005-14-08  Boris Kirzner <borisk@mainsoft.com>
        * LdapConnection.cs: 
                - Values from app settings are not stored anymore in app domain.
index e1b6d6bc49449b37513f3f7328b43e97c4462d81..5c69b94243fe1399ff16c667bbbd6a5d7b5ab4be 100644 (file)
@@ -14,6 +14,7 @@
                </Build>\r
                <Files>\r
                        <Include>\r
+                               <File RelPath="Consts.cs.in" Link="..\..\build\common\Consts.cs.in" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="Novell.Directory.Ldap\AssemblyInfo.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="Novell.Directory.Ldap\AuthenticationTypes.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="Novell.Directory.Ldap\Connection.cs" SubType="Code" BuildAction="Compile"/>\r
index 601b3502e64bbb679a991665f165ceb7eecb2aca..bab94f4a13c2d335c577172104e0032265684073 100644 (file)
@@ -1,3 +1,18 @@
+2005-09-16  Ankit Jain  <jankit@novell.com>
+
+       * PEAPI.cs: Clean up indentation. Split into ...
+         Metadata.cs, Code.cs, PEAPI.cs: ... these.
+
+2005-09-08  Ankit Jain  <jankit@novell.com>
+
+       * PEAPI.cs (FileImage.stackReserve): New. Set to default value of 0x100000 (1Mb).
+         (FileImage.WritePEHeader): Write stackReserve instead of the default value.
+         (PEFile.SetStackReserve): Set stack reserve for fileImage.
+
+2005-09-06  Ankit Jain  <jankit@novell.com>
+
+       * PEAPI.cs (MetaData.WriteTildeStream): Change minor version back to 0.
+
 2005-08-30  Ankit Jain  <jankit@novell.com>
 
        * PEAPI.cs (MetaData.WriteTildeStream): Change minor version to 1.
diff --git a/mcs/class/PEAPI/Code.cs b/mcs/class/PEAPI/Code.cs
new file mode 100644 (file)
index 0000000..af8ae77
--- /dev/null
@@ -0,0 +1,1322 @@
+using System.IO;
+using System.Collections;
+
+namespace PEAPI {
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for an IL instruction
+       /// </summary>
+       internal abstract class CILInstruction {
+               protected static readonly sbyte maxByteVal = 127;
+               protected static readonly sbyte minByteVal = -128;
+               protected static readonly byte leadByte = 0xFE;
+               protected static readonly uint USHeapIndex = 0x70000000;
+               protected static readonly int longInstrStart = (int)Op.arglist;
+               public bool twoByteInstr = false;
+               public uint size = 0;
+               public uint offset;
+
+               internal virtual bool Check(MetaData md) 
+               {
+                       return false;
+               }
+
+               internal virtual void Write(FileImage output) { }
+
+       }
+
+       internal class CILByte : CILInstruction {
+               byte byteVal;
+
+               internal CILByte(byte bVal) 
+               {
+                       byteVal = bVal;
+                       size = 1;
+               }
+
+               internal override void Write(FileImage output) 
+               {
+                       output.Write(byteVal);
+               }
+
+       }
+
+       internal class Instr : CILInstruction {
+               protected int instr;
+
+               internal Instr(int inst) 
+               {
+                       if (inst >= longInstrStart) {
+                               instr = inst - longInstrStart;
+                               twoByteInstr = true;
+                               size = 2;
+                       } else {
+                               instr = inst;
+                               size = 1;
+                       }
+               }
+
+               internal override void Write(FileImage output) 
+               {
+                       //Console.WriteLine("Writing instruction " + instr + " with size " + size);
+                       if (twoByteInstr) output.Write(leadByte);
+                       output.Write((byte)instr);
+               }
+
+       }
+
+       internal class IntInstr : Instr {
+               int val;
+               bool byteNum;
+
+               internal IntInstr(int inst, int num, bool byteSize) : base(inst) 
+               {
+                       val = num;
+                       byteNum = byteSize;
+                       if (byteNum) size++;
+                       else size += 4;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       if (byteNum) 
+                               output.Write((sbyte)val);
+                       else 
+                               output.Write(val); 
+               }
+
+       }
+
+       internal class UIntInstr : Instr {
+               int val;
+               bool byteNum;
+
+               internal UIntInstr(int inst, int num, bool byteSize) : base(inst) 
+               {
+                       val = num;
+                       byteNum = byteSize;
+                       if (byteNum) size++;
+                       else size += 2;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       if (byteNum)
+                               output.Write((byte)val);
+                       else
+                               output.Write((ushort)val); 
+               }
+
+       }
+
+       internal class LongInstr : Instr {
+               long val;
+
+               internal LongInstr(int inst, long l) : base(inst) 
+               {
+                       val = l;
+                       size += 8;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(val);
+               }
+
+       }
+
+       internal class FloatInstr : Instr {
+               float fVal;
+
+               internal FloatInstr(int inst, float f) : base(inst) 
+               {
+                       fVal = f;
+                       size += 4;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(fVal);
+               }
+
+       }
+
+       internal class DoubleInstr : Instr {
+               double val;
+
+               internal DoubleInstr(int inst, double d) : base(inst) 
+               {
+                       val = d;
+                       size += 8;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(val);
+               }
+
+       }
+
+       internal class StringInstr : Instr {
+               string val;
+               byte[] bval;                                                  
+               uint strIndex;
+
+               internal StringInstr(int inst, string str) : base(inst) 
+               {
+                       val = str;  
+                       size += 4;
+               }
+
+               internal StringInstr (int inst, byte[] str) : base (inst) 
+               {
+                       bval = str;
+                       size += 4;
+               }
+
+               internal sealed override bool Check(MetaData md) 
+               {
+                       if (val != null)
+                               strIndex = md.AddToUSHeap(val);
+                       else
+                               strIndex = md.AddToUSHeap (bval);
+                       return false;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(USHeapIndex  | strIndex);
+               }
+
+       }
+
+       internal class LabelInstr : CILInstruction {
+               CILLabel label;
+
+               internal LabelInstr(CILLabel lab) 
+               {
+                       label = lab;
+                       label.AddLabelInstr(this);
+               }
+       }
+
+       internal class FieldInstr : Instr {
+               Field field;
+
+               internal FieldInstr(int inst, Field f) : base(inst) 
+               {
+                       field = f;
+                       size += 4;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(field.Token());
+               }
+
+       }
+
+       internal class MethInstr : Instr {
+               Method meth;
+
+               internal MethInstr(int inst, Method m) : base(inst) 
+               {
+                       meth = m;
+                       size += 4;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(meth.Token());
+               }
+
+       }
+
+       internal class SigInstr : Instr {
+               CalliSig signature;
+
+               internal SigInstr(int inst, CalliSig sig) : base(inst) 
+               {
+                       signature = sig;
+                       size += 4;
+               }
+
+               internal sealed override bool Check(MetaData md) 
+               {
+                       md.AddToTable(MDTable.StandAloneSig,signature);
+                       signature.BuildTables(md);
+                       return false;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(signature.Token());
+               }
+       }
+
+       internal class TypeInstr : Instr {
+               MetaDataElement theType;
+
+               internal TypeInstr(int inst, Type aType, MetaData md) : base(inst) 
+               {
+                       theType = aType.GetTypeSpec(md);
+                       size += 4;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(theType.Token());
+               }
+
+       }
+
+       internal class BranchInstr : Instr {
+               CILLabel dest;
+               private bool shortVer = true;
+               private static readonly byte longInstrOffset = 13;
+               private int target = 0;
+
+               internal BranchInstr(int inst, CILLabel dst) : base(inst) 
+               {
+                       dest = dst;
+                       dest.AddBranch(this);
+                       size++;
+
+                       if (inst >= (int) BranchOp.br && inst != (int) BranchOp.leave_s) {
+                               shortVer = false;
+                               size += 3;
+                       }
+               }
+
+               internal sealed override bool Check(MetaData md) 
+               {
+                       target = (int)dest.GetLabelOffset() - (int)(offset + size);
+                       return false;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       if (shortVer)
+                               output.Write((sbyte)target);
+                       else
+                               output.Write(target);
+               }
+
+       }
+
+       internal class SwitchInstr : Instr {
+               CILLabel[] cases;
+               uint numCases = 0;
+
+               internal SwitchInstr(int inst, CILLabel[] dsts) : base(inst) 
+               {
+                       cases = dsts;
+                       if (cases != null) numCases = (uint)cases.Length;
+                       size += 4 + (numCases * 4);
+                       for (int i=0; i < numCases; i++) {
+                               cases[i].AddBranch(this);
+                       }
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       base.Write(output);
+                       output.Write(numCases);
+                       for (int i=0; i < numCases; i++) {
+                               int target = (int)cases[i].GetLabelOffset() - (int)(offset + size);
+                               output.Write(target);
+                       }
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// The IL instructions for a method
+       /// </summary>
+       public class CILInstructions  {
+               private static readonly uint ExHeaderSize = 4;
+               private static readonly uint FatExClauseSize = 24;
+               private static readonly uint SmlExClauseSize = 12;
+               private static readonly sbyte maxByteVal = 127;
+               private static readonly sbyte minByteVal = -128;
+               private static readonly byte maxUByteVal = 255;
+               private static readonly int smallSize = 64;
+               private static readonly ushort TinyFormat = 0x2;
+               private static readonly ushort FatFormat = 0x3003;
+               private static readonly ushort MoreSects = 0x8;
+               private static readonly ushort InitLocals = 0x10;
+               private static readonly uint FatSize = 12;
+               private static readonly uint FatWords = FatSize/4;
+               private static readonly byte FatExceptTable = 0x41;
+               private static readonly byte SmlExceptTable = 0x01; 
+
+               private MetaData metaData;
+               private ArrayList exceptions, blockStack;
+               //private bool codeChecked = false;
+               private static readonly int INITSIZE = 5;
+               private CILInstruction[] buffer = new CILInstruction[INITSIZE];
+               private int tide = 0;
+               private uint offset = 0;
+               private ushort headerFlags = 0;
+               private short maxStack;
+               private uint paddingNeeded = 0;
+               private byte exceptHeader = 0;
+               uint localSigIx = 0;
+               uint codeSize = 0, exceptSize = 0;
+               bool tinyFormat, fatExceptionFormat = false;
+
+               public uint Offset {
+                       get { return offset; }
+               }       
+
+               internal CILInstructions(MetaData md) 
+               {
+                       metaData = md;
+               }
+
+               private void AddToBuffer(CILInstruction inst) 
+               {
+                       if (tide >= buffer.Length) {
+                               CILInstruction[] tmp = buffer;
+                               buffer = new CILInstruction[tmp.Length * 2];
+                               for (int i=0; i < tide; i++) {
+                                       buffer[i] = tmp[i];
+                               }
+                       }
+                       //Console.WriteLine("Adding instruction at offset " + offset + " with size " + inst.size);
+                       inst.offset = offset;
+                       offset += inst.size;
+                       buffer[tide++] = inst;
+               }
+
+               /// <summary>
+               /// Add a simple IL instruction
+               /// </summary>
+               /// <param name="inst">the IL instruction</param>
+               public void Inst(Op inst) 
+               {
+                       AddToBuffer(new Instr((int)inst));
+               }
+
+               /// <summary>
+               /// Add an IL instruction with an integer parameter
+               /// </summary>
+               /// <param name="inst">the IL instruction</param>
+               /// <param name="val">the integer parameter value</param>
+               public void IntInst(IntOp inst, int val) 
+               {
+                       int instr = (int)inst;
+                       if ((inst == IntOp.ldc_i4_s) || (inst == IntOp.ldc_i4)) 
+                               AddToBuffer(new IntInstr(instr,val,(inst == IntOp.ldc_i4_s)));
+                       else
+                               AddToBuffer(new UIntInstr(instr,val,((inst < IntOp.ldc_i4_s) ||
+                                                               (inst == IntOp.unaligned))));
+               }
+
+               /// <summary>
+               /// Add the load long instruction
+               /// </summary>
+               /// <param name="cVal">the long value</param>
+               public void ldc_i8(long cVal) 
+               {
+                       AddToBuffer(new LongInstr(0x21,cVal));
+               }
+
+               /// <summary>
+               /// Add the load float32 instruction
+               /// </summary>
+               /// <param name="cVal">the float value</param>
+               public void ldc_r4(float cVal) 
+               {
+                       AddToBuffer(new FloatInstr(0x22,cVal));
+               }
+
+               /// <summary>
+               /// Add the load float64 instruction
+               /// </summary>
+               /// <param name="cVal">the float value</param>
+               public void ldc_r8(double cVal) 
+               {
+                       AddToBuffer(new DoubleInstr(0x23,cVal));
+               }
+
+               /// <summary>
+               /// Add the load string instruction
+               /// </summary>
+               /// <param name="str">the string value</param>
+               public void ldstr(string str) 
+               {
+                       AddToBuffer(new StringInstr(0x72,str));
+               }
+
+               /// <summary>
+               /// Add the load string instruction
+               /// </summary>
+               public void ldstr (byte[] str) 
+               {
+                       AddToBuffer (new StringInstr (0x72, str));
+               }
+
+               /// <summary>
+               /// Add the calli instruction
+               /// </summary>
+               /// <param name="sig">the signature for the calli</param>
+               public void calli(CalliSig sig) 
+               {
+                       AddToBuffer(new SigInstr(0x29,sig));
+               }
+
+               /// <summary>
+               /// Add a label to the CIL instructions
+               /// </summary>
+               /// <param name="lab">the label to be added</param>
+               public void CodeLabel(CILLabel lab) 
+               {
+                       AddToBuffer(new LabelInstr(lab));
+               }
+
+               /// <summary>
+               /// Add an instruction with a field parameter
+               /// </summary>
+               /// <param name="inst">the CIL instruction</param>
+               /// <param name="f">the field parameter</param>
+               public void FieldInst(FieldOp inst, Field f) 
+               {
+                       AddToBuffer(new FieldInstr((int)inst,f));
+               }
+
+               /// <summary>
+               /// Add an instruction with a method parameter
+               /// </summary>
+               /// <param name="inst">the CIL instruction</param>
+               /// <param name="m">the method parameter</param>
+               public void MethInst(MethodOp inst, Method m) 
+               {
+                       AddToBuffer(new MethInstr((int)inst,m));
+               }
+
+               /// <summary>
+               /// Add an instruction with a type parameter
+               /// </summary>
+               /// <param name="inst">the CIL instruction</param>
+               /// <param name="t">the type argument for the CIL instruction</param>
+               public void TypeInst(TypeOp inst, Type aType) 
+               {
+                       AddToBuffer(new TypeInstr((int)inst,aType,metaData));
+               }
+
+               /// <summary>
+               /// Add a branch instruction
+               /// </summary>
+               /// <param name="inst">the branch instruction</param>
+               /// <param name="lab">the label that is the target of the branch</param>
+               public void Branch(BranchOp inst,  CILLabel lab) 
+               {
+                       AddToBuffer(new BranchInstr((int)inst,lab));
+               }
+
+               /// <summary>
+               /// Add a switch instruction
+               /// </summary>
+               /// <param name="labs">the target labels for the switch</param>
+               public void Switch(CILLabel[] labs) 
+               {
+                       AddToBuffer(new SwitchInstr(0x45,labs));
+               }
+
+               /// <summary>
+               /// Add a byte to the CIL instructions (.emitbyte)
+               /// </summary>
+               /// <param name="bVal"></param>
+               public void emitbyte(byte bVal) 
+               {
+                       AddToBuffer(new CILByte(bVal));
+               }
+
+               /// <summary>
+               /// Add an instruction which puts an integer on TOS.  This method
+               /// selects the correct instruction based on the value of the integer.
+               /// </summary>
+               /// <param name="i">the integer value</param>
+               public void PushInt(int i) 
+               {
+                       if (i == -1) {
+                               AddToBuffer(new Instr((int)Op.ldc_i4_m1));
+                       } else if ((i >= 0) && (i <= 8)) {
+                               Op op = (Op)(Op.ldc_i4_0 + i);
+                               AddToBuffer(new Instr((int)op));
+                       } else if ((i >= minByteVal) && (i <= maxByteVal)) {
+                               AddToBuffer(new IntInstr((int)IntOp.ldc_i4_s,i,true));
+                       } else {
+                               AddToBuffer(new IntInstr((int)IntOp.ldc_i4,i,false)); 
+                       }
+               }
+
+               /// <summary>
+               /// Add the instruction to load a long on TOS
+               /// </summary>
+               /// <param name="l">the long value</param>
+               public void PushLong(long l) 
+               {
+                       AddToBuffer(new LongInstr(0x21,l));
+               }
+
+               /// <summary>
+               /// Add an instruction to push the boolean value true on TOS
+               /// </summary>
+               public void PushTrue() 
+               {
+                       AddToBuffer(new Instr((int)Op.ldc_i4_1));
+               }
+
+               /// <summary>
+               ///  Add an instruction to push the boolean value false on TOS
+               /// </summary>
+               public void PushFalse() 
+               {
+                       AddToBuffer(new Instr((int)Op.ldc_i4_0));
+               }
+
+               /// <summary>
+               /// Add the instruction to load an argument on TOS.  This method
+               /// selects the correct instruction based on the value of argNo
+               /// </summary>
+               /// <param name="argNo">the number of the argument</param>
+               public void LoadArg(int argNo) 
+               {
+                       if (argNo < 4) {
+                               int op = (int)Op.ldarg_0 + argNo;
+                               AddToBuffer(new Instr(op));
+                       } else if (argNo <= maxUByteVal) {
+                               AddToBuffer(new UIntInstr((int)IntOp.ldarg,argNo,true));
+                       } else {
+                               AddToBuffer(new UIntInstr(0x09,argNo,false)); 
+                       }
+               }
+
+               /// <summary>
+               /// Add the instruction to load the address of an argument on TOS.
+               /// This method selects the correct instruction based on the value
+               /// of argNo.
+               /// </summary>
+               /// <param name="argNo">the number of the argument</param>
+               public void LoadArgAdr(int argNo) 
+               {
+                       if (argNo <= maxUByteVal) {
+                               AddToBuffer(new UIntInstr((int)IntOp.ldarga,argNo,true));
+                       } else {
+                               AddToBuffer(new UIntInstr(0x0A,argNo,false)); 
+                       }
+               }
+
+               /// <summary>
+               /// Add the instruction to load a local on TOS.  This method selects
+               /// the correct instruction based on the value of locNo.
+               /// </summary>
+               /// <param name="locNo">the number of the local to load</param>
+               public void LoadLocal(int locNo) 
+               {
+                       if (locNo < 4) {
+                               int op = (int)Op.ldloc_0 + locNo;
+                               AddToBuffer(new Instr(op));
+                       } else if (locNo <= maxUByteVal) {
+                               AddToBuffer(new UIntInstr((int)IntOp.ldloc,locNo,true));
+                       } else {
+                               AddToBuffer(new UIntInstr(0x0C,locNo,false)); 
+                       }
+               }
+
+               /// <summary>
+               /// Add the instruction to load the address of a local on TOS.
+               /// This method selects the correct instruction based on the 
+               /// value of locNo.
+               /// </summary>
+               /// <param name="locNo">the number of the local</param>
+               public void LoadLocalAdr(int locNo) 
+               {
+                       if (locNo <= maxUByteVal) {
+                               AddToBuffer(new UIntInstr((int)IntOp.ldloca,locNo,true));
+                       } else {
+                               AddToBuffer(new UIntInstr(0x0D,locNo,false)); 
+                       }
+               }
+
+               /// <summary>
+               /// Add the instruction to store to an argument.  This method
+               /// selects the correct instruction based on the value of argNo.
+               /// </summary>
+               /// <param name="argNo">the argument to be stored to</param>
+               public void StoreArg(int argNo) 
+               {
+                       if (argNo <= maxUByteVal) {
+                               AddToBuffer(new UIntInstr((int)IntOp.starg,argNo,true));
+                       } else {
+                               AddToBuffer(new UIntInstr(0x0B,argNo,false)); 
+                       }
+               }
+
+               /// <summary>
+               /// Add the instruction to store to a local.  This method selects
+               /// the correct instruction based on the value of locNo.
+               /// </summary>
+               /// <param name="locNo">the local to be stored to</param>
+               public void StoreLocal(int locNo) 
+               {
+                       if (locNo < 4) {
+                               int op = (int)Op.stloc_0 + locNo;
+                               AddToBuffer(new Instr(op));
+                       } else if (locNo <= maxUByteVal) {
+                               AddToBuffer(new UIntInstr((int)IntOp.stloc,locNo,true));
+                       } else {
+                               AddToBuffer(new UIntInstr(0x0E,locNo,false)); 
+                       }
+               }
+
+               /// <summary>
+               /// Create a new CIL label.  To place the label in the CIL instruction
+               /// stream use CodeLabel.
+               /// </summary>
+               /// <returns>a new CIL label</returns>
+               public CILLabel NewLabel() 
+               {
+                       return new CILLabel();
+               }
+
+               public void AddTryBlock(TryBlock tryBlock) 
+               {
+                       if (exceptions == null) 
+                               exceptions = new ArrayList();
+                       else if (exceptions.Contains(tryBlock)) return;
+                       exceptions.Add(tryBlock);
+               }
+
+               /// <summary>
+               /// Create a new label at this position in the code buffer
+               /// </summary>
+               /// <returns>the label at the current position</returns>
+               public CILLabel NewCodedLabel() 
+               {
+                       CILLabel lab = new CILLabel();
+                       AddToBuffer(new LabelInstr(lab));
+                       return lab;
+               }
+
+               /// <summary>
+               /// Mark this position as the start of a new block
+               /// (try, catch, filter, finally or fault)
+               /// </summary>
+               public void StartBlock() 
+               {
+                       if (blockStack == null) blockStack = new ArrayList();
+                       blockStack.Insert(0,NewCodedLabel());
+               }
+
+               /// <summary>
+               /// Mark this position as the end of the last started block and
+               /// make it a try block.  This try block is added to the current 
+               /// instructions (ie do not need to call AddTryBlock)
+               /// </summary>
+               /// <returns>The try block just ended</returns>
+               public TryBlock EndTryBlock() 
+               {
+                       TryBlock tBlock = new TryBlock((CILLabel)blockStack[0],NewCodedLabel());
+                       blockStack.RemoveAt(0);
+                       AddTryBlock(tBlock);
+                       return tBlock;
+               }
+
+               /// <summary>
+               /// Mark this position as the end of the last started block and
+               /// make it a catch block.  This catch block is associated with the
+               /// specified try block.
+               /// </summary>
+               /// <param name="exceptType">the exception type to be caught</param>
+               /// <param name="tryBlock">the try block associated with this catch block</param>
+               public void EndCatchBlock(Class exceptType, TryBlock tryBlock) 
+               {
+                       Catch catchBlock = new Catch(exceptType,(CILLabel)blockStack[0],
+                                       NewCodedLabel());
+                       tryBlock.AddHandler(catchBlock);
+               }
+
+               /// <summary>
+               /// Mark this position as the end of the last started block and
+               /// make it a filter block.  This filter block is associated with the
+               /// specified try block.
+               /// </summary>
+               /// <param name="filterLab">the label where the filter code is</param>
+               /// <param name="tryBlock">the try block associated with this filter block</param>
+               public void EndFilterBlock(CILLabel filterLab, TryBlock tryBlock) 
+               {
+                       Filter filBlock = new Filter(filterLab,(CILLabel)blockStack[0],NewCodedLabel());
+                       tryBlock.AddHandler(filBlock);
+               }
+
+               /// <summary>
+               /// Mark this position as the end of the last started block and
+               /// make it a finally block.  This finally block is associated with the
+               /// specified try block.
+               /// </summary>
+               /// <param name="tryBlock">the try block associated with this finally block</param>
+               public void EndFinallyBlock(TryBlock tryBlock) 
+               {
+                       Finally finBlock= new Finally((CILLabel)blockStack[0],NewCodedLabel());
+                       tryBlock.AddHandler(finBlock);
+               }
+
+               /// <summary>
+               /// Mark this position as the end of the last started block and
+               /// make it a fault block.  This fault block is associated with the
+               /// specified try block.
+               /// </summary>
+               /// <param name="tryBlock">the try block associated with this fault block</param>
+               public void EndFaultBlock(TryBlock tryBlock) 
+               {
+                       Fault fBlock= new Fault((CILLabel)blockStack[0],NewCodedLabel());
+                       tryBlock.AddHandler(fBlock);
+               }
+
+               internal uint GetCodeSize() 
+               {
+                       return codeSize + paddingNeeded + exceptSize;
+               }
+
+               internal void CheckCode(uint locSigIx, bool initLocals, int maxStack) 
+               {
+                       if (tide == 0) return;
+                       bool changed = true;
+                       while (changed) {
+                               changed = false;
+                               for (int i=0; i < tide; i++) {
+                                       changed = buffer[i].Check(metaData) || changed;
+                               }
+                               if (changed) {
+                                       for (int i=1; i < tide; i++) {
+                                               buffer[i].offset = buffer[i-1].offset + buffer[i-1].size;
+                                       }
+                                       offset = buffer[tide-1].offset + buffer[tide-1].size;
+                               }
+                       }
+                       codeSize = offset;
+                       // Console.WriteLine("codeSize before header added = " + codeSize);
+                       if ((offset < smallSize) && (maxStack <= 8) && (locSigIx == 0) && (exceptions == null)) {
+                               // can use tiny header
+                               //Console.WriteLine("Tiny Header");
+                               tinyFormat = true;
+                               headerFlags = (ushort)(TinyFormat | ((ushort)codeSize << 2));
+                               codeSize++;
+                               if ((codeSize % 4) != 0) { paddingNeeded = 4 - (codeSize % 4); }
+                       } else {
+                               //Console.WriteLine("Fat Header");
+                               tinyFormat = false;
+                               localSigIx = locSigIx;
+                               this.maxStack = (short)maxStack;
+                               headerFlags = FatFormat;
+                               if (exceptions != null) {
+                                       // Console.WriteLine("Got exceptions");
+                                       headerFlags |= MoreSects;
+                                       uint numExceptClauses = 0;
+                                       for (int i=0; i < exceptions.Count; i++) {
+                                               TryBlock tryBlock = (TryBlock)exceptions[i];
+                                               tryBlock.SetSize();
+                                               numExceptClauses += (uint)tryBlock.NumHandlers();
+                                               if (tryBlock.isFat()) fatExceptionFormat = true;
+                                       }
+
+                                       uint data_size = ExHeaderSize + numExceptClauses *
+                                               (fatExceptionFormat ? FatExClauseSize : SmlExClauseSize);
+
+                                       if (data_size > 255)
+                                               fatExceptionFormat = true;
+
+                                       // Console.WriteLine("numexceptclauses = " + numExceptClauses);
+                                       if (fatExceptionFormat) {
+                                               // Console.WriteLine("Fat exception format");
+                                               exceptHeader = FatExceptTable;
+                                               exceptSize = ExHeaderSize + numExceptClauses * FatExClauseSize;
+                                       } else {
+                                               // Console.WriteLine("Tiny exception format");
+                                               exceptHeader = SmlExceptTable;
+                                               exceptSize = ExHeaderSize + numExceptClauses * SmlExClauseSize;
+                                       }
+                                       // Console.WriteLine("exceptSize = " + exceptSize);
+                               }
+                               if (initLocals) headerFlags |= InitLocals;
+                               if ((offset % 4) != 0) { paddingNeeded = 4 - (offset % 4); }
+                               codeSize += FatSize;
+                       }
+                       // Console.WriteLine("codeSize = " + codeSize + "  headerFlags = " + 
+                       //                   Hex.Short(headerFlags));
+               }
+
+               internal void Write(FileImage output) 
+               {
+                       // Console.WriteLine("Writing header flags = " + Hex.Short(headerFlags));
+                       if (tinyFormat) {
+                               // Console.WriteLine("Writing tiny code");
+                               output.Write((byte)headerFlags);
+                       } else {
+                               // Console.WriteLine("Writing fat code");
+                               output.Write(headerFlags);
+                               output.Write((ushort)maxStack);
+                               output.Write(offset);
+                               output.Write(localSigIx);
+                       }
+                       // Console.WriteLine(Hex.Int(tide) + " CIL instructions");
+                       // Console.WriteLine("starting instructions at " + output.Seek(0,SeekOrigin.Current));
+                       for (int i=0; i < tide; i++) {
+                               buffer[i].Write(output);
+                       }
+                       // Console.WriteLine("ending instructions at " + output.Seek(0,SeekOrigin.Current));
+                       for (int i=0; i < paddingNeeded; i++) { output.Write((byte)0); }
+                       if (exceptions != null) {
+                               // Console.WriteLine("Writing exceptions");
+                               // Console.WriteLine("header = " + Hex.Short(exceptHeader) + " exceptSize = " + Hex.Int(exceptSize));
+                               output.Write(exceptHeader);
+                               output.Write3Bytes((uint)exceptSize);
+                               for (int i=0; i < exceptions.Count; i++) {
+                                       TryBlock tryBlock = (TryBlock)exceptions[i];
+                                       tryBlock.Write(output,fatExceptionFormat);
+                               }
+                       }
+               }
+
+       }
+
+       /**************************************************************************/  
+       public abstract class CodeBlock {
+
+               private static readonly int maxCodeSize = 255;
+               protected CILLabel start, end;
+               protected bool small = true;
+
+               public CodeBlock(CILLabel start, CILLabel end) 
+               {
+                       this.start = start;
+                       this.end = end;
+               }
+
+               internal virtual bool isFat() 
+               {
+                       // Console.WriteLine("block start = " + start.GetLabelOffset() +
+                       //                  "  block end = " + end.GetLabelOffset());
+                       return (end.GetLabelOffset() - start.GetLabelOffset()) > maxCodeSize;
+               }
+
+               internal virtual void Write(FileImage output, bool fatFormat) 
+               {
+                       if (fatFormat) output.Write(start.GetLabelOffset());
+                       else output.Write((short)start.GetLabelOffset());
+                       uint len = end.GetLabelOffset() - start.GetLabelOffset();
+                       if (fatFormat) output.Write(len);
+                       else output.Write((byte)len);
+               }
+
+       }
+
+       /// <summary>
+       /// The descriptor for a guarded block (.try)
+       /// </summary>
+       public class TryBlock : CodeBlock {
+               protected bool fatFormat = false;
+               protected int flags = 0;
+               ArrayList handlers = new ArrayList();
+
+               /// <summary>
+               /// Create a new try block
+               /// </summary>
+               /// <param name="start">start label for the try block</param>
+               /// <param name="end">end label for the try block</param>
+               public TryBlock(CILLabel start, CILLabel end) : base(start,end) { }
+
+               /// <summary>
+               /// Add a handler to this try block
+               /// </summary>
+               /// <param name="handler">a handler to be added to the try block</param>
+               public void AddHandler(HandlerBlock handler) 
+               {
+                       flags = handler.GetFlag();
+                       handlers.Add(handler);
+               }
+
+               internal void SetSize() 
+               {
+                       fatFormat = base.isFat();
+                       if (fatFormat) return;
+                       for (int i=0; i < handlers.Count; i++) {
+                               HandlerBlock handler = (HandlerBlock)handlers[i];
+                               if (handler.isFat()) {
+                                       fatFormat = true;
+                                       return;
+                               }
+                       }
+               }
+
+               internal int NumHandlers() 
+               {
+                       return handlers.Count;
+               }
+
+               internal override bool isFat() 
+               {
+                       return fatFormat;
+               }
+
+               internal override void Write(FileImage output, bool fatFormat) 
+               {
+                       // Console.WriteLine("writing exception details");
+                       for (int i=0; i < handlers.Count; i++) {
+                               // Console.WriteLine("Except block " + i);
+                               HandlerBlock handler = (HandlerBlock)handlers[i];
+                               if (fatFormat) output.Write(flags);
+                               else output.Write((short)flags);
+                               // Console.WriteLine("flags = " + Hex.Short(flags));
+                               base.Write(output,fatFormat);
+                               handler.Write(output,fatFormat);
+                       }
+               }
+       }
+
+       public abstract class HandlerBlock : CodeBlock  {
+
+               protected static readonly short ExceptionFlag = 0;
+               protected static readonly short FilterFlag = 0x01;
+               protected static readonly short FinallyFlag = 0x02;
+               protected static readonly short FaultFlag = 0x04;
+
+               public HandlerBlock(CILLabel start, CILLabel end) : base(start,end) { }
+
+               internal virtual short GetFlag() { return ExceptionFlag; }
+
+               internal override void Write(FileImage output, bool fatFormat) 
+               {
+                       base.Write(output,fatFormat);
+               }
+
+       }
+
+       /// <summary>
+       /// The descriptor for a catch clause (.catch)
+       /// </summary>
+       public class Catch : HandlerBlock  {
+
+               Class exceptType;
+
+               /// <summary>
+               /// Create a new catch clause
+               /// </summary>
+               /// <param name="except">the exception to be caught</param>
+               /// <param name="handlerStart">start of the handler code</param>
+               /// <param name="handlerEnd">end of the handler code</param>
+               public Catch(Class except, CILLabel handlerStart, CILLabel handlerEnd) 
+                       : base(handlerStart,handlerEnd) 
+               {
+                       exceptType = except;
+               }
+
+               internal override void Write(FileImage output, bool fatFormat) 
+               {
+                       base.Write(output,fatFormat);
+                       output.Write(exceptType.Token());
+               }
+       }
+
+       /// <summary>
+       /// The descriptor for a filter clause (.filter)
+       /// </summary>
+       public class Filter : HandlerBlock  {
+
+               CILLabel filterLabel;
+
+               /// <summary>
+               /// Create a new filter clause
+               /// </summary>
+               /// <param name="filterLabel">the label where the filter code starts</param>
+               /// <param name="handlerStart">the start of the handler code</param>
+               /// <param name="handlerEnd">the end of the handler code</param>
+               public Filter(CILLabel filterLabel, CILLabel handlerStart, 
+                               CILLabel handlerEnd) : base(handlerStart,handlerEnd) 
+                               {
+                       this.filterLabel = filterLabel;
+               }
+
+               internal override short GetFlag() 
+               {
+                       return FilterFlag; 
+               }
+
+               internal override void Write(FileImage output, bool fatFormat) 
+               {
+                       base.Write(output,fatFormat);
+                       output.Write(filterLabel.GetLabelOffset());
+               }
+
+       }
+
+       /// <summary>
+       /// Descriptor for a finally block (.finally)
+       /// </summary>
+       public class Finally : HandlerBlock  {
+
+               /// <summary>
+               /// Create a new finally clause
+               /// </summary>
+               /// <param name="finallyStart">start of finally code</param>
+               /// <param name="finallyEnd">end of finally code</param>
+               public Finally(CILLabel finallyStart, CILLabel finallyEnd)
+                       : base(finallyStart,finallyEnd) { }
+
+               internal override short GetFlag() 
+               {
+                       return FinallyFlag; 
+               }
+
+               internal override void Write(FileImage output, bool fatFormat) 
+               {
+                       base.Write(output,fatFormat);
+                       output.Write((int)0);
+               }
+
+       }
+
+       /// <summary>
+       /// Descriptor for a fault block (.fault)
+       /// </summary>
+       public class Fault : HandlerBlock  {
+
+               /// <summary>
+               /// Create a new fault clause
+               /// </summary>
+               /// <param name="faultStart">start of the fault code</param>
+               /// <param name="faultEnd">end of the fault code</param>
+               public Fault(CILLabel faultStart, CILLabel faultEnd)
+                       : base(faultStart,faultEnd) { }
+
+               internal override short GetFlag() 
+               {
+                       return FaultFlag; 
+               }
+
+               internal override void Write(FileImage output, bool fatFormat) 
+               {
+                       base.Write(output,fatFormat);
+                       output.Write((int)0);
+
+               }
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for the locals for a method
+       /// </summary>
+       public class LocalSig : Signature {
+
+               private static readonly byte LocalSigByte = 0x7;
+               Local[] locals;
+
+               public LocalSig(Local[] locals)         
+               {
+                       this.locals = locals;
+                       tabIx = MDTable.StandAloneSig;
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       MemoryStream sig = new MemoryStream();
+                       sig.WriteByte(LocalSigByte);
+                       MetaData.CompressNum((uint)locals.Length,sig);
+                       for (int i=0; i < locals.Length; i++) {
+                               ((Local)locals[i]).TypeSig(sig);
+                       }
+                       sigIx = md.AddToBlobHeap(sig.ToArray());
+                       done = true;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Signature for calli instruction
+       /// </summary>
+       public class CalliSig : Signature {
+
+               private static readonly byte Sentinel = 0x41;
+               CallConv callConv;
+               Type returnType;
+               Type[] parameters, optParams;
+               uint numPars = 0, numOptPars = 0;
+
+               /// <summary>
+               /// Create a signature for a calli instruction
+               /// </summary>
+               /// <param name="cconv">calling conventions</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">parameter types</param>
+               public CalliSig(CallConv cconv, Type retType, Type[] pars) 
+               {
+                       tabIx = MDTable.StandAloneSig;
+                       callConv = cconv;
+                       returnType = retType;
+                       parameters = pars;
+                       if (pars != null) numPars = (uint)pars.Length;
+               }
+
+               /// <summary>
+               /// Add the optional parameters to a vararg method
+               /// This method sets the vararg calling convention
+               /// </summary>
+               /// <param name="optPars">the optional pars for the vararg call</param>
+               public void AddVarArgs(Type[] optPars) 
+               {
+                       optParams = optPars;
+                       if (optPars != null) numOptPars = (uint)optPars.Length;
+                       callConv |= CallConv.Vararg;
+               }
+
+               /// <summary>
+               /// Add extra calling conventions to this callsite signature
+               /// </summary>
+               /// <param name="cconv"></param>
+               public void AddCallingConv(CallConv cconv) 
+               {
+                       callConv |= cconv;
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       MemoryStream sig = new MemoryStream();
+                       sig.WriteByte((byte)callConv);
+                       MetaData.CompressNum(numPars+numOptPars,sig);
+                       returnType.TypeSig(sig);
+                       for (int i=0; i < numPars; i++) {
+                               parameters[i].TypeSig(sig);
+                       }
+                       sigIx = md.AddToBlobHeap(sig.ToArray());
+                       if (numOptPars > 0) {
+                               sig.WriteByte(Sentinel);
+                               for (int i=0; i < numOptPars; i++) {
+                                       optParams[i].TypeSig(sig);
+                               }
+                       }
+                       done = true;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a local of a method
+       /// </summary>
+       public class Local {
+
+               private static readonly byte Pinned = 0x45;
+               string name;
+               Type type;
+               bool pinned = false, byref = false;
+
+               /// <summary>
+               /// Create a new local variable 
+               /// </summary>
+               /// <param name="lName">name of the local variable</param>
+               /// <param name="lType">type of the local variable</param>
+               public Local(string lName, Type lType) 
+               {
+                       name = lName;
+                       type = lType;
+               }
+
+               /// <summary>
+               /// Create a new local variable that is byref and/or pinned
+               /// </summary>
+               /// <param name="lName">local name</param>
+               /// <param name="lType">local type</param>
+               /// <param name="byRef">is byref</param>
+               /// <param name="isPinned">has pinned attribute</param>
+               public Local(string lName, Type lType, bool byRef, bool isPinned)
+               {
+                       name = lName;
+                       type = lType;
+                       byref = byRef;
+                       pinned = isPinned;
+               }
+
+               internal void TypeSig(MemoryStream str) 
+               {
+                       if (pinned) str.WriteByte(Pinned);
+                       type.TypeSig(str);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// A label in the IL
+       /// </summary>
+       public class CILLabel {
+
+               CILInstruction branch;
+               CILInstruction[] multipleBranches;
+               int tide = 0;
+               CILInstruction labInstr;
+               uint offset = 0;
+
+               public CILLabel (uint offset) 
+               {
+                       this.offset = offset;
+               }
+
+
+               internal CILLabel() 
+               {
+               }
+
+               internal void AddBranch(CILInstruction instr) 
+               {
+                       if (branch == null) {
+                               branch = instr;
+                               return;
+                       }
+                       if (multipleBranches == null) {
+                               multipleBranches = new CILInstruction[2];
+                       } else if (tide >= multipleBranches.Length) {
+                               CILInstruction[] tmp = multipleBranches;
+                               multipleBranches = new CILInstruction[tmp.Length*2];
+                               for (int i=0; i < tide; i++) {
+                                       multipleBranches[i] = tmp[i];
+                               }
+                       }
+                       multipleBranches[tide++] = instr;
+               }
+
+               internal void AddLabelInstr(LabelInstr lInstr) 
+               {
+                       labInstr = lInstr;
+               }
+
+               internal uint GetLabelOffset() 
+               {
+                       if (labInstr == null) return 0;
+                       return labInstr.offset + offset;
+               }
+
+       }
+
+
+}
+
+
diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs
new file mode 100644 (file)
index 0000000..5e016e3
--- /dev/null
@@ -0,0 +1,5397 @@
+using System;
+using System.IO;
+using System.Collections;
+using System.Text;
+
+namespace PEAPI {
+
+       #region Enums
+
+       /// <summary>
+       /// flags for the assembly (.corflags)
+       /// </summary>
+       public enum CorFlags {CF_IL_ONLY = 1, CF_32_BITREQUIRED = 2,
+               CF_STRONGNAMESIGNED = 8, CF_TRACKDEBUGDATA = 0x10000 }
+
+       /// <summary>
+       /// subsystem for the assembly (.subsystem)
+       /// </summary>
+       public enum SubSystem { Native = 1, Windows_GUI = 2, 
+               Windows_CUI = 3, OS2_CUI = 5, POSIX_CUI = 7, Native_Windows = 8, 
+               Windows_CE_GUI = 9}
+
+       /// <summary>
+       /// Hash algorithms for the assembly
+       /// </summary>
+       public enum HashAlgorithm { None, SHA1 }
+
+       /// <summary>
+       /// Attributes for this assembly
+       /// </summary>
+       public enum AssemAttr { EnableJITCompileTracking = 0x8000, 
+               DisableJITCompileOptimizer = 0x4000}
+
+       /// <summary>
+       /// Method call conventions
+       /// </summary>
+       public enum CallConv { Default, Cdecl, Stdcall, Thiscall, 
+               Fastcall, Vararg, Instance = 0x20, Generic = 0x10, InstanceExplicit = 0x60 }
+
+       /// <summary>
+       /// Type custom modifier
+       /// </summary>
+       public enum CustomModifier { modreq = 0x1F, modopt };
+
+       /// <summary>
+       /// Attibutes for a class
+       /// </summary>
+       public enum TypeAttr {Private, Public, NestedPublic, NestedPrivate, 
+               NestedFamily, NestedAssembly, NestedFamAndAssem, NestedFamOrAssem, 
+               SequentialLayout, ExplicitLayout = 0x10, Interface = 0x20, 
+               Abstract = 0x80, PublicAbstract = 0x81, Sealed = 0x100, 
+               PublicSealed = 0x101, SpecialName = 0x400, RTSpecialName = 0x800, 
+               Import = 0x1000, Serializable = 0x2000, UnicodeClass = 0x10000,
+               AutoClass = 0x20000, HasSecurity = 0x40000, BeforeFieldInit = 0x100000 }
+
+       /// <summary>
+       /// Attributes for a field
+       /// </summary>
+       public enum FieldAttr {Default, Private, FamAndAssem, Assembly, 
+               Family, FamOrAssem, Public, Static = 0x10, PublicStatic = 0x16, 
+               Initonly = 0x20, Literal = 0x40, Notserialized = 0x80, 
+               SpecialName = 0x200, RTSpecialName = 0x400, HasFieldMarshal = 0x1000 }
+
+       /// <summary>
+       /// Attributes for a method
+       /// </summary>
+       public enum MethAttr { Default, Private, FamAndAssem, Assembly,
+               Family, FamOrAssem, Public, Static = 0x0010, PublicStatic = 0x16, 
+               Final = 0x0020, PublicStaticFinal = 0x36, Virtual = 0x0040, 
+               PrivateVirtual, PublicVirtual = 0x0046, HideBySig = 0x0080, 
+               NewSlot = 0x0100, Abstract = 0x0400, SpecialName = 0x0800,
+               RTSpecialName = 0x1000, SpecialRTSpecialName = 0x1800, 
+               HasSecurity = 0x4000, RequireSecObject = 0x8000}
+
+       /// <summary>
+       /// Attributes for .pinvokeimpl method declarations
+       /// </summary>
+       public enum PInvokeAttr { nomangle = 1, ansi = 2, unicode = 4, autochar = 6,
+               lasterr = 0x0040, winapi = 0x0100, cdecl = 0x0200,
+               stdcall = 0x0300, thiscall = 0x0400, fastcall = 0x0500 }
+
+       /// <summary>
+       /// Implementation attributes for a method
+       /// </summary>
+       public enum ImplAttr { IL, Native, Runtime = 0x03, Unmanaged = 0x04,
+               ForwardRef = 0x10, PreserveSig = 0x0080, InternalCall = 0x1000, 
+               Synchronised = 0x0020, Synchronized = 0x0020, NoInLining = 0x0008, Optil = 0x0002}
+
+       /// <summary>
+       /// Modes for a parameter
+       /// </summary>
+       public enum ParamAttr { Default, In, Out, Opt = 16, HasDefault = 0x1000, HasFieldMarshal = 0x2000 }
+
+       /// <summary>
+       /// CIL instructions
+       /// </summary>
+       public enum Op { nop, breakOp, ldarg_0, ldarg_1, ldarg_2, ldarg_3,
+               ldloc_0, ldloc_1, ldloc_2, ldloc_3, stloc_0, stloc_1, stloc_2, stloc_3, 
+               ldnull = 0x14, ldc_i4_m1, ldc_i4_0, ldc_i4_1, ldc_i4_2, ldc_i4_3, 
+               ldc_i4_4, ldc_i4_5, ldc_i4_6, ldc_i4_7, ldc_i4_8, dup = 0x25, pop, 
+               ret = 0x2A, ldind_i1 = 0x46, ldind_u1, ldind_i2, ldind_u2, ldind_i4, 
+               ldind_u4, ldind_i8, ldind_i,  ldind_r4, ldind_r8, ldind_ref, stind_ref, 
+               stind_i1, stind_i2, stind_i4, stind_i8, stind_r4, stind_r8, add, sub, mul,
+               div, div_un, rem, rem_un, and, or, xor, shl, shr, shr_un, neg, not, 
+               conv_i1, conv_i2, conv_i4, conv_i8, conv_r4, conv_r8, conv_u4, conv_u8, 
+               conv_r_un = 0x76, throwOp = 0x7A, conv_ovf_i1_un = 0x82, conv_ovf_i2_un,
+               conv_ovf_i4_un, conv_ovf_i8_un, conf_ovf_u1_un, conv_ovf_u2_un, 
+               conv_ovf_u4_un, conv_ovf_u8_un, conv_ovf_i_un, conv_ovf_u_un, 
+               ldlen = 0x8E, ldelem_i1 = 0x90, ldelem_u1, ldelem_i2, ldelem_u2, 
+               ldelem_i4, ldelem_u4, ldelem_i8, ldelem_i, ldelem_r4, ldelem_r8, 
+               ldelem_ref, stelem_i, stelem_i1, stelem_i2, stelem_i4, stelem_i8, stelem_r4 = 0xA0, stelem_r8,
+               stelem_ref, conv_ovf_i1 = 0xb3, conv_ovf_u1, conv_ovf_i2, conv_ovf_u2, 
+               conv_ovf_i4, conv_ovf_u4, conv_ovf_i8, conv_ovf_u8, ckfinite = 0xC3, 
+               conv_u2 = 0xD1, conv_u1, conv_i, conv_ovf_i, conv_ovf_u, add_ovf, 
+               add_ovf_un, mul_ovf, mul_ovf_un, sub_ovf, sub_ovf_un, endfinally, 
+               stind_i = 0xDF, conv_u, arglist = 0xFE00, ceq, cgt, cgt_un, clt, clt_un, 
+               localloc = 0xFE0F, endfilter = 0xFE11, volatile_ = 0xFE13, tail_, 
+               cpblk = 0xFE17, initblk, rethrow = 0xFE1A, refanytype = 0xFE1D}
+
+       /// <summary>
+       /// CIL instructions requiring an integer parameter
+       /// </summary>
+       public enum IntOp {ldarg_s = 0x0E, ldarga_s, starg_s, ldloc_s, ldloca_s, 
+               stloc_s, ldc_i4_s = 0x1F, ldc_i4, ldarg = 0xFE09,
+               ldarga, starg, ldloc, ldloca, stloc, unaligned = 0xFE12 }
+
+       /// <summary>
+       /// CIL instructions requiring a field parameter
+       /// </summary>
+       public enum FieldOp {ldfld = 0x7B, ldflda, stfld, ldsfld, ldsflda,
+               stsfld, ldtoken = 0xD0 }
+
+       /// <summary>
+       /// CIL instructions requiring a method parameter
+       /// </summary>
+       public enum MethodOp {jmp = 0x27, call, callvirt = 0x6F, newobj = 0x73, 
+               ldtoken = 0xD0, ldftn = 0xFE06, ldvirtfn }
+
+       /// <summary>
+       /// CIL instructions requiring a type parameter
+       /// </summary>
+       public enum TypeOp {cpobj = 0x70, ldobj, castclass = 0x74, isinst, 
+               unbox = 0x79, stobj = 0x81, box = 0x8C, newarr, 
+               ldelema = 0x8F, refanyval = 0xC2, mkrefany = 0xC6, 
+               ldtoken = 0xD0, initobj = 0xFE15, sizeOf = 0xFE1C,
+               ldelem = 0xA3, stelem = 0xA4, unbox_any }
+
+       /// <summary>
+       /// CIL branch instructions
+       /// </summary>
+       public enum BranchOp {
+               // short branches
+               br_s = 0x2B, brfalse_s, brtrue_s, beq_s, bge_s, bgt_s,
+               ble_s, blt_s, bne_un_s, bge_un_s, bgt_un_s, ble_un_s, blt_un_s,
+               // long branches
+               br = 0x38, brfalse, brtrue, beq, bge, bgt, ble, blt,
+               bne_un, bge_un, bgt_un, ble_un, blt_un,
+
+               leave = 0xDD, leave_s }
+
+       /// <summary>
+       /// Index for all the tables in the meta data
+       /// </summary>
+       public enum MDTable { Module, TypeRef, TypeDef, Field = 0x04, Method = 0x06,
+               Param = 0x08, InterfaceImpl, MemberRef, Constant, CustomAttribute, 
+               FieldMarshal, DeclSecurity, ClassLayout, FieldLayout, StandAloneSig, 
+               EventMap, Event = 0x14, PropertyMap, Property = 0x17, MethodSemantics, 
+               MethodImpl, ModuleRef, TypeSpec, ImplMap, FieldRVA, Assembly = 0x20, 
+               AssemblyProcessor, AssemblyOS, AssemblyRef, AssemblyRefProcessor, 
+               AssemblyRefOS, File, ExportedType, ManifestResource, NestedClass,
+               GenericParam, MethodSpec, GenericParamConstraint  }
+
+       public enum SafeArrayType { int16 = 2, int32, float32, float64,
+               currency, date, bstr, dispatch, error, boolean, variant, unknown,
+               Decimal, int8 = 16, uint8, uint16, uint32, Int = 22, UInt }
+
+       internal enum CIx { TypeDefOrRef, HasConst, HasCustomAttr, HasFieldMarshal,
+               HasDeclSecurity, MemberRefParent, HasSemantics, MethodDefOrRef, 
+               MemberForwarded, Implementation, CustomAttributeType, ResolutionScope,
+               TypeOrMethodDef, MaxCIx }
+
+       internal enum MapType { eventMap, propertyMap, nestedClass }
+
+       public enum ValueClass { ValueType, Enum }
+
+       /* Taken from Mono.Cecil */
+       public enum SecurityAction : short {
+               Request = 1,
+               Demand = 2,
+               Assert = 3,
+               Deny = 4,
+               PermitOnly = 5,
+               LinkDemand = 6,
+               InheritDemand = 7,
+               RequestMinimum = 8,
+               RequestOptional = 9,
+               RequestRefuse = 10,
+               PreJitGrant = 11,
+               PreJitDeny = 12,
+               NonCasDemand = 13,
+               NonCasLinkDemand = 14,
+               NonCasInheritance = 15,
+               LinkDemandChoice = 16,
+               InheritDemandChoice = 17,
+               DemandChoice = 18
+       }
+
+       #endregion
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for all Meta Data table elements
+       /// </summary>
+
+       public abstract class MetaDataElement: IComparable {
+               protected ArrayList customAttributes;
+               private uint row = 0;
+               protected bool done = false;
+               protected MDTable tabIx;
+               protected bool sortTable = false;
+
+               internal MetaDataElement() { }
+
+               public uint Row {
+                       get {
+                               return row;
+                       }
+                       set {
+                               if (row == 0) row = value;
+                       }
+               }
+
+               internal virtual uint GetCodedIx(CIx code) { return 0; }
+
+               /// <summary>
+               /// Add a custom attribute to this item
+               /// </summary>
+               /// <param name="ctorMeth">the constructor method for this attribute</param>
+               /// <param name="val">the byte value of the parameters</param>
+               public void AddCustomAttribute(Method ctorMeth, byte[] val) 
+               {
+                       if (customAttributes == null) {
+                               customAttributes = new ArrayList();
+                       } 
+                       customAttributes.Add(new CustomAttribute(this,ctorMeth,val));
+               }
+
+               /// <summary>
+               /// Add a custom attribute to this item
+               /// </summary>
+               /// <param name="ctorMeth">the constructor method for this attribute</param>
+               /// <param name="val">the constant values of the parameters</param>
+               public void AddCustomAttribute(Method ctorMeth, Constant[] cVals) 
+               {
+                       if (customAttributes == null) {
+                               customAttributes = new ArrayList();
+                       } 
+                       //      customAttributes.Add(new CustomAttribute(this,ctorMeth,cVals));
+               }
+
+               internal uint Token() 
+               {
+                       return (((uint)tabIx << 24) | row);
+               }
+
+               internal virtual void BuildTables(MetaData md) 
+               {
+                       done = true;
+               }
+
+               internal virtual uint Size(MetaData md) 
+               {
+                       return 0;
+               }
+
+               internal virtual void Write(FileImage output) {   }
+
+               internal virtual uint SortKey() 
+               { 
+                       throw new PEFileException("Trying to sort table of " + this);
+                       //return 0; 
+               }
+
+               internal virtual uint SortKey2()
+               {
+                       return 0;
+               }
+
+               public int CompareTo(object obj) 
+               {
+                       uint otherKey = ((MetaDataElement)obj).SortKey();
+                       uint thisKey = SortKey();
+
+                       if (thisKey == otherKey)  {
+
+                               otherKey = ((MetaDataElement)obj).SortKey2();
+                               thisKey = SortKey2();
+                               if (thisKey == otherKey)
+                                       return 0;
+                               if (thisKey < otherKey)
+                                       return -1;
+                               return 1;
+                       }
+                       if (thisKey < otherKey) return -1;
+
+                       return 1;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Layout information for a class (.class [sequential | explicit])
+       /// </summary>
+       internal class ClassLayout : MetaDataElement {
+
+               ClassDef parent;
+               ushort packSize = 0;
+               uint classSize = 0;
+
+               internal ClassLayout(int pack, int cSize, ClassDef par) 
+               {
+                       packSize = (ushort)pack;
+                       classSize = (uint)cSize;
+                       parent = par;
+                       tabIx = MDTable.ClassLayout;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 6 + md.TableIndexSize(MDTable.TypeDef);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(packSize);
+                       output.Write(classSize);
+                       output.WriteIndex(MDTable.TypeDef,parent.Row);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Summary description for ConstantElem.
+       /// </summary>
+       internal class ConstantElem : MetaDataElement {
+
+               MetaDataElement parent;
+               Constant cValue;
+               uint valIx = 0;
+
+               internal ConstantElem(MetaDataElement parent, Constant val) 
+               {
+                       this.parent = parent;
+                       cValue = val;
+                       tabIx = MDTable.Constant;
+                       sortTable = true;
+               }
+
+               internal override uint SortKey() 
+               {  
+                       return (parent.Row << MetaData.CIxShiftMap[(uint)CIx.HasConst]) 
+                               | parent.GetCodedIx(CIx.HasConst);
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       valIx = cValue.GetBlobIndex(md);
+                       done = true;
+               }
+
+               internal void AddToBlob(BinaryWriter bw) 
+               {
+                       cValue.Write(bw);
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2 + md.CodedIndexSize(CIx.HasConst) + md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(cValue.GetTypeIndex());
+                       output.Write((byte)0);
+                       output.WriteCodedIndex(CIx.HasConst,parent);
+                       output.BlobIndex(valIx);
+               }
+
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a Custom Attribute (.custom) 
+       /// </summary>
+
+       public class CustomAttribute : MetaDataElement {
+
+               private static readonly ushort prolog = 0x0001;
+               MetaDataElement parent;
+               Method type;
+               uint valIx;
+               Constant cVal;
+               byte[] byteVal;
+               ushort numNamed = 0;
+               ArrayList names, vals;
+
+               internal CustomAttribute(MetaDataElement paren, Method constrType, 
+                               Constant val) {
+                       parent = paren;
+                       type = constrType;
+                       cVal = val;
+                       tabIx = MDTable.CustomAttribute;
+               }
+
+               internal CustomAttribute(MetaDataElement paren, Method constrType,
+                               byte[] val) {
+                       parent = paren;
+                       type = constrType;
+                       tabIx = MDTable.CustomAttribute;
+                       byteVal = val;
+               }
+
+               internal override uint SortKey() 
+               {
+                       return (parent.Row << MetaData.CIxShiftMap[(uint)CIx.HasCustomAttr])
+                               | parent.GetCodedIx(CIx.HasCustomAttr);
+               }
+
+               public void AddFieldOrProp(string name, Constant val) 
+               {
+                       if (numNamed == 0) {
+                               names = new ArrayList();
+                               vals = new ArrayList();
+                       }
+                       names.Add(name);
+                       vals.Add(val);
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       BinaryWriter bw = new BinaryWriter(new MemoryStream());
+                       bw.Write(byteVal);
+                       md.AddToTable(MDTable.CustomAttribute, this);
+                       MemoryStream str = (MemoryStream)bw.BaseStream;
+                       valIx = md.AddToBlobHeap(str.ToArray());
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.CodedIndexSize(CIx.HasCustomAttr) + md.CodedIndexSize(CIx.CustomAttributeType) + md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteCodedIndex(CIx.HasCustomAttr,parent);
+                       output.WriteCodedIndex(CIx.CustomAttributeType,type);
+                       output.BlobIndex(valIx);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for security permissions for a class or a method
+       /// </summary>
+
+       public class DeclSecurity : MetaDataElement {
+
+               ushort action;
+               MetaDataElement parent;
+               uint permissionIx;
+               byte [] byteVal;
+
+               internal DeclSecurity(MetaDataElement paren, ushort act, byte [] val)        
+               {
+                       parent = paren;
+                       action = act;
+                       tabIx = MDTable.DeclSecurity;
+                       byteVal = val;
+               }
+
+               internal override uint SortKey() 
+               {
+                       return (parent.Row << MetaData.CIxShiftMap[(uint)CIx.HasDeclSecurity])
+                               | parent.GetCodedIx(CIx.HasDeclSecurity);
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2 + md.CodedIndexSize(CIx.HasDeclSecurity) + md.BlobIndexSize();
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       BinaryWriter bw = new BinaryWriter (new MemoryStream ());
+                       bw.Write (byteVal);
+                       md.AddToTable (MDTable.DeclSecurity, this);
+                       MemoryStream str = (MemoryStream)bw.BaseStream;
+                       permissionIx = md.AddToBlobHeap(str.ToArray());
+
+                       done = true;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(action);
+                       output.WriteCodedIndex(CIx.HasDeclSecurity,parent);
+                       output.BlobIndex(permissionIx);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for layout information for a field
+       /// </summary>
+
+       public class FieldLayout : MetaDataElement {
+
+               Field field;
+               uint offset;
+
+               internal FieldLayout(Field field, uint offset)      
+               {
+                       this.field = field;
+                       this.offset = offset;
+                       tabIx = MDTable.FieldLayout;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 4 + md.TableIndexSize(MDTable.Field);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(offset);
+                       output.WriteIndex(MDTable.Field,field.Row);
+               }
+
+       }
+
+       /*****************************************************************************/  
+       /// <summary>
+       /// Marshalling information for a field or param
+       /// </summary>
+       public class FieldMarshal : MetaDataElement {
+
+               MetaDataElement field;
+               NativeType nt;
+               uint ntIx;
+
+               internal FieldMarshal(MetaDataElement field, NativeType nType)      
+               {
+                       this.field = field;
+                       this.nt = nType;
+                       tabIx = MDTable.FieldMarshal;
+               }
+
+               internal override uint SortKey() 
+               {
+                       return (field.Row << MetaData.CIxShiftMap[(uint)CIx.HasFieldMarshal])
+                               | field.GetCodedIx(CIx.HasFieldMarshal);
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       ntIx = md.AddToBlobHeap(nt.ToBlob());
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.CodedIndexSize(CIx.HasFieldMarshal) + md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteCodedIndex(CIx.HasFieldMarshal,field);
+                       output.BlobIndex(ntIx);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for the address of a field's value in the PE file
+       /// </summary>
+       public class FieldRVA : MetaDataElement {
+
+               Field field;
+               DataConstant data;
+
+               internal FieldRVA(Field field, DataConstant data)   
+               {
+                       this.field = field;
+                       this.data = data;
+                       tabIx = MDTable.FieldRVA;
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       md.AddData(data);
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 4 + md.TableIndexSize(MDTable.Field);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteDataRVA(data.DataOffset);
+                       output.WriteIndex(MDTable.Field,field.Row);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a file referenced in THIS assembly/module (.file)
+       /// </summary>
+       public class FileRef : MetaDataElement {
+
+               private static readonly uint NoMetaData = 0x1;
+               uint nameIx = 0, hashIx = 0;
+               uint flags = 0;
+               protected string name;
+
+               internal FileRef(string name, byte[] hashBytes, bool metaData,
+                               bool entryPoint, MetaData md) {
+                       if (!metaData) flags = NoMetaData;
+                       if (entryPoint) md.SetEntryPoint(this);
+                       this.name = name;
+                       nameIx = md.AddToStringsHeap(name);
+                       hashIx = md.AddToBlobHeap(hashBytes);
+                       tabIx = MDTable.File;
+               }
+
+               internal FileRef(uint nameIx, byte[] hashBytes, bool metaData,
+                               bool entryPoint, MetaData md) {
+                       if (!metaData) flags = NoMetaData;
+                       if (entryPoint) md.SetEntryPoint(this);
+                       this.nameIx = nameIx;
+                       hashIx = md.AddToBlobHeap(hashBytes);
+                       tabIx = MDTable.File;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 4 + md.StringsIndexSize() + md.BlobIndexSize();
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       md.AddToTable(MDTable.File,this);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(flags);
+                       output.StringsIndex(nameIx);
+                       output.BlobIndex(hashIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 16; 
+                               case (CIx.Implementation) : return 0;
+                       }
+                       return 0;
+               }
+
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for pinvoke information for a method NOT YET IMPLEMENTED
+       /// </summary>
+       public class ImplMap : MetaDataElement {
+
+               private static readonly ushort NoMangle = 0x01;
+               ushort flags;
+               Method meth;
+               string importName;
+               uint iNameIx;
+               ModuleRef importScope;
+
+               internal ImplMap(ushort flag, Method implMeth, string iName, ModuleRef mScope) 
+               {
+                       flags = flag;
+                       meth = implMeth;
+                       importName = iName;
+                       importScope = mScope;
+                       tabIx = MDTable.ImplMap;
+                       if (iName == null) flags |= NoMangle;
+                       //throw(new NotYetImplementedException("PInvoke "));
+               }
+
+               internal override uint SortKey() 
+               {
+                       return (meth.Row << MetaData.CIxShiftMap[(uint)CIx.MemberForwarded]) 
+                               | meth.GetCodedIx(CIx.MemberForwarded);
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       iNameIx = md.AddToStringsHeap(importName);
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2+ md.CodedIndexSize(CIx.MemberForwarded) + 
+                               md.StringsIndexSize() +  md.TableIndexSize(MDTable.ModuleRef);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(flags);
+                       output.WriteCodedIndex(CIx.MemberForwarded,meth);
+                       output.StringsIndex(iNameIx);
+                       output.WriteIndex(MDTable.ModuleRef,importScope.Row);
+               }
+
+       }
+
+       /**************************************************************************/  
+
+       public class GenericParameter : MetaDataElement {
+
+               MetaDataElement owner;
+               MetaData metadata;
+               string name;
+               uint nameIx;
+               short index;
+
+               internal GenericParameter (ClassDef owner, MetaData metadata,
+                               short index, string name) : this (owner, metadata, index, name, true)
+               {
+               }
+
+               internal GenericParameter (MethodDef owner, MetaData metadata,
+                               short index, string name) : this (owner, metadata, index, name, true)
+               {
+               }
+
+               private GenericParameter (MetaDataElement owner, MetaData metadata,
+                               short index, string name, bool nadda) {
+                       this.owner = owner;
+                       this.metadata = metadata;
+                       this.index = index;
+                       tabIx = MDTable.GenericParam;
+                       this.name = name;
+               }
+
+               internal override uint SortKey() 
+               {
+                       return (owner.Row << MetaData.CIxShiftMap[(uint)CIx.TypeOrMethodDef])
+                               | owner.GetCodedIx(CIx.TypeOrMethodDef);
+               }
+
+               public void AddConstraint  (Type constraint) 
+               {
+                       metadata.AddToTable (MDTable.GenericParamConstraint,
+                                       new GenericParamConstraint (this, constraint));
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return (uint) (4 +
+                                       md.CodedIndexSize(CIx.TypeOrMethodDef) + 
+                                       4 +
+                                       md.TableIndexSize(MDTable.TypeDef));
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       nameIx = md.AddToStringsHeap(name);
+                       done = true;
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write ((short) index);
+                       output.Write ((short) 0);
+                       output.WriteCodedIndex(CIx.TypeOrMethodDef, owner);
+                       output.Write ((uint) nameIx);
+                       output.WriteIndex(MDTable.TypeDef,owner.Row);
+               }
+
+
+       }
+
+       internal class GenericParamConstraint : MetaDataElement {
+
+               GenericParameter param;
+               Type type;
+
+               public GenericParamConstraint (GenericParameter param, Type type) 
+               {
+                       this.param = param;
+                       this.type = type;
+                       tabIx = MDTable.GenericParamConstraint;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return (uint) (md.TableIndexSize(MDTable.GenericParam) +
+                                       md.CodedIndexSize(CIx.TypeDefOrRef));
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteIndex(MDTable.GenericParam, param.Row);
+                       output.WriteCodedIndex(CIx.TypeDefOrRef, type);
+               }
+
+       }
+
+       internal class MethodSpec : MetaDataElement {
+
+               Method meth;
+               GenericMethodSig g_sig;
+               uint sidx;
+
+               internal MethodSpec (Method meth, GenericMethodSig g_sig) 
+               {
+                       this.meth = meth;
+                       this.g_sig = g_sig;
+                       tabIx = MDTable.MethodSpec;
+               }
+
+               internal sealed override void BuildTables (MetaData md) 
+               {
+                       if (done) return;
+                       sidx = g_sig.GetSigIx (md);
+                       done = true;
+               }
+
+               internal sealed override uint Size (MetaData md) 
+               {
+                       return (uint) (md.CodedIndexSize(CIx.MethodDefOrRef) +
+                                       md.BlobIndexSize ());
+               }
+
+               internal sealed override void Write (FileImage output) 
+               {
+                       output.WriteCodedIndex (CIx.MethodDefOrRef, meth);
+                       output.BlobIndex (sidx);
+               }
+       }
+
+       /**************************************************************************/
+       /// <summary>
+       /// Descriptor for interface implemented by a class
+       /// </summary>
+       public class InterfaceImpl: MetaDataElement {
+
+               ClassDef theClass;
+               Class theInterface;
+
+               internal InterfaceImpl(ClassDef theClass, Class theInterface) 
+               {
+                       this.theClass = theClass;
+                       this.theInterface = theInterface;
+                       tabIx = MDTable.InterfaceImpl;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.TableIndexSize(MDTable.TypeDef) + 
+                               md.CodedIndexSize(CIx.TypeDefOrRef);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteIndex(MDTable.TypeDef,theClass.Row);
+                       output.WriteCodedIndex(CIx.TypeDefOrRef,theInterface);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) { return 5; }
+
+               internal override uint SortKey ()
+               {
+                       return (theClass.Row << MetaData.CIxShiftMap[(uint)CIx.TypeDefOrRef])
+                               | theClass.GetCodedIx (CIx.TypeDefOrRef);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for resources used in this PE file 
+       /// </summary>
+
+       public class ManifestResource : MetaDataElement {
+
+               public static readonly uint PublicResource = 0x1;
+               public static readonly uint PrivateResource = 0x2;
+
+               string mrName;
+               MetaDataElement rRef;
+               uint fileOffset;
+               uint nameIx = 0;
+               uint flags = 0;
+               byte [] resourceBytes;
+
+               public ManifestResource (string name, byte[] resBytes, uint flags) 
+               {
+                       InitResource (name, flags);
+                       this.resourceBytes = resBytes;
+               }
+
+               public ManifestResource(string name, uint flags, FileRef fileRef) 
+               {
+                       InitResource (name, flags);
+                       rRef = fileRef;
+               }
+
+               public ManifestResource(string name, uint flags, FileRef fileRef, 
+                               uint fileIx) {
+                       InitResource (name, flags);
+                       rRef = fileRef;
+                       fileOffset = fileIx;
+               }
+
+               public ManifestResource(string name, uint flags, AssemblyRef assemRef) 
+               {
+                       InitResource (name, flags);
+                       rRef = assemRef;
+               }
+
+               internal ManifestResource (ManifestResource mres) 
+               {
+                       mrName = mres.mrName;
+                       flags = mres.flags;
+                       rRef = mres.rRef;
+                       fileOffset = mres.fileOffset;
+                       resourceBytes = mres.resourceBytes;
+               }
+
+               private void InitResource (string name, uint flags) 
+               {
+                       mrName = name;
+                       this.flags = flags;
+                       tabIx = MDTable.ManifestResource;
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       md.AddToTable (MDTable.ManifestResource, this);
+                       nameIx = md.AddToStringsHeap(mrName);
+                       if (resourceBytes != null) {
+                               if (rRef != null)
+                                       throw new Exception("ERROR:  Manifest Resource has byte value and file reference");
+                               fileOffset = md.AddResource(resourceBytes);
+                       } else {
+                               if (rRef == null)
+                                       throw new Exception("ERROR:  Manifest Resource has no implementation or value");
+                               rRef.BuildTables (md);
+                       }
+
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 8 + md.StringsIndexSize() + 
+                               md.CodedIndexSize(CIx.Implementation);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(fileOffset);
+                       output.Write(flags);
+                       output.StringsIndex(nameIx);
+                       output.WriteCodedIndex(CIx.Implementation,rRef);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) { return 18; }
+
+               public string Name {
+                       get { return mrName; }
+                       set { mrName = value; }
+               }
+
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for elements in the PropertyMap, EventMap and 
+       /// NestedClass MetaData tables
+       /// </summary>
+       public class MapElem : MetaDataElement {
+
+               ClassDef parent;
+               uint elemIx;
+               MDTable elemTable;
+
+               internal MapElem(ClassDef par, uint elIx, MDTable elemTab) 
+               {
+                       parent = par;
+                       elemIx = elIx;
+                       elemTable = elemTab;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.TableIndexSize(MDTable.TypeDef) + md.TableIndexSize(elemTable);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteIndex(MDTable.TypeDef,parent.Row);
+                       output.WriteIndex(elemTable,elemIx);
+               }
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for an overriding method (.override)
+       /// </summary>
+       public class MethodImpl : MetaDataElement {
+
+               ClassDef parent;
+               Method header, body;
+
+               internal MethodImpl(ClassDef par, Method decl, Method bod)      
+               {
+                       parent = par;
+                       header = decl;
+                       body = bod;
+                       tabIx = MDTable.MethodImpl;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.TableIndexSize(MDTable.TypeDef) + 2 * md.CodedIndexSize(CIx.MethodDefOrRef);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteIndex(MDTable.TypeDef,parent.Row);
+                       output.WriteCodedIndex(CIx.MethodDefOrRef,body);
+                       output.WriteCodedIndex(CIx.MethodDefOrRef,header);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for Property and Event methods
+       /// </summary>
+       public class MethodSemantics : MetaDataElement {
+
+               Feature.MethodType type;
+               MethodDef meth;
+               Feature eventOrProp;
+
+               internal MethodSemantics(Feature.MethodType mType, MethodDef method, Feature feature) 
+               {
+                       type = mType;
+                       meth = method;
+                       eventOrProp = feature;
+                       tabIx = MDTable.MethodSemantics;
+               }
+
+               internal override uint SortKey() 
+               {
+                       return (eventOrProp.Row << MetaData.CIxShiftMap [(uint)CIx.HasSemantics])
+                               | eventOrProp.GetCodedIx (CIx.HasSemantics);
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2 + md.TableIndexSize(MDTable.Method) + md.CodedIndexSize(CIx.HasSemantics);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write((ushort)type);
+                       output.WriteIndex(MDTable.Method,meth.Row);
+                       output.WriteCodedIndex(CIx.HasSemantics,eventOrProp);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a parameter of a method defined in this assembly/module
+       /// </summary>
+       public class Param : MetaDataElement {
+
+
+               Type pType;
+               string pName;
+               internal ushort seqNo = 0;
+               ushort parMode;
+               ConstantElem defaultVal;
+               uint nameIx = 0;
+               FieldMarshal marshalInfo;
+
+               /// <summary>
+               /// Create a new parameter for a method
+               /// </summary>
+               /// <param name="mode">param mode (in, out, opt)</param>
+               /// <param name="parName">parameter name</param>
+               /// <param name="parType">parameter type</param>
+               public Param(ParamAttr mode, string parName, Type parType) 
+               {
+                       pName = parName;
+                       pType = parType;
+                       parMode = (ushort)mode;
+                       tabIx = MDTable.Param;
+               }
+
+               /// <summary>
+               /// Add a default value to this parameter
+               /// </summary>
+               /// <param name="c">the default value for the parameter</param>
+               public void AddDefaultValue(Constant cVal) 
+               {
+                       defaultVal = new ConstantElem(this,cVal);
+                       parMode |= (ushort) ParamAttr.HasDefault;
+               }
+
+               /// <summary>
+               /// Add marshalling information about this parameter
+               /// </summary>
+               public void AddMarshallInfo(NativeType marshallType) 
+               {
+                       parMode |= (ushort) ParamAttr.HasFieldMarshal;
+                       marshalInfo = new FieldMarshal(this,marshallType);
+               }
+
+               internal Type GetParType() { return pType; }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       nameIx = md.AddToStringsHeap(pName);
+                       if (defaultVal != null) {
+                               md.AddToTable(MDTable.Constant,defaultVal);
+                               defaultVal.BuildTables(md);
+                       }
+                       if (marshalInfo != null) {
+                               md.AddToTable(MDTable.FieldMarshal,marshalInfo);
+                               marshalInfo.BuildTables(md);
+                       }
+                       done = true;
+               }
+
+               internal void TypeSig(MemoryStream str) 
+               {
+                       pType.TypeSig(str);
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 4 + md.StringsIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(parMode);
+                       output.Write(seqNo);
+                       output.StringsIndex(nameIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 4; 
+                               case (CIx.HasConst) : return 1; 
+                               case (CIx.HasFieldMarshal) : return 1; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       /**************************************************************************/  
+       public abstract class Signature : MetaDataElement  {
+
+               protected uint sigIx;
+
+               internal Signature() 
+               {
+                       tabIx = MDTable.StandAloneSig;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.BlobIndex(sigIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) { return (uint)tabIx; }
+
+       }
+
+       /**************************************************************************/  
+       public class TypeSpec : MetaDataElement {
+               uint sigIx = 0;
+
+               internal TypeSpec(Type aType, MetaData md) 
+               {
+                       MemoryStream sig = new MemoryStream();
+                       aType.TypeSig(sig);
+                       sigIx = md.AddToBlobHeap(sig.ToArray());
+                       tabIx = MDTable.TypeSpec;
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.TypeDefOrRef) : return 2; 
+                               case (CIx.HasCustomAttr) : return 13; 
+                               case (CIx.MemberRefParent) : return 4; 
+                       }
+                       return 0;
+               }
+
+               internal override uint Size(MetaData md) 
+               {
+                       return md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       //Console.WriteLine("Writing the blob index for a TypeSpec");
+                       output.BlobIndex(sigIx);
+               }
+       }
+
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for all IL types
+       /// </summary>
+       public abstract class Type : MetaDataElement {
+               protected byte typeIndex;
+               protected TypeSpec typeSpec;
+
+               internal Type(byte tyIx) { typeIndex = tyIx; }
+
+               internal byte GetTypeIndex() { return typeIndex; }
+               internal void SetTypeIndex (byte b) { typeIndex = b; }
+
+               internal virtual MetaDataElement GetTypeSpec(MetaData md) 
+               {
+                       if (typeSpec == null) {
+                               typeSpec = new TypeSpec(this,md);
+                               md.AddToTable(MDTable.TypeSpec,typeSpec);
+                       }
+                       return typeSpec;
+               }
+
+               internal virtual void TypeSig(MemoryStream str) 
+               {
+                       throw(new TypeSignatureException(this.GetType().AssemblyQualifiedName +
+                                               " doesn't have a type signature!!"));   
+               }
+       }
+
+       public class ClassRefInst : Type {
+
+               private Type type;
+               private bool is_value;
+
+               public ClassRefInst (Type type, bool is_value) : base (PrimitiveType.Class.GetTypeIndex ()) 
+               {
+                       this.type = type;
+                       this.is_value = is_value;
+                       if (is_value)
+                               typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
+                       tabIx = MDTable.TypeSpec;
+               }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       type.TypeSig (str);
+               }
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// The base descriptor for a class 
+       /// </summary>
+       public abstract class Class : Type {
+
+               protected int row = 0;
+               public string name, nameSpace;
+               protected uint nameIx, nameSpaceIx;
+               protected MetaData _metaData;
+               internal Class(string nameSpaceName, string className, MetaData md)
+                       : base(PrimitiveType.Class.GetTypeIndex ()) 
+               {
+                               nameSpace = nameSpaceName;
+                               name = className;
+                               nameIx = md.AddToStringsHeap(name);
+                               nameSpaceIx = md.AddToStringsHeap(nameSpace);
+                               _metaData = md;
+               }
+
+               internal Class(uint nsIx, uint nIx) : base(PrimitiveType.Class.GetTypeIndex ()) 
+               {
+                       nameSpaceIx = nsIx;
+                       nameIx = nIx;
+               }
+
+               internal virtual uint TypeDefOrRefToken() { return 0; }
+
+               internal virtual void MakeValueClass(ValueClass vClass) 
+               {
+                       typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
+               }
+
+               internal virtual string TypeName() 
+               {
+                       return (nameSpace + "." + name);
+               }
+
+               internal override MetaDataElement GetTypeSpec(MetaData md) 
+               {
+                       return this;
+               }
+       }
+
+       /**************************************************************************/  
+       // This Class produces entries in the TypeDef table of the MetaData 
+       // in the PE meta data.
+
+       // NOTE:  Entry 0 in TypeDef table is always the pseudo class <module> 
+       // which is the parent for functions and variables declared a module level
+
+       /// <summary>
+       /// The descriptor for a class defined in the IL (.class) in the current assembly/module
+       /// </summary>
+       /// 
+       public class ClassDef : Class {
+
+               private static readonly byte ElementType_Class = 0x12;
+
+               Class superType;
+               ArrayList fields = new ArrayList();
+               ArrayList methods = new ArrayList();
+               ArrayList events;
+               ArrayList properties;
+               bool typeIndexChecked = true;
+               uint fieldIx = 0, methodIx = 0;
+               byte[] securityActions;
+               uint flags;
+               ClassLayout layout;
+               ClassDef parentClass;
+               MetaData metaData;
+
+               internal ClassDef(TypeAttr attrSet, string nsName, string name, 
+                               MetaData md) : base(nsName, name, md) 
+               {
+                       metaData = md;
+                       if (! ((nsName == "" && name == "<Module>") || (nsName == "System" && name == "Object")) ) {
+                               superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
+                       }
+                       flags = (uint)attrSet;
+                       tabIx = MDTable.TypeDef;
+               }
+
+               internal void SetSuper(Class sClass) 
+               {
+                       superType = sClass;
+                       if (sClass is ClassRef)
+                               typeIndex = superType.GetTypeIndex();
+                       else
+                               typeIndexChecked = false;
+               }
+
+               internal override void MakeValueClass(ValueClass vClass) 
+               {
+                       if (vClass == ValueClass.Enum)  
+                               superType = metaData.mscorlib.EnumType();
+                       else  
+                               superType = metaData.mscorlib.ValueType();
+
+                       typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
+               }
+
+               public void SpecialNoSuper() 
+               {
+                       superType = null;
+               }
+
+               /// <summary>
+               /// Add an attribute to this class
+               /// </summary>
+               /// <param name="ta">the attribute to be added</param>
+               public void AddAttribute(TypeAttr ta) 
+               {
+                       flags |= (uint)ta;
+               }
+
+               /// <summary>
+               /// Add an interface that is implemented by this class
+               /// </summary>
+               /// <param name="iFace">the interface that is implemented</param>
+               public void AddImplementedInterface(Class iFace) 
+               {
+                       metaData.AddToTable(MDTable.InterfaceImpl,new InterfaceImpl(this,iFace));
+               }
+
+               /// <summary>
+               ///  Add a named generic type parameter
+               /// </summary>
+               public GenericParameter AddGenericParameter (short index, string name) 
+               {
+                       GenericParameter gp = new GenericParameter (this, metaData, index, name);
+                       metaData.AddToTable (MDTable.GenericParam, gp);
+                       return gp;
+               }
+
+               /// <summary>
+               /// Add a field to this class
+               /// </summary>
+               /// <param name="name">field name</param>
+               /// <param name="fType">field type</param>
+               /// <returns>a descriptor for this new field</returns>
+               public FieldDef AddField(string name, Type fType) 
+               {
+                       FieldDef field = new FieldDef(name,fType);
+                       fields.Add(field);
+                       return field;
+               }
+
+               /// <summary>
+               /// Add a field to this class
+               /// </summary>
+               /// <param name="fAtts">attributes for this field</param>
+               /// <param name="name">field name</param>
+               /// <param name="fType">field type</param>
+               /// <returns>a descriptor for this new field</returns>
+               public FieldDef AddField(FieldAttr fAtts, string name, Type fType) 
+               {
+                       FieldDef field = new FieldDef(fAtts,name,fType);
+                       fields.Add(field);
+                       return field;
+               }
+
+               public void SetFieldOrder (ArrayList fields)
+               {
+                       this.fields = fields;
+               }
+
+               /// <summary>
+               /// Add a method to this class
+               /// </summary>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">parameters</param>
+               /// <returns>a descriptor for this new method</returns>
+               public MethodDef AddMethod(string name, Type retType, Param[] pars) 
+               {
+                       // Console.WriteLine("Adding method " + name + " to class " + this.name);
+                       MethodDef meth = new MethodDef(metaData,name,retType, pars);
+                       methods.Add(meth);
+                       return meth;
+               }
+
+               /// <summary>
+               /// Add a method to this class
+               /// </summary>
+               /// <param name="mAtts">attributes for this method</param>
+               /// <param name="iAtts">implementation attributes for this method</param>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">parameters</param>
+               /// <returns>a descriptor for this new method</returns>
+               public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, 
+                               Type retType, Param[] pars) {
+                       // Console.WriteLine("Adding method " + name + " to class " + this.name);
+                       MethodDef meth = new MethodDef(metaData,mAtts,iAtts,name,retType,pars);
+                       methods.Add(meth);
+                       return meth;
+               }
+
+               /// <summary>
+               /// Add an event to this class
+               /// </summary>
+               /// <param name="name">event name</param>
+               /// <param name="eType">event type</param>
+               /// <returns>a descriptor for this new event</returns>
+               public Event AddEvent(string name, Type eType) 
+               {
+                       Event e = new Event(name,eType,this);
+                       if (events == null) events = new ArrayList();
+                       events.Add(e);
+                       return e;
+               }
+
+               /// <summary>
+               /// Add a property to this class
+               /// </summary>
+               /// <param name="name">property name</param>
+               /// <param name="propType">property type</param>
+               /// <returns>a descriptor for this new property</returns>
+               public Property AddProperty(string name, Type retType, Type[] pars) 
+               {
+                       Property p = new Property(name, retType, pars, this);
+                       if (properties == null) properties = new ArrayList();
+                       properties.Add(p);
+                       return p;
+               }
+
+               /// <summary>
+               /// Add a nested class to this class
+               /// </summary>
+               /// <param name="attrSet">attributes for this nested class</param>
+               /// <param name="nsName">nested name space name</param>
+               /// <param name="name">nested class name</param>
+               /// <returns>a descriptor for this new nested class</returns>
+               public ClassDef AddNestedClass(TypeAttr attrSet, string nsName, 
+                               string name) {
+                       ClassDef nClass = new ClassDef(attrSet,"",name,metaData);
+                       metaData.AddToTable(MDTable.TypeDef,nClass);
+                       metaData.AddToTable(MDTable.NestedClass,new MapElem(nClass,Row,MDTable.TypeDef));
+                       nClass.parentClass = this;
+                       return (nClass);
+               }
+
+               public static bool IsValueType (Class type)
+               {
+                       return IsValueType (type.nameSpace, type.name);
+               }
+
+               public static bool IsEnum (Class type)
+               {
+                       return IsEnum (type.nameSpace, type.name);
+               }
+
+               public static bool IsValueType (string nsName, string name)
+               {
+                       return (nsName == "System" && name == "ValueType");
+               }
+
+               public static bool IsEnum (string nsName, string name)
+               {
+                       return (nsName == "System" && name == "Enum");
+               }
+
+               /// <summary>
+               /// Add a nested class to this class
+               /// </summary>
+               /// <param name="attrSet">attributes for this nested class</param>
+               /// <param name="nsName">nested name space name</param>
+               /// <param name="name">nested class name</param>
+               /// <param name="sType">super type of this nested class</param>
+               /// <returns>a descriptor for this new nested class</returns>
+               public ClassDef AddNestedClass(TypeAttr attrSet, string nsName, 
+                               string name, Class sType) {
+                       ClassDef nClass = AddNestedClass (attrSet, nsName, name);
+                       nClass.SetSuper(sType);
+                       if (ClassDef.IsValueType (sType))
+                               nClass.MakeValueClass (ValueClass.ValueType);
+                       else
+                               if (ClassDef.IsEnum (sType))
+                                       nClass.MakeValueClass (ValueClass.Enum);
+
+                       if (ClassDef.IsValueType (sType) || ClassDef.IsEnum (sType))
+                               nClass.SetTypeIndex (PrimitiveType.ValueType.GetTypeIndex ());
+
+                       nClass.typeIndexChecked = true;
+                       return (nClass);
+               }
+
+               /// <summary>
+               /// Add layout information for this class.  This class must have the
+               /// sequential or explicit attribute.
+               /// </summary>
+               /// <param name="packSize">packing size (.pack)</param>
+               /// <param name="classSize">class size (.size)</param>
+               public void AddLayoutInfo (int packSize, int classSize) 
+               {
+                       layout = new ClassLayout(packSize,classSize,this);
+               }
+
+               /// <summary>
+               /// Use a method as the implementation for another method (.override)
+               /// </summary>
+               /// <param name="decl">the method to be overridden</param>
+               /// <param name="body">the implementation to be used</param>
+               public void AddMethodOverride(Method decl, Method body) 
+               {
+                       metaData.AddToTable(MDTable.MethodImpl,new MethodImpl(this,decl,body));
+               }
+
+               /// <summary>
+               /// Add security to this class NOT YET IMPLEMENTED
+               /// </summary>
+               /// <param name="permissionSet"></param>
+               public void AddSecurity(byte[] permissionSet) 
+               {
+                       throw(new NotYetImplementedException("Class security "));
+                       //flags |= HasSecurity;
+                       // securityActions = permissionSet;
+               }
+
+               //public void AddLineInfo(int row, int col) { }
+
+               internal void CheckTypeIndex() 
+               {
+                       if (typeIndexChecked) return;
+                       if (!(superType is ClassRef)) 
+                               ((ClassDef)superType).CheckTypeIndex();
+                       typeIndex = superType.GetTypeIndex();
+                       typeIndexChecked = true;
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       if ((flags & (uint)TypeAttr.Interface) != 0) { superType = null; }
+                       // Console.WriteLine("Building tables for " + name);
+                       if (layout != null) md.AddToTable(MDTable.ClassLayout,layout);
+                       // Console.WriteLine("adding methods " + methods.Count);
+                       methodIx = md.TableIndex(MDTable.Method);
+                       for (int i=0; i < methods.Count; i++) {
+                               md.AddToTable(MDTable.Method,(MetaDataElement)methods[i]);
+                               ((MethodDef)methods[i]).BuildTables(md);
+                       }
+                       // Console.WriteLine("adding fields");
+                       fieldIx = md.TableIndex(MDTable.Field);
+                       for (int i=0; i < fields.Count; i++) {
+                               md.AddToTable(MDTable.Field,(MetaDataElement)fields[i]);
+                               ((FieldDef)fields[i]).BuildTables(md);
+                       }
+                       // Console.WriteLine("adding events and properties");
+                       if (events != null) { 
+                               for (int i=0; i < events.Count; i++) {
+                                       md.AddToTable(MDTable.Event,(Event)events[i]);
+                                       ((Event)events[i]).BuildTables(md);
+                               }
+                               md.AddToTable(MDTable.EventMap,
+                                               new MapElem(this,((Event)events[0]).Row,MDTable.Event));
+                       }
+                       if (properties != null) { 
+                               for (int i=0; i < properties.Count; i++) {
+                                       md.AddToTable(MDTable.Property,(Property)properties[i]);
+                                       ((Property)properties[i]).BuildTables(md);
+                               }
+                               md.AddToTable(MDTable.PropertyMap,new MapElem(this,
+                                                       ((Property)properties[0]).Row,MDTable.Property));
+                       }
+                       // Console.WriteLine("End of building tables");
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 4 + 2 * md.StringsIndexSize() + 
+                               md.CodedIndexSize(CIx.TypeDefOrRef) +
+                               md.TableIndexSize(MDTable.Field) + 
+                               md.TableIndexSize(MDTable.Method);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(flags);
+                       output.StringsIndex(nameIx);
+                       output.StringsIndex(nameSpaceIx);
+                       //if (superType != null) 
+                       // Console.WriteLine("getting coded index for superType of " + name + " = " + superType.GetCodedIx(CIx.TypeDefOrRef));
+                       output.WriteCodedIndex(CIx.TypeDefOrRef,superType);
+                       output.WriteIndex(MDTable.Field,fieldIx);
+                       output.WriteIndex(MDTable.Method,methodIx);
+               }
+
+               internal sealed override uint TypeDefOrRefToken() 
+               {
+                       uint cIx = Row;
+                       cIx = cIx << 2;
+                       return cIx;
+               }
+
+               internal sealed override void TypeSig(MemoryStream sig) 
+               {
+                       if (!typeIndexChecked) CheckTypeIndex();
+                       sig.WriteByte(GetTypeIndex());
+                       MetaData.CompressNum(TypeDefOrRefToken(),sig);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.TypeDefOrRef) : return 0; 
+                               case (CIx.HasCustomAttr) : return 3; 
+                               case (CIx.HasDeclSecurity) : return 0; 
+                               case (CIx.TypeOrMethodDef) : return 0; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a class/interface declared in another module of THIS 
+       /// assembly, or in another assembly.
+       /// </summary>
+       public class ClassRef : Class, IExternRef, IResolutionScope {
+
+               protected IResolutionScope parent;
+               ExternClass externClass;
+               protected MetaData metaData;
+
+               internal ClassRef(string nsName, string name, MetaData md) : base(nsName, name, md) 
+               {
+                       metaData = md;
+                       tabIx = MDTable.TypeRef;
+               }
+
+               /// <summary>
+               /// Add a method to this class
+               /// </summary>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">parameter types</param>
+               /// <returns>a descriptor for this method</returns>
+               public MethodRef AddMethod(string name, Type retType, Type[] pars) 
+               {
+                       MethodRef meth = new MethodRef(this,name,retType,pars,false,null);
+                       metaData.AddToTable(MDTable.MemberRef,meth);
+                       return meth;
+               }
+
+               /// <summary>
+               /// Add a method to this class
+               /// </summary>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">parameter types</param>
+               /// <returns>a descriptor for this method</returns>
+               public MethodRef AddVarArgMethod(string name, Type retType, 
+                               Type[] pars, Type[] optPars) 
+               {
+                       MethodRef meth = new MethodRef(this,name,retType,pars,true,optPars);
+                       metaData.AddToTable(MDTable.MemberRef,meth);
+                       return meth;
+               }
+
+               /// <summary>
+               /// Add a field to this class
+               /// </summary>
+               /// <param name="name">field name</param>
+               /// <param name="fType">field type</param>
+               /// <returns>a descriptor for this field</returns>
+               public FieldRef AddField(string name, Type fType) 
+               {
+                       FieldRef field = new FieldRef(this,name,fType);
+                       metaData.AddToTable(MDTable.MemberRef,field);
+                       return field;
+               }
+
+               public ClassRef AddClass (string nsName, string name)
+               {
+                       ClassRef aClass = new ClassRef(nsName,name,metaData);
+                       metaData.AddToTable(MDTable.TypeRef,aClass);
+                       aClass.SetParent(this);
+                       return aClass;
+               }
+
+               public ClassRef AddValueClass (string nsName, string name)
+               {
+                       ClassRef aClass = AddClass (nsName, name);
+                       aClass.MakeValueClass (ValueClass.ValueType);
+                       return aClass;
+               }
+
+               internal void SetParent(IResolutionScope par) 
+               {
+                       parent = par;
+               }
+
+               internal override string TypeName() 
+               {
+                       if ((parent != null) && (parent is AssemblyRef))
+                               return (nameSpace + "." + name + ", " + ((AssemblyRef)parent).TypeName());
+                       else 
+                               return (nameSpace + name);
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.CodedIndexSize(CIx.ResolutionScope) + 2 * 
+                               md.StringsIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteCodedIndex(CIx.ResolutionScope,(MetaDataElement) parent);
+                       output.StringsIndex(nameIx);
+                       output.StringsIndex(nameSpaceIx);
+               }
+
+               internal override sealed uint TypeDefOrRefToken() 
+               {
+                       uint cIx = Row;
+                       cIx = (cIx << 2) | 0x1;
+                       return cIx;
+               }
+
+               internal override void TypeSig(MemoryStream sig) 
+               {
+                       sig.WriteByte(GetTypeIndex());
+                       MetaData.CompressNum(TypeDefOrRefToken(),sig);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.TypeDefOrRef) : return 1; 
+                               case (CIx.HasCustomAttr) : return 2; 
+                               case (CIx.MemberRefParent) : return 1; 
+                               case (CIx.ResolutionScope) : return 3; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       /**************************************************************************/  
+       public class ExternClassRef : ClassRef {
+
+               ExternClass externClass;
+
+               internal ExternClassRef(TypeAttr attrs, string nsName, string name,
+                               FileRef declFile, MetaData md) : base(nsName,name,md) 
+               {
+                       externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declFile);
+                       metaData.AddToTable(MDTable.ExportedType,externClass);
+               }
+
+               internal ExternClassRef(string name, MetaData md) : base(null,name,md) 
+               {
+               }
+
+               public ClassRef AddNestedClass(TypeAttr attrs, string name) 
+               {
+                       ExternClassRef nestedClass = new ExternClassRef(name,metaData);
+                       externClass = new ExternClass(attrs,0,nameIx,this.externClass);
+                       metaData.AddToTable(MDTable.ExportedType,externClass);
+                       return nestedClass;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a class defined in another module of THIS assembly 
+       /// and exported (.class extern)
+       /// </summary>
+
+       internal class ExternClass : Class {
+
+               MetaDataElement parent;
+               uint flags;
+
+               internal ExternClass(TypeAttr attr, uint nsIx, uint nIx, 
+                               MetaDataElement paren) : base(nsIx,nIx) 
+               {
+                       flags = (uint)attr;
+                       parent = paren;
+                       tabIx = MDTable.ExportedType;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 8 + 2* md.StringsIndexSize() + md.CodedIndexSize(CIx.Implementation);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(flags);
+                       output.Write(0);
+                       output.StringsIndex(nameIx);
+                       output.StringsIndex(nameSpaceIx);
+                       output.WriteCodedIndex(CIx.Implementation,parent);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 17; 
+                               case (CIx.Implementation) : return 2; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       public class MVar : Type {
+
+               private int index;
+
+               public MVar (int index) : base (0x1E) 
+               {
+                       this.index = index;
+                       tabIx = MDTable.TypeSpec;
+               }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+                       MetaData.CompressNum ((uint) index, str);
+               }
+       }
+
+       public class GenericTypeSpec : Type {
+
+               private int index;
+
+               public GenericTypeSpec (int index) : base (0x13) 
+               {
+                       this.index = index;
+                       tabIx = MDTable.TypeSpec;
+               }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+                       MetaData.CompressNum ((uint) index, str);
+               }
+       }
+
+       public class GenericTypeInst : Type {
+
+               private Type gen_type;
+               private Type[] gen_param;
+
+               public GenericTypeInst (Type gen_type, Type[] gen_param) : base (0x15)
+               {
+                       typeIndex = 0x15;
+                       this.gen_type = gen_type;
+                       this.gen_param = gen_param;
+                       tabIx = MDTable.TypeSpec;
+               }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+                       gen_type.TypeSig (str);
+                       MetaData.CompressNum ((uint) gen_param.Length, str);
+                       foreach (Type param in gen_param)
+                               param.TypeSig (str);
+               }
+       }
+
+       public class GenericMethodSig {
+
+               private Type[] gen_param;
+
+               public GenericMethodSig (Type[] gen_param)
+               {
+                       this.gen_param = gen_param;
+               }
+
+               internal void TypeSig (MemoryStream str)
+               {
+                       MetaData.CompressNum ((uint) gen_param.Length, str); // THIS IS NOT RIGHT, but works
+                       MetaData.CompressNum ((uint) gen_param.Length, str);
+                       foreach (Type param in gen_param)
+                               param.TypeSig (str);
+               }
+
+               internal uint GetSigIx (MetaData md)
+               {
+                       MemoryStream sig = new MemoryStream();
+                       TypeSig (sig);
+                       return md.AddToBlobHeap (sig.ToArray());
+               }
+       }
+
+       public class Sentinel : Type {
+
+               public Sentinel () : base (0x41) { }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+               }
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a FunctionPointer type
+       /// </summary>
+       /// 
+       public class MethPtrType : Type {
+
+               bool varArgMeth;
+               Type retType;
+               Type [] parList;
+               Type [] optParList;
+               CallConv callConv;
+               uint numPars;
+               uint numOptPars;
+               uint sigIx = 0;
+
+               /// <summary>
+               /// Create a new function pointer type
+               /// </summary>
+               /// <param name="meth">the function to be referenced</param>
+               public MethPtrType (CallConv callconv, Type retType, Type[] pars,
+                               bool varArgMeth, Type[] optPars) : base(0x1B) 
+               {
+                       this.retType = retType;
+                       callConv = callconv;
+                       parList = pars;
+                       this.varArgMeth = varArgMeth;
+                       if (parList != null) numPars = (uint)parList.Length;
+                       if (varArgMeth) {
+                               optParList = optPars;
+                               if (optParList != null) numOptPars = (uint)optParList.Length;
+                               callConv |= CallConv.Vararg;
+                       }
+                       tabIx = MDTable.TypeSpec;
+               }
+
+               internal sealed override void TypeSig(MemoryStream sig) 
+               {
+                       sig.WriteByte(typeIndex);
+                       // Bootlegged from method ref
+                       sig.WriteByte((byte)callConv);
+                       MetaData.CompressNum (numPars + numOptPars, sig);
+                       retType.TypeSig (sig);
+                       for (int i=0; i < numPars; i++) {
+                               parList[i].TypeSig (sig);
+                       }
+                       if (varArgMeth) {
+                               sig.WriteByte (0x41); // Write the sentinel
+                               for (int i=0; i < numOptPars; i++) {
+                                       optParList[i].TypeSig (sig);
+                               }
+                       }
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       MemoryStream sig = new MemoryStream();
+                       TypeSig(sig);
+                       sigIx = md.AddToBlobHeap(sig.ToArray());
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.BlobIndex(sigIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) { return 0x1B; }
+
+       }
+
+       #region Array Types
+       /* Classes for Arrays */
+
+       /// <summary>
+       /// The IL Array type
+       /// </summary>
+       public abstract class Array : Type {
+
+               protected Type elemType;
+               protected MetaData metaData;
+               protected string cnameSpace, cname;
+
+               internal Array(Type eType, byte TypeId) : base(TypeId) 
+               {
+                       elemType = eType;
+                       tabIx = MDTable.TypeSpec;
+               }
+       }
+
+       /// <summary>
+       /// Single dimensional array with zero lower bound
+       /// </summary>
+       public class ZeroBasedArray : Array {
+
+               /// <summary>
+               /// Create a new array  -   elementType[]
+               /// </summary>
+               /// <param name="elementType">the type of the array elements</param>
+               public ZeroBasedArray(Type elementType) : base (elementType, PrimitiveType.SZArray.GetTypeIndex ()) { }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+                       elemType.TypeSig(str); 
+               }
+
+       }
+
+       /// <summary>
+       /// Multi dimensional array with explicit bounds
+       /// </summary>
+       public class BoundArray : Array {
+               int[] lowerBounds;
+               int[] sizes;
+               uint numDims;
+
+               /// <summary>
+               /// Create a new multi dimensional array type 
+               /// eg. elemType[1..5,3..10,5,,] would be 
+               /// new BoundArray(elemType,5,[1,3,0],[5,10,4])
+               /// </summary>
+               /// <param name="elementType">the type of the elements</param>
+               /// <param name="dimensions">the number of dimensions</param>
+               /// <param name="loBounds">lower bounds of dimensions</param>
+               /// <param name="upBounds">upper bounds of dimensions</param>
+               public BoundArray(Type elementType, uint dimensions, int[] loBounds, 
+                               int[] upBounds) : base (elementType,0x14) 
+               {
+                       numDims = dimensions;
+                       lowerBounds = loBounds;
+                       sizes = new int[loBounds.Length];
+                       for (int i=0; i < loBounds.Length; i++) {
+                               sizes[i] = upBounds[i] - loBounds[i] + 1;
+                       }
+               }
+
+               /// <summary>
+               /// Create a new multi dimensional array type 
+               /// eg. elemType[5,10,20] would be new BoundArray(elemType,3,[5,10,20])
+               /// </summary>
+               /// <param name="elementType">the type of the elements</param>
+               /// <param name="dimensions">the number of dimensions</param>
+               /// <param name="size">the sizes of the dimensions</param>
+               public BoundArray(Type elementType, uint dimensions, int[] size) 
+                       : base (elementType,0x14) 
+               {
+                       numDims = dimensions;
+                       sizes = size;
+               }
+
+               /// <summary>
+               /// Create a new multi dimensional array type 
+               /// eg. elemType[,,] would be new BoundArray(elemType,3)
+               /// </summary>
+               /// <param name="elementType">the type of the elements</param>
+               /// <param name="dimensions">the number of dimensions</param>
+               public BoundArray(Type elementType, uint dimensions)
+                       : base (elementType,0x14) 
+               {
+                       numDims = dimensions;
+               }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+                       elemType.TypeSig(str);
+                       MetaData.CompressNum(numDims,str);
+                       if ((sizes != null) && (sizes.Length > 0))  {
+
+                               MetaData.CompressNum((uint)sizes.Length,str);
+                               for (int i=0; i < sizes.Length; i++) {
+                                       MetaData.CompressNum((uint)sizes[i],str);
+                               }
+                       } else str.WriteByte(0);
+                       if ((lowerBounds != null) && (lowerBounds.Length > 0)) {
+                               MetaData.CompressNum((uint)lowerBounds.Length,str);
+                               for (int i=0; i < lowerBounds.Length; i++) {
+                                       MetaData.CompressNum((uint)lowerBounds[i],str);
+                               }
+                       } else str.WriteByte(0);
+               }
+
+       }
+
+       #endregion
+
+
+       /* Empty interface for grouping TypeRef's possible ResolutionScope
+          namely : Module, ModuleRef, AssemblyRef and TypeRef */
+       public interface IResolutionScope  {
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for scopes (extended by Module, ModuleRef, Assembly, AssemblyRef)
+       /// </summary>
+       public abstract class ResolutionScope : MetaDataElement, IResolutionScope {
+
+               protected uint nameIx = 0;
+               protected MetaData metaData;
+               protected string name;
+
+               internal ResolutionScope(string name, MetaData md)
+               {
+                       metaData = md;
+                       this.name = name;
+                       nameIx = md.AddToStringsHeap(name);
+               }
+
+               internal string GetName() { return name; }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for THIS assembly (.assembly)
+       /// </summary>
+       public class Assembly : ResolutionScope  {
+
+               ushort majorVer, minorVer, buildNo, revisionNo;
+               uint flags;
+               uint hashAlgId;
+               uint keyIx = 0, cultIx = 0;
+               bool hasPublicKey = false;
+
+               internal Assembly(string name, MetaData md) : base(name,md) 
+               {
+                       tabIx = MDTable.Assembly;
+               }
+
+               /// <summary>
+               /// Add details about THIS assembly
+               /// </summary>
+               /// <param name="majVer">Major Version</param>
+               /// <param name="minVer">Minor Version</param>
+               /// <param name="bldNo">Build Number</param>
+               /// <param name="revNo">Revision Number</param>
+               /// <param name="key">Hash Key</param>
+               /// <param name="hash">Hash Algorithm</param>
+               /// <param name="cult">Culture</param>
+               public void AddAssemblyInfo(int majVer, int minVer, int bldNo, int revNo, 
+                               byte[] key, uint hash, string cult) 
+               {
+                       majorVer = (ushort)majVer;
+                       minorVer = (ushort)minVer;
+                       buildNo = (ushort)bldNo;
+                       revisionNo = (ushort)revNo;
+                       hashAlgId = hash;
+                       hasPublicKey = (key != null);
+                       keyIx = metaData.AddToBlobHeap(key);
+                       cultIx = metaData.AddToStringsHeap(cult);
+               }
+
+               /// <summary>
+               /// Add an attribute to THIS assembly
+               /// </summary>
+               /// <param name="aa">assembly attribute</param>
+               public void AddAssemblyAttr(AssemAttr aa) 
+               {
+                       flags |= (uint)aa;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 16 + md.BlobIndexSize() + 2 * md.StringsIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       //      Console.WriteLine("Writing assembly element with nameIx of " + nameIx + " at file offset " + output.Seek(0,SeekOrigin.Current));
+                       output.Write((uint)hashAlgId);
+                       output.Write(majorVer);
+                       output.Write(minorVer);
+                       output.Write(buildNo);
+                       output.Write(revisionNo);
+                       output.Write(flags);
+                       output.BlobIndex(keyIx);
+                       output.StringsIndex(nameIx);
+                       output.StringsIndex(cultIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 14; 
+                               case (CIx.HasDeclSecurity) : return 2; 
+                       }
+                       return 0;
+               }
+
+               internal bool HasPublicKey {
+                       get { return hasPublicKey; }
+               }
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for THIS module
+       /// </summary>
+       public class Module : ResolutionScope {
+
+               Guid mvid;
+               uint mvidIx = 0;
+
+               internal Module(string name, MetaData md) : base(name,md)       
+               {
+                       mvid = Guid.NewGuid();
+                       mvidIx = md.AddToGUIDHeap(mvid);
+                       tabIx = MDTable.Module;
+               }
+
+               public Guid Guid {
+                       get { return mvid; }
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2 + md.StringsIndexSize() + 3 * md.GUIDIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write((short)0);
+                       output.StringsIndex(nameIx);
+                       output.GUIDIndex(mvidIx);
+                       output.GUIDIndex(0);
+                       output.GUIDIndex(0);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 7; 
+                               case (CIx.ResolutionScope) : return 0;
+                       }
+                       return 0;
+               }
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for another module in THIS assembly
+       /// </summary>
+       public class ModuleRef : ResolutionScope, IExternRef {
+
+               internal ModuleRef(MetaData md, string name) : base(name,md) 
+               {
+                       tabIx = MDTable.ModuleRef;
+               }
+
+               /// <summary>
+               /// Add a class to this external module.  This is a class declared in
+               /// another module of THIS assembly.
+               /// </summary>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns>a descriptor for this class in another module</returns>
+               public ClassRef AddClass(string nsName, string name) 
+               {
+                       ClassRef aClass = new ClassRef(nsName,name,metaData);
+                       metaData.AddToTable(MDTable.TypeRef,aClass);
+                       aClass.SetParent(this);
+                       return aClass;
+               }
+
+               /// <summary>
+               /// Make a file descriptor to correspond to this module.  The file
+               /// descriptor will have the same name as the module descriptor
+               /// </summary>
+               /// <param name="hashBytes">the hash of the file</param>
+               /// <param name="hasMetaData">the file contains metadata</param>
+               /// <param name="entryPoint">the program entry point is in this file</param>
+               /// <returns>a descriptor for the file which contains this module</returns>
+               public FileRef MakeFile(byte[] hashBytes, bool hasMetaData, bool entryPoint) 
+               {
+                       FileRef file = new FileRef(nameIx,hashBytes,hasMetaData,entryPoint,metaData);
+                       metaData.AddToTable(MDTable.File,file);
+                       return file;
+               }
+
+               /// <summary>
+               /// Add a value class to this module.  This is a class declared in
+               /// another module of THIS assembly.
+               /// </summary>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns></returns>
+               public ClassRef AddValueClass(string nsName, string name) 
+               {
+                       ClassRef aClass = new ClassRef(nsName,name,metaData);
+                       metaData.AddToTable(MDTable.TypeRef,aClass);
+                       aClass.SetParent(this);
+                       aClass.MakeValueClass(ValueClass.ValueType);
+                       return aClass;
+               }
+
+               /// <summary>
+               /// Add a class which is declared public in this external module of
+               /// THIS assembly.  This class will be exported from this assembly.
+               /// The ilasm syntax for this is .extern class
+               /// </summary>
+               /// <param name="attrSet">attributes of the class to be exported</param>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">external class name</param>
+               /// <param name="declFile">the file where the class is declared</param>
+               /// <param name="isValueClass">is this class a value type?</param>
+               /// <returns>a descriptor for this external class</returns>
+               public ExternClassRef AddExternClass(TypeAttr attrSet, string nsName, 
+                               string name, FileRef declFile, 
+                               bool isValueClass) {
+                       ExternClassRef cRef = new ExternClassRef(attrSet,nsName,name,declFile,metaData);
+                       metaData.AddToTable(MDTable.TypeRef,cRef);
+                       cRef.SetParent(this);
+                       if (isValueClass) cRef.MakeValueClass(ValueClass.ValueType);
+                       return cRef;
+               }
+
+               /// <summary>
+               /// Add a "global" method in another module
+               /// </summary>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">method parameter types</param>
+               /// <returns>a descriptor for this method in anther module</returns>
+               public MethodRef AddMethod(string name, Type retType, Type[] pars) 
+               {
+                       MethodRef meth = new MethodRef(this,name,retType,pars,false,null);
+                       metaData.AddToTable(MDTable.MemberRef,meth);
+                       return meth;
+               }
+
+               /// <summary>
+               /// Add a vararg method to this class
+               /// </summary>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">parameter types</param>
+               /// <param name="optPars">optional param types for this vararg method</param>
+               /// <returns>a descriptor for this method</returns>
+               public MethodRef AddVarArgMethod(string name, Type retType, 
+                               Type[] pars, Type[] optPars) {
+                       MethodRef meth = new MethodRef(this,name,retType,pars,true,optPars);
+                       metaData.AddToTable(MDTable.MemberRef,meth);
+                       return meth;
+               }
+
+               /// <summary>
+               /// Add a field in another module
+               /// </summary>
+               /// <param name="name">field name</param>
+               /// <param name="fType">field type</param>
+               /// <returns>a descriptor for this field in another module</returns>
+               public FieldRef AddField(string name, Type fType) 
+               {
+                       FieldRef field = new FieldRef(this,name,fType);
+                       metaData.AddToTable(MDTable.MemberRef,field);
+                       return field;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.StringsIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.StringsIndex(nameIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 12; 
+                               case (CIx.MemberRefParent) : return 2; 
+                               case (CIx.ResolutionScope) : return 1; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       #region Classes for Constants
+       /// <summary>
+       /// Descriptor for a constant value
+       /// </summary>
+       public abstract class Constant {
+               protected uint size = 0;
+               protected Type type;
+               protected uint blobIndex;
+               protected bool addedToBlobHeap = false;
+
+               internal Constant() { }
+
+               internal virtual uint GetBlobIndex(MetaData md) { return 0; }
+
+               internal uint GetSize() { return size; }
+
+               internal byte GetTypeIndex() { return type.GetTypeIndex(); }
+
+               internal virtual void Write(BinaryWriter bw) {  }
+
+       }
+       /// <summary>
+       /// Descriptor for a constant value
+       /// </summary>
+       public abstract class DataConstant : Constant {
+               private uint dataOffset = 0;
+
+               internal DataConstant() { }
+
+               public uint DataOffset {
+                       get { return dataOffset; }
+                       set { dataOffset = value; }
+               }
+
+       }
+
+       /// <summary>
+       /// Boolean constant
+       /// </summary>
+       public class BoolConst : Constant {
+               bool val;
+
+               /// <summary>
+               /// Create a new boolean constant with the value "val"
+               /// </summary>
+               /// <param name="val">value of this boolean constant</param>
+               public BoolConst(bool val) 
+               {
+                       this.val = val;
+                       size = 1;
+                       type = PrimitiveType.Boolean;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               if (val) blobIndex = md.AddToBlobHeap((sbyte)1);
+                               else blobIndex = md.AddToBlobHeap((sbyte)0);
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       if (val) bw.Write((sbyte)1);
+                       else bw.Write((sbyte)0);
+               }
+
+       }
+
+       public class ByteArrConst : DataConstant {
+               byte[] val;
+
+               public ByteArrConst(byte[] val) 
+               {
+                       type = PrimitiveType.String;
+                       this.val = val;
+                       size = (uint)val.Length;
+               }
+
+               public Type Type {
+                       get { return type; }
+                       set { type = value; }
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               blobIndex = md.AddToBlobHeap(val);
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       bw.Write(val);
+               }
+
+       }
+
+       public class CharConst : Constant {
+               char val;
+
+               public CharConst(char val) 
+               {
+                       this.val = val;
+                       size = 2;
+                       type = PrimitiveType.Char;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               blobIndex = md.AddToBlobHeap(val);
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       bw.Write(val);
+               }
+
+       }
+
+       public class FloatConst : DataConstant {
+               float val;
+
+               public FloatConst(float val) 
+               {
+                       this.val = val;
+                       size = 4;
+                       type = PrimitiveType.Float32;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               blobIndex = md.AddToBlobHeap(val);
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       bw.Write(val);
+               }
+
+       }
+
+       public class DoubleConst : DataConstant {
+               double val;
+
+               public DoubleConst(double val) 
+               {
+                       this.val = val;
+                       size = 8;
+                       type = PrimitiveType.Float64;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               blobIndex = md.AddToBlobHeap(val);
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       bw.Write(val);
+               }
+
+       }
+
+       public class IntConst : DataConstant {
+               long val;
+
+               public IntConst(sbyte val) 
+               {
+                       this.val = val;
+                       size = 1;
+                       type = PrimitiveType.Int8;
+               }
+
+               public IntConst(short val) 
+               {
+                       this.val = val;
+                       size = 2;
+                       type = PrimitiveType.Int16;
+               }
+
+               public IntConst(int val) 
+               {
+                       this.val = val;
+                       size = 4;
+                       type = PrimitiveType.Int32;
+               }
+
+               public IntConst(long val) 
+               {
+                       this.val = val;
+                       size = 8;
+                       type = PrimitiveType.Int64;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               switch (size) {
+                                       case (1) : blobIndex = md.AddToBlobHeap((sbyte)val); break;
+                                       case (2) : blobIndex = md.AddToBlobHeap((short)val); break;
+                                       case (4) : blobIndex = md.AddToBlobHeap((int)val); break;
+                                       default : blobIndex = md.AddToBlobHeap(val); break; 
+                               }
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       switch (size) {
+                               case (1) : bw.Write((sbyte)val); break;
+                               case (2) : bw.Write((short)val); break;
+                               case (4) : bw.Write((int)val); break;
+                               default : bw.Write(val); break; 
+                       }
+               }
+
+       }
+
+       public class UIntConst : Constant {
+               long val;
+
+               public UIntConst(sbyte val) 
+               {
+                       this.val = val;
+                       size = 1;
+                       type = PrimitiveType.UInt8;
+               }
+               public UIntConst(short val) 
+               {
+                       this.val = val;
+                       size = 2;
+                       type = PrimitiveType.UInt16;
+               }
+               public UIntConst(int val) 
+               {
+                       this.val = val;
+                       size = 4;
+                       type = PrimitiveType.UInt32;
+               }
+               public UIntConst(long val) 
+               {
+                       this.val = val;
+                       size = 8;
+                       type = PrimitiveType.UInt64;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               switch (size) {
+                                       case (1) : blobIndex = md.AddToBlobHeap((sbyte)val); break;
+                                       case (2) : blobIndex = md.AddToBlobHeap((short)val); break;
+                                       case (4) : blobIndex = md.AddToBlobHeap((int)val); break;
+                                       default : blobIndex = md.AddToBlobHeap(val); break;
+                               }
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       switch (size) {
+                               case (1) : bw.Write((sbyte)val); break;
+                               case (2) : bw.Write((short)val); break;
+                               case (4) : bw.Write((int)val); break;
+                               default : bw.Write(val); break;
+                       }
+               }
+
+       }
+
+       public class StringConst : DataConstant {
+               string val;
+
+               public StringConst(string val) 
+               {
+                       this.val = val;
+                       size = (uint)val.Length;  // need to add null ??
+                       type = PrimitiveType.String;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               byte [] b = Encoding.Unicode.GetBytes (val);
+                               blobIndex = md.AddToBlobHeap(b);
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       bw.Write(val);
+               }
+
+       }
+
+       public class NullConst : Constant {
+
+               public NullConst() 
+               {
+                       size = 4;
+                       type = PrimitiveType.Class;
+               }
+
+               internal sealed override uint GetBlobIndex(MetaData md) 
+               {
+                       if (!addedToBlobHeap) {
+                               blobIndex = md.AddToBlobHeap((int)0);
+                               addedToBlobHeap = true;
+                       }
+                       return blobIndex;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       bw.Write((int)0); 
+               }
+
+       }
+
+       public class AddressConstant : DataConstant {
+               DataConstant data;
+
+               public AddressConstant(DataConstant dConst) 
+               {
+                       data = dConst;
+                       size = 4;
+                       type = PrimitiveType.TypedRef;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       ((FileImage)bw).WriteDataRVA(data.DataOffset);
+               }
+
+       }
+
+       public class RepeatedConstant : DataConstant {
+               DataConstant data;
+               uint repCount;
+
+               public RepeatedConstant(DataConstant dConst, int repeatCount) 
+               {
+                       data = dConst;
+                       repCount = (uint)repeatCount;
+                       int[] sizes = new int[1];
+                       sizes[0] = repeatCount;
+                       type = new BoundArray(type,1,sizes);
+                       size = data.GetSize() * repCount;
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       for (int i=0; i < repCount; i++) {
+                               data.Write(bw);
+                       }
+               }
+
+       }
+
+       public class ArrayConstant : DataConstant {
+               DataConstant[] dataVals;
+
+               public ArrayConstant(DataConstant[] dVals) 
+               {
+                       dataVals = dVals;
+                       for (int i=0; i < dataVals.Length; i++) {
+                               size += dataVals[i].GetSize();
+                       }
+               }
+
+               internal sealed override void Write(BinaryWriter bw) 
+               {
+                       for (int i=0; i < dataVals.Length; i++) {
+                               dataVals[i].Write(bw);
+                       }
+               }
+
+       }
+
+       public class ClassType : Constant {
+               string name;
+               Class desc;
+
+               public ClassType(string className) 
+               {
+                       name = className;
+                       type = PrimitiveType.ClassType;
+               }
+
+               public ClassType(Class classDesc) 
+               {
+                       desc = classDesc;
+                       type = PrimitiveType.ClassType;
+               }
+
+               internal override void Write(BinaryWriter bw) 
+               {
+                       if (name == null)  name = desc.TypeName();
+                       bw.Write(name);
+               }
+
+       }
+
+       #endregion
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a custom modifier of a type (modopt or modreq)
+       /// </summary>
+
+       public class CustomModifiedType : Type {
+
+               Type type;
+               Class cmodType;
+
+               /// <summary>
+               /// Create a new custom modifier for a type
+               /// </summary>
+               /// <param name="type">the type to be modified</param>
+               /// <param name="cmod">the modifier</param>
+               /// <param name="cmodType">the type reference to be associated with the type</param>
+               public CustomModifiedType(Type type, CustomModifier cmod, Class cmodType)
+                       : base((byte)cmod) 
+               {
+                       this.type = type;
+                       this.cmodType = cmodType;
+               }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+                       MetaData.CompressNum(cmodType.TypeDefOrRefToken(),str);
+                       type.TypeSig(str);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for Event and Property descriptors
+       /// </summary>
+
+       public class Feature : MetaDataElement {
+
+               internal enum MethodType : ushort { Setter = 0x01, Getter, Other = 0x04, AddOn = 0x08, 
+                       RemoveOn = 0x10, Fire = 0x20 }
+
+               private static readonly int INITSIZE = 5;
+               private static readonly ushort specialName = 0x200;
+               private static readonly ushort rtSpecialName = 0x400;
+
+               protected ClassDef parent;
+               protected ushort flags = 0;
+               protected string name;
+               protected int tide = 0;
+               protected uint nameIx;
+               protected MethodSemantics[] methods = new MethodSemantics[INITSIZE];
+
+               internal Feature(string name, ClassDef par) 
+               {
+                       parent = par;
+                       this.name = name;
+               }
+
+               internal void AddMethod(MethodDef meth, MethodType mType) 
+               {
+                       if (tide >= methods.Length) { 
+                               int len = methods.Length;
+                               MethodSemantics[] mTmp = methods;
+                               methods = new MethodSemantics[len * 2];
+                               for (int i=0; i < len; i++) {
+                                       methods[i] = mTmp[i];
+                               }
+                       }
+                       methods[tide++] = new MethodSemantics(mType,meth,this);
+               }
+
+               /// <summary>
+               /// Set the specialName attribute for this Event or Property
+               /// </summary>
+               public void SetSpecialName() 
+               {
+                       flags |= specialName;
+               }
+
+               /// <summary>
+               /// Set the RTSpecialName attribute for this Event or Property
+               /// </summary>
+               public void SetRTSpecialName() 
+               {
+                       flags |= rtSpecialName;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for an event
+       /// </summary>
+       public class Event : Feature {
+
+               Type eventType;
+
+               internal Event(string name, Type eType, ClassDef parent) 
+                       : base(name, parent) 
+               {
+                       eventType = eType;
+                       tabIx = MDTable.Event;
+               }
+
+               /// <summary>
+               /// Add the addon method to this event
+               /// </summary>
+               /// <param name="addon">the addon method</param>
+               public void AddAddon(MethodDef addon) 
+               {
+                       AddMethod(addon,MethodType.AddOn);
+               }
+
+               /// <summary>
+               /// Add the removeon method to this event
+               /// </summary>
+               /// <param name="removeOn">the removeon method</param>
+               public void AddRemoveOn(MethodDef removeOn) 
+               {
+                       AddMethod(removeOn,MethodType.RemoveOn);
+               }
+
+               /// <summary>
+               /// Add the fire method to this event
+               /// </summary>
+               /// <param name="fire">the fire method</param>
+               public void AddFire(MethodDef fire) 
+               {
+                       AddMethod(fire,MethodType.Fire);
+               }
+
+               /// <summary>
+               /// Add another method to this event
+               /// </summary>
+               /// <param name="other">the method to be added</param>
+               public void AddOther(MethodDef other) 
+               {
+                       AddMethod(other,MethodType.Other);
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       nameIx = md.AddToStringsHeap(name);
+                       for (int i=0; i < tide; i++) {
+                               md.AddToTable(MDTable.MethodSemantics,methods[i]);
+                       }
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2 + md.StringsIndexSize() + md.CodedIndexSize(CIx.TypeDefOrRef);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(flags);
+                       output.StringsIndex(nameIx);
+                       output.WriteCodedIndex(CIx.TypeDefOrRef,eventType);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 10; 
+                               case (CIx.HasSemantics) : return 0; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for the Property of a class
+       /// </summary>
+       public class Property : Feature {
+
+               private static readonly byte PropertyTag = 0x8;
+               MethodDef getterMeth;
+               ConstantElem constVal;
+               uint typeBlobIx = 0;
+               Type[] parList;
+               Type returnType;
+               uint numPars = 0;
+
+               internal Property(string name, Type retType, Type[] pars, ClassDef parent) : base(name, parent) 
+               {
+                       returnType = retType;
+                       parList = pars;
+                       if (pars != null) numPars = (uint)pars.Length;
+                       tabIx = MDTable.Property;
+               }
+
+               /// <summary>
+               /// Add a set method to this property
+               /// </summary>
+               /// <param name="setter">the set method</param>
+               public void AddSetter(MethodDef setter) 
+               {
+                       AddMethod(setter,MethodType.Setter);
+               }
+
+               /// <summary>
+               /// Add a get method to this property
+               /// </summary>
+               /// <param name="getter">the get method</param>
+               public void AddGetter(MethodDef getter) 
+               {
+                       AddMethod(getter,MethodType.Getter);
+                       getterMeth = getter;
+               }
+
+               /// <summary>
+               /// Add another method to this property
+               /// </summary>
+               /// <param name="other">the method</param>
+               public void AddOther(MethodDef other) 
+               {
+                       AddMethod(other,MethodType.Other);
+               }
+
+               /// <summary>
+               /// Add an initial value for this property
+               /// </summary>
+               /// <param name="constVal">the initial value for this property</param>
+               public void AddInitValue(Constant constVal) 
+               {
+                       this.constVal = new ConstantElem(this,constVal);
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       nameIx = md.AddToStringsHeap(name);
+                       MemoryStream sig = new MemoryStream();
+                       sig.WriteByte(PropertyTag);
+                       MetaData.CompressNum(numPars,sig);
+                       returnType.TypeSig(sig);
+                       for (int i=0; i < numPars; i++) {
+                               parList[i].TypeSig(sig);
+                       }
+                       typeBlobIx = md.AddToBlobHeap(sig.ToArray());
+                       for (int i=0; i < tide; i++) {
+                               md.AddToTable(MDTable.MethodSemantics,methods[i]);
+                       }
+                       if (constVal != null) {
+                               md.AddToTable(MDTable.Constant,constVal);
+                               constVal.BuildTables(md);
+                       }
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2 + md.StringsIndexSize() + md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(flags);
+                       output.StringsIndex(nameIx);
+                       output.BlobIndex(typeBlobIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 9; 
+                               case (CIx.HasConst) : return 2; 
+                               case (CIx.HasSemantics) : return 1; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for field/methods (member of a class)
+       /// </summary>
+       public abstract class Member : MetaDataElement {
+
+               protected string name;
+               protected uint nameIx = 0, sigIx = 0;
+
+               internal Member(string memName)
+               {
+                       name = memName;
+                       tabIx = MDTable.MemberRef;
+               }
+
+       }
+
+       /*****************************************************************************/  
+       /// <summary>
+       /// Descriptor for a field of a class
+       /// </summary>
+
+       public abstract class Field : Member {
+
+               protected static readonly byte FieldSig = 0x6;
+
+               protected Type type;
+
+               internal Field(string pfName, Type pfType) : base(pfName)
+               {
+                       type = pfType;
+               }
+
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a field defined in a class of THIS assembly/module
+       /// </summary>
+       public class FieldDef : Field {
+
+               //private static readonly uint PInvokeImpl = 0x2000;
+               private static readonly ushort HasFieldRVA = 0x100;
+               private static readonly ushort HasDefault = 0x8000;
+
+               FieldRVA rva;
+               ConstantElem constVal;
+               FieldLayout layout;
+               FieldMarshal marshalInfo;
+               ushort flags;
+
+               internal FieldDef(string name, Type fType) : base(name,fType) 
+               {
+                       tabIx = MDTable.Field;
+               }
+
+               internal FieldDef(FieldAttr attrSet, string name, Type fType) : base(name, fType) 
+               {
+                       flags = (ushort)attrSet;
+                       tabIx = MDTable.Field;
+               }
+
+               /// <summary>
+               /// Add an attribute(s) to this field
+               /// </summary>
+               /// <param name="fa">the attribute(s) to be added</param>
+               public void AddFieldAttr(FieldAttr fa) 
+               {
+                       flags |= (ushort)fa;
+               }
+
+               /// <summary>
+               /// Add a value for this field
+               /// </summary>
+               /// <param name="val">the value for the field</param>
+               public void AddValue(Constant val) 
+               {
+                       constVal = new ConstantElem(this,val);
+                       flags |= HasDefault;
+               }
+
+               /// <summary>
+               /// Add an initial value for this field (at dataLabel) (.data)
+               /// </summary>
+               /// <param name="val">the value for the field</param>
+               /// <param name="repeatVal">the number of repetitions of this value</param>
+               public void AddDataValue(DataConstant val) 
+               {
+                       flags |= HasFieldRVA;
+                       rva = new FieldRVA(this,val);
+               }
+
+               /// <summary>
+               /// Set the offset of the field.  Used for sequential or explicit classes.
+               /// (.field [offs])
+               /// </summary>
+               /// <param name="offs">field offset</param>
+               public void SetOffset(uint offs) 
+               {
+                       layout = new FieldLayout(this,offs);
+               }
+
+               /// <summary>
+               /// Set the marshalling info for a field
+               /// </summary>
+               /// <param name="mInf"></param>
+               public void SetMarshalInfo(NativeType marshallType) 
+               {
+                       flags |= (ushort) FieldAttr.HasFieldMarshal;
+                       marshalInfo = new FieldMarshal(this,marshallType);
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       nameIx = md.AddToStringsHeap(name);
+                       MemoryStream sig = new MemoryStream();
+                       sig.WriteByte(FieldSig);
+                       type.TypeSig(sig);
+                       sigIx = md.AddToBlobHeap(sig.ToArray());
+                       if (rva != null) {
+                               md.AddToTable(MDTable.FieldRVA,rva);
+                               rva.BuildTables(md);
+                       } else if (constVal != null) {
+                               md.AddToTable(MDTable.Constant,constVal);
+                               constVal.BuildTables(md);
+                       }
+                       if (layout != null) md.AddToTable(MDTable.FieldLayout,layout);
+                       if (marshalInfo != null) {
+                               md.AddToTable(MDTable.FieldMarshal,marshalInfo);
+                               marshalInfo.BuildTables(md);
+                       }
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 2 + md.StringsIndexSize() + md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(flags);
+                       output.StringsIndex(nameIx);
+                       output.BlobIndex(sigIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasConst) : return 0; 
+                               case (CIx.HasCustomAttr) : return 1; 
+                               case (CIx.HasFieldMarshal) : return 0; 
+                               case (CIx.MemberForwarded) : return 0; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a field of a class defined in another assembly/module
+       /// </summary>
+       public class FieldRef : Field {
+
+               MetaDataElement parent;
+
+               internal FieldRef(MetaDataElement paren, string name, Type fType) : base(name, fType)   
+               {
+                       parent = paren;
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       nameIx = md.AddToStringsHeap(name);
+                       MemoryStream sig = new MemoryStream();
+                       sig.WriteByte(FieldSig);
+                       type.TypeSig(sig);
+                       sigIx = md.AddToBlobHeap(sig.ToArray());
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.CodedIndexSize(CIx.MemberRefParent) + md.StringsIndexSize() + md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteCodedIndex(CIx.MemberRefParent,parent);
+                       output.StringsIndex(nameIx);
+                       output.BlobIndex(sigIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) { return 6; }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for Method Descriptors
+       /// </summary>
+
+       public abstract class Method : Member {
+
+               protected CallConv callConv = CallConv.Default;
+               protected Type retType;
+
+               internal Method(string methName, Type rType) : base(methName)
+               {
+                       retType = rType;
+               }
+
+               /// <summary>
+               /// Add calling conventions to this method descriptor
+               /// </summary>
+               /// <param name="cconv"></param>
+               public void AddCallConv(CallConv cconv) 
+               {
+                       callConv |= cconv;
+               }
+
+               internal abstract void TypeSig(MemoryStream sig);
+
+               internal uint GetSigIx(MetaData md) 
+               {
+                       MemoryStream sig = new MemoryStream();
+                       TypeSig(sig);
+                       return md.AddToBlobHeap(sig.ToArray());
+               }
+
+               internal Type GetRetType() 
+               {
+                       return retType;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a method defined in THIS assembly/module
+       /// IL     .method
+       /// </summary>
+
+       public class MethodDef : Method {
+
+               private static readonly ushort PInvokeImpl = 0x2000;
+               //private static readonly uint UnmanagedExport = 0x0008;
+               // private static readonly byte LocalSigByte = 0x7;
+               uint parIx = 0, textOffset = 0;
+
+               MetaData metaData;
+               CILInstructions code;
+               ArrayList securityActions = new ArrayList();
+               Param[] parList;
+               Local[] locals;
+               bool initLocals;
+               ushort methFlags = 0, implFlags = 0;
+               int maxStack = 0, numPars = 0;
+               bool entryPoint = false;
+               LocalSig localSig;
+               ArrayList varArgSigList;
+               ImplMap pinvokeImpl;
+               Param ret_param;
+
+
+               internal MethodDef(MetaData md, string name, Type retType, Param[] pars) : base(name,retType) 
+               {
+                       metaData = md;
+                       parList = pars;
+                       if (parList != null) numPars = parList.Length;
+                       tabIx = MDTable.Method;
+               }
+
+               internal MethodDef(MetaData md, MethAttr mAttrSet, ImplAttr iAttrSet, string name, Type retType, Param[] pars) : base(name,retType) 
+               {
+                       metaData = md;
+                       parList = pars;
+                       if (parList != null) numPars = parList.Length;
+                       // Console.WriteLine("Creating method " + name + " with " + numPars + " parameters");
+                       methFlags = (ushort)mAttrSet;
+                       implFlags = (ushort)iAttrSet;
+                       tabIx = MDTable.Method;
+               }
+
+               internal Param[] GetPars() 
+               {
+                       return parList;
+               }
+
+               /// <summary>
+               /// Add some attributes to this method descriptor
+               /// </summary>
+               /// <param name="ma">the attributes to be added</param>
+               public void AddMethAttribute(MethAttr ma) 
+               {
+                       methFlags |= (ushort)ma;
+               }
+
+               /// <summary>
+               /// Add some implementation attributes to this method descriptor
+               /// </summary>
+               /// <param name="ia">the attributes to be added</param>
+               public void AddImplAttribute(ImplAttr ia) 
+               {
+                       implFlags |= (ushort)ia;
+               }
+
+               public void AddPInvokeInfo(ModuleRef scope, string methName,
+                               PInvokeAttr callAttr) {
+                       pinvokeImpl = new ImplMap((ushort)callAttr,this,methName,scope);
+                       methFlags |= PInvokeImpl;
+               }
+
+               /// <summary>
+               ///  Add a named generic type parameter
+               /// </summary>
+               public GenericParameter AddGenericParameter (short index, string name) 
+               {
+                       GenericParameter gp = new GenericParameter (this, metaData, index, name);
+                       metaData.AddToTable (MDTable.GenericParam, gp);
+                       return gp;
+               }
+
+               /// <summary>
+               /// Set the maximum stack height for this method
+               /// </summary>
+               /// <param name="maxStack">the maximum height of the stack</param>
+               public void SetMaxStack(int maxStack) 
+               {
+                       this.maxStack = maxStack; 
+               }
+
+               /// <summary>
+               /// Add local variables to this method
+               /// </summary>
+               /// <param name="locals">the locals to be added</param>
+               /// <param name="initLocals">are locals initialised to default values</param>
+               public void AddLocals(Local[] locals, bool initLocals) 
+               {
+                       this.locals = locals;
+                       this.initLocals = initLocals;
+               }
+
+               /* Add Marshal info for return type */
+               public void AddRetTypeMarshallInfo (NativeType marshallType) 
+               {
+                       ret_param = new Param (ParamAttr.HasFieldMarshal, "", retType);
+                       ret_param.AddMarshallInfo (marshallType);
+               }
+
+               /// <summary>
+               /// Mark this method as having an entry point
+               /// </summary>
+               public void DeclareEntryPoint() 
+               {
+                       entryPoint = true;
+               }
+
+               /// <summary>
+               /// Create a code buffer for this method to add the IL instructions to
+               /// </summary>
+               /// <returns>a buffer for this method's IL instructions</returns>
+               public CILInstructions CreateCodeBuffer() 
+               {
+                       code = new CILInstructions(metaData);
+                       return code;
+               }
+
+               /// <summary>
+               /// Make a method reference descriptor for this method to be used 
+               /// as a callsite signature for this vararg method
+               /// </summary>
+               /// <param name="optPars">the optional pars for the vararg method call</param>
+               /// <returns></returns>
+               public MethodRef MakeVarArgSignature(Type[] optPars) 
+               {
+                       Type[] pars = new Type[numPars];
+                       MethodRef varArgSig;
+                       for (int i=0; i < numPars; i++) {
+                               pars[i] = parList[i].GetParType();
+                       }
+                       varArgSig = new MethodRef(this,name,retType,pars,true,optPars);
+
+                       if (varArgSigList == null)
+                               varArgSigList = new ArrayList ();
+                       varArgSigList.Add (varArgSig);
+                       return varArgSig;
+               }
+
+               internal sealed override void TypeSig(MemoryStream sig) 
+               {
+                       sig.WriteByte((byte)callConv);
+                       MetaData.CompressNum((uint)numPars,sig);
+                       if (ret_param != null)
+                               ret_param.seqNo = 0;
+                       retType.TypeSig(sig);
+                       for (ushort i=0; i < numPars; i++) {
+                               parList[i].seqNo = (ushort)(i+1);
+                               parList[i].TypeSig(sig);
+                       }
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       if (pinvokeImpl != null) {
+                               md.AddToTable(MDTable.ImplMap,pinvokeImpl);
+                               pinvokeImpl.BuildTables(md);
+                       }
+                       if (entryPoint) md.SetEntryPoint(this);
+                       uint locToken = 0;
+                       if (locals != null) {
+                               localSig = new LocalSig(locals);
+                               md.AddToTable(MDTable.StandAloneSig,localSig);
+                               localSig.BuildTables(md);
+                               locToken = localSig.Token();
+                       }
+                       if (code != null) {
+                               code.CheckCode(locToken,initLocals,maxStack);
+                               textOffset = md.AddCode(code);
+                       }
+                       nameIx = md.AddToStringsHeap(name);
+                       sigIx = GetSigIx(md);
+                       parIx = md.TableIndex(MDTable.Param);
+                       if (ret_param != null) {
+                               md.AddToTable(MDTable.Param, ret_param);
+                               ret_param.BuildTables(md);
+                       }
+                       for (int i=0; i < numPars; i++) {
+                               md.AddToTable(MDTable.Param,parList[i]);
+                               parList[i].BuildTables(md);
+                       }
+                       if (varArgSigList != null) {
+                               foreach (MethodRef varArgSig in varArgSigList) {
+                                       md.AddToTable(MDTable.MemberRef,varArgSig);
+                                       varArgSig.BuildTables(md);
+                               }
+                       }
+                       // Console.WriteLine("method has " + numPars + " parameters");
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 8 + md.StringsIndexSize() + md.BlobIndexSize() + md.TableIndexSize(MDTable.Param);
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       if (ZeroRva ()) output.Write(0);
+                       else output.WriteCodeRVA(textOffset);
+                       output.Write(implFlags);
+                       output.Write(methFlags);
+                       output.StringsIndex(nameIx);
+                       output.BlobIndex(sigIx);
+                       output.WriteIndex(MDTable.Param,parIx);
+               }
+
+               internal bool ZeroRva () 
+               {
+                       return (((methFlags & (ushort)MethAttr.Abstract) != 0) ||
+                                       ((implFlags & (ushort)ImplAttr.Runtime) != 0) ||
+                                       ((implFlags & (ushort)ImplAttr.InternalCall) != 0) || 
+                                       (pinvokeImpl != null)); // TODO: Not entirely true but works for now
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 0; 
+                               case (CIx.HasDeclSecurity) : return 1; 
+                               case (CIx.MemberRefParent) : return 3; 
+                               case (CIx.MethodDefOrRef) : return 0; 
+                               case (CIx.MemberForwarded) : return 1; 
+                               case (CIx.CustomAttributeType) : return 2; 
+                               case (CIx.TypeOrMethodDef) : return 1; 
+                       }
+                       return 0;
+               }
+
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a method defined in another assembly/module
+       /// </summary>
+       public class MethodRef : Method {
+
+               private static readonly byte Sentinel = 0x41;
+               Type[] parList, optParList;
+               MetaDataElement parent;
+               uint numPars = 0, numOptPars = 0;
+
+               internal MethodRef(MetaDataElement paren, string name, Type retType,
+                               Type[] pars, bool varArgMeth, Type[] optPars) : base(name,retType) 
+               {
+                       parent = paren;
+                       parList = pars;
+                       if (parList != null) numPars = (uint)parList.Length;
+                       if (varArgMeth) {
+                               optParList = optPars;
+                               if (optParList != null) numOptPars = (uint)optParList.Length;
+                               callConv = CallConv.Vararg;
+                       }
+               }
+
+               internal sealed override void TypeSig(MemoryStream sig) 
+               {
+                       sig.WriteByte((byte)callConv);
+                       MetaData.CompressNum(numPars+numOptPars,sig);
+                       retType.TypeSig(sig);
+                       for (int i=0; i < numPars; i++) {
+                               parList[i].TypeSig(sig);
+                       }
+                       if (numOptPars > 0) {
+                               sig.WriteByte(Sentinel);
+                               for (int i=0; i < numOptPars; i++) {
+                                       optParList[i].TypeSig(sig);
+                               }
+                       }
+               }
+
+               internal sealed override void BuildTables(MetaData md) 
+               {
+                       if (done) return;
+                       nameIx = md.AddToStringsHeap(name);
+                       sigIx = GetSigIx(md);
+                       done = true;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return md.CodedIndexSize(CIx.MemberRefParent) + md.StringsIndexSize() + md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.WriteCodedIndex(CIx.MemberRefParent,parent);
+                       output.StringsIndex(nameIx);
+                       output.BlobIndex(sigIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 6; 
+                               case (CIx.MethodDefOrRef) : return 1; 
+                               case (CIx.CustomAttributeType) : return 3; 
+                       }
+                       return 0;
+               }
+
+       }
+
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptors for native types used for marshalling
+       /// </summary>
+       public class NativeType {
+               public static readonly NativeType Void = new NativeType(0x01);
+               public static readonly NativeType Boolean = new NativeType(0x02);
+               public static readonly NativeType Int8 = new NativeType(0x03);
+               public static readonly NativeType UInt8 = new NativeType(0x04);
+               public static readonly NativeType Int16 = new NativeType(0x05);
+               public static readonly NativeType UInt16 = new NativeType(0x06);
+               public static readonly NativeType Int32 = new NativeType(0x07);
+               public static readonly NativeType UInt32 = new NativeType(0x08);
+               public static readonly NativeType Int64 = new NativeType(0x09);
+               public static readonly NativeType UInt64 = new NativeType(0x0A);
+               public static readonly NativeType Float32 = new NativeType(0x0B);
+               public static readonly NativeType Float64 = new NativeType(0x0C);
+               public static readonly NativeType Currency = new NativeType(0x0F);
+               public static readonly NativeType BStr = new NativeType(0x13);
+               public static readonly NativeType LPStr = new NativeType(0x14);
+               public static readonly NativeType LPWStr = new NativeType(0x15);
+               public static readonly NativeType LPTStr = new NativeType(0x16);
+               public static readonly NativeType FixedSysString = new NativeType(0x17);
+               public static readonly NativeType IUnknown = new NativeType(0x19);
+               public static readonly NativeType IDispatch = new NativeType(0x1A);
+               public static readonly NativeType Struct = new NativeType(0x1B);
+               public static readonly NativeType Interface = new NativeType(0x1C);
+               public static readonly NativeType Int = new NativeType(0x1F);
+               public static readonly NativeType UInt = new NativeType(0x20);
+               public static readonly NativeType ByValStr = new NativeType(0x22);
+               public static readonly NativeType AnsiBStr = new NativeType(0x23);
+               public static readonly NativeType TBstr = new NativeType(0x24);
+               public static readonly NativeType VariantBool = new NativeType(0x25);
+               public static readonly NativeType FuncPtr = new NativeType(0x26);
+               public static readonly NativeType AsAny = new NativeType(0x28);
+
+               protected byte typeIndex;
+
+               internal NativeType(byte tyIx) { typeIndex = tyIx; }
+               internal byte GetTypeIndex() { return typeIndex; }
+
+               internal virtual byte[] ToBlob() 
+               {
+                       byte[] bytes = new byte[1];
+                       bytes[0] = GetTypeIndex();
+                       return bytes;
+               }
+
+       }
+
+       public class FixedSysString : NativeType  {
+
+               uint size;
+
+               public FixedSysString (uint size) : base (NativeType.FixedSysString.GetTypeIndex ())
+               {
+                       this.size = size;
+               }
+
+               internal override byte [] ToBlob () 
+               {
+                       MemoryStream str = new MemoryStream ();
+                       str.WriteByte (GetTypeIndex ());
+                       MetaData.CompressNum (size, str);
+                       return str.ToArray ();
+               }
+
+       }  
+
+       public class NativeArray : NativeType  {
+
+               NativeType elemType;
+               int numElem = -1, parNum = -1, elemMult = -1;
+
+               public NativeArray(NativeType elemType) : this (elemType, -1, -1, -1) 
+               {
+                       this.elemType = elemType;
+               }
+
+               /*    public NativeArray(NativeType elemType, int len) : base(0x2A) {
+                     this.elemType = elemType;
+                     this.len = len;
+                     }
+                */
+
+               public NativeArray(NativeType elemType, int numElem, int parNumForLen, int elemMult) : base(0x2A) 
+               {
+                       this.elemType = elemType;
+                       this.numElem = numElem;
+                       parNum = parNumForLen;
+                       this.elemMult = elemMult;
+               }
+
+               public NativeArray(NativeType elemType, int numElem, int parNumForLen) 
+                       : this (elemType, numElem, parNumForLen, -1) 
+               {
+               }
+
+               internal override byte[] ToBlob() 
+               {
+                       MemoryStream str = new MemoryStream();
+                       str.WriteByte(GetTypeIndex());
+                       if (elemType == null) str.WriteByte(0x50);  // no info (MAX)
+                       else str.WriteByte(elemType.GetTypeIndex());
+
+                       /* see : mono/metadata/metadata.c:mono_metadata_parse_marshal_spec
+                        * LAMESPEC: Older spec versions say elemMult comes before
+                        * len. Newer spec versions don't talk about elemMult at
+                        * all, but csc still emits it, and it is used to distinguish
+                        * between parNum being 0, and parNum being omitted.
+                        */
+
+                       if (parNum == -1)
+                               // <native_type> []
+                               return str.ToArray ();
+
+                       MetaData.CompressNum((uint) parNum,str);
+                       if (numElem != -1) {
+                               MetaData.CompressNum ((uint) numElem, str);
+                               if (elemMult != -1)
+                                       // <native_type> [ int32 ]
+                                       MetaData.CompressNum((uint) elemMult,str);
+                               //else <native_type> [ int32 + int32 ]
+                       } else if (elemMult != -1) {
+                               // When can this occur ?
+                               MetaData.CompressNum (0, str);
+                               MetaData.CompressNum((uint) elemMult,str);
+                       }
+                       //else <native_type> [ + int32 ]
+
+                       return str.ToArray();
+               }
+
+       }
+
+       public class SafeArray : NativeType  {
+
+               SafeArrayType elemType;
+               bool hasElemType;
+
+               public SafeArray() : base(0x1D) 
+               {
+               }
+
+               public SafeArray(SafeArrayType elemType) : base(0x1D) 
+               {
+                       this.elemType = elemType;
+                       hasElemType = true;
+               }
+
+               internal override byte[] ToBlob() 
+               {
+                       byte[] bytes = new byte[hasElemType ? 2 : 1];
+                       bytes[0] = GetTypeIndex();
+                       if (hasElemType)
+                               bytes[1] = (byte)elemType;
+                       return bytes;
+               }
+
+       }
+
+       public class FixedArray : NativeType  {
+
+               NativeType elemType;
+               uint numElem;
+
+               //public FixedArray(NativeType elemType, int numElems) : base(0x1E) {
+               public FixedArray(int numElems) : base(0x1E) 
+               {
+                       //this.elemType = elemType;
+                       numElem = (uint)numElems;
+               }
+
+               internal override byte[] ToBlob() 
+               {
+                       MemoryStream str = new MemoryStream();
+                       str.WriteByte(GetTypeIndex());
+                       MetaData.CompressNum(numElem,str);
+                       /* FIXME: 
+                          fixed array [5] lpstr [2]
+                          This format is not supported by ilasm 1.1.4322.2032, 
+                          but is supported by 2.0.5125..
+                          ilasm 1.1 only supports "fixed array [5]" 
+                          if (elemType == null) str.WriteByte(0x50);  // no info (MAX)
+                          else str.WriteByte(elemType.GetTypeIndex());*/
+
+                       return str.ToArray();
+               }
+
+       }
+
+       public class CustomMarshaller : NativeType  {
+
+               string typeName;
+               string marshallerName;
+               string cookie;
+
+               public CustomMarshaller(string typeNameOrGUID, string marshallerName, 
+                               string optCookie) : base(0x2C) 
+               {
+                       typeName = typeNameOrGUID;
+                       this.marshallerName = marshallerName;
+                       cookie = optCookie;
+               }
+
+               public CustomMarshaller(string marshallerName, string optCookie)
+                       :this (null, marshallerName, optCookie) 
+               {
+               }
+
+               internal override byte[] ToBlob() 
+               {
+                       MemoryStream str = new MemoryStream();
+                       BinaryWriter bw = new BinaryWriter(str,new UTF8Encoding());
+                       bw.Write(GetTypeIndex());
+                       //Native type name & unmanaged type - unused
+                       //See mono/metadata/metadata.c : mono_metadata_parse_marshal_spec
+                       bw.Write ((byte) 0); // Native Type name, unused 
+                       bw.Write ((byte) 0); // Unmanaged type, unused 
+                       if (marshallerName != null) {
+                               MetaData.CompressNum ((uint)marshallerName.Length, str);
+                               bw.Write(marshallerName.ToCharArray());
+                       } else { 
+                               bw.Write ((byte) 0);
+                       }
+                       if (cookie != null) {
+                               MetaData.CompressNum ((uint)cookie.Length, str);
+                               bw.Write(cookie.ToCharArray());
+                       } else {
+                               bw.Write ((byte) 0);
+                       }
+                       bw.Flush();
+                       return str.ToArray();
+               }
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for the Primitive types defined in IL
+       /// </summary>
+       public class PrimitiveType : Type {
+
+               private string name;
+               private int systemTypeIndex;
+               public static int NumSystemTypes = 18;
+
+               public static readonly PrimitiveType Void = new PrimitiveType(0x01,"Void",0);
+               public static readonly PrimitiveType Boolean = new PrimitiveType(0x02,"Boolean",1);
+               public static readonly PrimitiveType Char = new PrimitiveType(0x03,"Char",2);
+               public static readonly PrimitiveType Int8 = new PrimitiveType(0x04,"SByte",3);
+               public static readonly PrimitiveType UInt8 = new PrimitiveType(0x05,"Byte",4);
+               public static readonly PrimitiveType Int16 = new PrimitiveType(0x06,"Int16",5);
+               public static readonly PrimitiveType UInt16 = new PrimitiveType(0x07,"UInt16",6);
+               public static readonly PrimitiveType Int32 = new PrimitiveType(0x08,"Int32",7);
+               public static readonly PrimitiveType UInt32 = new PrimitiveType(0x09,"UInt32",8);
+               public static readonly PrimitiveType Int64 = new PrimitiveType(0x0A,"Int64",9);
+               public static readonly PrimitiveType UInt64 = new PrimitiveType(0x0B,"UInt64",10);
+               public static readonly PrimitiveType Float32 = new PrimitiveType(0x0C,"Single",11);
+               public static readonly PrimitiveType Float64 = new PrimitiveType(0x0D,"Double",12);
+               public static readonly PrimitiveType String = new PrimitiveType(0x0E,"String",13);
+               internal static readonly PrimitiveType Class = new PrimitiveType(0x12);
+               public static readonly PrimitiveType TypedRef = new PrimitiveType(0x16,"TypedReference",14);
+               public static readonly PrimitiveType IntPtr = new PrimitiveType(0x18,"IntPtr",15);
+               public static readonly PrimitiveType UIntPtr = new PrimitiveType(0x19,"UIntPtr",16);
+               public static readonly PrimitiveType Object = new PrimitiveType(0x1C,"Object",17);
+               internal static readonly PrimitiveType ClassType = new PrimitiveType(0x50);
+               internal static readonly PrimitiveType SZArray = new PrimitiveType(0x1D);
+               internal static readonly PrimitiveType ValueType = new PrimitiveType(0x11, "ValueType", 18);
+               public static readonly PrimitiveType NativeInt = IntPtr;
+               public static readonly PrimitiveType NativeUInt = UIntPtr;
+
+               internal PrimitiveType(byte typeIx) : base(typeIx) { }
+
+               internal PrimitiveType(byte typeIx, string name, int STIx) : base(typeIx) 
+               {
+                       this.name = name;
+                       this.systemTypeIndex = STIx;
+               }
+
+               internal string GetName() { return name; }
+
+               internal int GetSystemTypeIx() { return systemTypeIndex; }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+               }
+
+               internal override MetaDataElement GetTypeSpec(MetaData md) 
+               {
+                       TypeSpec tS = md.GetPrimitiveTypeSpec(systemTypeIndex);
+                       if (tS == null) {
+                               tS = new TypeSpec(this,md);
+                               md.SetPrimitiveTypeSpec(systemTypeIndex,tS);
+                               md.AddToTable(MDTable.TypeSpec,tS);
+                       }
+                       return tS;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for an pointer (type * or type &)
+       /// </summary>
+       public abstract class PtrType : Type {
+
+               Type baseType;
+
+               internal PtrType(Type bType, byte typeIx) : base(typeIx)
+               {
+                       baseType = bType;
+                       tabIx = MDTable.TypeSpec;
+               }
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(typeIndex);
+                       baseType.TypeSig(str);
+               }
+
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a managed pointer (type &  or byref)
+       /// </summary>
+
+       public class ManagedPointer : PtrType {
+
+               /// <summary>
+               /// Create new managed pointer to baseType
+               /// </summary>
+               /// <param name="bType">the base type of the pointer</param>
+               public ManagedPointer(Type baseType) : base(baseType,0x10) { }
+
+       }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for an unmanaged pointer (type *)
+       /// </summary>
+       public class UnmanagedPointer : PtrType {
+
+               /// <summary>
+               /// Create a new unmanaged pointer to baseType
+               /// </summary>
+               /// <param name="baseType">the base type of the pointer</param>
+               public UnmanagedPointer(Type baseType) : base(baseType, 0x0F) { }
+
+       }
+
+       /**************************************************************************/  
+
+       public interface IExternRef  {
+               ClassRef AddClass(string nsName, string name);
+               ClassRef AddValueClass(string nsName, string name);
+       }
+
+       /// <summary>
+       /// A reference to an external assembly (.assembly extern)
+       /// </summary>
+       public class AssemblyRef : ResolutionScope, IExternRef {
+
+               private ushort major, minor, build, revision;
+               uint flags, keyIx, hashIx, cultIx;
+               bool hasVersion = false, isKeyToken = false;
+               byte[] keyBytes;
+               string culture;
+
+               internal AssemblyRef(MetaData md, string name) : base(name,md) 
+               {
+                       tabIx = MDTable.AssemblyRef;
+               }
+
+               /// <summary>
+               /// Add version information about this external assembly
+               /// </summary>
+               /// <param name="majVer">Major Version</param>
+               /// <param name="minVer">Minor Version</param>
+               /// <param name="bldNo">Build Number</param>
+               /// <param name="revNo">Revision Number</param>
+               public void AddVersionInfo(int majVer, int minVer, int bldNo, int revNo) 
+               {
+                       major = (ushort)majVer;
+                       minor = (ushort)minVer;
+                       build = (ushort)bldNo;
+                       revision = (ushort)revNo;
+                       hasVersion = true;
+               }
+
+               /// <summary>
+               /// Add the hash value for this external assembly
+               /// </summary>
+               /// <param name="hash">bytes of the hash value</param>
+               public void AddHash(byte[] hash) 
+               {
+                       hashIx = metaData.AddToBlobHeap(hash); 
+               }
+
+               /// <summary>
+               /// Set the culture for this external assembly
+               /// </summary>
+               /// <param name="cult">the culture string</param>
+               public void AddCulture(string cult) 
+               {
+                       cultIx = metaData.AddToStringsHeap(cult);
+                       culture = cult;
+               }
+
+               /// <summary>
+               /// Add the full public key for this external assembly
+               /// </summary>
+               /// <param name="key">bytes of the public key</param>
+               public void AddKey(byte[] key) 
+               {
+                       flags |= 0x0001;   // full public key
+                       keyBytes = key;
+                       keyIx = metaData.AddToBlobHeap(key); 
+               }
+
+               /// <summary>
+               /// Add the public key token (low 8 bytes of the public key)
+               /// </summary>
+               /// <param name="key">low 8 bytes of public key</param>
+               public void AddKeyToken(byte[] key) 
+               {
+                       keyIx = metaData.AddToBlobHeap(key); 
+                       keyBytes = key;
+                       isKeyToken = true;
+               }
+
+               /// <summary>
+               /// Add a class to this external assembly
+               /// </summary>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns></returns>
+               public virtual ClassRef AddClass(string nsName, string name) 
+               {
+                       ClassRef aClass = new ClassRef(nsName,name,metaData);
+                       metaData.AddToTable(MDTable.TypeRef,aClass);
+                       aClass.SetParent(this);
+                       return aClass;
+               }
+
+               /// <summary>
+               /// Add a value class to this external assembly
+               /// </summary>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns></returns>
+               public virtual ClassRef AddValueClass(string nsName, string name) 
+               {
+                       ClassRef aClass = new ClassRef(nsName,name,metaData);
+                       metaData.AddToTable(MDTable.TypeRef,aClass);
+                       aClass.SetParent(this);
+                       aClass.MakeValueClass(ValueClass.ValueType);
+                       return aClass;
+               }
+
+               internal string TypeName() 
+               {
+                       string result = name;
+                       if (hasVersion) 
+                               result = result + ", Version=" + major + "." + minor + "." + 
+                                       build + "." + revision;
+                       if (keyBytes != null) {
+                               string tokenStr = "=";
+                               if (isKeyToken) tokenStr = "Token=";
+                               result = result + ", PublicKey" + tokenStr;
+                               for (int i=0; i < keyBytes.Length; i++) {
+                                       result = result + Hex.Byte(keyBytes[i]);
+                               }
+                       }
+                       if (culture != null) 
+                               result = result + ", Culture=" + culture;
+                       return result;
+               }
+
+               internal sealed override uint Size(MetaData md) 
+               {
+                       return 12 + 2 * md.StringsIndexSize() + 2 * md.BlobIndexSize();
+               }
+
+               internal sealed override void Write(FileImage output) 
+               {
+                       output.Write(major);
+                       output.Write(minor);
+                       output.Write(build);
+                       output.Write(revision);
+                       output.Write(flags);
+                       output.BlobIndex(keyIx);
+                       output.StringsIndex(nameIx);
+                       output.StringsIndex(cultIx);
+                       output.BlobIndex(hashIx);
+               }
+
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.ResolutionScope) : return 2; 
+                               case (CIx.HasCustomAttr) : return 15; 
+                               case (CIx.Implementation) : return 1; 
+                       }
+                       return 0;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a class defined in System (mscorlib)
+       /// </summary>
+       internal class SystemClass : ClassRef {
+
+               PrimitiveType elemType; 
+
+               internal SystemClass(PrimitiveType eType, AssemblyRef paren, MetaData md)
+                       : base("System",eType.GetName(),md) {
+                               elemType = eType;
+                               parent = paren;
+                       }
+
+               internal override sealed MetaDataElement GetTypeSpec(MetaData md) 
+               {
+                       if (typeSpec == null) typeSpec = (TypeSpec)elemType.GetTypeSpec(md);
+                       return typeSpec;
+               }
+
+
+               internal sealed override void TypeSig(MemoryStream str) 
+               {
+                       str.WriteByte(elemType.GetTypeIndex());
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// The assembly for mscorlib.  
+       /// </summary>
+       public sealed class MSCorLib : AssemblyRef {
+
+               private static readonly int valueTypeIx = 18;
+               private readonly string systemName = "System";
+               private Class[] systemClasses = new Class[valueTypeIx+2];
+               private PrimitiveType[] systemTypes = new PrimitiveType[valueTypeIx];
+               private TypeSpec[] specialTypeSpecs = new TypeSpec[valueTypeIx];
+               private static int[] specialNames = {
+                       PrimitiveType.Void.GetName().GetHashCode(),
+                       PrimitiveType.Boolean.GetName().GetHashCode(),
+                       PrimitiveType.Char.GetName().GetHashCode(),
+                       PrimitiveType.Int8.GetName().GetHashCode(),
+                       PrimitiveType.UInt8.GetName().GetHashCode(),
+                       PrimitiveType.Int16.GetName().GetHashCode(),
+                       PrimitiveType.UInt16.GetName().GetHashCode(),
+                       PrimitiveType.Int32.GetName().GetHashCode(),
+                       PrimitiveType.UInt32.GetName().GetHashCode(),
+                       PrimitiveType.Int64.GetName().GetHashCode(),
+                       PrimitiveType.UInt64.GetName().GetHashCode(),
+                       PrimitiveType.Float32.GetName().GetHashCode(),
+                       PrimitiveType.Float64.GetName().GetHashCode(),
+                       PrimitiveType.String.GetName().GetHashCode(),
+                       PrimitiveType.TypedRef.GetName().GetHashCode(),
+                       PrimitiveType.IntPtr.GetName().GetHashCode(),
+                       PrimitiveType.UIntPtr.GetName().GetHashCode(),
+                       PrimitiveType.Object.GetName().GetHashCode(),
+                       PrimitiveType.ValueType.GetName ().GetHashCode(),
+                       "Enum".GetHashCode()
+               };
+
+               internal MSCorLib(MetaData md) : base(md,"mscorlib") 
+               {
+                       if (!PEFile.IsMSCorlib)
+                               md.AddToTable(MDTable.AssemblyRef,this);
+                       systemTypes[PrimitiveType.Void.GetSystemTypeIx()] = PrimitiveType.Void;
+                       systemTypes[PrimitiveType.Boolean.GetSystemTypeIx()] = PrimitiveType.Boolean;
+                       systemTypes[PrimitiveType.Char.GetSystemTypeIx()] = PrimitiveType.Char;
+                       systemTypes[PrimitiveType.Int8.GetSystemTypeIx()] = PrimitiveType.Int8;
+                       systemTypes[PrimitiveType.UInt8.GetSystemTypeIx()] = PrimitiveType.UInt8;
+                       systemTypes[PrimitiveType.Int16.GetSystemTypeIx()] = PrimitiveType.Int16;
+                       systemTypes[PrimitiveType.UInt16.GetSystemTypeIx()] = PrimitiveType.UInt16;
+                       systemTypes[PrimitiveType.Int32.GetSystemTypeIx()] = PrimitiveType.Int32;
+                       systemTypes[PrimitiveType.UInt32.GetSystemTypeIx()] = PrimitiveType.UInt32;
+                       systemTypes[PrimitiveType.Int64.GetSystemTypeIx()] = PrimitiveType.Int64;
+                       systemTypes[PrimitiveType.UInt64.GetSystemTypeIx()] = PrimitiveType.UInt64;
+                       systemTypes[PrimitiveType.Float32.GetSystemTypeIx()] = PrimitiveType.Float32;
+                       systemTypes[PrimitiveType.Float64.GetSystemTypeIx()] = PrimitiveType.Float64;
+                       systemTypes[PrimitiveType.IntPtr.GetSystemTypeIx()] = PrimitiveType.IntPtr;
+                       systemTypes[PrimitiveType.UIntPtr.GetSystemTypeIx()] = PrimitiveType.UIntPtr;
+                       systemTypes[PrimitiveType.String.GetSystemTypeIx()] = PrimitiveType.String;
+                       systemTypes[PrimitiveType.Object.GetSystemTypeIx()] = PrimitiveType.Object;
+                       systemTypes[PrimitiveType.TypedRef.GetSystemTypeIx()] = PrimitiveType.TypedRef;
+               }
+
+               /// <summary>
+               /// Add a class to the mscorlib assembly
+               /// </summary>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns></returns>
+               public override ClassRef AddClass(string nsName, string name) 
+               {
+                       /* This gets called by !mscorlib, for adding references INTO mscorlib, so
+                          it should be returning ClassRef ..*/
+                       Class aClass = GetSpecialClass(nsName,name);
+                       if (aClass == null) {
+                               aClass = new ClassRef(nsName,name,metaData);
+                               metaData.AddToTable(MDTable.TypeRef,aClass);
+                               if (aClass is ClassRef)
+                                       ((ClassRef) aClass).SetParent(this);
+                       }
+                       //FIXME: Check for !ClassRef here?
+                       return (ClassRef) aClass;
+               }
+
+               private Class GetSpecialClass(string nsName,string name) 
+               {
+                       if (nsName.CompareTo(systemName) != 0) return null;
+                       int hash = name.GetHashCode();
+                       for (int i=0; i < specialNames.Length; i++) {
+                               if (hash != specialNames[i])
+                                       continue;
+                               if (systemClasses[i] == null) {
+                                       if (i < valueTypeIx) {
+                                               systemClasses[i] = new SystemClass(systemTypes[i],this,metaData);
+                                               if ((systemTypes[i] != PrimitiveType.Object) &&
+                                                               (systemTypes[i] != PrimitiveType.String)) {
+                                                       systemClasses[i].MakeValueClass(ValueClass.ValueType);
+                                               }
+                                       } else {
+                                               systemClasses[i] = new ClassRef(nsName,name,metaData);
+                                               ((ClassRef) systemClasses[i]).SetParent(this);
+                                               if (!ClassDef.IsValueType (nsName, name) && !ClassDef.IsEnum (nsName, name))
+                                                       systemClasses[i].MakeValueClass(ValueClass.ValueType);
+                                       }
+                                       metaData.AddToTable(MDTable.TypeRef,systemClasses[i]);
+                               }
+                               return systemClasses[i];
+                       }
+                       return null;
+               }
+
+               internal void SetSpecialSystemClass (string nsName, string name, Class aClass) 
+               {
+                       if (nsName != systemName) return;
+                       int hash = name.GetHashCode ();
+                       for (int i = 0; i < specialNames.Length; i++) {
+                               if (hash != specialNames [i])
+                                       continue;
+                               if (systemClasses [i] == null) {
+                                       systemClasses [i] = aClass;
+                               }
+                       }
+               }
+
+               internal Class GetSpecialSystemClass(PrimitiveType pType) 
+               {
+                       int ix = pType.GetSystemTypeIx();
+                       if (systemClasses[ix] == null && !PEFile.IsMSCorlib) {
+                               systemClasses[ix] = new SystemClass(pType,this,metaData);
+                               metaData.AddToTable(MDTable.TypeRef,systemClasses[ix]);
+                       }
+                       return systemClasses[ix];
+               }
+
+               private ClassRef GetValueClass(string name, int hash) 
+               {
+                       /* Called by MSCorLib.AddValueClass, which is called by
+                          !mscorlib, for adding ref to value class INTO mscorlib,
+                          so this should be classref */
+                       int ix = valueTypeIx;
+                       if (hash != specialNames[valueTypeIx]) ix++;
+                       if (systemClasses[ix] == null) {
+                               systemClasses[ix] = new ClassRef(systemName,name,metaData);
+                               ((ClassRef) systemClasses[ix]).SetParent(this);
+                               ((ClassRef) systemClasses[ix]).MakeValueClass(ValueClass.ValueType);
+                               metaData.AddToTable(MDTable.TypeRef,systemClasses[ix]);
+                       }
+                       return (ClassRef) systemClasses[ix];
+               }
+
+               internal Class ValueType() 
+               {
+                       if (systemClasses[valueTypeIx] == null && !PEFile.IsMSCorlib) {
+                               ClassRef valType = new ClassRef("System","ValueType",metaData);
+                               valType.SetParent(this);
+                               valType.MakeValueClass(ValueClass.ValueType);
+                               metaData.AddToTable(MDTable.TypeRef,valType);
+                               systemClasses[valueTypeIx] = valType;
+                       }
+                       return systemClasses[valueTypeIx];
+               }
+
+               internal Class EnumType() 
+               {
+                       /* Called by both mscorlib & !mscorlib, so can be
+                          either ClassRef or ClassDef */
+                       //systemClasses [ valueTypeIx + 1] -> System.Enum
+                       if (systemClasses[valueTypeIx + 1] == null && !PEFile.IsMSCorlib) {
+                               ClassRef valType = new ClassRef("System","Enum",metaData);
+                               valType.SetParent(this);
+                               valType.MakeValueClass(ValueClass.Enum);
+                               metaData.AddToTable(MDTable.TypeRef,valType);
+                               systemClasses[valueTypeIx + 1] = valType;
+                       }
+                       return systemClasses[valueTypeIx + 1];
+               }
+
+               /// <summary>
+               /// Add a value class to this external assembly
+               /// </summary>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns></returns>
+               public override ClassRef AddValueClass(string nsName, string name) 
+               {
+                       if (nsName.CompareTo(systemName) == 0) {
+                               int hash = name.GetHashCode();
+                               if ((hash == specialNames[valueTypeIx]) ||
+                                               (hash == specialNames[valueTypeIx+1])) {
+                                       return GetValueClass(name,hash);
+                               }
+                       }
+                       ClassRef aClass = new ClassRef(nsName,name,metaData);
+                       metaData.AddToTable(MDTable.TypeRef,aClass);
+                       aClass.SetParent(this);
+                       aClass.MakeValueClass(ValueClass.ValueType);
+                       return aClass;
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// MetaData 
+       ///   Root (20 bytes + UTF-8 Version String + quad align padding)
+       ///   StreamHeaders (8 bytes + null terminated name string + quad align padding)
+       ///   Streams 
+       ///     #~        (always present - holds metadata tables)
+       ///     #Strings  (always present - holds identifier strings)
+       ///     #US       (Userstring heap)
+       ///     #Blob     (signature blobs)
+       ///     #GUID     (guids for assemblies or Modules)
+       /// </summary>
+       public class MetaData  {
+
+               internal static readonly int[] CIxShiftMap = {2,2,5,1,2,3,1,1,1,2,3,2,1};
+               private static readonly byte StringsHeapMask = 0x1;
+               private static readonly byte GUIDHeapMask = 0x2;
+               private static readonly byte BlobHeapMask = 0x4;
+               private static readonly uint MetaDataSignature = 0x424A5342;
+               private static readonly uint maxSmlIxSize = 0xFFFF;
+               private static readonly uint max1BitSmlIx = 0x7FFF;
+               private static readonly uint max2BitSmlIx = 0x3FFF;
+               private static readonly uint max3BitSmlIx = 0x1FFF;
+               private static readonly uint max5BitSmlIx = 0x7FF;
+               // NOTE: version and stream name strings MUST always be quad padded
+               private static readonly string version = "v1.1.4322\0\0\0";
+               private static readonly char[] tildeName = {'#','~','\0','\0'};
+               private static readonly char[] stringsName = {'#','S','t','r','i','n','g','s','\0','\0','\0','\0'};
+               private static readonly char[] usName = {'#','U','S','\0'};
+               private static readonly char[] guidName = {'#','G','U','I','D','\0','\0','\0'};
+               private static readonly char[] blobName = {'#','B','l','o','b','\0','\0','\0'};
+               private static readonly uint MetaDataHeaderSize = 20 + (uint)version.Length;
+               private static readonly uint TildeHeaderSize = 24;
+               private static readonly uint StreamHeaderSize = 8;
+               private static readonly uint numMetaDataTables = (int)MDTable.GenericParamConstraint + 1;
+               private static readonly uint tildeHeaderSize = 8 + (uint)tildeName.Length;
+
+               MetaDataStream strings, us, guid, blob;
+
+               MetaDataStream[] streams = new MetaDataStream[5];
+               uint numStreams = 5;
+               uint tildeTide = 0, tildePadding = 0, tildeStart = 0;
+               uint numTables = 0, resourcesSize = 0;
+               ArrayList[] metaDataTables = new ArrayList[numMetaDataTables];
+               ArrayList byteCodes = new ArrayList();
+               uint codeSize = 0, codeStart, byteCodePadding = 0, metaDataSize = 0;
+               ulong valid = 0, /*sorted = 0x000002003301FA00;*/ sorted = 0;
+               bool[] largeIx = new bool[numMetaDataTables];
+               bool[] lgeCIx = new bool[(int)CIx.MaxCIx];
+               bool largeStrings = false, largeUS = false, largeGUID = false, largeBlob = false;
+               private FileImage file;
+               private byte heapSizes = 0;
+               MetaDataElement entryPoint;
+               BinaryWriter output;
+               public MSCorLib mscorlib;
+               private TypeSpec[] systemTypeSpecs = new TypeSpec[PrimitiveType.NumSystemTypes];
+               long mdStart;
+               private ArrayList cattr_list;
+               private ArrayList declsec_list;
+               ArrayList resources;            
+
+               internal MetaData(FileImage file) 
+               {
+                       // tilde = new MetaDataStream(tildeName,false,0);
+                       this.file = file;
+                       strings = new MetaDataStream(stringsName,new UTF8Encoding(),true);
+                       us = new MetaDataStream(usName,new UnicodeEncoding(),true);
+                       guid = new MetaDataStream(guidName,false);
+                       blob = new MetaDataStream(blobName,true);
+                       streams[1] = strings;
+                       streams[2] = us;
+                       streams[3] = guid;
+                       streams[4] = blob;
+                       for (int i=0; i < numMetaDataTables; i++) {
+                               largeIx[i] = false;
+                       }
+                       for (int i=0; i < lgeCIx.Length; i++) {
+                               lgeCIx[i] = false;
+                       }
+                       mscorlib = new MSCorLib(this);
+               }
+
+               internal TypeSpec GetPrimitiveTypeSpec(int ix) 
+               {
+                       return systemTypeSpecs[ix];
+               }
+
+               internal void SetPrimitiveTypeSpec(int ix, TypeSpec typeSpec) 
+               {
+                       systemTypeSpecs[ix] = typeSpec;
+               }
+
+               internal uint Size() 
+               {
+                       return metaDataSize;
+               }
+
+               private void CalcHeapSizes ()
+               {
+                       if (strings.LargeIx()) {
+                               largeStrings = true;
+                               heapSizes |= StringsHeapMask;
+                       }
+                       if (guid.LargeIx()) {
+                               largeGUID = true;
+                               heapSizes |= GUIDHeapMask;
+                       }
+                       if (blob.LargeIx()) {
+                               largeBlob = true;
+                               heapSizes |= BlobHeapMask;
+                       }
+
+                       largeUS = us.LargeIx();
+               }
+
+               internal void StreamSize(byte mask) 
+               {
+                       heapSizes |= mask;
+               }
+
+               internal uint AddToUSHeap(string str) 
+               {
+                       if (str == null) return 0;
+                       return us.Add(str,true);
+               }
+
+               internal uint AddToUSHeap(byte[] str) 
+               {
+                       if (str == null) return 0;
+                       return us.Add (str, true);
+               }
+
+               internal uint AddToStringsHeap(string str) 
+               {
+                       if ((str == null) || (str.CompareTo("") == 0)) return 0;
+                       return strings.Add(str,false);
+               }
+
+               internal uint AddToGUIDHeap(Guid guidNum) 
+               {
+                       return guid.Add(guidNum, false);
+               }
+
+               internal uint AddToBlobHeap(byte[] blobBytes) 
+               {
+                       if (blobBytes == null) return 0;
+                       return blob.Add(blobBytes, true);
+               }
+
+               internal uint AddToBlobHeap(byte val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(sbyte val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(ushort val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(short val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(uint val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(int val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(ulong val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(long val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(float val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(double val) 
+               {
+                       return blob.Add(val, true);
+               }
+
+               internal uint AddToBlobHeap(string val) 
+               {
+                       return blob.Add(val,true);
+               }
+
+               internal void AddCustomAttribute (CustomAttribute cattr)
+               {
+                       if (cattr_list == null)
+                               cattr_list = new ArrayList ();
+                       cattr_list.Add (cattr);
+               }
+
+               internal void AddDeclSecurity (DeclSecurity decl_sec)
+               {
+                       if (declsec_list == null)
+                               declsec_list = new ArrayList ();
+                       declsec_list.Add (decl_sec);
+               }
+
+               private ArrayList GetTable(MDTable tableIx) 
+               {
+                       int tabIx = (int)tableIx;
+                       if (metaDataTables[tabIx] == null) {
+                               metaDataTables[tabIx] = new ArrayList();
+                               valid |= ((ulong)0x1 << tabIx);
+                               // Console.WriteLine("after creating table " + tableIx + "(" + tabIx + ") valid = " + valid);
+                               numTables++;
+                       }
+                       return metaDataTables[tabIx];
+               }
+
+               internal void AddToTable(MDTable tableIx, MetaDataElement elem) 
+               {
+                       if (elem.Row > 0) {
+                               // Console.Out.WriteLine("ERROR - element already in table " + tableIx);
+                               return;
+                       }
+                       // updates Row field of the element
+                       // Console.WriteLine("Adding element to table " + (uint)tableIx);
+                       ArrayList table = GetTable(tableIx);
+                       elem.Row = (uint)table.Count + 1;
+                       table.Add(elem);
+               }
+
+               internal uint TableIndex(MDTable tableIx) 
+               {
+                       if (metaDataTables[(int)tableIx] == null) return 1;
+                       return (uint)metaDataTables[(int)tableIx].Count+1;
+               }
+
+               internal uint AddCode(CILInstructions byteCode) 
+               {
+                       byteCodes.Add(byteCode);
+                       uint offset = codeSize + codeStart;
+                       codeSize += byteCode.GetCodeSize();
+                       return offset;
+               }
+
+               internal void SetEntryPoint(MetaDataElement ep) 
+               {
+                       entryPoint = ep;
+               }
+
+               internal uint AddResource(byte[] resBytes) 
+               {
+                       if (resources == null) resources = new ArrayList ();
+                       resources.Add (resBytes);
+                       uint offset = resourcesSize;
+                       resourcesSize += (uint)resBytes.Length + 4;
+                       return offset;
+               }
+
+               internal void AddData(DataConstant cVal) 
+               {
+                       file.AddInitData(cVal);
+               }
+
+               internal static void CompressNum(uint val, MemoryStream sig) 
+               {
+                       if (val < 0x7F) {
+                               sig.WriteByte((byte)val);
+                       } else if (val < 0x3FFF) {
+                               byte b1 = (byte)((val >> 8) | 0x80);
+                               byte b2 = (byte)(val & FileImage.iByteMask[0]);
+                               sig.WriteByte(b1);
+                               sig.WriteByte(b2);
+                       } else {
+                               byte b1 = (byte)((val >> 24) | 0xC0);
+                               byte b2 = (byte)((val & FileImage.iByteMask[2]) >> 16);
+                               byte b3 = (byte)((val & FileImage.iByteMask[1]) >> 8);;
+                               byte b4 = (byte)(val & FileImage.iByteMask[0]);
+                               sig.WriteByte(b1);
+                               sig.WriteByte(b2);
+                               sig.WriteByte(b3);
+                               sig.WriteByte(b4);
+                       }
+               }
+
+               internal uint CodeSize() 
+               {
+                       return codeSize + byteCodePadding;
+               }
+
+               internal uint GetResourcesSize() 
+               { 
+                       return resourcesSize; 
+               }
+
+               internal uint StringsIndexSize() 
+               {
+                       if (largeStrings) return 4;
+                       return 2;
+               }
+
+               internal uint GUIDIndexSize() 
+               {
+                       if (largeGUID) return 4;
+                       return 2;
+               }
+
+               internal uint USIndexSize() 
+               {
+                       if (largeUS) return 4;
+                       return 2;
+               }
+
+               internal uint BlobIndexSize() 
+               {
+                       if (largeBlob) return 4;
+                       return 2;
+               }
+
+               internal uint CodedIndexSize(CIx code) 
+               {
+                       if (lgeCIx[(uint)code]) return 4;
+                       return 2;
+               }
+
+               internal uint TableIndexSize(MDTable tabIx) 
+               {
+                       if (largeIx[(uint)tabIx]) return 4;
+                       return 2;
+               }
+
+               private void SetIndexSizes() 
+               {
+                       for (int i=0; i < numMetaDataTables; i++) {
+                               if (metaDataTables[i] == null)
+                                       continue;
+
+                               uint count = (uint)metaDataTables[i].Count;
+                               if (count > maxSmlIxSize)
+                                       largeIx[i] = true;
+
+                               MDTable tabIx = (MDTable)i;
+                               if (count > max5BitSmlIx) {
+                                       lgeCIx[(int)CIx.HasCustomAttr] = true;
+                               }
+                               if (count > max3BitSmlIx) {
+                                       if ((tabIx == MDTable.TypeRef) || (tabIx == MDTable.ModuleRef) || (tabIx == MDTable.Method) || (tabIx == MDTable.TypeSpec) || (tabIx == MDTable.Field)) 
+                                               lgeCIx[(int)CIx.CustomAttributeType] = true;
+                                       if ((tabIx == MDTable.Method) || (tabIx == MDTable.MemberRef)) 
+                                               lgeCIx[(int)CIx.MemberRefParent] = true;
+                               }
+                               if (count > max2BitSmlIx) {
+                                       if ((tabIx == MDTable.Field) || (tabIx == MDTable.Param) || (tabIx == MDTable.Property)) 
+                                               lgeCIx[(int)CIx.HasConst] = true;
+                                       if ((tabIx == MDTable.TypeDef) || (tabIx == MDTable.TypeRef) || (tabIx == MDTable.TypeSpec))
+                                               lgeCIx[(int)CIx.TypeDefOrRef] = true;
+                                       if ((tabIx == MDTable.TypeDef) || (tabIx == MDTable.Method) || (tabIx == MDTable.Assembly))
+                                               lgeCIx[(int)CIx.HasDeclSecurity] = true;
+                                       if ((tabIx == MDTable.File) || (tabIx == MDTable.AssemblyRef) || (tabIx == MDTable.ExportedType))
+                                               lgeCIx[(int)CIx.Implementation] = true;
+                                       if ((tabIx == MDTable.Module) || (tabIx == MDTable.ModuleRef) || (tabIx == MDTable.AssemblyRef) || (tabIx == MDTable.TypeRef))
+                                               lgeCIx[(int)CIx.ResolutionScope] = true;
+                               }
+                               if (count > max1BitSmlIx) {
+                                       if ((tabIx == MDTable.Field) || (tabIx == MDTable.Param)) 
+                                               lgeCIx[(int)CIx.HasFieldMarshal] = true;
+                                       if ((tabIx == MDTable.Event) || (tabIx == MDTable.Property)) 
+                                               lgeCIx[(int)CIx.HasSemantics] = true;
+                                       if ((tabIx == MDTable.Method) || (tabIx == MDTable.MemberRef)) 
+                                               lgeCIx[(int)CIx.MethodDefOrRef] = true;
+                                       if ((tabIx == MDTable.Field) || (tabIx == MDTable.Method)) 
+                                               lgeCIx[(int)CIx.MemberForwarded] = true; 
+                                       if ((tabIx == MDTable.TypeDef) || (tabIx == MDTable.Method)) 
+                                               lgeCIx[(int)CIx.TypeOrMethodDef] = true; 
+                               }
+                       }
+               }
+
+               private void SetStreamOffsets() 
+               {
+                       uint sizeOfHeaders = StreamHeaderSize + (uint)tildeName.Length;
+                       for (int i=1; i < numStreams; i++) {
+                               sizeOfHeaders += streams[i].headerSize();
+                       }
+                       metaDataSize = MetaDataHeaderSize + sizeOfHeaders;
+                       tildeStart = metaDataSize;
+                       metaDataSize += tildeTide + tildePadding;
+                       for (int i=1; i < numStreams; i++) {
+                               streams[i].Start = metaDataSize;
+                               metaDataSize += streams[i].Size();
+                               streams[i].WriteDetails();
+                       }
+               }
+
+               internal void CalcTildeStreamSize() 
+               {
+                       CalcHeapSizes ();
+                       //tilde.SetIndexSizes(strings.LargeIx(),us.LargeIx(),guid.LargeIx(),blob.LargeIx());
+                       tildeTide = TildeHeaderSize;
+                       tildeTide += 4 * numTables;
+                       //Console.WriteLine("Tilde header + sizes = " + tildeTide);
+                       for (int i=0; i < numMetaDataTables; i++) {
+                               if (metaDataTables[i] != null) {
+                                       ArrayList table = metaDataTables[i];
+                                       // Console.WriteLine("Meta data table " + i + " at offset " + tildeTide);
+                                       tildeTide += (uint)table.Count * ((MetaDataElement)table[0]).Size(this);
+                                       // Console.WriteLine("Metadata table " + i + " has size " + table.Count);
+                                       // Console.WriteLine("tildeTide = " + tildeTide);
+                               }
+                       }
+                       if ((tildeTide % 4) != 0) tildePadding = 4 - (tildeTide % 4);
+                       //Console.WriteLine("tildePadding = " + tildePadding);
+               }
+
+               internal void WriteTildeStream(FileImage output) 
+               {
+                       long startTilde = output.Seek(0,SeekOrigin.Current);
+                       output.Write((uint)0); // Reserved
+                       output.Write((byte)1); // MajorVersion
+                       output.Write((byte)0); // MinorVersion
+                       output.Write(heapSizes);
+                       output.Write((byte)1); // Reserved
+                       output.Write(valid);
+                       output.Write(sorted);
+                       for (int i=0; i < numMetaDataTables; i++) {
+                               if (metaDataTables[i] != null) {
+                                       uint count = (uint)metaDataTables[i].Count;
+                                       output.Write(count);
+                               }
+                       }
+                       long tabStart = output.Seek(0,SeekOrigin.Current);
+                       // Console.WriteLine("Starting metaData tables at " + tabStart);
+                       for (int i=0; i < numMetaDataTables; i++) {
+                               if (metaDataTables[i] != null) {
+                                       // Console.WriteLine("Starting metaData table " + i + " at " + (output.Seek(0,SeekOrigin.Current) - startTilde));
+                                       ArrayList table = metaDataTables[i];
+                                       for (int j=0; j < table.Count; j++) {
+                                               ((MetaDataElement)table[j]).Write(output);
+                                       }
+                               }
+                       }
+                       // Console.WriteLine("Writing padding at " + output.Seek(0,SeekOrigin.Current));
+                       for (int i=0; i < tildePadding; i++) output.Write((byte)0);
+               }
+
+               private void BuildTable(ArrayList table) 
+               {
+                       if (table == null) return;
+                       for (int j=0; j < table.Count; j++) {
+                               ((MetaDataElement)table[j]).BuildTables(this);
+                       }
+               }
+
+               private void SortTable (ArrayList mTable) 
+               {
+                       if (mTable == null) return;
+                       mTable.Sort();
+                       for (int i=0; i < mTable.Count; i++) {
+                               ((MetaDataElement)mTable[i]).Row = (uint)i+1;
+                       }
+               }
+
+               internal void BuildMetaData(uint codeStartOffset) 
+               {
+                       codeStart = codeStartOffset;
+                       BuildTable(metaDataTables[(int)MDTable.TypeDef]);
+                       BuildTable(metaDataTables[(int)MDTable.MemberRef]);
+                       BuildTable(metaDataTables[(int)MDTable.GenericParam]);
+                       BuildTable(metaDataTables[(int)MDTable.MethodSpec]);
+                       BuildTable(metaDataTables[(int)MDTable.GenericParamConstraint]);
+                       BuildTable(metaDataTables[(int)MDTable.ManifestResource]);
+
+                       if (cattr_list != null) {
+                               foreach (CustomAttribute cattr in cattr_list)
+                                       cattr.BuildTables (this);
+                       }
+
+                       if (declsec_list != null) {
+                               foreach (DeclSecurity decl_sec in declsec_list)
+                                       decl_sec.BuildTables (this);
+                       }
+
+                       /*      for (int i=0; i < metaDataTables.Length; i++) {
+                               ArrayList table = metaDataTables[i];
+                               if (table != null) {
+                               for (int j=0; j < table.Count; j++) {
+                               ((MetaDataElement)table[j]).BuildTables(this);
+                               }
+                               }
+                               }
+                        */
+
+                       SetIndexSizes();
+                       for (int i=1; i < numStreams; i++) {
+                               streams[i].EndStream();
+                       }
+                       CalcTildeStreamSize();
+                       SetStreamOffsets();
+                       byteCodePadding = NumToAlign(codeSize,4);
+                       if (entryPoint != null) file.SetEntryPoint(entryPoint.Token());
+
+                       // Check ordering of specific tables
+                       // Constant, CustomAttribute, FieldMarshal, DeclSecurity, MethodSemantics
+                       // ImplMap, GenericParam
+                       // Need to load GenericParamConstraint AFTER GenericParam table in correct order
+                       // The tables:
+                       //   InterfaceImpl, ClassLayout, FieldLayout, MethodImpl, FieldRVA, NestedClass
+                       // will _ALWAYS_ be in the correct order as embedded in BuildMDTables
+
+                       SortTable(metaDataTables[(int)MDTable.Constant]);
+                       SortTable(metaDataTables[(int)MDTable.CustomAttribute]);
+                       SortTable(metaDataTables[(int)MDTable.FieldMarshal]);
+                       SortTable(metaDataTables[(int)MDTable.DeclSecurity]);
+                       SortTable(metaDataTables[(int)MDTable.MethodSemantics]);
+                       SortTable(metaDataTables[(int)MDTable.ImplMap]);
+                       if (metaDataTables[(int)MDTable.GenericParam] != null) {
+                               SortTable(metaDataTables[(int)MDTable.GenericParam]);
+                               // Now add GenericParamConstraints
+                               /*for (int i=0; i < metaDataTables[(int)MDTable.GenericParam].Count; i++) {
+                                 ((GenericParameter)metaDataTables[(int)MDTable.GenericParam][i]).AddConstraints(this);
+                                 }*/
+                       }
+                       SortTable(metaDataTables[(int)MDTable.GenericParamConstraint]);
+                       SortTable(metaDataTables[(int)MDTable.InterfaceImpl]);
+
+               }
+
+               internal void WriteByteCodes(FileImage output) 
+               {
+                       for (int i=0; i < byteCodes.Count; i++) {
+                               ((CILInstructions)byteCodes[i]).Write(output);
+                       }
+                       for (int i=0; i < byteCodePadding; i++) {
+                               output.Write((byte)0);
+                       }
+               }
+
+               internal void WriteResources (FileImage output) 
+               {
+                       if (resources == null) return;
+                       for (int i = 0; i < resources.Count; i ++) {
+                               byte [] resBytes = (byte []) resources [i];
+                               output.Write ((uint) resBytes.Length);
+                               output.Write (resBytes);
+                       } 
+               }
+
+               internal void WriteMetaData(FileImage output) 
+               {
+                       this.output = output;
+                       mdStart = output.Seek(0,SeekOrigin.Current);
+                       // Console.WriteLine("Writing metaData at " + Hex.Long(mdStart));
+                       output.Write(MetaDataSignature);
+                       output.Write((short)1);  // Major Version
+                       output.Write((short)1);  // Minor Version  ECMA = 0, PEFiles = 1
+                       output.Write(0);         // Reserved
+                       output.Write(version.Length);
+                       output.Write(version.ToCharArray());   // version string is already zero padded
+                       output.Write((short)0);
+                       output.Write((ushort)numStreams);
+                       // write tilde header
+                       output.Write(tildeStart);
+                       output.Write(tildeTide + tildePadding);
+                       output.Write(tildeName);
+                       for (int i=1; i < numStreams; i++) streams[i].WriteHeader(output);
+                       // Console.WriteLine("Writing tilde stream at " + output.Seek(0,SeekOrigin.Current) + " = " + tildeStart);
+                       WriteTildeStream(output);
+                       for (int i=1; i < numStreams; i++) streams[i].Write(output);
+                       // Console.WriteLine("Finished Writing metaData at " + output.Seek(0,SeekOrigin.Current));
+               }
+
+               internal bool LargeStringsIndex() { return strings.LargeIx(); }
+               internal bool LargeGUIDIndex() { return guid.LargeIx(); }
+               internal bool LargeUSIndex() { return us.LargeIx(); }
+               internal bool LargeBlobIndex() { return blob.LargeIx(); }
+
+               internal bool LargeIx(MDTable tabIx) { return largeIx[(uint)tabIx]; }
+
+
+               private uint NumToAlign(uint val, uint alignVal) 
+               {
+                       if ((val % alignVal) == 0) return 0;
+                       return alignVal - (val % alignVal);
+               }
+
+               internal void WriteCodedIndex(CIx code, MetaDataElement elem, FileImage output) 
+               {
+                       uint ix = 0;
+                       if (elem != null) { 
+                               ix = (elem.Row << CIxShiftMap[(uint)code]) | elem.GetCodedIx(code);
+                               // Console.WriteLine("coded index = " + ix + " row = " + elem.Row);
+                               //} else {
+                               // Console.WriteLine("elem for coded index is null");
+               }
+               if (lgeCIx[(uint)code]) 
+                       output.Write(ix);
+               else
+                       output.Write((ushort)ix);
+               }
+
+       }
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Stream in the Meta Data  (#Strings, #US, #Blob and #GUID)
+       /// </summary>
+
+       internal class MetaDataStream : BinaryWriter  {
+
+               private static readonly uint StreamHeaderSize = 8;
+               private static uint maxSmlIxSize = 0xFFFF;
+
+               private uint start = 0; 
+               uint size = 0, tide = 1;
+               bool largeIx = false;
+               uint sizeOfHeader;
+               char[] name;
+               Hashtable htable = new Hashtable();
+               Hashtable btable = new Hashtable (new ByteArrayHashCodeProvider (), new ByteArrayComparer ());
+
+               internal MetaDataStream(char[] name, bool addInitByte) : base(new MemoryStream()) 
+               {
+                       if (addInitByte) { Write((byte)0); size = 1; }
+                       this.name = name;
+                       sizeOfHeader = StreamHeaderSize + (uint)name.Length;
+               }
+
+               internal MetaDataStream(char[] name, System.Text.Encoding enc, bool addInitByte) : base(new MemoryStream(),enc) 
+               {
+                       if (addInitByte) { Write((byte)0); size = 1; }
+                       this.name = name;
+                       sizeOfHeader = StreamHeaderSize + (uint)name.Length;
+               }
+
+               public uint Start {
+                       get { return start; }
+                       set { start = value; }
+               }
+
+               internal uint headerSize() 
+               {
+                       // Console.WriteLine(name + " stream has headersize of " + sizeOfHeader);
+                       return sizeOfHeader;
+               }
+
+               internal void SetSize(uint siz) 
+               {
+                       size = siz;
+               }
+
+               internal uint Size() 
+               {
+                       return size;
+               }
+
+               internal bool LargeIx() 
+               {
+                       return largeIx;
+               }
+
+               internal void WriteDetails() 
+               {
+                       // Console.WriteLine(name + " - size = " + size);
+               }
+
+               internal uint Add(string str, bool prependSize) 
+               {
+                       Object val = htable[str];
+                       uint index = 0;
+                       if (val == null) { 
+                               index = size;
+                               htable[str] = index;
+                               char[] arr = str.ToCharArray();
+                               if (prependSize) CompressNum((uint)arr.Length*2+1);
+                               Write(arr);
+                               Write((byte)0);
+                               size = (uint)Seek(0,SeekOrigin.Current);
+                       } else {
+                               index = (uint)val;
+                       }
+                       return index;
+               }
+               internal uint Add (byte[] str, bool prependSize) 
+               {
+                       Object val = btable [str];
+                       uint index = 0;
+                       if (val == null) {
+                               index = size;
+                               btable [str] = index;
+                               if (prependSize) CompressNum ((uint) str.Length);
+                               Write (str);
+                               size = (uint) Seek (0, SeekOrigin.Current);
+                       } else {
+                               index = (uint) val;
+                       }
+                       return index;
+               }
+
+
+               internal uint Add(Guid guid, bool prependSize) 
+               {
+                       byte [] b = guid.ToByteArray ();
+                       if (prependSize) CompressNum ((uint) b.Length);
+                       Write(guid.ToByteArray());
+                       size =(uint)Seek(0,SeekOrigin.Current);
+                       return tide++;
+               }
+
+               internal uint Add(byte[] blob) 
+               {
+                       uint ix = size;
+                       CompressNum((uint)blob.Length);
+                       Write(blob);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(byte val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (1);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(sbyte val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (1);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(ushort val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (2);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(short val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (2);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(uint val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (4);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(int val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (4);
+                       Write (val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(ulong val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (8);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(long val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (8);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(float val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (4);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               internal uint Add(double val, bool prependSize) 
+               {
+                       uint ix = size;
+                       if (prependSize) CompressNum (8);
+                       Write(val);
+                       size = (uint)Seek(0,SeekOrigin.Current);
+                       return ix;
+               }
+
+               private void CompressNum(uint val) 
+               {
+                       if (val < 0x7F) {
+                               Write((byte)val);
+                       } else if (val < 0x3FFF) {
+                               byte b1 = (byte)((val >> 8) | 0x80);
+                               byte b2 = (byte)(val & FileImage.iByteMask[0]);
+                               Write(b1);
+                               Write(b2);
+                       } else {
+                               byte b1 = (byte)((val >> 24) | 0xC0);
+                               byte b2 = (byte)((val & FileImage.iByteMask[2]) >> 16);
+                               byte b3 = (byte)((val & FileImage.iByteMask[1]) >> 8);;
+                               byte b4 = (byte)(val & FileImage.iByteMask[0]);
+                               Write(b1);
+                               Write(b2);
+                               Write(b3);
+                               Write(b4);
+                       }
+               }
+
+               private void QuadAlign() 
+               {
+                       if ((size % 4) != 0) {
+                               uint pad = 4 - (size % 4);
+                               size += pad;
+                               for (int i=0; i < pad; i++) {
+                                       Write((byte)0);
+                               }
+                       }
+               }
+
+               internal void EndStream() 
+               {
+                       QuadAlign();
+                       if (size > maxSmlIxSize) {
+                               largeIx = true;
+                       }
+               }
+
+               internal void WriteHeader(BinaryWriter output) 
+               {
+                       output.Write(start);
+                       output.Write(size);
+                       output.Write(name);
+               }
+
+               internal virtual void Write(BinaryWriter output) 
+               {
+                       // Console.WriteLine("Writing " + name + " stream at " + output.Seek(0,SeekOrigin.Current) + " = " + start);
+                       MemoryStream str = (MemoryStream)BaseStream;
+                       output.Write(str.ToArray());
+               }
+
+       }
+
+       /**************************************************************************/  
+       class ByteArrayComparer : IComparer {
+
+               public int Compare (object x, object y)
+               {
+                       byte [] a = (byte []) x;
+                       byte [] b = (byte []) y;
+                       int len = a.Length;
+
+                       if (b.Length != len)
+                               return 1;
+
+                       for (int i = 0; i < len; ++i)
+                               if (a [i] != b [i])
+                                       return 1;
+                       return 0;
+               }
+       }
+
+       class ByteArrayHashCodeProvider : IHashCodeProvider {
+
+               public int GetHashCode (Object key)
+               {
+                       byte [] arr = (byte []) key;
+                       int len = arr.Length;
+                       int h = 0;
+
+                       for (int i = 0; i < len; ++i)
+                               h = (h << 5) - h + arr [i];
+
+                       return h;
+               }
+
+       }
+
+
+}
index fc022af63f199868be765bb73f888b1b583dd62f..496460aad2f9f14fdcf10579bf91a25be183d3b6 100644 (file)
@@ -3,7288 +3,1193 @@ using System.IO;
 using System.Collections;
 using System.Text;
 
-namespace PEAPI 
-{
-  public class Hex {
-    readonly static char[] hexDigit = {'0','1','2','3','4','5','6','7',
-                                        '8','9','A','B','C','D','E','F'};
-    readonly static uint[] iByteMask = {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000};
-    readonly static ulong[] lByteMask = {0x00000000000000FF, 0x000000000000FF00, 
-                                          0x0000000000FF0000, 0x00000000FF000000,
-                                          0x000000FF00000000, 0x0000FF0000000000,
-                                          0x00FF000000000000, 0xFF00000000000000 };
-    readonly static uint nibble0Mask = 0x0000000F;
-    readonly static uint nibble1Mask = 0x000000F0;
-
-    public static String Byte(int b) {
-      char[] str = new char[2];
-      uint num = (uint)b;
-      uint b1 = num & nibble0Mask;
-      uint b2 = (num & nibble1Mask) >> 4;
-      str[0] = hexDigit[b2];
-      str[1] = hexDigit[b1];
-      return new String(str);
-    }
-
-    public static String Short(int b) {
-      char[] str = new char[4];
-      uint num1 = (uint)b & iByteMask[0];
-      uint num2 = ((uint)b & iByteMask[1]) >> 8;
-      uint b1 = num1 & nibble0Mask;
-      uint b2 = (num1 & nibble1Mask) >> 4;
-      uint b3 = num2 & nibble0Mask;
-      uint b4 = (num2 & nibble1Mask) >> 4;
-      str[0] = hexDigit[b4];
-      str[1] = hexDigit[b3];
-      str[2] = hexDigit[b2];
-      str[3] = hexDigit[b1];
-      return new String(str);
-    }
-
-    public static String Int(int val) {
-      char[] str = new char[8];
-      uint num = (uint)val;
-      int strIx = 7;
-      for (int i=0; i < iByteMask.Length; i++) {
-        uint b = num & iByteMask[i];
-        b >>= (i*8);
-        uint b1 = b & nibble0Mask;
-        uint b2 = (b & nibble1Mask) >> 4;
-        str[strIx--] = hexDigit[b1];
-        str[strIx--] = hexDigit[b2];
-      }
-      return new String(str);
-    }
-    public static String Int(uint num) {
-      char[] str = new char[8];
-      int strIx = 7;
-      for (int i=0; i < iByteMask.Length; i++) {
-        uint b = num & iByteMask[i];
-        b >>= (i*8);
-        uint b1 = b & nibble0Mask;
-        uint b2 = (b & nibble1Mask) >> 4;
-        str[strIx--] = hexDigit[b1];
-        str[strIx--] = hexDigit[b2];
-      }
-      return new String(str);
-    }
-
-    public static String Long(long lnum) {
-      ulong num = (ulong)lnum;
-      char[] str = new char[16];
-      int strIx = 15;
-      for (int i=0; i < lByteMask.Length; i++) {
-        ulong b = num & lByteMask[i];
-        b >>= (i*8);
-        ulong b1 = b & nibble0Mask;
-        ulong b2 = (b & nibble1Mask) >> 4;
-        str[strIx--] = hexDigit[b1];
-        str[strIx--] = hexDigit[b2];
-      }
-      return new String(str);
-    }
-  }
-
-  public class NotYetImplementedException : System.Exception 
-  {
-     public NotYetImplementedException(string msg) : base(msg + " Not Yet Implemented") { }
-  }
-
-  public class TypeSignatureException : System.Exception {
-    public TypeSignatureException(string msg) : base(msg) { }
-  }
-
-                   public class ClassRefInst : Type {
-
-                          private Type type;
-                          private bool is_value;
-
-            public ClassRefInst (Type type, bool is_value) : base (PrimitiveType.Class.GetTypeIndex ()) {
-                    this.type = type;
-                    this.is_value = is_value;
-                    if (is_value)
-                          typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
-                    tabIx = MDTable.TypeSpec;
-            }
-
-            internal sealed override void TypeSig(MemoryStream str) {
-                    type.TypeSig (str);
-            }
-    }
-                  
-  public class MVar : Type {
-
-            private int index;
-
-            public MVar (int index) : base (0x1E) {
-                    this.index = index;
-                    tabIx = MDTable.TypeSpec;
-            }
-
-            internal sealed override void TypeSig(MemoryStream str) {
-                    str.WriteByte(typeIndex);
-                    MetaData.CompressNum ((uint) index, str);
-            }
-    }
-
-    public class GenericTypeSpec : Type {
-
-            private int index;
-
-            public GenericTypeSpec (int index) : base (0x13) {
-                    this.index = index;
-                    tabIx = MDTable.TypeSpec;
-            }
-
-            internal sealed override void TypeSig(MemoryStream str) {
-                    str.WriteByte(typeIndex);
-                    MetaData.CompressNum ((uint) index, str);
-            }
-    }
-
-  public class GenericTypeInst : Type {
-
-          private Type gen_type;
-          private Type[] gen_param;
-
-          public GenericTypeInst (Type gen_type, Type[] gen_param) : base (0x15)
-          {
-                  typeIndex = 0x15;
-                  this.gen_type = gen_type;
-                  this.gen_param = gen_param;
-                  tabIx = MDTable.TypeSpec;
-  }
-
-          internal sealed override void TypeSig(MemoryStream str) {
-                  str.WriteByte(typeIndex);
-                  gen_type.TypeSig (str);
-                  MetaData.CompressNum ((uint) gen_param.Length, str);
-                  foreach (Type param in gen_param)
-                          param.TypeSig (str);
-            }
-  }
-
-  public class GenericMethodSig {
-
-          private Type[] gen_param;
-
-          public GenericMethodSig (Type[] gen_param)
-          {
-                  this.gen_param = gen_param;
-          }
-
-          internal void TypeSig (MemoryStream str)
-          {
-                  MetaData.CompressNum ((uint) gen_param.Length, str); // THIS IS NOT RIGHT, but works
-                  MetaData.CompressNum ((uint) gen_param.Length, str);
-                  foreach (Type param in gen_param)
-                          param.TypeSig (str);
-          }
-
-          internal uint GetSigIx (MetaData md)
-          {
-                  MemoryStream sig = new MemoryStream();
-                  TypeSig (sig);
-                  return md.AddToBlobHeap (sig.ToArray());
-          }
-  }
-
-        public class Sentinel : Type {
-
-            public Sentinel () : base (0x41) { }
-
-            internal sealed override void TypeSig(MemoryStream str) {
-                    str.WriteByte(typeIndex);
-            }
-        }
-
-        /// <summary>
-        /// The IL Array type
-        /// </summary>
-        public abstract class Array : Type
-        {
-
-    protected Type elemType;
-                protected MetaData metaData;
-                protected string cnameSpace, cname;
-
-    internal Array(Type eType, byte TypeId) : base(TypeId) {
-      elemType = eType;
-                        tabIx = MDTable.TypeSpec;
-    }
-
-        }
-
-  /**************************************************************************/  
-  
-  /// <summary>
-  /// Single dimensional array with zero lower bound
-  /// </summary>
-  public class ZeroBasedArray : Array {
-
-    /// <summary>
-    /// Create a new array  -   elementType[]
-    /// </summary>
-    /// <param name="elementType">the type of the array elements</param>
-    public ZeroBasedArray(Type elementType) : base (elementType, PrimitiveType.SZArray.GetTypeIndex ()) { }
-
-    internal sealed override void TypeSig(MemoryStream str) {
-      str.WriteByte(typeIndex);
-      elemType.TypeSig(str); 
-    }
-
-  }
-
-
-  /**************************************************************************/           
-
-  /// <summary>
-  /// Multi dimensional array with explicit bounds
-  /// </summary>
-  public class BoundArray : Array {
-    int[] lowerBounds;
-    int[] sizes;
-    uint numDims;
-
-    /// <summary>
-    /// Create a new multi dimensional array type 
-    /// eg. elemType[1..5,3..10,5,,] would be 
-    /// new BoundArray(elemType,5,[1,3,0],[5,10,4])
-    /// </summary>
-    /// <param name="elementType">the type of the elements</param>
-    /// <param name="dimensions">the number of dimensions</param>
-    /// <param name="loBounds">lower bounds of dimensions</param>
-    /// <param name="upBounds">upper bounds of dimensions</param>
-    public BoundArray(Type elementType, uint dimensions, int[] loBounds, 
-      int[] upBounds) : base (elementType,0x14) {
-      numDims = dimensions;
-      lowerBounds = loBounds;
-      sizes = new int[loBounds.Length];
-      for (int i=0; i < loBounds.Length; i++) {
-        sizes[i] = upBounds[i] - loBounds[i] + 1;
-      }
-    }
-
-    /// <summary>
-    /// Create a new multi dimensional array type 
-    /// eg. elemType[5,10,20] would be new BoundArray(elemType,3,[5,10,20])
-    /// </summary>
-    /// <param name="elementType">the type of the elements</param>
-    /// <param name="dimensions">the number of dimensions</param>
-    /// <param name="size">the sizes of the dimensions</param>
-    public BoundArray(Type elementType, uint dimensions, int[] size) 
-                                                  : base (elementType,0x14) {
-      numDims = dimensions;
-      sizes = size;
-    }
-
-    /// <summary>
-    /// Create a new multi dimensional array type 
-    /// eg. elemType[,,] would be new BoundArray(elemType,3)
-    /// </summary>
-    /// <param name="elementType">the type of the elements</param>
-    /// <param name="dimensions">the number of dimensions</param>
-    public BoundArray(Type elementType, uint dimensions)
-                                                  : base (elementType,0x14) {
-      numDims = dimensions;
-    }
-
-    internal sealed override void TypeSig(MemoryStream str) {
-      str.WriteByte(typeIndex);
-      elemType.TypeSig(str);
-      MetaData.CompressNum(numDims,str);
-      if ((sizes != null) && (sizes.Length > 0)) {
-        MetaData.CompressNum((uint)sizes.Length,str);
-        for (int i=0; i < sizes.Length; i++) {
-          MetaData.CompressNum((uint)sizes[i],str);
-        }
-      } else str.WriteByte(0);
-      if ((lowerBounds != null) && (lowerBounds.Length > 0)) {
-        MetaData.CompressNum((uint)lowerBounds.Length,str);
-        for (int i=0; i < lowerBounds.Length; i++) {
-          MetaData.CompressNum((uint)lowerBounds[i],str);
-        }
-      } else str.WriteByte(0);
-    }
-  
-  }
-  /**************************************************************************/  
-  /// <summary>
-  /// Descriptor for THIS assembly (.assembly)
-  /// </summary>
-  public class Assembly : ResolutionScope 
-  {
-    ushort majorVer, minorVer, buildNo, revisionNo;
-    uint flags;
-    uint hashAlgId;
-    uint keyIx = 0, cultIx = 0;
-    bool hasPublicKey = false;
-    
-    internal Assembly(string name, MetaData md) : base(name,md) {
-      tabIx = MDTable.Assembly;
-    }
-
-    /// <summary>
-    /// Add details about THIS assembly
-    /// </summary>
-    /// <param name="majVer">Major Version</param>
-    /// <param name="minVer">Minor Version</param>
-    /// <param name="bldNo">Build Number</param>
-    /// <param name="revNo">Revision Number</param>
-    /// <param name="key">Hash Key</param>
-    /// <param name="hash">Hash Algorithm</param>
-    /// <param name="cult">Culture</param>
-    public void AddAssemblyInfo(int majVer, int minVer, int bldNo, int revNo, 
-                              byte[] key, uint hash, string cult) {
-      majorVer = (ushort)majVer;
-      minorVer = (ushort)minVer;
-      buildNo = (ushort)bldNo;
-      revisionNo = (ushort)revNo;
-      hashAlgId = hash;
-      hasPublicKey = (key != null);
-      keyIx = metaData.AddToBlobHeap(key);
-      cultIx = metaData.AddToStringsHeap(cult);
-    }
-
-    /// <summary>
-    /// Add an attribute to THIS assembly
-    /// </summary>
-    /// <param name="aa">assembly attribute</param>
-    public void AddAssemblyAttr(AssemAttr aa) {
-      flags |= (uint)aa;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 16 + md.BlobIndexSize() + 2 * md.StringsIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-//      Console.WriteLine("Writing assembly element with nameIx of " + nameIx + " at file offset " + output.Seek(0,SeekOrigin.Current));
-      output.Write((uint)hashAlgId);
-      output.Write(majorVer);
-      output.Write(minorVer);
-      output.Write(buildNo);
-      output.Write(revisionNo);
-      output.Write(flags);
-      output.BlobIndex(keyIx);
-      output.StringsIndex(nameIx);
-      output.StringsIndex(cultIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasCustomAttr) : return 14; 
-        case (CIx.HasDeclSecurity) : return 2; 
-      }
-      return 0;
-    }
-
-    internal bool HasPublicKey {
-      get { return hasPublicKey; }
-    }
-  }     
-  /**************************************************************************/  
-
-        public interface IExternRef  {
-                ClassRef AddClass(string nsName, string name);
-                ClassRef AddValueClass(string nsName, string name);
-        }
-        
-        /// <summary>
-        /// A reference to an external assembly (.assembly extern)
-        /// </summary>
-        public class AssemblyRef : ResolutionScope, IExternRef
-        {
-    private ushort major, minor, build, revision;
-    uint flags, keyIx, hashIx, cultIx;
-    bool hasVersion = false, isKeyToken = false;
-    byte[] keyBytes;
-    string culture;
-
-    internal AssemblyRef(MetaData md, string name) : base(name,md) {
-      tabIx = MDTable.AssemblyRef;
-                }
-
-    /// <summary>
-    /// Add version information about this external assembly
-    /// </summary>
-    /// <param name="majVer">Major Version</param>
-    /// <param name="minVer">Minor Version</param>
-    /// <param name="bldNo">Build Number</param>
-    /// <param name="revNo">Revision Number</param>
-    public void AddVersionInfo(int majVer, int minVer, int bldNo, int revNo) {
-      major = (ushort)majVer;
-      minor = (ushort)minVer;
-      build = (ushort)bldNo;
-      revision = (ushort)revNo;
-      hasVersion = true;
-    }
-
-    /// <summary>
-    /// Add the hash value for this external assembly
-    /// </summary>
-    /// <param name="hash">bytes of the hash value</param>
-    public void AddHash(byte[] hash) {
-      hashIx = metaData.AddToBlobHeap(hash); 
-    }
-
-    /// <summary>
-    /// Set the culture for this external assembly
-    /// </summary>
-    /// <param name="cult">the culture string</param>
-    public void AddCulture(string cult) {
-      cultIx = metaData.AddToStringsHeap(cult);
-      culture = cult;
-    }
-
-    /// <summary>
-    /// Add the full public key for this external assembly
-    /// </summary>
-    /// <param name="key">bytes of the public key</param>
-    public void AddKey(byte[] key) {
-      flags |= 0x0001;   // full public key
-      keyBytes = key;
-      keyIx = metaData.AddToBlobHeap(key); 
-    }
-
-    /// <summary>
-    /// Add the public key token (low 8 bytes of the public key)
-    /// </summary>
-    /// <param name="key">low 8 bytes of public key</param>
-    public void AddKeyToken(byte[] key) {
-      keyIx = metaData.AddToBlobHeap(key); 
-      keyBytes = key;
-      isKeyToken = true;
-    }
-
-    /// <summary>
-    /// Add a class to this external assembly
-    /// </summary>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns></returns>
-    public virtual ClassRef AddClass(string nsName, string name) {
-      ClassRef aClass = new ClassRef(nsName,name,metaData);
-      metaData.AddToTable(MDTable.TypeRef,aClass);
-      aClass.SetParent(this);
-      return aClass;
-    }
-
-    /// <summary>
-    /// Add a value class to this external assembly
-    /// </summary>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns></returns>
-    public virtual ClassRef AddValueClass(string nsName, string name) {
-      ClassRef aClass = new ClassRef(nsName,name,metaData);
-      metaData.AddToTable(MDTable.TypeRef,aClass);
-      aClass.SetParent(this);
-      aClass.MakeValueClass(ValueClass.ValueType);
-      return aClass;
-    }
-
-    internal string TypeName() {
-      string result = name;
-      if (hasVersion) 
-        result = result + ", Version=" + major + "." + minor + "." + 
-                  build + "." + revision;
-      if (keyBytes != null) {
-        string tokenStr = "=";
-        if (isKeyToken) tokenStr = "Token=";
-        result = result + ", PublicKey" + tokenStr;
-        for (int i=0; i < keyBytes.Length; i++) {
-          result = result + Hex.Byte(keyBytes[i]);
-        }
-      }
-      if (culture != null) 
-        result = result + ", Culture=" + culture;
-      return result;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 12 + 2 * md.StringsIndexSize() + 2 * md.BlobIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(major);
-      output.Write(minor);
-      output.Write(build);
-      output.Write(revision);
-      output.Write(flags);
-      output.BlobIndex(keyIx);
-      output.StringsIndex(nameIx);
-      output.StringsIndex(cultIx);
-      output.BlobIndex(hashIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.ResolutionScope) : return 2; 
-        case (CIx.HasCustomAttr) : return 15; 
-        case (CIx.Implementation) : return 1; 
-      }
-      return 0;
-    }
-
-        }
-  /**************************************************************************/  
-
-  /// <summary>
-  /// flags for the assembly (.corflags)
-  /// </summary>
-  public enum CorFlags {CF_IL_ONLY = 1, CF_32_BITREQUIRED = 2,
-                        CF_STRONGNAMESIGNED = 8, CF_TRACKDEBUGDATA = 0x10000 }
-
-  /// <summary>
-  /// subsystem for the assembly (.subsystem)
-  /// </summary>
-  public enum SubSystem { Native = 1, Windows_GUI = 2, 
-    Windows_CUI = 3, OS2_CUI = 5, POSIX_CUI = 7, Native_Windows = 8, 
-    Windows_CE_GUI = 9}
-  /// <summary>
-  /// Hash algorithms for the assembly
-  /// </summary>
-  public enum HashAlgorithm { None, SHA1 }
-
-  /// <summary>
-  /// Attributes for this assembly
-  /// </summary>
-  public enum AssemAttr { EnableJITCompileTracking = 0x8000, 
-                          DisableJITCompileOptimizer = 0x4000}
-
-  /// <summary>
-  /// Method call conventions
-  /// </summary>
-  public enum CallConv { Default, Cdecl, Stdcall, Thiscall, 
-    Fastcall, Vararg, Instance = 0x20, Generic = 0x10, InstanceExplicit = 0x60 }
-
-  /// <summary>
-  /// Type custom modifier
-  /// </summary>
-  public enum CustomModifier { modreq = 0x1F, modopt };
-
-  /// <summary>
-  /// Attibutes for a class
-  /// </summary>
-  public enum TypeAttr {Private, Public, NestedPublic, NestedPrivate, 
-    NestedFamily, NestedAssembly, NestedFamAndAssem, NestedFamOrAssem, 
-    SequentialLayout, ExplicitLayout = 0x10, Interface = 0x20, 
-    Abstract = 0x80, PublicAbstract = 0x81, Sealed = 0x100, 
-    PublicSealed = 0x101, SpecialName = 0x400, RTSpecialName = 0x800, 
-    Import = 0x1000, Serializable = 0x2000, UnicodeClass = 0x10000,
-    AutoClass = 0x20000, HasSecurity = 0x40000, BeforeFieldInit = 0x100000 }
-
-  /// <summary>
-  /// Attributes for a field
-  /// </summary>
-  public enum FieldAttr {Default, Private, FamAndAssem, Assembly, 
-    Family, FamOrAssem, Public, Static = 0x10, PublicStatic = 0x16, 
-    Initonly = 0x20, Literal = 0x40, Notserialized = 0x80, 
-    SpecialName = 0x200, RTSpecialName = 0x400, HasFieldMarshal = 0x1000 }
-  
-  /// <summary>
-  /// Attributes for a method
-  /// </summary>
-  public enum MethAttr { Default, Private, FamAndAssem, Assembly,
-    Family, FamOrAssem, Public, Static = 0x0010, PublicStatic = 0x16, 
-    Final = 0x0020, PublicStaticFinal = 0x36, Virtual = 0x0040, 
-    PrivateVirtual, PublicVirtual = 0x0046, HideBySig = 0x0080, 
-    NewSlot = 0x0100, Abstract = 0x0400, SpecialName = 0x0800,
-    RTSpecialName = 0x1000, SpecialRTSpecialName = 0x1800, 
-    HasSecurity = 0x4000, RequireSecObject = 0x8000}
-
-  /// <summary>
-  /// Attributes for .pinvokeimpl method declarations
-  /// </summary>
-  public enum PInvokeAttr { nomangle = 1, ansi = 2, unicode = 4, autochar = 6,
-                            lasterr = 0x0040, winapi = 0x0100, cdecl = 0x0200,
-                            stdcall = 0x0300, thiscall = 0x0400, fastcall = 0x0500 }
-
-  /// <summary>
-  /// Implementation attributes for a method
-  /// </summary>
-  public enum ImplAttr { IL, Native, Runtime = 0x03, Unmanaged = 0x04,
-    ForwardRef = 0x10, PreserveSig = 0x0080, InternalCall = 0x1000, 
-    Synchronised = 0x0020, Synchronized = 0x0020, NoInLining = 0x0008, Optil = 0x0002}
-
-  /// <summary>
-  /// Modes for a parameter
-  /// </summary>
-  public enum ParamAttr { Default, In, Out, Opt = 16, HasDefault = 0x1000, HasFieldMarshal = 0x2000 }
-
-  /// <summary>
-  /// CIL instructions
-  /// </summary>
-  public enum Op { nop, breakOp, ldarg_0, ldarg_1, ldarg_2, ldarg_3,
-    ldloc_0, ldloc_1, ldloc_2, ldloc_3, stloc_0, stloc_1, stloc_2, stloc_3, 
-    ldnull = 0x14, ldc_i4_m1, ldc_i4_0, ldc_i4_1, ldc_i4_2, ldc_i4_3, 
-    ldc_i4_4, ldc_i4_5, ldc_i4_6, ldc_i4_7, ldc_i4_8, dup = 0x25, pop, 
-    ret = 0x2A, ldind_i1 = 0x46, ldind_u1, ldind_i2, ldind_u2, ldind_i4, 
-    ldind_u4, ldind_i8, ldind_i,  ldind_r4, ldind_r8, ldind_ref, stind_ref, 
-    stind_i1, stind_i2, stind_i4, stind_i8, stind_r4, stind_r8, add, sub, mul,
-    div, div_un, rem, rem_un, and, or, xor, shl, shr, shr_un, neg, not, 
-    conv_i1, conv_i2, conv_i4, conv_i8, conv_r4, conv_r8, conv_u4, conv_u8, 
-    conv_r_un = 0x76, throwOp = 0x7A, conv_ovf_i1_un = 0x82, conv_ovf_i2_un,
-    conv_ovf_i4_un, conv_ovf_i8_un, conf_ovf_u1_un, conv_ovf_u2_un, 
-    conv_ovf_u4_un, conv_ovf_u8_un, conv_ovf_i_un, conv_ovf_u_un, 
-    ldlen = 0x8E, ldelem_i1 = 0x90, ldelem_u1, ldelem_i2, ldelem_u2, 
-    ldelem_i4, ldelem_u4, ldelem_i8, ldelem_i, ldelem_r4, ldelem_r8, 
-    ldelem_ref, stelem_i, stelem_i1, stelem_i2, stelem_i4, stelem_i8, stelem_r4 = 0xA0, stelem_r8,
-    stelem_ref, conv_ovf_i1 = 0xb3, conv_ovf_u1, conv_ovf_i2, conv_ovf_u2, 
-    conv_ovf_i4, conv_ovf_u4, conv_ovf_i8, conv_ovf_u8, ckfinite = 0xC3, 
-    conv_u2 = 0xD1, conv_u1, conv_i, conv_ovf_i, conv_ovf_u, add_ovf, 
-    add_ovf_un, mul_ovf, mul_ovf_un, sub_ovf, sub_ovf_un, endfinally, 
-    stind_i = 0xDF, conv_u, arglist = 0xFE00, ceq, cgt, cgt_un, clt, clt_un, 
-    localloc = 0xFE0F, endfilter = 0xFE11, volatile_ = 0xFE13, tail_, 
-    cpblk = 0xFE17, initblk, rethrow = 0xFE1A, refanytype = 0xFE1D}
-
-  /// <summary>
-  /// CIL instructions requiring an integer parameter
-  /// </summary>
-  public enum IntOp {ldarg_s = 0x0E, ldarga_s, starg_s, ldloc_s, ldloca_s, 
-                     stloc_s, ldc_i4_s = 0x1F, ldc_i4, ldarg = 0xFE09,
-                     ldarga, starg, ldloc, ldloca, stloc, unaligned = 0xFE12 }
-
-  /// <summary>
-  /// CIL instructions requiring a field parameter
-  /// </summary>
-  public enum FieldOp {ldfld = 0x7B, ldflda, stfld, ldsfld, ldsflda,
-                       stsfld, ldtoken = 0xD0 }
-
-  /// <summary>
-  /// CIL instructions requiring a method parameter
-  /// </summary>
-  public enum MethodOp {jmp = 0x27, call, callvirt = 0x6F, newobj = 0x73, 
-                        ldtoken = 0xD0, ldftn = 0xFE06, ldvirtfn }
-
-  /// <summary>
-  /// CIL instructions requiring a type parameter
-  /// </summary>
-  public enum TypeOp {cpobj = 0x70, ldobj, castclass = 0x74, isinst, 
-                      unbox = 0x79, stobj = 0x81, box = 0x8C, newarr, 
-                      ldelema = 0x8F, refanyval = 0xC2, mkrefany = 0xC6, 
-                      ldtoken = 0xD0, initobj = 0xFE15, sizeOf = 0xFE1C,
-                      ldelem = 0xA3, stelem = 0xA4, unbox_any }
-
-  /// <summary>
-  /// CIL branch instructions
-  /// </summary>
-  public enum BranchOp {
-          // short branches
-          br_s = 0x2B, brfalse_s, brtrue_s, beq_s, bge_s, bgt_s,
-          ble_s, blt_s, bne_un_s, bge_un_s, bgt_un_s, ble_un_s, blt_un_s,
-          // long branches
-          br = 0x38, brfalse, brtrue, beq, bge, bgt, ble, blt,
-          bne_un, bge_un, bgt_un, ble_un, blt_un,
-
-          leave = 0xDD, leave_s }
-
-  /// <summary>
-  /// Index for all the tables in the meta data
-  /// </summary>
-  public enum MDTable { Module, TypeRef, TypeDef, Field = 0x04, Method = 0x06,
-    Param = 0x08, InterfaceImpl, MemberRef, Constant, CustomAttribute, 
-    FieldMarshal, DeclSecurity, ClassLayout, FieldLayout, StandAloneSig, 
-    EventMap, Event = 0x14, PropertyMap, Property = 0x17, MethodSemantics, 
-    MethodImpl, ModuleRef, TypeSpec, ImplMap, FieldRVA, Assembly = 0x20, 
-    AssemblyProcessor, AssemblyOS, AssemblyRef, AssemblyRefProcessor, 
-    AssemblyRefOS, File, ExportedType, ManifestResource, NestedClass,
-    GenericParam, MethodSpec, GenericParamConstraint  }
-
-  public enum SafeArrayType { int16 = 2, int32, float32, float64,
-    currency, date, bstr, dispatch, error, boolean, variant, unknown,
-    Decimal, int8 = 16, uint8, uint16, uint32, Int = 22, UInt }
-
-  internal enum CIx { TypeDefOrRef, HasConst, HasCustomAttr, HasFieldMarshal,
-    HasDeclSecurity, MemberRefParent, HasSemantics, MethodDefOrRef, 
-    MemberForwarded, Implementation, CustomAttributeType, ResolutionScope,
-    TypeOrMethodDef, MaxCIx }
-
-  internal enum MapType { eventMap, propertyMap, nestedClass }
-
-  /* Taken from Mono.Cecil */
-  public enum SecurityAction : short {
-       Request = 1,
-       Demand = 2,
-       Assert = 3,
-       Deny = 4,
-       PermitOnly = 5,
-       LinkDemand = 6,
-       InheritDemand = 7,
-       RequestMinimum = 8,
-       RequestOptional = 9,
-       RequestRefuse = 10,
-       PreJitGrant = 11,
-       PreJitDeny = 12,
-       NonCasDemand = 13,
-       NonCasLinkDemand = 14,
-       NonCasInheritance = 15,
-       LinkDemandChoice = 16,
-       InheritDemandChoice = 17,
-       DemandChoice = 18
- }
-
-  /**************************************************************************/  
-        /// <summary>
-        /// The assembly for mscorlib.  
-        /// </summary>
-        public sealed class MSCorLib : AssemblyRef
-        {
-    private static readonly int valueTypeIx = 18;
-    private readonly string systemName = "System";
-    private Class[] systemClasses = new Class[valueTypeIx+2];
-    private PrimitiveType[] systemTypes = new PrimitiveType[valueTypeIx];
-    private TypeSpec[] specialTypeSpecs = new TypeSpec[valueTypeIx];
-    private static int[] specialNames = {
-      PrimitiveType.Void.GetName().GetHashCode(),
-      PrimitiveType.Boolean.GetName().GetHashCode(),
-      PrimitiveType.Char.GetName().GetHashCode(),
-      PrimitiveType.Int8.GetName().GetHashCode(),
-      PrimitiveType.UInt8.GetName().GetHashCode(),
-      PrimitiveType.Int16.GetName().GetHashCode(),
-      PrimitiveType.UInt16.GetName().GetHashCode(),
-      PrimitiveType.Int32.GetName().GetHashCode(),
-      PrimitiveType.UInt32.GetName().GetHashCode(),
-      PrimitiveType.Int64.GetName().GetHashCode(),
-      PrimitiveType.UInt64.GetName().GetHashCode(),
-      PrimitiveType.Float32.GetName().GetHashCode(),
-      PrimitiveType.Float64.GetName().GetHashCode(),
-      PrimitiveType.String.GetName().GetHashCode(),
-      PrimitiveType.TypedRef.GetName().GetHashCode(),
-      PrimitiveType.IntPtr.GetName().GetHashCode(),
-      PrimitiveType.UIntPtr.GetName().GetHashCode(),
-      PrimitiveType.Object.GetName().GetHashCode(),
-      PrimitiveType.ValueType.GetName ().GetHashCode(),
-      "Enum".GetHashCode()
-    };
-
-    internal MSCorLib(MetaData md) : base(md,"mscorlib") {
-      if (!PEFile.IsMSCorlib)
-             md.AddToTable(MDTable.AssemblyRef,this);
-      systemTypes[PrimitiveType.Void.GetSystemTypeIx()] = PrimitiveType.Void;
-      systemTypes[PrimitiveType.Boolean.GetSystemTypeIx()] = PrimitiveType.Boolean;
-      systemTypes[PrimitiveType.Char.GetSystemTypeIx()] = PrimitiveType.Char;
-      systemTypes[PrimitiveType.Int8.GetSystemTypeIx()] = PrimitiveType.Int8;
-      systemTypes[PrimitiveType.UInt8.GetSystemTypeIx()] = PrimitiveType.UInt8;
-      systemTypes[PrimitiveType.Int16.GetSystemTypeIx()] = PrimitiveType.Int16;
-      systemTypes[PrimitiveType.UInt16.GetSystemTypeIx()] = PrimitiveType.UInt16;
-      systemTypes[PrimitiveType.Int32.GetSystemTypeIx()] = PrimitiveType.Int32;
-      systemTypes[PrimitiveType.UInt32.GetSystemTypeIx()] = PrimitiveType.UInt32;
-      systemTypes[PrimitiveType.Int64.GetSystemTypeIx()] = PrimitiveType.Int64;
-      systemTypes[PrimitiveType.UInt64.GetSystemTypeIx()] = PrimitiveType.UInt64;
-      systemTypes[PrimitiveType.Float32.GetSystemTypeIx()] = PrimitiveType.Float32;
-      systemTypes[PrimitiveType.Float64.GetSystemTypeIx()] = PrimitiveType.Float64;
-      systemTypes[PrimitiveType.IntPtr.GetSystemTypeIx()] = PrimitiveType.IntPtr;
-      systemTypes[PrimitiveType.UIntPtr.GetSystemTypeIx()] = PrimitiveType.UIntPtr;
-      systemTypes[PrimitiveType.String.GetSystemTypeIx()] = PrimitiveType.String;
-      systemTypes[PrimitiveType.Object.GetSystemTypeIx()] = PrimitiveType.Object;
-      systemTypes[PrimitiveType.TypedRef.GetSystemTypeIx()] = PrimitiveType.TypedRef;
-    }
-
-    /// <summary>
-    /// Add a class to the mscorlib assembly
-    /// </summary>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns></returns>
-    public override ClassRef AddClass(string nsName, string name) {
-      /* This gets called by !mscorlib, for adding references INTO mscorlib, so
-         it should be returning ClassRef ..*/
-      Class aClass = GetSpecialClass(nsName,name);
-      if (aClass == null) {
-        aClass = new ClassRef(nsName,name,metaData);
-        metaData.AddToTable(MDTable.TypeRef,aClass);
-       if (aClass is ClassRef)
-               ((ClassRef) aClass).SetParent(this);
-      }
-      //FIXME: Check for !ClassRef here?
-      return (ClassRef) aClass;
-    }
-
-    private Class GetSpecialClass(string nsName,string name) {
-      if (nsName.CompareTo(systemName) != 0) return null;
-      int hash = name.GetHashCode();
-      for (int i=0; i < specialNames.Length; i++) {
-        if (hash != specialNames[i])
-          continue;
-        if (systemClasses[i] == null) {
-          if (i < valueTypeIx) {
-            systemClasses[i] = new SystemClass(systemTypes[i],this,metaData);
-            if ((systemTypes[i] != PrimitiveType.Object) &&
-              (systemTypes[i] != PrimitiveType.String)) {
-              systemClasses[i].MakeValueClass(ValueClass.ValueType);
-            }
-          } else {
-            systemClasses[i] = new ClassRef(nsName,name,metaData);
-            ((ClassRef) systemClasses[i]).SetParent(this);
-            if (!ClassDef.IsValueType (nsName, name) && !ClassDef.IsEnum (nsName, name))
-              systemClasses[i].MakeValueClass(ValueClass.ValueType);
-          }
-          metaData.AddToTable(MDTable.TypeRef,systemClasses[i]);
-        }
-        return systemClasses[i];
-      }
-      return null;
-    }
-
-    internal void SetSpecialSystemClass (string nsName, string name, Class aClass) {
-      if (nsName != systemName) return;
-      int hash = name.GetHashCode ();
-      for (int i = 0; i < specialNames.Length; i++) {
-        if (hash != specialNames [i])
-          continue;
-        if (systemClasses [i] == null) {
-          systemClasses [i] = aClass;
-        }
-      }
-    }
-
-    internal Class GetSpecialSystemClass(PrimitiveType pType) {
-      int ix = pType.GetSystemTypeIx();
-      if (systemClasses[ix] == null && !PEFile.IsMSCorlib) {
-        systemClasses[ix] = new SystemClass(pType,this,metaData);
-        metaData.AddToTable(MDTable.TypeRef,systemClasses[ix]);
-      }
-      return systemClasses[ix];
-    }
-        
-    private ClassRef GetValueClass(string name, int hash) {
-      /* Called by MSCorLib.AddValueClass, which is called by
-         !mscorlib, for adding ref to value class INTO mscorlib,
-         so this should be classref */
-      int ix = valueTypeIx;
-      if (hash != specialNames[valueTypeIx]) ix++;
-      if (systemClasses[ix] == null) {
-        systemClasses[ix] = new ClassRef(systemName,name,metaData);
-        ((ClassRef) systemClasses[ix]).SetParent(this);
-        ((ClassRef) systemClasses[ix]).MakeValueClass(ValueClass.ValueType);
-        metaData.AddToTable(MDTable.TypeRef,systemClasses[ix]);
-      }
-      return (ClassRef) systemClasses[ix];
-    }
-
-    internal Class ValueType() {
-      if (systemClasses[valueTypeIx] == null && !PEFile.IsMSCorlib) {
-        ClassRef valType = new ClassRef("System","ValueType",metaData);
-        valType.SetParent(this);
-        valType.MakeValueClass(ValueClass.ValueType);
-        metaData.AddToTable(MDTable.TypeRef,valType);
-        systemClasses[valueTypeIx] = valType;
-      }
-      return systemClasses[valueTypeIx];
-    }
-
-    internal Class EnumType() {
-      /* Called by both mscorlib & !mscorlib, so can be
-         either ClassRef or ClassDef */
-      //systemClasses [ valueTypeIx + 1] -> System.Enum
-      if (systemClasses[valueTypeIx + 1] == null && !PEFile.IsMSCorlib) {
-        ClassRef valType = new ClassRef("System","Enum",metaData);
-        valType.SetParent(this);
-        valType.MakeValueClass(ValueClass.Enum);
-        metaData.AddToTable(MDTable.TypeRef,valType);
-        systemClasses[valueTypeIx + 1] = valType;
-      }
-      return systemClasses[valueTypeIx + 1];
-    }
-
-    /// <summary>
-    /// Add a value class to this external assembly
-    /// </summary>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns></returns>
-    public override ClassRef AddValueClass(string nsName, string name) {
-      if (nsName.CompareTo(systemName) == 0) {
-        int hash = name.GetHashCode();
-        if ((hash == specialNames[valueTypeIx]) ||
-            (hash == specialNames[valueTypeIx+1])) {
-          return GetValueClass(name,hash);
-        }
-      }
-      ClassRef aClass = new ClassRef(nsName,name,metaData);
-      metaData.AddToTable(MDTable.TypeRef,aClass);
-      aClass.SetParent(this);
-      aClass.MakeValueClass(ValueClass.ValueType);
-      return aClass;
-    }
-
-        }
-        public enum ValueClass
-        {
-                ValueType,
-                Enum
-        }
-
-  /**************************************************************************/  
-        /// <summary>
-        /// Signature for calli instruction
-        /// </summary>
-        public class CalliSig : Signature
-        {
-    private static readonly byte Sentinel = 0x41;
-    CallConv callConv;
-    Type returnType;
-    Type[] parameters, optParams;
-                uint numPars = 0, numOptPars = 0;
-
-    /// <summary>
-    /// Create a signature for a calli instruction
-    /// </summary>
-    /// <param name="cconv">calling conventions</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">parameter types</param>
-    public CalliSig(CallConv cconv, Type retType, Type[] pars) {
-                        tabIx = MDTable.StandAloneSig;
-      callConv = cconv;
-      returnType = retType;
-      parameters = pars;
-                        if (pars != null) numPars = (uint)pars.Length;
-    }
-
-    /// <summary>
-    /// Add the optional parameters to a vararg method
-    /// This method sets the vararg calling convention
-    /// </summary>
-    /// <param name="optPars">the optional pars for the vararg call</param>
-    public void AddVarArgs(Type[] optPars) {
-      optParams = optPars;
-      if (optPars != null) numOptPars = (uint)optPars.Length;
-      callConv |= CallConv.Vararg;
-    }
-
-    /// <summary>
-    /// Add extra calling conventions to this callsite signature
-    /// </summary>
-    /// <param name="cconv"></param>
-    public void AddCallingConv(CallConv cconv) {
-      callConv |= cconv;
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      MemoryStream sig = new MemoryStream();
-      sig.WriteByte((byte)callConv);
-      MetaData.CompressNum(numPars+numOptPars,sig);
-      returnType.TypeSig(sig);
-      for (int i=0; i < numPars; i++) {
-        parameters[i].TypeSig(sig);
-      }
-      sigIx = md.AddToBlobHeap(sig.ToArray());
-      if (numOptPars > 0) {
-        sig.WriteByte(Sentinel);
-        for (int i=0; i < numOptPars; i++) {
-          optParams[i].TypeSig(sig);
-        }
-      }
-      done = true;
-    }
-
-        }
-  /**************************************************************************/  
-  /// <summary>
-  /// The IL instructions for a method
-  /// </summary>
-  public class CILInstructions 
-  {
-
-    private static readonly uint ExHeaderSize = 4;
-    private static readonly uint FatExClauseSize = 24;
-    private static readonly uint SmlExClauseSize = 12;
-    private static readonly sbyte maxByteVal = 127;
-    private static readonly sbyte minByteVal = -128;
-    private static readonly byte maxUByteVal = 255;
-    private static readonly int smallSize = 64;
-    private static readonly ushort TinyFormat = 0x2;
-    private static readonly ushort FatFormat = 0x3003;
-    private static readonly ushort MoreSects = 0x8;
-    private static readonly ushort InitLocals = 0x10;
-    private static readonly uint FatSize = 12;
-    private static readonly uint FatWords = FatSize/4;
-    private static readonly byte FatExceptTable = 0x41;
-    private static readonly byte SmlExceptTable = 0x01; 
-
-    private MetaData metaData;
-    private ArrayList exceptions, blockStack;
-    //private bool codeChecked = false;
-    private static readonly int INITSIZE = 5;
-    private CILInstruction[] buffer = new CILInstruction[INITSIZE];
-    private int tide = 0;
-    private uint offset = 0;
-    private ushort headerFlags = 0;
-    private short maxStack;
-    private uint paddingNeeded = 0;
-    private byte exceptHeader = 0;
-    uint localSigIx = 0;
-    uint codeSize = 0, exceptSize = 0;
-    bool tinyFormat, fatExceptionFormat = false;
-
-    public uint Offset {
-       get { return offset; }
-    }  
-
-    internal CILInstructions(MetaData md) {
-      metaData = md;
-    }
-
-    private void AddToBuffer(CILInstruction inst) {
-      if (tide >= buffer.Length) {
-        CILInstruction[] tmp = buffer;
-        buffer = new CILInstruction[tmp.Length * 2];
-        for (int i=0; i < tide; i++) {
-          buffer[i] = tmp[i];
-        }
-      }
-                        //Console.WriteLine("Adding instruction at offset " + offset + " with size " + inst.size);
-                        inst.offset = offset;
-      offset += inst.size;
-      buffer[tide++] = inst;
-    }
-
-    /// <summary>
-    /// Add a simple IL instruction
-    /// </summary>
-    /// <param name="inst">the IL instruction</param>
-    public void Inst(Op inst) {
-      AddToBuffer(new Instr((int)inst));
-    }
-
-    /// <summary>
-    /// Add an IL instruction with an integer parameter
-    /// </summary>
-    /// <param name="inst">the IL instruction</param>
-    /// <param name="val">the integer parameter value</param>
-    public void IntInst(IntOp inst, int val) {
-      int instr = (int)inst;
-      if ((inst == IntOp.ldc_i4_s) || (inst == IntOp.ldc_i4)) 
-        AddToBuffer(new IntInstr(instr,val,(inst == IntOp.ldc_i4_s)));
-      else
-        AddToBuffer(new UIntInstr(instr,val,((inst < IntOp.ldc_i4_s) ||
-                                              (inst == IntOp.unaligned))));
-    }
-
-    /// <summary>
-    /// Add the load long instruction
-    /// </summary>
-    /// <param name="cVal">the long value</param>
-    public void ldc_i8(long cVal) {
-      AddToBuffer(new LongInstr(0x21,cVal));
-    }
-
-    /// <summary>
-    /// Add the load float32 instruction
-    /// </summary>
-    /// <param name="cVal">the float value</param>
-    public void ldc_r4(float cVal) {
-      AddToBuffer(new FloatInstr(0x22,cVal));
-    }
-
-    /// <summary>
-    /// Add the load float64 instruction
-    /// </summary>
-    /// <param name="cVal">the float value</param>
-    public void ldc_r8(double cVal) {
-      AddToBuffer(new DoubleInstr(0x23,cVal));
-    }
-
-    /// <summary>
-    /// Add the load string instruction
-    /// </summary>
-    /// <param name="str">the string value</param>
-    public void ldstr(string str) {
-      AddToBuffer(new StringInstr(0x72,str));
-    }
-
-          /// <summary>
-          /// Add the load string instruction
-          /// </summary>
-          public void ldstr (byte[] str) {
-                  AddToBuffer (new StringInstr (0x72, str));
-          }
-          
-    /// <summary>
-    /// Add the calli instruction
-    /// </summary>
-    /// <param name="sig">the signature for the calli</param>
-    public void calli(CalliSig sig) {
-      AddToBuffer(new SigInstr(0x29,sig));
-    }
-
-    /// <summary>
-    /// Add a label to the CIL instructions
-    /// </summary>
-    /// <param name="lab">the label to be added</param>
-    public void CodeLabel(CILLabel lab) {
-      AddToBuffer(new LabelInstr(lab));
-    }
-
-    /// <summary>
-    /// Add an instruction with a field parameter
-    /// </summary>
-    /// <param name="inst">the CIL instruction</param>
-    /// <param name="f">the field parameter</param>
-    public void FieldInst(FieldOp inst, Field f) {
-      AddToBuffer(new FieldInstr((int)inst,f));
-    }
-
-    /// <summary>
-    /// Add an instruction with a method parameter
-    /// </summary>
-    /// <param name="inst">the CIL instruction</param>
-    /// <param name="m">the method parameter</param>
-    public void MethInst(MethodOp inst, Method m) {
-      AddToBuffer(new MethInstr((int)inst,m));
-    }
-
-    /// <summary>
-    /// Add an instruction with a type parameter
-    /// </summary>
-    /// <param name="inst">the CIL instruction</param>
-    /// <param name="t">the type argument for the CIL instruction</param>
-    public void TypeInst(TypeOp inst, Type aType) {
-      AddToBuffer(new TypeInstr((int)inst,aType,metaData));
-    }
-
-    /// <summary>
-    /// Add a branch instruction
-    /// </summary>
-    /// <param name="inst">the branch instruction</param>
-    /// <param name="lab">the label that is the target of the branch</param>
-    public void Branch(BranchOp inst,  CILLabel lab) {
-      AddToBuffer(new BranchInstr((int)inst,lab));
-    }
-
-    /// <summary>
-    /// Add a switch instruction
-    /// </summary>
-    /// <param name="labs">the target labels for the switch</param>
-    public void Switch(CILLabel[] labs) {
-      AddToBuffer(new SwitchInstr(0x45,labs));
-    }
-
-    /// <summary>
-    /// Add a byte to the CIL instructions (.emitbyte)
-    /// </summary>
-    /// <param name="bVal"></param>
-    public void emitbyte(byte bVal) { 
-      AddToBuffer(new CILByte(bVal));
-    }
-
-    /// <summary>
-    /// Add an instruction which puts an integer on TOS.  This method
-    /// selects the correct instruction based on the value of the integer.
-    /// </summary>
-    /// <param name="i">the integer value</param>
-    public void PushInt(int i) {
-      if (i == -1) {
-        AddToBuffer(new Instr((int)Op.ldc_i4_m1));
-      } else if ((i >= 0) && (i <= 8)) {
-        Op op = (Op)(Op.ldc_i4_0 + i);
-        AddToBuffer(new Instr((int)op));
-      } else if ((i >= minByteVal) && (i <= maxByteVal)) {
-        AddToBuffer(new IntInstr((int)IntOp.ldc_i4_s,i,true));
-      } else {
-        AddToBuffer(new IntInstr((int)IntOp.ldc_i4,i,false)); 
-      }
-    }
-
-    /// <summary>
-    /// Add the instruction to load a long on TOS
-    /// </summary>
-    /// <param name="l">the long value</param>
-    public void PushLong(long l) {
-      AddToBuffer(new LongInstr(0x21,l));
-    }
-
-    /// <summary>
-    /// Add an instruction to push the boolean value true on TOS
-    /// </summary>
-    public void PushTrue() {
-      AddToBuffer(new Instr((int)Op.ldc_i4_1));
-    }
-
-    /// <summary>
-    ///  Add an instruction to push the boolean value false on TOS
-    /// </summary>
-    public void PushFalse() {
-      AddToBuffer(new Instr((int)Op.ldc_i4_0));
-    }
-
-    /// <summary>
-    /// Add the instruction to load an argument on TOS.  This method
-    /// selects the correct instruction based on the value of argNo
-    /// </summary>
-    /// <param name="argNo">the number of the argument</param>
-    public void LoadArg(int argNo) {
-      if (argNo < 4) {
-        int op = (int)Op.ldarg_0 + argNo;
-        AddToBuffer(new Instr(op));
-      } else if (argNo <= maxUByteVal) {
-        AddToBuffer(new UIntInstr((int)IntOp.ldarg,argNo,true));
-      } else {
-        AddToBuffer(new UIntInstr(0x09,argNo,false)); 
-      }
-   }
-
-    /// <summary>
-    /// Add the instruction to load the address of an argument on TOS.
-    /// This method selects the correct instruction based on the value
-    /// of argNo.
-    /// </summary>
-    /// <param name="argNo">the number of the argument</param>
-    public void LoadArgAdr(int argNo) {
-      if (argNo <= maxUByteVal) {
-        AddToBuffer(new UIntInstr((int)IntOp.ldarga,argNo,true));
-      } else {
-        AddToBuffer(new UIntInstr(0x0A,argNo,false)); 
-      }
-    }
-
-    /// <summary>
-    /// Add the instruction to load a local on TOS.  This method selects
-    /// the correct instruction based on the value of locNo.
-    /// </summary>
-    /// <param name="locNo">the number of the local to load</param>
-    public void LoadLocal(int locNo) {
-      if (locNo < 4) {
-        int op = (int)Op.ldloc_0 + locNo;
-        AddToBuffer(new Instr(op));
-      } else if (locNo <= maxUByteVal) {
-        AddToBuffer(new UIntInstr((int)IntOp.ldloc,locNo,true));
-      } else {
-        AddToBuffer(new UIntInstr(0x0C,locNo,false)); 
-      }
-    }
-
-    /// <summary>
-    /// Add the instruction to load the address of a local on TOS.
-    /// This method selects the correct instruction based on the 
-    /// value of locNo.
-    /// </summary>
-    /// <param name="locNo">the number of the local</param>
-    public void LoadLocalAdr(int locNo) {
-      if (locNo <= maxUByteVal) {
-        AddToBuffer(new UIntInstr((int)IntOp.ldloca,locNo,true));
-      } else {
-        AddToBuffer(new UIntInstr(0x0D,locNo,false)); 
-      }
-    }
-
-    /// <summary>
-    /// Add the instruction to store to an argument.  This method
-    /// selects the correct instruction based on the value of argNo.
-    /// </summary>
-    /// <param name="argNo">the argument to be stored to</param>
-    public void StoreArg(int argNo) {
-      if (argNo <= maxUByteVal) {
-        AddToBuffer(new UIntInstr((int)IntOp.starg,argNo,true));
-      } else {
-        AddToBuffer(new UIntInstr(0x0B,argNo,false)); 
-      }
-    }
-
-    /// <summary>
-    /// Add the instruction to store to a local.  This method selects
-    /// the correct instruction based on the value of locNo.
-    /// </summary>
-    /// <param name="locNo">the local to be stored to</param>
-    public void StoreLocal(int locNo) {
-      if (locNo < 4) {
-        int op = (int)Op.stloc_0 + locNo;
-        AddToBuffer(new Instr(op));
-      } else if (locNo <= maxUByteVal) {
-        AddToBuffer(new UIntInstr((int)IntOp.stloc,locNo,true));
-      } else {
-        AddToBuffer(new UIntInstr(0x0E,locNo,false)); 
-      }
-    }
-
-    /// <summary>
-    /// Create a new CIL label.  To place the label in the CIL instruction
-    /// stream use CodeLabel.
-    /// </summary>
-    /// <returns>a new CIL label</returns>
-    public CILLabel NewLabel() {
-      return new CILLabel();
-    }
-
-    public void AddTryBlock(TryBlock tryBlock) {
-      if (exceptions == null) 
-        exceptions = new ArrayList();
-      else if (exceptions.Contains(tryBlock)) return;
-      exceptions.Add(tryBlock);
-    }
-
-    /// <summary>
-    /// Create a new label at this position in the code buffer
-    /// </summary>
-    /// <returns>the label at the current position</returns>
-    public CILLabel NewCodedLabel() {
-      CILLabel lab = new CILLabel();
-      AddToBuffer(new LabelInstr(lab));
-      return lab;
-    }
-
-    /// <summary>
-    /// Mark this position as the start of a new block
-    /// (try, catch, filter, finally or fault)
-    /// </summary>
-    public void StartBlock() {
-      if (blockStack == null) blockStack = new ArrayList();
-      blockStack.Insert(0,NewCodedLabel());
-    }
-
-    /// <summary>
-    /// Mark this position as the end of the last started block and
-    /// make it a try block.  This try block is added to the current 
-    /// instructions (ie do not need to call AddTryBlock)
-    /// </summary>
-    /// <returns>The try block just ended</returns>
-    public TryBlock EndTryBlock() {
-      TryBlock tBlock = new TryBlock((CILLabel)blockStack[0],NewCodedLabel());
-      blockStack.RemoveAt(0);
-      AddTryBlock(tBlock);
-      return tBlock;
-    }
-
-    /// <summary>
-    /// Mark this position as the end of the last started block and
-    /// make it a catch block.  This catch block is associated with the
-    /// specified try block.
-    /// </summary>
-    /// <param name="exceptType">the exception type to be caught</param>
-    /// <param name="tryBlock">the try block associated with this catch block</param>
-    public void EndCatchBlock(Class exceptType, TryBlock tryBlock) {
-      Catch catchBlock = new Catch(exceptType,(CILLabel)blockStack[0],
-        NewCodedLabel());
-      tryBlock.AddHandler(catchBlock);
-    }
-
-    /// <summary>
-    /// Mark this position as the end of the last started block and
-    /// make it a filter block.  This filter block is associated with the
-    /// specified try block.
-    /// </summary>
-    /// <param name="filterLab">the label where the filter code is</param>
-    /// <param name="tryBlock">the try block associated with this filter block</param>
-    public void EndFilterBlock(CILLabel filterLab, TryBlock tryBlock) {
-      Filter filBlock = new Filter(filterLab,(CILLabel)blockStack[0],NewCodedLabel());
-      tryBlock.AddHandler(filBlock);
-    }
-
-    /// <summary>
-    /// Mark this position as the end of the last started block and
-    /// make it a finally block.  This finally block is associated with the
-    /// specified try block.
-    /// </summary>
-    /// <param name="tryBlock">the try block associated with this finally block</param>
-    public void EndFinallyBlock(TryBlock tryBlock) {
-      Finally finBlock= new Finally((CILLabel)blockStack[0],NewCodedLabel());
-      tryBlock.AddHandler(finBlock);
-    }
-
-    /// <summary>
-    /// Mark this position as the end of the last started block and
-    /// make it a fault block.  This fault block is associated with the
-    /// specified try block.
-    /// </summary>
-    /// <param name="tryBlock">the try block associated with this fault block</param>
-    public void EndFaultBlock(TryBlock tryBlock) {
-      Fault fBlock= new Fault((CILLabel)blockStack[0],NewCodedLabel());
-      tryBlock.AddHandler(fBlock);
-    }
-
-    internal uint GetCodeSize() {
-      return codeSize + paddingNeeded + exceptSize;
-    }
-
-    internal void CheckCode(uint locSigIx, bool initLocals, int maxStack) {
-      if (tide == 0) return;
-      bool changed = true;
-      while (changed) {
-        changed = false;
-        for (int i=0; i < tide; i++) {
-          changed = buffer[i].Check(metaData) || changed;
-        }
-        if (changed) {
-          for (int i=1; i < tide; i++) {
-            buffer[i].offset = buffer[i-1].offset + buffer[i-1].size;
-          }
-          offset = buffer[tide-1].offset + buffer[tide-1].size;
-        }
-      }
-                        codeSize = offset;
-                        // Console.WriteLine("codeSize before header added = " + codeSize);
-      if ((offset < smallSize) && (maxStack <= 8) && (locSigIx == 0) && (exceptions == null)) {
-        // can use tiny header
-        //Console.WriteLine("Tiny Header");
-        tinyFormat = true;
-        headerFlags = (ushort)(TinyFormat | ((ushort)codeSize << 2));
-        codeSize++;
-        if ((codeSize % 4) != 0) { paddingNeeded = 4 - (codeSize % 4); }
-      } else {
-        //Console.WriteLine("Fat Header");
-        tinyFormat = false;
-        localSigIx = locSigIx;
-        this.maxStack = (short)maxStack;
-        headerFlags = FatFormat;
-        if (exceptions != null) {
-          // Console.WriteLine("Got exceptions");
-          headerFlags |= MoreSects;
-          uint numExceptClauses = 0;
-          for (int i=0; i < exceptions.Count; i++) {
-            TryBlock tryBlock = (TryBlock)exceptions[i];
-            tryBlock.SetSize();
-            numExceptClauses += (uint)tryBlock.NumHandlers();
-            if (tryBlock.isFat()) fatExceptionFormat = true;
-          }
-
-          uint data_size = ExHeaderSize + numExceptClauses *
-                 (fatExceptionFormat ? FatExClauseSize : SmlExClauseSize);
-
-          if (data_size > 255)
-                  fatExceptionFormat = true;
-                  
-          // Console.WriteLine("numexceptclauses = " + numExceptClauses);
-          if (fatExceptionFormat) {
-            // Console.WriteLine("Fat exception format");
-            exceptHeader = FatExceptTable;
-            exceptSize = ExHeaderSize + numExceptClauses * FatExClauseSize;
-          } else {
-            // Console.WriteLine("Tiny exception format");
-            exceptHeader = SmlExceptTable;
-            exceptSize = ExHeaderSize + numExceptClauses * SmlExClauseSize;
-          }
-          // Console.WriteLine("exceptSize = " + exceptSize);
-        }
-        if (initLocals) headerFlags |= InitLocals;
-        if ((offset % 4) != 0) { paddingNeeded = 4 - (offset % 4); }
-        codeSize += FatSize;
-      }
-                  // Console.WriteLine("codeSize = " + codeSize + "  headerFlags = " + 
-      //                   Hex.Short(headerFlags));
-    }
-
-                internal void Write(FileImage output) {
-      // Console.WriteLine("Writing header flags = " + Hex.Short(headerFlags));
-                        if (tinyFormat) {
-        // Console.WriteLine("Writing tiny code");
-                                output.Write((byte)headerFlags);
-                        } else {
-        // Console.WriteLine("Writing fat code");
-                                output.Write(headerFlags);
-                                output.Write((ushort)maxStack);
-                                output.Write(offset);
-                                output.Write(localSigIx);
-                        }
-      // Console.WriteLine(Hex.Int(tide) + " CIL instructions");
-      // Console.WriteLine("starting instructions at " + output.Seek(0,SeekOrigin.Current));
-                        for (int i=0; i < tide; i++) {
-                                buffer[i].Write(output);
-                        }
-      // Console.WriteLine("ending instructions at " + output.Seek(0,SeekOrigin.Current));
-      for (int i=0; i < paddingNeeded; i++) { output.Write((byte)0); }
-      if (exceptions != null) {
-        // Console.WriteLine("Writing exceptions");
-        // Console.WriteLine("header = " + Hex.Short(exceptHeader) + " exceptSize = " + Hex.Int(exceptSize));
-        output.Write(exceptHeader);
-        output.Write3Bytes((uint)exceptSize);
-        for (int i=0; i < exceptions.Count; i++) {
-          TryBlock tryBlock = (TryBlock)exceptions[i];
-          tryBlock.Write(output,fatExceptionFormat);
-        }
-      }
-                }
-
-  }
-  /**************************************************************************/  
-        /// <summary>
-        /// A label in the IL
-        /// </summary>
-        public class CILLabel
-        {
-    CILInstruction branch;
-    CILInstruction[] multipleBranches;
-    int tide = 0;
-    CILInstruction labInstr;
-    uint offset = 0;
-    public CILLabel (uint offset) {
-        this.offset = offset;
-        }
-        
-
-    internal CILLabel() {
-    }
-
-    internal void AddBranch(CILInstruction instr) {
-      if (branch == null) {
-        branch = instr;
-        return;
-      }
-      if (multipleBranches == null) {
-        multipleBranches = new CILInstruction[2];
-      } else if (tide >= multipleBranches.Length) {
-        CILInstruction[] tmp = multipleBranches;
-        multipleBranches = new CILInstruction[tmp.Length*2];
-        for (int i=0; i < tide; i++) {
-          multipleBranches[i] = tmp[i];
-        }
-      }
-      multipleBranches[tide++] = instr;
-    }
-
-    internal void AddLabelInstr(LabelInstr lInstr) {
-      labInstr = lInstr;
-    }
-
-    internal uint GetLabelOffset() {
-      if (labInstr == null) return 0;
-      return labInstr.offset + offset;
-    }
-
-        }
-  /**************************************************************************/  
-  public abstract class CodeBlock {
-
-    private static readonly int maxCodeSize = 255;
-    protected CILLabel start, end;
-    protected bool small = true;
-
-    public CodeBlock(CILLabel start, CILLabel end) {
-      this.start = start;
-      this.end = end;
-    }
-
-    internal virtual bool isFat() {
-      // Console.WriteLine("block start = " + start.GetLabelOffset() +
-      //                  "  block end = " + end.GetLabelOffset());
-      return (end.GetLabelOffset() - start.GetLabelOffset()) > maxCodeSize;
-    }
-
-    internal virtual void Write(FileImage output, bool fatFormat) {
-      if (fatFormat) output.Write(start.GetLabelOffset());
-      else output.Write((short)start.GetLabelOffset());
-      uint len = end.GetLabelOffset() - start.GetLabelOffset();
-      if (fatFormat) output.Write(len);
-      else output.Write((byte)len);
-    }
-
-  }
-
-  /// <summary>
-  /// The descriptor for a guarded block (.try)
-  /// </summary>
-  public class TryBlock : CodeBlock {
-    protected bool fatFormat = false;
-    protected int flags = 0;
-    ArrayList handlers = new ArrayList();
-
-    /// <summary>
-    /// Create a new try block
-    /// </summary>
-    /// <param name="start">start label for the try block</param>
-    /// <param name="end">end label for the try block</param>
-    public TryBlock(CILLabel start, CILLabel end) : base(start,end) { }
-
-    /// <summary>
-    /// Add a handler to this try block
-    /// </summary>
-    /// <param name="handler">a handler to be added to the try block</param>
-    public void AddHandler(HandlerBlock handler) {
-      flags = handler.GetFlag();
-      handlers.Add(handler);
-    }
-
-    internal void SetSize() {
-      fatFormat = base.isFat();
-      if (fatFormat) return;
-      for (int i=0; i < handlers.Count; i++) {
-        HandlerBlock handler = (HandlerBlock)handlers[i];
-        if (handler.isFat()) {
-          fatFormat = true;
-          return;
-        }
-      }
-    }
-
-    internal int NumHandlers() {
-      return handlers.Count;
-  }
-
-    internal override bool isFat() {
-      return fatFormat;
-    }
-
-    internal override void Write(FileImage output, bool fatFormat) {
-      // Console.WriteLine("writing exception details");
-      for (int i=0; i < handlers.Count; i++) {
-        // Console.WriteLine("Except block " + i);
-        HandlerBlock handler = (HandlerBlock)handlers[i];
-        if (fatFormat) output.Write(flags);
-        else output.Write((short)flags);
-        // Console.WriteLine("flags = " + Hex.Short(flags));
-        base.Write(output,fatFormat);
-        handler.Write(output,fatFormat);
-      }
-    }
-  }
-
-  public abstract class HandlerBlock : CodeBlock 
-  {
-    protected static readonly short ExceptionFlag = 0;
-    protected static readonly short FilterFlag = 0x01;
-    protected static readonly short FinallyFlag = 0x02;
-    protected static readonly short FaultFlag = 0x04;
-
-    public HandlerBlock(CILLabel start, CILLabel end) : base(start,end) { }
-
-    internal virtual short GetFlag() { return ExceptionFlag; }
-
-    internal override void Write(FileImage output, bool fatFormat) {
-      base.Write(output,fatFormat);
-    }
-
-  }
-
-  /// <summary>
-  /// The descriptor for a catch clause (.catch)
-  /// </summary>
-  public class Catch : HandlerBlock 
-  {
-    Class exceptType;
-    
-    /// <summary>
-    /// Create a new catch clause
-    /// </summary>
-    /// <param name="except">the exception to be caught</param>
-    /// <param name="handlerStart">start of the handler code</param>
-    /// <param name="handlerEnd">end of the handler code</param>
-    public Catch(Class except, CILLabel handlerStart, CILLabel handlerEnd) 
-                                            : base(handlerStart,handlerEnd) {
-      exceptType = except;
-    }
-
-    internal override void Write(FileImage output, bool fatFormat) {
-      base.Write(output,fatFormat);
-      output.Write(exceptType.Token());
-    }
-  }
-
-  /// <summary>
-  /// The descriptor for a filter clause (.filter)
-  /// </summary>
-  public class Filter : HandlerBlock 
-  {
-    CILLabel filterLabel;
-
-    /// <summary>
-    /// Create a new filter clause
-    /// </summary>
-    /// <param name="filterLabel">the label where the filter code starts</param>
-    /// <param name="handlerStart">the start of the handler code</param>
-    /// <param name="handlerEnd">the end of the handler code</param>
-    public Filter(CILLabel filterLabel, CILLabel handlerStart, 
-                        CILLabel handlerEnd) : base(handlerStart,handlerEnd) {
-      this.filterLabel = filterLabel;
-    }
-
-    internal override short GetFlag() { 
-      return FilterFlag; 
-    }
-
-    internal override void Write(FileImage output, bool fatFormat) {
-      base.Write(output,fatFormat);
-      output.Write(filterLabel.GetLabelOffset());
-    }
-
-  }
-
-  /// <summary>
-  /// Descriptor for a finally block (.finally)
-  /// </summary>
-  public class Finally : HandlerBlock 
-  {
-    /// <summary>
-    /// Create a new finally clause
-    /// </summary>
-    /// <param name="finallyStart">start of finally code</param>
-    /// <param name="finallyEnd">end of finally code</param>
-    public Finally(CILLabel finallyStart, CILLabel finallyEnd)
-      : base(finallyStart,finallyEnd) { }
-
-    internal override short GetFlag() { 
-      return FinallyFlag; 
-    }
-
-    internal override void Write(FileImage output, bool fatFormat) {
-      base.Write(output,fatFormat);
-      output.Write((int)0);
-    }
-
-  }
-
-  /// <summary>
-  /// Descriptor for a fault block (.fault)
-  /// </summary>
-  public class Fault : HandlerBlock 
-  {
-    /// <summary>
-    /// Create a new fault clause
-    /// </summary>
-    /// <param name="faultStart">start of the fault code</param>
-    /// <param name="faultEnd">end of the fault code</param>
-    public Fault(CILLabel faultStart, CILLabel faultEnd)
-                                              : base(faultStart,faultEnd) { }
-
-    internal override short GetFlag() { 
-      return FaultFlag; 
-    }
-
-    internal override void Write(FileImage output, bool fatFormat) {
-      base.Write(output,fatFormat);
-      output.Write((int)0);
-      
-    }
-  }
-
-  /**************************************************************************/  
-  /// <summary>
-        /// The base descriptor for a class 
-        /// </summary>
-        public abstract class Class : Type
-        {
-    protected int row = 0;
-    public string name, nameSpace;
-    protected uint nameIx, nameSpaceIx;
-                protected MetaData _metaData;
-                internal Class(string nameSpaceName, string className, MetaData md)
-                                                              : base(PrimitiveType.Class.GetTypeIndex ()) {
-      nameSpace = nameSpaceName;
-      name = className;
-      nameIx = md.AddToStringsHeap(name);
-      nameSpaceIx = md.AddToStringsHeap(nameSpace);
-      _metaData = md;
-    }
-
-    internal Class(uint nsIx, uint nIx) : base(PrimitiveType.Class.GetTypeIndex ()) {
-      nameSpaceIx = nsIx;
-      nameIx = nIx;
-    }
-
-    internal virtual uint TypeDefOrRefToken() { return 0; }
-
-    internal virtual void MakeValueClass(ValueClass vClass) {
-      typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
-    }
-        
-    internal virtual string TypeName() {
-      return (nameSpace + "." + name);
-    }
-
-    internal override MetaDataElement GetTypeSpec(MetaData md) {
-      return this;
-    }
-        }
-  /**************************************************************************/  
-  // This Class produces entries in the TypeDef table of the MetaData 
-  // in the PE meta data.
-
-  // NOTE:  Entry 0 in TypeDef table is always the pseudo class <module> 
-  // which is the parent for functions and variables declared a module level
-
-  /// <summary>
-        /// The descriptor for a class defined in the IL (.class) in the current assembly/module
-        /// </summary>
-        /// 
-        public class ClassDef : Class
-        {
-    private static readonly byte ElementType_Class = 0x12;
-
-    Class superType;
-    ArrayList fields = new ArrayList();
-    ArrayList methods = new ArrayList();
-    ArrayList events;
-    ArrayList properties;
-    bool typeIndexChecked = true;
-    uint fieldIx = 0, methodIx = 0;
-    byte[] securityActions;
-    uint flags;
-    ClassLayout layout;
-    ClassDef parentClass;
-    MetaData metaData;
-    
-    internal ClassDef(TypeAttr attrSet, string nsName, string name, 
-                      MetaData md) : base(nsName, name, md) {
-                        metaData = md;
-      if (! ((nsName == "" && name == "<Module>") || (nsName == "System" && name == "Object")) ) {
-        superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
-      }
-      flags = (uint)attrSet;
-      tabIx = MDTable.TypeDef;
-    }
-
-    internal void SetSuper(Class sClass) {
-      superType = sClass;
-      if (sClass is ClassRef)
-        typeIndex = superType.GetTypeIndex();
-      else
-        typeIndexChecked = false;
-    }
-
-    internal override void MakeValueClass(ValueClass vClass) {
-      if (vClass == ValueClass.Enum)  
-        superType = metaData.mscorlib.EnumType();
-      else  
-        superType = metaData.mscorlib.ValueType();
-
-      typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
-    }
-
-    public void SpecialNoSuper() {
-      superType = null;
-    }
-
-    /// <summary>
-    /// Add an attribute to this class
-    /// </summary>
-    /// <param name="ta">the attribute to be added</param>
-    public void AddAttribute(TypeAttr ta) { 
-      flags |= (uint)ta;
-    }
-
-    /// <summary>
-    /// Add an interface that is implemented by this class
-    /// </summary>
-    /// <param name="iFace">the interface that is implemented</param>
-    public void AddImplementedInterface(Class iFace) {
-      metaData.AddToTable(MDTable.InterfaceImpl,new InterfaceImpl(this,iFace));
-    }
-
-    /// <summary>
-    ///  Add a named generic type parameter
-    /// </summary>
-    public GenericParameter AddGenericParameter (short index, string name) {
-            GenericParameter gp = new GenericParameter (this, metaData, index, name);
-            metaData.AddToTable (MDTable.GenericParam, gp);
-            return gp;
-    }
-
-    /// <summary>
-    /// Add a field to this class
-    /// </summary>
-    /// <param name="name">field name</param>
-    /// <param name="fType">field type</param>
-    /// <returns>a descriptor for this new field</returns>
-    public FieldDef AddField(string name, Type fType) {
-      FieldDef field = new FieldDef(name,fType);
-      fields.Add(field);
-      return field;
-    }
-
-    /// <summary>
-    /// Add a field to this class
-    /// </summary>
-    /// <param name="fAtts">attributes for this field</param>
-    /// <param name="name">field name</param>
-    /// <param name="fType">field type</param>
-    /// <returns>a descriptor for this new field</returns>
-    public FieldDef AddField(FieldAttr fAtts, string name, Type fType) {
-      FieldDef field = new FieldDef(fAtts,name,fType);
-      fields.Add(field);
-      return field;
-    }
-
-    public void SetFieldOrder (ArrayList fields)
-    {
-            this.fields = fields;
-    }
-
-    /// <summary>
-    /// Add a method to this class
-    /// </summary>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">parameters</param>
-    /// <returns>a descriptor for this new method</returns>
-    public MethodDef AddMethod(string name, Type retType, Param[] pars) {
-      // Console.WriteLine("Adding method " + name + " to class " + this.name);
-      MethodDef meth = new MethodDef(metaData,name,retType, pars);
-      methods.Add(meth);
-      return meth;
-    }
-
-    /// <summary>
-    /// Add a method to this class
-    /// </summary>
-    /// <param name="mAtts">attributes for this method</param>
-    /// <param name="iAtts">implementation attributes for this method</param>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">parameters</param>
-    /// <returns>a descriptor for this new method</returns>
-    public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, 
-                               Type retType, Param[] pars) {
-      // Console.WriteLine("Adding method " + name + " to class " + this.name);
-      MethodDef meth = new MethodDef(metaData,mAtts,iAtts,name,retType,pars);
-      methods.Add(meth);
-      return meth;
-    }
-
-    /// <summary>
-    /// Add an event to this class
-    /// </summary>
-    /// <param name="name">event name</param>
-    /// <param name="eType">event type</param>
-    /// <returns>a descriptor for this new event</returns>
-    public Event AddEvent(string name, Type eType) {
-      Event e = new Event(name,eType,this);
-      if (events == null) events = new ArrayList();
-      events.Add(e);
-      return e;
-    }
-
-    /// <summary>
-    /// Add a property to this class
-    /// </summary>
-    /// <param name="name">property name</param>
-    /// <param name="propType">property type</param>
-    /// <returns>a descriptor for this new property</returns>
-    public Property AddProperty(string name, Type retType, Type[] pars) {
-      Property p = new Property(name, retType, pars, this);
-      if (properties == null) properties = new ArrayList();
-      properties.Add(p);
-      return p;
-    }
-
-
-    /// <summary>
-    /// Add a nested class to this class
-    /// </summary>
-    /// <param name="attrSet">attributes for this nested class</param>
-    /// <param name="nsName">nested name space name</param>
-    /// <param name="name">nested class name</param>
-    /// <returns>a descriptor for this new nested class</returns>
-    public ClassDef AddNestedClass(TypeAttr attrSet, string nsName, 
-                                   string name) {
-      ClassDef nClass = new ClassDef(attrSet,"",name,metaData);
-      metaData.AddToTable(MDTable.TypeDef,nClass);
-      metaData.AddToTable(MDTable.NestedClass,new MapElem(nClass,Row,MDTable.TypeDef));
-      nClass.parentClass = this;
-      return (nClass);
-     }
-    public static bool IsValueType (Class type)
-    {
-        return IsValueType (type.nameSpace, type.name);
-    }
-
-    public static bool IsEnum (Class type)
-    {
-        return IsEnum (type.nameSpace, type.name);
-    }
-    
-    public static bool IsValueType (string nsName, string name)
-    {
-      return (nsName == "System" && name == "ValueType");
-    }
-
-    public static bool IsEnum (string nsName, string name)
-    {
-      return (nsName == "System" && name == "Enum");
-    }
-
-    /// <summary>
-    /// Add a nested class to this class
-    /// </summary>
-    /// <param name="attrSet">attributes for this nested class</param>
-    /// <param name="nsName">nested name space name</param>
-    /// <param name="name">nested class name</param>
-    /// <param name="sType">super type of this nested class</param>
-    /// <returns>a descriptor for this new nested class</returns>
-    public ClassDef AddNestedClass(TypeAttr attrSet, string nsName, 
-                                   string name, Class sType) {
-      ClassDef nClass = AddNestedClass (attrSet, nsName, name);
-      nClass.SetSuper(sType);
-      if (ClassDef.IsValueType (sType))
-        nClass.MakeValueClass (ValueClass.ValueType);
-      else
-      if (ClassDef.IsEnum (sType))
-        nClass.MakeValueClass (ValueClass.Enum);
-      
-      if (ClassDef.IsValueType (sType) || ClassDef.IsEnum (sType))
-        nClass.SetTypeIndex (PrimitiveType.ValueType.GetTypeIndex ());
-
-      nClass.typeIndexChecked = true;
-      return (nClass);
-    }
-
-    /// <summary>
-    /// Add layout information for this class.  This class must have the
-    /// sequential or explicit attribute.
-    /// </summary>
-    /// <param name="packSize">packing size (.pack)</param>
-    /// <param name="classSize">class size (.size)</param>
-    public void AddLayoutInfo (int packSize, int classSize) {
-      layout = new ClassLayout(packSize,classSize,this);
-    }
-
-    /// <summary>
-    /// Use a method as the implementation for another method (.override)
-    /// </summary>
-    /// <param name="decl">the method to be overridden</param>
-    /// <param name="body">the implementation to be used</param>
-    public void AddMethodOverride(Method decl, Method body) {
-      metaData.AddToTable(MDTable.MethodImpl,new MethodImpl(this,decl,body));
-    }
-
-    /// <summary>
-    /// Add security to this class NOT YET IMPLEMENTED
-    /// </summary>
-    /// <param name="permissionSet"></param>
-    public void AddSecurity(byte[] permissionSet) {
-      throw(new NotYetImplementedException("Class security "));
-      //flags |= HasSecurity;
-     // securityActions = permissionSet;
-    }
-
-    //public void AddLineInfo(int row, int col) { }
-
-    internal void CheckTypeIndex() {
-      if (typeIndexChecked) return;
-      if (!(superType is ClassRef)) 
-        ((ClassDef)superType).CheckTypeIndex();
-      typeIndex = superType.GetTypeIndex();
-      typeIndexChecked = true;
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      if ((flags & (uint)TypeAttr.Interface) != 0) { superType = null; }
-      // Console.WriteLine("Building tables for " + name);
-      if (layout != null) md.AddToTable(MDTable.ClassLayout,layout);
-      // Console.WriteLine("adding methods " + methods.Count);
-      methodIx = md.TableIndex(MDTable.Method);
-      for (int i=0; i < methods.Count; i++) {
-        md.AddToTable(MDTable.Method,(MetaDataElement)methods[i]);
-        ((MethodDef)methods[i]).BuildTables(md);
-      }
-      // Console.WriteLine("adding fields");
-      fieldIx = md.TableIndex(MDTable.Field);
-      for (int i=0; i < fields.Count; i++) {
-        md.AddToTable(MDTable.Field,(MetaDataElement)fields[i]);
-        ((FieldDef)fields[i]).BuildTables(md);
-      }
-      // Console.WriteLine("adding events and properties");
-      if (events != null) { 
-        for (int i=0; i < events.Count; i++) {
-          md.AddToTable(MDTable.Event,(Event)events[i]);
-          ((Event)events[i]).BuildTables(md);
-        }
-        md.AddToTable(MDTable.EventMap,
-          new MapElem(this,((Event)events[0]).Row,MDTable.Event));
-      }
-      if (properties != null) { 
-        for (int i=0; i < properties.Count; i++) {
-          md.AddToTable(MDTable.Property,(Property)properties[i]);
-          ((Property)properties[i]).BuildTables(md);
-        }
-        md.AddToTable(MDTable.PropertyMap,new MapElem(this,
-                          ((Property)properties[0]).Row,MDTable.Property));
-      }
-      // Console.WriteLine("End of building tables");
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 4 + 2 * md.StringsIndexSize() + 
-        md.CodedIndexSize(CIx.TypeDefOrRef) +
-        md.TableIndexSize(MDTable.Field) + 
-        md.TableIndexSize(MDTable.Method);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(flags);
-      output.StringsIndex(nameIx);
-      output.StringsIndex(nameSpaceIx);
-      //if (superType != null) 
-      // Console.WriteLine("getting coded index for superType of " + name + " = " + superType.GetCodedIx(CIx.TypeDefOrRef));
-      output.WriteCodedIndex(CIx.TypeDefOrRef,superType);
-      output.WriteIndex(MDTable.Field,fieldIx);
-      output.WriteIndex(MDTable.Method,methodIx);
-    }
-
-    internal sealed override uint TypeDefOrRefToken() {
-      uint cIx = Row;
-      cIx = cIx << 2;
-      return cIx;
-    }
-
-    internal sealed override void TypeSig(MemoryStream sig) {
-      if (!typeIndexChecked) CheckTypeIndex();
-      sig.WriteByte(GetTypeIndex());
-      MetaData.CompressNum(TypeDefOrRefToken(),sig);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.TypeDefOrRef) : return 0; 
-        case (CIx.HasCustomAttr) : return 3; 
-        case (CIx.HasDeclSecurity) : return 0; 
-        case (CIx.TypeOrMethodDef) : return 0; 
-      }
-      return 0;
-    }
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Layout information for a class (.class [sequential | explicit])
-        /// </summary>
-        internal class ClassLayout : MetaDataElement
-        {
-    ClassDef parent;
-    ushort packSize = 0;
-    uint classSize = 0;
-
-                internal ClassLayout(int pack, int cSize, ClassDef par) {
-      packSize = (ushort)pack;
-      classSize = (uint)cSize;
-      parent = par;
-      tabIx = MDTable.ClassLayout;
-                }
-
-    internal sealed override uint Size(MetaData md) {
-      return 6 + md.TableIndexSize(MDTable.TypeDef);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(packSize);
-      output.Write(classSize);
-      output.WriteIndex(MDTable.TypeDef,parent.Row);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a class/interface declared in another module of THIS 
-        /// assembly, or in another assembly.
-        /// </summary>
-        public class ClassRef : Class, IExternRef, IResolutionScope
-        {
-    protected IResolutionScope parent;
-    ExternClass externClass;
-    protected MetaData metaData;
-
-                internal ClassRef(string nsName, string name, MetaData md) : base(nsName, name, md) {
-      metaData = md;
-      tabIx = MDTable.TypeRef;
-    }
-
-    /// <summary>
-    /// Add a method to this class
-    /// </summary>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">parameter types</param>
-    /// <returns>a descriptor for this method</returns>
-    public MethodRef AddMethod(string name, Type retType, Type[] pars) {
-      MethodRef meth = new MethodRef(this,name,retType,pars,false,null);
-      metaData.AddToTable(MDTable.MemberRef,meth);
-      return meth;
-    }
-
-    /// <summary>
-    /// Add a method to this class
-    /// </summary>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">parameter types</param>
-    /// <returns>a descriptor for this method</returns>
-    public MethodRef AddVarArgMethod(string name, Type retType, 
-                                     Type[] pars, Type[] optPars) {
-      MethodRef meth = new MethodRef(this,name,retType,pars,true,optPars);
-      metaData.AddToTable(MDTable.MemberRef,meth);
-      return meth;
-    }
-
-    /// <summary>
-    /// Add a field to this class
-    /// </summary>
-    /// <param name="name">field name</param>
-    /// <param name="fType">field type</param>
-    /// <returns>a descriptor for this field</returns>
-    public FieldRef AddField(string name, Type fType) {
-      FieldRef field = new FieldRef(this,name,fType);
-      metaData.AddToTable(MDTable.MemberRef,field);
-      return field;
-    }
-
-    public ClassRef AddClass (string nsName, string name)
-    {
-      ClassRef aClass = new ClassRef(nsName,name,metaData);
-      metaData.AddToTable(MDTable.TypeRef,aClass);
-      aClass.SetParent(this);
-      return aClass;
-    }
-
-    public ClassRef AddValueClass (string nsName, string name)
-    {
-      ClassRef aClass = AddClass (nsName, name);
-      aClass.MakeValueClass (ValueClass.ValueType);
-      return aClass;
-    }
-
-    internal void SetParent(IResolutionScope par) {
-      parent = par;
-    }
-
-    internal override string TypeName() {
-      if ((parent != null) && (parent is AssemblyRef))
-        return (nameSpace + "." + name + ", " + ((AssemblyRef)parent).TypeName());
-      else 
-        return (nameSpace + name);
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.CodedIndexSize(CIx.ResolutionScope) + 2 * 
-             md.StringsIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteCodedIndex(CIx.ResolutionScope,(MetaDataElement) parent);
-      output.StringsIndex(nameIx);
-      output.StringsIndex(nameSpaceIx);
-    }
-
-    internal override sealed uint TypeDefOrRefToken() {
-      uint cIx = Row;
-      cIx = (cIx << 2) | 0x1;
-      return cIx;
-    }
-
-    internal override void TypeSig(MemoryStream sig) {
-      sig.WriteByte(GetTypeIndex());
-      MetaData.CompressNum(TypeDefOrRefToken(),sig);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.TypeDefOrRef) : return 1; 
-        case (CIx.HasCustomAttr) : return 2; 
-        case (CIx.MemberRefParent) : return 1; 
-        case (CIx.ResolutionScope) : return 3; 
-      }
-      return 0;
-    }
-        }
-  /**************************************************************************/  
-
-  public class ExternClassRef : ClassRef {
-
-    ExternClass externClass;
-
-    internal ExternClassRef(TypeAttr attrs, string nsName, string name,
-                          FileRef declFile, MetaData md) : base(nsName,name,md) {
-      externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declFile);
-      metaData.AddToTable(MDTable.ExportedType,externClass);
-    }
-
-    internal ExternClassRef(string name, MetaData md) : base(null,name,md) {
-    }
-
-    public ClassRef AddNestedClass(TypeAttr attrs, string name) {
-      ExternClassRef nestedClass = new ExternClassRef(name,metaData);
-      externClass = new ExternClass(attrs,0,nameIx,this.externClass);
-      metaData.AddToTable(MDTable.ExportedType,externClass);
-      return nestedClass;
-    }
-  }
-  /**************************************************************************/  
-  /// <summary>
-  /// Descriptor for a constant value
-  /// </summary>
-  public abstract class Constant {
-    protected uint size = 0;
-    protected Type type;
-    protected uint blobIndex;
-    protected bool addedToBlobHeap = false;
-
-                internal Constant()     {       }
-
-    internal virtual uint GetBlobIndex(MetaData md) { return 0; }
-
-    internal uint GetSize() { return size; }
-
-    internal byte GetTypeIndex() { return type.GetTypeIndex(); }
-
-    internal virtual void Write(BinaryWriter bw) {  }
-
-        }
-  /// <summary>
-  /// Descriptor for a constant value
-  /// </summary>
-  public abstract class DataConstant : Constant {
-    private uint dataOffset = 0;
-
-    internal DataConstant() { }
-
-    public uint DataOffset {
-      get { return dataOffset; }
-      set { dataOffset = value; }
-    }
-
-  }
-
-  /// <summary>
-  /// Boolean constant
-  /// </summary>
-  public class BoolConst : Constant {
-    bool val;
-
-    /// <summary>
-    /// Create a new boolean constant with the value "val"
-    /// </summary>
-    /// <param name="val">value of this boolean constant</param>
-    public BoolConst(bool val) {
-      this.val = val;
-      size = 1;
-      type = PrimitiveType.Boolean;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        if (val) blobIndex = md.AddToBlobHeap((sbyte)1);
-        else blobIndex = md.AddToBlobHeap((sbyte)0);
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      if (val) bw.Write((sbyte)1);
-      else bw.Write((sbyte)0);
-    }
-
-  }
-
-  public class ByteArrConst : DataConstant {
-    byte[] val;
-
-    public ByteArrConst(byte[] val) {
-      type = PrimitiveType.String;
-      this.val = val;
-      size = (uint)val.Length;
-    }
-
-    public Type Type {
-            get { return type; }
-            set { type = value; }
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        blobIndex = md.AddToBlobHeap(val);
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      bw.Write(val);
-    }
-
-  }
-
-  public class CharConst : Constant {
-    char val;
-
-    public CharConst(char val) {
-      this.val = val;
-      size = 2;
-      type = PrimitiveType.Char;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        blobIndex = md.AddToBlobHeap(val);
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      bw.Write(val);
-    }
-
-  }
-
-  public class FloatConst : DataConstant {
-    float val;
-
-    public FloatConst(float val) {
-      this.val = val;
-      size = 4;
-      type = PrimitiveType.Float32;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        blobIndex = md.AddToBlobHeap(val);
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      bw.Write(val);
-    }
-
-  }
-
-  public class DoubleConst : DataConstant {
-    double val;
-
-    public DoubleConst(double val) {
-      this.val = val;
-      size = 8;
-      type = PrimitiveType.Float64;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        blobIndex = md.AddToBlobHeap(val);
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      bw.Write(val);
-    }
-
-  }
-
-  public class IntConst : DataConstant {
-    long val;
-
-    public IntConst(sbyte val) {
-      this.val = val;
-      size = 1;
-      type = PrimitiveType.Int8;
-    }
-
-    public IntConst(short val) {
-      this.val = val;
-      size = 2;
-      type = PrimitiveType.Int16;
-    }
-
-    public IntConst(int val) {
-      this.val = val;
-      size = 4;
-      type = PrimitiveType.Int32;
-    }
-
-    public IntConst(long val) {
-      this.val = val;
-      size = 8;
-      type = PrimitiveType.Int64;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        switch (size) {
-          case (1) : blobIndex = md.AddToBlobHeap((sbyte)val); break;
-          case (2) : blobIndex = md.AddToBlobHeap((short)val); break;
-          case (4) : blobIndex = md.AddToBlobHeap((int)val); break;
-          default : blobIndex = md.AddToBlobHeap(val); break; 
-        }
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      switch (size) {
-        case (1) : bw.Write((sbyte)val); break;
-        case (2) : bw.Write((short)val); break;
-        case (4) : bw.Write((int)val); break;
-        default : bw.Write(val); break; 
-      }
-    }
-
-  }
-
-  public class UIntConst : Constant {
-    long val;
-
-    public UIntConst(sbyte val) {
-      this.val = val;
-      size = 1;
-      type = PrimitiveType.UInt8;
-    }
-    public UIntConst(short val) {
-      this.val = val;
-      size = 2;
-      type = PrimitiveType.UInt16;
-    }
-    public UIntConst(int val) {
-      this.val = val;
-      size = 4;
-      type = PrimitiveType.UInt32;
-    }
-    public UIntConst(long val) {
-      this.val = val;
-      size = 8;
-      type = PrimitiveType.UInt64;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        switch (size) {
-          case (1) : blobIndex = md.AddToBlobHeap((sbyte)val); break;
-          case (2) : blobIndex = md.AddToBlobHeap((short)val); break;
-          case (4) : blobIndex = md.AddToBlobHeap((int)val); break;
-          default : blobIndex = md.AddToBlobHeap(val); break;
-        }
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      switch (size) {
-        case (1) : bw.Write((sbyte)val); break;
-        case (2) : bw.Write((short)val); break;
-        case (4) : bw.Write((int)val); break;
-        default : bw.Write(val); break;
-      }
-    }
-
-  }
-
-  public class StringConst : DataConstant {
-    string val;
-
-    public StringConst(string val) {
-      this.val = val;
-      size = (uint)val.Length;  // need to add null ??
-      type = PrimitiveType.String;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        byte [] b = Encoding.Unicode.GetBytes (val);
-        blobIndex = md.AddToBlobHeap(b);
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      bw.Write(val);
-    }
-
-  }
-
-  public class NullConst : Constant {
-    public NullConst() { 
-      size = 4;
-      type = PrimitiveType.Class;
-    }
-
-    internal sealed override uint GetBlobIndex(MetaData md) {
-      if (!addedToBlobHeap) {
-        blobIndex = md.AddToBlobHeap((int)0);
-        addedToBlobHeap = true;
-      }
-      return blobIndex;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      bw.Write((int)0); 
-    }
-
-  }
-
-  public class AddressConstant : DataConstant {
-    DataConstant data;
-
-    public AddressConstant(DataConstant dConst) {
-      data = dConst;
-      size = 4;
-      type = PrimitiveType.TypedRef;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      ((FileImage)bw).WriteDataRVA(data.DataOffset);
-    }
-
-  }
-
-  public class RepeatedConstant : DataConstant {
-    DataConstant data;
-    uint repCount;
-
-    public RepeatedConstant(DataConstant dConst, int repeatCount) {
-      data = dConst;
-      repCount = (uint)repeatCount;
-      int[] sizes = new int[1];
-      sizes[0] = repeatCount;
-      type = new BoundArray(type,1,sizes);
-      size = data.GetSize() * repCount;
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      for (int i=0; i < repCount; i++) {
-        data.Write(bw);
-      }
-    }
-
-  }
-
-  public class ArrayConstant : DataConstant {
-    DataConstant[] dataVals;
-
-    public ArrayConstant(DataConstant[] dVals) {
-      dataVals = dVals;
-      for (int i=0; i < dataVals.Length; i++) {
-        size += dataVals[i].GetSize();
-      }
-    }
-
-    internal sealed override void Write(BinaryWriter bw) {
-      for (int i=0; i < dataVals.Length; i++) {
-        dataVals[i].Write(bw);
-      }
-    }
-
-  }
-
-  public class ClassType : Constant {
-    string name;
-    Class desc;
-
-    public ClassType(string className) {
-      name = className;
-      type = PrimitiveType.ClassType;
-    }
-
-    public ClassType(Class classDesc) {
-      desc = classDesc;
-      type = PrimitiveType.ClassType;
-    }
-
-    internal override void Write(BinaryWriter bw) {
-      if (name == null)  name = desc.TypeName();
-      bw.Write(name);
-    }
-
-  }
-
-
-
-  /**************************************************************************/  
-        /// <summary>
-        /// Summary description for ConstantElem.
-        /// </summary>
-        internal class ConstantElem : MetaDataElement
-        {
-    MetaDataElement parent;
-    Constant cValue;
-    uint valIx = 0;
-
-                internal ConstantElem(MetaDataElement parent, Constant val) {
-      this.parent = parent;
-      cValue = val;
-                        tabIx = MDTable.Constant;
-                        sortTable = true;
-                }
-
-   internal override uint SortKey() 
-   {  
-     return (parent.Row << MetaData.CIxShiftMap[(uint)CIx.HasConst]) 
-             | parent.GetCodedIx(CIx.HasConst);
-   }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      valIx = cValue.GetBlobIndex(md);
-      done = true;
-    }
-
-    internal void AddToBlob(BinaryWriter bw) {
-      cValue.Write(bw);
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 2 + md.CodedIndexSize(CIx.HasConst) + md.BlobIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(cValue.GetTypeIndex());
-      output.Write((byte)0);
-      output.WriteCodedIndex(CIx.HasConst,parent);
-      output.BlobIndex(valIx);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a Custom Attribute (.custom) 
-        /// </summary>
-
-        public class CustomAttribute : MetaDataElement
-        {
-    private static readonly ushort prolog = 0x0001;
-    MetaDataElement parent;
-    Method type;
-    uint valIx;
-    Constant cVal;
-    byte[] byteVal;
-    ushort numNamed = 0;
-    ArrayList names, vals;
-
-                internal CustomAttribute(MetaDataElement paren, Method constrType, 
-                                                          Constant val) {
-      parent = paren;
-      type = constrType;
-      cVal = val;
-      tabIx = MDTable.CustomAttribute;
-                }
-
-    internal CustomAttribute(MetaDataElement paren, Method constrType,
-                                                          byte[] val) {
-      parent = paren;
-      type = constrType;
-      tabIx = MDTable.CustomAttribute;
-      byteVal = val;
-    }
-
-    internal override uint SortKey() {
-      return (parent.Row << MetaData.CIxShiftMap[(uint)CIx.HasCustomAttr])
-              | parent.GetCodedIx(CIx.HasCustomAttr);
-    }
-
-    public void AddFieldOrProp(string name, Constant val) {
-      if (numNamed == 0) {
-        names = new ArrayList();
-        vals = new ArrayList();
-      }
-      names.Add(name);
-      vals.Add(val);
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      BinaryWriter bw = new BinaryWriter(new MemoryStream());
-      bw.Write(byteVal);
-      md.AddToTable(MDTable.CustomAttribute, this);
-      MemoryStream str = (MemoryStream)bw.BaseStream;
-      valIx = md.AddToBlobHeap(str.ToArray());
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.CodedIndexSize(CIx.HasCustomAttr) + md.CodedIndexSize(CIx.CustomAttributeType) + md.BlobIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteCodedIndex(CIx.HasCustomAttr,parent);
-      output.WriteCodedIndex(CIx.CustomAttributeType,type);
-      output.BlobIndex(valIx);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a custom modifier of a type (modopt or modreq)
-        /// </summary>
-
-        public class CustomModifiedType : Type
-        {
-    Type type;
-    Class cmodType;
-
-    /// <summary>
-    /// Create a new custom modifier for a type
-    /// </summary>
-    /// <param name="type">the type to be modified</param>
-    /// <param name="cmod">the modifier</param>
-    /// <param name="cmodType">the type reference to be associated with the type</param>
-                public CustomModifiedType(Type type, CustomModifier cmod, Class cmodType)
-                                                          : base((byte)cmod) {
-      this.type = type;
-      this.cmodType = cmodType;
-                }
-
-    internal sealed override void TypeSig(MemoryStream str) {
-      str.WriteByte(typeIndex);
-      MetaData.CompressNum(cmodType.TypeDefOrRefToken(),str);
-      type.TypeSig(str);
-    }
-  
-  }
-  /**************************************************************************/  
-  /// <summary>
-  /// Descriptor for security permissions for a class or a method
-  /// </summary>
-        
-        public class DeclSecurity : MetaDataElement
-        {
-    ushort action;
-    MetaDataElement parent;
-    uint permissionIx;
-    byte [] byteVal;
-
-                internal DeclSecurity(MetaDataElement paren, ushort act, byte [] val)        {
-      parent = paren;
-      action = act;
-      tabIx = MDTable.DeclSecurity;
-      byteVal = val;
-                }
-
-    internal override uint SortKey() {
-      return (parent.Row << MetaData.CIxShiftMap[(uint)CIx.HasDeclSecurity])
-              | parent.GetCodedIx(CIx.HasDeclSecurity);
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 2 + md.CodedIndexSize(CIx.HasDeclSecurity) + md.BlobIndexSize();
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      BinaryWriter bw = new BinaryWriter (new MemoryStream ());
-      bw.Write (byteVal);
-      md.AddToTable (MDTable.DeclSecurity, this);
-      MemoryStream str = (MemoryStream)bw.BaseStream;
-      permissionIx = md.AddToBlobHeap(str.ToArray());
-
-      done = true;
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(action);
-      output.WriteCodedIndex(CIx.HasDeclSecurity,parent);
-      output.BlobIndex(permissionIx);
-    }
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for an event
-        /// </summary>
-  public class Event : Feature
-        {
-    Type eventType;
-
-    internal Event(string name, Type eType, ClassDef parent) 
-                                            : base(name, parent) {
-      eventType = eType;
-                        tabIx = MDTable.Event;
-    }
-
-    /// <summary>
-    /// Add the addon method to this event
-    /// </summary>
-    /// <param name="addon">the addon method</param>
-    public void AddAddon(MethodDef addon) {
-      AddMethod(addon,MethodType.AddOn);
-    }
-
-    /// <summary>
-    /// Add the removeon method to this event
-    /// </summary>
-    /// <param name="removeOn">the removeon method</param>
-    public void AddRemoveOn(MethodDef removeOn) {
-      AddMethod(removeOn,MethodType.RemoveOn);
-    }
-
-    /// <summary>
-    /// Add the fire method to this event
-    /// </summary>
-    /// <param name="fire">the fire method</param>
-    public void AddFire(MethodDef fire) {
-      AddMethod(fire,MethodType.Fire);
-    }
-
-    /// <summary>
-    /// Add another method to this event
-    /// </summary>
-    /// <param name="other">the method to be added</param>
-    public void AddOther(MethodDef other) {
-      AddMethod(other,MethodType.Other);
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      nameIx = md.AddToStringsHeap(name);
-      for (int i=0; i < tide; i++) {
-        md.AddToTable(MDTable.MethodSemantics,methods[i]);
-      }
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 2 + md.StringsIndexSize() + md.CodedIndexSize(CIx.TypeDefOrRef);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(flags);
-      output.StringsIndex(nameIx);
-      output.WriteCodedIndex(CIx.TypeDefOrRef,eventType);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasCustomAttr) : return 10; 
-        case (CIx.HasSemantics) : return 0; 
-      }
-      return 0;
-    }
-   
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a class defined in another module of THIS assembly 
-        /// and exported (.class extern)
-        /// </summary>
-
-  internal class ExternClass : Class
-        {
-                MetaDataElement parent;
-    uint flags;
-
-    internal ExternClass(TypeAttr attr, uint nsIx, uint nIx, 
-                         MetaDataElement paren) : base(nsIx,nIx) {
-      flags = (uint)attr;
-            parent = paren;
-                        tabIx = MDTable.ExportedType;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 8 + 2* md.StringsIndexSize() + md.CodedIndexSize(CIx.Implementation);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(flags);
-      output.Write(0);
-      output.StringsIndex(nameIx);
-      output.StringsIndex(nameSpaceIx);
-      output.WriteCodedIndex(CIx.Implementation,parent);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasCustomAttr) : return 17; 
-        case (CIx.Implementation) : return 2; 
-      }
-      return 0;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for Event and Property descriptors
-        /// </summary>
-
-  public class Feature : MetaDataElement
-        {
-    internal enum MethodType : ushort { Setter = 0x01, Getter, Other = 0x04, AddOn = 0x08, 
-      RemoveOn = 0x10, Fire = 0x20 }
-
-    private static readonly int INITSIZE = 5;
-    private static readonly ushort specialName = 0x200;
-    private static readonly ushort rtSpecialName = 0x400;
-
-    protected ClassDef parent;
-    protected ushort flags = 0;
-    protected string name;
-    protected int tide = 0;
-    protected uint nameIx;
-    protected MethodSemantics[] methods = new MethodSemantics[INITSIZE];
-    
-    internal Feature(string name, ClassDef par) {
-      parent = par;
-      this.name = name;
-    }
-
-    internal void AddMethod(MethodDef meth, MethodType mType) {
-      if (tide >= methods.Length) { 
-        int len = methods.Length;
-        MethodSemantics[] mTmp = methods;
-        methods = new MethodSemantics[len * 2];
-        for (int i=0; i < len; i++) {
-          methods[i] = mTmp[i];
-        }
-      }
-      methods[tide++] = new MethodSemantics(mType,meth,this);
-    }
-
-    /// <summary>
-    /// Set the specialName attribute for this Event or Property
-    /// </summary>
-    public void SetSpecialName() {
-      flags |= specialName;
-    }
-
-    /// <summary>
-    /// Set the RTSpecialName attribute for this Event or Property
-    /// </summary>
-    public void SetRTSpecialName() {
-      flags |= rtSpecialName;
-    }
-  
-        }
-  /*****************************************************************************/  
-        /// <summary>
-        /// Descriptor for a field of a class
-        /// </summary>
-
-  public abstract class Field : Member
-        {
-    protected static readonly byte FieldSig = 0x6;
-
-    protected Type type;
-
-                internal Field(string pfName, Type pfType) : base(pfName)
-                {
-      type = pfType;
-                }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a field defined in a class of THIS assembly/module
-        /// </summary>
-  public class FieldDef : Field
-        {
-    //private static readonly uint PInvokeImpl = 0x2000;
-    private static readonly ushort HasFieldRVA = 0x100;
-    private static readonly ushort HasDefault = 0x8000;
-
-    FieldRVA rva;
-    ConstantElem constVal;
-    FieldLayout layout;
-    FieldMarshal marshalInfo;
-    ushort flags;
-
-    internal FieldDef(string name, Type fType) : base(name,fType) {
-      tabIx = MDTable.Field;
-    }
-
-    internal FieldDef(FieldAttr attrSet, string name, Type fType) : base(name, fType) { 
-      flags = (ushort)attrSet;
-      tabIx = MDTable.Field;
-    }
-
-    /// <summary>
-    /// Add an attribute(s) to this field
-    /// </summary>
-    /// <param name="fa">the attribute(s) to be added</param>
-    public void AddFieldAttr(FieldAttr fa) {
-      flags |= (ushort)fa;
-    }
-    /// <summary>
-    /// Add a value for this field
-    /// </summary>
-    /// <param name="val">the value for the field</param>
-    public void AddValue(Constant val) {
-      constVal = new ConstantElem(this,val);
-      flags |= HasDefault;
-    }
-
-    /// <summary>
-    /// Add an initial value for this field (at dataLabel) (.data)
-    /// </summary>
-    /// <param name="val">the value for the field</param>
-    /// <param name="repeatVal">the number of repetitions of this value</param>
-    public void AddDataValue(DataConstant val) {
-      flags |= HasFieldRVA;
-      rva = new FieldRVA(this,val);
-    }
-
-    /// <summary>
-    /// Set the offset of the field.  Used for sequential or explicit classes.
-    /// (.field [offs])
-    /// </summary>
-    /// <param name="offs">field offset</param>
-    public void SetOffset(uint offs) {
-      layout = new FieldLayout(this,offs);
-    }
-
-    /// <summary>
-    /// Set the marshalling info for a field
-    /// </summary>
-    /// <param name="mInf"></param>
-    public void SetMarshalInfo(NativeType marshallType) {
-      flags |= (ushort) FieldAttr.HasFieldMarshal;
-      marshalInfo = new FieldMarshal(this,marshallType);
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      nameIx = md.AddToStringsHeap(name);
-      MemoryStream sig = new MemoryStream();
-      sig.WriteByte(FieldSig);
-      type.TypeSig(sig);
-      sigIx = md.AddToBlobHeap(sig.ToArray());
-      if (rva != null) {
-        md.AddToTable(MDTable.FieldRVA,rva);
-        rva.BuildTables(md);
-      } else if (constVal != null) {
-        md.AddToTable(MDTable.Constant,constVal);
-        constVal.BuildTables(md);
-      }
-      if (layout != null) md.AddToTable(MDTable.FieldLayout,layout);
-      if (marshalInfo != null) {
-        md.AddToTable(MDTable.FieldMarshal,marshalInfo);
-        marshalInfo.BuildTables(md);
-      }
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 2 + md.StringsIndexSize() + md.BlobIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(flags);
-      output.StringsIndex(nameIx);
-      output.BlobIndex(sigIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasConst) : return 0; 
-        case (CIx.HasCustomAttr) : return 1; 
-        case (CIx.HasFieldMarshal) : return 0; 
-        case (CIx.MemberForwarded) : return 0; 
-      }
-      return 0;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for layout information for a field
-        /// </summary>
-        
-        public class FieldLayout : MetaDataElement
-        {
-    Field field;
-    uint offset;
-
-    internal FieldLayout(Field field, uint offset)      {
-      this.field = field;
-      this.offset = offset;
-                        tabIx = MDTable.FieldLayout;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 4 + md.TableIndexSize(MDTable.Field);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(offset);
-      output.WriteIndex(MDTable.Field,field.Row);
-    }
-
-        }
-  /*****************************************************************************/  
-        /// <summary>
-        /// Marshalling information for a field or param
-        /// </summary>
-  public class FieldMarshal : MetaDataElement
-        {
-    MetaDataElement field;
-    NativeType nt;
-    uint ntIx;
-
-    internal FieldMarshal(MetaDataElement field, NativeType nType)      {
-      this.field = field;
-      this.nt = nType;
-                        tabIx = MDTable.FieldMarshal;
-                }
-
-    internal override uint SortKey() { 
-      return (field.Row << MetaData.CIxShiftMap[(uint)CIx.HasFieldMarshal])
-              | field.GetCodedIx(CIx.HasFieldMarshal);
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      ntIx = md.AddToBlobHeap(nt.ToBlob());
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.CodedIndexSize(CIx.HasFieldMarshal) + md.BlobIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteCodedIndex(CIx.HasFieldMarshal,field);
-      output.BlobIndex(ntIx);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a field of a class defined in another assembly/module
-        /// </summary>
-  public class FieldRef : Field
-        {
-    MetaDataElement parent;
-
-                internal FieldRef(MetaDataElement paren, string name, Type fType) : base(name, fType)   {       
-      parent = paren;
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      nameIx = md.AddToStringsHeap(name);
-      MemoryStream sig = new MemoryStream();
-      sig.WriteByte(FieldSig);
-      type.TypeSig(sig);
-      sigIx = md.AddToBlobHeap(sig.ToArray());
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.CodedIndexSize(CIx.MemberRefParent) + md.StringsIndexSize() + md.BlobIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteCodedIndex(CIx.MemberRefParent,parent);
-      output.StringsIndex(nameIx);
-      output.BlobIndex(sigIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) { return 6; }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for the address of a field's value in the PE file
-        /// </summary>
-  public class FieldRVA : MetaDataElement
-        {
-    Field field;
-    DataConstant data;
-
-    internal FieldRVA(Field field, DataConstant data)   {
-      this.field = field;
-      this.data = data;
-      tabIx = MDTable.FieldRVA;
-                }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      md.AddData(data);
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 4 + md.TableIndexSize(MDTable.Field);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteDataRVA(data.DataOffset);
-      output.WriteIndex(MDTable.Field,field.Row);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Image for a PEFile
-        /// File Structure
-  ///     DOS Header (128 bytes) 
-  ///     PE Signature ("PE\0\0") 
-  ///     PEFileHeader (20 bytes)
-  ///     PEOptionalHeader (224 bytes) 
-  ///     SectionHeaders (40 bytes * NumSections)
-  ///
-  ///     Sections .text (always present - contains metadata)
-  ///              .sdata (contains any initialised data in the file - may not be present)
-  ///                     (for ilams /debug this contains the Debug table)
-  ///              .reloc (always present - in pure CIL only has one fixup)
-  ///               others???  c# produces .rsrc section containing a Resource Table
-  ///
-  /// .text layout
-  ///     IAT (single entry 8 bytes for pure CIL)
-  ///     CLIHeader (72 bytes)
-  ///     CIL instructions for all methods (variable size)
-  ///     MetaData 
-  ///       Root (20 bytes + UTF-8 Version String + quad align padding)
-  ///       StreamHeaders (8 bytes + null terminated name string + quad align padding)
-  ///       Streams 
-  ///         #~        (always present - holds metadata tables)
-  ///         #Strings  (always present - holds identifier strings)
-  ///         #US       (Userstring heap)
-  ///         #Blob     (signature blobs)
-  ///         #GUID     (guids for assemblies or Modules)
-  ///    ImportTable (40 bytes)
-  ///    ImportLookupTable(8 bytes) (same as IAT for standard CIL files)
-  ///    Hint/Name Tables with entry "_CorExeMain" for .exe file and "_CorDllMain" for .dll (14 bytes)
-  ///    ASCII string "mscoree.dll" referenced in ImportTable (+ padding = 16 bytes)
-  ///    Entry Point  (0xFF25 followed by 4 bytes 0x400000 + RVA of .text)
-  ///
-  ///  #~ stream structure
-  ///    Header (24 bytes)
-  ///    Rows   (4 bytes * numTables)
-  ///    Tables
-  /// </summary>
-        internal class FileImage : BinaryWriter
-        {
-    internal readonly static uint[] iByteMask = {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000};
-    internal readonly static ulong[] lByteMask = {0x00000000000000FF, 0x000000000000FF00,
-                                                  0x0000000000FF0000, 0x00000000FF000000,
-                                                  0x000000FF00000000, 0x0000FF0000000000,
-                                                  0x00FF000000000000, 0xFF00000000000000 };
-    internal readonly static uint nibble0Mask = 0x0000000F;
-    internal readonly static uint nibble1Mask = 0x000000F0;
-
-    private static readonly byte[] DOSHeader = { 0x4d,0x5a,0x90,0x00,0x03,0x00,0x00,0x00,
-                                                 0x04,0x00,0x00,0x00,0xff,0xff,0x00,0x00,
-                                                 0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-                                                 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-                                                 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
-                                                 0x0e,0x1f,0xba,0x0e,0x00,0xb4,0x09,0xcd,
-                                                 0x21,0xb8,0x01,0x4c,0xcd,0x21,0x54,0x68,
-                                                 0x69,0x73,0x20,0x70,0x72,0x6f,0x67,0x72,
-                                                 0x61,0x6d,0x20,0x63,0x61,0x6e,0x6e,0x6f,
-                                                 0x74,0x20,0x62,0x65,0x20,0x72,0x75,0x6e,
-                                                 0x20,0x69,0x6e,0x20,0x44,0x4f,0x53,0x20,
-                                                 0x6d,0x6f,0x64,0x65,0x2e,0x0d,0x0d,0x0a,
-                                                 0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-                                                 0x50,0x45,0x00,0x00};
-    private static byte[] PEHeader = { 0x4c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                                       0xE0, 0x00, 0x0E, 0x01, // PE Header Standard Fields
-                                       0x0B, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
-                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-                                     };
-
-    private static readonly uint minFileAlign = 0x200;
-    private static readonly uint maxFileAlign = 0x1000;
-    private static readonly uint fileHeaderSize = 0x178;
-    private static readonly uint sectionHeaderSize = 40;
-    private static readonly uint SectionAlignment = 0x2000;
-    private static readonly uint ImageBase = 0x400000;
-    private static readonly uint ImportTableSize = 40;
-    private static readonly uint IATSize = 8;
-    private static readonly uint CLIHeaderSize = 72;
-    private uint runtimeFlags = 0x01;  // COMIMAGE_FLAGS_ILONLY
-    // 32BITREQUIRED 0x02, STRONGNAMESIGNED 0x08, TRACKDEBUGDATA 0x10000
-    private static readonly uint StrongNameSignatureSize = 128;
-    private bool reserveStrongNameSignatureSpace = false;
-
-                private static readonly uint relocFlags = 0x42000040;
-                private static readonly ushort exeCharacteristics = 0x010E;
-                private static readonly ushort dllCharacteristics = 0x210E;
-    // section names are all 8 bytes
-    private static readonly string textName = ".text\0\0\0";
-    private static readonly string sdataName = ".sdata\0\0";
-    private static readonly string relocName = ".reloc\0\0";
-    private static readonly string rsrcName = ".rsrc\0\0\0";
-    private static readonly string exeHintNameTable = "\0\0_CorExeMain\0";
-    private static readonly string dllHintNameTable = "\0\0_CorDllMain\0";
-    private static readonly string runtimeEngineName = "mscoree.dll\0\0";
-
-                private Section text, sdata, rsrc;
-                ArrayList data;
-    BinaryWriter reloc = new BinaryWriter(new MemoryStream());
-    uint dateStamp = 0;
-    DateTime origin = new DateTime(1970,1,1);
-    uint numSections = 2; // always have .text  and .reloc sections
-    internal SubSystem subSys = SubSystem.Windows_CUI;  // default is Windows Console mode
-    internal uint fileAlign = minFileAlign;
-    uint entryPointOffset, entryPointPadding, imageSize, headerSize, headerPadding, entryPointToken = 0;
-    uint relocOffset, relocRVA, relocSize, relocPadding, relocTide, hintNameTableOffset;
-    uint metaDataOffset, runtimeEngineOffset, initDataSize = 0, importTablePadding;
-    uint resourcesSize, resourcesOffset;
-    uint strongNameSigOffset;
-    uint importTableOffset, importLookupTableOffset, totalImportTableSize;
-    MetaData metaData;
-    char[] runtimeEngine = runtimeEngineName.ToCharArray(), hintNameTable;
-                bool doDLL, largeStrings, largeGUID, largeUS, largeBlob;
-                ushort characteristics;
-
-    internal FileImage(bool makeDLL, string fileName) : base(new FileStream(fileName,FileMode.Create)) {
-      InitFileImage(makeDLL);
-      TimeSpan tmp = System.IO.File.GetCreationTime(fileName).Subtract(origin);
-      dateStamp = Convert.ToUInt32(tmp.TotalSeconds);
-    }
-
-    internal FileImage(bool makeDLL, Stream str) : base(str) {
-      InitFileImage(makeDLL);
-      TimeSpan tmp = DateTime.Now.Subtract(origin);
-      dateStamp = Convert.ToUInt32(tmp.TotalSeconds);
-    }
-
-    private void InitFileImage(bool makeDLL) {
-      doDLL = makeDLL;
-                        if (doDLL) {
-                                hintNameTable = dllHintNameTable.ToCharArray();
-                                characteristics = dllCharacteristics;
-                        } else {
-                                hintNameTable = exeHintNameTable.ToCharArray();
-                                characteristics = exeCharacteristics;
-                        }
-      text = new Section(textName,0x60000020);     // IMAGE_SCN_CNT  CODE, EXECUTE, READ
-//                      rsrc = new Section(rsrcName,0x40000040);     // IMAGE_SCN_CNT  INITIALIZED_DATA, READ
-      metaData = new MetaData(this);
-    }
-
-                internal MetaData GetMetaData() {
-                        return metaData;
-                }
-
-    private uint GetNextSectStart(uint rva, uint tide) {
-      if (tide < SectionAlignment) return rva + SectionAlignment;
-      return rva + ((tide / SectionAlignment) + 1) * SectionAlignment;
-    }
-
-    private void BuildTextSection() {
-      // .text layout
-      //    IAT (single entry 8 bytes for pure CIL)
-      //    CLIHeader (72 bytes)
-      //    CIL instructions for all methods (variable size)
-      //    MetaData 
-      //    ImportTable (40 bytes)
-      //    ImportLookupTable(8 bytes) (same as IAT for standard CIL files)
-      //    Hint/Name Tables with entry "_CorExeMain" for .exe file and "_CorDllMain" for .dll (14 bytes)
-      //    ASCII string "mscoree.dll" referenced in ImportTable (+ padding = 16 bytes)
-      //    Entry Point  (0xFF25 followed by 4 bytes 0x400000 + RVA of .text)
-      metaData.BuildMetaData(IATSize + CLIHeaderSize);
-      metaDataOffset = IATSize + CLIHeaderSize;
-      // Console.WriteLine("Code starts at " + metaDataOffset);
-      metaDataOffset += metaData.CodeSize();
-      // resourcesStart =
-      resourcesOffset = metaDataOffset + metaData.Size ();
-      resourcesSize = metaData.GetResourcesSize ();
-      if (reserveStrongNameSignatureSpace) {
-        strongNameSigOffset = resourcesOffset + resourcesSize;
-        // fixUps = RVA for vtable
-        importTableOffset = strongNameSigOffset + StrongNameSignatureSize;
-      } else {
-        strongNameSigOffset = 0;
-        // fixUps = RVA for vtable
-        importTableOffset = resourcesOffset + resourcesSize;
-      }
-      importTablePadding = NumToAlign(importTableOffset,16);
-      importTableOffset += importTablePadding;
-      importLookupTableOffset = importTableOffset + ImportTableSize;
-      hintNameTableOffset = importLookupTableOffset + IATSize;
-      runtimeEngineOffset = hintNameTableOffset + (uint)hintNameTable.Length;
-      entryPointOffset = runtimeEngineOffset + (uint)runtimeEngine.Length;
-      totalImportTableSize = entryPointOffset - importTableOffset;
-      // Console.WriteLine("total import table size = " + totalImportTableSize);
-      // Console.WriteLine("entrypoint offset = " + entryPointOffset);
-      entryPointPadding = NumToAlign(entryPointOffset,4) + 2;
-      entryPointOffset += entryPointPadding;
-      text.AddReloc(entryPointOffset+2);
-      text.IncTide(entryPointOffset + 6);
-      //if (text.Tide() < fileAlign) fileAlign = minFileAlign;
-                        text.SetSize(NumToAlign(text.Tide(),fileAlign));
-      // Console.WriteLine("text size = " + text.Size() + " text tide = " + text.Tide() + " text padding = " + text.Padding());
-                        // Console.WriteLine("metaDataOffset = " + Hex.Int(metaDataOffset));
-                        // Console.WriteLine("importTableOffset = " + Hex.Int(importTableOffset));
-                        // Console.WriteLine("importLookupTableOffset = " + Hex.Int(importLookupTableOffset));
-                        // Console.WriteLine("hintNameTableOffset = " + Hex.Int(hintNameTableOffset));
-                        // Console.WriteLine("runtimeEngineOffset = " + Hex.Int(runtimeEngineOffset));
-                        // Console.WriteLine("entryPointOffset = " + Hex.Int(entryPointOffset));
-                        // Console.WriteLine("entryPointPadding = " + Hex.Int(entryPointPadding));
-
-    }
-
-    internal void BuildRelocSection() {
-                        text.DoRelocs(reloc);
-                        if (sdata != null) sdata.DoRelocs(reloc);
-                        if (rsrc != null) rsrc.DoRelocs(reloc);
-      relocTide = (uint)reloc.Seek(0,SeekOrigin.Current);
-      relocPadding = NumToAlign(relocTide,fileAlign);
-      relocSize = relocTide + relocPadding;
-                        imageSize = relocRVA + SectionAlignment;
-      initDataSize += relocSize;
-    }
-
-    private void CalcOffsets() {
-if (sdata != null)
-        numSections++;
-if (rsrc != null)
-        numSections++;
-      headerSize = fileHeaderSize + (numSections * sectionHeaderSize);
-      headerPadding = NumToAlign(headerSize,fileAlign);
-      headerSize += headerPadding;
-      uint offset = headerSize;
-      uint rva = SectionAlignment;
-      text.SetOffset(offset);
-      text.SetRVA(rva);
-      offset += text.Size();
-      rva  = GetNextSectStart(rva,text.Tide());
-                        // Console.WriteLine("headerSize = " + headerSize);
-                        // Console.WriteLine("headerPadding = " + headerPadding);
-                        // Console.WriteLine("textOffset = " + Hex.Int(text.Offset()));
-                        if (sdata != null) { 
-                                sdata.SetSize(NumToAlign(sdata.Tide(),fileAlign));
-                                sdata.SetOffset(offset);
-        sdata.SetRVA(rva);
-        offset += sdata.Size();
-        rva = GetNextSectStart(rva,sdata.Tide());
-                                initDataSize += sdata.Size();
-      }
-      if (rsrc != null) { 
-                     rsrc.SetSize(NumToAlign(rsrc.Tide(),fileAlign));
-                                rsrc.SetOffset(offset);
-        rsrc.SetRVA(rva);
-        offset += rsrc.Size();
-        rva = GetNextSectStart(rva,rsrc.Tide());
-                                initDataSize += rsrc.Size();
-      }
-      relocOffset = offset;
-      relocRVA = rva;
-    }
-
-    internal void MakeFile() {
-      if (doDLL) hintNameTable = dllHintNameTable.ToCharArray();
-      else hintNameTable = exeHintNameTable.ToCharArray();
-      BuildTextSection();
-      CalcOffsets();
-      BuildRelocSection();
-      // now write it out
-      WriteHeader();
-      WriteSections();
-      Flush();
-      Close();
-    }
-
-    private void WriteHeader() {
-      Write(DOSHeader);
-                        // Console.WriteLine("Writing PEHeader at offset " + Seek(0,SeekOrigin.Current));
-                        WritePEHeader();
-                         // Console.WriteLine("Writing text section header at offset " + Hex.Long(Seek(0,SeekOrigin.Current)));
-                        text.WriteHeader(this,relocRVA);
-      if (sdata != null) sdata.WriteHeader(this,relocRVA);
-      if (rsrc != null) rsrc.WriteHeader(this,relocRVA);
-                        // Console.WriteLine("Writing reloc section header at offset " + Seek(0,SeekOrigin.Current));
-                        WriteRelocSectionHeader();
-                        // Console.WriteLine("Writing padding at offset " + Seek(0,SeekOrigin.Current));
-                        WriteZeros(headerPadding);
-    }
-
-    private void WriteSections() {
-                        // Console.WriteLine("Writing text section at offset " + Seek(0,SeekOrigin.Current));
-      WriteTextSection();
-      if (sdata != null) WriteSDataSection();
-      if (rsrc != null) WriteRsrcSection();
-      WriteRelocSection();
-    }
-
-     private void WriteIAT() {
-      Write(text.RVA() + hintNameTableOffset);
-      Write(0);
-    }
-
-                private void WriteImportTables() {
-                        // Import Table
-      WriteZeros(importTablePadding);
-      // Console.WriteLine("Writing import tables at offset " + Hex.Long(Seek(0,SeekOrigin.Current)));
-                        Write(importLookupTableOffset + text.RVA());
-                        WriteZeros(8); 
-                        Write(runtimeEngineOffset + text.RVA());
-                        Write(text.RVA());    // IAT is at the beginning of the text section
-                        WriteZeros(20);
-                        // Import Lookup Table
-                        WriteIAT();                // lookup table and IAT are the same
-                        // Hint/Name Table
-       // Console.WriteLine("Writing hintname table at " + Hex.Long(Seek(0,SeekOrigin.Current)));
-                        Write(hintNameTable);
-      Write(runtimeEngineName.ToCharArray());
-                }
-
-    private void WriteTextSection() {
-      WriteIAT();
-      WriteCLIHeader();
-      // Console.WriteLine("Writing code at " + Hex.Long(Seek(0,SeekOrigin.Current)));
-      metaData.WriteByteCodes(this);
-      // Console.WriteLine("Finished writing code at " + Hex.Long(Seek(0,SeekOrigin.Current)));
-      largeStrings = metaData.LargeStringsIndex();
-      largeGUID = metaData.LargeGUIDIndex();
-      largeUS = metaData.LargeUSIndex();
-      largeBlob = metaData.LargeBlobIndex();
-      metaData.WriteMetaData(this);
-      metaData.WriteResources (this);
-      if (reserveStrongNameSignatureSpace) {
-        WriteZeros(StrongNameSignatureSize);
-      }
-      WriteImportTables();
-                        WriteZeros(entryPointPadding);
-                        Write((ushort)0x25FF);
-                        Write(ImageBase + text.RVA());
-                        WriteZeros(text.Padding());
-    }
-
-    private void WriteCLIHeader() {
-      Write(CLIHeaderSize);       // Cb
-      Write((short)2);            // Major runtime version
-      Write((short)0);            // Minor runtime version
-      Write(text.RVA() + metaDataOffset);
-      Write(metaData.Size());
-      Write(runtimeFlags);
-      Write(entryPointToken);
-      if (resourcesSize > 0) {
-        Write (text.RVA () + resourcesOffset);
-        Write (resourcesSize);
-      } else {
-       WriteZeros (8);
-      }
-      // Strong Name Signature (RVA, size)
-      if (reserveStrongNameSignatureSpace) {
-        Write(text.RVA() + strongNameSigOffset); 
-        Write(StrongNameSignatureSize);
-      } else {
-        WriteZeros(8);
-      }
-      WriteZeros(8);                     // CodeManagerTable
-      WriteZeros(8);                     // VTableFixups NYI
-      WriteZeros(16);                    // ExportAddressTableJumps, ManagedNativeHeader
-     }
-
-    private void WriteSDataSection() {
-      long size = sdata.Size ();
-      long start = BaseStream.Position;
-      for (int i=0; i < data.Count; i++) {
-        ((DataConstant)data[i]).Write(this);
-      }
-      while (BaseStream.Position < (start + size))
-              Write ((byte) 0);
-    }
-
-                private void WriteRsrcSection() {
-                }
-
-    private void WriteRelocSection() {
-     // Console.WriteLine("Writing reloc section at " + Seek(0,SeekOrigin.Current) + " = " + relocOffset);
-      MemoryStream str = (MemoryStream)reloc.BaseStream;
-      Write(str.ToArray());
-      WriteZeros(NumToAlign((uint)str.Position,fileAlign));
-    }
-
-    internal void SetEntryPoint(uint entryPoint) {
-      entryPointToken = entryPoint;
-    }
-
-    internal void AddInitData(DataConstant cVal) {
-                        if (sdata == null) {                    
-                                sdata = new Section(sdataName,0xC0000040);   // IMAGE_SCN_CNT  INITIALIZED_DATA, READ, WRITE
-                                data = new ArrayList(); 
-                        }
-      data.Add(cVal);
-      cVal.DataOffset = sdata.Tide();
-      sdata.IncTide(cVal.GetSize());
-    }
-
-    internal void WriteZeros(uint numZeros) {
-      for (int i=0; i < numZeros; i++) {
-        Write((byte)0);
-      }
-    }
-
-    internal void WritePEHeader() {
-      Write((ushort)0x014C);  // Machine - always 0x14C for Managed PE Files (allow others??)
-      Write((ushort)numSections);
-      Write(dateStamp);
-      WriteZeros(8); // Pointer to Symbol Table and Number of Symbols (always zero for ECMA CLI files)
-      Write((ushort)0x00E0);  // Size of Optional Header
-      Write(characteristics);
-      // PE Optional Header
-      Write((ushort)0x010B);   // Magic
-      Write((byte)0x6);        // LMajor pure-IL = 6   C++ = 7
-      Write((byte)0x0);        // LMinor
-      Write(text.Size());
-      Write(initDataSize);
-      Write(0);                // Check other sections here!!
-      Write(text.RVA() + entryPointOffset);
-      Write(text.RVA());
-                        uint dataBase = 0;
-                        if (sdata != null) dataBase = sdata.RVA();
-                        else if (rsrc != null) dataBase = rsrc.RVA();
-      else dataBase = relocRVA;
-                        Write(dataBase);
-      Write(ImageBase);
-      Write(SectionAlignment);
-      Write(fileAlign);
-      Write((ushort)0x04);     // OS Major
-      WriteZeros(6);                  // OS Minor, User Major, User Minor
-      Write((ushort)0x04);     // SubSys Major
-      WriteZeros(6);           // SybSys Minor, Reserved
-      Write(imageSize);
-      Write(headerSize);
-      Write((int)0);           // File Checksum
-      Write((ushort)subSys);
-      Write((short)0);         // DLL Flags
-      Write((uint)0x100000);   // Stack Reserve Size
-      Write((uint)0x1000);     // Stack Commit Size
-      Write((uint)0x100000);   // Heap Reserve Size
-      Write((uint)0x1000);     // Heap Commit Size
-      Write(0);                // Loader Flags
-      Write(0x10);             // Number of Data Directories
-      WriteZeros(8);                  // Export Table
-      Write(importTableOffset + text.RVA());
-      Write(totalImportTableSize);
-      WriteZeros(24);            // Resource, Exception and Certificate Tables
-      Write(relocRVA);
-      Write(relocTide);
-      WriteZeros(48);            // Debug, Copyright, Global Ptr, TLS, Load Config and Bound Import Tables
-      Write(text.RVA());         // IATRVA - IAT is at start of .text Section
-      Write(IATSize);
-      WriteZeros(8);             // Delay Import Descriptor
-      Write(text.RVA()+IATSize); // CLIHeader immediately follows IAT
-      Write(CLIHeaderSize);    
-      WriteZeros(8);             // Reserved
-    }
-
-    internal void WriteRelocSectionHeader() {
-      Write(relocName.ToCharArray());
-      Write(relocTide);
-      Write(relocRVA);
-      Write(relocSize);
-      Write(relocOffset);
-      WriteZeros(12);
-      Write(relocFlags);
-    }
-
-    private void Align (MemoryStream str, int val) {
-      if ((str.Position % val) != 0) {
-        for (int i=val - (int)(str.Position % val); i > 0; i--) {
-          str.WriteByte(0);
-        }
-      }
-    }
-
-    private uint Align(uint val, uint alignVal) {
-      if ((val % alignVal) != 0) {
-        val += alignVal - (val % alignVal);
-      }
-      return val;
-    }
-
-    private uint NumToAlign(uint val, uint alignVal) {
-      if ((val % alignVal) == 0) return 0;
-      return alignVal - (val % alignVal);
-    }
-
-    internal void StringsIndex(uint ix) {
-      if (largeStrings) Write(ix);
-      else Write((ushort)ix);
-    }
-
-    internal void GUIDIndex(uint ix) {
-      if (largeGUID) Write(ix);
-      else Write((ushort)ix);
-    }
-
-    internal void USIndex(uint ix) {
-      if (largeUS) Write(ix);
-      else Write((ushort)ix);
-    }
-
-    internal void BlobIndex(uint ix) {
-      if (largeBlob) Write(ix);
-      else Write((ushort)ix);
-    }
-
-    internal void WriteIndex(MDTable tabIx,uint ix) {
-      if (metaData.LargeIx(tabIx)) Write(ix);
-      else Write((ushort)ix);
-    }
-
-    internal void WriteCodedIndex(CIx code, MetaDataElement elem) {
-      metaData.WriteCodedIndex(code,elem,this);
-    }
-    
-    internal void WriteCodeRVA(uint offs) {
-      Write(text.RVA() + offs);
-    }
-
-    internal void WriteDataRVA(uint offs) {
-      Write(sdata.RVA() + offs);
-    }
-
-    internal void Write3Bytes(uint val) {
-      byte b3 = (byte)((val & FileImage.iByteMask[2]) >> 16);
-      byte b2 = (byte)((val & FileImage.iByteMask[1]) >> 8);;
-      byte b1 = (byte)(val & FileImage.iByteMask[0]);
-      Write(b1);
-      Write(b2);
-      Write(b3);
-    }
-
-    internal bool ReserveStrongNameSignatureSpace {
-      get { return reserveStrongNameSignatureSpace; }
-      set { reserveStrongNameSignatureSpace = value; }
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a file referenced in THIS assembly/module (.file)
-        /// </summary>
-        public class FileRef : MetaDataElement
-        {
-    private static readonly uint NoMetaData = 0x1;
-    uint nameIx = 0, hashIx = 0;
-    uint flags = 0;
-    protected string name;
-
-    internal FileRef(string name, byte[] hashBytes, bool metaData,
-                      bool entryPoint, MetaData md) {
-      if (!metaData) flags = NoMetaData;
-      if (entryPoint) md.SetEntryPoint(this);
-      this.name = name;
-      nameIx = md.AddToStringsHeap(name);
-      hashIx = md.AddToBlobHeap(hashBytes);
-      tabIx = MDTable.File;
-                }
-
-    internal FileRef(uint nameIx, byte[] hashBytes, bool metaData,
-                      bool entryPoint, MetaData md) {
-      if (!metaData) flags = NoMetaData;
-      if (entryPoint) md.SetEntryPoint(this);
-      this.nameIx = nameIx;
-      hashIx = md.AddToBlobHeap(hashBytes);
-      tabIx = MDTable.File;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 4 + md.StringsIndexSize() + md.BlobIndexSize();
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      md.AddToTable(MDTable.File,this);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(flags);
-      output.StringsIndex(nameIx);
-      output.BlobIndex(hashIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasCustomAttr) : return 16; 
-        case (CIx.Implementation) : return 0;
-      }
-      return 0;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for pinvoke information for a method NOT YET IMPLEMENTED
-        /// </summary>
-        public class ImplMap : MetaDataElement
-        {
-    private static readonly ushort NoMangle = 0x01;
-    ushort flags;
-    Method meth;
-    string importName;
-    uint iNameIx;
-    ModuleRef importScope;
-
-                internal ImplMap(ushort flag, Method implMeth, string iName, ModuleRef mScope) {
-      flags = flag;
-      meth = implMeth;
-      importName = iName;
-      importScope = mScope;
-      tabIx = MDTable.ImplMap;
-      if (iName == null) flags |= NoMangle;
-      //throw(new NotYetImplementedException("PInvoke "));
-                }
-
-    internal override uint SortKey() {
-      return (meth.Row << MetaData.CIxShiftMap[(uint)CIx.MemberForwarded]) 
-              | meth.GetCodedIx(CIx.MemberForwarded);
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      iNameIx = md.AddToStringsHeap(importName);
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 2+ md.CodedIndexSize(CIx.MemberForwarded) + 
-        md.StringsIndexSize() +  md.TableIndexSize(MDTable.ModuleRef);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(flags);
-      output.WriteCodedIndex(CIx.MemberForwarded,meth);
-      output.StringsIndex(iNameIx);
-      output.WriteIndex(MDTable.ModuleRef,importScope.Row);
-    }
-
-        }
-
-  /**************************************************************************/  
-  /// <summary>
-  /// Descriptor for an IL instruction
-  /// </summary>
-  internal abstract class CILInstruction {
-    protected static readonly sbyte maxByteVal = 127;
-    protected static readonly sbyte minByteVal = -128;
-    protected static readonly byte leadByte = 0xFE;
-                protected static readonly uint USHeapIndex = 0x70000000;
-    protected static readonly int longInstrStart = (int)Op.arglist;
-    public bool twoByteInstr = false;
-    public uint size = 0;
-    public uint offset;
-
-    internal virtual bool Check(MetaData md) {
-      return false;
-    }
-
-                internal virtual void Write(FileImage output) { }
-
-  }
-
-  internal class CILByte : CILInstruction {
-    byte byteVal;
-
-    internal CILByte(byte bVal) {
-      byteVal = bVal;
-      size = 1;
-    }
-
-    internal override void Write(FileImage output) {
-      output.Write(byteVal);
-    }
-
-  }
-
-  
-  internal class Instr : CILInstruction {
-    protected int instr;
-
-    internal Instr(int inst) {
-      if (inst >= longInstrStart) {
-        instr = inst - longInstrStart;
-        twoByteInstr = true;
-        size = 2;
-      } else {
-        instr = inst;
-        size = 1;
-      }
-    }
-
-                internal override void Write(FileImage output) {
-      //Console.WriteLine("Writing instruction " + instr + " with size " + size);
-      if (twoByteInstr) output.Write(leadByte);
-      output.Write((byte)instr);
-                }
-
-  }
-
-  internal class IntInstr : Instr {
-    int val;
-    bool byteNum;
-
-    internal IntInstr(int inst, int num, bool byteSize) : base(inst) {
-      val = num;
-      byteNum = byteSize;
-      if (byteNum) size++;
-      else size += 4;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-      if (byteNum) 
-        output.Write((sbyte)val);
-      else 
-                                output.Write(val); 
-                }
-
-  }
-
-  internal class UIntInstr : Instr {
-    int val;
-    bool byteNum;
-
-                internal UIntInstr(int inst, int num, bool byteSize) : base(inst) {
-                        val = num;
-      byteNum = byteSize;
-      if (byteNum) size++;
-      else size += 2;
-                }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-      if (byteNum)
-                          output.Write((byte)val);
-      else
-                                output.Write((ushort)val); 
-                }
-        
-  }
-
-        internal class LongInstr : Instr {
-                long val;
-
-                internal LongInstr(int inst, long l) : base(inst) {
-                        val = l;
-                        size += 8;
-                }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(val);
-                }
-
-        }
-
-  internal class FloatInstr : Instr {
-    float fVal;
-
-    internal FloatInstr(int inst, float f) : base(inst) {
-      fVal = f;
-      size += 4;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(fVal);
-                }
-
-        }
-
-  internal class DoubleInstr : Instr {
-    double val;
-
-    internal DoubleInstr(int inst, double d) : base(inst) {
-      val = d;
-      size += 8;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(val);
-                }
-
-        }
-
-  internal class StringInstr : Instr {
-    string val;
-          byte[] bval;                                                  
-    uint strIndex;
-
-    internal StringInstr(int inst, string str) : base(inst) {
-      val = str;  
-      size += 4;
-    }
-
-          internal StringInstr (int inst, byte[] str) : base (inst) {
-                  bval = str;
-                  size += 4;
-          }
-                   
-    internal sealed override bool Check(MetaData md) {
-            if (val != null)
-                    strIndex = md.AddToUSHeap(val);
-            else
-                    strIndex = md.AddToUSHeap (bval);
-      return false;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(USHeapIndex  | strIndex);
-                }
-
-        }
-
-  internal class LabelInstr : CILInstruction {
-    CILLabel label;
-
-    internal LabelInstr(CILLabel lab) {
-      label = lab;
-      label.AddLabelInstr(this);
-    }
-  }
-
-  internal class FieldInstr : Instr {
-    Field field;
-
-    internal FieldInstr(int inst, Field f) : base(inst) {
-      field = f;
-      size += 4;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(field.Token());
-                }
-
-        }
-
-  internal class MethInstr : Instr {
-    Method meth;
-
-    internal MethInstr(int inst, Method m) : base(inst) {
-      meth = m;
-      size += 4;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(meth.Token());
-                }
-
-  }
-
-  internal class SigInstr : Instr {
-    CalliSig signature;
-
-    internal SigInstr(int inst, CalliSig sig) : base(inst) {
-      signature = sig;
-      size += 4;
-    }
-
-    internal sealed override bool Check(MetaData md) {
-      md.AddToTable(MDTable.StandAloneSig,signature);
-      signature.BuildTables(md);
-      return false;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(signature.Token());
-                }
-  }
-
-  internal class TypeInstr : Instr {
-    MetaDataElement theType;
-
-    internal TypeInstr(int inst, Type aType, MetaData md) : base(inst) {
-      theType = aType.GetTypeSpec(md);
-      size += 4;
-    }
-
-    internal sealed override void Write(FileImage output) {
-      base.Write(output);
-      output.Write(theType.Token());
-                }
-
-  }
-
-  internal class BranchInstr : Instr {
-    CILLabel dest;
-    private bool shortVer = true;
-    private static readonly byte longInstrOffset = 13;
-    private int target = 0;
-
-    internal BranchInstr(int inst, CILLabel dst) : base(inst) {
-      dest = dst;
-      dest.AddBranch(this);
-      size++;
-
-      if (inst >= (int) BranchOp.br && inst != (int) BranchOp.leave_s) {
-              shortVer = false;
-              size += 3;
-      }
-    }
-
-    internal sealed override bool Check(MetaData md) {
-      target = (int)dest.GetLabelOffset() - (int)(offset + size);
-      return false;
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        if (shortVer)
-                                output.Write((sbyte)target);
-                        else
-                                output.Write(target);
-                }
-
-  }
-
-  internal class SwitchInstr : Instr {
-    CILLabel[] cases;
-                uint numCases = 0;
-
-    internal SwitchInstr(int inst, CILLabel[] dsts) : base(inst) {
-      cases = dsts;
-                        if (cases != null) numCases = (uint)cases.Length;
-      size += 4 + (numCases * 4);
-      for (int i=0; i < numCases; i++) {
-        cases[i].AddBranch(this);
-      }
-    }
-
-                internal sealed override void Write(FileImage output) {
-                        base.Write(output);
-                        output.Write(numCases);
-                        for (int i=0; i < numCases; i++) {
-                                int target = (int)cases[i].GetLabelOffset() - (int)(offset + size);
-                                output.Write(target);
-                        }
-                }
-
-  }
-  /**************************************************************************/  
-
-        public class GenericParameter : MetaDataElement
-        {
-                MetaDataElement owner;
-                MetaData metadata;
-                string name;
-                uint nameIx;
-                short index;
-
-                internal GenericParameter (ClassDef owner, MetaData metadata,
-                                short index, string name) : this (owner, metadata, index, name, true)
-                {
-                }
-
-                internal GenericParameter (MethodDef owner, MetaData metadata,
-                                short index, string name) : this (owner, metadata, index, name, true)
-                {
-                }
-
-                private GenericParameter (MetaDataElement owner, MetaData metadata,
-                                short index, string name, bool nadda)
-                {
-                        this.owner = owner;
-                        this.metadata = metadata;
-                        this.index = index;
-                        tabIx = MDTable.GenericParam;
-                        this.name = name;
-                }
-
-    internal override uint SortKey() {
-      return (owner.Row << MetaData.CIxShiftMap[(uint)CIx.TypeOrMethodDef])
-              | owner.GetCodedIx(CIx.TypeOrMethodDef);
-    }
-
-                public void AddConstraint  (Type constraint) {
-                        metadata.AddToTable (MDTable.GenericParamConstraint,
-                                        new GenericParamConstraint (this, constraint));
-                }
-
-                internal sealed override uint Size(MetaData md) {
-                        return (uint) (4 +
-                               md.CodedIndexSize(CIx.TypeOrMethodDef) + 
-                               4 +
-                               md.TableIndexSize(MDTable.TypeDef));
-                }
-
-                internal sealed override void BuildTables(MetaData md) {
-                        if (done) return;
-                        nameIx = md.AddToStringsHeap(name);
-                        done = true;
-                }
-
-                internal sealed override void Write(FileImage output) {
-                        output.Write ((short) index);
-                        output.Write ((short) 0);
-                        output.WriteCodedIndex(CIx.TypeOrMethodDef, owner);
-                        output.Write ((uint) nameIx);
-                        output.WriteIndex(MDTable.TypeDef,owner.Row);
-                }
-
-    
-        }
-
-        internal class GenericParamConstraint : MetaDataElement
-        {
-                GenericParameter param;
-                Type type;
-
-                public GenericParamConstraint (GenericParameter param, Type type) {
-                        this.param = param;
-                        this.type = type;
-                        tabIx = MDTable.GenericParamConstraint;
-                }
-
-                internal sealed override uint Size(MetaData md) {
-                        return (uint) (md.TableIndexSize(MDTable.GenericParam) +
-                                       md.CodedIndexSize(CIx.TypeDefOrRef));
-                }
-
-                internal sealed override void Write(FileImage output) {
-                        output.WriteIndex(MDTable.GenericParam, param.Row);
-                        output.WriteCodedIndex(CIx.TypeDefOrRef, type);
-                }
-
-
-        }
-
-        internal class MethodSpec : MetaDataElement
-        {
-                Method meth;
-                GenericMethodSig g_sig;
-                uint sidx;
-
-                internal MethodSpec (Method meth, GenericMethodSig g_sig) {
-                        this.meth = meth;
-                        this.g_sig = g_sig;
-                        tabIx = MDTable.MethodSpec;
-                }
-
-                internal sealed override void BuildTables (MetaData md) {
-                        if (done) return;
-                        sidx = g_sig.GetSigIx (md);
-                        done = true;
-                }
-
-                internal sealed override uint Size (MetaData md) {
-                        return (uint) (md.CodedIndexSize(CIx.MethodDefOrRef) +
-                                       md.BlobIndexSize ());
-                }
-
-                internal sealed override void Write (FileImage output) {
-                    output.WriteCodedIndex (CIx.MethodDefOrRef, meth);
-                    output.BlobIndex (sidx);
-                }
-        }
-
-  /**************************************************************************/
-        /// <summary>
-        /// Descriptor for interface implemented by a class
-        /// </summary>
-        public class InterfaceImpl: MetaDataElement
-        { 
-    ClassDef theClass;
-    Class theInterface;
-
-                internal InterfaceImpl(ClassDef theClass, Class theInterface) {
-      this.theClass = theClass;
-      this.theInterface = theInterface;
-                        tabIx = MDTable.InterfaceImpl;
-                }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.TableIndexSize(MDTable.TypeDef) + 
-             md.CodedIndexSize(CIx.TypeDefOrRef);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteIndex(MDTable.TypeDef,theClass.Row);
-      output.WriteCodedIndex(CIx.TypeDefOrRef,theInterface);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) { return 5; }
-
-    internal override uint SortKey ()
-    {
-        return (theClass.Row << MetaData.CIxShiftMap[(uint)CIx.TypeDefOrRef])
-                | theClass.GetCodedIx (CIx.TypeDefOrRef);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a local of a method
-        /// </summary>
-  public class Local
-        {
-    private static readonly byte Pinned = 0x45;
-    string name;
-    Type type;
-    bool pinned = false, byref = false;
-
-    /// <summary>
-    /// Create a new local variable 
-    /// </summary>
-    /// <param name="lName">name of the local variable</param>
-    /// <param name="lType">type of the local variable</param>
-    public Local(string lName, Type lType) {
-      name = lName;
-      type = lType;
-    }
-
-    /// <summary>
-    /// Create a new local variable that is byref and/or pinned
-    /// </summary>
-    /// <param name="lName">local name</param>
-    /// <param name="lType">local type</param>
-    /// <param name="byRef">is byref</param>
-    /// <param name="isPinned">has pinned attribute</param>
-                public Local(string lName, Type lType, bool byRef, bool isPinned)
-                {
-      name = lName;
-      type = lType;
-      byref = byRef;
-      pinned = isPinned;
-                }
-
-    internal void TypeSig(MemoryStream str) {
-      if (pinned) str.WriteByte(Pinned);
-      type.TypeSig(str);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for the locals for a method
-        /// </summary>
-
-  public class LocalSig : Signature
-        {
-                private static readonly byte LocalSigByte = 0x7;
-    Local[] locals;
-
-                public LocalSig(Local[] locals)         {
-      this.locals = locals;
-      tabIx = MDTable.StandAloneSig;
-                }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      MemoryStream sig = new MemoryStream();
-      sig.WriteByte(LocalSigByte);
-      MetaData.CompressNum((uint)locals.Length,sig);
-      for (int i=0; i < locals.Length; i++) {
-        ((Local)locals[i]).TypeSig(sig);
-      }
-      sigIx = md.AddToBlobHeap(sig.ToArray());
-      done = true;
-    }
-
-  }
-
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for resources used in this PE file 
-        /// </summary>
-
-  public class ManifestResource : MetaDataElement
-        {
-    public static readonly uint PublicResource = 0x1;
-    public static readonly uint PrivateResource = 0x2;
-
-    string mrName;
-    MetaDataElement rRef;
-    uint fileOffset;
-    uint nameIx = 0;
-    uint flags = 0;
-    byte [] resourceBytes;
-
-    public ManifestResource (string name, byte[] resBytes, uint flags) {
-      InitResource (name, flags);
-      this.resourceBytes = resBytes;
-    }
-
-    public ManifestResource(string name, uint flags, FileRef fileRef) {
-      InitResource (name, flags);
-      rRef = fileRef;
-    }
-
-    public ManifestResource(string name, uint flags, FileRef fileRef, 
-                                                            uint fileIx) {
-      InitResource (name, flags);
-      rRef = fileRef;
-      fileOffset = fileIx;
-    }
-
-    public ManifestResource(string name, uint flags, AssemblyRef assemRef) {
-      InitResource (name, flags);
-      rRef = assemRef;
-    }
-
-    internal ManifestResource (ManifestResource mres) {
-      mrName = mres.mrName;
-      flags = mres.flags;
-      rRef = mres.rRef;
-      fileOffset = mres.fileOffset;
-      resourceBytes = mres.resourceBytes;
-    }
-
-    private void InitResource (string name, uint flags) {
-      mrName = name;
-      this.flags = flags;
-      tabIx = MDTable.ManifestResource;
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      md.AddToTable (MDTable.ManifestResource, this);
-      nameIx = md.AddToStringsHeap(mrName);
-      if (resourceBytes != null) {
-        if (rRef != null)
-          throw new Exception("ERROR:  Manifest Resource has byte value and file reference");
-        fileOffset = md.AddResource(resourceBytes);
-      } else {
-        if (rRef == null)
-          throw new Exception("ERROR:  Manifest Resource has no implementation or value");
-       rRef.BuildTables (md);
-      }
-
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 8 + md.StringsIndexSize() + 
-                 md.CodedIndexSize(CIx.Implementation);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(fileOffset);
-      output.Write(flags);
-      output.StringsIndex(nameIx);
-      output.WriteCodedIndex(CIx.Implementation,rRef);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) { return 18; }
-    
-    public string Name {
-      get { return mrName; }
-      set { mrName = value; }
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for elements in the PropertyMap, EventMap and 
-        /// NestedClass MetaData tables
-        /// </summary>
-  public class MapElem : MetaDataElement
-        {
-    ClassDef parent;
-    uint elemIx;
-    MDTable elemTable;
-
-                internal MapElem(ClassDef par, uint elIx, MDTable elemTab) {
-      parent = par;
-      elemIx = elIx;
-      elemTable = elemTab;
-                }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.TableIndexSize(MDTable.TypeDef) + md.TableIndexSize(elemTable);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteIndex(MDTable.TypeDef,parent.Row);
-      output.WriteIndex(elemTable,elemIx);
-    }
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for field/methods (member of a class)
-        /// </summary>
-        public abstract class Member : MetaDataElement
-        {
-    protected string name;
-    protected uint nameIx = 0, sigIx = 0;
-    
-                internal Member(string memName)
-                {
-      name = memName;
-                        tabIx = MDTable.MemberRef;
-                }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-  /// MetaData 
-  ///   Root (20 bytes + UTF-8 Version String + quad align padding)
-  ///   StreamHeaders (8 bytes + null terminated name string + quad align padding)
-  ///   Streams 
-  ///     #~        (always present - holds metadata tables)
-  ///     #Strings  (always present - holds identifier strings)
-  ///     #US       (Userstring heap)
-  ///     #Blob     (signature blobs)
-  ///     #GUID     (guids for assemblies or Modules)
-  /// </summary>
-
-  public class MetaData 
-        {
-                internal static readonly int[] CIxShiftMap = {2,2,5,1,2,3,1,1,1,2,3,2,1};
-                private static readonly byte StringsHeapMask = 0x1;
-                private static readonly byte GUIDHeapMask = 0x2;
-                private static readonly byte BlobHeapMask = 0x4;
-    private static readonly uint MetaDataSignature = 0x424A5342;
-    private static readonly uint maxSmlIxSize = 0xFFFF;
-    private static readonly uint max1BitSmlIx = 0x7FFF;
-    private static readonly uint max2BitSmlIx = 0x3FFF;
-    private static readonly uint max3BitSmlIx = 0x1FFF;
-    private static readonly uint max5BitSmlIx = 0x7FF;
-    // NOTE: version and stream name strings MUST always be quad padded
-    private static readonly string version = "v1.1.4322\0\0\0";
-    private static readonly char[] tildeName = {'#','~','\0','\0'};
-    private static readonly char[] stringsName = {'#','S','t','r','i','n','g','s','\0','\0','\0','\0'};
-    private static readonly char[] usName = {'#','U','S','\0'};
-    private static readonly char[] guidName = {'#','G','U','I','D','\0','\0','\0'};
-    private static readonly char[] blobName = {'#','B','l','o','b','\0','\0','\0'};
-                private static readonly uint MetaDataHeaderSize = 20 + (uint)version.Length;
-    private static readonly uint TildeHeaderSize = 24;
-    private static readonly uint StreamHeaderSize = 8;
-    private static readonly uint numMetaDataTables = (int)MDTable.GenericParamConstraint + 1;
-    private static readonly uint tildeHeaderSize = 8 + (uint)tildeName.Length;
-
-    MetaDataStream strings, us, guid, blob;
-
-    MetaDataStream[] streams = new MetaDataStream[5];
-    uint numStreams = 5;
-    uint tildeTide = 0, tildePadding = 0, tildeStart = 0;
-    uint numTables = 0, resourcesSize = 0;
-    ArrayList[] metaDataTables = new ArrayList[numMetaDataTables];
-    ArrayList byteCodes = new ArrayList();
-    uint codeSize = 0, codeStart, byteCodePadding = 0, metaDataSize = 0;
-                ulong valid = 0, /*sorted = 0x000002003301FA00;*/ sorted = 0;
-    bool[] largeIx = new bool[numMetaDataTables];
-    bool[] lgeCIx = new bool[(int)CIx.MaxCIx];
-                bool largeStrings = false, largeUS = false, largeGUID = false, largeBlob = false;
-                private FileImage file;
-    private byte heapSizes = 0;
-                MetaDataElement entryPoint;
-                BinaryWriter output;
-    public MSCorLib mscorlib;
-    private TypeSpec[] systemTypeSpecs = new TypeSpec[PrimitiveType.NumSystemTypes];
-    long mdStart;
-                private ArrayList cattr_list;
-                private ArrayList declsec_list;
-    ArrayList resources;            
-                
-    internal MetaData(FileImage file) {
-      // tilde = new MetaDataStream(tildeName,false,0);
-      this.file = file;
-                        strings = new MetaDataStream(stringsName,new UTF8Encoding(),true);
-      us = new MetaDataStream(usName,new UnicodeEncoding(),true);
-      guid = new MetaDataStream(guidName,false);
-      blob = new MetaDataStream(blobName,true);
-      streams[1] = strings;
-      streams[2] = us;
-      streams[3] = guid;
-      streams[4] = blob;
-      for (int i=0; i < numMetaDataTables; i++) {
-        largeIx[i] = false;
-      }
-      for (int i=0; i < lgeCIx.Length; i++) {
-        lgeCIx[i] = false;
-      }
-      mscorlib = new MSCorLib(this);
-                }
-    internal TypeSpec GetPrimitiveTypeSpec(int ix) {
-      return systemTypeSpecs[ix];
-    }
-
-    internal void SetPrimitiveTypeSpec(int ix, TypeSpec typeSpec) {
-      systemTypeSpecs[ix] = typeSpec;
-    }
-
-    internal uint Size() {
-      return metaDataSize;
-    }
-
-    
-    private void CalcHeapSizes ()
-    {
-            if (strings.LargeIx()) {
-                    largeStrings = true;
-                    heapSizes |= StringsHeapMask;
-            }
-            if (guid.LargeIx()) {
-                    largeGUID = true;
-                    heapSizes |= GUIDHeapMask;
-            }
-            if (blob.LargeIx()) {
-                    largeBlob = true;
-                    heapSizes |= BlobHeapMask;
-            }
-
-            largeUS = us.LargeIx();
-   }
-
-                internal void StreamSize(byte mask) {
-                        heapSizes |= mask;
-                }
-
-    internal uint AddToUSHeap(string str) {
-      if (str == null) return 0;
-      return us.Add(str,true);
-   }
-
-                internal uint AddToUSHeap(byte[] str) {
-                        if (str == null) return 0;
-                        return us.Add (str, true);
-                }
-                                
-    internal uint AddToStringsHeap(string str) {
-      if ((str == null) || (str.CompareTo("") == 0)) return 0;
-      return strings.Add(str,false);
-    }
-
-    internal uint AddToGUIDHeap(Guid guidNum) {
-      return guid.Add(guidNum, false);
-    }
-
-    internal uint AddToBlobHeap(byte[] blobBytes) {
-      if (blobBytes == null) return 0;
-      return blob.Add(blobBytes, true);
-    }
-
-    internal uint AddToBlobHeap(byte val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(sbyte val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(ushort val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(short val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(uint val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(int val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(ulong val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(long val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(float val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(double val) {
-      return blob.Add(val, true);
-    }
-
-    internal uint AddToBlobHeap(string val) {
-      return blob.Add(val,true);
-    }
-
-                internal void AddCustomAttribute (CustomAttribute cattr)
-                {
-                        if (cattr_list == null)
-                                cattr_list = new ArrayList ();
-                        cattr_list.Add (cattr);
-                }
-               
-               internal void AddDeclSecurity (DeclSecurity decl_sec)
-                {
-                        if (declsec_list == null)
-                                declsec_list = new ArrayList ();
-                        declsec_list.Add (decl_sec);
-                }
-
-    private ArrayList GetTable(MDTable tableIx) {
-      int tabIx = (int)tableIx;
-      if (metaDataTables[tabIx] == null) {
-        metaDataTables[tabIx] = new ArrayList();
-        valid |= ((ulong)0x1 << tabIx);
-        // Console.WriteLine("after creating table " + tableIx + "(" + tabIx + ") valid = " + valid);
-        numTables++;
-      }
-      return metaDataTables[tabIx];
-    }
-    internal void AddToTable(MDTable tableIx, MetaDataElement elem) {
-      if (elem.Row > 0) {
-        // Console.Out.WriteLine("ERROR - element already in table " + tableIx);
-        return;
-      }
-      // updates Row field of the element
-      // Console.WriteLine("Adding element to table " + (uint)tableIx);
-      ArrayList table = GetTable(tableIx);
-      elem.Row = (uint)table.Count + 1;
-      table.Add(elem);
-    }
-
-    internal uint TableIndex(MDTable tableIx) {
-      if (metaDataTables[(int)tableIx] == null) return 1;
-      return (uint)metaDataTables[(int)tableIx].Count+1;
-    }
-
-    internal uint AddCode(CILInstructions byteCode) {
-      byteCodes.Add(byteCode);
-      uint offset = codeSize + codeStart;
-      codeSize += byteCode.GetCodeSize();
-      return offset;
-    }
-
-    internal void SetEntryPoint(MetaDataElement ep) {
-      entryPoint = ep;
-    }
-
-    internal uint AddResource(byte[] resBytes) {
-      if (resources == null) resources = new ArrayList ();
-      resources.Add (resBytes);
-      uint offset = resourcesSize;
-      resourcesSize += (uint)resBytes.Length + 4;
-      return offset;
-    }
-
-    internal void AddData(DataConstant cVal) {
-      file.AddInitData(cVal);
-    }
-
-                internal static void CompressNum(uint val, MemoryStream sig) {
-                        if (val < 0x7F) {
-                                sig.WriteByte((byte)val);
-                        } else if (val < 0x3FFF) {
-                                byte b1 = (byte)((val >> 8) | 0x80);
-                                byte b2 = (byte)(val & FileImage.iByteMask[0]);
-                                sig.WriteByte(b1);
-                                sig.WriteByte(b2);
-                        } else {
-                                byte b1 = (byte)((val >> 24) | 0xC0);
-                                byte b2 = (byte)((val & FileImage.iByteMask[2]) >> 16);
-                                byte b3 = (byte)((val & FileImage.iByteMask[1]) >> 8);;
-                                byte b4 = (byte)(val & FileImage.iByteMask[0]);
-                                sig.WriteByte(b1);
-                                sig.WriteByte(b2);
-                                sig.WriteByte(b3);
-                                sig.WriteByte(b4);
-                        }
-                }
-
-    internal uint CodeSize() {
-      return codeSize + byteCodePadding;
-    }
-
-    internal uint GetResourcesSize() 
-    { 
-        return resourcesSize; 
-    }
-
-    internal uint StringsIndexSize() {
-      if (largeStrings) return 4;
-      return 2;
-    }
-
-    internal uint GUIDIndexSize() {
-      if (largeGUID) return 4;
-      return 2;
-    }
-
-    internal uint USIndexSize() {
-      if (largeUS) return 4;
-      return 2;
-    }
-
-    internal uint BlobIndexSize() {
-      if (largeBlob) return 4;
-      return 2;
-    }
-
-    internal uint CodedIndexSize(CIx code) {
-      if (lgeCIx[(uint)code]) return 4;
-      return 2;
-    }
-
-    internal uint TableIndexSize(MDTable tabIx) {
-      if (largeIx[(uint)tabIx]) return 4;
-      return 2;
-    }
-    
-    private void SetIndexSizes() {
-      for (int i=0; i < numMetaDataTables; i++) {
-          if (metaDataTables[i] == null)
-                  continue;
-
-          uint count = (uint)metaDataTables[i].Count;
-          if (count > maxSmlIxSize)
-                  largeIx[i] = true;
-
-            MDTable tabIx = (MDTable)i;
-            if (count > max5BitSmlIx) {
-              lgeCIx[(int)CIx.HasCustomAttr] = true;
-            }
-            if (count > max3BitSmlIx) {
-              if ((tabIx == MDTable.TypeRef) || (tabIx == MDTable.ModuleRef) || (tabIx == MDTable.Method) || (tabIx == MDTable.TypeSpec) || (tabIx == MDTable.Field)) 
-                lgeCIx[(int)CIx.CustomAttributeType] = true;
-              if ((tabIx == MDTable.Method) || (tabIx == MDTable.MemberRef)) 
-                lgeCIx[(int)CIx.MemberRefParent] = true;
-            }
-            if (count > max2BitSmlIx) {
-              if ((tabIx == MDTable.Field) || (tabIx == MDTable.Param) || (tabIx == MDTable.Property)) 
-                lgeCIx[(int)CIx.HasConst] = true;
-              if ((tabIx == MDTable.TypeDef) || (tabIx == MDTable.TypeRef) || (tabIx == MDTable.TypeSpec))
-                lgeCIx[(int)CIx.TypeDefOrRef] = true;
-              if ((tabIx == MDTable.TypeDef) || (tabIx == MDTable.Method) || (tabIx == MDTable.Assembly))
-                lgeCIx[(int)CIx.HasDeclSecurity] = true;
-              if ((tabIx == MDTable.File) || (tabIx == MDTable.AssemblyRef) || (tabIx == MDTable.ExportedType))
-                lgeCIx[(int)CIx.Implementation] = true;
-              if ((tabIx == MDTable.Module) || (tabIx == MDTable.ModuleRef) || (tabIx == MDTable.AssemblyRef) || (tabIx == MDTable.TypeRef))
-                lgeCIx[(int)CIx.ResolutionScope] = true;
-            }
-            if (count > max1BitSmlIx) {
-              if ((tabIx == MDTable.Field) || (tabIx == MDTable.Param)) 
-                lgeCIx[(int)CIx.HasFieldMarshal] = true;
-              if ((tabIx == MDTable.Event) || (tabIx == MDTable.Property)) 
-                lgeCIx[(int)CIx.HasSemantics] = true;
-              if ((tabIx == MDTable.Method) || (tabIx == MDTable.MemberRef)) 
-                lgeCIx[(int)CIx.MethodDefOrRef] = true;
-              if ((tabIx == MDTable.Field) || (tabIx == MDTable.Method)) 
-                lgeCIx[(int)CIx.MemberForwarded] = true; 
-              if ((tabIx == MDTable.TypeDef) || (tabIx == MDTable.Method)) 
-                lgeCIx[(int)CIx.TypeOrMethodDef] = true; 
-            }
-      }
-    }
-
-    private void SetStreamOffsets() {
-      uint sizeOfHeaders = StreamHeaderSize + (uint)tildeName.Length;
-      for (int i=1; i < numStreams; i++) {
-        sizeOfHeaders += streams[i].headerSize();
-      }
-      metaDataSize = MetaDataHeaderSize + sizeOfHeaders;
-      tildeStart = metaDataSize;
-      metaDataSize += tildeTide + tildePadding;
-      for (int i=1; i < numStreams; i++) {
-        streams[i].Start = metaDataSize;
-        metaDataSize += streams[i].Size();
-        streams[i].WriteDetails();
-      }
-    }
-
-    internal void CalcTildeStreamSize() {
-CalcHeapSizes ();
-      //tilde.SetIndexSizes(strings.LargeIx(),us.LargeIx(),guid.LargeIx(),blob.LargeIx());
-      tildeTide = TildeHeaderSize;
-      tildeTide += 4 * numTables;
-      //Console.WriteLine("Tilde header + sizes = " + tildeTide);
-      for (int i=0; i < numMetaDataTables; i++) {
-        if (metaDataTables[i] != null) {
-          ArrayList table = metaDataTables[i];
-          // Console.WriteLine("Meta data table " + i + " at offset " + tildeTide);
-          tildeTide += (uint)table.Count * ((MetaDataElement)table[0]).Size(this);
-          // Console.WriteLine("Metadata table " + i + " has size " + table.Count);
-          // Console.WriteLine("tildeTide = " + tildeTide);
-        }
-      }
-      if ((tildeTide % 4) != 0) tildePadding = 4 - (tildeTide % 4);
-      //Console.WriteLine("tildePadding = " + tildePadding);
-    }
-
-    internal void WriteTildeStream(FileImage output) {
-      long startTilde = output.Seek(0,SeekOrigin.Current);
-                        output.Write((uint)0); // Reserved
-                        output.Write((byte)1); // MajorVersion
-                        output.Write((byte)1); // MinorVersion
-                        output.Write(heapSizes);
-                        output.Write((byte)1); // Reserved
-                        output.Write(valid);
-                        output.Write(sorted);
-                        for (int i=0; i < numMetaDataTables; i++) {
-                                if (metaDataTables[i] != null) {
-                                        uint count = (uint)metaDataTables[i].Count;
-                                        output.Write(count);
-                                }
-                        }
-      long tabStart = output.Seek(0,SeekOrigin.Current);
-      // Console.WriteLine("Starting metaData tables at " + tabStart);
-                        for (int i=0; i < numMetaDataTables; i++) {
-                                if (metaDataTables[i] != null) {
-          // Console.WriteLine("Starting metaData table " + i + " at " + (output.Seek(0,SeekOrigin.Current) - startTilde));
-          ArrayList table = metaDataTables[i];
-                                        for (int j=0; j < table.Count; j++) {
-             ((MetaDataElement)table[j]).Write(output);
-                                        }
-                                }
-                        }
-      // Console.WriteLine("Writing padding at " + output.Seek(0,SeekOrigin.Current));
-      for (int i=0; i < tildePadding; i++) output.Write((byte)0);
-                }
-
-    private void BuildTable(ArrayList table) {
-      if (table == null) return;
-      for (int j=0; j < table.Count; j++) {
-        ((MetaDataElement)table[j]).BuildTables(this);
-      }
-    }
-
-    private void SortTable (ArrayList mTable) {
-      if (mTable == null) return;
-      mTable.Sort();
-      for (int i=0; i < mTable.Count; i++) {
-        ((MetaDataElement)mTable[i]).Row = (uint)i+1;
-      }
-    }
-
-    internal void BuildMetaData(uint codeStartOffset) {
-      codeStart = codeStartOffset;
-      BuildTable(metaDataTables[(int)MDTable.TypeDef]);
-      BuildTable(metaDataTables[(int)MDTable.MemberRef]);
-      BuildTable(metaDataTables[(int)MDTable.GenericParam]);
-      BuildTable(metaDataTables[(int)MDTable.MethodSpec]);
-      BuildTable(metaDataTables[(int)MDTable.GenericParamConstraint]);
-      BuildTable(metaDataTables[(int)MDTable.ManifestResource]);
-
-      if (cattr_list != null) {
-              foreach (CustomAttribute cattr in cattr_list)
-                      cattr.BuildTables (this);
-      }
-      
-      if (declsec_list != null) {
-              foreach (DeclSecurity decl_sec in declsec_list)
-                      decl_sec.BuildTables (this);
-      }
-
-/*      for (int i=0; i < metaDataTables.Length; i++) {
-        ArrayList table = metaDataTables[i];
-        if (table != null) {
-          for (int j=0; j < table.Count; j++) {
-            ((MetaDataElement)table[j]).BuildTables(this);
-          }
-        }
-      }
-      */
-
-                        SetIndexSizes();
-                        for (int i=1; i < numStreams; i++) {
-                                streams[i].EndStream();
-                        }
-                        CalcTildeStreamSize();
-                        SetStreamOffsets();
-      byteCodePadding = NumToAlign(codeSize,4);
-      if (entryPoint != null) file.SetEntryPoint(entryPoint.Token());
-      
-      // Check ordering of specific tables
-      // Constant, CustomAttribute, FieldMarshal, DeclSecurity, MethodSemantics
-      // ImplMap, GenericParam
-      // Need to load GenericParamConstraint AFTER GenericParam table in correct order
-      // The tables:
-      //   InterfaceImpl, ClassLayout, FieldLayout, MethodImpl, FieldRVA, NestedClass
-      // will _ALWAYS_ be in the correct order as embedded in BuildMDTables
-      
-      SortTable(metaDataTables[(int)MDTable.Constant]);
-      SortTable(metaDataTables[(int)MDTable.CustomAttribute]);
-      SortTable(metaDataTables[(int)MDTable.FieldMarshal]);
-      SortTable(metaDataTables[(int)MDTable.DeclSecurity]);
-      SortTable(metaDataTables[(int)MDTable.MethodSemantics]);
-      SortTable(metaDataTables[(int)MDTable.ImplMap]);
-      if (metaDataTables[(int)MDTable.GenericParam] != null) {
-        SortTable(metaDataTables[(int)MDTable.GenericParam]);
-        // Now add GenericParamConstraints
-        /*for (int i=0; i < metaDataTables[(int)MDTable.GenericParam].Count; i++) {
-          ((GenericParameter)metaDataTables[(int)MDTable.GenericParam][i]).AddConstraints(this);
-        }*/
-      }
-      SortTable(metaDataTables[(int)MDTable.GenericParamConstraint]);
-      SortTable(metaDataTables[(int)MDTable.InterfaceImpl]);
-
-    }
-
-    internal void WriteByteCodes(FileImage output) {
-      for (int i=0; i < byteCodes.Count; i++) {
-        ((CILInstructions)byteCodes[i]).Write(output);
-      }
-      for (int i=0; i < byteCodePadding; i++) {
-        output.Write((byte)0);
-      }
-    }
-
-    internal void WriteResources (FileImage output) {
-      if (resources == null) return;
-      for (int i = 0; i < resources.Count; i ++) {
-        byte [] resBytes = (byte []) resources [i];
-        output.Write ((uint) resBytes.Length);
-        output.Write (resBytes);
-      } 
-    }
-
-    internal void WriteMetaData(FileImage output) {
-                        this.output = output;
-      mdStart = output.Seek(0,SeekOrigin.Current);
-      // Console.WriteLine("Writing metaData at " + Hex.Long(mdStart));
-      output.Write(MetaDataSignature);
-      output.Write((short)1);  // Major Version
-      output.Write((short)1);  // Minor Version  ECMA = 0, PEFiles = 1
-      output.Write(0);         // Reserved
-      output.Write(version.Length);
-      output.Write(version.ToCharArray());   // version string is already zero padded
-      output.Write((short)0);
-      output.Write((ushort)numStreams);
-      // write tilde header
-      output.Write(tildeStart);
-      output.Write(tildeTide + tildePadding);
-      output.Write(tildeName);
-      for (int i=1; i < numStreams; i++) streams[i].WriteHeader(output);
-      // Console.WriteLine("Writing tilde stream at " + output.Seek(0,SeekOrigin.Current) + " = " + tildeStart);
-      WriteTildeStream(output);
-      for (int i=1; i < numStreams; i++) streams[i].Write(output);
-      // Console.WriteLine("Finished Writing metaData at " + output.Seek(0,SeekOrigin.Current));
-    }
-
-                internal bool LargeStringsIndex() { return strings.LargeIx(); }
-                internal bool LargeGUIDIndex() { return guid.LargeIx(); }
-                internal bool LargeUSIndex() { return us.LargeIx(); }
-                internal bool LargeBlobIndex() { return blob.LargeIx(); }
-
-    internal bool LargeIx(MDTable tabIx) { return largeIx[(uint)tabIx]; }
-
-
-                private uint NumToAlign(uint val, uint alignVal) {
-                        if ((val % alignVal) == 0) return 0;
-                        return alignVal - (val % alignVal);
-                }
-
-    internal void WriteCodedIndex(CIx code, MetaDataElement elem, FileImage output) {
-      uint ix = 0;
-      if (elem != null) { 
-        ix = (elem.Row << CIxShiftMap[(uint)code]) | elem.GetCodedIx(code);
-        // Console.WriteLine("coded index = " + ix + " row = " + elem.Row);
-      //} else {
-        // Console.WriteLine("elem for coded index is null");
-      }
-      if (lgeCIx[(uint)code]) 
-        output.Write(ix);
-      else
-        output.Write((ushort)ix);
-    }
-
-        }
-    /// <summary>
-    /// Error for invalid PE file
-    /// </summary>
-    public class PEFileException : System.Exception {
-      public PEFileException(string msg) : base("Error in PE File:  " + msg) { }
-    }
-
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for all Meta Data table elements
-        /// </summary>
-
-  public abstract class MetaDataElement: IComparable
-        {
-
-    protected ArrayList customAttributes;
-    private uint row = 0;
-    protected bool done = false;
-                protected MDTable tabIx;
-    protected bool sortTable = false;
-
-    internal MetaDataElement() { }
-
-    public uint Row {
-      get {
-        return row;
-      }
-      set {
-        if (row == 0) row = value;
-      }
-    }
-
-    internal virtual uint GetCodedIx(CIx code) { return 0; }
-
-    /// <summary>
-    /// Add a custom attribute to this item
-    /// </summary>
-    /// <param name="ctorMeth">the constructor method for this attribute</param>
-    /// <param name="val">the byte value of the parameters</param>
-    public void AddCustomAttribute(Method ctorMeth, byte[] val) {
-      if (customAttributes == null) {
-        customAttributes = new ArrayList();
-      } 
-      customAttributes.Add(new CustomAttribute(this,ctorMeth,val));
-    }
-
-    /// <summary>
-    /// Add a custom attribute to this item
-    /// </summary>
-    /// <param name="ctorMeth">the constructor method for this attribute</param>
-    /// <param name="val">the constant values of the parameters</param>
-    public void AddCustomAttribute(Method ctorMeth, Constant[] cVals) {
-      if (customAttributes == null) {
-        customAttributes = new ArrayList();
-      } 
-//      customAttributes.Add(new CustomAttribute(this,ctorMeth,cVals));
-    }
-
-    internal uint Token() {
-      return (((uint)tabIx << 24) | row);
-    }
-
-    internal virtual void BuildTables(MetaData md) {
-      done = true;
-    }
-
-    internal virtual uint Size(MetaData md) { 
-      return 0;
-    }
-
-    internal virtual void Write(FileImage output) {   }
-
-    internal virtual uint SortKey() 
-    { 
-      throw new PEFileException("Trying to sort table of " + this);
-      //return 0; 
-    }
-
-    internal virtual uint SortKey2()
-    {
-      return 0;
-    }
-
-
-    public int CompareTo(object obj) 
-    {
-      uint otherKey = ((MetaDataElement)obj).SortKey();
-      uint thisKey = SortKey();
-
-      if (thisKey == otherKey) 
-      {
-        otherKey = ((MetaDataElement)obj).SortKey2();
-        thisKey = SortKey2();
-        if (thisKey == otherKey)
-          return 0;
-        if (thisKey < otherKey)
-          return -1;
-        return 1;
-      }
-      if (thisKey < otherKey) return -1;
-
-      return 1;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Stream in the Meta Data  (#Strings, #US, #Blob and #GUID)
-        /// </summary>
-
-  internal class MetaDataStream : BinaryWriter 
-        {
-                private static readonly uint StreamHeaderSize = 8;
-                private static uint maxSmlIxSize = 0xFFFF;
-                
-    private uint start = 0; 
-    uint size = 0, tide = 1;
-    bool largeIx = false;
-    uint sizeOfHeader;
-    char[] name;
-    Hashtable htable = new Hashtable();
-    Hashtable btable = new Hashtable (new ByteArrayHashCodeProvider (), new ByteArrayComparer ());
-
-    internal MetaDataStream(char[] name, bool addInitByte) : base(new MemoryStream()) {
-      if (addInitByte) { Write((byte)0); size = 1; }
-      this.name = name;
-      sizeOfHeader = StreamHeaderSize + (uint)name.Length;
-    }
-
-    internal MetaDataStream(char[] name, System.Text.Encoding enc, bool addInitByte) : base(new MemoryStream(),enc) {
-      if (addInitByte) { Write((byte)0); size = 1; }
-      this.name = name;
-      sizeOfHeader = StreamHeaderSize + (uint)name.Length;
-                }
-
-    public uint Start {
-      get {
-        return start;
-      }
-      set {
-        start = value;
-      }
-    }
-  
-    internal uint headerSize() {
-      // Console.WriteLine(name + " stream has headersize of " + sizeOfHeader);
-      return sizeOfHeader;
-    }
-
-    internal void SetSize(uint siz) {
-      size = siz;
-    }
-
-    internal uint Size() {
-      return size;
-    }
-
-    internal bool LargeIx() {
-      return largeIx;
-    }
-
-    internal void WriteDetails() {
-      // Console.WriteLine(name + " - size = " + size);
-    }
-
-                internal uint Add(string str, bool prependSize) {
-      Object val = htable[str];
-      uint index = 0;
-      if (val == null) { 
-        index = size;
-        htable[str] = index;
-        char[] arr = str.ToCharArray();
-        if (prependSize) CompressNum((uint)arr.Length*2+1);
-        Write(arr);
-        Write((byte)0);
-        size = (uint)Seek(0,SeekOrigin.Current);
-      } else {
-        index = (uint)val;
-      }
-                        return index;
-                }
-                internal uint Add (byte[] str, bool prependSize) {
-                        Object val = btable [str];
-                        uint index = 0;
-                        if (val == null) {
-                                index = size;
-                                btable [str] = index;
-                                if (prependSize) CompressNum ((uint) str.Length);
-                                Write (str);
-                                size = (uint) Seek (0, SeekOrigin.Current);
-                        } else {
-                                index = (uint) val;
-                        }
-                        return index;
-                }
-
-                    
-                internal uint Add(Guid guid, bool prependSize) {
-                        byte [] b = guid.ToByteArray ();
-                        if (prependSize) CompressNum ((uint) b.Length);
-                        Write(guid.ToByteArray());
-                        size =(uint)Seek(0,SeekOrigin.Current);
-                        return tide++;
-                }
-
-                internal uint Add(byte[] blob) {
-                        uint ix = size;
-                        CompressNum((uint)blob.Length);
-                        Write(blob);
-                        size = (uint)Seek(0,SeekOrigin.Current);
-                        return ix;
-                }
-
-    internal uint Add(byte val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (1);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(sbyte val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (1);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(ushort val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (2);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(short val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (2);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(uint val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (4);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(int val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (4);
-      Write (val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(ulong val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (8);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(long val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (8);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(float val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (4);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-    internal uint Add(double val, bool prependSize) {
-      uint ix = size;
-      if (prependSize) CompressNum (8);
-      Write(val);
-      size = (uint)Seek(0,SeekOrigin.Current);
-      return ix;
-    }
-
-                private void CompressNum(uint val) {
-      if (val < 0x7F) {
-        Write((byte)val);
-      } else if (val < 0x3FFF) {
-        byte b1 = (byte)((val >> 8) | 0x80);
-        byte b2 = (byte)(val & FileImage.iByteMask[0]);
-        Write(b1);
-        Write(b2);
-      } else {
-        byte b1 = (byte)((val >> 24) | 0xC0);
-        byte b2 = (byte)((val & FileImage.iByteMask[2]) >> 16);
-        byte b3 = (byte)((val & FileImage.iByteMask[1]) >> 8);;
-        byte b4 = (byte)(val & FileImage.iByteMask[0]);
-        Write(b1);
-        Write(b2);
-        Write(b3);
-        Write(b4);
-      }
-    }
-
-    private void QuadAlign() {
-      if ((size % 4) != 0) {
-        uint pad = 4 - (size % 4);
-        size += pad;
-        for (int i=0; i < pad; i++) {
-          Write((byte)0);
-        }
-      }
-    }
-
-                internal void EndStream() {
-                        QuadAlign();
-                        if (size > maxSmlIxSize) {
-                                largeIx = true;
-                        }
-                }
-
-    internal void WriteHeader(BinaryWriter output) {
-      output.Write(start);
-      output.Write(size);
-      output.Write(name);
-    }
-
-                internal virtual void Write(BinaryWriter output) {
-       // Console.WriteLine("Writing " + name + " stream at " + output.Seek(0,SeekOrigin.Current) + " = " + start);
-      MemoryStream str = (MemoryStream)BaseStream;
-                        output.Write(str.ToArray());
-                }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for Method Descriptors
-        /// </summary>
-
-  public abstract class Method : Member
-        {
-    protected CallConv callConv = CallConv.Default;
-    protected Type retType;
-
-    internal Method(string methName, Type rType) : base(methName)
-                {
-      retType = rType;
-                }
-
-    /// <summary>
-    /// Add calling conventions to this method descriptor
-    /// </summary>
-    /// <param name="cconv"></param>
-    public void AddCallConv(CallConv cconv) {
-      callConv |= cconv;
-    }
-
-                internal abstract void TypeSig(MemoryStream sig);
-
-    internal uint GetSigIx(MetaData md) {
-      MemoryStream sig = new MemoryStream();
-                        TypeSig(sig);
-      return md.AddToBlobHeap(sig.ToArray());
-    }
-
-    internal Type GetRetType() {
-      return retType;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a method defined in THIS assembly/module
-        /// IL     .method
-        /// </summary>
-
-  public class MethodDef : Method
-        {
-    private static readonly ushort PInvokeImpl = 0x2000;
-    //private static readonly uint UnmanagedExport = 0x0008;
-   // private static readonly byte LocalSigByte = 0x7;
-    uint parIx = 0, textOffset = 0;
-
-    MetaData metaData;
-    CILInstructions code;
-    ArrayList securityActions = new ArrayList();
-                Param[] parList;
-    Local[] locals;
-    bool initLocals;
-    ushort methFlags = 0, implFlags = 0;
-    int maxStack = 0, numPars = 0;
-    bool entryPoint = false;
-    LocalSig localSig;
-                ArrayList varArgSigList;
-    ImplMap pinvokeImpl;
-       Param ret_param;
-
-
-                internal MethodDef(MetaData md, string name, Type retType, Param[] pars) : base(name,retType) {
-      metaData = md;
-                        parList = pars;
-                        if (parList != null) numPars = parList.Length;
-      tabIx = MDTable.Method;
-                }
-
-    internal MethodDef(MetaData md, MethAttr mAttrSet, ImplAttr iAttrSet, string name, Type retType, Param[] pars) : base(name,retType) {
-      metaData = md;
-                        parList = pars;
-                        if (parList != null) numPars = parList.Length;
-      // Console.WriteLine("Creating method " + name + " with " + numPars + " parameters");
-                        methFlags = (ushort)mAttrSet;
-      implFlags = (ushort)iAttrSet;
-      tabIx = MDTable.Method;
-    }
-
-                internal Param[] GetPars() {
-                        return parList;
-                }
-
-    /// <summary>
-    /// Add some attributes to this method descriptor
-    /// </summary>
-    /// <param name="ma">the attributes to be added</param>
-    public void AddMethAttribute(MethAttr ma) {
-      methFlags |= (ushort)ma;
-    }
-
-    /// <summary>
-    /// Add some implementation attributes to this method descriptor
-    /// </summary>
-    /// <param name="ia">the attributes to be added</param>
-    public void AddImplAttribute(ImplAttr ia) {
-      implFlags |= (ushort)ia;
-    }
-
-    public void AddPInvokeInfo(ModuleRef scope, string methName,
-                               PInvokeAttr callAttr) {
-      pinvokeImpl = new ImplMap((ushort)callAttr,this,methName,scope);
-      methFlags |= PInvokeImpl;
-    }
-
-    /// <summary>
-    ///  Add a named generic type parameter
-    /// </summary>
-    public GenericParameter AddGenericParameter (short index, string name) {
-            GenericParameter gp = new GenericParameter (this, metaData, index, name);
-            metaData.AddToTable (MDTable.GenericParam, gp);
-            return gp;
-    }
-
-    /// <summary>
-    /// Set the maximum stack height for this method
-    /// </summary>
-    /// <param name="maxStack">the maximum height of the stack</param>
-    public void SetMaxStack(int maxStack) {
-      this.maxStack = maxStack; 
-    }
-
-    /// <summary>
-    /// Add local variables to this method
-    /// </summary>
-    /// <param name="locals">the locals to be added</param>
-    /// <param name="initLocals">are locals initialised to default values</param>
-    public void AddLocals(Local[] locals, bool initLocals) {
-      this.locals = locals;
-      this.initLocals = initLocals;
-    }
-
-    /* Add Marshal info for return type */
-    public void AddRetTypeMarshallInfo (NativeType marshallType) {
-       ret_param = new Param (ParamAttr.HasFieldMarshal, "", retType); 
-       ret_param.AddMarshallInfo (marshallType);
-    }
-
-    /// <summary>
-    /// Mark this method as having an entry point
-    /// </summary>
-    public void DeclareEntryPoint() {
-      entryPoint = true;
-    }
-
-    /// <summary>
-    /// Create a code buffer for this method to add the IL instructions to
-    /// </summary>
-    /// <returns>a buffer for this method's IL instructions</returns>
-    public CILInstructions CreateCodeBuffer() {
-      code = new CILInstructions(metaData);
-      return code;
-    }
-
-    /// <summary>
-    /// Make a method reference descriptor for this method to be used 
-    /// as a callsite signature for this vararg method
-    /// </summary>
-    /// <param name="optPars">the optional pars for the vararg method call</param>
-    /// <returns></returns>
-    public MethodRef MakeVarArgSignature(Type[] optPars) {
-      Type[] pars = new Type[numPars];
-      MethodRef varArgSig;
-      for (int i=0; i < numPars; i++) {
-        pars[i] = parList[i].GetParType();
-      }
-      varArgSig = new MethodRef(this,name,retType,pars,true,optPars);
-
-      if (varArgSigList == null)
-              varArgSigList = new ArrayList ();
-      varArgSigList.Add (varArgSig);
-      return varArgSig;
-    }
-
-                internal sealed override void TypeSig(MemoryStream sig) {
-                        sig.WriteByte((byte)callConv);
-                        MetaData.CompressNum((uint)numPars,sig);
-                       if (ret_param != null)
-                               ret_param.seqNo = 0;
-                        retType.TypeSig(sig);
-                        for (ushort i=0; i < numPars; i++) {
-                                parList[i].seqNo = (ushort)(i+1);
-                                parList[i].TypeSig(sig);
-                        }
-                }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      if (pinvokeImpl != null) {
-        md.AddToTable(MDTable.ImplMap,pinvokeImpl);
-        pinvokeImpl.BuildTables(md);
-      }
-      if (entryPoint) md.SetEntryPoint(this);
-      uint locToken = 0;
-      if (locals != null) {
-        localSig = new LocalSig(locals);
-        md.AddToTable(MDTable.StandAloneSig,localSig);
-        localSig.BuildTables(md);
-        locToken = localSig.Token();
-      }
-                        if (code != null) {
-                                code.CheckCode(locToken,initLocals,maxStack);
-                                textOffset = md.AddCode(code);
-                        }
-      nameIx = md.AddToStringsHeap(name);
-      sigIx = GetSigIx(md);
-      parIx = md.TableIndex(MDTable.Param);
-                       if (ret_param != null) {
-                                md.AddToTable(MDTable.Param, ret_param);
-                                ret_param.BuildTables(md);
-                       }
-                        for (int i=0; i < numPars; i++) {
-                                md.AddToTable(MDTable.Param,parList[i]);
-                                parList[i].BuildTables(md);
-                        }
-      if (varArgSigList != null) {
-              foreach (MethodRef varArgSig in varArgSigList) {
-        md.AddToTable(MDTable.MemberRef,varArgSig);
-        varArgSig.BuildTables(md);
-      }
-      }
-      // Console.WriteLine("method has " + numPars + " parameters");
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 8 + md.StringsIndexSize() + md.BlobIndexSize() + md.TableIndexSize(MDTable.Param);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      if (ZeroRva ()) output.Write(0);
-      else output.WriteCodeRVA(textOffset);
-      output.Write(implFlags);
-      output.Write(methFlags);
-      output.StringsIndex(nameIx);
-      output.BlobIndex(sigIx);
-      output.WriteIndex(MDTable.Param,parIx);
-    }
-
-    internal bool ZeroRva () {
-        return (((methFlags & (ushort)MethAttr.Abstract) != 0) ||
-                        ((implFlags & (ushort)ImplAttr.Runtime) != 0) ||
-                        ((implFlags & (ushort)ImplAttr.InternalCall) != 0) || 
-                        (pinvokeImpl != null)); // TODO: Not entirely true but works for now
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-                        switch (code) {
-                                case (CIx.HasCustomAttr) : return 0; 
-                                case (CIx.HasDeclSecurity) : return 1; 
-                                case (CIx.MemberRefParent) : return 3; 
-                                case (CIx.MethodDefOrRef) : return 0; 
-                                case (CIx.MemberForwarded) : return 1; 
-                                case (CIx.CustomAttributeType) : return 2; 
-                                case (CIx.TypeOrMethodDef) : return 1; 
-                        }
-                        return 0;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for an overriding method (.override)
-        /// </summary>
-  public class MethodImpl : MetaDataElement
-        {
-    ClassDef parent;
-    Method header, body;
-
-                internal MethodImpl(ClassDef par, Method decl, Method bod)      {
-      parent = par;
-      header = decl;
-      body = bod;
-                        tabIx = MDTable.MethodImpl;
-                }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.TableIndexSize(MDTable.TypeDef) + 2 * md.CodedIndexSize(CIx.MethodDefOrRef);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteIndex(MDTable.TypeDef,parent.Row);
-      output.WriteCodedIndex(CIx.MethodDefOrRef,body);
-      output.WriteCodedIndex(CIx.MethodDefOrRef,header);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a method defined in another assembly/module
-        /// </summary>
-  public class MethodRef : Method
-  {
-    private static readonly byte Sentinel = 0x41;
-                Type[] parList, optParList;
-    MetaDataElement parent;
-    uint numPars = 0, numOptPars = 0;
-
-    internal MethodRef(MetaDataElement paren, string name, Type retType,
-        Type[] pars, bool varArgMeth, Type[] optPars) : base(name,retType) {
-      parent = paren;
-      parList = pars;
-      if (parList != null) numPars = (uint)parList.Length;
-      if (varArgMeth) {
-        optParList = optPars;
-        if (optParList != null) numOptPars = (uint)optParList.Length;
-        callConv = CallConv.Vararg;
-      }
-    }
-
-                internal sealed override void TypeSig(MemoryStream sig) {
-                        sig.WriteByte((byte)callConv);
-                        MetaData.CompressNum(numPars+numOptPars,sig);
-                        retType.TypeSig(sig);
-                        for (int i=0; i < numPars; i++) {
-                                parList[i].TypeSig(sig);
-                        }
-      if (numOptPars > 0) {
-        sig.WriteByte(Sentinel);
-        for (int i=0; i < numOptPars; i++) {
-          optParList[i].TypeSig(sig);
-        }
-      }
-                }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      nameIx = md.AddToStringsHeap(name);
-      sigIx = GetSigIx(md);
-      done = true;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.CodedIndexSize(CIx.MemberRefParent) + md.StringsIndexSize() + md.BlobIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.WriteCodedIndex(CIx.MemberRefParent,parent);
-      output.StringsIndex(nameIx);
-      output.BlobIndex(sigIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasCustomAttr) : return 6; 
-        case (CIx.MethodDefOrRef) : return 1; 
-        case (CIx.CustomAttributeType) : return 3; 
-      }
-                        return 0;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for Property and Event methods
-        /// </summary>
-  public class MethodSemantics : MetaDataElement {
-
-    Feature.MethodType type;
-    MethodDef meth;
-    Feature eventOrProp;
-
-    internal MethodSemantics(Feature.MethodType mType, MethodDef method, Feature feature) {
-      type = mType;
-      meth = method;
-      eventOrProp = feature;
-                        tabIx = MDTable.MethodSemantics;
-                }
-
-    internal override uint SortKey() {
-      return (eventOrProp.Row << MetaData.CIxShiftMap [(uint)CIx.HasSemantics])
-              | eventOrProp.GetCodedIx (CIx.HasSemantics);
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 2 + md.TableIndexSize(MDTable.Method) + md.CodedIndexSize(CIx.HasSemantics);
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write((ushort)type);
-      output.WriteIndex(MDTable.Method,meth.Row);
-      output.WriteCodedIndex(CIx.HasSemantics,eventOrProp);
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a FunctionPointer type
-        /// </summary>
-        /// 
-        public class MethPtrType : Type
-        {
-                bool varArgMeth;
-                Type retType;
-                Type [] parList;
-                Type [] optParList;
-                CallConv callConv;
-                uint numPars;
-                uint numOptPars;
-                uint sigIx = 0;
-
-    /// <summary>
-    /// Create a new function pointer type
-    /// </summary>
-    /// <param name="meth">the function to be referenced</param>
-    public MethPtrType (CallConv callconv, Type retType, Type[] pars,
-                    bool varArgMeth, Type[] optPars) : base(0x1B) {
-      this.retType = retType;
-      callConv = callconv;
-      parList = pars;
-      this.varArgMeth = varArgMeth;
-      if (parList != null) numPars = (uint)parList.Length;
-      if (varArgMeth) {
-        optParList = optPars;
-        if (optParList != null) numOptPars = (uint)optParList.Length;
-        callConv |= CallConv.Vararg;
-      }
-      tabIx = MDTable.TypeSpec;
-    }
-  
-    internal sealed override void TypeSig(MemoryStream sig) {
-      sig.WriteByte(typeIndex);
-      // Bootlegged from method ref
-      sig.WriteByte((byte)callConv);
-      MetaData.CompressNum (numPars + numOptPars, sig);
-      retType.TypeSig (sig);
-      for (int i=0; i < numPars; i++) {
-              parList[i].TypeSig (sig);
-      }
-      if (varArgMeth) {
-              sig.WriteByte (0x41); // Write the sentinel
-        for (int i=0; i < numOptPars; i++) {
-          optParList[i].TypeSig (sig);
-        }
-      }
-    }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      MemoryStream sig = new MemoryStream();
-      TypeSig(sig);
-      sigIx = md.AddToBlobHeap(sig.ToArray());
-      done = true;
-    }
-
-                internal sealed override uint Size(MetaData md) {
-                        return md.BlobIndexSize();
-                }
-
-                internal sealed override void Write(FileImage output) {
-                        output.BlobIndex(sigIx);
-                }
-
-                internal sealed override uint GetCodedIx(CIx code) { return 0x1B; }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for THIS module
-        /// </summary>
-  public class Module : ResolutionScope
-        {
-    Guid mvid;
-    uint mvidIx = 0;
-
-                internal Module(string name, MetaData md) : base(name,md)       {
-      mvid = Guid.NewGuid();
-      mvidIx = md.AddToGUIDHeap(mvid);
-      tabIx = MDTable.Module;
-    }
-
-    public Guid Guid {
-      get { return mvid; }
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 2 + md.StringsIndexSize() + 3 * md.GUIDIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write((short)0);
-      output.StringsIndex(nameIx);
-      output.GUIDIndex(mvidIx);
-      output.GUIDIndex(0);
-      output.GUIDIndex(0);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-                        switch (code) {
-                                case (CIx.HasCustomAttr) : return 7; 
-                                case (CIx.ResolutionScope) : return 0;
-                        }
-                        return 0;
-    }
-  }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for another module in THIS assembly
-        /// </summary>
-        public class ModuleRef : ResolutionScope, IExternRef
-        {
-
-                internal ModuleRef(MetaData md, string name) : base(name,md) {
-      tabIx = MDTable.ModuleRef;
-                }
-
-    /// <summary>
-    /// Add a class to this external module.  This is a class declared in
-    /// another module of THIS assembly.
-    /// </summary>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns>a descriptor for this class in another module</returns>
-    public ClassRef AddClass(string nsName, string name) {
-      ClassRef aClass = new ClassRef(nsName,name,metaData);
-      metaData.AddToTable(MDTable.TypeRef,aClass);
-      aClass.SetParent(this);
-      return aClass;
-    }
-
-    /// <summary>
-    /// Make a file descriptor to correspond to this module.  The file
-    /// descriptor will have the same name as the module descriptor
-    /// </summary>
-    /// <param name="hashBytes">the hash of the file</param>
-    /// <param name="hasMetaData">the file contains metadata</param>
-    /// <param name="entryPoint">the program entry point is in this file</param>
-    /// <returns>a descriptor for the file which contains this module</returns>
-    public FileRef MakeFile(byte[] hashBytes, bool hasMetaData, bool entryPoint) {
-      FileRef file = new FileRef(nameIx,hashBytes,hasMetaData,entryPoint,metaData);
-      metaData.AddToTable(MDTable.File,file);
-      return file;
-    }
-
-    /// <summary>
-    /// Add a value class to this module.  This is a class declared in
-    /// another module of THIS assembly.
-    /// </summary>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns></returns>
-    public ClassRef AddValueClass(string nsName, string name) {
-      ClassRef aClass = new ClassRef(nsName,name,metaData);
-      metaData.AddToTable(MDTable.TypeRef,aClass);
-      aClass.SetParent(this);
-      aClass.MakeValueClass(ValueClass.ValueType);
-      return aClass;
-    }
-
-    /// <summary>
-    /// Add a class which is declared public in this external module of
-    /// THIS assembly.  This class will be exported from this assembly.
-    /// The ilasm syntax for this is .extern class
-    /// </summary>
-    /// <param name="attrSet">attributes of the class to be exported</param>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">external class name</param>
-    /// <param name="declFile">the file where the class is declared</param>
-    /// <param name="isValueClass">is this class a value type?</param>
-    /// <returns>a descriptor for this external class</returns>
-    public ExternClassRef AddExternClass(TypeAttr attrSet, string nsName, 
-                                         string name, FileRef declFile, 
-                                         bool isValueClass) {
-      ExternClassRef cRef = new ExternClassRef(attrSet,nsName,name,declFile,metaData);
-      metaData.AddToTable(MDTable.TypeRef,cRef);
-      cRef.SetParent(this);
-      if (isValueClass) cRef.MakeValueClass(ValueClass.ValueType);
-      return cRef;
-    }
-
-    /// <summary>
-    /// Add a "global" method in another module
-    /// </summary>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">method parameter types</param>
-    /// <returns>a descriptor for this method in anther module</returns>
-    public MethodRef AddMethod(string name, Type retType, Type[] pars) {
-      MethodRef meth = new MethodRef(this,name,retType,pars,false,null);
-      metaData.AddToTable(MDTable.MemberRef,meth);
-      return meth;
-    }
-
-    /// <summary>
-    /// Add a vararg method to this class
-    /// </summary>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">parameter types</param>
-    /// <param name="optPars">optional param types for this vararg method</param>
-    /// <returns>a descriptor for this method</returns>
-    public MethodRef AddVarArgMethod(string name, Type retType, 
-      Type[] pars, Type[] optPars) {
-      MethodRef meth = new MethodRef(this,name,retType,pars,true,optPars);
-      metaData.AddToTable(MDTable.MemberRef,meth);
-      return meth;
-    }
-
-    /// <summary>
-    /// Add a field in another module
-    /// </summary>
-    /// <param name="name">field name</param>
-    /// <param name="fType">field type</param>
-    /// <returns>a descriptor for this field in another module</returns>
-    public FieldRef AddField(string name, Type fType) {
-      FieldRef field = new FieldRef(this,name,fType);
-      metaData.AddToTable(MDTable.MemberRef,field);
-      return field;
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return md.StringsIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.StringsIndex(nameIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasCustomAttr) : return 12; 
-        case (CIx.MemberRefParent) : return 2; 
-        case (CIx.ResolutionScope) : return 1; 
-      }
-                        return 0;
-    }
-  }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptors for native types used for marshalling
-        /// </summary>
-  public class NativeType {
-    public static readonly NativeType Void = new NativeType(0x01);
-    public static readonly NativeType Boolean = new NativeType(0x02);
-    public static readonly NativeType Int8 = new NativeType(0x03);
-    public static readonly NativeType UInt8 = new NativeType(0x04);
-    public static readonly NativeType Int16 = new NativeType(0x05);
-    public static readonly NativeType UInt16 = new NativeType(0x06);
-    public static readonly NativeType Int32 = new NativeType(0x07);
-    public static readonly NativeType UInt32 = new NativeType(0x08);
-    public static readonly NativeType Int64 = new NativeType(0x09);
-    public static readonly NativeType UInt64 = new NativeType(0x0A);
-    public static readonly NativeType Float32 = new NativeType(0x0B);
-    public static readonly NativeType Float64 = new NativeType(0x0C);
-    public static readonly NativeType Currency = new NativeType(0x0F);
-    public static readonly NativeType BStr = new NativeType(0x13);
-    public static readonly NativeType LPStr = new NativeType(0x14);
-    public static readonly NativeType LPWStr = new NativeType(0x15);
-    public static readonly NativeType LPTStr = new NativeType(0x16);
-    public static readonly NativeType FixedSysString = new NativeType(0x17);
-    public static readonly NativeType IUnknown = new NativeType(0x19);
-    public static readonly NativeType IDispatch = new NativeType(0x1A);
-    public static readonly NativeType Struct = new NativeType(0x1B);
-    public static readonly NativeType Interface = new NativeType(0x1C);
-    public static readonly NativeType Int = new NativeType(0x1F);
-    public static readonly NativeType UInt = new NativeType(0x20);
-    public static readonly NativeType ByValStr = new NativeType(0x22);
-    public static readonly NativeType AnsiBStr = new NativeType(0x23);
-    public static readonly NativeType TBstr = new NativeType(0x24);
-    public static readonly NativeType VariantBool = new NativeType(0x25);
-    public static readonly NativeType FuncPtr = new NativeType(0x26);
-    public static readonly NativeType AsAny = new NativeType(0x28);
-
-    protected byte typeIndex;
-
-    internal NativeType(byte tyIx) { typeIndex = tyIx; }
-    internal byte GetTypeIndex() { return typeIndex; }
-
-    internal virtual byte[] ToBlob() {
-      byte[] bytes = new byte[1];
-      bytes[0] = GetTypeIndex();
-      return bytes;
-    }
-
-   }
-
-  public class FixedSysString : NativeType 
-  {
-    uint size;
-
-    public FixedSysString (uint size) : base (NativeType.FixedSysString.GetTypeIndex ())
-    {
-       this.size = size;
-    }
-
-    internal override byte [] ToBlob () 
-    {
-       MemoryStream str = new MemoryStream ();
-       str.WriteByte (GetTypeIndex ());
-       MetaData.CompressNum (size, str);
-       return str.ToArray ();  
-    }
-
-  }  
-
-  public class NativeArray : NativeType 
-  {
-    NativeType elemType;
-    int numElem = -1, parNum = -1, elemMult = -1;
-
-    
-    public NativeArray(NativeType elemType) : this (elemType, -1, -1, -1) {
-      this.elemType = elemType;
-    }
-
-/*    public NativeArray(NativeType elemType, int len) : base(0x2A) {
-      this.elemType = elemType;
-      this.len = len;
-    }
-*/
-    public NativeArray(NativeType elemType, int numElem, int parNumForLen, int elemMult) : base(0x2A) {
-      this.elemType = elemType;
-      this.numElem = numElem;
-      parNum = parNumForLen;
-      this.elemMult = elemMult;
-    }
-
-    public NativeArray(NativeType elemType, int numElem, int parNumForLen) 
-       : this (elemType, numElem, parNumForLen, -1) {
-    }
-
-    internal override byte[] ToBlob() {
-      MemoryStream str = new MemoryStream();
-      str.WriteByte(GetTypeIndex());
-      if (elemType == null) str.WriteByte(0x50);  // no info (MAX)
-      else str.WriteByte(elemType.GetTypeIndex());
-
-      /* see : mono/metadata/metadata.c:mono_metadata_parse_marshal_spec
-       * LAMESPEC: Older spec versions say elemMult comes before
-       * len. Newer spec versions don't talk about elemMult at
-       * all, but csc still emits it, and it is used to distinguish
-       * between parNum being 0, and parNum being omitted.
-       */      
-
-      if (parNum == -1)
-        // <native_type> []
-        return str.ToArray ();
-
-      MetaData.CompressNum((uint) parNum,str);
-      if (numElem != -1) {
-       MetaData.CompressNum ((uint) numElem, str);
-       if (elemMult != -1)
-              // <native_type> [ int32 ]
-             MetaData.CompressNum((uint) elemMult,str);
-        //else <native_type> [ int32 + int32 ]
-      }        else if (elemMult != -1) {
-              // When can this occur ?
-             MetaData.CompressNum (0, str);
-             MetaData.CompressNum((uint) elemMult,str);
-      }
-      //else <native_type> [ + int32 ]
-
-      return str.ToArray();
-    }
-
-  }
-
-  public class SafeArray : NativeType 
-  {
-    SafeArrayType elemType;
-    bool hasElemType;
-
-    public SafeArray() : base(0x1D) {
-    }
-
-    public SafeArray(SafeArrayType elemType) : base(0x1D) {
-      this.elemType = elemType;
-      hasElemType = true;
-    }
-
-    internal override byte[] ToBlob() {
-      byte[] bytes = new byte[hasElemType ? 2 : 1];
-      bytes[0] = GetTypeIndex();
-      if (hasElemType)
-        bytes[1] = (byte)elemType;
-      return bytes;
-    }
-
-  }
-
-  public class FixedArray : NativeType 
-  {
-    NativeType elemType;
-    uint numElem;
-
-    //public FixedArray(NativeType elemType, int numElems) : base(0x1E) {
-    public FixedArray(int numElems) : base(0x1E) {
-      //this.elemType = elemType;
-      numElem = (uint)numElems;
-    }
-
-    internal override byte[] ToBlob() {
-      MemoryStream str = new MemoryStream();
-      str.WriteByte(GetTypeIndex());
-      MetaData.CompressNum(numElem,str);
-      /* FIXME: 
-        fixed array [5] lpstr [2]
-       This format is not supported by ilasm 1.1.4322.2032, 
-       but is supported by 2.0.5125..
-       ilasm 1.1 only supports "fixed array [5]" 
-      if (elemType == null) str.WriteByte(0x50);  // no info (MAX)
-      else str.WriteByte(elemType.GetTypeIndex());*/
-
-      return str.ToArray();
-    }
-
-  }
-
-  public class CustomMarshaller : NativeType 
-  {
-    string typeName;
-    string marshallerName;
-    string cookie;
-
-    public CustomMarshaller(string typeNameOrGUID, string marshallerName, 
-                string optCookie) : base(0x2C) {
-      typeName = typeNameOrGUID;
-      this.marshallerName = marshallerName;
-      cookie = optCookie;
-    }
-    
-    public CustomMarshaller(string marshallerName, string optCookie)
-      :this (null, marshallerName, optCookie) {
-    }
-
-    internal override byte[] ToBlob() {
-      MemoryStream str = new MemoryStream();
-      BinaryWriter bw = new BinaryWriter(str,new UTF8Encoding());
-      bw.Write(GetTypeIndex());
-      //Native type name & unmanaged type - unused
-      //See mono/metadata/metadata.c : mono_metadata_parse_marshal_spec
-      bw.Write ((byte) 0); // Native Type name, unused 
-      bw.Write ((byte) 0); // Unmanaged type, unused 
-      if (marshallerName != null) {
-        MetaData.CompressNum ((uint)marshallerName.Length, str);
-        bw.Write(marshallerName.ToCharArray());
-      } else { 
-        bw.Write ((byte) 0);
-      }
-      if (cookie != null) {
-        MetaData.CompressNum ((uint)cookie.Length, str);
-        bw.Write(cookie.ToCharArray());
-      }        else {
-        bw.Write ((byte) 0);
-      }        
-      bw.Flush();
-      return str.ToArray();
-    }
-  }
-
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a parameter of a method defined in this assembly/module
-        /// </summary>
-  public class Param : MetaDataElement
-        {
-
-    Type pType;
-    string pName;
-    internal ushort seqNo = 0;
-    ushort parMode;
-    ConstantElem defaultVal;
-    uint nameIx = 0;
-    FieldMarshal marshalInfo;
-
-    /// <summary>
-    /// Create a new parameter for a method
-    /// </summary>
-    /// <param name="mode">param mode (in, out, opt)</param>
-    /// <param name="parName">parameter name</param>
-    /// <param name="parType">parameter type</param>
-    public Param(ParamAttr mode, string parName, Type parType) {
-      pName = parName;
-      pType = parType;
-      parMode = (ushort)mode;
-                        tabIx = MDTable.Param;
-                }
-
-    /// <summary>
-    /// Add a default value to this parameter
-    /// </summary>
-    /// <param name="c">the default value for the parameter</param>
-    public void AddDefaultValue(Constant cVal) {
-      defaultVal = new ConstantElem(this,cVal);
-      parMode |= (ushort) ParamAttr.HasDefault;
-    }
-
-    /// <summary>
-    /// Add marshalling information about this parameter
-    /// </summary>
-    public void AddMarshallInfo(NativeType marshallType) {
-      parMode |= (ushort) ParamAttr.HasFieldMarshal;
-      marshalInfo = new FieldMarshal(this,marshallType);
-    }
-
-    internal Type GetParType() { return pType; }
-
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      nameIx = md.AddToStringsHeap(pName);
-      if (defaultVal != null) {
-        md.AddToTable(MDTable.Constant,defaultVal);
-        defaultVal.BuildTables(md);
-      }
-      if (marshalInfo != null) {
-        md.AddToTable(MDTable.FieldMarshal,marshalInfo);
-        marshalInfo.BuildTables(md);
-      }
-      done = true;
-    }
-
-    internal void TypeSig(MemoryStream str) {
-      pType.TypeSig(str);
-    }
-
-    internal sealed override uint Size(MetaData md) {
-      return 4 + md.StringsIndexSize();
-    }
-
-    internal sealed override void Write(FileImage output) {
-      output.Write(parMode);
-      output.Write(seqNo);
-      output.StringsIndex(nameIx);
-    }
-
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.HasCustomAttr) : return 4; 
-        case (CIx.HasConst) : return 1; 
-        case (CIx.HasFieldMarshal) : return 1; 
-      }
-                        return 0;
-    }
-
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for the PEFile (starting point)
-        /// </summary>
-  public class PEFile
-        {
-    private static readonly string mscorlibName = "mscorlib";
-    private Module thisMod;
-    private ClassDef moduleClass;
-    private ArrayList classRefList = new ArrayList();
-    private ArrayList classDefList = new ArrayList();
-    private ArrayList resources = new ArrayList ();
-    private Assembly thisAssembly;
-    private static bool isMSCorlib;
-    private int corFlags = 1;
-    FileImage fileImage;
-                MetaData metaData;
-
-    /// <summary>
-    /// Create a new PEFile.  Each PEFile is a module.
-    /// </summary>
-    /// <param name="name">module name, also used for the file name</param>
-    /// <param name="isDLL">create a .dll or .exe file</param>
-    /// <param name="hasAssembly">this file is an assembly and 
-    /// will contain the assembly manifest.  The assembly name is the 
-    /// same as the module name</param>
-    public PEFile(string name, bool isDLL, bool hasAssembly)
-      : this (name, null, isDLL, hasAssembly, null, null) {
-      // Console.WriteLine(Hex.Byte(0x12));
-      // Console.WriteLine(Hex.Short(0x1234));
-      // Console.WriteLine(Hex.Int(0x12345678));
-    }
-
-    /// <summary>
-    /// Create a new PEFile.  Each PEFile is a module.
-    /// </summary>
-    /// <param name="name">module name, also used for the file name</param>
-    /// <param name="isDLL">create a .dll or .exe file</param>
-    /// <param name="hasAssembly">this file is an assembly and 
-    /// will contain the assembly manifest.  The assembly name is the 
-    /// same as the module name</param>
-    /// <param name="outputDir">write the PEFile to this directory.  If this
-    /// string is null then the output will be to the current directory</param>
-    public PEFile(string name, bool isDLL, bool hasAssembly, string outputDir)
-      : this (name, null, isDLL, hasAssembly, outputDir, null) {
-      // Console.WriteLine(Hex.Byte(0x12));
-      // Console.WriteLine(Hex.Short(0x1234));
-      // Console.WriteLine(Hex.Int(0x12345678));
-    }
-
-    /// <summary>
-    /// Create a new PEFile
-    /// </summary>
-    /// <param name="name">module name</param>
-    /// <param name="isDLL">create a .dll or .exe</param>
-    /// <param name="hasAssembly">this PEfile is an assembly and
-    /// will contain the assemly manifest.  The assembly name is the
-    /// same as the module name</param>
-    /// <param name="outStream">write the PEFile to this stream instead
-    /// of to a new file</param>
-    public PEFile(string name, bool isDLL, bool hasAssembly, Stream outStream)
-      : this (name, null, isDLL, hasAssembly, null, outStream) {
-    }
-
-    public PEFile(string name, string module_name, bool isDLL, bool hasAssembly, Stream outStream)
-      : this (name, module_name, isDLL, hasAssembly, null, outStream) {
-    }  
-
-    public PEFile(string name, string module_name, bool isDLL, bool hasAssembly, string outputDir, Stream outStream) {
-      SetName (name);
-      string fname = module_name == null ? MakeFileName (outputDir, name, isDLL) : module_name;
-      if (outStream == null)
-        fileImage = new FileImage (isDLL, fname);
-      else  
-        fileImage = new FileImage (isDLL, outStream);
-
-      InitPEFile (name, fname, hasAssembly);
-    }
-
-    private void SetName (string name)
-    {
-      if (name == "mscorlib")
-        isMSCorlib = true;
-    }
-
-    private void InitPEFile(string name, string fName, bool hasAssembly) {
-      metaData = fileImage.GetMetaData();
-      thisMod = new Module(fName,metaData);
-      if (hasAssembly) {
-        thisAssembly = new Assembly(name,metaData);
-        metaData.AddToTable(MDTable.Assembly,thisAssembly);      
-      }
-      moduleClass = AddClass(TypeAttr.Private,"","<Module>");
-      moduleClass.SpecialNoSuper();
-      metaData.AddToTable(MDTable.Module,thisMod);
-    }
-    internal static bool IsMSCorlib {
-      get { return isMSCorlib; }
-    }
-
-    public ClassDef ModuleClass {
-            get { return moduleClass; }
-    }
-
-    /// <summary>
-    /// Set the subsystem (.subsystem) (Default is Windows Console mode)
-    /// </summary>
-    /// <param name="subS">subsystem value</param>
-    public void SetSubSystem(SubSystem subS) {
-      fileImage.subSys = subS;
-    }
-
-    /// <summary>
-    /// Set the flags (.corflags)
-    /// </summary>
-    /// <param name="flags">the flags value</param>
-    public void SetCorFlags(int flags) {
-      corFlags = flags;
-    }
+namespace PEAPI {
+
+       /**************************************************************************/  
+       /// <summary>
+       /// Image for a PEFile
+       /// File Structure
+       ///     DOS Header (128 bytes) 
+       ///     PE Signature ("PE\0\0") 
+       ///     PEFileHeader (20 bytes)
+       ///     PEOptionalHeader (224 bytes) 
+       ///     SectionHeaders (40 bytes * NumSections)
+       ///
+       ///     Sections .text (always present - contains metadata)
+       ///              .sdata (contains any initialised data in the file - may not be present)
+       ///                     (for ilams /debug this contains the Debug table)
+       ///              .reloc (always present - in pure CIL only has one fixup)
+       ///               others???  c# produces .rsrc section containing a Resource Table
+       ///
+       /// .text layout
+       ///     IAT (single entry 8 bytes for pure CIL)
+       ///     CLIHeader (72 bytes)
+       ///     CIL instructions for all methods (variable size)
+       ///     MetaData 
+       ///       Root (20 bytes + UTF-8 Version String + quad align padding)
+       ///       StreamHeaders (8 bytes + null terminated name string + quad align padding)
+       ///       Streams 
+       ///         #~        (always present - holds metadata tables)
+       ///         #Strings  (always present - holds identifier strings)
+       ///         #US       (Userstring heap)
+       ///         #Blob     (signature blobs)
+       ///         #GUID     (guids for assemblies or Modules)
+       ///    ImportTable (40 bytes)
+       ///    ImportLookupTable(8 bytes) (same as IAT for standard CIL files)
+       ///    Hint/Name Tables with entry "_CorExeMain" for .exe file and "_CorDllMain" for .dll (14 bytes)
+       ///    ASCII string "mscoree.dll" referenced in ImportTable (+ padding = 16 bytes)
+       ///    Entry Point  (0xFF25 followed by 4 bytes 0x400000 + RVA of .text)
+       ///
+       ///  #~ stream structure
+       ///    Header (24 bytes)
+       ///    Rows   (4 bytes * numTables)
+       ///    Tables
+       /// </summary>
+       internal class FileImage : BinaryWriter {
+
+               internal readonly static uint[] iByteMask = {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000};
+               internal readonly static ulong[] lByteMask = {0x00000000000000FF, 0x000000000000FF00,
+                       0x0000000000FF0000, 0x00000000FF000000,
+                       0x000000FF00000000, 0x0000FF0000000000,
+                       0x00FF000000000000, 0xFF00000000000000 };
+               internal readonly static uint nibble0Mask = 0x0000000F;
+               internal readonly static uint nibble1Mask = 0x000000F0;
+
+               private static readonly byte[] DOSHeader = { 0x4d,0x5a,0x90,0x00,0x03,0x00,0x00,0x00,
+                       0x04,0x00,0x00,0x00,0xff,0xff,0x00,0x00,
+                       0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
+                       0x0e,0x1f,0xba,0x0e,0x00,0xb4,0x09,0xcd,
+                       0x21,0xb8,0x01,0x4c,0xcd,0x21,0x54,0x68,
+                       0x69,0x73,0x20,0x70,0x72,0x6f,0x67,0x72,
+                       0x61,0x6d,0x20,0x63,0x61,0x6e,0x6e,0x6f,
+                       0x74,0x20,0x62,0x65,0x20,0x72,0x75,0x6e,
+                       0x20,0x69,0x6e,0x20,0x44,0x4f,0x53,0x20,
+                       0x6d,0x6f,0x64,0x65,0x2e,0x0d,0x0d,0x0a,
+                       0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x50,0x45,0x00,0x00};
+               private static byte[] PEHeader = { 0x4c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0xE0, 0x00, 0x0E, 0x01, // PE Header Standard Fields
+                       0x0B, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+               };
+
+               private static readonly uint minFileAlign = 0x200;
+               private static readonly uint maxFileAlign = 0x1000;
+               private static readonly uint fileHeaderSize = 0x178;
+               private static readonly uint sectionHeaderSize = 40;
+               private static readonly uint SectionAlignment = 0x2000;
+               private static readonly uint ImageBase = 0x400000;
+               private static readonly uint ImportTableSize = 40;
+               private static readonly uint IATSize = 8;
+               private static readonly uint CLIHeaderSize = 72;
+               private uint runtimeFlags = 0x01;  // COMIMAGE_FLAGS_ILONLY
+               // 32BITREQUIRED 0x02, STRONGNAMESIGNED 0x08, TRACKDEBUGDATA 0x10000
+               private static readonly uint StrongNameSignatureSize = 128;
+               private bool reserveStrongNameSignatureSpace = false;
+
+               private static readonly uint relocFlags = 0x42000040;
+               private static readonly ushort exeCharacteristics = 0x010E;
+               private static readonly ushort dllCharacteristics = 0x210E;
+               // section names are all 8 bytes
+               private static readonly string textName = ".text\0\0\0";
+               private static readonly string sdataName = ".sdata\0\0";
+               private static readonly string relocName = ".reloc\0\0";
+               private static readonly string rsrcName = ".rsrc\0\0\0";
+               private static readonly string exeHintNameTable = "\0\0_CorExeMain\0";
+               private static readonly string dllHintNameTable = "\0\0_CorDllMain\0";
+               private static readonly string runtimeEngineName = "mscoree.dll\0\0";
+
+               private Section text, sdata, rsrc;
+               ArrayList data;
+               BinaryWriter reloc = new BinaryWriter(new MemoryStream());
+               uint dateStamp = 0;
+               DateTime origin = new DateTime(1970,1,1);
+               uint numSections = 2; // always have .text  and .reloc sections
+               internal SubSystem subSys = SubSystem.Windows_CUI;  // default is Windows Console mode
+               internal long stackReserve = 0x100000; // default is 1Mb 
+               internal uint fileAlign = minFileAlign;
+               uint entryPointOffset, entryPointPadding, imageSize, headerSize, headerPadding, entryPointToken = 0;
+               uint relocOffset, relocRVA, relocSize, relocPadding, relocTide, hintNameTableOffset;
+               uint metaDataOffset, runtimeEngineOffset, initDataSize = 0, importTablePadding;
+               uint resourcesSize, resourcesOffset;
+               uint strongNameSigOffset;
+               uint importTableOffset, importLookupTableOffset, totalImportTableSize;
+               MetaData metaData;
+               char[] runtimeEngine = runtimeEngineName.ToCharArray(), hintNameTable;
+               bool doDLL, largeStrings, largeGUID, largeUS, largeBlob;
+               ushort characteristics;
+
+               internal FileImage(bool makeDLL, string fileName) : base(new FileStream(fileName,FileMode.Create)) 
+               {
+                       InitFileImage(makeDLL);
+                       TimeSpan tmp = System.IO.File.GetCreationTime(fileName).Subtract(origin);
+                       dateStamp = Convert.ToUInt32(tmp.TotalSeconds);
+               }
 
-    private string MakeFileName(string dirName, string name, bool isDLL) {
-      string result = "";
-      if ((dirName != null) && (dirName.CompareTo("") != 0)) {
-        result = dirName;
-        if (!dirName.EndsWith("\\")) result += "\\";
-      }
-      result += name;
-       
-      // if (isDLL) result += ".dll";  else result += ".exe";
-      
-      return result;
-    }
+               internal FileImage(bool makeDLL, Stream str) : base(str) 
+               {
+                       InitFileImage(makeDLL);
+                       TimeSpan tmp = DateTime.Now.Subtract(origin);
+                       dateStamp = Convert.ToUInt32(tmp.TotalSeconds);
+               }
 
-    /// <summary>
-    /// Add an external assembly to this PEFile (.assembly extern)
-    /// </summary>
-    /// <param name="assemName">the external assembly name</param>
-    /// <returns>a descriptor for this external assembly</returns>
-    public AssemblyRef AddExternAssembly(string assemName) {
-      if (assemName.CompareTo(mscorlibName) == 0) return metaData.mscorlib;
-      AssemblyRef anAssem = new AssemblyRef(metaData,assemName);
-      metaData.AddToTable(MDTable.AssemblyRef,anAssem);
-      // Console.WriteLine("Adding assembly " + assemName);
-      return anAssem;
-    }
+               private void InitFileImage(bool makeDLL) 
+               {
+                       doDLL = makeDLL;
+                       if (doDLL) {
+                               hintNameTable = dllHintNameTable.ToCharArray();
+                               characteristics = dllCharacteristics;
+                       } else {
+                               hintNameTable = exeHintNameTable.ToCharArray();
+                               characteristics = exeCharacteristics;
+                       }
+                       text = new Section(textName,0x60000020);     // IMAGE_SCN_CNT  CODE, EXECUTE, READ
+                       //                      rsrc = new Section(rsrcName,0x40000040);     // IMAGE_SCN_CNT  INITIALIZED_DATA, READ
+                       metaData = new MetaData(this);
+               }
 
-    /// <summary>
-    /// Add an external module to this PEFile (.module extern)
-    /// </summary>
-    /// <param name="name">the external module name</param>
-    /// <returns>a descriptor for this external module</returns>
-    public ModuleRef AddExternModule(string name) {
-      ModuleRef modRef = new ModuleRef(metaData,name);
-      metaData.AddToTable(MDTable.ModuleRef,modRef);
-      return modRef;
-    }
+               internal MetaData GetMetaData() 
+               {
+                       return metaData;
+               }
 
-    /// <summary>
-    /// Add a "global" method to this module
-    /// </summary>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">method parameters</param>
-    /// <returns>a descriptor for this new "global" method</returns>
-    public MethodDef AddMethod(string name, Type retType, Param[] pars) {
-      return moduleClass.AddMethod(name,retType,pars);
-    }
+               private uint GetNextSectStart(uint rva, uint tide) 
+               {
+                       if (tide < SectionAlignment) return rva + SectionAlignment;
+                       return rva + ((tide / SectionAlignment) + 1) * SectionAlignment;
+               }
 
-    /// <summary>
-    /// Add a "global" method to this module
-    /// </summary>
-    /// <param name="mAtts">method attributes</param>
-    /// <param name="iAtts">method implementation attributes</param>
-    /// <param name="name">method name</param>
-    /// <param name="retType">return type</param>
-    /// <param name="pars">method parameters</param>
-    /// <returns>a descriptor for this new "global" method</returns>
-    public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, Type retType, Param[] pars) {
-      return moduleClass.AddMethod(mAtts,iAtts,name,retType,pars);
-    }
+               private void BuildTextSection() 
+               {
+                       // .text layout
+                       //    IAT (single entry 8 bytes for pure CIL)
+                       //    CLIHeader (72 bytes)
+                       //    CIL instructions for all methods (variable size)
+                       //    MetaData 
+                       //    ImportTable (40 bytes)
+                       //    ImportLookupTable(8 bytes) (same as IAT for standard CIL files)
+                       //    Hint/Name Tables with entry "_CorExeMain" for .exe file and "_CorDllMain" for .dll (14 bytes)
+                       //    ASCII string "mscoree.dll" referenced in ImportTable (+ padding = 16 bytes)
+                       //    Entry Point  (0xFF25 followed by 4 bytes 0x400000 + RVA of .text)
+                       metaData.BuildMetaData(IATSize + CLIHeaderSize);
+                       metaDataOffset = IATSize + CLIHeaderSize;
+                       // Console.WriteLine("Code starts at " + metaDataOffset);
+                       metaDataOffset += metaData.CodeSize();
+                       // resourcesStart =
+                       resourcesOffset = metaDataOffset + metaData.Size ();
+                       resourcesSize = metaData.GetResourcesSize ();
+                       if (reserveStrongNameSignatureSpace) {
+                               strongNameSigOffset = resourcesOffset + resourcesSize;
+                               // fixUps = RVA for vtable
+                               importTableOffset = strongNameSigOffset + StrongNameSignatureSize;
+                       } else {
+                               strongNameSigOffset = 0;
+                               // fixUps = RVA for vtable
+                               importTableOffset = resourcesOffset + resourcesSize;
+                       }
+                       importTablePadding = NumToAlign(importTableOffset,16);
+                       importTableOffset += importTablePadding;
+                       importLookupTableOffset = importTableOffset + ImportTableSize;
+                       hintNameTableOffset = importLookupTableOffset + IATSize;
+                       runtimeEngineOffset = hintNameTableOffset + (uint)hintNameTable.Length;
+                       entryPointOffset = runtimeEngineOffset + (uint)runtimeEngine.Length;
+                       totalImportTableSize = entryPointOffset - importTableOffset;
+                       // Console.WriteLine("total import table size = " + totalImportTableSize);
+                       // Console.WriteLine("entrypoint offset = " + entryPointOffset);
+                       entryPointPadding = NumToAlign(entryPointOffset,4) + 2;
+                       entryPointOffset += entryPointPadding;
+                       text.AddReloc(entryPointOffset+2);
+                       text.IncTide(entryPointOffset + 6);
+                       //if (text.Tide() < fileAlign) fileAlign = minFileAlign;
+                       text.SetSize(NumToAlign(text.Tide(),fileAlign));
+                       // Console.WriteLine("text size = " + text.Size() + " text tide = " + text.Tide() + " text padding = " + text.Padding());
+                       // Console.WriteLine("metaDataOffset = " + Hex.Int(metaDataOffset));
+                       // Console.WriteLine("importTableOffset = " + Hex.Int(importTableOffset));
+                       // Console.WriteLine("importLookupTableOffset = " + Hex.Int(importLookupTableOffset));
+                       // Console.WriteLine("hintNameTableOffset = " + Hex.Int(hintNameTableOffset));
+                       // Console.WriteLine("runtimeEngineOffset = " + Hex.Int(runtimeEngineOffset));
+                       // Console.WriteLine("entryPointOffset = " + Hex.Int(entryPointOffset));
+                       // Console.WriteLine("entryPointPadding = " + Hex.Int(entryPointPadding));
 
-    public MethodRef AddMethodToTypeSpec (Type item, string name, Type retType, Type[] pars) {
-            MethodRef meth = new MethodRef (item.GetTypeSpec (metaData), name, retType, pars, false, null);
-            metaData.AddToTable (MDTable.MemberRef,meth);
-            return meth;
-    }
+               }
 
-    public MethodRef AddVarArgMethodToTypeSpec (Type item, string name, Type retType,
-                    Type[] pars, Type[] optPars) {
-            MethodRef meth = new MethodRef(item.GetTypeSpec (metaData), name,retType,pars,true,optPars);
-            metaData.AddToTable(MDTable.MemberRef,meth);
-            return meth;
-    }
+               internal void BuildRelocSection() 
+               {
+                       text.DoRelocs(reloc);
+                       if (sdata != null) sdata.DoRelocs(reloc);
+                       if (rsrc != null) rsrc.DoRelocs(reloc);
+                       relocTide = (uint)reloc.Seek(0,SeekOrigin.Current);
+                       relocPadding = NumToAlign(relocTide,fileAlign);
+                       relocSize = relocTide + relocPadding;
+                       imageSize = relocRVA + SectionAlignment;
+                       initDataSize += relocSize;
+               }
 
-    public FieldRef AddFieldToTypeSpec (Type item, string name, Type fType) {
-            FieldRef field = new FieldRef (item.GetTypeSpec (metaData), name,fType);
-            metaData.AddToTable (MDTable.MemberRef,field);
-            return field;
-    }
+               private void CalcOffsets() 
+               {
+                       if (sdata != null)
+                               numSections++;
+                       if (rsrc != null)
+                               numSections++;
+                       headerSize = fileHeaderSize + (numSections * sectionHeaderSize);
+                       headerPadding = NumToAlign(headerSize,fileAlign);
+                       headerSize += headerPadding;
+                       uint offset = headerSize;
+                       uint rva = SectionAlignment;
+                       text.SetOffset(offset);
+                       text.SetRVA(rva);
+                       offset += text.Size();
+                       rva  = GetNextSectStart(rva,text.Tide());
+                       // Console.WriteLine("headerSize = " + headerSize);
+                       // Console.WriteLine("headerPadding = " + headerPadding);
+                       // Console.WriteLine("textOffset = " + Hex.Int(text.Offset()));
+                       if (sdata != null) { 
+                               sdata.SetSize(NumToAlign(sdata.Tide(),fileAlign));
+                               sdata.SetOffset(offset);
+                               sdata.SetRVA(rva);
+                               offset += sdata.Size();
+                               rva = GetNextSectStart(rva,sdata.Tide());
+                               initDataSize += sdata.Size();
+                       }
+                       if (rsrc != null) { 
+                               rsrc.SetSize(NumToAlign(rsrc.Tide(),fileAlign));
+                               rsrc.SetOffset(offset);
+                               rsrc.SetRVA(rva);
+                               offset += rsrc.Size();
+                               rva = GetNextSectStart(rva,rsrc.Tide());
+                               initDataSize += rsrc.Size();
+                       }
+                       relocOffset = offset;
+                       relocRVA = rva;
+               }
 
-    public void AddMethodSpec (Method m, GenericMethodSig g_sig)
-    {
-            MethodSpec ms = new MethodSpec (m, g_sig);
-            metaData.AddToTable (MDTable.MethodSpec, ms);
-    }
+               internal void MakeFile() 
+               {
+                       if (doDLL) hintNameTable = dllHintNameTable.ToCharArray();
+                       else hintNameTable = exeHintNameTable.ToCharArray();
+                       BuildTextSection();
+                       CalcOffsets();
+                       BuildRelocSection();
+                       // now write it out
+                       WriteHeader();
+                       WriteSections();
+                       Flush();
+                       Close();
+               }
 
-    /// <summary>
-    /// Add a "global" field to this module
-    /// </summary>
-    /// <param name="name">field name</param>
-    /// <param name="fType">field type</param>
-    /// <returns>a descriptor for this new "global" field</returns>
-    public FieldDef AddField(string name, Type fType) {
-      return moduleClass.AddField(name,fType);
-    }
+               private void WriteHeader() 
+               {
+                       Write(DOSHeader);
+                       // Console.WriteLine("Writing PEHeader at offset " + Seek(0,SeekOrigin.Current));
+                       WritePEHeader();
+                       // Console.WriteLine("Writing text section header at offset " + Hex.Long(Seek(0,SeekOrigin.Current)));
+                       text.WriteHeader(this,relocRVA);
+                       if (sdata != null) sdata.WriteHeader(this,relocRVA);
+                       if (rsrc != null) rsrc.WriteHeader(this,relocRVA);
+                       // Console.WriteLine("Writing reloc section header at offset " + Seek(0,SeekOrigin.Current));
+                       WriteRelocSectionHeader();
+                       // Console.WriteLine("Writing padding at offset " + Seek(0,SeekOrigin.Current));
+                       WriteZeros(headerPadding);
+               }
 
-    /// <summary>
-    /// Add a "global" field to this module
-    /// </summary>
-    /// <param name="attrSet">attributes of this field</param>
-    /// <param name="name">field name</param>
-    /// <param name="fType">field type</param>
-    /// <returns>a descriptor for this new "global" field</returns>
-    public FieldDef AddField(FieldAttr attrSet, string name, Type fType) {
-      return moduleClass.AddField(attrSet,name,fType);
-    }
+               private void WriteSections() 
+               {
+                       // Console.WriteLine("Writing text section at offset " + Seek(0,SeekOrigin.Current));
+                       WriteTextSection();
+                       if (sdata != null) WriteSDataSection();
+                       if (rsrc != null) WriteRsrcSection();
+                       WriteRelocSection();
+               }
 
-    /// <summary>
-    /// Add a class to this module
-    /// </summary>
-    /// <param name="attrSet">attributes of this class</param>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns>a descriptor for this new class</returns>
-    public ClassDef AddClass(TypeAttr attrSet, string nsName, string name) {
-      return AddClass (attrSet, nsName, name, null);
-    }
+               private void WriteIAT() 
+               {
+                       Write(text.RVA() + hintNameTableOffset);
+                       Write(0);
+               }
 
-    /// <summary>
-    /// Add a class which extends System.ValueType to this module
-    /// </summary>
-    /// <param name="attrSet">attributes of this class</param>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <returns>a descriptor for this new class</returns>
-    public ClassDef AddValueClass(TypeAttr attrSet, string nsName, string name, ValueClass vClass) {
-      ClassDef aClass = new ClassDef(attrSet,nsName,name,metaData);
-      if (!ClassDef.IsValueType (nsName, name) && !ClassDef.IsEnum (nsName, name)) {
-        aClass.MakeValueClass(vClass);
-      } else {
-        if (ClassDef.IsEnum (nsName, name))
-               aClass.SetSuper (metaData.mscorlib.ValueType ());
-        else
-               aClass.SetSuper (metaData.mscorlib.GetSpecialSystemClass (PrimitiveType.Object));
+               private void WriteImportTables() 
+               {
+                       // Import Table
+                       WriteZeros(importTablePadding);
+                       // Console.WriteLine("Writing import tables at offset " + Hex.Long(Seek(0,SeekOrigin.Current)));
+                       Write(importLookupTableOffset + text.RVA());
+                       WriteZeros(8); 
+                       Write(runtimeEngineOffset + text.RVA());
+                       Write(text.RVA());    // IAT is at the beginning of the text section
+                       WriteZeros(20);
+                       // Import Lookup Table
+                       WriteIAT();                // lookup table and IAT are the same
+                       // Hint/Name Table
+                       // Console.WriteLine("Writing hintname table at " + Hex.Long(Seek(0,SeekOrigin.Current)));
+                       Write(hintNameTable);
+                       Write(runtimeEngineName.ToCharArray());
+               }
 
-        metaData.mscorlib.SetSpecialSystemClass (nsName, name, aClass);
-      }
-      aClass.SetTypeIndex (PrimitiveType.ValueType.GetTypeIndex ());
-      metaData.AddToTable(MDTable.TypeDef,aClass);
-      return aClass;
-    }
+               private void WriteTextSection() 
+               {
+                       WriteIAT();
+                       WriteCLIHeader();
+                       // Console.WriteLine("Writing code at " + Hex.Long(Seek(0,SeekOrigin.Current)));
+                       metaData.WriteByteCodes(this);
+                       // Console.WriteLine("Finished writing code at " + Hex.Long(Seek(0,SeekOrigin.Current)));
+                       largeStrings = metaData.LargeStringsIndex();
+                       largeGUID = metaData.LargeGUIDIndex();
+                       largeUS = metaData.LargeUSIndex();
+                       largeBlob = metaData.LargeBlobIndex();
+                       metaData.WriteMetaData(this);
+                       metaData.WriteResources (this);
+                       if (reserveStrongNameSignatureSpace) {
+                               WriteZeros(StrongNameSignatureSize);
+                       }
+                       WriteImportTables();
+                       WriteZeros(entryPointPadding);
+                       Write((ushort)0x25FF);
+                       Write(ImageBase + text.RVA());
+                       WriteZeros(text.Padding());
+               }
 
-    /// <summary>
-    /// Add a class to this module
-    /// </summary>
-    /// <param name="attrSet">attributes of this class</param>
-    /// <param name="nsName">name space name</param>
-    /// <param name="name">class name</param>
-    /// <param name="superType">super type of this class (extends)</param>
-    /// <returns>a descriptor for this new class</returns>
-    public ClassDef AddClass(TypeAttr attrSet, string nsName, string name, Class superType) {
-      ClassDef aClass = new ClassDef(attrSet,nsName,name,metaData);
-      if (superType != null)
-        aClass.SetSuper(superType);
-      if (PEFile.IsMSCorlib)
-        metaData.mscorlib.SetSpecialSystemClass (nsName, name, aClass);
-      metaData.AddToTable(MDTable.TypeDef,aClass);
-      return aClass;
-    }
+               private void WriteCLIHeader() 
+               {
+                       Write(CLIHeaderSize);       // Cb
+                       Write((short)2);            // Major runtime version
+                       Write((short)0);            // Minor runtime version
+                       Write(text.RVA() + metaDataOffset);
+                       Write(metaData.Size());
+                       Write(runtimeFlags);
+                       Write(entryPointToken);
+                       if (resourcesSize > 0) {
+                               Write (text.RVA () + resourcesOffset);
+                               Write (resourcesSize);
+                       } else {
+                               WriteZeros (8);
+                       }
+                       // Strong Name Signature (RVA, size)
+                       if (reserveStrongNameSignatureSpace) {
+                               Write(text.RVA() + strongNameSigOffset); 
+                               Write(StrongNameSignatureSize);
+                       } else {
+                               WriteZeros(8);
+                       }
+                       WriteZeros(8);                     // CodeManagerTable
+                       WriteZeros(8);                     // VTableFixups NYI
+                       WriteZeros(16);                    // ExportAddressTableJumps, ManagedNativeHeader
+               }
 
-    public FileRef AddFile(string fName, byte[] hashBytes, bool hasMetaData, bool entryPoint) {
-      FileRef file = new FileRef(fName,hashBytes,hasMetaData,entryPoint,metaData);
-      metaData.AddToTable(MDTable.File,file);
-      return file;
-    }
+               private void WriteSDataSection() 
+               {
+                       long size = sdata.Size ();
+                       long start = BaseStream.Position;
+                       for (int i=0; i < data.Count; i++) {
+                               ((DataConstant)data[i]).Write(this);
+                       }
+                       while (BaseStream.Position < (start + size))
+                               Write ((byte) 0);
+               }
 
-    /// <summary>
-    /// Add a manifest resource to this PEFile NOT YET IMPLEMENTED
-    /// </summary>
-    /// <param name="mr"></param>
-    public void AddManifestResource(ManifestResource mr) {
-      metaData.AddToTable(MDTable.ManifestResource,mr);
-      resources.Add (mr);
-      //mr.FixName(metaData);
-    }
+               private void WriteRsrcSection() 
+               {
+               }
 
-    public void AddCustomAttribute (Method meth, byte [] data, MetaDataElement element)
-    {
-            metaData.AddCustomAttribute (new CustomAttribute (element, meth, data));
-    }
-    
-    public void AddDeclSecurity (SecurityAction sec_action, byte [] data, MetaDataElement element)
-    {
-            metaData.AddDeclSecurity (new DeclSecurity (element, (ushort) sec_action, data));
-    }
+               private void WriteRelocSection() 
+               {
+                       // Console.WriteLine("Writing reloc section at " + Seek(0,SeekOrigin.Current) + " = " + relocOffset);
+                       MemoryStream str = (MemoryStream)reloc.BaseStream;
+                       Write(str.ToArray());
+                       WriteZeros(NumToAlign((uint)str.Position,fileAlign));
+               }
 
-    /// <summary>
-    /// Add a managed resource from another assembly.
-    /// </summary>
-    /// <param name="resName">The name of the resource</param>
-    /// <param name="assem">The assembly where the resource is</param>
-    /// <param name="isPublic">Access for the resource</param>
-    public void AddExternalManagedResource (string resName, AssemblyRef assem, uint flags) {
-      resources.Add (new ManifestResource (resName, flags, assem));
-    }
+               internal void SetEntryPoint(uint entryPoint) 
+               {
+                       entryPointToken = entryPoint;
+               }
 
-    /// <summary>
-    /// Add a managed resource from another assembly.
-    /// </summary>
-    /// <param name="mr"></param>
-    /// <param name="isPublic"></param>
-    public void AddExternalManagedResource (ManifestResource mr) {
-      resources.Add (new ManifestResource (mr));
-    }
-    /// <summary>
-    /// Find a resource
-    /// </summary>
-    /// <param name="name">The name of the resource</param>
-    /// <returns>The resource with the name "name" or null </returns>
-    public ManifestResource GetResource (string name) {
-      for (int i = 0; i < resources.Count; i ++) {
-        if (((ManifestResource) resources [i]).Name == name)
-          return (ManifestResource) resources [i];
-      }
-      return null;
-    }
+               internal void AddInitData(DataConstant cVal) 
+               {
+                       if (sdata == null) {                    
+                               sdata = new Section(sdataName,0xC0000040);   // IMAGE_SCN_CNT  INITIALIZED_DATA, READ, WRITE
+                               data = new ArrayList(); 
+                       }
+                       data.Add(cVal);
+                       cVal.DataOffset = sdata.Tide();
+                       sdata.IncTide(cVal.GetSize());
+               }
 
-    public ManifestResource [] GetResources() {
-      return (ManifestResource []) resources.ToArray (typeof (ManifestResource));
-    }
+               internal void WriteZeros(uint numZeros) 
+               {
+                       for (int i=0; i < numZeros; i++) {
+                               Write((byte)0);
+                       }
+               }
 
-    /// <summary>
-    /// Write out the PEFile (the "bake" function)
-    /// </summary>
-    public void WritePEFile() { /* the "bake" function */
-      fileImage.ReserveStrongNameSignatureSpace = thisAssembly.HasPublicKey;
-      fileImage.MakeFile();
-    }
+               internal void WritePEHeader() 
+               {
+                       Write((ushort)0x014C);  // Machine - always 0x14C for Managed PE Files (allow others??)
+                       Write((ushort)numSections);
+                       Write(dateStamp);
+                       WriteZeros(8); // Pointer to Symbol Table and Number of Symbols (always zero for ECMA CLI files)
+                       Write((ushort)0x00E0);  // Size of Optional Header
+                       Write(characteristics);
+                       // PE Optional Header
+                       Write((ushort)0x010B);   // Magic
+                       Write((byte)0x6);        // LMajor pure-IL = 6   C++ = 7
+                       Write((byte)0x0);        // LMinor
+                       Write(text.Size());
+                       Write(initDataSize);
+                       Write(0);                // Check other sections here!!
+                       Write(text.RVA() + entryPointOffset);
+                       Write(text.RVA());
+                       uint dataBase = 0;
+                       if (sdata != null) dataBase = sdata.RVA();
+                       else if (rsrc != null) dataBase = rsrc.RVA();
+                       else dataBase = relocRVA;
+                       Write(dataBase);
+                       Write(ImageBase);
+                       Write(SectionAlignment);
+                       Write(fileAlign);
+                       Write((ushort)0x04);     // OS Major
+                       WriteZeros(6);                  // OS Minor, User Major, User Minor
+                       Write((ushort)0x04);     // SubSys Major
+                       WriteZeros(6);           // SybSys Minor, Reserved
+                       Write(imageSize);
+                       Write(headerSize);
+                       Write((int)0);           // File Checksum
+                       Write((ushort)subSys);
+                       Write((short)0);         // DLL Flags
+                       Write((uint)stackReserve);   // Stack Reserve Size
+                       Write((uint)0x1000);     // Stack Commit Size
+                       Write((uint)0x100000);   // Heap Reserve Size
+                       Write((uint)0x1000);     // Heap Commit Size
+                       Write(0);                // Loader Flags
+                       Write(0x10);             // Number of Data Directories
+                       WriteZeros(8);                  // Export Table
+                       Write(importTableOffset + text.RVA());
+                       Write(totalImportTableSize);
+                       WriteZeros(24);            // Resource, Exception and Certificate Tables
+                       Write(relocRVA);
+                       Write(relocTide);
+                       WriteZeros(48);            // Debug, Copyright, Global Ptr, TLS, Load Config and Bound Import Tables
+                       Write(text.RVA());         // IATRVA - IAT is at start of .text Section
+                       Write(IATSize);
+                       WriteZeros(8);             // Delay Import Descriptor
+                       Write(text.RVA()+IATSize); // CLIHeader immediately follows IAT
+                       Write(CLIHeaderSize);    
+                       WriteZeros(8);             // Reserved
+               }
 
-    /// <summary>
-    /// Get the descriptor of this module
-    /// </summary>
-    /// <returns>the descriptor for this module</returns>
-    public Module GetThisModule() {
-      return thisMod;
-    }
+               internal void WriteRelocSectionHeader() 
+               {
+                       Write(relocName.ToCharArray());
+                       Write(relocTide);
+                       Write(relocRVA);
+                       Write(relocSize);
+                       Write(relocOffset);
+                       WriteZeros(12);
+                       Write(relocFlags);
+               }
 
-    /// <summary>
-    /// Get the descriptor for this assembly.  The PEFile must have been
-    /// created with hasAssembly = true
-    /// </summary>
-    /// <returns>the descriptor for this assembly</returns>
-    public Assembly GetThisAssembly() {
-      return thisAssembly;
-    }
+               private void Align (MemoryStream str, int val) 
+               {
+                       if ((str.Position % val) != 0) {
+                               for (int i=val - (int)(str.Position % val); i > 0; i--) {
+                                       str.WriteByte(0);
+                               }
+                       }
+               }
 
-        }
+               private uint Align(uint val, uint alignVal) 
+               {
+                       if ((val % alignVal) != 0) {
+                               val += alignVal - (val % alignVal);
+                       }
+                       return val;
+               }
 
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for the Primitive types defined in IL
-        /// </summary>
-  public class PrimitiveType : Type
-        {
-    private string name;
-    private int systemTypeIndex;
-    public static int NumSystemTypes = 18;
+               private uint NumToAlign(uint val, uint alignVal) 
+               {
+                       if ((val % alignVal) == 0) return 0;
+                       return alignVal - (val % alignVal);
+               }
 
-    public static readonly PrimitiveType Void = new PrimitiveType(0x01,"Void",0);
-    public static readonly PrimitiveType Boolean = new PrimitiveType(0x02,"Boolean",1);
-    public static readonly PrimitiveType Char = new PrimitiveType(0x03,"Char",2);
-    public static readonly PrimitiveType Int8 = new PrimitiveType(0x04,"SByte",3);
-    public static readonly PrimitiveType UInt8 = new PrimitiveType(0x05,"Byte",4);
-    public static readonly PrimitiveType Int16 = new PrimitiveType(0x06,"Int16",5);
-    public static readonly PrimitiveType UInt16 = new PrimitiveType(0x07,"UInt16",6);
-    public static readonly PrimitiveType Int32 = new PrimitiveType(0x08,"Int32",7);
-    public static readonly PrimitiveType UInt32 = new PrimitiveType(0x09,"UInt32",8);
-    public static readonly PrimitiveType Int64 = new PrimitiveType(0x0A,"Int64",9);
-    public static readonly PrimitiveType UInt64 = new PrimitiveType(0x0B,"UInt64",10);
-    public static readonly PrimitiveType Float32 = new PrimitiveType(0x0C,"Single",11);
-    public static readonly PrimitiveType Float64 = new PrimitiveType(0x0D,"Double",12);
-    public static readonly PrimitiveType String = new PrimitiveType(0x0E,"String",13);
-                internal static readonly PrimitiveType Class = new PrimitiveType(0x12);
-    public static readonly PrimitiveType TypedRef = new PrimitiveType(0x16,"TypedReference",14);
-    public static readonly PrimitiveType IntPtr = new PrimitiveType(0x18,"IntPtr",15);
-    public static readonly PrimitiveType UIntPtr = new PrimitiveType(0x19,"UIntPtr",16);
-    public static readonly PrimitiveType Object = new PrimitiveType(0x1C,"Object",17);
-    internal static readonly PrimitiveType ClassType = new PrimitiveType(0x50);
-    internal static readonly PrimitiveType SZArray = new PrimitiveType(0x1D);
-    internal static readonly PrimitiveType ValueType = new PrimitiveType(0x11, "ValueType", 18);
-    public static readonly PrimitiveType NativeInt = IntPtr;
-    public static readonly PrimitiveType NativeUInt = UIntPtr;
+               internal void StringsIndex(uint ix) 
+               {
+                       if (largeStrings) Write(ix);
+                       else Write((ushort)ix);
+               }
 
-    internal PrimitiveType(byte typeIx) : base(typeIx) { }
+               internal void GUIDIndex(uint ix) 
+               {
+                       if (largeGUID) Write(ix);
+                       else Write((ushort)ix);
+               }
 
-                internal PrimitiveType(byte typeIx, string name, int STIx) : base(typeIx) {
-      this.name = name;
-      this.systemTypeIndex = STIx;
-    }
+               internal void USIndex(uint ix) 
+               {
+                       if (largeUS) Write(ix);
+                       else Write((ushort)ix);
+               }
 
-    internal string GetName() { return name; }
+               internal void BlobIndex(uint ix) 
+               {
+                       if (largeBlob) Write(ix);
+                       else Write((ushort)ix);
+               }
 
-    internal int GetSystemTypeIx() { return systemTypeIndex; }
+               internal void WriteIndex(MDTable tabIx,uint ix) 
+               {
+                       if (metaData.LargeIx(tabIx)) Write(ix);
+                       else Write((ushort)ix);
+               }
 
-    internal sealed override void TypeSig(MemoryStream str) {
-      str.WriteByte(typeIndex);
-    }
+               internal void WriteCodedIndex(CIx code, MetaDataElement elem) 
+               {
+                       metaData.WriteCodedIndex(code,elem,this);
+               }
 
-    internal override MetaDataElement GetTypeSpec(MetaData md) {
-      TypeSpec tS = md.GetPrimitiveTypeSpec(systemTypeIndex);
-      if (tS == null) {
-        tS = new TypeSpec(this,md);
-        md.SetPrimitiveTypeSpec(systemTypeIndex,tS);
-        md.AddToTable(MDTable.TypeSpec,tS);
-      }
-      return tS;
-    }
+               internal void WriteCodeRVA(uint offs) 
+               {
+                       Write(text.RVA() + offs);
+               }
 
-        }
+               internal void WriteDataRVA(uint offs) 
+               {
+                       Write(sdata.RVA() + offs);
+               }
 
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for the Property of a class
-        /// </summary>
-  public class Property : Feature
-        {
-    private static readonly byte PropertyTag = 0x8;
-    MethodDef getterMeth;
-    ConstantElem constVal;
-    uint typeBlobIx = 0;
-    Type[] parList;
-    Type returnType;
-    uint numPars = 0;
+               internal void Write3Bytes(uint val) 
+               {
+                       byte b3 = (byte)((val & FileImage.iByteMask[2]) >> 16);
+                       byte b2 = (byte)((val & FileImage.iByteMask[1]) >> 8);;
+                       byte b1 = (byte)(val & FileImage.iByteMask[0]);
+                       Write(b1);
+                       Write(b2);
+                       Write(b3);
+               }
 
-    internal Property(string name, Type retType, Type[] pars, ClassDef parent) : base(name, parent) {
-      returnType = retType;
-      parList = pars;
-      if (pars != null) numPars = (uint)pars.Length;
-                        tabIx = MDTable.Property;
-                }
+               internal bool ReserveStrongNameSignatureSpace {
+                       get { return reserveStrongNameSignatureSpace; }
+                       set { reserveStrongNameSignatureSpace = value; }
+               }
 
-    /// <summary>
-    /// Add a set method to this property
-    /// </summary>
-    /// <param name="setter">the set method</param>
-    public void AddSetter(MethodDef setter) {
-      AddMethod(setter,MethodType.Setter);
-    }
+       }
 
-    /// <summary>
-    /// Add a get method to this property
-    /// </summary>
-    /// <param name="getter">the get method</param>
-    public void AddGetter(MethodDef getter) {
-      AddMethod(getter,MethodType.Getter);
-      getterMeth = getter;
-    }
+       /**************************************************************************/  
+       /// <summary>
+       /// Base class for the PEFile (starting point)
+       /// </summary>
+       public class PEFile {
+
+               private static readonly string mscorlibName = "mscorlib";
+               private Module thisMod;
+               private ClassDef moduleClass;
+               private ArrayList classRefList = new ArrayList();
+               private ArrayList classDefList = new ArrayList();
+               private ArrayList resources = new ArrayList ();
+               private Assembly thisAssembly;
+               private static bool isMSCorlib;
+               private int corFlags = 1;
+               FileImage fileImage;
+               MetaData metaData;
+
+               /// <summary>
+               /// Create a new PEFile.  Each PEFile is a module.
+               /// </summary>
+               /// <param name="name">module name, also used for the file name</param>
+               /// <param name="isDLL">create a .dll or .exe file</param>
+               /// <param name="hasAssembly">this file is an assembly and 
+               /// will contain the assembly manifest.  The assembly name is the 
+               /// same as the module name</param>
+               public PEFile(string name, bool isDLL, bool hasAssembly)
+                       : this (name, null, isDLL, hasAssembly, null, null) 
+               {
+                       // Console.WriteLine(Hex.Byte(0x12));
+                       // Console.WriteLine(Hex.Short(0x1234));
+                       // Console.WriteLine(Hex.Int(0x12345678));
+               }
 
-    /// <summary>
-    /// Add another method to this property
-    /// </summary>
-    /// <param name="other">the method</param>
-    public void AddOther(MethodDef other) {
-      AddMethod(other,MethodType.Other);
-    }
+               /// <summary>
+               /// Create a new PEFile.  Each PEFile is a module.
+               /// </summary>
+               /// <param name="name">module name, also used for the file name</param>
+               /// <param name="isDLL">create a .dll or .exe file</param>
+               /// <param name="hasAssembly">this file is an assembly and 
+               /// will contain the assembly manifest.  The assembly name is the 
+               /// same as the module name</param>
+               /// <param name="outputDir">write the PEFile to this directory.  If this
+               /// string is null then the output will be to the current directory</param>
+               public PEFile(string name, bool isDLL, bool hasAssembly, string outputDir)
+                       : this (name, null, isDLL, hasAssembly, outputDir, null) 
+               {
+                       // Console.WriteLine(Hex.Byte(0x12));
+                       // Console.WriteLine(Hex.Short(0x1234));
+                       // Console.WriteLine(Hex.Int(0x12345678));
+               }
 
-    /// <summary>
-    /// Add an initial value for this property
-    /// </summary>
-    /// <param name="constVal">the initial value for this property</param>
-    public void AddInitValue(Constant constVal) {
-      this.constVal = new ConstantElem(this,constVal);
-    }
+               /// <summary>
+               /// Create a new PEFile
+               /// </summary>
+               /// <param name="name">module name</param>
+               /// <param name="isDLL">create a .dll or .exe</param>
+               /// <param name="hasAssembly">this PEfile is an assembly and
+               /// will contain the assemly manifest.  The assembly name is the
+               /// same as the module name</param>
+               /// <param name="outStream">write the PEFile to this stream instead
+               /// of to a new file</param>
+               public PEFile(string name, bool isDLL, bool hasAssembly, Stream outStream)
+                       : this (name, null, isDLL, hasAssembly, null, outStream) 
+               {
+               }
 
-    internal sealed override void BuildTables(MetaData md) {
-      if (done) return;
-      nameIx = md.AddToStringsHeap(name);
-      MemoryStream sig = new MemoryStream();
-      sig.WriteByte(PropertyTag);
-      MetaData.CompressNum(numPars,sig);
-      returnType.TypeSig(sig);
-      for (int i=0; i < numPars; i++) {
-        parList[i].TypeSig(sig);
-      }
-      typeBlobIx = md.AddToBlobHeap(sig.ToArray());
-      for (int i=0; i < tide; i++) {
-        md.AddToTable(MDTable.MethodSemantics,methods[i]);
-      }
-      if (constVal != null) {
-        md.AddToTable(MDTable.Constant,constVal);
-        constVal.BuildTables(md);
-      }
-      done = true;
-    }
+               public PEFile(string name, string module_name, bool isDLL, bool hasAssembly, Stream outStream)
+                       : this (name, module_name, isDLL, hasAssembly, null, outStream) 
+               {
+               }  
 
-    internal sealed override uint Size(MetaData md) {
-      return 2 + md.StringsIndexSize() + md.BlobIndexSize();
-    }
+               public PEFile(string name, string module_name, bool isDLL, bool hasAssembly, string outputDir, Stream outStream) 
+               {
+                       SetName (name);
+                       string fname = module_name == null ? MakeFileName (outputDir, name, isDLL) : module_name;
+                       if (outStream == null)
+                               fileImage = new FileImage (isDLL, fname);
+                       else  
+                               fileImage = new FileImage (isDLL, outStream);
+
+                       InitPEFile (name, fname, hasAssembly);
+               }
 
-    internal sealed override void Write(FileImage output) {
-      output.Write(flags);
-      output.StringsIndex(nameIx);
-      output.BlobIndex(typeBlobIx);
-    }
+               private void SetName (string name)
+               {
+                       if (name == "mscorlib")
+                               isMSCorlib = true;
+               }
 
-    internal sealed override uint GetCodedIx(CIx code) {
-                        switch (code) {
-                                case (CIx.HasCustomAttr) : return 9; 
-                                case (CIx.HasConst) : return 2; 
-                                case (CIx.HasSemantics) : return 1; 
-                        }
-                        return 0;
-    }
+               private void InitPEFile(string name, string fName, bool hasAssembly) 
+               {
+                       metaData = fileImage.GetMetaData();
+                       thisMod = new Module(fName,metaData);
+                       if (hasAssembly) {
+                               thisAssembly = new Assembly(name,metaData);
+                               metaData.AddToTable(MDTable.Assembly,thisAssembly);      
+                       }
+                       moduleClass = AddClass(TypeAttr.Private,"","<Module>");
+                       moduleClass.SpecialNoSuper();
+                       metaData.AddToTable(MDTable.Module,thisMod);
+               }
 
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for an pointer (type * or type &)
-        /// </summary>
-  public abstract class PtrType : Type
-        {
-    Type baseType;
+               internal static bool IsMSCorlib {
+                       get { return isMSCorlib; }
+               }
 
-                internal PtrType(Type bType, byte typeIx) : base(typeIx)
-                {
-      baseType = bType;
-      tabIx = MDTable.TypeSpec;
-                }
+               public ClassDef ModuleClass {
+                       get { return moduleClass; }
+               }
 
-    internal sealed override void TypeSig(MemoryStream str) {
-      str.WriteByte(typeIndex);
-      baseType.TypeSig(str);
-    }
+               /// <summary>
+               /// Set the subsystem (.subsystem) (Default is Windows Console mode)
+               /// </summary>
+               /// <param name="subS">subsystem value</param>
+               public void SetSubSystem(SubSystem subS) 
+               {
+                       fileImage.subSys = subS;
+               }
 
-        }
-  /**************************************************************************/  
-  /// <summary>
-  /// Descriptor for a managed pointer (type &  or byref)
-  /// </summary>
+               /// <summary>
+               /// Set the flags (.corflags)
+               /// </summary>
+               /// <param name="flags">the flags value</param>
+               public void SetCorFlags(int flags) 
+               {
+                       corFlags = flags;
+               }
 
-  public class ManagedPointer : PtrType  // <type> & (BYREF)  
-  {
+               public void SetStackReserve (long stackReserve)
+               {
+                       fileImage.stackReserve = stackReserve;
+               }
 
-    /// <summary>
-    /// Create new managed pointer to baseType
-    /// </summary>
-    /// <param name="bType">the base type of the pointer</param>
-    public ManagedPointer(Type baseType) : base(baseType,0x10) { }
-  }
-  /**************************************************************************/  
-  /// <summary>
-  /// Descriptor for an unmanaged pointer (type *)
-  /// </summary>
-  public class UnmanagedPointer : PtrType // PTR
-  {
-    /// <summary>
-    /// Create a new unmanaged pointer to baseType
-    /// </summary>
-    /// <param name="baseType">the base type of the pointer</param>
-    public UnmanagedPointer(Type baseType) : base(baseType, 0x0F) { }
+               private string MakeFileName(string dirName, string name, bool isDLL) 
+               {
+                       string result = "";
+                       if ((dirName != null) && (dirName.CompareTo("") != 0)) {
+                               result = dirName;
+                               if (!dirName.EndsWith("\\")) result += "\\";
+                       }
+                       result += name;
 
-  }
+                       // if (isDLL) result += ".dll";  else result += ".exe";
 
-  public interface IResolutionScope 
-  {
-  }
-  
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for scopes (extended by Module, ModuleRef, Assembly, AssemblyRef)
-        /// </summary>
-  public abstract class ResolutionScope : MetaDataElement, IResolutionScope
-        {
-    protected uint nameIx = 0;
-    protected MetaData metaData;
-    protected string name;
+                       return result;
+               }
 
-                internal ResolutionScope(string name, MetaData md)
-                {
-      metaData = md;
-      this.name = name;
-      nameIx = md.AddToStringsHeap(name);
-                }
+               /// <summary>
+               /// Add an external assembly to this PEFile (.assembly extern)
+               /// </summary>
+               /// <param name="assemName">the external assembly name</param>
+               /// <returns>a descriptor for this external assembly</returns>
+               public AssemblyRef AddExternAssembly(string assemName) 
+               {
+                       if (assemName.CompareTo(mscorlibName) == 0) return metaData.mscorlib;
+                       AssemblyRef anAssem = new AssemblyRef(metaData,assemName);
+                       metaData.AddToTable(MDTable.AssemblyRef,anAssem);
+                       // Console.WriteLine("Adding assembly " + assemName);
+                       return anAssem;
+               }
 
-    internal string GetName() { return name; }
+               /// <summary>
+               /// Add an external module to this PEFile (.module extern)
+               /// </summary>
+               /// <param name="name">the external module name</param>
+               /// <returns>a descriptor for this external module</returns>
+               public ModuleRef AddExternModule(string name) 
+               {
+                       ModuleRef modRef = new ModuleRef(metaData,name);
+                       metaData.AddToTable(MDTable.ModuleRef,modRef);
+                       return modRef;
+               }
 
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a Section in a PEFile  eg .text, .sdata
-        /// </summary>
-  internal class Section {
-                private static readonly uint relocPageSize = 4096;  // 4K pages for fixups
+               /// <summary>
+               /// Add a "global" method to this module
+               /// </summary>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">method parameters</param>
+               /// <returns>a descriptor for this new "global" method</returns>
+               public MethodDef AddMethod(string name, Type retType, Param[] pars) 
+               {
+                       return moduleClass.AddMethod(name,retType,pars);
+               }
 
-                char[] name; 
-                uint offset = 0, tide = 0, size = 0, rva = 0, relocTide = 0;
-                //uint relocOff = 0;
-    uint flags = 0, padding = 0;
-                uint[] relocs; 
+               /// <summary>
+               /// Add a "global" method to this module
+               /// </summary>
+               /// <param name="mAtts">method attributes</param>
+               /// <param name="iAtts">method implementation attributes</param>
+               /// <param name="name">method name</param>
+               /// <param name="retType">return type</param>
+               /// <param name="pars">method parameters</param>
+               /// <returns>a descriptor for this new "global" method</returns>
+               public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, Type retType, Param[] pars) 
+               {
+                       return moduleClass.AddMethod(mAtts,iAtts,name,retType,pars);
+               }
 
-                internal Section(string sName, uint sFlags) {
-                  name = sName.ToCharArray();
-                  flags = sFlags;
-                }
+               public MethodRef AddMethodToTypeSpec (Type item, string name, Type retType, Type[] pars) 
+               {
+                       MethodRef meth = new MethodRef (item.GetTypeSpec (metaData), name, retType, pars, false, null);
+                       metaData.AddToTable (MDTable.MemberRef,meth);
+                       return meth;
+               }
 
-                internal uint Tide() { return tide; }
+               public MethodRef AddVarArgMethodToTypeSpec (Type item, string name, Type retType,
+                               Type[] pars, Type[] optPars) {
+                       MethodRef meth = new MethodRef(item.GetTypeSpec (metaData), name,retType,pars,true,optPars);
+                       metaData.AddToTable(MDTable.MemberRef,meth);
+                       return meth;
+               }
 
-                internal void IncTide(uint incVal) { tide += incVal; }
+               public FieldRef AddFieldToTypeSpec (Type item, string name, Type fType) 
+               {
+                       FieldRef field = new FieldRef (item.GetTypeSpec (metaData), name,fType);
+                       metaData.AddToTable (MDTable.MemberRef,field);
+                       return field;
+               }
 
-                internal uint Padding() { return padding; }
+               public void AddMethodSpec (Method m, GenericMethodSig g_sig)
+               {
+                       MethodSpec ms = new MethodSpec (m, g_sig);
+                       metaData.AddToTable (MDTable.MethodSpec, ms);
+               }
 
-                internal uint Size() { return size; }
+               /// <summary>
+               /// Add a "global" field to this module
+               /// </summary>
+               /// <param name="name">field name</param>
+               /// <param name="fType">field type</param>
+               /// <returns>a descriptor for this new "global" field</returns>
+               public FieldDef AddField(string name, Type fType) 
+               {
+                       return moduleClass.AddField(name,fType);
+               }
 
-                internal void SetSize(uint pad) {
-                        padding = pad;
-                        size = tide + padding;
-                }
+               /// <summary>
+               /// Add a "global" field to this module
+               /// </summary>
+               /// <param name="attrSet">attributes of this field</param>
+               /// <param name="name">field name</param>
+               /// <param name="fType">field type</param>
+               /// <returns>a descriptor for this new "global" field</returns>
+               public FieldDef AddField(FieldAttr attrSet, string name, Type fType) 
+               {
+                       return moduleClass.AddField(attrSet,name,fType);
+               }
 
-                internal uint RVA() { return rva; }
+               /// <summary>
+               /// Add a class to this module
+               /// </summary>
+               /// <param name="attrSet">attributes of this class</param>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns>a descriptor for this new class</returns>
+               public ClassDef AddClass(TypeAttr attrSet, string nsName, string name) 
+               {
+                       return AddClass (attrSet, nsName, name, null);
+               }
 
-                internal void SetRVA(uint rva) { this.rva = rva; }
+               /// <summary>
+               /// Add a class which extends System.ValueType to this module
+               /// </summary>
+               /// <param name="attrSet">attributes of this class</param>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <returns>a descriptor for this new class</returns>
+               public ClassDef AddValueClass(TypeAttr attrSet, string nsName, string name, ValueClass vClass) 
+               {
+                       ClassDef aClass = new ClassDef(attrSet,nsName,name,metaData);
+                       if (!ClassDef.IsValueType (nsName, name) && !ClassDef.IsEnum (nsName, name)) {
+                               aClass.MakeValueClass(vClass);
+                       } else {
+                               if (ClassDef.IsEnum (nsName, name))
+                                       aClass.SetSuper (metaData.mscorlib.ValueType ());
+                               else
+                                       aClass.SetSuper (metaData.mscorlib.GetSpecialSystemClass (PrimitiveType.Object));
+
+                               metaData.mscorlib.SetSpecialSystemClass (nsName, name, aClass);
+                       }
+                       aClass.SetTypeIndex (PrimitiveType.ValueType.GetTypeIndex ());
+                       metaData.AddToTable(MDTable.TypeDef,aClass);
+                       return aClass;
+               }
 
-                internal uint Offset() { return offset; }
+               /// <summary>
+               /// Add a class to this module
+               /// </summary>
+               /// <param name="attrSet">attributes of this class</param>
+               /// <param name="nsName">name space name</param>
+               /// <param name="name">class name</param>
+               /// <param name="superType">super type of this class (extends)</param>
+               /// <returns>a descriptor for this new class</returns>
+               public ClassDef AddClass(TypeAttr attrSet, string nsName, string name, Class superType) 
+               {
+                       ClassDef aClass = new ClassDef(attrSet,nsName,name,metaData);
+                       if (superType != null)
+                               aClass.SetSuper(superType);
+                       if (PEFile.IsMSCorlib)
+                               metaData.mscorlib.SetSpecialSystemClass (nsName, name, aClass);
+                       metaData.AddToTable(MDTable.TypeDef,aClass);
+                       return aClass;
+               }
 
-                internal void SetOffset(uint offs) { offset = offs; }
+               public FileRef AddFile(string fName, byte[] hashBytes, bool hasMetaData, bool entryPoint) 
+               {
+                       FileRef file = new FileRef(fName,hashBytes,hasMetaData,entryPoint,metaData);
+                       metaData.AddToTable(MDTable.File,file);
+                       return file;
+               }
 
-    internal void DoBlock(BinaryWriter reloc, uint page, int start, int end) {
-      //Console.WriteLine("rva = " + rva + "  page = " + page);
-      reloc.Write(rva + page);
-      reloc.Write((uint)(((end-start+1)*2) + 8));
-      for (int j=start; j < end; j++) {
-        //Console.WriteLine("reloc offset = " + relocs[j]);
-        reloc.Write((ushort)((0x3 << 12) | (relocs[j] - page)));
-      }
-      reloc.Write((ushort)0);
-    }
+               /// <summary>
+               /// Add a manifest resource to this PEFile NOT YET IMPLEMENTED
+               /// </summary>
+               /// <param name="mr"></param>
+               public void AddManifestResource(ManifestResource mr) 
+               {
+                       metaData.AddToTable(MDTable.ManifestResource,mr);
+                       resources.Add (mr);
+                       //mr.FixName(metaData);
+               }
 
-                internal void DoRelocs(BinaryWriter reloc) {
-      if (relocTide > 0) {
-        //relocOff = (uint)reloc.Seek(0,SeekOrigin.Current);
-        uint block = (relocs[0]/relocPageSize + 1) * relocPageSize;
-        int start = 0;
-        for (int i=1; i < relocTide; i++) {
-          if (relocs[i] >= block) {
-            DoBlock(reloc,block-relocPageSize,start,i);
-            start = i;
-            block = (relocs[i]/relocPageSize + 1) * relocPageSize;
-          }
-        }
-        DoBlock(reloc,block-relocPageSize,start,(int)relocTide);
-      }
-                }
+               public void AddCustomAttribute (Method meth, byte [] data, MetaDataElement element)
+               {
+                       metaData.AddCustomAttribute (new CustomAttribute (element, meth, data));
+               }
 
-                internal void AddReloc(uint offs) {
-                        int pos = 0;
-                        if (relocs == null) {
-                                relocs = new uint[5];
-                        } else {
-                                if (relocTide >= relocs.Length) {
-                                        uint[] tmp = relocs;
-                                        relocs = new uint[tmp.Length + 5];
-                                        for (int i=0; i < relocTide; i++) {
-                                                relocs[i] = tmp[i];
-                                        }
-                                }
-                                while ((pos < relocTide) && (relocs[pos] < offs)) pos++;
-                                for (int i=pos; i < relocTide; i++) {
-                                        relocs[i+1] = relocs[i];
-                                }
-                        }
-                        relocs[pos] = offs;
-                        relocTide++;    
-                }
-      
-                internal void WriteHeader(BinaryWriter output, uint relocRVA) {
-                        output.Write(name);
-                        output.Write(tide);
-                        output.Write(rva);
-                        output.Write(size);
-                        output.Write(offset);
-                        output.Write(0);
-                        //output.Write(relocRVA + relocOff);
-                        output.Write(0);
-      output.Write(0);
-                        //output.Write((ushort)relocTide);
-                        //output.Write((ushort)0);
-                        output.Write(flags);
-                }
+               public void AddDeclSecurity (SecurityAction sec_action, byte [] data, MetaDataElement element)
+               {
+                       metaData.AddDeclSecurity (new DeclSecurity (element, (ushort) sec_action, data));
+               }
 
-        }
-  /**************************************************************************/  
-  public abstract class Signature : MetaDataElement 
-  {
-    protected uint sigIx;
+               /// <summary>
+               /// Add a managed resource from another assembly.
+               /// </summary>
+               /// <param name="resName">The name of the resource</param>
+               /// <param name="assem">The assembly where the resource is</param>
+               /// <param name="isPublic">Access for the resource</param>
+               public void AddExternalManagedResource (string resName, AssemblyRef assem, uint flags) 
+               {
+                       resources.Add (new ManifestResource (resName, flags, assem));
+               }
 
-    internal Signature() {
-      tabIx = MDTable.StandAloneSig;
-    }
+               /// <summary>
+               /// Add a managed resource from another assembly.
+               /// </summary>
+               /// <param name="mr"></param>
+               /// <param name="isPublic"></param>
+               public void AddExternalManagedResource (ManifestResource mr) 
+               {
+                       resources.Add (new ManifestResource (mr));
+               }
+               /// <summary>
+               /// Find a resource
+               /// </summary>
+               /// <param name="name">The name of the resource</param>
+               /// <returns>The resource with the name "name" or null </returns>
+               public ManifestResource GetResource (string name) 
+               {
+                       for (int i = 0; i < resources.Count; i ++) {
+                               if (((ManifestResource) resources [i]).Name == name)
+                                       return (ManifestResource) resources [i];
+                       }
+                       return null;
+               }
 
-    internal sealed override uint Size(MetaData md) {
-      return md.BlobIndexSize();
-    }
+               public ManifestResource [] GetResources() 
+               {
+                       return (ManifestResource []) resources.ToArray (typeof (ManifestResource));
+               }
 
-    internal sealed override void Write(FileImage output) {
-      output.BlobIndex(sigIx);
-    }
+               /// <summary>
+               /// Write out the PEFile (the "bake" function)
+               /// </summary>
+               public void WritePEFile() { /* the "bake" function */
+                       fileImage.ReserveStrongNameSignatureSpace = thisAssembly.HasPublicKey;
+                       fileImage.MakeFile();
+               }
 
-    internal sealed override uint GetCodedIx(CIx code) { return (uint)tabIx; }
+               /// <summary>
+               /// Get the descriptor of this module
+               /// </summary>
+               /// <returns>the descriptor for this module</returns>
+               public Module GetThisModule() 
+               {
+                       return thisMod;
+               }
 
-  }
-  /**************************************************************************/  
-        /// <summary>
-        /// Descriptor for a class defined in System (mscorlib)
-        /// </summary>
-  internal class SystemClass : ClassRef
-        {
-    PrimitiveType elemType; 
+               /// <summary>
+               /// Get the descriptor for this assembly.  The PEFile must have been
+               /// created with hasAssembly = true
+               /// </summary>
+               /// <returns>the descriptor for this assembly</returns>
+               public Assembly GetThisAssembly() 
+               {
+                       return thisAssembly;
+               }
 
-                internal SystemClass(PrimitiveType eType, AssemblyRef paren, MetaData md)
-                                    : base("System",eType.GetName(),md) {
-      elemType = eType;
-      parent = paren;
-                }
+       }
 
-    internal override sealed MetaDataElement GetTypeSpec(MetaData md) {
-      if (typeSpec == null) typeSpec = (TypeSpec)elemType.GetTypeSpec(md);
-      return typeSpec;
-    }
+       /**************************************************************************/  
+       /// <summary>
+       /// Descriptor for a Section in a PEFile  eg .text, .sdata
+       /// </summary>
+       internal class Section {
+               private static readonly uint relocPageSize = 4096;  // 4K pages for fixups
 
+               char[] name; 
+               uint offset = 0, tide = 0, size = 0, rva = 0, relocTide = 0;
+               //uint relocOff = 0;
+               uint flags = 0, padding = 0;
+               uint[] relocs; 
 
-    internal sealed override void TypeSig(MemoryStream str) {
-        str.WriteByte(elemType.GetTypeIndex());
-    }
+               internal Section(string sName, uint sFlags) 
+               {
+                       name = sName.ToCharArray();
+                       flags = sFlags;
+               }
 
-        }
-  /**************************************************************************/  
-        /// <summary>
-        /// Base class for all IL types
-        /// </summary>
-  public abstract class Type : MetaDataElement {
-    protected byte typeIndex;
-    protected TypeSpec typeSpec;
+               internal uint Tide() { return tide; }
 
-    internal Type(byte tyIx) { typeIndex = tyIx; }
+               internal void IncTide(uint incVal) { tide += incVal; }
 
-    internal byte GetTypeIndex() { return typeIndex; }
-    internal void SetTypeIndex (byte b) { typeIndex = b; }
-          
-    internal virtual MetaDataElement GetTypeSpec(MetaData md) {
-      if (typeSpec == null) {
-        typeSpec = new TypeSpec(this,md);
-        md.AddToTable(MDTable.TypeSpec,typeSpec);
-      }
-      return typeSpec;
-    }
-    internal virtual void TypeSig(MemoryStream str) {
-      throw(new TypeSignatureException(this.GetType().AssemblyQualifiedName +
-        " doesn't have a type signature!!"));   
-    }
+               internal uint Padding() { return padding; }
 
-  }
+               internal uint Size() { return size; }
 
-  /**************************************************************************/  
+               internal void SetSize(uint pad) 
+               {
+                       padding = pad;
+                       size = tide + padding;
+               }
 
-  public class TypeSpec : MetaDataElement {
-    uint sigIx = 0;
+               internal uint RVA() { return rva; }
 
-    internal TypeSpec(Type aType, MetaData md) {
-      MemoryStream sig = new MemoryStream();
-      aType.TypeSig(sig);
-      sigIx = md.AddToBlobHeap(sig.ToArray());
-      tabIx = MDTable.TypeSpec;
-    }
+               internal void SetRVA(uint rva) { this.rva = rva; }
 
-    internal sealed override uint GetCodedIx(CIx code) {
-      switch (code) {
-        case (CIx.TypeDefOrRef) : return 2; 
-        case (CIx.HasCustomAttr) : return 13; 
-        case (CIx.MemberRefParent) : return 4; 
-      }
-      return 0;
-    }
+               internal uint Offset() { return offset; }
 
-    internal override uint Size(MetaData md) { 
-      return md.BlobIndexSize();
-    }
+               internal void SetOffset(uint offs) { offset = offs; }
 
-    internal sealed override void Write(FileImage output) {
-      //Console.WriteLine("Writing the blob index for a TypeSpec");
-      output.BlobIndex(sigIx);
-    }
+               internal void DoBlock(BinaryWriter reloc, uint page, int start, int end) 
+               {
+                       //Console.WriteLine("rva = " + rva + "  page = " + page);
+                       reloc.Write(rva + page);
+                       reloc.Write((uint)(((end-start+1)*2) + 8));
+                       for (int j=start; j < end; j++) {
+                               //Console.WriteLine("reloc offset = " + relocs[j]);
+                               reloc.Write((ushort)((0x3 << 12) | (relocs[j] - page)));
+                       }
+                       reloc.Write((ushort)0);
+               }
 
-  }
+               internal void DoRelocs(BinaryWriter reloc) 
+               {
+                       if (relocTide > 0) {
+                               //relocOff = (uint)reloc.Seek(0,SeekOrigin.Current);
+                               uint block = (relocs[0]/relocPageSize + 1) * relocPageSize;
+                               int start = 0;
+                               for (int i=1; i < relocTide; i++) {
+                                       if (relocs[i] >= block) {
+                                               DoBlock(reloc,block-relocPageSize,start,i);
+                                               start = i;
+                                               block = (relocs[i]/relocPageSize + 1) * relocPageSize;
+                                       }
+                               }
+                               DoBlock(reloc,block-relocPageSize,start,(int)relocTide);
+                       }
+               }
 
-          class ByteArrayComparer : IComparer {
+               internal void AddReloc(uint offs) 
+               {
+                       int pos = 0;
+                       if (relocs == null) {
+                               relocs = new uint[5];
+                       } else {
+                               if (relocTide >= relocs.Length) {
+                                       uint[] tmp = relocs;
+                                       relocs = new uint[tmp.Length + 5];
+                                       for (int i=0; i < relocTide; i++) {
+                                               relocs[i] = tmp[i];
+                                       }
+                               }
+                               while ((pos < relocTide) && (relocs[pos] < offs)) pos++;
+                               for (int i=pos; i < relocTide; i++) {
+                                       relocs[i+1] = relocs[i];
+                               }
+                       }
+                       relocs[pos] = offs;
+                       relocTide++;    
+               }
 
-                public int Compare (object x, object y)
-                {
-                        byte [] a = (byte []) x;
-                        byte [] b = (byte []) y;
-                        int len = a.Length;
+               internal void WriteHeader(BinaryWriter output, uint relocRVA) 
+               {
+                       output.Write(name);
+                       output.Write(tide);
+                       output.Write(rva);
+                       output.Write(size);
+                       output.Write(offset);
+                       output.Write(0);
+                       //output.Write(relocRVA + relocOff);
+                       output.Write(0);
+                       output.Write(0);
+                       //output.Write((ushort)relocTide);
+                       //output.Write((ushort)0);
+                       output.Write(flags);
+               }
 
-                        if (b.Length != len)
-                                return 1;
+       }
 
-                        for (int i = 0; i < len; ++i)
-                                if (a [i] != b [i])
-                                        return 1;
-                        return 0;
-                }
-        }
+       public class Hex {
+               readonly static char[] hexDigit = {'0','1','2','3','4','5','6','7',
+                       '8','9','A','B','C','D','E','F'};
+               readonly static uint[] iByteMask = {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000};
+               readonly static ulong[] lByteMask = {0x00000000000000FF, 0x000000000000FF00, 
+                       0x0000000000FF0000, 0x00000000FF000000,
+                       0x000000FF00000000, 0x0000FF0000000000,
+                       0x00FF000000000000, 0xFF00000000000000 };
+               readonly static uint nibble0Mask = 0x0000000F;
+               readonly static uint nibble1Mask = 0x000000F0;
+
+               public static String Byte(int b) 
+               {
+                       char[] str = new char[2];
+                       uint num = (uint)b;
+                       uint b1 = num & nibble0Mask;
+                       uint b2 = (num & nibble1Mask) >> 4;
+                       str[0] = hexDigit[b2];
+                       str[1] = hexDigit[b1];
+                       return new String(str);
+               }
 
-        class ByteArrayHashCodeProvider : IHashCodeProvider {
+               public static String Short(int b) 
+               {
+                       char[] str = new char[4];
+                       uint num1 = (uint)b & iByteMask[0];
+                       uint num2 = ((uint)b & iByteMask[1]) >> 8;
+                       uint b1 = num1 & nibble0Mask;
+                       uint b2 = (num1 & nibble1Mask) >> 4;
+                       uint b3 = num2 & nibble0Mask;
+                       uint b4 = (num2 & nibble1Mask) >> 4;
+                       str[0] = hexDigit[b4];
+                       str[1] = hexDigit[b3];
+                       str[2] = hexDigit[b2];
+                       str[3] = hexDigit[b1];
+                       return new String(str);
+               }
 
-               public int GetHashCode (Object key)
+               public static String Int(int val) 
                {
-                       byte [] arr = (byte []) key;
-                        int len = arr.Length;
-                       int h = 0;
+                       char[] str = new char[8];
+                       uint num = (uint)val;
+                       int strIx = 7;
+                       for (int i=0; i < iByteMask.Length; i++) {
+                               uint b = num & iByteMask[i];
+                               b >>= (i*8);
+                               uint b1 = b & nibble0Mask;
+                               uint b2 = (b & nibble1Mask) >> 4;
+                               str[strIx--] = hexDigit[b1];
+                               str[strIx--] = hexDigit[b2];
+                       }
+                       return new String(str);
+               }
 
-                       for (int i = 0; i < len; ++i)
-                               h = (h << 5) - h + arr [i];
+               public static String Int(uint num) 
+               {
+                       char[] str = new char[8];
+                       int strIx = 7;
+                       for (int i=0; i < iByteMask.Length; i++) {
+                               uint b = num & iByteMask[i];
+                               b >>= (i*8);
+                               uint b1 = b & nibble0Mask;
+                               uint b2 = (b & nibble1Mask) >> 4;
+                               str[strIx--] = hexDigit[b1];
+                               str[strIx--] = hexDigit[b2];
+                       }
+                       return new String(str);
+               }
 
-                       return h;
+               public static String Long(long lnum) 
+               {
+                       ulong num = (ulong)lnum;
+                       char[] str = new char[16];
+                       int strIx = 15;
+                       for (int i=0; i < lByteMask.Length; i++) {
+                               ulong b = num & lByteMask[i];
+                               b >>= (i*8);
+                               ulong b1 = b & nibble0Mask;
+                               ulong b2 = (b & nibble1Mask) >> 4;
+                               str[strIx--] = hexDigit[b1];
+                               str[strIx--] = hexDigit[b2];
+                       }
+                       return new String(str);
                }
+       }
 
+       /// <summary>
+       /// Error for invalid PE file
+       /// </summary>
+       public class PEFileException : System.Exception {
+               public PEFileException(string msg) : base("Error in PE File:  " + msg) { }
        }
-}
 
+       public class NotYetImplementedException : System.Exception  {
+               public NotYetImplementedException(string msg) : base(msg + " Not Yet Implemented") { }
+       }
+
+       public class TypeSignatureException : System.Exception {
+               public TypeSignatureException(string msg) : base(msg) { }
+       }
 
+}
index e052c1386db6eca970aa9aaab731af801d7a9f58..fe5b1f598c302fb62f7d506d63d9a9f4103abaa4 100644 (file)
@@ -1,4 +1,6 @@
 ./Assembly/AssemblyInfo.cs
 ../../build/common/Consts.cs
 ../../build/common/Locale.cs
+Metadata.cs
+Code.cs
 PEAPI.cs
index 29bbd5d03bc1e6bf3e559a58c0d9269da8d4c4af..48d75943313db8079890e1cdb803bc584cda01fe 100644 (file)
@@ -5,7 +5,7 @@ include ../../build/rules.make
 LIBRARY = System.Configuration.dll
 LIBRARY_USE_INTERMEDIATE_FILE = yes
 
-LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Xml.dll
+LIB_MCS_FLAGS = -r:$(corlib) -r:System.dll -r:System.Xml.dll
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 # This is a .NET 2.0 only assembly
index d81b030b60fd714accdcde3a070f31407751734b..f30a8d492ae763e5b54abf893469f76419931888 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-20 Konstantin Triger <kostat@mainsoft.com>
+
+       * Added jay.bat to run jay in java prebuild step
+       * System.Data.vmwcsproj: added prebuild step
+
 2005-09-02 Umadevi S <sumadevi@novell.com>
        * System.Data.dll.sources: Added SqlProcedureAttribute,SqlTriggerAttribute and 
         SqlTriggerContext.cs to Microsoft.SqlServer.Server namespace.Also added SqlXml to                   SqlTypes namespace 
index 978c7280066c15632af6c027b4bc8558fe02c05c..0b9ce6607f2900a3d993c1ed57e9f7f72e053201 100644 (file)
@@ -9,7 +9,7 @@ system = System.dll
 else
 system = $(topdir)/class/lib/$(PROFILE)/System.dll
 endif
-       
+
 ifeq (net_2_0, $(PROFILE))
 OTHER_LIB_MCS_FLAGS = -r:System.Configuration.dll
 endif
index 177a733cbf5b6f34f77340ae8d90f57413a61086..a588789138b33a9acdfc6f4b724ca2476c33e625 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-07 Boris Kirzner <borisk@mainsoft.com>
+       * DataContainer.cs: Do not convert value if container type 
+       is System.Object.
+
 2005-08-08  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * DbTypes.cs: Marked internal to fix public API.
index 4ce888fbf59c6f93c8df29ded0025554713d62e4..70074d581a85bb8cd2639e9b08b244938495c7b4 100644 (file)
@@ -1090,7 +1090,7 @@ namespace System.Data.Common
 \r
                        protected override void SetValue(int index, object value)\r
                        {\r
-                               if(value != null && value != DBNull.Value && !Type.IsAssignableFrom(value.GetType()))\r
+                               if(value != null && value != DBNull.Value && !(Type == DbTypes.TypeOfObject) && !Type.IsAssignableFrom(value.GetType()))\r
                                        value = Convert.ChangeType(value, Type);\r
 \r
                                base.SetValue(index, value);\r
index 8ff1ccc6072e995f84cf42acaf9e37a453f5b120..0f56cfbcfc06c2f961a2f9f878131fce9ab7a145 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-05 Boris Kirzner <borisk@mainsoft.com>
+       * OleDbConvert.cs: return underlined value type in case of enum value.
+       * OleDbParameter.cs:
+               - Update of DbType should also update OleDbType property. 
+               - Do not update parameter type is the value set is DbNull.
+
 2005-06-21  Konstantin  Triger <kostat@mainsoft.com>
 
        * OleDbConvert.cs: mapping OleDbType.Guid to Types.CHAR
index 992f88575c0dc000c787b10db29668d65fd38242..41ad6da8d8487b51441c120c110301fbb7745d64 100644 (file)
@@ -159,6 +159,9 @@ namespace System.Data.OleDb
                                        if (type.Equals(DbTypes.TypeOfTimespan)) return OleDbType.DBTime;\r
                                        if (type.Equals(DbTypes.TypeOfGuid)) return OleDbType.Guid;\r
 \r
+                                       if (type.IsEnum)\r
+                                               return ValueTypeToOleDbType (Enum.GetUnderlyingType (type));\r
+\r
                                        return OleDbType.IUnknown;\r
                                }\r
                                case TypeCode.SByte: return OleDbType.TinyInt;\r
index db992cc71367cfada9fa08f3b5a2fca6d475d97b..eae36d37a341fb49c1e04e61808bf88b46abdab1 100644 (file)
@@ -114,7 +114,7 @@ namespace System.Data.OleDb
                public override DbType DbType\r
         {\r
             get { return OleDbConvert.OleDbTypeToDbType(_oleDbType); }           \r
-                       set { _oleDbType = OleDbConvert.DbTypeToOleDbType(value); }\r
+                       set { OleDbType = OleDbConvert.DbTypeToOleDbType(value); }\r
         }                \r
         \r
         public OleDbType OleDbType\r
@@ -130,7 +130,7 @@ namespace System.Data.OleDb
         {\r
             get { return base.Value; }\r
             set {\r
-                if (!_isDbTypeSet && (value != null)) {\r
+                if (!_isDbTypeSet && (value != null) && (value != DBNull.Value)) {\r
                     _oleDbType = OleDbConvert.ValueTypeToOleDbType(value.GetType());\r
                                }\r
                 base.Value = value;\r
index f5a4232bc2b431ff267e87eb69b345f44bd8b9e1..983774a4a5c961b67d7759f224d110729716d5b5 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-20  Alexandre Miguel Pedro Gomes  <alexmipego@gmail.com>
+       
+       * OleDbConnection.cs: Verify and throw an exception if the
+       connection isn't valid.
+
+2005-09-13  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * Moved TestGda.cs & TestOleDb.cs to ..\Test.
+       
 2005-08-08  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * OleDbDataAdapter.cs: Fixed custom attributes to match MS.NET.
index c93b5e10a7edb18ddd176ad94c95ac0f003a8a79..7ee3e9cceb8c5187ac5079c45fc32ce41ab184c7 100644 (file)
@@ -261,7 +261,9 @@ namespace System.Data.OleDb
                        gdaConnection = libgda.gda_client_open_connection (libgda.GdaClient,
                                                                           connectionString,
                                                                           "", "", 0);
-                       
+
+                       if (gdaConnection==IntPtr.Zero)
+                               throw new OleDbException (this);        
                        /* convert the connection string to its GDA equivalent */
                        //args = connectionString.Split (';');
                        //len = args.Length;
diff --git a/mcs/class/System.Data/System.Data.OleDb/TestGDA.cs b/mcs/class/System.Data/System.Data.OleDb/TestGDA.cs
deleted file mode 100644 (file)
index 6e90803..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Data.OleDb;
-
-namespace Mono.Data.GDA.Test
-{
-       public class TestGDA
-       {
-               private IntPtr m_gdaClient = IntPtr.Zero;
-               private IntPtr m_gdaConnection = IntPtr.Zero;
-               
-               static void Main (string[] args)
-               {
-                       TestGDA test = new TestGDA ();
-                       
-                       /* initialization */
-                       libgda.gda_init ("TestGDA#", "0.1", args.Length, args);
-                       test.m_gdaClient = libgda.gda_client_new ();
-
-                       /* open connection */
-                       test.m_gdaConnection = libgda.gda_client_open_connection (
-                               test.m_gdaClient,
-                               "PostgreSQL",
-                               "", "");
-                       if (test.m_gdaConnection != IntPtr.Zero) {
-                               System.Console.Write ("Connection successful!");
-
-                               /* close connection */
-                               libgda.gda_connection_close (test.m_gdaConnection);
-                       }
-               }       
-       }
-}
diff --git a/mcs/class/System.Data/System.Data.OleDb/TestOleDb.cs b/mcs/class/System.Data/System.Data.OleDb/TestOleDb.cs
deleted file mode 100644 (file)
index b31c4eb..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Data.OleDb;
-
-namespace System.Data.OleDb.Test
-{
-       public class TestOleDb
-       {
-               private OleDbConnection m_cnc;
-
-               private TestOleDb ()
-               {
-                       OleDbCommand cmd;
-                       
-                       m_cnc = new OleDbConnection ("Provider=PostgreSQL;Addr=127.0.0.1;Database=rodrigo");
-                       m_cnc.Open ();
-
-                       Console.WriteLine ("Connected to:");
-                       Console.WriteLine (" Data Source: " + m_cnc.DataSource);
-                       Console.WriteLine (" Database: " + m_cnc.Database);
-                       Console.WriteLine (" Connection string: " + m_cnc.ConnectionString);
-                       Console.WriteLine (" Provider: " + m_cnc.Provider);
-                       Console.WriteLine (" Server version:" + m_cnc.ServerVersion);
-
-                       /* create temporary table */
-                       Console.WriteLine ("Creating temporary table...");
-                       cmd = new OleDbCommand ("CREATE TABLE mono_test_table ( " +
-                                               " name varchar(25), email varchar(50), date_entered timestamp)",
-                                               m_cnc);
-                       cmd.ExecuteNonQuery ();
-                       InsertRow ("Mike Smith", "mike@smiths.com");
-                       InsertRow ("Julie Andrews", "julie@hollywood.com");
-                       InsertRow ("Michael Jordan", "michael@bulls.com");
-               }
-
-               void InsertRow (string name, string email)
-               {
-                       OleDbCommand cmd;
-
-                       cmd = new OleDbCommand ("INSERT INTO mono_test_table (name, email, date_entered) VALUES ('" +
-                                               name + "', '" + email +"', date 'now')", m_cnc);
-                       Console.WriteLine ("Executing command '" + cmd.CommandText + "'");
-                       cmd.ExecuteNonQuery ();
-
-               }
-               
-               void DisplayRow (OleDbDataReader reader)
-               {
-                       for (int i = 0; i < reader.FieldCount; i++) {
-                               Console.WriteLine (" " + reader.GetDataTypeName (i) + ": " +
-                                                  reader.GetValue (i).ToString ());
-                       }
-               }
-               
-               void TestDataReader ()
-               {
-                       int i = 0;
-                       string sql = "SELECT * FROM mono_test_table";
-                       
-                       Console.WriteLine ("Executing SELECT command...");
-                       OleDbCommand cmd = new OleDbCommand (sql, m_cnc);
-                       OleDbDataReader reader = cmd.ExecuteReader ();
-
-                       Console.WriteLine (" Recordset description:");
-                       for (i = 0; i < reader.FieldCount; i++) {
-                               Console.WriteLine ("  Field " + i + ": " +
-                                                  reader.GetName (i) + " (" +
-                                                  reader.GetDataTypeName (i) + ")");
-                       }
-
-                       Console.WriteLine ("Reading data...");
-                       i = 0;
-                       while (reader.Read ()) {
-                               Console.WriteLine ("Row " + i + ":");
-                               DisplayRow (reader);
-                               i++;
-                       }
-
-                       reader.Close ();
-               }
-
-               void TestTransaction ()
-               {
-                       Console.WriteLine ("Starting transaction...");
-                       OleDbTransaction xaction = m_cnc.BeginTransaction ();
-
-                       Console.WriteLine ("Aborting transaction...");
-                       xaction.Rollback ();
-               }
-               
-               void Close ()
-               {
-                       OleDbCommand cmd = new OleDbCommand ("DROP TABLE mono_test_table", m_cnc);
-                       cmd.ExecuteNonQuery ();
-                       m_cnc.Close ();
-               }
-
-               static void Main (string[] args)
-               {
-                       try {
-                               TestOleDb test = new TestOleDb ();
-                               test.TestDataReader ();
-                               test.TestTransaction ();
-                               test.Close ();
-                       } catch (Exception e) {
-                               Console.WriteLine ("An error has occured: {0}", e.ToString ());
-                       }
-               }
-       }
-}
index 1577930921b8f1294baf62dd77d552a11d3adb50..eca10ae4eac693496bb0daf5b46fe3037c66358e 100644 (file)
@@ -441,8 +441,7 @@ namespace System.Data.ProviderBase
                        if (trimedProcedureName.Length > 0 && trimedProcedureName[trimedProcedureName.Length-1] == ')')\r
                                addParas = false;\r
                        \r
-                               AbstractDbParameter derivedParam = (AbstractDbParameter)derivedParams[curDerivedPos++];\r
-\r
+                               AbstractDbParameter derivedParam = (derivedParams.Count > 0) ? (AbstractDbParameter)derivedParams[curDerivedPos++] : null;\r
                                AbstractDbParameter returnValueParameter = GetReturnParameter (userParams);\r
                                if (returnValueParameter != null) {\r
 \r
index 3f7c330dbc270ec048e78ed9a6fe42279c2499f3..4de9619edfb7895464b5c39da826df8b42aaf423 100644 (file)
@@ -1,3 +1,7 @@
+2005-13-09 Boris Kirzner <borisk@mainsoft.com>
+       * AbstractDBCommand.cs: TARGET_JVM fix. Check for derived parameters
+       array length.
+
 2005-28-08 Boris Kirzner <borisk@mainsoft.com>
        * ReaderCache.cs: 
                - Create Guid from the string fetched.
index 39299580ea7175531d266343f48a826330e2bd7e..623991322a68644453f6f104d1cc5d4fc02acbd4 100644 (file)
@@ -1,3 +1,15 @@
+2005-09-14 Boris Kirzner <borisk@mainsoft.com>
+       * SqlConvert.cs: Fix SqlDbType to JDBC type convertion.
+
+2005-09-11 Boris Kirzner <borisk@mainsoft.com>
+       * SqlConvert.cs: Fix DbType to SqlDbType convertion.
+
+2005-09-05 Boris Kirzner <borisk@mainsoft.com>
+       * SqlConvert.cs: reimplemented ValueTypeToSqlDbType().
+       * SqlParameter.cs:
+               - Update of DbType should also update SqlDbType property. 
+               - Do not update parameter type is the value set is DbNull.
+
 2005-08-18  Boris Kirzner <borisk@mainsoft.com>
 
        * SqlCommand.cs: added GetReturnParameter method.
index 06e9ee021b813e5ce257e249b290fb260d6c7318..68e0009c5bcb65d1ba7eb9e6ffeb7918d5b70ff6 100644 (file)
@@ -82,43 +82,36 @@ namespace System.Data.SqlClient
 \r
                internal static SqlDbType ValueTypeToSqlDbType(Type type)\r
                {\r
-                       if (type.Equals(typeof(byte[]))) return  SqlDbType.VarBinary;\r
-                       if (type.Equals(typeof(bool))) return SqlDbType.Bit;\r
-//                             if (type.Equals(typeof(string))) return OleDbType.BSTR;\r
-//                             if (type.Equals(typeof(string))) return OleDbType.Char;\r
-//                             if (type.Equals(typeof(decimal))) return OleDbType.Currency;\r
-                       if (type.Equals(typeof(DateTime))) return SqlDbType.DateTime;\r
-//                             if (type.Equals(typeof(DateTime))) return OleDbType.DBDate;\r
-//                             if (type.Equals(typeof(TimeSpan))) return OleDbType.DBTime;\r
-//                             if (type.Equals(typeof(DateTime))) return OleDbType.DBTimeStamp;\r
-                       if (type.Equals(typeof(decimal))) return SqlDbType.Decimal;\r
-//                             if (type.Equals(typeof(int))) return OleDbType.Error;\r
-//                             if (type.Equals(typeof(DateTime))) return OleDbType.Filetime;\r
-                       if (type.Equals(typeof(Guid))) return SqlDbType.UniqueIdentifier;\r
-//                             if (type.Equals(typeof(short))) return OleDbType.TinyInt;\r
-                       if (type.Equals(typeof(short))) return SqlDbType.SmallInt;\r
-                       if (type.Equals(typeof(int))) return SqlDbType.Int;\r
-                       if (type.Equals(typeof(long))) return SqlDbType.BigInt;\r
-//                             if (type.Equals(typeof(object))) return OleDbType.IDispatch;\r
-//                             if (type.Equals(typeof(object))) return OleDbType.IUnknown;\r
-//                             if (type.Equals(typeof(byte[]))) return OleDbType.LongVarBinary;\r
-//                             if (type.Equals(typeof(string))) return OleDbType.LongVarChar;\r
-//                             if (type.Equals(typeof(decimal))) return OleDbType.Numeric;\r
-//                             if (type.Equals(typeof(object))) return OleDbType.PropVariant;\r
-                       if (type.Equals(typeof(float))) return SqlDbType.Float;\r
-                       if (type.Equals(typeof(double))) return SqlDbType.Float;\r
-                       if (type.Equals(typeof(byte))) return SqlDbType.TinyInt;\r
-//                             if (type.Equals(typeof(int))) return OleDbType.UnsignedSmallInt;\r
-//                             if (type.Equals(typeof(long))) return OleDbType.UnsignedInt;\r
-//                             if (type.Equals(typeof(decimal))) return OleDbType.UnsignedBigInt;\r
-//                             if (type.Equals(typeof(byte[]))) return OleDbType.VarBinary;\r
-                       if (type.Equals(typeof(string))) return SqlDbType.VarChar;\r
-                       if (type.Equals(typeof(object))) return SqlDbType.Variant;\r
-//                             if (type.Equals(typeof(decimal))) return OleDbType.VarNumeric;\r
-//                             if (type.Equals(typeof(string))) return OleDbType.WChar;\r
-//                             if (type.Equals(typeof(string))) return OleDbType.VarWChar;\r
-//                             if (type.Equals(typeof(string))) return OleDbType.LongVarWChar;\r
-                       return SqlDbType.Variant;\r
+                       switch (Type.GetTypeCode(type)) {\r
+                               case TypeCode.Boolean: return SqlDbType.Bit;\r
+                               case TypeCode.Byte: return SqlDbType.TinyInt;\r
+                               case TypeCode.Char: return SqlDbType.Char;\r
+                               case TypeCode.DateTime: return SqlDbType.DateTime;\r
+                               case TypeCode.DBNull: return SqlDbType.Variant;\r
+                               case TypeCode.Decimal: return SqlDbType.Decimal;\r
+                               case TypeCode.Double: return SqlDbType.Float;\r
+                               case TypeCode.Empty: return SqlDbType.Variant;\r
+                               case TypeCode.Int16: return SqlDbType.SmallInt;\r
+                               case TypeCode.Int32: return SqlDbType.Int;\r
+                               case TypeCode.Int64: return SqlDbType.BigInt;\r
+                               default:\r
+                               case TypeCode.Object: {\r
+                                       if (type.Equals(DbTypes.TypeOfByteArray)) return  SqlDbType.VarBinary;\r
+                                       //if (type.Equals(DbTypes.TypeOfTimespan)) return OleDbType.DBTime;\r
+                                       if (type.Equals(DbTypes.TypeOfGuid)) return SqlDbType.UniqueIdentifier;\r
+\r
+                                       if (type.IsEnum)\r
+                                               return ValueTypeToSqlDbType (Enum.GetUnderlyingType (type));\r
+\r
+                                       return SqlDbType.Variant;\r
+                               }\r
+                               case TypeCode.SByte: return SqlDbType.TinyInt;\r
+                               case TypeCode.Single: return SqlDbType.Float;\r
+                               case TypeCode.String: return SqlDbType.VarChar;\r
+                               case TypeCode.UInt16: return SqlDbType.SmallInt;\r
+                               case TypeCode.UInt32: return SqlDbType.Int;\r
+                               case TypeCode.UInt64: return SqlDbType.BigInt;\r
+                       }\r
                }\r
 \r
                internal static Type SqlDbTypeToValueType(SqlDbType sqlDbType)\r
@@ -160,6 +153,7 @@ namespace System.Data.SqlClient
                                case DbType.Byte : return SqlDbType.TinyInt;\r
                                case DbType.Boolean : return SqlDbType.Bit;\r
                                case DbType.Currency : return SqlDbType.Money;\r
+                               case DbType.Date : return SqlDbType.DateTime;\r
                                case DbType.DateTime : return SqlDbType.DateTime;\r
                                case DbType.Decimal : return SqlDbType.Decimal;\r
                                case DbType.Double : return SqlDbType.Float;\r
@@ -219,7 +213,7 @@ namespace System.Data.SqlClient
                                case SqlDbType.Binary : return Types.BINARY;\r
                                case SqlDbType.Bit : return Types.BIT;\r
                                case SqlDbType.Char : return Types.CHAR;\r
-                               case SqlDbType.DateTime : return Types.DATE;\r
+                               case SqlDbType.DateTime : return Types.TIMESTAMP;\r
                                case SqlDbType.Decimal : return Types.DECIMAL;\r
                                case SqlDbType.Float : return Types.FLOAT;\r
                                case SqlDbType.Image : return Types.LONGVARBINARY;\r
index 3a91f490e28c38feafc2c70bba9d81c101a9e848..ad7a32d9beea213b1e36f415521ca458602dec3c 100644 (file)
@@ -125,7 +125,7 @@ namespace System.Data.SqlClient
                public override DbType DbType\r
         {\r
             get { return SqlConvert.SqlDbTypeToDbType(_sqlDbType); }           \r
-                       set { _sqlDbType = SqlConvert.DbTypeToSqlDbType(value); }\r
+                       set { SqlDbType = SqlConvert.DbTypeToSqlDbType(value); }\r
         }                \r
         \r
         public SqlDbType SqlDbType\r
@@ -174,7 +174,7 @@ namespace System.Data.SqlClient
                {
                        get { return base.Value; }
                        set { 
-                               if (!_isDbTypeSet && (value != null)) {\r
+                               if (!_isDbTypeSet && (value != null) && (value != DBNull.Value)) {\r
                     _sqlDbType = SqlConvert.ValueTypeToSqlDbType(value.GetType());\r
                                }
                                base.Value = value; 
index 91156c07fd0ecaa196d10a38367849003c59a3e2..ae3fd3955ab48183d3fecafa6deb4bbcafdb9ebc 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-15  Raja R Harinath  <rharinath@novell.com>
+
+       * SqlString.cs (MoneyFormat): Move to SqlMoney.cs.
+       (operator SqlString) [SqlMoney variant]: Delegate to
+       SqlMoney.ToString ().
+       * SqlMoney.cs (MoneyFormat): Move from SqlString.cs.
+       (SqlString): New static constructor.
+       (ToString): Use it.
+
 2005-09-02 Umadevi S <sumadevi@novell.com>
 
        * SqlXml.cs : Added a dummy placeholder to compile MicrosoftServer namespace
index 1d9d10119850ee35c6b66d8282225705c68abcf5..42486698d1e3c25354d461cbb4f7f0592cd7cb75 100644 (file)
@@ -49,10 +49,19 @@ namespace System.Data.SqlTypes
                public static readonly SqlMoney Null;
                public static readonly SqlMoney Zero = new SqlMoney (0);
 
+               private static readonly NumberFormatInfo MoneyFormat;
+
                #endregion
 
                #region Constructors
 
+               static SqlMoney ()
+               {
+                       MoneyFormat = (NumberFormatInfo) NumberFormatInfo.InvariantInfo.Clone ();
+                       MoneyFormat.NumberDecimalDigits = 4;
+                       MoneyFormat.NumberGroupSeparator = String.Empty;
+               }
+
                public SqlMoney (decimal value) 
                {
                        if (value > 922337203685477.5807m || value < -922337203685477.5808m)
@@ -265,7 +274,7 @@ namespace System.Data.SqlTypes
                        if (!notNull)
                                return "Null";
                        else
-                               return value.ToString ();
+                               return value.ToString ("N", MoneyFormat);
                }
 
                public static SqlMoney operator + (SqlMoney x, SqlMoney y)
index 46f461afe12d98620fc0e8e407ffb4e08dbb33e4..7108b0b5d0167fa91369d60a39ac41c70ea1a089 100644 (file)
@@ -64,7 +64,6 @@ namespace System.Data.SqlTypes
                public static readonly int IgnoreWidth = 0x10;
                public static readonly SqlString Null;
 
-               internal static readonly NumberFormatInfo MoneyFormat;
                internal static NumberFormatInfo DecimalFormat;
                #endregion // Fields
 
@@ -72,10 +71,6 @@ namespace System.Data.SqlTypes
 
                static SqlString ()
                {
-                       MoneyFormat = (NumberFormatInfo) NumberFormatInfo.InvariantInfo.Clone ();
-                       MoneyFormat.NumberDecimalDigits = 4;
-                       MoneyFormat.NumberGroupSeparator = String.Empty;
-
                        DecimalFormat = (NumberFormatInfo) NumberFormatInfo.InvariantInfo.Clone ();
                        DecimalFormat.NumberDecimalDigits = 13;
                        DecimalFormat.NumberGroupSeparator = String.Empty;
@@ -233,21 +228,21 @@ namespace System.Data.SqlTypes
                         }
                 }
 
-               #endregion // Public Properties\r
-\r
-               #region Private Properties\r
-\r
-               private CompareOptions CompareOptions {\r
-                       get {\r
-                               return\r
-                                       (this.compareOptions & SqlCompareOptions.BinarySort) != 0 ?\r
-                                       CompareOptions.Ordinal :\r
-                                       // 27 == all SqlCompareOptions - BinarySort \r
-                                       // (1,2,8,24 are common to CompareOptions)\r
-                                       (CompareOptions)((int)this.compareOptions & 27);\r
-                       }\r
-               }\r
-\r
+               #endregion // Public Properties
+
+               #region Private Properties
+
+               private CompareOptions CompareOptions {
+                       get {
+                               return
+                                       (this.compareOptions & SqlCompareOptions.BinarySort) != 0 ?
+                                       CompareOptions.Ordinal :
+                                       // 27 == all SqlCompareOptions - BinarySort 
+                                       // (1,2,8,24 are common to CompareOptions)
+                                       (CompareOptions)((int)this.compareOptions & 27);
+                       }
+               }
+
                #endregion Private Properties
 
                #region Public Methods
@@ -602,8 +597,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.Value.ToString ());
-                               // return new SqlString (x.Value.ToString ("N", MoneyFormat));
+                               return new SqlString (x.ToString ());
                }
 
                public static explicit operator SqlString (SqlSingle x) 
index 8633d921da7dc39e33984394317c45118f2fd4ae..02390660b394799453aa6eb5e6719b7e9d8df759 100644 (file)
@@ -1,7 +1,7 @@
 <VisualStudioProject>\r
        <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{12CA069B-C324-48C1-9836-0014497A212C}">\r
                <Build>\r
-                       <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="System.Data" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="System.Data" RunPostBuildEvent="OnBuildSuccess" StartupObject="">\r
+                       <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="System.Data" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="$(ProjectDir)\jay.bat $(ProjectDir)" PostBuildEvent="" RootNamespace="System.Data" RunPostBuildEvent="OnBuildSuccess" StartupObject="">\r
                                <Config Name="Debug" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;ONLY_1_1;TRACE;DEBUG;DOTNET;TARGET_JVM;" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" NoStdLib="false" NoWarn="" Optimize="false" OutputPath="bin\Debug\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
                                <Config Name="Release" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;ONLY_1_1;TRACE;DOTNET;TARGET_JVM;" DocumentationFile="" DebugSymbols="false" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="" Optimize="true" OutputPath="bin\Release\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
                                <Config Name="Debug_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;ONLY_1_1;TRACE;DEBUG;DOTNET;TARGET_JVM;" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595" Optimize="false" OutputPath="bin\Debug_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
index 93a71735794a02e34b8638877c87347a9cf603fb..0e3301fef808a0cff089aaa1ca8152711dc23b99 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-20  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * DataView.cs (Sort): Apply default Sorting Order if Sort property
+       is reset to null. Sort property handles this. Patch from Marc.
+
+       * DataTable.cs (ParseSortString): Patch from  Marc Haisenko for
+       allowing [ & ] in DataView.Sort string.
+
 2005-09-01 Boris Kirzner <borisk@mainsoft.com>
        * System.Data/DataRowCollection.cs: indexes should be updated even if 
        EnforceConstraints is false. Check for EnforceConstraints in
index 1879666fd215fe5895adc3b93187c42b655768c8..03f71f003a79eb166dcd3112bb460623fa898f01 100644 (file)
@@ -1882,12 +1882,42 @@ namespace System.Data {
                                string[] columnExpression = sort.Trim ().Split (new char[1] {','});\r
                        \r
                                for (int c = 0; c < columnExpression.Length; c++) {\r
-                                       string[] columnSortInfo = columnExpression[c].Trim ().Split (new char[1] {' '});\r
+                                       string rawColumnName = columnExpression[c].Trim ();\r
+                                       string[] columnSortInfo;\r
+                                       \r
+                                       if (rawColumnName.StartsWith ("[") && (rawColumnName.IndexOf ("]") > 0)) {\r
+                                               // Column name is "escaped" a la "[Name with spaces]", so we can't\r
+                                               // split at spaces. We just split it manually. \r
+                                               int i = rawColumnName.LastIndexOf ("]"); \r
+\r
+                                               if (i + 1 < rawColumnName.Length) {\r
+                                                       // The "]" is not the last character which means we also have\r
+                                                       // an optional sort order... we extract that one and trim it.\r
+                                                       columnSortInfo = new String[2];\r
+                                                       columnSortInfo[1] = rawColumnName.Substring (i + 1,\r
+                                                               rawColumnName.Length - i - 1).Trim ();\r
+                                               } else {\r
+                                                       // The "]" is the last character, we don't have a sort order\r
+                                                       columnSortInfo = new String[1];\r
+                                               }\r
+\r
+                                               // Get everything between leading "[" and the LAST "]", no trimming !\r
+                                               columnSortInfo[0] = rawColumnName.Substring (1, i - 1);\r
+                                       } else {\r
+                                               // No column name "escaping", just split at spaces and trim just to\r
+                                               // be sure. \r
+                                               columnSortInfo = rawColumnName.Split (new char[1] {' '});\r
+\r
+                                               // Fix entries (trim strings)\r
+                                               for (int i = 0; i < columnSortInfo.Length; i++) {\r
+                                                       columnSortInfo[i] = columnSortInfo[i].Trim ();\r
+                                               }\r
+                                       }\r
                                \r
-                                       string columnName = columnSortInfo[0].Trim ();\r
+                                       string columnName = columnSortInfo[0];\r
                                        string sortOrder = "ASC";\r
                                        if (columnSortInfo.Length > 1) \r
-                                               sortOrder = columnSortInfo[1].Trim ().ToUpper (table.Locale);\r
+                                               sortOrder = columnSortInfo[1].ToUpper (table.Locale);\r
                                        \r
                                        ListSortDirection sortDirection = ListSortDirection.Ascending;\r
                                        switch (sortOrder) {\r
@@ -1898,29 +1928,22 @@ namespace System.Data {
                                                sortDirection = ListSortDirection.Descending;\r
                                                break;\r
                                        default:\r
-                                               throw new IndexOutOfRangeException ("Could not find column: " + columnExpression[c]);\r
-                                       }\r
-\r
-                                       if (columnName.StartsWith("[") || columnName.EndsWith("]")) {\r
-                                               if (columnName.StartsWith("[") && columnName.EndsWith("]"))\r
-                                                       columnName = columnName.Substring(1, columnName.Length - 2);\r
-                                               else\r
-                                                       throw new ArgumentException(String.Format("{0} isn't a valid Sort string entry.", columnName));\r
+                                               throw new IndexOutOfRangeException ("Could not find column: " + rawColumnName);\r
                                        }\r
 \r
                                        DataColumn dc = table.Columns[columnName];\r
                                        if (dc == null){\r
                                                try {\r
                                                        dc = table.Columns[Int32.Parse (columnName)];\r
-                                       }\r
-                                       catch (FormatException) {\r
+                                               } catch (FormatException) {\r
                                                        throw new IndexOutOfRangeException("Cannot find column " + columnName);\r
-                                       }\r
+                                               }\r
                                        }\r
 \r
                                        columns.Add (dc);\r
                                        sorts.Add(sortDirection);\r
-                               }       \r
+                               }\r
+\r
                                sortColumns = (DataColumn[]) columns.ToArray (typeof (DataColumn));\r
                                sortDirections = new ListSortDirection[sorts.Count];\r
                                for (int i = 0; i < sortDirections.Length; i++)\r
index 85faccdd26c302ef0ddb918cdbb03ae7424d4e36..70b4737f48248c6693333867362a4b29ce1e2567 100644 (file)
@@ -259,7 +259,13 @@ namespace System.Data
                [DataSysDescription ("Indicates the order in which data is returned by this DataView.")]\r
                [DefaultValue ("")]\r
                public string Sort {\r
-                       get { return sort; }\r
+                       get { \r
+                               if (useDefaultSort)\r
+                                       return String.Empty;\r
+                               else\r
+                                       return sort;\r
+                       }\r
+\r
                        set {\r
                                if (isInitPhase) {\r
                                        initSort = value;\r
@@ -268,7 +274,7 @@ namespace System.Data
                                if (value == sort)\r
                                        return;\r
 \r
-                               if (value == null) {    \r
+                               if ((value == null) || (value.Equals (String.Empty))) { \r
                                /* if given value is null useDefaultSort */\r
                                        useDefaultSort = true;\r
                                        /* if ApplyDefault sort is true try appling it */\r
index 87fcaab9c248cbf7a7c81c9b41f622b2e18a1a1f..3509e2a29dfd925becb7b97cbe3bea09a24ab773 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-16  Senganal T  <tsenganal@novell.com>
+
+       * System.Data.Connected.Tests.dll.sources: added more source files 
+
+2005-09-13  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * Makefile: Added reference to Sybase db.
+
 2005-09-01  Sureshkumar T  <tsureshkumar@novell.com>
 
        * System.Data.Connected.Tests.dll.sources: source files.
index 63d82ce27129404e62833a54242422094fc46831..c24b8564794afcf6ff66945d2e9b71dbea0db29b 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-16  Senganal T  <tsenganal@novell.com>
+
+       * DataProvider.cs : Provides data for validation
+
+       DataProvider provides the data that is used for
+       validating Sq[DataReader. Currently it uses a dataset
+       to fill data from the database. Will be modified later to
+       get the values from a config file.
+
 2005-09-01  Sureshkumar T  <tsureshkumar@novell.com>
 
        * DBHelper.cs: Added. Class to provide helper methods for other tests.
diff --git a/mcs/class/System.Data/Test/ProviderTests/Common/DataProvider.cs b/mcs/class/System.Data/Test/ProviderTests/Common/DataProvider.cs
new file mode 100644 (file)
index 0000000..592130b
--- /dev/null
@@ -0,0 +1,70 @@
+//
+// DataProvider.cs  - Holds the data used for Validating Reader Classes
+// Author:
+//      Senganal T (tsenganal@novell.com)
+//
+// Copyright (c) 2004 Novell 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.
+//
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace MonoTests.System.Data
+{
+       public class DataProvider {
+
+               private DataSet data = null ; 
+
+               // TODO : The Data is now got from the Database.
+               // Needs to be modified to get the data from a config file
+               public DataProvider ()
+               {
+                       data = new DataSet ();
+                       string query = "Select * from numeric_family order by id ASC;";
+                       query += "Select * from string_family order by id ASC;";
+                       query += "Select * from binary_family order by id ASC;";
+                       query += "Select * from datetime_family order by id ASC;";
+
+                       SqlDataAdapter adapter = new SqlDataAdapter (query,
+                                       ConnectionManager.Singleton.ConnectionString);  
+                       adapter.TableMappings.Add ("Table", "numeric_family");
+                       adapter.TableMappings.Add ("Table1", "string_family");
+                       adapter.TableMappings.Add ("Table2", "binary_family");
+                       adapter.TableMappings.Add ("Table3", "datetime_family");
+
+                       data.Tables.Add ("numeric_family");
+                       data.Tables.Add ("string_family");
+                       data.Tables.Add ("binary_family");
+                       data.Tables.Add ("datetime_family");
+                       adapter.Fill (data);
+               }
+
+               public DataSet GetDataSet ()
+               {
+                       return data ;
+               }
+       }
+}
+
index aeb7224e96ad4e43f1c5fd6cd946c0552246723d..3cb1edba0a37aa699ccba3f7da97546be9139b2d 100644 (file)
@@ -3,7 +3,7 @@ thisdir=class/System.Data/Test/ProviderTests
 
 include ../../../../build/rules.make
 
-LIB_MCS_FLAGS = /r:System.Data,System.Data.OracleClient,ByteFX.Data,Npgsql,System,System.Xml,nunit.framework,Mono.Data
+LIB_MCS_FLAGS = /r:System.Data,System.Data.OracleClient,ByteFX.Data,Npgsql,System,System.Xml,nunit.framework,Mono.Data,Mono.Data.SybaseClient
 
 DATABASE=sql92
 
index 1b414512c5680a9d3ddb0c67c303b861167f9aa7..04ea16a08cc857c833c777b4ee953645ff8c8a15 100644 (file)
@@ -1,5 +1,6 @@
 Common/ConnectionManager.cs
 Common/DBHelper.cs
+Common/DataProvider.cs
 System.Data.Odbc/OdbcCommandBuilderTest.cs
 System.Data.Odbc/OdbcCommandTest.cs
 System.Data.Odbc/OdbcDataReaderTest.cs
@@ -12,3 +13,5 @@ System.Data.SqlClient/SqlCommandTest.cs
 System.Data.SqlClient/SqlDataReaderTest.cs
 System.Data.SqlClient/SqlDataAdapterTest.cs
 System.Data.SqlClient/SqlTransactionTest.cs
+System.Data.SqlClient/SqlConnectionTest.cs
+
index 155e8884489f64fc3aa44ce1d35730c1c06acd5c..4c8da99165b9abe25433ca4ed28a6f12af732834 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-16 Senganal T  <tsenganal@novell.com>
+
+       * SqlCommandTest.cs: added more testcases for connected mode
+       * SqlConnectionTest.cs: added more testcases for connected mode
+       * SqlDataAdapterTest.cs: added more testcases for connected mode
+       * SqlDataReaderTest.cs: added more testcases for connected mode
+
 2005-09-01  Sureshkumar T  <tsureshkumar@novell.com>
 
        * SqlCommandBuilderTest.cs: added tests for SqlCommandBuilder
@@ -10,4 +17,3 @@
 
        Added attribute Category ("sqlserver") to all these test fixtures.
 
-
index 7180bd2f038cc424769dfa5e1eeb1d8f8e1c8621..5aebd7030989d5a410c9c9b5a89f0c42359434aa 100644 (file)
@@ -4,6 +4,7 @@
 // Author:
 //      Umadevi S (sumadevi@novell.com)
 //     Sureshkumar T (tsureshkumar@novell.com)
+//     Senganal T (tsenganal@novell.com)
 //
 // Copyright (c) 2004 Novell Inc., and the individuals listed
 // on the ChangeLog entries.
@@ -42,7 +43,515 @@ namespace MonoTests.System.Data.SqlClient
        public class SqlCommandTest 
        {
 
-               public SqlConnection conn;
+               public SqlConnection conn = null ;
+               SqlCommand cmd = null;
+               string connectionString = ConnectionManager.Singleton.ConnectionString;
+
+               [SetUp]
+               public void Setup ()
+               {
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       if (conn != null)
+                               conn.Close ();
+               }
+
+               [Test]
+               public void ConstructorTest ()
+               {
+                       // Test Default Constructor 
+                       cmd = new SqlCommand ();
+                       Assert.AreEqual (String.Empty, cmd.CommandText,
+                                "#1 Command Test should be empty");
+                       Assert.AreEqual (30, cmd.CommandTimeout, 
+                               "#2 CommandTimeout should be 30");
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, 
+                               "#3 CommandType should be text");
+                       Assert.IsNull (cmd.Connection, "#4 Connection Should be null");
+                       Assert.AreEqual (0, cmd.Parameters.Count,
+                               "#5 Parameter shud be empty");
+
+                       // Test Overloaded Constructor 
+                       String cmdText = "select * from tbl1" ;
+                       cmd = new SqlCommand (cmdText);
+                       Assert.AreEqual (cmdText, cmd.CommandText,
+                               "#5 CommandText should be the same as passed");
+                       Assert.AreEqual (30, cmd.CommandTimeout,
+                               "#6 CommandTimeout should be 30");
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType,
+                               "#7 CommandType should be text");
+                       Assert.IsNull (cmd.Connection , "#8 Connection Should be null");
+                       
+                       // Test Overloaded Constructor 
+                       SqlConnection conn = new SqlConnection ();
+                       cmd = new SqlCommand (cmdText , conn);
+                       Assert.AreEqual (cmdText, cmd.CommandText,
+                               "#9 CommandText should be the same as passed");
+                       Assert.AreEqual (30, cmd.CommandTimeout,
+                               "#10 CommandTimeout should be 30");
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType,
+                               "#11 CommandType should be text");
+                       Assert.AreSame (cmd.Connection, conn, "#12 Connection Should be same"); 
+
+                       // Test Overloaded Constructor 
+                       SqlTransaction trans = null ; 
+                       try {
+                               conn = new SqlConnection (connectionString);
+                               conn.Open ();
+                               trans = conn.BeginTransaction ();
+                               cmd = new SqlCommand (cmdText, conn, trans); 
+                               Assert.AreEqual (cmdText, cmd.CommandText,
+                                       "#9 CommandText should be the same as passed");
+                               Assert.AreEqual (30, cmd.CommandTimeout,
+                                       "#10 CommandTimeout should be 30");
+                               Assert.AreEqual (CommandType.Text, cmd.CommandType,
+                                       "#11 CommandType should be text");
+                               Assert.AreEqual (cmd.Connection, conn,
+                                       "#12 Connection Should be null");       
+                               Assert.AreEqual (cmd.Transaction, trans,
+                                        "#13 Transaction Property should be set");
+                               
+                               // Test if parameters are reset to Default Values       
+                               cmd = new SqlCommand ();
+                               Assert.AreEqual (String.Empty, cmd.CommandText,
+                                       "#1 Command Test should be empty");
+                               Assert.AreEqual (30, cmd.CommandTimeout,
+                                       "#2 CommandTimeout should be 30");
+                               Assert.AreEqual (CommandType.Text, cmd.CommandType,
+                                       "#3 CommandType should be text");
+                               Assert.IsNull (cmd.Connection, "#4 Connection Should be null");
+                       }finally {
+                               trans.Rollback ();
+                       }
+               }
+
+               [Test]
+               public void ExecuteScalarTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       cmd = new SqlCommand ("" , conn);
+                       cmd.CommandText = "Select count(*) from numeric_family where id<=4";
+
+                       //Check Exception is thrown when executed on a closed connection 
+                       try {
+                               cmd.ExecuteScalar ();
+                               Assert.Fail ("#1 InvalidOperation Exception must be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#2 Incorrect Exception : " + e.StackTrace);
+                       }
+
+                       // Check the Return value for a Correct Query 
+                       object result = 0;
+                       conn.Open ();
+                       result = cmd.ExecuteScalar ();
+                       Assert.AreEqual (4, (int)result, "#3 Query Result returned is incorrect");
+
+                       cmd.CommandText = "select id , type_bit from numeric_family order by id asc" ;
+                       result = Convert.ToInt32 (cmd.ExecuteScalar ());
+                       Assert.AreEqual (1, result,
+                               "#4 ExecuteScalar Should return (1,1) the result set" );
+
+                       cmd.CommandText = "select id from numeric_family where id=-1";
+                       result = cmd.ExecuteScalar ();
+                       Assert.IsNull (result, "#5 Null shud be returned if result set is empty");
+
+                       // Check SqlException is thrown for Invalid Query 
+                       cmd.CommandText = "select count* from numeric_family";
+                       try {
+                               result = cmd.ExecuteScalar ();
+                               Assert.Fail ("#6 InCorrect Query should cause an SqlException");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(SqlException), e.GetType(),
+                                       "#7 Incorrect Exception : " + e.StackTrace);
+                       }
+               }
+
+               [Test]
+               public void ExecuteNonQuery ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       cmd = new SqlCommand ("", conn);
+                       int result = 0;
+
+                       // Test for exceptions
+                       // Test exception is thrown if connection is closed
+                       cmd.CommandText = "Select id from numeric_family where id=1";
+                       try {
+                               cmd.ExecuteNonQuery ();
+                               Assert.Fail ("#1 Connextion shud be open"); 
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#2 Incorrect Exception : " + e);
+                       }
+                       
+                       // Test Exception is thrown if Query is incorrect 
+                       conn.Open ();
+                       cmd.CommandText = "Select id1 from numeric_family";
+                       try {
+                               cmd.ExecuteNonQuery (); 
+                               Assert.Fail ("#1 invalid Query");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(SqlException), e.GetType(),
+                                       "#2 Incorrect Exception : " + e);
+                       }
+
+                       // Test Select/Insert/Update/Delete Statements 
+                       SqlTransaction trans = conn.BeginTransaction ();
+                       cmd.Transaction = trans; 
+
+                       try {
+                               cmd.CommandText = "Select id from numeric_family where id=1";
+                               result = cmd.ExecuteNonQuery ();
+                               Assert.AreEqual (-1, result, "#1");
+
+                               cmd.CommandText = "Insert into numeric_family (id,type_int) values (100,200)";
+                               result = cmd.ExecuteNonQuery ();
+                               Assert.AreEqual (1, result, "#2 One row shud be inserted");
+
+                               cmd.CommandText = "Update numeric_family set type_int=300 where id=100";
+                               result = cmd.ExecuteNonQuery ();
+                               Assert.AreEqual (1, result, "#3 One row shud be updated");
+
+                               cmd.CommandText = "Delete from numeric_family where id=100";
+                               result = cmd.ExecuteNonQuery ();
+                               Assert.AreEqual (1, result, "#4 One row shud be deleted");
+
+                       }finally {
+                               trans.Rollback ();
+                       }
+               }
+
+               [Test]
+               public void ExecuteReaderTest ()
+               {
+                       SqlDataReader reader = null; 
+                       conn = new SqlConnection (connectionString);
+
+                       // Test exception is thrown if conn is closed
+                       cmd = new SqlCommand ("Select count(*) from numeric_family");
+                       try {
+                               reader = cmd.ExecuteReader ();
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#1 Incorrect Exception");
+                       }
+
+                       conn.Open ();
+                       // Test exception is thrown for Invalid Query
+                       cmd = new SqlCommand ("InvalidQuery", conn);
+                       try {
+                               reader = cmd.ExecuteReader ();
+                               Assert.Fail ("#1 Exception shud be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(SqlException), e.GetType (),
+                                       "#2 Incorrect Exception : " + e);
+                       }
+                       
+                       // NOTE         
+                       // Test SqlException is thrown if a row is locked 
+                       // should lock a particular row and then modify it
+                       /*
+                       */
+       
+                       // Test Connection  cannot be modified when reader is in use
+                       // NOTE : msdotnet contradicts documented behavior      
+                       cmd.CommandText = "select * from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       conn.Close (); // valid operation 
+                       conn = new SqlConnection (connectionString);
+
+                       /*
+                       // NOTE msdotnet contradcits documented behavior 
+                       // If the above testcase fails, then this shud be tested        
+                       // Test connection can be modified once reader is closed
+                       conn.Close ();
+                       reader.Close ();
+                       conn = new SqlConnection (connectionString); // valid operation 
+                       */
+               }
+
+               [Test]
+               public void ExecuteReaderCommandBehaviorTest ()
+               {
+                       // Test for command behaviors   
+                       DataTable schemaTable = null; 
+                       SqlDataReader reader = null; 
+
+                       conn = new SqlConnection (connectionString);
+                       conn.Open ();
+                       cmd = new SqlCommand ("", conn);
+                       cmd.CommandText = "Select id from numeric_family where id <=4 order by id asc;";
+                       cmd.CommandText += "Select type_bit from numeric_family where id <=4 order by id asc";
+
+                       // Test for default command behavior    
+                       reader = cmd.ExecuteReader ();
+                       int rows = 0; 
+                       int results = 0;
+                       do {
+                               while (reader.Read ())
+                                       rows++ ; 
+                               Assert.AreEqual (4, rows, "#1 Multiple rows shud be returned");
+                               results++; 
+                               rows = 0;
+                       }while (reader.NextResult());
+                       Assert.AreEqual (2, results, "#2 Multiple result sets shud be returned");
+                       reader.Close ();
+
+                       // Test if closing reader, closes the connection 
+                       reader = cmd.ExecuteReader (CommandBehavior.CloseConnection);
+                       reader.Close ();
+                       Assert.AreEqual (ConnectionState.Closed, conn.State,
+                               "#3 Command Behavior is not followed");
+                       conn.Open(); 
+
+                       // Test if row info and primary Key info is returned
+                       reader = cmd.ExecuteReader (CommandBehavior.KeyInfo);
+                       schemaTable = reader.GetSchemaTable ();
+                       Assert.IsTrue(reader.HasRows, "#4 Data Rows shud also be returned");
+                       Assert.IsTrue ((bool)schemaTable.Rows[0]["IsKey"],
+                               "#5 Primary Key info shud be returned");
+                       reader.Close ();        
+
+                       // Test only column information is returned 
+                       reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly);
+                       schemaTable = reader.GetSchemaTable ();
+                       Assert.IsFalse (reader.HasRows, "#6 row data shud not be returned");
+                       Assert.AreEqual(DBNull.Value, schemaTable.Rows[0]["IsKey"],
+                               "#7 Primary Key info shud not be returned");
+                       Assert.AreEqual ("id", schemaTable.Rows[0]["ColumnName"],
+                               "#8 Schema Data is Incorrect");
+                       reader.Close ();
+
+                       // Test only one result set (first) is returned 
+                       reader = cmd.ExecuteReader (CommandBehavior.SingleResult);
+                       schemaTable = reader.GetSchemaTable ();
+                       Assert.IsFalse (reader.NextResult(), 
+                               "#9 Only one result set shud be returned");
+                       Assert.AreEqual ("id", schemaTable.Rows[0]["ColumnName"],
+                               "#10 The result set returned shud be the first result set");
+                       reader.Close ();
+
+                       // Test only one row is returned for all result sets 
+                       // msdotnet doesnt work correctly.. returns only one result set
+                       reader = cmd.ExecuteReader (CommandBehavior.SingleRow);
+                       rows=0;
+                       results=0;
+                       do {
+                               while (reader.Read ())
+                                       rows++ ; 
+                               Assert.AreEqual (1, rows, "#11 Only one row shud be returned");
+                               results++; 
+                               rows = 0;
+                       }while (reader.NextResult());
+                       // NOTE msdotnet contradicts documented behavior.
+                       // Multiple result sets shud be returned , and in this case : 2 
+                       //Assert.AreEqual (2, results, "# Multiple result sets shud be returned");
+                       Assert.AreEqual (2, results, "#12 Multiple result sets shud be returned");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void PrepareTest_CheckValidStatement ()
+               {
+                       cmd = new SqlCommand ();
+                       conn = new SqlConnection (connectionString);
+                       conn.Open ();
+                       
+                       cmd.CommandText = "Select id from numeric_family where id=@ID" ; 
+                       cmd.Connection = conn ; 
+
+                       // Test if Parameters are correctly populated 
+                       cmd.Parameters.Clear ();
+                       cmd.Parameters.Add ("@ID", SqlDbType.TinyInt);
+                       cmd.Parameters["@ID"].Value = 2 ;
+                       cmd.Prepare ();
+                       Assert.AreEqual (2, cmd.ExecuteScalar (), "#3 Prepared Stmt not working");
+
+                       cmd.Parameters[0].Value = 3;
+                       Assert.AreEqual (3, cmd.ExecuteScalar (), "#4 Prep Stmt not working");
+                       conn.Close ();
+               }
+
+               [Test]
+               public void PrepareTest ()
+               {
+                       cmd = new SqlCommand ();
+                       conn = new SqlConnection (connectionString);
+                       conn.Open ();
+                       
+                       cmd.CommandText = "Select id from numeric_family where id=@ID" ; 
+                       cmd.Connection = conn ; 
+
+                       // Test InvalidOperation Exception is thrown if Parameter Type
+                       // is not explicitly set
+                       cmd.Parameters.Add ("@ID", 2);
+                       try {
+                               cmd.Prepare ();
+                               Assert.Fail ("#1 Parameter Type shud be explicitly Set");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType (),
+                                       "#2 Incorrect Exception : " + e.StackTrace);
+                       }
+
+                       // Test Exception is thrown for variable size data  if precision/scale
+                       // is not set
+                       cmd.CommandText = "select type_varchar from string_family where type_varchar=@p1";
+                       cmd.Parameters.Clear ();
+                       cmd.Parameters.Add ("@p1", SqlDbType.VarChar);
+                       cmd.Parameters["@p1"].Value = "afasasadadada";
+                       try {
+                               cmd.Prepare ();
+                               Assert.Fail ("#5 Exception shud be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#6 Incorrect Exception " + e.StackTrace);
+                       }
+
+                       // Test Exception is not thrown for Stored Procs 
+                       try {
+                               cmd.CommandType = CommandType.StoredProcedure;
+                               cmd.CommandText = "ABFSDSFSF" ;
+                               cmd.Prepare ();
+                       }catch (Exception e) {
+                               Assert.Fail ("#7 Exception shud not be thrown for Stored Procs");
+                       }
+                       cmd.CommandType = CommandType.Text;     
+                       conn.Close ();
+
+                       //Test InvalidOperation Exception is thrown if connection is not set
+                       cmd.Connection = null; 
+                       try {
+                               cmd.Prepare ();
+                               Assert.Fail ("#8 InvalidOperation Exception shud be thrown");
+                       }catch (AssertionException e) {
+                               throw e; 
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#9 Incorrect Exception : " + e.StackTrace);
+                       }
+
+                       //Test InvalidOperation Exception is thrown if connection is closed
+                       cmd.Connection = conn ;
+                       try{
+                               cmd.Prepare ();
+                               Assert.Fail ("#4 InvalidOperation Exception shud be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "Incorrect Exception : " + e.StackTrace);
+                       }
+               }
+
+               [Test]
+               public void ResetTimeOut ()
+               {
+                       SqlCommand cmd = new SqlCommand ();
+                       cmd.CommandTimeout = 50 ;
+                       Assert.AreEqual ( cmd.CommandTimeout, 50,
+                               "#1 CommandTimeout should be modfiable"); 
+                       cmd.ResetCommandTimeout ();
+                       Assert.AreEqual (cmd.CommandTimeout, 30,
+                               "#2 Reset Should set the Timeout to default value");
+               }
+
+               [Test]
+               [ExpectedException (typeof(ArgumentException))]
+               public void CommandTimeout ()
+               {
+                       cmd = new SqlCommand ();
+                       cmd.CommandTimeout = 10; 
+                       Assert.AreEqual (10, cmd.CommandTimeout, "#1");
+                       cmd.CommandTimeout = -1;
+               }
+               
+               [Test]
+               [ExpectedException (typeof(ArgumentException))]
+               public void CommandTypeTest ()
+               {
+                       cmd = new SqlCommand ();
+                       Assert.AreEqual (CommandType.Text ,cmd.CommandType,
+                               "Default CommandType is text");
+                       cmd.CommandType = (CommandType)(-1);    
+               }
+               
+               [Test]
+               [Ignore ("msdotnet contradicts documented behavior")]
+               [ExpectedException (typeof(InvalidOperationException))]
+               public void ConnectionTest ()
+               {
+                       SqlTransaction trans = null; 
+                       try {
+                               conn = new SqlConnection (connectionString);
+                               conn.Open ();
+                               trans = conn.BeginTransaction ();
+                               cmd = new SqlCommand ("", conn,trans);
+                               cmd.CommandText = "Select id from numeric_family where id=1";
+                               cmd.Connection = new SqlConnection ();
+                       }finally {
+                               trans.Rollback();
+                               conn.Close ();
+                       }
+               }
+               
+               [Test]
+               public void TransactionTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       cmd = new SqlCommand ("", conn);
+                       Assert.IsNull (cmd.Transaction, "#1 Default value is null");
+               
+                       SqlConnection conn1 = new SqlConnection (connectionString);
+                       conn1.Open ();
+                       SqlTransaction trans1 = conn1.BeginTransaction ();
+                       cmd.Transaction = trans1 ; 
+                       try {
+                               cmd.ExecuteNonQuery (); 
+                               Assert.Fail ("#2 Connection cannot be different");
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#3 Incorrect Exception : " + e);
+                       }finally {
+                               conn1.Close ();
+                               conn.Close ();
+                       }
+               }
+
+               // Need to add more tests
+               [Test]
+               [ExpectedException (typeof(ArgumentException))]
+               public void UpdatedRowSourceTest ()
+               {
+                       cmd = new SqlCommand ();
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource,
+                               "#1 Default value is both");
+                       cmd.UpdatedRowSource = UpdateRowSource.None;    
+                       Assert.AreEqual (UpdateRowSource.None, cmd.UpdatedRowSource,
+                               "#2");
+
+                       cmd.UpdatedRowSource = (UpdateRowSource) (-1);
+               }
 
                [Test]
                public void ExecuteNonQueryTempProcedureTest () {
@@ -146,7 +655,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                private readonly string CREATE_TMP_SP_TEMP_INSERT_PERSON = ("create procedure #sp_temp_insert_employee ( " + Environment.NewLine + 
-                                                                           "@fname varchar (20), " + Environment.NewLine + 
+                                                                           "@fname varchar (20)) " + Environment.NewLine + 
                                                                            "as " + Environment.NewLine + 
                                                                            "begin" + Environment.NewLine + 
                                                                            "declare @id int;" + Environment.NewLine + 
@@ -161,3 +670,4 @@ namespace MonoTests.System.Data.SqlClient
                                                                          "drop procedure #sp_temp_insert_employee; ");
        }
 }
+
diff --git a/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs b/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs
new file mode 100644 (file)
index 0000000..7f22718
--- /dev/null
@@ -0,0 +1,549 @@
+//
+// SqlDataAdapterTest.cs - NUnit Test Cases for testing the
+//                          SqlDataAdapter class
+// Author:
+//      Senganal T (tsenganal@novell.com)
+//
+// Copyright (c) 2004 Novell 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.
+//
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using System.Net;
+using NUnit.Framework;
+using System.Collections;
+
+namespace MonoTests.System.Data
+{
+       [TestFixture]
+       [Category ("sqlserver")]
+       public class SqlConnectionTest
+       {
+               SqlConnection conn = null ; 
+               String connectionString = ConnectionManager.Singleton.ConnectionString;
+
+               ArrayList invalidConnectionStrings = null;
+               int stateChangeEventCount = 0;
+               int disposedEventCount = 0;
+               int infoMessageEventCount = 0;
+
+               void populateTestData () 
+               {
+                       invalidConnectionStrings = new ArrayList ();
+                       // shud be got from  a config file .. 
+                       //list of invalid and valid conn strings; 
+                       invalidConnectionStrings.Add ("InvalidConnectionString");
+                       invalidConnectionStrings.Add ("invalidKeyword=10");
+                       invalidConnectionStrings.Add ("Packet Size=511");
+                       invalidConnectionStrings.Add ("Packet Size=32768");
+                       invalidConnectionStrings.Add ("Connect Timeout=-1");                    
+                       invalidConnectionStrings.Add ("Max Pool Size=-1");
+                       invalidConnectionStrings.Add ("Min Pool Size=-1");                              
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       if (conn != null)
+                               conn.Dispose ();
+               }
+
+               [Test]
+               public void DefaultConstructorTest ()
+               {
+                       SqlConnection conn = new SqlConnection ();  
+                       Assert.AreEqual ("", conn.ConnectionString, 
+                                       "#1 Default Connection String should be empty");
+                       Assert.AreEqual (15, conn.ConnectionTimeout, 
+                                       "#2 Default ConnectionTimeout should be 15" ); 
+                       Assert.AreEqual ("", conn.Database, 
+                                       "#3 Default Database should be empty");
+                       Assert.AreEqual ("", conn.DataSource,
+                                       "#4 Default DataSource should be empty");
+                       Assert.AreEqual (8192, conn.PacketSize,"#5 Default Packet Size is 8192");
+                       Assert.AreEqual (Dns.GetHostName(), conn.WorkstationId, 
+                                       "#6 Default Workstationid shud be hostname");
+                       Assert.AreEqual (ConnectionState.Closed, conn.State, 
+                                       "#7 Connection State shud be closed by default");
+               }
+
+               [Test]
+               public void OverloadedConstructorTest ()
+               {
+                       // Test Exceptions are thrown for Invalid Connection Strings
+                       int count=0 ;
+                       populateTestData ();
+                       foreach (String invalidConnString in invalidConnectionStrings) {
+                               count++;
+                               try {
+                                       conn = new SqlConnection ((string)invalidConnString);
+                                       Assert.Fail ("#1 Exception must be thrown");
+                               }catch (AssertionException e) {
+                                       throw e; 
+                               }catch (Exception e) {
+                                       Assert.AreEqual (typeof(ArgumentException), e.GetType(), 
+                                               "Incorrect Exception" + e.StackTrace);
+                               }
+                       }
+
+                       //check synonyms..
+                       //do i need to check for all the synonyms.. 
+                       conn = new SqlConnection (
+                                       "Timeout=10;Connect Timeout=20;Connection Timeout=30");
+                       Assert.AreEqual (30, conn.ConnectionTimeout,
+                               "## The last set value shud be taken");
+                       conn = new SqlConnection (
+                                       "Connect Timeout=100;Connection Timeout=200;Timeout=300");
+                       Assert.AreEqual (300, conn.ConnectionTimeout,
+                               "## The last set value shud be taken");
+                       conn = new SqlConnection (
+                                       "Connection Timeout=1000;Timeout=200$0;Connect Timeout=3000");
+                       Assert.AreEqual (3000, conn.ConnectionTimeout,
+                               "## The last set value shud be taken");
+
+                       // Test if properties are set correctly
+                       
+                       //'==' doesent work correctly in both msdotnet and mono
+                       /*
+                       conn = new SqlConnection ("server=local==host;database=tmp;");
+                       Assert.AreEqual ("local==host", conn.DataSource, 
+                               "# Datasource name is set incorrectly");
+                       */
+                       string connStr = "Server='loca\"lhost';Database='''Db'; packet Size=\"512\";";
+                       connStr += "connect Timeout=20;Workstation Id=\"'\"\"desktop\";";
+                       conn = new SqlConnection (connStr);
+                       Assert.AreEqual (connStr , conn.ConnectionString , "#1");
+                       Assert.AreEqual ("loca\"lhost" , conn.DataSource , "#2");
+                       Assert.AreEqual ("'Db" , conn.Database , "#3");
+                       Assert.AreEqual (512 , conn.PacketSize , "#4");
+                       Assert.AreEqual (20 , conn.ConnectionTimeout , "#5");
+                       Assert.AreEqual ("'\"desktop" , conn.WorkstationId , "#6");
+                       Assert.AreEqual (ConnectionState.Closed , conn.State , "#7");
+               }
+
+               [Test]
+               public void OpenTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       ArrayList validIncorrectConnStrings = new ArrayList();
+                       string validConnString = connectionString;
+
+                       validIncorrectConnStrings.Add (
+                                       validConnString+"user id=invalidLogin");
+                       validIncorrectConnStrings.Add (
+                                       validConnString+"database=invalidDB");
+                       validIncorrectConnStrings.Add (
+                                       validConnString+";password=invalidPassword");
+                       validIncorrectConnStrings.Add (
+                                       validConnString+";server=invalidServerName");
+
+                       int count=0;
+                       foreach (string connString in validIncorrectConnStrings) {
+                               count++;
+                               try {
+                                       conn.ConnectionString = connString;
+                                       conn.Open();
+                                       Assert.AreEqual (typeof (SqlException), null,
+                                               string.Format (
+                                                       "#1_{0} Incorrect Connection String",count));                           
+                               }catch (AssertionException e) {
+                                       throw e;
+                               }catch (Exception e) {
+                                       Assert.AreEqual (typeof (SqlException), e.GetType (),
+                                               "#2 Incorrect Exception" + e.StackTrace);
+                               }
+                       }
+                       
+                       // Test connection is Opened for a valid Connection String
+                       conn.ConnectionString = connectionString; 
+                       conn.Open ();
+                       Assert.AreEqual (ConnectionState.Open, conn.State,
+                               "#3 Connection State Should be OPEN");
+
+                       // Test Exception is thrown on opening an OPEN Connection 
+                       try {
+                               conn.Open ();
+                               Assert.AreEqual (typeof (InvalidOperationException), null,
+                                       "#1 Connection is Already Open");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType (),
+                                        "#2 Incorect Exception."); 
+                       }
+                       conn.Close();                           
+
+                       /*
+                       // Test if localhost is assumed when servername is empty/missing
+                       // NOTE : msdotnet contradicts doc
+
+                       Assumes the server is localhost .. need to test this with mono on windows 
+                       conn.ConnectionString = connectionString + "server=;";
+                       try {
+                               conn.Open ();
+                       }catch (Exception e) {
+                               Assert.Fail ("## If server name is not given or empty ,localhost shud be tried");
+                       }
+                       ex = null; 
+                       conn.Close ();
+                        */
+               }
+
+               [Test]
+               public void CreateCommandTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       IDbCommand cmd = conn.CreateCommand ();
+                       Assert.AreSame (conn, cmd.Connection,
+                               "#1 Connection instance should be the same");
+               }
+
+               [Test]
+               public void CloseTest ()
+               {       
+                       conn = new SqlConnection (connectionString);
+                       conn.Open ();
+                       Assert.AreEqual (ConnectionState.Open, conn.State,
+                               "#1 Connection State should be : Open");
+                       conn.Close ();
+                       Assert.AreEqual (ConnectionState.Closed, conn.State,
+                               "#1 Connection State Should : Closed");
+                       // Test Closing an already closed connection is Valid..
+                       conn.Close ();
+               }
+
+               [Test]
+               public void DisposeTest ()
+               {
+                       SqlConnection conn = new SqlConnection (connectionString);
+                       conn.Dispose ();
+                       Assert.AreEqual ("", conn.ConnectionString, 
+                               "#1 Dispose shud make the Connection String empty");
+                       Assert.AreEqual (15, conn.ConnectionTimeout, 
+                               "#2 Default ConnectionTimeout : 15" ); 
+                       Assert.AreEqual ("", conn.Database,
+                               "#3 Default Database : empty");
+                       Assert.AreEqual ("", conn.DataSource, 
+                               "#4 Default DataSource : empty");
+                       Assert.AreEqual (8192, conn.PacketSize, 
+                               "#5 Default Packet Size : 8192");
+                       Assert.AreEqual (Dns.GetHostName(), conn.WorkstationId, 
+                               "#6 Default Workstationid : hostname");
+                       Assert.AreEqual (ConnectionState.Closed, conn.State, 
+                               "#7 Default State : CLOSED ");
+               }
+
+               [Test]
+               public void ChangeDatabaseTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       String database = conn.Database;
+
+                       //Test if exception is thrown if connection is closed
+                       try {
+                               conn.ChangeDatabase ("database");
+                               Assert.AreEqual (typeof (InvalidOperationException), null,
+                                       "#1 Connection is Closed");
+                       }catch (AssertionException e){
+                               throw e; 
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof (InvalidOperationException), e.GetType(),
+                                       "#2 Incorrect Exception : " + e.StackTrace);
+                       }
+
+                       //Test if exception is thrown for invalid Database Names 
+                       //need to add more to the list 
+                       conn.Open ();
+                       String[] InvalidDatabaseNames = {"", null, "       "};
+                       for (int i = 0; i < InvalidDatabaseNames.Length ; ++i) {
+                               try {
+                                       conn.ChangeDatabase (InvalidDatabaseNames[i]);
+                                       Assert.AreEqual (typeof (ArgumentException), null,
+                                               string.Format ("#3_{0} Exception not thrown",i));
+                               }catch (AssertionException e) {
+                                       throw e;
+                               }catch (Exception e) {
+                                       Assert.AreEqual (typeof(ArgumentException), e.GetType (),
+                                               string.Format( "#4_{0} Incorrect Exception : {1}",
+                                                       i, e.StackTrace));
+                               }
+                               Assert.AreEqual (database, conn.Database,
+                                       "#4 The Database shouldnt get changed if Operation Failed");
+                       }
+                       
+                       //Test if exception is thrown if database name is non-existent
+                       try {
+                               conn.ChangeDatabase ("invalidDB");
+                               Assert.Fail ("#5 Exception must be thrown if database doesent exist");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(SqlException), e.GetType (),
+                                       "#6 Incorrect Exception" + e.StackTrace);
+                       }
+                       conn.Close (); 
+
+                       //Test if '-' is a valid character in a database name
+                       //TODO : Check for database names that have more special Characters..
+                       conn.ConnectionString = connectionString;
+                       conn.Open ();
+                       try {
+                               conn.ChangeDatabase ("mono-test");
+                               Assert.AreEqual ("mono-test", conn.Database,
+                                       "#7 Database name should be mono-test");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e){
+                               Assert.Fail ("#8 Unexpected Exception : DB Name can have a '-' : "
+                                        + e);
+                       }
+               }
+
+               [Test]
+               public void BeginTransactionTest()
+               {
+                       conn = new SqlConnection (connectionString);
+                       SqlTransaction trans = null ;
+
+                       try {
+                               trans = conn.BeginTransaction ();
+                               Assert.Fail ("#1 Connection must be Open to Begin a Transaction");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof (InvalidOperationException), e.GetType(),
+                                       "#2 Incorrect Exception" + e.StackTrace);
+                       }
+
+                       conn.Open ();
+                       trans = conn.BeginTransaction ();
+                       Assert.AreSame (conn, trans.Connection, 
+                                       "#3 Transaction should reference the same connection");
+                       Assert.AreEqual (IsolationLevel.ReadCommitted, trans.IsolationLevel,
+                                       "#4 Isolation Level shud be ReadCommitted");
+                       trans.Rollback ();
+
+                       try {
+                               trans = conn.BeginTransaction ();
+                               trans = conn.BeginTransaction ();
+                               conn.BeginTransaction ();
+                               Assert.Fail ("#5 Parallel Transactions are not supported");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#6 Incorrect Exception" + e.StackTrace); 
+                       }finally {
+                               trans.Rollback();
+                       }
+
+                       try {
+                               trans = conn.BeginTransaction ();
+                               trans.Rollback ();
+                               trans = conn.BeginTransaction ();
+                               trans.Commit();
+                               trans = conn.BeginTransaction ();
+                       }catch (Exception e) {
+                               Assert.Fail ("#7 Transaction can be opened after a rollback/commit");
+                       }finally {
+                               trans.Rollback ();
+                       }
+               }
+
+               [Test]
+               public void ConnectionStringPropertyTest ()
+               {
+                       conn = new SqlConnection (connectionString) ;
+                       // Test Repeated Keyoword ..Should take the latest value 
+                       conn.ConnectionString = conn.ConnectionString + ";server=RepeatedServer;" ;
+                       Assert.AreEqual ("RepeatedServer", ((SqlConnection)conn).DataSource,
+                                       "#1 if keyword is repeated, the latest value should be taken");
+                       conn.ConnectionString += ";database=gen;Initial Catalog=gen1";
+                       Assert.AreEqual ("gen1", conn.Database,
+                                       "#2 database and initial catalog are synonyms .. ");
+
+                       // Test if properties are set correctly 
+                       string str = "server=localhost1;database=db;user id=user;";
+                       str += "password=pwd;Workstation ID=workstation;Packet Size=512;";
+                       str += "Connect Timeout=10";
+                       conn.ConnectionString = str;
+
+                       Assert.AreEqual ("localhost1", conn.DataSource,
+                                       "#3 DataSource name should be same as passed");
+                       Assert.AreEqual ("db", conn.Database,
+                                       "#4 Database name shud be same as passed");
+                       Assert.AreEqual (ConnectionState.Closed, conn.State,
+                                       "#5 Connection shud be in closed state");
+                       Assert.AreEqual ("workstation", conn.WorkstationId,
+                                       "#6 Workstation Id shud be same as passed");
+                       Assert.AreEqual (512, conn.PacketSize,
+                                       "#7 Packetsize shud be same as passed");
+                       Assert.AreEqual (10, conn.ConnectionTimeout,
+                                       "#8 ConnectionTimeout shud be same as passed");
+                       
+                       // Test if any leftover values exist from previous invocation. 
+                       conn.ConnectionString = connectionString;
+                       conn.ConnectionString = "";
+                       Assert.AreEqual ("", conn.DataSource,
+                                       "#9 Datasource shud be reset to Default : Empty");
+                       Assert.AreEqual ("", conn.Database, 
+                                       "#10 Database shud reset to Default : Empty");
+                       Assert.AreEqual (8192, conn.PacketSize, 
+                                       "#11 Packetsize shud be reset to Default : 8192");
+                       Assert.AreEqual (15, conn.ConnectionTimeout, 
+                                       "#12 ConnectionTimeour shud be reset to Default : 15");
+                       Assert.AreEqual (Dns.GetHostName (), conn.WorkstationId,
+                                       "#13 WorkstationId shud be reset to Default : Hostname");
+                       
+                       // Test Argument Exception is thrown for Invalid Connection Strings
+                       foreach (string connString in invalidConnectionStrings) {
+                               try {
+                                       conn.ConnectionString = connString;
+                                       Assert.Fail (
+                                               "#14 Exception should be thrown");
+                               }catch (AssertionException e){
+                                       throw e;
+                               }catch (Exception e) {
+                                       Assert.AreEqual (typeof (ArgumentException), e.GetType(),
+                                               "#15 Incorrect Exception" + e.StackTrace);
+                               }
+                       }
+
+                       // Test if ConnectionString is read-only when Connection is OPEN
+                       conn.ConnectionString = connectionString;
+                       conn.Open() ;
+                       try {
+                               Assert.AreEqual (conn.State, ConnectionState.Open,
+                                               "#16 Connection shud be open");
+                               conn.ConnectionString =  "server=localhost;database=tmp;" ;
+                               Assert.Fail (
+                                       "#17 ConnectionString should Read-Only when Connection is Open");
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#18 Incorrect Exception" + e.StackTrace); 
+                       }
+                       conn.Close ();
+               }
+
+               [Test]
+               public void ServerVersionTest ()
+               {       
+                       conn = new SqlConnection (connectionString);
+
+                       // Test InvalidOperation Exception is thrown if Connection is CLOSED
+                       try{
+                               string s = conn.ServerVersion;
+                               Assert.Fail (
+                                       "#1 InvalidOperation Exception Must be thrown if conn is closed");
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual(typeof (InvalidOperationException), e.GetType (),
+                                       "#2 Incorrect Exception" + e.StackTrace);
+                       }
+                       
+                       // Test if Release Version is as per specification.
+                       conn.Open ();
+                       String[] version = conn.ServerVersion.Split ('.') ;
+                       Assert.AreEqual (2, version[0].Length,
+                               "#2 The Major release shud be exactly 2 characters");
+                       Assert.AreEqual (2, version[1].Length,
+                               "#3 The Minor release shud be exactly 2 characters");
+                       Assert.AreEqual (4, version[2].Length,
+                               "#4 The Release version should be exactly 4 digits");
+               }
+
+               [Test]
+               public void DatabasePropertyTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+
+                       // Test if database property is updated when a query changes database
+                       conn.Open ();
+                       SqlCommand cmd = new SqlCommand ("use [mono-test]" , conn);
+                       cmd.ExecuteNonQuery ();
+                       Assert.AreEqual ("mono-test", conn.Database,
+                               "#1 DATABASE name shud change if query changes the db");
+                       conn.Close ();
+                       Assert.AreEqual ("monotest", conn.Database,
+                               "#2 Shud be back to default value");
+
+                       // Test if the database property is reset on re-opening the connection
+                       conn.ConnectionString = connectionString;
+                       conn.Open ();   
+                       Assert.AreEqual ("monotest", conn.Database,
+                               "#3 Shud be back to original value");
+                       conn.Close ();
+               }
+
+               [Test]
+               public void StateChangeEventTest () 
+               {
+                       conn = new SqlConnection (connectionString);
+                       conn.StateChange += new StateChangeEventHandler (
+                                                       StateChangeHandlerTest1);
+                       using (conn) {
+                               conn.Open ();
+                       }
+                       Assert.AreEqual (2, stateChangeEventCount,
+                               "#1 The handler shud be called twice");
+                       stateChangeEventCount =0 ; 
+                       conn.StateChange -= new StateChangeEventHandler (
+                                                       StateChangeHandlerTest1);
+                       // NOTE : Need to check  the behavior if an exception is raised 
+                       // in a handler 
+               }
+
+               [Test]
+               public void DisposedEventTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       conn.Disposed += new EventHandler (DisposedEventHandlerTest1);
+                       conn.Dispose ();
+                       Assert.AreEqual (1, disposedEventCount,
+                                "#1 Disposed eventhandler shud be called");
+               }
+
+               void StateChangeHandlerTest1 (object sender , StateChangeEventArgs e)
+               {
+                       Assert.IsTrue ((e.CurrentState != e.OriginalState),
+                               "#1 Current and Original state shud be different");
+                       Assert.AreEqual (e.CurrentState, conn.State,
+                               "The conn state and the arg received in event shud be same");
+                       stateChangeEventCount++ ;
+               }
+
+               void DisposedEventHandlerTest1 (object sender , EventArgs e)
+               {
+                       disposedEventCount++; 
+               }
+       }
+}
index 6121b4a924a1bd1572a9cfa3adb963950059d57f..1b1d7e248a8b83f06725fe2d58e79284e8f09d1e 100644 (file)
@@ -4,6 +4,7 @@
 // Author:
 //      Umadevi S (sumadevi@novell.com)
 //     Sureshkumar T (tsureshkumar@novell.com)
+//     Senganal T (tsenganal@novell.com)
 //
 // Copyright (c) 2004 Novell Inc., and the individuals listed
 // on the ChangeLog entries.
@@ -42,7 +43,10 @@ namespace MonoTests.System.Data.SqlClient
        [Category ("sqlserver")]
        public class SqlDataAdapterTest
        {
-               SqlConnection conn;
+               SqlDataAdapter adapter =null; 
+               DataSet data = null ;
+               string  connectionString = ConnectionManager.Singleton.ConnectionString;
+               SqlConnection conn = null; 
 
                [Test]
                /**
@@ -72,25 +76,6 @@ namespace MonoTests.System.Data.SqlClient
                        }
                }
 
-               [Test]
-               public void FillSchemaTest() 
-               {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       try {
-                               ConnectionManager.Singleton.OpenConnection ();
-                               string sql = "select * from employee;";
-                               SqlCommand c = conn.CreateCommand();
-                               c.CommandText = sql;
-                               SqlDataReader dr = c.ExecuteReader(CommandBehavior.KeyInfo|CommandBehavior.SchemaOnly);
-                               DataTable schema = dr.GetSchemaTable();
-                               DataRowCollection drc = schema.Rows;
-                               DataRow r = drc[0];
-                               Assert.AreEqual("id",r["ColumnName"].ToString());
-                       } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
-                       }
-               }
-
                /**
                   This needs a errortable created as follows 
                   id uniqueidentifier,name char(10) , with values
@@ -121,10 +106,527 @@ namespace MonoTests.System.Data.SqlClient
                        Assert.AreEqual("Done","Done");
                                        
                }
+
+               [Test]
+               public void DefaultConstructorTest ()
+               {
+                       adapter = new SqlDataAdapter ();
+                       Assert.AreEqual (MissingMappingAction.Passthrough,
+                               adapter.MissingMappingAction,
+                               "#1 Missing Mapping acttion default to Passthrough");
+                       Assert.AreEqual (MissingSchemaAction.Add,
+                               adapter.MissingSchemaAction,
+                               "#2 Missing Schme action default to Add");
+               }
+
+               [Test]
+               public void OverloadedConstructorsTest ()
+               {
+                       SqlCommand selCmd = new SqlCommand ("Select * from numeric_family");
+                       adapter = new SqlDataAdapter (selCmd);
+                       Assert.AreEqual (MissingMappingAction.Passthrough,
+                               adapter.MissingMappingAction,
+                               "#1 Missing Mapping acttion default to Passthrough");
+                       Assert.AreEqual (MissingSchemaAction.Add,
+                               adapter.MissingSchemaAction,
+                               "#2 Missing Schme action default to Add");
+                       Assert.AreSame (selCmd, adapter.SelectCommand,
+                               "#3 Select Command shud be a ref to the arg passed");
+                       
+                       conn = new SqlConnection (connectionString);
+                       String selStr = "Select * from numeric_family";
+                       adapter = new SqlDataAdapter (selStr, conn);
+                       Assert.AreEqual (MissingMappingAction.Passthrough,
+                               adapter.MissingMappingAction,
+                               "#4 Missing Mapping acttion default to Passthrough");
+                       Assert.AreEqual (MissingSchemaAction.Add,
+                               adapter.MissingSchemaAction,
+                               "#5 Missing Schme action default to Add");
+                       Assert.AreSame (selStr, adapter.SelectCommand.CommandText,
+                               "#6 Select Command shud be a ref to the arg passed");
+                       Assert.AreSame (conn, adapter.SelectCommand.Connection,
+                               "#7 cmd.connection shud be t ref to connection obj");
+
+                       selStr = "Select * from numeric_family";
+                       adapter = new SqlDataAdapter (selStr, connectionString);
+                       Assert.AreEqual (MissingMappingAction.Passthrough,
+                               adapter.MissingMappingAction,
+                               "#8 Missing Mapping action shud default to Passthrough");
+                       Assert.AreEqual (MissingSchemaAction.Add,
+                               adapter.MissingSchemaAction,
+                               "#9 Missing Schema action shud default to Add");
+                       Assert.AreSame (selStr,
+                               adapter.SelectCommand.CommandText,
+                               "#10");
+                       Assert.AreEqual (connectionString,
+                               adapter.SelectCommand.Connection.ConnectionString,
+                               "#11  ");
+               }
+               [Test]
+               public void Fill_Test_ConnState ()
+               {
+                       //Check if Connection State is maintained correctly .. 
+                       data = new DataSet ("test1");
+                       adapter = new SqlDataAdapter ("select id from numeric_family where id=1",
+                                        connectionString);
+                       SqlCommand cmd = adapter.SelectCommand ; 
+
+                       Assert.AreEqual (ConnectionState.Closed,
+                               cmd.Connection.State, "#1 Connection shud be in closed state");
+                       adapter.Fill (data);
+                       Assert.AreEqual (1, data.Tables.Count, "#2 One table shud be populated");
+                       Assert.AreEqual (ConnectionState.Closed, cmd.Connection.State,
+                               "#3 Connection shud be closed state");
+
+                       data = new DataSet ("test2");
+                       cmd.Connection.Open ();
+                       Assert.AreEqual (ConnectionState.Open, cmd.Connection.State,
+                               "#3 Connection shud be open");
+                       adapter.Fill (data);
+                       Assert.AreEqual (1, data.Tables.Count, "#4 One table shud be populated");
+                       Assert.AreEqual (ConnectionState.Open, cmd.Connection.State,
+                               "#5 Connection shud be open");
+                       cmd.Connection.Close ();
  
-       
-       
+                       // Test if connection is closed when exception occurs
+                       cmd.CommandText = "select id1 from numeric_family";
+                       try {
+                               adapter.Fill (data);
+                       }catch (Exception e) {
+                               if (cmd.Connection.State == ConnectionState.Open) {
+                                       cmd.Connection.Close ();
+                                       Assert.Fail ("# Connection Shud be Closed");
+                               }
+                       }
+               }
+
+               [Test]
+               public void Fill_Test_Data ()
+               {
+                       //Check if a table is created for each resultset 
+                       String batchQuery = "Select id,type_bit,type_int from numeric_family;";
+                       batchQuery += "Select type_bit,type_bigint from numeric_family";
+                       adapter = new SqlDataAdapter (batchQuery, connectionString);
+                       data = new DataSet ("test1");
+                       adapter.Fill (data);
+                       Assert.AreEqual (2, data.Tables.Count,"#1 2 Table shud be created");
+                               
+                       //Check if Table and Col are named correctly for unnamed columns 
+                       string query = "Select 10,20 from numeric_family;" ;
+                       query += "Select 10,20 from numeric_family";
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test2");
+                       adapter.Fill (data);
+                       Assert.AreEqual (2, data.Tables.Count,
+                               "#2 2 Tables shud be created");
+                       Assert.AreEqual ("Table", data.Tables[0].TableName, "#3");
+                       Assert.AreEqual ("Table1", data.Tables[1].TableName, "#4");
+                       Assert.AreEqual ("Column1", data.Tables[0].Columns[0].ColumnName, "#5");
+                       Assert.AreEqual ("Column2", data.Tables[0].Columns[1].ColumnName, "#6");
+                       Assert.AreEqual ("Column1", data.Tables[1].Columns[0].ColumnName, "#7");
+                       Assert.AreEqual ("Column2", data.Tables[1].Columns[1].ColumnName, "#8");
+
+                       //Check if dup columns are named correctly
+                       query = "select A.id ,B.id , C.id from numeric_family A, ";
+                       query += "numeric_family B , numeric_family C";
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test3");
+                       adapter.Fill (data);
+
+                       // NOTE msdotnet contradicts documented behavior
+                       // as per documentation the column names should be 
+                       // id1,id2,id3 .. but msdotnet returns id,id1,id2
+                       Assert.AreEqual ("id", data.Tables[0].Columns[0].ColumnName,
+                               "#9 if colname is duplicated ,shud be col,col1,col2 etc");
+                       Assert.AreEqual ("id1", data.Tables[0].Columns[1].ColumnName,
+                               "#10 if colname is duplicated ,shud be col,col1,col2 etc");
+                       Assert.AreEqual ("id2", data.Tables[0].Columns[2].ColumnName,
+                               "#11 if colname is duplicated ,shud be col,col1,col2 etc");
 
+                       // Test if tables are created and named accordingly ,
+                       // but only for those queries returning result sets
+                       query = "update numeric_family set id=100 where id=50;";
+                       query += "select * from numeric_family";
+                       adapter = new SqlDataAdapter (query, connectionString); 
+                       data = new DataSet ("test4");
+                       adapter.Fill (data);
+                       Assert.AreEqual (1 ,data.Tables.Count,
+                               "#12 Tables shud be named only for queries returning a resultset");
+                       Assert.AreEqual ("Table", data.Tables[0].TableName,
+                               "#13 The first resutlset shud have 'Table' as its name");
+
+                       // Test behavior with an outerjoin
+                       query = "select A.id,B.type_bit from numeric_family A LEFT OUTER JOIN "; 
+                       query += "numeric_family B on A.id = B.type_bit"; 
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test5");
+                       adapter.Fill (data);
+                       Assert.AreEqual (0, data.Tables[0].PrimaryKey.Length,
+                               "#14 Primary Key shudnt be set if an outer join is performed");
+                       Assert.AreEqual (0, data.Tables[0].Constraints.Count,
+                               "#15 Constraints shudnt be set if an outer join is performed");
+                       adapter = new SqlDataAdapter ("select id from numeric_family",
+                                       connectionString);
+                       data = new DataSet ("test6");
+                       adapter.Fill (data, 1, 1, "numeric_family");
+                       Assert.AreEqual (1, data.Tables[0].Rows.Count, "#16"); 
+                       Assert.AreEqual (2, data.Tables[0].Rows[0][0], "#17");
+
+                       // only one test for DataTable.. DataSet tests covers others  
+                       adapter = new SqlDataAdapter ("select id from numeric_family",
+                                       connectionString);
+                       DataTable table = new DataTable ("table1");
+                       adapter.Fill (table);
+                       Assert.AreEqual (4, table.Rows.Count , "#18");
+               }
+               
+               [Test]
+               public void Fill_Test_PriKey ()
+               {             
+                       // Test if Primary Key & Constraints Collection is correct 
+                       adapter = new SqlDataAdapter ("select id,type_bit from numeric_family", 
+                                       connectionString);
+                       adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
+                       data = new DataSet ("test1");
+                       adapter.Fill (data);
+                       Assert.AreEqual (1, data.Tables[0].PrimaryKey.Length,
+                               "#1 Primary Key shud be set");
+                       Assert.AreEqual (1, data.Tables[0].Constraints.Count,
+                               "#2 Constraints shud be set");
+                       Assert.AreEqual (4, data.Tables[0].Rows.Count,
+                               "#3 No Of Rows shud be 4");
+               
+                       // Test if data is correctly merged 
+                       adapter.Fill (data);
+                       Assert.AreEqual (4, data.Tables[0].Rows.Count,
+                               "#4 No of Row shud still be 4");
+
+                       // Test if rows are appended  and not merged 
+                       // when primary key is not returned in the result-set
+                       string query = "Select type_int,type_bigint from numeric_family";
+                       adapter.SelectCommand.CommandText = query;
+                       data = new DataSet ("test2");
+                       adapter.Fill (data);
+                       Assert.AreEqual (4, data.Tables[0].Rows.Count,
+                               "#5 No of Rows shud be 4");
+                       adapter.Fill (data);
+                       Assert.AreEqual (8, data.Tables[0].Rows.Count,
+                               "#6 No of Rows shud double now");
+               }
+       
+               [Test]
+               public void Fill_Test_Exceptions ()
+               {
+                       adapter = new SqlDataAdapter ("select * from numeric_family",
+                                       connectionString);
+                       data = new DataSet ("test1");
+                       try {
+                               adapter.Fill (data, -1, 0, "numeric_family");
+                               Assert.Fail ("#1 Exception shud be thrown:Incorrect Arguments"); 
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual (typeof(ArgumentException), e.GetType(),
+                                       "#2 Incorrect Exception : "  + e);
+                       }
+
+                       // conn is not closed due to a bug..
+                       // can be removed later 
+                       adapter.SelectCommand.Connection.Close (); 
+
+                       try {
+                               adapter.Fill (data , 0 , -1 , "numeric_family");
+                               Assert.Fail ("#3 Exception shud be thrown:Incorrect Arguments"); 
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual (typeof(ArgumentException), e.GetType(),
+                                       "#4 Incorrect Exception : "  + e);
+                       }
+                       // conn is curr not closed.. can be removed later 
+                       adapter.SelectCommand.Connection.Close ();  
+
+                       /*
+                       // NOTE msdotnet contradicts documented behavior
+                       // InvalidOperationException is expected if table is not valid  
+                       try {
+                               adapter.Fill (data , 0 , 0 , "invalid_talbe_name");
+                       }catch (InvalidOperationException e) {
+                               ex= e;
+                       }catch (Exception e){
+                               Assert.Fail ("#5 Exception shud be thrown : incorrect arugments ");
+                       }
+                       Assert.IsNotNull (ex , "#6 Exception shud be thrown : incorrect args ");
+                       adapter.SelectCommand.Connection.Close (); // tmp .. can be removed once the bug if fixed
+                       ex=null;
+                       */
+
+                       // NOTE msdotnet contradicts documented behavior
+                       // SystemException is expected when Dataset is invalid 
+                       // but msdotnet throws ArgumentNullException
+                       try {
+                               adapter.Fill ( null , 0 , 0 , "numeric_family");
+                               Assert.Fail ( "#7 Exception shud be thrown : Invalid Dataset");
+                       }catch (AssertionException e){
+                               throw e ;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(SystemException), e.GetType(),
+                                       "#8 Incorrect Exception : " + e);
+                       }
+                       // conn is currently not being closed.. 
+                       //need to be removed once behavior is fixed 
+                       adapter.SelectCommand.Connection.Close (); 
+
+                       adapter.SelectCommand.Connection = null; 
+                       try { 
+                               adapter.Fill (data);
+                               Assert.Fail ("#9 Exception shud be thrown : Invalid Connection");
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#10 Incorrect Exception : " + e);
+                       }
+               }
+
+               [Test]
+               public void GetFillParametersTest ()
+               {
+                       string query = "select id, type_bit from numeric_family where id > @param1";
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       IDataParameter[] param = adapter.GetFillParameters ();
+                       Assert.AreEqual (0, param.Length, "#1 size shud be 0");
+                       
+                       SqlParameter param1 = new SqlParameter ();
+                       param1.ParameterName = "@param1";
+                       param1.Value = 2;
+                       adapter.SelectCommand.Parameters.Add (param1);
+               
+                       param = adapter.GetFillParameters ();
+                       Assert.AreEqual (1, param.Length, "#2 count shud be 1");
+                       Assert.AreEqual (param1, param[0], "#3 Params shud be equal");
+               }
+               
+               [Test]
+               public void FillSchemaTest ()
+               {
+                       string query = "";      
+
+                       // Test if connection is closed if excepton occurs during fill schema 
+                       query = "select * from invalid_table"; 
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test");
+                       try {
+                               adapter.FillSchema (data , SchemaType.Source);
+                       }catch (Exception e){
+                               if ( adapter.SelectCommand.Connection.State != ConnectionState.Closed)
+                               {
+                                       Assert.Fail ("#0 Conn shud be closed if exception occurs");
+                                       adapter.SelectCommand.Connection.Close();
+                               }
+                       }
+               
+                       // Test Primary Key is set (since primary key column returned)  
+                       query = "select id, type_int from numeric_family where id=1";   
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test1");
+                       adapter.FillSchema (data , SchemaType.Source);
+
+                       Assert.AreEqual (1, data.Tables[0].PrimaryKey.Length,
+                               "#1 Primary Key property must be set");
        
+                       // Test Primary Key is not set (since primary key column is returned)   
+                       query = "select type_bit, type_int from numeric_family where id=1";     
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test2");
+                       adapter.FillSchema (data, SchemaType.Source);
+                       Assert.AreEqual (0, data.Tables[0].PrimaryKey.Length,
+                               "#2 Primary Key property should not be set");
+
+                       // Test multiple tables are created for a batch query
+                       query = "Select id ,type_bit from numeric_family;" ;
+                       query += "Select id,type_bit,type_int from numeric_family;"; 
+                       data = new DataSet ("test3");
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       adapter.FillSchema (data , SchemaType.Source);
+                       Assert.AreEqual (2 , data.Tables.Count , "#3 A table shud be created for each Result Set");
+                       Assert.AreEqual (2 , data.Tables[0].Columns.Count , "#4 should have 2 columns");
+                       Assert.AreEqual (3 , data.Tables[1].Columns.Count , "#5 Should have 3 columns");
+
+                       // Test if table names and column names  are filled correctly
+                       query = "select 10,20 from numeric_family;" ;
+                       query += "select 10,20 from numeric_family;";
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test4");
+                       try {
+                               adapter.FillSchema (data , SchemaType.Source);
+                       }catch (Exception e){
+                               Assert.Fail ("#3 Unexpected Exception : " + e); 
+                       }
+                       Assert.AreEqual ( "Table", data.Tables[0].TableName);
+                       Assert.AreEqual ( "Table1", data.Tables[1].TableName);
+                       Assert.AreEqual ( "Column1", data.Tables[0].Columns[0].ColumnName,
+                               "#6 Unnamed col shud be named as 'ColumnN'");
+                       Assert.AreEqual ( "Column2", data.Tables[0].Columns[1].ColumnName,
+                               "#7 Unnamed col shud be named as 'ColumnN'");
+                       Assert.AreEqual ( "Column1", data.Tables[1].Columns[0].ColumnName,
+                               "#8 Unnamed col shud be named as 'ColumnN'");
+                       Assert.AreEqual ( "Column2", data.Tables[1].Columns[1].ColumnName,
+                               "#9 Unnamed col shud be named as 'ColumnN'");
+                       Assert.AreEqual (ConnectionState.Closed, adapter.SelectCommand.Connection.State,
+                               "#10 Connection shud be closed");
+                       
+                       // Test if mapping works correctly  
+                       // doesent work in both mono and msdotnet
+                       // gotto check if something is wrong 
+                       /*
+                       query = "select id,type_bit from numeric_family";  
+                       adapter = new SqlDataAdapter (query, connectionString);
+                       data = new DataSet ("test");
+                       DataTable table = data.Tables.Add ("numeric_family_1");
+                       table.Columns.Add ("id");
+                       table.Columns.Add ("type_bit");
+                       DataTableMapping map = adapter.TableMappings.Add("numeric_family_1",
+                                                       "numeric_family");
+                       map.ColumnMappings.Add ("id", "id_1");
+                       map.ColumnMappings.Add ("type_bit", "type_bit_1");
+                       adapter.FillSchema (data, SchemaType.Source, "numeric_family");
+                       foreach (DataTable tab in data.Tables){
+                               Console.WriteLine ("Table == {0}",tab.TableName);
+                               foreach (DataColumn col in tab.Columns)
+                                       Console.WriteLine (" Col = {0} " , col.ColumnName);
+                       }                       
+                       */
+               }
+
+               [Test]
+               public void MissingSchemaActionTest ()
+               {
+                       adapter = new SqlDataAdapter (
+                                       "select id,type_bit,type_int from numeric_family where id<=4",
+                                        connectionString);
+                       data = new DataSet ();
+                       Assert.AreEqual (MissingSchemaAction.Add, adapter.MissingSchemaAction,
+                                        "#1 Default Value");
+
+                       adapter.Fill (data);
+                       Assert.AreEqual (1, data.Tables.Count , "#1 One table shud be populated");
+                       Assert.AreEqual (3, data.Tables[0].Columns.Count, "#2 Missing cols are added");
+                       Assert.AreEqual (0, data.Tables[0].PrimaryKey.Length, "#3 Default Value");
+
+                       adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
+                       data.Reset();
+                       adapter.Fill (data);
+                       Assert.AreEqual (3, data.Tables[0].Columns.Count,
+                               "#4 Missing cols are added");
+                       Assert.AreEqual (1, data.Tables[0].PrimaryKey.Length, "#5 Default Value");
+
+                       adapter.MissingSchemaAction = MissingSchemaAction.Ignore ;
+                       data.Reset ();
+                       adapter.Fill (data);
+                       Assert.AreEqual (0, data.Tables.Count, "#6 Data shud be ignored");
+                       
+                       adapter.MissingSchemaAction = MissingSchemaAction.Error ; 
+                       data.Reset();
+                       try {
+                               adapter.Fill (data);
+                               Assert.Fail ("#8 Exception shud be thrown: Schema Mismatch");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#9 Incorrect Exception : "+e); 
+                       }
+               
+                       // Test for invalid MissingSchema Value         
+                       try {
+                               adapter.MissingSchemaAction = (MissingSchemaAction)(-5000);
+                               Assert.Fail ("#10 Exception shud be thrown: Invalid Value");
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual (typeof(ArgumentException), e.GetType(),
+                                       "#11 Incorrect Exception : " +e);
+                       }
+                       
+                       // Tests if Data is filled correctly if schema is defined 
+                       // manually and MissingSchemaAction.Error is set 
+                       adapter.MissingSchemaAction = MissingSchemaAction.Error;
+                       data.Reset();
+                       DataTable table = data.Tables.Add ("Table");
+                       table.Columns.Add ("id");
+                       table.Columns.Add ("type_bit");
+                       table.Columns.Add ("type_int");
+                       try {
+                               adapter.Fill (data);
+                               Assert.AreEqual (1, data.Tables.Count, "#12");
+                               Assert.AreEqual (4, data.Tables[0].Rows.Count, "#13");
+                       }catch (Exception e) {
+                               Assert.Fail ("#12 Unexpected Exception : " + e);
+                       }
+               }
+               
+               [Test]
+               public void MissingMappingActionTest ()
+               {
+                       adapter = new SqlDataAdapter ("select id,type_bit from numeric_family where id=1",
+                                       connectionString);
+                       data = new DataSet ();
+                       Assert.AreEqual (adapter.MissingMappingAction,
+                               MissingMappingAction.Passthrough,
+                               "#1 Default Value");
+                       adapter.Fill(data);
+                       Assert.AreEqual (1, data.Tables.Count,
+                               "#2 One Table shud be created");
+                       Assert.AreEqual (2, data.Tables[0].Columns.Count,
+                               "#3 Two Cols shud be created");
+
+                       adapter.MissingMappingAction = MissingMappingAction.Ignore;
+                       data.Reset ();
+                       adapter.Fill (data);
+                       Assert.AreEqual (0, data.Tables.Count, "#4 No table shud be created");
+                       
+                       adapter.MissingMappingAction = MissingMappingAction.Error;
+                       data.Reset ();
+                       try {
+                               adapter.Fill (data);
+                               Assert.Fail ("#5 Exception shud be thrown : Mapping is missing");
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#6 Incorrect Exception : " + e);
+                       }
+
+                       try {
+                               adapter.MissingMappingAction = (MissingMappingAction)(-5000);
+                               Assert.Fail ("#7 Exception shud be thrown : Invalid Value");
+                       }catch (AssertionException e){
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual (typeof(ArgumentException), e.GetType(),
+                                       "#8 Incorrect Exception : " +e); 
+                       }
+               
+                       // Test if mapping the column and table names works correctly   
+                       adapter.MissingMappingAction = MissingMappingAction.Error;
+                       data.Reset ();
+                       DataTable table = data.Tables.Add ("numeric_family_1");
+                       table.Columns.Add ("id_1");
+                       table.Columns.Add ("type_bit_1");
+                       table.Columns.Add ("type_int_1");
+                       DataTableMapping tableMap = adapter.TableMappings.Add ("numeric_family",
+                                                        "numeric_family_1");
+                       tableMap.ColumnMappings.Add ("id", "id_1");
+                       tableMap.ColumnMappings.Add ("type_bit", "type_bit_1");
+                       tableMap.ColumnMappings.Add ("type_int", "type_int_1");
+                       adapter.Fill (data,"numeric_family");
+                       Assert.AreEqual (1, data.Tables.Count ,
+                               "#8 The DataTable shud be correctly mapped");
+                       Assert.AreEqual (3, data.Tables[0].Columns.Count,
+                               "#9 The DataColumns shud be corectly mapped");
+                       Assert.AreEqual (1, data.Tables[0].Rows.Count,
+                               "#10 Data shud be populated if mapping is correct");
+               }
        }
 }
index fb7865361287cd0a4582e5246afe29a1923fc6ed..dc041c00c3ce6f0c0174ef5ae60db5da65db5b29 100644 (file)
@@ -5,6 +5,7 @@
 //      Umadevi S (sumadevi@novell.com)
 //      Kornél Pál <http://www.kornelpal.hu/>
 //     Sureshkumar T (tsureshkumar@novell.com)
+//     Senganal T (tsenganal@novell.com)
 //
 // Copyright (c) 2004 Novell Inc., and the individuals listed
 // on the ChangeLog entries.
@@ -31,6 +32,8 @@
 
 using System;
 using System.Data;
+using System.Text;
+using System.Data.SqlTypes;
 using System.Data.Common;
 using System.Data.SqlClient;
 
@@ -43,7 +46,21 @@ namespace MonoTests.System.Data.SqlClient
        [Category ("sqlserver")]
        public class SqlDataReaderTest 
        {
-               SqlConnection conn;
+               SqlConnection conn = null; 
+               SqlCommand cmd = null;
+               SqlDataReader reader = null; 
+               String query = "Select type_{0},type_{1},convert({0},null) from numeric_family where id=1";
+               DataSet sqlDataset = null; 
+
+               DataTable numericDataTable =null;
+               DataTable stringDataTable =null;
+               DataTable binaryDataTable =null;
+               DataTable datetimeDataTable =null;
+
+               DataRow numericRow = null; 
+               DataRow stringRow = null; 
+               DataRow binaryRow = null; 
+               DataRow datetimeRow = null; 
                
                [Test]
                public void ReadEmptyNTextFieldTest () {
@@ -87,5 +104,799 @@ namespace MonoTests.System.Data.SqlClient
                                ConnectionManager.Singleton.CloseConnection ();
                        }
                }
+
+               [TestFixtureSetUp]
+               public void init ()
+               {
+                       conn = new SqlConnection (ConnectionManager.Singleton.ConnectionString);
+                       cmd = conn.CreateCommand ();
+                       
+                       sqlDataset = (new DataProvider()).GetDataSet ();
+
+                       numericDataTable = sqlDataset.Tables["numeric_family"];
+                       stringDataTable = sqlDataset.Tables["string_family"];
+                       binaryDataTable = sqlDataset.Tables["binary_family"];
+                       datetimeDataTable = sqlDataset.Tables["datetime_family"];
+
+                       numericRow = numericDataTable.Select ("id=1")[0];
+                       stringRow = stringDataTable.Select ("id=1")[0];
+                       binaryRow = binaryDataTable.Select ("id=1")[0];
+                       datetimeRow = datetimeDataTable.Select ("id=1")[0];
+               }
+
+               [SetUp]
+               public void Setup ()
+               {
+                       conn.Open ();
+               }
+               [TearDown]
+               public void TearDown ()
+               {
+                       if (reader != null)
+                               reader.Close ();
+
+                       conn.Close ();
+               }
+
+               // This method just helps in Calling common tests among all the Get* Methods 
+               // without replicating code 
+
+               void CallGetMethod (string s, int i)
+               {
+                       switch (s) {
+                       case "Boolean" : reader.GetBoolean (i) ; break; 
+                       case "SqlBoolean": reader.GetSqlBoolean (i); break;
+                       case "Int16" : reader.GetInt16 (i); break;
+                       case "SqlInt16" : reader.GetSqlInt16 (i); break;
+                       case "Int32" : reader.GetInt32 (i);break;
+                       case "SqlInt32" : reader.GetSqlInt32(i);break;
+                       case "Int64" : reader.GetInt64 (i);break;
+                       case "SqlInt64" : reader.GetSqlInt64(i); break;
+                       case "Decimal" : reader.GetDecimal(i);break;
+                       case "SqlDecimal" : reader.GetSqlDecimal (i);break;
+                       case "SqlMoney" : reader.GetSqlMoney (i);break;
+                       case "Float" : reader.GetFloat (i);break;
+                       case "SqlSingle" : reader.GetSqlSingle(i);break;
+                       case "Double" : reader.GetDouble (i);break;
+                       case "SqlDouble" : reader.GetSqlDouble(i);break;
+                       case "Guid" : reader.GetGuid(i);break;
+                       case "SqlGuid" : reader.GetSqlGuid(i);break;
+                       case "String" : reader.GetString(i);break;
+                       case "SqlString" : reader.GetSqlString(i);break;
+                       case "Char" : reader.GetChar(i);break;
+                       case "Byte" : reader.GetByte (i);break;
+                       case "SqlByte" : reader.GetSqlByte(i); break;
+                       case "DateTime" : reader.GetDateTime(i); break;
+                       case "SqlDateTime" : reader.GetSqlDateTime(i); break;
+                       case "SqlBinary" : reader.GetSqlBinary(i); break;
+                       default : Console.WriteLine ("OOOOPSSSSSS {0}",s);break;
+                       }
+               }
+
+               // This method just helps in Calling common tests among all the Get* Methods 
+               // without replicating code 
+               void GetMethodTests (string s)
+               {
+
+                       try {
+                               CallGetMethod (s, 1);
+                               Assert.Fail ("#1[Get"+s+"] InvalidCastException must be thrown");       
+                       }catch (AssertionException e) {
+                               throw e;                
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidCastException), e.GetType(),
+                                       "#2[Get"+s+"] Incorrect Exception : " + e);
+                       }
+               
+                       // GetSql* Methods do not throw SqlNullValueException   
+                       // So, Testimg only for Get* Methods 
+                       if (!s.StartsWith("Sql")) {
+                               try {
+                                       CallGetMethod (s, 2);
+                                       Assert.Fail ("#3[Get"+s+"] Exception must be thrown");  
+                               }catch (AssertionException e) {
+                                       throw e;
+                               }catch (Exception e){
+                                       Assert.AreEqual (typeof(SqlNullValueException),e.GetType(),
+                                               "#4[Get"+s+"] Incorrect Exception : " + e);
+                               }
+                       }
+
+                       try {
+                               CallGetMethod (s, 3);
+                               Assert.Fail ("#5[Get"+s+"] IndexOutOfRangeException must be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e){
+                               Assert.AreEqual (typeof(IndexOutOfRangeException), e.GetType(),
+                                       "#6[Get"+s+"] Incorrect Exception : " + e);
+                       }
+               }
+
+               [Test]
+               public void GetBooleanTest ()
+               {
+                       cmd.CommandText = string.Format (query, "bit", "int");
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("Boolean");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_bit"], reader.GetBoolean(0),
+                                               "#2 DataValidation Failed");
+                       
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlBoolean");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_bit"], reader.GetSqlBoolean(0).Value,
+                               "#4 DataValidation Failed");    
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetByteTest ()
+               {
+                       cmd.CommandText = string.Format (query, "tinyint", "int");
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("Byte");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_tinyint"], reader.GetByte(0),
+                                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlByte");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_tinyint"], reader.GetSqlByte(0).Value,
+                                               "#4 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetInt16Test ()
+               {
+                       cmd.CommandText = string.Format (query, "smallint", "int");
+                       reader = cmd.ExecuteReader();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("Int16");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_smallint"], reader.GetInt16(0),
+                                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlInt16");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_smallint"], reader.GetSqlInt16(0).Value,
+                                               "#4 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetInt32Test ()
+               {
+                       cmd.CommandText = string.Format (query, "int", "bigint");
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("Int32");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_int"], reader.GetInt32(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlInt32");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_int"], reader.GetSqlInt32(0).Value,
+                               "#4 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetInt64Test ()
+               {
+                       cmd.CommandText = string.Format (query, "bigint", "int");
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+
+                       // Test for standard exceptions 
+                       GetMethodTests("Int64");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_bigint"], reader.GetInt64(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlInt64");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_bigint"], reader.GetSqlInt64(0).Value,
+                               "#4 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetDecimalTest ()
+               {
+                       cmd.CommandText = string.Format (query, "decimal", "int");
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("Decimal");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_decimal"], reader.GetDecimal(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlDecimal");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_decimal"], reader.GetSqlDecimal(0).Value,
+                               "#4 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetSqlMoneyTest ()
+               {
+                       cmd.CommandText = string.Format (query, "money", "int");
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlMoney");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_money"], reader.GetSqlMoney(0).Value,
+                               "#2 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetFloatTest ()
+               {
+                       cmd.CommandText = "select type_float,type_double,convert(real,null)";
+                       cmd.CommandText += "from numeric_family where id=1"; 
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("Float");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_float"], reader.GetFloat(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlSingle");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_float"], reader.GetSqlSingle(0).Value,
+                               "#2 DataValidation Failed");
+                       reader.Close ();
+               } 
+
+               [Test]
+               public void GetDoubleTest ()
+               {
+                       cmd.CommandText = "select type_double,type_float,convert(float,null)";
+                       cmd.CommandText += " from numeric_family where id=1"; 
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("Double");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_double"], reader.GetDouble(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlDouble");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (numericRow["type_double"], reader.GetSqlDouble(0).Value,
+                               "#4 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetBytesTest ()
+               {
+                       cmd.CommandText = "Select type_text,type_ntext,convert(text,null) ";
+                       cmd.CommandText += "from string_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       try {
+                               reader.GetBytes (0,0,null,0,0); 
+                               Assert.Fail ("#1 GetBytes shud be used only wth Sequential Access");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidCastException), e.GetType (),
+                                       "#2 Incorrect Exception : " + e);
+                       }
+                       reader.Close ();
+                       
+                       byte[] asciiArray = (new ASCIIEncoding ()).GetBytes ("text");
+                       byte[] unicodeArray = (new UnicodeEncoding ()).GetBytes ("ntext");
+                       byte[] buffer = null ;
+                       long size = 0; 
+
+                       reader = cmd.ExecuteReader (CommandBehavior.SequentialAccess);  
+                       reader.Read ();
+                       size = reader.GetBytes (0,0,null,0,0);
+                       Assert.AreEqual (asciiArray.Length, size, "#3 Data Incorrect");
+
+                       buffer = new byte[size];
+                       size = reader.GetBytes (0,0,buffer,0,(int)size);
+                       for (int i=0;i<size; i++)
+                               Assert.AreEqual (asciiArray[i], buffer[i], "#4 Data Incorrect");
+
+                       size = reader.GetBytes (1,0,null,0,0);
+                       Assert.AreEqual (unicodeArray.Length, size, "#5 Data Incorrect");
+                       buffer = new byte[size];
+                       size = reader.GetBytes (1,0,buffer,0,(int)size);
+                       for (int i=0;i<size; i++)
+                               Assert.AreEqual (unicodeArray[i], buffer[i], "#6 Data Incorrect");
+                       
+                       // Test if msdotnet behavior s followed when null value 
+                       // is read using GetBytes 
+                       Assert.AreEqual (0, reader.GetBytes (2,0,null,0,0), "#7");
+                       reader.GetBytes (2,0,buffer,0,10);
+
+                       reader.Close ();
+                       // do i need to test for image/binary values also ??? 
+               }
+
+               [Test]
+               public void GetStringTest ()
+               {
+                       cmd.CommandText = "Select type_varchar,10,convert(varchar,null)";
+                       cmd.CommandText += "from string_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions 
+                       GetMethodTests("String");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (stringRow["type_varchar"], reader.GetString(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlString");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (stringRow["type_varchar"], reader.GetSqlString(0).Value,
+                               "#4 DataValidation Failed");
+                       reader.Close();
+               }
+
+               [Test]
+               public void GetSqlBinaryTest ()
+               {
+                       cmd.CommandText = "Select type_binary ,10 ,convert(binary,null)";
+                       cmd.CommandText += "from binary_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions         
+                       GetMethodTests ("SqlBinary");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (binaryRow["type_binary"], reader.GetSqlBinary(0).Value,
+                               "#2 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetGuidTest ()
+               {
+                       cmd.CommandText = "Select type_guid,id,convert(uniqueidentifier,null)";
+                       cmd.CommandText += "from string_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+
+                       // Test for standard exceptions 
+                       GetMethodTests("Guid");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (stringRow["type_guid"], reader.GetGuid(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlGuid");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (stringRow["type_guid"], reader.GetSqlGuid(0).Value,
+                               "#4 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetDateTimeTest ()
+               {
+                       cmd.CommandText = "Select type_datetime,10,convert(datetime,null)";
+                       cmd.CommandText += "from datetime_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+
+                       // Test for standard exceptions 
+                       GetMethodTests("DateTime");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (datetimeRow["type_datetime"], reader.GetDateTime(0),
+                               "#2 DataValidation Failed");
+
+                       // Test for standard exceptions 
+                       GetMethodTests("SqlDateTime");
+
+                       // Test if data is returned correctly
+                       Assert.AreEqual (datetimeRow["type_datetime"], reader.GetSqlDateTime(0).Value,
+                               "#2 DataValidation Failed");
+                       reader.Close ();
+               }
+
+               [Test]
+               [Ignore ("Not Supported by msdotnet")]
+               public void GetCharTest ()
+               {
+                       cmd.CommandText = "Select type_char,type_guid,convert(char,null)"; 
+                       cmd.CommandText += "from string_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       // Test for standard exceptions
+                       GetMethodTests ("Char");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetValueTest ()
+               {
+                       cmd.CommandText = "Select id, null from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+
+                       object obj = null; 
+                       obj = reader.GetValue (0);
+                       Assert.AreEqual ((byte)1, obj, "#1 Shud return the value of id");
+                       obj = reader.GetValue (1);
+                       Assert.AreEqual (DBNull.Value, obj, "#2 shud return DBNull");
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetSqlValueTest ()
+               {
+                       cmd.CommandText = "Select id,null from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+
+                       Assert.AreEqual ((byte)1, ((SqlByte)reader.GetSqlValue(0)).Value, "#1");
+                       //Assert.AreEqual (DBNull.Value, reader.GetSqlValue(1), "#2");
+
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetValuesTest ()
+               {
+                       cmd.CommandText = "Select 10,20,30 from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       object[] arr = null;
+                       int count = 0; 
+
+                       arr = new object[1];
+                       count = reader.GetValues (arr);
+                       Assert.AreEqual (10, (int)arr[0], "#1 Only first object shud be copied");
+                       Assert.AreEqual (1, count, "#1 return value shud equal objects copied");
+
+                       arr = new object[3];
+                       count = reader.GetValues (arr);
+                       Assert.AreEqual (3, count, "#2 return value shud equal objects copied");
+
+                       arr = new object[5];
+                       count = reader.GetValues (arr);
+                       Assert.AreEqual (3, count, "#3 return value shud equal objects copied");
+                       Assert.IsNull (arr[3], "#4 Only 3 objects shud be copied");
+
+                       reader.Close ();
+               }
+
+               [Test]
+               public void GetSqlValuesTest ()
+               {
+                       cmd.CommandText = "Select 10,20,30 from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+                       object[] arr = null;
+                       int count = 0; 
+
+                       arr = new object[1];
+                       count = reader.GetSqlValues (arr);
+                       // Something is wrong with types ... gotta figure it out 
+                       //Assert.AreEqual (10, arr[0], "#1 Only first object shud be copied");
+                       Assert.AreEqual (1, count, "#1 return value shud equal objects copied");
+
+                       arr = new object[3];
+                       count = reader.GetSqlValues (arr);
+                       Assert.AreEqual (3, count, "#2 return value shud equal objects copied");
+
+                       arr = new object[5];
+                       count = reader.GetSqlValues (arr);
+                       Assert.AreEqual (3, count, "#3 return value shud equal objects copied");
+                       Assert.IsNull (arr[3], "#4 Only 3 objects shud be copied");
+
+                       reader.Close ();
+               }
+
+               [Test]
+               public void isDBNullTest ()
+               {
+                       cmd.CommandText = "select id , null from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       reader.Read ();
+
+                       Assert.IsFalse (reader.IsDBNull (0), "#1");
+                       Assert.IsTrue (reader.IsDBNull (1) , "#2");
+
+                       try {
+                               reader.IsDBNull (10);
+                               Assert.Fail ("#1 Invalid Argument");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(IndexOutOfRangeException), e.GetType(),
+                                       "#1 Incorrect Exception : " + e); 
+                       }
+               }
+
+               [Test]
+               public void ReadTest ()
+               {
+                       cmd.CommandText = "select id, type_bit from numeric_family where id=1" ;
+                       reader = cmd.ExecuteReader ();
+                       Assert.IsTrue (reader.Read () , "#1");
+                       Assert.IsFalse (reader.Read (), "#2");
+                       reader.Close ();
+
+                       try {
+                               reader.Read ();
+                               Assert.Fail ("#3 Exception shud be thrown : Reader is closed");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType (),
+                                       "#4 Incorrect Exception : " + e);
+                       }
+               }
+
+               [Test]
+               public void NextResultTest ()
+               {
+                       cmd.CommandText = "Select id from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+                       Assert.IsFalse (reader.NextResult (), "#1");
+                       reader.Close ();
+
+                       cmd.CommandText = "select id from numeric_family where id=1;";
+                       cmd.CommandText += "select type_bit from numeric_family where id=2;";
+                       reader = cmd.ExecuteReader ();
+                       Assert.IsTrue (reader.NextResult (), "#2");
+                       Assert.IsFalse (reader.NextResult (), "#3");
+                       reader.Close ();
+
+                       try {
+                               reader.NextResult ();
+                               Assert.Fail ("#4 Exception shud be thrown : Reader is closed");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType (),
+                                       "#5 Incorrect Exception : " + e);
+                       }
+               }
+
+               [Test]
+               public void GetNameTest ()
+               {
+                       cmd.CommandText = "Select id,10 as gen,20 from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+
+                       Assert.AreEqual ("id" , reader.GetName(0) , "#1");
+                       Assert.AreEqual ("gen" , reader.GetName(1) , "#2");
+
+                       try {
+                               reader.GetName (3);
+                               Assert.Fail ("#4 Exception shud be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(IndexOutOfRangeException), e.GetType(),
+                                       "#5 Incorrect Exception : " + e);
+                       }
+               }
+
+               [Test]
+               public void GetOrdinalTest ()
+               {
+                       //what is kana-width insensitive ????? 
+                       cmd.CommandText = "Select id,10 as gen,20 from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+
+                       Assert.AreEqual (0, reader.GetOrdinal ("id"), "#1");
+                       Assert.AreEqual (0, reader.GetOrdinal ("ID"), "#2");
+                       Assert.AreEqual (1, reader.GetOrdinal ("gen"), "#3");
+                       // Would expect column1,columnn2 etc for unnamed columns,
+                       // but msdotnet return empty string for unnamed columns
+                       Assert.AreEqual (2, reader.GetOrdinal (""), "#4");
+
+                       try {
+                               reader.GetOrdinal ("invalidname");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof (IndexOutOfRangeException),
+                                       e.GetType(), "#4 Incorrect Exception : " + e);
+                       }
+               }
+
+               [Test]
+               public void GetSchemaTableTest ()
+               {
+                       cmd.CommandText = "Select type_decimal as decimal,id,10 ";
+                       cmd.CommandText += "from numeric_family where id=1";
+                       reader = cmd.ExecuteReader (CommandBehavior.KeyInfo);
+                       DataTable schemaTable  = reader.GetSchemaTable ();
+                       DataRow row0 = schemaTable.Rows[0]; 
+                       DataRow row1 = schemaTable.Rows[1]; 
+               
+                       Assert.AreEqual ("decimal", row0["ColumnName"], "#1");
+                       Assert.AreEqual ("", schemaTable.Rows[2]["ColumnName"], "#2");
+
+                       Assert.AreEqual (0, row0["ColumnOrdinal"], "#2");
+                       Assert.AreEqual (17, row0["ColumnSize"], "#3");
+                       Assert.AreEqual (38, row0["NumericPrecision"], "#4"); 
+                       Assert.AreEqual (0, row0["NumericScale"], "#5");
+
+                       Assert.AreEqual (false, row0["IsUnique"], "#6"); 
+                       // msdotnet returns IsUnique as false for Primary key
+                       // even though table consists of a single Primary Key
+                       //Assert.AreEqual (true, row1["IsUnique"], "#7"); 
+                       Assert.AreEqual (false, row0["IsKey"], "#8"); 
+                       Assert.AreEqual (true, row1["IsKey"], "#9"); 
+
+                       //Assert.AreEqual ("servername", row0["BaseServerName"], "#10");
+                       //Assert.AreEqual ("monotest", row0["BaseCatalogName"], "#11");  
+                       Assert.AreEqual ("type_decimal", row0["BaseColumnName"], "#12");
+                       //Assert.IsNull(row0["BaseSchemaName"], "#13");
+                       Assert.AreEqual ("numeric_family", row0["BaseTableName"], "#14");
+                       Assert.AreEqual (typeof (Decimal), row0["DataType"], "#15"); 
+                       Assert.AreEqual (true, row0["AllowDBNull"], "#16");
+                       Assert.AreEqual (false, row1["AllowDBNull"], "#17");
+                       //Assert.IsNull(row0["ProviderType"], "#18");
+                       Assert.AreEqual (true, row0["IsAliased"], "#19");
+                       Assert.AreEqual (false, row1["IsAliased"], "#20");
+
+                       Assert.AreEqual (false, row0["IsExpression"], "#21"); 
+                       Assert.AreEqual (false, row0["IsIdentity"], "#22"); 
+                       Assert.AreEqual (false, row0["IsAutoIncrement"], "#23");
+                       Assert.AreEqual (false, row0["IsRowVersion"], "#24"); 
+                       Assert.AreEqual (false, row0["IsHidden"], "#25"); 
+                       Assert.AreEqual (false, row0["IsLong"], "#26"); 
+                       Assert.AreEqual (false, row0["IsReadOnly"], "#27"); 
+                       Assert.AreEqual (true, schemaTable.Rows[2]["IsReadOnly"], "#27"); 
+
+                       // Test Exception is thrown when reader is closed
+                       reader.Close ();
+                       try {
+                               reader.GetSchemaTable ();
+                               Assert.Fail ("#28 Exception shud be thrown" );
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(InvalidOperationException), e.GetType(),
+                                       "#29 Incorrect Exception");
+                       }
+               }
+
+               [Test]
+               public void GetDataTypeNameTest ()
+               {
+                       cmd.CommandText = "Select id,10,null from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+
+                       Assert.AreEqual ("tinyint", reader.GetDataTypeName(0), "#1");
+                       Assert.AreEqual ("int", reader.GetDataTypeName(1), "#2");
+                       //need check on windows 
+                       Assert.AreEqual ("int", reader.GetDataTypeName(2), "#3");
+                       try {
+                               reader.GetDataTypeName (10);
+                               Assert.Fail ("#4 Exception shud be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(IndexOutOfRangeException), e.GetType(),
+                                       "#5 Incorrect Exception : " + e);
+                       }
+               }
+
+               [Test]
+               public void GetFieldType ()
+               {
+                       cmd.CommandText = "Select id ,10 , null from numeric_family where id=1";
+                       reader = cmd.ExecuteReader ();
+
+                       Assert.AreEqual ("tinyint", reader.GetDataTypeName(0), "#1");
+                       Assert.AreEqual ("int", reader.GetDataTypeName(1) , "#2");
+                       Assert.AreEqual ("int", reader.GetDataTypeName(2), "#3");
+                       try {
+                               reader.GetDataTypeName (10);
+                               Assert.Fail ("#4 Exception shud be thrown");
+                       }catch (AssertionException e) {
+                               throw e;
+                       }catch (Exception e) {
+                               Assert.AreEqual (typeof(IndexOutOfRangeException), e.GetType(),
+                                       "#5 Incorrect Exception : " + e);
+                       }
+               }
+
+               // Need to populate the data from a config file
+               // Will be replaced later 
+               void validateData(string sqlQuery, DataTable table)
+               {
+                       string fmt = "#TAB[{0}] ROW[{1}] COL[{2}] Data Mismatch";
+
+                       int noOfColumns = table.Columns.Count ;
+                       int i=0;
+
+                       cmd.CommandText = sqlQuery ;
+                       reader = cmd.ExecuteReader ();
+
+                       while (reader.Read ()){
+                               for (int j=1; j< noOfColumns ; ++j)
+                                       Assert.AreEqual (table.Rows[i][j], reader[j],
+                                               String.Format (fmt, table.TableName, i+1, j));
+                               
+                               i++;
+                       }
+                       reader.Close ();
+               }
+
+               [Test]
+               public void NumericDataValidation ()
+               {
+                       validateData ("select * from numeric_family order by id ASC",
+                               numericDataTable);
+               }
+               
+               [Test]
+               public void StringDataValidation ()
+               {
+                       validateData ("select * from string_family order by id ASC",
+                               stringDataTable);
+               }
+
+               [Test]
+               public void BinaryDataValidation ()
+               {
+                       validateData ("select * from binary_family order by id ASC",
+                               binaryDataTable);
+               }
+
+               [Test]
+               public void DatetimeDataValidation ()
+               {
+                       validateData ("select * from datetime_family order by id ASC",
+                               datetimeDataTable);
+               }
+
        }
 }
index f560dfcf536d279732d9f56e8af91af871c85d96..b16ad3e8f4d3b00b9efdd2095295f3ac31467037 100644 (file)
@@ -1,3 +1,14 @@
+2005-09-16  Senganal T  <tsenganal@novell.com>
+
+       * sqlserver.sql: modified. added string_family, datetime_family,
+       modified numeric_family values.
+       created new database mono-test for checking -.
+
+2005-09-13  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * sybase.sql: added. script file to create test database on
+       sybase.
+
 2005-09-01  Sureshkumar T  <tsureshkumar@novell.com>
 
        * SCHEMA: schema specification.
index 4b1723f30bdd3cc930301165d5d29989e29c2314..f31407bcfc866194c09ef883073b3b2b1133d10f 100644 (file)
@@ -3,7 +3,7 @@ use monotest
 //
 
 -- =================================== OBJECT NUMERIC_FAMILY =========================
--- TABLE : INT_FAMILY
+-- TABLE : NUMERIC_FAMILY
 -- data with id > 6000 is not gaurenteed to be read-only.
 drop table if exists numeric_family;
 //
@@ -24,14 +24,12 @@ create table numeric_family (
 
 insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647);
 insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648);
-insert into numeric_family values (3,0,0,0,0,0,0,0,0,0);
-insert into numeric_family values (4,null,null,null,null,null,null,null,null,null);
-//
+insert into numeric_family values (3,0,0,0,0,0,0,0,0,0); insert into numeric_family values (4,null,null,null,null,null,null,null,null,null); //
 
 -- =================================== END OBJECT NUMERIC_FAMILY ========================
 
 -- =================================== OBJECT BINARY_FAMILY =========================
--- TABLE : INT_FAMILY
+-- TABLE : BINARY_FAMILY
 -- data with id > 6000 is not gaurenteed to be read-only.
 drop table if exists binary_family;
 //
@@ -102,4 +100,4 @@ begin
 end
 //
 
--- =================================== END OBJECT EMPLOYEE ============================
\ No newline at end of file
+-- =================================== END OBJECT EMPLOYEE ============================
index b56e1cf7ce26d69330e9c750cf963b85f9876ba9..117b41ae1d3470f3ff4bc43dd118c1f47f91f497 100644 (file)
@@ -1,54 +1,65 @@
-use monotest
-go
+if exists (select name from sysdatabases where
+        name = 'mono-test') 
+        drop database [mono-test];
+create database [mono-test];
+grant all privileges on [mono-test] to monotester;
 
--- =================================== OBJECT EMPLOYEE ============================
--- TABLE : INT_FAMILY
+use monotest;
+
+-- =================================== OBJECT NUMERIC_FAMILY============================
+-- TABLE : NUMERIC_FAMILY
 -- data with id > 6000 is not gaurenteed to be read-only.
 if exists (select name from sysobjects where 
        name = 'numeric_family' and type = 'U')
        drop table numeric_family;
 go
 
-create table numeric_family (
-       id int PRIMARY KEY NOT NULL,
-       type_bit bit NULL,
-       type_tinyint tinyint NULL,
-       type_smallint smallint NULL,
-       type_int int NULL,
-       type_bigint bigint NULL,
-       type_decimal decimal (38, 0) NULL,
-       type_numeric numeric (38, 0) NULL,
-       type_money money NULL,
-       type_smallmoney smallmoney NULL);
+create table numeric_family(id tinyint PRIMARY KEY NOT NULL,
+        type_bit bit NULL,
+        type_tinyint tinyint NULL,
+        type_smallint smallint NULL,
+        type_int int NULL,
+        type_bigint bigint NULL,
+        type_decimal decimal(38,0) NULL,
+        type_numeric numeric(38,0) NULL,
+        type_money money NULL,
+        type_smallmoney smallmoney NULL,
+        type_float real NULL,
+        type_double float NULL);
 go
 
-insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647);
-insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648);
-insert into numeric_family values (3,0,0,0,0,0,0,0,0,0);
-insert into numeric_family values (4,null,null,null,null,null,null,null,null,null);
+grant all privileges on numeric_family to monotester;
 go
 
--- =================================== END OBJECT EMPLOYEE ========================
+insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647,3.40E+38,1.79E+308);
+insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648,-3.40E+38,-1.79E+308);
+insert into numeric_family values (3,0,0,0,0,0,0,0,0,0,0,0);
+insert into numeric_family values (4,null,null,null,null,null,null,null,null,null,null,null);
+go
+-- =================================== END OBJECT NUMERIC_FAMILY ========================
 
 -- =================================== OBJECT BINARY_FAMILY =========================
--- TABLE : INT_FAMILY
+-- TABLE : BINARY_FAMILY
 -- data with id > 6000 is not gaurenteed to be read-only.
 if exists (select name from sysobjects where 
-       name = 'employee' and type = 'U')
+       name = 'binary_family' and type = 'U')
        drop table binary_family;
 go
 
 create table binary_family (
-       id int PRIMARY KEY NOT NULL,
-       type_binary binary NULL,
-       type_varbinary varbinary (255) NULL,
-       type_blob image NULL,
-       type_tinyblob image NULL,
-       type_mediumblob image NULL,
-       type_longblob_image image NULL);
+        id tinyint PRIMARY KEY NOT NULL,
+        type_binary binary NULL,
+        type_varbinary varbinary (255) NULL,
+        type_blob image NULL,
+        type_tinyblob image NULL,
+        type_mediumblob image NULL,
+        type_longblob_image image NULL);
 go
 
-insert into binary_family values (1, convert (image, '555555'), convert (image, '0123456789012345678901234567890123456789012345678901234567890123456789'), 
+grant all privileges on binary_family to monotester;
+go
+
+insert into binary_family values (1, convert (binary, '555555'), convert (varbinary, '0123456789012345678901234567890123456789012345678901234567890123456789'), 
                                        convert (image, '66666666'), convert (image, '777777'), 
                                        convert (image, '888888'), convert (image, '999999'));
 --insert into binary_family values (2,
@@ -59,6 +70,53 @@ go
 -- =================================== END OBJECT BINARY_FAMILY ========================
 
 
+-- =================================== OBJECT STRING_FAMILY============================
+-- TABLE : string_family 
+-- data with id above 6000 is not gaurenteed to be read-only.
+if exists (select name from sysobjects where 
+       name = 'string_family' and type = 'U')
+       drop table string_family;
+go
+
+create table string_family(id tinyint PRIMARY KEY NOT NULL,
+        type_guid uniqueidentifier NULL,
+        type_char char(10) NULL,
+        type_varchar varchar(10) NULL,
+        type_text text NULL,
+        type_ntext ntext NULL);
+go
+
+grant all privileges on string_family to monotester;
+go
+
+insert into string_family values (1,newid(),"char","varchar","text","ntext");
+insert into string_family values (4,null,null,null,null,null);
+go
+-- =================================== END OBJECT STRING_FAMILY ========================
+
+
+-- =================================== OBJECT DATETIME_FAMILY============================
+-- TABLE : datetime_family
+-- data with id above 6000 is not gaurenteed to be read-only.
+
+if exists (select name from sysobjects where 
+       name = 'datetime_family' and type = 'U')
+       drop table datetime_family;
+go
+
+create table datetime_family (
+        id tinyint PRIMARY KEY NOT NULL,
+        type_smalldatetime smalldatetime NULL,
+        type_datetime datetime NULL);
+
+grant all privileges on datetime_family to monotester;
+go
+insert into datetime_family values (1,'2079-06-06 23:59:00','9999-12-31 23:59:59.997');
+insert into datetime_family values (4,null,null);
+go
+
+-- =================================== END OBJECT DATETIME_FAMILY========================
+
 -- =================================== OBJECT EMPLOYEE ============================
 -- TABLE : EMPLOYEE
 -- data with id above 6000 is not gaurenteed to be read-only.
@@ -74,13 +132,17 @@ create table employee (
        dob datetime NOT NULL,
        doj datetime NOT NULL,
        email varchar (50) NULL);
+go
 
 grant all privileges on employee to monotester;
 
+go
+
 insert into employee values (1, 'suresh', 'kumar', '1978-08-22', '2001-03-12', 'suresh@gmail.com');
 insert into employee values (2, 'ramesh', 'rajendran', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
 insert into employee values (3, 'venkat', 'ramakrishnan', '1977-06-12', '2003-12-11', 'ramesh@yahoo.com');
 insert into employee values (4, 'ramu', 'dhasarath', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
+
 go
 
 -- STORED PROCEDURES
@@ -114,6 +176,4 @@ begin
 end
 go
 
-
-
--- =================================== END OBJECT EMPLOYEE ============================
\ No newline at end of file
+-- =================================== END OBJECT EMPLOYEE ============================
diff --git a/mcs/class/System.Data/Test/ProviderTests/sql/sybase.sql b/mcs/class/System.Data/Test/ProviderTests/sql/sybase.sql
new file mode 100644 (file)
index 0000000..2d31ee3
--- /dev/null
@@ -0,0 +1,120 @@
+use monotest
+go
+
+-- =================================== OBJECT EMPLOYEE ============================
+-- TABLE : INT_FAMILY
+-- data with id > 6000 is not gaurenteed to be read-only.
+if exists (select name from sysobjects where 
+       name = 'numeric_family' and type = 'U')
+       drop table numeric_family
+go
+
+create table numeric_family (
+       id int PRIMARY KEY NOT NULL,
+       type_bit bit NOT NULL,
+       type_tinyint tinyint NULL,
+       type_smallint smallint NULL,
+       type_int int NULL,
+       type_bigint numeric (38,0) NULL,
+       type_decimal decimal (38, 0) NULL,
+       type_numeric numeric (38, 0) NULL,
+       type_money money NULL,
+       type_smallmoney smallmoney NULL)
+go
+
+insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647)
+insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648)
+insert into numeric_family values (3,0,0,0,0,0,0,0,0,0)
+insert into numeric_family values (4,0,null,null,null,null,null,null,null,null)
+go
+
+-- =================================== END OBJECT EMPLOYEE ========================
+
+-- =================================== OBJECT BINARY_FAMILY =========================
+-- TABLE : BINARY FAMILY
+-- data with id > 6000 is not gaurenteed to be read-only.
+if exists (select name from sysobjects where 
+       name = 'binary_family' and type = 'U')
+       drop table binary_family
+go
+
+create table binary_family (
+       id int PRIMARY KEY NOT NULL,
+       type_binary binary NULL,
+       type_varbinary varbinary (255) NULL,
+       type_blob image NULL,
+       type_tinyblob image NULL,
+       type_mediumblob image NULL,
+       type_longblob_image image NULL)
+go
+
+insert into binary_family values (1, convert (binary, '555555'), convert (varbinary, '0123456789012345678901234567890123456789012345678901234567890123456789'), 
+                                       convert (image, '66666666'), convert (image, '777777'), 
+                                       convert (image, '888888'), convert (image, '999999'))
+--insert into binary_family values (2,
+--insert into binary_family values (3,
+insert into binary_family values (4,null,null,null,null,null,null)
+go
+
+-- =================================== END OBJECT BINARY_FAMILY ========================
+
+
+-- =================================== OBJECT EMPLOYEE ============================
+-- TABLE : EMPLOYEE
+-- data with id above 6000 is not gaurenteed to be read-only.
+if exists (select name from sysobjects where 
+       name = 'employee' and type = 'U')
+       drop table employee
+go
+
+create table employee ( 
+       id int PRIMARY KEY NOT NULL, 
+       fname varchar (50) NOT NULL,
+       lname varchar (50) NULL,
+       dob datetime NOT NULL,
+       doj datetime NOT NULL,
+       email varchar (50) NULL)
+go
+
+grant all privileges on employee to monotester
+
+insert into employee values (1, 'suresh', 'kumar', '1978-08-22', '2001-03-12', 'suresh@gmail.com')
+insert into employee values (2, 'ramesh', 'rajendran', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com')
+insert into employee values (3, 'venkat', 'ramakrishnan', '1977-06-12', '2003-12-11', 'ramesh@yahoo.com')
+insert into employee values (4, 'ramu', 'dhasarath', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com')
+go
+
+-- STORED PROCEDURES
+-- SP : sp_clean_employee_table
+if exists (select name from sysobjects where 
+       name = 'sp_clean_employee_table' and type = 'P')
+       drop procedure sp_clean_employee_table
+go
+
+create procedure sp_clean_employee_table
+as 
+begin
+       delete from employee where id > 6000
+end
+go
+
+
+-- SP : sp_get_age
+if exists (select name from sysobjects where 
+       name = 'sp_get_age' and type = 'P')
+       drop procedure sp_get_age
+go
+
+create procedure sp_get_age (
+       @fname varchar (50),
+       @age int output)
+as 
+begin
+       select @age = datediff (day, dob, getdate ()) from employee where fname like @fname
+       return @age
+end
+go
+
+
+
+-- =================================== END OBJECT EMPLOYEE ============================
index 50af590b95aa998dbdb843cef99c1ad9d8d0d5e1..c7ea1072250a5894b80f9974a10369831d4fdf00 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-20  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * DataViewTest.cs: Added a case for Sort to accept columns with
+       '[' & ']'.
+       (SortTests): Added cases for sorting order. TestCase from Marc
+
 2005-08-02  Sureshkumar T  <tsureshkumar@novell.com>
 
        * DataTableTest.cs: Select (): added a case for apos escaping.
index 3e7dd8fbb44d941f7b4e04a6f6c2b6a4a8efe461..713470a12cf048e9e0b178214f8337f8568449aa 100644 (file)
@@ -5,6 +5,7 @@
 //     Patrick Kalkman  kalkman@cistron.nl
 //      Umadevi S (sumadevi@novell.com)
 //     Atsushi Enomoto (atsushi@ximian.com)
+//      Sureshkumar T <tsureshkumar@novell.com>
 //
 // (C) 2003 Patrick Kalkman
 //
@@ -224,8 +225,10 @@ namespace MonoTests.System.Data
                        AssertEquals ("Deleted.Value", "1", v);
                }
 
+
+               #region Sort Tests
                [Test]
-               public void Sort ()
+               public void SortListChangedTest ()
                {
                        dataView.Sort = "itemName DESC";
                        AssertEquals ("test#01",ListChangedType.Reset,listChangedArgs.ListChangedType);
@@ -233,6 +236,73 @@ namespace MonoTests.System.Data
                        // PrintTableOrView (dataView);
                }
 
+
+               [Test]
+               public void SortTestWeirdColumnName ()
+               {
+                       DataTable dt = new DataTable ();
+                       dt.Columns.Add ("id]", typeof (int));
+                       dt.Columns.Add ("[id", typeof (int));
+
+                       DataView dv = dt.DefaultView;
+                       dv.Sort = "id]";
+                       //dv.Sort = "[id"; // this is not allowed
+                       dv.Sort = "[id]]";
+                       dv.Sort = "[[id]";
+                       dv.Sort = "id] ASC";
+                       dv.Sort = "[id]] DESC";
+                       dv.Sort = "[[id] ASC";
+               }
+
+
+               [Test]
+               public void SortTests ()
+               {
+                       DataTable dataTable = new DataTable ("itemTable");
+                       DataColumn dc1 = new DataColumn ("itemId", typeof(int));
+                       DataColumn dc2 = new DataColumn ("itemName", typeof(string));
+                       
+                       dataTable.Columns.Add (dc1);
+                       dataTable.Columns.Add (dc2);
+
+                       dataTable.Rows.Add (new object[2] { 1, "First entry" });
+                       dataTable.Rows.Add (new object[2] { 0, "Second entry" });
+                       dataTable.Rows.Add (new object[2] { 3, "Third entry" });
+                       dataTable.Rows.Add (new object[2] { 2, "Fourth entry" });
+                       
+                       DataView dataView = dataTable.DefaultView;
+
+                       string s = "Default sorting: ";
+                       AssertEquals (s + "First entry has wrong item", 1, dataView[0][0]);
+                       AssertEquals (s + "Second entry has wrong item", 0, dataView[1][0]);
+                       AssertEquals (s + "Third entry has wrong item", 3, dataView[2][0]);
+                       AssertEquals (s + "Fourth entry has wrong item", 2, dataView[3][0]);
+
+                       s = "Ascending sorting: ";
+                       dataView.Sort = "itemId ASC";
+                       AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
+                       AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
+                       AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
+                       AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
+
+                       s = "Descending sorting: ";
+                       dataView.Sort = "itemId DESC";
+                       AssertEquals (s + "First entry has wrong item", 3, dataView[0][0]);
+                       AssertEquals (s + "Second entry has wrong item", 2, dataView[1][0]);
+                       AssertEquals (s + "Third entry has wrong item", 1, dataView[2][0]);
+                       AssertEquals (s + "Fourth entry has wrong item", 0, dataView[3][0]);
+
+                       s = "Reverted to default sorting: ";
+                       dataView.Sort = null;
+                       AssertEquals (s + "First entry has wrong item", 1, dataView[0][0]);
+                       AssertEquals (s + "Second entry has wrong item", 0, dataView[1][0]);
+                       AssertEquals (s + "Third entry has wrong item", 3, dataView[2][0]);
+                       AssertEquals (s + "Fourth entry has wrong item", 2, dataView[3][0]);
+
+               }
+
+               #endregion // Sort Tests
+
                [Test]
                [ExpectedException(typeof(DataException))]
                public void AddNew_1 ()
diff --git a/mcs/class/System.Data/Test/TestGDA.cs b/mcs/class/System.Data/Test/TestGDA.cs
new file mode 100644 (file)
index 0000000..6e90803
--- /dev/null
@@ -0,0 +1,55 @@
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Data.OleDb;
+
+namespace Mono.Data.GDA.Test
+{
+       public class TestGDA
+       {
+               private IntPtr m_gdaClient = IntPtr.Zero;
+               private IntPtr m_gdaConnection = IntPtr.Zero;
+               
+               static void Main (string[] args)
+               {
+                       TestGDA test = new TestGDA ();
+                       
+                       /* initialization */
+                       libgda.gda_init ("TestGDA#", "0.1", args.Length, args);
+                       test.m_gdaClient = libgda.gda_client_new ();
+
+                       /* open connection */
+                       test.m_gdaConnection = libgda.gda_client_open_connection (
+                               test.m_gdaClient,
+                               "PostgreSQL",
+                               "", "");
+                       if (test.m_gdaConnection != IntPtr.Zero) {
+                               System.Console.Write ("Connection successful!");
+
+                               /* close connection */
+                               libgda.gda_connection_close (test.m_gdaConnection);
+                       }
+               }       
+       }
+}
diff --git a/mcs/class/System.Data/Test/TestOleDb.cs b/mcs/class/System.Data/Test/TestOleDb.cs
new file mode 100644 (file)
index 0000000..b31c4eb
--- /dev/null
@@ -0,0 +1,132 @@
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Data.OleDb;
+
+namespace System.Data.OleDb.Test
+{
+       public class TestOleDb
+       {
+               private OleDbConnection m_cnc;
+
+               private TestOleDb ()
+               {
+                       OleDbCommand cmd;
+                       
+                       m_cnc = new OleDbConnection ("Provider=PostgreSQL;Addr=127.0.0.1;Database=rodrigo");
+                       m_cnc.Open ();
+
+                       Console.WriteLine ("Connected to:");
+                       Console.WriteLine (" Data Source: " + m_cnc.DataSource);
+                       Console.WriteLine (" Database: " + m_cnc.Database);
+                       Console.WriteLine (" Connection string: " + m_cnc.ConnectionString);
+                       Console.WriteLine (" Provider: " + m_cnc.Provider);
+                       Console.WriteLine (" Server version:" + m_cnc.ServerVersion);
+
+                       /* create temporary table */
+                       Console.WriteLine ("Creating temporary table...");
+                       cmd = new OleDbCommand ("CREATE TABLE mono_test_table ( " +
+                                               " name varchar(25), email varchar(50), date_entered timestamp)",
+                                               m_cnc);
+                       cmd.ExecuteNonQuery ();
+                       InsertRow ("Mike Smith", "mike@smiths.com");
+                       InsertRow ("Julie Andrews", "julie@hollywood.com");
+                       InsertRow ("Michael Jordan", "michael@bulls.com");
+               }
+
+               void InsertRow (string name, string email)
+               {
+                       OleDbCommand cmd;
+
+                       cmd = new OleDbCommand ("INSERT INTO mono_test_table (name, email, date_entered) VALUES ('" +
+                                               name + "', '" + email +"', date 'now')", m_cnc);
+                       Console.WriteLine ("Executing command '" + cmd.CommandText + "'");
+                       cmd.ExecuteNonQuery ();
+
+               }
+               
+               void DisplayRow (OleDbDataReader reader)
+               {
+                       for (int i = 0; i < reader.FieldCount; i++) {
+                               Console.WriteLine (" " + reader.GetDataTypeName (i) + ": " +
+                                                  reader.GetValue (i).ToString ());
+                       }
+               }
+               
+               void TestDataReader ()
+               {
+                       int i = 0;
+                       string sql = "SELECT * FROM mono_test_table";
+                       
+                       Console.WriteLine ("Executing SELECT command...");
+                       OleDbCommand cmd = new OleDbCommand (sql, m_cnc);
+                       OleDbDataReader reader = cmd.ExecuteReader ();
+
+                       Console.WriteLine (" Recordset description:");
+                       for (i = 0; i < reader.FieldCount; i++) {
+                               Console.WriteLine ("  Field " + i + ": " +
+                                                  reader.GetName (i) + " (" +
+                                                  reader.GetDataTypeName (i) + ")");
+                       }
+
+                       Console.WriteLine ("Reading data...");
+                       i = 0;
+                       while (reader.Read ()) {
+                               Console.WriteLine ("Row " + i + ":");
+                               DisplayRow (reader);
+                               i++;
+                       }
+
+                       reader.Close ();
+               }
+
+               void TestTransaction ()
+               {
+                       Console.WriteLine ("Starting transaction...");
+                       OleDbTransaction xaction = m_cnc.BeginTransaction ();
+
+                       Console.WriteLine ("Aborting transaction...");
+                       xaction.Rollback ();
+               }
+               
+               void Close ()
+               {
+                       OleDbCommand cmd = new OleDbCommand ("DROP TABLE mono_test_table", m_cnc);
+                       cmd.ExecuteNonQuery ();
+                       m_cnc.Close ();
+               }
+
+               static void Main (string[] args)
+               {
+                       try {
+                               TestOleDb test = new TestOleDb ();
+                               test.TestDataReader ();
+                               test.TestTransaction ();
+                               test.Close ();
+                       } catch (Exception e) {
+                               Console.WriteLine ("An error has occured: {0}", e.ToString ());
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Data/jay.bat b/mcs/class/System.Data/jay.bat
new file mode 100755 (executable)
index 0000000..efedb37
--- /dev/null
@@ -0,0 +1,2 @@
+echo "processing Parser.jay..."\r
+%1\..\..\jay\jay.exe -ct < %1\..\..\jay\skeleton.cs %1\Mono.Data.SqlExpressions\Parser.jay > %1\Mono.Data.SqlExpressions\Parser.cs
\ No newline at end of file
index 74cee89f5f613d0b6f26b04b8058084eec010905..80a98062933a7abd9d5042049e315e30c6765b62 100644 (file)
@@ -1,3 +1,6 @@
+2005-09-07 Boris Kirzner <borisk@mainsoft.com>
+       * System.DirectoryServices.vmwcsproj: changed reference to Consts.cs.in.
+
 2005-22-08  Boris Kirzner <borisk@mainsoft.com>
        * System.DirectoryServices.vmwcsproj: changed reference to Consts.cs.
 
index 4ed84a93ea79d1b25470493d68553c12c941d749..52a6b4a8e27f92b9b00a953365d483b23d11fd26 100644 (file)
@@ -13,7 +13,7 @@
                </Build>\r
                <Files>\r
                        <Include>\r
-                               <File RelPath="Consts.cs" Link="..\..\build\common\Consts.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Consts.cs.in" Link="..\..\build\common\Consts.cs.in" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="Locale.cs" Link="..\..\build\common\Locale.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="MonoTODOAttribute.cs" Link="..\..\build\common\MonoTODOAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="Assembly\AssemblyInfo.cs" SubType="Code" BuildAction="Compile"/>\r
index 0f41ebd7e6f72f7546b9b4aa242052bcc6c17b0e..ad67805aec1dcc5453f4bab448219dfde70f33c9 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-19  Miguel de Icaza  <miguel@novell.com>
+
+       * Makefile (EXTRA_DISTFILES): Distribute indexed.png, add resource
+       to build.
+
+2005-09-14 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * System.Drawing.vmwcsproj: Added PlainImage.jvm.cs, PlainImageCollection.jvm.cs
+
+2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * System.Drawing.vmwcsproj: ImageCodec.jvm.cs
+       Added Mainsoft.Drawing.Configuration.jvm folder with
+       ResolutionConfiguration.cs, ResolutionConfigurationCollection.cs, 
+       ResolutionConfigurationHandler.cs
+
 2005-08-28 Vladimir Krasnov <vladimirk@mainsoft.com>
 
        * System.Drawing.vmwcsproj: Added GraphicsContainer.jvm.cs, GraphicsState.jvm.cs
diff --git a/mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfiguration.cs b/mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfiguration.cs
new file mode 100644 (file)
index 0000000..a62c270
--- /dev/null
@@ -0,0 +1,76 @@
+using System;\r
+using System.Collections;\r
+\r
+namespace Mainsoft.Drawing.Configuration\r
+{\r
+       /// <summary>\r
+       /// Summary description for ResolutionConfiguration.\r
+       /// </summary>\r
+       public class ResolutionConfiguration : IComparable\r
+       {\r
+               string _imageFormat = "";\r
+\r
+               string _xResPath = "";\r
+               string _yResPath = "";\r
+               string _unitsTypePath = "";\r
+\r
+               string _xResDefault = "";\r
+               string _yResDefault = "";\r
+               string _unitsTypeDefault = "";\r
+\r
+               Hashtable _unitScale;\r
+\r
+               public ResolutionConfiguration(\r
+                       string imageFormat,\r
+                       string xresPath, string yresPath, string unitsTypePath,\r
+                       string xresDefault, string yresDefault, string unitsTypeDefault,\r
+                       Hashtable unitScale)\r
+               {\r
+                       _imageFormat = imageFormat;\r
+\r
+                       _xResPath = xresPath;\r
+                       _yResPath = yresPath;\r
+                       _unitsTypePath = unitsTypePath;\r
+\r
+                       _xResDefault = xresDefault;\r
+                       _yResDefault = yresDefault;\r
+                       _unitsTypeDefault = unitsTypeDefault;\r
+\r
+                       _unitScale = unitScale;\r
+               }\r
+\r
+               public string XResPath {\r
+                       get { return _xResPath; }\r
+               }\r
+               public string XResDefault {\r
+                       get { return _xResDefault; }\r
+               }\r
+               public string YResPath {\r
+                       get { return _yResPath; }\r
+               }\r
+               public string YResDefault {\r
+                       get { return _yResDefault; }\r
+               }\r
+               public string UnitsTypePath {\r
+                       get { return _unitsTypePath; }\r
+               }\r
+               public string UnitsTypeDefault {\r
+                       get { return _unitsTypeDefault; }\r
+               }\r
+               public string ImageFormat {\r
+                       get { return _imageFormat; }\r
+               }\r
+               public Hashtable UnitsScale {\r
+                       get { return _unitScale; }\r
+               }\r
+\r
+               #region IComparable Members\r
+\r
+               public int CompareTo(object obj) {\r
+                       return _imageFormat.CompareTo(((ResolutionConfiguration)obj).ImageFormat);\r
+               }\r
+\r
+               #endregion\r
+\r
+       }\r
+}\r
diff --git a/mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfigurationCollection.cs b/mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfigurationCollection.cs
new file mode 100644 (file)
index 0000000..9dcbe40
--- /dev/null
@@ -0,0 +1,93 @@
+using System;\r
+using System.Collections;\r
+\r
+namespace Mainsoft.Drawing.Configuration {\r
+       /// <summary>\r
+       /// Summary description for MetadataConfigurationCollection.\r
+       /// </summary>\r
+       public class ResolutionConfigurationCollection  : IEnumerable, ICollection {\r
+\r
+               ArrayList _resolutionConfigurations;\r
+\r
+               #region ctors\r
+\r
+               internal ResolutionConfigurationCollection(ResolutionConfigurationCollection parent) {\r
+                       _resolutionConfigurations = new ArrayList();\r
+\r
+                       if (parent != null)\r
+                               _resolutionConfigurations.AddRange(parent);\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region methods\r
+\r
+               internal void Add(ResolutionConfiguration value) {\r
+                       _resolutionConfigurations.Add(value);\r
+               }\r
+\r
+               internal void Sort() {\r
+                       _resolutionConfigurations.Sort();\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region props\r
+\r
+               public ResolutionConfiguration this[int index] {\r
+                       get {\r
+                               return (ResolutionConfiguration)_resolutionConfigurations[index];\r
+                       }\r
+               }\r
+\r
+               public ResolutionConfiguration this[string ImageFormat] {\r
+                       get {\r
+                               for (int i=0; i < _resolutionConfigurations.Count; i++)\r
+                                       if ( ((ResolutionConfiguration)_resolutionConfigurations[i]).ImageFormat == ImageFormat )\r
+                                               return (ResolutionConfiguration)_resolutionConfigurations[i];\r
+                               return null;\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region IEnumerable Members\r
+\r
+               public IEnumerator GetEnumerator() {\r
+                       // TODO:  Add ResolutionConfigurationCollection.GetEnumerator implementation\r
+                       return _resolutionConfigurations.GetEnumerator();\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region ICollection Members\r
+\r
+               public bool IsSynchronized {\r
+                       get {\r
+                               // TODO:  Add ResolutionConfigurationCollection.IsSynchronized getter implementation\r
+                               return _resolutionConfigurations.IsSynchronized;\r
+                       }\r
+               }\r
+\r
+               public int Count {\r
+                       get {\r
+                               // TODO:  Add ResolutionConfigurationCollection.Count getter implementation\r
+                               return _resolutionConfigurations.Count;\r
+                       }\r
+               }\r
+\r
+               public void CopyTo(Array array, int index) {\r
+                       // TODO:  Add ResolutionConfigurationCollection.CopyTo implementation\r
+                       _resolutionConfigurations.CopyTo(array, index);\r
+               }\r
+\r
+               public object SyncRoot {\r
+                       get {\r
+                               // TODO:  Add ResolutionConfigurationCollection.SyncRoot getter implementation\r
+                               return _resolutionConfigurations.SyncRoot;\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfigurationHandler.cs b/mcs/class/System.Drawing/Mainsoft.Drawing.Configuration.jvm/ResolutionConfigurationHandler.cs
new file mode 100644 (file)
index 0000000..18698ff
--- /dev/null
@@ -0,0 +1,140 @@
+using System;\r
+using System.Collections;\r
+using System.Configuration;\r
+using System.Xml;\r
+\r
+\r
+namespace Mainsoft.Drawing.Configuration\r
+{\r
+       /// <summary>\r
+       /// Summary description for MetadataConfigurationHandler.\r
+       /// </summary>\r
+       public class ResolutionConfigurationHandler : IConfigurationSectionHandler\r
+       {\r
+               public ResolutionConfigurationHandler()\r
+               {\r
+                       //\r
+                       // TODO: Add constructor logic here\r
+                       //\r
+               }\r
+\r
+               public virtual object Create (object parent, object configContext, XmlNode section) {\r
+\r
+                       if (section.Attributes != null && section.Attributes.Count != 0)\r
+                               HandlersUtil.ThrowException ("Unrecognized attribute", section);\r
+\r
+                       ResolutionConfigurationCollection col = \r
+                               new ResolutionConfigurationCollection(parent as ResolutionConfigurationCollection);\r
+\r
+                       XmlNodeList imageFormats = section.ChildNodes;\r
+                       foreach (XmlNode child in imageFormats) {\r
+                               \r
+                               XmlNodeType ntype = child.NodeType;\r
+                               if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)\r
+                                       continue;\r
+\r
+                               if (ntype != XmlNodeType.Element)\r
+                                       HandlersUtil.ThrowException ("Only elements allowed", child);\r
+\r
+                               string imageFormatName = HandlersUtil.ExtractAttributeValue ("name", child, false, false);\r
+\r
+                               string xResPath = HandlersUtil.ExtractNodeValue(child["xresolution"]);\r
+                               string yResPath = HandlersUtil.ExtractNodeValue(child["yresolution"]);\r
+                               string unitsType = HandlersUtil.ExtractNodeValue(child["unitstype"], false, true);\r
+\r
+                               string xResDefault = HandlersUtil.ExtractAttributeValue ("default", child["xresolution"]);\r
+                               string yResDefault = HandlersUtil.ExtractAttributeValue ("default", child["yresolution"]);\r
+                               string unitsTypeDefault = HandlersUtil.ExtractAttributeValue ("default", child["unitstype"], true);\r
+\r
+                               Hashtable unitScale = new Hashtable(3);\r
+\r
+                               XmlNodeList unitScaleNodes = child.SelectNodes("unitscale");\r
+                               foreach (XmlNode unitScaleNode in unitScaleNodes) {\r
+                                       unitScale.Add(\r
+                                               HandlersUtil.ExtractAttributeValue ("value", unitScaleNode),\r
+                                               HandlersUtil.ExtractNodeValue(unitScaleNode) );\r
+                               }\r
+\r
+                               ResolutionConfiguration resConf = new ResolutionConfiguration(\r
+                                       imageFormatName,\r
+                                       xResPath, yResPath, unitsType,\r
+                                       xResDefault, yResDefault, unitsTypeDefault,\r
+                                       unitScale);\r
+                               \r
+                               col.Add(resConf);\r
+                       }\r
+\r
+                       col.Sort();\r
+                       return col;\r
+               }\r
+       }\r
+\r
+       internal sealed class HandlersUtil {\r
+               private HandlersUtil () {\r
+               }\r
+\r
+               static internal string ExtractNodeValue(XmlNode node, bool optional, bool allowEmpty) {\r
+                       if (node == null) {\r
+                               if (optional)\r
+                                       return null;\r
+                               ThrowException ("Required node not found", node);\r
+                       }\r
+\r
+                       string nodeValue = node.InnerText;\r
+\r
+                       if (!allowEmpty && nodeValue == String.Empty) {\r
+                               string opt = optional ? "Optional" : "Required";\r
+                               ThrowException (opt + " node is empty", node);\r
+                       }\r
+\r
+                       return nodeValue;\r
+               }\r
+\r
+               static internal string ExtractNodeValue(XmlNode node, bool optional) {\r
+                       return ExtractNodeValue(node, false, false);\r
+               }\r
+\r
+               static internal string ExtractNodeValue(XmlNode node) {\r
+                       return ExtractNodeValue(node, false);\r
+               }\r
+\r
+               static internal string ExtractAttributeValue (string attKey, XmlNode node) {\r
+                       return ExtractAttributeValue (attKey, node, false);\r
+               }\r
+                       \r
+               static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional) {\r
+                       return ExtractAttributeValue (attKey, node, optional, false);\r
+               }\r
+               \r
+               static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional,\r
+                       bool allowEmpty) {\r
+                       if (node.Attributes == null) {\r
+                               if (optional)\r
+                                       return null;\r
+\r
+                               ThrowException ("Required attribute not found: " + attKey, node);\r
+                       }\r
+\r
+                       XmlNode att = node.Attributes.RemoveNamedItem (attKey);\r
+                       if (att == null) {\r
+                               if (optional)\r
+                                       return null;\r
+                               ThrowException ("Required attribute not found: " + attKey, node);\r
+                       }\r
+\r
+                       string value = att.Value;\r
+                       if (!allowEmpty && value == String.Empty) {\r
+                               string opt = optional ? "Optional" : "Required";\r
+                               ThrowException (opt + " attribute is empty: " + attKey, node);\r
+                       }\r
+\r
+                       return value;\r
+               }\r
+\r
+               static internal void ThrowException (string msg, XmlNode node) {\r
+                       if (node != null && node.Name != String.Empty)\r
+                               msg = msg + " (node name: " + node.Name + ") ";\r
+                       throw new ConfigurationException (msg, node);\r
+               }\r
+       }\r
+}\r
index f79e4d8831121335e12da3aed10523adae0fd8d8..3631d2d001ad5506a6a6fbbe93fda53495c748a9 100644 (file)
@@ -6,6 +6,9 @@ LIBRARY = System.Drawing.dll
 
 LIB_MCS_FLAGS = /unsafe /r:$(corlib) /r:System.dll /nowarn:649 /nowarn:169 /codepage:28591
 
-TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) /r:System.Drawing.dll -nowarn:0618 -nowarn:219 -nowarn:169 -nowarn:1595
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -resource:Test/resources/indexed.png,indexed.png \
+        /r:System.Drawing.dll -nowarn:0618 -nowarn:219 -nowarn:169 -nowarn:1595
 
 include ../../build/library.make
+
+EXTRA_DISTFILES = Test/resources/indexed.png
\ No newline at end of file
index bdb7f8e881e7afb700e5a3878e709949e3a03bdd..510876334287982ac9cb3db98249395e762be08d 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-06  Jordi Mas <jordi@ximian.com>
+
+       * clipping: Sample to test clipping
+
 2004-06-17  Ravindra <rkumar@novell.com>
 
        * BmpPaint.cs: Fixed, formatted and moved here from
diff --git a/mcs/class/System.Drawing/Samples/System.Drawing/clipping.cs b/mcs/class/System.Drawing/Samples/System.Drawing/clipping.cs
new file mode 100644 (file)
index 0000000..e7541cc
--- /dev/null
@@ -0,0 +1,103 @@
+//
+// Author:
+//   Jordi Mas i Hernandez
+//
+// Sample to test clipping. Requires SWF.
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Windows.Forms;
+using System.Drawing;
+using System;
+
+namespace MyFormProject
+{
+
+
+       class MainForm : System.Windows.Forms.Form
+       {
+               class ourLabelTwoAreas : Label
+               {
+                       public ourLabelTwoAreas ()
+                       {
+
+                       }
+                       protected override void OnPaint (PaintEventArgs pevent)
+                       {
+                               Console.WriteLine ("ourLabelTwoAreas pevents {0}, pos {1} - size {2}", pevent.ClipRectangle,
+                                       Location, Size);
+
+                               Region reg = new Region (new Rectangle (20, 20, 10, 10));
+                               reg.Union (new Rectangle (5, 5, 10, 10));
+                               pevent.Graphics.Clip  = reg;
+                               pevent.Graphics.FillRectangle (Brushes.Red, pevent.ClipRectangle);
+                       }
+               }
+
+               class ourLabelOverflows : Label
+               {
+                       public ourLabelOverflows ()
+                       {
+
+                       }
+                       protected override void OnPaint (PaintEventArgs pevent)
+                       {
+                               Console.WriteLine ("ourLabelOverflows pevents {0}, pos {1} - size {2}", pevent.ClipRectangle,
+                                       Location, Size);
+
+                               pevent.Graphics.FillRectangle (Brushes.Yellow,
+                                       new Rectangle (0,0, 1000, 1000));
+                       }
+               }
+
+               protected override void OnPaint (PaintEventArgs pevent)
+               {
+                       pevent.Graphics.FillRectangle (Brushes.Green, pevent.ClipRectangle);
+               }
+
+               static private ourLabelTwoAreas label = new ourLabelTwoAreas ();
+               static private ourLabelOverflows label2 = new ourLabelOverflows ();
+
+               public MainForm ()
+               {
+                       label.Location = new Point (20, 20);
+                       label.Size = new Size (50, 80);
+                       label.Text = "Hola";
+                       Controls.Add (label);
+
+                       label2.Location = new Point (100, 100);
+                       label2.Size = new Size (50, 80);
+                       label2.Text = "Hola";
+                       Controls.Add (label2);
+
+                       ClientSize = new Size (400, 400);
+               }
+
+               public static void Main(string[] args)
+               {
+                       Application.Run (new MainForm ());
+               }
+       }
+
+}
+
index c60e6dc83872ffd08f247dfd9d8a1eedc30fe02c..a2754641c76175650b02d470e4cc09d2dbff54d2 100644 (file)
@@ -10,7 +10,7 @@
 // 
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 //
 
 using System.Collections;
+using System.Security.Permissions;
 
 namespace System.Drawing.Design
 {
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
        public sealed class CategoryNameCollection : ReadOnlyCollectionBase
        {
                
-               public CategoryNameCollection (CategoryNameCollection value) {
+               public CategoryNameCollection (CategoryNameCollection value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
                        InnerList.AddRange (value);
                }
 
-               public CategoryNameCollection(string[] value) {
+               public CategoryNameCollection (string[] value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
                        InnerList.AddRange (value);
                }
 
index 303f37a3e2b8105daab0af200b9eb20ba80e957b..50b47ac4ba000ea0f8cb71be37bd829982790b99 100644 (file)
@@ -1,3 +1,22 @@
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * CategoryNameCollection.cs: Added LinkDemand for Unrestricted 
+       permissions. Added null checks in constructors.
+       * PaintValueEventArgs.cs: Added LinkDemand and InheritanceDemand for 
+       Unrestricted permissions. Added null checks in constructor.
+       * PropertyValueItem.cs: Added LinkDemand and InheritanceDemand for 
+       Unrestricted permissions. Added null checks in constructor.
+       * ToolboxComponentsCreatedEventArgs.cs: Added LinkDemand and 
+       InheritanceDemand for Unrestricted permissions.
+       * ToolboxComponentsCreatingEventArgs.cs: Added LinkDemand and 
+       InheritanceDemand for Unrestricted permissions.
+       * ToolboxItem.cs: Added LinkDemand and InheritanceDemand for 
+       Unrestricted permissions.
+       * ToolboxItemCollection.cs: Added LinkDemand for Unrestricted 
+       permissions.
+       * UITypeEditor.cs: Added LinkDemand and InheritanceDemand for 
+       Unrestricted permissions.
+
 2005-08-24 Michael Hutchinson <m.j.hutchinson@gmail.com>
 
        * ToolboxItem.cs: Implemented retrieving item's bitmap
index 8a639483b182ae2c3e372cf86af0c97e6c650528..9c3ba7dd8d6179e31d298c6baab6da412f4b4767 100644 (file)
@@ -7,7 +7,7 @@
 // 
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 //
 
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Drawing.Design
 {
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
        public class PaintValueEventArgs : EventArgs
        {
                private ITypeDescriptorContext context;
@@ -40,7 +43,10 @@ namespace System.Drawing.Design
                private Graphics graphics;
                private Rectangle bounds;
                
-               public PaintValueEventArgs(ITypeDescriptorContext context, object value, Graphics graphics, Rectangle bounds) {
+               public PaintValueEventArgs(ITypeDescriptorContext context, object value, Graphics graphics, Rectangle bounds) 
+               {
+                       if (graphics == null)
+                               throw new ArgumentNullException ("graphics");
                        this.context = context;
                        this.value = value;
                        this.graphics = graphics;
index f3d7132e7bf62c299abc77f33c9038e8e4ca8e35..b9eaaf6fe0d9b2f5cf360c2c656edd61031b8aef 100644 (file)
@@ -10,7 +10,7 @@
 // 
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Drawing;
+using System.Security.Permissions;
 
 namespace System.Drawing.Design
 {
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
        public class PropertyValueUIItem
        {
 
@@ -46,6 +48,10 @@ namespace System.Drawing.Design
                public PropertyValueUIItem (Image uiItemImage,
                        PropertyValueUIItemInvokeHandler handler, string tooltip)
                {
+                       if (uiItemImage == null)
+                               throw new ArgumentNullException ("uiItemImage");
+                       if (handler == null)
+                               throw new ArgumentNullException ("handler");
                        this.uiItemImage = uiItemImage;
                        this.handler = handler;
                        this.tooltip = tooltip;
index a1855d101cfd6300e73d673a714e14c393ccdda5..65790a107684b596065415614345e4ec55fff2aa 100644 (file)
@@ -8,7 +8,7 @@
 //
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 //
 
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Drawing.Design
 {
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
        public class ToolboxComponentsCreatedEventArgs : EventArgs
        {
                private IComponent[] components;
index 4e387a9162cf87161aa36fb1cbc6eb7500594edc..cd7c35346de295e2817894d5041f9c320f67e059 100644 (file)
@@ -8,7 +8,7 @@
 // 
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 //
 
 using System.ComponentModel.Design;
+using System.Security.Permissions;
 
 namespace System.Drawing.Design
 {
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
        public class ToolboxComponentsCreatingEventArgs : EventArgs
        {
                private IDesignerHost host;
index f1547ce393ebc89b6a4a8c9ee5136435b8acbe34..1487a027ad17abbb12651f1fa5f23d786959a57c 100644 (file)
@@ -10,7 +10,7 @@
 //
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 using System.Collections;
 using System.ComponentModel;
 using System.ComponentModel.Design;
-using System.Drawing;
 using System.Reflection;
 using System.Runtime.Serialization;
+using System.Security.Permissions;
 
 namespace System.Drawing.Design 
 {
        [Serializable]
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
        public class ToolboxItem : ISerializable
        {
 
index 1c613290fdd2efafe8aca89409622c3ae4e62356..dc76d7a48e21f9eb8ac05557cd672dad27d80fb7 100644 (file)
@@ -10,7 +10,7 @@
 //
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 //
 
 using System.Collections;
+using System.Security.Permissions;
 
 namespace System.Drawing.Design
 {
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
        public sealed class ToolboxItemCollection : ReadOnlyCollectionBase
        {
 
index 51272dc6caa8c66d00f8955b661a2718ebfaa2a9..8c5ada85a0734b623233df95f1f93a7c6c9988ab 100644 (file)
@@ -10,7 +10,7 @@
 // 
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.ComponentModel;
+using System.Security.Permissions;
+
 namespace System.Drawing.Design
 {
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
        public class UITypeEditor
        {
 
index 55927689a292b1e91e1d8259ada32bdba4cc5d91..127ca1d988a249a746a5b62741e63bd0c563ce27 100644 (file)
@@ -1,3 +1,53 @@
+2005-09-14 Konstantin Triger <kostat@mainsoft.com>
+
+       * GraphicsPath.jvm.cs: fix drawing arcs for angles >= 360
+
+2005-09-14 Konstantin Triger <kostat@mainsoft.com>
+
+       * GraphicsState.jvm.cs: container
+
+2005-09-11 Konstantin Triger <kostat@mainsoft.com>
+
+       * GraphicsState.jvm.cs: fixing visible window for containers
+
+2005-09-07 Konstantin Triger <kostat@mainsoft.com>
+
+       * GraphicsPath.jvm.cs: correct angle to compute the quarter
+
+2005-09-07 Konstantin Triger <kostat@mainsoft.com>
+
+       * Matrix.jvm.cs: Fix copy order in CopyTo
+
+2005-09-07 Boris Kirzner <borisk@mainsoft.com>
+
+       * ExtendedGeneralPath.jvm.cs: Cache PathData and GeneralPath.
+       * PathData.cs: always return cloned points and types. Use internals
+       without clone for internal processing.
+
+2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * LinearGradientBrush.jvm.cs: FIxed transform methods
+       * Matrix.jvm.cs: Added CopyTo(), fixed Invert()
+
+2005-09-06 Boris Kirzner <borisk@mainsoft.com>
+
+       * ExtendedGeneralPath.jvm.cs: Imported functionality from GraphicsPAth. 
+       Added copyright.
+       * GeneralPathIterator.jvm.cs: Added copyright.
+       * GraphicsPath.jvm.cs: Implemented methods. Some functionality moved 
+       to ExtendedGeneralPath. Added copyright.
+       * GraphicsPathIterator.jvm.cs: Implemented.
+
+2005-09-06 Konstantin Triger <kostat@mainsoft.com>
+
+       * Matrix.jvm.cs: fix scale, added static IdentityMatrix
+       * GraphicsState.jvm.cs, GraphicsContainer.jvm.cs: fix
+               containers implementation
+
+2005-08-30 Boris Kirzner <borisk@mainsoft.com>
+
+       * Matrix.jvm.cs: Bug fix
+
 2005-08-30 Vladimir Krasnov <vladimirk@mainsoft.com>
 
        * LinearGradientBrush.jvm.cs: Refactoring, bug fix
index 2ce4d614a21f0538260e994b327723c796ef9105..993857cf724d6a01e566a33b23f184005cf0266d 100644 (file)
@@ -1,3 +1,31 @@
+//
+// System.Drawing.Drawing2D.ExtendedGeneralPath.cs
+//
+// Author:
+// Bors Kirzner <boris@mainsoft.com>   
+//
+// Copyright (C) 2005 Mainsoft Corporation, (http://www.mainsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//\r
+\r
 using System;\r
 \r
 using java.awt;\r
@@ -32,6 +60,9 @@ namespace System.Drawing.Drawing2D
                private int _coordsCount;\r
                private int _windingRule;\r
 \r
+               private PathData _pathData;\r
+               private GeneralPath _generalPath;\r
+\r
                const int INIT_SIZE = 20;\r
                const int EXPAND_MAX = 500;\r
 \r
@@ -61,8 +92,7 @@ namespace System.Drawing.Drawing2D
                private ExtendedGeneralPath(int rule, int initialTypes, int initialCoords) \r
                {\r
                        setWindingRule(rule);\r
-                       _types = new sbyte [initialTypes];\r
-                       _coords = new float [initialCoords * 2];\r
+                       Reset (initialTypes, initialCoords);\r
                }\r
 \r
                #endregion // Constructors\r
@@ -72,10 +102,10 @@ namespace System.Drawing.Drawing2D
                private GeneralPath GeneralPath\r
                {\r
                        get {\r
-                               PathIterator iter = getPathIterator (null);\r
-                               GeneralPath path = new GeneralPath ();\r
-                               path.append (iter, false);\r
-                               return path;\r
+                               if (_generalPath == null) {                             \r
+                                       _generalPath = GetGeneralPath ();\r
+                               }\r
+                               return _generalPath;\r
                        }\r
                }\r
 \r
@@ -108,12 +138,95 @@ namespace System.Drawing.Drawing2D
                        }\r
                }\r
 \r
+               public int PointCount\r
+               {\r
+                       get {\r
+                               return CoordsCount / 2;\r
+                       }\r
+               }\r
 \r
+               public PathData PathData \r
+               {\r
+                       get \r
+                       {\r
+                               if (_pathData == null)\r
+                                       _pathData = GetPathData ();\r
+                               \r
+                               return _pathData;\r
+                       }\r
+               }\r
 \r
                #endregion // Properties\r
 \r
                #region Methods\r
 \r
+               #region CachedData\r
+\r
+               private void ClearCache ()\r
+               {\r
+                       _pathData = null;\r
+                       _generalPath = null;\r
+               }\r
+\r
+               private GeneralPath GetGeneralPath ()\r
+               {\r
+                       PathIterator iter = getPathIterator (null);\r
+                       GeneralPath path = new GeneralPath ();\r
+                       path.append (iter, false);\r
+                       return path;\r
+               }\r
+\r
+               private PathData GetPathData ()\r
+               {\r
+                       PathData pathData = new PathData();\r
+                       pathData.Types = new byte [PointCount];\r
+                       pathData.Points = new PointF [PointCount];\r
+                       int tpos = 0;\r
+                       int ppos = 0;\r
+                       int cpos = 0;\r
+                       byte marker;\r
+                       bool start;\r
+                       for (int i = 0; i < TypesCount; i++) {\r
+                               sbyte segmentType = (sbyte)(Types [i] & SEG_MASK);\r
+\r
+                               // set the masks and the markers\r
+                               marker = ((Types [i] & SEG_MARKER) != 0) ? (byte)PathPointType.PathMarker : (byte)0;\r
+                               start = ((Types [i] & SEG_START) != 0);\r
+                               \r
+                               switch (segmentType) {\r
+                                       case SEG_CLOSE:\r
+                                               pathData.InternalTypes [tpos - 1] = (byte) (pathData.InternalTypes [tpos - 1] | (byte) PathPointType.CloseSubpath | marker);\r
+                                               break;\r
+                                       case SEG_MOVETO:\r
+                                               pathData.InternalTypes [tpos++] = (byte)((byte) PathPointType.Start | marker);\r
+                                               pathData.InternalPoints [ppos++] = new PointF (Coords [cpos++], Coords [cpos++]);\r
+                                               break;\r
+                                       case SEG_LINETO:\r
+                                               pathData.InternalTypes [tpos++] = (byte) ((byte) PathPointType.Line | marker);\r
+                                               pathData.InternalPoints [ppos++] = new PointF (Coords [cpos++], Coords [cpos++]);\r
+                                               break;\r
+                                       case SEG_QUADTO:\r
+                                               // FIXME : use 4 cp , two of which \r
+                                               pathData.InternalTypes [tpos++] = (byte)(byte) PathPointType.Bezier;\r
+                                               pathData.InternalPoints [ppos++] = new PointF (Coords [cpos++], Coords [cpos++]);\r
+                                               pathData.InternalTypes [tpos++] = (byte) ((byte)PathPointType.Bezier | marker);\r
+                                               pathData.InternalPoints [ppos++] = new PointF (Coords [cpos++], Coords [cpos++]);\r
+                                               break;\r
+                                       case SEG_CUBICTO:\r
+                                               pathData.InternalTypes [tpos++] = (byte)(byte) PathPointType.Bezier3;\r
+                                               pathData.InternalPoints [ppos++] = new PointF (Coords [cpos++], Coords [cpos++]);\r
+                                               pathData.InternalTypes [tpos++] = (byte) PathPointType.Bezier3;\r
+                                               pathData.InternalPoints [ppos++] = new PointF (Coords [cpos++], Coords [cpos++]);\r
+                                               pathData.InternalTypes [tpos++] = (byte) ((byte)PathPointType.Bezier3 | marker);\r
+                                               pathData.InternalPoints [ppos++] = new PointF (Coords [cpos++], Coords [cpos++]);\r
+                                               break;\r
+                               }\r
+                       }\r
+                       return pathData;\r
+               }\r
+\r
+               #endregion // CachedData\r
+\r
                public void append(Shape s)\r
                {\r
                        append (s, !LastFigureClosed);\r
@@ -123,6 +236,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void append(PathIterator pi, bool connect) \r
                {\r
+                       ClearCache ();\r
                        float [] coords = new float [6];\r
                        while (!pi.isDone ()) {\r
                                switch (pi.currentSegment (coords)) {\r
@@ -162,7 +276,7 @@ namespace System.Drawing.Drawing2D
 \r
                public object Clone() \r
                {\r
-                       ExtendedGeneralPath copy = new ExtendedGeneralPath ();\r
+                       ExtendedGeneralPath copy = (ExtendedGeneralPath)MemberwiseClone ();\r
                        copy._types = (sbyte []) _types.Clone ();\r
                        copy._coords = (float []) _coords.Clone ();\r
                        return copy;\r
@@ -170,6 +284,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void closePath() \r
                {\r
+                       ClearCache ();\r
                        if (_typesCount == 0 || _types[_typesCount - 1] != SEG_CLOSE) {\r
                                needRoom (1, 0, true);\r
                                _types [_typesCount++] = SEG_CLOSE;\r
@@ -207,6 +322,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) \r
                {\r
+                       ClearCache ();\r
                        needRoom (1, 6, true);\r
                        _types [_typesCount++] = SEG_CUBICTO;\r
                        _coords [_coordsCount++] = x1;\r
@@ -299,6 +415,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void lineTo(float x, float y) \r
                {\r
+                       ClearCache ();\r
                        needRoom (1, 2, true);\r
                        _types [_typesCount++] = SEG_LINETO;\r
                        _coords [_coordsCount++] = x;\r
@@ -307,6 +424,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void moveTo(float x, float y) \r
                {\r
+                       ClearCache ();\r
                        if (_typesCount > 0 && _types [_typesCount - 1] == SEG_MOVETO) {\r
                                _coords [_coordsCount - 2] = x;\r
                                _coords [_coordsCount - 1] = y;\r
@@ -321,6 +439,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void quadTo(float x1, float y1, float x2, float y2) \r
                {\r
+                       ClearCache ();\r
                        needRoom (1, 4, true);\r
                        _types [_typesCount++] = SEG_QUADTO;\r
                        _coords [_coordsCount++] = x1;\r
@@ -331,6 +450,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void reset() \r
                {\r
+                       ClearCache ();\r
                        _typesCount = 0;\r
                        _coordsCount = 0;\r
                }\r
@@ -345,6 +465,7 @@ namespace System.Drawing.Drawing2D
 \r
                public void transform(AffineTransform at) \r
                {\r
+                       ClearCache ();\r
                        at.transform (_coords, 0, _coords, 0, _coordsCount/2);\r
                }\r
 \r
@@ -385,17 +506,159 @@ namespace System.Drawing.Drawing2D
 \r
                public void SetMarkers()\r
                {\r
-                       Types [ TypesCount - 1] |= SEG_MARKER;\r
+                       ClearCache ();\r
+                       if (TypesCount > 0)\r
+                               Types [ TypesCount - 1] |= SEG_MARKER;\r
                }\r
 \r
                public void ClearMarkers()\r
                {\r
+                       ClearCache ();\r
                        for (int i = 0; i < TypesCount; i++)\r
                                Types [i] &= ~SEG_MARKER;\r
                }\r
 \r
+               public void StartFigure ()\r
+               {\r
+                       ClearCache ();\r
+                       if (TypesCount > 0)\r
+                               Types [TypesCount - 1] |= ExtendedGeneralPath.SEG_START;\r
+               }\r
+\r
+               private void Reset (int initialTypes, int initialCoords)\r
+               {\r
+                       ClearCache ();\r
+                       _types = new sbyte [initialTypes];\r
+                       _coords = new float [initialCoords * 2];\r
+                       _typesCount = 0;\r
+                       _coordsCount = 0;\r
+               }\r
+\r
+               internal void Clear ()\r
+               {\r
+                       Reset (INIT_SIZE, INIT_SIZE);\r
+               }\r
+\r
+               internal void Reverse ()\r
+               {\r
+                       ClearCache ();\r
+                       // revert coordinates\r
+                       for (int i=0, max = CoordsCount / 2; i < max;) {\r
+                               int ix = i++;\r
+                               int iy = i++;\r
+                               int rix = CoordsCount - i;\r
+                               int riy = rix + 1;\r
+                               float tmpx = Coords [ix];\r
+                               float tmpy = Coords [iy];\r
+                               Coords [ix] = Coords [rix];\r
+                               Coords [iy] = Coords [riy];\r
+                               Coords [rix] = tmpx;\r
+                               Coords [riy] = tmpy;\r
+                       }\r
+\r
+                       // revert types\r
+                       sbyte [] newTypes = new sbyte [TypesCount];\r
+                       int oldIdx = 0;\r
+                       int newIdx = TypesCount - 1;\r
+                       int copyStart;\r
+                       int copyEnd;\r
+                       sbyte mask1 = 0;\r
+                       sbyte mask2 = 0;\r
+                       sbyte closeMask = 0;\r
+                       bool closedFigure = false;\r
+                       \r
+                       while (oldIdx < TypesCount) {\r
+                               // start copying after moveto\r
+                               copyStart = ++oldIdx;\r
+                               // continue to the next figure start\r
+                               while ((Types [oldIdx] != SEG_MOVETO) && (oldIdx < TypesCount))\r
+                                       oldIdx++;\r
+\r
+                               copyEnd = oldIdx - 1;\r
+                               // check whenever current figure is closed\r
+                               if ((Types [oldIdx - 1] & SEG_CLOSE) != 0) {\r
+                                       closedFigure = true;\r
+                                       // close figure\r
+                                       newTypes [newIdx--] = (sbyte)(SEG_CLOSE | mask1);\r
+                                       mask1 = 0;\r
+                                       mask2 = 0;\r
+                                       // end copy one cell earlier\r
+                                       copyEnd--;\r
+                                       closeMask = (sbyte)(Types [oldIdx - 1] & (sbyte)SEG_MARKER);\r
+                               }\r
+                               else {\r
+                                       mask2 = mask1;\r
+                                       mask1 = 0;\r
+                               }\r
+\r
+                               // copy reverted "inner" types\r
+                               for(int i = copyStart; i <= copyEnd; i++) {\r
+                                       newTypes [newIdx--] = (sbyte)((Types [i] & SEG_MASK) | mask2);\r
+                                       mask2 = mask1;\r
+                                       mask1 = (sbyte)(Types [i] & (sbyte)SEG_MARKER);\r
+                               }\r
+\r
+                               // copy moveto\r
+                               newTypes [newIdx--] = SEG_MOVETO;\r
+\r
+                               // pass close mask to the nex figure\r
+                               if (closedFigure) {\r
+                                       mask1 = closeMask;\r
+                                       closedFigure = false;\r
+                               }\r
+                       }\r
+\r
+                       _types = newTypes;\r
+               }\r
+\r
+               public PointF GetLastPoint ()\r
+               {\r
+                       if (CoordsCount == 0)\r
+                               throw new System.ArgumentException ("Invalid parameter used.");\r
+\r
+                       return new PointF (Coords [CoordsCount - 2], Coords [CoordsCount - 1]);\r
+               }\r
+\r
                #endregion //Methods\r
 \r
+               #region Private helpers\r
+\r
+#if DEBUG\r
+               private void Print()\r
+               {\r
+                       Console.WriteLine ("\n\n");\r
+                       float [] fpoints = _coords;\r
+                       int cpos = 0;\r
+                       for (int i=0; i < _typesCount; i++) {\r
+                               sbyte type = _types [i];\r
+                               string marker = String.Empty;\r
+                               if ((type & SEG_MARKER) != 0)\r
+                                       marker = " | MARKER";\r
+\r
+                               switch (type & SEG_MASK) {\r
+                                       case SEG_CLOSE:\r
+                                               Console.WriteLine ("CLOSE {0}",marker);\r
+                                               break;\r
+                                       case SEG_MOVETO:\r
+                                               Console.WriteLine("{0}{3} ({1},{2})","MOVETO", fpoints[cpos++], fpoints[cpos++], marker);\r
+                                               break;\r
+                                       case SEG_LINETO:\r
+                                               Console.WriteLine("{0}{3} ({1},{2})","LINETO", fpoints[cpos++], fpoints[cpos++], marker);\r
+                                               break;\r
+                                       case SEG_QUADTO:\r
+                                               Console.WriteLine("{0}{3} ({1},{2})","QUADTO", fpoints[cpos++], fpoints[cpos++], marker);\r
+                                               Console.WriteLine("       ({1},{2})","QUADTO", fpoints[cpos++], fpoints[cpos++]);\r
+                                               break;\r
+                                       case SEG_CUBICTO:\r
+                                               Console.WriteLine("{0}{3} ({1},{2})","CUBICTO", fpoints[cpos++], fpoints[cpos++], marker);\r
+                                               Console.WriteLine("        ({1},{2})","CUBICTO", fpoints[cpos++], fpoints[cpos++]);\r
+                                               Console.WriteLine("        ({1},{2})","CUBICTO", fpoints[cpos++], fpoints[cpos++]);\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+#endif\r
+               #endregion // Private helpers\r
                \r
        }\r
 }\r
index 77da636b5e1dae350d586d7bdc22bbfd3cbc6212..1cfa230a4e820b91d7aad61577214ea1830a4f76 100644 (file)
@@ -1,3 +1,31 @@
+//
+// System.Drawing.Drawing2D.GeneralPathIterator.cs
+//
+// Author:
+// Bors Kirzner <boris@mainsoft.com>   
+//
+// Copyright (C) 2005 Mainsoft Corporation, (http://www.mainsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+\r
 using System;\r
 \r
 using java.awt.geom;\r
index 5b2aa5ac1e4f40897d81507bc6ed830ce44933ab..7981c0acd09305ec7e556427569948e713932bc2 100644 (file)
@@ -39,13 +39,9 @@ namespace System.Drawing.Drawing2D
        /// </summary>
        public sealed class GraphicsContainer : MarshalByRefObject\r
        {
-               GraphicsState _stateObject;
+               readonly GraphicsState _stateObject;
                
-               internal GraphicsContainer ()
-               {
-               }
-
-               internal GraphicsContainer (GraphicsState stateObject) : base()
+               internal GraphicsContainer (GraphicsState stateObject)
                {
                        _stateObject = stateObject;
                }
index 570deed956a77fa24fe23f895c8198fef3fe4c68..bdbacec20dd41838f71d6e8162cf40e06fbf2f41 100755 (executable)
@@ -1,3 +1,31 @@
+//
+// System.Drawing.Drawing2D.GraphicsPath.cs
+//
+// Author:
+// Konstantin Triger <kostat@mainsoft.com>
+// Bors Kirzner <boris@mainsoft.com>   
+//
+// Copyright (C) 2005 Mainsoft Corporation, (http://www.mainsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//\r
 using System;\r
 using System.Drawing;\r
 using System.Collections;\r
@@ -53,51 +81,13 @@ namespace System.Drawing.Drawing2D
                public GraphicsPath (Point [] pts, byte [] types, FillMode fillMode) : this(new ExtendedGeneralPath ())\r
                {\r
                        FillMode = fillMode;\r
-                       for (int i=0; i < pts.Length; i++) {\r
-                               switch ((PathPointType)types [i]) {\r
-                                       case PathPointType.Start :\r
-                                               NativeObject.moveTo (pts [i].X, pts [i].Y);\r
-                                               break;\r
-                                       case PathPointType.Bezier3 :\r
-                                               float x1 = pts [i].X;\r
-                                               float y1 = pts [i].Y;\r
-                                               i++;\r
-                                               float x2 = pts [i].X;\r
-                                               float y2 = pts [i].Y;\r
-                                               i++;\r
-                                               float x3 = pts [i].X;\r
-                                               float y3 = pts [i].Y;\r
-                                               NativeObject.curveTo (x1,y1, x2, y2, x3, y3);\r
-                                               break;                                          \r
-                               }\r
-                               if (((PathPointType)types [i] & PathPointType.CloseSubpath) != 0)\r
-                                       NativeObject.closePath();\r
-                       }       \r
+                       SetPath (pts, types);\r
                }\r
 \r
                public GraphicsPath (PointF [] pts, byte [] types, FillMode fillMode) : this(new ExtendedGeneralPath ())\r
                {\r
                        FillMode = fillMode;\r
-                       for (int i=0; i < pts.Length; i++) {\r
-                               switch ((PathPointType)types [i]) {\r
-                                       case PathPointType.Start :\r
-                                               NativeObject.moveTo (pts [i].X, pts [i].Y);\r
-                                               break;\r
-                                       case PathPointType.Bezier3 :\r
-                                               float x1 = pts [i].X;\r
-                                               float y1 = pts [i].Y;\r
-                                               i++;\r
-                                               float x2 = pts [i].X;\r
-                                               float y2 = pts [i].Y;\r
-                                               i++;\r
-                                               float x3 = pts [i].X;\r
-                                               float y3 = pts [i].Y;\r
-                                               NativeObject.curveTo (x1,y1, x2, y2, x3, y3);\r
-                                               break;\r
-                               }\r
-                               if (((PathPointType)types [i] & PathPointType.CloseSubpath) != 0)\r
-                                       NativeObject.closePath();\r
-                       }\r
+                       SetPath (pts, types);\r
                }\r
 \r
                #endregion\r
@@ -130,51 +120,7 @@ namespace System.Drawing.Drawing2D
 \r
                public PathData PathData \r
                {\r
-                       get \r
-                       {\r
-                               PathIterator iter = NativeObject.getPathIterator(null);\r
-                               PathData pathData = new PathData();\r
-                               pathData.Types = new byte [PointCount];\r
-                               pathData.Points = new PointF [PointCount];\r
-                               int tpos = 0;\r
-                               int ppos = 0;\r
-                               float [] jpoints = new float [6];\r
-                               while (!iter.isDone ()) {\r
-                                       //if (tpos == 0)\r
-                                       //      pathData.Types [tpos++] = PathPointType.Start;\r
-\r
-                                       JPI segmentType = (JPI)iter.currentSegment (jpoints);\r
-                                       switch (segmentType) {\r
-                                               case JPI.SEG_CLOSE:\r
-                                                       pathData.Types [tpos - 1] = (byte) (pathData.Types [tpos - 1] | (byte) PathPointType.CloseSubpath);\r
-                                                       break;\r
-                                               case JPI.SEG_MOVETO:\r
-                                                       pathData.Types [tpos++] = (byte) PathPointType.Start;\r
-                                                       pathData.Points [ppos++] = new PointF (jpoints [0], jpoints [1]);\r
-                                                       break;\r
-                                               case JPI.SEG_LINETO:\r
-                                                       pathData.Types [tpos++] = (byte) PathPointType.Line;\r
-                                                       pathData.Points [ppos++] = new PointF (jpoints [0], jpoints [1]);\r
-                                                       break;\r
-                                               case JPI.SEG_QUADTO:\r
-                                                       pathData.Types [tpos++] = (byte) PathPointType.Bezier;\r
-                                                       pathData.Points [ppos++] = new PointF (jpoints [0], jpoints [1]);\r
-                                                       pathData.Types [tpos++] = (byte) PathPointType.Bezier;\r
-                                                       pathData.Points [ppos++] = new PointF (jpoints [2], jpoints [3]);\r
-                                                       break;\r
-                                               case JPI.SEG_CUBICTO:\r
-                                                       pathData.Types [tpos++] = (byte) PathPointType.Bezier3;\r
-                                                       pathData.Points [ppos++] = new PointF (jpoints [0], jpoints [1]);\r
-                                                       pathData.Types [tpos++] = (byte) PathPointType.Bezier3;\r
-                                                       pathData.Points [ppos++] = new PointF (jpoints [2], jpoints [3]);\r
-                                                       pathData.Types [tpos++] = (byte) PathPointType.Bezier3;\r
-                                                       pathData.Points [ppos++] = new PointF (jpoints [4], jpoints [5]);\r
-                                                       break;\r
-                                       }               \r
-                                       iter.next ();\r
-                               }\r
-                               return pathData;\r
-                       }\r
+                       get { return NativeObject.PathData; }\r
                }\r
 \r
                public PointF [] PathPoints \r
@@ -194,13 +140,12 @@ namespace System.Drawing.Drawing2D
                }\r
                #endregion\r
 \r
-               #region PointCount [TODO]\r
+               #region PointCount\r
                public int PointCount \r
                {\r
-\r
                        get \r
                        {\r
-                               return NativeObject.CoordsCount / 2;\r
+                               return NativeObject.PointCount;\r
                        }\r
                }\r
                #endregion\r
@@ -261,15 +206,23 @@ namespace System.Drawing.Drawing2D
                        int q = ((int)angle)/90;\r
 \r
                        switch (q&3) {\r
-                               default:\r
-                                       return x;\r
                                case 1:\r
-                                       return 180-x;\r
+                                       x = 180-x;\r
+                                       break;\r
                                case 2:\r
-                                       return 180+x;\r
+                                       x = 180+x;\r
+                                       break;\r
                                case 3:\r
-                                       return 360-x;\r
+                                       x = 360-x;\r
+                                       break;\r
                        }\r
+\r
+                       if (angle < 0)\r
+                               x = -x;\r
+\r
+                       x += (((int)angle)/360)*360;\r
+\r
+                       return x;\r
                }\r
 \r
                #endregion\r
@@ -333,7 +286,7 @@ namespace System.Drawing.Drawing2D
                }\r
                #endregion\r
 \r
-               #region AdEllipse\r
+               #region AddEllipse\r
                public void AddEllipse (float x, float y, float width, float height)\r
                {\r
                        Ellipse2D e = new Ellipse2D.Float(x,y,width,height);\r
@@ -481,9 +434,7 @@ namespace System.Drawing.Drawing2D
                #region AddRectangle(s)\r
                internal void AddRectangle(float x,float y, float w, float h)\r
                {\r
-                       if (NativeObject.LastFigureClosed)\r
-                               NativeObject.moveTo(x, y);\r
-\r
+                       NativeObject.moveTo(x, y);\r
                        NativeObject.lineTo (x + w, y);\r
                        NativeObject.lineTo (x + w, y + h);\r
                        NativeObject.lineTo (x, y + h);\r
@@ -522,11 +473,7 @@ namespace System.Drawing.Drawing2D
                #region GetLastPoint\r
                public PointF GetLastPoint ()\r
                {\r
-                       int length = NativeObject.CoordsCount;\r
-                       if (length == 0)\r
-                               throw new System.ArgumentException ("Invalid parameter used.");\r
-\r
-                       return new PointF (NativeObject.Coords [length - 2], NativeObject.Coords [length - 1]);\r
+                       return NativeObject.GetLastPoint ();\r
                }\r
                #endregion\r
 \r
@@ -540,21 +487,36 @@ namespace System.Drawing.Drawing2D
                #region GetBounds\r
                public RectangleF GetBounds ()\r
                {\r
-                       Rectangle2D rect = NativeObject.getBounds2D();\r
-                       return new RectangleF((float)rect.getX(),(float)rect.getY(),(float)rect.getWidth(),(float)rect.getHeight());\r
+                       return GetBounds (null, null);\r
                }               \r
 \r
                public RectangleF GetBounds (Matrix matrix)\r
                {\r
-                       Shape shape = matrix != null ? \r
-                               NativeObject.createTransformedShape(matrix.NativeObject) : NativeObject;\r
-                       Rectangle2D rect = shape.getBounds2D();\r
-                       return new RectangleF((float)rect.getX(),(float)rect.getY(),(float)rect.getWidth(),(float)rect.getHeight());\r
+                       return GetBounds (matrix, null);\r
                }\r
 \r
                public RectangleF GetBounds (Matrix matrix, Pen pen)\r
                {\r
-                       throw new NotImplementedException();\r
+                       // FIXME : we do not know exacly how the bounding rectangle \r
+                       // is calculated so this implementation obtains different bounds\r
+                       // that still contains the path widened by oen and transformed by matrix\r
+                       // the order of operations is similar to widening, as .Net does.\r
+\r
+                       // first get original shape bounds\r
+                       //Shape shape = NativeObject.getBounds2D();\r
+                       Shape shape = NativeObject;\r
+\r
+                       // stroke bounds\r
+                       if (pen != null)\r
+                               shape = ((Stroke)pen).createStrokedShape (shape);\r
+\r
+                       Rectangle2D rect = shape.getBounds2D ();\r
+\r
+                       // transform bounds                     \r
+                       if (matrix != null)\r
+                               rect = matrix.NativeObject.createTransformedShape(rect).getBounds2D();\r
+\r
+                       return new RectangleF (rect);\r
                }\r
                #endregion\r
         \r
@@ -606,17 +568,18 @@ namespace System.Drawing.Drawing2D
                 \r
                public bool IsVisible (float x, float y, Graphics graphics)\r
                {\r
-                       if (graphics != null && !graphics.IsVisible(x,y))\r
-                               return false;\r
+                       // LAMESPEC : .Net is currently ignorig Graphics object\r
+                       //if (graphics != null && !graphics.IsVisible(x,y))\r
+                       //      return false;\r
 \r
                        return NativeObject.contains(x,y);\r
                }\r
                #endregion\r
         \r
-               #region Reverse [TODO]\r
+               #region Reverse\r
                public void Reverse ()\r
                {\r
-                       throw new NotImplementedException();\r
+                       NativeObject.Reverse ();\r
                }\r
                #endregion\r
              \r
@@ -656,6 +619,7 @@ namespace System.Drawing.Drawing2D
                        pts[--length] = points[points.Length-1].X;\r
 \r
                        AddCurve(pts, !NativeObject.LastFigureClosed, tension);\r
+                       CloseFigure ();\r
                }\r
 \r
                public void AddClosedCurve (PointF [] points, float tension)\r
@@ -683,6 +647,7 @@ namespace System.Drawing.Drawing2D
                        pts[--length] = points[points.Length-1].X;\r
 \r
                        AddCurve(pts, !NativeObject.LastFigureClosed, tension);\r
+                       CloseFigure ();\r
                }\r
                #endregion\r
 \r
@@ -806,38 +771,40 @@ namespace System.Drawing.Drawing2D
                }\r
                #endregion\r
 \r
-               #region AddString [TODO]\r
+               #region AddString\r
+               [MonoTODO]\r
                public void AddString (string s, FontFamily family, int style,  float emSize,  Point origin,   StringFormat format)\r
                {\r
                        throw new NotImplementedException ();\r
                }       \r
                 \r
+               [MonoTODO]\r
                public void AddString (string s,  FontFamily family,  int style,  float emSize,  PointF origin,   StringFormat format)\r
                {\r
                        throw new NotImplementedException ();\r
                }       \r
                \r
+               [MonoTODO]\r
                public void AddString (string s, FontFamily family, int style, float emSize,  Rectangle layoutRect, StringFormat format)\r
                {\r
                        throw new NotImplementedException ();\r
                }       \r
                \r
+               [MonoTODO]\r
                public void AddString (string s, FontFamily family, int style, float emSize,  RectangleF layoutRect,   StringFormat format)\r
                {\r
                        throw new NotImplementedException ();\r
                }\r
                #endregion\r
                 \r
-               #region ClearMarkers [TODO]\r
+               #region ClearMarkers\r
                public void ClearMarkers()               \r
                {\r
-                       throw new NotImplementedException ();\r
+                       NativeObject.ClearMarkers ();\r
                }\r
                #endregion\r
         \r
-               #region Close(All) [REVIEW-EXTEND]\r
-               \r
-\r
+               #region Close\r
                public void CloseAllFigures()\r
                {\r
                        ExtendedGeneralPath p = new ExtendedGeneralPath();\r
@@ -877,7 +844,6 @@ namespace System.Drawing.Drawing2D
 \r
                        p.closePath();\r
                        Shape = p;\r
-                       //_isNewFigure = (lastSeg == PathIterator.SEG_CLOSE);\r
                }       \r
                 \r
                public void CloseFigure()\r
@@ -886,7 +852,7 @@ namespace System.Drawing.Drawing2D
                } \r
                #endregion\r
 \r
-               #region Flatten [REVIEW]\r
+               #region Flatten\r
                public void Flatten ()\r
                {\r
                        // 1/4 is the FlatnessDefault as defined in GdiPlusEnums.h\r
@@ -904,7 +870,7 @@ namespace System.Drawing.Drawing2D
                        if(matrix != null)                      \r
                                tr = matrix.NativeObject;\r
 \r
-                       //REVIEW. Perfomance reasons.\r
+                       //FIXME : Review (perfomance reasons).\r
                        PathIterator pi = NativeObject.getPathIterator(tr,flatness);\r
                        ExtendedGeneralPath newPath = new ExtendedGeneralPath();\r
                        newPath.append(pi,false);\r
@@ -912,78 +878,88 @@ namespace System.Drawing.Drawing2D
                }\r
                #endregion\r
         \r
-               #region GetOutlineVisible [TODO]\r
+               #region GetOutlineVisible\r
                public bool IsOutlineVisible (Point point, Pen pen)\r
                {\r
-                       throw new NotImplementedException();\r
+                       return IsOutlineVisible (point.X, point.Y, pen, null);\r
                }               \r
                \r
                public bool IsOutlineVisible (PointF point, Pen pen)\r
                {\r
-                       throw new NotImplementedException();\r
+                       return IsOutlineVisible (point.X, point.Y, pen, null);\r
                } \r
                \r
                public bool IsOutlineVisible (int x, int y, Pen pen)\r
                {\r
-                       throw new NotImplementedException();\r
+                       return IsOutlineVisible (x, y, pen, null);\r
                }\r
 \r
                public bool IsOutlineVisible (float x, float y, Pen pen)\r
                {\r
-                       throw new NotImplementedException();\r
+                       return IsOutlineVisible (x, y, pen, null);\r
                }               \r
                \r
                public bool IsOutlineVisible (Point pt, Pen pen, Graphics graphics)\r
                {\r
-                       throw new NotImplementedException();\r
+                       return IsOutlineVisible (pt.X, pt.Y, pen, graphics);\r
                }               \r
                \r
                public bool IsOutlineVisible (PointF pt, Pen pen, Graphics graphics)\r
                {\r
-                       throw new NotImplementedException();\r
+                       return IsOutlineVisible (pt.X, pt.Y, pen, graphics);\r
                }               \r
                                \r
                public bool IsOutlineVisible (int x, int y, Pen pen, Graphics graphics)\r
                {\r
-                       throw new NotImplementedException();\r
+                       // LAMESPEC : .Net is currently ignorig Graphics object\r
+                       //if (graphics != null) {\r
+                       //      if (!graphics.IsVisible (x, y))\r
+                       //              return false;                           \r
+                       //}\r
+\r
+                       return ((Stroke)pen).createStrokedShape (NativeObject).contains (x, y);\r
                }               \r
                                \r
                public bool IsOutlineVisible (float x, float y, Pen pen, Graphics graphics)\r
                {\r
-                       throw new NotImplementedException();\r
+                       return ((Stroke)pen).createStrokedShape (NativeObject).contains (x, y);\r
                }               \r
                #endregion\r
         \r
-               #region SetMarkers [TODO]\r
+               #region SetMarkers \r
                public void SetMarkers ()\r
                {\r
-                       throw new NotImplementedException();\r
+                       NativeObject.SetMarkers ();\r
                }\r
                #endregion\r
                 \r
                #region StartFigure\r
                public void StartFigure()\r
                {\r
-                       NativeObject.Types [NativeObject.TypesCount - 1] |= ExtendedGeneralPath.SEG_START;\r
+                       NativeObject.StartFigure ();\r
                }\r
                #endregion\r
                        \r
-               #region Warp [TODO]\r
+               #region Warp\r
+               [MonoTODO]\r
                public void Warp (PointF[] destPoints, RectangleF srcRect)\r
                {\r
                        Warp (destPoints, srcRect, null, WarpMode.Perspective, 1.0f / 4.0f);\r
                }               \r
 \r
+               [MonoTODO]\r
                public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix)\r
                {\r
                        Warp (destPoints, srcRect, matrix, WarpMode.Perspective, 1.0f / 4.0f);\r
                }               \r
 \r
+               [MonoTODO]\r
                public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode)\r
                {\r
                        Warp (destPoints, srcRect, matrix, warpMode, 1.0f / 4.0f);\r
                }               \r
 \r
+               [MonoTODO]\r
                public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix,  WarpMode warpMode, float flatness)\r
                {\r
                        throw new NotImplementedException();\r
@@ -1010,5 +986,72 @@ namespace System.Drawing.Drawing2D
                        Flatten(matrix, flatness);\r
                } \r
                #endregion\r
+\r
+               private void SetPath (Point [] pts, byte [] types)\r
+               {\r
+                       NativeObject.Clear ();\r
+                       if (((PathPointType)types [0] & PathPointType.PathTypeMask) != PathPointType.Start)\r
+                               NativeObject.moveTo (pts [0].X, pts [0].Y);\r
+\r
+                       for (int i=0; i < pts.Length; i++) {\r
+                               switch (((PathPointType)types [i] & PathPointType.PathTypeMask)) {\r
+                                       case PathPointType.Start :\r
+                                               NativeObject.moveTo (pts [i].X, pts [i].Y);\r
+                                               break;\r
+                                       case PathPointType.Line :\r
+                                               NativeObject.lineTo (pts [i].X, pts [i].Y);\r
+                                               break;\r
+                                       case PathPointType.Bezier3 :\r
+                                               float x1 = pts [i].X;\r
+                                               float y1 = pts [i].Y;\r
+                                               i++;\r
+                                               float x2 = pts [i].X;\r
+                                               float y2 = pts [i].Y;\r
+                                               i++;\r
+                                               float x3 = pts [i].X;\r
+                                               float y3 = pts [i].Y;\r
+                                               NativeObject.curveTo (x1,y1, x2, y2, x3, y3);\r
+                                               break;                                          \r
+                               }\r
+                               if (((PathPointType)types [i] & PathPointType.CloseSubpath) != 0)\r
+                                       NativeObject.closePath();\r
+\r
+                               if (((PathPointType)types [i] & PathPointType.PathMarker) != 0)\r
+                                       NativeObject.SetMarkers ();\r
+                       }\r
+               }\r
+\r
+               internal void SetPath (PointF [] pts, byte [] types)\r
+               {\r
+                       NativeObject.Clear ();\r
+                       if (((PathPointType)types [0] & PathPointType.PathTypeMask) != PathPointType.Start)\r
+                               NativeObject.moveTo (pts [0].X, pts [0].Y);\r
+                       for (int i=0; i < pts.Length; i++) {\r
+                               switch (((PathPointType)types [i] & PathPointType.PathTypeMask)) {\r
+                                       case PathPointType.Start :\r
+                                               NativeObject.moveTo (pts [i].X, pts [i].Y);\r
+                                               break;\r
+                                       case PathPointType.Line :\r
+                                               NativeObject.lineTo (pts [i].X, pts [i].Y);\r
+                                               break;\r
+                                       case PathPointType.Bezier3 :\r
+                                               float x1 = pts [i].X;\r
+                                               float y1 = pts [i].Y;\r
+                                               i++;\r
+                                               float x2 = pts [i].X;\r
+                                               float y2 = pts [i].Y;\r
+                                               i++;\r
+                                               float x3 = pts [i].X;\r
+                                               float y3 = pts [i].Y;\r
+                                               NativeObject.curveTo (x1,y1, x2, y2, x3, y3);\r
+                                               break;                                          \r
+                               }\r
+                               if (((PathPointType)types [i] & PathPointType.CloseSubpath) != 0)\r
+                                       NativeObject.closePath();\r
+\r
+                               if (((PathPointType)types [i] & PathPointType.PathMarker) != 0)\r
+                                       NativeObject.SetMarkers ();\r
+                       }\r
+               }\r
        }\r
 }\r
index 12d0f2ee0855790e3409ba99957d38eed65322a4..f0ce626b88c31c22b7b55379127da295ab58348e 100755 (executable)
@@ -2,13 +2,9 @@
 // System.Drawing.Drawing2D.GraphicsPathIterator.cs
 //
 // Author:
-//   Dennis Hayes (dennish@Raytek.com)
-//   Duncan Mak (duncan@ximian.com)
-//   Ravindra (rkumar@novell.com)
+// Bors Kirzner <boris@mainsoft.com>   
 //
-// Copyright (C) 2002/3 Ximian, Inc (http://www.ximian.com)
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 Mainsoft Corporation, (http://www.mainsoft.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -36,86 +32,189 @@ namespace System.Drawing.Drawing2D
 {
        public sealed class GraphicsPathIterator : MarshalByRefObject, IDisposable
        {
+               #region Fields
+
+               private readonly GraphicsPath _path;
+               private int _marker = -1;
+               private int _subpath = -1;
+
+               #endregion // Fields
+
+               #region Constructors
 
                public GraphicsPathIterator (GraphicsPath path)
                {
-                       throw new NotImplementedException();
+                       _path = path;
                }
 
-               // Public Properites
+               #endregion // Constructors
 
-               public int Count {
-                       get {
-                               throw new NotImplementedException();
-                       }
+               #region Properites
+
+               public int Count \r
+               {
+                       get { return _path.NativeObject.PointCount; }
                }
 
                public int SubpathCount {
                        get {
-                               throw new NotImplementedException();
+                               int count = 0;
+                               int start, end;
+                               bool isClosed;
+                               while (NextSubpath (out start, out end, out isClosed) != 0)
+                                       count++;
+                               return count;
                        }
                }
 
-               internal void Dispose (bool disposing)
-               {
-                       throw new NotImplementedException();
-               }
+               #endregion // Properties
 
-               // Public Methods.
+               #region Methods
 
                public int CopyData (ref PointF [] points, ref byte [] types, int startIndex, int endIndex)
                {
-                       throw new NotImplementedException();
+                       int j = 0;
+                       for (int i = startIndex; i <= endIndex && i < _path.PointCount; i++) {
+                               points [j] = _path.PathPoints [i];
+                               types [j++] = _path.PathTypes [i];
+                       }
+                       return j;
                }
 
                public void Dispose ()
                {
-                       throw new NotImplementedException();
-               }
-
-               ~GraphicsPathIterator ()
-               {
-                       Dispose (false);
                }
 
                public int Enumerate (ref PointF [] points, ref byte [] types)
                {
-                       throw new NotImplementedException();
+                       return CopyData (ref points, ref types, 0, _path.PointCount);
                }
 
                public bool HasCurve ()
                {
-                       throw new NotImplementedException();
+                       byte [] types = _path.PathTypes;
+                       for (int i=0; i < types.Length; i++)
+                               if ((types [i] & (byte)PathPointType.PathTypeMask) == (byte)PathPointType.Bezier3)
+                                       return true;
+                       return false;
                }
 
                public int NextMarker (GraphicsPath path)
                {
-                       throw new NotImplementedException();
+                       if (path == null)
+                               return 0;
+
+                       int startIndex;
+                       int endIndex;
+                       int count = NextMarker (out startIndex, out endIndex);
+
+                       if (count != 0)
+                               SetPath (_path, startIndex, count, path);
+
+                       return count;
                }
 
                public int NextMarker (out int startIndex, out int endIndex)
                {
-                       throw new NotImplementedException();
+                       if (_marker >= _path.PointCount) {
+                               startIndex = 0;
+                               endIndex = 0;
+                               return 0;
+                       }
+
+                       startIndex = ++_marker;
+                       while ((_marker < _path.PointCount) && ((_path.PathTypes [_marker] & (byte)PathPointType.PathMarker) == 0))
+                               _marker++;
+
+                       endIndex = (_marker < _path.PointCount) ? _marker : _path.PointCount - 1;
+                       return endIndex - startIndex + 1;
                }
 
                public int NextPathType (out byte pathType, out int startIndex, out int endIndex)
                {
-                       throw new NotImplementedException();
+                       if ((_subpath >= _path.PointCount - 1) | (_subpath < 0)) {
+                               startIndex = 0;
+                               endIndex = 0;
+                               pathType = (_subpath < 0) ? (byte)PathPointType.Start : _path.PathTypes [_path.PointCount - 1];
+                               return 0;
+                       }
+
+                       // .net acts different, but it seems to be a bug
+                       if ((_path.PathTypes [_subpath + 1] & (byte)PathPointType.PathMarker) != 0) {
+                               startIndex = 0;
+                               endIndex = 0;
+                               pathType = _path.PathTypes [_subpath];
+                               return 0;
+                       }
+
+                       startIndex = _subpath++;
+                       endIndex = startIndex;
+                       pathType = (byte)(_path.PathTypes [startIndex + 1] & (byte)PathPointType.PathTypeMask);
+
+                       while (((_subpath) < _path.PointCount) && ((_path.PathTypes [_subpath] & (byte)PathPointType.PathTypeMask) == pathType))
+                               _subpath++;
+                       
+                       endIndex = (_subpath < _path.PointCount) ? --_subpath : _path.PointCount - 1;
+                       return endIndex - startIndex + 1;
                }
 
                public int NextSubpath (GraphicsPath path, out bool isClosed)
                {
-                       throw new NotImplementedException();
+                       int startIndex;
+                       int endIndex;
+                       int count = NextSubpath (out startIndex, out endIndex, out isClosed);
+
+                       if ((count != 0) && (path != null))
+                               SetPath (_path, startIndex, count, path);
+
+                       return count;
+               }
+
+               private void SetPath (GraphicsPath source, int start, int count, GraphicsPath target)
+               {
+                       PointF [] points = new PointF [count];
+                       byte [] types = new byte [count];
+                       PointF [] pathPoints = _path.PathPoints;
+                       byte [] pathTypes = _path.PathTypes;
+
+                       for (int i = 0; i < count; i++) {
+                               points [i] = pathPoints [start + i];
+                               types [i] = pathTypes [start + i];
+                       }
+                       
+                       target.SetPath (points, types);
                }
 
                public int NextSubpath (out int startIndex, out int endIndex, out bool isClosed)
                {
-                       throw new NotImplementedException();
+                       _subpath++;
+                       while (((_subpath) < _path.PointCount) && (_path.PathTypes [_subpath] != (byte)PathPointType.Start))
+                               _subpath++;
+
+                               
+                       if (_subpath >= _path.PointCount - 1) {
+                               startIndex = 0;
+                               endIndex = 0;
+                               isClosed = true;
+                               return 0;
+                       }                       
+
+                       startIndex = _subpath;
+                       int offset = 1;
+                       while (((_subpath + offset) < _path.PointCount) && (_path.PathTypes [_subpath + offset] != (byte)PathPointType.Start))
+                               offset++;
+
+                       endIndex = ((_subpath + offset) < _path.PointCount) ? _subpath + offset - 1 : _path.PointCount - 1;
+                       isClosed = (_path.PathTypes [endIndex] & (byte)PathPointType.CloseSubpath) != 0;
+                       return endIndex - startIndex + 1;
                }
 
                public void Rewind ()
                {
-                       throw new NotImplementedException();
+                       _marker = -1;
+                       _subpath = -1;
                }
+
+               #endregion // Methods
        }
 }
index bcaa6060f035e840e0ab75ae8abe4d0af791fd5f..9f6712e1a0b31811eba2e1cf896ed42514cdcf3b 100644 (file)
@@ -29,6 +29,8 @@
 //
 using System;
 using System.Drawing.Text;
+using geom = java.awt.geom;
+using awt = java.awt;
 
 namespace System.Drawing.Drawing2D \r
 {
@@ -37,122 +39,128 @@ namespace System.Drawing.Drawing2D
        /// </summary>
        public sealed class GraphicsState : MarshalByRefObject
        {
-               // Constructor
-               internal GraphicsState()
-               {
+               readonly CompositingMode _compositingMode;
+               readonly CompositingQuality _compositingQuality;
+               readonly Region _clip;
+               readonly awt.Shape _baseClip;
+               readonly InterpolationMode _interpolationMode;
+               readonly float _pageScale;
+               readonly GraphicsUnit _pageUnit;
+               readonly PixelOffsetMode _pixelOffsetMode;
+               readonly Point _renderingOrigin;
+               readonly SmoothingMode _smoothingMode;
+               readonly int _textContrast;
+               readonly TextRenderingHint _textRenderingHint;
+
+               // additional transform in case that new container has one
+               readonly Matrix _transform;
+               readonly Matrix _baseTransform;
+
+               GraphicsState _next = null;
+
+               awt.Shape _finalBaseClip = null;
+
+               internal GraphicsState(Graphics graphics, bool resetState) 
+                       : this(graphics, Matrix.IdentityTransform, resetState) {}
+
+               internal GraphicsState Next {
+                       get {
+                               return _next;
+                       }
+                       set {
+                               _next = value;
+                       }
                }
 
-               internal GraphicsState(Graphics graphics, bool resetState) : base()
+               internal GraphicsState(Graphics graphics, Matrix matrix, bool resetState)
                {
-                       this.SaveState(graphics);
-                       if (resetState)
-                               this.ResetState(graphics);
-               }
+                       _compositingMode = graphics.CompositingMode;
+                       _compositingQuality = graphics.CompositingQuality;
+                       _clip = graphics.ScaledClip;
+                       _baseClip = graphics.NativeObject.getClip();
+                       _interpolationMode = graphics.InterpolationMode;
+                       _pageScale = graphics.PageScale;
+                       _pageUnit = graphics.PageUnit;
+                       _pixelOffsetMode = graphics.PixelOffsetMode;
+                       
+                       // FIXME: render orign is not implemented yet
+                       //_renderingOrigin = new Point( g.RenderingOrigin.X, g.RenderingOrigin.Y );
 
-               private CompositingMode _compositingMode;
-               private CompositingQuality _compositingQuality;
-               private Region _clip;
-               private InterpolationMode _interpolationMode;
-               private float _pageScale = 0;
-               private GraphicsUnit _pageUnit;
-               private PixelOffsetMode _pixelOffsetMode;
-               private Point _renderingOrigin;
-               private SmoothingMode _smoothingMode;
-               private Matrix _transform = null;
-               private int _textContrast;
-               private TextRenderingHint _textRenderingHint;
+                       _smoothingMode = graphics.SmoothingMode;
+                       _transform = graphics.Transform;
+                       _baseTransform = graphics.BaseTransform;
 
-               // additional transform in case that new container has one
-               private Matrix _containerTransform;
+                       _textContrast = graphics.TextContrast;
+                       _textRenderingHint = graphics.TextRenderingHint;
 
-               internal Matrix ContainerTransfrom
-               {
-                       get {return _containerTransform;}
-                       set {_containerTransform = value;}
+                       if (resetState)
+                               ResetState(graphics, matrix);
                }
 
-               private void SaveState(Graphics g)
+               internal void RestoreState(Graphics graphics)
                {
-                       if (g != null)
-                       {
-                               try
-                               {
-                                       _compositingMode = g.CompositingMode;
-                                       _compositingQuality = g.CompositingQuality;
-                                       _clip = g.Clip.Clone();
-                                       _interpolationMode = g.InterpolationMode;
-                                       _pageScale = g.PageScale;
-                                       _pageUnit = g.PageUnit;
-                                       _pixelOffsetMode = g.PixelOffsetMode;
-                       
-                                       // FIXME: render orign is not implemented yet
-                                       //_renderingOrigin = new Point( g.RenderingOrigin.X, g.RenderingOrigin.Y );
-
-                                       _smoothingMode = g.SmoothingMode;
-                                       _transform = g.Transform.Clone();
-                                       _textContrast = g.TextContrast;
-                                       _textRenderingHint = g.TextRenderingHint;
-                               }
-                               finally
-                               {
-                               }
-                       }
+                       graphics.CompositingMode = _compositingMode;
+                       graphics.CompositingQuality = _compositingQuality;
+                       graphics.ScaledClip = _clip;
+                       graphics.InterpolationMode = _interpolationMode;
+                       graphics.PageScale = _pageScale;
+                       graphics.PageUnit = _pageUnit;
+                       graphics.PixelOffsetMode = _pixelOffsetMode;
+       
+                       // FIXME: render orign is not implemented yet
+                       //graphics.RenderingOrigin = new Point( _renderingOrigin.X, _renderingOrigin.Y );
+
+                       graphics.SmoothingMode = _smoothingMode;
+                       graphics.Transform = _transform;
+                       graphics.BaseTransform = _baseTransform;
+                       graphics.TextContrast = _textContrast;
+                       graphics.TextRenderingHint = _textRenderingHint;
+
+                       // must be set after the base transform is restored
+                       graphics.NativeObject.setClip(_baseClip);
                }
 
-               internal void RestoreState(Graphics g)
+               void ResetState(Graphics graphics, Matrix matrix)
                {
-                       if (g != null)
-                       {
-                               try
-                               {
-                                       g.CompositingMode = _compositingMode;
-                                       g.CompositingQuality = _compositingQuality;
-                                       g.Clip = _clip;
-                                       g.InterpolationMode = _interpolationMode;
-                                       g.PageScale = _pageScale;
-                                       g.PageUnit = _pageUnit;
-                                       g.PixelOffsetMode = _pixelOffsetMode;
+                       //should be set before the base transform is changed
+                       if (_baseClip == null)
+                               graphics.IntersectScaledClipWithBase(graphics.VisibleShape);
+                       graphics.IntersectScaledClipWithBase(_clip);
+
+                       graphics.CompositingMode = CompositingMode.SourceOver;
+                       graphics.CompositingQuality = CompositingQuality.Default;
+                       graphics.Clip = Region.InfiniteRegion;
+                       graphics.InterpolationMode = InterpolationMode.Bilinear;
+                       graphics.PageScale = 1.0f;
+                       graphics.PageUnit = GraphicsUnit.Display;
+                       graphics.PixelOffsetMode = PixelOffsetMode.Default;
                        
-                                       // FIXME: render orign is not implemented yet
-                                       //g.RenderingOrigin = new Point( _renderingOrigin.X, _renderingOrigin.Y );
-
-                                       g.SmoothingMode = _smoothingMode;
-                                       g.Transform = _transform;
-                                       g.TextContrast = _textContrast;
-                                       g.TextRenderingHint = _textRenderingHint;
-                               }
-                               finally
-                               {
-                               }
-                       }
+                       // FIXME: render orign is not implemented yet
+                       //graphics.RenderingOrigin = new Point(0, 0);
+
+                       graphics.SmoothingMode = SmoothingMode.None;
+                       graphics.ResetTransform();
+                       graphics.PrependBaseTransform(Graphics.GetFinalTransform(_transform.NativeObject, _pageUnit, _pageScale));
+                       graphics.PrependBaseTransform(matrix.NativeObject);
+                       graphics.TextContrast = 4;
+                       graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
+
+                       geom.AffineTransform finalBaseTransform = graphics.NativeObject.getTransform();
+                       graphics.NativeObject.setTransform(Matrix.IdentityTransform.NativeObject);
+                       _finalBaseClip = graphics.NativeObject.getClip();
+                       graphics.NativeObject.setTransform(finalBaseTransform);
                }
 
-               private void ResetState(Graphics g)
-               {
-                       if (g != null)
-                       {
-                               try
-                               {
-                                       g.CompositingMode = CompositingMode.SourceOver;
-                                       g.CompositingQuality = CompositingQuality.Default;
-                                       g.Clip = Region.InfiniteRegion;
-                                       g.InterpolationMode = InterpolationMode.Bilinear;
-                                       g.PageScale = 1.0f;
-                                       g.PageUnit = GraphicsUnit.Display;
-                                       g.PixelOffsetMode = PixelOffsetMode.Default;
-                                       
-                                       // FIXME: render orign is not implemented yet
-                                       //g.RenderingOrigin = new Point(0, 0);
-
-                                       g.SmoothingMode = SmoothingMode.None;
-                                       g.ResetTransform();
-                                       g.TextContrast = 4;
-                                       g.TextRenderingHint = TextRenderingHint.SystemDefault;
-                               }
-                               finally
-                               {
-                               }
+               internal void RestoreBaseClip(Graphics graphics) {
+                       if (_finalBaseClip == null) {
+                               graphics.NativeObject.setClip(null);
+                               return;
                        }
+
+                       geom.AffineTransform finalBaseTransform = graphics.NativeObject.getTransform();
+                       graphics.NativeObject.setTransform(Matrix.IdentityTransform.NativeObject);
+                       graphics.NativeObject.setClip(_finalBaseClip);
+                       graphics.NativeObject.setTransform(finalBaseTransform);
                }
        }
 }
index 41e8702eaa9f4ba26c54b47b97c42a45e73ba04e..a74a65de01ea69d4dd63a6d0ea2928d654e161a4 100755 (executable)
@@ -197,15 +197,8 @@ namespace System.Drawing.Drawing2D {
                }
 
                public Matrix Transform {
-                       get {
-                               return _brushTransform;
-                       }
-                       set {
-                               if (value == null)
-                                       throw new ArgumentNullException("matrix");
-
-                               _brushTransform = value;
-                       }
+                       get { return BrushTransform; }
+                       set { BrushTransform = value; }
                }
 
                // FALLBACK: not functionality implemented for this property
@@ -222,34 +215,31 @@ namespace System.Drawing.Drawing2D {
                #region Public Methods
 
                public void MultiplyTransform (Matrix matrix) {
-                       MultiplyTransform (matrix, MatrixOrder.Prepend);
+                       BrushMultiplyTransform(matrix, MatrixOrder.Prepend);
                }
 
                public void MultiplyTransform (Matrix matrix, MatrixOrder order) {
-                       if (matrix == null)\r
-                               throw new ArgumentNullException("matrix");\r
-\r
-                       _brushTransform.Multiply(matrix,order);                 
+                       BrushMultiplyTransform(matrix, order);                  
                }
 
                public void ResetTransform () {
-                       _brushTransform = new Matrix();
+                       BrushResetTransform();
                }
 
                public void RotateTransform (float angle) {
-                       RotateTransform (angle, MatrixOrder.Prepend);
+                       BrushRotateTransform(angle, MatrixOrder.Prepend);
                }
 
                public void RotateTransform (float angle, MatrixOrder order) {
-                       _brushTransform.Rotate(angle,order);
+                       BrushRotateTransform(angle, order);
                }
 
                public void ScaleTransform (float sx, float sy) {
-                       ScaleTransform (sx, sy, MatrixOrder.Prepend);
+                       BrushScaleTransform(sx, sy, MatrixOrder.Prepend);
                }
 
                public void ScaleTransform (float sx, float sy, MatrixOrder order) {
-                       _brushTransform.Scale(sx,sy,order);
+                       BrushScaleTransform(sx, sy, order);
                }
 
                public void SetBlendTriangularShape (float focus) {
@@ -278,11 +268,11 @@ namespace System.Drawing.Drawing2D {
                }
 
                public void TranslateTransform (float dx, float dy) {
-                       TranslateTransform (dx, dy, MatrixOrder.Prepend);
+                       BrushTranslateTransform (dx, dy);
                }
 
                public void TranslateTransform (float dx, float dy, MatrixOrder order) {
-                       _brushTransform.Translate(dx,dy,order);
+                       BrushTranslateTransform(dx, dy, order);
                }
 
                public override object Clone () {
index 4290d605bc3aa8cda34346cffe83f268ac79a508..ba4ea5cb71e0f7aad719e0a3ae51f701284602ce 100755 (executable)
@@ -10,13 +10,14 @@ namespace System.Drawing.Drawing2D
        {
                #region fields
 
-               geom.AffineTransform _nativeMatrix;                             
+               static internal readonly Matrix IdentityTransform = new Matrix();
+               readonly geom.AffineTransform _nativeMatrix;                            
 
                #endregion
                 
                #region ctors
 
-               Matrix (geom.AffineTransform ptr)
+               internal Matrix (geom.AffineTransform ptr)
                {
                        _nativeMatrix = ptr;
                }
@@ -126,6 +127,10 @@ namespace System.Drawing.Drawing2D
                {
                }                       
         
+               internal void CopyTo(Matrix matrix) {
+                       matrix.NativeObject.setTransform(NativeObject);
+               }
+
                public override bool Equals (object obj)
                {
                        Matrix m = obj as Matrix;
@@ -145,7 +150,7 @@ namespace System.Drawing.Drawing2D
                public void Invert ()
                {
                        try {
-                               _nativeMatrix = _nativeMatrix.createInverse();
+                               _nativeMatrix.setTransform( _nativeMatrix.createInverse() );
                        }
                        catch(geom.NoninvertibleTransformException e) {
                                throw new ArgumentException(e.Message, e);
@@ -189,7 +194,7 @@ namespace System.Drawing.Drawing2D
         
                public void Scale (float scaleX, float scaleY)
                {
-                       Scale (scaleX, scaleY, MatrixOrder.Append);
+                       Scale (scaleX, scaleY, MatrixOrder.Prepend);
                }
         
                public void Scale (float scaleX, float scaleY, MatrixOrder order)
@@ -204,7 +209,7 @@ namespace System.Drawing.Drawing2D
         
                public void Shear (float shearX, float shearY, MatrixOrder order)
                {
-                       Multiply(geom.AffineTransform.getScaleInstance(shearX, shearY), order);
+                       Multiply(geom.AffineTransform.getShearInstance (shearX, shearY), order);
                }
         
                public void TransformPoints (Point[] pts)
index 666058606ded38919fc2727cfb5f7107213fc1bd..55819e58314704ae670cf589b0afbf8c83a04545 100644 (file)
@@ -46,13 +46,21 @@ namespace System.Drawing.Drawing2D
                public PathData () { }
 
                public PointF[] Points {
-                       get { return points; } 
+                       get { return (PointF[]) points.Clone (); } 
                        set { points = value; }
                }
 
                public byte[] Types {
-                       get { return types; }
+                       get { return (byte[]) types.Clone (); }
                        set { types = value; }
                }
+
+               public PointF[] InternalPoints {
+                       get { return points; } 
+               }
+
+               public byte[] InternalTypes {
+                       get { return types; }
+               }
        }
 }
index 9cb64f57b11507320ab81cda5d427b823250e062..6322f093c72c2c581877ba0e921e30a4bd78c882 100644 (file)
@@ -1,3 +1,17 @@
+2005-09-14 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * ImageCodecInfo.jvm.cs: fixed ImageCodec namespace
+       * ImageCodec.jvm.cs: refactoring of read/write methods
+
+2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * ImageCodecInfo.jvm.cs: fixed GetValueFromMetadata, SetResolution
+
+2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * ImageCodecInfo.jvm.cs: Refactoring
+       * Added ImageCodec.jvm.cs
+
 2005-08-28 Vladimir Krasnov <vladimirk@mainsoft.com>
 
        * ImageCodecInfo.jvm.cs: Fixed Iterate
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodec.jvm.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodec.jvm.cs
new file mode 100644 (file)
index 0000000..c451191
--- /dev/null
@@ -0,0 +1,605 @@
+using System;\r
+using System.Configuration;\r
+using System.Collections;\r
+using System.Collections.Specialized;\r
+using System.Drawing.Imaging;\r
+using System.Xml;\r
+using Mainsoft.Drawing.Configuration;\r
+\r
+using imageio = javax.imageio;\r
+using stream = javax.imageio.stream;\r
+using awt = java.awt;\r
+using image = java.awt.image;\r
+using spi = javax.imageio.spi;\r
+using dom = org.w3c.dom;\r
+\r
+namespace Mainsoft.Drawing.Imaging {\r
+       /// <summary>\r
+       /// Summary description for ImageCodec.\r
+       /// </summary>\r
+       public class ImageCodec {\r
+\r
+               #region Members\r
+\r
+               imageio.ImageReader _nativeReader = null;\r
+               imageio.ImageWriter _nativeWriter = null;\r
+               stream.ImageInputStream _nativeStream = null;\r
+\r
+               ImageFormat _imageFormat = null;\r
+\r
+               int _currentFrame = 0;\r
+\r
+               #endregion\r
+\r
+               #region Constructros\r
+\r
+               protected ImageCodec() {\r
+               }\r
+\r
+               static ImageCodec() {\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Internal properties\r
+\r
+               internal imageio.ImageReader NativeReader {\r
+                       get { return _nativeReader; }\r
+                       set { \r
+                               _nativeReader = value; \r
+                               _imageFormat = MimeTypesToImageFormat( value.getOriginatingProvider().getMIMETypes() );\r
+                       }\r
+               }\r
+               internal imageio.ImageWriter NativeWriter {\r
+                       get { return _nativeWriter; }\r
+                       set { \r
+                               _nativeWriter = value; \r
+                               _imageFormat = MimeTypesToImageFormat( value.getOriginatingProvider().getMIMETypes() );\r
+                       }\r
+               }\r
+\r
+               internal stream.ImageInputStream NativeStream {\r
+                       get { return _nativeStream; }\r
+                       set {\r
+                               if (value == null)\r
+                                       throw new ArgumentNullException("stream");\r
+\r
+                               _nativeStream = value;\r
+\r
+                               if (NativeReader != null)\r
+                                       NativeReader.setInput( value );\r
+\r
+                               if (NativeWriter != null)\r
+                                       NativeWriter.setOutput( value );\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region ImageCodec factory methods\r
+\r
+               public static ImageCodec CreateReader(stream.ImageInputStream inputStream) {\r
+                       java.util.Iterator iter = imageio.ImageIO.getImageReaders( inputStream );\r
+                       return CreateReader(iter);\r
+               }\r
+\r
+               public static ImageCodec CreateReader(ImageFormat imageFormat) {\r
+                       return CreateReader( ImageFormatToClsid( imageFormat ) );\r
+               }\r
+\r
+               public static ImageCodec CreateReader(Guid clsid) {\r
+                       ImageCodecInfo codecInfo = (ImageCodecInfo) Decoders[clsid];\r
+                       java.util.Iterator iter = imageio.ImageIO.getImageReadersByMIMEType( codecInfo.MimeType );\r
+                       return CreateReader(iter);\r
+               }\r
+\r
+               private static ImageCodec CreateReader(java.util.Iterator iter) {\r
+                       if ( !iter.hasNext() )
+                               throw new OutOfMemoryException ("Out of memory"); 
+\r
+                       ImageCodec imageCodec = new ImageCodec();\r
+                       imageCodec.NativeReader = (imageio.ImageReader) iter.next();\r
+                       return imageCodec;\r
+               }\r
+\r
+               public static ImageCodec CreateWriter(ImageFormat imageFormat) {\r
+                       return CreateWriter( ImageFormatToClsid( imageFormat ) );\r
+               }\r
+\r
+               public static ImageCodec CreateWriter(Guid clsid) {\r
+                       ImageCodecInfo codecInfo = (ImageCodecInfo) Encoders[clsid];\r
+                       java.util.Iterator iter = imageio.ImageIO.getImageWritersByMIMEType( codecInfo.MimeType );\r
+                       return CreateWriter(iter);\r
+               }\r
+\r
+               public static ImageCodec CreateWriter(java.util.Iterator iter) {\r
+                       if ( !iter.hasNext() )
+                               throw new OutOfMemoryException ("Out of memory"); 
+                       \r
+                       ImageCodec imageCodec = new ImageCodec();\r
+                       imageCodec.NativeWriter = (imageio.ImageWriter) iter.next();\r
+                       return imageCodec;\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Codec enumerations\r
+\r
+               internal static Hashtable Decoders {
+                       get {
+                               const string MYNAME = "System.Drawing.Imaging.ImageCodecInfo.decoders";
+                               Hashtable o = (Hashtable) AppDomain.CurrentDomain.GetData (MYNAME);
+                               if (o != null)
+                                       return o;
+                               o = new ReaderSpiIterator().Iterate();
+                               AppDomain.CurrentDomain.SetData(MYNAME, o);
+                               return o;
+                       }
+               }
+
+               internal static Hashtable Encoders {
+                       get {
+                               const string MYNAME = "System.Drawing.Imaging.ImageCodecInfo.encoders";
+                               Hashtable o = (Hashtable) AppDomain.CurrentDomain.GetData (MYNAME);
+                               if (o != null)
+                                       return o;
+                               o = new WriterSpiIterator().Iterate();
+                               AppDomain.CurrentDomain.SetData(MYNAME, o);
+                               return o;
+                       }
+               }
+
+               internal static ImageCodecInfo FindEncoder (Guid clsid) {
+                       return (ImageCodecInfo) Encoders[clsid];
+               }
+
+               internal static ImageCodecInfo FindDecoder (Guid clsid) {
+                       return (ImageCodecInfo) Decoders[clsid];
+               }
+\r
+               #endregion\r
+\r
+               #region SpiIterators
+
+               abstract class BaseSpiIterator {
+                       protected abstract java.util.Iterator GetIterator (string mimeType);
+                       protected abstract spi.ImageReaderWriterSpi GetNext (java.util.Iterator iter);
+
+                       #region ProcessOneCodec
+                       ImageCodecInfo ProcessOneCodec (Guid clsid, Guid formatID, string mimeType) {
+                               ImageCodecInfo ici = new ImageCodecInfo ();
+                               ici.Clsid = clsid;
+                               ici.FormatID = formatID;
+                               ici.MimeType = mimeType;
+                               java.util.Iterator iter = GetIterator (mimeType);
+                               while (iter.hasNext ()) {
+                                       spi.ImageReaderWriterSpi rw = GetNext (iter);
+                                       try {
+                                               ici.CodecName = rw.getDescription (java.util.Locale.getDefault ());
+                                               ici.DllName = null;
+                                               foreach (string suffix in rw.getFileSuffixes ()) {
+                                                       if (ici.FilenameExtension != null)
+                                                               ici.FilenameExtension += ";";
+                                                       ici.FilenameExtension += "*."+suffix;
+                                               }
+                                               ici.Flags = ImageCodecFlags.Builtin|ImageCodecFlags.SupportBitmap;
+                                               if (rw is spi.ImageReaderSpi) {
+                                                       ici.Flags |= ImageCodecFlags.Decoder;
+                                                       if ((rw as spi.ImageReaderSpi).getImageWriterSpiNames().Length != 0)
+                                                               ici.Flags |= ImageCodecFlags.Encoder;
+                                               }
+                                               if (rw is spi.ImageWriterSpi) {
+                                                       ici.Flags |= ImageCodecFlags.Encoder;
+                                                       if ((rw as spi.ImageWriterSpi).getImageReaderSpiNames().Length != 0)
+                                                               ici.Flags |= ImageCodecFlags.Decoder;
+                                               }
+                                               ici.FormatDescription = string.Join(";",
+                                                       rw.getFormatNames());
+                                               ici.Version = (int)Convert.ToDouble(rw.getVersion ());
+                                               break;
+                                       }
+                                       catch {
+                                       }
+                               }
+                               return ici;
+                       }
+                       #endregion
+
+                       public Hashtable Iterate () {
+                               // TBD: Insert Exception handling here
+                               NameValueCollection nvc = (NameValueCollection) System.Configuration.ConfigurationSettings
+                                       .GetConfig ("system.drawing/codecs");
+                               Hashtable codecs = new Hashtable (10);
+                       
+                               for (int i=0; i<nvc.Count; i++) {
+                                       Guid clsid = new Guid (nvc.GetKey (i));
+                                       ImageFormat format = ClsidToImageFormat (clsid);
+                                       ImageCodecInfo codec = ProcessOneCodec (clsid, format.Guid, nvc[i]);
+                                       if (codec.FilenameExtension != null)
+                                               codecs [clsid] = codec;
+                               }
+                               return codecs;
+                       }
+               }
+
+               class ReaderSpiIterator: BaseSpiIterator {
+                       protected override java.util.Iterator GetIterator(string mimeType) {\r
+                               return imageio.ImageIO.getImageReadersByMIMEType (mimeType);\r
+                       }\r
+                       protected override javax.imageio.spi.ImageReaderWriterSpi GetNext(java.util.Iterator iter) {\r
+                               imageio.ImageReader r = (imageio.ImageReader) iter.next ();\r
+                               return r.getOriginatingProvider ();\r
+                       }\r
+               }
+
+               class WriterSpiIterator: BaseSpiIterator {
+                       protected override java.util.Iterator GetIterator(string mimeType) {\r
+                               return imageio.ImageIO.getImageWritersByMIMEType (mimeType);\r
+                       }\r
+                       protected override javax.imageio.spi.ImageReaderWriterSpi GetNext(java.util.Iterator iter) {\r
+                               imageio.ImageWriter w = (imageio.ImageWriter) iter.next ();\r
+                               return w.getOriginatingProvider ();\r
+                       }\r
+               }
+               #endregion
+\r
+               #region Clsid and FormatID
+               static Guid BmpClsid = new Guid ("557cf400-1a04-11d3-9a73-0000f81ef32e");
+               static Guid JpegClsid = new Guid ("557cf401-1a04-11d3-9a73-0000f81ef32e");
+               static Guid GifClsid = new Guid ("557cf402-1a04-11d3-9a73-0000f81ef32e");
+               static Guid EmfClsid = new Guid ("557cf403-1a04-11d3-9a73-0000f81ef32e");
+               static Guid WmfClsid = new Guid ("557cf404-1a04-11d3-9a73-0000f81ef32e");
+               static Guid TiffClsid = new Guid ("557cf405-1a04-11d3-9a73-0000f81ef32e");
+               static Guid PngClsid = new Guid ("557cf406-1a04-11d3-9a73-0000f81ef32e");
+               static Guid IconClsid = new Guid ("557cf407-1a04-11d3-9a73-0000f81ef32e");
+
+               internal static ImageFormat MimeTypesToImageFormat (string [] mimeTypes) {
+                       foreach (ImageCodecInfo codec in Decoders.Values)
+                               for (int i=0; i<mimeTypes.Length; i++)
+                                       if (codec.MimeType == mimeTypes [i])
+                                               return new ImageFormat (codec.FormatID);
+                       return null;
+               }
+
+               internal static ImageFormat ClsidToImageFormat (Guid clsid) {
+                       if (clsid.Equals (BmpClsid))
+                               return ImageFormat.Bmp;
+                       else if (clsid.Equals (JpegClsid))
+                               return ImageFormat.Jpeg;
+                       else if (clsid.Equals (GifClsid))
+                               return ImageFormat.Gif;
+                       else if (clsid.Equals (EmfClsid))
+                               return ImageFormat.Emf;
+                       else if (clsid.Equals (WmfClsid))
+                               return ImageFormat.Wmf;
+                       else if (clsid.Equals (TiffClsid))
+                               return ImageFormat.Tiff;
+                       else if (clsid.Equals (PngClsid))
+                               return ImageFormat.Png;
+                       else if (clsid.Equals (IconClsid))
+                               return ImageFormat.Icon;
+                       else
+                               return null;
+               }
+
+               internal static Guid ImageFormatToClsid (ImageFormat format) {
+                       if (format == null)
+                               return Guid.Empty;
+
+                       if (format.Guid.Equals (ImageFormat.Bmp.Guid))
+                               return BmpClsid;
+                       else if (format.Guid.Equals (ImageFormat.Jpeg.Guid))
+                               return JpegClsid;
+                       else if (format.Guid.Equals (ImageFormat.Gif))
+                               return GifClsid;
+                       else if (format.Guid.Equals (ImageFormat.Emf.Guid))
+                               return EmfClsid;
+                       else if (format.Guid.Equals (ImageFormat.Wmf.Guid))
+                               return WmfClsid;
+                       else if (format.Guid.Equals (ImageFormat.Tiff.Guid))
+                               return TiffClsid;
+                       else if (format.Guid.Equals (ImageFormat.Png.Guid))
+                               return PngClsid;
+                       else if (format.Guid.Equals (ImageFormat.Icon.Guid))
+                               return IconClsid;
+                       else
+                               return Guid.Empty;
+               }
+
+               internal FrameDimension FormatFrameDimesion {
+                       get {
+                               if (ImageFormat == null)
+                                       return FrameDimension.Page;
+
+                               if (ImageFormat.Guid.Equals (ImageFormat.Bmp.Guid))
+                                       return FrameDimension.Page;
+                               else if (ImageFormat.Guid.Equals (ImageFormat.Jpeg.Guid))
+                                       return FrameDimension.Page;
+                               else if (ImageFormat.Guid.Equals (ImageFormat.Gif))
+                                       return FrameDimension.Time;
+                               else if (ImageFormat.Guid.Equals (ImageFormat.Emf.Guid))
+                                       return FrameDimension.Page;
+                               else if (ImageFormat.Guid.Equals (ImageFormat.Wmf.Guid))
+                                       return FrameDimension.Page;
+                               else if (ImageFormat.Guid.Equals (ImageFormat.Tiff.Guid))
+                                       return FrameDimension.Page;
+                               else if (ImageFormat.Guid.Equals (ImageFormat.Png.Guid))
+                                       return FrameDimension.Page;
+                               else if (ImageFormat.Guid.Equals (ImageFormat.Icon.Guid))
+                                       return FrameDimension.Resolution;
+                               else
+                                       return FrameDimension.Page;
+                       }
+               }
+
+               #endregion
+               \r
+               #region Image read/write methods\r
+\r
+               public PlainImage ReadPlainImage() {\r
+                       awt.Image img = ReadImage( _currentFrame );\r
+                       if (img == null)\r
+                               return null;\r
+\r
+                       awt.Image [] th = ReadThumbnails( _currentFrame );\r
+                       XmlDocument _md = ReadImageMetadata( _currentFrame );\r
+                       float [] resolution = GetResolution( _md );\r
+\r
+                       PlainImage pi = new PlainImage( img, th, ImageFormat, resolution[0], resolution[1], FormatFrameDimesion, _md );\r
+                       return pi;\r
+               }\r
+\r
+               public PlainImage ReadNextPlainImage() {\r
+                       _currentFrame++;\r
+                       return ReadPlainImage();\r
+               }\r
+\r
+               public awt.Image ReadImage(int frame) {\r
+                       if (NativeStream == null)\r
+                               throw new Exception("Input stream not specified");\r
+\r
+                       try {\r
+                               return NativeReader.read (frame);
+                       }
+                       catch (java.lang.IndexOutOfBoundsException) {
+                               return null;
+                       }
+                       catch (java.io.IOException ex) {
+                               throw new System.IO.IOException(ex.Message, ex);
+                       }
+               }\r
+\r
+               public awt.Image [] ReadThumbnails(int frameIndex) {\r
+                       awt.Image [] thArray = null;
+
+                       try {
+                               if (NativeReader.hasThumbnails(frameIndex)) {
+                                       int tmbNumber = NativeReader.getNumThumbnails(frameIndex);
+
+                                       if (tmbNumber > 0) {
+                                               thArray = new awt.Image[ tmbNumber ];
+
+                                               for (int i = 0; i < tmbNumber; i++) {
+                                                       thArray[i] = NativeReader.readThumbnail(frameIndex, i);
+                                               }
+                                       }
+                               }\r
+                               return thArray;\r
+                       }\r
+                       catch (java.io.IOException ex) {
+                               throw new System.IO.IOException(ex.Message, ex);
+                       }
+               }\r
+\r
+               public XmlDocument ReadImageMetadata(int frameIndex) {\r
+                       if (NativeStream == null)\r
+                               throw new Exception("Input stream not specified");\r
+\r
+                       try {\r
+                               imageio.metadata.IIOMetadata md = NativeReader.getImageMetadata( frameIndex );\r
+
+                               string [] formatNames = md.getMetadataFormatNames();
+                               dom.Element rootNode = (dom.Element) md.getAsTree(formatNames[0]);
+
+                               XmlDocument _metadataDocument = new XmlDocument();\r
+                               XmlConvert(rootNode, _metadataDocument);\r
+\r
+                               return _metadataDocument;\r
+                       }\r
+                       catch (java.io.IOException ex) {
+                               throw new System.IO.IOException(ex.Message, ex);
+                       }
+               }\r
+\r
+               public void WritePlainImage(PlainImage pi) {\r
+                       WriteImage( pi.NativeImage );\r
+               }\r
+\r
+               public void WriteImage(awt.Image bitmap) {\r
+                       if (NativeStream == null)\r
+                               throw new Exception("Output stream not specified");\r
+\r
+                       try {\r
+                               if (bitmap is image.BufferedImage)\r
+                                       NativeWriter.write((image.BufferedImage)bitmap);\r
+                               else\r
+                                       // TBD: This codec is for raster formats only\r
+                                       throw new NotSupportedException("Only raster formats are supported");\r
+                       }\r
+                       catch (java.io.IOException ex) {
+                               throw new System.IO.IOException(ex.Message, ex);
+                       }
+               }\r
+\r
+               public void WriteImage(awt.Image [] bitmap) {\r
+                       //FIXME: does not supports metadata and thumbnails for now
+                       try {
+                               if (bitmap.Length == 1) {
+                                       WriteImage(bitmap[0]);
+                               }
+                               else {
+                                       if (NativeWriter.canWriteSequence ()) {
+                                               NativeWriter.prepareWriteSequence (null);
+
+                                               for (int i = 0; i < bitmap.Length; i++) {
+                                                       if (bitmap[i] is image.BufferedImage){
+                                                               imageio.IIOImage iio = new imageio.IIOImage ((image.BufferedImage)bitmap[i], null, null);
+                                                               NativeWriter.writeToSequence (iio, null);
+                                                       }
+                                                       else
+                                                               // TBD: This codec is for raster formats only
+                                                               throw new NotSupportedException("Only raster formats are supported");
+                                               }
+                                               NativeWriter.endWriteSequence ();\r
+                                       }\r
+                                       else\r
+                                               throw new ArgumentException();\r
+                               }\r
+                       }\r
+                       catch (java.io.IOException ex) {
+                               throw new System.IO.IOException(ex.Message, ex);
+                       }
+               }\r
+\r
+               #endregion\r
+\r
+               #region Extra properties\r
+\r
+               public ImageFormat ImageFormat {\r
+                       get { return _imageFormat; }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Metadata parse\r
+\r
+               protected float [] GetResolution(XmlDocument metaData) {\r
+                       ResolutionConfigurationCollection rcc = 
+                               (ResolutionConfigurationCollection)
+                               ConfigurationSettings.GetConfig("system.drawing/codecsmetadata");
+
+                       if (rcc == null)
+                               throw new ConfigurationException("Configuration section codecsmetadata not found");
+
+                       ResolutionConfiguration rc = rcc[ ImageFormat.ToString() ];
+
+                       if (rc == null)
+                               return new float[]{0, 0};
+
+                       // Horizontal resolution
+                       string xResPath = rc.XResPath;
+                       string xRes;
+
+                       if (xResPath == string.Empty)
+                               xRes = rc.XResDefault;
+                       else
+                               xRes = GetValueFromMetadata(metaData, xResPath);
+
+                       if ((xRes == null) || (xRes == string.Empty))
+                               xRes = rc.XResDefault;
+
+                       // Vertical resolution
+                       string yResPath = rc.YResPath;
+                       string yRes;
+
+                       if (yResPath == string.Empty)
+                               yRes = rc.YResDefault;
+                       else
+                               yRes = GetValueFromMetadata(metaData, yResPath);
+
+                       if ((yRes == null) || (yRes == string.Empty))
+                               yRes = rc.YResDefault;
+
+                       // Resolution units
+                       string resUnitsPath = rc.UnitsTypePath;
+                       string resUnitsType;
+
+                       if (resUnitsPath == string.Empty)
+                               resUnitsType = rc.UnitsTypeDefault;
+                       else
+                               resUnitsType = GetValueFromMetadata(metaData, resUnitsPath);
+
+                       if (resUnitsType == null)
+                               resUnitsType = rc.UnitsTypeDefault;
+
+                       // Unit scale
+                       string unitScale = rc.UnitsScale[resUnitsType].ToString();
+
+                       // Adjust resolution to its units
+                       float [] res = new float[2];
+                       res[0] = ParseFloatValue(xRes) * ParseFloatValue(unitScale);
+                       res[1] = ParseFloatValue(yRes) * ParseFloatValue(unitScale);
+
+                       return res;
+               }\r
+\r
+\r
+               protected string GetValueFromMetadata(XmlDocument metaData, string path) {\r
+                       XmlNode n = metaData.SelectSingleNode(path);\r
+                       if (n == null)\r
+                               return null;\r
+\r
+                       return n.InnerText;\r
+               }\r
+\r
+               private void XmlConvert(dom.Node jNode, XmlNode nNode) {\r
+                       XmlDocument document = nNode.OwnerDocument;\r
+                       if (document == null)\r
+                               document = (XmlDocument)nNode;\r
+\r
+                       XmlNode n = null;\r
+                       switch (jNode.getNodeType()) {\r
+                               case 1 :\r
+                                       n = document.CreateNode(XmlNodeType.Element, jNode.getNodeName(), jNode.getNamespaceURI());\r
+                                       break;\r
+\r
+                               case 4 :\r
+                                       n = document.CreateNode(XmlNodeType.CDATA, jNode.getNodeName(), jNode.getNamespaceURI());\r
+                                       break;\r
+\r
+                               default:\r
+                                       return;\r
+                       }\r
+                       //set value\r
+                       n.InnerText = jNode.getNodeValue();\r
+                       nNode.AppendChild( n );\r
+\r
+                       //copy attributes\r
+                       org.w3c.dom.NamedNodeMap nm = jNode.getAttributes();\r
+                       for (int i=0; i<nm.getLength(); i++) {\r
+                               XmlAttribute a = document.CreateAttribute( nm.item(i).getNodeName() );\r
+                               a.Value = nm.item(i).getNodeValue();\r
+                               n.Attributes.Append( a );\r
+                       }\r
+\r
+                       //copy childs\r
+                       org.w3c.dom.NodeList nl = jNode.getChildNodes();\r
+                       for (int i=0; i<nl.getLength(); i++) {\r
+                               XmlConvert(nl.item(i), n);\r
+                       }\r
+               }\r
+\r
+               protected virtual float ParseFloatValue(string strValue) {\r
+                       try {\r
+                               if ((strValue != null) && (strValue != "")) {
+                                       int dividerPos = strValue.IndexOf("/");
+                               
+                                       if (dividerPos < 0) {
+                                               return float.Parse(strValue);
+                                       } 
+                                       else {
+                                               return float.Parse(strValue.Substring( 0, dividerPos )) /
+                                                       float.Parse(strValue.Substring( dividerPos + 1 ));
+                                       }
+                               }\r
+                               return float.NaN;\r
+                       }\r
+                       catch (Exception) {\r
+                               return float.NaN;\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+\r
+       }\r
+}\r
index 2836101e6e6e3c6a385e6fc150645130ced8edfc..b402dbc9d2da0dbae9bdf2469b2b18e3eb5e7350 100755 (executable)
@@ -41,6 +41,8 @@ using System.Collections;
 using System.Collections.Specialized;
 using System.Configuration;
 using System.IO;
+using Mainsoft.Drawing.Imaging;
+
 using imageio = javax.imageio;
 using spi = javax.imageio.spi;
 
@@ -61,197 +63,9 @@ namespace System.Drawing.Imaging {
                private byte[][] signaturePatterns;
                private int version;
                
-               #region SpiIterators
-               abstract class BaseSpiIterator {
-                       protected abstract java.util.Iterator GetIterator (string mimeType);
-                       protected abstract spi.ImageReaderWriterSpi GetNext (java.util.Iterator iter);
-
-                       #region ProcessOneCodec
-                       ImageCodecInfo ProcessOneCodec (Guid clsid, Guid formatID, string mimeType) {
-                               ImageCodecInfo ici = new ImageCodecInfo ();
-                               ici.Clsid = clsid;
-                               ici.FormatID = formatID;
-                               ici.MimeType = mimeType;
-                               java.util.Iterator iter = GetIterator (mimeType);
-                               while (iter.hasNext ()) {
-                                       spi.ImageReaderWriterSpi rw = GetNext (iter);
-                                       try {
-                                               ici.CodecName = rw.getDescription (java.util.Locale.getDefault ());
-                                               ici.DllName = null;
-                                               foreach (string suffix in rw.getFileSuffixes ()) {
-                                                       if (ici.FilenameExtension != null)
-                                                               ici.FilenameExtension += ";";
-                                                       ici.FilenameExtension += "*."+suffix;
-                                               }
-                                               ici.Flags = ImageCodecFlags.Builtin|ImageCodecFlags.SupportBitmap;
-                                               if (rw is spi.ImageReaderSpi) {
-                                                       ici.Flags |= ImageCodecFlags.Decoder;
-                                                       if ((rw as spi.ImageReaderSpi).getImageWriterSpiNames().Length != 0)
-                                                               ici.Flags |= ImageCodecFlags.Encoder;
-                                               }
-                                               if (rw is spi.ImageWriterSpi) {
-                                                       ici.Flags |= ImageCodecFlags.Encoder;
-                                                       if ((rw as spi.ImageWriterSpi).getImageReaderSpiNames().Length != 0)
-                                                               ici.Flags |= ImageCodecFlags.Decoder;
-                                               }
-                                               ici.FormatDescription = string.Join(";",
-                                                       rw.getFormatNames());
-                                               ici.Version = (int)Convert.ToDouble(rw.getVersion ());
-                                               break;
-                                       }
-                                       catch {
-                                       }
-                               }
-                               return ici;
-                       }
-                       #endregion
-
-                       public Hashtable Iterate () {
-                               // TBD: Insert Exception handling here
-                               NameValueCollection nvc = (NameValueCollection) System.Configuration.ConfigurationSettings
-                                       .GetConfig ("system.drawing/codecs");
-                               Hashtable codecs = new Hashtable (10);
-                       
-                               for (int i=0; i<nvc.Count; i++) {
-                                       Guid clsid = new Guid (nvc.GetKey (i));
-                                       ImageFormat format = ClsidToImageFormat (clsid);
-                                       string [] codecMimeTypes = nvc[i].Split(',');
-                                       for (int j = 0; j < codecMimeTypes.Length; j++) \r
-                                       {
-                                               ImageCodecInfo codec = ProcessOneCodec (clsid, format.Guid, codecMimeTypes[j].Trim());
-                                               if (codec.FilenameExtension != null)
-                                                       codecs [clsid] = codec;
-                                       }
-                               }
-                               return codecs;
-                       }
-               }
-
-               class ReaderSpiIterator: BaseSpiIterator {
-                       protected override java.util.Iterator GetIterator(string mimeType) {\r
-                               return imageio.ImageIO.getImageReadersByMIMEType (mimeType);\r
-                       }\r
-                       protected override javax.imageio.spi.ImageReaderWriterSpi GetNext(java.util.Iterator iter) {\r
-                               imageio.ImageReader r = (imageio.ImageReader) iter.next ();\r
-                               return r.getOriginatingProvider ();\r
-                       }\r
-               }
-
-               class WriterSpiIterator: BaseSpiIterator {
-                       protected override java.util.Iterator GetIterator(string mimeType) {\r
-                               return imageio.ImageIO.getImageWritersByMIMEType (mimeType);\r
-                       }\r
-                       protected override javax.imageio.spi.ImageReaderWriterSpi GetNext(java.util.Iterator iter) {\r
-                               imageio.ImageWriter w = (imageio.ImageWriter) iter.next ();\r
-                               return w.getOriginatingProvider ();\r
-                       }\r
-               }
-               #endregion
-
-               #region Clsid and FormatID
-               static Guid BmpClsid = new Guid ("557cf400-1a04-11d3-9a73-0000f81ef32e");
-               static Guid JpegClsid = new Guid ("557cf401-1a04-11d3-9a73-0000f81ef32e");
-               static Guid GifClsid = new Guid ("557cf402-1a04-11d3-9a73-0000f81ef32e");
-               static Guid EmfClsid = new Guid ("557cf403-1a04-11d3-9a73-0000f81ef32e");
-               static Guid WmfClsid = new Guid ("557cf404-1a04-11d3-9a73-0000f81ef32e");
-               static Guid TiffClsid = new Guid ("557cf405-1a04-11d3-9a73-0000f81ef32e");
-               static Guid PngClsid = new Guid ("557cf406-1a04-11d3-9a73-0000f81ef32e");
-               static Guid IconClsid = new Guid ("557cf407-1a04-11d3-9a73-0000f81ef32e");
-
-               internal static ImageFormat ClsidToImageFormat (Guid clsid)
-               {
-                       if (clsid.Equals (BmpClsid))
-                               return ImageFormat.Bmp;
-                       else if (clsid.Equals (JpegClsid))
-                               return ImageFormat.Jpeg;
-                       else if (clsid.Equals (GifClsid))
-                               return ImageFormat.Gif;
-                       else if (clsid.Equals (EmfClsid))
-                               return ImageFormat.Emf;
-                       else if (clsid.Equals (WmfClsid))
-                               return ImageFormat.Wmf;
-                       else if (clsid.Equals (TiffClsid))
-                               return ImageFormat.Tiff;
-                       else if (clsid.Equals (PngClsid))
-                               return ImageFormat.Png;
-                       else if (clsid.Equals (IconClsid))
-                               return ImageFormat.Icon;
-                       else
-                               return null;
-               }
-
-               internal static Guid ImageFormatToClsid (ImageFormat format)
-               {
-                       if (format == null)
-                               return Guid.Empty;
-
-                       if (format.Guid.Equals (ImageFormat.Bmp.Guid))
-                               return BmpClsid;
-                       else if (format.Guid.Equals (ImageFormat.Jpeg.Guid))
-                               return JpegClsid;
-                       else if (format.Guid.Equals (ImageFormat.Gif))
-                               return GifClsid;
-                       else if (format.Guid.Equals (ImageFormat.Emf.Guid))
-                               return EmfClsid;
-                       else if (format.Guid.Equals (ImageFormat.Wmf.Guid))
-                               return WmfClsid;
-                       else if (format.Guid.Equals (ImageFormat.Tiff.Guid))
-                               return TiffClsid;
-                       else if (format.Guid.Equals (ImageFormat.Png.Guid))
-                return PngClsid;
-                       else if (format.Guid.Equals (ImageFormat.Icon.Guid))
-                               return IconClsid;
-                       else
-                               return Guid.Empty;
-               }
-               #endregion
-
-               #region Internals
-               internal static Hashtable Decoders {
-                       get {
-                               const string MYNAME = "System.Drawing.Imaging.ImageCodecInfo.decoders";
-                               Hashtable o = (Hashtable) AppDomain.CurrentDomain.GetData (MYNAME);
-                               if (o != null)
-                                       return o;
-                               o = new ReaderSpiIterator ().Iterate ();
-                               AppDomain.CurrentDomain.SetData (MYNAME, o);
-                               return o;
-                       }
-               }
-
-               internal static Hashtable Encoders {
-                       get {
-                               const string MYNAME = "System.Drawing.Imaging.ImageCodecInfo.encoders";
-                               Hashtable o = (Hashtable) AppDomain.CurrentDomain.GetData (MYNAME);
-                               if (o != null)
-                                       return o;
-                               o = new WriterSpiIterator ().Iterate ();
-                               AppDomain.CurrentDomain.SetData (MYNAME, o);
-                               return o;
-                       }
-               }
-
-               internal static ImageCodecInfo FindEncoder (Guid clsid) {
-                       return (ImageCodecInfo) Encoders [clsid];
-               }
-
-               internal static ImageCodecInfo FindDecoder (Guid clsid) {
-                       return (ImageCodecInfo) Decoders [clsid];
-               }
-
-               internal static string ImageFormatToMimeType (ImageFormat format) {
-                       //FIXME: this code assumes that any encoder has corresponding decoder
-                       Guid clsid = ImageFormatToClsid (format);
-                       ImageCodecInfo codec = FindDecoder (clsid);
-                       if (codec == null)
-                               return null;
-                       return codec.MimeType;
-               }
-               #endregion
-
                public static ImageCodecInfo[] GetImageDecoders () 
                {
-                       Hashtable oldInfo = Decoders;
+                       Hashtable oldInfo = ImageCodec.Decoders;
                        ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count];
                        int i=0;
                        foreach (ImageCodecInfo codec in oldInfo.Values) {
@@ -272,12 +86,12 @@ namespace System.Drawing.Imaging {
                        return newInfo;
                }
                
-               private ImageCodecInfo () {
+               internal ImageCodecInfo () {
                }
 
                public static ImageCodecInfo[] GetImageEncoders () 
                {
-                       Hashtable oldInfo = Encoders;
+                       Hashtable oldInfo = ImageCodec.Encoders;
                        ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count];
                        int i=0;
                        foreach (ImageCodecInfo codec in oldInfo.Values) {
index 4ea1f6f269fff300ada20d3d58e8a22d94615536..4ed7a0e31ff6c9db6f9394aa1092600e267afee2 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * InvalidPrinterException.cs: Removed NotImplementedException (not
+       required) and added a demand for SerializationFormatter on the 
+       GetObjectData method.
+       * PrintingPermission.cs: Throw ArgumentException if the class or 
+       version attributes are missing in the supplied XML (only in 1.x).
+
 2005-03-23 Jordi Mas i Hernandez <jordi@ximian.com>
        * PaperKind.cs: fixes wrong enum values
 
index fde56db2c5d5c6895926f42b8adeb380e75f24db..9ee8b733b7fe4af6c3d6896862c95b30c5a9f7a9 100644 (file)
@@ -8,7 +8,7 @@
 //
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Runtime.Serialization;
+using System.Security.Permissions;
+
+namespace System.Drawing.Printing {
 
-namespace System.Drawing.Printing
-{
-       /// <summary>
-       /// Summary description for InvalidPrinterExecption.
-       /// </summary>
+#if NET_2_0
+       [Serializable]
+#endif
        public class InvalidPrinterException : SystemException {
+
                private PrinterSettings settings;
 
-               public InvalidPrinterException(PrinterSettings settings) {
+               public InvalidPrinterException (PrinterSettings settings)
+               {
                        this.settings = settings;
                }
-               protected InvalidPrinterException(SerializationInfo info, StreamingContext context) {
-                       throw new NotImplementedException ();
+
+               protected InvalidPrinterException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
                }
-               public override void GetObjectData(SerializationInfo info, StreamingContext context) {
-                       throw new NotImplementedException ();
+
+               [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+
+                       base.GetObjectData (info, context);
                }
        }
 }
index bebd31d4fb47a278c9e6c46d8e6347d4447be0a8..8aee6ce95cd6ba0da3bfcdde37150c8ea5a3ade9 100644 (file)
@@ -200,11 +200,18 @@ namespace System.Drawing.Printing {
                        if (se == null)
                                throw new ArgumentNullException (parameterName);
 
-                       if (se.Attribute ("class") == null) {
+                       string c = se.Attribute ("class");
+#if NET_2_0
+                       if (c == null) {
                                string msg = Locale.GetText ("Missing 'class' attribute.");
                                throw new ArgumentException (msg, parameterName);
                        }
-
+#else
+                       if ((c == null) || (String.Compare (c, 0, "System.Drawing.Printing.PrintingPermission", 0, 42) != 0)) {
+                               string msg = Locale.GetText ("Wrong 'class' attribute.");
+                               throw new ArgumentException (msg, parameterName);
+                       }
+#endif
                        // we assume minimum version if no version number is supplied
                        int version = minimumVersion;
                        string v = se.Attribute ("version");
@@ -218,6 +225,12 @@ namespace System.Drawing.Printing {
                                        throw new ArgumentException (msg, parameterName, e);
                                }
                        }
+#if !NET_2_0
+                       else {
+                               string msg = Locale.GetText ("Missing 'version' attribute.");
+                               throw new ArgumentException (msg, parameterName);
+                       }
+#endif
 
                        if ((version < minimumVersion) || (version > maximumVersion)) {
                                string msg = Locale.GetText ("Unknown version '{0}', expected versions between ['{1}','{2}'].");
index 16e7d0ecbeeb9ac9788b2debf65c737115a10467..98500a732188c46e64ec6bae41e0176f2da4fde9 100644 (file)
@@ -9,6 +9,7 @@
                                <Reference Name="System" AssemblyName="System" HintPath="..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"/>\r
                                <Reference Name="rt" AssemblyName="rt" HintPath="..\lib\j2sdk1.4.1\rt.dll" Private="False"/>\r
                                <Reference Name="J2SE.Helpers" AssemblyName="J2SE.Helpers" HintPath="..\lib\J2SE.Helpers.dll" Private="False"/>\r
+                               <Reference Name="System.Xml" AssemblyName="System.Xml" HintPath="..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Xml.dll" Private="False"/>\r
                        </References>\r
                </Build>\r
                <Files>\r
@@ -17,6 +18,9 @@
                                <File RelPath="MonoTODOAttribute.cs" Link="..\..\build\common\MonoTODOAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="Assembly\AssemblyInfo.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="Assembly\Consts.cs.in" Link="..\..\build\common\Consts.cs.in" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mainsoft.Drawing.Configuration.jvm\ResolutionConfiguration.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mainsoft.Drawing.Configuration.jvm\ResolutionConfigurationCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mainsoft.Drawing.Configuration.jvm\ResolutionConfigurationHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\AdvancedStroke.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\BasicShape.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\Bitmap.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
@@ -42,6 +46,8 @@
                                <File RelPath="System.Drawing\KnownColor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\Pen.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\Pens.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Drawing\PlainImage.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Drawing\PlainImageCollection.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\Point.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\PointConverter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing\PointF.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing.Imaging\EncoderValue.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing.Imaging\FrameDimension.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing.Imaging\ImageAttributes.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Drawing.Imaging\ImageCodec.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing.Imaging\ImageCodecFlags.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing.Imaging\ImageCodecInfo.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Drawing.Imaging\ImageFlags.cs" SubType="Code" BuildAction="Compile"/>\r
index 0c54be5351254de3685d7fdd5739344de84ae78e..4d6b6aa948b318b6cf164b70e86ad3a037e30ccb 100755 (executable)
@@ -10,6 +10,15 @@ using sun.dc.pr;
 namespace System.Drawing {\r
        internal class AdvancedStroke : Stroke {\r
 \r
+               public const float PenUnits = 0.01f;
+               public const int MinPenUnits = 100;
+               public const int MinPenUnitsAA = 20;
+               public const float MinPenSizeAA = PenUnits * MinPenUnitsAA;\r
+               public const double MinPenSizeAASquared = (MinPenSizeAA * MinPenSizeAA);
+               public const double MinPenSizeSquared = 1.000000001;\r
+               public const double MinPenSizeNorm = 1.5;\r
+               public const double MinPenSizeSquaredNorm = (MinPenSizeNorm * MinPenSizeNorm);\r
+\r
                /**\r
                 * Joins path segments by extending their outside edges until\r
                 * they meet.\r
@@ -58,6 +67,8 @@ namespace System.Drawing {
                float dash_phase;\r
 \r
                AffineTransform _penTransform;\r
+               AffineTransform _outputTransform;\r
+               bool _fitPen;\r
 \r
                /**\r
                 * Constructs a new <code>AdvancedStroke</code> with the specified\r
@@ -87,7 +98,8 @@ namespace System.Drawing {
                 * @throws IllegalArgumentException if dash lengths are all zero.\r
                 */\r
                public AdvancedStroke(float width, int cap, int join, float miterlimit,\r
-                       float[] dash, float dash_phase, AffineTransform penTransform) {\r
+                       float[] dash, float dash_phase, AffineTransform penTransform,\r
+                       AffineTransform outputTransform, bool fitPen) {\r
                        if (width < 0.0f) {\r
                                throw new IllegalArgumentException("negative width");\r
                        }\r
@@ -127,6 +139,8 @@ namespace System.Drawing {
                        }\r
                        this.dash_phase = dash_phase;\r
                        this._penTransform = penTransform;\r
+                       this._outputTransform = outputTransform;\r
+                       this._fitPen = fitPen;\r
                }\r
 \r
                /**\r
@@ -145,7 +159,7 @@ namespace System.Drawing {
                 *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER\r
                 */\r
                public AdvancedStroke(float width, int cap, int join, float miterlimit) :\r
-                       this(width, cap, join, miterlimit, null, 0.0f, null) {\r
+                       this(width, cap, join, miterlimit, null, 0.0f, null, null, false) {\r
                }\r
 \r
                /**\r
@@ -163,7 +177,7 @@ namespace System.Drawing {
                 *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER\r
                 */\r
                public AdvancedStroke(float width, int cap, int join) :\r
-                       this(width, cap, join, 10.0f, null, 0.0f, null) {\r
+                       this(width, cap, join, 10.0f, null, 0.0f, null, null, false) {\r
                }\r
 \r
                /**\r
@@ -174,7 +188,7 @@ namespace System.Drawing {
                 * @throws IllegalArgumentException if <code>width</code> is negative\r
                 */\r
                public AdvancedStroke(float width) :\r
-                       this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f, null) {\r
+                       this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f, null, null, false) {\r
                }\r
 \r
                /**\r
@@ -184,7 +198,7 @@ namespace System.Drawing {
                 * JOIN_MITER, a miter limit of 10.0.\r
                 */\r
                public AdvancedStroke() :\r
-                       this(1.0f, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f, null) {\r
+                       this(1.0f, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f, null, null, false) {\r
                }\r
 \r
 \r
@@ -200,16 +214,28 @@ namespace System.Drawing {
                        PathConsumer consumer;\r
 \r
                        stroker.setPenDiameter(width);\r
+                       if (_fitPen)\r
+                               stroker.setPenFitting(PenUnits, MinPenUnitsAA);\r
 \r
                        float[] t4 = null;\r
-                       if (PenTransform != null) {\r
-                               t4 = new float[4]{\r
-                                       (float)PenTransform.getScaleX(), (float)PenTransform.getShearX(), \r
-                                       (float)PenTransform.getShearY(), (float)PenTransform.getScaleY()\r
+                       if (PenTransform != null && !PenTransform.isIdentity()) {\r
+                               t4 = new float[]{\r
+                                       (float)PenTransform.getScaleX(), (float)PenTransform.getShearY(), \r
+                                       (float)PenTransform.getShearX(), (float)PenTransform.getScaleY()\r
+                               };\r
+                       }\r
+\r
+                       float[] t6 = null;\r
+                       if (OutputTransform != null && !OutputTransform.isIdentity()) {\r
+                               t6 = new float[] {\r
+                                       (float)OutputTransform.getScaleX(), (float)OutputTransform.getShearY(), \r
+                                       (float)OutputTransform.getShearX(), (float)OutputTransform.getScaleY(),\r
+                                       (float)OutputTransform.getTranslateX(), (float)OutputTransform.getTranslateY()\r
                                };\r
                        }\r
 \r
                        stroker.setPenT4(t4);\r
+                       stroker.setOutputT6(t6);\r
                        stroker.setCaps(RasterizerCaps[cap]);\r
                        stroker.setCorners(RasterizerCorners[join], miterlimit);\r
                        if (dash != null) {\r
@@ -230,12 +256,6 @@ namespace System.Drawing {
                                float my = 0.0f;\r
                                float[] point  = new float[6];\r
 \r
-                               // normalize\r
-                               const float norm = 0.5f;\r
-                               //const float rnd = (0.5f - norm);
-                               float ax = 0.0f;
-                               float ay = 0.0f;\r
-\r
                                while (!pi.isDone()) {\r
                                        int type = pi.currentSegment(point);\r
                                        if (pathClosed == true) {\r
@@ -245,51 +265,6 @@ namespace System.Drawing {
                                                        consumer.beginSubpath(mx, my);\r
                                                }\r
                                        }\r
-                                       int index;
-                                       switch ((GraphicsPath.JPI)type) {
-                                               case GraphicsPath.JPI.SEG_CUBICTO:
-                                                       index = 4;
-                                                       break;
-                                               case GraphicsPath.JPI.SEG_QUADTO:
-                                                       index = 2;
-                                                       break;
-                                               case GraphicsPath.JPI.SEG_MOVETO:
-                                               case GraphicsPath.JPI.SEG_LINETO:
-                                                       index = 0;
-                                                       break;
-                                               case GraphicsPath.JPI.SEG_CLOSE:
-                                               default:
-                                                       index = -1;
-                                                       break;
-                                       }
-                                       if (index >= 0) {
-                                               float ox = point[index];
-                                               float oy = point[index+1];
-                                               float newax = (float) java.lang.Math.floor(ox/* + rnd*/) + norm;
-                                               float neway = (float) java.lang.Math.floor(oy/* + rnd*/) + norm;
-                                               point[index] = newax;
-                                               point[index+1] = neway;
-                                               newax -= ox;
-                                               neway -= oy;
-                                               switch ((GraphicsPath.JPI)type) {
-                                                       case GraphicsPath.JPI.SEG_CUBICTO:
-                                                               point[0] += ax;
-                                                               point[1] += ay;
-                                                               point[2] += newax;
-                                                               point[3] += neway;
-                                                               break;
-                                                       case GraphicsPath.JPI.SEG_QUADTO:
-                                                               point[0] += (newax + ax) / 2;
-                                                               point[1] += (neway + ay) / 2;
-                                                               break;
-//                                                     case GraphicsPath.JPI.SEG_MOVETO:
-//                                                     case GraphicsPath.JPI.SEG_LINETO:
-//                                                     case GraphicsPath.JPI.SEG_CLOSE:
-//                                                             break;
-                                               }
-                                               ax = newax;
-                                               ay = neway;
-                                       }\r
                                        switch ((GraphicsPath.JPI)type) {\r
                                                case GraphicsPath.JPI.SEG_MOVETO:\r
                                                        mx = point[0];\r
@@ -479,6 +454,15 @@ namespace System.Drawing {
                        }\r
                }\r
 \r
+               public AffineTransform OutputTransform {\r
+                       get {\r
+                               return _outputTransform;\r
+                       }\r
+                       set {\r
+                               _outputTransform = value;\r
+                       }\r
+               }\r
+\r
                private static readonly int[] RasterizerCaps = {\r
                                                                                                                   Rasterizer.BUTT, Rasterizer.ROUND, Rasterizer.SQUARE\r
                                                                                                           };\r
index 8a434177889c4cb8b0a35b204a35fc516229f7cc..d25f21221326902d40d469e5e0d3d082684da31c 100644 (file)
@@ -13,7 +13,7 @@
 //
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
 using System.Drawing.Imaging;
 using System.Runtime.Serialization;
 using System.Runtime.InteropServices;
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Drawing
 {
@@ -97,14 +97,6 @@ namespace System.Drawing
                        
                }
 
-               void InitFromFile (string filename)
-               {               
-                       IntPtr imagePtr;
-                       Status st = GDIPlus.GdipLoadImageFromFile (filename, out imagePtr);
-                       GDIPlus.CheckStatus (st);
-                       nativeObject = imagePtr;                        
-               }
-
                public Bitmap (Stream stream, bool useIcm)
                {
                        if (stream == null)
@@ -115,7 +107,16 @@ namespace System.Drawing
 
                public Bitmap (string filename, bool useIcm)
                {
-                       InitFromFile (filename);
+                       IntPtr imagePtr;
+                       Status st;
+
+                       if (useIcm)
+                               st = GDIPlus.GdipCreateBitmapFromFileICM (filename, out imagePtr);
+                       else
+                               st = GDIPlus.GdipCreateBitmapFromFile (filename, out imagePtr);
+
+                       GDIPlus.CheckStatus (st);
+                       nativeObject = imagePtr;
                }
 
                public Bitmap (Type type, string resource)
@@ -226,12 +227,14 @@ namespace System.Drawing
                }
 
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public IntPtr GetHbitmap ()
                {
                        return GetHbitmap(Color.Gray);
                }
 
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public IntPtr GetHbitmap (Color background)
                {
                        IntPtr HandleBmp;
@@ -243,6 +246,7 @@ namespace System.Drawing
                }
 
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public IntPtr GetHicon ()
                {
                        IntPtr HandleIcon;
index f35402a77dbede9ef9826a1258879c465df55326..752a8f869a76629ee038fa5b8d21c0a314a47a76 100644 (file)
@@ -2,6 +2,7 @@ using System;
 using System.IO;
 using System.Drawing.Imaging;
 using System.Runtime.Serialization;
+using Mainsoft.Drawing.Imaging;
 
 using io = java.io;
 using imageio = javax.imageio;
@@ -18,33 +19,26 @@ namespace System.Drawing
 
                #region constructors
 
-               Bitmap (Bitmap orig):base (orig) {}
+               Bitmap (Bitmap orig):base ( orig.NativeObject ) {}
 
                private Bitmap (SerializationInfo info, StreamingContext context) {
                        throw new NotImplementedException ();
                }
 
-               public Bitmap (int width, int height, Graphics g) {
-                       throw new NotImplementedException();                    
+               public Bitmap (int width, int height, Graphics g) 
+                       :this (width, height, PixelFormat.Format32bppArgb) {
+                       CurrentImage.HorizontalResolution = g.DpiX;
+                       CurrentImage.VerticalResolution = g.DpiY;
                }
 
-               public Bitmap (Image orig, Size newSize)
-                       :this (orig, newSize.Width, newSize.Height) {}
-
-               public Bitmap (Image orig, int width, int height)
-                       :base (CreateScaledImage (orig, width, height), ImageFormat.Bmp) {}
-
-               public Bitmap (int width, int height) 
-                       :this (width, height, PixelFormat.Format32bppArgb) {}
-
                public Bitmap (Image original) 
                        :this (original, original.Size) {}
 
-               public Bitmap (Stream stream)
-                       :this (stream, false) {}
+               public Bitmap (Image orig, Size newSize)
+                       :this (orig, newSize.Width, newSize.Height) {}
 
-               public Bitmap (string filename) 
-                       :this (filename, false) {}
+               public Bitmap (Image orig, int width, int height)
+                       :base (CreateScaledImage (orig, width, height), ImageFormat.MemoryBmp) {}
 
                internal Bitmap (java.awt.Image nativeObject, ImageFormat format)
                        :base (nativeObject, format) {}
@@ -55,18 +49,22 @@ namespace System.Drawing
                                throw new NotImplementedException ("Converting PixelFormat is not implemented yet.");
                }
 
+               public Bitmap (int width, int height) 
+                       :this (width, height, PixelFormat.Format32bppArgb) {}
+
                public Bitmap (int width, int height, PixelFormat format)
                        :base (
-                               new java.awt.image.BufferedImage (width, height,
-                                       ToBufferedImageFormat (format)),
-                               ImageFormat.Bmp)
-               {
-                       //TBD: why the following 3 lines are necessary?
-//                     java.awt.Graphics2D graphics2d = NativeObject.createGraphics();
-//                     graphics2d.drawImage(NativeObject, 0, 0, null);
-//                     graphics2d.dispose();
+                       new java.awt.image.BufferedImage (width, height,
+                       ToBufferedImageFormat (format)),
+                       ImageFormat.Bmp) {
                }
 
+               public Bitmap (Stream stream)
+                       :this (stream, false) {}
+
+               public Bitmap (string filename) 
+                       :this (filename, false) {}
+
                public Bitmap (Stream stream, bool useIcm)
                        :this (stream, useIcm, null) {}
 
@@ -84,16 +82,15 @@ namespace System.Drawing
                        //FIXME: useIcm param
                        java.io.File file = vmw.common.IOUtils.getJavaFile (filename);
                        if (!file.exists ())
-                               //TBD: check what exception throws NET
-                               throw new System.IO.IOException ("File not found: "+filename);
+                                throw new System.IO.FileNotFoundException (filename);
                        Initialize (new stream.FileImageInputStream (file), format);
                }
 
                public Bitmap (Type type, string resource) {
                        using (Stream s = type.Assembly.GetManifestResourceStream (resource)) {
                                if (s == null)
-                                       //TBD: check what type is thrown in MS
-                                       throw new Exception("Resource name was not found: `" + resource + "'");
+                                       throw new ArgumentException("Resource '" + resource + "' could not be found in class '" + type.ToString() + "'");
+
                                io.InputStream jis = vmw.common.IOUtils.ToInputStream (s);
                                try {
                                        Initialize (new stream.MemoryCacheImageInputStream (jis), null);
@@ -104,99 +101,56 @@ namespace System.Drawing
                                }
                        }
                }
-
-               //FIXME: should go to imageio helpers class
-               static ImageFormat MimeTypesToImageFormat (string [] mimeTypes)
-               {
-                       foreach (ImageCodecInfo codec in ImageCodecInfo.Decoders.Values)
-                               for (int i=0; i<mimeTypes.Length; i++)
-                                       if (codec.MimeType == mimeTypes [i])
-                                               return new ImageFormat (codec.FormatID);
-                       return null;
+#if INTPTR_SUPPORT
+               public Bitmap (int width, int height, int stride, PixelFormat format, IntPtr scan0)
+               {                                               
+                       throw new NotImplementedException();                    
                }
+#endif
+               #endregion
 
-               private void Initialize (stream.ImageInputStream input, ImageFormat format) {
-                       java.util.Iterator iter = null;
-                       if (format != null)
-                               iter = imageio.ImageIO.getImageReadersByMIMEType (
-                                       ImageCodecInfo.ImageFormatToMimeType (format));
-                       else 
-                               iter = imageio.ImageIO.getImageReaders (input);
-
-                       if (!iter.hasNext ())
-                               throw new ArgumentException ("Format not found"); //TBD: make same text as MS
-
-                       imageio.ImageReader r = (imageio.ImageReader) iter.next ();
+               #region Internal Initialization
 
-                       r.setInput (input);
+               private void Initialize (stream.ImageInputStream input, ImageFormat format) {
+                       ImageCodec ic = null;
 
                        if (format == null)
-                               format = MimeTypesToImageFormat (r.getOriginatingProvider ().getMIMETypes ());
+                               ic = ImageCodec.CreateReader(input);
+                       else
+                               ic = ImageCodec.CreateReader(format);
 
-                       Initialize (r, format);
-               }
-
-               private void Initialize (imageio.ImageReader r, ImageFormat format) {
-                       java.awt.Image [] nativeObjects;
-                       java.awt.Image [] thumbnails = null;
                        try {
-                               nativeObjects = new BufferedImage [r.getNumImages (false)];
-                               for (int i = 0; i < nativeObjects.Length; i++) {
-                                       if (r.hasThumbnails(i)) {
-                                               if (thumbnails == null)
-                                                       thumbnails = new BufferedImage[nativeObjects.Length];
-
-                                               thumbnails[i] = r.readThumbnail(i, 0);
-                                       }
-                                       nativeObjects [i] = r.read (i);
+                               ic.NativeStream = input;
+                               PlainImage pi = ic.ReadPlainImage();
+                               base.Initialize( pi, false );
+
+                               pi = ic.ReadNextPlainImage();
+                               while ( pi != null) {
+                                       base.Initialize( pi, true );
+                                       pi = ic.ReadNextPlainImage();
                                }
 
+                               _flags |= (int)(ImageFlags.ImageFlagsReadOnly | ImageFlags.ImageFlagsHasRealPixelSize);
                        }
-                       catch (Exception e) {
-                               //TDB: make exception same as in MS
-                               throw new ArgumentException ("Error reading", e);
+                       catch (Exception) {
+                               throw new OutOfMemoryException ("Out of memory");
                        }
-                       base.Initialize (nativeObjects, thumbnails, format, FrameDimension.Page.Guid);
                }
 
-#if INTPTR_SUPPORT
-               public Bitmap (int width, int height, int stride, PixelFormat format, IntPtr scan0)
-               {                                               
-                       throw new NotImplementedException();                    
-               }
-#endif
                #endregion
 
                #region InternalSave
                protected override void InternalSave (stream.ImageOutputStream output, Guid clsid) {
-                       string mime=ImageCodecInfo.FindEncoder (clsid).MimeType;
-                       imageio.ImageWriter writer = null;;
-                       try {
-                               writer = (imageio.ImageWriter) imageio.ImageIO.getImageWritersByMIMEType (mime).next ();
-                               writer.setOutput (output);
-                               if (NativeObjectsCount == 1)
-                                       writer.write (NativeObject);
-                               else if (writer.canWriteSequence ())
-                                       SaveSequence (writer);
-                               else
-                                       throw new NotImplementedException ();
-                       }
-                       catch (Exception e) {
-                               //FIXME: check dotnet exceptions in save, and throw same types
-                               throw new Exception ("java threw an exception", e);
-                       }
-               }
-
-               void SaveSequence (imageio.ImageWriter writer) {
-                       //FIXME: does not supports metadata and thumbnails for now
-                       writer.prepareWriteSequence (null);
 
-                       for (int i = 0; i < NativeObjectsCount; i++) {
-                               imageio.IIOImage iio = new imageio.IIOImage ((BufferedImage)this[i], null, null);
-                               writer.writeToSequence (iio, null);
+                       ImageCodec ic = ImageCodec.CreateWriter( clsid );
+                       if (ic != null) {
+                               ic.NativeStream = output;
+                               ic.WriteImage( NativeObject );
+                       }
+                       else {
+                               // FIXME: correct this exception
+                               throw new Exception("Format not supported");
                        }
-
-                       writer.endWriteSequence ();
                }
 
                #endregion
@@ -227,7 +181,7 @@ namespace System.Drawing
                }
 
                private static java.awt.Image CreateScaledImage(Image original, int width, int height) {
-                       JavaImage oldscaled = original.NativeObject.getScaledInstance(width, height,
+                       JavaImage oldscaled = original.CurrentImage.NativeImage.getScaledInstance(width, height,
                                JavaImage.SCALE_DEFAULT);
                        BufferedImage newimage = new BufferedImage(oldscaled.getWidth(null), 
                                oldscaled.getHeight(null),
@@ -310,10 +264,11 @@ namespace System.Drawing
                }
                #endregion
 
-               #region SetResolution [TODO]
+               #region SetResolution
                public void SetResolution (float xDpi, float yDpi)
                {
-                       throw new NotImplementedException();
+                       CurrentImage.HorizontalResolution = xDpi;
+                       CurrentImage.VerticalResolution = yDpi;
                }
                #endregion 
 
@@ -327,7 +282,7 @@ namespace System.Drawing
                #region NativeObject
                internal new BufferedImage NativeObject {
                        get {
-                               return (BufferedImage)base.NativeObject;
+                               return (BufferedImage)base.NativeObject.CurrentImage.NativeImage;
                        }
                }
 
index 7a48bd93a4f8d5903f3ca531cfa43451833f5189..8f67829256b35bdc4e3c62863ae9d3ec75c9f176 100755 (executable)
@@ -10,8 +10,7 @@ using geom = java.awt.geom;
 
 namespace System.Drawing
 {
-       public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable, awt.Paint
-       {
+       public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable, awt.Paint {
                protected abstract java.awt.Paint NativeObject {
                        get;
                }
@@ -29,16 +28,60 @@ namespace System.Drawing
 
                abstract public object Clone ();
 
-               public void Dispose ()
-               {
+               public void Dispose () {
                        Dispose (true);
                }
 
-               protected virtual void Dispose (bool disposing)
-               {
+               protected virtual void Dispose (bool disposing) {
                }
 
-               protected internal Matrix _brushTransform = new Matrix();
+               #region Brush transform
+
+               private readonly Matrix _brushTransform = new Matrix();
+
+               protected Matrix BrushTransform {
+                       get { return _brushTransform.Clone(); }
+                       set { 
+                               if (value == null)
+                                       throw new ArgumentNullException("matrix");
+
+                               value.CopyTo( _brushTransform ); 
+                       }
+               }
+
+               protected void BrushTranslateTransform (float dx, float dy) {
+                       BrushTranslateTransform(dx, dy, MatrixOrder.Prepend);
+               }
+               protected void BrushTranslateTransform (float dx, float dy, MatrixOrder order) {
+                       BrushTransform.Translate(dx,dy,order);
+               }
+               protected void BrushResetTransform () {
+                       BrushTransform.Reset();
+               }
+               protected void BrushRotateTransform (float angle) {
+                       BrushRotateTransform(angle, MatrixOrder.Prepend);
+               }
+               protected void BrushRotateTransform (float angle, MatrixOrder order) {
+                       BrushTransform.Rotate(angle, order);
+               }
+               protected void BrushScaleTransform (float sx, float sy) {
+                       BrushScaleTransform(sx, sy, MatrixOrder.Prepend);
+               }
+               protected void BrushScaleTransform (float sx, float sy, MatrixOrder order) {
+                       BrushTransform.Scale(sx, sy, order);
+               }
+               protected void BrushMultiplyTransform (Matrix matrix) {
+                       BrushMultiplyTransform(matrix, MatrixOrder.Prepend);
+               }
+               protected void BrushMultiplyTransform (Matrix matrix, MatrixOrder order) {
+                       if (matrix == null)\r
+                               throw new ArgumentNullException("matrix");\r
+                       BrushTransform.Multiply(matrix, order);                 
+               }
+
+               #endregion
+
+               // TODO: implement transform methods.
 
 //             ~Brush ()
 //             {
index 62666d886abeab326201d4fa424721a8e7929bc4..40006a0445a5d88e3fbc9acbfacb645725442a80 100644 (file)
@@ -1,3 +1,119 @@
+2005-09-20 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * Graphics.jvm.cs: bitmap resolution fix in DrawImage
+
+2005-09-20 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * Graphics.jvm.cs: fixed DrawImage
+
+2005-09-19  Miguel de Icaza  <miguel@novell.com>
+
+       * Graphics.cs: Removed restriction on the images that can be
+       loaded.  Indexed images *can* be loaded
+
+2005-09-18  Miguel de Icaza  <miguel@novell.com>
+
+       * Image.cs: introduce a workaround that catches errors on systems
+       that lack GDI+ as this is being triggered too easily when we
+       enumerate attributes on loaded classes.
+
+       The real bug to fix is #76062.
+
+2005-09-17  Kornél Pál  <kornelpal@hotmail.com>
+
+       * Image.cs: Implemented FromHbitmap.
+
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * gdipFunctions.cs: Add [SuppressUnmanagedCodeSecurity] attributes so 
+       the JIT won't add demands for UnmanagedCode.
+       * carbonFunctions.cs: Add [SuppressUnmanagedCodeSecurity] attributes 
+       so the JIT won't add demands for UnmanagedCode on Mac OSX.
+       * Bitmap.cs: Added LinkDemand for UnmanagedCode on GetHbitmap 
+       (+ overloads) and GetHicon methods.
+       * Graphics.cs: Added LinkDemand for UnmanagedCode on FromHdcInternal, 
+       FromHwndInternal and ReleaseHdcInternal methods (which are all public 
+       despite their names).
+
+2005-09-15 Konstantin Triger <kostat@mainsoft.com>
+
+       * Graphics.jvm.cs: text transform, headless session
+
+2005-09-14 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * Bitmap.jvm.cs: native object refactoring
+       * Image.jvm.cs: native object refactoring
+       * Graphics.jvm.cs: fixed access to image native object
+       * TextureBrush.jvm.cs: fixed access to image native object
+       * Added PlainImage.jvm.cs, PlainImageCollection.jvm.cs
+
+2005-09-14  Geoff Norton  <gnorton@customerdna.com>
+
+       * carbonFunctions.cs: Add GetCGContextForNSView for Cocoa# integration
+       * Graphics.cs: Check GDIPlus.UseCocoaDrawable for Cocoa# integration
+       * gdipFunctions.cs: Set UseCocoaDrawable depending on the environment variable MONO_GDIP_USE_COCOA_BACKEND
+                                                                                         
+2005-09-14 Konstantin Triger <kostat@mainsoft.com>
+
+       * Graphics.jvm.cs: transform, container, thin pen
+
+2005-09-12 Konstantin Triger <kostat@mainsoft.com>
+
+       * AdvancedStroke.jvm.cs: constants for pen fitting calculations
+       * Pen.jvm.cs: fixing transform, pen fitting
+
+2005-09-12 Konstantin Triger <kostat@mainsoft.com>
+
+        * Region.jvm.cs: IsVisible is about intersection 
+
+2005-09-12 Gert Driesen <drieseng@users.sourceforge.net>
+
+       * ImageConverter.cs: Use default TypeDescriptor implementation of 
+       GetProperties.
+
+2005-09-11 Konstantin Triger <kostat@mainsoft.com>
+
+       * Graphics.jvm.cs: fixing clipping with rotate transform
+
+2005-09-11 Konstantin Triger <kostat@mainsoft.com>
+
+       * Region.jvm.cs: default region is infinite
+
+2005-09-10 Konstantin Triger <kostat@mainsoft.com>
+
+       * Graphics.jvm.cs: fixing clipping stuff
+
+2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * Bitmap.jvm.cs: fixed bitamp accessors
+       * Image.jvm.cs: fixed image accessors
+
+2005-09-07 Konstantin Triger <kostat@mainsoft.com>
+       * AdvancedStroke.jvm.cs: fix matrix translate
+       * Graphics.jvm.cs: fix matrix concatenation order
+
+2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+       * Brush.jvm.cs: added transform methods
+
+2005-09-06 Konstantin Triger <kostat@mainsoft.com>
+
+       * StrokeFactory.jvm.cs, AdvancedStroke.jvm.cs, Pen.jvm.cs:
+               implementing fitting, output transform
+       * Graphics.jvm.cs: fixing DrawXXX, Fill, Clipping, Containers
+
+2005-09-06 Konstantin Triger <kostat@mainsoft.com>
+
+       * ColorTranslator.cs: perform case insensitive check
+
+2005-09-05 Jordi Mas i Hernandez <jordi@ximian.com> 
+
+       * gdipFunctions.cs: define new functions
+       * Bitmap.cs: fixes image loading and exceptions
+       * Image.cs: fixes image loading and exceptions
+       
+       Thanks Kornél Pál for its help
+
 2005-08-30 Vladimir Krasnov <vladimirk@mainsoft.com>
 
        * Brush.jvm.cs: added brush transform field
index 157187d63b6a7a55e2b82556f18b331482250dfa..181d1a8d0ef0a747b5a51c9174379c6701b59772 100644 (file)
@@ -44,7 +44,7 @@ namespace System.Drawing
 
                public static Color FromHtml (string HtmlFromColor)
                {
-                       switch (HtmlFromColor) {
+                       switch (HtmlFromColor.ToLower()) {
                        case "buttonface":
                                return SystemColors.Control;
                        case "captiontext":
index ac0d04ec4474fdac541b18811a95dfef5af71fbc..5e777899446d6513d25c2e48ea9aadc91bd22cf7 100644 (file)
@@ -8,7 +8,7 @@
 //
 // Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
 //
-// Copyright (C) 2004 Novell, Inc. (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc. (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Drawing.Text;
 using System.ComponentModel;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
 using System.Text;
 
 namespace System.Drawing
@@ -1217,7 +1218,7 @@ namespace System.Drawing
                {
                        Status status = GDIPlus.GdipFlush (nativeObject, intention);
                         GDIPlus.CheckStatus (status);                    
-                       if (GDIPlus.UseQuartzDrawable)
+                       if (GDIPlus.UseQuartzDrawable || GDIPlus.UseCocoaDrawable)
                                Carbon.CGContextSynchronize (GDIPlus.Display);
                }
 
@@ -1238,6 +1239,7 @@ namespace System.Drawing
                }
 
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public static Graphics FromHdcInternal (IntPtr hdc)
                {
                        GDIPlus.Display = hdc;
@@ -1249,6 +1251,13 @@ namespace System.Drawing
                {
                        IntPtr graphics;
 
+                       if (GDIPlus.UseCocoaDrawable) {
+                               CarbonContext cgContext = Carbon.GetCGContextForNSView (hwnd);
+                               GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
+                               
+                               GDIPlus.Display = cgContext.ctx;
+                               return new Graphics (graphics);
+                       }
                        if (GDIPlus.UseQuartzDrawable) {
                                CarbonContext cgContext = Carbon.GetCGContextForView (hwnd);
                                GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
@@ -1272,6 +1281,7 @@ namespace System.Drawing
                }
                
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public static Graphics FromHwndInternal (IntPtr hwnd)
                {
                        return FromHwnd (hwnd);
@@ -1283,11 +1293,6 @@ namespace System.Drawing
 
                        if (image == null) throw new ArgumentException ();
 
-                       if ((image.PixelFormat & PixelFormat.Indexed) != PixelFormat.Undefined) {\r
-                               // And MS ignores its own rules again\r
-                               throw new Exception ("A Graphics object cannot be created from an image that has an indexed pixel format");\r
-                       }\r
-
                        Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
                        GDIPlus.CheckStatus (status);
                        Graphics result = new Graphics (graphics);
@@ -1588,6 +1593,7 @@ namespace System.Drawing
 
                [MonoTODO]
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public void ReleaseHdcInternal (IntPtr hdc)
                {
                        throw new NotImplementedException ();
index 9c089f12505620da686f5d5ea5cf00f540b65504..9d0fcd3d193ff9a7e389e1ea97afb6dd5ad808d7 100755 (executable)
@@ -12,6 +12,156 @@ using geom = java.awt.geom;
 namespace System.Drawing {\r
        [ComVisible(false)]\r
        public sealed class Graphics : MarshalByRefObject, IDisposable {\r
+               sealed class DummyStroke : awt.Stroke {\r
+                       #region Stroke Members\r
+\r
+                       awt.Shape awt.Stroke.createStrokedShape(awt.Shape arg_0) {\r
+                               throw new NotImplementedException("DummyStroke");\r
+                       }\r
+\r
+                       #endregion\r
+               }\r
+\r
+               sealed class NormalizingPathIterator : geom.PathIterator {\r
+\r
+                       #region fields\r
+\r
+                       readonly geom.PathIterator _iter;\r
+\r
+                       const float norm = 0.5f;\r
+                       const float rnd = (1.0f - norm);
+                       float ax = 0.0f;
+                       float ay = 0.0f;\r
+\r
+                       #endregion\r
+\r
+                       #region ctor\r
+\r
+                       public NormalizingPathIterator(geom.PathIterator iter) {\r
+                               _iter = iter;\r
+                       }\r
+\r
+                       #endregion\r
+\r
+                       #region methods\r
+\r
+                       static int GetIndex(int type) {\r
+                               int index;\r
+                               switch ((GraphicsPath.JPI)type) {
+                                       case GraphicsPath.JPI.SEG_CUBICTO:
+                                               index = 4;
+                                               break;
+                                       case GraphicsPath.JPI.SEG_QUADTO:
+                                               index = 2;
+                                               break;
+                                       case GraphicsPath.JPI.SEG_MOVETO:
+                                       case GraphicsPath.JPI.SEG_LINETO:
+                                               index = 0;
+                                               break;
+                                       case GraphicsPath.JPI.SEG_CLOSE:
+                                       default:
+                                               index = -1;
+                                               break;
+                               }\r
+\r
+                               return index;\r
+                       }\r
+\r
+                       #endregion\r
+\r
+                       #region PathIterator Members\r
+\r
+                       void geom.PathIterator.next() {\r
+                               _iter.next();\r
+                       }\r
+\r
+                       bool geom.PathIterator.isDone() {\r
+                               return _iter.isDone();\r
+                       }\r
+\r
+                       int geom.PathIterator.currentSegment(float[] point) {\r
+                               int type = _iter.currentSegment(point);\r
+\r
+                               int index = GetIndex(type);
+                               
+                               if (index >= 0) {
+                                       float ox = point[index];
+                                       float oy = point[index+1];
+                                       float newax = (float) java.lang.Math.floor(ox + rnd) + norm;
+                                       float neway = (float) java.lang.Math.floor(oy + rnd) + norm;
+                                       point[index] = newax;
+                                       point[index+1] = neway;
+                                       newax -= ox;
+                                       neway -= oy;
+                                       switch ((GraphicsPath.JPI)type) {
+                                               case GraphicsPath.JPI.SEG_CUBICTO:
+                                                       point[0] += ax;
+                                                       point[1] += ay;
+                                                       point[2] += newax;
+                                                       point[3] += neway;
+                                                       break;
+                                               case GraphicsPath.JPI.SEG_QUADTO:
+                                                       point[0] += (newax + ax) / 2;
+                                                       point[1] += (neway + ay) / 2;
+                                                       break;
+                                                       //                                                      case GraphicsPath.JPI.SEG_MOVETO:
+                                                       //                                                      case GraphicsPath.JPI.SEG_LINETO:
+                                                       //                                                      case GraphicsPath.JPI.SEG_CLOSE:
+                                                       //                                                              break;
+                                       }
+                                       ax = newax;
+                                       ay = neway;
+                               }\r
+\r
+                               return type;\r
+                       }\r
+\r
+                       int geom.PathIterator.currentSegment(double[] point) {\r
+                               int type = _iter.currentSegment(point);\r
+\r
+                               int index = GetIndex(type);
+
+                               if (index >= 0) {
+                                       float ox = (float)point[index];
+                                       float oy = (float)point[index+1];
+                                       float newax = (float)java.lang.Math.floor(ox + rnd) + norm;
+                                       float neway = (float)java.lang.Math.floor(oy + rnd) + norm;
+                                       point[index] = newax;
+                                       point[index+1] = neway;
+                                       newax -= ox;
+                                       neway -= oy;
+                                       switch ((GraphicsPath.JPI)type) {
+                                               case GraphicsPath.JPI.SEG_CUBICTO:
+                                                       point[0] += ax;
+                                                       point[1] += ay;
+                                                       point[2] += newax;
+                                                       point[3] += neway;
+                                                       break;
+                                               case GraphicsPath.JPI.SEG_QUADTO:
+                                                       point[0] += (newax + ax) / 2;
+                                                       point[1] += (neway + ay) / 2;
+                                                       break;
+                                                       //                                                      case GraphicsPath.JPI.SEG_MOVETO:
+                                                       //                                                      case GraphicsPath.JPI.SEG_LINETO:
+                                                       //                                                      case GraphicsPath.JPI.SEG_CLOSE:
+                                                       //                                                              break;
+                                       }
+                                       ax = newax;
+                                       ay = neway;
+                               }\r
+\r
+                               return type;\r
+                       }\r
+\r
+                       int geom.PathIterator.getWindingRule() {\r
+                               return _iter.getWindingRule();\r
+                       }\r
+\r
+                       #endregion\r
+\r
+               }\r
+\r
+\r
                #region Variables\r
 \r
                readonly awt.Graphics2D _nativeObject;\r
@@ -19,11 +169,14 @@ namespace System.Drawing {
                int _textContrast = 4;\r
                readonly Image _image;\r
                \r
-               Matrix _transform;\r
+               readonly Matrix _transform;\r
                GraphicsUnit _pageUnit = GraphicsUnit.Display;\r
                float _pageScale = 1.0f;\r
 \r
-               Stack _stateContainerStack = new Stack(3);\r
+               readonly Region _clip;\r
+               readonly awt.Rectangle _windowRect;\r
+\r
+               GraphicsState _nextGraphicsState = null;\r
 \r
                static readonly float [] _unitConversion = {\r
                                                                                                           1,                                                           // World\r
@@ -35,7 +188,26 @@ namespace System.Drawing {
                                                                                                           DefaultScreenResolution / 25.4f      // Millimeter\r
                                                                                                   };\r
 \r
-               static internal readonly bool IsHeadless;\r
+               static int _isHeadless;\r
+               static internal bool IsHeadless {\r
+                       get {\r
+                               if (_isHeadless == 0) {\r
+                                       bool isHeadless = awt.GraphicsEnvironment.isHeadless();\r
+                                       if (!isHeadless) {\r
+                                               try {\r
+                                                       awt.Toolkit.getDefaultToolkit();\r
+                                               }\r
+                                               catch{\r
+                                                       isHeadless = true;\r
+                                               }\r
+                                       }\r
+\r
+                                       _isHeadless = isHeadless ? 2 : 1;\r
+                               }\r
+\r
+                               return _isHeadless > 1;\r
+                       }\r
+               }\r
        \r
                #endregion\r
 \r
@@ -52,33 +224,23 @@ namespace System.Drawing {
 \r
                #region Constr. and Destr.\r
                private Graphics (Image image) {\r
-                       _nativeObject = (awt.Graphics2D)image.NativeObject.getGraphics();\r
+                       _nativeObject = (awt.Graphics2D)image.NativeObject.CurrentImage.NativeImage.getGraphics();\r
                        _image = image;\r
                        _transform = new Matrix ();\r
-                       _nativeObject.setTransform( _transform.NativeObject );\r
 \r
+                       NativeObject.setStroke(new DummyStroke());\r
                        NativeObject.setRenderingHint(awt.RenderingHints.KEY_COLOR_RENDERING, awt.RenderingHints.VALUE_COLOR_RENDER_QUALITY);\r
-                       InterpolationMode = InterpolationMode.Bilinear;\r
+
+                       InterpolationMode = InterpolationMode.Bilinear;
+
+                       _windowRect = new awt.Rectangle(_image.Width, _image.Height);
+                       _clip = new Region();
                }\r
 \r
                #endregion\r
                \r
                #region Internal Accessors\r
 \r
-               static Graphics() {\r
-                       bool isHeadless = awt.GraphicsEnvironment.isHeadless();\r
-                       if (!isHeadless) {\r
-                               try {\r
-                                       awt.Toolkit.getDefaultToolkit();\r
-                               }\r
-                               catch{\r
-                                       isHeadless = true;\r
-                               }\r
-                       }\r
-\r
-                       IsHeadless = isHeadless;\r
-               }\r
-\r
                static internal int DefaultScreenResolution {\r
                        get {\r
                                return IsHeadless ? 96 :\r
@@ -133,17 +295,70 @@ namespace System.Drawing {
                        if (pen == null)\r
                                throw new ArgumentNullException("pen");\r
 \r
-                       if (pen.RequiresWidening && StrokeFactory.CanCreateAdvancedStroke) {\r
-                               FillShape(pen.Brush, ((awt.Stroke)pen).createStrokedShape(shape));\r
+                       if (StrokeFactory.CanCreateAdvancedStroke) {\r
+                               geom.AffineTransform oldT = NativeObject.getTransform();\r
+                               NativeObject.setTransform(Matrix.IdentityTransform.NativeObject);\r
+\r
+                               try {\r
+                                       geom.Area clip = _clip.NativeObject;\r
+                                       geom.AffineTransform t = GetFinalTransform();\r
+                                       if (!oldT.isIdentity()) {\r
+                                               clip = (geom.Area)clip.clone();\r
+                                               clip.transform(oldT);\r
+\r
+                                               t = (geom.AffineTransform)t.clone();\r
+                                               t.preConcatenate(oldT);\r
+                                       }\r
+                                       \r
+                                       double widthsquared = pen.GetSquaredTransformedWidth(t);\r
+\r
+                                       bool antiAlias = (SmoothingMode == SmoothingMode.AntiAlias);\r
+\r
+                                       bool thin = (widthsquared <= (antiAlias ? 
+                                               AdvancedStroke.MinPenSizeAASquared :
+                                               AdvancedStroke.MinPenSizeSquared));\r
+\r
+                                       if (NeedsNormalization) {\r
+\r
+                                               bool normThin = \r
+                                                       widthsquared <= AdvancedStroke.MinPenSizeSquaredNorm;\r
+\r
+                                               if (normThin) {\r
+                                                       shape = GetNormalizedShape(shape, t);\r
+                                                       shape = pen.GetNativeObject(\r
+                                                               t, null, thin).createStrokedShape(shape);\r
+                                               }\r
+                                               else {\r
+                                                       shape = pen.GetNativeObject(t, thin).createStrokedShape(shape);\r
+                                                       shape = GetNormalizedShape(shape, null);\r
+                                               }\r
+                                       }\r
+                                       else {\r
+                                               shape = pen.GetNativeObject(t, thin).createStrokedShape(shape);\r
+                                       }\r
+\r
+                                       FillScaledShape(pen.Brush, shape, clip);\r
+                               }\r
+                               finally {\r
+                                       NativeObject.setTransform(oldT);\r
+                               }\r
                        }\r
                        else {\r
                                awt.Stroke oldStroke = NativeObject.getStroke();\r
-                               NativeObject.setStroke(pen.NativeObject);\r
+                               NativeObject.setStroke(pen.GetNativeObject(null, false));\r
                                try {\r
                                        awt.Paint oldPaint = NativeObject.getPaint();\r
+                                       NativeObject.setPaint(pen.Brush);\r
                                        try {\r
-                                               NativeObject.setPaint(pen.Brush);\r
-                                               NativeObject.draw(shape);\r
+                                               geom.AffineTransform oldT = NativeObject.getTransform();\r
+                                               NativeObject.transform(GetFinalTransform());\r
+                                               try {\r
+                                                       shape = IntersectUserClip(shape);\r
+                                                       NativeObject.draw(shape);\r
+                                               }\r
+                                               finally {\r
+                                                       NativeObject.setTransform(oldT);\r
+                                               }\r
                                        }\r
                                        finally {\r
                                                NativeObject.setPaint(oldPaint);\r
@@ -154,18 +369,66 @@ namespace System.Drawing {
                                }\r
                        }\r
                }\r
-\r
                void FillShape(awt.Paint paint, awt.Shape shape) {\r
                        if (paint == null)\r
                                throw new ArgumentNullException("brush");\r
 \r
-                       awt.Paint old = NativeObject.getPaint();\r
+                       geom.AffineTransform oldT = null;\r
+                       geom.Area clip = _clip.NativeObject;\r
+                       if (NeedsNormalization) {\r
+                               oldT = NativeObject.getTransform();\r
+                               geom.AffineTransform t = GetFinalTransform();\r
+                               if (!oldT.isIdentity()) {\r
+                                       t = (geom.AffineTransform)t.clone();\r
+                                       t.preConcatenate(oldT);\r
+                                       clip = (geom.Area)clip.clone();\r
+                                       clip.transform(oldT);\r
+                               }\r
+                               shape = GetNormalizedShape(shape, t);\r
+                       }\r
+                       else {\r
+                               geom.AffineTransform t = GetFinalTransform();\r
+                               if (!t.isIdentity())\r
+                                       shape = t.createTransformedShape(shape);\r
+                       }\r
+\r
+                       if (oldT != null)\r
+                               NativeObject.setTransform(Matrix.IdentityTransform.NativeObject);\r
+\r
+                       try {\r
+                               FillScaledShape(paint, shape, clip);\r
+                       }\r
+                       finally {\r
+                               if (oldT != null)\r
+                                       NativeObject.setTransform(oldT);\r
+                       }\r
+               }\r
+\r
+               bool NeedsNormalization {\r
+                       get {\r
+                               return PixelOffsetMode != PixelOffsetMode.Half &&\r
+                                       PixelOffsetMode != PixelOffsetMode.HighQuality;\r
+                       }\r
+               }\r
+\r
+               static awt.Shape GetNormalizedShape(awt.Shape shape, geom.AffineTransform t) {\r
+                       geom.PathIterator iter = new NormalizingPathIterator(shape.getPathIterator(t));\r
+       \r
+                       geom.GeneralPath path = new geom.GeneralPath(iter.getWindingRule());\r
+                       path.append(iter, false);\r
+                       return path;\r
+               }\r
+\r
+               void FillScaledShape(awt.Paint paint, awt.Shape shape, geom.Area clip) {\r
+                       geom.Rectangle2D r = shape.getBounds2D();\r
+                       awt.Paint oldP = NativeObject.getPaint();\r
                        NativeObject.setPaint(paint);\r
                        try {\r
+                               shape = IntersectUserClip(shape, clip);\r
                                NativeObject.fill(shape);\r
                        }\r
                        finally {\r
-                               NativeObject.setPaint(old);\r
+                               NativeObject.setPaint(oldP);\r
                        }\r
                }\r
 \r
@@ -259,6 +522,7 @@ namespace System.Drawing {
                                        return retVal;\r
 \r
                                InternalSetBrush(brush);\r
+                               g.setRenderingHint(awt.RenderingHints.KEY_TEXT_ANTIALIASING, awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON);\r
 \r
                                //end measurment\r
 \r
@@ -304,17 +568,43 @@ namespace System.Drawing {
 \r
                                                        at1.rotate(Math.PI/2);\r
                                                        awt.Shape sha = textlayout.getOutline(at1);\r
+                                                       geom.AffineTransform t = GetFinalTransform();\r
+                                                       if (!t.isIdentity())\r
+                                                               sha = t.createTransformedShape(sha);\r
                                                        //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\r
+                                                       sha = IntersectUserClip(sha);\r
                                                        g.fill(sha);\r
                                                        continue;\r
                                                }\r
                                                if((format.FormatFlags & StringFormatFlags.DirectionRightToLeft)  != 0) {\r
                                                        drawPosX = ((drawPosX + formatWidth) - advance) + (float)9;\r
-                                                       layout.draw(g, drawPosX, drawPosY);\r
+                                                       IntersectScaledClipWithBase(_clip);\r
+                                                       try {\r
+                                                               layout.draw(g, drawPosX, drawPosY);\r
+                                                       }\r
+                                                       finally {\r
+                                                               RestoreBaseClip();\r
+                                                       }\r
                                                } \r
                                        }                                       \r
+\r
+                                       geom.AffineTransform oldT = null;\r
+                                       geom.AffineTransform ft = GetFinalTransform();\r
+\r
                                        //Draw current line\r
-                                       layout.draw(g, drawPosX, drawPosY);                                     \r
+                                       IntersectScaledClipWithBase(_clip);\r
+                                       try {\r
+                                               if (!ft.isIdentity()) {\r
+                                                       oldT = NativeObject.getTransform();\r
+                                                       NativeObject.transform(ft);\r
+                                               }\r
+                                               layout.draw(g, drawPosX, drawPosY);                                     \r
+                                       }\r
+                                       finally {\r
+                                               if (oldT != null)\r
+                                                       NativeObject.setTransform(oldT);\r
+                                               RestoreBaseClip();\r
+                                       }\r
                                }\r
                        } //not nulls\r
 \r
@@ -330,14 +620,7 @@ namespace System.Drawing {
                \r
                #region Clear\r
                public void Clear (Color color) {\r
-                       geom.AffineTransform old = NativeObject.getTransform();\r
-                       NativeObject.setTransform(new geom.AffineTransform());\r
-                       try {\r
-                               FillShape(color.NativeObject, new awt.Rectangle(0,0,_image.Width,_image.Height));\r
-                       }\r
-                       finally {\r
-                               NativeObject.setTransform(old);\r
-                       }\r
+                       FillScaledShape(color.NativeObject, _clip.NativeObject, null);\r
                }\r
                #endregion\r
 \r
@@ -504,14 +787,12 @@ namespace System.Drawing {
 \r
                #region DrawImage\r
 \r
-               public void DrawImage (Image image, Point point) \r
-               {\r
-                       DrawImage(image, (int)point.X, (int)point.Y);\r
+               public void DrawImage (Image image, Point point) {\r
+                       DrawImage(image, point.X, point.Y);\r
                }\r
 \r
-               public void DrawImage (Image image, PointF point) \r
-               {\r
-                       DrawImage(image, (int)point.X, (int)point.Y);\r
+               public void DrawImage (Image image, PointF point) {\r
+                       DrawImage(image, point.X, point.Y);\r
                }\r
 \r
                \r
@@ -520,81 +801,54 @@ namespace System.Drawing {
                        DrawImage(image, m);\r
                }\r
 \r
-               public void DrawImage (Image image, PointF [] destPoints) \r
-               {\r
+               public void DrawImage (Image image, PointF [] destPoints) {\r
                        Matrix m = new Matrix(new RectangleF(0, 0, image.Width, image.Height), destPoints);\r
                        DrawImage(image, m);\r
                }\r
 \r
                \r
-               public void DrawImage (Image image, Rectangle rect) \r
-               {\r
+               public void DrawImage (Image image, Rectangle rect) {\r
                        DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);\r
                }\r
 \r
-               public void DrawImage (Image image, RectangleF rect) \r
-               {\r
-                       DrawImage(image, (int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);\r
+               public void DrawImage (Image image, RectangleF rect) {\r
+                       DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);\r
                }\r
 \r
                \r
-               public void DrawImage (Image image, int x, int y) \r
-               {\r
-                       float current_scale = PageScale;\r
-                       if (current_scale != 1)\r
-                               PageScale = 1;\r
-\r
-                       try\r
-                       {\r
-                               NativeObject.drawImage(image.NativeObject, x, y, null);\r
-                       }\r
-                       finally\r
-                       {\r
-                               if (current_scale != 1)\r
-                                       PageScale = current_scale;\r
-                       }\r
+               public void DrawImage (Image image, int x, int y) {\r
+                       DrawImage(image, (float)x, (float)y);\r
                }\r
 \r
-               public void DrawImage (Image image, float x, float y) \r
-               {\r
-                       DrawImage(image, (int)x, (int)y);\r
+               public void DrawImage (Image image, float x, float y) {\r
+                       if ((image.HorizontalResolution != DpiX) || (image.VerticalResolution != DpiY))\r
+                               DrawImage( image, x, y, \r
+                                       (float)image.Width * (DpiX / image.HorizontalResolution), \r
+                                       (float)image.Height * (DpiY / image.VerticalResolution));\r
+                       else\r
+                               DrawImage( image, x, y, (float)image.Width, (float)image.Height );\r
                }\r
 \r
                \r
                public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit) {\r
-                       if (srcUnit != GraphicsUnit.Pixel)\r
-                               throw new NotImplementedException();\r
-                               // Like in .NET http://dotnet247.com/247reference/msgs/45/227979.aspx\r
-\r
-                       float current_scale = PageScale;\r
-                       if (current_scale != 1)\r
-                               PageScale = 1;\r
-\r
-                       try\r
-                       {\r
-                               NativeObject.drawImage(image.NativeObject,\r
-                                       destRect.X,\r
-                                       destRect.Y,\r
-                                       destRect.X + destRect.Width,\r
-                                       destRect.Y + destRect.Height,\r
-                                       srcRect.X,\r
-                                       srcRect.Y,\r
-                                       srcRect.X + srcRect.Width,\r
-                                       srcRect.Y + srcRect.Height,\r
-                                       null);\r
-                       }\r
-                       finally\r
-                       {\r
-                               if (current_scale != 1)\r
-                                       PageScale = current_scale;\r
-                       }\r
+                       DrawImage(\r
+                               image,\r
+                               new Point [] {\r
+                                                                new Point( destRect.X, destRect.Y),\r
+                                                                new Point( destRect.X + destRect.Width, destRect.Y),\r
+                                                                new Point( destRect.X, destRect.Y + destRect.Height)},\r
+                               srcRect, \r
+                               srcUnit);\r
                }\r
-               \r
+       \r
                public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit) {\r
                        DrawImage(\r
-                               image, \r
-                               new Rectangle((int)destRect.X, (int)destRect.Y, (int)destRect.Width, (int)destRect.Height),\r
-                               new Rectangle((int)srcRect.X, (int)srcRect.Y, (int)srcRect.Width, (int)srcRect.Height),\r
+                               image,\r
+                               new PointF [] {\r
+                                                                new PointF( destRect.X, destRect.Y),\r
+                                                                new PointF( destRect.X + destRect.Width, destRect.Y),\r
+                                                                new PointF( destRect.X, destRect.Y + destRect.Height)},\r
+                               srcRect, \r
                                srcUnit);\r
                }\r
 \r
@@ -612,67 +866,54 @@ namespace System.Drawing {
                        //TBD: ImageAttributes\r
                        if (srcUnit != GraphicsUnit.Pixel)\r
                                throw new NotImplementedException();\r
-                               // Like in .NET http://dotnet247.com/247reference/msgs/45/227979.aspx\r
+                       // Like in .NET http://dotnet247.com/247reference/msgs/45/227979.aspx\r
 \r
                        Matrix mx = new Matrix(srcRect, destPoints);\r
 \r
                        Region region = new Region(srcRect);\r
                        region.Transform (mx);\r
                        \r
-                       geom.Area current_clip = (geom.Area)GetNativeClip().clone();\r
-                       IntersectClip(region);\r
-                       try\r
-                       {\r
-                               DrawImage(image, mx);\r
-                       }\r
-                       finally\r
-                       {\r
-                               SetNativeClip(current_clip);\r
-                       }\r
+                       geom.AffineTransform t = _transform.NativeObject;\r
+                       if (!t.isIdentity())\r
+                               region.NativeObject.transform(t);\r
+                       region.Intersect(_clip);\r
+\r
+                       DrawImage(image, mx, region);\r
                }\r
                \r
                public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr) {\r
                        //TBD: ImageAttributes\r
                        if (srcUnit != GraphicsUnit.Pixel)\r
                                throw new NotImplementedException();\r
-                               // Like in .NET http://dotnet247.com/247reference/msgs/45/227979.aspx\r
+                       // Like in .NET http://dotnet247.com/247reference/msgs/45/227979.aspx\r
 \r
                        Matrix mx = new Matrix(srcRect, destPoints);\r
 \r
                        Region region = new Region(srcRect);\r
                        region.Transform (mx);\r
                        \r
-                       geom.Area current_clip = (geom.Area)GetNativeClip().clone();\r
-                       IntersectClip(region);\r
-                       try\r
-                       {\r
-                               DrawImage(image, mx);\r
-                       }\r
-                       finally\r
-                       {\r
-                               SetNativeClip(current_clip);\r
-                       }\r
+                       geom.AffineTransform t = GetFinalTransform();\r
+                       if (!t.isIdentity())\r
+                               region.NativeObject.transform(t);\r
+                       region.Intersect(_clip);\r
+\r
+                       DrawImage(image, mx, region);\r
                }\r
 \r
 \r
                public void DrawImage (Image image, int x, int y, int width, int height) {\r
-                       float current_scale = PageScale;\r
-                       if (current_scale != 1)\r
-                               PageScale = 1;\r
-\r
-                       try\r
-                       {\r
-                               NativeObject.drawImage(image.NativeObject, x, y, width, height, null);\r
-                       }\r
-                       finally\r
-                       {\r
-                               if (current_scale != 1)\r
-                                       PageScale = current_scale;\r
-                       }\r
+                       DrawImage(image, (float)x, (float)y, (float)width, (float)height);\r
                }\r
 \r
                public void DrawImage (Image image, float x, float y, float width, float height) {\r
-                       DrawImage(image, (int)x, (int)y, (int)width, (int)height);\r
+                       geom.Point2D.Float pt = new geom.Point2D.Float(x, y);\r
+                       GetFinalTransform().transform(pt, pt);\r
+\r
+                       Matrix mx = new Matrix();\r
+                       mx.Translate((float)pt.getX(), (float)pt.getY());\r
+                       mx.Scale(width / (float)image.Width, height / (float)image.Height);\r
+\r
+                       DrawImage( image, mx );\r
                }\r
 \r
                \r
@@ -708,25 +949,77 @@ namespace System.Drawing {
                        DrawImage(\r
                                image, \r
                                destRect,\r
-                               new Rectangle((int)srcX, (int)srcY, (int)srcWidth, (int)srcHeight),\r
+                               new RectangleF(srcX, srcY, srcWidth, srcHeight),\r
                                srcUnit);\r
                }\r
                \r
 \r
                internal void DrawImage (Image image, Matrix m) {\r
-                       float current_scale = PageScale;\r
-                       if (current_scale != 1)\r
-                               PageScale = 1;\r
+                       DrawImage(image, m, null);\r
+               }\r
 \r
-                       try\r
-                       {\r
-                               NativeObject.drawImage(image.NativeObject, m.NativeObject, null);\r
+               internal void DrawImage (Image image, Matrix m, Region clip) {\r
+                       if (clip == null) {\r
+                               clip = new Region( new RectangleF( 0, 0, image.Width, image.Height ) );\r
+                               clip.Transform( m );\r
                        }\r
-                       finally\r
-                       {\r
-                               if (current_scale != 1)\r
-                                       PageScale = current_scale;\r
+                       clip.Intersect(_clip);\r
+                       \r
+                       geom.AffineTransform oldT = NativeObject.getTransform();\r
+                       // must set clip before the base transform is altered\r
+                       if (NeedsNormalization) {\r
+                               Matrix normMatrix = ComputeClipNormalization(clip.GetBounds(this));\r
+                               clip.Transform(normMatrix);\r
                        }\r
+\r
+                       IntersectScaledClipWithBase(clip);\r
+                       \r
+                       try {\r
+                               NativeObject.transform(_transform.NativeObject);\r
+                               \r
+                               Matrix mm = ComputeImageNormalization(image, m);\r
+                               NativeObject.drawImage(image.NativeObject.CurrentImage.NativeImage, mm.NativeObject, null);\r
+                       }\r
+                       finally {\r
+                               NativeObject.setTransform(oldT);\r
+                               RestoreBaseClip();\r
+                       }\r
+               }\r
+\r
+               private static Matrix ComputeImageNormalization(Image img, Matrix m) {\r
+                       if ( m.IsIdentity )\r
+                               return m;\r
+\r
+                       //m.Translate( -(m.Elements[0] + m.Elements[2]) / 2.0f,  -(m.Elements[3] + m.Elements[1]) / 2.0f, MatrixOrder.Append);\r
+                       m.Translate( \r
+                               -(float)(m.NativeObject.getScaleX() + m.NativeObject.getShearX()) / 2.0f,  \r
+                               -(float)(m.NativeObject.getScaleY() + m.NativeObject.getShearY()) / 2.0f, MatrixOrder.Append);\r
+                       \r
+                       PointF [] p = new PointF[] { \r
+                                                                                  new PointF( 0, 0 ),\r
+                                                                                  new PointF( img.Width, 0 ),\r
+                                                                                  new PointF( 0, img.Height )};\r
+\r
+                       m.TransformPoints(p);\r
+                       for (int i=0; i < p.Length; i++) {\r
+                               p[i].X = (float)( p[i].X + 0.5f );\r
+                               p[i].Y = (float)( p[i].Y + 0.5f );\r
+                       }\r
+\r
+                       return new Matrix( new Rectangle(0, 0, img.Width, img.Height), p );\r
+               }\r
+               private static Matrix ComputeClipNormalization(RectangleF rect) {\r
+                       PointF [] p = new PointF[] { \r
+                                                                                  new PointF( rect.X, rect.Y ),\r
+                                                                                  new PointF( rect.X + rect.Width, rect.Y ),\r
+                                                                                  new PointF( rect.X, rect.Y + rect.Height )};\r
+\r
+                       for (int i=0; i < p.Length; i++) {\r
+                               p[i].X = (float)Math.Round( p[i].X + 0.5f ) + 0.5f;\r
+                               p[i].Y = (float)Math.Round( p[i].Y + 0.5f ) + 0.5f;\r
+                       }\r
+\r
+                       return new Matrix( rect, p );\r
                }\r
                \r
 \r
@@ -977,78 +1270,86 @@ namespace System.Drawing {
                }\r
                #endregion\r
 \r
-               #region Container [TODO]\r
-               public void EndContainer (GraphicsContainer container) {\r
-                       if (_stateContainerStack.Contains(container.StateObject))\r
-                       {\r
-                               GraphicsState gs = (GraphicsState)_stateContainerStack.Pop();\r
-                               while ( !gs.Equals(container.StateObject) )\r
-                                       gs = (GraphicsState)_stateContainerStack.Pop();\r
+               #region Container\r
+\r
+               void PushGraphicsState(GraphicsState state) {\r
+                       state.Next = _nextGraphicsState;\r
+                       _nextGraphicsState = state;\r
+               }\r
+\r
+               GraphicsState PopGraphicsState() {\r
+                       GraphicsState state = _nextGraphicsState;\r
+                       _nextGraphicsState = _nextGraphicsState.Next;\r
+                       return state;\r
+               }\r
 \r
-                               gs.RestoreState(this);\r
-                               UpdateInternalTransform();\r
+               bool ContainsGraphicsState(GraphicsState state) {\r
+                       GraphicsState gs = _nextGraphicsState;\r
+\r
+                       while(gs != null) {\r
+                               if (gs == state)\r
+                                       return true;\r
+\r
+                               gs = gs.Next;\r
                        }\r
+\r
+                       return false;\r
                }\r
 \r
-               public GraphicsContainer BeginContainer () {\r
-                       GraphicsState graphicsState = new GraphicsState(this, true);\r
-                       GraphicsContainer container = new GraphicsContainer(graphicsState);\r
+               public void EndContainer (GraphicsContainer container) {\r
+                       Restore(container.StateObject);\r
+               }\r
 \r
-                       _stateContainerStack.Push( graphicsState );\r
-                       return container;\r
+               public GraphicsContainer BeginContainer () {\r
+                       return new GraphicsContainer(Save(Matrix.IdentityTransform, true));\r
                }\r
                \r
                public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit) {\r
-                       GraphicsState graphicsState = new GraphicsState(this, true);\r
-                       GraphicsContainer container = new GraphicsContainer(graphicsState);\r
-\r
                        Matrix containerTransfrom =\r
                                new Matrix(     srcrect,\r
                                new Point [] {   new Point (dstrect.X, dstrect.Y), \r
                                                                 new Point (dstrect.X + dstrect.Width, dstrect.Y), \r
                                                                 new Point (dstrect.X, dstrect.Y + dstrect.Height) });\r
 \r
-                       if (_stateContainerStack.Count != 0) \r
-                       {\r
-                               GraphicsState gs = (GraphicsState)_stateContainerStack.Peek();\r
-                               if (gs.ContainerTransfrom != null)\r
-                                       Matrix.Multiply(\r
-                                               containerTransfrom.NativeObject, \r
-                                               gs.ContainerTransfrom.NativeObject, MatrixOrder.Append);\r
-                       }\r
+                       float scale = 1/_unitConversion[ (int)unit ];\r
+                       containerTransfrom.Scale(scale, scale);\r
 \r
-                       graphicsState.ContainerTransfrom = containerTransfrom;\r
-                       \r
-                       _stateContainerStack.Push( graphicsState );\r
-                       UpdateInternalTransform();\r
-                       return container;\r
+                       return new GraphicsContainer(Save(containerTransfrom, true));\r
                }\r
 \r
                \r
                public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit) {\r
-                       GraphicsState graphicsState = new GraphicsState(this, true);\r
-                       GraphicsContainer container = new GraphicsContainer(graphicsState);\r
-\r
                        Matrix containerTransfrom =\r
                                new Matrix(     srcrect,\r
                                new PointF [] {  new PointF (dstrect.X, dstrect.Y), \r
                                                                 new PointF (dstrect.X + dstrect.Width, dstrect.Y), \r
                                                                 new PointF (dstrect.X, dstrect.Y + dstrect.Height) });\r
 \r
-                       if (_stateContainerStack.Count != 0) \r
-                       {\r
-                               GraphicsState gs = (GraphicsState)_stateContainerStack.Peek();\r
-                               if (gs.ContainerTransfrom != null)\r
-                                       Matrix.Multiply(\r
-                                               containerTransfrom.NativeObject, \r
-                                               gs.ContainerTransfrom.NativeObject, MatrixOrder.Append);\r
-                       }\r
+                       float scale = 1/_unitConversion[ (int)unit ];\r
+                       containerTransfrom.Scale(scale, scale);\r
 \r
-                       graphicsState.ContainerTransfrom = containerTransfrom;\r
-                       \r
-                       _stateContainerStack.Push( graphicsState );\r
-                       UpdateInternalTransform();\r
-                       return container;\r
+                       return new GraphicsContainer(Save(containerTransfrom, true));\r
+               }\r
+\r
+               GraphicsState Save(Matrix matrix, bool resetState) {\r
+                       GraphicsState graphicsState = new GraphicsState(this, matrix, resetState);\r
+\r
+                       PushGraphicsState( graphicsState );\r
+                       return graphicsState;\r
+               }\r
+\r
+               public GraphicsState Save () {\r
+                       return Save(Matrix.IdentityTransform, false);\r
+               }\r
+\r
+               public void Restore (GraphicsState graphicsState) {\r
+                       if (ContainsGraphicsState(graphicsState)) {\r
+                               GraphicsState gs = PopGraphicsState();\r
+                               while ( gs != graphicsState )\r
+                                       gs = PopGraphicsState();\r
+\r
+                               graphicsState.RestoreState(this);\r
+                       }\r
                }\r
 \r
                #endregion\r
@@ -1242,16 +1543,25 @@ namespace System.Drawing {
                #endregion      \r
 \r
                #region ExcludeClip\r
+               void ExcludeClip(geom.Area area) {\r
+\r
+                       geom.AffineTransform t = GetFinalTransform();\r
+                       if (!t.isIdentity()) {\r
+                               area = (geom.Area)area.clone();\r
+                               area.transform(t);\r
+                       }\r
+\r
+                       _clip.NativeObject.subtract(area);\r
+               }\r
+\r
                public void ExcludeClip (Rectangle rect) {\r
-                       geom.Area clip = GetNativeClip();\r
-                       clip.subtract(new geom.Area(rect.NativeObject));\r
-                       SetNativeClip(clip);\r
+                       ExcludeClip(new geom.Area(rect.NativeObject));\r
                }\r
 \r
                public void ExcludeClip (Region region) {\r
-                       geom.Area clip = GetNativeClip();\r
-                       clip.subtract(region.NativeObject);\r
-                       SetNativeClip(clip);\r
+                       if (region == null)\r
+                               throw new ArgumentNullException("region");\r
+                       ExcludeClip(region.NativeObject);\r
                }\r
                #endregion \r
 \r
@@ -1307,6 +1617,9 @@ namespace System.Drawing {
 \r
                #region FillPath\r
                public void FillPath (Brush brush, GraphicsPath path) {\r
+                       if (path == null)\r
+                               throw new ArgumentNullException("path");\r
+\r
                        FillShape(brush,path);\r
                }\r
                #endregion\r
@@ -1393,7 +1706,7 @@ namespace System.Drawing {
                \r
                public void Flush (FlushIntention intention) {\r
                        if (_image != null)\r
-                               _image.NativeObject.flush();\r
+                               _image.NativeObject.CurrentImage.NativeImage.flush();\r
                }\r
 \r
 #if INTPTR_SUPPORTED\r
@@ -1464,9 +1777,14 @@ namespace System.Drawing {
 \r
                #region IntersectClip\r
                void IntersectClip (geom.Area area) {\r
-                       geom.Area clip = GetNativeClip();\r
-                       clip.intersect(area);\r
-                       SetNativeClip(clip);\r
+                       \r
+                       geom.AffineTransform t = GetFinalTransform();\r
+                       if (!t.isIdentity()) {\r
+                               area = (geom.Area)area.clone();\r
+                               area.transform(t);\r
+                       }\r
+\r
+                       _clip.NativeObject.intersect(area);\r
                }\r
 \r
                public void IntersectClip (Region region) {\r
@@ -1504,12 +1822,24 @@ namespace System.Drawing {
                }\r
                \r
                public bool IsVisible (float x, float y) {\r
-                       java.awt.Graphics2D g = NativeObject;\r
-                       java.awt.Shape s = g.getClip();\r
-                       if (s == null)\r
+                       double dx = x;\r
+                       double dy = y;\r
+                       geom.AffineTransform t = GetFinalTransform();\r
+                       if (!t.isIdentity()) {\r
+                               double[] p = new double[] {dx, dy};\r
+                               t.transform(p, 0, p, 0, 1);\r
+\r
+                               dx = p[0];\r
+                               dy = p[1];\r
+                       }\r
+                       if (!_clip.NativeObject.contains(dx, dy))\r
+                               return false;\r
+\r
+                       awt.Shape clip = NativeObject.getClip();\r
+                       if (clip == null)\r
                                return true;\r
-                       else                            \r
-                               return s.contains(x,y);\r
+\r
+                       return clip.contains(dx, dy);\r
                }\r
                \r
                public bool IsVisible (int x, int y) {\r
@@ -1517,12 +1847,17 @@ namespace System.Drawing {
                }\r
                \r
                public bool IsVisible (float x, float y, float width, float height) {\r
-                       java.awt.Graphics2D g = NativeObject;\r
-                       java.awt.Shape s = g.getClip();\r
-                       if (s == null)\r
-                               return true;\r
-                       else                            \r
-                               return s.contains(x,y,width,height);\r
+\r
+                       geom.AffineTransform t = GetFinalTransform();\r
+                       geom.Rectangle2D r = new geom.Rectangle2D.Float(x, y, width, height);\r
+                       \r
+                       if (!t.isIdentity())\r
+                               r = t.createTransformedShape(r).getBounds2D();\r
+               \r
+                       return NativeObject.hitClip(\r
+                                       (int)(r.getX()+0.5), (int)(r.getY()+0.5),\r
+                                       (int)(r.getWidth()+0.5), (int)(r.getHeight()+0.5))\r
+                               && _clip.NativeObject.intersects(r);\r
                }\r
 \r
                \r
@@ -1587,42 +1922,14 @@ namespace System.Drawing {
 \r
                #region Reset (Clip and Transform)\r
                public void ResetClip () {\r
-                       java.awt.Graphics2D g = NativeObject;\r
-                       g.setClip(null);\r
-\r
+                       _clip.MakeInfinite();\r
                }\r
 \r
                public void ResetTransform () {\r
-                       _transform = new Matrix(1,0,0,1,0,0);\r
-                       UpdateInternalTransform();\r
+                       _transform.Reset();\r
                }\r
                #endregion\r
 \r
-               public GraphicsState Save () {\r
-                       GraphicsState graphicsState = new GraphicsState(this, false);\r
-\r
-                       if (_stateContainerStack.Count != 0) \r
-                       {\r
-                               GraphicsState gs = (GraphicsState)_stateContainerStack.Peek();\r
-                               if (gs.ContainerTransfrom != null)\r
-                                       graphicsState.ContainerTransfrom = gs.ContainerTransfrom;\r
-                       }\r
-                       _stateContainerStack.Push( graphicsState );\r
-                       return graphicsState;\r
-               }\r
-\r
-               public void Restore (GraphicsState graphicsState) {\r
-                       if (_stateContainerStack.Contains(graphicsState))\r
-                       {\r
-                               GraphicsState gs = (GraphicsState)_stateContainerStack.Pop();\r
-                               while ( !gs.Equals(graphicsState) )\r
-                                       gs = (GraphicsState)_stateContainerStack.Pop();\r
-\r
-                               graphicsState.RestoreState(this);\r
-                               UpdateInternalTransform();\r
-                       }\r
-               }\r
-\r
                #region RotateTransform\r
                public void RotateTransform (float angle) {\r
                        RotateTransform (angle, MatrixOrder.Prepend);\r
@@ -1668,9 +1975,7 @@ namespace System.Drawing {
                        if(g == null)\r
                                throw new NullReferenceException();\r
                        \r
-                       SetNativeClip(\r
-                               CombineClipArea(g.GetNativeClip(),\r
-                               combineMode));\r
+                       CombineClipArea(g._clip.NativeObject, combineMode);\r
                }\r
 \r
                public void SetClip (Rectangle rect, CombineMode combineMode) {\r
@@ -1684,33 +1989,43 @@ namespace System.Drawing {
                        if(region == null)\r
                                throw new ArgumentNullException("region");\r
 \r
-                       if(region == Region.InfiniteRegion) {\r
-                               SetNativeClip(null);\r
-                               return;\r
-                       }\r
-\r
-                       SetNativeClip(CombineClipArea(region.NativeObject,combineMode));\r
+                       CombineClipArea((geom.Area)region.NativeObject.clone(),combineMode);\r
                }\r
                \r
                public void SetClip (GraphicsPath path, CombineMode combineMode) {\r
                        if(path == null)\r
                                throw new ArgumentNullException("path");\r
 \r
-                       SetNativeClip(CombineClipArea(new java.awt.geom.Area(path.NativeObject),combineMode));\r
+                       CombineClipArea(new geom.Area(path.NativeObject), combineMode);\r
                }\r
                #endregion\r
 \r
                #region Clipping Staff [INTERNAL]\r
+               internal Region ScaledClip {\r
+                       get {\r
+                               return _clip.Clone();\r
+                       }\r
+                       set {\r
+                               _clip.NativeObject.reset();\r
+                               _clip.NativeObject.add(value.NativeObject);\r
+                       }\r
+               }\r
                internal void SetClip(float x,float y,float width,float height,CombineMode combineMode) {                                       \r
-                       SetNativeClip(CombineClipArea(new geom.Area(\r
-                               new geom.Rectangle2D.Float(x,y,width,height)),combineMode));\r
+                       CombineClipArea(new geom.Area(\r
+                               new geom.Rectangle2D.Float(x,y,width,height)),combineMode);\r
                }\r
 \r
-               geom.Area CombineClipArea(java.awt.geom.Area area, CombineMode combineMode) {\r
-                       if (combineMode == CombineMode.Replace)\r
-                               return area;\r
+               void CombineClipArea(geom.Area area, CombineMode combineMode) {\r
+                       geom.AffineTransform t = GetFinalTransform();\r
+                       if (!t.isIdentity())\r
+                               area.transform(t);\r
+                       if (combineMode == CombineMode.Replace) {\r
+                               _clip.NativeObject.reset();\r
+                               _clip.NativeObject.add(area);\r
+                               return;\r
+                       }\r
 \r
-                       geom.Area curClip = GetNativeClip();\r
+                       geom.Area curClip = _clip.NativeObject;\r
                        switch(combineMode) {\r
                                case CombineMode.Complement:\r
                                        curClip.add(area);\r
@@ -1730,18 +2045,34 @@ namespace System.Drawing {
                                default:\r
                                        throw new ArgumentOutOfRangeException();                                        \r
                        }\r
-                       \r
-                       return curClip;\r
                }\r
-               \r
-               void SetNativeClip(awt.Shape s) {\r
-                       NativeObject.setClip(s);\r
+\r
+               internal void IntersectScaledClipWithBase(awt.Shape clip) {\r
+                       NativeObject.clip(clip);\r
                }\r
 \r
-               geom.Area GetNativeClip() {\r
-                       awt.Shape clip = NativeObject.getClip();\r
-                       return clip != null ? new geom.Area(clip) : (geom.Area)Region.InfiniteRegion.NativeObject.clone();\r
+               awt.Shape IntersectUserClip(awt.Shape shape, geom.Area clip) {\r
+                       if (clip == null)\r
+                               return shape;\r
+\r
+                       geom.Area area = new geom.Area(shape);\r
+                       area.intersect(clip);\r
+                       return area;\r
+               }\r
+\r
+               awt.Shape IntersectUserClip(awt.Shape shape) {\r
+                       return IntersectUserClip(shape, _clip.NativeObject);\r
+               }\r
+\r
+               void RestoreBaseClip() {\r
+                       if (_nextGraphicsState == null) {\r
+                               NativeObject.setClip(null);\r
+                               return;\r
+                       }\r
+\r
+                       _nextGraphicsState.RestoreBaseClip(this);\r
                }\r
+               \r
                #endregion\r
                \r
                #region TransformPoints\r
@@ -1779,9 +2110,25 @@ namespace System.Drawing {
 \r
                \r
                public void TranslateClip (float dx, float dy) {\r
-                       geom.Area clip = GetNativeClip();\r
-                       clip.transform(geom.AffineTransform.getTranslateInstance(dx, dy));\r
-                       SetNativeClip(clip);\r
+                       double x = dx;\r
+                       double y = dy;\r
+                       geom.AffineTransform f = GetFinalTransform();\r
+\r
+                       if (!f.isIdentity()) {\r
+                               double[] p = new double[] {x, y};\r
+                               f.deltaTransform(p, 0, p, 0, 1);\r
+\r
+                               x = p[0];\r
+                               y = p[1];\r
+                       }\r
+\r
+                       // It seems .Net does exactly this...\r
+                       x = Math.Floor(x+0.96875);\r
+                       y = Math.Floor(y+0.96875);\r
+\r
+                       geom.AffineTransform t = geom.AffineTransform.getTranslateInstance(x, y);\r
+\r
+                       _clip.NativeObject.transform(t);\r
                }\r
                #endregion\r
 \r
@@ -1801,14 +2148,12 @@ namespace System.Drawing {
                #region Properties [Partial TODO]\r
                public Region Clip {\r
                        get {\r
-                               java.awt.Graphics2D g = NativeObject;\r
-                               java.awt.Shape s = g.getClip();                         \r
-                               if(s != null) {\r
-                                       return new Region(new java.awt.geom.Area(s));\r
-                               }\r
-                               else {\r
-                                       return Region.InfiniteRegion.Clone();\r
-                               }\r
+                               Region r = _clip.Clone();\r
+                               geom.AffineTransform t = GetFinalTransform();\r
+                               if (!t.isIdentity())\r
+                                       r.NativeObject.transform(t.createInverse());\r
+\r
+                               return r;\r
                        }\r
                        set {\r
                                SetClip (value, CombineMode.Replace);\r
@@ -1817,10 +2162,18 @@ namespace System.Drawing {
 \r
                public RectangleF ClipBounds {\r
                        get {\r
-                               java.awt.Graphics2D g = NativeObject;\r
-                               java.awt.Rectangle r = g.getClipBounds();\r
-                               RectangleF rect = new RectangleF ((float)r.getX(),(float)r.getY(),(float)r.getWidth(),(float)r.getHeight());\r
-                               return rect;\r
+                               awt.Shape shape = _clip.NativeObject;\r
+                               if (shape == null)\r
+                                       shape = Region.InfiniteRegion.NativeObject;\r
+\r
+                               geom.RectangularShape r = shape.getBounds2D();\r
+                               geom.AffineTransform t = GetFinalTransform();\r
+                               if (!t.isIdentity()) {\r
+                                       geom.AffineTransform it = t.createInverse();\r
+                                       r = it.createTransformedShape(r).getBounds2D();\r
+                               }\r
+\r
+                               return new RectangleF (r);\r
                        }\r
                }\r
 \r
@@ -1943,20 +2296,16 @@ namespace System.Drawing {
 \r
                public bool IsClipEmpty {\r
                        get {\r
-                               java.awt.Graphics2D g = NativeObject;\r
-                               awt.Shape clip = g.getClip();\r
-                               if (clip == null)\r
-                                       return false;\r
-                               return new geom.Area(clip).isEmpty();\r
+                               return _clip.IsEmpty(this);\r
                        }\r
                }\r
 \r
                public bool IsVisibleClipEmpty {\r
                        get {\r
-                               awt.Shape clip = NativeObject.getClip();\r
-                               if (clip == null)\r
-                                       return false;\r
-                               return !clip.intersects(0, 0, _image.Width, _image.Height);\r
+                               if (_clip.IsEmpty(this))\r
+                                       return true;\r
+\r
+                               return VisibleClipBounds.IsEmpty;\r
                        }\r
                }\r
 \r
@@ -1966,7 +2315,6 @@ namespace System.Drawing {
                        }\r
                        set {\r
                                _pageScale = value;\r
-                               UpdateInternalTransform();\r
                        }\r
                }\r
 \r
@@ -1976,28 +2324,28 @@ namespace System.Drawing {
                        }\r
                        set {\r
                                _pageUnit = value;\r
-                               UpdateInternalTransform();\r
                        }\r
                }\r
 \r
-               internal void UpdateInternalTransform()\r
-               {\r
-                       float new_scale = _pageScale * _unitConversion[ (int)PageUnit ];\r
-                       Matrix mx = _transform.Clone();\r
-\r
-                       mx.Scale( new_scale, new_scale, MatrixOrder.Prepend );\r
-                       mx.Translate(\r
-                               mx.OffsetX * new_scale - mx.OffsetX,\r
-                               mx.OffsetY * new_scale - mx.OffsetY, MatrixOrder.Append);\r
-\r
-                       if (_stateContainerStack.Count != 0) {\r
-                               GraphicsState gs = (GraphicsState)_stateContainerStack.Peek();\r
-                               if (gs.ContainerTransfrom != null)\r
-                                       Matrix.Multiply(mx.NativeObject, gs.ContainerTransfrom.NativeObject, MatrixOrder.Append);\r
+               static internal geom.AffineTransform GetFinalTransform(\r
+                       geom.AffineTransform transform, GraphicsUnit pageUnit, float pageScale) {\r
+                       geom.AffineTransform t = null;\r
+                       if (pageUnit != GraphicsUnit.Display) {\r
+                               float scale = pageScale * _unitConversion[ (int)pageUnit ];\r
+                               if (Math.Abs(scale-1f) > float.Epsilon)\r
+                                       t = geom.AffineTransform.getScaleInstance(scale, scale);\r
                        }\r
 \r
-                       java.awt.Graphics2D g = NativeObject;\r
-                       g.setTransform( mx.NativeObject );\r
+                       if (t != null)\r
+                               t.concatenate(transform);\r
+                       else\r
+                               t = transform;\r
+                       \r
+                       return t;\r
+               }\r
+\r
+               geom.AffineTransform GetFinalTransform() {\r
+                       return GetFinalTransform(_transform.NativeObject, PageUnit, PageScale);\r
                }\r
 \r
                public PixelOffsetMode PixelOffsetMode {\r
@@ -2116,27 +2464,60 @@ namespace System.Drawing {
 \r
                public Matrix Transform {\r
                        get {\r
-                               return _transform;\r
+                               return _transform.Clone();\r
                        }\r
                        set {\r
-                               _transform = value.Clone();\r
-                               UpdateInternalTransform();\r
+                               if (value == null)\r
+                                       throw new ArgumentNullException("matrix");\r
+\r
+                               if (!value.IsInvertible)\r
+                                       throw new ArgumentException("Invalid parameter used.");\r
+\r
+                               value.CopyTo(_transform);\r
+                       }\r
+               }\r
+\r
+               internal Matrix BaseTransform {\r
+                       get {\r
+                               return new Matrix(NativeObject.getTransform());\r
+                       }\r
+                       set {\r
+                               NativeObject.setTransform(value.NativeObject);\r
+                       }\r
+               }\r
+\r
+               internal void PrependBaseTransform(geom.AffineTransform t) {\r
+                       NativeObject.transform(t);\r
+               }\r
+\r
+               internal awt.Shape VisibleShape {\r
+                       get {\r
+                               return _windowRect;\r
                        }\r
                }\r
 \r
                public RectangleF VisibleClipBounds {\r
                        get {\r
-                               RectangleF bounds = ClipBounds;\r
-                               bounds.Intersect(new RectangleF(0, 0, _image.Width, _image.Height));\r
-                               return bounds;\r
+                               if (_clip.IsEmpty(this))\r
+                                       return RectangleF.Empty;\r
+\r
+                               geom.Rectangle2D r = _clip.NativeObject.getBounds2D();\r
+                               awt.Shape clip = NativeObject.getClip();\r
+                               geom.Rectangle2D clipBounds = (clip != null) ? clip.getBounds2D() : _windowRect;\r
+                               geom.Rectangle2D.intersect(r, clipBounds, r);\r
+                               geom.AffineTransform t = GetFinalTransform();\r
+                               if (!t.isIdentity()) {\r
+                                       geom.AffineTransform it = t.createInverse();\r
+                                       r = it.createTransformedShape(r).getBounds2D();\r
+                               }\r
+\r
+                               return new RectangleF (r);\r
                        }\r
                }\r
 \r
                void ConcatenateTransform(geom.AffineTransform transform, MatrixOrder order) {\r
                        geom.AffineTransform at = _transform.NativeObject;\r
                        Matrix.Multiply(at, transform, order);\r
-\r
-                       UpdateInternalTransform();\r
                }\r
                #endregion\r
        }\r
index 54432fc76dbfa0d1e917df1dc699001ce66c332f..83edd59dcfa76697df0ceb623c27775a8ef1eed1 100644 (file)
@@ -93,24 +93,40 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer
        // static
        public static Image FromFile(string filename)
        {
-               return new Bitmap (filename);
+               return FromFile (filename, false);
        }
        
        public static Image FromFile(string filename, bool useEmbeddedColorManagement)
        {
-               return new Bitmap (filename, useEmbeddedColorManagement);
+               IntPtr imagePtr;
+               Status st;
+
+               if (!File.Exists (filename))
+                       throw new FileNotFoundException (filename);
+
+               if (useEmbeddedColorManagement)
+                       st = GDIPlus.GdipLoadImageFromFileICM (filename, out imagePtr);
+               else
+                       st = GDIPlus.GdipLoadImageFromFile (filename, out imagePtr);
+
+               GDIPlus.CheckStatus (st);
+               return new Bitmap (imagePtr);
        }
 
-       [MonoTODO]      
        public static Bitmap FromHbitmap(IntPtr hbitmap)
-       {               
-               throw new NotImplementedException ();
+       {
+               return FromHbitmap (hbitmap, IntPtr.Zero);
        }
 
-       [MonoTODO]      
        public static Bitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette)
        {               
-               throw new NotImplementedException ();
+               IntPtr imagePtr;
+               Status st;
+
+               st = GDIPlus.GdipCreateBitmapFromHBITMAP (hbitmap, hpalette, out imagePtr);
+
+               GDIPlus.CheckStatus (st);
+               return new Bitmap (imagePtr);
        }
 
        public static Image FromStream (Stream stream)
index 61c32d731b74daec2fd463adbb77295d41a40b31..b5f392af849a9b1de3c8dece68cffca06d50613f 100644 (file)
 //
 namespace System.Drawing {
 
-using System;
-using System.Runtime.Remoting;
-using System.Runtime.Serialization;
-using System.Runtime.InteropServices;
-using System.ComponentModel;
-using System.Drawing.Imaging;
-using System.IO;
-using BufferedImage = java.awt.image.BufferedImage;
-using java.io;
-using javax.imageio;
-using javax.imageio.stream;
-using vmw.common;
-using awt = java.awt;
-using image = java.awt.image;
-
-public abstract class Image : MarshalByRefObject, IDisposable , ICloneable
-{      
-       #region Vars    
-       java.awt.Image [] _nativeObjects;
-
-       //consider using Image[] to support many thumbnails per Image
-       java.awt.Image [] _thumbnails;
-       int _currentObject;
-       Guid _dimension;
-       ImageFormat _format;
-       #endregion
-
-       #region Constructor
-       public void Dispose ()
-       {
-       }
+       using System;
+       using System.Runtime.Remoting;
+       using System.Runtime.Serialization;
+       using System.Runtime.InteropServices;
+       using System.ComponentModel;
+       using System.Drawing;
+       using System.Drawing.Imaging;
+       using System.IO;
+       using System.Xml;
+       using Mainsoft.Drawing.Imaging;
+
+       using BufferedImage = java.awt.image.BufferedImage;
+       using java.io;
+       using javax.imageio;
+       using javax.imageio.stream;
+       using vmw.common;
+       using awt = java.awt;
+       using image = java.awt.image;
+
+       public abstract class Image : MarshalByRefObject, IDisposable , ICloneable {    
+               #region Vars    
+               PlainImageCollection _nativeObject = new PlainImageCollection();
+               protected int _flags = 0;
+
+               //consider using Image[] to support many thumbnails per Image
+               #endregion
+
+               #region flags enum
+               [Flags]
+               protected enum ImageFlags {\r
+                       ImageFlagsNone = 0,\r
+                       ImageFlagsScalable = 0x0001,\r
+                       ImageFlagsHasAlpha = 0x0002,\r
+                       ImageFlagsHasTranslucent = 0x0004,\r
+                       ImageFlagsPartiallyScalable = 0x0008,\r
+                       ImageFlagsColorSpaceRGB = 0x0010,\r
+                       ImageFlagsColorSpaceCMYK = 0x0020,\r
+                       ImageFlagsColorSpaceGRAY = 0x0040,\r
+                       ImageFlagsColorSpaceYCBCR = 0x0080,\r
+                       ImageFlagsColorSpaceYCCK = 0x0100,\r
+                       ImageFlagsHasRealDPI = 0x1000,\r
+                       ImageFlagsHasRealPixelSize = 0x2000,\r
+                       ImageFlagsReadOnly = 0x00010000,\r
+                       ImageFlagsCaching = 0x00020000\r
+               }\r
+               #endregion\r
+
+               #region Constructor
+               public void Dispose () {
+               }
 
-       protected virtual void DisposeResources ()
-       {
-       }
+               protected virtual void DisposeResources () {
+               }
        
-       protected virtual void Dispose (bool disposing)
-       {
-       }
+               protected virtual void Dispose (bool disposing) {
+               }
 
-       // Derived classes must call Initialize () when they use this constructor
-       protected Image () {
-       }
+               // Derived classes must call Initialize () when they use this constructor
+               protected Image () {
+               }
  
-       protected Image (Image orig) {
-               _nativeObjects = CloneNativeObjects(orig._nativeObjects);
-               _thumbnails = CloneNativeObjects(orig._thumbnails);
-               _format = orig._format;
-               _currentObject = orig._currentObject;
-               _dimension = orig._dimension;
-       }
-
-       protected Image (java.awt.Image nativeObject, ImageFormat format)
-               :this (new java.awt.Image [] {nativeObject}, format) {}
-
-       protected Image (java.awt.Image [] nativeObjects, ImageFormat format)
-        :this (nativeObjects, format, FrameDimension.Page.Guid)        {}
+               protected Image (java.awt.Image nativeObject) : this(nativeObject, ImageFormat.MemoryBmp) {
+               }
 
-       protected Image (java.awt.Image [] nativeObjects, ImageFormat format, Guid dimension) {
-               Initialize (nativeObjects, null, format, dimension);
-       }
+               protected Image (java.awt.Image nativeObject, ImageFormat format) {
+                       PlainImage pi = new PlainImage( nativeObject, null, format, 0, 0, FrameDimension.Page, null );
+                       Initialize( pi, false );
+               }
 
-       protected void Initialize (java.awt.Image [] nativeObjects, java.awt.Image [] thumbnails, ImageFormat format, Guid dimension) {
-               _format = format;
-               _nativeObjects = nativeObjects;
-               _thumbnails = thumbnails;
-               _currentObject = 0;
-               _dimension = dimension;
-       }
+               protected void Initialize (PlainImage pi, bool addToCollection) {
+                       if (!addToCollection)
+                               NativeObject.Clear();
+                               
+                       NativeObject.Add( pi );
+               }
 
-       #endregion
+               #endregion
        
-       #region Internals
-
-       internal java.awt.Image NativeObject {
-               get {
-                 return _nativeObjects [_currentObject];
-               }
-       }
+               #region Internals
 
-       protected java.awt.Image this [int i] {
-               get {
-                       return _nativeObjects [i];
+               internal PlainImageCollection NativeObject {
+                       get {
+                               return _nativeObject;
+                       }
                }
-       }
 
-       protected int NativeObjectsCount {
-               get {
-                       return _nativeObjects.Length;
+               internal PlainImage CurrentImage {
+                       get {
+                               return NativeObject.CurrentImage;
+                       }
                }
-       }
-
-       #endregion
+               
+               #endregion
     
-       #region FromFile
-       public static Image FromFile(string filename)
-       {
-               //FIXME: check if it's not a metafile
-               return new Bitmap (filename);
-       }
+               #region FromFile
+               public static Image FromFile(string filename) {
+                       //FIXME: check if it's not a metafile, throw NotImplementedException
+                       return new Bitmap (filename);
+               }
        
-       public static Image FromFile(string filename, bool useIcm)
-       {
-               //FIXME: check if it's not a metafile
-               return new Bitmap (filename, useIcm);
-       }
-       #endregion
+               public static Image FromFile(string filename, bool useIcm) {
+                       //FIXME: check if it's not a metafile, throw NotImplementedException
+                       return new Bitmap (filename, useIcm);
+               }
+               #endregion
 
-       #region GetThumbnailImageAbort
-       [Serializable]
-       public delegate bool GetThumbnailImageAbort();
-       #endregion
+               #region GetThumbnailImageAbort
+               [Serializable]
+                       public delegate bool GetThumbnailImageAbort();
+               #endregion
 
-       #region Clone
-       public virtual object Clone() {
-               throw new NotImplementedException ("Must be implemented in child class");
-       }
-       #endregion
-
-       // static
-       #region FromStream
-       public static Image FromStream (Stream stream)
-       {
-               //FIXME: check if it's not a metafile
-               return new Bitmap (stream);
-       }
+               #region Clone
+               public virtual object Clone() {
+                       throw new NotImplementedException ("Must be implemented in child class");
+               }
+               #endregion
+
+               // static
+               #region FromStream
+               public static Image FromStream (Stream stream) {
+                       //FIXME: check if it's not a metafile, throw NotImplementedException
+                       return new Bitmap (stream);
+               }
        
-       public static Image FromStream (Stream stream, bool useIcm)
-       {
-               //FIXME: check if it's not a metafile
-               return new Bitmap (stream, useIcm);
-       }
-       #endregion
-
-       #region GetPixelFormatSize
-       public static int GetPixelFormatSize(PixelFormat pixfmt)
-       {
-
-               int result = 0;
-               switch (pixfmt) {
-                       case PixelFormat.Format16bppArgb1555:
-                       case PixelFormat.Format16bppGrayScale:
-                       case PixelFormat.Format16bppRgb555:
-                       case PixelFormat.Format16bppRgb565:
-                               result = 16;
-                               break;
-                       case PixelFormat.Format1bppIndexed:
-                               result = 1;
-                               break;
-                       case PixelFormat.Format24bppRgb:
-                               result = 24;
-                               break;
-                       case PixelFormat.Format32bppArgb:
-                       case PixelFormat.Format32bppPArgb:
-                       case PixelFormat.Format32bppRgb:
-                               result = 32;
-                               break;
-                       case PixelFormat.Format48bppRgb:
-                               result = 48;
-                               break;
-                       case PixelFormat.Format4bppIndexed:
-                               result = 4;
-                               break;
-                       case PixelFormat.Format64bppArgb:
-                       case PixelFormat.Format64bppPArgb:
-                               result = 64;
-                               break;
-                       case PixelFormat.Format8bppIndexed:
-                               result = 8;
-                               break;
-               }
-               return result;
-       }
-       #endregion
+               public static Image FromStream (Stream stream, bool useIcm) {
+                       //FIXME: check if it's not a metafile, throw NotImplementedException
+                       return new Bitmap (stream, useIcm);
+               }
+               #endregion
+
+               #region GetPixelFormatSize
+               public static int GetPixelFormatSize(PixelFormat pixfmt) {
+
+                       int result = 0;
+                       switch (pixfmt) {
+                               case PixelFormat.Format16bppArgb1555:
+                               case PixelFormat.Format16bppGrayScale:
+                               case PixelFormat.Format16bppRgb555:
+                               case PixelFormat.Format16bppRgb565:
+                                       result = 16;
+                                       break;
+                               case PixelFormat.Format1bppIndexed:
+                                       result = 1;
+                                       break;
+                               case PixelFormat.Format24bppRgb:
+                                       result = 24;
+                                       break;
+                               case PixelFormat.Format32bppArgb:
+                               case PixelFormat.Format32bppPArgb:
+                               case PixelFormat.Format32bppRgb:
+                                       result = 32;
+                                       break;
+                               case PixelFormat.Format48bppRgb:
+                                       result = 48;
+                                       break;
+                               case PixelFormat.Format4bppIndexed:
+                                       result = 4;
+                                       break;
+                               case PixelFormat.Format64bppArgb:
+                               case PixelFormat.Format64bppPArgb:
+                                       result = 64;
+                                       break;
+                               case PixelFormat.Format8bppIndexed:
+                                       result = 8;
+                                       break;
+                       }
+                       return result;
+               }
+               #endregion
 
-       #region IsAlphaPixelFormat
-       public static bool IsAlphaPixelFormat(PixelFormat pixfmt)
-       {
-               return (pixfmt & PixelFormat.Alpha) != PixelFormat.Undefined;
-       }
-       #endregion
+               #region IsAlphaPixelFormat
+               public static bool IsAlphaPixelFormat(PixelFormat pixfmt) {
+                       return (pixfmt & PixelFormat.Alpha) != PixelFormat.Undefined;
+               }
+               #endregion
        
-       #region GetCanonicalPixelFormat [TODO]
-       public static bool IsCanonicalPixelFormat (PixelFormat pixfmt)
-       {
-               return (pixfmt & PixelFormat.Canonical) != PixelFormat.Undefined;
-       }
-       #endregion
+               #region GetCanonicalPixelFormat [TODO]
+               public static bool IsCanonicalPixelFormat (PixelFormat pixfmt) {
+                       return (pixfmt & PixelFormat.Canonical) != PixelFormat.Undefined;
+               }
+               #endregion
        
-       #region IsextendedPixelFormat [TODO]
-       public static bool IsExtendedPixelFormat (PixelFormat pixfmt)
-       {
-               return (pixfmt & PixelFormat.Extended) != PixelFormat.Undefined;
-       }
-       #endregion
-
-       // non-static
-       #region GetBounds
-       public RectangleF GetBounds (ref GraphicsUnit pageUnit)
-       {       
-               int w = NativeObject.getWidth(null);
-               int h = NativeObject.getHeight(null);
-
-               pageUnit = GraphicsUnit.Pixel; //java.awt.Image always returns pixels
+               #region IsextendedPixelFormat [TODO]
+               public static bool IsExtendedPixelFormat (PixelFormat pixfmt) {
+                       return (pixfmt & PixelFormat.Extended) != PixelFormat.Undefined;
+               }
+               #endregion
 
-               return new RectangleF((float)0,(float)0,(float)w,(float)h);
-       }
-       #endregion
+               // non-static
+               #region GetBounds
+               public RectangleF GetBounds (ref GraphicsUnit pageUnit) {       
+                       pageUnit = GraphicsUnit.Pixel; //java.awt.Image always returns pixels
+                       return new RectangleF((float)0,(float)0,(float)Width,(float)Height);
+               }
+               #endregion
        
-       #region GetEncoderParameterList [TODO]
-       public EncoderParameters GetEncoderParameterList(Guid encoder)
-       {
-               throw new NotImplementedException ();
-       }
-       #endregion
+               #region GetEncoderParameterList [TODO]
+               public EncoderParameters GetEncoderParameterList(Guid encoder) {
+                       throw new NotImplementedException ();
+               }
+               #endregion
        
-       #region GetFrameCount
-       public int GetFrameCount(FrameDimension dimension)
-       {
-               return _nativeObjects.Length;
-       }
-       #endregion
+               #region GetFrameCount
+               public int GetFrameCount(FrameDimension dimension) {
+                       return NativeObject.Count;
+               }
+               #endregion
        
-       #region GetPropertyItem [TODO]
-       public PropertyItem GetPropertyItem(int propid)
-       {
-               throw new NotImplementedException ();
-       }
-       #endregion
+               #region GetPropertyItem [TODO]
+               public PropertyItem GetPropertyItem(int propid) {
+                       throw new NotImplementedException ();
+               }
+               #endregion
 
-       #region RemovePropertyItem [TODO]
-       public void RemovePropertyItem (int propid)
-       {               
-               throw new NotImplementedException ();
-       }
-       #endregion
+               #region RemovePropertyItem [TODO]
+               public void RemovePropertyItem (int propid) {           
+                       throw new NotImplementedException ();
+               }
+               #endregion
        
-       #region RotateFlip [TODO]
-       public void RotateFlip (RotateFlipType rotateFlipType)
-       {               
-               throw new NotImplementedException ();
-       }
-       #endregion
+               #region RotateFlip
+               public void RotateFlip (RotateFlipType rotateFlipType) {
+                       awt.geom.AffineTransform tx;
+
+                       if ( !(CurrentImage.NativeImage is image.BufferedImage) )
+                               // TBD: This implementation is for raster formats only
+                               throw new NotImplementedException("Only raster formats are supported");
+
+                       switch (rotateFlipType) {
+                               case RotateFlipType.RotateNoneFlipNone :
+                                       return;
+                               
+                               case RotateFlipType.Rotate90FlipNone :
+                                       tx = awt.geom.AffineTransform.getRotateInstance(Math.PI / 2);
+                                       tx.translate( 0, -Height );
+                                       break;
+
+                               case RotateFlipType.Rotate180FlipNone :
+                                       tx = awt.geom.AffineTransform.getScaleInstance(-1, -1);
+                                       tx.translate( -Width, -Height );
+                                       break;
+
+                               case RotateFlipType.Rotate270FlipNone :
+                                       tx = awt.geom.AffineTransform.getRotateInstance(-Math.PI / 2);
+                                       tx.translate( -Width, 0 );
+                                       break;
+
+                               case RotateFlipType.RotateNoneFlipX :
+                                       tx = awt.geom.AffineTransform.getScaleInstance(-1, 1);
+                                       tx.translate( -Width, 0 );
+                                       break;
+
+                               case RotateFlipType.Rotate90FlipX :
+                                       tx = awt.geom.AffineTransform.getRotateInstance(Math.PI / 2);
+                                       tx.scale(1, -1);
+                                       break;
+
+                               case RotateFlipType.Rotate180FlipX :
+                                       tx = awt.geom.AffineTransform.getScaleInstance(1, -1);
+                                       tx.translate( 0, -Height );
+                                       break;
+
+                               case RotateFlipType.Rotate270FlipX :
+                                       tx = awt.geom.AffineTransform.getRotateInstance(Math.PI / 2);
+                                       tx.scale(-1, 1);
+                                       tx.translate( -Width, -Height );
+                                       break;
+
+                               default:
+                                       throw new ArgumentOutOfRangeException();
+                       }
+                       image.AffineTransformOp op = new image.AffineTransformOp(tx, image.AffineTransformOp.TYPE_NEAREST_NEIGHBOR);\r
+                       CurrentImage.NativeImage = op.filter((BufferedImage)CurrentImage.NativeImage, null);\r
+               }
+               #endregion
 
-       #region Save
-       protected abstract void InternalSave (ImageOutputStream output, Guid clsid);
+               #region Save
+               protected abstract void InternalSave (ImageOutputStream output, Guid clsid);
 
-       public void Save (Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
-       {
-               //FIXME: ignoring encoderParams
-               java.io.OutputStream jos = vmw.common.IOUtils.ToOutputStream (stream);
-               MemoryCacheImageOutputStream output = new MemoryCacheImageOutputStream(jos);
+               public void Save (Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) {
+                       //FIXME: ignoring encoderParams
+                       java.io.OutputStream jos = vmw.common.IOUtils.ToOutputStream (stream);
+                       MemoryCacheImageOutputStream output = new MemoryCacheImageOutputStream(jos);
                
-               InternalSave (output, encoder.Clsid);
-       }
+                       InternalSave (output, encoder.Clsid);
+               }
        
-       public void Save(string filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
-       {
-               //FIXME: ignoring encoderParams
-               java.io.File jf = vmw.common.IOUtils.getJavaFile (filename);
-               FileImageOutputStream output = new FileImageOutputStream (jf);
-               InternalSave (output, encoder.Clsid);
-       }
+               public void Save(string filename, ImageCodecInfo encoder, EncoderParameters encoderParams) {
+                       //FIXME: ignoring encoderParams
+                       java.io.File jf = vmw.common.IOUtils.getJavaFile (filename);
+                       FileImageOutputStream output = new FileImageOutputStream (jf);
+                       InternalSave (output, encoder.Clsid);
+               }
 
-       public void Save (string filename)
-       {
-               Save (filename, ImageFormat.Png);
-       }
+               public void Save (string filename) {
+                       Save (filename, ImageFormat.Png);
+               }
 
-       public void Save (Stream stream, ImageFormat format)
-       {
-               Save (stream, ImageCodecInfo.FindEncoder (
-                       ImageCodecInfo.ImageFormatToClsid (format)), null);
-       }
+               public void Save (Stream stream, ImageFormat format) {
+                       Save (stream, ImageCodec.FindEncoder (
+                               ImageCodec.ImageFormatToClsid (format)), null);
+               }
 
-       public void Save(string filename, ImageFormat format) 
-       {
-               Save (filename, ImageCodecInfo.FindEncoder (
-                       ImageCodecInfo.ImageFormatToClsid (format)), null);
-       }
-       #endregion
+               public void Save(string filename, ImageFormat format) {
+                       Save (filename, ImageCodec.FindEncoder (
+                               ImageCodec.ImageFormatToClsid (format)), null);
+               }
+               #endregion
 
-       #region SaveAdd [TODO]
-       public void SaveAdd(EncoderParameters encoderParams)
-       {
-               throw new NotImplementedException ();
-       }
-       
-       public void SaveAdd(Image image, EncoderParameters encoderParams)
-       {
-               throw new NotImplementedException ();
-       }
-       #endregion
+               #region SaveAdd [TODO]
+               public void SaveAdd(EncoderParameters encoderParams) {
+                       throw new NotImplementedException ();
+               }
        
-       #region SelectActiveFrame
-       public int SelectActiveFrame(FrameDimension dimension, int frameIndex)
-       {
-               if (dimension.Guid != _dimension) //TBD check if this is the correct exception and message
-            throw new ArgumentException (dimension + " dimension is not supported");
-               _currentObject = frameIndex;
-               //TBD check what net makes when index out of bounds
-               return frameIndex;
-       }
-       #endregion
+               public void SaveAdd(Image image, EncoderParameters encoderParams) {
+                       throw new NotImplementedException ();
+               }
+               #endregion
        
-       #region SetPropertyItem [TODO]
-       public void SetPropertyItem(PropertyItem propitem)
-       {
-               throw new NotImplementedException ();
-       }
-       #endregion
+               #region SelectActiveFrame
 
-       // properties
-       #region Flags[TODO]
-       public int Flags 
-       {
-               get {
-                       throw new NotImplementedException ();   
-               }
-       }
-       #endregion
+               // TBD: .Net does not load all frames at the initialization. New frames loaded by request.
+               public int SelectActiveFrame(FrameDimension dimension, int frameIndex) {
+                       // FIXME: dimension
+                       //if (dimension != CurrentImage.Dimension) //TBD check if this is the correct exception and message
+                       //      throw new ArgumentException (dimension + " dimension is not supported");
 
-       #region FrameDimensionsList
-       public Guid[] FrameDimensionsList {
-               get {
-                       return new Guid [] {_dimension};
-               }
-       }
-       #endregion
+                       if (frameIndex < NativeObject.Count)
+                               NativeObject.CurrentImageIndex = frameIndex;
 
-       #region Height
-       public int Height 
-       {
-               get {
-                       return NativeObject.getHeight(null);
+                       return frameIndex;
                }
-       }
-       #endregion
+               #endregion
        
-       #region HorisontalDimention [TODO]
-       public float HorizontalResolution 
-       {
-               get {
+               #region SetPropertyItem [TODO]
+               public void SetPropertyItem(PropertyItem propitem) {
                        throw new NotImplementedException ();
                }
-       }
-       #endregion
+               #endregion
+
+               // properties
+               #region Flags
+               public int Flags {
+                       // FIXME: ImageFlagsScalable, ImageFlagsHasTranslucent, ImageFlagsPartiallyScalable, ImageFlagsCaching
+                       get {
+                               image.ColorModel colorModel = ((BufferedImage)CurrentImage.NativeImage).getColorModel();
+                               int t = colorModel.getColorSpace().getType();
+                               
+                               if (t == awt.color.ColorSpace.TYPE_RGB)
+                                       _flags |= (int)ImageFlags.ImageFlagsColorSpaceRGB;
+                               else if (t == awt.color.ColorSpace.TYPE_CMYK)
+                                       _flags |= (int)ImageFlags.ImageFlagsColorSpaceCMYK;
+                               else if (t == awt.color.ColorSpace.TYPE_GRAY)
+                                       _flags |= (int)ImageFlags.ImageFlagsColorSpaceGRAY;
+                               else if (t == awt.color.ColorSpace.TYPE_YCbCr)
+                                       _flags |= (int)ImageFlags.ImageFlagsColorSpaceYCBCR;
+
+                               if (colorModel.hasAlpha())
+                                       _flags |= (int)ImageFlags.ImageFlagsHasAlpha;
+
+                               if ((CurrentImage.HorizontalResolution > 0) || (CurrentImage.VerticalResolution > 0))
+                                       _flags |= (int)ImageFlags.ImageFlagsHasRealDPI;
+
+                               return _flags;
+                       }
+               }
+               #endregion
+
+               #region FrameDimensionsList
+               public Guid[] FrameDimensionsList {
+                       // FIXME: Add support for various dimensions
+                       get {
+                               Guid [] dimList = new Guid[]{CurrentImage.Dimension.Guid};
+                               return dimList;
+                       }
+               }
+               #endregion
+
+               #region Height
+               public int Height {
+                       get {
+                               return CurrentImage.NativeImage.getHeight(null);
+                       }
+               }
+               #endregion
        
-       #region ColorPalette [TODO]
-       public ColorPalette Palette 
-       {
-               get {                                                   
-                       
-                       throw new NotImplementedException ();
+               #region HorizontalResolution
+               public float HorizontalResolution {
+                       get {
+                               if (CurrentImage.HorizontalResolution == 0)
+                                       return Graphics.DefaultScreenResolution;
+
+                               return CurrentImage.HorizontalResolution;
+                       }
                }
-               set {
-                       throw new NotImplementedException ();
+               #endregion
+       
+               #region ColorPalette
+               public ColorPalette Palette {
+                       get {
+                               if (!(CurrentImage.NativeImage is BufferedImage))
+                                       // TBD: This implementation is for raster formats only
+                                       throw new NotImplementedException("Only raster formats are supported");
+
+                               image.ColorModel colorModel = ((BufferedImage)CurrentImage.NativeImage).getColorModel();
+                               if (colorModel is image.IndexColorModel) {
+
+                                       Color [] colors = new Color[ ((image.IndexColorModel)colorModel).getMapSize() ];
+                                       for (int i=0; i<colors.Length; i++) {
+                                               colors[i] = Color.FromArgb( ((image.IndexColorModel)colorModel).getRGB(i) );
+                                       }
+                                       ColorPalette palette = new ColorPalette(0, colors);
+                                       return palette;
+                               }
+                               return new ColorPalette();
+                       }
+                       set {
+                               // TBD: add set
+                               throw new NotImplementedException ();
+                       }
                }
-       }
-       #endregion
+               #endregion
                
-       #region PhysicalDimension [TODO]
-       public SizeF PhysicalDimension 
-       {
-               get {
-                       throw new NotImplementedException ();
+               #region PhysicalDimension
+               public SizeF PhysicalDimension {
+                       get {
+                               return new Size(Width, Height);
+                       }
                }
-       }
-       #endregion
+               #endregion
        
-       #region PixelFormat
-       abstract protected PixelFormat InternalPixelFormat {get;}
+               #region PixelFormat
+               abstract protected PixelFormat InternalPixelFormat {get;}
 
-       public PixelFormat PixelFormat {
-               get {
-                       return InternalPixelFormat;
+               public PixelFormat PixelFormat {
+                       get {
+                               return InternalPixelFormat;
+                       }
                }
-       }
-       #endregion
+               #endregion
                
-       #region PropertiIdList [TODO]
-       public int[] PropertyIdList 
-       {
-               get {
-                       throw new NotImplementedException ();
+               #region PropertiIdList [TODO]
+               public int[] PropertyIdList {
+                       get {
+                               throw new NotImplementedException ();
+                       }
                }
-       }
-       #endregion
+               #endregion
                
-       #region PropertItems [TODO]
-       public PropertyItem[] PropertyItems 
-       {
-               get {
-                       throw new NotImplementedException ();
+               #region PropertItems [TODO]
+               public PropertyItem[] PropertyItems {
+                       get {
+                               throw new NotImplementedException ();
+                       }
                }
-       }
-       #endregion
+               #endregion
 
-       #region RawFormat
-       public ImageFormat RawFormat 
-       {
-               get {
-                       return _format;
+               #region RawFormat
+               public ImageFormat RawFormat {
+                       get {
+                               return CurrentImage.ImageFormat;
+                       }
                }
-       }
-       #endregion
+               #endregion
 
-       #region Size
-       public Size Size 
-       {
-               get {
-                       return new Size(Width, Height);
+               #region Size
+               public Size Size {
+                       get {
+                               return new Size(Width, Height);
+                       }
                }
-       }
-       #endregion
+               #endregion
        
-       #region VerticalResolution [TODO]
-       public float VerticalResolution 
-       {
-               get {
-                       throw new NotImplementedException();
+               #region VerticalResolution
+               public float VerticalResolution {
+                       get {
+                               if (CurrentImage.VerticalResolution == 0)
+                                       return Graphics.DefaultScreenResolution;
+
+                               return CurrentImage.VerticalResolution;
+                       }
                }
-       }
-       #endregion
+               #endregion
        
-       #region Width
-       public int Width 
-       {
-               get {
-                       return NativeObject.getWidth(null);
+               #region Width
+               public int Width {
+                       get {
+                               return CurrentImage.NativeImage.getWidth(null);
+                       }
                }
-       }
-       #endregion      
-
-       public Image GetThumbnailImage(int thumbWidth, int thumbHeight, Image.GetThumbnailImageAbort callback, IntPtr callbackData)
-       {
-               awt.Image img = NativeObject;                   
-               if (_thumbnails != null && _currentObject < _thumbnails.Length) {
-                       if (_thumbnails[_currentObject] != null)
-                               img = _thumbnails[_currentObject];
+               #endregion      
+
+               public Image GetThumbnailImage(int thumbWidth, int thumbHeight, Image.GetThumbnailImageAbort callback, IntPtr callbackData) {
+                       awt.Image img;
+
+                       if (CurrentImage.Thumbnails != null) {
+                               for (int i=0; i < CurrentImage.Thumbnails.Length; i++)
+                                       if (CurrentImage.Thumbnails[i] != null) {
+                                               img = CurrentImage.Thumbnails[i];
+                                               if (img.getHeight(null) == thumbHeight && img.getWidth(null) == thumbWidth)
+                                                       return ImageFromNativeImage(img, RawFormat);
+                                       }
+                       }
+                       img = CurrentImage.NativeImage.getScaledInstance(thumbWidth, thumbHeight, awt.Image.SCALE_DEFAULT);
+
+                       return ImageFromNativeImage(img, RawFormat);
                }
-
-               if (img.getHeight(null) != thumbHeight || img.getWidth(null) != thumbWidth)
-                       img = img.getScaledInstance(thumbWidth, thumbHeight, awt.Image.SCALE_DEFAULT);
-
-               return ImageFromNativeImage(img, RawFormat);
-       }
 #if INTPTR_SUPPORT
        public static Bitmap FromHbitmap(IntPtr hbitmap)
        {               
@@ -467,14 +527,14 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable
        }
 #endif
 
-       internal static Image ImageFromNativeImage(awt.Image nativeImage, ImageFormat format) {
-               if (nativeImage is BufferedImage)
-                       return new Bitmap(nativeImage, format);
+               internal static Image ImageFromNativeImage(awt.Image nativeImage, ImageFormat format) {
+                       if (nativeImage is BufferedImage)
+                               return new Bitmap(nativeImage, format);
 
-               throw new ArgumentException("Invalid image type");
-       }
+                       throw new ArgumentException("Invalid image type");
+               }
 
-       protected abstract awt.Image [] CloneNativeObjects(awt.Image [] src);
-}
+               protected abstract awt.Image [] CloneNativeObjects(awt.Image [] src);
+       }
 
 }
index 406ffd8c634af1ee3f28108c38a7503ff23c62ac..3367e207fb1f2770642f51b39d85a239512b297f 100644 (file)
@@ -85,34 +85,12 @@ namespace System.Drawing
                                ((Image)val).Save (ms, ((Image)val).RawFormat);
                                return ms.GetBuffer ();
                        }else
-                               return new NotSupportedException ("ImageConverter can not convert from " + val.GetType ());                             
+                               return new NotSupportedException ("ImageConverter can not convert from " + val.GetType ());
                }
 
-               public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object val, Attribute[] attribs )
+               public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object val, Attribute[] attribs)
                {
-                       Type type = typeof (System.Drawing.Image);
-                       PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties (type); 
-                       PropertyDescriptorCollection returnPDC = pdc;
-                       if (attribs !=null) {
-                               int length = attribs.Length;
-                               foreach (PropertyDescriptor pd in pdc) {
-                                       bool found = false;
-                                       AttributeCollection attributes = pd.Attributes;
-                                       //Apply the filter on the PropertyDescriptor
-                                       //If any attribute is found from attribs, in 
-                                       //PropertyDescriptor then retain that particular
-                                       //PropertyDescriptor else discard it.
-                                       for (int i=0; i<length; i++) {
-                                               if (attributes.Contains (attribs [i])) {
-                                                       found = true;
-                                                       break;
-                                               }
-                                       }
-                                       if (!found)
-                                               returnPDC.Remove (pd);
-                               }
-                       }
-                       return returnPDC;       
+                       return TypeDescriptor.GetProperties (typeof (Image), attribs);
                }
 
                public override bool GetPropertiesSupported (ITypeDescriptorContext context )
index a5eec475590250f4092540497117c5be7439639f..d0b6fc585fe2a7227fff269a55f950e0d4fc0b3d 100755 (executable)
@@ -16,6 +16,7 @@ using System.Drawing.Drawing2D;
 using System.Runtime.InteropServices;
 
 using awt = java.awt;
+using geom = java.awt.geom;
 
 namespace System.Drawing \r
 {
@@ -72,6 +73,7 @@ namespace System.Drawing
                        _alignment = PenAlignment.Center;
                        _lineJoin = LineJoin.Miter;
                        _miterLimit = 10f;
+                       _transform = new Matrix();
                }
                #endregion
                //
@@ -328,22 +330,14 @@ namespace System.Drawing
                {
                        get \r
                        {
-                               if (_transform == null)
-                                       _transform = new Matrix ();
-                               return _transform;
+                               return _transform.Clone();
                        }
                                        
                        set \r
                        {
                                EnsureModifiable();
 
-                               _transform = value;
-                       }
-               }
-
-               internal bool RequiresWidening {
-                       get {
-                               return _transform != null && !_transform.IsIdentity;
+                               value.CopyTo(_transform);
                        }
                }
                #endregion
@@ -392,45 +386,45 @@ namespace System.Drawing
                #region Transform Funcs
                public void MultiplyTransform (Matrix matrix)
                {
-                       Transform.Multiply (matrix);
+                       _transform.Multiply (matrix);
                }
 
                public void MultiplyTransform (Matrix matrix, MatrixOrder order)
                {
-                       Transform.Multiply (matrix, order);
+                       _transform.Multiply (matrix, order);
                }
 
                public void ResetTransform ()
                {
-                       Transform.Reset ();
+                       _transform.Reset ();
                }
 
                public void RotateTransform (float angle)
                {
-                       Transform.Rotate (angle);
+                       _transform.Rotate (angle);
                }
 
                public void RotateTransform (float angle, MatrixOrder order)
                {
-                       Transform.Rotate (angle, order);
+                       _transform.Rotate (angle, order);
                }
 
                public void ScaleTransform (float sx, float sy)
                {
-                       Transform.Scale (sx, sy);
+                       _transform.Scale (sx, sy);
                }
 
                public void ScaleTransform (float sx, float sy, MatrixOrder order)
                {
-                       Transform.Scale (sx, sy, order);
+                       _transform.Scale (sx, sy, order);
                }
 
                public void TranslateTransform (float dx, float dy) {
-                       Transform.Translate (dx, dy);
+                       _transform.Translate (dx, dy);
                }
 
                public void TranslateTransform (float dx, float dy, MatrixOrder order) {
-                       Transform.Translate (dx, dy, order);
+                       _transform.Translate (dx, dy, order);
                }
                #endregion
 
@@ -446,86 +440,116 @@ namespace System.Drawing
                                throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
                }
 
-               internal awt.Stroke NativeObject {
-                       get {
-                               float[] dashPattern = null;\r
+               internal double GetSquaredTransformedWidth(geom.AffineTransform coordsTransform) {
+                       geom.AffineTransform transform = _transform.NativeObject;
+                       double A = transform.getScaleX();       // m00
+                       double B = transform.getShearY();       // m10
+                       double C = transform.getShearX();       // m01
+                       double D = transform.getScaleY();       // m11
+
+                       double K = coordsTransform.getScaleX(); // m00
+                       double L = coordsTransform.getShearY(); // m10
+                       double M = coordsTransform.getShearX(); // m01
+                       double N = coordsTransform.getScaleY(); // m11
+
+                       double AD = A*D, BC = B*C, KN = K*N, LM = L*M;
+                       double KN_LM = KN-LM;
+                       return Math.Abs(Width*Width * (AD*KN_LM - BC*KN_LM));
+               }
+
+               internal awt.Stroke GetNativeObject(geom.AffineTransform outputTransform, bool fitPen) {
+                       return GetNativeObject(null, outputTransform, fitPen);
+               }
+               /// <summary>\r
+               /// \r
+               /// </summary>\r
+               /// <param name="outputTransform">transform which will be applied on the final shape</param>\r
+               /// <param name="fitPen">ensure the shape will wide enough to be visible</param>\r
+               /// <returns></returns>
+               internal awt.Stroke GetNativeObject(geom.AffineTransform penTransform, geom.AffineTransform outputTransform, bool fitPen) {
+                       float[] dashPattern = null;\r
 \r
-                               switch (DashStyle) {\r
-                                       case DashStyle.Custom:\r
-                                               if (DashPattern != null) {\r
-                                                       dashPattern = new float[DashPattern.Length];\r
-                                                       for(int i = 0; i < DashPattern.Length; i++) {
-
-                                                               if (EndCap == LineCap.Flat)
-                                                                       dashPattern[i] = DashPattern[i] * Width;
-                                                               else {
-                                                                       if ((i & 1) == 0)
-                                                                               // remove the size of caps from the opaque parts
-                                                                               dashPattern[i] = (DashPattern[i] * Width) - Width;
-                                                                       else
-                                                                               // add the size of caps to the transparent parts
-                                                                               dashPattern[i] = (DashPattern[i] * Width) + Width;
-                                                               }
-                                                       }\r
+                       switch (DashStyle) {\r
+                               case DashStyle.Custom:\r
+                                       if (DashPattern != null) {\r
+                                               dashPattern = new float[DashPattern.Length];\r
+                                               for(int i = 0; i < DashPattern.Length; i++) {
+
+                                                       if (EndCap == LineCap.Flat)
+                                                               dashPattern[i] = DashPattern[i] * Width;
+                                                       else {
+                                                               if ((i & 1) == 0)
+                                                                       // remove the size of caps from the opaque parts
+                                                                       dashPattern[i] = (DashPattern[i] * Width) - Width;
+                                                               else
+                                                                       // add the size of caps to the transparent parts
+                                                                       dashPattern[i] = (DashPattern[i] * Width) + Width;
+                                                       }
                                                }\r
-                                               break;\r
-                                       case DashStyle.Dash:\r
-                                               dashPattern = DASH_ARRAY;\r
-                                               break;\r
-                                       case DashStyle.DashDot:\r
-                                               dashPattern = DASHDOT_ARRAY;\r
-                                               break;\r
-                                       case DashStyle.DashDotDot:\r
-                                               dashPattern = DASHDOTDOT_ARRAY;\r
-                                               break;\r
+                                       }\r
+                                       break;\r
+                               case DashStyle.Dash:\r
+                                       dashPattern = DASH_ARRAY;\r
+                                       break;\r
+                               case DashStyle.DashDot:\r
+                                       dashPattern = DASHDOT_ARRAY;\r
+                                       break;\r
+                               case DashStyle.DashDotDot:\r
+                                       dashPattern = DASHDOTDOT_ARRAY;\r
+                                       break;\r
                                \r
-                                               //                              default:\r
-                                               //                              case DashStyle.Solid:\r
-                                               //                                      break;\r
-                               }\r
+                                       //                              default:\r
+                                       //                              case DashStyle.Solid:\r
+                                       //                                      break;\r
+                       }\r
 \r
-                               int join;
-                               switch (LineJoin) {
-                                       case LineJoin.Bevel:
-                                               join = java.awt.BasicStroke.JOIN_BEVEL;
-                                               break;
-                                       default:
-                                       case LineJoin.Miter:
-                                       case LineJoin.MiterClipped:
-                                               join = java.awt.BasicStroke.JOIN_MITER;
-                                               break;
-                                       case LineJoin.Round:
-                                               join = java.awt.BasicStroke.JOIN_ROUND;\r
-                                               break;\r
-                               }\r
+                       int join;
+                       switch (LineJoin) {
+                               case LineJoin.Bevel:
+                                       join = java.awt.BasicStroke.JOIN_BEVEL;
+                                       break;
+                               default:
+                               case LineJoin.Miter:
+                               case LineJoin.MiterClipped:
+                                       join = java.awt.BasicStroke.JOIN_MITER;
+                                       break;
+                               case LineJoin.Round:
+                                       join = java.awt.BasicStroke.JOIN_ROUND;\r
+                                       break;\r
+                       }\r
 \r
-                               // We go by End cap for now.\r
-                               int cap;\r
-                               switch (EndCap) {\r
-                                       default:\r
-                                       case LineCap.Square:
-                                       case LineCap.SquareAnchor:
-                                               cap = awt.BasicStroke.CAP_SQUARE;
-                                               break;
-                                       case LineCap.Round: 
-                                       case LineCap.RoundAnchor:
-                                               cap = awt.BasicStroke.CAP_ROUND;
-                                               break;
-                                       case LineCap.Flat:
-                                               cap = awt.BasicStroke.CAP_BUTT;
-                                               break;\r
-                               }\r
+                       // We go by End cap for now.\r
+                       int cap;\r
+                       switch (EndCap) {\r
+                               default:\r
+                               case LineCap.Square:
+                               case LineCap.SquareAnchor:
+                                       cap = awt.BasicStroke.CAP_SQUARE;
+                                       break;
+                               case LineCap.Round: 
+                               case LineCap.RoundAnchor:
+                                       cap = awt.BasicStroke.CAP_ROUND;
+                                       break;
+                               case LineCap.Flat:
+                                       cap = awt.BasicStroke.CAP_BUTT;
+                                       break;\r
+                       }\r
 \r
-                               return StrokeFactory.CreateStroke(Width, cap, \r
-                                       join, MiterLimit, dashPattern, DashOffset,\r
-                                       _transform != null ? _transform.NativeObject : null);
-                       }
+                       geom.AffineTransform penT = _transform.NativeObject;\r
+                       if (penTransform != null && !penTransform.isIdentity()) {\r
+                               penT = (geom.AffineTransform)penT.clone();\r
+                               penT.concatenate(penTransform);\r
+                       }\r
+\r
+                       return StrokeFactory.CreateStroke(Width, cap, \r
+                               join, MiterLimit, dashPattern, DashOffset,\r
+                               penT, outputTransform, fitPen);
                }
 
                #region Stroke Members\r
 \r
                awt.Shape awt.Stroke.createStrokedShape(awt.Shape arg_0) {\r
-                       return NativeObject.createStrokedShape(arg_0);\r
+                       return GetNativeObject(null, false).createStrokedShape(arg_0);\r
                }\r
 \r
                #endregion
diff --git a/mcs/class/System.Drawing/System.Drawing/PlainImage.jvm.cs b/mcs/class/System.Drawing/System.Drawing/PlainImage.jvm.cs
new file mode 100644 (file)
index 0000000..b2297ef
--- /dev/null
@@ -0,0 +1,120 @@
+using System;\r
+using System.Drawing.Imaging;\r
+using System.Xml;\r
+\r
+using Mainsoft.Drawing.Imaging;\r
+\r
+using awt = java.awt;\r
+using java.awt.image;\r
+\r
+namespace Mainsoft.Drawing.Imaging\r
+{\r
+       /// <summary>\r
+       /// Summary description for PlainImage.\r
+       /// </summary>\r
+       public class PlainImage : ICloneable {\r
+\r
+               #region Members\r
+\r
+               awt.Image _nativeObject;\r
+               awt.Image [] _thumbnails;\r
+               FrameDimension _dimension;\r
+               XmlDocument _metadata;\r
+               ImageFormat _imageFormat;\r
+\r
+               float _xResolution;\r
+               float _yResolution;\r
+\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               public PlainImage() {\r
+               }\r
+\r
+               public PlainImage(awt.Image image, awt.Image [] thumbnails, ImageFormat format, float xRes, float yRes, FrameDimension dimension, XmlDocument metadata) {\r
+                       _nativeObject = image;\r
+                       _thumbnails = thumbnails;\r
+                       _imageFormat = format;\r
+\r
+                       _xResolution = xRes;\r
+                       _yResolution = yRes;\r
+\r
+                       _dimension = dimension;\r
+                       _metadata = metadata;\r
+               }\r
+\r
+               #endregion\r
+\r
+\r
+               private awt.Image NativeObject {\r
+                       get { return _nativeObject; }\r
+                       set { _nativeObject = value; }\r
+               }\r
+\r
+               #region PlainImage properties\r
+\r
+               public awt.Image NativeImage {\r
+                       get { return NativeObject; }\r
+                       set { NativeObject = value; }\r
+               }\r
+\r
+               public ImageFormat ImageFormat {\r
+                       get { return _imageFormat; }\r
+               }\r
+\r
+               public FrameDimension Dimension {\r
+                       get { return _dimension; }\r
+                       set { _dimension = value; }\r
+               }\r
+\r
+               public awt.Image [] Thumbnails {\r
+                       get { return _thumbnails; }\r
+               }\r
+\r
+               public float HorizontalResolution {\r
+                       get { return _xResolution; }\r
+                       set { _xResolution = value; }\r
+               }\r
+\r
+               public float VerticalResolution {\r
+                       get { return _yResolution; }\r
+                       set { _yResolution = value; }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region ICloneable members\r
+\r
+               public object Clone() {\r
+                       \r
+                       awt.Image img = new BufferedImage(\r
+                               ((BufferedImage)NativeObject).getColorModel(), \r
+                               ((BufferedImage)NativeObject).copyData(null), \r
+                               ((BufferedImage)NativeObject).isAlphaPremultiplied(), null);\r
+\r
+                       awt.Image [] th = null;\r
+                       if (Thumbnails != null) {\r
+                               th = new java.awt.Image[ Thumbnails.Length ];\r
+                               for (int i=0; i < Thumbnails.Length; i++) {\r
+                                       th[i] = new BufferedImage(\r
+                                               ((BufferedImage)Thumbnails[i]).getColorModel(), \r
+                                               ((BufferedImage)Thumbnails[i]).copyData(null), \r
+                                               ((BufferedImage)Thumbnails[i]).isAlphaPremultiplied(), null);\r
+                               }\r
+                       }\r
+\r
+                       return new PlainImage( \r
+                               img, \r
+                               th, \r
+                               ImageFormat, \r
+                               HorizontalResolution, \r
+                               VerticalResolution, \r
+                               Dimension, \r
+                               _metadata );\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.Drawing/System.Drawing/PlainImageCollection.jvm.cs b/mcs/class/System.Drawing/System.Drawing/PlainImageCollection.jvm.cs
new file mode 100644 (file)
index 0000000..e79d36b
--- /dev/null
@@ -0,0 +1,101 @@
+using System;\r
+using System.Collections;\r
+\r
+namespace Mainsoft.Drawing.Imaging\r
+{\r
+       /// <summary>\r
+       /// Summary description for PlainImageCollection.\r
+       /// </summary>\r
+       internal class PlainImageCollection : ICollection, IEnumerable\r
+       {\r
+               ArrayList collection = new ArrayList();\r
+               int _position = 0;\r
+\r
+               public PlainImageCollection()\r
+               {\r
+                       //\r
+                       // TODO: Add constructor logic here\r
+                       //\r
+               }\r
+\r
+               #region ICollection members\r
+               \r
+               public bool IsSynchronized {\r
+                       get {\r
+                               return collection.IsSynchronized;\r
+                       }\r
+               }\r
+\r
+               public int Count {\r
+                       get {\r
+                               return collection.Count;\r
+                       }\r
+               }\r
+\r
+               public void CopyTo(Array array, int index) {\r
+                       collection.CopyTo(array, index);\r
+               }\r
+\r
+               public object SyncRoot {\r
+                       get {\r
+                               return collection.SyncRoot;\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region IEnumerable members\r
+\r
+               public IEnumerator GetEnumerator() {\r
+                       return collection.GetEnumerator();\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Collection members\r
+\r
+               public int Add(PlainImage plainImage) {\r
+                       return collection.Add( plainImage );\r
+               }\r
+\r
+               public void Clear() {\r
+                       collection.Clear();\r
+               }\r
+\r
+               public bool Contains(PlainImage plainImage) {\r
+                       return collection.Contains(plainImage);\r
+               }\r
+\r
+               public int IndexOf(PlainImage plainImage) {\r
+                       return collection.IndexOf( plainImage );\r
+               }\r
+\r
+               public void Insert(int index, PlainImage value) {\r
+                       collection.Insert( index, value );\r
+               }\r
+\r
+               public void Remove(PlainImage value) {\r
+                       collection.Remove( value );\r
+               }\r
+\r
+               public void RemoveAt(int index) {\r
+                       collection.RemoveAt( index );\r
+               }\r
+\r
+               public PlainImage this[int index] {\r
+                       get { return (PlainImage) collection[ index ]; }\r
+               }\r
+\r
+               public PlainImage CurrentImage {\r
+                       get { return (PlainImage) collection[ _position ]; }\r
+                       set { collection[ _position ] = value; }\r
+               }\r
+\r
+               public int CurrentImageIndex {\r
+                       get { return _position; }\r
+                       set { _position = value; }\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
index 79466d313e17e8fbeacb9036423a261bea2012db..3d34b67efdc7060f886c10fd535e1c87fa0966d3 100644 (file)
@@ -258,7 +258,7 @@ namespace System.Drawing
 
 
 #if TARGET_JVM
-               internal RectangleF (java.awt.geom.Rectangle2D r2d) {
+               internal RectangleF (java.awt.geom.RectangularShape r2d) {
                        this.x = (float) r2d.getX ();
                        this.y = (float) r2d.getY ();
                        this.width = (float) r2d.getWidth ();
index 6afcaed83c3d5fde7d04b6aa930fbb0d1754f41e..60e0230b1f067ec304307b7532af9fdc702839a3 100644 (file)
@@ -28,7 +28,7 @@ namespace System.Drawing
                #region Ctors. and Dtor
 
 
-               public Region() : this(new geom.Area())
+               public Region() : this((geom.Area)InfiniteRegion.NativeObject.clone())
                {                  
                }
 
@@ -297,14 +297,14 @@ namespace System.Drawing
 
                public bool IsVisible (float x, float y, float width, float height)
                {
-                       return NativeObject.contains(x,y,width,height);
+                       return NativeObject.intersects(x,y,width,height);
                }
 
                public bool IsVisible (float x, float y, float width, float height, Graphics g) 
                {
                        if (g == null)
                                throw new ArgumentNullException("graphics");
-                       return NativeObject.contains(x,y,width,height);
+                       return NativeObject.intersects(x,y,width,height);
                }
                #endregion
 
@@ -337,7 +337,7 @@ namespace System.Drawing
                #region MakeInfinite
                public void MakeInfinite()
                {
-                       Shape = new geom.Area(InfiniteRegion.NativeObject);
+                       Shape = (geom.Area)InfiniteRegion.NativeObject.clone();
                }
                #endregion 
 
index 4f378ebd02d9cdac353f97eca495c94f4d9416ed..6882dc68e466cdbe07c7668c2cbd8ef6c502fa77 100755 (executable)
@@ -9,14 +9,16 @@ namespace System.Drawing {
 \r
                interface StrokeCreator {\r
                        awt.Stroke Create(float width, int cap, int join, float miterlimit,\r
-                               float[] dash, float dash_phase, geom.AffineTransform penTransform);\r
+                               float[] dash, float dash_phase, geom.AffineTransform penTransform,\r
+                               geom.AffineTransform outputTransform, bool fitPen);\r
                }\r
 \r
                sealed class AdvancedCreator : StrokeCreator {\r
                        #region StrokeCreator Members\r
 \r
-                       public awt.Stroke Create(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase, geom.AffineTransform penTransform) {\r
-                               return new System.Drawing.AdvancedStroke(width, cap, join, miterlimit, dash, dash_phase, penTransform);\r
+                       public awt.Stroke Create(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase, geom.AffineTransform penTransform,\r
+                               geom.AffineTransform outputTransform, bool fitPen) {\r
+                               return new System.Drawing.AdvancedStroke(width, cap, join, miterlimit, dash, dash_phase, penTransform, outputTransform, fitPen);\r
                        }\r
 \r
                        #endregion\r
@@ -25,7 +27,8 @@ namespace System.Drawing {
                sealed class DefaultCreator : StrokeCreator {\r
                        #region StrokeCreator Members\r
 \r
-                       public awt.Stroke Create(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase, geom.AffineTransform penTransform) {\r
+                       public awt.Stroke Create(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase, geom.AffineTransform penTransform,\r
+                               geom.AffineTransform outputTransform, bool fitPen) {\r
                                return new awt.BasicStroke(width, cap, join, miterlimit, dash, dash_phase);\r
                        }\r
 \r
@@ -51,9 +54,10 @@ namespace System.Drawing {
                }\r
 \r
                static public awt.Stroke CreateStroke(float width, int cap, int join, float miterlimit,\r
-                       float[] dash, float dash_phase, geom.AffineTransform penTransform) {\r
+                       float[] dash, float dash_phase, geom.AffineTransform penTransform,\r
+                       geom.AffineTransform outputTransform, bool fitPen) {\r
 \r
-                       return Creator.Create(width, cap, join, miterlimit, dash, dash_phase, penTransform);\r
+                       return Creator.Create(width, cap, join, miterlimit, dash, dash_phase, penTransform, outputTransform, fitPen);\r
                }\r
        }\r
 }
\ No newline at end of file
index 47912ea513eb4e7af6a302f8da2e57a0451dfb19..6872f116a4c555ba2c944e62920037bd30f97c2a 100644 (file)
@@ -73,15 +73,17 @@ namespace System.Drawing
 
                public TextureBrush (Image image, RectangleF dstRect)
                {
-                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject,
+                       // FIXME: check if not metafile
+                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
                                new geom.Rectangle2D.Float((float)dstRect.X,(float)dstRect.Y,(float)dstRect.Width,
                                (float)dstRect.Height));
                }
 
                public TextureBrush (Image image, WrapMode wrapMode)
                {
-                       //      TODO: WRAP MODE
-                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject,
+                       // FIXME: check if not metafile
+                       // TBD: WRAP MODE
+                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
                                new geom.Rectangle2D.Float(0,0,1,1));
                }
 
@@ -97,15 +99,17 @@ namespace System.Drawing
 
                public TextureBrush (Image image, WrapMode wrapMode, Rectangle dstRect)
                {
-                       //TODO:WRAP MODE
-                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject,
+                       // FIXME: check if not metafile
+                       // TBD:WRAP MODE
+                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
                                new geom.Rectangle2D.Float ((float)dstRect.X,(float)dstRect.Y,(float)dstRect.Width,(float)dstRect.Height));
                }
 
                public TextureBrush (Image image, WrapMode wrapMode, RectangleF dstRect)
                {
-                       //TODO:WRAP MODE
-                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject,
+                       // FIXME: check if not metafile
+                       //TBD:WRAP MODE
+                       _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
                                new geom.Rectangle2D.Float((float)dstRect.X,(float)dstRect.Y,(float)dstRect.Width,
                                (float)dstRect.Height));
                }
index ff2147bd2e690d360734a8f07c55aec13ae78c91..9737b48e1dcceb1825189a0dc9ef489eee389ac3 100644 (file)
@@ -114,22 +114,26 @@ namespace System.Drawing
                        Bitmap bitmap;
                        if (imageName == null)
                                imageName = t.Name + ".bmp";
-                       
-                       using (System.IO.Stream s = t.Assembly.GetManifestResourceStream (t.Namespace + "." + imageName)){
-                               if (s == null) {
-                                       return null;
-                               }
-                               else {
-                                       bitmap = new Bitmap (s, false);
+
+                       try {
+                               using (System.IO.Stream s = t.Assembly.GetManifestResourceStream (t.Namespace + "." + imageName)){
+                                       if (s == null) {
+                                               return null;
+                                       } else {
+                                               bitmap = new Bitmap (s, false);
+                                       }
                                }
+                               
+                               //FIXME: thrown too easily
+                               //if (bitmap.Width != 16 || bitmap.Height != 16)
+                               //      throw new Exception ("ToolboxBitmap must be 16x16 pixels");
+                               
+                               if (large)
+                                       return new Bitmap (bitmap, 32, 32);
+                               return bitmap;
+                       } catch {
+                               return null;
                        }
-                       
-                       //FIXME: thrown too easily
-                       //if (bitmap.Width != 16 || bitmap.Height != 16)
-                       //      throw new Exception ("ToolboxBitmap must be 16x16 pixels");
-                       
-                       if (large) return new Bitmap (bitmap, 32, 32);
-                       return bitmap;
                }
        }
 }
index bb0a7bcc04b75699af8ce60aef0759df8e3c3bc5..40e36825b7077cdb4929ced632fd142a4ffa4fb3 100644 (file)
 //
 
 using System.Runtime.InteropServices;
+using System.Security;
 
 namespace System.Drawing {
+
+       [SuppressUnmanagedCodeSecurity]
        internal class Carbon {
 
+               internal static CarbonContext GetCGContextForNSView (IntPtr hwnd) {
+                       IntPtr cgContext = IntPtr.Zero;
+
+                       cgContext = objc_msgSend (objc_msgSend (objc_getClass ("NSGraphicsContext"), sel_registerName ("currentContext")), sel_registerName ("graphicsPort"));
+                       HIRect rect = new HIRect ();
+                       objc_msgSend_stret (ref rect, hwnd, sel_registerName ("bounds"));
+                       return new CarbonContext (cgContext, (int)rect.size.width, (int)rect.size.height);
+               }
                internal static CarbonContext GetCGContextForView (IntPtr hwnd) {
                        IntPtr cgContext = IntPtr.Zero;
                        // Grab the window we're in
@@ -60,6 +71,19 @@ namespace System.Drawing {
                        Carbon.CGContextClipToRect (cgContext, rcClip);
                        return new CarbonContext (cgContext, (int)vBounds.size.width, (int)vBounds.size.height);
                }
+               #region Cocoa Methods
+               [DllImport("libobjc.dylib")]
+               public static extern IntPtr objc_getClass(string className); 
+               [DllImport("libobjc.dylib")]
+               public static extern IntPtr objc_msgSend(IntPtr basePtr, IntPtr selector, string argument);  
+               [DllImport("libobjc.dylib")]
+               public static extern IntPtr objc_msgSend(IntPtr basePtr, IntPtr selector);        
+               [DllImport("libobjc.dylib")]
+               public static extern void objc_msgSend_stret(ref HIRect arect, IntPtr basePtr, IntPtr selector);        
+               [DllImport("libobjc.dylib")]
+               public static extern IntPtr sel_registerName(string selectorName);         
+               #endregion
+
                [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
                 internal static extern int HIViewGetBounds (IntPtr vHnd, ref HIRect r);
                 [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
index 0bc169933ff973799072e2d3e39882b44d3d09d3..a8a80ddc13b3cf95ba83d89dc497f92a465ce6f1 100644 (file)
@@ -36,6 +36,7 @@ using System.Text;
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Drawing.Text;
+using System.Security;
 #if NET_2_0
 using System.Runtime.InteropServices.ComTypes;
 #else
@@ -47,6 +48,7 @@ namespace System.Drawing
        /// <summary>
        /// GDI+ API Functions
        /// </summary>
+       [SuppressUnmanagedCodeSecurity]
        internal class GDIPlus
        {
                public const int FACESIZE = 32;
@@ -54,6 +56,7 @@ namespace System.Drawing
                public static IntPtr Display = IntPtr.Zero;
                public static bool UseX11Drawable;
                public static bool UseQuartzDrawable = (Environment.GetEnvironmentVariable ("MONO_MWF_USE_QUARTZ_BACKEND") != null);
+               public static bool UseCocoaDrawable = (Environment.GetEnvironmentVariable ("MONO_GDIP_USE_COCOA_BACKEND") != null);
 
                #region gdiplus.dll functions
 
@@ -1093,6 +1096,12 @@ namespace System.Drawing
                
                [DllImport("gdiplus.dll")]              
                internal static extern Status GdipCreateHBITMAPFromBitmap (IntPtr bmp, out IntPtr HandleBmp, int clrbackground);
+
+               [DllImport("gdiplus.dll", CharSet=CharSet.Auto)]
+               internal static extern Status GdipCreateBitmapFromFile ([MarshalAs (UnmanagedType.LPWStr)] string filename, out IntPtr bitmap);
+
+               [DllImport("gdiplus.dll", CharSet=CharSet.Auto)]
+               internal static extern Status GdipCreateBitmapFromFileICM ([MarshalAs (UnmanagedType.LPWStr)] string filename, out IntPtr bitmap);
                
                [DllImport("gdiplus.dll")]
                internal static extern Status GdipCreateHICONFromBitmap (IntPtr bmp, out IntPtr HandleIcon);
index 15019fa84f88c6c822c755b9e108db64b8be0d17..e4a51043a85a4af2c60456cc142decd05ec0260e 100644 (file)
@@ -4,6 +4,8 @@ System.Drawing/TestBitmap.cs
 System.Drawing/TestBrushes.cs
 System.Drawing/TestColor.cs
 System.Drawing/TestFont.cs
+System.Drawing/TestGraphics.cs
+System.Drawing/TestImage.cs
 System.Drawing/TestPens.cs
 System.Drawing/TestPoint.cs
 System.Drawing/TestPointConverter.cs
@@ -33,3 +35,13 @@ System.Drawing.Imaging/TestColorMatrix.cs
 System.Drawing.Imaging/TestImageAttributes.cs
 System.Drawing.Printing/PrintingPermissionAttributeTest.cs
 System.Drawing.Printing/PrintingPermissionTest.cs
+System.Drawing/BitmapCas.cs
+System.Drawing/GraphicsCas.cs
+System.Drawing.Design/CategoryNameCollectionCas.cs
+System.Drawing.Design/PaintValueEventArgsCas.cs
+System.Drawing.Design/PropertyValueUIItemCas.cs
+System.Drawing.Design/ToolboxComponentsCreatedEventArgsCas.cs
+System.Drawing.Design/ToolboxComponentsCreatingEventArgsCas.cs
+System.Drawing.Design/ToolboxItemCas.cs
+System.Drawing.Design/ToolboxItemCollectionCas.cs
+System.Drawing.Design/UITypeEditorCas.cs
index c89b6c8748c3941910f81586ce5a7df7affca9ad..23dd6ba37d7d63c8f286a35a3547ba6ffb12e2f8 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-06 Boris Kirzner <borisk@mainsoft.com>
+
+       * Test.dotnet.csproj, Test.vmwcsproj: Added GraphicsPathIterator.cs.
+
 2005-08-16 Andrew Skiba <andrews@mainsoft.com>
 
        * Test.dotnet.csproj, Test.vmwcsproj: Embed Bitmap1.png, add Bitmap1.bmp
index 6108cc55ed65d31e112d1f38d66db91aea49ebf6..f162ebb2e61e01ba99e56b9941564540cbd57293 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-20 Vladimir Krasnov <vladimirk@mainsoft.com>\r
+\r
+       * DrawingTest.cs: Added Pixel Distance comparer PDCompare()\r
+       * Added PDComparer.cs\r
+\r
+2005-09-06 Boris Kirzner <borisk@mainsoft.com>\r
+       \r
+       * DrawingTest.cs: bug fix.\r
+\r
 2005-08-16 Vladimir Krasnov <vladimirk@mainsoft.com>\r
 \r
        * DrawingTest.cs: Added special tolerance feature\r
index 50050e465123b62011afbe38933951e5827a9328..f5504625c92b4eb72247dd59f96cb472549a2a89 100644 (file)
@@ -162,7 +162,7 @@ namespace DrawingTestHelper
        public abstract class DrawingTest {\r
 \r
                public const float DEFAULT_FLOAT_TOLERANCE = 1e-5f; \r
-               public const int DEFAULT_IMAGE_TOLERANCE = 3\r
+               public const int DEFAULT_IMAGE_TOLERANCE = 2\r
 \r
                Graphics _graphics;\r
                protected Bitmap _bitmap;\r
@@ -332,7 +332,7 @@ namespace DrawingTestHelper
 \r
                private static void AssertAlmostEqual (float expected, float actual, float tolerance, string message)\r
                {\r
-                       float error = System.Math.Abs (expected - actual) / (expected + actual + float.Epsilon);\r
+                       float error = System.Math.Abs ((expected - actual) / (expected + actual + float.Epsilon));\r
                        Assert.IsTrue (error < tolerance, message);\r
                }\r
 \r
@@ -343,15 +343,54 @@ namespace DrawingTestHelper
                        AssertAlmostEqual (expected.Y, actual.Y, DEFAULT_FLOAT_TOLERANCE, msg);\r
                }\r
 \r
+               /// <summary>\r
+               /// Checks that the given bitmap norm is similar to expected\r
+               /// </summary>\r
+               /// <param name="tolerance">tolerance in percents (0..100)</param>\r
+               /// <returns></returns>\r
+               /// \r
+               public bool Compare (double tolerance) {\r
+                       CheckCounter ();\r
+\r
+                       double error = CompareToExpectedInternal()*100;\r
+\r
+                       if (SpecialTolerance != null)\r
+                               return error <= GetSpecialTolerance(TestName);\r
+\r
+                       return error <= tolerance;\r
+               }\r
+\r
+               public bool PDCompare (double tolerance) {\r
+                       Bitmap ri = GetReferenceImage(TestName);\r
+                       if (ri == null)\r
+                               return true;\r
+\r
+                       double error = PDComparer.Compare(ri, _bitmap);\r
+                       return error <= tolerance;\r
+               }\r
+               \r
                public bool Compare () {\r
                        CheckCounter ();\r
+\r
                        double error = CompareToExpectedInternal()*100;\r
+                       \r
                        if (SpecialTolerance != null)\r
                                return error <= GetSpecialTolerance(TestName);\r
 \r
                        return error <= DEFAULT_IMAGE_TOLERANCE;\r
                }\r
 \r
+               public bool PDCompare () {\r
+                       Bitmap ri = GetReferenceImage(TestName);\r
+                       if (ri == null)\r
+                               return true;\r
+\r
+                       double error = PDComparer.Compare(ri, _bitmap);\r
+                       return error <= DEFAULT_IMAGE_TOLERANCE;\r
+               }\r
+\r
+               protected abstract Bitmap GetReferenceImage(string testName);\r
+\r
                protected double GetSpecialTolerance(string testName) {\r
                        try     {\r
                                string shortTestName = testName.Substring( testName.LastIndexOf(".") + 1 );\r
@@ -366,18 +405,6 @@ namespace DrawingTestHelper
                        }\r
                }\r
 \r
-               /// <summary>\r
-               /// Checks that the given bitmap norm is similar to expected\r
-               /// </summary>\r
-               /// <param name="tolerance">tolerance in percents (0..100)</param>\r
-               /// <returns></returns>\r
-               /// \r
-               public bool Compare (double tolerance) {\r
-                       CheckCounter ();\r
-                       double error = CompareToExpectedInternal()*100;\r
-                       return error <= tolerance;\r
-               }\r
-\r
                public void AssertCompare () {\r
                        CheckCounter ();\r
                        Assert.IsTrue ((CompareToExpectedInternal () * 100) < DEFAULT_IMAGE_TOLERANCE);\r
@@ -425,9 +452,17 @@ namespace DrawingTestHelper
                        get {\r
                                if (_image != null)\r
                                        return _image;\r
-                               Type imageType = typeof (Image);\r
-                               PropertyInfo prop = imageType.GetProperty ("NativeObject",\r
-                                       BindingFlags.NonPublic | BindingFlags.Instance);\r
+                               Type imageType = typeof (Bitmap);\r
+                               PropertyInfo [] props = imageType.GetProperties (\r
+                                       BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);\r
+\r
+                               PropertyInfo prop = null;\r
+                               foreach (PropertyInfo p in props) {\r
+                                       if (p.Name == "NativeObject")\r
+                                               if (p.PropertyType == typeof(java.awt.image.BufferedImage))\r
+                                                       prop = p;\r
+                               }\r
+\r
                                MethodInfo method = prop.GetGetMethod (true);\r
                                _image = (java.awt.image.BufferedImage) method.Invoke (_bitmap, new object [0]);\r
                                return _image;\r
@@ -440,6 +475,17 @@ namespace DrawingTestHelper
                        return ExpectedResults.GetNorm(TestName);\r
                }\r
 \r
+               protected override Bitmap GetReferenceImage(string testName) {\r
+                       try{\r
+                               string dotNetResultsFolder = @"..\Debug\";\r
+                               string fileName = dotNetResultsFolder + testName.Replace(":", "_") + ".png";\r
+                               return new Bitmap(fileName);\r
+                       }\r
+                       catch(System.Exception e) {\r
+                               throw new System.Exception("Error creating .Net reference image");\r
+                       }\r
+               }\r
+\r
                private class JavaForm:java.awt.Dialog,IMyForm {\r
                        class EventListener : java.awt.@event.WindowListener {\r
                                #region WindowListener Members\r
@@ -547,6 +593,17 @@ namespace DrawingTestHelper
                        return myNorm;\r
                }\r
 \r
+               protected override Bitmap GetReferenceImage(string testName) {\r
+                       try{\r
+                               string fileName = testName.Replace(":", "_") + ".png";\r
+                               _bitmap.Save( fileName );\r
+                               return null;\r
+                       }\r
+                       catch(System.Exception e) {\r
+                               throw new System.Exception("Error creating .Net reference image");\r
+                       }\r
+               }\r
+\r
                private class NetForm:Form,IMyForm {\r
                        Image image;\r
                        public NetForm(string title, Image anImage):base() {\r
@@ -591,4 +648,5 @@ namespace DrawingTestHelper
 \r
        }\r
 #endif\r
+\r
 }\r
diff --git a/mcs/class/System.Drawing/Test/DrawingTest/DrawingTestHelper/PDComparer.cs b/mcs/class/System.Drawing/Test/DrawingTest/DrawingTestHelper/PDComparer.cs
new file mode 100644 (file)
index 0000000..689a129
--- /dev/null
@@ -0,0 +1,109 @@
+using System;\r
+using System.Drawing;\r
+using System.Collections;\r
+\r
+namespace DrawingTestHelper\r
+{\r
+       /// <summary>\r
+       /// Summary description for PDComparer.\r
+       /// </summary>\r
+       public class PDComparer\r
+       {\r
+               static int SearchRectSize = 10;\r
+               static double [,] ltDistances = new double[SearchRectSize,SearchRectSize];\r
+\r
+\r
+               static PDComparer()\r
+               {\r
+                       for (int x = 0; x < SearchRectSize; x++)\r
+                               for (int y = 0; y < SearchRectSize; y++)\r
+                               {\r
+                                       ltDistances[x,y] = Math.Sqrt(x*x + y*y);\r
+                               }\r
+               }\r
+\r
+               public PDComparer()\r
+               {\r
+               }\r
+\r
+               public static double Compare(Bitmap b1, Bitmap b2)\r
+               {\r
+                       Point [] shapePoints = GetPointFromImage(b1);\r
+                       double [] pointsDistance = new double[ shapePoints.Length ];\r
+\r
+                       for (int i = 0; i < shapePoints.Length; i++)\r
+                       {\r
+                               pointsDistance[i] = DistanceToClosestPoint( shapePoints[i], b2 );\r
+                       }\r
+\r
+                       return Max( pointsDistance );\r
+               }\r
+\r
+               private static double DistanceToClosestPoint(Point p, Bitmap b)\r
+               {\r
+                       if (IsPixelExist( b.GetPixel(p.X, p.Y) ))\r
+                               return 0;\r
+\r
+                       Rectangle r = new Rectangle(\r
+                               p.X - SearchRectSize / 2,\r
+                               p.Y - SearchRectSize / 2,\r
+                               SearchRectSize,\r
+                               SearchRectSize);\r
+\r
+                       double min_distance = SearchRectSize;\r
+\r
+                       for (int x = r.X; x < r.X + SearchRectSize; x++)\r
+                               for (int y = r.Y; y < r.Y + SearchRectSize; y++)\r
+                                       if ((x < b.Width) && (y < b.Height) && (x >= 0) && (y >= 0))\r
+                                       {\r
+                                               if ( IsPixelExist( b.GetPixel(x, y) ) )\r
+                                               {\r
+                                                       double d = CalculateDistance(p.X, p.Y, x, y);\r
+                                                       if (d < min_distance)\r
+                                                               min_distance = d;\r
+                                               }\r
+                                       }\r
+\r
+                       return min_distance;\r
+               }\r
+\r
+               private static double CalculateDistance(Point a, Point b)\r
+               {\r
+                       return CalculateDistance(a.X, a.Y, b.X, b.Y);\r
+               }\r
+\r
+               private static double CalculateDistance(int x1, int y1, int x2, int y2)\r
+               {\r
+                       int delta_x = Math.Abs(x2 - x1);\r
+                       int delta_y = Math.Abs(y2 - y1);\r
+                       return ltDistances[delta_x, delta_y];\r
+               }\r
+\r
+               private static double Max(double [] a)\r
+               {\r
+                       double max = 0;\r
+\r
+                       for (int i = 0; i < a.Length; i++)\r
+                               if (a[i] > max)\r
+                                       max = a[i];\r
+                       return max;\r
+               }\r
+               \r
+               private static Point [] GetPointFromImage(Bitmap b)\r
+               {\r
+                       ArrayList points = new ArrayList();\r
+                       \r
+                       for(int x = 0; x < b.Width; x++)\r
+                               for(int y = 0; y < b.Height; y++)\r
+                                       if (IsPixelExist ( b.GetPixel(x, y) ))\r
+                                               points.Add( new Point(x, y) );\r
+\r
+                       return (Point [])points.ToArray( typeof(Point) );\r
+               }\r
+\r
+               private static bool IsPixelExist(Color c)\r
+               {\r
+                       return c.A > 0;\r
+               }\r
+       }\r
+}\r
index baed0d0c024887d21d890027af17dbcb0d1a279e..a18259790d71bab91af642e3af7e33270c34559c 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-20 Vladimir Krasnov <vladimirk@mainsoft.com>\r
+       \r
+       * Graphics.cs: Added tests for DrawImage, fixed use pixel distance comparer\r
+\r
+2005-09-10 Konstnatin Triger <kostat@mainsoft.com>\r
+\r
+        * Graphics.cs: Added test for Clipping\r
+\r
+2005-09-07 Boris Kirzner <borisk@mainsoft.com>\r
+       * GraphicsPath.cs: Added another PathData test..\r
+\r
+2005-09-06 Boris Kirzner <borisk@mainsoft.com>\r
+       * GraphicsPathIterator.cs: added.\r
+       * GraphicsPath.cs: Changed tests. Added NotWorking for the tests that\r
+       should fail in TARGET_JVM.\r
+\r
 2005-08-25 Vladimir Krasnov <vladimirk@mainsoft.com>\r
        \r
        * Graphics.cs: Added tests for Graphics.Begin/EndContaioner, \r
index bbbe24dce2ce440aab0baf51f71990b993a76a02..f907e84cbf71ccaaf60f5ab3d54c73ec451214fa 100644 (file)
@@ -90,7 +90,57 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw lines between original points to screen.\r
                        t.Graphics.DrawLines(redPen, curvePoints);\r
                        t.Show ();\r
-                       Assert.IsTrue(t.Compare(TOLERANCE));\r
+                       Assert.IsTrue(t.PDCompare(TOLERANCE));\r
+               }\r
+\r
+               [Test]\r
+               public void ClipTest_3() {\r
+                       t.Graphics.TranslateTransform(3, 3);\r
+                       t.Graphics.SetClip(new Rectangle(23, 24, 30, 40));\r
+\r
+                       RectangleF cb = t.Graphics.VisibleClipBounds;\r
+                       DrawingTest.AssertAlmostEqual(23, cb.X);\r
+                       DrawingTest.AssertAlmostEqual(24, cb.Y);\r
+                       DrawingTest.AssertAlmostEqual(30, cb.Width);\r
+                       DrawingTest.AssertAlmostEqual(40, cb.Height);\r
+\r
+                       t.Graphics.PageUnit = GraphicsUnit.Millimeter;\r
+\r
+                       cb = t.Graphics.VisibleClipBounds;\r
+                       DrawingTest.AssertAlmostEqual(23, cb.X);\r
+                       DrawingTest.AssertAlmostEqual(24, cb.Y);\r
+                       DrawingTest.AssertAlmostEqual(30, cb.Width);\r
+                       DrawingTest.AssertAlmostEqual(40, cb.Height);\r
+\r
+                       t.Graphics.RotateTransform(128);\r
+\r
+                       t.Graphics.TranslateTransform(14, 14);\r
+                       t.Graphics.ExcludeClip(new Rectangle(0, 0, 4, 60));\r
+\r
+                       \r
+                       t.Graphics.RotateTransform(128);\r
+                       \r
+                       t.Graphics.PageUnit = GraphicsUnit.Pixel;\r
+                       \r
+                       t.Graphics.TranslateClip(5.2f, 3.1f);\r
+\r
+                       t.Graphics.ResetTransform();\r
+                       t.Graphics.PageUnit = GraphicsUnit.Pixel;\r
+\r
+                       cb = t.Graphics.VisibleClipBounds;\r
+                       DrawingTest.AssertAlmostEqual(28, cb.X);\r
+                       DrawingTest.AssertAlmostEqual(22, cb.Y);\r
+                       DrawingTest.AssertAlmostEqual(30, cb.Width);\r
+                       DrawingTest.AssertAlmostEqual(40, cb.Height);\r
+                       \r
+                       t.Graphics.ScaleTransform(5, 7);\r
+                       t.Graphics.IntersectClip(new Rectangle(7, 4, 20, 20));\r
+\r
+                       cb = t.Graphics.VisibleClipBounds;\r
+                       DrawingTest.AssertAlmostEqual(7, cb.X);\r
+                       DrawingTest.AssertAlmostEqual(4f, cb.Y);\r
+                       DrawingTest.AssertAlmostEqual(4.6f, cb.Width);\r
+                       DrawingTest.AssertAlmostEqual(4.85714245f, cb.Height);\r
                }\r
 \r
                [Test]\r
@@ -129,7 +179,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Graphics.DrawImage(b, 300, 300);\r
 \r
                        t.Show ();\r
-                       Assert.IsTrue(t.Compare(TOLERANCE));\r
+                       Assert.IsTrue(t.PDCompare(TOLERANCE));\r
                }\r
 \r
                [Test] //TBD\r
@@ -233,6 +283,108 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
 \r
        #endregion\r
 \r
+       #region DrawImage\r
+       [TestFixture]\r
+       public class DrawImage {\r
+               protected DrawingTest t;\r
+               protected int TOLERANCE = 10; //in %;\r
+               protected Hashtable st = new Hashtable();\r
+\r
+               Rectangle src = new Rectangle(0, 0, 50, 50);\r
+               RectangleF srcF = new Rectangle(0, 0, 50, 50);\r
+               Rectangle dst = new Rectangle(170, 170, 100, 100);\r
+               RectangleF dstF = new Rectangle(270, 270, 100, 100);\r
+\r
+               Image bmp;\r
+\r
+               [SetUp]\r
+               public virtual void SetUp() {\r
+                       SetUp("DrawImage");\r
+                       DrawingTest.ShowForms = false;\r
+                       try {\r
+                               bmp = Bitmap.FromFile(@"..\..\bitmap50.png");\r
+                       }\r
+                       catch(Exception e) {\r
+                               Console.WriteLine(e.Message);\r
+                       }\r
+               }\r
+               public virtual void SetUp(string ownerClass) {\r
+                       t = DrawingTest.Create(512, 512, ownerClass);\r
+                       t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;\r
+\r
+                       // hashtable of differents tolerance values for specified tests.\r
+               }\r
+               [TearDown]\r
+               public void TearDown() {\r
+               }\r
+\r
+               [Test]\r
+               public void DrawImage1() {\r
+                       t.Graphics.DrawImage(bmp, new Point[]{new Point(170,10), new Point(250,0), new Point(100,100)}, src, GraphicsUnit.Pixel );\r
+                       t.Graphics.DrawImage(bmp, new PointF[]{new PointF(70,10), new PointF(150,0), new PointF(10,100)}, srcF, GraphicsUnit.Pixel );\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage2() {\r
+                       t.Graphics.DrawImage(bmp, dst, src, GraphicsUnit.Pixel);\r
+                       t.Graphics.DrawImage(bmp, dstF, srcF, GraphicsUnit.Pixel);\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage3() {\r
+                       t.Graphics.DrawImage(bmp, 10.0F, 10.0F, srcF, GraphicsUnit.Pixel);\r
+                       t.Graphics.DrawImage(bmp, 70.0F, 150.0F, 250.0F, 150.0F);\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage4() {\r
+                       t.Graphics.DrawImage(bmp, dst);\r
+                       t.Graphics.DrawImage(bmp, dstF);\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage5() {\r
+                       t.Graphics.SetClip( new Rectangle(70, 0, 20, 200));\r
+                       t.Graphics.DrawImage(bmp, new Point[]{new Point(50,50), new Point(250,30), new Point(100,150)}, src, GraphicsUnit.Pixel );\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage6() {\r
+                       t.Graphics.ScaleTransform(2, 2);\r
+                       t.Graphics.SetClip( new Rectangle(70, 0, 20, 200));\r
+                       t.Graphics.DrawImage(bmp, new Point[]{new Point(50,50), new Point(250,30), new Point(100,150)}, src, GraphicsUnit.Pixel );\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage7() {\r
+                       t.Graphics.DrawImage(bmp, 170, 70, src, GraphicsUnit.Pixel);\r
+                       t.Graphics.DrawImage(bmp, 70, 350, 350, 150);\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage8() {\r
+                       t.Graphics.DrawImage(bmp, new Point[]{new Point(170,10), new Point(250,10), new Point(100,100)} );\r
+                       t.Graphics.DrawImage(bmp, new PointF[]{new PointF(170,100), new PointF(250,100), new PointF(100,190)} );\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+               [Test]\r
+               public void DrawImage9() {\r
+                       t.Graphics.DrawImage(bmp, 0, 0);\r
+                       t.Graphics.DrawImage(bmp, 200, 200);\r
+                       t.Show();\r
+                       Assert.IsTrue(t.Compare());\r
+               }\r
+       }\r
+       #endregion\r
+\r
        #region GraphicsFixture\r
        /// <summary>\r
        /// Summary description for Graphics.\r
@@ -285,17 +437,17 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill untransformed rectangle with green.\r
                        t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0.0F, 0.0F, 200.0F, 200.0F);\r
                        t.Show ();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
                public void ClearTest() {\r
                        // Clear screen with teal background.\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        t.Graphics.Clear(Color.Teal);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -313,25 +465,25 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw arc to screen.\r
                        t.Graphics.DrawArc(blackPen, (int)x, (int)y, (int)width, (int)height, (int)startAngle, (int)sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
                        startAngle =  10.0F;\r
                        sweepAngle = 120.0F;\r
                        t.Graphics.DrawArc(blackPen, new Rectangle((int)x, (int)y, (int)width, (int)height), startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
                        startAngle =  10.0F;\r
                        sweepAngle = 190.0F;\r
                        t.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
                        startAngle =  10.0F;\r
                        sweepAngle = 300.0F;\r
                        t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -353,21 +505,21 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                                controlX2, controlY2,\r
                                endX, endY);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
                        t.Graphics.DrawBezier(blackPen, new PointF( startX, startY),\r
                                new PointF(controlX1, controlY1),\r
                                new PointF(controlX2, controlY2),\r
                                new PointF(endX, endY));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
                        t.Graphics.DrawBezier(blackPen, new Point((int)startX, (int)startY),\r
                                new Point((int)controlX1, (int)controlY1),\r
                                new Point((int)controlX2, (int)controlY2),\r
                                new Point((int)endX, (int)endY));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -389,7 +541,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw arc to screen.\r
                        t.Graphics.DrawBeziers(blackPen, bezierPoints);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        PointF startF = new PointF(100.0F, 100.0F);\r
@@ -406,7 +558,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw arc to screen.\r
                        t.Graphics.DrawBeziers(blackPen, bezierPointsF);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -439,14 +591,14 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw closed curve to screen.\r
                        t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        aFillMode = FillMode.Winding;\r
                        // Draw closed curve to screen.\r
                        t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -480,17 +632,17 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw curve to screen.\r
                        t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawCurve(greenPen, curvePoints, tension);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawCurve(greenPen, curvePoints);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -524,22 +676,22 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw curve to screen.\r
                        t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawCurve(greenPen, curvePoints, tension);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawCurve(greenPen, curvePoints);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -554,12 +706,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw ellipse to screen.\r
                        t.Graphics.DrawEllipse(blackPen, x, y, width, height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawEllipse(blackPen, new Rectangle(x, y, width, height));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -574,12 +726,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw ellipse to screen.\r
                        t.Graphics.DrawEllipse(blackPen, x, y, width, height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawEllipse(blackPen, new RectangleF(x, y, width, height));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                static string getInFile (string file) {\r
@@ -609,11 +761,11 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw icon to screen.\r
                        t.Graphics.DrawIcon(newIcon, x, y);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
 \r
                        t.Graphics.DrawIcon(newIcon, new Rectangle(200, 300, 125, 345));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -629,7 +781,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw icon to screen.\r
                        t.Graphics.DrawIconUnstretched(newIcon, rect);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 #if INTPTR_SUPPORTED\r
                // Define DrawImageAbort callback method.\r
@@ -697,22 +849,22 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw image to screen.\r
                        t.Graphics.DrawImageUnscaled(newImage, x, y, 100, 125);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawImageUnscaled(newImage, new Rectangle(x, y, 34, 235));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawImageUnscaled(newImage, x, y);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawImageUnscaled(newImage, new Point(x, y));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -727,12 +879,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw line to screen.\r
                        t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawLine(blackPen, new Point( x1, y1), new Point( x2, y2));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -747,12 +899,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw line to screen.\r
                        t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawLine(blackPen, new PointF( x1, y1), new PointF( x2, y2));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -769,7 +921,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        //Draw lines to screen.\r
                        t.Graphics.DrawLines(pen, points);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -786,7 +938,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        //Draw lines to screen.\r
                        t.Graphics.DrawLines(pen, points);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -799,7 +951,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw graphics path to screen.\r
                        t.Graphics.DrawPath(blackPen, graphPath);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -817,12 +969,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw pie to screen.\r
                        t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawPie(blackPen, new RectangleF( x, y, width, height), startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -840,12 +992,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw pie to screen.\r
                        t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawPie(blackPen, new Rectangle( x, y, width, height), startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -872,7 +1024,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw polygon to screen.\r
                        t.Graphics.DrawPolygon(blackPen, curvePoints);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare()); // .NET's lines of polygon is more wide\r
+                       Assert.IsTrue(t.PDCompare()); // .NET's lines of polygon is more wide\r
                }\r
 \r
                [Test]\r
@@ -899,7 +1051,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw polygon to screen.\r
                        t.Graphics.DrawPolygon(blackPen, curvePoints);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -914,17 +1066,17 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rectangle to screen.\r
                        t.Graphics.DrawRectangle(blackPen, x, y, width, height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawRectangle(blackPen, (int)x, (int)y, (int)width, (int)height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.DrawRectangle(blackPen, new Rectangle( (int)x, (int)y, (int)width, (int)height));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -940,7 +1092,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rectangles to screen.\r
                        t.Graphics.DrawRectangles(blackPen, rects);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -956,7 +1108,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rectangles to screen.\r
                        t.Graphics.DrawRectangles(blackPen, rects);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test] //TBD: add more combinations\r
@@ -975,21 +1127,21 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw string to screen.\r
                        t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare()); // in .net the font is shmoothed\r
+                       Assert.IsTrue(t.PDCompare()); // in .net the font is shmoothed\r
                        SetUp();\r
 \r
                        drawFormat.FormatFlags = StringFormatFlags.NoClip;\r
                        // Draw string to screen.\r
                        t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        drawFormat.FormatFlags = StringFormatFlags.FitBlackBox;\r
                        // Draw string to screen.\r
                        t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1006,7 +1158,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill untransformed rectangle with green.\r
                        t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test] //TBD\r
@@ -1022,7 +1174,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill large rectangle to show clipping region.\r
                        t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1042,17 +1194,17 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill curve on screen.\r
                        t.Graphics.FillClosedCurve(redBrush, points);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillClosedCurve(redBrush, points, newFillMode);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        newFillMode = FillMode.Alternate;\r
                        t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        t.Show();\r
                }\r
 \r
@@ -1073,18 +1225,18 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill curve on screen.\r
                        t.Graphics.FillClosedCurve(redBrush, points);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillClosedCurve(redBrush, points, newFillMode);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        newFillMode = FillMode.Alternate;\r
                        t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1099,12 +1251,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill ellipse on screen.\r
                        t.Graphics.FillEllipse(redBrush, x, y, width, height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillEllipse(redBrush, new Rectangle( x, y, width, height));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1119,12 +1271,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill ellipse on screen.\r
                        t.Graphics.FillEllipse(redBrush, x, y, width, height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillEllipse(redBrush, new RectangleF( x, y, width, height));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1137,7 +1289,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill graphics path to screen.\r
                        t.Graphics.FillPath(redBrush, graphPath);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1155,17 +1307,17 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill pie to screen.\r
                        t.Graphics.FillPie(redBrush, new Rectangle(x, y, width, height), startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillPie(redBrush, x, y, width, height, (int)startAngle, (int)sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillPie(redBrush, (float)x, (float)y, (float)width, (float)height, startAngle, sweepAngle);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1193,17 +1345,17 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill polygon to screen.\r
                        t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillPolygon(blueBrush, curvePoints);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1231,17 +1383,17 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill polygon to screen.\r
                        t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillPolygon(blueBrush, curvePoints);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1256,12 +1408,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill rectangle to screen.\r
                        t.Graphics.FillRectangle(blueBrush, x, y, width, height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillRectangle(blueBrush, new Rectangle( x, y, width, height));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1276,12 +1428,12 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill rectangle to screen.\r
                        t.Graphics.FillRectangle(blueBrush, x, y, width, height);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                        SetUp();\r
 \r
                        t.Graphics.FillRectangle(blueBrush, new RectangleF( x, y, width, height));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1297,7 +1449,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill rectangles to screen.\r
                        t.Graphics.FillRectangles(blueBrush, rects);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1313,7 +1465,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill rectangles to screen.\r
                        t.Graphics.FillRectangles(blueBrush, rects);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1327,7 +1479,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill region to screen.\r
                        t.Graphics.FillRegion(blueBrush, fillRegion);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1357,7 +1509,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Show();\r
                        t.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1384,7 +1536,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                                t.Show();\r
                        }\r
 \r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1436,7 +1588,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                                new Pen(Color.Blue, 1),\r
                                Rectangle.Round(measureRect2));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test] //TBD: add more overloads\r
@@ -1485,7 +1637,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                                Brushes.Black,\r
                                new PointF(100, 0));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1503,7 +1655,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rotated, translated ellipse.\r
                        t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1521,7 +1673,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rotated, translated ellipse.\r
                        t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1539,7 +1691,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rotated, translated ellipse.\r
                        t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1558,7 +1710,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);\r
                        t.Graphics.DrawRectangle(new Pen(Color.Red), Rectangle.Round(intersectRectF));\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1575,7 +1727,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Graphics.Restore(transState);\r
                        t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 100, 100);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1587,7 +1739,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw translated, rotated ellipse to screen.\r
                        t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1599,7 +1751,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw translated, rotated ellipse to screen.\r
                        t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());  // Line width problem\r
+                       Assert.IsTrue(t.PDCompare());  // Line width problem\r
                }\r
 \r
                [Test]\r
@@ -1611,7 +1763,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rotated, scaled rectangle to screen.\r
                        t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare()); // Line width problem\r
+                       Assert.IsTrue(t.PDCompare()); // Line width problem\r
                }\r
 \r
                [Test]\r
@@ -1623,7 +1775,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rotated, scaled rectangle to screen.\r
                        t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test] //TBD: add more combination\r
@@ -1635,7 +1787,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill rectangle to demonstrate clip region.\r
                        t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1660,7 +1812,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                                points[0],\r
                                points[1]);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1676,7 +1828,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Fill rectangle to demonstrate translated clip region.\r
                        t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1688,7 +1840,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rotated, translated ellipse to screen.\r
                        t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare()); // Line width problem\r
+                       Assert.IsTrue(t.PDCompare()); // Line width problem\r
                }\r
 \r
                [Test]\r
@@ -1700,7 +1852,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        // Draw rotated, translated ellipse to screen.\r
                        t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);\r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1728,7 +1880,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Graphics.DrawLine(Pens.Yellow, 10, 70, 70, 10);\r
 \r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
@@ -1747,7 +1899,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Graphics.DrawLine(Pens.Green, 10, 70, 70, 10);\r
 \r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
                [Test]\r
                public void TransfromPageScaleUnits_3() {\r
@@ -1777,7 +1929,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);\r
 \r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
        }\r
 \r
@@ -2126,7 +2278,7 @@ namespace Test.Sys.Drawing.GraphicsFixtures {
                        t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );\r
 \r
                        t.Show();\r
-                       Assert.IsTrue(t.Compare());\r
+                       Assert.IsTrue(t.PDCompare());\r
                }\r
 \r
                [Test]\r
index 9450ca7e56a7ff4fff9f33294ebe50b7b7d28672..3663bebea55e4ab56f471270c6da6481c689c2df 100644 (file)
@@ -176,6 +176,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddArc_Rectangle_Float_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -238,6 +241,9 @@ namespace Test.Sys.Drawing
 \r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddArc_RectangleF_Float_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -300,6 +306,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddArc_Int_Int_Int_Int_Float_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -363,6 +372,9 @@ namespace Test.Sys.Drawing
 \r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddArc_Float_Float_Float_Float_Float_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -1938,6 +1950,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddPie_Rectangle_Float_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -2004,6 +2019,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddPie_Int_Int_Int_Int_Float_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -2070,6 +2088,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddPie_Float_Float_Float_Float_Float_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -2406,6 +2427,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddString_String_FontFamily_Int_Float_Point_StringFormat()\r
                {\r
                        path = new GraphicsPath();\r
@@ -2427,6 +2451,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddString_String_FontFamily_Int_Float_PointF_StringFormat()\r
                {\r
                        path = new GraphicsPath();\r
@@ -2448,6 +2475,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddString_String_FontFamily_Int_Float_Rectangle_StringFormat()\r
                {\r
                        path = new GraphicsPath();\r
@@ -2469,6 +2499,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void AddString_String_FontFamily_Int_Float_RectangleFF_StringFormat()\r
                {\r
                        path = new GraphicsPath();\r
@@ -2752,6 +2785,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Flatten()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -2961,6 +2997,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Flatten_Matrix()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -3280,6 +3319,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Flatten_Matrix_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -3539,19 +3581,25 @@ namespace Test.Sys.Drawing
                        path.AddLine (new Point (400, 400), new Point (400, 10));\r
 \r
                        Matrix matrix = new Matrix ();\r
-                       matrix.Scale (1.2f,1.3f);\r
-                       matrix.Shear (1.5f, 1.9f);\r
+                       matrix.Scale (0.2f,0.3f);\r
+                       matrix.Shear (0.5f, 0.5f);\r
 \r
                        Pen p = new Pen (Color.AliceBlue, 45);\r
 \r
                        RectangleF actual = path.GetBounds (matrix, p);\r
                        RectangleF expected = new RectangleF (21f, 31.2f, 2758.363f, 3046.163f);\r
 \r
-                       DrawingTest.AssertAlmostEqual(expected.X, actual.X);\r
-                       DrawingTest.AssertAlmostEqual(expected.Y, actual.Y);\r
-                       DrawingTest.AssertAlmostEqual(expected.Width, actual.Width);\r
-                       DrawingTest.AssertAlmostEqual(expected.Height, actual.Height);\r
+                       // we do not know exacly how the bounding rectangle \r
+                       // is calculated so we just want to obtain bounds\r
+                       // that still contain the path widened by oen and transformed by matrix\r
+                       path.Widen (p, matrix);\r
+                       RectangleF widened = path.GetBounds ();\r
+                       Assert.IsTrue (actual.Contains (widened));\r
 \r
+//                     DrawingTest.AssertAlmostEqual(expected.X, actual.X);\r
+//                     DrawingTest.AssertAlmostEqual(expected.Y, actual.Y);\r
+//                     DrawingTest.AssertAlmostEqual(expected.Width, actual.Width);\r
+//                     DrawingTest.AssertAlmostEqual(expected.Height, actual.Height);\r
 \r
                        path = new GraphicsPath ();\r
                        path.AddLine (new Point (100, 100), new Point (400, 100));\r
@@ -3572,10 +3620,17 @@ namespace Test.Sys.Drawing
                        actual = path.GetBounds (matrix, p);\r
                        expected = new RectangleF (21f, 31.2f, 2758.363f, 3046.163f);\r
 \r
-                       DrawingTest.AssertAlmostEqual(expected.X, actual.X);\r
-                       DrawingTest.AssertAlmostEqual(expected.Y, actual.Y);\r
-                       DrawingTest.AssertAlmostEqual(expected.Width, actual.Width);\r
-                       DrawingTest.AssertAlmostEqual(expected.Height, actual.Height);\r
+                       // we do not know exacly how the bounding rectangle \r
+                       // is calculated so we just want to obtain bounds\r
+                       // that still contain the path widened by oen and transformed by matrix\r
+                       path.Widen (p, matrix);\r
+                       widened = path.GetBounds ();\r
+                       Assert.IsTrue (actual.Contains (widened));\r
+\r
+//                     DrawingTest.AssertAlmostEqual(expected.X, actual.X);\r
+//                     DrawingTest.AssertAlmostEqual(expected.Y, actual.Y);\r
+//                     DrawingTest.AssertAlmostEqual(expected.Width, actual.Width);\r
+//                     DrawingTest.AssertAlmostEqual(expected.Height, actual.Height);\r
 \r
                        //t.AssertCompare ();\r
                }\r
@@ -3613,6 +3668,15 @@ namespace Test.Sys.Drawing
                        //t.AssertCompare ();\r
                }\r
 \r
+               [Test]\r
+               [ExpectedException (typeof (ArgumentException))]\r
+               public void GetLastPoint2()\r
+               {\r
+                       path = new GraphicsPath ();\r
+                       \r
+                       PointF actual = path.GetLastPoint ();           \r
+               }\r
+\r
                [Test]\r
                public void IsOutlineVisible_Float_Float_Pen()\r
                {\r
@@ -3636,16 +3700,6 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (313f, 313f, pen));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new PointF (0f, 0f), pen));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (new PointF (40f, 40f), pen));\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new PointF (311f, 290f), pen));\r
-\r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -3673,16 +3727,6 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (new PointF (313f, 313f), pen));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new PointF (0f, 0f), pen));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (new PointF (40f, 40f), pen));\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new PointF (311f, 290f), pen));\r
-\r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -3712,16 +3756,6 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (313f, 313f, pen, gr));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (0f, 0f, pen, gr));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (40f, 40f, pen, gr));\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (311f, 290f, pen, gr));\r
-\r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -3751,16 +3785,6 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (new PointF (313f, 313f), pen, gr));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new PointF (0f, 0f), pen, gr));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (new PointF (40f, 40f), pen, gr));\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new PointF (311f, 290f), pen, gr));\r
-\r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -3788,16 +3812,6 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (313, 313, pen));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (0, 0, pen));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (40, 40, pen));\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (311, 290, pen));\r
-\r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -3825,16 +3839,6 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (new Point (313, 313), pen));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new Point (0, 0), pen));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (new Point (40, 40), pen));\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new Point (311, 290), pen));\r
-\r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -3864,16 +3868,6 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (313, 313, pen, gr));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (0, 0, pen, gr));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (40, 40, pen, gr));\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (311, 290, pen, gr));\r
-\r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -3903,15 +3897,11 @@ namespace Test.Sys.Drawing
 \r
                        Assert.IsFalse (path.IsOutlineVisible (new Point (313, 313), pen, gr));\r
 \r
-                       pen = new Pen (Color.Red, 20);\r
-                       pen.DashStyle = DashStyle.Dash;\r
-                       pen.DashCap = DashCap.Round;\r
-\r
-                       Assert.IsTrue (path.IsOutlineVisible (new Point (0, 0), pen, gr));\r
-\r
-                       Assert.IsFalse (path.IsOutlineVisible (new Point (40, 40), pen, gr));\r
+                       Assert.IsTrue (path.IsOutlineVisible (new Point (310, 10), pen, gr));\r
+                       Assert.IsTrue (path.IsOutlineVisible (new Point (310, 10), pen, null));\r
 \r
-                       Assert.IsTrue (path.IsOutlineVisible (new Point (311, 290), pen, gr));\r
+                       Assert.IsTrue (path.IsOutlineVisible (new Point (310, 210), pen, gr));\r
+                       Assert.IsTrue (path.IsOutlineVisible (new Point (310, 210), pen, null));\r
 \r
                        //t.AssertCompare ();\r
                }\r
@@ -4159,6 +4149,118 @@ namespace Test.Sys.Drawing
                        //t.AssertCompare ();\r
                }\r
 \r
+               [Test]\r
+               public void PathData ()\r
+               {\r
+                       path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       PointF [] expectedPoints = new PointF [] {      new PointF(100f, 100f), \r
+                                                                                                               new PointF(400f, 100f), \r
+                                                                                                               new PointF(400f, 200f), \r
+                                                                                                               new PointF(10f, 100f), \r
+                                                                                                               new PointF(10f, 10f), \r
+                                                                                                               new PointF(50f, 250f), \r
+                                                                                                               new PointF(100f, 5f), \r
+                                                                                                               new PointF(200f, 280f), \r
+                                                                                                               new PointF(10f, 20f), \r
+                                                                                                               new PointF(310f, 20f), \r
+                                                                                                               new PointF(310f, 420f), \r
+                                                                                                               new PointF(10f, 420f), \r
+                                                                                                               new PointF(400f, 400f), \r
+                                                                                                               new PointF(400f, 10f)};\r
+                       \r
+                       for(int i = 0; i < path.PointCount; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], path.PathPoints [i]);\r
+                       }\r
+\r
+                       byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) (PathPointType.Bezier3 | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], path.PathTypes [i]);\r
+                       }\r
+\r
+\r
+                       path = new GraphicsPath ();\r
+                       path.AddEllipse (0, 0, 100, 200);\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (100, 100), new Point (200, 100));\r
+                       Rectangle rect = new Rectangle (200, 0, 100, 200);\r
+                       path.AddRectangle (rect);\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (250, 200), new Point (250, 300));\r
+                       path.SetMarkers ();\r
+\r
+                       expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                       (byte) (PathPointType.Bezier3 | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                       (byte) PathPointType.Start, \r
+                                                                                       (byte) PathPointType.Line, \r
+                                                                                       (byte) PathPointType.Start, \r
+                                                                                       (byte) PathPointType.Line, \r
+                                                                                       (byte) PathPointType.Line, \r
+                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                       (byte) PathPointType.Start, \r
+                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker) };\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], path.PathTypes [i]);\r
+                       }       \r
+               }\r
+\r
+               [Test]\r
+               public void PathData2 ()\r
+               {\r
+                       path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+\r
+                       byte [] types = path.PathTypes;\r
+                       PointF [] points = path.PathPoints;\r
+\r
+                       types [1] = 88;\r
+                       points [1] = new PointF (-88, -88);\r
+\r
+                       Assert.AreEqual ( 88, types [1]);\r
+                       DrawingTest.AssertAlmostEqual ( new PointF (-88,-88), points [1]);\r
+\r
+                       Assert.AreEqual ( 1, path.PathData.Types [1]);\r
+                       DrawingTest.AssertAlmostEqual ( new PointF (400,100), path.PathData.Points [1]);\r
+               }\r
+\r
                [Test]\r
                public void Reset()\r
                {\r
@@ -4188,23 +4290,31 @@ namespace Test.Sys.Drawing
                {\r
                        path = new GraphicsPath ();\r
                        path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.SetMarkers ();\r
                        path.AddLine (new Point (400, 200), new Point (10, 100));\r
 \r
+                       path.SetMarkers ();\r
                        path.StartFigure ();\r
                        path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.SetMarkers ();\r
                        path.StartFigure ();\r
                        path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
 \r
                        path.StartFigure ();\r
                        path.AddLine (new Point (400, 400), new Point (400, 10));\r
-\r
+                       path.AddLine (new Point (400, 450), new Point (500, 510));\r
+                       path.SetMarkers ();\r
+                       path.CloseFigure ();\r
+                       \r
                        path.Reverse ();\r
 \r
-                       PointF [] expectedPoints = new PointF [] {      new PointF(400f, 10f), \r
+                       PointF [] expectedPoints = new PointF [] {      new PointF(500f, 510f), \r
+                                                                                                               new PointF(400f, 450f), \r
+                                                                                                               new PointF(400f, 10f), \r
                                                                                                                new PointF(400f, 400f), \r
                                                                                                                new PointF(10f, 420f), \r
                                                                                                                new PointF(310f, 420f), \r
-                                                                                                               new PointF(310f, 20f), \r
+                                                                                                               new PointF(310f, 20f),\r
                                                                                                                new PointF(10f, 20f), \r
                                                                                                                new PointF(200f, 280f), \r
                                                                                                                new PointF(100f, 5f), \r
@@ -4214,6 +4324,8 @@ namespace Test.Sys.Drawing
                                                                                                                new PointF(400f, 200f), \r
                                                                                                                new PointF(400f, 100f), \r
                                                                                                                new PointF(100f, 100f)};\r
+\r
+                       \r
                        \r
                        for(int i = 0; i < path.PointCount; i++) {\r
                                DrawingTest.AssertAlmostEqual(expectedPoints [i], path.PathPoints [i]);\r
@@ -4221,23 +4333,103 @@ namespace Test.Sys.Drawing
 \r
                        byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
                                                                                                        (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath), \r
                                                                                                        (byte) PathPointType.Start, \r
                                                                                                        (byte) PathPointType.Line, \r
                                                                                                        (byte) PathPointType.Line, \r
-                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath), \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) (PathPointType.Bezier3 | PathPointType.PathMarker), \r
                                                                                                        (byte) PathPointType.Start, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], path.PathTypes [i]);\r
+                       }       \r
+                       \r
+                       //t.AssertCompare ();\r
+               }\r
+\r
+               [Test]\r
+               public void Reverse2()\r
+               {\r
+                       path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+\r
+                       path.SetMarkers ();\r
+                       path.StartFigure ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.SetMarkers ();\r
+                       path.StartFigure ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+                       path.AddBezier( 100, 100, 500, 250, 150, 500, 250, 300);\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 450), new Point (500, 510));\r
+                       path.SetMarkers ();\r
+                       path.CloseFigure ();\r
+\r
+                       path.Reverse ();\r
+\r
+                       PointF [] expectedPoints = new PointF [] {      new PointF(500f, 510f), \r
+                                                                                                               new PointF(400f, 450f), \r
+                                                                                                               new PointF(250f, 300f), \r
+                                                                                                               new PointF(150f, 500f), \r
+                                                                                                               new PointF(500f, 250f), \r
+                                                                                                               new PointF(100f, 100f), \r
+                                                                                                               new PointF(400f, 10f), \r
+                                                                                                               new PointF(400f, 400f), \r
+                                                                                                               new PointF(10f, 420f), \r
+                                                                                                               new PointF(310f, 420f), \r
+                                                                                                               new PointF(310f, 20f), \r
+                                                                                                               new PointF(10f, 20f), \r
+                                                                                                               new PointF(200f, 280f), \r
+                                                                                                               new PointF(100f, 5f), \r
+                                                                                                               new PointF(50f, 250f), \r
+                                                                                                               new PointF(10f, 10f), \r
+                                                                                                               new PointF(10f, 100f), \r
+                                                                                                               new PointF(400f, 200f), \r
+                                                                                                               new PointF(400f, 100f), \r
+                                                                                                               new PointF(100f, 100f)};\r
+                       \r
+                       for(int i = 0; i < path.PointCount; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], path.PathPoints [i]);\r
+                       }\r
+\r
+                       byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Line, \r
                                                                                                        (byte) PathPointType.Bezier3, \r
                                                                                                        (byte) PathPointType.Bezier3, \r
                                                                                                        (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath), \r
                                                                                                        (byte) PathPointType.Start, \r
                                                                                                        (byte) PathPointType.Line, \r
                                                                                                        (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) (PathPointType.Bezier3 | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker),\r
+                                                                                                       (byte) PathPointType.Line, \r
                                                                                                        (byte) PathPointType.Line};\r
 \r
                        for (int i=0; i < expectedTypes.Length; i++) {\r
                                Assert.AreEqual (expectedTypes [i], path.PathTypes [i]);\r
                        }       \r
-\r
+                       \r
                        //t.AssertCompare ();\r
                }\r
 \r
@@ -4254,12 +4446,32 @@ namespace Test.Sys.Drawing
                        path.AddLine (new Point (250, 200), new Point (250, 300));\r
                        path.SetMarkers ();\r
 \r
-                       GraphicsPathIterator pathIterator = new GraphicsPathIterator(path);\r
-                       pathIterator.Rewind ();\r
-                       int [] pointsNumber = new int[] {13, 6, 2, 0};\r
-                       for (int i=0; i < 4; i ++) {\r
-                               Assert.AreEqual (pathIterator.NextMarker (path), pointsNumber[i]);\r
-                       }\r
+                       byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) (PathPointType.Bezier3 | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker) };\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], path.PathTypes [i]);\r
+                       }       \r
+\r
 \r
                        //t.AssertCompare ();\r
                }\r
@@ -4390,6 +4602,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Warp_PointFArr_RectangleF()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -4466,6 +4681,9 @@ namespace Test.Sys.Drawing
 \r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Warp_PointFArr_RectangleF_Matrix()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -4545,6 +4763,9 @@ namespace Test.Sys.Drawing
 \r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Warp_PointFArr_RectangleF_Matrix_WarpMode()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -4694,6 +4915,9 @@ namespace Test.Sys.Drawing
 \r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Warp_PointFArr_RectangleF_Matrix_WarpMode_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -4772,6 +4996,9 @@ namespace Test.Sys.Drawing
                }\r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Widen_Pen()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -4994,6 +5221,9 @@ namespace Test.Sys.Drawing
 \r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Widen_Pen_Matrix()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -5183,6 +5413,9 @@ namespace Test.Sys.Drawing
 \r
 \r
                [Test]\r
+#if TARGET_JVM\r
+               [Category ("NotWorking")]\r
+#endif\r
                public void Widen_Pen_Matrix_Float()\r
                {\r
                        path = new GraphicsPath ();\r
@@ -5460,11 +5693,37 @@ namespace Test.Sys.Drawing
                        //t.AssertCompare ();\r
                }\r
 \r
-//             foreach(PointF point in path.PathPoints) {\r
-//                     Console.WriteLine("new PointF({0}f, {1}f), ",point.X, point.Y);\r
-//             }\r
-//             foreach(PathPointType type in path.PathTypes) {\r
-//                     Console.WriteLine("(byte) PathPointType.{0}, ",type);\r
-//             }\r
+               #region Private helpers\r
+\r
+               public void Print (GraphicsPath path)\r
+               {\r
+//                     foreach(PointF point in path.PathPoints) {\r
+//                             Console.WriteLine("new PointF({0}f, {1}f), ",point.X, point.Y);\r
+//                     }\r
+//                     foreach(PathPointType type in path.PathTypes) {\r
+//                             Console.WriteLine("(byte) PathPointType.{0}, ",type);\r
+//                     }\r
+\r
+                       for (int i=0; i < path.PointCount; i++) {\r
+                               Console.WriteLine (" ({0},{1}) [{2}]",path.PathPoints[i].X,path.PathPoints[i].Y,ToString ((PathPointType)path.PathTypes[i]));\r
+                       }\r
+               }\r
+\r
+               public string ToString (PathPointType type)\r
+               {\r
+                       foreach (PathPointType t in Enum.GetValues(typeof (PathPointType)))\r
+                               if (type == t)\r
+                               return type.ToString ();\r
+\r
+                       string s = (type & PathPointType.PathTypeMask).ToString ();\r
+\r
+                       foreach (PathPointType t in new PathPointType[] {PathPointType.PathMarker, PathPointType.CloseSubpath})\r
+                               if ((type & t) != 0)\r
+                                       s += " | " + t.ToString ();\r
+\r
+                       return s;\r
+               }\r
+               \r
+               #endregion // Private helpers\r
        }\r
 }\r
diff --git a/mcs/class/System.Drawing/Test/DrawingTest/Test/GraphicsPathIterator.cs b/mcs/class/System.Drawing/Test/DrawingTest/Test/GraphicsPathIterator.cs
new file mode 100644 (file)
index 0000000..f51a0da
--- /dev/null
@@ -0,0 +1,749 @@
+using System;\r
+using NUnit.Framework;\r
+using System.Drawing.Drawing2D;\r
+using System.Drawing;\r
+\r
+using DrawingTestHelper;\r
\r
+namespace Test.Sys.Drawing \r
+{\r
+    [TestFixture]\r
+    public class GraphicsPathIteratorFixture \r
+       {        \r
+        [Test]\r
+        public virtual void NextSubpath_Int_Int_Bool() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.CloseFigure ();\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+\r
+                       int start;\r
+                       int end;\r
+                       bool isClosed;\r
+\r
+                       int count = iterator.NextSubpath (out start, out end, out isClosed);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (3, end);\r
+                       Assert.IsFalse (isClosed);\r
+\r
+                       count = iterator.NextSubpath (out start, out end, out isClosed);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (4, start);\r
+                       Assert.AreEqual (7, end);\r
+                       Assert.IsTrue (isClosed);\r
+\r
+                       count = iterator.NextSubpath (out start, out end, out isClosed);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (8, start);\r
+                       Assert.AreEqual (11, end);\r
+                       Assert.IsTrue (isClosed);\r
+\r
+                       count = iterator.NextSubpath (out start, out end, out isClosed);\r
+                       Assert.AreEqual (2, count);\r
+                       Assert.AreEqual (12, start);\r
+                       Assert.AreEqual (13, end);\r
+                       Assert.IsFalse (isClosed);\r
+\r
+                       count = iterator.NextSubpath (out start, out end, out isClosed);\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (0, end);\r
+                       Assert.IsTrue (isClosed);\r
+        }\r
+        \r
+        [Test]\r
+        public virtual void NextSubpath_GraphicsPath_Bool() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.CloseFigure ();\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+                       GraphicsPath path2 = new GraphicsPath ();\r
+\r
+                       bool isClosed;\r
+\r
+                       int count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.IsFalse (isClosed);\r
+\r
+                       PointF [] actualPoints = path2.PathPoints;\r
+                       byte [] actualTypes = path2.PathTypes;\r
+\r
+                       PointF [] expectedPoints = new PointF [] {      new PointF(100f, 100f), \r
+                                                                                                               new PointF(400f, 100f), \r
+                                                                                                               new PointF(400f, 200f), \r
+                                                                                                               new PointF(10f, 100f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker)};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }\r
+\r
+                       count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.IsTrue (isClosed);\r
+\r
+                       actualPoints = path2.PathPoints;\r
+                       actualTypes = path2.PathTypes;\r
+\r
+                       expectedPoints = new PointF [] {new PointF(10f, 10f), \r
+                                                                                       new PointF(50f, 250f), \r
+                                                                                       new PointF(100f, 5f), \r
+                                                                                       new PointF(200f, 280f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                               (byte) PathPointType.Bezier3, \r
+                                                               (byte) PathPointType.Bezier3, \r
+                                                               (byte) (PathPointType.Bezier3 | PathPointType.CloseSubpath | PathPointType.PathMarker)};\r
+                       \r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }\r
+\r
+                       count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.IsTrue (isClosed);\r
+\r
+                       actualPoints = path2.PathPoints;\r
+                       actualTypes = path2.PathTypes;\r
+\r
+                       expectedPoints = new PointF [] {new PointF(10f, 20f), \r
+                                                                                       new PointF(310f, 20f), \r
+                                                                                       new PointF(310f, 420f), \r
+                                                                                       new PointF(10f, 420f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                       (byte) PathPointType.Line, \r
+                                                                                       (byte) PathPointType.Line, \r
+                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath | PathPointType.PathMarker)};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }\r
+\r
+                       count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (2, count);\r
+                       Assert.IsFalse (isClosed);\r
+\r
+                       actualPoints = path2.PathPoints;\r
+                       actualTypes = path2.PathTypes;\r
+\r
+                       expectedPoints = new PointF [] {new PointF(400f, 400f), \r
+                                                                                       new PointF(400f, 10f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                       (byte) PathPointType.Line};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }\r
+\r
+                       count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (0, count);\r
+\r
+                       count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.IsTrue (isClosed);\r
+                       Assert.AreEqual (2, path2.PointCount);\r
+\r
+                       actualPoints = path2.PathPoints;\r
+                       actualTypes = path2.PathTypes;\r
+\r
+                       expectedPoints = new PointF [] {new PointF(400f, 400f), \r
+                                                                                       new PointF(400f, 10f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                       (byte) PathPointType.Line};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }\r
+\r
+                       path = new GraphicsPath ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       iterator = new GraphicsPathIterator (path);\r
+                       \r
+                       path2 = new GraphicsPath ();                    \r
+                       count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.IsFalse (isClosed);\r
+                       \r
+                       path2 = new GraphicsPath ();\r
+                       count = iterator.NextSubpath (path2, out isClosed);\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.IsTrue (isClosed);\r
+        }\r
+        \r
+        [Test]\r
+        public virtual void NextPathType() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddBezier( 100, 100, 500, 250, 100, 50, 250, 280);\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+\r
+                       byte pathType;\r
+                       int start;\r
+                       int end;\r
+                       bool isClosed;\r
+\r
+                       int count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Start, pathType);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (0, end);\r
+\r
+                       iterator.NextSubpath (out start, out end, out isClosed);\r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (3, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Line, pathType);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (2, end);\r
+\r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Bezier3, pathType);\r
+                       Assert.AreEqual (2, start);\r
+                       Assert.AreEqual (5, end);\r
+\r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (3, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Line, pathType);\r
+                       Assert.AreEqual (5, start);\r
+                       Assert.AreEqual (7, end);\r
+                       \r
+                       // we don't want to be a bug compliant with .net\r
+                       /* \r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Line, pathType);\r
+                       Assert.AreEqual (5, start);\r
+                       Assert.AreEqual (7, end);\r
+                       */\r
+\r
+                       iterator.NextSubpath (out start, out end, out isClosed);\r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Bezier3, pathType);\r
+                       Assert.AreEqual (8, start);\r
+                       Assert.AreEqual (11, end);\r
+\r
+                       iterator.NextSubpath (out start, out end, out isClosed);\r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Line, pathType);\r
+                       Assert.AreEqual (12, start);\r
+                       Assert.AreEqual (15, end);\r
+\r
+                       iterator.NextSubpath (out start, out end, out isClosed);\r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (2, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Line, pathType);\r
+                       Assert.AreEqual (16, start);\r
+                       Assert.AreEqual (17, end);\r
+\r
+                       iterator.NextSubpath (out start, out end, out isClosed);\r
+                       count = iterator.NextPathType (out pathType, out start, out end);\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual ((byte)PathPointType.Line, pathType);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (0, end);\r
+        }\r
+        \r
+        [Test]\r
+        public virtual void NextMarker_Int32_Int32() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+\r
+                       int start;\r
+                       int end;\r
+                       int count = iterator.NextMarker (out start, out end);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (3, end);\r
+                       \r
+                       count = iterator.NextMarker (out start, out end);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (4, start);\r
+                       Assert.AreEqual (7, end);\r
+\r
+                       count = iterator.NextMarker (out start, out end);\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (8, start);\r
+                       Assert.AreEqual (11, end);\r
+\r
+                       count = iterator.NextMarker (out start, out end);\r
+                       Assert.AreEqual (2, count);\r
+                       Assert.AreEqual (12, start);\r
+                       Assert.AreEqual (13, end);\r
+\r
+                       // FIXME - should return all 0'z?\r
+                       /*\r
+                       count = iterator.NextMarker (out start, out end);\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual (12, start);\r
+                       Assert.AreEqual (13, end);\r
+                       */\r
+        }\r
+\r
+               [Test]\r
+               public void NextSubpath_NextMarker()\r
+               {\r
+                       GraphicsPath path = new GraphicsPath();\r
+                       \r
+                       path.AddLine (10, 10, 50, 50); // figure #1\r
+                       path.AddLine (50, 50, 80, 80);\r
+                       path.AddLine (90, 90, 100, 100);\r
+                       path.SetMarkers (); // marker #1\r
+                       path.AddLine (150, 150, 180, 180);\r
+                       path.SetMarkers (); // marker #2\r
+                       path.StartFigure (); // figure #2\r
+                       path.SetMarkers (); // marker #3 is actually marker #2\r
+                       path.AddRectangle (new Rectangle (200, 200, 200, 200)); \r
+                       path.SetMarkers (); // marker #4\r
+                       path.AddLine (150, 150, 180, 180); \r
+                       path.StartFigure (); // figure #3\r
+                       path.AddBezier (400, 400, 500, 500, 600, 600, 700, 700);\r
+                       path.AddBezier (450, 450, 550, 550, 650, 650, 750, 750);\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+\r
+                       int start;\r
+                       int end;\r
+                       bool isClosed;\r
+                       int count = iterator.NextMarker (out start,out end); // marker #1\r
+                       Assert.AreEqual (5, count);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (4, end);\r
+\r
+                       count = iterator.NextSubpath (out start,out end,out isClosed); // figure #1\r
+                       Assert.AreEqual (7, count);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (6, end);\r
+                       Assert.AreEqual (false, isClosed);\r
+\r
+                       count = iterator.NextMarker (out start,out end); // marker #2 (and #3)\r
+                       Assert.AreEqual (2, count);\r
+                       Assert.AreEqual (5, start);\r
+                       Assert.AreEqual (6, end);\r
+\r
+                       count = iterator.NextSubpath (out start,out end,out isClosed); // figure #2\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (7, start);\r
+                       Assert.AreEqual (10, end);\r
+                       Assert.AreEqual (true, isClosed);\r
+\r
+                       count = iterator.NextSubpath (out start,out end,out isClosed); // figure #3\r
+                       Assert.AreEqual (2, count);\r
+                       Assert.AreEqual (11, start);\r
+                       Assert.AreEqual (12, end);\r
+                       Assert.AreEqual (false, isClosed);\r
+\r
+                       count = iterator.NextMarker (out start,out end); // marker #5 (end)\r
+                       Assert.AreEqual (4, count);\r
+                       Assert.AreEqual (7, start);\r
+                       Assert.AreEqual (10, end);\r
+\r
+                       count = iterator.NextMarker (out start,out end); // marker #5 (end)\r
+                       Assert.AreEqual (10, count);\r
+                       Assert.AreEqual (11, start);\r
+                       Assert.AreEqual (20, end);\r
+\r
+                       // we dont want to be bug compliant with .net\r
+                       /*\r
+                       count = iterator.NextMarker (out start,out end); // no more markers\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual (11, start);\r
+                       Assert.AreEqual (20, end);\r
+                       */\r
+\r
+                       count = iterator.NextSubpath (out start,out end,out isClosed); // figure #4\r
+                       Assert.AreEqual (8, count);\r
+                       Assert.AreEqual (13, start);\r
+                       Assert.AreEqual (20, end);\r
+                       Assert.AreEqual (false, isClosed);\r
+\r
+                       // we dont want to be bug compliant with .net\r
+                       /*\r
+                       count = iterator.NextMarker (out start,out end); // no more markers\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual (13, start);\r
+                       Assert.AreEqual (20, end);\r
+                       */\r
+\r
+                       count = iterator.NextSubpath (out start,out end,out isClosed); // no more figures\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (0, end);\r
+                       Assert.AreEqual (true, isClosed);\r
+\r
+                       count = iterator.NextMarker (out start,out end); // no more markers\r
+                       Assert.AreEqual (0, count);\r
+                       Assert.AreEqual (0, start);\r
+                       Assert.AreEqual (0, end);                       \r
+               }\r
+\r
+        \r
+        [Test]\r
+        public virtual void NextMarker_GraphicsPath() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       GraphicsPath path2 = new GraphicsPath ();\r
+                       path.AddLine (new Point (150, 150), new Point (450, 150));\r
+                       path.AddLine (new Point (450, 250), new Point (50, 150));\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+\r
+                       iterator.NextMarker (null);\r
+                       iterator.NextMarker (path2);\r
+\r
+                       Assert.AreEqual (4, path2.PointCount);\r
+                       PointF [] actualPoints = path2.PathPoints;\r
+                       byte [] actualTypes = path2.PathTypes;\r
+\r
+                       PointF [] expectedPoints = new PointF [] {      new PointF(100f, 100f), \r
+                                                                                                               new PointF(400f, 100f), \r
+                                                                                                               new PointF(400f, 200f), \r
+                                                                                                               new PointF(10f, 100f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker)};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }\r
+\r
+                       iterator.NextMarker (null);\r
+                       iterator.NextMarker (null);\r
+                       iterator.NextMarker (null);\r
+                       iterator.NextMarker (path2);\r
+\r
+                       Assert.AreEqual (4, path2.PointCount);\r
+                       actualPoints = path2.PathPoints;\r
+                       actualTypes = path2.PathTypes;\r
+\r
+                       expectedPoints = new PointF [] {new PointF(10f, 10f), \r
+                                                                                       new PointF(50f, 250f), \r
+                                                                                       new PointF(100f, 5f), \r
+                                                                                       new PointF(200f, 280f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                               (byte) PathPointType.Bezier3, \r
+                                                                                               (byte) PathPointType.Bezier3, \r
+                                                                                               (byte) (PathPointType.Bezier3 | PathPointType.PathMarker)};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }       \r
+                       \r
+        }\r
+        \r
+        [Test]\r
+        public virtual void Count() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+                       Assert.AreEqual (0, iterator.Count);\r
+\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       iterator = new GraphicsPathIterator (path);\r
+                       Assert.AreEqual (14, iterator.Count);\r
+        }\r
+        \r
+        [Test]\r
+        public virtual void SubpathCount() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+                       Assert.AreEqual (0, iterator.SubpathCount);\r
+\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       iterator = new GraphicsPathIterator (path);\r
+                       Assert.AreEqual (4, iterator.SubpathCount);\r
+        }\r
+        \r
+        [Test]\r
+        public virtual void HasCurve() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+                       Assert.IsFalse (iterator.HasCurve ());\r
+\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+\r
+                       iterator = new GraphicsPathIterator (path);\r
+                       Assert.IsFalse (iterator.HasCurve ());\r
+\r
+                       path.StartFigure ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       iterator = new GraphicsPathIterator (path);\r
+                       Assert.IsTrue (iterator.HasCurve ());\r
+        }\r
+        \r
+        [Test]\r
+        public virtual void Rewind() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+\r
+                       int i;\r
+                       int j;\r
+                       iterator.NextMarker (out i, out j);\r
+                       iterator.NextMarker (out i, out j);\r
+\r
+                       iterator.Rewind ();\r
+                       iterator.NextMarker (out i, out j);\r
+\r
+                       Assert.AreEqual (0, i);\r
+                       Assert.AreEqual (3, j);\r
+        }\r
+        \r
+        [Test]\r
+        public virtual void Enumerate() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);\r
+                       path.StartFigure ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+\r
+                       path.StartFigure ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       path.Reverse ();\r
+\r
+                       GraphicsPathIterator iterator = new GraphicsPathIterator (path);\r
+                       PointF [] actualPoints = new PointF [14];\r
+                       byte [] actualTypes = new byte [14];\r
+                       iterator.Enumerate (ref actualPoints, ref actualTypes);\r
+\r
+                       PointF [] expectedPoints = new PointF [] {      new PointF(400f, 10f), \r
+                                                                                                               new PointF(400f, 400f), \r
+                                                                                                               new PointF(10f, 420f), \r
+                                                                                                               new PointF(310f, 420f), \r
+                                                                                                               new PointF(310f, 20f), \r
+                                                                                                               new PointF(10f, 20f), \r
+                                                                                                               new PointF(200f, 280f), \r
+                                                                                                               new PointF(100f, 5f), \r
+                                                                                                               new PointF(50f, 250f), \r
+                                                                                                               new PointF(10f, 10f), \r
+                                                                                                               new PointF(10f, 100f), \r
+                                                                                                               new PointF(400f, 200f), \r
+                                                                                                               new PointF(400f, 100f), \r
+                                                                                                               new PointF(100f, 100f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Bezier3, \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }       \r
+        }\r
+        \r
+        [Test]\r
+        public virtual void CopyData() \r
+               {\r
+            GraphicsPath path = new GraphicsPath ();\r
+                       path.AddLine (new Point (100, 100), new Point (400, 100));\r
+                       path.AddLine (new Point (400, 200), new Point (10, 100));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddRectangle (new Rectangle (10, 20, 300, 400));\r
+                       path.StartFigure ();\r
+                       path.SetMarkers ();\r
+                       path.AddLine (new Point (400, 400), new Point (400, 10));\r
+\r
+                       GraphicsPathIterator pathIterator = new GraphicsPathIterator(path);\r
+                       pathIterator.Rewind ();\r
+                       PointF [] actualPoints = new PointF [10];\r
+                       byte [] actualTypes = new byte [10];\r
+                       pathIterator.CopyData (ref actualPoints, ref actualTypes, 0, 9);\r
+\r
+                       PointF [] expectedPoints = new PointF [] {      new PointF(100f, 100f), \r
+                                                                                                               new PointF(400f, 100f), \r
+                                                                                                               new PointF(400f, 200f), \r
+                                                                                                               new PointF(10f, 100f), \r
+                                                                                                               new PointF(10f, 20f), \r
+                                                                                                               new PointF(310f, 20f), \r
+                                                                                                               new PointF(310f, 420f), \r
+                                                                                                               new PointF(10f, 420f), \r
+                                                                                                               new PointF(400f, 400f), \r
+                                                                                                               new PointF(400f, 10f)};\r
+                       \r
+                       for(int i = 0; i < expectedPoints.Length; i++) {\r
+                               DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);\r
+                       }\r
+\r
+                       byte [] expectedTypes = new byte [] {   (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) PathPointType.Line, \r
+                                                                                                       (byte) (PathPointType.Line | PathPointType.CloseSubpath | PathPointType.PathMarker), \r
+                                                                                                       (byte) PathPointType.Start, \r
+                                                                                                       (byte) PathPointType.Line};\r
+\r
+                       for (int i=0; i < expectedTypes.Length; i++) {\r
+                               Assert.AreEqual (expectedTypes [i], actualTypes [i]);\r
+                       }       \r
+        }\r
+    }\r
+}\r
+\r
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/CategoryNameCollectionCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/CategoryNameCollectionCas.cs
new file mode 100644 (file)
index 0000000..39fcc52
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// CategoryNameCollectionCas.cs 
+//     - CAS unit tests for System.Drawing.Design.CategoryNameCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class CategoryNameCollectionCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (CategoryNameCollection).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       new CategoryNameCollection (new string[0]);
+               }
+
+               // we use reflection to call CategoryNameCollection class as it's 
+               // protected by a  LinkDemand (which will be converted into full demand, 
+               // i.e. a stack walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (new object[1] { (string[])null });
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/ChangeLog b/mcs/class/System.Drawing/Test/System.Drawing.Design/ChangeLog
new file mode 100644 (file)
index 0000000..66c0b09
--- /dev/null
@@ -0,0 +1,18 @@
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * CategoryNameCollectionCas.cs: New. CAS unit tests to check for 
+       LinkDemand for SkipVerification.
+       * PaintValueEventArgsCas.cs: New. CAS unit tests to check for 
+       LinkDemand for SkipVerification.
+       * PropertyValueUIItemCas.cs: New. CAS unit tests to check for 
+       LinkDemand for SkipVerification.
+       * ToolboxComponentsCreatedEventArgsCas.cs: New. CAS unit tests to 
+       check for LinkDemand for SkipVerification.
+       * ToolboxComponentsCreatingEventArgsCas.cs: New. CAS unit tests to 
+       check for LinkDemand for SkipVerification.
+       * ToolboxItemCas.cs: New. CAS unit tests to check for LinkDemand for
+       SkipVerification.
+       * ToolboxItemCollectionCas.cs: New. CAS unit tests to check for 
+       LinkDemand for SkipVerification.
+       * UITypeEditorCas.cs: New. CAS unit tests to check for LinkDemand for
+       SkipVerification.
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/PaintValueEventArgsCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/PaintValueEventArgsCas.cs
new file mode 100644 (file)
index 0000000..c28b515
--- /dev/null
@@ -0,0 +1,85 @@
+//
+// PaintValueEventArgsCas.cs 
+//     - CAS unit tests for System.Drawing.Design.PaintValueEventArgs
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PaintValueEventArgsCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (PaintValueEventArgs).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       Rectangle r = new Rectangle ();
+                       new PaintValueEventArgs (null, null, Graphics.FromImage (new Bitmap (10, 10)), r);
+               }
+
+               // we use reflection to call PaintValueEventArgs class as it's protected 
+               // by a  LinkDemand (which will be converted into full demand, i.e. a 
+               // stack walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (new object[4]);
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/PropertyValueUIItemCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/PropertyValueUIItemCas.cs
new file mode 100644 (file)
index 0000000..be02541
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// PropertyValueUIItemCas.cs 
+//     - CAS unit tests for System.Drawing.Design.PropertyValueUIItem
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [NUnit.Framework.Category ("CAS")]
+       public class PropertyValueUIItemCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (PropertyValueUIItem).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               private void PropertyValueUIItemInvoke (ITypeDescriptorContext context, PropertyDescriptor descriptor, PropertyValueUIItem invokedItem)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       new PropertyValueUIItem (new Bitmap (10, 10), PropertyValueUIItemInvoke, null);
+               }
+
+               // we use reflection to call PropertyValueUIItem class as it's protected 
+               // by a LinkDemand (which will be converted into full demand, i.e. a stack 
+               // walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (new object [3]);
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxComponentsCreatedEventArgsCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxComponentsCreatedEventArgsCas.cs
new file mode 100644 (file)
index 0000000..e2fc4d7
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// ToolboxComponentsCreatedEventArgsCas.cs - CAS unit tests
+//     for System.Drawing.Design.ToolboxComponentsCreatedEventArgs
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ToolboxComponentsCreatedEventArgsCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (ToolboxComponentsCreatedEventArgs).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       new ToolboxComponentsCreatedEventArgs (null);
+               }
+
+               // we use reflection to call ToolboxComponentsCreatedEventArgs class as
+               // it's protected by a  LinkDemand (which will be converted into full demand,
+               // i.e. a stack walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (new object[1] { null });
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxComponentsCreatingEventArgsCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxComponentsCreatingEventArgsCas.cs
new file mode 100644 (file)
index 0000000..b7b4264
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// ToolboxComponentsCreatingEventArgsCas.cs - CAS unit tests
+//     for System.Drawing.Design.ToolboxComponentsCreatingEventArgs
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ToolboxComponentsCreatingEventArgsCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (ToolboxComponentsCreatingEventArgs).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       new ToolboxComponentsCreatingEventArgs (null);
+               }
+
+               // we use reflection to call ToolboxComponentsCreatingEventArgs class as
+               // it's protected by a  LinkDemand (which will be converted into full demand,
+               // i.e. a stack walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (new object[1] { null });
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxItemCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxItemCas.cs
new file mode 100644 (file)
index 0000000..2efc1ca
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// ToolboxItemCas.cs - CAS unit tests for System.Drawing.Design.ToolboxItem
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ToolboxItemCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (ToolboxItem).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       new ToolboxItem ();
+               }
+
+               // we use reflection to call ToolboxItem class as it's protected by a 
+               // LinkDemand (which will be converted into full demand, i.e. a stack 
+               // walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (null);
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxItemCollectionCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/ToolboxItemCollectionCas.cs
new file mode 100644 (file)
index 0000000..3a17531
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// ToolboxItemCollectionCas.cs
+//     - CAS unit tests for System.Drawing.Design.ToolboxItemCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ToolboxItemCollectionCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (ToolboxItemCollection).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       new ToolboxItemCollection (new ToolboxItem [0]);
+               }
+
+               // we use reflection to call ToolboxItemCollection class as it's protected
+               // by a LinkDemand (which will be converted into full demand, i.e. a stack 
+               // walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (new object[1] { new ToolboxItem[0] });
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Design/UITypeEditorCas.cs b/mcs/class/System.Drawing/Test/System.Drawing.Design/UITypeEditorCas.cs
new file mode 100644 (file)
index 0000000..ff56d40
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// UITypeEditorCas.cs - CAS unit tests for System.Drawing.Design.UITypeEditor
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing.Design {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class UITypeEditorCas {
+
+               private ConstructorInfo ctor;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       ConstructorInfo[] infos = typeof (UITypeEditor).GetConstructors ();
+                       ctor = infos[0];
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create ()
+               {
+                       new UITypeEditor ();
+               }
+
+               // we use reflection to call UITypeEditor class as it's protected by a 
+               // LinkDemand (which will be converted into full demand, i.e. a stack 
+               // walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Create_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (ctor, "constructor");
+                       ctor.Invoke (null);
+               }
+       }
+}
index d43c41b3e27b6f9d5806e07255be7470c2b2dd7c..23a1a51ee0acda20ddbf7d744de86b9cf4f751b3 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * TestBlend.cs, TestColorBlend.cs, TestHatchBrush.cs, TestMatrix.cs:
+       Deny UnmanagedCode permission to all tests. This shows (when executed 
+       under MS runtime) that S.D API is safe and doesn't requires high 
+       privileges to run - even if we know that, deep down, this calls into 
+       GDI+.
+
 2005-08-25 Jordi Mas i Hernandez <jordi@ximian.com>
 
        * TestMatrix.cs: New test cases
index c2ad954e7f5c8d4bbd1853286fd07f411c5a4bff..f66ea61094bff6b855539fa19c72399f3376ab34 100644 (file)
@@ -30,10 +30,12 @@ using NUnit.Framework;
 using System;
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing.Drawing2D
 {
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class BlendTest : Assertion
        {
                [TearDown]
index 702d18be24273bf37fd2f2b841d8763be49eef87..2ddc9b539e62a330e0ed233880ca4cd29ec7f584 100644 (file)
@@ -30,10 +30,12 @@ using NUnit.Framework;
 using System;
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing.Drawing2D 
 {
        [TestFixture]   
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class ColorBlendTest : Assertion
        {
                [TearDown]
index 04454eb09d92978d61c043aac33651c2c55c4f33..1972f82c7cc6a8605dad29ef2ecb36b6358f488d 100644 (file)
@@ -33,11 +33,13 @@ using System;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.Drawing.Drawing2D;
+using System.Security.Permissions;
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing.Drawing2D
 {
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class HatchBrushTest : Assertion
        {
                Graphics gr;
index a0b429edcee95f12a9cf838b2a300813a8ef419c..5b02ee7c43f69fa8d3d7ff30ccb9d3b62ea7b9a8 100644 (file)
@@ -30,10 +30,12 @@ using NUnit.Framework;
 using System;
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing.Drawing2D
 {
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class MatrixTest : Assertion
        {
                [TearDown]
index e137685c4e3fa6ca4e689a5dbbbc05e2968748d2..62e7f8142f56b06b6ec1aec72958e3d29b61ac9d 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * TestBmpCodec.cs, TestColorMatrix.cs, TestImageAttributes.cs, 
+       TestImageCodecInfo.cs, TestJpegCodec.cs: Deny UnmanagedCode permission
+       to all tests. This shows (when executed under MS runtime) that S.D API
+       is safe and doesn't requires high privileges to run - even if we know
+       that, deep down, this calls into GDI+.
+
 2005-08-19  Jordi Mas i Hernandez <jordi@ximian.com>
 
        *  TestBmpCodec.cs: Enable PixelFormat tests                                                  
index 13bb0a9e44b3230918113351cf36d6a45af67d78..dac4ffe169504df83e38d5ec061e78f661c666d0 100644 (file)
@@ -36,12 +36,14 @@ using System.Drawing.Imaging;
 using NUnit.Framework;
 using System.IO;
 using System.Security.Cryptography;
+using System.Security.Permissions;
 using System.Text;
 
 namespace MonoTests.System.Drawing
 {
 
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestBmpCodec
        {
                
index 0d2f91f8c480d2437d510c5bf89ba498d6130806..ceb64b45593b57fa3f5b59bf2ce6730632da13d8 100644 (file)
@@ -31,12 +31,14 @@ using System.Drawing.Imaging;
 using NUnit.Framework;
 using System.IO;
 using System.Security.Cryptography;
+using System.Security.Permissions;
 using System.Text;
 
 namespace MonoTests.System.Drawing
 {
 
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestColorMatrix
        {
 
index b79251fdc92c13e5998f888965609df3e850826c..644458c6bb4c7206412bee1c2bad1276545c6607 100644 (file)
@@ -31,12 +31,14 @@ using System.Drawing.Imaging;
 using NUnit.Framework;
 using System.IO;
 using System.Security.Cryptography;
+using System.Security.Permissions;
 using System.Text;
 
 namespace MonoTests.System.Drawing
 {
 
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestImageAttributes
        {
 
index c86148a639c684947e84a2ae09e3f3737004ab4f..39ef67ef733e641f1625be1e06cb427b7581f3b1 100644 (file)
@@ -35,12 +35,14 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using NUnit.Framework;
 using System.Collections;
+using System.Security.Permissions;
 using System.Text.RegularExpressions;
 
 namespace MonoTests.System.Drawing
 {
 
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestImageCodecInfo 
        {
                Hashtable decoders;
index 1ca794a5890789da652eebc61f2f3eec0f02445b..54aaa327b4b09e94694fc0c2945f58be46d230b0 100644 (file)
@@ -35,11 +35,13 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using NUnit.Framework;
 using System.IO;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
 
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestJpegCodec 
        {
                
index 97832ff291eb16e376533392d1e51deed16313be..6e9d1f0d55e1f9cde54f8a6ff133c8a8bd06ffca 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * PrintingPermissionTest.cs: Before 2.0 some test cases throws 
+       ArgumentException.
+
 2005-08-26  Atsushi Enomoto  <atsushi@ximian.com>
 
        * PrintingPermissionTest.cs, PrintingPermissionAttributeTest.cs :
index ef8dc1051dd22b4e4384d7f1efe0ff4d44f5b873..1f38dfd130a9c91eb341e05f2b2ae7efbba9a009 100644 (file)
@@ -33,8 +33,6 @@ using System.Drawing.Printing;
 using System.Security;
 using System.Security.Permissions;
 
-using System.Diagnostics;
-
 namespace MonoTests.System.Drawing.Printing {
 
        [TestFixture]
@@ -376,6 +374,9 @@ namespace MonoTests.System.Drawing.Printing {
                }
 
                [Test]
+#if !NET_2_0
+               [ExpectedException (typeof (ArgumentException))]
+#endif
                public void FromXml_WrongClass ()
                {
                        PrintingPermission pp = new PrintingPermission (PermissionState.None);
@@ -415,6 +416,9 @@ namespace MonoTests.System.Drawing.Printing {
                }
 
                [Test]
+#if !NET_2_0
+               [ExpectedException (typeof (ArgumentException))]
+#endif
                public void FromXml_NoVersion ()
                {
                        PrintingPermission pp = new PrintingPermission (PermissionState.None);
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/BitmapCas.cs b/mcs/class/System.Drawing/Test/System.Drawing/BitmapCas.cs
new file mode 100644 (file)
index 0000000..fefbf4a
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// BitmapCas.cs - CAS unit tests for System.Drawing.Bitmap
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class BitmapCas {
+
+               private MethodInfo getHbitmap1;
+               private MethodInfo getHbitmap2;
+               private MethodInfo getHicon;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       getHbitmap1 = typeof (Bitmap).GetMethod ("GetHbitmap", new Type[0]);
+                       getHbitmap2 = typeof (Bitmap).GetMethod ("GetHbitmap", new Type[1] { typeof (Color) });
+                       getHicon = typeof (Bitmap).GetMethod ("GetHicon");
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               public void GetHbitmap ()
+               {
+                       Bitmap b = new Bitmap (10, 10);
+                       try {
+                               Assert.IsTrue (b.GetHbitmap () != IntPtr.Zero, "GetHbitmap");
+                       }
+                       catch (NotImplementedException) {
+                               // not available on Mono
+                       }
+                       try {
+                               Assert.IsTrue (b.GetHbitmap (Color.Aqua) != IntPtr.Zero, "GetHbitmap(Color)");
+                       }
+                       catch (NotImplementedException) {
+                               // not available on Mono
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               public void GetHicon ()
+               {
+                       Bitmap b = new Bitmap (10, 10);
+                       try {
+                               Assert.IsTrue (b.GetHicon () != IntPtr.Zero, "GetHicon");
+                       }
+                       catch (NotImplementedException) {
+                               // not available on Mono
+                       }
+               }
+
+               // we use reflection to call Bitmap as it's GetHbitmap and GetHicon methods
+               // are protected by a LinkDemand (which will be converted into full demand, 
+               // i.e. a stack walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetHbitmap_Empty_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (getHbitmap1, "GetHbitmap");
+                       Bitmap b = new Bitmap (10, 10);
+                       getHbitmap1.Invoke (b, null);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetHbitmap_Color_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (getHbitmap2, "GetHbitmap(Color)");
+                       Bitmap b = new Bitmap (10, 10);
+                       getHbitmap2.Invoke (b, new object[1] { Color.Aqua });
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetHicon_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (getHicon, "GetHicon");
+                       Bitmap b = new Bitmap (10, 10);
+                       getHicon.Invoke (b, null);
+               }
+       }
+}
index e137b5d3204931b6cb32e6d3a5d0912a6dc54629..5c648d4309fb140df1590a4af542b22ab33e33b6 100644 (file)
@@ -1,3 +1,47 @@
+2005-09-19  Miguel de Icaza  <miguel@novell.com>
+
+       * TestGraphics.cs (LoadIndexed): Add test for the indexed bug.
+
+2005-09-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * BitmapCas.cs: New. CAS unit tests for Bitmap.
+       * GraphicsCas.cs: New. CAS unit tests for Graphics.
+       * ColorConverter.cs, ColorTranslator.cs, TestBrushes.cs, TestBitmap.cs
+       TestColor.cs, TestFont.cs, TestIcon.cs, TestIconConverter.cs,
+       TestImage.cs, TestImageConverter.cs, TestImageFormatConverter.cs,
+       TestPens.cs, TestPoint.cs, TestPointF.cs, TestPointConverter.cs,
+       TestRectangle.cs, TestRectangleF.cs, TestRectangleConverter.cs,
+       TestRegion.cs, TestSizeConverter.cs, TestSize.cs, TestSizeF.cs,
+       TestStringFormat.cs, TestSystemBrushes.cs, TestSystemPens.cs: Deny 
+       UnmanagedCode permission to all tests. This shows (when executed under
+       MS runtime) that S.D API is safe and doesn't requires high privileges
+       to run - even if we know that, deep down, this calls into GDI+.
+
+2005-09-14 Jordi Mas i Hernandez <jordi@ximan.com>
+
+       * TestGraphics.cs: Adds default properties, properties set/get and save
+       and restore status test
+
+2005-09-13 Jordi Mas i Hernandez <jordi@ximan.com>
+
+       * TestGraphics.cs: resets graphics object status before every SetClip test
+
+2005-09-12 Gert Driesen <drieseng@users.sourceforge.net>
+
+       * TestImageConverter.cs: Re-enabled GetProperties test.
+       * TestPointConverter.cs: same.
+       * TestRectangleConverter.cs: same.
+       * TestSizeConverter.cs: same.
+
+2005-09-06 Jordi Mas i Hernandez <jordi@ximan.com>
+
+       * TestImagge.cs: File not found exception, related to fix r49744
+       * TestBimap.cs: File not found exception, related to fix r49744
+
+2005-09-06 Jordi Mas i Hernandez <jordi@ximan.com>
+
+       * TestGraphics.cs: New test case, only clipping for now
+
 2005-08-26 Gert Driesen <drieseng@users.sourceforge.net>
 
        * TestPointConverter.cs: Use Assert class instead of deriving from
index 1f0f5d0d59ab3fbf79c34ed5a0dce7219431ac7a..379366379af4cc8cbb94949c31f3608d4d33315e 100644 (file)
@@ -4,12 +4,14 @@ using System.ComponentModel;
 using System.ComponentModel.Design.Serialization;
 using System.Drawing;
 using System.Globalization;
+using System.Security.Permissions;
 
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing {
 
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class ColorConverterFixture
        {
                Color col;
index 8c110c8826994b7060d0f68edb087823bf4f6b99..552b77c77b066f9181633c9e0e0aa735763f7829 100644 (file)
@@ -1,10 +1,12 @@
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing {
 
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class ColorTranslatorFixture {
                [Test]
                public void FromHtml ()
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/GraphicsCas.cs b/mcs/class/System.Drawing/Test/System.Drawing/GraphicsCas.cs
new file mode 100644 (file)
index 0000000..16a8679
--- /dev/null
@@ -0,0 +1,150 @@
+//
+// GraphicsCas.cs - CAS unit tests for System.Drawing.Graphics
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Drawing;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoCasTests.System.Drawing {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class GraphicsCas {
+
+               private MethodInfo fromHdcInternal;
+               private MethodInfo fromHwndInternal;
+               private MethodInfo releaseHdcInternal;
+               private Bitmap bitmap;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // this executes at fulltrust
+                       fromHdcInternal = typeof (Graphics).GetMethod ("FromHdcInternal");
+                       fromHwndInternal = typeof (Graphics).GetMethod ("FromHwndInternal");
+                       releaseHdcInternal = typeof (Graphics).GetMethod ("ReleaseHdcInternal");
+                       bitmap = new Bitmap (10, 10);
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!SecurityManager.SecurityEnabled)
+                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+               }
+
+               private Graphics GetGraphics ()
+               {
+                       return Graphics.FromImage (bitmap);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               public void FromHdcInternal ()
+               {
+                       try {
+                               Graphics.FromHdcInternal (IntPtr.Zero);
+                       }
+                       catch (SecurityException) {
+                               Assert.Fail ("SecurityException");
+                       }
+                       catch (Exception) {
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [Category ("NotWorking")]
+               public void FromHwndInternal ()
+               {
+                       try {
+                               Graphics.FromHwndInternal (IntPtr.Zero);
+                       }
+                       catch (SecurityException) {
+                               Assert.Fail ("SecurityException");
+                       }
+                       catch (Exception) {
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               public void ReleaseHdcInternal ()
+               {
+                       try {
+                               Graphics g = GetGraphics ();
+                               g.ReleaseHdcInternal (IntPtr.Zero);
+                       }
+                       catch (SecurityException) {
+                               Assert.Fail ("SecurityException");
+                       }
+                       catch (Exception) {
+                       }
+               }
+
+               // we use reflection to call Graphics as it's *Internal methods are 
+               // protected by a LinkDemand (which will be converted into full demand, 
+               // i.e. a stack walk) when reflection is used (i.e. it gets testable).
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void FromHdcInternal_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (fromHdcInternal, "FromHdcInternal");
+                       fromHdcInternal.Invoke (null, new object[1] { IntPtr.Zero });
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void FromHwndInternal_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (fromHwndInternal, "FromHwndInternal");
+                       fromHwndInternal.Invoke (null, new object[1] { IntPtr.Zero });
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ReleaseHdcInternal_LinkDemand ()
+               {
+                       // requires FullTrust, so denying anything break the requirements
+                       Assert.IsNotNull (releaseHdcInternal, "ReleaseHdcInternal");
+                       Graphics g = GetGraphics ();
+                       releaseHdcInternal.Invoke (g, new object[1] { IntPtr.Zero });
+               }
+       }
+}
index 83cd630ee0a4058dc4b474f96c6eed9fa773a2a3..16f0b4a0056a39f63f1242ea994530f6bb74ec33 100644 (file)
@@ -38,10 +38,12 @@ using System.IO;
 using System.Security.Cryptography;
 using System.Text;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing{
 
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestBitmap {
                
                [TearDown]
@@ -165,6 +167,13 @@ namespace MonoTests.System.Drawing{
                        Assert.AreEqual (1, cnt);                                                               
                        Assert.AreEqual (0, active);                                                                                    
                }
+               
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void FileDoesNotExists ()
+               {                       
+                       Bitmap  bmp = new Bitmap ("FileDoesNotExists.jpg");                     
+               }
 
                static string ByteArrayToString(byte[] arrInput)
                {
index b306709b25bff5bad23f40b160d50607e0f3263b..d1bad184fa0d6393f443e2c6c38e363c4a3c7322 100644 (file)
 using NUnit.Framework;
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class BrushesTest : Assertion
        {
                [SetUp]
index ca56bf579cbe6da2e4663372bd6c8f96b8fdb324..fc7878c3a265838de3e716fe14656a9c760a94ab 100644 (file)
 
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing
 {
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class ColorTest : Assertion
        {
                [SetUp]
index e861ad8c5d825d4e67a52a5f48427c2b6a6b7b9d..e73206e76641e4356a1eba89320c5070138234d0 100644 (file)
 using System;
 using System.Drawing;
 using System.Drawing.Imaging;
+using System.Security.Permissions;
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing{
 
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class FontTest : Assertion {
                
                [TearDown]
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs
new file mode 100644 (file)
index 0000000..3fe66c6
--- /dev/null
@@ -0,0 +1,304 @@
+//
+// Graphics class testing unit
+//
+// Author:
+//   Jordi Mas, jordi@ximian.com
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Drawing.Drawing2D;
+using System.IO;
+using System.Reflection;
+
+namespace MonoTests.System.Drawing
+{
+       [TestFixture]
+       public class GraphicsTest : Assertion
+       {
+               private RectangleF[] rects;
+
+               [TearDown]
+               public void TearDown () {}
+
+               [SetUp]
+               public void SetUp ()
+               {
+
+               }
+
+               [Test]
+               public void DefaultProperties ()
+               {
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);
+                       Region r = new Region ();
+
+                       AssertEquals ("DefaultProperties1", r.GetBounds (g) , g.ClipBounds);
+                       AssertEquals ("DefaultProperties2", CompositingMode.SourceOver, g.CompositingMode);
+                       AssertEquals ("DefaultProperties3", CompositingQuality.Default, g.CompositingQuality);
+                       AssertEquals ("DefaultProperties4", InterpolationMode.Bilinear, g.InterpolationMode);
+                       AssertEquals ("DefaultProperties5", 1, g.PageScale);
+                       AssertEquals ("DefaultProperties6", GraphicsUnit.Display, g.PageUnit);
+                       AssertEquals ("DefaultProperties7", PixelOffsetMode.Default, g.PixelOffsetMode);
+                       AssertEquals ("DefaultProperties8", new Point (0, 0) , g.RenderingOrigin);
+                       AssertEquals ("DefaultProperties9", SmoothingMode.None, g.SmoothingMode);
+                       AssertEquals ("DefaultProperties10", TextRenderingHint.SystemDefault, g.TextRenderingHint);
+
+                       r.Dispose ();
+               }
+               
+               [Test]
+               public void SetGetProperties ()
+               {
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);                                          
+                       
+                       g.CompositingMode = CompositingMode.SourceCopy;
+                       g.CompositingQuality = CompositingQuality.GammaCorrected;
+                       g.InterpolationMode = InterpolationMode.HighQualityBilinear;
+                       g.PageScale = 2;
+                       g.PageUnit = GraphicsUnit.Inch;                 
+                       g.PixelOffsetMode = PixelOffsetMode.Half;
+                       g.RenderingOrigin = new Point (10, 20);
+                       g.SmoothingMode = SmoothingMode.AntiAlias;
+                       g.TextRenderingHint = TextRenderingHint.SystemDefault;
+
+                       //Clipping set/get tested in clipping functions                 
+                       AssertEquals ("SetGetProperties2", CompositingMode.SourceCopy, g.CompositingMode);
+                       AssertEquals ("SetGetProperties3", CompositingQuality.GammaCorrected, g.CompositingQuality);
+                       AssertEquals ("SetGetProperties4", InterpolationMode.HighQualityBilinear, g.InterpolationMode);
+                       AssertEquals ("SetGetProperties5", 2, g.PageScale);
+                       AssertEquals ("SetGetProperties6", GraphicsUnit.Inch, g.PageUnit);
+                       AssertEquals ("SetGetProperties7", PixelOffsetMode.Half, g.PixelOffsetMode);
+                       AssertEquals ("SetGetProperties8", new Point (10, 20), g.RenderingOrigin);
+                       AssertEquals ("SetGetProperties9", SmoothingMode.AntiAlias, g.SmoothingMode);
+                       AssertEquals ("SetGetProperties10", TextRenderingHint.SystemDefault, g.TextRenderingHint);                      
+               }\r
+
+               // Properties
+               [Test]
+               public void Clip ()
+               {
+                       RectangleF[] rects ;
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);
+                       g.Clip = new Region (new Rectangle (50, 40, 210, 220));
+                       rects = g.Clip.GetRegionScans (new Matrix ());
+
+                       AssertEquals ("Clip1", 1, rects.Length);
+                       AssertEquals ("Clip2", 50, rects[0].X);
+                       AssertEquals ("Clip3", 40, rects[0].Y);
+                       AssertEquals ("Clip4", 210, rects[0].Width);
+                       AssertEquals ("Clip5", 220, rects[0].Height);
+               }
+
+               [Test]
+               public void ExcludeClip ()
+               {
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);
+
+                       g.Clip = new Region (new RectangleF (10, 10, 100, 100));
+                       g.ExcludeClip (new Rectangle (40, 60, 100, 20));
+                       rects = g.Clip.GetRegionScans (new Matrix ());
+
+                       AssertEquals ("ExcludeClip1", 3, rects.Length);
+
+                       AssertEquals ("ExcludeClip2", 10, rects[0].X);
+                       AssertEquals ("ExcludeClip3", 10, rects[0].Y);
+                       AssertEquals ("ExcludeClip4", 100, rects[0].Width);
+                       AssertEquals ("ExcludeClip5", 50, rects[0].Height);
+
+                       AssertEquals ("ExcludeClip6", 10, rects[1].X);
+                       AssertEquals ("ExcludeClip7", 60, rects[1].Y);
+                       AssertEquals ("ExcludeClip8", 30, rects[1].Width);
+                       AssertEquals ("ExcludeClip9", 20, rects[1].Height);
+
+                       AssertEquals ("ExcludeClip10", 10, rects[2].X);
+                       AssertEquals ("ExcludeClip11", 80, rects[2].Y);
+                       AssertEquals ("ExcludeClip12", 100, rects[2].Width);
+                       AssertEquals ("ExcludeClip13", 30, rects[2].Height);
+               }
+
+               [Test]
+               public void IntersectClip ()
+               {
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);
+
+                       g.Clip = new Region (new RectangleF (260, 30, 60, 80));
+                       g.IntersectClip (new Rectangle (290, 40, 60, 80));
+                       rects = g.Clip.GetRegionScans (new Matrix ());
+
+                       AssertEquals ("IntersectClip", 1, rects.Length);
+
+                       AssertEquals ("IntersectClip", 290, rects[0].X);
+                       AssertEquals ("IntersectClip", 40, rects[0].Y);
+                       AssertEquals ("IntersectClip", 30, rects[0].Width);
+                       AssertEquals ("IntersectClip", 70, rects[0].Height);
+               }
+
+               [Test]
+               public void ResetClip ()
+               {
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);
+
+                       g.Clip = new Region (new RectangleF (260, 30, 60, 80));
+                       g.IntersectClip (new Rectangle (290, 40, 60, 80));
+                       g.ResetClip ();
+                       rects = g.Clip.GetRegionScans (new Matrix ());
+
+                       AssertEquals ("ResetClip", 1, rects.Length);
+
+                       AssertEquals ("ResetClip", -4194304, rects[0].X);
+                       AssertEquals ("ResetClip", -4194304, rects[0].Y);
+                       AssertEquals ("ResetClip", 8388608, rects[0].Width);
+                       AssertEquals ("ResetClip", 8388608, rects[0].Height);
+               }
+
+               [Test]
+               public void SetClip ()
+               {
+                       RectangleF[] rects ;
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);
+
+                       // Region
+                       g.SetClip (new Region (new Rectangle (50, 40, 210, 220)), CombineMode.Replace);
+                       rects = g.Clip.GetRegionScans (new Matrix ());
+                       AssertEquals ("SetClip1", 1, rects.Length);
+                       AssertEquals ("SetClip2", 50, rects[0].X);
+                       AssertEquals ("SetClip3", 40, rects[0].Y);
+                       AssertEquals ("SetClip4", 210, rects[0].Width);
+                       AssertEquals ("SetClip5", 220, rects[0].Height);
+
+                       // RectangleF
+                       g = Graphics.FromImage (bmp);
+                       g.SetClip (new RectangleF (50, 40, 210, 220));
+                       rects = g.Clip.GetRegionScans (new Matrix ());
+                       AssertEquals ("SetClip6", 1, rects.Length);
+                       AssertEquals ("SetClip7", 50, rects[0].X);
+                       AssertEquals ("SetClip8", 40, rects[0].Y);
+                       AssertEquals ("SetClip9", 210, rects[0].Width);
+                       AssertEquals ("SetClip10", 220, rects[0].Height);
+
+                       // Rectangle
+                       g = Graphics.FromImage (bmp);
+                       g.SetClip (new Rectangle (50, 40, 210, 220));
+                       rects = g.Clip.GetRegionScans (new Matrix ());
+                       AssertEquals ("SetClip10", 1, rects.Length);
+                       AssertEquals ("SetClip11", 50, rects[0].X);
+                       AssertEquals ("SetClip12", 40, rects[0].Y);
+                       AssertEquals ("SetClip13", 210, rects[0].Width);
+                       AssertEquals ("SetClip14", 220, rects[0].Height);
+               }
+               
+               [Test]
+               public void SetSaveReset ()
+               {
+                       Bitmap bmp = new Bitmap (200, 200);
+                       Graphics g = Graphics.FromImage (bmp);
+                       GraphicsState state_default, state_modified;
+                       
+                       state_default = g.Save (); // Default
+                       
+                       g.CompositingMode = CompositingMode.SourceCopy;
+                       g.CompositingQuality = CompositingQuality.GammaCorrected;
+                       g.InterpolationMode = InterpolationMode.HighQualityBilinear;
+                       g.PageScale = 2;
+                       g.PageUnit = GraphicsUnit.Inch;                 
+                       g.PixelOffsetMode = PixelOffsetMode.Half;
+                       g.Clip = new Region (new Rectangle (0, 0, 100, 100));
+                       g.RenderingOrigin = new Point (10, 20);
+                       g.SmoothingMode = SmoothingMode.AntiAlias;
+                       g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
+                       
+                       
+                       state_modified = g.Save (); // Modified
+                       
+                       g.CompositingMode = CompositingMode.SourceOver;
+                       g.CompositingQuality = CompositingQuality.Default;
+                       g.InterpolationMode = InterpolationMode.Bilinear;
+                       g.PageScale = 5;
+                       g.PageUnit = GraphicsUnit.Display;                      
+                       g.PixelOffsetMode = PixelOffsetMode.Default;
+                       g.Clip = new Region (new Rectangle (1, 2, 20, 25));
+                       g.RenderingOrigin = new Point (5, 6);
+                       g.SmoothingMode = SmoothingMode.None;
+                       g.TextRenderingHint = TextRenderingHint.SystemDefault;                  
+                                               
+                       g.Restore (state_modified);
+                       
+                       AssertEquals ("SetSaveReset1", CompositingMode.SourceCopy, g.CompositingMode);
+                       AssertEquals ("SetSaveReset2", CompositingQuality.GammaCorrected, g.CompositingQuality);
+                       AssertEquals ("SetSaveReset3", InterpolationMode.HighQualityBilinear, g.InterpolationMode);
+                       AssertEquals ("SetSaveReset4", 2, g.PageScale);
+                       AssertEquals ("SetSaveReset5", GraphicsUnit.Inch, g.PageUnit);
+                       AssertEquals ("SetSaveReset6", PixelOffsetMode.Half, g.PixelOffsetMode);
+                       AssertEquals ("SetSaveReset7", new Point (10, 20), g.RenderingOrigin);
+                       AssertEquals ("SetSaveReset8", SmoothingMode.AntiAlias, g.SmoothingMode);
+                       AssertEquals ("SetSaveReset9", TextRenderingHint.ClearTypeGridFit, g.TextRenderingHint);                        
+                       AssertEquals ("SetSaveReset10", 0, (int) g.ClipBounds.X);
+                       AssertEquals ("SetSaveReset10", 0, (int) g.ClipBounds.Y);
+                       
+                       g.Restore (state_default);                      
+                       
+                       AssertEquals ("SetSaveReset11", CompositingMode.SourceOver, g.CompositingMode);
+                       AssertEquals ("SetSaveReset12", CompositingQuality.Default, g.CompositingQuality);
+                       AssertEquals ("SetSaveReset13", InterpolationMode.Bilinear, g.InterpolationMode);
+                       AssertEquals ("SetSaveReset14", 1, g.PageScale);
+                       AssertEquals ("SetSaveReset15", GraphicsUnit.Display, g.PageUnit);
+                       AssertEquals ("SetSaveReset16", PixelOffsetMode.Default, g.PixelOffsetMode);
+                       AssertEquals ("SetSaveReset17", new Point (0, 0) , g.RenderingOrigin);
+                       AssertEquals ("SetSaveReset18", SmoothingMode.None, g.SmoothingMode);
+                       AssertEquals ("SetSaveReset19", TextRenderingHint.SystemDefault, g.TextRenderingHint);          
+
+                       Region r = new Region ();
+                       AssertEquals ("SetSaveReset20", r.GetBounds (g) , g.ClipBounds);
+                       
+                       g.Dispose ();                   
+               }
+
+
+               [Test]
+               public void LoadIndexed ()
+               {
+                       //
+                       // Tests that we can load an indexed file
+                       //
+
+                       Stream str = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("indexed.png");
+                       Image x = Image.FromStream (str);
+                       Graphics g = Graphics.FromImage (x);
+               }
+       }
+}
+
index b4fea3cbd5b89b28e5a4c859d82de9a52206025b..6b9bb2a299c87115d0cf26c91e3fe97926932b00 100644 (file)
@@ -33,10 +33,12 @@ using System;
 using System.Drawing;
 using NUnit.Framework;
 using System.IO;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing{
 
        [TestFixture]   
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestIcon {
                
                Icon icon;
index cfe721e6d78a6488a344d4cecf19b46221525a88..a588e8fe9a9426e25d496757b43dac530d6c3571 100644 (file)
@@ -37,10 +37,12 @@ using System.Collections;
 using System.ComponentModel;
 using System.Globalization;
 using System.IO;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class IconConverterTest
        {
                Icon icon;              
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs
new file mode 100644 (file)
index 0000000..7a77f3d
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// Image class testing unit
+//
+// Author:
+//
+//      Jordi Mas i Hernàndez (jmas@softcatala.org>
+//
+// (C) 2005 Ximian, Inc.  http://www.ximian.com
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using NUnit.Framework;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Drawing{
+
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+       public class TestImage {
+
+
+               [Test]
+               [ExpectedException (typeof (FileNotFoundException))]
+               public void FileDoesNotExists ()
+               {
+                       Image img = Image.FromFile ("FileDoesNotExists.jpg");
+               }
+       }
+}
index fb5a9b0441a9bc7247ff42e5261cae38a1390d5a..507522568977819716ca02066394d87bfdb0f869 100644 (file)
@@ -37,10 +37,12 @@ using System.Collections;
 using System.ComponentModel;
 using System.Globalization;
 using System.IO;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class ImageConverterTest 
        {
                Image image;            
@@ -427,7 +429,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [Ignore ("This test fails because of bug #58435")]
                public void TestGetProperties ()
                {
                        PropertyDescriptorCollection propsColl;
index 724280c64e77fb4c0427310c26c19dc331e4a306..22ad5f3e00d8cf3bff183712677f7b478c74db79 100644 (file)
@@ -37,10 +37,12 @@ using System.Collections;
 using System.ComponentModel;
 using System.Globalization;
 using System.IO;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class ImageFormatConverterTest
        {
                ImageFormat imageFmt;           
index 86742e30edf5d76ac93ec806a43939e0b3c4e44d..00172e0b1ec2af734af74936e22c59da1527ab48 100644 (file)
@@ -32,10 +32,12 @@ using NUnit.Framework;
 using System;
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class PensTest : Assertion
        {
                [SetUp]
index be92de988cb4f0ce215473c512b24872832e0105..d60bac2929a5cee868866f061b73f756de721639 100644 (file)
 using NUnit.Framework;
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing{
 
        [TestFixture]   
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class PointTest : Assertion {
                Point pt1_1;
                Point pt1_0;
index 20aa676bdbab923088981884a83173a41bed0c2f..af3d2e32966320461c1661a3c44793d179d7fcac 100644 (file)
@@ -33,6 +33,7 @@ using System.ComponentModel;
 using System.ComponentModel.Design.Serialization;
 using System.Drawing;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Threading;
 
 using NUnit.Framework;
@@ -40,6 +41,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Drawing
 {
        [TestFixture]   
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class PointConverterTest
        {
                Point pt;
@@ -262,7 +264,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [Ignore ("This test fails because of bug #58435")]
                public void TestGetProperties ()
                {
                        Attribute [] attrs;
index 8cf11a5e7ff8e18e66a79ce13e65d133fc0f1cdc..af9f9c758ab8493115f0f5109d7657ae62863d59 100644 (file)
 using System;
 using System.Drawing;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Threading;
 
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing
 {
-       [TestFixture]
+       [TestFixture]   
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class PointFTest
        {
                PointF pt11_99;
index 9e7ea7c27047dbde4000811025ea73f25297bb58..73f62a3c51caa2ac70518a8913372096ce610c90 100644 (file)
 using NUnit.Framework;
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
 
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestRectangle : Assertion
        {
                Rectangle rect_0;
index ec8d6aa3bbcf701fc7033f491d0fbc8095cfaa0d..dbc36ddd77919c00f2c6a60876468c6837827f40 100644 (file)
@@ -34,6 +34,7 @@ using System.ComponentModel;
 using System.ComponentModel.Design.Serialization;
 using System.Drawing;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Threading;
 
 using NUnit.Framework;
@@ -41,6 +42,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Drawing
 {
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class RectangleConverterTest
        {
                Rectangle rect;
@@ -322,7 +324,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [Ignore ("This test fails because of bug #58435")]
                public void TestGetProperties ()
                {
                        Attribute [] attrs;
index a0d253d403129746d9637c5c050c13ea4c3d2462..27a288b75a96a4b18f5dd3748727f334a28506d0 100644 (file)
 using NUnit.Framework;
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
 
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestRectangleF : Assertion
        {
                RectangleF rect_0;
index e05972d75322ba9512913a4d25e7188f1d73251f..90dcb9c2bb583c357d72fa377e48c05f5c623562 100644 (file)
@@ -32,12 +32,14 @@ using System;
 using System.Drawing.Imaging;
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.Security.Permissions;
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing
 {
 
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class TestRegion
        {
                [TearDown]
index 2096558f5acb570bf8085a6470ce4a6f68a60d39..c0eeae43da2307b23dad7238a5792290dbdba60d 100644 (file)
 using NUnit.Framework;
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing 
 {
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class SizeTest : Assertion 
        {
                Size sz1_1;
index 5052731cfa1e67e46fdbb51a64625272c3765686..22592590fa648b70663f325e8652cc7b0c4faa09 100644 (file)
@@ -34,6 +34,7 @@ using System.ComponentModel;
 using System.ComponentModel.Design.Serialization;
 using System.Drawing;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Threading;
 
 using NUnit.Framework;
@@ -41,6 +42,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Drawing
 {
        [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class SizeConverterTest
        {
                Size sz;
@@ -265,7 +267,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [Ignore ("This test fails because of bug #58435")]
                public void TestGetProperties ()
                {
                        Attribute [] attrs;
index 1cdab31794e9c5aeb78606b802149670b1b8ad66..77549fd91330e36bb27e8dae4ac55342da6bebd1 100644 (file)
@@ -30,6 +30,7 @@
 
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 using System.Globalization;
 using System.Threading;
 
@@ -37,7 +38,8 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Drawing 
 {
-       [TestFixture]
+       [TestFixture]   
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class SizeFTest
        {
                SizeF sz11_99;
index d5592db239b43e8c2368980bfd48bdd888ca9c98..657cc25078c8c5db577db82d06e70777570673f5 100644 (file)
 using System;
 using System.Drawing;
 using System.Drawing.Imaging;
+using System.Security.Permissions;
 using NUnit.Framework;
 
 namespace MonoTests.System.Drawing{
 
        [TestFixture]   
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class StringFormatTest {
                
                [TearDown]
index 2894e7e261a5d14fd3c3dd2e55acb5be61a5e87f..795cdf851dfbc37a08c9b06c5482a2a91fcd8aa0 100644 (file)
 using NUnit.Framework;
 using System;
 using System.Drawing;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class SystemBrushesTest : Assertion
        {
                [TearDown]
index 34b8928ed85932d27021b199490552035eac2de0..1e82a8607df7bc276a6868732907a724c1abb5ad 100644 (file)
@@ -32,10 +32,12 @@ using NUnit.Framework;
 using System;
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.Security.Permissions;
 
 namespace MonoTests.System.Drawing
 {
-       [TestFixture]   
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class SystemPensTest : Assertion
        {
                [TearDown]
index 27be6e0dc3dcc25753c96d0592bb5cd2a59532a5..8a69b3d581651ff225eacf645357e8066930f243 100644 (file)
                     SubType = "Code"\r
                     BuildAction = "Compile"\r
                 />\r
+                <File\r
+                    RelPath = "DrawingTest\Test\GraphicsPathIterator.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
                 <File\r
                     RelPath = "DrawingTest\Test\Image.cs"\r
                     SubType = "Code"\r
index c25ade1be5c50fa6d934c43c0c1ab704ca744145..c42968e055e4e8a65f9bfe032aa9fb31bef922e9 100644 (file)
@@ -26,6 +26,7 @@
                                <File RelPath="DrawingTest\Test\Brush.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="DrawingTest\Test\Graphics.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="DrawingTest\Test\GraphicsPath.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="DrawingTest\Test\GraphicsPathIterator.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="DrawingTest\Test\Image.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="DrawingTest\Test\Pen.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="DrawingTest\Test\Region.cs" SubType="Code" BuildAction="Compile"/>\r
diff --git a/mcs/class/System.Drawing/Test/resources/indexed.png b/mcs/class/System.Drawing/Test/resources/indexed.png
new file mode 100644 (file)
index 0000000..2ea1fe1
Binary files /dev/null and b/mcs/class/System.Drawing/Test/resources/indexed.png differ
index 6fbb708fd7d689429c78fc91a1070cf7e5dde1bf..805830fd0f3c2d2dfc23eb847f33e6c3c2567564 100644 (file)
@@ -5,12 +5,12 @@ include ../../build/rules.make
 LIBRARY = System.Security.dll
 LIB_MCS_FLAGS = -nowarn:618 \
        -r:$(corlib) -r:System.dll -r:System.Xml.dll \
-       /debug+
+       -debug+
 
 ifeq (net_2_0,$(PROFILE))
 LIB_MCS_FLAGS += -r:Mono.Security.dll
 endif
 
-TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 -nowarn:1595
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:169,219,618,1595
 
 include ../../build/library.make
index 43fc43e54a729dbe0be522976d8873530dfb7967..f3baa27e101e989030ff189a908ba1f704c86bfb 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-08  Eyal Alaluf <eyala@mainsoft.com>
+       * System.Web.vmwcsproj - updated to match new code base
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * System.Web.dll.sources: add MinimizableAttributeTypeConverter.
+
+       * System.Web_test.dll.sources: add
+       MinimizableAttributeTypeConverter test.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * System.Web.dll.sources: add HtmlLink.cs and HtmlMeta.cs
+
+       * System.Web_test.dll.sources: add HtmlLinkTest and HtmlMetaTest.
+
 2005-08-31  Chris Toshok  <toshok@ximian.com>
 
        * System.Web.dll.sources: add
index 7174c69b3d1217630972405467a84140db7d7fca..816942414c89f7a6fcb97dded3ad20f30e3fb560 100644 (file)
@@ -238,44 +238,11 @@ A: a few things are required:
 
        <add verb="*" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 
-   2. Apply the following patch to your browscap.ini (this patch only
+   2. Apply the patch file 'browscap.ini.diff' to your browscap.ini (this patch only
       works if you're using firefox, IE6, or Safari.  I didn't bother with any others.):
------
-Index: browscap.ini
-===================================================================
---- browscap.ini        (revision 48810)
-+++ browscap.ini        (working copy)
-@@ -4958,6 +4958,8 @@
- version=1.3
- majorver=1
- minorver=3
-+ecmascriptversion=1.3
-+w3cdomversion=1.0
-
- [Mozilla/5.0 (Macintosh; U; PPC Mac OS X; *) AppleWebKit/* (*) Safari/412*]
- parent=Safari
-@@ -12424,6 +12426,8 @@
- stripper=False
- wap=False
- netclr=False
-+ecmascriptversion=1.3
-+w3cdomversion=1.0
-
- [Mozilla/5.0 (Macintosh; *; PPC Mac OS X Mach-O; *rv:*) Gecko/* Firefox/1.0*]
- parent=Firefox 1.0
-@@ -13306,6 +13310,8 @@
- netclr=False
- AK=False
- SK=False
-+ecmascriptversion=1.3
-+w3cdomversion=1.0
-
- [Mozilla/?.0 (compatible; MSIE 6.0*;*Windows NT 5.2*)*]
- parent=IE 6.0
------
 
   Once these two steps are completed, just going to be a page with
-  validators that have EnableClientScript="true" should be enough.
+  validators that have EnableClientScript="true" (the default) should be enough.
 
 Q: My control can get a URL in one of its attributes. The value can be something
 like "~/blah" or "../bleh" or... How do I translate that into a URL that is
index 6efd424edad6cc7628130c0937eb86405cc15127..7b6e0a1c99191a3520d166c4feb34e7aba123e1d 100644 (file)
@@ -56,7 +56,7 @@ endif
 LIBRARY = System.Web.dll
 LIB_MCS_FLAGS = \
        -unsafe \
-       -nowarn:649     \
+       -nowarn:612,649 \
        -r:$(corlib)                    \
        -r:System.dll                   \
        -r:System.Drawing.dll           \
index a42acd18ccca4f1c49ef00bd2dcd577f91dd0269..c98706a139ed75ca15d84aa9a0f4e0f44aad4641 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Threading;
 using System.Collections;
+using System.Security.Permissions;
 
 namespace System.Web.Caching
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class Cache: IEnumerable
        {
                Hashtable cache;
@@ -171,8 +173,13 @@ namespace System.Web.Caching
                                                it.Dependency.Dispose ();
                                        }
                                        cache.Remove (key);
-                                       if (it.OnRemoveCallback != null)
-                                               it.OnRemoveCallback (key, it.Value, reason);
+                                       if (it.OnRemoveCallback != null) {
+                                               try {
+                                                       it.OnRemoveCallback (key, it.Value, reason);
+                                               } catch {
+                                                       //TODO: anything to be done here?
+                                               }
+                                       }
                                        return it.Value;
                                }
                                else
index 2cb3c5105abcdc89b042f5739e3b04b5354538fe..f887f5da77571ecc7bab7a91f4f7caf10a888cc6 100644 (file)
 
 using System.Collections;
 using System.IO;
+using System.Security.Permissions;
 
 namespace System.Web.Caching
 {
-       public sealed class CacheDependency: IDisposable
-       {
+#if NET_2_0
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public class CacheDependency: IDisposable {
+#else
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class CacheDependency: IDisposable {
+#endif
                string[] cachekeys;
                CacheDependency dependency;
                DateTime start;
index 592686c1db7ecb7443e7e46c83dc63ca71d2b641..25c919f3a5a5bd10f44b7bfa034246a5b01170fa 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-08  Eyal Alaluf  <eyala@mainsoft.com>
+       * OutputCacheModule.cs: Use C# 1.0 style of delegate instantiating.
+         Needed to compile Grasshopper (TARGET_J2EE) which uses MS C# 1.0 compiler
+         and does not use msc.
+
+2005-09-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * Cache.cs: ignore exceptions thrown by removed item callbacks.
+
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * Cache.cs: Added security permissions with Minimal level for
+       AspNetHostingPermissionLevel (only LinkDemand as the class is sealed).
+       * CacheDependency.cs: : Added security permissions with Minimal level 
+       for AspNetHostingPermissionLevel (note class is sealed only in 1.x).
+
 2005-09-01 Eyal Alaluf <eyala@mainsoft.com>
        * CacheDependency.cs: TARGET_J2EE fixes.
 
@@ -34,7 +50,7 @@
        * CacheDependency.cs - added TARGET_JVM directives in places,
          where file watching is using (Mainsoft's implementation currently
          doesn't support the feature).
-         
+
 2005-05-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * CacheEntry.cs: credits for this patch should go to mcs. it catched
index e5e54cc2f8b09ca9d1dee5f18f1c136822705155..b39d555496353b385b35ef1509d774250c709542 100644 (file)
@@ -49,8 +49,8 @@ namespace System.Web.Caching {
 
                public void Init (HttpApplication app)
                {
-                       app.ResolveRequestCache += OnResolveRequestCache;
-                       app.UpdateRequestCache += OnUpdateRequestCache;
+                       app.ResolveRequestCache += new EventHandler(OnResolveRequestCache);
+                       app.UpdateRequestCache += new EventHandler(OnUpdateRequestCache);
  
                        response_removed = new CacheItemRemovedCallback (OnRawResponseRemoved);
                }
index c772b4b4b5b15da202d407be343f6dd4cbd00da0..2ca32876f896fc2864527b8d0cde75056cad894d 100644 (file)
@@ -42,7 +42,6 @@ namespace System.Web.Compilation
 {
        abstract class BaseCompiler
        {
-               string dynamic_dir;
                TemplateParser parser;
                CodeDomProvider provider;
                ICodeCompiler compiler;
@@ -288,30 +287,7 @@ namespace System.Web.Compilation
 
                protected string DynamicDir ()
                {
-                       if (dynamic_dir != null)
-                               return dynamic_dir;
-
-                       dynamic_dir = AppDomain.CurrentDomain.SetupInformation.DynamicBase;
-                       if (dynamic_dir != null && dynamic_dir != "")
-                               return dynamic_dir;
-                       
-                       for (int i = 0; ; i++){
-                               string d = Path.Combine (
-                                       Path.GetTempPath (),
-                                       String.Format ("{0}-temp-aspnet-{1:x}", Environment.UserName, i));
-                       
-                               try {
-                                       Directory.CreateDirectory (d);
-                                       string stamp = Path.Combine (d, "stamp");
-                                       Directory.CreateDirectory (stamp);
-                                       dynamic_dir = d;
-                                       Directory.Delete (stamp);
-                                       break;
-                               } catch (UnauthorizedAccessException){
-                                       continue;
-                               }
-                       }
-                       return dynamic_dir;
+                       return AppDomain.CurrentDomain.SetupInformation.DynamicBase;
                }
                
                public virtual Type GetCompiledType () 
index 39a5df71867a7b390d59ff5b9ed0048a62714b4a..9c3bdca4095c38389c25981cd123cbfc7e8efa1f 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * BaseCompiler.cs: set the domain's DynamicBase property instead of
+       guessing it in BaseCompiler.
+
 2005-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * WebServiceCompiler.cs: apply the same fix as in r45440 that fixed bug
index 2127c43276d69629e8897ab2750d4ad261d1d473..45f5efe1219a1c9ac72b2a5f5177cf97d3b14658 100644 (file)
 
 #if NET_2_0
 
-using System;
 using System.Collections.Specialized;
+using System.Runtime.Serialization;
 
 namespace System.Web.Configuration
 {
        [Serializable]
-       public class AdapterDictionary: OrderedDictionary
+       public class AdapterDictionary: OrderedDictionary, IDeserializationCallback
        {
                public string this [string key] {
                        get { return (string) base [key]; }
                        set { base [key] = value; }
                }
+
+               [MonoTODO]
+               void IDeserializationCallback.OnDeserialization (object sender)
+               {
+                       throw new NotImplementedException ();
+               }
        }
 }
 
index ff0d8c675e0f2bdd4405ef2ea05f48a89759dd75..18619a0612f7ebf32dee2e22c3d0ebf3a731a7be 100644 (file)
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-using System.Resources;
-
 #if NET_2_0
 namespace System.Web.Configuration
 {
         public enum AuthorizationRuleAction
         {
-                Allow = 1,
-                Deny = 2,
+                Deny,
+                Allow
         }
 }
 #endif
index eaa6030dd70f0c906aa7424d1ec9730231befe1e..6c10bedc708f0d47d159e91eb6e99ba4604af031 100644 (file)
@@ -33,14 +33,11 @@ using System.Configuration;
 
 namespace System.Web.Configuration
 {
-       public class BuildProvider : ConfigurationElement {
+       public sealed class BuildProvider : ConfigurationElement {
                string extension;
                string type;
                BuildProviderAppliesTo appliesTo;
 
-               public BuildProvider ()
-               {
-               }
 
                public BuildProvider (string extension, string type, BuildProviderAppliesTo appliesTo)
                {
index b14a394e2589bc117f2e5f179b1d7c4d31c9304b..3c8505e65d6434a8166c7f4485ac3ebc3899b412 100644 (file)
@@ -88,7 +88,7 @@ namespace System.Web.Configuration
 
                protected override ConfigurationElement CreateNewElement ()
                {
-                       return new BuildProvider ();
+                       return new BuildProvider (null, null, BuildProviderAppliesTo.Web);
                }
 
                protected override object GetElementKey (ConfigurationElement element)
index 0af0ad4e662e196c48ea237dbe1eda6c8af6cba7..7ed13d49daac445a869141c09f5da9125968b7d4 100644 (file)
@@ -1,3 +1,27 @@
+2005-09-15  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * CompilationConfiguration.cs: Return an empty configuration object if
+       no HttpContext is available. This is required for the unit tests and
+       match the results of MS 1.1 and 2.0 (beta2).
+
+2005-08-24  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AdapterDictionary.cs: Added missing IDeserializationCallback.
+       * AuthorizationRuleAction.cs: Fixed enum values.
+       * BuildProvider.cs: Class is sealed. Removed empty constructor.
+       * BuildProviderCollection.cs: Adapted to BuildProvider ctor changes.
+       * CodeSubDirectory.cs: Added missing constructor.
+       * CodeSubDirectoriesCollection.cs: Adapted to 
+       CodeSubDirectoriesCollection ctor changes.
+       * CustomErrorsMode.cs: Fixed enum values.
+       * FormsAuthenticationConfiguration.cs: Class is sealed.
+       * HttpCapabilitiesBase.cs: Added security permissions with Minimal 
+       level for AspNetHostingPermission (both Link and Inheritance demands).
+       * ProcessModelComAuthenticationLevel.cs: Fixed enum values.
+       * ProcessModelComImpersonationLevel.cs: Fixed enum values.
+       * ProcessModelLogLevel.cs: Fixed enum values.
+       * WebApplicationLevel.cs: New enum for 2.0.
+
 2005-08-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * ModulesConfiguration.cs: LoadModules creates a HttpModuleCollection,
index 2578fee95b95ef215d57ba9804c0500709dbb27a..0d2ae2b2abf616710771883030209b82f4298f7c 100644 (file)
@@ -77,7 +77,7 @@ namespace System.Web.Configuration
 
                protected override ConfigurationElement CreateNewElement ()
                {
-                       return new CodeSubDirectory ();
+                       return new CodeSubDirectory (null);
                }
 
                protected override object GetElementKey (ConfigurationElement element)
index d1f248ca26901924e61a612712712da22472c959..745460cd2929e473b9839772523416a147104a5c 100644 (file)
@@ -47,6 +47,11 @@ namespace System.Web.Configuration
                        props.Add (prop);
 */             }
 
+               public CodeSubDirectory (string directoryName)
+               {
+                       this.directoryName = directoryName;
+               }
+
                public string DirectoryName {
                        get { return directoryName; }
                        set { directoryName = value; }
index 08f86b0a9bab1e341bde07e40494b88fad44d9db..9f1aa14344c2714d03597a2ca65e19743d2b1845 100644 (file)
@@ -77,10 +77,14 @@ namespace System.Web.Configuration
                        if (context == null)
                                context = HttpContext.Current;
 
-                       config = context.GetConfig ("system.web/compilation") as CompilationConfiguration;
-
-                       if (config == null)
-                               throw new Exception ("Configuration error.");
+                       if (context != null) {
+                               config = context.GetConfig ("system.web/compilation") as CompilationConfiguration;
+                               if (config == null)
+                                       throw new Exception ("Configuration error.");
+                       } else {
+                               // empty config (as used in unit tests)
+                               config = new CompilationConfiguration (null);
+                       }
 
                        return config;
                }
index 3fd8d4192305ee72f069b22520c8e5269de02cdc..7b10bf5e0f9d34909012958b1af07eb349b80180 100644 (file)
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-using System.Resources;
-
 #if NET_2_0
 namespace System.Web.Configuration
 {
         public enum CustomErrorsMode
         {
-                On = 1,
-                Off = 2,
-                RemoteOnly = 3,
+                RemoteOnly,
+                On,
+                Off
         }
 }
 #endif
index 9e121376f89b4c1d915c107e8c2a5bcad1575f9f..0c692c08dafb2ef21d0d66a9b3ada1c02205fea7 100644 (file)
 
 #if NET_2_0
 
-using System;
 using System.Configuration;
 
 namespace System.Web.Configuration
 {
-       public class FormsAuthenticationConfiguration: ConfigurationElement
+       public sealed class FormsAuthenticationConfiguration: ConfigurationElement
        {
        }
 }
index 3ff24e353225ec567c57f76f46488725dcaacdb1..8e413cad69b3c3a65de59e612f21b3acee5f7410 100644 (file)
@@ -5,9 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-// (C) 2003,2004 Novell, Inc (http://www.novell.com)
-//
-
+// Copyright (C) 2003,2004,2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Collections;
+using System.Security.Permissions;
+
 namespace System.Web.Configuration
 {
-       using System;
-       using System.Collections;
-       using System.Web;
-       
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public partial class HttpCapabilitiesBase
        {
                Hashtable capabilities;
index 937b0c9bf548b78be3590ede8bcefa57a1bd1fca..b2f5e4f04be6d5b66d699be34e28c583ea462b39 100644 (file)
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-using System.Resources;
-
 #if NET_2_0
 namespace System.Web.Configuration
 {
         public enum ProcessModelComAuthenticationLevel
         {
-                Call = 1,
-                Connect = 2,
-                Default = 3,
-                None = 4,
-                Pkt = 5,
-                PktIntegrity = 6,
-                PktPrivacy = 7
+                None,
+                Call,
+                Connect,
+                Default,
+                Pkt,
+                PktIntegrity,
+                PktPrivacy
         }
 }
 #endif
index a84607ea193dd76add621d038824719b323afa6a..e25fc8adc42514c5075adef5c8d80e22ae245655 100644 (file)
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-using System.Resources;
-
 #if NET_2_0
 namespace System.Web.Configuration
 {
         public enum ProcessModelComImpersonationLevel
         {
-                Anonymous = 1,
-                Default = 2,
-                Delegate = 3,
-                Identify = 4,
-                Impersonate = 5
+                Default,
+                Anonymous,
+                Delegate,
+                Identify,
+                Impersonate
         }
 }
 #endif
index 94edfe9046d6e7ef295119fd97742f5485ab9b31..3d70f99d3b3481731e52c6363ec4f87f16034013 100644 (file)
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-using System.Resources;
-
 #if NET_2_0
 namespace System.Web.Configuration
 {
         public enum ProcessModelLogLevel
         {
-                All = 1,
-                Errors = 2,
-                None = 3
+                None,
+                All,
+                Errors
         }
 }
 #endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/WebApplicationLevel.cs b/mcs/class/System.Web/System.Web.Configuration/WebApplicationLevel.cs
new file mode 100644 (file)
index 0000000..3183a5b
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// System.Web.Configuration.WebApplicationLevel enum
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Web.Configuration {
+
+       public enum WebApplicationLevel {
+               AboveApplication = 10,
+               AtApplication = 20,
+               BelowApplication = 30
+       }
+}
+
+#endif
index a156e9e1a1538401df94181e19a84d8ac2166560..16ba405cbfe0c3c7ec8824d7be3647534044a568 100644 (file)
@@ -28,7 +28,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Web;
 using System.Web.UI;
 using System.Reflection;
 using System.IO;
@@ -36,7 +35,7 @@ using System.IO;
 namespace System.Web.Handlers {
        [MonoTODO ("Should we cache stuff?")]
        #if NET_2_0
-       public
+       public sealed
        #else
        internal // since this is in the .config file, we need to support it, since we dont have versoned support.
        #endif
index eb1b06f0fbc7394b050f6f2c9e6ad6ab40ad4718..a4f9de87c50d2102beaad4b510cc4ebc7f0692d2 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AssemblyResourceLoader.cs: Class is sealed in 2.0.
+       * TraceHandler.cs: Added security permissions on class (LinkDemand and
+       InheritanceDemand for AspNetHostingPermission) and on ctor (Demand for
+       UnmanagedCode). Stubbed new protected methods for 2.0.
+
 2004-11-18  Lluis Sanchez Gual <lluis@novell.com>
 
        * AssemblyResourceLoader.cs: Use a special name when encoding a resource
index 23e35288f80454f58da4a4e07f96147cc22946cd..7845d42604e5c9c1e66a1c8db26f4bf6294e0e6b 100644 (file)
@@ -32,7 +32,7 @@
 
 using System.Collections;
 using System.Data;
-using System.Web;
+using System.Security.Permissions;
 using System.Web.Util;
 using System.Web.UI;
 using System.Web.UI.WebControls;
@@ -62,9 +62,23 @@ namespace System.Web.Handlers
                }
        }
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class TraceHandler : IHttpHandler
        {
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public TraceHandler ()
+               {
+                       // LAMESPEC: the ctor is documented to have a Demand for a SecurityPermission
+                       // but doesn't specify which one it is (tests shows it's UnmanagedCode)
+               }
+
+#if NET_2_0
+               public void ProcessRequest (HttpContext context)
+#else
                void IHttpHandler.ProcessRequest (HttpContext context)
+#endif
                {
                        TraceManager manager = HttpRuntime.TraceManager;
 
@@ -90,8 +104,11 @@ namespace System.Web.Handlers
                                
                }
 
-               bool IHttpHandler.IsReusable
-               {
+#if NET_2_0
+               public bool IsReusable {
+#else
+               bool IHttpHandler.IsReusable {
+#endif
                        get {
                                return false;
                        }
@@ -176,11 +193,21 @@ namespace System.Web.Handlers
                protected void ShowDetails (DataSet data)
                {
                }
+#if NET_2_0
+               [MonoTODO ("Appears in class status, but...")]
+               protected void ShowRequests (IList data)
+               {
+               }
 
+               [MonoTODO]
+               protected void ShowVersionDetails ()
+               {
+               }
+#else
                [MonoTODO ("Appears in class status, but...")]
                protected void ShowRequests (ArrayList list)
                {
                }
+#endif
        }
 }
-
index da23998fefa009df881b9be3024d8e234a49ae7b..065e08157d5f4c76509d40f0871b025782e0f6e4 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.Permissions;
+
 namespace System.Web.Hosting {
 
-       public sealed class AppDomainFactory {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class AppDomainFactory : IAppDomainFactory {
+
+#if NET_2_0
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
+#endif
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public AppDomainFactory ()
+               {
+               }
 
+               [MonoTODO]
                public object Create (string module, string typeName, string appId, string appPath, string strUrlOfAppOrigin, int iZone)
                {
                        throw new NotImplementedException ();
index 43220e0120580dee9ca3ebe4fe89e37797ab1fc3..a5dec8b5dde381443c6142482fae3bec11dd81c2 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
+using System.Security.Permissions;
 using System.Security.Policy;
 
 namespace System.Web.Hosting {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class ApplicationHost {
 
                static string [] types = { "Web.config", "web.config" };
@@ -60,6 +62,7 @@ namespace System.Web.Hosting {
                //
                //    http://www.west-wind.com/presentations/aspnetruntime/aspnetruntime.asp
                // 
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public static object CreateApplicationHost (Type hostType, string virtualDir, string physicalDir)
                {
                        if (physicalDir == null)
@@ -78,9 +81,6 @@ namespace System.Web.Hosting {
                        if (virtualDir == null)
                                throw new NullReferenceException ();
 
-                       if (hostType == null || virtualDir == null || physicalDir == null)
-                               throw new NullReferenceException ();
-
                        Evidence evidence = new Evidence (AppDomain.CurrentDomain.Evidence);
 
                        // 
@@ -96,6 +96,7 @@ namespace System.Web.Hosting {
                        setup.ApplicationBase = physicalDir;
 
                        setup.CachePath = null;
+                       setup.ApplicationName = domain_id;
                        setup.ConfigurationFile = FindWebConfig (physicalDir);
                        setup.DisallowCodeDownload = true;
                        setup.PrivateBinPath = "bin";
@@ -104,6 +105,26 @@ namespace System.Web.Hosting {
                        UriBuilder b = new UriBuilder ("file://", null, 0, Path.Combine (physicalDir, "bin"));
                        setup.ShadowCopyDirectories = b.Uri.ToString ();
 
+                       string dynamic_dir = null;
+                       string user = Environment.UserName;
+                       for (int i = 0; ; i++){
+                               string d = Path.Combine (Path.GetTempPath (),
+                                       String.Format ("{0}-temp-aspnet-{1:x}", user, i));
+                       
+                               try {
+                                       Directory.CreateDirectory (d);
+                                       string stamp = Path.Combine (d, "stamp");
+                                       Directory.CreateDirectory (stamp);
+                                       dynamic_dir = d;
+                                       Directory.Delete (stamp);
+                                       break;
+                               } catch (UnauthorizedAccessException){
+                                       continue;
+                               }
+                       }
+                       setup.DynamicBase = dynamic_dir;
+                       Directory.CreateDirectory (setup.DynamicBase);
+
                        //
                        // Create app domain
                        //
index 0226a26429e3583cfda23919a7d56723648dfae7..b4491204a9188598548bad50b65f8c9567831384 100644 (file)
@@ -1,3 +1,24 @@
+2005-09-10  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AppDomainFactory.cs: Added LinkDemand for Minimal. Added Demand for
+       UnmanagedCode on ctor. Added TODO on unimplemented method.
+       * ApplicationHost.cs: Added LinkDemand for Minimal. Added Demand for 
+       UnmanagedCode on ctor. Removed duplicate null checks.
+       * ISAPIRuntime.cs: Fixed inheritance (added MarshalByRefObject and 
+       IRegisteredObject) for 2.0. Added LinkDemand for Minimal. Added Demand 
+       for UnmanagedCode on ctor.
+       * SimpleWorkerRequest.cs: Added LinkDemand and InheritanceDemand (not
+       sealed) for Minimal. Added Demands for UnmanagedCode on ctors. Added
+       FileIOPermission for PathDiscovery before returning processed paths.
+
+2005-09-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * ApplicationHost.cs: set the domain's DynamicBase property instead of
+       guessing it in BaseCompiler.
+
+2005-09-08  Eyal Alalouf  <eyala@mainsoft.com>
+       * ServletWorkerRequest.jvm.cs: Implement SendResponseFromFile
+
 2005-07-24  Eyal Alalouf  <eyala@mainsoft.com>
        * ServletWorkerRequest.jvm.cs: Put Console.WriteLine in #if DEBUG
 
index 44dc266eed8bd2058f9788a580016fe9598e15bc..e5abc91e78a93b857ad8a87f7ee5bea7fdd121f9 100644 (file)
@@ -7,8 +7,7 @@
 //
 // (C) Bob Smith
 // (c) 2002 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
-namespace System.Web.Hosting
-{
-        public sealed class ISAPIRuntime : IISAPIRuntime
-        {
-               [MonoTODO]
+namespace System.Web.Hosting {
+
+#if NET_2_0
+        public sealed class ISAPIRuntime : MarshalByRefObject, IISAPIRuntime, IRegisteredObject {
+#else
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+        public sealed class ISAPIRuntime : IISAPIRuntime {
+#endif
+
+#if NET_2_0
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
+#endif
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                 public ISAPIRuntime ()
                {
-                       throw new NotImplementedException ();
                }
                
                [MonoTODO]
@@ -61,9 +68,26 @@ namespace System.Web.Hosting
                }
                
                [MonoTODO]
+#if NET_2_0
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+#endif
                 public void StopProcessing ()
                {
                        throw new NotImplementedException ();
                }
+
+#if NET_2_0
+               [MonoTODO]
+               public override object InitializeLifetimeService ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               void IRegisteredObject.Stop (bool immediate)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
         }
 }
index 9b63751200160be55d839b4465c2c20070a4e7b1..f9e04e56a7d7be411932975fb43c3eaf25767029 100644 (file)
@@ -388,6 +388,19 @@ namespace System.Web.Hosting
 
                public override void SendResponseFromFile (string filename, long offset, long length)
                {
+                       using (FileStream fs = File.OpenRead (filename)) {
+                               byte [] buffer = new byte [4 * 1024];
+
+                               if (offset != 0)
+                                       fs.Position = offset;
+
+                               long remain = length;
+                               int n;
+                               while (remain > 0 && (n = fs.Read (buffer, 0, (int) Math.Min (remain, buffer.Length))) != 0){
+                                       remain -= n;
+                                       SendResponseFromMemory(buffer, n);
+                               }
+                       }
                }
 
                public override void SendResponseFromMemory (byte [] data, int length)
index 1042b11e836e5e0ce2ada5aebc7c9268b2863d74..f73ff7f1ba80ea250e91e3d8c8f72a96412bbfa7 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.IO;
 using System.Runtime.InteropServices;
-using System.Web;
+using System.Security;
+using System.Security.Permissions;
 using System.Web.UI;
 using System.Web.Util;
 
 namespace System.Web.Hosting {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ComVisible (false)]
        public class SimpleWorkerRequest : HttpWorkerRequest {
                string page;
@@ -55,6 +59,7 @@ namespace System.Web.Hosting {
                // Constructor used when the target application domain
                // was created with ApplicationHost.CreateApplicationHost
                //
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public SimpleWorkerRequest (string page, string query, TextWriter output)
                {
                        this.page = page;
@@ -71,6 +76,7 @@ namespace System.Web.Hosting {
                //
                // This is used for user instantiates HttpContext (my_SimpleWorkerRequest)
                //
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public SimpleWorkerRequest (string appVirtualDir, string appPhysicalDir, string page, string query, TextWriter output)
                {
                        this.page = page;
@@ -83,16 +89,26 @@ namespace System.Web.Hosting {
                
                public override string MachineConfigPath {
                        get {
-                               if (hosted)
-                                       return ICalls.GetMachineConfigPath ();
+                               if (hosted) {
+                                       string path = ICalls.GetMachineConfigPath ();
+                                       if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
+                                               new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand (); 
+                                       }
+                                       return path;
+                               }
                                return null;
                        }
                }
 
                public override string MachineInstallDirectory {
                        get {
-                               if (hosted)
-                                       return ICalls.GetMachineInstallDirectory ();
+                               if (hosted) {
+                                       string path = ICalls.GetMachineInstallDirectory ();
+                                       if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
+                                               new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand (); 
+                                       }
+                                       return path;
+                               }
                                return null;
                        }
                }
@@ -112,6 +128,9 @@ namespace System.Web.Hosting {
 
                public override string GetAppPathTranslated ()
                {
+                       if (SecurityManager.SecurityEnabled && (app_physical_dir != null) && (app_physical_dir.Length > 0)) {
+                               new FileIOPermission (FileIOPermissionAccess.PathDiscovery, app_physical_dir).Demand (); 
+                       }
                        return app_physical_dir;
                }
 
@@ -129,7 +148,11 @@ namespace System.Web.Hosting {
                        else
                                local_page = page;
                        
-                       return Path.Combine (app_physical_dir, local_page);
+                       string path = Path.Combine (app_physical_dir, local_page);
+                       if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
+                               new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand (); 
+                       }
+                       return path;
                }
 
                public override string GetHttpVerbName ()
index 34d498756b5d7438322148cca1f3a6ffcf6f5d5a..e44be30e1e0ad4810cc9650c22100588067d8283 100644 (file)
@@ -219,3 +219,11 @@ namespace System.Web.J2EE
        }
 
 }
+
+namespace System.Web.GH
+{
+       public class BaseHttpServlet : System.Web.J2EE.BaseHttpServlet
+       {
+       }
+
+}
index d7b827a26b68012cd630b4389a739e804ff31c2d..6b6ce7c1d2d0c6e86ca168adaca823726b67c3f6 100644 (file)
@@ -111,3 +111,11 @@ namespace System.Web.J2EE
                private string AppDir;
        }
 }
+
+namespace System.Web.GH
+{
+       public class BaseStaticHttpServlet : System.Web.J2EE.BaseStaticHttpServlet
+       {
+       }
+
+}
index 15f9cb25bc0136a1294913672179f3cff929eb82..447ff6285979f57516e4f7b4b75a5108e4cf01bf 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-08  Eyal Alalouf  <eyala@mainsoft.com>\r
+       * BaseHttpServlet.cs, PageMapper.cs, BaseStaticHttpServlet.cs,\r
+         SessionListener.cs - backward compatibility fixes.\r
+         PageMapper.cs - bug fix when compiler produces an unclear error.\r
+\r
 2005-08-30  Eyal Alalouf  <eyala@mainsoft.com>\r
        * BaseHttpServlet.cs, SessionListener.cs: Adaptations to global changes in\r
          System.Web.\r
index 24c0d30e738c051f0a5773b25b8c7fdf26863226..587ea307f26acb64d6eab7286c27ccf146914e7a 100644 (file)
@@ -37,7 +37,7 @@ namespace System.Web.J2EE
        /// <summary>
        /// Class that allows reading assemblies.xml file for getting information about different types.
        /// </summary>
-       internal class PageMapper
+       public class PageMapper
        {
                private static readonly string _fileListName = "/filelist.xml";
 
@@ -363,10 +363,15 @@ namespace System.Web.J2EE
 
                        if (file != null)
                        {
-                               Location loc = new Location(null);
-                               loc.Filename = file;
-                               loc.BeginLine = int.Parse(lineInFile);
-                               return new ParseException(loc,message);
+                               try {
+                                       Location loc = new Location(null);
+                                       loc.Filename = file;
+                                       loc.BeginLine = int.Parse(lineInFile);
+                                       return new ParseException(loc,message);
+                               }
+                               // If file doesn't exist, or is unreadable just go on and send
+                               // the original error message.
+                               catch(Exception e) {}
                        }
 
                        if (message.IndexOf(typeof(FileNotFoundException).Name) != -1 &&
@@ -376,3 +381,10 @@ namespace System.Web.J2EE
                }
        }
 }
+
+namespace System.Web.GH
+{
+       public class PageMapper : System.Web.J2EE.PageMapper
+       {
+       }
+}
index 5d8dc690ff98cb26f84e88b29ab5101ebe461d4c..6613fada317c1aee02c28e91c39e1b867596c132 100644 (file)
@@ -83,3 +83,13 @@ namespace System.Web.J2EE
                }
        }
 }
+
+namespace System.Web.GH
+{
+       /// <summary>
+       /// Summary description for Class1.
+       /// </summary>
+       public class SessionListener : System.Web.J2EE.SessionListener
+       {
+       }
+}
index 8361593aab95b1a6de543ba504d266a27d9400b1..3558f6187bf40e9e05583526c2884fe36e2d1888 100644 (file)
@@ -1,3 +1,33 @@
+2005-09-15  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * MailPriority.cs: Marked obsolete in 2.0 profile. Fixed line endings.
+       * SmtpMail.cs: Added workaround message to ensure same warning is
+       generated as MS.NET 2.0.
+       * MailMessage.cs: same and fixed line endings. Set eol-style to native.
+       * MailEncoding.cs: same.
+       * MailFormat.cs: same.
+       * MailAttachment.cs: same.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * SmtpMail.cs: Added an Assert for FileIOPermission so it's possible
+       to send attachments (in this case MailAttachment is already protected
+       but doesn't open|read the file itself).
+
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * MailAttachment.cs: Added [Link|Inheritance]Demand for Minimal. Added
+       FileIOPermission for Read in the constructor. Added [Obsolete] in 2.0.
+       * MailEncoding.cs: Removed [Serializable] and added [Obsolete] in 2.0.
+       * MailFormat.cs: Removed [Serializable] and added [Obsolete] in 2.0.
+       * MailMessage.cs: Removed references to RelatedBodyParts (2.0). Added 
+       [Link|Inheritance]Demand for Minimal. Added [Obsolete] in 2.0.
+       * MailMessageWrapper.cs: Removed references to RelatedBodyParts (2.0).
+       * MailPriority.cs: Removed [Serializable] in 2.0. No [Obsolete] ?
+       * SmtpClient.cs: Removed references to RelatedBodyParts (2.0).
+       * SmtpMail.cs: Added [Link|Inheritance]Demand for Minimal. Added 
+       Demand for Medium on Send method.Added [Obsolete] in 2.0.
+
 2005-06-08 Ilya Kharmatsky <ilyak-at-mainsoft.com>
 
     * SmtpMail.cs: Added TARGET_JVM directive in Send method,
index 6232f12401139be3a86563b7ddd2bb4e41dfe7f5..809524b6fd37aaf475917129804312bcddd8ef08 100644 (file)
@@ -1,11 +1,12 @@
-//\r
-// System.Web.Mail.MailAttachment.cs\r
-//\r
-// Author:\r
-//    Lawrence Pit (loz@cable.a2000.nl)\r
-//    Per Arneng (pt99par@student.bth.se)\r
-//\r
-
+//
+// System.Web.Mail.MailAttachment.cs
+//
+// Author:
+//    Lawrence Pit (loz@cable.a2000.nl)
+//    Per Arneng (pt99par@student.bth.se)
+//    Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-namespace System.Web.Mail\r
-{\r
-       public class MailAttachment\r
-       {\r
-               private string filename;\r
-               private MailEncoding encoding;\r
-               \r
-               public MailAttachment (string filename) : \r
-                       this (filename, MailEncoding.Base64) \r
-               {\r
-               }\r
-               \r
-               public MailAttachment (string filename, MailEncoding encoding) \r
-               {\r
-                       this.filename = filename;\r
-                       this.encoding = encoding;\r
-                       try {\r
-                               System.IO.File.OpenRead (filename).Close ();\r
-                       } catch (Exception) {\r
-                           throw new System.Web.HttpException ("Cannot find file: '" + \r
-                                                               filename + "'." );\r
-                       }                       \r
-               }\r
-           \r
-               // Properties\r
-               public string Filename \r
-               {\r
-                       get { return filename; } \r
-               }\r
-               \r
-               public MailEncoding Encoding \r
-               {\r
-                       get { return encoding; } \r
-               }               \r
-       \r
-       }\r
-       \r
-} //namespace System.Web.Mail\r
+
+using System.IO;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Web.Mail
+{
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [Obsolete ("The recommended alternative is System.Net.Mail.Attachment.")]
+#endif
+       public class MailAttachment
+       {
+               private string filename;
+               private MailEncoding encoding;
+               
+               public MailAttachment (string filename) : 
+                       this (filename, MailEncoding.Base64) 
+               {
+               }
+               
+               public MailAttachment (string filename, MailEncoding encoding) 
+               {
+                       if (SecurityManager.SecurityEnabled) {
+                               new FileIOPermission (FileIOPermissionAccess.Read, filename).Demand ();
+                       }
+
+                       if (!File.Exists (filename)) {
+                               string msg = Locale.GetText ("Cannot find file: '{0}'.");
+                               throw new HttpException (String.Format (msg, filename));
+                       }
+
+                       this.filename = filename;
+                       this.encoding = encoding;
+               }
+
+               // Properties
+               public string Filename 
+               {
+                       get { return filename; } 
+               }
+               
+               public MailEncoding Encoding 
+               {
+                       get { return encoding; } 
+               }
+       }
+}
index 161a31823a9832f34bfc0995707eb2bb02bf7b18..d38de363f45560697588c3234168eea7b70300cf 100644 (file)
@@ -1,10 +1,10 @@
-//\r
-// System.Web.Mail.MailEncoding.cs\r
-//\r
-// Author:\r
-//    Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-
+//
+// System.Web.Mail.MailEncoding.cs
+//
+// Author:
+//    Lawrence Pit (loz@cable.a2000.nl)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-namespace System.Web.Mail \r
-{\r
-\r
-       /// <summary>\r
-       /// </summary>\r
+
+namespace System.Web.Mail {
+
 #if NET_2_0
-       [Serializable]
+       [Obsolete ("The recommended alternative is System.Net.Mime.TransferEncoding.")]
 #endif
-       public enum MailEncoding \r
-       {\r
-\r
-               /// <summary>\r
-               /// </summary>\r
-               UUEncode = 0,\r
-\r
-               /// <summary>\r
-               /// </summary>\r
-               Base64 = 1\r
-\r
-       } \r
-       \r
-} //namespace System.Web.Mail\r
+       public enum MailEncoding {
+               UUEncode,
+               Base64
+       }
+}
index 35a13d363bd25f6f6a55ddac9c20aa6381f62e2d..a9a282d8cb7a4ce6cfefd44fa767c1bdfb9e148d 100644 (file)
@@ -1,10 +1,10 @@
-//\r
-// System.Web.Mail.MailFormat.cs\r
-//\r
-// Author:\r
-//    Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-
+//
+// System.Web.Mail.MailFormat.cs
+//
+// Author:
+//    Lawrence Pit (loz@cable.a2000.nl)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-namespace System.Web.Mail \r
-{\r
-\r
-       /// <summary>\r
-       /// </summary>\r
+
+namespace System.Web.Mail {
+
 #if NET_2_0
-        [Serializable]
+       [Obsolete ("The recommended alternative is System.Net.Mail.MailMessage.IsBodyHtml.")]
 #endif
-       public enum MailFormat \r
-       {\r
-\r
-               /// <summary>\r
-               /// </summary>\r
-               Text = 0,\r
-       \r
-               /// <summary>\r
-               /// </summary>\r
-               Html = 1\r
-\r
-       } \r
-       \r
-} //namespace System.Web.Mail\r
+       public enum MailFormat {
+               Text,
+               Html
+       } 
+}
index cd0eb98f335acffd35fc1271e0376bbb180f0328..144903ba2829309b6b11d3f5edfa321597fc955e 100644 (file)
@@ -1,14 +1,12 @@
-//\r
-// System.Web.Mail.MailMessage.cs\r
-//\r
-// Author:\r
-//    Lawrence Pit (loz@cable.a2000.nl)\r
-//    Per Arneng (pt99par@student.bth.se)\r
+//
+// System.Web.Mail.MailMessage.cs
+//
+// Author:
+//    Lawrence Pit (loz@cable.a2000.nl)
+//    Per Arneng (pt99par@student.bth.se)
 //     Sanjay Gupta (gsanjay@novell.com)
 //
-//     (c)2004 Novell, Inc. (http://www.novell.com)
-//\r
-
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-using System;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-using System.Text;\r
-\r
-namespace System.Web.Mail\r
-{\r
-       /// <remarks>\r
-       /// </remarks>\r
-       public class MailMessage\r
-       {\r
-               private ArrayList attachments;\r
-               private string bcc;\r
-               private string body = "";\r
-               private Encoding bodyEncoding;\r
-               private MailFormat bodyFormat;\r
-               private string cc;              \r
-               private string from;\r
-               private ListDictionary headers;\r
-               private MailPriority priority;\r
-               private string subject = "";\r
-               private string to;\r
-               private string urlContentBase;\r
+
+using System.Collections;
+using System.Collections.Specialized;
+using System.Security.Permissions;
+using System.Text;
+
+namespace System.Web.Mail
+{
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [Obsolete ("The recommended alternative is System.Net.Mail.MailMessage.")]
+#endif
+       public class MailMessage
+       {
+               private ArrayList attachments;
+               private string bcc;
+               private string body = String.Empty;
+               private Encoding bodyEncoding;
+               private MailFormat bodyFormat;
+               private string cc;              
+               private string from;
+               private ListDictionary headers;
+               private MailPriority priority;
+               private string subject = String.Empty;
+               private string to;
+               private string urlContentBase;
                private string urlContentLocation;
-               \r
-               // Constructor          \r
-               public MailMessage ()\r
-               {\r
-                       attachments = new ArrayList (8);\r
-                       headers = new ListDictionary ();\r
+               
+               // Constructor          
+               public MailMessage ()
+               {
+                       attachments = new ArrayList (8);
+                       headers = new ListDictionary ();
                        bodyEncoding = Encoding.Default;
 #if NET_1_1
-                       fields = new Hashtable ();\r
-#endif
-#if NET_2_0
-                       bodyParts = new ArrayList (2);
+                       fields = new Hashtable ();
 #endif
-               }               \r
-       \r
-               // Properties\r
-               public IList Attachments {\r
-                       get { return (IList) attachments; }\r
-               }               \r
-               \r
-               public string Bcc {\r
-                       get { return bcc; } \r
-                       set { bcc = value; }\r
-               }\r
-       \r
-               public string Body {\r
-                       get { return body; } \r
-                       set { body = value; }\r
-               }\r
-\r
-               public Encoding BodyEncoding {\r
-                       get { return bodyEncoding; } \r
-                       set { bodyEncoding = value; }\r
-               }\r
-\r
-               public MailFormat BodyFormat {\r
-                       get { return bodyFormat; } \r
-                       set { bodyFormat = value; }\r
-               }               \r
-\r
-               public string Cc {\r
-                       get { return cc; } \r
-                       set { cc = value; }\r
-               }\r
-\r
-               public string From {\r
-                       get { return from; } \r
-                       set { from = value; }\r
-               }\r
-\r
-               public IDictionary Headers {\r
-                       get { return (IDictionary) headers; }\r
-               }\r
-               \r
-               public MailPriority Priority {\r
-                       get { return priority; } \r
-                       set { priority = value; }\r
-               }\r
-               \r
-               public string Subject {\r
-                       get { return subject; } \r
-                       set { subject = value; }\r
-               }\r
-\r
-               public string To {\r
-                       get { return to; }   \r
-                       set { to = value; }\r
-               }\r
-\r
-               public string UrlContentBase {\r
-                       get { return urlContentBase; } \r
-                       set { urlContentBase = value; }\r
-               }\r
-\r
-               public string UrlContentLocation {\r
-                       get { return urlContentLocation; } \r
-                       set { urlContentLocation = value; }\r
-               }\r
-\r
-#if NET_1_1\r
-               private Hashtable fields;\r
+               }               
+       
+               // Properties
+               public IList Attachments {
+                       get { return (IList) attachments; }
+               }               
                
-               public IDictionary Fields {\r
-                       get {
-                               return (IDictionary) fields;
-                       }\r
-               }\r
-#endif\r
+               public string Bcc {
+                       get { return bcc; } 
+                       set { bcc = value; }
+               }
+       
+               public string Body {
+                       get { return body; } 
+                       set { body = value; }
+               }
 
-#if NET_2_0
-               private ArrayList bodyParts;
+               public Encoding BodyEncoding {
+                       get { return bodyEncoding; } 
+                       set { bodyEncoding = value; }
+               }
+
+               public MailFormat BodyFormat {
+                       get { return bodyFormat; } 
+                       set { bodyFormat = value; }
+               }               
+
+               public string Cc {
+                       get { return cc; } 
+                       set { cc = value; }
+               }
+
+               public string From {
+                       get { return from; } 
+                       set { from = value; }
+               }
+
+               public IDictionary Headers {
+                       get { return (IDictionary) headers; }
+               }
                
-               public IList RelatedBodyParts {
-                       get { return (IList) bodyParts; }
+               public MailPriority Priority {
+                       get { return priority; } 
+                       set { priority = value; }
+               }
+               
+               public string Subject {
+                       get { return subject; } 
+                       set { subject = value; }
                }
-#endif
 
-       }\r
-       \r
-} //namespace System.Web.Mail\r
+               public string To {
+                       get { return to; }   
+                       set { to = value; }
+               }
+
+               public string UrlContentBase {
+                       get { return urlContentBase; } 
+                       set { urlContentBase = value; }
+               }
+
+               public string UrlContentLocation {
+                       get { return urlContentLocation; } 
+                       set { urlContentLocation = value; }
+               }
+
+#if NET_1_1
+               private Hashtable fields;
+               
+               public IDictionary Fields {
+                       get {
+                               return (IDictionary) fields;
+                       }
+               }
+#endif
+       }
+}
index f50ec10c7bdc5df331c7933729e54489b47465a1..d7ab68663da94bfffaf49807513c9f8599f46e7a 100644 (file)
@@ -247,11 +247,5 @@ namespace System.Web.Mail {
                        
                }
 #endif
-
-#if NET_2_0
-               public IList RelatedBodyParts {
-                       get { return message.RelatedBodyParts; }
-               }
-#endif
     }   
 }
index 5c0bf83ed2a45fe1aa8f81d9f848e0a56ff3e540..8917be0fae210152b70120521b2b225a1dfdd3e8 100644 (file)
@@ -1,10 +1,10 @@
-//\r
-// System.Web.Mail.MailPriority.cs\r
-//\r
-// Author:\r
-//    Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-
+//
+// System.Web.Mail.MailPriority.cs
+//
+// Author:
+//    Lawrence Pit (loz@cable.a2000.nl)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-namespace System.Web.Mail \r
-{\r
-\r
-       /// <summary>\r
-       /// </summary>\r
+
+namespace System.Web.Mail {
 #if NET_2_0
-        [Serializable]
+       [Obsolete ("The recommended alternative is System.Net.Mail.MailPriority.")]
 #endif
-       public enum MailPriority \r
-       {\r
-\r
-               /// <summary>\r
-               /// </summary>\r
-               Normal = 0,\r
-               \r
-               /// <summary>\r
-               /// </summary>\r
-               Low = 1,\r
-\r
-               /// <summary>\r
-               /// </summary>\r
-               High = 2\r
-\r
-       } \r
-       \r
-} //namespace System.Web.Mail\r
+       public enum MailPriority {
+               Normal,
+               Low,
+               High
+       } 
+}
index e47401258199b86adbddfaf4993a6678052bc33e..9c5c7e7d487c6f8bacb684e7d98d8c299eca073d 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Net;
 using System.IO;
 using System.Text;
 using System.Collections;
 using System.Net.Sockets;
+using System.Security.Permissions;
 
 namespace System.Web.Mail {
 
@@ -105,13 +106,7 @@ namespace System.Web.Mail {
            smtp.WriteData();
                
            if( msg.Attachments.Count == 0 ) {
-#if NET_2_0
-               //The message might be multipart, if RelatedBodyParts are present
-               if (msg.RelatedBodyParts.Count != 0)
-                       SendMultipartMail (msg);
-               else
-#endif         
-                       SendSinglepartMail( msg );          
+               SendSinglepartMail( msg );          
            } else {
                
                SendMultipartMail( msg );
@@ -133,7 +128,9 @@ namespace System.Web.Mail {
            smtp.WriteBytes( msg.BodyEncoding.GetBytes( msg.Body ) );
 
        }
-       
+
+       // SECURITY-FIXME: lower assertion with imperative asserts      
+       [FileIOPermission (SecurityAction.Assert, Unrestricted = true)]
        // sends a multipart mail to the server
        private void SendMultipartMail( MailMessageWrapper msg ) {
                    
@@ -143,11 +140,6 @@ namespace System.Web.Mail {
            // set the Content-Type header to multipart/mixed
            string bodyContentType = msg.Header.ContentType;
 
-#if NET_2_0
-               if (msg.RelatedBodyParts.Count != 0)
-                       msg.Header.ContentType = String.Format( "multipart/related;\r\n   boundary={0}" , boundary );
-               else
-#endif
            msg.Header.ContentType = 
                String.Format( "multipart/mixed;\r\n   boundary={0}" , boundary );
                
@@ -188,43 +180,6 @@ namespace System.Web.Mail {
 
            smtp.WriteBoundary( boundary );
 
-#if NET_2_0
-               for (int i = 0; i < msg.RelatedBodyParts.Count; i++) {
-                       RelatedBodyPart rbp = (RelatedBodyPart) msg.RelatedBodyParts [i];
-                       FileInfo file = new FileInfo (rbp.Path);
-                       MailHeader header = new MailHeader ();
-                       header.ContentLocation = rbp.Path;
-                       header.ContentType = String.Format (MimeTypes.GetMimeType (file.Name) + "; name=\"{0}\"",file.Name);
-                       //If content id and ContentLocation both are present
-                       //in mime header of a mail, than RelatedBodyPart of mail
-                       //doesnt show up in a machine other than from which mail
-                       //was sent, and hence only one of them is inserted in 
-                       //header. Need to check how the things go when another 
-                       //body part refers the content with the content id specified
-                       /*if (rbp.Name != null)
-                               header.Data.Add ("Content-ID", "<"+rbp.Name+">");*/
-                               
-                       header.ContentTransferEncoding = "Base64";
-                       header.ContentDisposition = String.Format( "inline; filename=\"{0}\"" , file.Name );
-                       
-                       smtp.WriteHeader (header);
-                       FileStream rbpStream = new FileStream (file.FullName, FileMode.Open);
-                       IAttachmentEncoder rbpEncoder = new Base64AttachmentEncoder ();
-                       rbpEncoder.EncodeStream (rbpStream, smtp.Stream);
-                       rbpStream.Close();
-                       smtp.WriteLine( "" );
-                       
-                       if (i < (msg.RelatedBodyParts.Count - 1)) {
-                               smtp.WriteBoundary (boundary);
-                       } else {
-                               if (msg.Attachments.Count == 0)
-                                        smtp.WriteFinalBoundary (boundary);
-                               else
-                                       smtp.WriteBoundary (boundary);
-                                       
-                       }                                               
-               }
-#endif     
            // now start to write the attachments
            
            for( int i=0; i< msg.Attachments.Count ; i++ ) {
@@ -246,7 +201,7 @@ namespace System.Web.Mail {
                   
                // perform the actual writing of the file.
                // read from the file stream and write to the tcp stream
-               FileStream ins = new FileStream( fileInfo.FullName  , FileMode.Open );
+               FileStream ins = fileInfo.OpenRead ();
                
                // create an apropriate encoder
                IAttachmentEncoder encoder;
index f547a2ca58c50df5dc0821b98764fecc32e36c02..7e6042c02684d364f0cee28a25178b698eda6ec5 100644 (file)
@@ -5,7 +5,7 @@
 //    Lawrence Pit (loz@cable.a2000.nl)
 //    Per Arneng (pt99par@student.bth.se) (SmtpMail.Send)
 //
-
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Net;
 using System.Net.Sockets;
 using System.Text;
 using System.IO;
 using System.Reflection;
+using System.Security.Permissions;
 
 namespace System.Web.Mail
 {
-       /// <remarks>
-       /// </remarks>
-       public class SmtpMail
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [Obsolete ("The recommended alternative is System.Net.Mail.SmtpClient.")]
+#endif
+       public class SmtpMail
        {
                private static string smtpServer = "localhost";
                
@@ -54,7 +58,9 @@ namespace System.Web.Mail
                        set { smtpServer = value; }
                }
                
-               
+               // Medium (not Minimal) here
+               // http://msdn.microsoft.com/library/en-us/dnpag2/html/paght000017.asp
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
                public static void Send (MailMessage message) 
                {
                                                    
@@ -112,7 +118,5 @@ namespace System.Web.Mail
                        message.Body = messageText;
                        Send (message);
                }
-       
        }
-       
-} //namespace System.Web.Mail
+}
index b73378204ced2ce23518a0ff44750b22a82e248d..e4ebe1255708cb7c15417f79f446e6cda277a4b8 100644 (file)
@@ -1,3 +1,27 @@
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * DefaultAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
+       * DefaultAuthenticationModule.cs: Added LinkDemand for Minimal. Added
+       Demand for UnmanagedCode on constructor.
+       * FileAuthorizationModule.cs: Added LinkDemand for Minimal. Added 
+       Demand for UnmanagedCode on constructor.
+       * FormsAuthentication.cs: Added LinkDemand for Minimal.
+       * FormsAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
+       * FormsAuthenticationModule.cs: Added LinkDemand for Minimal. Added 
+       Demand for UnmanagedCode on constructor.
+       * FormsAuthenticationTicket.cs: Added LinkDemand for Minimal.
+       * FormsIdentity.cs: Added LinkDemand for Minimal.
+       * PassportAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
+       * PassportAuthenticationModule.cs: Added LinkDemand for Minimal. Added
+       Demand for UnmanagedCode on constructor.
+       * PassportIdentity.cs: Added LinkDemand for Minimal. Added Demand for
+       UnmanagedCode on constructor.
+       * UrlAuthorizationModule.cs: Added LinkDemand for Minimal. Added 
+       Demand for UnmanagedCode on constructor.
+       * WindowsAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
+       * WindowsAuthenticationModule.cs: Added LinkDemand for Minimal. Added
+       Demand for UnmanagedCode on constructor.
+
 2005-09-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * FormsAuthenticationEventArgs.cs: Ensure the setter for User is 
index 650ddbf7447f3ad341efc03e24b83a94f7dc4b09..031061bb5af4ad1430d49d3a40d495264641630b 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.Permissions;
+
 namespace System.Web.Security {
-       using System;
-       using System.Web;
-       
-public sealed class DefaultAuthenticationEventArgs : EventArgs
-{
-       private HttpContext _context;
 
-       public DefaultAuthenticationEventArgs (HttpContext context)
-       {
-               if (context == null)
-                       throw new ArgumentNullException ("context");
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class DefaultAuthenticationEventArgs : EventArgs {
 
-               _context = context;
-       }
+               private HttpContext _context;
 
-       public HttpContext Context
-       {
-               get { return _context; }
+               public DefaultAuthenticationEventArgs (HttpContext context)
+               {
+                       if (context == null)
+                               throw new ArgumentNullException ("context");
+
+                       _context = context;
+               }
+
+               public HttpContext Context {
+                       get { return _context; }
+               }
        }
 }
-}
-
index b799e35ad8567556bfc1ecde47d9130f87cf9bdc..16093083e340b4be776bd96860ad047c4ebf66f6 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Web;
+using System.Security.Permissions;
 using System.Security.Principal;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class DefaultAuthenticationModule : IHttpModule
        {
                static GenericIdentity defaultIdentity = new GenericIdentity ("", "");
 
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public DefaultAuthenticationModule ()
+               {
+               }
+
                public event DefaultAuthenticationEventHandler Authenticate;
 
                public void Dispose ()
index 747dc8ca89ab8f906e10c6b368b7d774529bed5f..3b301d42f55d8042abf8031278408ebb27baaba8 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.Permissions;
+
 namespace System.Web.Security
 {
        [MonoTODO ("that's only a stub")]
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class FileAuthorizationModule : IHttpModule
        {
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public FileAuthorizationModule ()
+               {
+               }
+
                public void Dispose ()
                {
                }
index d21125bdffa67877747bebe1dfe0ec7f8a254489..1383aa2996886079dc835762492ceddc2f120019 100644 (file)
@@ -32,6 +32,7 @@
 using System.Collections;
 using System.IO;
 using System.Security.Cryptography;
+using System.Security.Permissions;
 using System.Text;
 using System.Web;
 using System.Web.Configuration;
@@ -39,6 +40,8 @@ using System.Web.Util;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class FormsAuthentication
        {
                const int MD5_hash_size = 16;
index c560ed044f40a39fbcd01cb820da7c070a50d456..c1fc437c4fef58655507be37f8720d7ad69c3e47 100644 (file)
@@ -32,6 +32,8 @@ using System.Security.Principal;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class FormsAuthenticationEventArgs : EventArgs
        {
                IPrincipal user;
index c816d7896958d3ddd876d1c16fa0495aeec99c68..bab52f7f6550a5c5de2d0e3a50505bd5d915bd9b 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 using System.Security.Principal;
 using System.Text;
-using System.Web;
 using System.Web.Configuration;
 using System.Web.Util;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class FormsAuthenticationModule : IHttpModule
        {
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public FormsAuthenticationModule ()
+               {
+               }
+
                public void Dispose ()
                {
                }
index cb108d98c40cb55e33d4861860af6a31d3ac6577..86232449132dc63d493ab492960f18e2b5be39d0 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
+using System.Security.Permissions;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [Serializable]
        public sealed class FormsAuthenticationTicket
        {
index 43e2846ae230ad1d9817d8c4c3a614c7d093f452..c38331e8e2f9a3f7b1ab5c48ea867a4f1f721397 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (c) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 using System.Security.Principal;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [Serializable]
        public sealed class FormsIdentity : IIdentity
        {
index 30c301dbb5b4636e3566df4cef92e683e0a4d24e..e11f4bf36ca522dde487fa8cf75408de08c86d26 100644 (file)
@@ -32,6 +32,8 @@ using System.Security.Principal;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class PassportAuthenticationEventArgs : EventArgs
        {
                PassportIdentity identity;
index 21646f3c2f3638a9884ddbbad2aafc7c41057c9c..9fd102d2ed34a16b4b6a20a5e79e2a3ef1a3b870 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Web;
+using System.Security.Permissions;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class PassportAuthenticationModule : IHttpModule
        {
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public PassportAuthenticationModule ()
+               {
+               }
+
                public event PassportAuthenticationEventHandler Authenticate;
 
                public void Dispose ()
index d51e0b99af57b67210d17469554ec3308d6bd7fd..821d8af4b556f69e619d695ccb43eb2ce6cf9b1b 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.Permissions;
 using System.Security.Principal;
 
 namespace System.Web.Security {
 
+       [MonoTODO]
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 #if NET_2_0
        public sealed class PassportIdentity : IIdentity, IDisposable {
 #else
        public sealed class PassportIdentity : IIdentity {
 #endif
-               [MonoTODO]
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public PassportIdentity ()
                {
-                       throw new NotImplementedException ();
                }
 
                ~PassportIdentity ()
index 2e6bca2747c8ad8473a43df2b95953e5def9519e..f44e19513e1da9f249c2e1cebabf32ec3736d3fa 100644 (file)
 //
 
 using System.Web.Configuration;
+using System.Security.Permissions;
 using System.Security.Principal;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class UrlAuthorizationModule : IHttpModule
        {
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public UrlAuthorizationModule ()
                {
                }
index e7114ca9ce0b6cdad435e7320ca6043604007c4d..519ab293bf652ded838d5b134ac7d4ab3cd0c81f 100644 (file)
@@ -32,6 +32,8 @@ using System.Security.Principal;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class WindowsAuthenticationEventArgs : EventArgs
        {
                WindowsIdentity identity;
index a47af129aecea758f5b208477afda95de3bccc6a..d33351e118f183819984a5bc272362c3bca523b7 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
-using System.Web;
+using System.Security.Permissions;
 
 namespace System.Web.Security
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class WindowsAuthenticationModule : IHttpModule
        {
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public WindowsAuthenticationModule ()
+               {
+               }
+
                public event WindowsAuthenticationEventHandler Authenticate;
 
                public void Dispose ()
index 4ed966148c84cee4694ffe1263acaa5ff991336f..689d27db371230396485537e42b8eaf76c4e16a7 100644 (file)
@@ -1,3 +1,28 @@
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpSessionState.cs: Added LinkDemand for Minimal.
+       * IHttpSessionState.cs: Renamed IsCookieLess to IsCookieless.
+       * ISessionStateItemCollection.cs: Added ICollection and IEnumerable.
+       * SessionStateMode.cs: Added Custom (2.0).
+       * SessionStateModule.cs: Use RandomNumberGenerator.Create to create 
+       the RNG. Assert EnvironmentPermission to read MONO_XSP_STATIC_SESSION.
+       Added LinkDemand for Minimal.
+       * StateRuntime.cs: Added LinkDemand for Minimal, new ProcessRequest
+       override (2.0) and security attributes on methods.
+
+2005-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * SessionStateModule.cs: raise the Start event for new sessions.
+
+2005-09-08 Eyal Alaluf <eyala@mainsoft.com>
+       * HttpSessionState.jvm.cs - fixed serialization when we want to serialize
+         an empty session.
+
+2005-09-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * SessionStateModule.cs: Only invoke the End event using the new method
+       in HttpApplicationFactory and when session state mode is InProc.
+
 2005-09-01 Eyal Alaluf <eyala@mainsoft.com>
        * SessionStateModule.cs: Under TARGET_J2EE we let the J2EE app server handle
          session persistence, so we don't support SQL/Remoting session servers
index 901c923401c59ee981a9deae1ece6a5af87d4fa3..2867059771811c03417817df0366752c441acd66 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Collections;
 using System.Collections.Specialized;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Text;
 using System.Threading;
-using System.Web;
 
 namespace System.Web.SessionState {
+
+// CAS - no InheritanceDemand here as the class is sealed
+[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 public sealed class HttpSessionState : ICollection, IEnumerable
 {
        private string _id;
index 22e1dd7f5ec5cb77902e2f115422dd039afc4a74..0524e74bc8c408afbefa7db82920a6d3dae1c4c6 100644 (file)
@@ -109,6 +109,7 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa
        {
                lock (this)
                {
+                       output.writeBoolean(_needSessionPersistence);
                        if (!_needSessionPersistence)
                        {
                                return;
@@ -130,7 +131,6 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa
                        else 
                                bw.Write(3);
                        bw.Write(_isReadonly);
-                       bw.Write(_needSessionPersistence);
                        output.writeObject(vmw.common.TypeUtils.ToSByteArray(ms.GetBuffer()));
                }
        }
@@ -139,6 +139,11 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa
        {
                lock(this)
                {
+                       _needSessionPersistence = input.readBoolean();
+                       if (!_needSessionPersistence)
+                       {
+                               return;
+                       }
                        sbyte[] array = (sbyte[])input.readObject();
                        if (!_readFirstTime || array == null || array.Length == 0)
                        {
@@ -163,7 +168,6 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa
                        else 
                                _mode = SessionStateMode.SQLServer;
                        _isReadonly = br.ReadBoolean();
-                       _needSessionPersistence = br.ReadBoolean();
                        //      _app = HttpContext.Current.ApplicationInstance;
                }
        }
index 5f3b1f06d6d125797e4b11a65371797a709d1ae9..978208249d0a2f2b7d9e134453ed6b8e93a343de 100644 (file)
 
 #if NET_2_0
 
-using System;
 using System.Collections;
 using System.Collections.Specialized;
-using System.Web;
 
 namespace System.Web.SessionState {
        public interface IHttpSessionState
@@ -52,7 +50,7 @@ namespace System.Web.SessionState {
                int CodePage { get; set; }
                HttpCookieMode CookieMode { get; }
                int Count { get; }              
-               bool IsCookieLess { get; }
+               bool IsCookieless { get; }
                bool IsNewSession { get; }
                bool IsReadOnly { get; }
                bool IsSynchronized { get; }
index 40537f89998d602b5ab9c2db15ca4c602320f170..c76294f36e8a3b050f14e92295606891e4277057 100644 (file)
@@ -4,9 +4,7 @@
 // Authors:
 //     Sanjay Gupta (gsanjay@novell.com)
 //
-// (C) 2004 Novell, Inc (http://www.novell.com)
-//
-
+// Copyright (c) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 
 #if NET_2_0
 
-using System;
 using System.Collections;
 using System.Collections.Specialized;
 
 namespace System.Web.SessionState {
-       public interface ISessionStateItemCollection
+
+       public interface ISessionStateItemCollection : ICollection, IEnumerable
        {
                ///methods
                void Clear ();
index fd10b66c9e076ebc6649e75b6570292426176dae..b54c020661f1a02bb0844a28592bfbcc5a8c6763 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -34,9 +33,12 @@ public enum SessionStateMode
        Off = 0,
        InProc = 1,
        StateServer = 2,
-       SQLServer = 3
+       SQLServer = 3,
+#if NET_2_0
+       Custom = 4,
+#endif
 #if TARGET_J2EE
-       ,J2ee = 1024
+       J2ee = 1024
 #endif
 }
 
index d1bd169e1f34e2d4176bb589715d9e1e11224e35..dc3e14d239edb875f36a9827e8d92162a523d35f 100644 (file)
@@ -6,9 +6,8 @@
 //     Stefan Görling (stefan@gorling.se)
 //     Jackson Harper (jackson@ximian.com)
 //
-// (C) 2002,2003,2004,2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2002,2003,2004,2005 Novell, Inc (http://www.novell.com)
 // (C) 2003 Stefan Görling (http://www.gorling.se)
-
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Web;
 using System.Web.Caching;
 using System.Web.Util;
 using System.Security.Cryptography;
+using System.Security.Permissions;
 
 namespace System.Web.SessionState
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class SessionStateModule : IHttpModule
        {
                internal static readonly string CookieName = "ASPSESSION";
@@ -67,8 +68,9 @@ namespace System.Web.SessionState
                ISessionHandler handler;
                bool sessionForStaticFiles;
                
-               static RandomNumberGenerator rng = new RNGCryptoServiceProvider ();
+               static RandomNumberGenerator rng = RandomNumberGenerator.Create ();
                
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public SessionStateModule ()
                {
                }
@@ -110,6 +112,7 @@ namespace System.Web.SessionState
                        }
                }
 
+               [EnvironmentPermission (SecurityAction.Assert, Read = "MONO_XSP_STATIC_SESSION")]
                public void Init (HttpApplication app)
                {
                        sessionForStaticFiles = (Environment.GetEnvironmentVariable ("MONO_XSP_STATIC_SESSION") != null);
@@ -204,23 +207,28 @@ namespace System.Web.SessionState
                                        cookie.Path = UrlUtils.GetDirectory (context.Request.ApplicationPath);
                                        context.Response.AppendCookie (cookie);
                                }
+
+                               if (isNew)
+                                       OnSessionStart ();
                        }
                }
 
-               internal void OnSessionRemoved (string key, object value, CacheItemRemovedReason reason)
+               void OnSessionStart ()
                {
-                       OnEnd ();
+                       if (Start != null)
+                               Start (this, EventArgs.Empty);
                }
 
-               internal void OnEnd ()
+               internal void OnSessionRemoved (string key, object value, CacheItemRemovedReason reason)
                {
-#if !TARGET_J2EE                       
-                       if (End != null)
-                               End (this, EventArgs.Empty);
-#endif                         
+                       // Only invoked for InProc (see msdn2 docs on SessionStateModule.End)
+                       if (GetConfig ().Mode == SessionStateMode.InProc)
+                               HttpApplicationFactory.InvokeSessionEnd (value);
                }
                
                public event EventHandler Start;
+
+               // This event is public, but only Session_[On]End in global.asax will be invoked if present.
                public event EventHandler End;
        }
 }
index 5cd9ae085ca3012b39834943fcbda97628d6891c..eb5a25df0d224d9cd06be960e7fa059e9fb45736 100644 (file)
@@ -1,12 +1,12 @@
 //
 // System.Web.SessionState.StateRuntime.cs
 //
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Authors:
+//     Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2003 Andreas Nahr
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-namespace System.Web.SessionState
-{
-       public sealed class StateRuntime : IStateRuntime
-       {
+using System.Security.Permissions;
+
+namespace System.Web.SessionState {
+
+       [MonoTODO]
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class StateRuntime : IStateRuntime {
+
+#if NET_2_0
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
+#endif
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+               public StateRuntime ()
+               {
+               }
+
                [MonoTODO]
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
                public void ProcessRequest (IntPtr tracker, int verb,
                        string uri, int exclusive, int timeout,
                        int lockCookieExists, int lockCookie,
@@ -40,8 +54,18 @@ namespace System.Web.SessionState
                {
                        throw new NotImplementedException ();
                }
-
+#if NET_2_0
+               [MonoTODO]
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
+               public void ProcessRequest (IntPtr tracker, int verb, string uri, int exclusive,
+                       int extraFlags, int timeout, int lockCookieExists, int lockCookie,
+                       int contentLength, IntPtr content)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
                [MonoTODO]
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public void StopProcessing ()
                {
                        throw new NotImplementedException ();
index 0e205355161ad7a8493ff6ae4685390dea375af7..a53d45b86ce0254e1ac42cc37cbfc874927e90af 100644 (file)
@@ -1,3 +1,189 @@
+2005-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HtmlInputButton.cs: render the onclick for doing a postback even when
+       there are no validators.
+
+2005-09-19  Sebastien Pouliot  <sebastien@ximian.com> 
+       * HtmlInputPassword.cs: Removed ctor(string) as it's not in 2.0 RC.
+       
+2005-09-19  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HtmlAnchor.cs: Added [SupportsEventValidation] on class and 
+       [UrlProperty] on HRef property for 2.0.
+       * HtmlButton.cs: Added [SupportsEventValidation] for 2.0.
+       * HtmlHead.cs: Remove IPageHeader interface.
+       * HtmlImage.cs: Added [UrlProperty] on Src property for 2.0.
+       * HtmlInputButton.cs: Added [SupportsEventValidation] for 2.0.
+       * HtmlInputCheckBox.cs: Added [SupportsEventValidation] for 2.0.
+       * HtmlInputHidden.cs: Added [SupportsEventValidation] for 2.0.
+       * HtmlInputImage.cs: Added [SupportsEventValidation] on class and 
+       [UrlProperty] on Src property for 2.0.
+       * HtmlInputPassword.cs: Added [SupportsEventValidation].
+       * HtmlInputRadioButton.cs: Added [SupportsEventValidation] for 2.0.
+       * HtmlInputReset.cs: Added [SupportsEventValidation].
+       * HtmlInputSubmit.cs: Added [SupportsEventValidation].
+       * HtmlInputText.cs: Added [SupportsEventValidation] on class and 
+       re-enabled RenderAttribute for 2.0.
+       * HtmlLink.cs: Added [UrlProperty] on HRef property for 2.0.
+       * HtmlSelect.cs: Added [SupportsEventValidation] for 2.0.
+       * HtmlTextArea.cs: Added [SupportsEventValidation] for 2.0.
+
+2005-09-18  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlButton.cs (RenderAttribute): make sure to use WriteAttribute
+       instead of AddAttribute when dealing with "onclick."
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HtmlHead.cs: Fixed parameter orders for CreateStyleRule.
+
+2005-09-11  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputFile.cs (set_Value): add a message to the
+       NotSupportedException.
+
+       * HtmlInputControl.cs (RenderAttributes): add Page != null to the
+       checks before we register our control with the
+       __enabledControlArray JS array.
+
+2005-09-09  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputButton.cs (CausesValidation): this is stored in
+       Attributes, not ViewState.
+       (ValidationGroup): same.
+       (RenderAttributes): remove CausesValidation from the list of
+       Attributes before calling base.RenderAttributes.  Don't, however,
+       remove ValidationGroup, to replicate an MS bug.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlForm.cs (DefaultFocus): not stored in Attributes either.
+       (Name): not sure about this property.. the getter apparently just
+       returns UniqueID, and the setter does nothing that I can figure
+       out.
+       (RenderAttributes): don't bother to remove "name", since it's not
+       in the attributes anyway.
+
+2005-09-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HtmlInputControl.cs: use the Name property instead of the ClientID.
+       The 'name' attribute rendered contains colons if inside a
+       NamingContainer.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputCheckBox.cs (Checked): uncomment the
+       MinimizableAttributeTypeConverter attribute.
+
+       * HtmlControl.cs (Disabled): uncomment the
+       MinimizableAttributeTypeConverter attribute.
+
+       * HtmlForm.cs (SubmitDisabledControls): remove the MonoTODO.
+
+       * HtmlTableCell.cs (NoWrap): uncomment the
+       MinimizableAttributeTypeConverter attribute.
+
+       * HtmlLink.cs (Href): remove the MonoTODO.
+
+       * HtmlMeta.cs (Name): remove the MonoTODO.
+       (Scheme): same.
+       (Render): add (pretty bogus, really..) implementation.  not sure
+       why we need this one.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputControl.cs (RenderAttributes): Check Page.Form for
+       null.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputControl.cs (RenderAttributes): use ClientID instead of
+       ID.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlHead.cs (AddParsedSubObject): nuke, not in corcompare.
+       (AddedControl): move the HtmlTitle logic here.
+       (RemovedControl): clear out the title if that was the control that
+       was removed.
+
+       * HtmlLink.cs: new implementation.
+
+       * HtmlMeta.cs: new implementation.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputControl.cs (RenderAttributes): add ourselves to the
+       __enabledControlArray JS array if we're currently enabled and the
+       form is set to SubmitDisabledControls.
+
+       * HtmlForm.cs (OnInit): call Page.RegisterForm here.
+       (DetermineRenderUplevel): split this out of OnPreRender and make
+       it internal so HtmlInputControl can call it.
+       (OnPreRender): add handling for SubmitDisabledControls.
+
+2005-09-05  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlForm.cs (DefaultButton): this isn't stored as an Attribute,
+       or in the ViewState.  where then?
+       (DefaultFocus): this one is stored in the ViewState, not as an
+       Attribute.
+       (SubmitDisabledControls): implement just as a boolean flag, not in
+       the viewstate or attributes.
+       (RenderAttributes): defaultfocus and defaultbutton are no longer
+       in Attributes.
+
+2005-09-04  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputButton: Fix the 2.0/1.0 postback stuff the right way.
+       
+       * HtmlInputCheckBox: Fix the 2.0/1.0 postback stuff the right way.
+       
+       * HtmlInputFile.cs: Fix the 2.0/1.0 postback stuff the right way.
+
+       * HtmlInputHidden.cs: Fix the 2.0/1.0 postback stuff the right
+       way, and in OnPreRender, call Page.RegisterRequiresPostback.
+
+       * HtmlInputImage.cs: Fix the 2.0/1.0 postback stuff the right way,
+       and in OnPreRender, call Page.RegisterRequiresPostback.
+
+       * HtmlInputRadioButton.cs (OnPreRender): call
+       Page.RegisterRequiresPostback.
+       
+       * HtmlInputText.cs: Fix the 2.0/1.0 postback stuff the right way.
+       Also, in OnPreRender, call Page.RegisterRequiresPostback.
+
+       * HtmlTextArea.cs (OnPreRender): call
+       Page.RegisterRequiresPostback.
+
+2005-09-02  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlSelect.cs: implement 2.0 DataSourceID data binding.
+
+2005-09-02  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputReset.cs (ValidationGroup): remove the MonoTODO.
+
+       * htmlinputimage.cs: implement the 2.0 versions of loadpostdata,
+       raisepostdatachangedevent, and raisepostbackevent.
+       (validationgroup): implement.
+
+       * htmlinputcheckbox.cs: implement the 2.0 versions of loadpostdata
+       and raisepostdatachangedevent.
+
+       * HtmlInputHidden.cs: implement the 2.0 versions of LoadPostData
+       and RaisePostDataChangedEvent.
+
+       * HtmlInputButton.cs (RaisePostBackEventInternal): split out the
+       body of both RaisePostBackEvent impl's here, and fix it up so we
+       use the property Page.Validate call in 2.0.
+       (RaisePostBackEvent): call RaisePostBackEventInternal.
+       (IPostBackEventHandler.RaisePostBackEvent): same.
+
+       * HtmlImage.cs (Align): the test case shows that we don't need to
+       validate input.
+
 2005-09-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * HtmlTableCell.cs, HtmlTableRowCollection.cs, HtmlInputFile.cs,
index 5995ae894e22ef159fd1d9bef3fccaee467ed854..7bea980b04f584d17e1e1e1533cd0be72dc4b60b 100644 (file)
@@ -36,6 +36,9 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEvent ("ServerClick")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler {
 
                private static readonly object serverClickEvent = new object ();
@@ -50,6 +53,9 @@ namespace System.Web.UI.HtmlControls {
                [WebSysDescription("")]
                [WebCategory("Action")]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+#if NET_2_0
+               [UrlProperty]
+#endif
                public string HRef {
                        get {
                                string s = Attributes ["href"];
index 2f8b2a323c9f364c77c9354c2f2e2141d47fc8a7..127e249318c214cf4bddb7f214eddfb10e48afea 100644 (file)
@@ -37,6 +37,9 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEvent("ServerClick")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlButton : HtmlContainerControl, IPostBackEventHandler {
 
                private static readonly object ServerClickEvent = new object();
@@ -132,8 +135,8 @@ namespace System.Web.UI.HtmlControls {
                                writer.WriteAttribute ("language", "javascript");
                        }
                        else if (postback) {
-                               writer.AddAttribute ("onclick",
-                                                    Page.ClientScript.GetPostBackClientHyperlink (this, ""));
+                               writer.WriteAttribute ("onclick",
+                                                      Page.ClientScript.GetPostBackClientHyperlink (this, ""));
 
                                writer.WriteAttribute ("language", "javascript");
                        }
index a6102e3d7f1459b573928f61da58a1c61bf2c2e1..bfe41cfa39a86d09a6816488f9a25c9520297422 100644 (file)
@@ -37,7 +37,6 @@ using System.Text;
 //TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
 //case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
 //to do anything with children.
-// a doc references this. add? protected override ControlCollection CreateControlCollection();
 
 //TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
 // Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
@@ -140,6 +139,9 @@ namespace System.Web.UI.HtmlControls
                        base.RenderAttributes (writer);
                }
 
+               /* we need to override this because our base class
+                * (HtmlControl) returns an instance of
+                * EmptyControlCollection. */
                protected override ControlCollection CreateControlCollection ()
                {
                        return new ControlCollection (this);
index 32fc23d67bee9871620eb08c1e8185bdaac4e3e2..c4f2476628f3e057a17ccda94fb8e8df4b24aea5 100644 (file)
@@ -158,8 +158,7 @@ namespace System.Web.UI.HtmlControls{
                [WebSysDescription("")]
                [WebCategory("Behavior")]
 #if NET_2_0
-               /* Can't find this type in the docs */
-               //[TypeConverter (typeof(System.Web.UI.MinimizableAttributeTypeConverter))]
+               [TypeConverter (typeof(MinimizableAttributeTypeConverter))]
 #endif
                public bool Disabled
                {
index 3e64013a97090898e803f09c00a935956fccf924..b6d6456881595932dada49bdc658bab2ad1239fa 100644 (file)
@@ -43,45 +43,27 @@ namespace System.Web.UI.HtmlControls
                }
 
 #if NET_2_0
+               string defaultbutton = "";
                [DefaultValue ("")]
                public string DefaultButton
                {
                        get {
-                               string defaultbutton = Attributes["defaultbutton"];
-
-                               if (defaultbutton == null) {
-                                       return (String.Empty);
-                               }
-
-                               return (defaultbutton);
+                               return defaultbutton;
                        }
                        set {
-                               if (value == null) {
-                                       Attributes.Remove ("defaultbutton");
-                               } else {
-                                       Attributes["defaultbutton"] = value;
-                               }
+                               defaultbutton = (value == null ? "" : value);
                        }
                }
 
+               string defaultfocus = "";
                [DefaultValue ("")]
                public string DefaultFocus
                {
                        get {
-                               string defaultfocus = Attributes["defaultfocus"];
-
-                               if (defaultfocus == null) {
-                                       return (String.Empty);
-                               }
-
-                               return (defaultfocus);
+                               return defaultfocus;
                        }
                        set {
-                               if (value == null) {
-                                       Attributes.Remove ("defaultfocus");
-                               } else {
-                                       Attributes["defaultfocus"] = value;
-                               }
+                               defaultfocus = (value == null ? "" : value);
                        }
                }
 #endif         
@@ -140,33 +122,23 @@ namespace System.Web.UI.HtmlControls
                string Name 
                {
                        get {
-                               string name = Attributes["name"];
-
-                               if (name == null) {
-                                       return (UniqueID);
-                               }
-                               
-                               return (name);
+                               return UniqueID;
                        }
                        set {
-                               if (value == null) {
-                                       Attributes.Remove ("name");
-                               } else {
-                                       Attributes["name"] = value;
-                               }
+                               /* why am i here? I do nothing. */
                        }
                }
 
 #if NET_2_0
+               bool submitdisabledcontrols = false;
                [DefaultValue (false)]
-               [MonoTODO]
                public virtual bool SubmitDisabledControls 
                {
                        get {
-                               throw new NotImplementedException ();
+                               return submitdisabledcontrols;
                        }
                        set {
-                               throw new NotImplementedException ();
+                               submitdisabledcontrols = value;
                        }
                }
 #endif
@@ -207,7 +179,7 @@ namespace System.Web.UI.HtmlControls
                }
 
 #if NET_2_0            
-               [MonoTODO]
+               [MonoTODO ("why override?")]
                protected override ControlCollection CreateControlCollection ()
                {
                        return base.CreateControlCollection ();
@@ -223,22 +195,20 @@ namespace System.Web.UI.HtmlControls
                {
                        Page.RegisterViewStateHandler ();
 
+#if NET_2_0
+                       Page.RegisterForm (this);
+#endif
+
                        base.OnInit (e);
                }
 
 #if NET_2_0
-               protected internal override void OnPreRender (EventArgs e)
+               internal bool DetermineRenderUplevel ()
                {
-                       string focus_id = null;
-                       bool render_uplevel = false;
-                       bool need_script_block = false;
-
-                       base.OnPreRender(e);
-
                        /* this bit is c&p'ed from BaseValidator.DetermineRenderUplevel */
                        try {
                                if (Page != null && Page.Request != null)
-                                       render_uplevel = (
+                                       return (
                                                /* From someplace on the web: "JavaScript 1.2
                                                 * and later (also known as ECMAScript) has
                                                 * built-in support for regular
@@ -258,6 +228,18 @@ namespace System.Web.UI.HtmlControls
                                ;
                        }
 
+                       return false;
+               }
+
+               protected internal override void OnPreRender (EventArgs e)
+               {
+                       string focus_id = null;
+                       bool need_script_block = false;
+                       bool render_uplevel;
+
+                       base.OnPreRender(e);
+
+                       render_uplevel = DetermineRenderUplevel ();
 
                        /* figure out if we have some control we're going to focus */
                        if (DefaultFocus != null && DefaultFocus != "")
@@ -265,10 +247,8 @@ namespace System.Web.UI.HtmlControls
                        else if (DefaultButton != null && DefaultButton != "")
                                focus_id = DefaultButton;
 
-                       /* presumably there are other conditions to
-                        * this test, not just whether or not we have
-                        * a default focus/button */
-                       need_script_block = (focus_id != null);
+                       /* decide if we need to include the script block */
+                       need_script_block = (focus_id != null || submitdisabledcontrols);
 
                        if (render_uplevel) {
                                Page.RequiresPostBackScript();
@@ -288,6 +268,19 @@ namespace System.Web.UI.HtmlControls
                                                                                                "WebForm_AutoFocus('{0}');// -->\n" + 
                                                                                                "</script>\n", focus_id));
                                }
+
+                               if (submitdisabledcontrols) {
+                                       Page.ClientScript.RegisterOnSubmitStatement ("HtmlForm-SubmitDisabledControls-SubmitStatement",
+                                                                                    "javascript: return WebForm_OnSubmit();");
+                                       Page.ClientScript.RegisterStartupScript ("HtmlForm-SubmitDisabledControls-StartupScript",
+@"<script language=""JavaScript"">
+<!--
+function WebForm_OnSubmit() {
+WebForm_ReEnableControls();
+return true;
+} // -->
+</script>");
+                               }
                        }
                }
 #endif         
@@ -303,8 +296,9 @@ namespace System.Web.UI.HtmlControls
                        if (query != null && query.Length > 0) {
                                action += "?" + query;
                        }
-                       
+
                        w.WriteAttribute ("name", Name);
+
                        w.WriteAttribute ("method", Method);
                        w.WriteAttribute ("action", action);
 
@@ -347,14 +341,9 @@ namespace System.Web.UI.HtmlControls
                        /* Now remove them from the hash so the base
                         * RenderAttributes can do all the rest
                         */
-                       Attributes.Remove ("name");
                        Attributes.Remove ("method");
                        Attributes.Remove ("enctype");
                        Attributes.Remove ("target");
-#if NET_2_0
-                       Attributes.Remove ("defaultfocus");
-                       Attributes.Remove ("defaultbutton");
-#endif
 
                        base.RenderAttributes (w);
                }
@@ -373,7 +362,7 @@ namespace System.Web.UI.HtmlControls
 
 #if NET_2_0
                /* According to corcompare */
-               [MonoTODO]
+               [MonoTODO ("why override?")]
                public override void RenderControl (HtmlTextWriter w)
                {
                        base.RenderControl (w);
index d36c7e474a098d7432e9c0a4c730d81c3ff49d5b..02b220dfe9ccbc0b61d78720bc73230ef412f09d 100644 (file)
@@ -39,8 +39,8 @@ namespace System.Web.UI.HtmlControls
        [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [ControlBuilder (typeof(HtmlHeadBuilder))]
-       public sealed class HtmlHead: HtmlGenericControl, IPageHeader, IParserAccessor
-       {
+       public sealed class HtmlHead: HtmlGenericControl, IParserAccessor {
+
                HtmlTitle title;
                Hashtable metadata;
                ArrayList styleSheets;
@@ -73,48 +73,44 @@ namespace System.Web.UI.HtmlControls
                                styleSheet.Render (writer);
                }
                
-               protected override void AddParsedSubObject (object ob)
-               {
-                       if (ob is HtmlTitle)
-                               title = (HtmlTitle) ob;
-                       
-                       base.AddParsedSubObject (ob);
-               }
-               
                protected internal override void AddedControl (Control control, int index)
                {
+                       if (control is HtmlTitle)
+                               title = (HtmlTitle) control;
+
                        base.AddedControl (control, index);
                }
 
-               /* Shows up in corcompare */
-               [MonoTODO]
                protected internal override void RemovedControl (Control control)
                {
-                       throw new NotImplementedException ();
+                       if (title == control)
+                               title = null;
+
+                       base.RemovedControl (control);
                }
                
-               IList IPageHeader.LinkedStyleSheets {
+               IList LinkedStyleSheets {
                        get {
                                if (styleSheets == null) styleSheets = new ArrayList ();
                                return styleSheets;
                        }
                } 
                
-               IDictionary IPageHeader.Metadata {
+               IDictionary Metadata {
                        get {
                                if (metadata == null) metadata = new Hashtable ();
                                return metadata;
                        }
                }
                
-               IStyleSheet IPageHeader.StyleSheet {
+               public IStyleSheet StyleSheet {
                        get {
                                if (styleSheet == null) styleSheet = new StyleSheetBag ();
                                return styleSheet;
                        }
                }
                
-               string IPageHeader.Title {
+               public string Title {
                        get { return title.Text; }
                        set { title.Text = value; }
                }
@@ -135,7 +131,7 @@ namespace System.Web.UI.HtmlControls
                {
                }
                
-               public void CreateStyleRule (Style style, string selection, IUrlResolutionService urlResolver)
+               public void CreateStyleRule (Style style, IUrlResolutionService urlResolver, string selection)
                {
                        StyleEntry entry = new StyleEntry ();
                        entry.Style = style;
@@ -153,7 +149,7 @@ namespace System.Web.UI.HtmlControls
                        
                        string name = "aspnet_" + entries.Count;
                        style.SetRegisteredCssClass (name);
-                       CreateStyleRule (style, "." + name, urlResolver);
+                       CreateStyleRule (style, urlResolver, "." + name);
                }
                
                public void Render (HtmlTextWriter writer)
index 530dcb790aaf06c6158ac31c3152313ca17d4667..e72ba3e93af3405509da05072a3d7dbd226c893d 100644 (file)
@@ -47,7 +47,6 @@ namespace System.Web.UI.HtmlControls
                {
                }
 
-               [MonoTODO ("need to validate input strings?")]
                [DefaultValue ("")]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                [WebSysDescription("")]
@@ -64,9 +63,6 @@ namespace System.Web.UI.HtmlControls
                                return (align);
                        }
                        set {
-                               /* Validate: left, center, right, top,
-                                * middle, bottom?
-                                */
                                if (value == null) {
                                        Attributes.Remove ("align");
                                } else {
@@ -154,6 +150,9 @@ namespace System.Web.UI.HtmlControls
                [WebSysDescription("")]
                [WebCategory("Behavior")]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+#if NET_2_0
+               [UrlProperty]
+#endif
                public string Src 
                {
                        get {
index 432473861f7d8161d6532a865edfc3cda709e504..dd4a7bab9815ce65873f21a426811ecc843d9c99 100644 (file)
@@ -36,6 +36,9 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEventAttribute ("ServerClick")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler {
 
                private static readonly object ServerClickEvent = new object();
@@ -58,10 +61,15 @@ namespace System.Web.UI.HtmlControls {
 #endif         
                bool CausesValidation {
                        get {
-                               return ViewState.GetBool ("CausesValidation", true);
+                               string flag = Attributes["CausesValidation"];
+
+                               if (flag == null)
+                                       return true;
+
+                               return Boolean.Parse (flag);
                        }
                        set {
-                               ViewState ["CausesValidation"] = value;
+                               Attributes ["CausesValidation"] = value.ToString();
                        }
                }
 
@@ -70,27 +78,47 @@ namespace System.Web.UI.HtmlControls {
                public string ValidationGroup
                {
                        get {
-                               return ViewState.GetString ("ValidationGroup", "");
+                               string group = Attributes["ValidationGroup"];
+
+                               if (group == null)
+                                       return "";
+
+                               return group;
                        }
                        set {
-                               ViewState ["ValidationGroup"] = value;
+                               if (value == null)
+                                       Attributes.Remove ("ValidationGroup");
+                               else
+                                       Attributes["ValidationGroup"] = value;
                        }
                }
 #endif
 
+               void RaisePostBackEventInternal (string eventArgument)
+               {
+                       if (CausesValidation)
+#if NET_2_0
+                               Page.Validate (ValidationGroup);
+#else
+                               Page.Validate ();
+#endif
+                       OnServerClick (EventArgs.Empty);
+               }
+
 #if NET_2_0
-               [MonoTODO]
                protected virtual void RaisePostBackEvent (string eventArgument)
                {
-                       throw new NotImplementedException ();
+                       RaisePostBackEventInternal (eventArgument);
                }
 #endif
                
                void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
                {
-                       if (CausesValidation)
-                               Page.Validate ();
-                       OnServerClick (EventArgs.Empty);
+#if NET_2_0
+                       RaisePostBackEvent (eventArgument);
+#else
+                       RaisePostBackEventInternal (eventArgument);
+#endif
                }
 
 #if NET_2_0
@@ -114,12 +142,29 @@ namespace System.Web.UI.HtmlControls {
 
                protected override void RenderAttributes (HtmlTextWriter writer)
                {
-                       if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
+                       if (CausesValidation && Page != null) {
+                               string oc = null;
                                ClientScriptManager csm = new ClientScriptManager (Page);
-                               writer.WriteAttribute ("onclick", csm.GetClientValidationEvent ());
-                               writer.WriteAttribute ("language", "javascript");
+                               if (Page.AreValidatorsUplevel ()) {
+                                       oc = csm.GetClientValidationEvent ();
+                               } else if (Events [ServerClickEvent] != null) {
+                                       oc = Attributes ["onclick"] + " " + csm.GetPostBackClientEvent (this, "");
+                               }
+                               
+                               if (oc != null) {
+                                       writer.WriteAttribute ("language", "javascript");
+                                       writer.WriteAttribute ("onclick", oc);
+                               }
                        }
 
+                       Attributes.Remove ("CausesValidation");
+#if NET_2_0
+                       // LAMESPEC: MS doesn't actually remove this
+                       //attribute.  it shows up in the rendered
+                       //output.
+
+                       // Attributes.Remove("ValidationGroup");
+#endif
                        base.RenderAttributes (writer);
                }
 
index 9ded738dba3e5ca6d0fea8816f71ab874039a594..a0981cfa2079264ef438223dacc1d0310e057956 100644 (file)
@@ -37,6 +37,9 @@ namespace System.Web.UI.HtmlControls
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEvent ("ServerChange")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler
        {
                public HtmlInputCheckBox () : base ("checkbox")
@@ -48,7 +51,7 @@ namespace System.Web.UI.HtmlControls
                [WebSysDescription("")]
                [WebCategory("Misc")]
 #if NET_2_0
-               //[TypeConverter (typeof(System.Web.UI.MinimizableAttributeTypeConverter))]
+               [TypeConverter (typeof(MinimizableAttributeTypeConverter))]
 #endif
                public bool Checked
                {
@@ -107,39 +110,53 @@ namespace System.Web.UI.HtmlControls
                        }
                }
 
+               bool LoadPostDataInternal (string postDataKey, NameValueCollection postCollection)
+               {
+                       string postedValue = postCollection[postDataKey];
+                       bool postedBool = ((postedValue != null) &&
+                                          (postedValue.Length > 0));
+
+                       if (Checked != postedBool) {
+                               Checked = postedBool;
+                               return (true);
+                       }
+                       
+                       return (false);
+               }
+
+               void RaisePostDataChangedEventInternal ()
+               {
+                       OnServerChange (EventArgs.Empty);
+               }
+
 #if NET_2_0
-               [MonoTODO]
                protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       throw new NotImplementedException ();
+                       return LoadPostDataInternal (postDataKey, postCollection);
                }
 
-               [MonoTODO]
                protected virtual void RaisePostDataChangedEvent ()
                {
-                       throw new NotImplementedException ();
+                       RaisePostDataChangedEventInternal ();
                }
 #endif
                
                bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       string postedValue = postCollection[postDataKey];
-                       bool postedBool = ((postedValue != null) &&
-                                          (postedValue.Length > 0));
-
-                       if (Checked != postedBool) {
-                               Checked = postedBool;
-                               return (true);
-                       }
-                       
-                       return (false);
+#if NET_2_0
+                       return LoadPostData (postDataKey, postCollection);
+#else
+                       return LoadPostDataInternal (postDataKey, postCollection);
+#endif
                }
 
                void IPostBackDataHandler.RaisePostDataChangedEvent ()
                {
-                       OnServerChange (EventArgs.Empty);
+#if NET_2_0
+                       RaisePostDataChangedEvent();
+#else
+                       RaisePostDataChangedEventInternal ();
+#endif
                }
        }
 }
-
-       
index 9463a9dcc56f46000a951c0c168abaef6af7cc25..8aea7b8d1110f61bee0cd98cb530aff91e76a5dc 100644 (file)
@@ -100,7 +100,7 @@ namespace System.Web.UI.HtmlControls {
                protected override void RenderAttributes (HtmlTextWriter writer)
                {
                        if (Attributes ["name"] == null) {
-                               writer.WriteAttribute ("name", ClientID);
+                               writer.WriteAttribute ("name", Name);
                        }
 #if NET_2_0
                        Attributes.Remove ("type");
@@ -108,6 +108,12 @@ namespace System.Web.UI.HtmlControls {
 #endif
                        base.RenderAttributes (writer);
                        writer.Write (" /");
+
+#if NET_2_0
+                       if (Page != null && Page.Form != null && Page.Form.SubmitDisabledControls && Page.Form.DetermineRenderUplevel() && !Disabled)
+                               Page.ClientScript.RegisterArrayDeclaration ("__enabledControlArray", String.Format ("'{0}'", ClientID));
+#endif
                }
        }
 }
+
index 2b0a9c3380be678a70268b484bde6a3a3f5397df..1a5d4b44fb519c0319b340dff0ce6f7ca0efe799 100644 (file)
@@ -143,7 +143,7 @@ namespace System.Web.UI.HtmlControls
                                return (value);
                        }
                        set {
-                               throw new NotSupportedException ();
+                               throw new NotSupportedException ("The value property on HtmlInputFile is not settable.");
                        }
                }
 
@@ -161,30 +161,46 @@ namespace System.Web.UI.HtmlControls
                        }
                }
 
+               bool LoadPostDataInternal (string postDataKey, NameValueCollection postCollection)
+               {
+                       posted_file = Page.Request.Files [postDataKey];
+                       
+                       return (false);
+               }
+
+               void RaisePostDataChangedEventInternal ()
+               {
+                       /* No events to raise */
+               }
+
 #if NET_2_0
-               [MonoTODO]
                protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       throw new NotImplementedException ();
+                       return LoadPostDataInternal (postDataKey, postCollection);
                }
 
-               [MonoTODO]
                protected virtual void RaisePostDataChangedEvent ()
                {
-                       throw new NotImplementedException ();
+                       RaisePostDataChangedEventInternal ();
                }
 #endif         
                
                bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       posted_file = Page.Request.Files [postDataKey];
-                       
-                       return (false);
+#if NET_2_0
+                       return LoadPostData (postDataKey, postCollection);
+#else
+                       return LoadPostDataInternal (postDataKey, postCollection);
+#endif
                }
 
                void IPostBackDataHandler.RaisePostDataChangedEvent ()
                {
-                       /* No events to raise */
+#if NET_2_0
+                       RaisePostDataChangedEvent ();
+#else
+                       RaisePostDataChangedEventInternal ();
+#endif
                }
        }
 }
index 6b55d6858f40cae29318d8c1c216b3cde3292d49..592a9c169ae4435cb98eb28ed4e122428160f8ab 100644 (file)
@@ -37,6 +37,9 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEvent ("ServerChange")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler {
 
                private static readonly object ServerChangeEvent = new object ();
@@ -45,34 +48,50 @@ namespace System.Web.UI.HtmlControls {
                {
                }
 
+               bool LoadPostDataInternal (string postDataKey, NameValueCollection postCollection)
+               {
+                       string data = postCollection [postDataKey];
+                       if (data != null && data != Value) {
+                               Value = data;
+                               return true;
+                       }
+                       return false;
+               }
+
+               void RaisePostDataChangedEventInternal ()
+               {
+                       OnServerChange (EventArgs.Empty);
+               }
+
 #if NET_2_0
-               [MonoTODO]
                protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       throw new NotImplementedException ();
+                       return LoadPostDataInternal (postDataKey, postCollection);
                }
 
-               [MonoTODO]
                protected virtual void RaisePostDataChangedEvent ()
                {
-                       throw new NotImplementedException ();
+                       RaisePostDataChangedEventInternal ();
                }
 #endif         
                
                bool IPostBackDataHandler.LoadPostData (string postDataKey,
-                               NameValueCollection postCollection)
+                                                       NameValueCollection postCollection)
                {
-                       string data = postCollection [postDataKey];
-                       if (data != null && data != Value) {
-                               Value = data;
-                               return true;
-                       }
-                       return false;
+#if NET_2_0
+                       return LoadPostData (postDataKey, postCollection);
+#else
+                       return LoadPostDataInternal (postDataKey, postCollection);
+#endif
                }
 
                void IPostBackDataHandler.RaisePostDataChangedEvent ()
                {
-                       OnServerChange (EventArgs.Empty);
+#if NET_2_0
+                       RaisePostDataChangedEvent ();
+#else
+                       RaisePostDataChangedEventInternal ();
+#endif
                }
 
 #if NET_2_0
@@ -83,6 +102,10 @@ namespace System.Web.UI.HtmlControls {
                override void OnPreRender (EventArgs e)
                {
                        base.OnPreRender (e);
+
+                       if (Page != null) {
+                               Page.RegisterRequiresPostBack (this);
+                       }
                }
 
                protected virtual void OnServerChange (EventArgs e)
index e028ea08ff41bd090bf544705b6c257b39722f33..043cf887e09193b792197c98a701df19ba4db110 100644 (file)
@@ -43,6 +43,9 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEvent("ServerClick")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlInputImage : HtmlInputControl, IPostBackDataHandler,
                      IPostBackEventHandler {
 
@@ -97,6 +100,9 @@ namespace System.Web.UI.HtmlControls {
                [WebSysDescription("")]
                [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                [WebCategory("Appearance")]
+#if NET_2_0
+               [UrlProperty]
+#endif
                public string Src {
                        get { return GetAtt ("src"); }
                        set { SetAtt ("src", value); }
@@ -126,69 +132,94 @@ namespace System.Web.UI.HtmlControls {
                        }
                }
 
+               bool LoadPostDataInternal (string postDataKey, NameValueCollection postCollection)
+               {
+                       string x = postCollection [UniqueID + ".x"];
+                       string y = postCollection [UniqueID + ".y"];
+
+                       if (x != null && x.Length != 0 &&
+                                       y != null && y.Length != 0) {
+                               clicked_x = Int32.Parse (x, CultureInfo.InvariantCulture);
+                               clicked_y = Int32.Parse (y, CultureInfo.InvariantCulture);
+                               Page.RegisterRequiresRaiseEvent (this);
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               
+               void RaisePostBackEventInternal (string eventArgument)
+               {
+                       if (CausesValidation)
+#if NET_2_0
+                               Page.Validate (ValidationGroup);
+#else
+                               Page.Validate ();
+#endif
+                       OnServerClick (new ImageClickEventArgs (clicked_x, clicked_y));
+               }
+
+               void RaisePostDataChangedEventInternal ()
+               {
+                       /* no events to raise */
+               }
+
 #if NET_2_0
-               [MonoTODO]
                [DefaultValue ("")]
                public string ValidationGroup
                {
                        get {
-                               throw new NotImplementedException ();
+                               return ViewState.GetString ("ValidationGroup", "");
                        }
                        set {
-                               throw new NotImplementedException ();
+                               ViewState ["ValidationGroup"] = value;
                        }
                }
 
-               [MonoTODO]
                protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       throw new NotImplementedException ();
+                       return LoadPostDataInternal (postDataKey, postCollection);
                }
 
-               [MonoTODO]
                protected virtual void RaisePostBackEvent (string eventArgument)
                {
-                       throw new NotImplementedException ();
+                       RaisePostBackEventInternal (eventArgument);
                }
 
-               [MonoTODO]
                protected virtual void RaisePostDataChangedEvent ()
                {
-                       throw new NotImplementedException ();
+                       RaisePostDataChangedEventInternal ();
                }
 #endif         
 
                bool IPostBackDataHandler.LoadPostData (string postDataKey,
                                NameValueCollection postCollection)
                {
-                       string x = postCollection [UniqueID + ".x"];
-                       string y = postCollection [UniqueID + ".y"];
-
-                       if (x != null && x.Length != 0 &&
-                                       y != null && y.Length != 0) {
-                               clicked_x = Int32.Parse (x, CultureInfo.InvariantCulture);
-                               clicked_y = Int32.Parse (y, CultureInfo.InvariantCulture);
-                               Page.RegisterRequiresRaiseEvent (this);
-                               return true;
-                       }
-
-                       return false;
+#if NET_2_0
+                       return LoadPostData (postDataKey, postCollection);
+#else
+                       return LoadPostDataInternal (postDataKey, postCollection);
+#endif
                }
 
                
                void IPostBackDataHandler.RaisePostDataChangedEvent ()
                {
+#if NET_2_0
+                       RaisePostDataChangedEvent();
+#else
+                       RaisePostDataChangedEventInternal ();
+#endif
                }
                                
                void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
                {
-                       if (CausesValidation)
 #if NET_2_0
-                               Page.Validate (ValidationGroup);
+                       RaisePostBackEvent (eventArgument);
 #else
-                               Page.Validate ();
+                       RaisePostBackEventInternal (eventArgument);
 #endif
-                       OnServerClick (new ImageClickEventArgs (clicked_x, clicked_y));
                }
 
 #if NET_2_0
@@ -199,8 +230,10 @@ namespace System.Web.UI.HtmlControls {
                override void OnPreRender (EventArgs e)
                {
                        base.OnPreRender (e);
-                       if (Page != null)
+
+                       if (Page != null) {
                                Page.RegisterRequiresPostBack (this);
+                       }
                }
 
                protected virtual void OnServerClick (ImageClickEventArgs e)
index 68ed99706692a6acd88945e32202c9d05ff811c1..99db3113a04c221713442c6de4fc2af19647b63e 100644 (file)
@@ -40,6 +40,7 @@ namespace System.Web.UI.HtmlControls {
        // attributes
        [DefaultEvent ("ServerChange")]
        [ValidationProperty ("Value")]
+       [SupportsEventValidation]
        public class HtmlInputPassword : HtmlInputText, IPostBackDataHandler
        {
                public HtmlInputPassword ()
@@ -47,10 +48,6 @@ namespace System.Web.UI.HtmlControls {
                {
                }
 
-               public HtmlInputPassword (string type)
-                       : base (type)
-               {
-               }
 
                protected override void RenderAttributes (HtmlTextWriter writer)
                {
index 0acf277e6a0666c8cdacd240229f34634476a333..c4a0c47ccc3af1d24d3c9e28d2f78aa8bf3d7be5 100644 (file)
@@ -37,6 +37,9 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEvent ("ServerChange")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlInputRadioButton : HtmlInputControl, IPostBackDataHandler {
 
                private static readonly object serverChangeEvent = new object ();
@@ -102,6 +105,10 @@ namespace System.Web.UI.HtmlControls {
                override void OnPreRender (EventArgs e)
                {
                        base.OnPreRender (e);
+
+                       if (Page != null) {
+                               Page.RegisterRequiresPostBack (this);
+                       }
                }
 
                protected virtual void OnServerChange (EventArgs e)
index c40aae84e349dcaaf708d6ea1f88a53a408589e4..ee566d56e936d98a7065161f8ee408f742e53e52 100644 (file)
@@ -38,6 +38,7 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEventAttribute ("")]
+       [SupportsEventValidation]
        public class HtmlInputReset : HtmlInputButton
        {
                private static readonly object ServerClickEvent = new object();
@@ -52,7 +53,6 @@ namespace System.Web.UI.HtmlControls {
                {
                }
 
-               [MonoTODO("Why override?")]
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public override bool CausesValidation {
@@ -64,7 +64,6 @@ namespace System.Web.UI.HtmlControls {
                        }
                }
 
-               [MonoTODO("Why new?")]
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new string ValidationGroup
index f2cfc018a46f78fe8b5e5226cf8c516cb8ca41fa..2ef52266103f5b0e960af73e092595eab195baaf 100644 (file)
@@ -38,6 +38,7 @@ namespace System.Web.UI.HtmlControls {
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        // attributes
        [DefaultEventAttribute ("ServerClick")]
+       [SupportsEventValidation]
        public class HtmlInputSubmit : HtmlInputButton, IPostBackEventHandler
        {
                public HtmlInputSubmit ()
@@ -50,7 +51,7 @@ namespace System.Web.UI.HtmlControls {
                {
                }
 
-               [MonoTODO]
+               [MonoTODO ("why our own version?")]
                void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
                {
                        base.RaisePostBackEvent (eventArgument);
index 16255c39e92e57924a457e7494644595c02fd159..b41f019d9aff3c85459cd38f0ab96a5fd0ea3f81 100644 (file)
@@ -39,6 +39,9 @@ namespace System.Web.UI.HtmlControls {
        // attributes
        [DefaultEvent ("ServerChange")]
        [ValidationProperty ("Value")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlInputText : HtmlInputControl, IPostBackDataHandler {
 
                private static readonly object serverChangeEvent = new object ();
@@ -115,6 +118,9 @@ namespace System.Web.UI.HtmlControls {
                override void OnPreRender (EventArgs e)
                {
                        base.OnPreRender (e);
+                       if (Page != null) {
+                               Page.RegisterRequiresPostBack (this);
+                       }
                }
 
                protected virtual void OnServerChange (EventArgs e)
@@ -123,17 +129,7 @@ namespace System.Web.UI.HtmlControls {
                        if (serverChange != null)
                                serverChange (this, e);
                }
-#if NET_2_0
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
-               {
-                       return DefaultLoadPostData (postDataKey, postCollection);
-               }
 
-               protected virtual void RaisePostDataChangedEvent ()
-               {
-                       OnServerChange (EventArgs.Empty);
-               }
-#else
                protected override void RenderAttributes (HtmlTextWriter writer)
                {
                        // the Type property can be, indirectly, changed by using the Attributes property
@@ -143,24 +139,40 @@ namespace System.Web.UI.HtmlControls {
 
                        base.RenderAttributes (writer);
                }
-#endif
 
-               internal bool DefaultLoadPostData (string postDataKey, NameValueCollection postCollection)
+               bool LoadPostDataInternal (string postDataKey, NameValueCollection postCollection)
                {
                        string s = postCollection [postDataKey];
-                       if (Attributes ["value"] != s) {
-                               Attributes ["value"] = s;
+                       if (Value != s) {
+                               Value = s;
                                return true;
                        }
                        return false;
                }
 
+               void RaisePostDataChangedEventInternal ()
+               {
+                       OnServerChange (EventArgs.Empty);
+               }
+
+#if NET_2_0
+               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+               {
+                       return LoadPostDataInternal (postDataKey, postCollection);
+               }
+
+               protected virtual void RaisePostDataChangedEvent ()
+               {
+                       RaisePostDataChangedEventInternal ();
+               }
+#endif
+
                bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
 #if NET_2_0
                        return LoadPostData (postDataKey, postCollection);
 #else
-                       return DefaultLoadPostData (postDataKey, postCollection);
+                       return LoadPostDataInternal (postDataKey, postCollection);
 #endif
                }
 
@@ -169,7 +181,7 @@ namespace System.Web.UI.HtmlControls {
 #if NET_2_0
                        RaisePostDataChangedEvent ();
 #else
-                       OnServerChange (EventArgs.Empty);
+                       RaisePostDataChangedEventInternal ();
 #endif
                }
 
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlLink.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlLink.cs
new file mode 100644 (file)
index 0000000..518c0b8
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// System.Web.UI.HtmlControls.HtmlHead
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.HtmlControls
+{
+       [ControlBuilder (typeof (HtmlEmptyTagControlBuilder))]
+       public class HtmlLink: HtmlControl
+       {
+               public HtmlLink () : base ("link")
+               {
+               }
+
+               [DefaultValue ("")]
+               [UrlProperty]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public virtual string Href {
+                       get {
+                               string s = Attributes["href"];
+                               if (s == null)
+                                       return "";
+                               return s;
+                       }
+                       set {
+                               if (value == null)
+                                       Attributes.Remove ("href");
+                               else
+                                       Attributes["href"] = value;
+                       }
+               }
+
+               protected internal override void Render (HtmlTextWriter writer)
+               {
+                       writer.WriteBeginTag (TagName);
+                       RenderAttributes (writer);
+                       writer.Write (" />");
+               }
+
+               [MonoTODO ("why override?")]
+               protected override void RenderAttributes (HtmlTextWriter writer)
+               {
+                       base.RenderAttributes (writer);
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlMeta.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlMeta.cs
new file mode 100644 (file)
index 0000000..daa2f61
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// System.Web.UI.HtmlControls.HtmlHead
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.HtmlControls
+{
+       [ControlBuilder (typeof (HtmlEmptyTagControlBuilder))]
+       public class HtmlMeta: HtmlControl
+       {
+               public HtmlMeta () : base ("meta")
+               {
+               }
+
+               [DefaultValue ("")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public virtual string Content {
+                       get {
+                               string s = Attributes["content"];
+                               if (s == null)
+                                       return "";
+                               return s;
+                       }
+                       set {
+                               if (value == null)
+                                       Attributes.Remove ("content");
+                               else
+                                       Attributes["content"] = value;
+                       }
+               }
+
+               [DefaultValue ("")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public virtual string HttpEquiv {
+                       get {
+                               string s = Attributes["http-equiv"];
+                               if (s == null)
+                                       return "";
+                               return s;
+                       }
+                       set {
+                               if (value == null)
+                                       Attributes.Remove ("http-equiv");
+                               else
+                                       Attributes["http-equiv"] = value;
+                       }
+               }
+
+               [DefaultValue ("")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public virtual string Name {
+                       get {
+                               string s = Attributes["name"];
+                               if (s == null)
+                                       return "";
+                               return s;
+                       }
+                       set {
+                               if (value == null)
+                                       Attributes.Remove ("name");
+                               else
+                                       Attributes["name"] = value;
+                       }
+               }
+
+               [DefaultValue ("")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public virtual string Scheme {
+                       get {
+                               string s = Attributes["scheme"];
+                               if (s == null)
+                                       return "";
+                               return s;
+                       }
+                       set {
+                               if (value == null)
+                                       Attributes.Remove ("scheme");
+                               else
+                                       Attributes["scheme"] = value;
+                       }
+               }
+
+               protected internal override void Render (HtmlTextWriter writer)
+               {
+                       writer.WriteBeginTag (TagName);
+                       RenderAttributes (writer);
+                       writer.Write (">");
+               }
+       }
+}
+
+#endif
index 14af471c9781ab219e7af9fa989bf997efed9b57..dfec4a6adb4ec89151d905e59829497a33abb120 100644 (file)
@@ -43,11 +43,17 @@ namespace System.Web.UI.HtmlControls
        [DefaultEvent ("ServerChange")]
        [ValidationProperty ("Value")]
        [ControlBuilder (typeof (HtmlSelectBuilder))]
-       public class HtmlSelect : HtmlContainerControl , IPostBackDataHandler
 #if NET_2_0
-       , IParserAccessor
+       [SupportsEventValidation]
+       public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler, IParserAccessor {
+
+               DataSourceView boundDataSourceView;
+               IDataSource boundDataSource;
+               private bool requiresDataBinding;
+               IEnumerable data;
+#else
+       public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler {
 #endif
-       {
                public HtmlSelect () : base ("select")
                {
                }
@@ -103,9 +109,14 @@ namespace System.Web.UI.HtmlControls
                public virtual string DataSourceID
                {
                        get {
-                               return (String.Empty);
+                               return ViewState.GetString ("DataSourceID", "");
                        }
                        set {
+                               if (datasource != null)
+                                       throw new HttpException ("Only one of DataSource and DataSourceID can be specified.");
+                               ViewState ["DataSourceID"] = value;
+
+                               OnDataPropertyChanged ();
                        }
                }
 #endif
@@ -178,11 +189,10 @@ namespace System.Web.UI.HtmlControls
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected bool IsBoundUsingDataSourceID 
                {
                        get {
-                               throw new NotImplementedException ();
+                               return (DataSourceID.Length != 0);
                        }
                }
 #endif         
@@ -241,15 +251,10 @@ namespace System.Web.UI.HtmlControls
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected bool RequiresDataBinding 
                {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
+                       get { return requiresDataBinding; }
+                       set { requiresDataBinding = value; }
                }
 #endif
 
@@ -411,16 +416,32 @@ namespace System.Web.UI.HtmlControls
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected void EnsureDataBound ()
                {
-                       throw new NotImplementedException ();
+                       if (IsBoundUsingDataSourceID && RequiresDataBinding)
+                               DataBind ();
+               }
+
+               private void SelectCallback (IEnumerable data)
+               {
+                       this.data = data;
                }
 
-               [MonoTODO]
                protected virtual IEnumerable GetData ()
                {
-                       throw new NotImplementedException ();
+                       IEnumerable result;
+
+                       if (DataSourceID.Length == 0)
+                               return null;
+
+                       boundDataSourceView = boundDataSource.GetView (String.Empty);
+                       boundDataSourceView.Select (new DataSourceSelectArguments (), SelectCallback);
+                       boundDataSourceView.DataSourceViewChanged += OnDataSourceViewChanged;
+
+                       result = data;
+                       data = null;
+
+                       return result;
                }
 #endif         
 
@@ -458,7 +479,14 @@ namespace System.Web.UI.HtmlControls
 
                        listitems.Clear ();
                        
-                       IEnumerable list = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
+                       IEnumerable list;
+
+#if NET_2_0
+                       if (IsBoundUsingDataSourceID)
+                               list = GetData ();
+                       else
+#endif
+                               list = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
 
                        if (list == null) {
                                return;
@@ -506,7 +534,6 @@ namespace System.Web.UI.HtmlControls
                protected virtual void OnDataPropertyChanged ()
                {
                        RequiresDataBinding = true;
-                       throw new NotImplementedException ();
                }
 
                [MonoTODO]
@@ -514,27 +541,46 @@ namespace System.Web.UI.HtmlControls
                                                                EventArgs e)
                {
                        RequiresDataBinding = true;
-                       throw new NotImplementedException ();
                }
 
                [MonoTODO]
                protected internal override void OnInit (EventArgs e)
                {
-/*
-                       if (IsViewStateEnabled == false &&
-                           Page.IsPostBack == true) {
-                               RequiresDataBinding = true;
-                       }
-*/
-                       throw new NotImplementedException ();
+                       base.OnInit (e);
                }
 
-               [MonoTODO]
                protected internal override void OnLoad (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       if ((Page != null) && !Page.IsPostBack)
+                               RequiresDataBinding = true;
+
+                       base.OnLoad (e);
+
+                       if (IsBoundUsingDataSourceID)
+                               ConnectToDataSource ();
                }
-#endif         
+
+               void ConnectToDataSource ()
+               {
+                       /* verify that the data source exists and is an IDataSource */
+                       object ctrl = null;
+                       if (Page != null)
+                               ctrl = Page.FindControl (DataSourceID);
+
+                       if (ctrl == null || !(ctrl is IDataSource)) {
+                               string format;
+
+                               if (ctrl == null)
+                                       format = "DataSourceID of '{0}' must be the ID of a control of type IDataSource.  A control with ID '{1}' could not be found.";
+                               else
+                                       format = "DataSourceID of '{0}' must be the ID of a control of type IDataSource.  '{1}' is not an IDataSource.";
+
+                               throw new HttpException (String.Format (format, ID, DataSourceID));
+                       }
+
+                       boundDataSource = (IDataSource)ctrl;
+               }
+#endif
 
 #if NET_2_0
                protected internal
@@ -543,6 +589,10 @@ namespace System.Web.UI.HtmlControls
 #endif         
                override void OnPreRender (EventArgs e)
                {
+#if NET_2_0
+                       EnsureDataBound ();
+#endif
+
                        base.OnPreRender (e);
 
                        if (Page != null) {
index 1bf7b99c9b0d134e95d7935145dfc44261e85f31..7c9bdcdbe3c6e63e4cd6ad29ef4a7cee58bceddc 100644 (file)
@@ -138,8 +138,7 @@ namespace System.Web.UI.HtmlControls {
                [DefaultValue ("")]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
 #if NET_2_0
-               [MonoTODO ("duplicate internal class for TypeConverter ?")]
-               [TypeConverter ("System.Web.UI.MinimizableAttributeTypeConverter, " + Consts.AssemblySystem_Web)]
+               [TypeConverter (typeof (MinimizableAttributeTypeConverter))]
 #endif
                [WebSysDescription("")]
                [WebCategory("Behavior")]
index b318ae68530d0ca6ae899efcc92249db926645b1..fd768c991a630388d3ffa415caaa7ea9e6a7f641 100644 (file)
@@ -39,6 +39,9 @@ namespace System.Web.UI.HtmlControls {
        // attributes
        [DefaultEvent ("ServerChange")]
        [ValidationProperty ("Value")]
+#if NET_2_0
+       [SupportsEventValidation]
+#endif
        public class HtmlTextArea : HtmlContainerControl, IPostBackDataHandler {
 
                private static readonly object serverChangeEvent = new object ();
@@ -119,6 +122,10 @@ namespace System.Web.UI.HtmlControls {
                override void OnPreRender (EventArgs e)
                {
                        base.OnPreRender (e);
+
+                       if (Page != null) {
+                               Page.RegisterRequiresPostBack (this);
+                       }
                }
 
                protected virtual void OnServerChange (EventArgs e)
index 6539ae02864d7ff75acd7601306ac4daabc2ee40..7ea721c6112ba9fa6b4f6b5261b45f349a3fa5a7 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-05  Chris Toshok  <toshok@ximian.com>
+
+       * WebPartVerbCollection.cs: class is sealed.
+
 2005-09-01  Chris Toshok  <toshok@ximian.com>
 
        * WebPart.cs: add some WebSysDescription/WebCategory attributes.
index 1fef3870060707d21ce459a283b9036349d2d8e7..a8d79c9224ec549baec988eb9f82ea06334169cf 100644 (file)
@@ -34,7 +34,7 @@ using System.Reflection;
 
 namespace System.Web.UI.WebControls.WebParts
 {
-       public class WebPartVerbCollection : ReadOnlyCollectionBase
+       public sealed class WebPartVerbCollection : ReadOnlyCollectionBase
        {
                public WebPartVerbCollection ()
                {                       
index d9bd000657ba8f51dd5b4f2bffa7481319fdd3d0..e6ce37dc76632bf777d738eb19959d8305f3d5eb 100644 (file)
@@ -41,7 +41,6 @@ namespace System.Web.UI.WebControls
                public event EventHandler DataBound;
                
                object dataSource;
-               string dataSourceId;
                bool initialized;
                bool requiresDataBinding;
                
@@ -76,10 +75,10 @@ namespace System.Web.UI.WebControls
                [ThemeableAttribute (false)]
                public virtual string DataSourceID {
                        get {
-                               return dataSourceId != null ? dataSourceId : string.Empty;
+                               return ViewState.GetString ("DataSourceID", "");
                        }
                        set {
-                               dataSourceId = value;
+                               ViewState["DataSourceID"] = value;
                                if (initialized)
                                        OnDataPropertyChanged ();
                        }
index 783efe29b9d2d8aca24cb0f096034b64331b2db4..9c0fdff25f18d49180e4391ec0e027b7ede1b2cc 100644 (file)
@@ -232,6 +232,10 @@ namespace System.Web.UI.WebControls {
                {
                        /* if we're rendering uplevel, add our attributes */
                        if (RenderUplevel) {
+                               /* force an ID here if we weren't assigned one */
+                               if (ID == null)
+                                       writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
+
                                if (ControlToValidate != String.Empty)
                                        writer.AddAttribute ("controltovalidate", ControlToValidate);
 
@@ -398,7 +402,7 @@ namespace System.Web.UI.WebControls {
                                RegisterValidatorCommonScript ();
 
                                Page.ClientScript.RegisterOnSubmitStatement ("Mono-System.Web-ValidationOnSubmitStatement",
-                                                                            "if (!ValidatorCommonOnSubmit()) return false;");
+                                                                            "if (!ValidatorOnSubmit()) return false;");
                                Page.ClientScript.RegisterStartupScript ("Mono-System.Web-ValidationStartupScript",
                                                                         "<script language=\"JavaScript\">\n" + 
                                                                         "<!--\n" + 
@@ -449,7 +453,7 @@ namespace System.Web.UI.WebControls {
                protected virtual void RegisterValidatorDeclaration ()
                {
                        Page.ClientScript.RegisterArrayDeclaration ("Page_Validators",
-                                                                   String.Format ("document.getElementById ('{0}')", ID));
+                                                                   String.Format ("document.getElementById ('{0}')", ClientID));
                }
 
 #if NET_2_0
@@ -459,10 +463,6 @@ namespace System.Web.UI.WebControls {
 #endif         
                override void Render (HtmlTextWriter writer)
                {
-                       /* we have to be in a server form */
-                       /* XXX it appears MS doesn't do this */
-                       //Page.VerifyRenderingInServerForm (this);
-
                        if (RenderUplevel) {
                                /* according to an msdn article, this is done here */
                                RegisterValidatorDeclaration ();
index 4d2a7bfead3b183258bee4549ad788b5308e06c5..e32cddf716968dcd59a56c692850934b61b83088 100644 (file)
@@ -100,6 +100,9 @@ namespace System.Web.UI.WebControls {
 
                protected virtual string FormatDataValue (object dataValue)
                {
+                       if (dataValue == null)
+                               return "";
+
                        if (data_format_string == String.Empty)
                                return dataValue.ToString ();
 
@@ -111,19 +114,14 @@ namespace System.Web.UI.WebControls {
                        TableCell cell = (TableCell) sender;
                        DataGridItem item  = (DataGridItem) cell.NamingContainer;
                        object value = null;
-                       string text = null;
 
                        if (DataField != thisExpr) {
-                               try {
-                                       value = DataBinder.Eval (item.DataItem, DataField);
-                               } catch {
-                                       value = String.Empty;
-                               }
+                               value = DataBinder.Eval (item.DataItem, DataField);
                        } else {
                                value = item.DataItem;
                        }
 
-                       text = FormatDataValue (value);
+                       string text = FormatDataValue (value);
                        if (text == String.Empty)
                                text = "&nbsp;";
                        cell.Text = text;
index 3cad2bb80e5c58b95eb96efac55726508ac9fbfe..91d85c9ce6d867547fba9a44d08f4e3638ffebb2 100644 (file)
@@ -357,7 +357,7 @@ namespace System.Web.UI.WebControls {
                        get {
                                if (selectedDayStyle == null)
                                        selectedDayStyle = new TableItemStyle ();
-
+                               
                                if (IsTrackingViewState)
                                        selectedDayStyle.TrackViewState ();
 
@@ -1020,8 +1020,12 @@ namespace System.Web.UI.WebControls {
                                style.CopyFrom (otherMonthDayStyle);
                        }
 
-                       if (day.IsSelected && selectedDayStyle != null && !selectedDayStyle.IsEmpty) {
-                               style.CopyFrom (selectedDayStyle);
+                       if (day.IsSelected) {
+                               style.BackColor = Color.Silver;
+                               style.ForeColor = Color.White;
+                               if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) {
+                                       style.CopyFrom (selectedDayStyle);
+                               }
                        }
 
                        cell.ApplyStyle (style);
@@ -1037,14 +1041,18 @@ namespace System.Web.UI.WebControls {
                        DateTime date = new DateTime (DisplayDate.Year, DisplayDate.Month, 1); // first date
                        DateTime lastDate;
                        TableCell selectorCell = null;
+                       int n;
 
                        // Goes backwards until we find the date of that is begining of the week
-                       for (int n = 0; n < daysInAWeek; n++) {
+                       for (n = 0; n < daysInAWeek; n++) {
                                if (date.DayOfWeek == DisplayFirstDayOfWeek)
                                        break;
 
                                date = GetGlobalCalendar().AddDays (date, -1);
                        }
+                       /* if the start date is the first day of the week, we need to shift backward one more week */
+                       if (n == 0)
+                               date = GetGlobalCalendar().AddDays (date, -1 * daysInAWeek);
 
                        lastDate = GetGlobalCalendar().AddDays (date, 6 * daysInAWeek); // Always six weeks per months
 
@@ -1145,7 +1153,6 @@ namespace System.Web.UI.WebControls {
 
                        // Table
                        tableTitle.Width =  Unit.Percentage (100);
-                       tableTitle.ControlStyle.CopyFrom (ControlStyle);
                        if (titleStyle != null && !titleStyle.IsEmpty) {
                                tableTitle.ApplyStyle (titleStyle);
                        }
index cc00357594d3eca8c51f9e04408732f686a603ef..3908c864f266aeb17724ca4f76232b6daf53d878 100644 (file)
@@ -1,3 +1,179 @@
+2005-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TableStyle.cs: fixed typo that prevented restoring GridLines from
+       a saved viewstate.
+
+       * DataGrid.cs: the table does not get an auto ID. When restoring from
+       viewstate, use all the saved columns, not just that data bound ones. Set
+       the owner of the BoundColumns created. Save/restore columns.
+       OnItemCreated happens after the item is initialized and the data item is
+       set before the event and nullified after OnItemDataBound.
+       Add the render_table to the Controls immediately, otherwise we might get
+       errors from child controls such as "must be rendered inside a form".
+       Keep the items created in the list waiting for them.
+       The table uses the attributes from the DataGrid and ControlStyle.
+       Raise OnItemCommand on all bubble events and don't propagate bubble
+       event up in the hierarchy
+
+       * TableCell.cs: it does not get an automatic ID.
+       * BoundColumn.cs: FormatDataValue returns an empty string on null input
+       (there was already a test for this).
+
+       Fixes bug #76117.
+
+2005-09-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * DataGridColumnCollection.cs: track the view state in the newly added
+       items.
+
+2005-09-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * DataGrid.cs: merge column styles too. Fixes bug #76106.
+       * DataGridColumn.cs: new internal method to retrieve the styles without
+       creating an instance for them.
+
+2005-09-15  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * DataControlField.cs, HotSpot.cs, MenuItem.cs, Parameter.cs, 
+       Style.cs, TreeNode.cs: Replace _empty_ StateBag.SetDirty () with 
+       StateBag.SetDirty (true).
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * Menu.cs: Fixed parameter orders for CreateStyleRule.
+
+2005-09-13  Chris Toshok  <toshok@ximian.com>
+
+       * Style.cs: corcompare stuff.
+
+       * RequiredFieldValidator.cs: more corcompare stuff.
+
+       * CheckBoxList.cs: clean up some of the interface methods vs
+       protected virtual 2.0 calls.
+
+       * SubMenuStyle.cs: corcompare says this should implement
+       ICustomTypeDescriptor... sooo, make it.
+
+2005-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TableCell.cs: do the same as HyperLink and others in
+       AddParsedSubobject so that adding a literal control does not remove the
+       existing controls if any. Fixes bug #76078.
+
+2005-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * GridView.cs: don't duplicate class attribute. Fixes bug #75936.
+
+2005-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * ImageButton.cs: fix invalid cast exception.
+
+2005-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * ListItem.cs: throw in AddParsedSubObject if the object is not a
+       LiteralControl.
+       * RadioButtonList.cs: implemented LoadPostData and
+       RaisePostDataChangedEvent.
+
+2005-09-09  Chris Toshok  <toshok@ximian.com>
+
+       * CheckBox.cs, CheckBoxList.cs, DropDownList.cs, ImageButton.cs,
+       ListBox.cs, RadioButton.cs, RadioButtonList.cs, TextBox.cs: fix up
+       LoadPostData/RaisePostDataChangedEvent.
+
+2005-09-09  Chris Toshok  <toshok@ximian.com>
+
+       * FontInfo.cs (IsEmpty): new internal property, used by
+       Style.IsEmpty.
+
+       * Style.cs (IsEmpty): make sure the fontinfo is null or empty as
+       well.
+
+2005-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * ListItemCollection.cs: remove obsoleted methods.
+       * ListBox.cs: use IStateManager on the item collection.
+
+2005-09-08  Eyal Alaluf  <eyala@mainsoft.com>
+
+       * Use C# 1.0 style of delegate instantiating. Needed to compile
+       Grasshopper (TARGET_J2EE) which uses MS C# 1.0 compiler and not msc.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * Calendar.cs (WriteDay): always add BackColor=Silver,
+       ForeColor=White to selected day cells, before copying over the
+       selectedDayStyle, if it exists.
+       (WriteDays): fix nunit test - if the first day of the month falls
+       on the first day of the week, go back one week (effectively adding
+       a row of dates from the previous month.)
+       (WriteTitle): don't copy the control style to the tableTitle,
+       since it might have height specifications, which would make the
+       title look rather off.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * ValidationSummary.cs (AddAttributesToRender): we only set
+       display=none if there are no errors.
+
+       * BaseValidator.cs (OnPreRender): fix a JS error - on submit we
+       call ValidatorOnSubmit, not ValidatorCommonOnSubmit.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * ListControl.cs (SelectedIndex): add comment about how you'd
+       think OnSelectedIndexChanged would be called.. and you'd be wrong.
+       (Text): implement in terms of SelectedValue.
+       (TagKey): do the HAVE_CONTROL_ADAPTERS two-step.
+       (LoadControlState): implement - this is where the selected index
+       ArrayList gets stuffed in 2.0.
+       (OnInit): call Page.RegisterRequiresControlState.
+       (OnTextChanged): implement.
+       (RenderContents): for now just chain up to base.RenderContents.
+       (SaveControlState): save our control state properly.
+       (GetSelectedIndices): split this out from SaveViewState to it can
+       be used by both that and SaveControlState.
+       (SaveViewState): mangle this function so it works in both 2.0 and
+       1.0.
+       (LoadViewState): same.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * BaseValidator.cs (AddAttributesToRender): render our ClientID if
+       we weren't assigned an ID.
+
+       * ValidationSummary.cs (AddAttributesToRender): same.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * WebControl.cs: revert the last change.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * WebControl.cs (AddAttributesToRender): always render ClientID.
+
+       * ValidationSummary.cs (Render): same.
+
+       * BaseValidator.cs (RegisterValidatorDeclaration): use ClientID
+       here.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * ValidationSummary.cs (Render): only do the JS stuff when the
+       validators on the page are uplevel.
+
+       * BaseValidator.cs (Render): remove unnecessary comment.
+
+2005-09-05  Chris Toshok  <toshok@ximian.com>
+
+       * BaseDataBoundControl.cs (DataSourceID): testing reveals this is
+       stored in the ViewState.
+
+2005-09-02  Chris Toshok  <toshok@ximian.com>
+
+       * Repeater.cs (GetData): change this slightly so the Repeater
+       doesn't keep a ref to the return value of GetData.
+
 2005-09-01  Chris Toshok  <toshok@ximian.com>
 
        * ListControl.cs (AppendDataBoundItems): implement (2.0)
index c50805ac0a6a49321184a5860a4049596bdceff6..c85b3eeb9ed0cf555e8e860e8695673ce05ca2c7 100644 (file)
@@ -431,30 +431,27 @@ namespace System.Web.UI.WebControls {
                        return (false);
                }
 
-               bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
-               {
-                       return LoadPostData (postDataKey, postCollection);
-               }
-               
 #if NET_2_0
-               protected virtual void RaisePostDataChangedEvent ()
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
                {
+#if NET_2_0
                        if (CausesValidation)
                                Page.Validate (ValidationGroup);
-               
+#endif
                        OnCheckedChanged (EventArgs.Empty);
                }
-               
-               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+
+               bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       RaisePostDataChangedEvent ();
+                       return LoadPostData (postDataKey, postCollection);
                }
-#else
+               
                void IPostBackDataHandler.RaisePostDataChangedEvent ()
                {
-                       OnCheckedChanged (EventArgs.Empty);
+                       RaisePostDataChangedEvent ();
                }
-#endif
 
                internal virtual void InternalAddAttributesToRender (HtmlTextWriter w)
                {
index 207d1bc5e177f7f989b819bc815caf91700acafb..9b43e65aa42b71c537abbc85cdee95776d05feb7 100644 (file)
@@ -138,40 +138,6 @@ namespace System.Web.UI.WebControls {
                        }
                }
 
-#if NET_2_0
-               [MonoTODO]
-               protected virtual bool HasFooter 
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual bool HasHeader
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual bool HasSeparators
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual int RepeatedItemCount
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-#endif         
-
                private TableStyle TableStyle {
                        get { return (TableStyle) ControlStyle; }
                }
@@ -187,15 +153,6 @@ namespace System.Web.UI.WebControls {
                        return this;
                }
 
-#if NET_2_0
-               [MonoTODO]
-               protected virtual Style GetItemStyle (ListItemType itemType,
-                                                     int repeatIndex)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
-               
 #if NET_2_0
                protected internal
 #else          
@@ -245,30 +202,9 @@ namespace System.Web.UI.WebControls {
                }
 
 #if NET_2_0
-               [MonoTODO]
-               protected virtual void RenderItem (ListItemType itemType,
-                                                  int repeatIndex,
-                                                  RepeatInfo repeatInfo,
-                                                  HtmlTextWriter w)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected virtual void RaisePostDataChangedEvent ()
-               {
-                       throw new NotImplementedException ();
-               }
-#endif         
-
-               bool IPostBackDataHandler.LoadPostData (string postDataKey,
-                               NameValueCollection postCollection)
+               protected virtual
+#endif
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
                        int checkbox = -1;
 
@@ -295,36 +231,104 @@ namespace System.Web.UI.WebControls {
                        return false;
                }
 
-               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
                {
                        OnSelectedIndexChanged (EventArgs.Empty);
                }
 
+               bool IPostBackDataHandler.LoadPostData (string postDataKey,
+                                                       NameValueCollection postCollection)
+               {
+                       return LoadPostData (postDataKey, postCollection);
+               }
+
+               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+               {
+                       RaisePostDataChangedEvent ();
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasFooter 
+               {
+                       get {
+                               return false;
+                       }
+               }
+
                bool IRepeatInfoUser.HasFooter {
-                       get { return false; }
+                       get { return HasFooter; }
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasHeader
+               {
+                       get {
+                               return false;
+                       }
                }
 
                bool IRepeatInfoUser.HasHeader {
-                       get { return false; }
+                       get { return HasHeader; }
+               }
+
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasSeparators
+               {
+                       get {
+                               return false;
+                       }
                }
 
                bool IRepeatInfoUser.HasSeparators {
-                       get { return false; }
+                       get { return HasSeparators; }
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               int RepeatedItemCount
+               {
+                       get {
+                               return Items.Count;
+                       }
                }
 
                int IRepeatInfoUser.RepeatedItemCount {
-                       get { return Items.Count; }
+                       get { return RepeatedItemCount; }
                }
 
-               Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,
-                               int repeatIndex)
+#if NET_2_0
+               protected virtual
+#endif
+               Style GetItemStyle (ListItemType itemType,
+                                   int repeatIndex)
                {
                        return null;
                }
 
-               void IRepeatInfoUser.RenderItem (ListItemType itemType,
-                               int repeatIndex, RepeatInfo repeatInfo,
-                               HtmlTextWriter writer)
+               Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,
+                                                   int repeatIndex)
+               {
+                       return GetItemStyle (itemType, repeatIndex);
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               void RenderItem (ListItemType itemType,
+                                int repeatIndex,
+                                RepeatInfo repeatInfo,
+                                HtmlTextWriter writer)
                {
                        ListItem item = Items [repeatIndex];
 
@@ -334,5 +338,12 @@ namespace System.Web.UI.WebControls {
                        check_box.Checked = item.Selected;
                        check_box.RenderControl (writer);
                }
+
+               void IRepeatInfoUser.RenderItem (ListItemType itemType,
+                                                int repeatIndex, RepeatInfo repeatInfo,
+                                                HtmlTextWriter writer)
+               {
+                       RenderItem (itemType, repeatIndex, repeatInfo, writer);
+               }
        }
 }
index 4ea6ea1a92515e7e9e0f9eb64e6d7156437c4ab3..1de3cc852f83264cad88576e087288b8fc8711d4 100644 (file)
@@ -60,7 +60,7 @@ namespace System.Web.UI.WebControls {
                
                internal void SetDirty ()
                {
-                       viewState.SetDirty ();
+                       viewState.SetDirty (true);
                }
                
                protected StateBag ViewState {
index 36ef1026955c22c618bd1b44bc5b3d678cfa94b6..a5e4afbbb04a98bac440c77e104a7cf1cd484509 100644 (file)
@@ -351,11 +351,7 @@ namespace System.Web.UI.WebControls {
                        get {
                                if (render_table == null) {
                                        render_table = new Table ();
-                                       if (ControlStyleCreated)
-                                               render_table.ControlStyle.MergeWith (TableStyle);
-                                       else
-                                               render_table.ControlStyle.MergeWith (CreateControlStyle ());
-//                                     Controls.Add (render_table);
+                                       render_table.PreventAutoID ();
                                }
                                return render_table;
                        }
@@ -366,7 +362,7 @@ namespace System.Web.UI.WebControls {
                        if (useDataSource) {
                                ArrayList columns_list = CreateColumnSet (paged, useDataSource);
                                render_columns = new DataGridColumn [columns_list.Count];
-                               
+
                                for (int c = 0; c < render_columns.Length; c++) {
                                        DataGridColumn col = (DataGridColumn) columns_list [c];
                                        col.Set_Owner (this);
@@ -374,8 +370,8 @@ namespace System.Web.UI.WebControls {
                                        render_columns [c] = col;
                                }
                        } else {
-                               render_columns = new DataGridColumn [DataSourceColumns.Count];
-                               DataSourceColumns.CopyTo (render_columns, 0);
+                               render_columns = new DataGridColumn [Columns.Count];
+                               Columns.CopyTo (render_columns, 0);
                        }
                }
 
@@ -427,11 +423,9 @@ namespace System.Web.UI.WebControls {
                        get { return (TableStyle) ControlStyle; }
                }
                
-               protected virtual ArrayList CreateColumnSet (PagedDataSource dataSource,
-                               bool useDataSource)
+               protected virtual ArrayList CreateColumnSet (PagedDataSource dataSource, bool useDataSource)
                {
                        ArrayList res = new ArrayList ();
-
                        if (columns_list != null)
                                res.AddRange (columns_list);
 
@@ -440,7 +434,6 @@ namespace System.Web.UI.WebControls {
                                        PropertyDescriptorCollection props = dataSource.GetItemProperties (null);
                                        DataSourceColumns.Clear ();
                                        if (props != null) {
-
                                                foreach (PropertyDescriptor d in props)
                                                        AddPropertyToColumns (d, false);
                                        } else {
@@ -455,22 +448,42 @@ namespace System.Web.UI.WebControls {
 
                                                props = TypeDescriptor.GetProperties (dataSource.DataSource);
                                                PropertyDescriptor item = props.Find ("Item", false);
-
-                                               if (item != null)
-                                                       AddPropertyToColumns (item, true);
+                                               IEnumerator items = dataSource.GetEnumerator ();
+                                               // Don't add if there are no elements
+                                               if (items.MoveNext ()) {
+                                                       if (item != null)
+                                                               AddPropertyToColumns (item, true);
+                                                       else
+                                                               AddPropertyToColumns ();
+                                               }
                                        }
                                }
 
-                               if (data_source_columns != null)
+                               if (data_source_columns != null && data_source_columns.Count > 0)
                                        res.AddRange (data_source_columns);
                        }
 
                        return res;
                }
 
+               private void AddPropertyToColumns ()
+               {
+                       BoundColumn b = new BoundColumn ();
+                       if (IsTrackingViewState) {
+                               IStateManager m = (IStateManager) b;
+                               m.TrackViewState ();
+                       }
+                       b.Set_Owner (this);
+                       b.HeaderText = "Item";
+                       b.SortExpression = "Item";
+                       b.DataField  = BoundColumn.thisExpr;
+                       DataSourceColumns.Add (b);
+               }
+
                private void AddPropertyToColumns (PropertyDescriptor prop, bool tothis)
                {
                        BoundColumn b = new BoundColumn ();
+                       b.Set_Owner (this);
                        if (IsTrackingViewState) {
                                IStateManager m = (IStateManager) b;
                                m.TrackViewState ();
@@ -500,7 +513,7 @@ namespace System.Web.UI.WebControls {
                        if (edit_item_style != null)
                                edit_item_style.TrackViewState ();
 
-                       IStateManager manager = (IStateManager) data_source_columns;
+                       IStateManager manager = (IStateManager) columns;
                        if (manager != null)
                                manager.TrackViewState ();
                }
@@ -510,7 +523,10 @@ namespace System.Web.UI.WebControls {
                        object [] res = new object [10];
 
                        res [0] = base.SaveViewState ();
-
+                       if (columns != null) {
+                               IStateManager cm = (IStateManager) columns;
+                               res [1] = cm.SaveViewState ();
+                       }
                        if (pager_style != null)
                                res [2] = pager_style.SaveViewState ();
                        if (header_style != null)
@@ -542,7 +558,10 @@ namespace System.Web.UI.WebControls {
                                return;
 
                        base.LoadViewState (pieces [0]);
-
+                       if (columns != null) {
+                               IStateManager cm = (IStateManager) columns;
+                               cm.LoadViewState (pieces [1]);
+                       }
                        if (pieces [2] != null)
                                PagerStyle.LoadViewState (pieces [2]);
                        if (pieces [3] != null)
@@ -564,6 +583,7 @@ namespace System.Web.UI.WebControls {
                                object [] cols = (object []) pieces [9];
                                foreach (object o in cols) {
                                        BoundColumn c = new BoundColumn ();
+                                       c.Set_Owner (this);
                                        ((IStateManager) c).LoadViewState (o);
                                        DataSourceColumns.Add (c);
                                }
@@ -714,27 +734,29 @@ namespace System.Web.UI.WebControls {
                {
                        DataGridItem res = CreateItem (item_index, data_source_index, type);
                        DataGridItemEventArgs args = new DataGridItemEventArgs (res);
+                       bool no_pager = (type != ListItemType.Pager);
 
-                       if (type != ListItemType.Pager) {
-                               OnItemCreated (args);
+                       if (no_pager) {
                                InitializeItem (res, render_columns);
+                               if (data_bind)
+                                       res.DataItem = data_item;
+                               OnItemCreated (args);
                        } else {
                                InitializePager (res, render_columns.Length, paged);
                                if (pager_style != null)
                                        res.ApplyStyle (pager_style);
+                               OnItemCreated (args);
                        }
 
                        // Add before the column is bound, so that the
                        // value is saved in the viewstate
                        RenderTable.Controls.Add (res);
 
-                       if (data_bind) {
-                               res.DataItem = data_item;
-                               if (data_item != null)
-                                       res.DataBind ();
+                       if (no_pager && data_bind) {
+                               res.DataBind ();
                                OnItemDataBound (args);
+                               res.DataItem = null;
                        }
-
                        return res;
                }
 
@@ -743,35 +765,39 @@ namespace System.Web.UI.WebControls {
                        DataGridItem item;
 
                        RenderTable.Controls.Clear ();
+                       Controls.Add (RenderTable);
 
                        IEnumerable data_source;
                        if (useDataSource) {
-                               data_source = DataSourceResolver.ResolveDataSource (DataSource,
-                                               DataMember);
+                               data_source = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
                        } else {
                                // This is a massive waste
                                data_source = new object [ViewState.GetInt ("Items", 0)];
                        }
 
                        paged_data_source = new PagedDataSource ();
-                       paged_data_source.AllowPaging = AllowPaging;
-                       paged_data_source.AllowCustomPaging = AllowCustomPaging;
-                       paged_data_source.DataSource = data_source;
-                       paged_data_source.CurrentPageIndex = CurrentPageIndex;
-                       paged_data_source.PageSize = PageSize;
-                       paged_data_source.VirtualCount = VirtualItemCount;
+                       PagedDataSource pds = paged_data_source;
+                       pds.AllowPaging = AllowPaging;
+                       pds.AllowCustomPaging = AllowCustomPaging;
+                       pds.DataSource = data_source;
+                       pds.CurrentPageIndex = CurrentPageIndex;
+                       pds.PageSize = PageSize;
+                       pds.VirtualCount = VirtualItemCount;
 
                        CreateRenderColumns (paged_data_source, useDataSource);
 
-                       item = CreateItem (-1, -1, ListItemType.Pager, false, null,
-                                       paged_data_source);
-                       item = CreateItem (-1, -1, ListItemType.Header, useDataSource, null,
-                                       paged_data_source);
+                       if (pds.IsPagingEnabled)
+                               CreateItem (-1, -1, ListItemType.Pager, false, null, pds);
+
+                       CreateItem (-1, -1, ListItemType.Header, useDataSource, null, pds);
 
                        // No indexer on PagedDataSource so we have to do
                        // this silly foreach and index++
                        int index = 0;
-                       foreach (object ds in paged_data_source) {
+                       if (items_list == null)
+                               items_list = new ArrayList ();
+
+                       foreach (object ds in pds) {
                                ListItemType type = ListItemType.Item;
 
                                if (this.EditItemIndex == index) 
@@ -779,52 +805,95 @@ namespace System.Web.UI.WebControls {
                                else if (index % 2 != 0) 
                                        type = ListItemType.AlternatingItem;
 
-                               item = CreateItem (index, index, type, useDataSource, ds, paged_data_source);
+                               items_list.Add (CreateItem (index, index, type, useDataSource, ds, pds));
                                index++;
                        }
 
-                       item = CreateItem (-1, -1, ListItemType.Footer, useDataSource, null, paged_data_source);
-                       item = CreateItem (-1, -1, ListItemType.Pager, false, null, paged_data_source);
-
-                       Controls.Add (RenderTable);
-                       ViewState ["Items"] = paged_data_source.DataSourceCount;
+                       CreateItem (-1, -1, ListItemType.Footer, useDataSource, null, paged_data_source);
+                       if (pds.IsPagingEnabled)
+                               CreateItem (-1, -1, ListItemType.Pager, false, null, paged_data_source);
 
+                       if (useDataSource)
+                               ViewState ["Items"] = index;
                        pager_cell = null;
                }
 
+               void ApplyColumnStyle (TableCellCollection cells, ListItemType type)
+               {
+                       int ncells = Math.Min (cells.Count, render_columns.Length);
+                       if (ncells <= 0)
+                               return;
+
+                       for (int i = 0; i < ncells; i++) {
+                               Style style = null;
+                               TableCell cell = cells [i];
+                               DataGridColumn column = render_columns [i];
+                               if (!column.Visible) {
+                                       cell.Visible = false;
+                                       continue;
+                               }
+
+                               style = column.GetStyle (type);
+                               if (style != null)
+                                       cell.MergeStyle (style);
+                       }
+               }
+
                protected override void PrepareControlHierarchy ()
                {
                        if (render_table == null)
                                return;
 
+                       render_table.CopyBaseAttributes (this);
+                       render_table.ApplyStyle (ControlStyle);
+
                        bool top_pager = true;
+                       Style alt = null;
+                       if (alt_item_style != null) {
+                               alt = new Style ();
+                               alt.CopyFrom (item_style);
+                               alt.CopyFrom (alt_item_style);
+                       } else {
+                               alt = item_style;
+                       }
+
                        foreach (DataGridItem item in render_table.Rows) {
                                
                                switch (item.ItemType) {
                                case ListItemType.Item:
-                                       item.ApplyStyle (ItemStyle);
+                                       item.MergeStyle (item_style);
+                                       ApplyColumnStyle (item.Cells, ListItemType.Item);
                                        break;
                                case ListItemType.AlternatingItem:
-                                       item.ApplyStyle (AlternatingItemStyle);
+                                       item.MergeStyle (alt);
+                                       ApplyColumnStyle (item.Cells, ListItemType.AlternatingItem);
                                        break;
                                case ListItemType.EditItem:
-                                       item.ApplyStyle (EditItemStyle);
+                                       item.MergeStyle (edit_item_style);
+                                       ApplyColumnStyle (item.Cells, ListItemType.EditItem);
                                        break;
                                case ListItemType.Footer:
                                        if (!ShowFooter)
                                                item.Visible = false;
-                                       item.ApplyStyle (FooterStyle);
+                                       if (footer_style != null)
+                                               item.MergeStyle (footer_style);
+                                       ApplyColumnStyle (item.Cells, ListItemType.Footer);
                                        break;
                                case ListItemType.Header:
                                        if (!ShowHeader)
                                                item.Visible = false;
-                                       item.ApplyStyle (HeaderStyle);
+                                       if (header_style != null)
+                                               item.MergeStyle (header_style);
+                                       ApplyColumnStyle (item.Cells, ListItemType.Header);
                                        break;
                                case ListItemType.SelectedItem:
-                                       item.ApplyStyle (SelectedItemStyle);
+                                       if (selected_style != null)
+                                               item.MergeStyle (selected_style);
+                                       else
+                                               item.MergeStyle (item_style);
+                                       ApplyColumnStyle (item.Cells, ListItemType.SelectedItem);
                                        break;
                                case ListItemType.Pager:
-
                                        if (!paged_data_source.IsPagingEnabled) {
                                                item.Visible = false;
                                        } else {
@@ -853,25 +922,18 @@ namespace System.Web.UI.WebControls {
                        string cn = de.CommandName;
                        CultureInfo inv = CultureInfo.InvariantCulture;
 
+                       OnItemCommand (de);
                        if (String.Compare (cn, CancelCommandName, true, inv) == 0) {
                                OnCancelCommand (de);
-                               return true;
                        } else if (String.Compare (cn, DeleteCommandName, true, inv) == 0) {
                                OnDeleteCommand (de);
-                               return true;
                        } else if (String.Compare (cn, EditCommandName, true, inv) == 0) {
                                OnEditCommand (de);
-                               return true;
-                       } else if (String.Compare (cn, "Item", true, inv) == 0) {
-                               OnItemCommand (de);
-                               return true;
                        } else if (String.Compare (cn, SelectCommandName, true, inv) == 0) {
                                OnSelectedIndexChanged (de);
-                               return true;
                        } else if (String.Compare (cn, SortCommandName, true, inv) == 0) {
                                DataGridSortCommandEventArgs se = new DataGridSortCommandEventArgs (de.CommandSource, de);
                                OnSortCommand (se);
-                               return true;
                        } else if (String.Compare (cn, UpdateCommandName, true, inv) == 0) {
                                OnUpdateCommand (de);
                        } else if (String.Compare (cn, PageCommandName, true, inv) == 0) {
@@ -892,10 +954,9 @@ namespace System.Web.UI.WebControls {
                                DataGridPageChangedEventArgs pc = new DataGridPageChangedEventArgs (
                                        de.CommandSource, new_index);
                                OnPageIndexChanged (pc);
-                               return true;
                        }
 
-                       return false;
+                       return true;
                }
 
                protected virtual void OnCancelCommand (DataGridCommandEventArgs e)
@@ -1024,16 +1085,6 @@ namespace System.Web.UI.WebControls {
                        add { Events.AddHandler (UpdateCommandEvent, value); }
                        remove { Events.AddHandler (UpdateCommandEvent, value); }
                }
-
-               [Obsolete]
-               internal void OnColumnsChanged ()
-               {
-               }
-
-               [Obsolete]
-               internal void OnPagerChanged ()
-               {
-               }
        }
 }
 
index 7ba0403207d479d33b1184cc4a3dc1694092da3d..49a4d26f35222ceb0a77f044ee099f44f96fd7f1 100644 (file)
@@ -292,6 +292,18 @@ namespace System.Web.UI.WebControls {
                        }
                }
 
+
+               internal TableItemStyle GetStyle (ListItemType type)
+               {
+                       if (type == ListItemType.Header)
+                               return header_style;
+
+                       if (type == ListItemType.Footer)
+                               return footer_style;
+
+                       return item_style;
+               }
+
                internal void Set_Owner (DataGrid value) 
                {
                        owner = value;
index 9c68d1c6dcd18beaadc2e9a6e7d24d900794998e..c223aef2e95b4fde06f0819e0bf1a890b931d266 100644 (file)
@@ -42,12 +42,16 @@ namespace System.Web.UI.WebControls {
                {
                        columns.Add (column);
                        column.Set_Owner (owner);
+                       if (track)
+                               ((IStateManager) column).TrackViewState ();
                }
        
                public void AddAt (int index, DataGridColumn column)
                {
                        columns.Insert (index, column);
                        column.Set_Owner (owner);
+                       if (track)
+                               ((IStateManager) column).TrackViewState ();
                }
        
                public void Clear ()
index 4f80534411e28e821271a98e7d8a7462009a5b1c..3536988a55d9c2a3345151caeb222bfebb63931f 100644 (file)
@@ -180,20 +180,10 @@ namespace System.Web.UI.WebControls {
 
                #region Interface Methods
 #if NET_2_0
-               [MonoTODO]
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+               protected virtual
+#endif
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected virtual void RaisePostDataChangedEvent ()
-               {
-                       throw new NotImplementedException ();
-               }
-#endif         
-               
-               bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection) {
                        int     index;
 
                        index = Items.IndexOf(postCollection[postDataKey]);
@@ -205,9 +195,23 @@ namespace System.Web.UI.WebControls {
                        return false;
                }
 
-               void IPostBackDataHandler.RaisePostDataChangedEvent() {
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
+               {
                        OnSelectedIndexChanged(EventArgs.Empty);
                }
+               
+               bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+               {
+                       return LoadPostData (postDataKey, postCollection);
+               }
+
+               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+               {
+                       RaisePostDataChangedEvent ();
+               }
                #endregion      // Interface Methods
        }
 }
index 476351f9da8b585db9c81e05e1237698d88bc11f..4e53260905af6318820dbdca666599f398b8cd0d 100644 (file)
@@ -431,5 +431,12 @@ namespace System.Web.UI.WebControls
                        }
                }
                #endregion      // Private Methods
+
+
+               internal bool IsEmpty {
+                       get {
+                               return fontstyles == FontStyles.None;
+                       }
+               }
        }
 }
index dc92f83c7c285b813951392eebfd9da1f4995885..967fc84fb83508b67d2d4a9a75502869d17bb9d4 100644 (file)
@@ -1832,10 +1832,11 @@ namespace System.Web.UI.WebControls
                                                if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
                                                break;
                                        default:
-                                               if (rowStyle != null) rowStyle.AddAttributesToRender (writer, row);
                                                break;
                                }
 
+                               if ((row.RowState & DataControlRowState.Normal) != 0 && rowStyle != null)
+                                       rowStyle.AddAttributesToRender (writer, row);
                                if ((row.RowState & DataControlRowState.Alternate) != 0 && alternatingRowStyle != null)
                                        alternatingRowStyle.AddAttributesToRender (writer, row);
                                if ((row.RowState & DataControlRowState.Edit) != 0 && editRowStyle != null)
index 13af2c39619ccc2d93097bb548240d4b8abf8e90..6c587c268518b737072f1f1f73fbc12a087ea086 100644 (file)
@@ -189,7 +189,7 @@ namespace System.Web.UI.WebControls
                
                internal void SetDirty ()
                {
-                       viewState.SetDirty ();
+                       viewState.SetDirty (true);
                }
        
                public abstract string GetCoordinates ();
index e455c9327cd526b99fd3066c1d89d0c109ed9c40..6f6a1f20384411916fdbeb2c21712d8e76ea0df3 100644 (file)
@@ -164,7 +164,7 @@ namespace System.Web.UI.WebControls
                        case ListItemType.Item:
                        case ListItemType.EditItem:
                        case ListItemType.AlternatingItem:
-                               cell.DataBinding += ItemDataBinding;
+                               cell.DataBinding += new EventHandler(ItemDataBinding);
                                cell.Controls.Add (new HyperLink ());
                                break;
                        }
index 1c1d7154578566a88791100d0f0e45f73200da84..0a473f044939d737e48f3f8fe423ee3fd13a5763 100644 (file)
@@ -236,26 +236,9 @@ namespace System.Web.UI.WebControls {
 
 
 #if NET_2_0
-               [MonoTODO]
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection psotCollection) 
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected virtual void RaisePostDataChangedEvent ()
-               {
-                       throw new NotImplementedException ();
-               }
-               
-               [MonoTODO]
-               protected virtual void RaisePostBackEvent (string eventArgument)
-               {
-                       throw new NotImplementedException ();
-               }
+               protected virtual
 #endif
-
-               bool IPostBackDataHandler.LoadPostData (string postDataKey,  NameValueCollection postCollection)
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection) 
                {
                        string x, y;
 
@@ -270,14 +253,10 @@ namespace System.Web.UI.WebControls {
 
                        return true;
                }
-
-
-               void IPostBackDataHandler.RaisePostDataChangedEvent ()
-               {
-
-               }
-
-               void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
                {
                        if (CausesValidation)
 #if NET_2_0
@@ -289,11 +268,35 @@ namespace System.Web.UI.WebControls {
                        OnClick (new ImageClickEventArgs (pos_x, pos_y));
                        OnCommand (new CommandEventArgs (CommandName, CommandArgument));
                }
+               
+               [MonoTODO]
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostBackEvent (string eventArgument)
+               {
+               }
+
+               bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+               {
+                       return LoadPostData (postDataKey, postCollection);
+               }
+
+
+               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+               {
+                       RaisePostDataChangedEvent ();
+               }
+
+               void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+               {
+                       RaisePostBackEvent (eventArgument);
+               }
 
                protected virtual void OnClick (ImageClickEventArgs e)
                {
                        if (Events != null) {
-                               EventHandler eh = (EventHandler) (Events [ClickEvent]);
+                               ImageClickEventHandler eh = (ImageClickEventHandler) (Events [ClickEvent]);
                                if (eh != null)
                                        eh (this, e);
                        }
index 680f618226b327fc022e31fdd198c557d7f7d94f..7910628267652543ad476d03b5f55acd96f50147 100644 (file)
@@ -184,21 +184,9 @@ namespace System.Web.UI.WebControls {
                }
 
 #if NET_2_0
-               [MonoTODO]
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected virtual void RaisePostDataChangedEvent ()
-               {
-                       throw new NotImplementedException ();
-               }
-#endif         
-                       
-               bool IPostBackDataHandler.LoadPostData (string postDataKey,
-                               NameValueCollection postCollection)
+               protected virtual
+#endif
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
                        string [] items = postCollection.GetValues (postDataKey) as string [];
                        bool res = false;
@@ -215,14 +203,28 @@ namespace System.Web.UI.WebControls {
                        }
 
                        // So we can tell when they have been changed
-                       Items.TrackViewState ();
+                       ((IStateManager) Items).TrackViewState ();
                        return res;
                }
 
-               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
                {
                        OnSelectedIndexChanged (EventArgs.Empty);
                }
+                       
+               bool IPostBackDataHandler.LoadPostData (string postDataKey,
+                                                       NameValueCollection postCollection)
+               {
+                       return LoadPostData (postDataKey, postCollection);
+               }
+
+               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+               {
+                       RaisePostDataChangedEvent ();
+               }
        }
 }
 
index b849f4fae76a2424775bee156fd2f844d94d9ed5..a912cab379c76b10d466f4517ea1cd288f85c6be 100644 (file)
@@ -193,6 +193,9 @@ namespace System.Web.UI.WebControls {
                                if (value < 0 || value >= Items.Count)
                                        throw new ArgumentOutOfRangeException ("value");
                                items [value].Selected = true;
+
+                               /* you'd think this would be called, but noooo */
+                               //OnSelectedIndexChanged (EventArgs.Empty);
                        }
                }
 
@@ -245,17 +248,23 @@ namespace System.Web.UI.WebControls {
                [MonoTODO]
                [WebSysDescription ("")]
                [WebCategoryAttribute ("Behavior")]
-               public virtual string Text 
-               {
+               public virtual string Text {
                        get {
-                               throw new NotImplementedException ();
+                               return SelectedValue;
                        }
                        set {
-                               throw new NotImplementedException ();
+                               SelectedValue = value;
+                               /* you'd think this would be called, but noooo */
+                               //OnTextChanged (EventArgs.Empty);
                        }
                }
 
-               protected virtual new HtmlTextWriterTag TagKey
+#if HAVE_CONTROL_ADAPTERS
+               protected virtual new
+#else          
+               protected override
+#endif
+               HtmlTextWriterTag TagKey
                {
                        get {
                                return HtmlTextWriterTag.Select;
@@ -280,10 +289,23 @@ namespace System.Web.UI.WebControls {
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected internal override void LoadControlState (object savedState)
                {
-                       throw new NotImplementedException ();
+                       object first = null;
+                       ArrayList indices = null;
+                       Pair pair = savedState as Pair;
+
+                       if (pair != null) {
+                               first = pair.First;
+                               indices = pair.Second as ArrayList;
+                       }
+
+                       base.LoadControlState (first);
+
+                       if (indices != null) {
+                               foreach (int index in indices)
+                                       Items [index].Selected = true;
+                       }
                }
 #endif         
 
@@ -330,10 +352,10 @@ namespace System.Web.UI.WebControls {
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected internal override void OnInit (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       Page.RegisterRequiresControlState (this);
+                       base.OnInit (e);
                }
 #endif         
 
@@ -348,10 +370,11 @@ namespace System.Web.UI.WebControls {
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected virtual void OnTextChanged (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       EventHandler handler = (EventHandler) Events [TextChangedEvent];
+                       if (handler != null)
+                               handler (this, e);
                }
 
                [MonoTODO]
@@ -369,21 +392,41 @@ namespace System.Web.UI.WebControls {
                [MonoTODO]
                protected internal override void RenderContents (HtmlTextWriter w)
                {
-                       throw new NotImplementedException ();
+                       base.RenderContents (w);
                }
 
-               [MonoTODO]
                protected internal override object SaveControlState ()
                {
-                       throw new NotImplementedException ();
+                       object first;
+                       ArrayList second;
+
+                       first = base.SaveControlState ();
+                       second = GetSelectedIndices();
+                       if (second == null)
+                               second = new ArrayList();
+
+                       return new Pair (first, second);
                }
 #endif         
 
+               ArrayList GetSelectedIndices ()
+               {
+                       ArrayList selected = null;
+                       if (items != null) {
+                               selected = new ArrayList ();
+                               int count = Items.Count;
+                               for (int i = 0; i < count; i++) {
+                                       if (items [i].Selected)
+                                               selected.Add (i);
+                               }
+                       }
+                       return selected;
+               }
+
                protected override object SaveViewState ()
                {
                        object first = null;
                        object second = null;
-                       ArrayList selected = null;
 
                        first = base.SaveViewState ();
 
@@ -391,33 +434,46 @@ namespace System.Web.UI.WebControls {
                        if (manager != null)
                                second = manager.SaveViewState ();
 
-                       if (items != null) {
-                               selected = new ArrayList ();
-                               int count = Items.Count;
-                               for (int i = 0; i < count; i++) {
-                                       if (items [i].Selected)
-                                               selected.Add (i);
-                               }
-                       }
+#if !NET_2_0
+                       ArrayList selected = GetSelectedIndices ();
+#endif
 
-                       if (first == null && second == null && selected == null)
+                       if (first == null && second == null
+#if !NET_2_0
+                           && selected == null
+#endif
+                           )
                                return null;
 
+#if NET_2_0
+                       return new Pair (first, second);
+#else
                        return new Triplet (first, second, selected);
+#endif
                }
 
                protected override void LoadViewState (object savedState)
                {
                        object first = null;
                        object second = null;
+#if !NET_2_0
                        ArrayList indices = null;
+#endif
 
+#if NET_2_0
+                       Pair pair = savedState as Pair;
+                       if (pair != null) {
+                               first = pair.First;
+                               second = pair.Second;
+                       }
+#else
                        Triplet triplet = savedState as Triplet;
                        if (triplet != null) {
                                first = triplet.First;
                                second = triplet.Second;
                                indices = triplet.Third as ArrayList;
                        }
+#endif
 
                        base.LoadViewState (first);
 
@@ -426,10 +482,12 @@ namespace System.Web.UI.WebControls {
                                manager.LoadViewState (second);
                        }
 
+#if !NET_2_0
                        if (indices != null) {
                                foreach (int index in indices)
                                        Items [index].Selected = true;
                        }
+#endif
                }
 
 #if NET_2_0
index b76a35486ca198ce0d611c79f7d74eb9a1766b93..0c5b93fd52cbbb13a8afb0b145f7e2e7f95c2381 100644 (file)
@@ -84,8 +84,11 @@ namespace System.Web.UI.WebControls {
                void IParserAccessor.AddParsedSubObject (object obj)
                {
                        LiteralControl lc = obj as LiteralControl;
-                       if (lc != null)
-                               Text = lc.Text;
+                       if (lc == null) {
+                               // obj.GetType() will throw a NullRef if obj is null. That's fine according to the test.
+                               throw new HttpException ("'ListItem' cannot have children of type " + obj.GetType ());
+                       }
+                       Text = lc.Text;
                }
        
                void IStateManager.LoadViewState (object state)
@@ -184,7 +187,7 @@ namespace System.Web.UI.WebControls {
                
                        set {
                                text = value;
-                               text_dirty |= tracking;
+                               text_dirty = tracking;
                        }
                }
 
@@ -201,7 +204,7 @@ namespace System.Web.UI.WebControls {
                
                        set {
                                this.value = value;
-                               value_dirty |= tracking;
+                               value_dirty = tracking;
                        }
                }
 
index 51fe63001ba951b214465b149b4487ae31b9e49a..8b3411b29b4305b44fe83ea22a54728bdb845c76 100644 (file)
@@ -263,20 +263,5 @@ namespace System.Web.UI.WebControls {
                        }
                }
                #endregion      // Interface methods
-
-               #region REMOVE ME
-               [MonoTODO]
-               internal void LoadViewState(object state) {
-                       throw new NotImplementedException("Use the IStateManager interface instead of this method. It has been obsoleted due to Project Fresh.");
-               }
-               [MonoTODO]
-               internal object SaveViewState() {
-                       throw new NotImplementedException("Use the IStateManager interface instead of this method. It has been obsoleted due to Project Fresh");
-               }
-               [MonoTODO]
-               internal void TrackViewState() {
-                       throw new NotImplementedException("Use the IStateManager interface instead of this method. It has been obsoleted due to Project Fresh");
-               }
-               #endregion      // REMOVE ME
        }
 }
index 05beed0ab1bf9c0611152af317ef48bbc9187477..d6c454f197d50dd4777ac036890e7a7b52d164f2 100644 (file)
@@ -1035,7 +1035,7 @@ namespace System.Web.UI.WebControls
                        Page.Header.StyleSheet.RegisterStyle (baseStyle, this);
                        Style ts = new Style ();
                        ts.CopyTextStylesFrom (baseStyle);
-                       Page.Header.StyleSheet.CreateStyleRule (ts, "." + baseStyle.RegisteredCssClass + " A", this);
+                       Page.Header.StyleSheet.CreateStyleRule (ts, this, "." + baseStyle.RegisteredCssClass + " A");
                }
                
                protected internal override void Render (HtmlTextWriter writer)
index 27713b2463c23a7640c9d8f2be35d2d0fa0b3b14..9d610b5a47866d38aa01788e8490905e98bd9bd0 100644 (file)
@@ -511,7 +511,7 @@ namespace System.Web.UI.WebControls
                
                internal void SetDirty ()
                {
-                       ViewState.SetDirty ();
+                       ViewState.SetDirty (true);
                }
                
                object ICloneable.Clone ()
index 9240a1e786125eba8911752f2daac0559828d10a..ff96dfd245232b782662607b4ace9287ebb65f2e 100644 (file)
@@ -271,7 +271,7 @@ namespace System.Web.UI.WebControls {
                
                protected internal virtual void SetDirty()
                {
-                       ViewState.SetDirty ();
+                       ViewState.SetDirty (true);
                }
 
 
index c7b233852615badbb0c0d0cf346e308c128e88d1..da7c0ce32e9546085577f7aef823d68be59025ba 100644 (file)
@@ -78,20 +78,9 @@ namespace System.Web.UI.WebControls {
                }
 
 #if NET_2_0
-               [MonoTODO]
-               protected override bool LoadPostData (string postDataKey, NameValueCollection postCollection) 
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected override void RaisePostDataChangedEvent ()
-               {
-                       throw new NotImplementedException ();
-               }
-#endif         
-
-               bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+               protected override
+#endif
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection) 
                {
                        bool old_checked = Checked;
                        
@@ -107,5 +96,17 @@ namespace System.Web.UI.WebControls {
                                return (false);
                        }
                }
+
+#if NET_2_0
+               protected override
+#endif
+               void RaisePostDataChangedEvent ()
+               {
+               }
+
+               bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+               {
+                       return LoadPostData (postDataKey, postCollection);
+               }
        }
 }
index 27a0fb0870c275bf6415c54597b3b1b096ad067b..ac9c45fb80a35ea3ef36e5f735c7d83e8fe7d087 100644 (file)
@@ -38,6 +38,7 @@ namespace System.Web.UI.WebControls {
        [ValidationProperty ("SelectedItem")]
        public class RadioButtonList : ListControl, IRepeatInfoUser,
                INamingContainer, IPostBackDataHandler {
+               bool need_raise;
 
                public RadioButtonList ()
                {
@@ -221,60 +222,82 @@ namespace System.Web.UI.WebControls {
                {
                        throw new NotImplementedException ();
                }
+#endif
 
-               [MonoTODO]
-               protected virtual Style GetItemStyle (ListItemType itemType, int repeatIndex)
+#if NET_2_0
+               protected virtual
+#endif
+               Style GetItemStyle (ListItemType itemType, int repeatIndex)
                {
-                       throw new NotImplementedException ();
+                       return null;
                }
 
-               [MonoTODO]
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+#if NET_2_0
+               protected virtual
+#endif
+               void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
                {
-                       throw new NotImplementedException ();
+                       RadioButton radio = new RadioButton ();
+                       radio.Text = Items [repeatIndex].Text;
+                       radio.ID = ClientID + "_"  + repeatIndex;
+                       radio.TextAlign = TextAlign;
+                       radio.GroupName = UniqueID;
+                       radio.Page = Page;
+                       radio.Checked = Items [repeatIndex].Selected;
+                       radio.Attributes["Value"] = Items [repeatIndex].Value;
+                       radio.RenderControl (writer);
                }
-
-               [MonoTODO]
-               protected virtual void RaisePostDataChangedEvent ()
+#if NET_2_0
+               protected virtual
+#endif
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       throw new NotImplementedException ();
+                       string val = postCollection [postDataKey];
+                       ListItemCollection items = Items;
+                       int end = items.Count;
+                       int selected = SelectedIndex;
+                       for (int i = 0; i < end; i++) {
+                               ListItem item = items [i];
+                               if (item == null || val != item.Value)
+                                       continue;
+
+                               if (i != selected) {
+                                       SelectedIndex = i;
+                                       need_raise = true;
+                               }
+                               return true;
+                       }
+
+                       return false;
                }
 
-               [MonoTODO]
-               protected virtual void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
                {
-                       throw new NotImplementedException ();
+                       if (need_raise)
+                               OnSelectedIndexChanged (EventArgs.Empty);
                }
-#endif         
 
-               [MonoTODO]
                bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       return true;
+                       return LoadPostData (postDataKey, postCollection);
                }
                
-               [MonoTODO]
                void IPostBackDataHandler.RaisePostDataChangedEvent ()
                {
-
+                       RaisePostDataChangedEvent ();
                }
 
                Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,  int repeatIndex)
                {
-                       return null;
+                       return GetItemStyle (itemType, repeatIndex);
                }
 
                void IRepeatInfoUser.RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
                {
-                       RadioButton radio = new RadioButton ();
-                       radio.Text = Items [repeatIndex].Text;
-                       radio.ID = ClientID + "_"  + repeatIndex;
-                       radio.TextAlign = TextAlign;
-                       radio.GroupName = UniqueID;
-                       radio.Page = Page;
-                       radio.Checked = Items [repeatIndex].Selected;
-                       radio.Attributes["Value"] = Items [repeatIndex].Value;
-                       radio.RenderControl (writer);
+                       RenderItem (itemType, repeatIndex, repeatInfo, writer);
                }
 
 #if NET_2_0
index 569d1184ba02619ef26776c4473c6bb5fe3f3480..03039e5cb9a5e0f3266daa7303dd1691009dc523 100644 (file)
@@ -491,12 +491,16 @@ namespace System.Web.UI.WebControls {
 
                protected virtual IEnumerable GetData ()
                {
+                       IEnumerable result;
                        if (DataSourceID.Length == 0)
                                return null;
 
                        DataSourceView dsv = boundDataSource.GetView (String.Empty);
                        dsv.Select (SelectArguments, new DataSourceViewSelectCallback (SelectCallback));
-                       return data;
+
+                       result = data;
+                       data = null;
+                       return result;
                }
 
                [MonoTODO]
index 9cac4864611f4509ad6dadd8977305ec207ca0c6..91d8490fb1413c62cc25b74d950c612d4a823acd 100644 (file)
 using System.ComponentModel;
 
 namespace System.Web.UI.WebControls {
+#if NET_2_0
+       [ToolboxData ("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\"></{0}:RequiredFieldValidator>")]
+#else
        [ToolboxData ("<{0}:RequiredFieldValidator runat=server ErrorMessage=\"RequiredFieldValidator\"></{0}:RequiredFieldValidator>")]
+#endif
        public class RequiredFieldValidator : BaseValidator {
                protected override void AddAttributesToRender (HtmlTextWriter w)
                {
@@ -47,7 +51,11 @@ namespace System.Web.UI.WebControls {
                }
                
 
+#if NET_2_0
+               [Themeable(false)]
+#else
                [Bindable(true)]
+#endif
                [DefaultValue("")]
                [WebSysDescription ("")]
                [WebCategory ("Behavior")]
index a514640ff9d0b9bd99ccf3f0cdf06beb1dd0c6b3..a0dc409f8294d331255f9362f18afba09fa332e7 100644 (file)
@@ -30,7 +30,12 @@ using System.Drawing;
 
 namespace System.Web.UI.WebControls 
 {
+#if NET_2_0
+// Not until we actually have StyleConverter
+//     [TypeConverter(typeof(System.Web.UI.WebControls.StyleConverter))]
+#else
        [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
+#endif
        [ToolboxItem("")]
        public class Style : System.ComponentModel.Component, System.Web.UI.IStateManager 
        {
@@ -96,7 +101,9 @@ namespace System.Web.UI.WebControls
                #endregion      // Public Constructors
 
                #region Public Instance Properties
+#if !NET_2_0
                [Bindable(true)]
+#endif
                [DefaultValue(typeof (Color), "")]
                [NotifyParentProperty(true)]
                [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
@@ -121,7 +128,9 @@ namespace System.Web.UI.WebControls
                        }
                }
 
+#if !NET_2_0
                [Bindable(true)]
+#endif
                [DefaultValue(typeof (Color), "")]
                [NotifyParentProperty(true)]
                [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
@@ -146,7 +155,9 @@ namespace System.Web.UI.WebControls
                        }
                }
 
+#if !NET_2_0
                [Bindable(true)]
+#endif
                [DefaultValue(BorderStyle.NotSet)]
                [NotifyParentProperty(true)]
                [WebSysDescription ("")]
@@ -170,7 +181,9 @@ namespace System.Web.UI.WebControls
                        }
                }
 
+#if !NET_2_0
                [Bindable(true)]
+#endif
                [DefaultValue(typeof (Unit), "")]
                [NotifyParentProperty(true)]
                [WebSysDescription ("")]
@@ -238,7 +251,9 @@ namespace System.Web.UI.WebControls
                        }
                }
 
+#if !NET_2_0
                [Bindable(true)]
+#endif
                [DefaultValue(typeof (Color), "")]
                [NotifyParentProperty(true)]
                [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
@@ -263,7 +278,9 @@ namespace System.Web.UI.WebControls
                        }
                }
 
+#if !NET_2_0
                [Bindable(true)]
+#endif
                [DefaultValue(typeof (Unit), "")]
                [NotifyParentProperty(true)]
                [WebSysDescription ("")]
@@ -292,7 +309,9 @@ namespace System.Web.UI.WebControls
                        }
                }
 
+#if !NET_2_0
                [Bindable(true)]
+#endif
                [DefaultValue(typeof (Unit), "")]
                [NotifyParentProperty(true)]
                [WebSysDescription ("")]
@@ -327,7 +346,7 @@ namespace System.Web.UI.WebControls
                {
                        get 
                        {
-                               return (styles == 0);
+                               return (styles == 0 && (fontinfo == null || fontinfo.IsEmpty));
                        }
                }
 
@@ -693,28 +712,6 @@ namespace System.Web.UI.WebControls
                }
                #endregion      // IStateManager Properties & Methods
 
-               #region REMOVE ME
-               internal static int BORDERWIDTH = 0xeadbeef;
-               internal static int FORECOLOR   = 0xeadbeef;
-
-               [Obsolete ("This method will be removed in Fresh")]
-               internal bool IsSet(int blah) 
-               {
-                       if (blah == BORDERWIDTH)
-                               return ((styles & Styles.BorderWidth) != 0);
-
-                       if (blah == FORECOLOR)
-                               return ((styles & Styles.ForeColor) != 0);
-
-                       return false;
-               }
-
-               [Obsolete ("This method will be removed in Fresh")]
-               internal void Set(int blah) 
-               {
-               }
-               #endregion      // REMOVE ME
-
 #if NET_2_0
                protected virtual void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
                {
@@ -734,6 +731,9 @@ namespace System.Web.UI.WebControls
                }
 
                [MonoTODO]
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [Browsable(false)]
                public string RegisteredCssClass {
                        get {
                                return registered_class;
@@ -754,7 +754,7 @@ namespace System.Web.UI.WebControls
                public void SetDirty ()
                {
                        if (viewstate != null)
-                               viewstate.SetDirty ();
+                               viewstate.SetDirty (true);
                }
 
                public static bool IsStyleEmpty (Style s)
index 4bb26c088b85057e9fbdd441e5350918c14b6ac6..d1a90b6c5c1cdc7edc77b6fcb253d6407b6e55ef 100644 (file)
@@ -36,7 +36,7 @@ using System.ComponentModel;
 
 namespace System.Web.UI.WebControls
 {
-       public class SubMenuStyle: Style
+       public class SubMenuStyle: Style, ICustomTypeDescriptor
        {
                private const string HORZ_PADD = "HorizontalPadding";
                private const string VERT_PADD = "VerticalPadding";
@@ -140,6 +140,78 @@ namespace System.Web.UI.WebControls
                                attributes.Add (HtmlTextWriterStyle.PaddingBottom, VerticalPadding.ToString () + "px");
                        }
                }
+
+               [MonoTODO]
+               System.ComponentModel.AttributeCollection ICustomTypeDescriptor.GetAttributes ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               string ICustomTypeDescriptor.GetClassName ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               string ICustomTypeDescriptor.GetComponentName ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               TypeConverter ICustomTypeDescriptor.GetConverter ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] arr)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] arr)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
+               {
+                       throw new NotImplementedException ();
+               }
        }
 }
 
index 788540554047c598d32080a1017a8b2a3158a95e..3773747dea707192e69bc8fa012cd787af4e4994 100644 (file)
@@ -52,6 +52,7 @@ namespace System.Web.UI.WebControls {
                public TableCell ()
                        : base (HtmlTextWriterTag.Td)
                {
+                       PreventAutoID ();
                }
 
                // FIXME: is there a clean way to change the tag's name without using a ctor ?
@@ -59,6 +60,7 @@ namespace System.Web.UI.WebControls {
                internal TableCell (HtmlTextWriterTag tag)
                        : base (tag)
                {
+                       PreventAutoID ();
                }
 
 
@@ -224,6 +226,11 @@ namespace System.Web.UI.WebControls {
 
                protected override void AddParsedSubObject (object obj)
                {
+                       if (HasControls ()) {
+                               base.AddParsedSubObject (obj);
+                               return;
+                       }
+                       
                        LiteralControl lc = (obj as LiteralControl);
                        if (lc == null) {
                                string s = Text;
index 9479517f36f305e0023ddb0aade10414a8ae1c08..c7abd475b191ca02fedeaea8522ebfdb1f1b941a 100644 (file)
@@ -324,7 +324,7 @@ namespace System.Web.UI.WebControls {
                        if (viewstate["CellSpacing"] != null) {
                                styles |= Styles.CellSpacing;
                        }
-                       if (viewstate["BackGridLines"] != null) {
+                       if (viewstate["GridLines"] != null) {
                                styles |= Styles.GridLines;
                        }
                        if (viewstate["HorizontalAlign"] != null) {
index 5b75af99793d6882e3ef603d5d9bd3382681fa5c..f91ff3b6ca198dd45c641b40136a806ea9e018d4 100644 (file)
@@ -128,32 +128,34 @@ namespace System.Web.UI.WebControls {
                }
                
 #if NET_2_0
-               [MonoTODO]
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+               protected virtual
+#endif
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       throw new NotImplementedException ();
+                       if (Text != postCollection [postDataKey]) {
+                               Text = postCollection [postDataKey];
+                               return true;
+                       }
+                       
+                       return false;
                }
 
-               [MonoTODO]
-               protected virtual void RaisePostDataChangedEvent ()
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
                {
-                       throw new NotImplementedException ();
+                       OnTextChanged (EventArgs.Empty);
                }
-#endif
 
-               bool IPostBackDataHandler.LoadPostData (string key, NameValueCollection col)
+               bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
-                       if (Text != col [key]) {        
-                               Text = col [key];
-                               return true;
-                       }
-                       
-                       return false;
+                       return LoadPostData (postDataKey, postCollection);
                }
        
                void IPostBackDataHandler.RaisePostDataChangedEvent ()
                {
-                       OnTextChanged (EventArgs.Empty);
+                       RaisePostDataChangedEvent ();
                }
 
 #if NET_2_0
index 2ee3b9b844bcbbe1b5b4ee6fbb18ba3722d71c9f..fe7716ef12ae2888976463a2192d630d83481bf4 100644 (file)
@@ -614,7 +614,7 @@ namespace System.Web.UI.WebControls
                
                internal void SetDirty ()
                {
-                       ViewState.SetDirty ();
+                       ViewState.SetDirty (true);
                }
                
                public object Clone ()
index 1d2f54ffe2b124d33d204eab14882516f9066d45..74f90698bf559725fdc66456edf44d5bbee6080b 100644 (file)
@@ -165,7 +165,11 @@ namespace System.Web.UI.WebControls {
                protected override void AddAttributesToRender(HtmlTextWriter writer) {
                        base.AddAttributesToRender (writer);
 
-                       if (EnableClientScript && pre_render_called) {
+                       if (EnableClientScript && pre_render_called && Page.AreValidatorsUplevel ()) {
+                               /* force an ID here if we weren't assigned one */
+                               if (ID == null)
+                                       writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
+
                                if (HeaderText != "")
                                        writer.AddAttribute ("headertext", HeaderText);
 
@@ -178,12 +182,11 @@ namespace System.Web.UI.WebControls {
                                if (DisplayMode != ValidationSummaryDisplayMode.BulletList)
                                        writer.AddAttribute ("displaymode", DisplayMode.ToString());
 
-                               writer.AddStyleAttribute ("display", "none");
+                               if (!has_errors)
+                                       writer.AddStyleAttribute ("display", "none");
                        }
                }
 
-               bool pre_render_called = false;
-
 #if NET_2_0
                protected internal
 #else          
@@ -214,11 +217,6 @@ namespace System.Web.UI.WebControls {
                                return;
                        }
 
-                       if (EnableClientScript && pre_render_called) {
-                               Page.ClientScript.RegisterArrayDeclaration ("Page_ValidationSummaries",
-                                                                           String.Format ("document.getElementById ('{0}')", ID));
-                       }
-
                        // We have validators
                        errors = new ArrayList(validators.Count);
                        for (int i = 0; i < validators.Count; i++) {
@@ -227,10 +225,17 @@ namespace System.Web.UI.WebControls {
                                }
                        }
 
-                       if ((ShowSummary && errors.Count > 0) || (EnableClientScript && pre_render_called))
+                       has_errors = errors.Count > 0;
+
+                       if (EnableClientScript && pre_render_called && Page.AreValidatorsUplevel ()) {
+                               Page.ClientScript.RegisterArrayDeclaration ("Page_ValidationSummaries",
+                                                                           String.Format ("document.getElementById ('{0}')", ClientID));
+                       }
+
+                       if ((ShowSummary && has_errors) || (EnableClientScript && pre_render_called))
                                base.RenderBeginTag(writer);
 
-                       if (ShowSummary && errors.Count > 0) {
+                       if (ShowSummary && has_errors) {
                                switch(DisplayMode) {
                                        case ValidationSummaryDisplayMode.BulletList: {
                                                if (HeaderText.Length > 0) {
@@ -289,9 +294,12 @@ namespace System.Web.UI.WebControls {
                                }
                        }
 
-                       if ((ShowSummary && errors.Count > 0) || (EnableClientScript && pre_render_called))
+                       if ((ShowSummary && has_errors) || (EnableClientScript && pre_render_called))
                                base.RenderEndTag(writer);
                }
                #endregion      // Public Instance Methods
+
+               bool pre_render_called;
+               bool has_errors;
        }
 }
index c07a1b2c220d8b0dd899870f3bb2bb546f3fe95e..a644ba273a476423c2f1737ad3033ab26735449d 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.Globalization;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class AttributeCollection
        {
                private StateBag bag;
index e01bd6faf07270bb8834972747ded92b5e0ce121..e08281f53bc0b4ace4e74c53d268ff18572211ab 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.IO;
-using System.Web;
+using System.Security.Permissions;
 using System.Web.Compilation;
 using System.Web.Configuration;
 using System.Web.Util;
 
 namespace System.Web.UI
 {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class BaseParser
        {
                HttpContext context;
index 84d1deb509695d556f8ad697de0286ac2d0232c0..3debb830b332898ff6073c03616e521d470469b7 100644 (file)
@@ -6,9 +6,7 @@
 //   Jackson Harper (jackson@ximian.com)
 //
 // (C) 2003 Andreas Nahr
-// (C) 2004 Novell, Inc (http://www.novell.com)
-//
-
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
 using System.Text;
 using System.ComponentModel;
+using System.Security.Permissions;
 using System.Web.Caching;
 
 namespace System.Web.UI
 {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ToolboxItem (false)]
        public abstract class BasePartialCachingControl : Control
        {
index 7407131b2dc3c212bee7b6c80c3705ed65780ccc..48d48995504a8102efa0d9e993731a50cc484b77 100644 (file)
@@ -1,3 +1,176 @@
+2005-09-19  Sebastien Pouliot  <sebastien@ximian.com> 
+       * Page.cs: Remove references to IPageParser (removed from 2.0 RC). We
+       now use HtmlHeader directly.
+       * UrlPropertyAttribute.cs: Removed AllowedTypes property (2.0 RC) and
+       rewrote Equals to avoid dual type cast.
+
+2005-09-19  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * SupportsEventValidationAttribute.cs: New attribute added in 2.0 RC.
+
+2005-09-19  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * ControlBuilder.cs: Added BuildObject override for 2.0 profile.
+       * TagPrefixAttribute.cs: Added LinkDemand for AspNetHostingPermission
+       with Minimal level. Fixed checks on ctor.
+       * TemplateBuilder.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level.
+       * TemplateContainerAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level.
+       * TemplateControl.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Fixed checks/exceptions. 
+       Stubbed IFilterResolutionService for CAS testing.
+       * TemplateControlParser.cs: Added LinkDemand and InheritanceDemand for
+       AspNetHostingPermission with Minimal level.
+       * TemplateParser.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level.
+       * ThemeableAttribute.cs: Added LinkDemand for AspNetHostingPermission
+       with Minimal level. Removed IDispose interface.
+       * ToolboxDataAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Fixed IsDefaultAttribute 
+       to work on both 1.x and 2.0 profiles.
+       * Triplet.cs: Added LinkDemand and (only for 1.x) InheritanceDemand 
+       for AspNetHostingPermission with Minimal level.
+       * UserControl.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Stubbed 
+       IFilterResolutionService for CAS testing.
+       * UserControlControlBuilder.cs: Added LinkDemand and InheritanceDemand
+       for AspNetHostingPermission with Minimal level.
+       * ValidationPropertyAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level.
+       * ValidatorCollection.cs: Added LinkDemand for AspNetHostingPermission 
+       with Minimal level.
+       * WebResourceAttribute.cs: Removed extra ctor and added setter to 
+       PerformSubstitution.
+       * WebServiceParser.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level.
+
+2005-09-15  Sebastien Pouliot  <sebastien@ximian.com> 
+       * ParseChildrenAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Simplified Equals to avoid
+       casting. Added new ctor and public fields (2.0). Changed 
+       ChildControlType setter visibility to internal.
+       * PartialCachingAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Added new ctor and 
+       SqlDependency property (2.0).
+       * PartialCachingControl.cs: Added LinkDemand and InheritanceDemand for
+       AspNetHostingPermission with Minimal level.
+       * PersistenceModeAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Simplified Equals to avoid
+       casting.
+       * PersistChildrenAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Simplified Equals to avoid 
+       casting.
+       * PropertyConverter.cs: Added LinkDemand for AspNetHostingPermission 
+       with Minimal level. Class is static in 2.0.
+       * RootBuilder.cs: Added LinkDemand and, for 2.0, InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Class is no more sealed in
+       2.0. Added new (2.0) BuiltObjects property.
+       * SimpleWebHandlerParser.cs: Added LinkDemand and InheritanceDemand 
+       for AspNetHostingPermission with Minimal level.
+       * StateItem.cs: Added LinkDemand for AspNetHostingPermission with 
+       Minimal level.
+       * StateBag.cs: Added LinkDemand for AspNetHostingPermission with 
+       Minimal level. Removed SetDirty() which was called (2.0) but did 
+       nothing.
+       * StaticPartialCachingControl.cs: Added LinkDemand and 
+       InheritanceDemand for AspNetHostingPermission with Minimal level.
+
+2005-09-15  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * Html32TextWriter.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Added new 2.0 properties
+       (but the generated HTML doesn't use them).
+       * HtmlTextWriter.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level.
+       * ImageClickEventArgs.cs: Added LinkDemand for AspNetHostingPermission
+       with Minimal level.
+       * LiteralControl.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Default Text is null.
+       * LosFormatter.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Stubbed new 2.0 ctor.
+       * ObjectConverter.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Obsoleted ctor for 2.0.
+       * ObjectTagBuilder.cs: Added LinkDemand for AspNetHostingPermission 
+       with Minimal level. Added check for null id (HttpException).
+       * Page.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Throw some HttpException 
+       when no context is available.
+       * Pair.cs: Added LinkDemand for AspNetHostingPermission with Minimal 
+       level. InheritanceDemand too for 1.x.
+       * PageParser.cs: Added LinkDemand for AspNetHostingPermission with 
+       Minimal level.
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com>
+       * DataBinder.cs: Added LinkDemand for AspNetHostingPermission with 
+       Minimal level. Fixed some exceptions.
+       * DataBindingCollection.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Added 2.0 method and 
+       event.
+       * DataBindingHandlerAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level.
+       * DataBinding.cs: Added LinkDemand for AspNetHostingPermission with
+       Minimal level. Simplified Equals (reduced casts).
+       * DataBoundLiteralControl.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Implemented ITextControl
+       for 2.0.
+       * DesignerDataBoundLiteralControl.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level.
+       * DesignTimeParseData.cs: Added LinkDemand for AspNetHostingPermission
+       with Minimal level. Added new 2.0 properties.
+       * DesignTimeTemplateParser.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Made class static and 
+       stubbed missing methods (2.0).
+       * EmptyControlCollection.cs: Added LinkDemand and InheritanceDemand 
+       for AspNetHostingPermission with Minimal level. Changed Add* methods
+       exceptions to HttpException.
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * AttributeCollection.cs: Added LinkDemand for AspNetHostingPermission
+       with Minimal level.
+       * BaseParser.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level.
+       * BasePartialCachingControl.cs: Added LinkDemand and InheritanceDemand
+       for AspNetHostingPermission with Minimal level.
+       * CompiledTemplateBuilder.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level.
+       * ConstructorNeedsTagAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level.
+       * ControlBuilderAttribute.cs: Added LinkDemand for 
+       AspNetHostingPermission with Minimal level. Simplified Equals and 
+       IsDefaultAttribute.
+       * ControlBuilder.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level.
+       * ControlCachePolicy.cs: Hided ctor and removed SupportsCaching setter
+       * ControlCollection.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Fixed possible stack 
+       overflow in Add* methods. Fixed CopyTo as we're not allocating the 
+       array based on the number of items.
+       * Control.cs: Added LinkDemand and InheritanceDemand for 
+       AspNetHostingPermission with Minimal level. Fixed 2.0 signatures.
+       * CssStyleCollection.cs: Added LinkDemand for AspNetHostingPermission 
+       with Minimal level.
+       * IStyleSheet.cs: Fixed parameter orders (2.0).
+
+2005-09-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TemplateParser.cs: default VS 2005 pages are compiled fine now.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * MinimizableAttributeTypeConverter.cs: new class, whose existence
+       we know about because of corcompare, and for whose implementation
+       we have exclusively nunit to thank.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * RootBuilder.cs (.cctor): doh, add all the new html controls
+       here.
+
 2005-08-31  Chris Toshok  <toshok@ximian.com>
 
        * DataSourceSelectArguments.cs (Empty): this is apparently,
index f2ece3d81dd9e29a388a7037d78a751f26b188d4..1710b844e276430507f346bc50d33fb3ca5f704c 100644 (file)
@@ -5,6 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // This is used in the generated C# code from MS and xsp does the same.
 // It just seems to be a container implementing an ITemplate interface.
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.Permissions;
+
 namespace System.Web.UI {
 
+// CAS - no InheritanceDemand here as the class is sealed
+[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 public sealed class CompiledTemplateBuilder : ITemplate
 {
        private BuildTemplateMethod templateMethod;
index ac244667dc630178cab0fab46e80e86175215716..3e30cbadb2ef007f4596f55668624fc1ad4f3823 100644 (file)
@@ -4,7 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class)]
        public sealed class ConstructorNeedsTagAttribute : Attribute
        {
index 80ee65d1c94245ef11e6c76b8798d1817518d991..694ad0019e032c3cbf9abed31fb82e3695b3bbe0 100644 (file)
 // This will provide extra information when trace is enabled. Might be too verbose.
 #define MONO_TRACE
 
-using System;
 using System.Collections;
 using System.ComponentModel;
 using System.ComponentModel.Design;
 using System.ComponentModel.Design.Serialization;
+using System.Security.Permissions;
 using System.Web;
 using System.Web.Util;
 #if NET_2_0
@@ -50,6 +50,10 @@ using System.IO;
 
 namespace System.Web.UI
 {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [DefaultProperty ("ID"), DesignerCategory ("Code"), ToolboxItemFilter ("System.Web.UI", ToolboxItemFilterType.Require)]
        [ToolboxItem ("System.Web.UI.Design.WebControlToolboxItem, " + Consts.AssemblySystem_Design)]
        [Designer ("System.Web.UI.Design.ControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
@@ -1406,15 +1410,7 @@ namespace System.Web.UI
                        set { skinId = value; }
                }
                
-               /* This shouldnt be in 2.0, and I can't find it in 1.1
-                * either, so leaving alone for now.
-                */
-               protected string GetWebResourceUrl (string resourceName)
-               {
-                       return Page.ClientScript.GetWebResourceUrl (GetType(), resourceName); 
-               } 
-
-               string IUrlResolutionService.ResolveClientUrl (string url)
+               public string ResolveClientUrl (string url)
                {
                        throw new NotImplementedException ();               
                }
index 2e62189d43821944e06fa6cad8249f33d920a70f..c3394fa0776a2ddd7caa452c3cfd187815b0c6f7 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002, 2003 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.CodeDom;
 using System.Reflection;
-using System.Web;
+using System.Security.Permissions;
 using System.Web.Compilation;
 
 namespace System.Web.UI {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class ControlBuilder
        {
                internal static BindingFlags flagsNoCase = BindingFlags.Public |
@@ -490,6 +491,12 @@ namespace System.Web.UI {
                                }
                        }
                }
+#if NET_2_0
+               [MonoTODO ("unsure, lack documentation")]
+               public virtual object BuildObject ()
+               {
+                       return CreateInstance ();
+               }
+#endif
        }
 }
-
index abc5ea7cfa83088826988b04dd41004e904a158e..be84ba25164be0411747d6e01ea6fd2f37e61d1e 100644 (file)
@@ -4,9 +4,10 @@
 // Authors:
 //     Duncan Mak  (duncan@ximian.com)
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class)]
        public sealed class ControlBuilderAttribute : Attribute
        {
@@ -49,9 +53,10 @@ namespace System.Web.UI {
 
                public override bool Equals (object obj)
                {
-                       if (!(obj is ControlBuilderAttribute))
+                       ControlBuilderAttribute cba = (obj as ControlBuilderAttribute);
+                       if (cba == null)
                                return false;
-                       return ((ControlBuilderAttribute) obj).builderType == builderType;
+                       return (cba.builderType == builderType);
                }
 
                public override int GetHashCode ()
@@ -61,7 +66,7 @@ namespace System.Web.UI {
 
                public override bool IsDefaultAttribute ()
                {
-                       return Equals (Default);
+                       return (builderType == null);
                }
        }
 }
index a2e1093f2e6a8ea35dea735fc26bf763194e5b5a..6087587cbd9eeff91f1caa14a3f86876b8264022 100644 (file)
 //
 
 #if NET_2_0
-using System.Web;
+
 using System.Web.Caching;
 
 namespace System.Web.UI
 {
+       [MonoTODO ("only stubbed")]
        public sealed class ControlCachePolicy
        {
+               internal ControlCachePolicy ()
+               {
+               }
+
                public bool Cached 
                {
                        get {
@@ -69,9 +74,6 @@ namespace System.Web.UI
                        get {
                                throw new NotImplementedException ();
                        }
-                       set {
-                               throw new NotImplementedException ();
-                       }
                }
 
                public string VaryByControl 
@@ -107,4 +109,4 @@ namespace System.Web.UI
                }
        }
 }
-#endif
\ No newline at end of file
+#endif
index b1db49799bae40f5420ae17a7041dd3ffd10d62a..d6b340bd700f6073da5b374e8f7faca2b27a3ff9 100644 (file)
@@ -5,9 +5,7 @@
 //     Duncan Mak  (duncan@ximian.com)
 //     Gonzalo Paniagua Javier (gonzalo@novell.com)
 //
-// Copyright (c) 2002-2004 Novell, Inc. (http://www.novell.com)
-//
-
+// Copyright (c) 2002-2005 Novell, Inc. (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class ControlCollection : ICollection, IEnumerable
        {
                Control owner;
@@ -97,7 +98,10 @@ namespace System.Web.UI {
                                throw new ArgumentNullException ();
 
                        if (readOnly)
-                               throw new HttpException ();
+                               throw new HttpException (Locale.GetText ("Collection is read-only."));
+
+                       if (Object.ReferenceEquals (owner, child))
+                               throw new HttpException (Locale.GetText ("Cannot add collection's owner."));
 
                        EnsureControls ();
                        version++;
@@ -114,7 +118,10 @@ namespace System.Web.UI {
                                throw new ArgumentOutOfRangeException ();
 
                        if (readOnly)
-                               throw new HttpException ();
+                               throw new HttpException (Locale.GetText ("Collection is read-only."));
+
+                       if (Object.ReferenceEquals (owner, child))
+                               throw new HttpException (Locale.GetText ("Cannot add collection's owner."));
 
                        if (index == -1) {
                                Add (child);
@@ -153,7 +160,22 @@ namespace System.Web.UI {
                        if (controls == null)
                                return;
 
-                       controls.CopyTo (array, index);
+                       // can't use controls.CopyTo (array, index);
+                       // as we do not allocate it based on the true 
+                       // numbers of items we have in the collection
+                       // so we must re-implement Array.CopyTo :(
+
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index + count > array.GetLowerBound (0) + array.GetLength (0))
+                               throw new ArgumentException ();
+                       if (array.Rank > 1)
+                               throw new RankException (Locale.GetText ("Only single dimension arrays are supported."));
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("index", Locale.GetText ("Value has to be >= 0."));
+
+                       for (int i=0; i < count; i++)
+                               array.SetValue (controls [i], i);
                }
 
                public IEnumerator GetEnumerator ()
index 24cbc71a5759a221da7409dade788ded4e19ffc3..5c4e3a142c73ff224bf2b18c1f3ee918af97e3af 100644 (file)
 
 using System.IO;
 using System.Collections;
+using System.Security.Permissions;
 using System.Text;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class CssStyleCollection
        {
                private StateBag bag;
index 6d5512f85ff9258ad94da69a15939c9fdc07f7d0..86d1d9e174de019a7e96a84cc52752141a4912e6 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.ComponentModel;
 using System.Reflection;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
-       public sealed class DataBinder
-       {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class DataBinder {
 #if NET_2_0
                [Obsolete]
 #endif
@@ -58,7 +58,7 @@ namespace System.Web.UI {
                
                public static object Eval (object container, string expression)
                {
-                       if (expression == null)
+                       if ((expression == null) || (expression.Length == 0))
                                throw new ArgumentNullException ("expression");
 
                        object current = container;
@@ -89,7 +89,9 @@ namespace System.Web.UI {
 
                public static object GetIndexedPropertyValue (object container, string expr)
                {
-                       if (expr == null)
+                       if (container == null)
+                               throw new ArgumentNullException ("container");
+                       if ((expr == null) || (expr.Length == 0))
                                throw new ArgumentNullException ("expr");
 
                        int openIdx = expr.IndexOf ('[');
@@ -171,6 +173,8 @@ namespace System.Web.UI {
 
                public static object GetPropertyValue (object container, string propName)
                {
+                       if (container == null)
+                               throw new ArgumentNullException ("container");
                        if (propName == null)
                                throw new ArgumentNullException ("propName");
 
index 88e56feb1832783b8665ea1a40622c6f7f25e346..ab86dc78705c7c7242c5a5512cf128c31d21efe2 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class DataBinding
        {
                string propertyName;
@@ -62,10 +63,10 @@ namespace System.Web.UI {
 
                public override bool Equals (object obj)
                {
-                       if (!(obj is DataBinding))
+                       DataBinding o = (obj as DataBinding);
+                       if (o == null)
                                return false;
                        
-                       DataBinding o = (DataBinding) obj;
                        return (o.Expression == expression &&
                                o.PropertyName == propertyName &&
                                o.PropertyType == propertyType);
index 89508c87a59505904a119c36980217a62ac6eb3e..1d1ecc00944330493d66029f1b06e0cd4de69c2a 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class DataBindingCollection : ICollection, IEnumerable
        {
                Hashtable list;
@@ -109,5 +110,14 @@ namespace System.Web.UI {
 
                        list.Remove (propertyName);
                }
+#if NET_2_0
+               public bool Contains (string propertyName)
+               {
+                       return list.Contains (propertyName);
+               }
+
+               [MonoTODO]
+               public event EventHandler Changed;
+#endif
        }
 }
index f535516bd24273bd1a4d52799431369230c68f1d..493fa558d777682ad94aa5baefe4c108e2672ace 100644 (file)
@@ -1,5 +1,5 @@
 //
-// System.Web.UI.WebControls.CommandEventArgs.cs
+// System.Web.UI.WebControls.DataBindingHandlerAttribute class
 //
 // Author: Duncan Mak (duncan@novell.com)
 //
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.Permissions;
+
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class)]
        public sealed class DataBindingHandlerAttribute : Attribute
        {
index 10aa8be81a53797c015899a20ff9e84235ea7d38..4185264d5a618659c5e88b488aaf247bcdddcaa5 100644 (file)
@@ -1,13 +1,12 @@
 //
-// System.Web.UI.DataBoundLiteralCOntrol.cs
+// System.Web.UI.DataBoundLiteralControl.cs
 //
 // Authors:
 //     Duncan Mak  (duncan@ximian.com)
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
+using System.Security.Permissions;
 using System.Text;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ToolboxItem(false)]
        public sealed class DataBoundLiteralControl : Control
 #if NET_2_0
@@ -111,13 +113,12 @@ namespace System.Web.UI {
                }
 
 #if NET_2_0
-               string ITextControl.Text 
-               {
+               string ITextControl.Text {
                        get {
-                               throw new NotImplementedException ();
+                               return Text;
                        }
                        set {
-                               throw new NotImplementedException ();
+                               throw new NotSupportedException ();
                        }
                }
 #endif         
index 54179036d4a508010e67da9f7d6dc2b3fe4a8c13..bf7dc787f7e8dbb9f63df80ae99f6ffb101b8bb4 100644 (file)
@@ -1,5 +1,5 @@
 //
-// System.Web.HttpRequest.cs 
+// System.Web.DesignTimeParseData class
 //
 // 
 // Author:
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
-using System.Web.UI;
+using System.Collections;
 using System.ComponentModel.Design;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class DesignTimeParseData {
                EventHandler db_handler;
                string text;
                IDesignerHost host;
                string durl;
+#if NET_2_0
+               string filter;
+               bool theme;
+               ICollection collection;
+#endif
                
                public DesignTimeParseData (IDesignerHost designerHost, string parseText)
                {
                        host = designerHost;
                        text = parseText;
                }
+#if NET_2_0
+               public DesignTimeParseData (IDesignerHost designerHost, string parseText, string filter)
+                       : this (designerHost, parseText)
+               {
+                       this.filter = filter;
+               }
+#endif
 
                public EventHandler DataBindingHandler {
                        get {
@@ -78,7 +92,20 @@ namespace System.Web.UI {
                                return text;
                        }
                }
-               
+#if NET_2_0
+               public string Filter {
+                       get { return filter; }
+               }
+
+               public bool ShouldApplyTheme {
+                       get { return theme; }
+                       set { theme = value; }
+               }
+
+               // FIXME: there's probably a way to set this somewhere...
+               public ICollection UserControlRegisterEntries {
+                       get { return collection; }
+               }
+#endif
        }
 }
-
index 78a32b4c40ed8bd1df033c8dc7ad36b49f5e7379..b406367cc124394b99f4dcf35c8cfe721be5a8f7 100644 (file)
@@ -5,8 +5,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2003 Andreas Nahr
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Security.Permissions;
+
+namespace System.Web.UI {
 
-namespace System.Web.UI
-{
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       public static class DesignTimeTemplateParser {
+#else
+       public sealed class DesignTimeTemplateParser {
 
-       public sealed class DesignTimeTemplateParser
-       {
                private DesignTimeTemplateParser ()
                {
                }
-
+#endif
+               [SecurityPermission (SecurityAction.Demand, ControlThread = true, UnmanagedCode = true)]
                public static Control ParseControl (DesignTimeParseData data)
                {
                        TemplateParser NewParser = InitParser (data);
@@ -51,6 +56,7 @@ namespace System.Web.UI
                        return null;
                }
 
+               [SecurityPermission (SecurityAction.Demand, ControlThread = true, UnmanagedCode = true)]
                public static ITemplate ParseTemplate (DesignTimeParseData data)
                {
                        TemplateParser NewParser = InitParser (data);
@@ -69,5 +75,20 @@ namespace System.Web.UI
                        // Parse data
                        return NewParser;
                }
+#if NET_2_0
+               [MonoTODO]
+               [SecurityPermission (SecurityAction.Demand, ControlThread = true, UnmanagedCode = true)]
+               public static Control[] ParseControls (DesignTimeParseData data)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               [SecurityPermission (SecurityAction.Demand, ControlThread = true)]
+               public static ControlBuilder ParseTheme (IDesignerHost host, string theme, string themePath)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
        } 
 }
index 6b79c7d8c76547ddefc7c6da82f537f30f768bb1..b0a9ec7bf62d38ec5718a8ee771650aa74c67b55 100644 (file)
@@ -5,8 +5,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2003 Andreas Nahr
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Web.UI
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ToolboxItem(false)]
        [DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
        public sealed class DesignerDataBoundLiteralControl : Control
index 2ead5502da017e38e27c6879425f5cda2acd6786..214f692d7025e86cab7ececbc1451163947389a8 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class EmptyControlCollection : ControlCollection
        {
                public EmptyControlCollection (Control owner)
@@ -40,12 +42,12 @@ namespace System.Web.UI {
                
                public override void Add (Control child)
                {
-                       throw new NotSupportedException ("Control " + Owner.ID + " does not allow children");
+                       throw new HttpException (Locale.GetText ("Control '{0}' does not allow children.", Owner.ID));
                }
 
                public override void AddAt (int index, Control child)
                {
-                       throw new NotSupportedException ("Control " + Owner.ID + " does not allow children");
+                       throw new HttpException (Locale.GetText ("Control '{0}' does not allow children.", Owner.ID));
                }
        }
 }
index e8bb5f9a7e4414a448502ab4596a7e88abb3b43c..d9e9defb52e3f771c837f33d975af8ce4ecd0e83 100644 (file)
@@ -6,9 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // Copyright (C) Matthijs ter Woord, 2004
-// (C) 2004 Novell, Inc (http://www.novell.com)
-//
-
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 using System.Collections;
 using System.Globalization;
 using System.IO;
+using System.Security.Permissions;
 
 namespace System.Web.UI
 {
        [MonoTODO ("Needs work and verification.")]
-       public class Html32TextWriter : HtmlTextWriter
-       {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public class Html32TextWriter : HtmlTextWriter {
+#if NET_2_0
+               private bool div_table_substitution;
+               private bool bold;
+               private bool italic;
+#endif
+
                public Html32TextWriter (TextWriter writer) : base (writer)
                {
                }
@@ -47,6 +54,25 @@ namespace System.Web.UI
                {
                }
 
+#if NET_2_0
+               [MonoTODO ("no effect on html generation")]
+               public bool ShouldPerformDivTableSubstitution {
+                       get { return div_table_substitution; }
+                       set { div_table_substitution = value; }
+               }
+
+               [MonoTODO ("no effect on html generation")]
+               public bool SupportsBold {
+                       get { return bold; }
+                       set { bold = value; }
+               }
+
+               [MonoTODO ("no effect on html generation")]
+               public bool SupportsItalic {
+                       get { return italic; }
+                       set { italic = value; }
+               }
+#endif
 
                public override void RenderBeginTag (HtmlTextWriterTag tagKey)
                {
index 73d3745758666be44f32fa3bc5856f04d0273543..51f71a24939dd4ffb8a1dcc51f59881e6dd49c9b 100644 (file)
 using System.IO;
 using System.Globalization;
 using System.Collections;
+using System.Security.Permissions;
 using System.Text;
 
 namespace System.Web.UI {
        
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class HtmlTextWriter : TextWriter {
 
 
index e6fd19a4ae78c1db8bd0cf132db1a0d9bd3f0fc4..b14ee83db9a0519a3250fa8cd9264d330e4aa26e 100644 (file)
@@ -4,8 +4,7 @@
 // Authors:
 //      Sanjay Gupta (gsanjay@novell.com)
 //
-// (C) 2004 Novell, Inc (http://www.novell.com)
-//
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 
 
 #if NET_2_0
-using System;
+
 using System.Web.UI.WebControls;
 
 namespace System.Web.UI
 {
        public interface IStyleSheet
        {
-               void CreateStyleRule (Style style, string selection, IUrlResolutionService urlResolver);
+               void CreateStyleRule (Style style, IUrlResolutionService urlResolver, string selection);
                void RegisterStyle (Style style, IUrlResolutionService urlResolver);
        }
 }
index 133ce48e78d6d0e4c13f9757eb4b2c01b6d657d1..c3d70124870eadd29fb822efc80d7e0c0bab7595 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class ImageClickEventArgs : EventArgs
        {
                public ImageClickEventArgs (int x, int y)
index be13c45a1889709d8cd3c89d0ae70af9a5daf530..7323e2dbc0de8b2055d51dd912504232bfc48dde 100644 (file)
@@ -6,9 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) Bob Smith
-// Copyright (c) 2002-2004 Novell, Inc. (http://www.novell.com)
-//
-
+// Copyright (C) 2002-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
-using System.Web;
+using System.Security.Permissions;
+
+namespace System.Web.UI {
 
-namespace System.Web.UI
-{
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ToolboxItem(false)]
         public class LiteralControl : Control
 #if NET_2_0
@@ -50,7 +51,7 @@ namespace System.Web.UI
                 {
                        EnableViewState = false;
                        PreventAutoID ();
-                       _text = (text == null) ? "" : text; // Text property is not called for this.
+                       _text = text; // can be null in this case (see CAS unit tests)
                 }
 
                 public virtual string Text {
index b445257657f36bca93c7c3b30f63e7c88240c4f9..e30da669122b146c186604638699dab922e2a3e7 100644 (file)
@@ -5,8 +5,7 @@
 //     Ben Maurer (bmaurer@users.sourceforge.net)
 //
 // (C) 2003 Ben Maurer
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 //
 
 using System.IO;
-
+using System.Security.Permissions;
 
 namespace System.Web.UI {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class LosFormatter {
 
                ObjectStateFormatter osf = new ObjectStateFormatter ();
@@ -44,8 +46,17 @@ namespace System.Web.UI {
                [MonoTODO]
                public LosFormatter (bool enableMac, string macKeyModifier)
                {
+                       // FIXME - is this used ???
                }
-#endif 
+#endif
+#if NET_2_0
+               [MonoTODO]
+               public LosFormatter (bool enableMac, byte[] macKeyModifier)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+
                public object Deserialize (Stream stream)
                {
                        return osf.Deserialize (stream);
diff --git a/mcs/class/System.Web/System.Web.UI/MinimizableAttributeTypeConverter.cs b/mcs/class/System.Web/System.Web.UI/MinimizableAttributeTypeConverter.cs
new file mode 100644 (file)
index 0000000..7005773
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// System.Web.UI.MinimizableAttributeTypeConvert.cs
+//
+// Authors:
+//   Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+
+#if NET_2_0
+namespace System.Web.UI {
+       internal class MinimizableAttributeTypeConverter : TypeConverter {
+
+               public MinimizableAttributeTypeConverter ()
+               {
+               }
+
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       if (sourceType == typeof (string))
+                               return true;
+
+                       return base.CanConvertFrom (context, sourceType);
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       if (value is string && destinationType == typeof (bool)) {
+                               return value != null;
+                       }
+                       if (value is bool && destinationType == typeof (string))
+                               return ((Boolean) value).ToString (culture);
+
+                       return base.ConvertTo (context, culture, value, destinationType);
+               }
+               
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       // culture?
+                       if (value == null) {
+                               throw new NotSupportedException ("MinimizableAttributeTypeConverter cannot convert from (null)");
+                       }
+                                       
+                       Type t = value.GetType ();
+                       if (t == typeof (string))
+                               return value != String.Empty;
+
+                       if (t == typeof (bool))
+                               return value;
+
+                       return base.ConvertFrom (context, culture, value);
+               }
+
+       }
+}
+#endif
index 2822f494c43bb139d157e175e19310a8f07351a2..62dbfa188fcf0661f3b3f2f8ccebf08f848e133c 100644 (file)
@@ -4,9 +4,7 @@
 // Authors:
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
-// (C) 2003 Novell, Inc (http://www.novell.com)
-//
-
+// Copyright (C) 2003,2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-namespace System.Web.UI
-{
+using System.Security.Permissions;
+
+namespace System.Web.UI {
+
        [Obsolete ("Use the System.Convert class and String.Format instead", false)]
-       public sealed class ObjectConverter
-       {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class ObjectConverter {
+
+#if NET_2_0
+               [Obsolete]
+#endif
+               public ObjectConverter ()
+               {
+               }
+
                public static object ConvertValue (object value, Type toType, string formatString)
                {
                        throw new NotImplementedException ("Not implemented and [Obsolete]");
                }
        }
 }
-
index 3a815d6a291db310c8c2f43a7ed673c7de53c836..19b2f3b035eae5c7bb8dc643df172d9be48a46f7 100644 (file)
@@ -5,7 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2003 Ximian, Inc. (http://www.ximian.com)
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-
-using System;
 using System.Collections;
+using System.Security.Permissions;
 using System.Web.Compilation;
 
 namespace System.Web.UI
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class ObjectTagBuilder : ControlBuilder
        {
                string id;
@@ -62,6 +63,8 @@ namespace System.Web.UI
                                           string id,
                                           IDictionary attribs) 
                {
+                       if (id == null)
+                               throw new HttpException ("Missing 'id'.");
                        if (attribs == null)
                                throw new ParseException (parser.Location, "Error in ObjectTag.");
 
index 1316de992a6fd6e0e370a51da930f9fa5e8becfc..9b79e0730b627b8e152bd28c60013c1096464f03 100644 (file)
@@ -7,9 +7,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2002,2003 Ximian, Inc. (http://www.ximian.com)
-// (c) 2003 Novell, Inc. (http://www.novell.com)
-//
-
+// Copyright (C) 2003,2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -39,6 +37,7 @@ using System.ComponentModel.Design;
 using System.ComponentModel.Design.Serialization;
 using System.Globalization;
 using System.IO;
+using System.Security.Permissions;
 using System.Security.Principal;
 using System.Text;
 using System.Threading;
@@ -54,7 +53,9 @@ using System.Web.UI.Adapters;
 
 namespace System.Web.UI
 {
-
+// CAS
+[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 #if NET_2_0
 [RootDesignerSerializer ("Microsoft.VisualStudio.Web.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VisualStudio_Web, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
 #else
@@ -102,7 +103,7 @@ public class Page : TemplateControl, IHttpHandler
        internal const string CallbackSourceID = "__CALLBACKTARGET";
        internal const string PreviousPageID = "__PREVIOUSPAGE";
        
-       IPageHeader htmlHeader;
+       HtmlHead htmlHeader;
        
        MasterPage masterPage;
        string masterPageFile;
@@ -130,7 +131,11 @@ public class Page : TemplateControl, IHttpHandler
        [Browsable (false)]
        public HttpApplicationState Application
        {
-               get { return _context.Application; }
+               get {
+                       if (_context == null)
+                               return null;
+                       return _context.Application;
+               }
        }
 
        [EditorBrowsable (EditorBrowsableState.Never)]
@@ -167,7 +172,11 @@ public class Page : TemplateControl, IHttpHandler
        [Browsable (false)]
        public Cache Cache
        {
-               get { return _context.Cache; }
+               get {
+                       if (_context == null)
+                               throw new HttpException ("No cache available without a context.");
+                       return _context.Cache;
+               }
        }
 
 #if NET_2_0
@@ -353,7 +362,12 @@ public class Page : TemplateControl, IHttpHandler
        [Browsable (false)]
        public HttpResponse Response
        {
-               get { return _context.Response; }
+               get {
+                       if (_context != null)
+                               return _context.Response;
+
+                       throw new HttpException ("Response is not available without context");
+               }
        }
 
        [EditorBrowsable (EditorBrowsableState.Never)]
@@ -386,6 +400,9 @@ public class Page : TemplateControl, IHttpHandler
        public virtual HttpSessionState Session
        {
                get {
+                       if (_context == null)
+                               throw new HttpException ("Session is not available without context");
+
                        if (_context.Session == null)
                                throw new HttpException ("Session state can only be used " +
                                                "when enableSessionState is set to true, either " +
@@ -1412,11 +1429,11 @@ public class Page : TemplateControl, IHttpHandler
 
     [BrowsableAttribute (false)]
     [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
-       public IPageHeader Header {
+       public HtmlHead Header {
                get { return htmlHeader; }
        }
        
-       internal void SetHeader (IPageHeader header)
+       internal void SetHeader (HtmlHead header)
        {
                htmlHeader = header;
        }
index aa145cd3df93e9043321926838a8bd6321fa2b05..b1574d476b3d5f0662f88bd60a9a7dd1d0e1d5a1 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Collections;
 using System.Collections.Specialized;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Text;
-using System.Web;
 using System.Web.Compilation;
 using System.Web.Configuration;
 using System.Web.Util;
 
 namespace System.Web.UI
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class PageParser : TemplateControlParser
        {
                bool enableSessionState = true;
index 35c739dddcb37bd48dd6b2eb4b4c46e16f7125f8..b164a7f56b5b7922bc8e8a047108c15f94541877 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //        Ben Maurer <bmaurer@novell.com>
 //
-// (c) 2005 Novell
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.Permissions;
+
 namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 #if NET_2_0
        [Serializable]
+       public sealed class Pair {
+#else
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public class Pair {
 #endif
-       public 
-#if NET_2_0
-       sealed
-#endif
-       class Pair {
-       
                public Pair (object first, object second)
                {
                        First = first;
index a9f50099a4e4b4d28901bbcb8a009c9da36c875a..de54835ccfd4c05951774a49059d58df48dcb410 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class)]
        public sealed class ParseChildrenAttribute : Attribute
        {
@@ -41,6 +43,9 @@ namespace System.Web.UI {
                public static readonly ParseChildrenAttribute Default = new ParseChildrenAttribute ();
                
 #if NET_2_0
+               public static readonly ParseChildrenAttribute ParseAsChildren = new ParseChildrenAttribute (false);
+               public static readonly ParseChildrenAttribute ParseAsProperties = new ParseChildrenAttribute (true);
+
                Type childType = typeof(System.Web.UI.Control);
 #endif
 
@@ -64,6 +69,13 @@ namespace System.Web.UI {
                        if (childrenAsProperties)
                                this.defaultProperty = defaultProperty;
                }
+#if NET_2_0
+               public ParseChildrenAttribute (Type childControlType)
+               {
+                       childType = childControlType;
+                       defaultProperty = "";
+               }
+#endif
 
                public bool ChildrenAsProperties {
 
@@ -81,16 +93,16 @@ namespace System.Web.UI {
 #if NET_2_0
                public Type ChildControlType {
                        get { return childType; }
-                       set { childType = value; }
+                       internal set { childType = value; }
                }
 #endif
 
                public override bool Equals (object obj)
                {
-                       if (!(obj is ParseChildrenAttribute))
+                       ParseChildrenAttribute o = (obj as ParseChildrenAttribute);
+                       if (o == null)
                                return false;
 
-                       ParseChildrenAttribute o = (ParseChildrenAttribute) obj;
                        if (childrenAsProperties == o.childrenAsProperties){
                                if (childrenAsProperties == false)
                                        return true;
index 7f566444ec9728d6ea96022e718e7e12930fded8..fe881d737ee76224ca7d4f19b03f3fdbcab512bd 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class)]
        public sealed class PartialCachingAttribute : Attribute
        {
@@ -41,6 +43,10 @@ namespace System.Web.UI {
 #if NET_1_1
                bool shared;
 #endif
+#if NET_2_0
+               string sqlDependency;
+#endif
+
                
                public PartialCachingAttribute (int duration)
                {
@@ -67,6 +73,18 @@ namespace System.Web.UI {
                        this.shared = shared;
                }
 #endif
+#if NET_2_0
+               public PartialCachingAttribute (int duration, string varyByParams, string varyByControls,
+                                               string varyByCustom, string sqlDependency, bool shared)
+               {
+                       this.duration = duration;
+                       this.varyByParams = varyByParams;
+                       this.varyByControls = varyByControls;
+                       this.varyByCustom = varyByCustom;
+                       this.sqlDependency = sqlDependency;
+                       this.shared = shared;
+               }
+#endif
 
                public int Duration {
                        get { return duration; }
@@ -88,6 +106,11 @@ namespace System.Web.UI {
                public bool Shared {
                        get { return shared; }
                }
+#endif
+#if NET_2_0
+               public string SqlDependency {
+                       get { return sqlDependency; }
+               }
 #endif
        }
 }
index 42452582da96708501919e40e3bf00f511737dfc..850e37906a19f47e10bcb6c33e04101e8b3c43a6 100644 (file)
@@ -5,8 +5,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2003 Andreas Nahr
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI {
 
-namespace System.Web.UI
-{
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class PartialCachingControl : BasePartialCachingControl
        {
 
index 3e5aadef82ca654c458b2abafcd7cbe1f2f6ff1e..52ec3f1ac21b69dc3ce18a8af3db2e31f164c22f 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class)]
        public sealed class PersistChildrenAttribute : Attribute
        {
@@ -72,11 +74,10 @@ namespace System.Web.UI {
                
                public override bool Equals (object obj)
                {
-                       if (!(obj is PersistChildrenAttribute))
+                       PersistChildrenAttribute pobj = (obj as PersistChildrenAttribute);
+                       if (pobj == null)
                                return false;
 
-                       PersistChildrenAttribute pobj = obj as PersistChildrenAttribute;
-
                        return (pobj.persist == persist
 #if NET_2_0
                                && pobj.usesCustomPersistence == usesCustomPersistence
@@ -99,4 +100,3 @@ namespace System.Web.UI {
                }
        }
 }
-
index f1081e89788572fd168419e0b51ddeccdb69ac01..82178ef3f55bfeb899e400d75997a23187f351a4 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.All)]
        public sealed class PersistenceModeAttribute : Attribute
        {
@@ -62,10 +64,11 @@ namespace System.Web.UI {
 
                public override bool Equals (object obj)
                {
-                       if (!(obj is PersistenceModeAttribute))
+                       PersistenceModeAttribute pma = (obj as PersistenceModeAttribute);
+                       if (pma == null)
                                return false;
 
-                       return ((PersistenceModeAttribute) obj).mode == mode;
+                       return (pma.mode == mode);
                }
 
                public override int GetHashCode ()
index f9c49f0bdf13d72622f40a126543bad43c53030f..4aac6a373326b1d9e6be6a13aa8cdb679200e628 100644 (file)
 // Authors:
 //     Jackson Harper (jackson@ximian.com)
 //
-// (C) 2005 Novell, Inc.
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 
-using System;
 using System.Reflection;
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       public static class PropertyConverter {
+#else
        public sealed class PropertyConverter {
 
                private PropertyConverter ()
                {
                        // no instantiation for you
                }
-
+#endif
                public static object EnumFromString (Type enumType, string value)
                {
                        object res = null;
index 8bf44dc77a138d38f6521834b0ace658099abb4f..3eae34435a20a9ce8f69125e95d6eff0f83a22a7 100644 (file)
@@ -5,7 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2003 Ximian, Inc. (http://www.ximian.com)
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
+using System.Security.Permissions;
 using System.Web.Compilation;
 using System.Web.UI.HtmlControls;
 
-namespace System.Web.UI
-{
-       public sealed class RootBuilder : TemplateBuilder
-       {
+namespace System.Web.UI {
+
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public class RootBuilder : TemplateBuilder {
+
+               private Hashtable built_objects;
+
+               public RootBuilder ()
+               {
+               }
+#else
+       public sealed class RootBuilder : TemplateBuilder {
+#endif
                static Hashtable htmlControls;
                static Hashtable htmlInputControls;
                AspComponentFoundry foundry;
@@ -48,43 +59,60 @@ namespace System.Web.UI
                        htmlControls.Add ("A", typeof (HtmlAnchor));
                        htmlControls.Add ("BUTTON", typeof (HtmlButton));
                        htmlControls.Add ("FORM", typeof (HtmlForm));
+#if NET_2_0
+                       htmlControls.Add ("HEAD", typeof (HtmlHead));
+#endif
                        htmlControls.Add ("IMG", typeof (HtmlImage));
                        htmlControls.Add ("INPUT", "INPUT");
+#if NET_2_0
+                       htmlControls.Add ("LINK", typeof (HtmlLink));
+                       htmlControls.Add ("META", typeof (HtmlLink));
+#endif
                        htmlControls.Add ("SELECT", typeof (HtmlSelect));
                        htmlControls.Add ("TABLE", typeof (HtmlTable));
                        htmlControls.Add ("TD", typeof (HtmlTableCell));
                        htmlControls.Add ("TH", typeof (HtmlTableCell));
                        htmlControls.Add ("TR", typeof (HtmlTableRow));
                        htmlControls.Add ("TEXTAREA", typeof (HtmlTextArea));
-#if NET_2_0
-                       htmlControls.Add ("HEAD", typeof (HtmlHead));
-#endif
 
                        htmlInputControls = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
                                                      CaseInsensitiveComparer.DefaultInvariant); 
 
                        htmlInputControls.Add ("BUTTON", typeof (HtmlInputButton));
+#if NET_2_0
+                       htmlInputControls.Add ("SUBMIT", typeof (HtmlInputSubmit));
+                       htmlInputControls.Add ("RESET", typeof (HtmlInputReset));
+#else
                        htmlInputControls.Add ("SUBMIT", typeof (HtmlInputButton));
                        htmlInputControls.Add ("RESET", typeof (HtmlInputButton));
+#endif
                        htmlInputControls.Add ("CHECKBOX", typeof (HtmlInputCheckBox));
                        htmlInputControls.Add ("FILE", typeof (HtmlInputFile));
                        htmlInputControls.Add ("HIDDEN", typeof (HtmlInputHidden));
                        htmlInputControls.Add ("IMAGE", typeof (HtmlInputImage));
                        htmlInputControls.Add ("RADIO", typeof (HtmlInputRadioButton));
                        htmlInputControls.Add ("TEXT", typeof (HtmlInputText));
+#if NET_2_0
+                       htmlInputControls.Add ("PASSWORD", typeof (HtmlInputPassword));
+#else
                        htmlInputControls.Add ("PASSWORD", typeof (HtmlInputText));
+#endif
                }
 
                public RootBuilder (TemplateParser parser)
                {
                        foundry = new AspComponentFoundry ();
                        line = 1;
-                       fileName = parser.InputFile;
+                       if (parser != null)
+                               fileName = parser.InputFile;
                        Init (parser, null, null, null, null, null);
                }
 
                public override Type GetChildControlType (string tagName, IDictionary attribs) 
                {
+                       if (tagName == null)
+                               throw new ArgumentNullException ("tagName");
+
                        string prefix;
                        string cname;
                        int colon = tagName.IndexOf (':');
@@ -138,6 +166,16 @@ namespace System.Web.UI
                internal AspComponentFoundry Foundry {
                        get { return foundry; }
                }
+#if NET_2_0
+               // FIXME: it's empty (but not null) when using the new default ctor
+               // but I'm not sure when something should gets in...
+               public IDictionary BuiltObjects {
+                       get {
+                               if (built_objects == null)
+                                       built_objects = new Hashtable ();
+                               return built_objects;
+                       }
+               }
+#endif
        }
 }
-
index ec28beb30d219233c2ba6e97f51d1ad9d888d0dd..abebc8c50f3af0e911e4c35582d655b04abc98af 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.CodeDom.Compiler;
 using System.Collections;
 using System.IO;
 using System.Reflection;
+using System.Security.Permissions;
 using System.Text;
-using System.Web;
 using System.Web.Compilation;
 using System.Web.Configuration;
 using System.Web.Util;
 
 namespace System.Web.UI
 {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public abstract class SimpleWebHandlerParser
        {
                HttpContext context;
index d35cf0f522cc20b7fb5d48cb2b5d164f41350b76..946a07c81f103872ccac8b9fa24937533720733b 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //        Ben Maurer <bmaurer@novell.com>
 //
-// (c) 2005 Novell
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 
 using System.Collections;
 using System.Collections.Specialized;
+using System.Security.Permissions;
 
-namespace System.Web.UI 
-{
-       
+namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class StateBag : IDictionary, IStateManager {
 
                HybridDictionary ht;
@@ -277,11 +278,6 @@ namespace System.Web.UI
                                si.IsDirty = dirty;
                        }
                }
-
-               internal void SetDirty ()
-               {
-                       // Just lets me compile
-               }
 #endif
        }
 }
index 2cffd164ccfbfad8e17edf62088a1b256a3516a0..78f49ac3bd3669823d280da5fb499e6ea973682e 100644 (file)
@@ -5,8 +5,7 @@
 //   Bob Smith <bob@thestuff.net>\r
 //\r
 // (C) Bob Smith\r
-//\r
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 \r
-using System;\r
-using System.Web;\r
+using System.Security.Permissions;
+\r
+namespace System.Web.UI {
 \r
-namespace System.Web.UI\r
-{\r
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
         public sealed class StateItem\r
         {\r
                 private bool _isDirty = false;\r
index 4ab2af9870b074b89529a68e09737816dffecc13..eaeea7106dad3b6352998895899430a888db8163 100644 (file)
@@ -5,8 +5,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2003 Andreas Nahr
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI {
 
-namespace System.Web.UI
-{
-       public class StaticPartialCachingControl : BasePartialCachingControl
-       {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public class StaticPartialCachingControl : BasePartialCachingControl {
 
                private BuildMethod buildMethod;
 
diff --git a/mcs/class/System.Web/System.Web.UI/SupportsEventValidationAttribute.cs b/mcs/class/System.Web/System.Web.UI/SupportsEventValidationAttribute.cs
new file mode 100644 (file)
index 0000000..8862941
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.SupportsEventValidationAttribute class
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Security.Permissions;
+
+namespace System.Web.UI {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
+       [AttributeUsage (AttributeTargets.Class)]
+       public sealed class SupportsEventValidationAttribute : Attribute {
+
+               public SupportsEventValidationAttribute ()
+               {
+               }
+       }
+}
+
+#endif
index b454cf12e52dce1abe296ff1dcc8712d0c546017..006413e0dd4f79c2a80e6c38b1af02da96b071ac 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)]
        public sealed class TagPrefixAttribute : Attribute
        {
@@ -40,8 +42,10 @@ namespace System.Web.UI {
                public TagPrefixAttribute (string namespaceName,
                                           string tagPrefix)
                {
-                       if (namespaceName == null || tagPrefix == null)
-                               throw new ArgumentNullException ();
+                       if ((namespaceName == null) || (namespaceName.Length == 0))
+                               throw new ArgumentNullException ("namespaceName");
+                       if ((tagPrefix == null) || (tagPrefix.Length == 0))
+                               throw new ArgumentNullException ("tagPrefix");
 
                        this.namespaceName = namespaceName;
                        this.tagPrefix = tagPrefix;
index 9a30ef94609bc07b7e810493dae046b2021f3b74..eaf72d8244a494b37e0c5a18e859f696097706ec 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2003 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.Reflection;
+using System.Security.Permissions;
 #if NET_2_0
 using System.ComponentModel;
 #endif
 
-namespace System.Web.UI
-{
-       public class TemplateBuilder : ControlBuilder, ITemplate
-       {
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public class TemplateBuilder : ControlBuilder, ITemplate {
+
                string text;
                TemplateContainerAttribute containerAttribute;
 #if NET_2_0
@@ -80,6 +82,12 @@ namespace System.Web.UI
                internal ICollection Bindings {
                        get { return bindings; }
                }
+
+               [MonoTODO ("why override?")]
+               public override object BuildObject ()
+               {
+                       return base.BuildObject ();
+               }
 #endif
 
                public override void Init (TemplateParser parser,
index aac8d003efc89b068106056740f92168e14a33c5..e51f42b9659f516901ac4b73994839e66d023738 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Property)]
        public sealed class TemplateContainerAttribute : Attribute
        {
index e224979822702512127996ee85ffd691ae33cb42..7a896b9b8a66ef54ab4b5af1c9ca4905b067e783 100644 (file)
@@ -7,8 +7,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.ComponentModel;
 using System.Reflection;
-using System.Web;
+using System.Security.Permissions;
 using System.Web.Compilation;
 using System.Web.Util;
 
 namespace System.Web.UI {
 
-       public abstract class TemplateControl : Control, INamingContainer
-       {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       public abstract class TemplateControl : Control, INamingContainer, IFilterResolutionService {
+#else
+       public abstract class TemplateControl : Control, INamingContainer {
+#endif
                static object abortTransaction = new object ();
                static object commitTransaction = new object ();
                static object error = new object ();
@@ -158,6 +162,13 @@ namespace System.Web.UI {
 
                public Control LoadControl (string virtualPath)
                {
+#if NET_2_0
+                       if (virtualPath == null)
+                               throw new ArgumentNullException ("virtualPath");
+#else
+                       if (virtualPath == null)
+                               throw new HttpException ("virtualPath is null");
+#endif
                        object control = Activator.CreateInstance (GetTypeFromControlPath (virtualPath));
                        if (control is UserControl)
                                ((UserControl) control).InitializeAsUserControl (Page);
@@ -167,6 +178,13 @@ namespace System.Web.UI {
 
                public ITemplate LoadTemplate (string virtualPath)
                {
+#if NET_2_0
+                       if (virtualPath == null)
+                               throw new ArgumentNullException ("virtualPath");
+#else
+                       if (virtualPath == null)
+                               throw new HttpException ("virtualPath is null");
+#endif
                        Type t = GetTypeFromControlPath (virtualPath);
                        return new SimpleTemplate (t);
                }
@@ -195,6 +213,9 @@ namespace System.Web.UI {
                [MonoTODO]
                public Control ParseControl (string content)
                {
+                       if (content == null)
+                               throw new ArgumentNullException ("content");
+
                        return null;
                }
 
@@ -202,6 +223,9 @@ namespace System.Web.UI {
                [EditorBrowsable (EditorBrowsableState.Never)]
                public static object ReadStringResource (Type t)
                {
+                       if (t == null)
+                               throw new ArgumentNullException ("t");
+
                        return null;
                }
 
@@ -313,7 +337,20 @@ namespace System.Web.UI {
        {
                return XPathBinder.Select (CurrentDataItem, xpathexpression);
        }
-#endif
 
+               // IFilterResolutionService
+
+               [MonoTODO]
+               int IFilterResolutionService.CompareFilters (string filter1, string filter2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               bool IFilterResolutionService.EvaluateFilter (string filterName)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
        }
 }
index 6c185ebc3171cdd4a0081f544bd5d237aa85e86a..65e1663c8ca63f32843c8f9e4ffb4fd98ca208ad 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Collections;
 using System.IO;
 using System.Reflection;
+using System.Security.Permissions;
 using System.Web.Compilation;
 using System.Web.Util;
 
-namespace System.Web.UI
-{
-       public abstract class TemplateControlParser : TemplateParser
-       {
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public abstract class TemplateControlParser : TemplateParser {
+
                bool autoEventWireup = true;
                bool enableViewState = true;
 
index 842b2211491f0212d0cf885da2df25aa43fa8428..7994f5c004f8fccdffdeff4b0d3b5088cf76fd17 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002,2003 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.CodeDom.Compiler;
 using System.Collections;
 using System.IO;
 using System.Reflection;
-using System.Web;
+using System.Security.Permissions;
 using System.Web.Compilation;
 using System.Web.Configuration;
 using System.Web.Util;
 
-namespace System.Web.UI
-{
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public abstract class TemplateParser : BaseParser
        {
                string inputFile;
@@ -409,29 +411,35 @@ namespace System.Web.UI
                internal virtual void ProcessMainAttributes (Hashtable atts)
                {
                        atts.Remove ("Description"); // ignored
+#if NET_1_1
                        atts.Remove ("CodeBehind");  // ignored
-                       atts.Remove ("AspCompat"); // ignored
-
-#if NET_2_0
-                       atts.Remove ("CodeFile"); // ignored
 #endif
+                       atts.Remove ("AspCompat"); // ignored
 
                        debug = GetBool (atts, "Debug", true);
                        compilerOptions = GetString (atts, "CompilerOptions", "");
                        language = GetString (atts, "Language", CompilationConfig.DefaultLanguage);
                        strictOn = GetBool (atts, "Strict", CompilationConfig.Strict);
                        explicitOn = GetBool (atts, "Explicit", CompilationConfig.Explicit);
+#if NET_2_0
+                       string src = GetString (atts, "CodeFile", null);
+#else
                        string src = GetString (atts, "Src", null);
+#endif
                        if (src != null)
                                srcAssembly = GetAssemblyFromSource (src);
 
                        string inherits = GetString (atts, "Inherits", null);
+#if NET_2_0
+                       className = inherits;
+#else
                        if (inherits != null)
                                SetBaseType (inherits);
 
                        className = GetString (atts, "ClassName", null);
                        if (className != null && !CodeGenerator.IsValidLanguageIndependentIdentifier (className))
                                ThrowParseException (String.Format ("'{0}' is not valid for 'className'", className));
+#endif
 
                        if (atts.Count > 0)
                                ThrowParseException ("Unknown attribute: " + GetOneKey (atts));
index 32c30443e84a3d3b0fcf62a0043fd0013efa527f..ce56822f3543d04954af0360a2c6f16b5c6e229d 100644 (file)
@@ -5,8 +5,7 @@
 //     Sanjay Gupta (gsanjay@novell.com)
 //
 // (C) 2004 Novell, Inc. (http://www.novell.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
 #if NET_2_0
-using System;
+
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]          
-       public sealed class ThemeableAttribute : Attribute, IDisposable 
-       {
+       public sealed class ThemeableAttribute : Attribute {
+
                private bool themeable;
                private bool dispose;
 
@@ -54,20 +58,6 @@ namespace System.Web.UI {
                        get { return themeable; } 
                }
 
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-               
-               private void Dispose (bool disposing)
-               {
-                       if (!this.dispose){
-                               //Do nothing
-                               this.dispose = true;
-                       }
-               }
-
                public override bool Equals (object obj)
                {
                        if (obj != null && obj is ThemeableAttribute) {
@@ -89,7 +79,6 @@ namespace System.Web.UI {
 
                public static bool IsObjectThemeable (object obj)
                {
-                       
                        return IsTypeThemeable (obj.GetType ());
                }
 
index 96222e3411fd713b3851f7c55516fe80fc89538d..a0bd041e83f67a9501de523b98216ce3407816b1 100644 (file)
 // Authors:
 //     Jackson Harper (jackson@ximian.com)
 //
-// (C) 2005 Novell, Inc.
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage(AttributeTargets.Class)]
        public sealed class ToolboxDataAttribute : Attribute {
 
@@ -57,13 +60,17 @@ namespace System.Web.UI {
                public override int GetHashCode ()
                {
                        if (data == null)
-                               return 0;
+                               return -1;
                        return data.GetHashCode ();
                }
 
                public override bool IsDefaultAttribute ()
                {
-                       return Equals (Default);
+#if NET_2_0
+                       return ((data == null) || (data.Length == 0));
+#else
+                       return ((data != null) && (data.Length == 0));
+#endif
                }
        }
 }
index c3d3046adb5b98ca5cbb3744a8723a3be9ba513c..f27de1fd5ccdf50463c0e3c7e7e1b20738d34812 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 #if NET_2_0
        [Serializable]
-       sealed
+       public sealed class Triplet {
+#else
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public class Triplet {
 #endif
-       public class Triplet
-       {
                public object First;
                public object Second;
                public object Third;
index 6928feb7662a36a8a724067d871a7c067552fd2e..852f1020c72b3c6d7f792238e812730bbac51b4d 100644 (file)
@@ -3,6 +3,7 @@
 //
 // Authors:
 //     Sanjay Gupta (gsanjay@novell.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
@@ -35,13 +36,10 @@ namespace System.Web.UI {
        [AttributeUsage (AttributeTargets.Property, AllowMultiple = false, Inherited = true)]           
        public sealed class UrlPropertyAttribute : Attribute 
        {
-               private string filter = "*.*";
-               private UrlTypes urlTypes = UrlTypes.Absolute |
-                                        UrlTypes.AppRelative |
-                                        UrlTypes.DocRelative |
-                                        UrlTypes.RootRelative;
+               private string filter;
 
                public UrlPropertyAttribute () 
+                       : this ("*.*")
                {                       
                }
 
@@ -55,19 +53,13 @@ namespace System.Web.UI {
                        get { return filter; } 
                }
 
-               public UrlTypes AllowedTypes {
-                       get { return urlTypes; }
-                       set { urlTypes = value; }
-               }
-               
                public override bool Equals (object obj)
                {
-                       if (obj != null && obj is UrlPropertyAttribute) {
-                               UrlPropertyAttribute upa = (UrlPropertyAttribute)obj;
-                               return (filter.Equals (upa.Filter) 
-                                       && urlTypes.Equals (upa.AllowedTypes));
-                       }
-                       return false;
+                       UrlPropertyAttribute upa = (obj as UrlPropertyAttribute);
+                       if (upa == null)
+                               return false;
+
+                       return (filter.Equals (upa.Filter));
                }
 
                public override int GetHashCode ()
index 695f5241bfcf329a69735875947d2781cc1e1641..298e0653daab202472fb8e063a6f7d0b8ac6ab2d 100644 (file)
@@ -6,8 +6,7 @@
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.ComponentModel;
 using System.ComponentModel.Design;
 using System.ComponentModel.Design.Serialization;
+using System.Security.Permissions;
 using System.Web.Caching;
 using System.Web.SessionState;
 
-namespace System.Web.UI
-{
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ControlBuilder (typeof (UserControlControlBuilder))]
        [DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
        [ToolboxItem (false)]
        [Designer ("System.Web.UI.Design.UserControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
-       [RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
 #if NET_2_0
        [Designer ("Microsoft.VisualStudio.Web.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VisualStudio_Web, typeof (IRootDesigner))]
        [ParseChildren (true, "", ChildControlType = typeof (Control))]
 #else
+       [RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
        [ParseChildren (true)]
 #endif
        public class UserControl : TemplateControl, IAttributeAccessor, IUserControlDesignerAccessor
 #if NET_2_0
-       , INamingContainer
+       , INamingContainer, IFilterResolutionService
 #endif
        {
                private bool initialized;
@@ -59,7 +63,6 @@ namespace System.Web.UI
 
                public UserControl ()
                {
-                       //??
                }
 
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
@@ -89,6 +92,7 @@ namespace System.Web.UI
                public AttributeCollection Attributes
                {
                        get {
+                               EnsureAttributes ();
                                return attributes;
                        }
                }
@@ -280,6 +284,18 @@ namespace System.Web.UI
                        }
                        set { ViewState["!DesignTimeTagName"] = value; }
                }
+#if NET_2_0
+               [MonoTODO]
+               int IFilterResolutionService.CompareFilters (string filter1, string filter2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               bool IFilterResolutionService.EvaluateFilter (string filterName)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
        }
 }
-
index 2f25376bd5418f1e64a97d660c40eb3357675122..ae1c8b9d068f6d32ca4ccf91be4556b62e342edb 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2003 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-namespace System.Web.UI
-{
+using System.Security.Permissions;
+
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class UserControlControlBuilder : ControlBuilder
        {
                public override bool NeedsTagInnerText ()
@@ -42,6 +46,12 @@ namespace System.Web.UI
                {
                        // Do something with the text
                }
+#if NET_2_0
+               [MonoTODO ("why override?")]
+               public override object BuildObject ()
+               {
+                       return base.BuildObject ();
+               }
+#endif
        }
 }
-
index 57a337f98417674ecc9d6374f8554309181b10ae..d8aed37860a4f98806d1ed03b0fa1aedac75bcdd 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.Class)]
        public sealed class ValidationPropertyAttribute : Attribute
        {
index 18f11146efd0907acc1493c177b2075da110f9c3..13d8ea689a15eac1b5f0fe505125454a6e742eff 100644 (file)
@@ -6,7 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class ValidatorCollection : ICollection, IEnumerable
        {
                private ArrayList _validators;
index 4b4d7bbf8105a33e068839ea82c32543c73063ee..bda53b023b6ad074756497391be07f873c74fd91 100644 (file)
@@ -5,8 +5,7 @@
 //     Ben Maurer (bmaurer@users.sourceforge.net)
 //
 // (C) 2003 Ben Maurer
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -27,7 +26,9 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
 namespace System.Web.UI {
+
        [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
 #if NET_2_0
        public
@@ -35,18 +36,28 @@ namespace System.Web.UI {
        internal
 #endif
        sealed class WebResourceAttribute : Attribute {
-               public WebResourceAttribute (string webResource, string contentType) : this (webResource, contentType, false) {}
-               public WebResourceAttribute (string webResource, string contentType, bool performSubstitution)
+
+               public WebResourceAttribute (string webResource, string contentType)
                {
                        this.webResource = webResource;
                        this.contentType = contentType;
-                       this.performSubstitution = performSubstitution;
                }
+
                
-               public string ContentType { get { return contentType; } }
-               public bool PerformSubstitution { get { return performSubstitution; } }
-               public string WebResource { get { return webResource; } }
-               
+               public string ContentType {
+                       get { return contentType; }
+               }
+
+               public bool PerformSubstitution {
+                       get { return performSubstitution; }
+                       set { performSubstitution = value; }
+               }
+
+               public string WebResource {
+                       get { return webResource; }
+               }
+
+
                bool performSubstitution;
                string webResource, contentType;
        }
index 694b57da961f8f91c5837eff04b1d7e4919190d0..ebcddb76b0b4187081e62ecfdf6aa7e905d86696 100644 (file)
@@ -5,8 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Web;
+using System.Security.Permissions;
 using System.Web.Compilation;
 
-namespace System.Web.UI
-{
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class WebServiceParser : SimpleWebHandlerParser
        {
                private WebServiceParser (HttpContext context, string virtualPath, string physicalPath)
index 981497b594cec4bb65b8dda9be9faa598194b3e5..b332cada533cd22db7ace5b4ceeb4ce0e2cbc588 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-11  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * IWebObjectFactory.cs: New. 2.0 interface.
+       * IWebPropertyAccessor.cs: New. 2.0 interface.
+       * Transactions.cs: Added [Link|Inheritance]Demand for Minimal.
+       * WorkItem.cs: Added [Link|Inheritance]Demand for Minimal. Added 
+       Demand for UnmanagedCode on the static Post method,
+
 2005-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * UrlUtils.cs: removed 2 unused methods. IsRelativeUrl returns false if
diff --git a/mcs/class/System.Web/System.Web.Util/IWebObjectFactory.cs b/mcs/class/System.Web/System.Web.Util/IWebObjectFactory.cs
new file mode 100644 (file)
index 0000000..c3d60f4
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// System.Web.Util.IWebObjectFactory interface
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Web.Util {
+
+       public interface IWebObjectFactory {
+
+               object CreateInstance ();
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Util/IWebPropertyAccessor.cs b/mcs/class/System.Web/System.Web.Util/IWebPropertyAccessor.cs
new file mode 100644 (file)
index 0000000..fa87329
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// System.Web.Util.IWebPropertyAccessor interface
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Web.Util {
+
+       public interface IWebPropertyAccessor {
+
+               object GetProperty (object target);
+               void SetProperty (object target, object value);
+       }
+}
+
+#endif
index 340abf776fef993945cc93fdb32b5179bc0d7991..272a164294be3855ff1405e42e55fbd7b17f309f 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.EnterpriseServices;
+using System.Security.Permissions;
 
 namespace System.Web.Util
 {
+       [MonoTODO]
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class Transactions
        {
                public Transactions ()
@@ -47,6 +51,8 @@ namespace System.Web.Util
                                                        TransactionOption mode, 
                                                        ref bool transactionAborted)
                {
+                       // note: this is the documented exception for (Windows) OS prior to NT
+                       // so in this case we won't throw a NotImplementedException
                        throw new PlatformNotSupportedException ("Not supported on mono");
                }
        }
index 92361e4bfb85aff6f61617a1e0e68d70a9c2ba02..7aba89f563ed3bcd5d742c9a5607ed8961c3294b 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
 //
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.Util
 {
+       [MonoTODO]
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class WorkItem
        {
                public WorkItem ()
                {
                }
 
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public static void Post (WorkItemCallback callback)
                {
+                       // note: this is the documented exception for (Windows) OS prior to NT
+                       // so in this case we won't throw a NotImplementedException
                        throw new PlatformNotSupportedException ("Not supported on mono");
                }
        }
index 5ba95eeb9eb81d6155b3e626f584208d5e11d462..97b18d970421029782508168823eaa4800b91ee4 100644 (file)
@@ -98,6 +98,7 @@ System.Web.Configuration/TraceConfigurationHandler.cs
 System.Web.Configuration/TraceDisplayMode.cs
 System.Web.Configuration/VirtualDirectoryMappingCollection.cs
 System.Web.Configuration/VirtualDirectoryMapping.cs
+System.Web.Configuration/WebApplicationLevel.cs
 System.Web.Configuration/WebConfigurationFileMap.cs
 System.Web.Configuration/WebConfigurationHost.cs
 System.Web.Configuration/WebConfigurationManager.cs
@@ -151,6 +152,7 @@ System.Web/HttpRequestPriority.cs
 System.Web/HttpRequestValidationException.cs
 System.Web/HttpResponseHeader.cs
 System.Web/HttpResponseStream.cs
+System.Web/HttpResponseSubstitutionCallback.cs
 System.Web/HttpResponse.cs
 System.Web/HttpRuntime.cs
 System.Web/HttpServerUtility.cs
@@ -178,7 +180,6 @@ System.Web.Mail/MailMessage.cs
 System.Web.Mail/MailMessageWrapper.cs
 System.Web.Mail/MailPriority.cs
 System.Web.Mail/MailUtil.cs
-System.Web.Mail/RelatedBodyPart.cs
 System.Web.Mail/SmtpClient.cs
 System.Web.Mail/SmtpException.cs
 System.Web.Mail/SmtpMail.cs
@@ -285,6 +286,8 @@ System.Web/StaticFileHandler.cs
 System.Web/StaticSiteMapProvider.cs
 System.Web/TimeoutManager.cs
 System.Web/TraceContext.cs
+System.Web/TraceContextEventArgs.cs
+System.Web/TraceContextEventHandler.cs
 System.Web/TraceData.cs
 System.Web/TraceManager.cs
 System.Web/TraceMode.cs
@@ -363,6 +366,8 @@ System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
 System.Web.UI.HtmlControls/HtmlInputReset.cs
 System.Web.UI.HtmlControls/HtmlInputSubmit.cs
 System.Web.UI.HtmlControls/HtmlInputText.cs
+System.Web.UI.HtmlControls/HtmlLink.cs
+System.Web.UI.HtmlControls/HtmlMeta.cs
 System.Web.UI.HtmlControls/HtmlSelectBuilder.cs
 System.Web.UI.HtmlControls/HtmlSelect.cs
 System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
@@ -405,7 +410,6 @@ System.Web.UI.Imaging/StorageType.cs
 System.Web.UI/IMobileTextWriter.cs
 System.Web.UI/INamingContainer.cs
 System.Web.UI/INavigateUIData.cs
-System.Web.UI/IPageHeader.cs
 System.Web.UI/IPaginationContainer.cs
 System.Web.UI/IPaginationInfo.cs
 System.Web.UI/IParserAccessor.cs
@@ -431,6 +435,7 @@ System.Web.UI/LiteralControl.cs
 System.Web.UI/LosFormatter.cs
 System.Web.UI/MasterPage.cs
 System.Web.UI/MasterPageParser.cs
+System.Web.UI/MinimizableAttributeTypeConverter.cs
 System.Web.UI/NonVisualControlAttribute.cs
 System.Web.UI/ObjectConverter.cs
 System.Web.UI/ObjectStateFormatter.cs
@@ -460,6 +465,7 @@ System.Web.UI/StateBag.cs
 System.Web.UI/StateItem.cs
 System.Web.UI/StateManagedCollection.cs
 System.Web.UI/StaticPartialCachingControl.cs
+System.Web.UI/SupportsEventValidationAttribute.cs
 System.Web.UI/TagPrefixAttribute.cs
 System.Web.UI/TemplateBuilder.cs
 System.Web.UI/TemplateContainerAttribute.cs
@@ -473,7 +479,6 @@ System.Web.UI/ToolboxDataAttribute.cs
 System.Web.UI/Triplet.cs
 System.Web.UI/TwoWayBoundPropertyEntry.cs
 System.Web.UI/UrlPropertyAttribute.cs
-System.Web.UI/UrlTypes.cs
 System.Web.UI/UserControlControlBuilder.cs
 System.Web.UI/UserControl.cs
 System.Web.UI/UserControlParser.cs
@@ -913,6 +918,8 @@ System.Web.Util/AltSerialization.cs
 System.Web.Util/DataSourceHelper.cs
 System.Web.Util/DataSourceResolver.cs
 System.Web.Util/ICalls.cs
+System.Web.Util/IWebObjectFactory.cs
+System.Web.Util/IWebPropertyAccessor.cs
 System.Web.Util/StrUtils.cs
 System.Web.Util/TimeUtil.cs
 System.Web.Util/TransactedCallback.cs
index aa415d41b88f56fd179715d4159e1531252dbdec..6894fedd93154c4aa238fd6e1fc7b4ccf4275e42 100644 (file)
@@ -2,12 +2,13 @@
        <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{FBDAB5E6-450A-4149-AC1C-5AC3E4908FCE}">\r
                <Build>\r
                        <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="System.Web" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="System.Web" RunPostBuildEvent="OnBuildSuccess" StartupObject="">\r
-                               <Config Name="Debug" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="false" OutputPath="bin\Debug\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
-                               <Config Name="Release" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY" DocumentationFile="" DebugSymbols="false" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="true" OutputPath="bin\Release\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
-                               <Config Name="Debug_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="false" OutputPath="bin\Debug_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
-                               <Config Name="Release_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="true" OutputPath="bin\Release_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                               <Config Name="Debug" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY;ONLY_1_1" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="false" OutputPath="bin\Debug\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                               <Config Name="Release" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY;ONLY_1_1" DocumentationFile="" DebugSymbols="false" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="true" OutputPath="bin\Release\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                               <Config Name="Debug_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY;ONLY_1_1" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="false" OutputPath="bin\Debug_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                               <Config Name="Release_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_J2EE;TARGET_JVM;GH_ONLY;ONLY_1_1" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595,169,649,67,168,219" Optimize="true" OutputPath="bin\Release_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
                        </Settings>\r
                        <References>\r
+                               <Reference Name="System.EnterpriseServices" AssemblyName="System.EnterpriseServices" Private="False"/>\r
                                <Reference Name="System.Xml" AssemblyName="System.Xml" HintPath="..\lib\System.Xml.dll" Private="False"/>\r
                                <Reference Name="SystemDll" AssemblyName="System" HintPath="..\lib\System.dll" Private="True"/>\r
                                <Reference Name="System.Drawing" AssemblyName="System.Drawing" HintPath="..\lib\System.Drawing.dll" Private="True"/>\r
                        <Include>\r
                                <File RelPath="jar.resources" BuildAction="None"/>\r
                                <File RelPath="Locale.cs" Link="..\..\build\common\Locale.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Consts.cs" Link="..\..\build\common\Consts.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="MonoTODOAttribute.cs" Link="..\..\build\common\MonoTODOAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Mail\ChangeLog" BuildAction="None"/>\r
                                <File RelPath="Assembly\AssemblyInfo.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="Assembly\Consts.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\ApplicationShutdownReason.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\BeginEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web\BrowserCapabilities.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\CapabilitiesLoader.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\EndEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HtmlizedException.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpApplication.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpApplicationFactory.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpApplicationState.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\HttpAsyncResult.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpBrowserCapabilities.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\HttpCacheability.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpCachePolicy.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpCacheRevalidation.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpCacheValidateHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpCacheVaryByHeaders.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpCacheVaryByParams.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web\HttpCacheability.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpClientCertificate.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpCompileException.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpContext.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpException.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpFileCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpForbiddenHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\HttpHelper.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpMethodNotAllowedHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpModuleCollection.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\HttpMultipartContentParser.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpParseException.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpPostedFile.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpRequest.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpRequestPriority.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\HttpRequestStream.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpRequestValidationException.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpResponse.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpResponseHeader.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpResponseStream.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\HttpResponseStreamProxy.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpRuntime.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpServerUtility.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpStaticObjectsCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpUnhandledException.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpUtility.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpValidationStatus.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\HttpValueCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpWorkerRequest.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\HttpWriter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\IHttpAsyncHandler.cs" SubType="Code" BuildAction="Compile"/>\r
@@ -88,7 +85,6 @@
                                <File RelPath="System.Web\ProcessShutdownReason.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\ProcessStatus.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\QueueManager.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web\ReusableMemoryStream.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\ServerVariablesCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\SiteMap.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\SiteMapNode.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\SiteMapResolveEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\StaticFileHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\StaticSiteMapProvider.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web\TimeoutManager.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\TraceContext.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\TraceData.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\TraceManager.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\TraceMode.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\WebCategoryAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web\WebROCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\WebSysDescriptionAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web\XmlSiteMapProvider.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Administration\WebAdminUserControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Caching\Cache.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Caching\CacheDefinitions.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Caching\CacheDependency.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Caching\CacheItemPriority.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Caching\CacheItemRemovedCallback.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Caching\CacheItemRemovedReason.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Caching\CachedRawResponse.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Caching\CachedVaryBy.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Caching\CacheEntry.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Caching\CacheExpires.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Caching\ExpiresBuckets.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Caching\OutputCacheModule.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Compilation\ILocation.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Compilation\Location.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\BuildProvider.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\BuildProviderAppliesTo.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\BuildProviderCollection.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Configuration\ClientTargetSectionHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\CodeSubDirectoriesCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\CodeSubDirectory.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\CompilationSection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\CustomErrorsMode.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\ExpressionBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\ExpressionBuilderCollection.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Configuration\FormsAuthenticationConfiguration.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\FormsAuthPasswordFormat.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Configuration\FormsAuthenticationConfiguration.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\FormsProtectionEnum.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\GlobalizationConfiguration.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\GlobalizationConfigurationHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\HandlerFactoryConfiguration.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Configuration\HandlerFactoryProxy.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Configuration\HandlerItem.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\HttpCapabilitiesBase.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\HttpConfigurationContext.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\HttpHandlersSectionHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\HttpModulesConfigurationHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\HttpRuntimeConfig.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\HttpRuntimeConfigurationHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Configuration\InternalSection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\IRemoteWebConfigurationHostServer.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Configuration\InternalSection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\MachineKeyConfig.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\MachineKeyConfigHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\MachineKeyValidation.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\MembershipSection.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Configuration\ModuleItem.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\ModulesConfiguration.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\PagesConfiguration.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\PagesConfigurationHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\PagesEnableSessionState.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\PagesToCountAction.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Configuration\PassportAuthentication.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\ProcessModelComAuthenticationLevel.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\ProcessModelComImpersonationLevel.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Configuration\ProcessModelLogLevel.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Handlers\AssemblyResourceLoader.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Handlers\TraceHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Hosting\IAppDomainFactory.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Hosting\IApplicationHost.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Hosting\IAppManagerAppDomainFactory.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Hosting\IApplicationHost.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Hosting\IHttpWorkerRequestHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Hosting\IProcessHost.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Hosting\IProcessHostFactoryHelper.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.J2EE\PageMapper.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.J2EE\SessionListener.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Mail\Base64AttachmentEncoder.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Mail\ChangeLog" BuildAction="None"/>\r
                                <File RelPath="System.Web.Mail\IAttachmentEncoder.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Mail\MailAddress.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Mail\MailAddressCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Management\WebBaseEvent.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Management\WebEventFormatter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Profile\ProfileAuthenticationOption.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Profile\ProfileInfo.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\ActiveDirectoryMembershipProvider.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\AnonymousIdentificationEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\AnonymousIdentificationEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\Membership.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipCreateStatus.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipCreateUserException.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Security\MembershipOnlineStatus.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipPasswordException.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipPasswordFormat.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipProvider.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipProviderCollection.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Security\MembershipSortOptions.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipUser.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipUserCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\MembershipValidatePasswordEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Security\PassportAuthenticationEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Security\PassportAuthenticationEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Security\PassportAuthenticationModule.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Security\PassportIdentity.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\RoleManagerEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\RoleManagerEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Security\RoleManagerModule.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.SessionState\ISessionIDModule.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.SessionState\ISessionStateItemCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.SessionState\IStateRuntime.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.SessionState\RemoteStateServer.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.SessionState\SessionConfig.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.SessionState\SessionDictionary.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.SessionState\SessionId.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\Control.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ControlBuilder.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ControlBuilderAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\ControlCachePolicy.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ControlCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ControlSkinProc.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ControlValuePropertyAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\DataSourceView.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\DataSourceViewOperationCallback.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\DataSourceViewSelectCallback.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI\DesignerDataBoundLiteralControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\DesignTimeParseData.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\DesignerDataBoundLiteralControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\EmptyControlCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ExpressionBinding.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ExpressionBindingCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\HtmlTextWriterAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\HtmlTextWriterStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\HtmlTextWriterTag.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\IAdaptableTextWriter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IAttributeAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IBindableTemplate.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ICallbackEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IControlBuilderAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IControlDesignerAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IControlTypeFilter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\IDReferencePropertyAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IDataBindingsAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IDataItemContainer.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IDataSource.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IDataSourceViewSchemaAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI\IDReferencePropertyAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IEditableTextControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IExpressionsAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IFilterResolutionService.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI\IgnoreUnknownContentAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IHierarchicalDataSource.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IHierarchicalEnumerable.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IHierarchyData.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IItemPaginationInfo.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI\ImageClickEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI\ImageClickEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IMobileTextWriter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\INamingContainer.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\INavigateUIData.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IUserControlDesignerAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IUserControlTypeResolutionService.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\IValidator.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\IgnoreUnknownContentAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\ImageClickEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\ImageClickEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\KeyedList.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\KeyedListEnumerator.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ListSourceHelper.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\OutputCacheLocation.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\Page.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\PageHandlerFactory.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\PageStatePersister.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\Pair.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ParseChildrenAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\PartialCachingAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\UrlTypes.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\UserControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\UserControlControlBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI\Utils.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ValidationPropertyAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\ValidatorCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\VerificationConditionalOperator.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\VerificationReportLevel.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\VerificationRule.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\WebResourceAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI\XhtmlMobileDocType.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI\XPathBinder.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI\XhtmlMobileDocType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.Adapters\ControlAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.Adapters\PageAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.Adapters\WmlPostFieldType.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlAnchor.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlButton.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlContainerControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlControlBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.HtmlControls\HtmlEmptyTagControlBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlForm.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlGenericControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlHead.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlInputFile.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlInputHidden.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlInputImage.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.HtmlControls\HtmlInputPassword.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlInputRadioButton.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.HtmlControls\HtmlInputReset.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlInputText.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlSelect.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.HtmlControls\HtmlSelectBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\BorderStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\BoundColumn.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\BoundField.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\BulletStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\BulletedList.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\BulletedListDisplayMode.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\BulletedListEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\BulletedListEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\BulletStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\Button.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ButtonColumn.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ButtonColumnType.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataGridItemCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataGridItemEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataGridItemEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DataGridLinkButton.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataGridPageChangedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataGridPageChangedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DataGridPagerStyle.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\DataGridPagerStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataGridSortCommandEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataGridSortCommandEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DataGridTableInternal.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataKey.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataKeyArray.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataKeyCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataListItemCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataListItemEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DataListItemEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DataSourceInternal.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DayNameFormat.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DayRenderEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DayRenderEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsView.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewCommandEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewCommandEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DetailsViewDeletedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DetailsViewDeletedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewDeleteEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewDeleteEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DetailsViewInsertedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DetailsViewInsertedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\DetailsViewDeletedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\DetailsViewDeletedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewInsertEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewInsertEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\DetailsViewInsertedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\DetailsViewInsertedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewMode.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewModeEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewModeEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewPageEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewRow.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewRowCollection.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DetailsViewUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\DetailsViewUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewUpdateEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DetailsViewUpdateEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\DetailsViewUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\DetailsViewUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\DropDownList.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\EditCommandColumn.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FirstDayOfWeek.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormView.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewCommandEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewCommandEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\FormViewDeletedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\FormViewDeletedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewDeleteEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewDeleteEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\FormViewInsertedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\FormViewInsertedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\FormViewDeletedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\FormViewDeletedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewInsertEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewInsertEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\FormViewInsertedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\FormViewInsertedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewMode.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewModeEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewModeEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewPageEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewPageEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewRow.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\FormViewUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\FormViewUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewUpdateEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\FormViewUpdateEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\FormViewUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\FormViewUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridLines.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridView.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewCancelEditEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewCancelEditEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewCommandEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewCommandEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\GridViewDeletedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\GridViewDeletedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewDeleteEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewDeleteEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\GridViewDeletedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\GridViewDeletedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewEditEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewEditEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewPageEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewSelectEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewSortEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewSortEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\GridViewUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\GridViewUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewUpdateEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\GridViewUpdateEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\GridViewUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\GridViewUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\HiddenField.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\HierarchicalDataBoundControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\HorizontalAlign.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\IButtonControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ICallbackContainer.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ICompositeControlDesignerAccessor.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\IPostBackContainer.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\IRepeatInfoUser.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\Image.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ImageAlign.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ImageButton.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ImageMap.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ImageMapEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ImageMapEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\IPostBackContainer.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\IRepeatInfoUser.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\Label.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LabelControlBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LinkButton.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LinkButtonControlBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\LinkButtonInternal.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ListBox.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ListControl.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ListItem.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LiteralControlBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LiteralMode.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\Localize.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\Login.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\LoginCancelEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\LoginCancelEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LoginFailureAction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\LoginName.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\LoginStatus.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LoginTextLayout.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\LoginView.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\LogoutAction.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\MailMessageEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\MailMessageEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RectangleHotSpot.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RegularExpressionValidator.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RepeatDirection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\RepeatInfo.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\RepeatLayout.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\Repeater.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RepeaterCommandEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RepeaterCommandEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RepeaterItemCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RepeaterItemEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RepeaterItemEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\RepeatInfo.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\RepeatLayout.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\RequiredFieldValidator.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\RoleGroup.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\RoleGroupCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\ScrollBars.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SelectedDatesCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SendMailErrorEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SqlDataSource.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SqlDataSourceCommandEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SqlDataSourceCommandEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\SqlDataSourceCommandType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\SqlDataSourceFilteringEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\SqlDataSourceFilteringEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SqlDataSourceMode.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\SqlDataSourceSelectingEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\SqlDataSourceSelectingEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SqlDataSourceStatusEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SqlDataSourceStatusEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SqlDataSourceView.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\StringArrayConverter.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\Style.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\Style.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SubMenuStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\SubMenuStyleCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\Table.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableCell.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableCellCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableCellControlBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\TableFooterRow.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableHeaderCell.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\TableHeaderRow.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableHeaderScope.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\TableItemStyle.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\TableItemStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableRow.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableRowCollection.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TableRowSection.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.UI.WebControls\TableStyle.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\TableSectionStyle.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls\TableStyle.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TargetConverter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TemplateColumn.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\TemplateField.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\XmlHierarchicalDataSourceView.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\XmlHierarchicalEnumerable.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls\XmlHierarchyData.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls.Adapters\DataBoundControlAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls.Adapters\HideDisabledControlAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls.Adapters\HierarchicalDataBoundControlAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls.Adapters\MenuAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.UI.WebControls.Adapters\WebControlAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls.WebParts\ConnectionConsumerCallback.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls.WebParts\ConnectionPoint.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls.WebParts\ConnectionPointType.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.UI.WebControls.WebParts\WebPartVerbsEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\AltSerialization.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\DataSourceHelper.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Util\DataSourceResolver.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\ICalls.jvm.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Util\NativeFileChangeEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\StrUtils.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\TimeUtil.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\TransactedCallback.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Web.Util\Transactions.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\UrlUtils.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\WebEncoding.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Util\WebEqualComparer.cs" SubType="Code" BuildAction="Compile"/>\r
-                               <File RelPath="System.Web.Util\WebHashCodeProvider.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\WebTrace.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\WorkItem.cs" SubType="Code" BuildAction="Compile"/>\r
                                <File RelPath="System.Web.Util\WorkItemCallback.cs" SubType="Code" BuildAction="Compile"/>\r
index b0b13b5fdf690cb45fc9cd66f360da4efe64a615..e7eac5fcc742330d4f032fea22287fd8e78a4593 100644 (file)
@@ -28,8 +28,9 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Collections;
+using System.Globalization;
 using System.Web.Configuration;
 using System.Web.UI;
 
@@ -151,7 +152,12 @@ namespace System.Web {
                                return browser;
                        }
                }
-
+#if NET_2_0
+               [MonoTODO]
+               public ArrayList Browsers {
+                       get { throw new NotImplementedException (); }
+               }
+#endif
                public bool CDF {
                        get {
                                if (!Get (HaveCDF)) {
@@ -372,7 +378,7 @@ namespace System.Web {
 #if NET_1_1
                public Version [] GetClrVersions ()
                {
-                       if (clrVersions == null)
+                       if ((clrVersions == null) && (clrVersion == null))
                                InternalGetClrVersions ();
 
                        return clrVersions;
@@ -385,7 +391,7 @@ namespace System.Web {
                        string s = useragent;
                        ArrayList list = null;
                        int idx;
-                       while ((idx = s.IndexOf (".NET CLR ")) != -1) {
+                       while ((s != null) && (idx = s.IndexOf (".NET CLR ")) != -1) {
                                int end = s.IndexOfAny (anychars, idx + 9);
                                if (end == -1)
                                        break;
@@ -407,7 +413,11 @@ namespace System.Web {
                        
                        if (list == null || list.Count == 0) {
                                clrVersion = new Version ();
-                               clrVersions = new Version [] { clrVersion };
+#if NET_2_0
+                               clrVersions = null;
+#else
+                               clrVersions = new Version [1] { clrVersion };
+#endif
                        } else {
                                list.Sort ();
                                clrVersions = (Version []) list.ToArray (typeof (Version));
@@ -420,7 +430,7 @@ namespace System.Web {
                        if (v == null)
                                return dflt;
 
-                       return (v == "True");
+                       return (String.Compare (v, "True", true, CultureInfo.InvariantCulture) == 0);
                }
 
                int ReadInt32 (string key, int dflt)
index 53075238c32ee1003476f9418be8f3a7cafc6ee5..4c3bd6b7231042cdb5b0ad87c770c56da595704c 100644 (file)
@@ -1,3 +1,214 @@
+2005-09-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpResponseStream.cs: implemented Send(stream) for files. Fixes bug
+       #76145.
+
+2005-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRuntime.cs: catch errors when compiling global.asax and
+       initializing the application. Fixes bug #76090.
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com> 
+       * BrowserCapabilities.cs: Fixed changes (in 2.0) with versions. Fixed
+       compare with "True" (culture and case sensitivity).
+       * HttpApplicationState.cs: Added LinkDemand for Minimal. Use the 
+       internal HttpStaticObjectsCollection ctor to avoid the UnmanagedCode
+       demand.
+       * HttpContext.cs: Added LinkDemand for Minimal. Added 2.0 properties
+       and methods to test CAS on them.
+       * HttpRequest.cs: Added LinkDemand for Minimal. Ensure we return 
+       proper values when worker_request is null.
+       * HttpResponse.cs: Added LinkDemand for Minimal. Ensure we return 
+       proper values when context or WorkerRequest is null. Added 2.0 
+       properties and methods to test CAS on them.
+       * HttpRuntime.cs: Added LinkDemand for Minimal. Added PathDiscovery 
+       demands for properties returning directories. Added demand for High 
+       level on AppDomainAppId and AppDomainId properties, Low level on 
+       IsOnUNCShare, Medium level on ProcessRequest and a demand for 
+       UnmanagedCode on UnloadAppDomain method. Constructor also has a 
+       UnmanagedCode demand for 1.x.
+       * HttpStaticObjectsCollection.cs: Added LinkDemand for Minimal. Added
+       a UnmanagedCode demand to public ctor. Added internal ctor without the
+       demand. Changed Serialize and Deserialize methods to public for 2.0.
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpWorkerRequest.cs: Removed TODO for 2.0 APIs and return the 
+       default values for them.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpApplication.cs: : Added LinkDemand and InheritanceDemand (class)
+       for Minimal. Changed AssemblyLocation to a property (so it doesn't 
+       require special permission, PathDiscovery) to create an instance. 
+       Protected Modules property with a Demand for High level. Added some 
+       missing HttpException for null context.
+       * HttpServerUtility.cs: Added LinkDemand for Minimal. Added demands 
+       for UnmanagedCode on all CreateObject* methods. Added demand for 
+       Medium level on MachineName and ScriptTimeout properties. Added new
+       overloaded Transfer method (2.0) to test CAS on it.
+       * HttpUtility.cs: Added LinkDemand for Minimal. Added [Obsolete] to 
+       ctor (2.0). Changed some return values when 'count' is 0. Added 
+       ParseQueryString (overload) methods for 2.0 (to enabled CAS testing on
+       them).
+       * HttpWorkerRequest.cs: Added LinkDemand and InheritanceDemand (class)
+       for Minimal. Added RequestTraceIdentifier and RootWebConfigPath (2.0) 
+       properties, GetPreloadedEntityBody, GetPreloadedEntityBodyLength, 
+       GetTotalEntityBodyLength and ReadEntityBody (2.0) methods to test CAS 
+       on them. Fixed SendResponseFromMemory to ignore IntPtr.Zero (used in 
+       tests without failures).
+       * ServerVariablesCollection.cs: Fixed loadServerVariablesCollection 
+       when HttpWorkerRequest is null.
+       * TraceContext.cs: Added LinkDemand for Minimal. Fixed default Mode 
+       (SortByTime). Added new (2.0) TraceFinished event to test CAS on it.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com> 
+       * HttpBrowserCapabilities.cs: Added LinkDemand and InheritanceDemand 
+       (class) for Minimal. Note that current MCS has problem compiling 
+       security attributes on partial class (bug #75969).
+       * HttpCachePolicy.cs: Added LinkDemand for Minimal. Added 2.0 methods
+       (stub) to enable CAS tests on them.
+       * HttpCacheVaryByHeaders.cs: Added LinkDemand for Minimal.
+       * HttpCacheVaryByParams.cs: Added LinkDemand for Minimal.
+       * HttpClientCertificate.cs: Added LinkDemand and InheritanceDemand 
+       (class) for Minimal.
+       * HttpCookie.cs: Added LinkDemand for Minimal.
+       * HttpCookieCollection.cs: Added LinkDemand for Minimal.
+       * HttpFileCollection.cs: Added LinkDemand for Minimal.
+       * HttpModuleCollection.cs: Added LinkDemand for Minimal.
+       * HttpPostedFile.cs: Added LinkDemand for Minimal.
+       * HttpRequestPriority.cs: Fix enum values.
+       * HttpWriter.cs: Added LinkDemand for Minimal.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * ProcessInfo.cs: Added LinkDemand and InheritanceDemand (class) for
+       Minimal.
+       * ProcessModelInfo.cs: Added LinkDemand and InheritanceDemand (class)
+       for Minimal. Methods GetCurrentProcessInfo and GetHistory are also
+       protected by Demand for High level.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com> 
+       * HttpCompileException.cs: Added new public ctors and [Serializable]
+       to 2.0. Added new Message property and GetObjectData (protected by a
+       demand for SerializationFormatter) for 2.0. Fixed line-ending.
+       * HttpException.cs: Added LinkDemand and InheritanceDemand (class) for
+       Minimal. Renamed parameters to match documentation.
+       * HttpParseException.cs: Added LinkDemand (class) for Minimal. Added
+       demand for SerializationFormatter on GetObjectData method. Fixed 
+       line-ending.
+       * HttpRequestValidationException.cs: Added new public ctors and 
+       [Serializable] to 2.0. Added LinkDemand for Minimal.
+       * HttpUnhandledException.cs: Added new public ctors and [Serializable]
+       to 2.0. Removed unused internal ctor. Added LinkDemand for Minimal.
+       Fixed line-ending.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpResponseSubstitutionCallback.cs: New. 2.0 delegate.
+       * TraceContextEventArgs.cs: New. 2.0 class.
+       * TraceContextEventHandler.cs: New. 2.0 delegate.
+
+2005-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRequest.cs: use GetServerName instead of GetLocalAddress when
+       building the Url.
+
+2005-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRequest.cs: fix the indexer.
+
+2005-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpPostedFile.cs: fixes in Seek and Position.
+
+2005-09-08  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpRequest.cs: Make sure the MemoryStream created have their 
+       contents marked as public - or else you can't call GetBuffer on them!
+
+2005-09-08  Miguel de Icaza  <miguel@novell.com>
+
+       * HttpRequest.cs: Patch from Juraj Skripsky <js@hotfeet.ch> that
+       fixes UrlReferrer. 
+
+2005-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpPostedFile.cs: Make this class actually work. Every time we read,
+       we have to position the underlying stream.
+
+2005-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRequest.cs: reading multipart/form-data works again.
+
+2005-09-08 Eyal Alaluf <eyala@mainsoft.com>
+       * HttpRequest.cs: Under TARGET_JVM the input stream must allow GetBuffer.
+
+2005-09-08 Eyal Alaluf <eyala@mainsoft.com>
+       * HttpApplicationFactory.cs: TARGET_J2EE/JVM fix.
+
+2005-09-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRequest.cs: correctly detect multipart/form-data.
+
+2005-09-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpApplicationFactory.cs: recycle after invoking session_end.
+
+2005-09-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRuntime.cs: remove Console.
+
+       * HttpApplicationFactory.cs: don't hook Session_End, but keep
+       the MethodInfo around for later invocation if needed. Don't call
+       GetMethods() for every HttpApplication (or derived class) instances.
+       Added a method, used by SessionStateModule, that will create use an
+       application without context to invoke Session_End. Keep a pool of
+       applications that are meant to be used by this method only.
+
+       * HttpApplication.cs: add a SetSession method and do not
+       attach all the events if the application is for Session_End only.
+
+2005-09-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRuntime.cs: actually unload the domain when requested. Reformatted
+       FinishUnavailable() and removed the 'Location' header form the error.
+
+       * HttpApplicationFactory.cs: set up the watcher for the bin directory.
+       This also prevents a nullref when global.asax is changed.
+
+2005-09-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpApplication.cs: fixed bug introduced when moving GetHandler call
+       around. Now we get error pages again.
+
+2005-09-06  Miguel de Icaza  <miguel@novell.com>
+
+       * HttpApplication.cs: Catch EndRequest errors as well.
+
+2005-09-05  Miguel de Icaza  <miguel@novell.com>
+
+       * HttpApplication.cs: Invoke EndRequest handler before OutputPage
+       as FormsAuthentication will issue a Redirect from the EndRequest 
+       handler. 
+
+2005-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpApplication.cs: when writing an error message, catch the possible
+       write error.
+
+2005-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpResponseStream.cs: prevent invalid cast exception if the first
+       thing written is a file.
+
+2005-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpApplication.cs: fix invalid cast exception (bug #75926).
+
 2005-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * HttpApplicationFactory.cs: only trigger the Application_Start event
index 390a6ffbdef2824f2b018d7d67b5ba38a092b295..3b5ce0f0f7ec27ad81e70973440f1beb1441b628 100644 (file)
 // TODO:
 //    Events Disposed
 //
-using System;
+
 using System.IO;
 using System.Collections;
 using System.ComponentModel;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Security.Principal;
 using System.Threading;
 using System.Web.Configuration;
@@ -74,15 +75,20 @@ using System.Web.UI;
        
 namespace System.Web {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ToolboxItem(false)]
        public class HttpApplication : IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable {
                HttpContext context;
+               HttpSessionState session;
                ISite isite;
 
                // The source, and the exposed API (cache).
                HttpModuleCollection modcoll;
 
-               internal string AssemblyLocation;
+               string assemblyLocation;
 
                //
                // The factory for the handler currently running.
@@ -128,11 +134,10 @@ namespace System.Web {
 
                public HttpApplication ()
                {
-                       AssemblyLocation = GetType ().Assembly.Location;
                        done = new ManualResetEvent (false);
                }
 
-               void InitOnce ()
+               internal void InitOnce (bool full_init)
                {
                        lock (this) {
                                if (modcoll != null)
@@ -143,7 +148,8 @@ namespace System.Web {
 
                                modcoll = modules.LoadModules (this);
 
-                               HttpApplicationFactory.AttachEvents (this);
+                               if (full_init)
+                                       HttpApplicationFactory.AttachEvents (this);
 
                                GlobalizationConfiguration cfg = GlobalizationConfiguration.GetInstance (null);
                                if (cfg != null) {
@@ -153,6 +159,14 @@ namespace System.Web {
                        }
                }
 
+               internal string AssemblyLocation {
+                       get {
+                               if (assemblyLocation == null)
+                                       assemblyLocation = GetType ().Assembly.Location;
+                               return assemblyLocation;
+                       }
+               }
+
                [Browsable (false)]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public HttpApplicationState Application {
@@ -181,6 +195,7 @@ namespace System.Web {
                [Browsable (false)]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public HttpModuleCollection Modules {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
                        get {
                                if (modcoll == null)
                                        modcoll = new HttpModuleCollection ();
@@ -193,6 +208,8 @@ namespace System.Web {
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public HttpRequest Request {
                        get {
+                               if (context == null)
+                                       throw new HttpException (Locale.GetText ("No context is available."));
                                return context.Request;
                        }
                }
@@ -201,6 +218,8 @@ namespace System.Web {
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public HttpResponse Response {
                        get {
+                               if (context == null)
+                                       throw new HttpException (Locale.GetText ("No context is available."));
                                return context.Response;
                        }
                }
@@ -224,6 +243,12 @@ namespace System.Web {
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public HttpSessionState Session {
                        get {
+                               // Only used for Session_End
+                               if (session != null)
+                                       return session;
+
+                               if (context == null)
+                                       throw new HttpException (Locale.GetText ("No context is available."));
                                return context.Session;
                        }
                }
@@ -244,8 +269,10 @@ namespace System.Web {
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public IPrincipal User {
                        get {
+                               if (context == null)
+                                       throw new HttpException (Locale.GetText ("No context is available."));
                                if (context.User == null)
-                                       throw new HttpException ("Currently authenticated user");
+                                       throw new HttpException (Locale.GetText ("No currently authenticated user."));
                                
                                return context.User;
                        }
@@ -657,6 +684,16 @@ namespace System.Web {
                        }
                }
 
+               static void FinalErrorWrite (HttpResponse response, string error)
+               {
+                       try {
+                               response.Write (error);
+                               response.Flush (true);
+                       } catch {
+                               response.Close ();
+                       }
+               }
+
                void OutputPage ()
                {
                        if (context.Error == null){
@@ -682,10 +719,14 @@ namespace System.Web {
                                                response.StatusCode = 500;
                                        }
                                        if (!RedirectCustomError ())
-                                               response.Write (((HttpException) error).GetHtmlErrorMessage ());
-                               } else
-                                       response.Write (((HttpException) error).GetHtmlErrorMessage ());
-                               response.Flush (true);
+                                               FinalErrorWrite (response, ((HttpException) error).GetHtmlErrorMessage ());
+                                       else
+                                               response.Flush (true);
+                               } else {
+                                       if (!(error is HttpException))
+                                               error = new HttpException ("", error);
+                                       FinalErrorWrite (response, ((HttpException) error).GetHtmlErrorMessage ());
+                               }
                        }
                        
                }
@@ -696,13 +737,17 @@ namespace System.Web {
                void PipelineDone ()
                {
                        try {
-                               OutputPage ();
-                               
                                if (EndRequest != null)
                                        EndRequest (this, EventArgs.Empty);
+                       } catch (Exception e){
+                               ProcessError (e);
+                       }
+
+                       try {
 
+                               OutputPage ();
                        } catch (Exception e) {
-                               Console.WriteLine ("Internal error: we are missing one catch " + e);
+                               Console.WriteLine ("Internal error: OutputPage threw an exception " + e);
                        } finally {
                                context.WorkerRequest.EndOfRequest();
                                if (begin_iar != null){
@@ -784,7 +829,7 @@ namespace System.Web {
                        }
 
                        if (stop_processing)
-                               yield return false;
+                               yield return true;
 
 #if NET_2_0
                        if (PostResolveRequestCache != null)
@@ -926,12 +971,13 @@ namespace System.Web {
                        HttpRuntime.TimeoutManager.Remove (context);
 #endif
                        context = null;
+                       session = null;
                        HttpContext.Current = null;
                }
 
                void Start (object x)
                {
-                       InitOnce ();
+                       InitOnce (true);
                        PreStart ();
                        stop_processing = false;
                        pipeline = Pipeline ();
@@ -979,7 +1025,12 @@ namespace System.Web {
                {
                        this.context = context;
                }
-               
+
+               internal void SetSession (HttpSessionState session)
+               {
+                       this.session = session;
+               }
+
                IAsyncResult IHttpAsyncHandler.BeginProcessRequest (HttpContext context, AsyncCallback cb, object extraData)
                {
                        this.context = context;
index a7ac4cc7532e499606fd1f05263e75a43b1c0678..ac7430062a3c1521c9a5471bdd6c015b791d8b83 100644 (file)
@@ -1,10 +1,6 @@
 //
 // System.Web.HttpApplicationFactory
 //
-// TODO:
-//   bin_watcher must work.
-//   
-//
 // Author:
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
@@ -69,21 +65,28 @@ namespace System.Web {
                static HttpApplicationFactory theFactory = new HttpApplicationFactory();
 #endif
 
+               static MethodInfo session_end;
                bool needs_init = true;
                bool app_start_needed = true;
                Type app_type;
                HttpApplicationState app_state;
+               Hashtable app_event_handlers;
 #if !TARGET_JVM
                FileSystemWatcher app_file_watcher;
                FileSystemWatcher bin_watcher;
 #endif
                Stack available = new Stack ();
+               Stack available_for_end = new Stack ();
                
                // Watch this thing out when getting an instance
                IHttpHandler custom_application;
 
                bool IsEventHandler (MethodInfo m)
                {
+                       int pos = m.Name.IndexOf ('_');
+                       if (pos == -1 || (m.Name.Length - 1) <= pos)
+                               return false;
+
                        if (m.ReturnType != typeof (void))
                                return false;
 
@@ -122,22 +125,34 @@ namespace System.Web {
                        list.Add (method);
                }
                
-               Hashtable GetApplicationTypeEvents (HttpApplication app)
+               Hashtable GetApplicationTypeEvents (Type type)
                {
-                       Type appType = app.GetType ();
-                       Hashtable appTypeEventHandlers = new Hashtable ();
-                       BindingFlags flags = BindingFlags.Public    |
-                                            BindingFlags.NonPublic | 
-                                            BindingFlags.Instance |
-                                            BindingFlags.Static;
-
-                       MethodInfo [] methods = appType.GetMethods (flags);
-                       foreach (MethodInfo m in methods) {
-                               if (IsEventHandler (m))
-                                       AddEvent (m, appTypeEventHandlers);
+                       lock (this) {
+                               if (app_event_handlers != null)
+                                       return app_event_handlers;
+
+                               app_event_handlers = new Hashtable ();
+                               BindingFlags flags = BindingFlags.Public    | BindingFlags.NonPublic | 
+                                                    BindingFlags.Instance  | BindingFlags.Static;
+
+                               MethodInfo [] methods = type.GetMethods (flags);
+                               foreach (MethodInfo m in methods) {
+                                       if (m.DeclaringType != typeof (HttpApplication) && IsEventHandler (m))
+                                               AddEvent (m, app_event_handlers);
+                               }
                        }
 
-                       return appTypeEventHandlers;
+                       return app_event_handlers;
+               }
+
+               Hashtable GetApplicationTypeEvents (HttpApplication app)
+               {
+                       lock (this) {
+                               if (app_event_handlers != null)
+                                       return app_event_handlers;
+
+                               return GetApplicationTypeEvents (app.GetType ());
+                       }
                }
 
                bool FireEvent (string method_name, object target, object [] args)
@@ -184,7 +199,7 @@ namespace System.Web {
                }
 
 #if !TARGET_JVM
-               FileSystemWatcher CreateWatcher (string file, FileSystemEventHandler hnd)
+               static FileSystemWatcher CreateWatcher (string file, FileSystemEventHandler hnd)
                {
                        FileSystemWatcher watcher = new FileSystemWatcher ();
 
@@ -214,9 +229,6 @@ namespace System.Web {
                        Hashtable possibleEvents = factory.GetApplicationTypeEvents (app);
                        foreach (string key in possibleEvents.Keys) {
                                int pos = key.IndexOf ('_');
-                               if (pos == -1 || key.Length <= pos + 1)
-                                       continue;
-
                                string moduleName = key.Substring (0, pos);
                                object target;
                                if (moduleName == "Application") {
@@ -231,9 +243,17 @@ namespace System.Web {
                                EventInfo evt = target.GetType ().GetEvent (eventName);
                                if (evt == null)
                                        continue;
-                       
+
                                string usualName = moduleName + "_" + eventName;
                                object methodData = possibleEvents [usualName];
+                               if (methodData != null && eventName == "End" && moduleName == "Session") {
+                                       lock (factory) {
+                                               if (session_end == null)
+                                                       session_end = (MethodInfo) methodData;
+                                       }
+                                       continue;
+                               }
+
                                if (methodData == null)
                                        continue;
 
@@ -261,6 +281,28 @@ namespace System.Web {
                        }
                }
 
+               internal static void InvokeSessionEnd (object state)
+               {
+                       HttpApplicationFactory factory = theFactory;
+                       MethodInfo method = null;
+                       HttpApplication app = null;
+                       lock (factory.available_for_end) {
+                               method = session_end;
+                               if (method == null)
+                                       return;
+
+                               app = GetApplicationForSessionEnd ();
+                       }
+
+                       app.SetSession ((HttpSessionState) state);
+                       try {
+                               method.Invoke (app, new object [] {app, EventArgs.Empty});
+                       } catch (Exception e) {
+                               // Ignore
+                       }
+                       RecycleForSessionEnd (app);
+               }
+
                static HttpStaticObjectsCollection MakeStaticCollection (ArrayList list)
                {
                        if (list == null || list.Count == 0)
@@ -360,13 +402,21 @@ namespace System.Web {
                                factory.InitType (context);
                                lock (factory) {
                                        if (factory.app_start_needed) {
+#if !TARGET_JVM
+                                               string bin = HttpRuntime.BinDirectory;
+                                               if (Directory.Exists (bin))
+                                                       bin = Path.Combine (bin, "*.dll");
+
+                                               // We watch bin or bin/*.dll if the directory exists
+                                               factory.bin_watcher = CreateWatcher (bin, new FileSystemEventHandler (factory.OnAppFileChanged));
+#endif
                                                factory.FireOnAppStart (context);
                                                factory.app_start_needed = false;
                                        }
                                }
                        }
 
-                       lock (factory) {
+                       lock (factory.available) {
                                if (factory.available.Count > 0)
                                        return (HttpApplication) factory.available.Pop ();
                        }
@@ -376,10 +426,34 @@ namespace System.Web {
                        return app;
                }
 
+               // The lock is in InvokeSessionEnd
+               static HttpApplication GetApplicationForSessionEnd ()
+               {
+                       HttpApplicationFactory factory = theFactory;
+                       if (factory.available_for_end.Count > 0)
+                               return (HttpApplication) factory.available_for_end.Pop ();
+
+                       HttpApplication app = (HttpApplication) Activator.CreateInstance (factory.app_type, true);
+                       app.InitOnce (false);
+
+                       return app;
+               }
+
+               internal static void RecycleForSessionEnd (HttpApplication app)
+               {
+                       HttpApplicationFactory factory = theFactory;
+                       lock (factory.available_for_end) {
+                               if (factory.available_for_end.Count < 32)
+                                       factory.available_for_end.Push (app);
+                               else
+                                       app.Dispose ();
+                       }
+               }
+
                internal static void Recycle (HttpApplication app)
                {
                        HttpApplicationFactory factory = theFactory;
-                       lock (factory) {
+                       lock (factory.available) {
                                if (factory.available.Count < 32)
                                        factory.available.Push (app);
                                else
@@ -388,3 +462,4 @@ namespace System.Web {
                }
        }
 }
+
index 17f0968fe09e3df8310a99ca8949d91c30e92d47..de259d16d38dafa268a512c90bf653235043f8a3 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Threading;
-using System.Web;
 using System.Collections.Specialized;
+using System.Security.Permissions;
 
-namespace System.Web \r
-{
+namespace System.Web {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpApplicationState : NameObjectCollectionBase \r
        {
                private HttpStaticObjectsCollection _AppObjects;
@@ -42,8 +43,9 @@ namespace System.Web
 
                internal HttpApplicationState ()
                {
-                       _AppObjects = new HttpStaticObjectsCollection ();
-                       _SessionObjects = new HttpStaticObjectsCollection ();
+                       // do not use the public (empty) ctor as it required UnmanagedCode permission
+                       _AppObjects = new HttpStaticObjectsCollection (this);
+                       _SessionObjects = new HttpStaticObjectsCollection (this);
                        _Lock = new ReaderWriterLock ();
                }
 
@@ -56,7 +58,8 @@ namespace System.Web
                        } \r
                        else \r
                        {
-                               _AppObjects = new HttpStaticObjectsCollection ();
+                               // do not use the public (empty) ctor as it required UnmanagedCode permission
+                               _AppObjects = new HttpStaticObjectsCollection (this);
                        }
 
                        if (null != SessionObj) \r
@@ -65,7 +68,8 @@ namespace System.Web
                        } \r
                        else \r
                        {
-                               _SessionObjects = new HttpStaticObjectsCollection ();
+                               // do not use the public (empty) ctor as it required UnmanagedCode permission
+                               _SessionObjects = new HttpStaticObjectsCollection (this);
                        }
                        _Lock = new ReaderWriterLock ();
                }
index d0377760377aaa1e6e35ffd73a06814ac42373f6..9b3dffa9117f44ac004ec350cd32fc64e223eb42 100644 (file)
@@ -5,9 +5,7 @@
 //   Patrik Torstensson (Patrik.Torstensson@labs2.com)
 //   Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
-// (c) 2003 Novell, Inc. (http://www.novell.com)
-//
-
+// Copyright (C) 2003,2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
-using System.Collections;
+
+using System.Security.Permissions;
 using System.Web.Configuration;
-using System.Web.UI;
 
 namespace System.Web
 {
        //
        // The real implementation lives in System.Web/BrowserCapabilities.cs
        //
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public partial class HttpBrowserCapabilities : HttpCapabilitiesBase
        {
                public HttpBrowserCapabilities ()
index 28c057cca8ce4401da4202cfd958960367d28c48..a77113dca9ef7e465acbe0b1ecf5141cb18a6725 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Collections;
 using System.Globalization;
+using System.Security.Permissions;
 using System.Text;
 using System.Web.UI;
 using System.Web.Util;
@@ -47,6 +48,8 @@ namespace System.Web {
        
        internal delegate void CacheabilityUpdatedCallback (object sender, CacheabilityUpdatedEventArgs args);
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpCachePolicy {
 
                internal HttpCachePolicy ()
@@ -346,6 +349,19 @@ namespace System.Web {
                        }
 
                }
+#if NET_2_0
+               [MonoTODO]
+               public void SetDiskCacheable (bool diskCacheable)
+               {
+                       throw new NotImplementedException (); 
+               }
+
+               [MonoTODO]
+               public void SetOmitVaryStar (bool omit)
+               {
+                       throw new NotImplementedException (); 
+               }
+#endif
                
 #endregion // Methods
        }
index 85b9ee4c622339a4bba84517561772cecb458303..3508adacfc6e1caf01bc4ac41ed0d69926874c41 100644 (file)
 //
 
 using System.Collections;
+using System.Security.Permissions;
 
 namespace System.Web {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpCacheVaryByHeaders {
 
                /* I would have much rather seen this class just use the
index a422e781cb40dc49e40bc799cd0cbe1c5819a5f1..e03910d614c117bc04916a648bbf61381a498ef0 100644 (file)
 //
 
 using System.Collections;
+using System.Security.Permissions;
 using System.Text;
 
 namespace System.Web {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpCacheVaryByParams {
 
                bool ignore_parms;
index 003b70ecebd3a68dac949dda0b9741ea7bff4c5f..6f921658b963ce2b8ea09c8f0869957839803b28 100644 (file)
 
 using System.Collections.Specialized;
 using System.Globalization;
+using System.Security.Permissions;
 
 namespace System.Web {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class HttpClientCertificate : NameValueCollection {
 
                private HttpWorkerRequest hwr;
index 98053b0563b09125bc34cdc40a879d5486a98ef6..22e051441086ab682b32b777e71cf9d20a0d125b 100644 (file)
@@ -1,12 +1,12 @@
-// \r
-// System.Web.HttpCompileException.cs\r
-//\r
-// Author:\r
-//   Tim Coleman (tim@timcoleman.com)\r
-//\r
-// Copyright (C) Tim Coleman, 2002\r
-//\r
-
+// 
+// System.Web.HttpCompileException.cs
+//
+// Authors:
+//     Tim Coleman (tim@timcoleman.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) Tim Coleman, 2002
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-using System.CodeDom.Compiler;\r
-\r
-namespace System.Web {\r
-       public sealed class HttpCompileException : HttpException {\r
-\r
-               #region Fields\r
-\r
-               CompilerResults results;\r
-               string sourceCode;\r
-\r
-               #endregion // Fields\r
-\r
-               #region Constructors\r
-\r
-               internal HttpCompileException (CompilerResults results, string sourceCode)\r
-                       : base ()\r
-               {\r
-                       this.results = results;\r
-                       this.sourceCode = sourceCode;\r
-               }\r
-\r
-               #endregion // Constructors\r
-\r
-               #region Properties\r
-\r
-               public CompilerResults Results {\r
-                       get { return results; }\r
-               }\r
-\r
-               public string SourceCode {\r
-                       get { return sourceCode; }\r
-               }\r
-\r
-               #endregion // Properties\r
-       }\r
-}\r
+
+using System.CodeDom.Compiler;
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+
+namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [Serializable]
+#endif
+       public sealed class HttpCompileException : HttpException {
+
+               CompilerResults results;
+               string sourceCode;
+
+#if NET_2_0
+               public HttpCompileException ()
+               {
+               }
+
+               public HttpCompileException (string message)
+                       : base (message)
+               {
+               }
+
+               public HttpCompileException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+
+               public HttpCompileException (CompilerResults results, string sourceCode)
+#else
+               internal HttpCompileException (CompilerResults results, string sourceCode)
+#endif
+               {
+                       this.results = results;
+                       this.sourceCode = sourceCode;
+               }
+
+
+               public CompilerResults Results {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
+                       get { return results; }
+               }
+
+               public string SourceCode {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
+                       get { return sourceCode; }
+               }
+#if NET_2_0
+               public override string Message {
+                       get { return base.Message; }
+               }
+
+               [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       sourceCode = info.GetString ("sourcecode");
+                       results = (CompilerResults) info.GetValue ("results", typeof (CompilerResults));
+               }
+#endif
+       }
+}
index dac40e93bd9345671f68b3cb682409549fd4b818..a82569b8e5413b6943a93bce9aea944e9536e249 100644 (file)
@@ -31,6 +31,7 @@
 
 using System.Collections;
 using System.Configuration;
+using System.Globalization;
 using System.Runtime.Remoting.Messaging;
 using System.Security.Permissions;
 using System.Security.Principal;
@@ -40,9 +41,14 @@ using System.Web.Configuration;
 using System.Web.SessionState;
 using System.Web.UI;
 using System.Web.Util;
+#if NET_2_0
+using System.Web.Profile;
+#endif
 
 namespace System.Web {
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpContext : IServiceProvider {
                internal HttpWorkerRequest WorkerRequest;
                HttpApplication app_instance;
@@ -178,7 +184,11 @@ namespace System.Web {
 #else
                public bool IsDebuggingEnabled {
                        get {
-                               return CompilationConfiguration.GetInstance (this).Debug;
+                               try {
+                                       return CompilationConfiguration.GetInstance (this).Debug;
+                               } catch {
+                                       return false;
+                               }
                        }
                }
 #endif
@@ -252,6 +262,25 @@ namespace System.Web {
                        }
                }
 
+#if NET_2_0
+               [MonoTODO]
+               public IHttpHandler CurrentHandler {
+                       get { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public IHttpHandler PreviousHandler {
+                       get { throw new NotImplementedException (); }
+               }
+
+       #if false
+               [MonoTODO]
+               public ProfileBase Profile {
+                       get { throw new NotImplementedException (); }
+               }
+       #endif
+#endif
+
                public void AddError (Exception errorInfo)
                {
                        if (errors == null){
@@ -273,6 +302,9 @@ namespace System.Web {
                        errors = null;
                }
 
+#if NET_2_0
+               [Obsolete ("see WebConfigurationManager")]
+#endif
                public static object GetAppConfig (string name)
                {
                        object o = ConfigurationSettings.GetConfig (name);
@@ -280,11 +312,45 @@ namespace System.Web {
                        return o;
                }
 
+#if NET_2_0
+               [Obsolete ("see GetSection")]
+#endif
                public object GetConfig (string name)
                {
                        return WebConfigurationSettings.GetConfig (name, this);
                }
 
+#if NET_2_0
+               [MonoTODO]
+               public static object GetGlobalResourceObject (string classKey, string resourceKey)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static object GetGlobalResourceObject (string classKey, string resourceKey, CultureInfo culture)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static object GetLocalResourceObject (string virtualPath, string resourceKey)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static object GetLocalResourceObject (string virtualPath, string resourceKey, CultureInfo culture)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public object GetSection (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
                object IServiceProvider.GetService (Type service)
                {
                        if (service == typeof (HttpWorkerRequest))
@@ -355,6 +421,14 @@ namespace System.Web {
                                Request.QueryStringRaw = queryString;
                }
 
+#if NET_2_0
+               [MonoTODO]
+               public void RewritePath (string path, bool rebaseClientPath)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+
 #region internals
                
                internal void SetSession (HttpSessionState state)
index 0731f1da7f82896ce955ff2436ea567e23b33398..b95031c2713d51d0551713e5759cc6e715e7c021 100644 (file)
@@ -30,6 +30,7 @@
 
 using System.Text;
 using System.Collections.Specialized;
+using System.Security.Permissions;
 
 namespace System.Web {
 
@@ -39,6 +40,8 @@ namespace System.Web {
                HttpOnly = 2
        }
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpCookie {
 
                string path = "/";
index b668291fc71e24c4ebbee6bc7c1ad199599f7464..9de71a7b96877512b16b8fac93c034dab13c8ad3 100644 (file)
 //
 
 using System.Collections.Specialized;
+using System.Security.Permissions;
 
 namespace System.Web {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpCookieCollection : NameObjectCollectionBase {
 
                private bool auto_fill = false;
index c5cae9c14b42c8ea4b7905eb2dab5e4954ba93ad..2beb0fb6216ab0207e367aa21a8080caacc4a626 100644 (file)
@@ -7,8 +7,7 @@
 //
 // (c) 2002 Patrik Torstensson
 // (c) 2003 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.IO;
 using System.Runtime.Serialization;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
 using System.Text;
 using System.Web.Util;
 #if !TARGET_J2EE
@@ -41,6 +41,9 @@ using System.Web.Compilation;
 
 namespace System.Web
 {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 #if NET_2_0
        [Serializable]
 #endif
@@ -48,30 +51,33 @@ namespace System.Web
        {
                int http_code = 500;
 
-               public HttpException () : base ()
+               public HttpException ()
                {
                }
 
-               public HttpException (string sMessage) : base (sMessage)
+               public HttpException (string message)
+                       : base (message)
                {
                }
 
-               public HttpException (string sMessage, Exception InnerException)
-                       : base (sMessage, InnerException)
+               public HttpException (string message, Exception innerException)
+                       : base (message, innerException)
                {
                }
 
-               public HttpException (int iHttpCode, string sMessage) : base (sMessage)
+               public HttpException (int httpCode, string message) : base (message)
                {
-                       http_code = iHttpCode;
+                       http_code = httpCode;
                }
 
 #if NET_2_0
-               protected HttpException (SerializationInfo info, StreamingContext sc) : base (info, sc)
+               protected HttpException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
                {
                        http_code = info.GetInt32 ("_httpCode");
                }
 
+               [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
                public override void GetObjectData (SerializationInfo info, StreamingContext context)
                {
                        base.GetObjectData (info, context);
@@ -79,21 +85,21 @@ namespace System.Web
                }
 #endif
 
-               public HttpException (int iHttpCode, string sMessage, int iHR) : base (sMessage, iHR)
+               public HttpException (int httpCode, string message, int hr) 
+                       : base (message, hr)
                {
-                       http_code = iHttpCode;
+                       http_code = httpCode;
                }
 
-               public HttpException (string sMessage, int iHR) : base (sMessage, iHR)
+               public HttpException (string message, int hr)
+                       : base (message, hr)
                {
                }
        
-               public HttpException (int iHttpCode,
-                                     string sMessage,
-                                     Exception InnerException)
-                       : base (sMessage, InnerException)
+               public HttpException (int httpCode, string message, Exception innerException)
+                       : base (message, innerException)
                {
-                       http_code = iHttpCode;
+                       http_code = httpCode;
                }
 
                public string GetHtmlErrorMessage ()
@@ -193,9 +199,7 @@ namespace System.Web
                        builder.AppendFormat ("<!--\r\n{0}\r\n-->\r\n", HtmlEncode (exc.StackTrace));
                        return builder.ToString ();
                }
-#endif
-
-#if !TARGET_J2EE
+#else
                string GetHtmlizedErrorMessage ()
                {
                        StringBuilder builder = new StringBuilder ("<html>\r\n<title>");
@@ -258,9 +262,7 @@ namespace System.Web
                        builder.Append ("</pre></code>\r\n");
                }
 
-#endif
-
-#if !TARGET_J2EE
+#else
                static void WriteSource (StringBuilder builder, HtmlizedException e)
                {
                        builder.Append ("<code><pre>");
index 7b486f8d26dfc6952162e58b06c758c746da7595..7b77b5cc02c3c238b654e2efdeebdbd3dc02a69d 100644 (file)
 //
 
 using System.Collections.Specialized;
+using System.Security.Permissions;
 
 namespace System.Web {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpFileCollection : NameObjectCollectionBase
        {
                internal HttpFileCollection ()
@@ -85,5 +88,4 @@ namespace System.Web {
                        }
                }
        }
-
 }
index 642793f673cb6b495538c63bf72f2566cb9ebfd7..2c3bb7087117dd53338b22f87485ef832e2ca1aa 100644 (file)
 //
 
 using System.Collections.Specialized;
+using System.Security.Permissions;
 
 namespace System.Web {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpModuleCollection : NameObjectCollectionBase
        {
                internal HttpModuleCollection ()
@@ -85,5 +88,4 @@ namespace System.Web {
                        }
                }
        }
-
 }
diff --git a/mcs/class/System.Web/System.Web/HttpMultipartContentParser.cs b/mcs/class/System.Web/System.Web/HttpMultipartContentParser.cs
deleted file mode 100644 (file)
index 52cd70f..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// System.Web.HttpMultipartContentParser
-//
-// Authors:
-//     Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (c) 2003 Ben Maurer
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Specialized;
-using System.IO;
-using System.Text;
-using System.Web.Configuration;
-using System.Web.Util;
-
-namespace System.Web {
-       internal class HttpMultipartContentParser {
-               
-               const byte HYPHEN = (byte) '-', LF = (byte) '\n', CR = (byte) '\r';
-               
-               public static MultipartContentElement [] Parse (byte [] data, byte [] boundary, Encoding encoding)
-               {
-                       HttpMultipartContentParser p = new HttpMultipartContentParser (data, boundary, encoding);
-                       p.ParseIntoElementList();
-                       
-                       return (MultipartContentElement []) p.elements.ToArray (typeof (MultipartContentElement));
-               }
-               
-               HttpMultipartContentParser (byte [] data, byte [] boundary, Encoding encoding)
-               {
-                       this.data = data;
-                       this.boundary = boundary;
-                       this.enc = encoding;
-                       this.len = data.Length;
-               }
-
-               bool IsAtBoundaryLine ()
-               {
-                       int boundaryLen = boundary.Length;
-
-                       if (lineLen != boundaryLen     &&
-                           lineLen != boundaryLen + 2)
-                               return false; 
-
-                       
-                       for (int i = 0; i < boundaryLen; i++)
-                               if (data [lineStart + i] != boundary [i])
-                                       return false;
-                               
-                       if (lineLen == boundaryLen)
-                               return true; 
-                       
-                       if (data [lineStart + boundaryLen    ] != HYPHEN || 
-                           data [lineStart + boundaryLen + 1] != HYPHEN)
-                               return false;
-                       
-                       lastBoundaryFound = true;
-                       return true; 
-               }
-               
-               string GetAttributeFromContentDispositionHeader (string l, int pos, string name)
-               {
-                       string nameEqQuote = name + "=\"";
-
-                       int idxVal = l.IndexOf (nameEqQuote, pos);
-                       if (idxVal < 0)
-                               return null;
-                       idxVal += nameEqQuote.Length;
-                       int idxEndQuote = l.IndexOf ('"', idxVal);
-                       if (idxEndQuote < 0)
-                               return null;
-                       if (idxEndQuote == idxVal)
-                               return "";
-                       return l.Substring (idxVal, idxEndQuote - idxVal);
-               }
-
-               
-               bool IsAtEndOfData ()
-               {
-                       return pos >= len || lastBoundaryFound;
-               }
-               
-               private bool GetNextLine()
-               { 
-                       int pos = this.pos;
-                       lineStart = -1;
-                               
-                       while (pos < len && !(this.data [pos] == LF || ++pos + 1 == len))
-                               ;
-                       
-                       if (pos >= len)
-                               return false;
-                       
-                       lineStart = this.pos;
-                       lineLen = pos - lineStart;
-                       this.pos = pos + 1;
-                       
-                       if (lineLen > 0 && data [pos - 1] == CR)
-                               lineLen--;
-                       
-                       return true;
-               }
-               
-               void ParseIntoElementList ()
-               { 
-                       while (!IsAtBoundaryLine () && GetNextLine ())
-                               ;
-                       
-                       do {
-                               partName = partFilename = partContentType = null;
-                       
-                               while (this.GetNextLine () && lineLen != 0) {
-                                       
-                                       string line = enc.GetString (data, lineStart, lineLen);
-                                       int colonPos = line.IndexOf(':');
-                                       if (colonPos < 0) continue;
-                                               
-                                       string headerName = line.Substring (0, colonPos);
-                                       if (String.Compare (headerName, "Content-Disposition", true) == 0) {
-                                               partName = GetAttributeFromContentDispositionHeader (line, colonPos + 1, "name");
-                                               partFilename = GetAttributeFromContentDispositionHeader (line, colonPos + 1, "filename");
-                                       } else if (String.Compare (headerName, "Content-Type", true) == 0)
-                                               partContentType = line.Substring (colonPos + 1).Trim ();
-                               }
-                               
-                               if (IsAtEndOfData ()) break;
-                                       
-                               partDataStart = pos;
-                               partDataLength = -1;
-                               
-                               while (GetNextLine ()) {
-                                       if (!IsAtBoundaryLine ())
-                                               continue;
-                                       
-                                       int end = lineStart - 1;
-                                       if (data [end] == LF) end--;
-                                       if (data [end] == CR) end--;
-                                       
-                                       partDataLength = end - partDataStart + 1;
-                                       break;
-                               }
-                               
-                               if (partDataLength == -1) break;
-                               
-                               if (partName != null) {
-                                        elements.Add (new MultipartContentElement (
-                                               partName, partFilename, partContentType,
-                                               data, partDataStart, partDataLength
-                                       ));
-                               }
-                       } while (!IsAtEndOfData ());
-               }
-
-               byte [] data, boundary;
-
-               ArrayList elements = new ArrayList ();
-               Encoding enc;
-               bool lastBoundaryFound;
-               int len, lineLen, lineStart;
-
-               int partDataStart, partDataLength;
-               string partContentType, partName, partFilename;
-               int pos;
-       }
-       
-       internal class MultipartContentElement {
-               string name, fileName, contentType;
-               byte [] data;
-               int offset, len;
-               
-               public MultipartContentElement (string name, string fileName, string contentType, byte [] data, int offset, int len)
-               {
-                       this.name = name;
-                       this.fileName = fileName;
-                       this.contentType = contentType;
-                       this.data = data;
-                       this.offset = offset;
-                       this.len = len;
-               }
-               
-               public bool IsFile { get { return fileName != null; } }
-               public bool IsFormItem { get { return fileName == null; } }
-               public string Name { get { return name; } }
-               
-               public string GetString (Encoding enc)
-               {
-                       if (len == 0) return "";
-                       return enc.GetString (data, offset, len);
-               }
-               
-               public HttpPostedFile GetFile ()
-               {
-                       return new HttpPostedFile (fileName, contentType, new MemoryStream (data, offset, len, false));
-               }
-       }
-}
index 8e718cbe81c9104a754fd909afc48424c96dfcbc..3de3c9b0ac6d804de7d011133b7a85caa5bd7673 100644 (file)
@@ -1,12 +1,11 @@
-// \r
-// System.Web.HttpParseException.cs\r
-//\r
-// Author:\r
-//   Tim Coleman (tim@timcoleman.com)\r
-//\r
-// Copyright (C) Tim Coleman, 2002\r
-//\r
-
+// 
+// System.Web.HttpParseException.cs
+//
+// Author:
+//   Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Web {\r
-\r
-#if NET_2_0\r
-       [Serializable]\r
-#endif\r
-       public sealed class HttpParseException : HttpException {\r
-\r
-               int line;\r
-               string virtualPath;\r
-               \r
-#if NET_2_0\r
-               ParserErrorCollection errors = new ParserErrorCollection ();\r
-#endif\r
-\r
-               internal HttpParseException (string message, string virtualPath, int line)\r
-                       : base (message)\r
-               {\r
-                       this.virtualPath = virtualPath;\r
-                       this.line = line;\r
-               }\r
-\r
-#if NET_2_0\r
-\r
-               public HttpParseException (): this ("External component has thrown an exception")\r
-               {\r
-               }\r
-\r
-               public HttpParseException (string message)\r
-                       : base (message)\r
-               {\r
-                       errors.Add (new ParserError (message, null, 0));\r
-               }\r
-               \r
-               public HttpParseException (string message, Exception innerException)\r
-                       : base (message, innerException)\r
-               {\r
-                       errors.Add (new ParserError (message, null, 0));\r
-               }\r
-\r
-               public HttpParseException (string message, Exception innerException, string virtualPath, string sourceCode, int line)\r
-                       : base (message, innerException)\r
-               {\r
-                       this.virtualPath = virtualPath;\r
-                       this.line = line;\r
-                       errors.Add (new ParserError (message, virtualPath, line));\r
-               }\r
-\r
-               public override void GetObjectData (SerializationInfo info, StreamingContext ctx)\r
-               {\r
-                       base.GetObjectData (info, ctx);\r
-                       info.AddValue ("_virtualPath", virtualPath);\r
-                       info.AddValue ("_parserErrors", errors);\r
-                       info.AddValue ("_line", line);\r
-               }\r
-#endif\r
-\r
-               public string FileName {\r
-                       get { return virtualPath; }\r
-               }\r
-\r
-               public int Line {\r
-                       get { return line; }\r
-               }\r
-               \r
-#if NET_2_0\r
-               public string VirtualPath {\r
-                       get { return virtualPath; }\r
-               }\r
-               \r
-               public ParserErrorCollection ParserErrors {\r
-                       get { return errors; }\r
-               }\r
-#endif\r
-       }\r
-}\r
-\r
+
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+
+namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [Serializable]
+#endif
+       public sealed class HttpParseException : HttpException {
+
+               int line;
+               string virtualPath;
+               
+#if NET_2_0
+               ParserErrorCollection errors = new ParserErrorCollection ();
+#endif
+
+               internal HttpParseException (string message, string virtualPath, int line)
+                       : base (message)
+               {
+                       this.virtualPath = virtualPath;
+                       this.line = line;
+               }
+
+#if NET_2_0
+
+               public HttpParseException (): this ("External component has thrown an exception")
+               {
+               }
+
+               public HttpParseException (string message)
+                       : base (message)
+               {
+                       errors.Add (new ParserError (message, null, 0));
+               }
+               
+               public HttpParseException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+                       errors.Add (new ParserError (message, null, 0));
+               }
+
+               public HttpParseException (string message, Exception innerException, string virtualPath, string sourceCode, int line)
+                       : base (message, innerException)
+               {
+                       this.virtualPath = virtualPath;
+                       this.line = line;
+                       errors.Add (new ParserError (message, virtualPath, line));
+               }
+
+               [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
+               public override void GetObjectData (SerializationInfo info, StreamingContext ctx)
+               {
+                       base.GetObjectData (info, ctx);
+                       info.AddValue ("_virtualPath", virtualPath);
+                       info.AddValue ("_parserErrors", errors);
+                       info.AddValue ("_line", line);
+               }
+#endif
+
+               public string FileName {
+                       get { return virtualPath; }
+               }
+
+               public int Line {
+                       get { return line; }
+               }
+               
+#if NET_2_0
+               public string VirtualPath {
+                       get { return virtualPath; }
+               }
+               
+               public ParserErrorCollection ParserErrors {
+                       get { return errors; }
+               }
+#endif
+       }
+}
+
index eb329e084d9a1c79652c9f6081eca28e6a34274e..9764b5324d07a412c8ac6d9820bd1d75d711f497 100644 (file)
 //
 
 using System.IO;
+using System.Security.Permissions;
 
 namespace System.Web
 {
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpPostedFile {
                string name;
                string content_type;
                Stream stream;
-
                
                class ReadSubStream : Stream {
                        Stream s;
                        long offset;
-                       long length;
+                       long end;
+                       long position;
        
                        public ReadSubStream (Stream s, long offset, long length)
                        {
                                this.s = s;
                                this.offset = offset;
-                               this.length = length;
+                               this.end = offset + length;
+                               position = offset;
                        }
        
                        public override void Flush ()
@@ -56,24 +60,51 @@ namespace System.Web
        
                        public override int Read (byte [] buffer, int dest_offset, int count)
                        {
+                               if (buffer == null)
+                                       throw new ArgumentNullException ("buffer");
+
                                if (dest_offset < 0)
                                        throw new ArgumentOutOfRangeException ("dest_offset", "< 0");
+
                                if (count < 0)
                                        throw new ArgumentOutOfRangeException ("count", "< 0");
-                               if (dest_offset > length)
+
+                               int len = buffer.Length;
+                               if (dest_offset > len)
                                        throw new ArgumentException ("destination offset is beyond array size");
                                // reordered to avoid possible integer overflow
-                               if (dest_offset > length - count)
+                               if (dest_offset > len - count)
                                        throw new ArgumentException ("Reading would overrun buffer");
 
-                               return s.Read (buffer, dest_offset, count);
+                               if (count > end - position)
+                                       count = (int) (end - position);
+
+                               if (count <= 0)
+                                       return 0;
+
+                               s.Position = position;
+                               int result = s.Read (buffer, dest_offset, count);
+                               if (result > 0)
+                                       position += result;
+                               else
+                                       position = end;
+
+                               return result;
                        }
        
                        public override int ReadByte ()
                        {
-                               if (Position == Length - 1)
+                               if (position >= end)
                                        return -1;
-                               return s.ReadByte ();
+
+                               s.Position = position;
+                               int result = s.ReadByte ();
+                               if (result < 0)
+                                       position = end;
+                               else
+                                       position++;
+
+                               return result;
                        }
        
                        public override long Seek (long d, SeekOrigin origin)
@@ -84,20 +115,21 @@ namespace System.Web
                                        real = offset + d;
                                        break;
                                case SeekOrigin.End:
-                                       real = offset + length - d;
+                                       real = end + d;
                                        break;
                                case SeekOrigin.Current:
-                                       real = s.Position + d;
+                                       real = position + d;
                                        break;
                                default:
                                        throw new ArgumentException ();
                                }
 
                                long virt = real - offset;
-                               if (virt < 0 || virt >= length)
+                               if (virt < 0 || virt > Length)
                                        throw new ArgumentException ();
 
-                               return s.Seek (real, SeekOrigin.Begin) - offset;
+                               position = s.Seek (real, SeekOrigin.Begin);
+                               return position;
                        }
        
                        public override void SetLength (long value)
@@ -121,15 +153,18 @@ namespace System.Web
                        }
        
                        public override long Length {
-                               get { return length; }
+                               get { return end - offset; }
                        }
        
                        public override long Position {
                                get {
-                                       return s.Position - offset;
+                                       return position - offset;
                                }
                                set {
-                                       Seek (Position, SeekOrigin.Begin);
+                                       if (value > Length)
+                                               throw new ArgumentOutOfRangeException ();
+
+                                       position = Seek (value, SeekOrigin.Begin);
                                }
                        }
                }
index aba8c57ab6537615d615ae1dddbf90238849a903..d4d5bb15696e14da57ad22a9a52dcd5308f8d1a6 100644 (file)
@@ -34,6 +34,8 @@ using System.Collections;
 using System.Collections.Specialized;
 using System.IO;
 using System.Runtime.InteropServices;
+using System.Security;
+using System.Security.Permissions;
 using System.Web.Configuration;
 using System.Web.UI;
 using System.Web.Util;
@@ -41,6 +43,8 @@ using System.Globalization;
 
 namespace System.Web {
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpRequest {
                HttpWorkerRequest worker_request;
                HttpContext context;
@@ -97,7 +101,7 @@ namespace System.Web {
                {
                        uri_builder = new UriBuilder ();
                        uri_builder.Scheme = worker_request.GetProtocol ();
-                       uri_builder.Host = worker_request.GetLocalAddress ();
+                       uri_builder.Host = worker_request.GetServerName ();
                        int port = worker_request.GetLocalPort ();
                        uri_builder.Port = port;
                        uri_builder.Path = worker_request.GetUriPath ();
@@ -219,7 +223,7 @@ namespace System.Web {
                        get {
                                if (content_length == -1){
                                        if (worker_request == null)
-                                               throw new HttpException ("No HttpWorkerRequest");
+                                               return 0;
 
                                        string cl = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderContentLength);
 
@@ -241,12 +245,11 @@ namespace System.Web {
                public string ContentType {
                        get {
                                if (content_type == null){
-                                       if (worker_request == null)
-                                               throw new HttpException ("No HttpWorkerRequest");
+                                       if (worker_request != null)
+                                               content_type = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderContentType);
 
-                                       content_type = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderContentType);
                                        if (content_type == null)
-                                               content_type = "";
+                                               content_type = String.Empty;
                                }
                                
                                return content_type;
@@ -259,9 +262,13 @@ namespace System.Web {
 
                public HttpCookieCollection Cookies {
                        get {
-                               if (cookies == null){
-                                       string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
-                                       cookies = new HttpCookieCollection (cookie_hv);
+                               if (cookies == null) {
+                                       if (worker_request == null) {
+                                               cookies = new HttpCookieCollection ();
+                                       } else {
+                                               string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
+                                               cookies = new HttpCookieCollection (cookie_hv);
+                                       }
                                }
 
                                if (validate_cookies && !checked_cookies){
@@ -286,7 +293,7 @@ namespace System.Web {
                public string FilePath {
                        get {
                                if (worker_request == null)
-                                       return null;
+                                       return "/"; // required for 2.0
 
                                if (file_path == null)
                                        file_path = UrlUtils.Canonic (worker_request.GetFilePath ());
@@ -311,13 +318,17 @@ namespace System.Web {
                        get {
                                if (files == null) {
                                        files = new HttpFileCollection ();
-                                       if (IsContentType ("multipart/form-data"))
+                                       if ((worker_request != null) && IsContentType ("multipart/form-data", true)) {
+                                               form = new WebROCollection ();
                                                LoadMultiPart ();
+                                               form.Protect ();
+                                       }
                                }
                                return files;
                        }
                }
 
+               [MonoTODO]
                public Stream Filter {
                        get {
                                throw new NotImplementedException ();
@@ -337,7 +348,7 @@ namespace System.Web {
 
                        if (stream is MemoryStream) {
                                MemoryStream other = (MemoryStream) stream;
-                               return new MemoryStream (other.GetBuffer (), 0, (int) other.Length, false);
+                               return new MemoryStream (other.GetBuffer (), 0, (int) other.Length, false, true);
                        }
 
                        throw new NotSupportedException ("The stream is " + stream.GetType ());
@@ -349,11 +360,14 @@ namespace System.Web {
                void LoadMultiPart ()
                {
                        string boundary = GetParameter (ContentType, "; boundary=");
+                       if (boundary == null)
+                               return;
+
                        Stream input = StreamCopy (InputStream);
                        HttpMultipart multi_part = new HttpMultipart (input, boundary, ContentEncoding);
 
                        HttpMultipart.Element e;
-                       while (multi_part.ReadNextElement (out e)) {
+                       while ((e = multi_part.ReadNextElement ()) != null) {
                                if (e.Filename == null){
                                        byte [] copy = new byte [e.Length];
                                
@@ -418,8 +432,11 @@ namespace System.Web {
                                AddRawKeyValue (key, value);
                }
                
-               bool IsContentType (string ct)
+               bool IsContentType (string ct, bool starts_with)
                {
+                       if (starts_with)
+                               return StrUtils.StartsWith (ContentType, ct, true);
+
                        return String.Compare (ContentType, ct, true, CultureInfo.InvariantCulture) == 0;
                }
                
@@ -429,9 +446,9 @@ namespace System.Web {
                                        form = new WebROCollection ();
                                        files = new HttpFileCollection ();
 
-                                       if (IsContentType ("application/x-www-form-urlencoded"))
+                                       if (IsContentType ("application/x-www-form-urlencoded", false))
                                                LoadWwwForm ();
-                                       else if (IsContentType ("multipart/form-data"))
+                                       else if (IsContentType ("multipart/form-data", true))
                                                LoadMultiPart ();
 
                                        form.Protect ();
@@ -449,11 +466,12 @@ namespace System.Web {
                public NameValueCollection Headers {
                        get {
                                if (headers == null){
-                                       if (worker_request == null)
-                                               throw new HttpException ("No HttpWorkerRequest");
-                                               
                                        headers = new WebROCollection ();
-                                       
+                                       if (worker_request == null) {
+                                               headers.Protect ();
+                                               return headers;
+                                       }
+
                                        for (int i = 0; i < HttpWorkerRequest.RequestHeaderMaximum; i++){
                                                string hval = worker_request.GetKnownRequestHeader (i);
 
@@ -484,6 +502,8 @@ namespace System.Web {
                                if (http_method == null){
                                        if (worker_request != null)
                                                http_method = worker_request.GetHttpVerbName ();
+                                       else
+                                               http_method = "GET";
                                }
                                return http_method;
                        }
@@ -541,15 +561,17 @@ namespace System.Web {
                        if (total < content_length)
                                throw new HttpException (411, "The uploaded file is incomplete");
                                                         
-                       input_stream = new MemoryStream (content);
+                       input_stream = new MemoryStream (content, 0, content.Length, false, true);
                }
 #else
                const int INPUT_BUFFER_SIZE = 32*1024;
 
                void MakeInputStream ()
                {
-                       if (worker_request == null)
-                               throw new HttpException ("No HttpWorkerRequest");
+                       if (worker_request == null) {
+                               input_stream = new MemoryStream (new byte [0], 0, 0, false, true);
+                               return;
+                       }
 
                        //
                        // Use an unmanaged memory block as this might be a large
@@ -567,9 +589,9 @@ namespace System.Web {
                        // we check the instance field 'content_length' here, not the local var.
                        if (this.content_length == 0 || worker_request.IsEntireEntityBodyIsPreloaded ()) {
                                if (buffer == null || content_length == 0) {
-                                       input_stream = new MemoryStream (new byte [0], false);
+                                       input_stream = new MemoryStream (new byte [0], 0, 0, false, true);
                                } else {
-                                       input_stream = new MemoryStream (buffer, 0, buffer.Length, false);
+                                       input_stream = new MemoryStream (buffer, 0, buffer.Length, false, true);
                                }
                                return;
                        }
@@ -613,7 +635,7 @@ namespace System.Web {
                                                throw new HttpException (400, "Upload size exceeds httpRuntime limit.");
                                        ms.Write (buffer, 0, n);
                                }
-                               input_stream = new MemoryStream (ms.GetBuffer (), 0, (int) ms.Length, false);
+                               input_stream = new MemoryStream (ms.GetBuffer (), 0, (int) ms.Length, false, true);
                        }
 
                        if (total < content_length)
@@ -646,17 +668,34 @@ namespace System.Web {
 
                public bool IsSecureConnection {
                        get {
+                               if (worker_request == null)
+                                       return false;
                                return worker_request.IsSecure ();
                        }
                }
 
                public string this [string key] {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Low)]
                        get {
-                               return Params [key];
+                               // "The QueryString, Form, Cookies, or ServerVariables collection member
+                               // specified in the key parameter."
+                               string val = QueryString [key];
+                               if (val == null)
+                                       val = Form [key];
+                               if (val == null) {
+                                       HttpCookie cookie = Cookies [key];
+                                       if (cookie != null)
+                                               val = cookie.Value;
+                               }
+                               if (val == null)
+                                       val = ServerVariables [key];
+
+                               return val;
                        }
                }
 
                public NameValueCollection Params {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Low)]
                        get {
                                if (all_params == null) {
                                        all_params = new WebROCollection ();
@@ -691,7 +730,7 @@ namespace System.Web {
                        get {
                                if (path_info == null) {
                                        if (worker_request == null)
-                                               return null;
+                                               return String.Empty;
                                        path_info = worker_request.GetPathInfo ();
                                }
 
@@ -702,16 +741,27 @@ namespace System.Web {
                public string PhysicalApplicationPath {
                        get {
                                if (worker_request == null)
-                                       throw new NullReferenceException ();
-                               
-                               return HttpRuntime.AppDomainAppPath;
+                                       throw new ArgumentNullException (); // like 2.0, 1.x throws TypeInitializationException
+
+                               string path = HttpRuntime.AppDomainAppPath;
+                               if (SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
+                               }
+                               return path;
                        }
                }
 
                public string PhysicalPath {
                        get {
+                               if (worker_request == null)
+                                       return String.Empty; // don't check security with an empty string!
+
                                if (physical_path == null)
                                        physical_path = MapPath (CurrentExecutionFilePath);
+
+                               if (SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, physical_path).Demand ();
+                               }
                                return physical_path;
                        }
                }
@@ -789,6 +839,8 @@ namespace System.Web {
                                        if (worker_request != null) {
                                                request_type = worker_request.GetHttpVerbName ();
                                                http_method = request_type;
+                                       } else {
+                                               request_type = "GET";
                                        }
                                }
                                return request_type;
@@ -800,6 +852,7 @@ namespace System.Web {
                }
 
                public NameValueCollection ServerVariables {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Low)]
                        get {
                                if (server_variables == null)
                                        server_variables = new ServerVariablesCollection (this);
@@ -826,24 +879,40 @@ namespace System.Web {
 
                public Uri UrlReferrer {
                        get {
-                               return new Uri (worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderReferer));
+                               if (worker_request == null)
+                                       return null;
+
+                               string hr = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderReferer);
+                               if (hr == null)
+                                       return null;
+
+                               return new Uri (hr);
                        }
                }
 
                public string UserAgent {
                        get {
+                               if (worker_request == null)
+                                       return null;
+
                                return worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderUserAgent);
                        }
                }
 
                public string UserHostAddress {
                        get {
+                               if (worker_request == null)
+                                       return null;
+
                                return worker_request.GetRemoteAddress ();
                        }
                }
 
                public string UserHostName {
                        get {
+                               if (worker_request == null)
+                                       return null;
+
                                return worker_request.GetRemoteName ();
                        }
                }
@@ -862,8 +931,8 @@ namespace System.Web {
 
                public byte [] BinaryRead (int count)
                {
-                       if (count <= 0)
-                               throw new ArgumentException ("count is <= 0");
+                       if (count < 0)
+                               throw new ArgumentException ("count is < 0");
 
                        Stream s = InputStream;
                        byte [] ret = new byte [count];
@@ -907,6 +976,9 @@ namespace System.Web {
 
                public string MapPath (string virtualPath)
                {
+                       if (worker_request == null)
+                               return null;
+
                        return MapPath (virtualPath, BaseVirtualDir, true);
                }
 
@@ -949,9 +1021,13 @@ namespace System.Web {
                        Stream output = new FileStream (filename, FileMode.Create);
                        if (includeHeaders) {
                                StringBuilder sb = new StringBuilder ();
-                               string version = worker_request.GetHttpVersion ();
-                               InitUriBuilder ();
-                               string path = uri_builder.Path;
+                               string version = String.Empty;
+                               string path = "/";
+                               if (worker_request != null) {
+                                       version = worker_request.GetHttpVersion ();
+                                       InitUriBuilder ();
+                                       path = uri_builder.Path;
+                               }
                                string qs = null;
                                if (query_string != null && query_string != "")
                                        qs = "?" + query_string;
@@ -1149,9 +1225,9 @@ namespace System.Web {
        // limit-less HttpInputFiles). 
        //
        
-       struct HttpMultipart {
+       class HttpMultipart {
 
-               public struct Element {
+               public class Element {
                        public string ContentType;
                        public string Name;
                        public string Filename;
@@ -1166,9 +1242,12 @@ namespace System.Web {
                }
                
                Stream data;
-               byte [] boundary;
+               string boundary;
+               byte [] boundary_bytes;
+               byte [] buffer;
                bool at_eof;
                Encoding encoding;
+               StringBuilder sb;
                
                const byte HYPHEN = (byte) '-', LF = (byte) '\n', CR = (byte) '\r';
                
@@ -1184,61 +1263,40 @@ namespace System.Web {
                
                public HttpMultipart (Stream data, string b, Encoding encoding)
                {
-                       this = new HttpMultipart ();
                        this.data = data;
-
-                       boundary = new byte [b.Length];
-                       for (int i = 0; i < b.Length; i++)
-                               boundary [i] = (byte) b [i];
-                            
+                       boundary = b;
+                       boundary_bytes = encoding.GetBytes (b);
+                       buffer = new byte [boundary_bytes.Length + 2]; // CRLF or '--'
                        this.encoding = encoding;
-                       
-                       while (!ReadLineForBoundary ())
-                               ;
+                       sb = new StringBuilder ();
                }
 
-               void ReadToEndOfLine ()
-               {
-                       while (Read () != CR || Read () != LF)
-                               ;
-               }
-               
-               byte Read ()
+               string ReadLine ()
                {
-                       int b = data.ReadByte ();
-                       if (b == -1)
-                               throw new Exception ("Unexpected end of multipart data");
-                       return (byte) b;
-               }
-        
-        
-               bool ReadLineForBoundary ()
-               {
-                       for (int i = 0; i < boundary.Length; i ++) {
-                               if (Read () == boundary [i])
-                                       continue;
-                               
-                               ReadToEndOfLine ();
-                               return false;
-                       }
-                       
-                       long pos = data.Position;
-                       
-                       byte b = Read ();
-                       if (b == CR && Read () == LF)
-                               return true;
-                       
-                       if (b == HYPHEN && Read () == HYPHEN && Read () == CR && Read () == LF){
-                               at_eof = true;
-                               return true;
+                       // CRLF or LF are ok as line endings.
+                       bool got_cr = false;
+                       int b = 0;
+                       sb.Length = 0;
+                       while (true) {
+                               b = data.ReadByte ();
+                               if (b == -1) {
+                                       return null;
+                               }
+
+                               if (b == LF) {
+                                       break;
+                               }
+                               got_cr = (b == CR);
+                               sb.Append ((char) b);
                        }
-                       
-                       data.Position = pos;
-                       
-                       ReadToEndOfLine ();
-                       return false;           
+
+                       if (got_cr)
+                               sb.Length--;
+
+                       return sb.ToString ();
+
                }
-               
+
                static string GetContentDispositionAttribute (string l, string name)
                {
                        int idx = l.IndexOf (name + "=\"");
@@ -1252,49 +1310,162 @@ namespace System.Web {
                                return "";
                        return l.Substring (begin, end - begin);
                }
-               
-               public bool ReadNextElement (out Element elem)
+
+               bool ReadBoundary ()
                {
-                       // When this gets called, we are at the end of the \r\n from the boundary line.
-                       
-                       elem = new Element ();
-                       if (at_eof)
+                       try {
+                               string line = ReadLine ();
+                               while (line == "")
+                                       line = ReadLine ();
+                               int ll = line.Length;
+                               int bl = boundary.Length;
+                               if (line [0] != '-' || line [1] != '-')
+                                       return false;
+
+                               if (!StrUtils.EndsWith (line, boundary, false))
+                                       return true;
+                       } catch {
+                       }
+
+                       return false;
+               }
+
+               bool IsBoundary (string line)
+               {
+                       if (line.Length < 2)
                                return false;
-                       
+
+                       int ll = line.Length;
+                       int bl = boundary.Length;
+                       if (line [0] != '-' || line [1] != '-')
+                               return false;
+
+                       if (line.IndexOf (boundary) != 2)
+                               return false;
+
+                       if (ll == bl + 4 && line [ll -1] == '-' && line [ll - 2] == '-')
+                               at_eof = true;
+
+                       return  (at_eof || ll == bl + 2);
+               }
+
+               string ReadHeaders ()
+               {
+                       string s = ReadLine ();
+                       if (s == "")
+                               return null;
+
+                       return s;
+               }
+
+               bool CompareBytes (byte [] orig, byte [] other)
+               {
+                       for (int i = orig.Length - 1; i >= 0; i--)
+                               if (orig [i] != other [i])
+                                       return false;
+
+                       return true;
+               }
+
+               long MoveToNextBoundary ()
+               {
+                       long retval = 0;
+                       bool got_cr = false;
+
+                       int state = 0;
+                       int c = data.ReadByte ();
                        while (true) {
-                               long start = data.Position;
-                               ReadToEndOfLine ();
-                               long end = data.Position;
-                               int length = (int) (end - start - 2);
-                               // Blank line means end of headers
-                               if (length == 0)
+                               if (c == -1)
+                                       return -1;
+
+                               if (state == 0 && c == LF) {
+                                       retval = data.Position - 1;
+                                       if (got_cr)
+                                               retval--;
+                                       state = 1;
+                                       c = data.ReadByte ();
+                               } else if (state == 0) {
+                                       got_cr = (c == CR);
+                                       c = data.ReadByte ();
+                               } else if (state == 1 && c == '-') {
+                                       c = data.ReadByte ();
+                                       if (c == -1)
+                                               return -1;
+
+                                       if (c != '-') {
+                                               state = 0;
+                                               got_cr = false;
+                                               continue; // no ReadByte() here
+                                       }
+
+                                       int nread = data.Read (buffer, 0, buffer.Length);
+                                       int bl = buffer.Length;
+                                       if (nread != bl)
+                                               return -1;
+
+                                       if (!CompareBytes (boundary_bytes, buffer)) {
+                                               state = 0;
+                                               data.Position = retval + 2;
+                                               if (got_cr) {
+                                                       data.Position++;
+                                                       got_cr = false;
+                                               }
+                                               c = data.ReadByte ();
+                                               continue;
+                                       }
+
+                                       if (buffer [bl - 2] == '-' && buffer [bl - 1] == '-') {
+                                               at_eof = true;
+                                       } else if (buffer [bl - 2] != CR || buffer [bl - 1] != LF) {
+                                               state = 0;
+                                               data.Position = retval + 2;
+                                               if (got_cr) {
+                                                       data.Position++;
+                                                       got_cr = false;
+                                               }
+                                               c = data.ReadByte ();
+                                               continue;
+                                       }
+                                       data.Position = retval + 2;
+                                       if (got_cr)
+                                               data.Position++;
                                        break;
-                               
-                               byte [] buf = new byte [length];
-                               data.Position = start;
-                               data.Read (buf, 0, length);
-                               data.Position = end;
-                               
-                               string line = encoding.GetString (buf, 0, buf.Length);
-                               if (StrUtils.StartsWith (line, "Content-Disposition:", true)) {
-                                       elem.Name = GetContentDispositionAttribute (line, "name");
-                                       elem.Filename = GetContentDispositionAttribute (line, "filename");      
-                               } else if (StrUtils.StartsWith (line, "Content-Type:", true)) {
-                                       elem.ContentType = line.Substring ("Content-Type:".Length).Trim ();
-                               }               
+                               } else {
+                                       // state == 1
+                                       state = 0; // no ReadByte() here
+                               }
                        }
-                       
-                       long d_start = data.Position;
-                       long d_length = 0;
-                       while (! ReadLineForBoundary ())
-                               d_length = data.Position - d_start - 2;
-                       
-                       elem.Start = d_start;
-                       elem.Length = d_length;
-                       
-                       return true;
+
+                       return retval;
+               }
+
+               public Element ReadNextElement ()
+               {
+                       if (at_eof || ReadBoundary ())
+                               return null;
+
+                       Element elem = new Element ();
+                       string header;
+                       while ((header = ReadHeaders ()) != null) {
+                               if (StrUtils.StartsWith (header, "Content-Disposition:", true)) {
+                                       elem.Name = GetContentDispositionAttribute (header, "name");
+                                       elem.Filename = GetContentDispositionAttribute (header, "filename");      
+                               } else if (StrUtils.StartsWith (header, "Content-Type:", true)) {
+                                       elem.ContentType = header.Substring ("Content-Type:".Length).Trim ();
+                               }
+                       }
+
+                       long start = data.Position;
+                       elem.Start = start;
+                       long pos = MoveToNextBoundary ();
+                       if (pos == -1)
+                               return null;
+
+                       elem.Length = pos - start;
+                       return elem;
                }
                
        }
 #endregion
 }
+
index 30d68b039366d51eff1d373f097b898d55734cba..973931f72511f2bddef508022904a01567992b06 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 
 #if NET_2_0
 namespace System.Web
 {
-        [Serializable]
         public enum HttpRequestPriority
         {
-                Normal = 10,
-                High = 20,
-                Critical = 30,                
+                Normal,
+                High,
+                Critical
         }
 }
 #endif
index 10047ad676634f93caf6c9c9ce0017ea4702f96b..bb02d6f9e04e76e9b588a2290e3ea08b2f43ecc5 100644 (file)
@@ -3,10 +3,9 @@
 //
 // Authors:
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //
-// (c) 2003 Novell, Inc. (http://www.novell.com)
-//
-
+// Copyright (C) 2003,2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
 #if NET_1_1
-namespace System.Web
-{
-       public sealed class HttpRequestValidationException : HttpException
-       {
-               internal HttpRequestValidationException (string msg) : base (msg)
+
+using System.Security.Permissions;
+
+namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [Serializable]
+#endif
+       public sealed class HttpRequestValidationException : HttpException {
+
+#if NET_2_0
+               public HttpRequestValidationException ()
                {
                }
 
+               public HttpRequestValidationException (string message) 
+                       : base (message)
+               {
+               }
+
+               public HttpRequestValidationException (string message, Exception innerException) 
+                       : base (message, innerException)
+               {
+               }
+#else
+               internal HttpRequestValidationException (string msg) : base (msg)
+               {
+               }
+#endif
                internal override string Description {
                        get {
                                return  "Request validation detected a potentially dangerous input value " +
index b4fdb94ed5fc5e9be2f3e40bf332cdb52e638fe6..83b60174d2a914d3fc656a2ff6aa2ad84a26c0c8 100644 (file)
@@ -29,6 +29,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
 using System.Text;
 using System.Web.UI;
 using System.Collections;
@@ -38,9 +39,12 @@ using System.Web.Caching;
 using System.Threading;
 using System.Web.Util;
 using System.Globalization;
+using System.Security.Permissions;
 
 namespace System.Web {
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpResponse {
                internal HttpWorkerRequest WorkerRequest;
                internal HttpResponseStream output_stream;
@@ -150,17 +154,19 @@ namespace System.Web {
                //
                public Encoding ContentEncoding {
                        get {
-                               if (encoding == null){
-                                       string client_content_type = context.Request.ContentType;
-                                       string parameter = HttpRequest.GetParameter (client_content_type, "; charset=");
-                                       if (parameter != null){
-                                               try {
-                                                       // Do what the #1 web server does
-                                                       encoding = Encoding.GetEncoding (parameter);
-                                               } catch {
-                                                       encoding = WebEncoding.ResponseEncoding;
+                               if (encoding == null) {
+                                       if (context != null) {
+                                               string client_content_type = context.Request.ContentType;
+                                               string parameter = HttpRequest.GetParameter (client_content_type, "; charset=");
+                                               if (parameter != null) {
+                                                       try {
+                                                               // Do what the #1 web server does
+                                                               encoding = Encoding.GetEncoding (parameter);
+                                                       } catch {
+                                                       }
                                                }
-                                       } else
+                                       }
+                                       if (encoding == null)
                                                encoding = WebEncoding.ResponseEncoding;
                                }
                                return encoding;
@@ -231,7 +237,8 @@ namespace System.Web {
                                Cache.SetExpires (value);
                        }
                }
-               
+
+               [MonoTODO]
                public Stream Filter {
                        get {
                                throw new NotImplementedException ();
@@ -241,13 +248,31 @@ namespace System.Web {
                                throw new NotImplementedException ();
                        }
                }
-               
+#if NET_2_0
+               [MonoTODO]
+               public Encoding HeaderEncoding {
+                       get { throw new NotImplementedException (); }
+                       set {
+                               if (value == null)
+                                       throw new ArgumentNullException ("HeaderEncoding");
+                               throw new NotImplementedException ();
+                       }
+               }
+#endif
                public bool IsClientConnected {
                        get {
+                               if (WorkerRequest == null)
+                                       return true; // yep that's true
+
                                return WorkerRequest.IsClientConnected ();
                        }
                }
-               
+#if NET_2_0
+               [MonoTODO]
+               public bool IsRequestBeingRedirected {
+                       get { throw new NotImplementedException (); }
+               }
+#endif
                public TextWriter Output {
                        get {
                                if (writer == null)
@@ -340,22 +365,44 @@ namespace System.Web {
                                suppress_content = value;
                        }
                }
+#if NET_2_0
+               [MonoTODO]
+               public void AddCacheDependency (CacheDependency[] dependencies)
+               {
+                       throw new NotImplementedException ();
+               }
 
+               [MonoTODO]
+               public void AddCacheItemDependencies (string[] cacheKeys)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+               [MonoTODO]
                public void AddCacheItemDependencies (ArrayList cacheKeys)
                {
                        // TODO: talk to jackson about the cache
                }
 
+               [MonoTODO]
                public void AddCacheItemDependency (string cacheKey)
                {
                        // TODO: talk to jackson about the cache
                }
 
+               [MonoTODO]
                public void AddFileDependencies (ArrayList filenames)
                {
                        // TODO: talk to jackson about the cache
                }
-
+#if NET_2_0
+               [MonoTODO]
+               public void AddFileDependencies (string[] filenames)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+               [MonoTODO]
                public void AddFileDependency (string filename)
                {
                        // TODO: talk to jackson about the cache
@@ -406,6 +453,7 @@ namespace System.Web {
                        headers.Add (new UnknownResponseHeader (name, value));
                }
 
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
                public void AppendToLog (string param)
                {
                        Console.Write ("System.Web: ");
@@ -510,7 +558,8 @@ namespace System.Web {
                {
                        if (closed)
                                return;
-                       WorkerRequest.CloseConnection ();
+                       if (WorkerRequest != null)
+                               WorkerRequest.CloseConnection ();
                        closed = true;
                }
 
@@ -532,7 +581,8 @@ namespace System.Web {
                //   Cache-Control
                void WriteHeaders (bool final_flush)
                {
-                       WorkerRequest.SendStatus (status_code, StatusDescription);
+                       if (WorkerRequest != null)
+                               WorkerRequest.SendStatus (status_code, StatusDescription);
 
                        if (cached_response != null)
                                cached_response.SetHeaders (headers);
@@ -631,12 +681,15 @@ namespace System.Web {
                        //
                        // Flush
                        //
-                       HttpApplication app_instance = context.ApplicationInstance;
-                       if (app_instance != null)
-                               app_instance.TriggerPreSendRequestHeaders ();
-                               
-                       foreach (BaseResponseHeader header in write_headers){
-                               header.SendContent (WorkerRequest);
+                       if (context != null) {
+                               HttpApplication app_instance = context.ApplicationInstance;
+                               if (app_instance != null)
+                                       app_instance.TriggerPreSendRequestHeaders ();
+                       }
+                       if (WorkerRequest != null) {
+                               foreach (BaseResponseHeader header in write_headers){
+                                       header.SendContent (WorkerRequest);
+                               }
                        }
                        headers_sent = true;
                }
@@ -650,15 +703,19 @@ namespace System.Web {
                                WriteHeaders (final_flush);
                        }
 
-                       if (suppress_content || context.Request.HttpMethod == "HEAD") {
+                       bool head = ((context != null) && (context.Request.HttpMethod == "HEAD"));
+                       if (suppress_content || head) {
                                output_stream.Clear ();
-                               output_stream.Flush (WorkerRequest, final_flush);
+                               if (WorkerRequest != null)
+                                       output_stream.Flush (WorkerRequest, final_flush);
                                return;
                        }
 
-                       HttpApplication app_instance = context.ApplicationInstance;
-                       if (app_instance != null)
-                               app_instance.TriggerPreSendRequestContent ();
+                       if (context != null) {
+                               HttpApplication app_instance = context.ApplicationInstance;
+                               if (app_instance != null)
+                                       app_instance.TriggerPreSendRequestContent ();
+                       }
 
                        if (IsCached) {
                                byte [] data = output_stream.GetData ();
@@ -666,8 +723,10 @@ namespace System.Web {
                                cached_response.SetData (data);
                        }
 
-                       output_stream.Flush (WorkerRequest, final_flush);
+                       if (WorkerRequest != null)
+                               output_stream.Flush (WorkerRequest, final_flush);
 
+                       // FIXME
                        if (final_flush && use_chunked != null)
                                Write ("0\r\n\r\n");
                }
@@ -799,6 +858,8 @@ namespace System.Web {
                        if (size == 0)
                                return;
 
+                       // Note: this .ctor will throw a SecurityException if the caller 
+                       // doesn't have the UnmanagedCode permission
                        using (FileStream fs = new FileStream (fileHandle, FileAccess.Read))
                                WriteFile (fs, offset, size);
 
@@ -828,7 +889,13 @@ namespace System.Web {
 
                        Flush ();
                }
-
+#if NET_2_0
+               [MonoTODO]
+               public void WriteSubstitution (HttpResponseSubstitutionCallback callback)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
                //
                // Like WriteFile, but never buffers, so we manually Flush here
                //
@@ -899,29 +966,36 @@ namespace System.Web {
                //
                public string CacheControl {
                        set {
-                               if (String.Compare (value, "public", true, CultureInfo.InvariantCulture) == 0 || 
-                                   String.Compare (value, "private", true, CultureInfo.InvariantCulture) == 0 ||
-                                   String.Compare (value, "no-cache", true, CultureInfo.InvariantCulture) == 0)
-                                       cache_control = value;
+                               if (String.Compare (value, "public", true, CultureInfo.InvariantCulture) == 0)
+                                       Cache.SetCacheability (HttpCacheability.Public);
+                               else if (String.Compare (value, "private", true, CultureInfo.InvariantCulture) == 0)
+                                       Cache.SetCacheability (HttpCacheability.Private);
+                               else if (String.Compare (value, "no-cache", true, CultureInfo.InvariantCulture) == 0)
+                                       Cache.SetCacheability (HttpCacheability.NoCache);
                                else
                                        throw new ArgumentException ("CacheControl property only allows `public', " +
                                                                     "`private' or no-cache, for different uses, use " +
                                                                     "Response.AppendHeader");
-
+                               cache_control = value;
                        }
 
                        get {
-                               if (cache_policy != null){
-                                       switch (Cache.Cacheability){
-                                       case HttpCacheability.NoCache: return "private";
-                                       case HttpCacheability.Private: return "private";
-                                       case HttpCacheability.Server: return "private";
-                                       case HttpCacheability.Public: return "public";
-                                       case HttpCacheability.ServerAndPrivate: return "private";
+                               if ((cache_control == null) && (cache_policy != null)) {
+                                       switch (Cache.Cacheability) {
+                                       case (HttpCacheability)0:
+                                       case HttpCacheability.NoCache:
+                                               return "no-cache";
+                                       case HttpCacheability.Private: 
+                                       case HttpCacheability.Server:
+                                       case HttpCacheability.ServerAndPrivate:
+                                               return "private";
+                                       case HttpCacheability.Public:
+                                               return "public";
+                                       default:
+                                               throw new Exception ("Unknown internal state: " + Cache.Cacheability);
                                        }
-                                       throw new Exception ("Unknown internal state: " + Cache.Cacheability);
-                               } else
-                                       return cache_control;
+                               }
+                               return cache_control;
                        }
                }
 #endregion
index 8f2d3432104bb80c7f3004702fb5a30381e6d31c..b3f8dc289434ba0c2ec68b18ad24ce5038e4e71e 100644 (file)
@@ -451,7 +451,16 @@ namespace System.Web {
 
                        public override void Send (Stream stream)
                        {
-                               throw new NotImplementedException ();
+                               using (FileStream fs = File.OpenRead (file)) {
+                                       byte [] buffer = new byte [Math.Min (fs.Length, 32*1024)];
+
+                                       long remain = fs.Length;
+                                       int n;
+                                       while (remain > 0 && (n = fs.Read (buffer, 0, (int) Math.Min (remain, 32*1024))) != 0){
+                                               remain -= n;
+                                               stream.Write (buffer, 0, n);
+                                       }
+                               }
                        }
 
                        public override string ToString ()
@@ -522,9 +531,11 @@ namespace System.Web {
 
                        total += count;
                        while (count > 0) {
-                               int n = ((ByteBucket) cur_bucket).Write (buffer, offset, count);
-                               offset += n;
-                               count -= n;
+                               if (cur_bucket is ByteBucket) {
+                                       int n = ((ByteBucket) cur_bucket).Write (buffer, offset, count);
+                                       offset += n;
+                                       count -= n;
+                               }
        
                                if (split_after_file != null) {
                                        AppendBucket (split_after_file);
diff --git a/mcs/class/System.Web/System.Web/HttpResponseSubstitutionCallback.cs b/mcs/class/System.Web/System.Web/HttpResponseSubstitutionCallback.cs
new file mode 100644 (file)
index 0000000..6627d74
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// System.Web.HttpResponseSubstitutionCallback delegate
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Web {
+
+       public delegate string HttpResponseSubstitutionCallback (HttpContext context);
+
+}
+
+#endif
index cc4f6991047ec13f798766d96b52100abb8aee1e..bc194c6bdfb800cb211daeca70137f2a1627bc6a 100644 (file)
@@ -34,6 +34,8 @@ using System.IO;
 using System.Text;
 using System.Globalization;
 using System.Collections;
+using System.Security;
+using System.Security.Permissions;
 using System.Web.Caching;
 using System.Web.Configuration;
 using System.Web.UI;
@@ -41,6 +43,8 @@ using System.Threading;
 
 namespace System.Web {
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpRuntime {
 #if TARGET_J2EE
                static QueueManager queue_manager { get { return _runtime._queue_manager; } }
@@ -94,6 +98,9 @@ namespace System.Web {
                        do_RealProcessRequest = new WaitCallback (RealProcessRequest);
                }
 
+#if ONLY_1_1
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+#endif
                public HttpRuntime ()
                {
                }
@@ -104,19 +111,27 @@ namespace System.Web {
                // http://radio.weblogs.com/0105476/stories/2002/07/12/executingAspxPagesWithoutAWebServer.html
                //
                public static string AppDomainAppId {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
                        get {
                                //
                                // This value should not change across invocations
                                //
-                              
-                               return (string) AppDomain.CurrentDomain.GetData (".appId");
+                               string dirname = (string) AppDomain.CurrentDomain.GetData (".appId");
+                               if ((dirname != null) && (dirname.Length > 0) && SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                               }
+                               return dirname;
                        }
                }
 
                // Physical directory for the application
                public static string AppDomainAppPath {
                        get {
-                               return (string) AppDomain.CurrentDomain.GetData (".appPath");
+                               string dirname = (string) AppDomain.CurrentDomain.GetData (".appPath");
+                               if (SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                               }
+                               return dirname;
                        }
                }
 
@@ -127,6 +142,7 @@ namespace System.Web {
                }
 
                public static string AppDomainId {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
                        get {
                                return (string) AppDomain.CurrentDomain.GetData (".domainId");
                        }
@@ -134,14 +150,22 @@ namespace System.Web {
 
                public static string AspInstallDirectory {
                        get {
-                               return (string) AppDomain.CurrentDomain.GetData (".hostingInstallDir");
+                               string dirname = (string) AppDomain.CurrentDomain.GetData (".hostingInstallDir");
+                               if ((dirname != null) && (dirname.Length > 0) && SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                               }
+                               return dirname;
                        }
                }
 #endregion
                
                public static string BinDirectory {
                        get {
-                               return Path.Combine (AppDomainAppPath, "bin");
+                               string dirname = Path.Combine (AppDomainAppPath, "bin");
+                               if (SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                               }
+                               return dirname;
                        }
                }
 
@@ -153,17 +177,27 @@ namespace System.Web {
 
                public static string ClrInstallDirectory {
                        get {
-                               return Path.GetDirectoryName (typeof (Object).Assembly.CodeBase);
+                               string dirname = Path.GetDirectoryName (typeof (Object).Assembly.Location);
+                               if ((dirname != null) && (dirname.Length > 0) && SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                               }
+                               return dirname;
                        }
                }
 
                public static string CodegenDir {
                        get {
-                               return AppDomain.CurrentDomain.SetupInformation.DynamicBase;
+                               string dirname = AppDomain.CurrentDomain.SetupInformation.DynamicBase;
+                               if (SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                               }
+                               return dirname;
                        }
                }
 
+               [MonoTODO]
                public static bool IsOnUNCShare {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Low)]
                        get {
                                throw new NotImplementedException ();
                        }
@@ -171,10 +205,15 @@ namespace System.Web {
 
                public static string MachineConfigurationDirectory {
                        get {
-                               return Path.GetDirectoryName (WebConfigurationSettings.MachineConfigPath);
+                               string dirname = Path.GetDirectoryName (WebConfigurationSettings.MachineConfigPath);
+                               if ((dirname != null) && (dirname.Length > 0) && SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                               }
+                               return dirname;
                        }
                }
 
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public static void Close ()
                {
                        // Remove all items from cache.
@@ -196,23 +235,32 @@ namespace System.Web {
                        //
                        // Get application instance (create or reuse an instance of the correct class)
                        //
-                       HttpApplication app = HttpApplicationFactory.GetApplication (context);
+                       HttpApplication app = null;
+                       bool error = false;
+                       try {
+                               app = HttpApplicationFactory.GetApplication (context);
+                       } catch (Exception e) {
+                               FinishWithException ((HttpWorkerRequest) o, new HttpException ("", e));
+                               error = true;
+                       }
 
-                       context.ApplicationInstance = app;
+                       if (error) {
+                               context.Request.ReleaseResources ();
+                               context.Response.ReleaseResources ();
+                               HttpContext.Current = null;
+                       } else {
+                               context.ApplicationInstance = app;
                        
-                       //
-                       // Initialize, load modules specific on the config file.
-                       //
-
-                       //
-                       // Ask application to service the request
-                       //
-                       IHttpAsyncHandler ihah = app;
+                               //
+                               // Ask application to service the request
+                               //
+                               IHttpAsyncHandler ihah = app;
 
-                       IAsyncResult appiar = ihah.BeginProcessRequest (context, new AsyncCallback (request_processed), context);
-                       ihah.EndProcessRequest (appiar);
+                               IAsyncResult appiar = ihah.BeginProcessRequest (context, new AsyncCallback (request_processed), context);
+                               ihah.EndProcessRequest (appiar);
 
-                       HttpApplicationFactory.Recycle (app);
+                               HttpApplicationFactory.Recycle (app);
+                       }
                        
                        QueuePendingRequests ();
                }
@@ -224,14 +272,15 @@ namespace System.Web {
                //    ProcessRequest does not guarantee that `wr' will be processed synchronously,
                //    the request can be queued and processed later.
                //
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
                public static void ProcessRequest (HttpWorkerRequest wr)
                {
-                       HttpWorkerRequest request;
-
+                       if (wr == null)
+                               throw new ArgumentNullException ("wr");
                        //
                        // Queue our request, fetch the next available one from the queue
                        //
-                       request = queue_manager.GetNextRequest (wr);
+                       HttpWorkerRequest request = queue_manager.GetNextRequest (wr);
                        if (request == null)
                                return;
 
@@ -253,6 +302,7 @@ namespace System.Web {
                // Called when we are shutting down or we need to reload an application
                // that has been modified (touch global.asax) 
                //
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public static void UnloadAppDomain ()
                {
                        //
@@ -268,6 +318,12 @@ namespace System.Web {
                {
                        // Kill our application.
                        HttpApplicationFactory.Dispose ();
+                       ThreadPool.QueueUserWorkItem (new WaitCallback (DoUnload), null);
+               }
+
+               static void DoUnload (object state)
+               {
+                       AppDomain.Unload (AppDomain.CurrentDomain);
                }
 
                 static string content503 = "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" +
@@ -275,6 +331,22 @@ namespace System.Web {
                        "<h1>Server Unavailable</h1>\n" +
                        "</body></html>\n";
 
+               static void FinishWithException (HttpWorkerRequest wr, HttpException e)
+               {
+                       int code = e.GetHttpCode ();
+                       wr.SendStatus (code, HttpWorkerRequest.GetStatusDescription (code));
+                       wr.SendUnknownResponseHeader ("Connection", "close");
+                       wr.SendUnknownResponseHeader ("Date", DateTime.Now.ToUniversalTime ().ToString ("r"));
+                       Encoding enc = Encoding.ASCII;
+                       wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
+                       string msg = e.GetHtmlErrorMessage ();
+                       byte [] contentBytes = enc.GetBytes (msg);
+                       wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
+                       wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
+                       wr.FlushResponse (true);
+                       wr.CloseConnection ();
+               }
+
                //
                // This is called from the QueueManager if a request
                // can not be processed (load, no resources, or
@@ -282,24 +354,16 @@ namespace System.Web {
                //
                static internal void FinishUnavailable (HttpWorkerRequest wr)
                {
-                       string host = "FIXME";
-                       string location = "FIXME";
-                               
-                       //
-                       // From Mono.WebServer
-                       //
                        wr.SendStatus (503, "Service unavailable");
-                        wr.SendUnknownResponseHeader ("Connection", "close");
-                        wr.SendUnknownResponseHeader ("Date", DateTime.Now.ToUniversalTime ().ToString ("r"));
-                        wr.SendUnknownResponseHeader ("Location", String.Format ("http://{0}{1}", host, location));
-                        Encoding enc = Encoding.ASCII;
-                        wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
-                        byte [] contentBytes = enc.GetBytes (content503);
-                        wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
-                        wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
-                        wr.FlushResponse (true);
-                        wr.CloseConnection ();
-                       
+                       wr.SendUnknownResponseHeader ("Connection", "close");
+                       wr.SendUnknownResponseHeader ("Date", DateTime.Now.ToUniversalTime ().ToString ("r"));
+                       Encoding enc = Encoding.ASCII;
+                       wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
+                       byte [] contentBytes = enc.GetBytes (content503);
+                       wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
+                       wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
+                       wr.FlushResponse (true);
+                       wr.CloseConnection ();
                }
 
                internal static TraceManager TraceManager {
index 1205e177435008a7df821de0701e088e6021a5ab..01796b837f64aa66b35ae7f6963b99a4fad6a09a 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
 using System.Web.UI;
 using System.Web.Util;
 using System.Collections.Specialized;
+using System.Security.Permissions;
 
 namespace System.Web {
 
@@ -42,6 +42,8 @@ namespace System.Web {
        // Methods exposed through HttpContext.Server property
        //
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpServerUtility {
                HttpContext context;
                
@@ -55,16 +57,19 @@ namespace System.Web {
                        context.ClearError ();
                }
 
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public object CreateObject (string progID)
                {
                        throw new HttpException (500, "COM is not supported");
                }
 
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public object CreateObject (Type type)
                {
                        throw new HttpException (500, "COM is not supported");
                }
 
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public object CreateObjectFromClsid (string clsid)
                {
                        throw new HttpException (500, "COM is not supported");
@@ -189,7 +194,13 @@ namespace System.Web {
                        Execute (path, null, preserveForm);
                        context.Response.End ();
                }
-
+#if NET_2_0
+               [MonoTODO]
+               public void Transfer (IHttpHandler handler, bool preserveForm)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
                public string UrlDecode (string s)
                {
                        return HttpUtility.UrlDecode (s);
@@ -230,13 +241,17 @@ namespace System.Web {
                }
 
                public string MachineName {
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
+                       // Medium doesn't look heavy enough to replace this... reported as
+                       [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+                       [EnvironmentPermission (SecurityAction.Assert, Read = "COMPUTERNAME")]
                        get { return Environment.MachineName; }
                }
 
                public int ScriptTimeout {
                        get { return (int) context.ConfigTimeout.TotalSeconds; }
+                       [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
                        set { context.ConfigTimeout = new TimeSpan (0, 0, value); }
                }
        }
 }
-
index 873da72de7c41e44ea1723b3fd7f5e683f9f88fb..72b7324909295b53a328d76ce8245824a3b0b26c 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Collections;
 using System.IO;
+using System.Security.Permissions;
 using System.Web.UI;
 
 namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpStaticObjectsCollection : ICollection, IEnumerable {
                private Hashtable _Objects;
 
@@ -55,9 +59,18 @@ namespace System.Web {
                }
 
                // Needs to hold object items that can be latebound and can be serialized
+#if ONLY_1_1
+               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
+#endif
                public HttpStaticObjectsCollection ()
                {
-                       _Objects = new Hashtable();
+                       _Objects = new Hashtable ();
+               }
+
+               // this ctor has no security requirements and is used when creating HttpApplicationState
+               internal HttpStaticObjectsCollection (HttpApplicationState appstate)
+               {
+                       _Objects = new Hashtable ();
                }
 
                public object GetObject (string name)
@@ -102,6 +115,13 @@ namespace System.Web {
                        get { return false; }
                }
 
+#if NET_2_0
+               [MonoTODO]
+               public bool NeverAccessed {
+                       get { throw new NotImplementedException (); }
+               }
+#endif
+
                public object SyncRoot {
                        get { return this; }
                }
@@ -128,33 +148,41 @@ namespace System.Web {
                        _Objects [name] = obj;
                }
 
-               internal void Serialize (BinaryWriter w)
+#if NET_2_0
+               public void Serialize (BinaryWriter writer)
+#else
+               internal void Serialize (BinaryWriter writer)
+#endif
                {
                        lock (_Objects) {
-                               w.Write (Count);
+                               writer.Write (Count);
                                foreach (string key in _Objects.Keys) {
-                                       w.Write (key);
+                                       writer.Write (key);
                                        object value = _Objects [key];
                                        if (value == null) {
-                                               w.Write (System.Web.Util.AltSerialization.NullIndex);
+                                               writer.Write (System.Web.Util.AltSerialization.NullIndex);
                                                continue;
                                        }
 
-                                       System.Web.Util.AltSerialization.SerializeByType (w, value);
+                                       System.Web.Util.AltSerialization.SerializeByType (writer, value);
                                }
                        }
                }
 
-               internal static HttpStaticObjectsCollection Deserialize (BinaryReader r)
+#if NET_2_0
+               public static HttpStaticObjectsCollection Deserialize (BinaryReader reader)
+#else
+               internal static HttpStaticObjectsCollection Deserialize (BinaryReader reader)
+#endif
                {
                        HttpStaticObjectsCollection result = new HttpStaticObjectsCollection ();
-                       for (int i = r.ReadInt32 (); i > 0; i--) {
-                               string key = r.ReadString ();
-                               int index = r.ReadInt32 ();
+                       for (int i = reader.ReadInt32 (); i > 0; i--) {
+                               string key = reader.ReadString ();
+                               int index = reader.ReadInt32 ();
                                if (index == System.Web.Util.AltSerialization.NullIndex)
                                        result.Set (key, null);
                                else
-                                       result.Set (key, System.Web.Util.AltSerialization.DeserializeFromIndex (index, r));
+                                       result.Set (key, System.Web.Util.AltSerialization.DeserializeFromIndex (index, reader));
                        }
 
                        return result;
index 611d9bfbdbcd0f204787a67f302af6735a9ab291..f58799ead36caad3bb9cd6263fdef5f69d9da8a6 100644 (file)
@@ -1,12 +1,12 @@
-// \r
-// System.Web.HttpUnhandledException.cs\r
-//\r
-// Author:\r
-//   Tim Coleman (tim@timcoleman.com)\r
-//\r
-// Copyright (C) Tim Coleman, 2002\r
-//\r
-
+// 
+// System.Web.HttpUnhandledException.cs
+//
+// Authors:
+//     Tim Coleman (tim@timcoleman.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) Tim Coleman, 2002
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-namespace System.Web {\r
-       public sealed class HttpUnhandledException : HttpException {\r
-\r
-               #region Constructors\r
-\r
-               internal HttpUnhandledException (string message, Exception innerException)\r
-                       : base (message, innerException)\r
-               {\r
-               }\r
-\r
-               internal HttpUnhandledException (string message, string x, Exception innerException)\r
-                       : base (message, innerException)\r
-               {\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+
+using System.Security.Permissions;
+
+namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+       [Serializable]
+#endif
+       public sealed class HttpUnhandledException : HttpException {
+
+#if NET_2_0
+               public HttpUnhandledException ()
+               {
+               }
+
+               public HttpUnhandledException (string message)
+                       : base (message)
+               {
+               }
+
+               public HttpUnhandledException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+#else
+               internal HttpUnhandledException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+#endif
+       }
+}
index a58df029e00d012f08586ba5866324f28e755d33..1e2c3b16acc0c9c24e5d5e2f1a65ff41855ce94d 100644 (file)
@@ -7,7 +7,7 @@
 //   Tim Coleman (tim@timcoleman.com)
 //   Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Collections;
+using System.Collections.Specialized;
 using System.Globalization;
 using System.IO;
+using System.Security.Permissions;
 using System.Text;
 using System.Web.Util;
 
 namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpUtility {
 
                #region Fields
@@ -316,7 +321,10 @@ namespace System.Web {
                        entities.Add ("rsaquo", '\u203A');
                        entities.Add ("euro", '\u20AC');
                }
-       
+
+#if NET_2_0
+               [Obsolete]
+#endif
                public HttpUtility () 
                {
                }
@@ -449,8 +457,10 @@ namespace System.Web {
                
                public static string UrlDecode (byte [] bytes, int offset, int count, Encoding e)
                {
-                       if (bytes == null || count == 0)
+                       if (bytes == null)
                                return null;
+                       if (count == 0)
+                               return String.Empty;
 
                        if (bytes == null)
                                throw new ArgumentNullException ("bytes");
@@ -529,6 +539,8 @@ namespace System.Web {
                {
                        if (bytes == null)
                                return null;
+                       if (count == 0)
+                               return new byte [0];
 
                        int len = bytes.Length;
                        if (offset < 0 || offset >= len)
@@ -901,6 +913,21 @@ namespace System.Web {
                        return s2;
                }
 #endif
+
+#if NET_2_0
+               [MonoTODO]
+               public static NameValueCollection ParseQueryString (string query)
+               {
+                       // LAMESPEC: default encoding not specified
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NameValueCollection ParseQueryString (string query, Encoding encoding)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
                #endregion // Methods
        }
 }
index de8e38446799666e28affb7a42ebe39b4913f3b9..1d9f0faa15cdcde8cf99ed4c4320654c7370e8de 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-
-using System.Web.UI;
 using System.Collections;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
+using System.Web.UI;
 
 namespace System.Web {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [ComVisible (false)]
        public abstract class HttpWorkerRequest {
 
@@ -113,6 +117,16 @@ namespace System.Web {
                        }
                }
 
+#if NET_2_0
+               public virtual Guid RequestTraceIdentifier {
+                       get { return Guid.Empty; }
+               }
+
+               public virtual string RootWebConfigPath {
+                       get { return null; }
+               }
+#endif
+
                public virtual void CloseConnection ()
                {
                }
@@ -161,7 +175,17 @@ namespace System.Web {
                {
                        return null;
                }
+#if NET_2_0
+               public virtual int GetPreloadedEntityBody (byte[] buffer, int offset)
+               {
+                       return 0;
+               }
 
+               public virtual int GetPreloadedEntityBodyLength ()
+               {
+                       return 0;
+               }
+#endif
                public virtual string GetProtocol ()
                {
                        if (IsSecure ())
@@ -194,7 +218,12 @@ namespace System.Web {
                {
                        return null;
                }
-
+#if NET_2_0
+               public virtual int GetTotalEntityBodyLength ()
+               {
+                       return 0;
+               }
+#endif
                public virtual string GetUnknownRequestHeader (string name)
                {
                        return null;
@@ -245,9 +274,14 @@ namespace System.Web {
 
                public virtual int ReadEntityBody (byte [] buffer, int size)
                {
-                       throw new NotImplementedException ("");
+                       return 0;
                }
-
+#if NET_2_0
+               public virtual int ReadEntityBody (byte [] buffer, int offset, int size)
+               {
+                       return 0;
+               }
+#endif
                public virtual void SendCalculatedContentLength (int contentLength)
                {
                        throw new NotImplementedException ();
@@ -261,11 +295,11 @@ namespace System.Web {
 #else
                public virtual void SendResponseFromMemory (IntPtr data, int length)
                {
-                       byte [] copy = new byte [length];
-
-                       Marshal.Copy (data, copy, 0, length);
-
-                       SendResponseFromMemory (copy, length);
+                       if (data != IntPtr.Zero) {
+                               byte [] copy = new byte [length];
+                               Marshal.Copy (data, copy, 0, length);
+                               SendResponseFromMemory (copy, length);
+                       }
                }
 #endif
 
index 5ffa47c7de4381860e501dd0b3426bc90db114e0..d85eb8c092ae6ee40f1d81f6ea1f2d9d7f4d7c34 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
 using System.Text;
 using System.Globalization;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
        
 namespace System.Web {
        
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class HttpWriter : TextWriter {
                HttpResponseStream output_stream;
                HttpResponse response;
index 6d424207cc6792802f3570da85e8f3503df5fd7a..9ff6eabe69acf020781e483175f31b27e7a887a8 100644 (file)
@@ -5,7 +5,7 @@
 //   Tim Coleman (tim@timcoleman.com)\r
 //\r
 // Copyright (C) Tim Coleman, 2002\r
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
+using System.Security.Permissions;
 \r
 namespace System.Web {\r
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class ProcessInfo {\r
 \r
                #region Fields\r
index 39c05b69598e0017bc48053b0c7661276e716937..2afd1f77c7259818b319684a2498d6cd34c6f67b 100644 (file)
@@ -5,7 +5,7 @@
 //   Tim Coleman (tim@timcoleman.com)\r
 //\r
 // Copyright (C) Tim Coleman, 2002\r
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 \r
-using System;\r
+using System.Security.Permissions;
 \r
 namespace System.Web {\r
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class ProcessModelInfo {\r
 \r
                #region Fields\r
@@ -47,6 +51,7 @@ namespace System.Web {
                #region Properties\r
 \r
                [MonoTODO ("Retrieve appropriate variables from worker")]\r
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
                public static ProcessInfo GetCurrentProcessInfo ()\r
                {\r
                        DateTime startTime = DateTime.Now;\r
@@ -61,6 +66,7 @@ namespace System.Web {
                }\r
 \r
                [MonoTODO ("Retrieve process information.")]\r
+               [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
                public static ProcessInfo[] GetHistory (int numRecords)\r
                {\r
                        throw new NotImplementedException ();\r
index d112591d0e0c6ba621561cbe5de4ce4b154845d7..f0eac0177cc06c65b09be40071383f2dfdc32a03 100644 (file)
@@ -122,13 +122,12 @@ namespace System.Web
 
                private void loadServerVariablesCollection()
                {
-                       if (loaded)
+                       HttpWorkerRequest wr = request.WorkerRequest;
+                       if (loaded || (wr == null))
                                return;
 
                        IsReadOnly = false;
-
-                       HttpWorkerRequest wr = request.WorkerRequest;
-                       
+               
                        Add("ALL_HTTP", Fill (wr, true));
                        Add("ALL_RAW",  Fill (wr, false));
                            
index 0bc731db729fd0c3ca36330e05bac5ddcfd53f03..0c376235cedfaa66f6bb3e355a90a9e7049a75e9 100644 (file)
@@ -6,9 +6,7 @@
 //   Jackson Harper (jackson@ximian.com)
 //
 // (C) 2002 2003, Patrik Torstensson
-// (C) 2003 Novell, Inc (http://www.novell.com) 
-//
-
+// Copyright (C) 2003,2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
-using System.Data;
+using System.Security.Permissions;
 using System.Web.UI;
-using System.Web.UI.WebControls;
 
 namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class TraceContext {
                HttpContext _Context;
                bool _Enabled;
@@ -49,6 +48,7 @@ namespace System.Web {
                public TraceContext (HttpContext Context)
                {
                        _Context = Context;
+                       _Mode = TraceMode.SortByTime;
                }
 
                internal bool HaveTrace {
@@ -119,7 +119,10 @@ namespace System.Web {
                                data = new TraceData ();
                        data.Write (category, msg, error, Warning);
                }
-
+#if NET_2_0
+               [MonoTODO]
+               public event TraceContextEventHandler TraceFinished;
+#endif
                internal void SaveData ()
                {
                        if (data == null)
diff --git a/mcs/class/System.Web/System.Web/TraceContextEventArgs.cs b/mcs/class/System.Web/System.Web/TraceContextEventArgs.cs
new file mode 100644 (file)
index 0000000..dc7ba83
--- /dev/null
@@ -0,0 +1,53 @@
+// 
+// System.Web.TraceContextEventArgs class
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Security.Permissions;
+
+namespace System.Web {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class TraceContextEventArgs : EventArgs {
+
+               private ICollection trace_records;
+
+               public TraceContextEventArgs (ICollection records)
+               {
+                       trace_records = records;
+               }
+
+               public ICollection TraceRecords {
+                       get { return trace_records; }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web/TraceContextEventHandler.cs b/mcs/class/System.Web/System.Web/TraceContextEventHandler.cs
new file mode 100644 (file)
index 0000000..548a231
--- /dev/null
@@ -0,0 +1,36 @@
+// 
+// System.Web.TraceContextEventHandler delegate
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Web {
+
+       public delegate void TraceContextEventHandler (object sender, TraceContextEventArgs e);
+}
+
+#endif
index 4fbb2bb88c8998a192a3ef7343d3220294a00142..7cc3b0789b1bf9d3abee69f6f4106ca4162efdf8 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.ComponentModel;
 namespace System.Web {
 
-       internal class WebCategoryAttribute : Attribute {
+       [AttributeUsage(AttributeTargets.All)]
+       internal class WebCategoryAttribute : CategoryAttribute {
 
-               public WebCategoryAttribute (string category)
+               public WebCategoryAttribute (string category) : base (category)
                {
                }
        }
index 0cb93bd2223a668525c82369090d952eb9a463dd..3964fae60dad1f1b51a7756b63a2b6e76428fdb0 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.ComponentModel;
 namespace System.Web {
 
-       internal class WebSysDescriptionAttribute : Attribute {
+       [AttributeUsage(AttributeTargets.All)]
+       internal class WebSysDescriptionAttribute : DescriptionAttribute {
 
-               public WebSysDescriptionAttribute (string description)
+               public WebSysDescriptionAttribute (string description) : base (description)
                {
                }
        }
index 9254e977bc752316b9b27faba8e360c5f4573a66..9c22a78eb6364f58809281bc434003628c2b84a8 100644 (file)
@@ -12,6 +12,7 @@ System.Web.Hosting/SimpleWorkerRequestTest.cs
 System.Web.Hosting/ApplicationHostTest.cs
 System.Web.Profile/ProfileInfoTest.cs
 System.Web.Security/FormsAuthenticationTest.cs
+System.Web.Security/FormsIdentityTest.cs
 System.Web.Security/MembershipTest.cs
 System.Web.Security/MembershipProviderCollectionTest.cs
 System.Web.Security/MembershipUserCollectionTest.cs
@@ -27,18 +28,22 @@ System.Web.UI.HtmlControls/HtmlImageTest.cs
 System.Web.UI.HtmlControls/HtmlInputButtonTest.cs
 System.Web.UI.HtmlControls/HtmlInputCheckBoxTest.cs
 System.Web.UI.HtmlControls/HtmlInputControlTest.cs
+System.Web.UI.HtmlControls/HtmlInputFileTest.cs
 System.Web.UI.HtmlControls/HtmlInputHiddenTest.cs
 System.Web.UI.HtmlControls/HtmlInputPasswordTest.cs
 System.Web.UI.HtmlControls/HtmlInputRadioButtonTest.cs
 System.Web.UI.HtmlControls/HtmlInputResetTest.cs
 System.Web.UI.HtmlControls/HtmlInputSubmitTest.cs
 System.Web.UI.HtmlControls/HtmlInputTextTest.cs
+System.Web.UI.HtmlControls/HtmlLinkTest.cs
+System.Web.UI.HtmlControls/HtmlMetaTest.cs
 System.Web.UI.HtmlControls/HtmlSelectTest.cs
 System.Web.UI.HtmlControls/HtmlTableCellTest.cs
 System.Web.UI.HtmlControls/HtmlTableRowTest.cs
 System.Web.UI.HtmlControls/HtmlTableTest.cs
 System.Web.UI.HtmlControls/HtmlTextAreaTest.cs
 System.Web.UI/HtmlTextWriterTest.cs
+System.Web.UI/MinimizableAttributeTypeConverterTest.cs
 System.Web.UI/PageTest.cs
 System.Web.UI/PropertyConverterTest.cs
 System.Web.UI/StateBagTest.cs
@@ -46,6 +51,7 @@ System.Web.UI/TestUrlPropertyAttribute.cs
 System.Web.UI/ToolboxDataAttributeTest.cs
 System.Web.UI.WebControls/AdCreatedEventArgsTest.cs
 System.Web.UI.WebControls/BaseCompareValidatorTest.cs
+System.Web.UI.WebControls/BaseDataBoundControlTest.cs
 System.Web.UI.WebControls/BaseDataListTest.cs
 System.Web.UI.WebControls/BaseValidatorTest.cs
 System.Web.UI.WebControls/BoundColumnTest.cs
@@ -58,6 +64,7 @@ System.Web.UI.WebControls/CheckBoxTest.cs
 System.Web.UI.WebControls/CompareValidatorTest.cs
 System.Web.UI.WebControls/CompositeControlTest.cs
 System.Web.UI.WebControls/CustomValidatorTest.cs
+System.Web.UI.WebControls/DataBoundControlTest.cs
 System.Web.UI.WebControls/DataGridColumnTest.cs
 System.Web.UI.WebControls/DataGridItemCollectionTest.cs
 System.Web.UI.WebControls/DataGridItemTest.cs
@@ -71,6 +78,7 @@ System.Web.UI.WebControls/DropDownListTest.cs
 System.Web.UI.WebControls/EditCommandColumnTest.cs
 System.Web.UI.WebControls/FontNamesConverterTest.cs
 System.Web.UI.WebControls/FontUnitTest.cs
+System.Web.UI.WebControls/FormViewTest.cs
 System.Web.UI.WebControls/HyperLinkColumnTest.cs
 System.Web.UI.WebControls/HyperLinkTest.cs
 System.Web.UI.WebControls/ImageButtonTest.cs
@@ -79,6 +87,7 @@ System.Web.UI.WebControls/LabelTest.cs
 System.Web.UI.WebControls/LinkButtonTest.cs
 System.Web.UI.WebControls/ListBoxTest.cs
 System.Web.UI.WebControls/ListControlTest.cs
+System.Web.UI.WebControls/ListItemTest.cs
 System.Web.UI.WebControls/ListItemCollectionTest.cs
 System.Web.UI.WebControls/LiteralTest.cs
 System.Web.UI.WebControls/LoginNameTest.cs
@@ -124,12 +133,110 @@ System.Web.UI.WebControls.WebParts/ConnectionInterfaceCollectionTest.cs
 System.Web.UI.WebControls.WebParts/WebPartTest.cs
 Cas/AspNetHostingPermissionHelper.cs
 Cas/AspNetHostingMinimal.cs
+System.Web/HttpApplicationCas.cs
+System.Web/HttpApplicationStateCas.cs
+System.Web/HttpBrowserCapabilitiesCas.cs
+System.Web/HttpCachePolicyCas.cs
+System.Web/HttpCacheVaryByHeadersCas.cs
+System.Web/HttpCacheVaryByParamsCas.cs
+System.Web/HttpClientCertificateCas.cs
+System.Web/HttpCompileExceptionCas.cs
 System.Web/HttpContextCas.cs
+System.Web/HttpCookieCas.cs
+System.Web/HttpCookieCollectionCas.cs
+System.Web/HttpExceptionCas.cs
+System.Web/HttpFileCollectionCas.cs
+System.Web/HttpModuleCollectionCas.cs
+System.Web/HttpParseExceptionCas.cs
+System.Web/HttpRequestCas.cs
+System.Web/HttpRequestValidationExceptionCas.cs
+System.Web/HttpResponseCas.cs
+System.Web/HttpRuntimeCas.cs
+System.Web/HttpServerUtilityCas.cs
+System.Web/HttpStaticObjectsCollectionCas.cs
+System.Web/HttpUnhandledExceptionCas.cs
+System.Web/HttpUtilityCas.cs
+System.Web/HttpWorkerRequestCas.cs
+System.Web/HttpWriterCas.cs
+System.Web/ProcessInfoCas.cs
+System.Web/ProcessModelInfoCas.cs
+System.Web/TraceContextCas.cs
+System.Web.Caching/CacheCas.cs
+System.Web.Caching/CacheDependencyCas.cs
+System.Web.Configuration/HttpCapabilitiesBaseCas.cs
+System.Web.Handlers/TraceHandlerCas.cs
+System.Web.Hosting/AppDomainFactoryCas.cs
+System.Web.Hosting/ApplicationHostCas.cs
+System.Web.Hosting/ISAPIRuntimeCas.cs
+System.Web.Hosting/SimpleWorkerRequestCas.cs
+System.Web.Mail/MailAttachmentCas.cs
+System.Web.Mail/MailMessageCas.cs
+System.Web.Mail/SmtpMailCas.cs
+System.Web.SessionState/StateRuntimeCas.cs
+System.Web.SessionState/SessionStateModuleCas.cs
+System.Web.Security/DefaultAuthenticationEventArgsCas.cs
+System.Web.Security/DefaultAuthenticationModuleCas.cs
+System.Web.Security/FileAuthorizationModuleCas.cs
+System.Web.Security/FormsAuthenticationCas.cs
 System.Web.Security/FormsAuthenticationEventArgsCas.cs
+System.Web.Security/FormsAuthenticationModuleCas.cs
+System.Web.Security/FormsAuthenticationTicketCas.cs
+System.Web.Security/FormsIdentityCas.cs
 System.Web.Security/PassportAuthenticationEventArgsCas.cs
+System.Web.Security/PassportAuthenticationModuleCas.cs
+System.Web.Security/PassportIdentityCas.cs
+System.Web.Security/UrlAuthorizationModuleCas.cs
 System.Web.Security/WindowsAuthenticationEventArgsCas.cs
+System.Web.Security/WindowsAuthenticationModuleCas.cs
+System.Web.UI/AttributeCollectionCas.cs
+System.Web.UI/BaseParserCas.cs
+System.Web.UI/CompiledTemplateBuilderCas.cs
+System.Web.UI/ConstructorNeedsTagAttributeCas.cs
+System.Web.UI/ControlBuilderAttributeCas.cs
+System.Web.UI/ControlBuilderCas.cs
+System.Web.UI/ControlCas.cs
+System.Web.UI/ControlCollectionCas.cs
+System.Web.UI/CssStyleCollectionCas.cs
+System.Web.UI/DataBinderCas.cs
+System.Web.UI/DataBindingCas.cs
+System.Web.UI/DataBindingCollectionCas.cs
+System.Web.UI/DataBindingHandlerAttributeCas.cs
+System.Web.UI/DataBoundLiteralControlCas.cs
+System.Web.UI/DesignerDataBoundLiteralControlCas.cs
+System.Web.UI/DesignTimeParseDataCas.cs
+System.Web.UI/DesignTimeTemplateParserCas.cs
+System.Web.UI/EmptyCollectionCas.cs
+System.Web.UI/Html32TextWriterCas.cs
+System.Web.UI/HtmlTextWriterCas.cs
+System.Web.UI/ImageClickEventArgsCas.cs
+System.Web.UI/LiteralControlCas.cs
+System.Web.UI/LosFormatterCas.cs
+System.Web.UI/ObjectConverterCas.cs
+System.Web.UI/ObjectTagBuilderCas.cs
+System.Web.UI/PageCas.cs
+System.Web.UI/PairCas.cs
+System.Web.UI/ParseChildrenAttributeCas.cs
+System.Web.UI/PartialCachingAttributeCas.cs
+System.Web.UI/PersistChildrenAttributeCas.cs
+System.Web.UI/PersistenceModeAttributeCas.cs
+System.Web.UI/PropertyConverterCas.cs
+System.Web.UI/RootBuilderCas.cs
+System.Web.UI/StateBagCas.cs
+System.Web.UI/StateItemCas.cs
+System.Web.UI/StaticPartialCachingControlCas.cs
+System.Web.UI/TagPrefixAttributeCas.cs
+System.Web.UI/TemplateBuilderCas.cs
+System.Web.UI/TemplateContainerAttributeCas.cs
+System.Web.UI/TemplateControlCas.cs
+System.Web.UI/ToolboxDataAttributeCas.cs
+System.Web.UI/TripletCas.cs
+System.Web.UI/UserControlCas.cs
+System.Web.UI/UserControlControlBuilderCas.cs
+System.Web.UI/ValidationPropertyAttributeCas.cs
+System.Web.UI/ValidatorCollectionCas.cs
 System.Web.UI.HtmlControls/HtmlAnchorCas.cs
 System.Web.UI.HtmlControls/HtmlButtonCas.cs
+System.Web.UI.HtmlControls/HtmlContainerControlCas.cs
 System.Web.UI.HtmlControls/HtmlEmptyTagControlBuilderCas.cs
 System.Web.UI.HtmlControls/HtmlFormCas.cs
 System.Web.UI.HtmlControls/HtmlGenericControlCas.cs
@@ -138,6 +245,7 @@ System.Web.UI.HtmlControls/HtmlHeadCas.cs
 System.Web.UI.HtmlControls/HtmlImageCas.cs
 System.Web.UI.HtmlControls/HtmlInputButtonCas.cs
 System.Web.UI.HtmlControls/HtmlInputCheckBoxCas.cs
+System.Web.UI.HtmlControls/HtmlInputControlCas.cs
 System.Web.UI.HtmlControls/HtmlInputFileCas.cs
 System.Web.UI.HtmlControls/HtmlInputHiddenCas.cs
 System.Web.UI.HtmlControls/HtmlInputImageCas.cs
@@ -146,9 +254,14 @@ System.Web.UI.HtmlControls/HtmlInputRadioButtonCas.cs
 System.Web.UI.HtmlControls/HtmlInputResetCas.cs
 System.Web.UI.HtmlControls/HtmlInputSubmitCas.cs
 System.Web.UI.HtmlControls/HtmlInputTextCas.cs
+System.Web.UI.HtmlControls/HtmlLinkCas.cs
+System.Web.UI.HtmlControls/HtmlMetaCas.cs
 System.Web.UI.HtmlControls/HtmlSelectBuilderCas.cs
 System.Web.UI.HtmlControls/HtmlSelectCas.cs
 System.Web.UI.HtmlControls/HtmlTableCas.cs
 System.Web.UI.HtmlControls/HtmlTableCellCas.cs
 System.Web.UI.HtmlControls/HtmlTableRowCas.cs
+System.Web.UI.HtmlControls/HtmlTextAreaCas.cs
 System.Web.UI.HtmlControls/HtmlTitleCas.cs
+System.Web.Util/TransactionsCas.cs
+System.Web.Util/WorkItemCas.cs
index 4530452bee5ff582b88ae7bc11f5374bad477886..2e8200a6d3819cc1783b62447efa02675152867d 100644 (file)
@@ -38,92 +38,92 @@ namespace MonoCasTests {
 
                [Test]
                [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Unrestricted)]
-               public void PermitOnly_Unrestricted ()
+               public void LinkDemand_PermitOnly_Unrestricted ()
                {
-                       Assert.IsNotNull (CreateControl ());
+                       Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Unrestricted));
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
-               public void PermitOnly_High ()
+               public void LinkDemand_PermitOnly_High ()
                {
-                       Assert.IsNotNull (CreateControl ());
+                       Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.High));
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
-               public void PermitOnly_Medium ()
+               public void LinkDemand_PermitOnly_Medium ()
                {
-                       Assert.IsNotNull (CreateControl ());
+                       Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Medium));
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Low)]
-               public void PermitOnly_Low ()
+               public void LinkDemand_PermitOnly_Low ()
                {
-                       Assert.IsNotNull (CreateControl ());
+                       Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Low));
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Minimal)]
-               public void PermitOnly_Minimal ()
+               public void LinkDemand_PermitOnly_Minimal ()
                {
-                       Assert.IsNotNull (CreateControl ());
+                       Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Minimal));
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.None)]
                [ExpectedException (typeof (SecurityException))]
-               public void PermitOnly_None ()
+               public void LinkDemand_PermitOnly_None ()
                {
-                       CreateControl ();
+                       CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.None);
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Unrestricted)]
                [ExpectedException (typeof (SecurityException))]
-               public void Deny_Unrestricted ()
+               public void LinkDemand_Deny_Unrestricted ()
                {
-                       CreateControl ();
+                       CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Unrestricted);
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
                [ExpectedException (typeof (SecurityException))]
-               public void Deny_High ()
+               public void LinkDemand_Deny_High ()
                {
-                       CreateControl ();
+                       CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.High);
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
                [ExpectedException (typeof (SecurityException))]
-               public void Deny_Medium ()
+               public void LinkDemand_Deny_Medium ()
                {
-                       CreateControl ();
+                       CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Medium);
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Low)]
                [ExpectedException (typeof (SecurityException))]
-               public void Deny_Low ()
+               public void LinkDemand_Deny_Low ()
                {
-                       CreateControl ();
+                       CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Low);
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Minimal)]
                [ExpectedException (typeof (SecurityException))]
-               public void Deny_Minimal ()
+               public void LinkDemand_Deny_Minimal ()
                {
-                       CreateControl ();
+                       CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Minimal);
                }
 
                [Test]
                [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.None)]
-               public void Deny_None ()
+               public void LinkDemand_Deny_None ()
                {
-                       Assert.IsNotNull (CreateControl ());
+                       Assert.IsNotNull (CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.None));
                }
        }
 }
index c66b98422dca201d6c299e9ea62187c0c1d567c2..8b3a91ea9a42cb56d74d1697e4bad7db29c5ba84 100644 (file)
@@ -40,7 +40,7 @@ namespace MonoCasTests {
        public abstract class AspNetHostingPermissionHelper {
 
                [SetUp]
-               public void SetUp ()
+               public virtual void SetUp ()
                {
                        if (!SecurityManager.SecurityEnabled)
                                Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
@@ -50,9 +50,9 @@ namespace MonoCasTests {
                // a LinkDemand (which will be converted into full demand, i.e. a stack walk) 
                // when reflection is used (i.e. it gets testable).
 
-               static Type[] VoidType = new Type[0];
+               public static Type[] VoidType = new Type[0];
 
-               public object CreateControl ()
+               public virtual object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
                {
                        ConstructorInfo ci = this.Type.GetConstructor (VoidType);
                        Assert.IsNotNull (ci, "default .ctor");
index d38cc5112190f4a9695aea43becccb5646f37be3..537d64f6f703219fd5ea97f615d86b28cf0de50d 100644 (file)
@@ -1,3 +1,21 @@
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AspNetHostingPermissionHelper.cs: SetUp method is now virtual.
+
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AspNetHostingMinimal.cs: Rename tests to LinkDemand_* so they have 
+       less chances to conflict with tests in derived classes.
+       * AspNetHostingPermissionHelper.cs: Made VoidType public.
+
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AspNetHostingMinimal.cs: Added new required parameters to all calls
+       to CreateControl.
+       * AspNetHostingPermissionHelper.cs: Made CreateControl virtual and 
+       accept a SecurityAction and AspNetHostingPermissionLevel parameters
+       for more flexibility in testing.
+
 2005-09-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * AspNetHostingMinimal.cs: CAS test helper class to test for Minimal
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/CacheCas.cs b/mcs/class/System.Web/Test/System.Web.Caching/CacheCas.cs
new file mode 100644 (file)
index 0000000..c5b4e8a
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// CacheCas.cs - CAS unit tests for System.Web.Caching.Cache
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Caching;
+
+namespace MonoCasTests.System.Web.Caching {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class CacheCas : AspNetHostingMinimal {
+
+               // LAMESPEC: using Cache also requires permission for UnmanagedCode
+               // this shows up only for PermitOnly (expected) unless Level is None
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               private object UnmanagedCreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       if ((level != AspNetHostingPermissionLevel.None) && (action == SecurityAction.PermitOnly))
+                               return UnmanagedCreateControl (action, level);
+                       else
+                               return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (Cache); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/CacheDependencyCas.cs b/mcs/class/System.Web/Test/System.Web.Caching/CacheDependencyCas.cs
new file mode 100644 (file)
index 0000000..689fbb4
--- /dev/null
@@ -0,0 +1,98 @@
+//
+// CacheDependencyCas.cs 
+//     - CAS unit tests for System.Web.Caching.CacheDependency
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Caching;
+
+namespace MonoCasTests.System.Web.Caching {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class CacheDependencyCas : AspNetHostingMinimal {
+
+               private string tempFile;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // that requires both FileIOPermission and EnvironmentPermission
+                       // so we do it before setting the stack with PermitOnly and Deny
+                       tempFile = Path.GetTempFileName ();
+               }
+
+               // note: CacheDependency still requires some file access
+               [FileIOPermission (SecurityAction.Assert, Unrestricted = true)]
+#if ONLY_1_1
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+#endif
+               private object FileIOPermissionCreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return CreateControlStringCtor (action, level);
+               }
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       if ((level != AspNetHostingPermissionLevel.None) && (action == SecurityAction.PermitOnly)) {
+                               try {
+                                       return FileIOPermissionCreateControl (action, level);
+                               }
+                               catch (TargetInvocationException tie) {
+#if ONLY_1_1
+                                       // hide this error (occurs with ms 1.x)
+                                       if ((tie.InnerException is NullReferenceException) &&
+                                               (level == AspNetHostingPermissionLevel.Unrestricted)) {
+                                               return String.Empty;
+                                       }
+#endif
+                                       throw tie;
+                               }
+                       } 
+                       else
+                               return CreateControlStringCtor (action, level);
+               }
+
+               private object CreateControlStringCtor (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // not public empty (default) ctor - at least not before 2.0
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(string)");
+                       return ci.Invoke (new object[1] { tempFile });
+               }
+
+               public override Type Type {
+                       get { return typeof (CacheDependency); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/ChangeLog b/mcs/class/System.Web/Test/System.Web.Caching/ChangeLog
new file mode 100644 (file)
index 0000000..e3cc223
--- /dev/null
@@ -0,0 +1,14 @@
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * CacheDependencyCas.cs: Under 1.x FAM also requires UnmanagedCode so 
+       we must assert this too before creating instances. We also "hide" an
+       error where the initialization throws a NullReferenceException on 1.x
+       (as this has nothing to do with CAS).
+
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * CacheCas.cs: New. CAS unit tests for Cache. It turns out that 
+       UnmanagedCode permission is also required (down-level).
+       * CacheDependencyCas.cs: New. CAS unit tests for CacheDependency. It 
+       turns out that FileIOPermission is also required (down-level) and that
+       Mono (currently) requires Unmanaged permission for FAM.
diff --git a/mcs/class/System.Web/Test/System.Web.Configuration/ChangeLog b/mcs/class/System.Web/Test/System.Web.Configuration/ChangeLog
new file mode 100644 (file)
index 0000000..0b39ed8
--- /dev/null
@@ -0,0 +1,4 @@
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpCapabilitiesBaseCas.cs: New. CAS unit tests for 
+       HttpCapabilitiesBase class.
diff --git a/mcs/class/System.Web/Test/System.Web.Configuration/HttpCapabilitiesBaseCas.cs b/mcs/class/System.Web/Test/System.Web.Configuration/HttpCapabilitiesBaseCas.cs
new file mode 100644 (file)
index 0000000..7405d6c
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// HttpCapabilitiesBaseCas.cs 
+//     - CAS unit tests for System.Web.Configuration.HttpCapabilitiesBase
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Web.Configuration;
+
+namespace MonoCasTests.System.Web.Configuration {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpCapabilitiesBaseCas : AspNetHostingMinimal {
+
+               public override Type Type {
+                       get { return typeof (HttpCapabilitiesBase); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/Test/System.Web.Handlers/ChangeLog
new file mode 100644 (file)
index 0000000..b1ef0cd
--- /dev/null
@@ -0,0 +1,3 @@
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * TraceHandlerCas.cs: New. CAS unit tests for TraceHandler.
diff --git a/mcs/class/System.Web/Test/System.Web.Handlers/TraceHandlerCas.cs b/mcs/class/System.Web/Test/System.Web.Handlers/TraceHandlerCas.cs
new file mode 100644 (file)
index 0000000..b474602
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// TraceHandlerCas.cs - CAS unit tests for System.Web.Handlers.TraceHandler
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Handlers;
+
+namespace MonoCasTests.System.Web.Handlers {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class TraceHandlerCas : AspNetHostingMinimal {
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new TraceHandler ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new TraceHandler ();
+               }
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // don't let UnmanagedCode mess up the results
+                       return base.CreateControl (action, level);
+               }
+
+               // base class AspNetHostingMinimal and Type property will test LinkDemands
+
+               public override Type Type {
+                       get { return typeof (TraceHandler); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Hosting/AppDomainFactoryCas.cs b/mcs/class/System.Web/Test/System.Web.Hosting/AppDomainFactoryCas.cs
new file mode 100644 (file)
index 0000000..0896402
--- /dev/null
@@ -0,0 +1,130 @@
+//
+// AppDomainFactoryCas.cs 
+//     - CAS unit tests for System.Web.Hosting.AppDomainFactory
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Hosting;
+
+namespace MonoCasTests.System.Web.Hosting {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class AppDomainFactoryCas : AspNetHostingMinimal {
+
+               private AppDomainFactory adf;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // we're at full trust here
+                       adf = new AppDomainFactory ();
+               }
+
+               // test ctor
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new AppDomainFactory ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+               [ExpectedException (typeof (SecurityException))]
+#endif
+               public void Constructor_Deny_AspNetHostingPermission ()
+               {
+                       new AppDomainFactory ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Minimal)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new AppDomainFactory ();
+               }
+
+               // Create isn't protected (so the Demands aren't on the class)
+
+               private void Create ()
+               {
+                       try {
+                               adf.Create (null, null, null, null, null, 0);
+                       }
+                       catch (NullReferenceException) {
+                               // MS
+                       }
+                       catch (NotImplementedException) {
+                               // Mono
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               public void Create_Deny_UnmanagedCode ()
+               {
+                       Create ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Minimal)]
+               public void Create_Deny_AspNetHostingPermission ()
+               {
+                       Create ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Create_Deny_Unrestricted ()
+               {
+                       Create ();
+               }
+
+               // test for LinkDemand on class
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // don't let UnmanagedCode mess up the results
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (AppDomainFactory); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Hosting/ApplicationHostCas.cs b/mcs/class/System.Web/Test/System.Web.Hosting/ApplicationHostCas.cs
new file mode 100644 (file)
index 0000000..7bd7dac
--- /dev/null
@@ -0,0 +1,103 @@
+//
+// ApplicationHostCas.cs 
+//     - CAS unit tests for System.Web.Hosting.ApplicationHost
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Hosting;
+
+namespace MonoCasTests.System.Web.Hosting {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ApplicationHostCas : AspNetHostingMinimal {
+
+               private void CreateApplicationHost ()
+               {
+                       try {
+                               ApplicationHost.CreateApplicationHost (null, null, null);
+                       }
+                       catch (NullReferenceException) {
+                               // MS
+                       }
+                       catch (NotImplementedException) {
+                               // Mono
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void CreateApplicationHost_Deny_UnmanagedCode ()
+               {
+                       CreateApplicationHost ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void CreateApplicationHost_PermitOnly_UnmanagedCode ()
+               {
+                       CreateApplicationHost ();
+               }
+
+               // test for LinkDemand on class
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // in this case testing with a (private) ctor isn't very conveniant
+                       // and the LinkDemand promotion (to Demand) will still occurs on other stuff
+                       // and (finally) we know that the CreateApplicationHost method is only 
+                       // protected for unmanaged code (which we can assert)
+                       try {
+                               MethodInfo mi = this.Type.GetMethod ("CreateApplicationHost");
+                               Assert.IsNotNull (mi, "method");
+                               return mi.Invoke (null, new object[3] { null, null, null });
+                       }
+                       catch (TargetInvocationException e) {
+                               // so we hit the same exception as we did for the ctor
+                               if (e.InnerException is NullReferenceException)
+                                       return String.Empty; // MS
+                               else if (e.InnerException is NotImplementedException)
+                                       return String.Empty; // Mono
+                               else
+                                       return null;
+                       }
+               }
+
+               public override Type Type {
+                       get { return typeof (ApplicationHost); }
+               }
+       }
+}
index 502a37e644ed8014132e3609581dd3334ada2d77..a7facb8695d09f00062ad9378f02f4b24eee5267 100644 (file)
@@ -1,3 +1,27 @@
+2005-09-18  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * SimpleWorkerRequestTest.cs: Ensure a trailing / in the expected path
+       as GetAppPathTranslated must have one (while most directory methods
+       don't append one).
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * SimpleWorkerRequestTest.cs: Added a test case (GetUriPath) that was 
+       failing in the CAS tests (but wasn't CAS related).
+       * SimpleWorkerRequestCas.cs: Ignore the ctor(string,string,TextWriter)
+       test as I don't have a working test case. Simplify GetUriPath check
+       so it doesn't fail.
+
+2005-09-10  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AppDomainFactoryCas.cs: New. CAS unit tests for AppDomainFactory.
+       * ApplicationHostCas.cs: New. CAS unit tests for ApplicationHost.
+       * ISAPIRuntimeCas.cs: New. CAS unit tests for ISAPIRuntime.
+       * SimpleWorkerRequestCas.cs: New. CAS unit tests for 
+       SimpleWorkerRequest.
+       * SimpleWorkerRequestTest.cs: Added a few (unworking) test cases for
+       GetPathInfo method.
+
 2005-08-22  Chris Toshok  <toshok@ximian.com>
 
        * SimpleWorkerRequestTest.cs (Host): make cwd =
diff --git a/mcs/class/System.Web/Test/System.Web.Hosting/ISAPIRuntimeCas.cs b/mcs/class/System.Web/Test/System.Web.Hosting/ISAPIRuntimeCas.cs
new file mode 100644 (file)
index 0000000..f54075a
--- /dev/null
@@ -0,0 +1,182 @@
+//
+// ISAPIRuntimeCas.cs - CAS unit tests for System.Web.Hosting.ISAPIRuntime
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Hosting;
+
+namespace MonoCasTests.System.Web.Hosting {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ISAPIRuntimeCas : AspNetHostingMinimal {
+
+               private ISAPIRuntime isapi;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // we're at full trust here
+                       isapi = new ISAPIRuntime ();
+               }
+
+               // test ctor (those tests aren't affected by a LinkDemand)
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new ISAPIRuntime ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+               [ExpectedException (typeof (SecurityException))]
+#endif
+               public void Constructor_Deny_AspNetHostingPermission ()
+               {
+                       new ISAPIRuntime ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Minimal)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new ISAPIRuntime ();
+               }
+
+               // only StopProcessing requires some permissions (UnmanagedCode)
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Members_Deny_Unrestricted ()
+               {
+                       try {
+                               isapi.DoGCCollect ();
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       try {
+                               isapi.ProcessRequest (IntPtr.Zero, 0);
+                       }
+#if NET_2_0
+                       catch (AccessViolationException) {
+                               // fx2.0
+                       }
+#else
+                       catch (NullReferenceException) {
+                               // fx1.x
+                       }
+#endif
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       try {
+                               isapi.StartProcessing ();
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+#if NET_2_0
+                       try {
+                               isapi.InitializeLifetimeService ();
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+#endif
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+#if NET_2_0
+               [ExpectedException (typeof (SecurityException))]
+#endif
+               public void StopProcessing_Deny_UnmanagedCode ()
+               {
+                       try {
+                               isapi.StopProcessing ();
+                       }
+#if ONLY_1_1
+                       catch (TypeInitializationException) {
+                               // fx 1.x
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+#endif
+                       finally {
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void StopProcessing_PermitOnly_UnmanagedCode ()
+               {
+                       try {
+                               isapi.StopProcessing ();
+                       }
+#if ONLY_1_1
+                       catch (TypeInitializationException) {
+                               // fx 1.x
+                       }
+#endif
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+
+               // test for LinkDemand on class
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // in this case testing the ctor isn't very conveniant
+                       // because it has a Demand similar to the LinkDemand.
+                       try {
+                               return base.CreateControl (action, level);
+                       }
+                       catch (TargetInvocationException tie) {
+                               throw tie.InnerException;
+                       }
+               }
+
+               public override Type Type {
+                       get { return typeof (ISAPIRuntime); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Hosting/SimpleWorkerRequestCas.cs b/mcs/class/System.Web/Test/System.Web.Hosting/SimpleWorkerRequestCas.cs
new file mode 100644 (file)
index 0000000..ab888b9
--- /dev/null
@@ -0,0 +1,181 @@
+//
+// SimpleWorkerRequestCas.cs 
+//     - CAS unit tests for System.Web.Hosting.SimpleWorkerRequest
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Hosting;
+
+namespace MonoCasTests.System.Web.Hosting {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class SimpleWorkerRequestCas : AspNetHostingMinimal {
+
+               private StringWriter sw;
+               private string cwd;
+               private SimpleWorkerRequest swr;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // we're at full trust here
+                       sw = new StringWriter ();
+                       cwd = Environment.CurrentDirectory;
+                       swr = new SimpleWorkerRequest ("/", cwd, String.Empty, String.Empty, sw);
+               }
+
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor3_Deny_UnmanagedCode ()
+               {
+                       new SimpleWorkerRequest (null, null, null);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               [Ignore ("I don't have a 'real' working case, inside NUnit, for this .ctor")]
+               public void Constructor3_PermitOnly_UnmanagedCode ()
+               {
+                       try {
+                               new SimpleWorkerRequest ("/", String.Empty, sw);
+                       }
+                       catch (NullReferenceException) {
+                               // we always seems to get a NRE from MS here (both 1.x and 2.0)
+                       }
+                       // note: on Mono a FileIOPermission is triggered later
+                       // in a call to HttpRuntime
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor5_Deny_UnmanagedCode ()
+               {
+                       new SimpleWorkerRequest (null, null, null, null, null);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor5_PermitOnly_UnmanagedCode ()
+               {
+                       new SimpleWorkerRequest (null, cwd, "/", String.Empty, sw);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       Assert.IsNull (swr.MachineConfigPath, "MachineConfigPath");
+                       Assert.IsNull (swr.MachineInstallDirectory, "MachineInstallDirectory");
+                       Assert.AreEqual ("/", swr.GetAppPath (), "GetAppPath");
+                       Assert.AreEqual ("/", swr.GetFilePath (), "GetFilePath");
+                       Assert.AreEqual ("GET", swr.GetHttpVerbName (), "GetHttpVerbName");
+                       Assert.AreEqual ("HTTP/1.0", swr.GetHttpVersion (), "GetHttpVersion");
+                       Assert.AreEqual ("127.0.0.1", swr.GetLocalAddress (), "GetLocalAddress");
+                       Assert.AreEqual (80, swr.GetLocalPort (), "GetLocalPort");
+                       Assert.AreEqual (String.Empty, swr.GetPathInfo (), "GetPathInfo");
+                       Assert.AreEqual (String.Empty, swr.GetQueryString (), "GetQueryString");
+                       Assert.AreEqual ("/", swr.GetRawUrl (), "GetRawUrl");
+                       Assert.AreEqual ("127.0.0.1", swr.GetRemoteAddress (), "GetRemoteAddress");
+                       Assert.AreEqual (0, swr.GetRemotePort (), "GetRemotePort");
+                       Assert.AreEqual (String.Empty, swr.GetServerVariable ("mono"), "GetServerVariable");
+                       Assert.IsNotNull (swr.GetUriPath (), "GetUriPath");
+                       Assert.AreEqual (IntPtr.Zero, swr.GetUserToken (), "GetUserToken");
+                       Assert.IsNull (swr.MapPath ("/"), "MapPath");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       swr.EndOfRequest ();
+                       swr.FlushResponse (true);
+                       swr.SendKnownResponseHeader (0, String.Empty);
+                       swr.SendResponseFromFile (IntPtr.Zero, 0, 0);
+                       swr.SendResponseFromFile (String.Empty, 0, 0);
+                       swr.SendResponseFromMemory (new byte[0], 0);
+                       swr.SendStatus (0, "hello?");
+                       swr.SendUnknownResponseHeader ("mono", "monkey");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetAppPathTranslated_Deny_FileIOPermission ()
+               {
+                       // path discovery
+                       swr.GetAppPathTranslated ();
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void GetAppPathTranslated_PermitOnly_FileIOPermission ()
+               {
+                       Assert.IsNotNull (swr.GetAppPathTranslated (), "GetAppPathTranslated");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetFilePathTranslated_Deny_FileIOPermission ()
+               {
+                       // path discovery
+                       swr.GetFilePathTranslated ();
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void GetFilePathTranslated_PermitOnly_FileIOPermission ()
+               {
+                       Assert.IsNotNull (swr.GetFilePathTranslated (), "GetFilePathTranslated");
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[5] { typeof (string), typeof (string), typeof (string), typeof (string), typeof (TextWriter) });
+                       Assert.IsNotNull (ci, ".ctor(string,string,TextWriter)");
+                       return ci.Invoke (new object[5] { null, cwd, "/", String.Empty, sw });
+               }
+
+               public override Type Type {
+                       get { return typeof (SimpleWorkerRequest); }
+               }
+       }
+}
index 02b09563f3185490fe6f3f47e51057c09425fcd6..92c8f9b33faba727cb884ef0ddf24b85b8864841 100644 (file)
@@ -71,8 +71,6 @@ namespace MonoTests.System.Web.Hosting {
                        
                        SimpleWorkerRequest swr;
 
-                       sw = new StringWriter ();
-
                        string ppath;
                        swr = new SimpleWorkerRequest ("/appVirtualDir", cwd, "pageVirtualPath", "querystring", sw);
                        Assert.AreEqual ("/appVirtualDir", swr.GetAppPath (), "S1");
@@ -127,6 +125,28 @@ namespace MonoTests.System.Web.Hosting {
                        
                }
 
+               [Test]
+               public void GetPathInfo ()
+               {
+                       StringWriter sw = new StringWriter ();
+                       SimpleWorkerRequest swr = new SimpleWorkerRequest ("appVirtualDir", cwd, "/pageVirtualPath", "querystring", sw);
+                       Assert.AreEqual ("/pageVirtualPath", swr.GetPathInfo (), "GetPathInfo-1");
+
+                       swr = new SimpleWorkerRequest ("appVirtualDir", cwd, "/", "querystring", sw);
+                       Assert.AreEqual ("/", swr.GetPathInfo (), "GetPathInfo-2");
+
+                       swr = new SimpleWorkerRequest ("appVirtualDir", cwd, "pageVirtualPath", "querystring", sw);
+                       Assert.AreEqual (String.Empty, swr.GetPathInfo (), "GetPathInfo-3");
+               }
+
+               [Test]
+               public void GetUriPath ()
+               {
+                       StringWriter sw = new StringWriter ();
+                       SimpleWorkerRequest swr = new SimpleWorkerRequest ("/", cwd, String.Empty, String.Empty, sw);
+                       Assert.AreEqual ("/", swr.GetUriPath (), "GetUriPath");
+               }
+
                public class Host : MarshalByRefObject {
                        string cwd = Environment.CurrentDirectory;
 
@@ -137,7 +157,7 @@ namespace MonoTests.System.Web.Hosting {
                                SimpleWorkerRequest swr = new SimpleWorkerRequest("file.aspx", "querystring", sw);
 
                                Assert.AreEqual ("/appVirtualDir", swr.GetAppPath (), "T1");
-                               Assert.AreEqual (cwd, swr.GetAppPathTranslated (), "TRANS1");
+                               Assert.AreEqual (cwd + Path.DirectorySeparatorChar, swr.GetAppPathTranslated (), "TRANS1");
                                Assert.AreEqual ("/appVirtualDir/file.aspx", swr.GetFilePath (), "T2");
                                Assert.AreEqual ("GET", swr.GetHttpVerbName (), "T3");
                                Assert.AreEqual ("HTTP/1.0", swr.GetHttpVersion (), "T4");
@@ -174,7 +194,6 @@ namespace MonoTests.System.Web.Hosting {
                                //
                                Assert.AreEqual (Path.Combine (cwd, "file.aspx"), swr.MapPath ("/appVirtualDir/file.aspx"), "TP2");
                                Assert.AreEqual (Path.Combine (cwd, "file.aspx"), swr.MapPath ("/appVirtualDir/file.aspx"), "TP4");
-                               Console.WriteLine ("5. HOLA");
                                Assert.AreEqual (Path.Combine (cwd, Path.Combine ("Subdir", "file.aspx")), swr.MapPath ("/appVirtualDir/Subdir/file.aspx"), "TP5");
 
                        }
diff --git a/mcs/class/System.Web/Test/System.Web.Mail/ChangeLog b/mcs/class/System.Web/Test/System.Web.Mail/ChangeLog
new file mode 100644 (file)
index 0000000..d6c2e26
--- /dev/null
@@ -0,0 +1,5 @@
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * MailAttachmentCas.cs: New. CAS unit tests for MailAttachment.
+       * MailMessageCas.cs: New. CAS unit tests for MailMessage.
+       * SmtpMailCas.cs: New. CAS unit tests for SmtpMail.
diff --git a/mcs/class/System.Web/Test/System.Web.Mail/MailAttachmentCas.cs b/mcs/class/System.Web/Test/System.Web.Mail/MailAttachmentCas.cs
new file mode 100644 (file)
index 0000000..8f7a799
--- /dev/null
@@ -0,0 +1,140 @@
+//
+// MailAttachmentCas.cs - CAS unit tests for System.Web.Mail.MailAttachment
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Mail;
+
+namespace MonoCasTests.System.Web.Mail {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class MailAttachmentCas : AspNetHostingMinimal {
+
+               private string fname;
+               private MailAttachment attachment;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       fname = Path.GetTempFileName ();
+                       using (FileStream fs = File.OpenWrite (fname)) {
+                               fs.WriteByte (0);
+                               fs.Close ();
+                       }
+                       attachment = new MailAttachment (fname);
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Contructor_String_Deny_FileIOPermission ()
+               {
+                       try {
+                               new MailAttachment (fname);
+                       }
+                       catch (TypeInitializationException e) {
+                               // MS BUG - the original security exception gets wrapped
+                               // inside a TypeInitializationException.
+                               Assert.IsNotNull (e.InnerException, "InnerException");
+                               throw e.InnerException;
+                       }
+                       catch (HttpException e) {
+                               // MS BUG - the original security exception gets replaced
+                               // by an HttpException. Even worst the SecurityException 
+                               // is not in the InnerException!
+                               Assert.IsNull (e.InnerException, "InnerException");
+                               Assert.Ignore ("2.0 hides the SecurityException with a HttpException");
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Contructor_StringMailEncoding_Deny_FileIOPermission ()
+               {
+                       try {
+                               new MailAttachment (fname, MailEncoding.UUEncode);
+                       }
+                       catch (TypeInitializationException e) {
+                               // MS BUG - the original security exception gets wrapped
+                               // inside a TypeInitializationException.
+                               Assert.IsNotNull (e.InnerException, "InnerException");
+                               throw e.InnerException;
+                       }
+                       catch (HttpException e) {
+                               // MS BUG - the original security exception gets replaced
+                               // by an HttpException. Even worst the SecurityException 
+                               // is not in the InnerException!
+                               Assert.IsNull (e.InnerException, "InnerException");
+                               Assert.Ignore ("2.0 hides the SecurityException with a HttpException");
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void Contructor_PermitOnly_FileIOPermission ()
+               {
+                       new MailAttachment (fname);
+                       new MailAttachment (fname, MailEncoding.UUEncode);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties ()
+               {
+                       // once created we can get the filename even with no permissions
+                       Assert.AreEqual (fname, attachment.Filename, "Filename");
+                       // LAMESPEC: default isn't UUEncode
+                       Assert.AreEqual (MailEncoding.Base64, attachment.Encoding, "Encoding");
+               }
+
+               // LinkDemand tests
+
+               // overriden because
+               // (a) there's no empty .ctor in MailAttachment
+               // (b) the filename parameter implies some file i/o
+               [FileIOPermission (SecurityAction.Assert, Unrestricted = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type [1] { typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(string)");
+                       return ci.Invoke (new object [1] { fname });
+               }
+               
+               public override Type Type {
+                       get { return typeof (MailAttachment); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Mail/MailMessageCas.cs b/mcs/class/System.Web/Test/System.Web.Mail/MailMessageCas.cs
new file mode 100644 (file)
index 0000000..5c42d7b
--- /dev/null
@@ -0,0 +1,86 @@
+//
+// MailMessageCas.cs - CAS unit tests for System.Web.Mail.MailMessage
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+using System.Web.Mail;
+
+namespace MonoCasTests.System.Web.Mail {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class MailMessageCas : AspNetHostingMinimal {
+
+               private MailAttachment attachment;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       string fname = Path.GetTempFileName ();
+                       using (FileStream fs = File.OpenWrite (fname)) {
+                               fs.WriteByte (0);
+                               fs.Close ();
+                       }
+                       attachment = new MailAttachment (fname);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void MailMessage_Deny_Unrestricted ()
+               {
+                       MailMessage msg = new MailMessage ();
+                       // we can include attachments (if created without the deny)
+                       msg.Attachments.Add (attachment);
+                       msg.Bcc = "bcc@localhost.com";
+                       msg.Body = "Hola!";
+                       msg.BodyEncoding = Encoding.ASCII;
+                       msg.Cc = "cc@localhost.com";
+                       msg.Fields["mono"] = "monkey";
+                       msg.From = "from@localhost.com";
+                       msg.Headers["monkey"] = "mono";
+                       msg.Priority = MailPriority.High;
+                       msg.Subject = "Monkey business";
+                       msg.To = "to@localhost.com";
+                       msg.UrlContentBase = "http://www.mono-project.com";
+                       msg.UrlContentLocation = "http://www.go-mono.com";
+               }
+
+               // LinkDemand tests
+
+               public override Type Type {
+                       get { return typeof (MailMessage); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Mail/SmtpMailCas.cs b/mcs/class/System.Web/Test/System.Web.Mail/SmtpMailCas.cs
new file mode 100644 (file)
index 0000000..c159a4d
--- /dev/null
@@ -0,0 +1,147 @@
+//
+// SmtpMailCas.cs - CAS unit tests for System.Web.Mail.SmtpMail
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+using System.Web.Mail;
+
+namespace MonoCasTests.System.Web.Mail {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class SmtpMailCas : AspNetHostingMinimal {
+
+               private MailMessage msg;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       string fname = Path.GetTempFileName ();
+                       using (FileStream fs = File.OpenWrite (fname)) {
+                               fs.WriteByte (0);
+                               fs.Close ();
+                       }
+                       msg = new MailMessage ();
+                       msg.Attachments.Add (new MailAttachment (fname));
+                       msg.Bcc = "bcc@localhost.com";
+                       msg.Body = "Hola!";
+                       msg.BodyEncoding = Encoding.ASCII;
+                       msg.Cc = "cc@localhost.com";
+                       msg.Fields["mono"] = "monkey";
+                       msg.From = "from@localhost.com";
+                       msg.Headers["monkey"] = "mono";
+                       msg.Priority = MailPriority.High;
+                       msg.Subject = "Monkey business";
+                       msg.To = "to@localhost.com";
+                       msg.UrlContentBase = "http://www.mono-project.com";
+                       msg.UrlContentLocation = "http://www.go-mono.com";
+                       // ensure the static ctor is called at full trust
+                       Assert.IsNotNull (SmtpMail.SmtpServer);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void SmtpServer_Deny_Unrestricted ()
+               {
+                       // get/set
+                       SmtpMail.SmtpServer = "localhost";
+                       Assert.AreEqual ("localhost", SmtpMail.SmtpServer, "SmtpServer");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void SendMessage_Deny_Medium ()
+               {
+                       SmtpMail.Send (msg);
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               public void SendMessage_PermitOnly_Medium ()
+               {
+                       try {
+                               SmtpMail.Send (msg);
+                       }
+                       catch (Exception e) {
+                               // HttpException: can't sent mail
+                               // TypeInitializationException: missing stuff in machine.config
+                               // ConfigurationException: missing stuff in machine.config
+                               if (e is SecurityException)
+                                       throw e; // that's the one we're looking for
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Send_Deny_Medium ()
+               {
+                       SmtpMail.Send (msg.From, msg.To, msg.Subject, msg.Body);
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               public void Send_PermitOnly_Medium ()
+               {
+                       try {
+                               SmtpMail.Send (msg.From, msg.To, msg.Subject, msg.Body);
+                       }
+                       catch (Exception e) {
+                               // HttpException: can't sent mail
+                               // TypeInitializationException: missing stuff in machine.config
+                               // ConfigurationException: missing stuff in machine.config
+                               if (e is SecurityException)
+                                       throw e; // that's the one we're looking for
+                       }
+               }
+
+               // LinkDemand tests
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // in this case testing with a (private) ctor isn't very conveniant
+                       // and the LinkDemand promotion (to Demand) will still occurs on other stuff
+                       // and (finally) we know that the SmtpServer properties isn't protected ifself
+                       MethodInfo mi = this.Type.GetProperty ("SmtpServer").GetGetMethod ();
+                       Assert.IsNotNull (mi, "get");
+                       return mi.Invoke (null, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (SmtpMail); }
+               }
+       }
+}
index e96b3df37051512830046f42c0a9b5325291d43c..beeba433d32923d48076946accd8eb3f15a7f6d5 100644 (file)
@@ -1,3 +1,26 @@
+2005-09-18  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * FormsIdentityTest.cs: Changed constructor used to create the ticket
+       to one that doesn't throw a NRE under MS runtime.
+
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com> 
+       * DefaultAuthenticationEventArgsCas.cs: New. CAS unit tests.
+       * DefaultAuthenticationModuleCas.cs: New. CAS unit tests.
+       * FileAuthorizationModuleCas.cs: New. CAS unit tests.
+       * FormsAuthenticationCas.cs: New. CAS unit tests.
+       * FormsAuthenticationEventArgsCas.cs: Added LinkDemand tests.
+       * FormsAuthenticationModuleCas.cs: New. CAS unit tests.
+       * FormsAuthenticationTicketCas.cs: New. CAS unit tests.
+       * FormsIdentityCas.cs: New. CAS unit tests.
+       * FormsIdentityTest.cs: New. Unit tests for FormsIdentity.
+       * PassportAuthenticationEventArgsCas.cs: Added LinkDemand tests.
+       * PassportAuthenticationModuleCas.cs: New. CAS unit tests.
+       * PassportIdentityCas.cs: New. CAS unit tests.
+       * WindowsAuthenticationEventArgsCas.cs: Added LinkDemand tests.
+       * WindowsAuthenticationModuleCas.cs: New. CAS unit tests.
+       * UrlAuthorizationModuleCas.cs: New. CAS unit tests.
+
 2005-09-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * FormsAuthenticationEventArgsCas.cs: New. CAS unit tests.
diff --git a/mcs/class/System.Web/Test/System.Web.Security/DefaultAuthenticationEventArgsCas.cs b/mcs/class/System.Web/Test/System.Web.Security/DefaultAuthenticationEventArgsCas.cs
new file mode 100644 (file)
index 0000000..d81a71c
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// DefaultAuthenticationEventArgsCas.cs 
+//     - CAS unit tests for System.Web.Security.DefaultAuthenticationEventArgs
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DefaultAuthenticationEventArgsCas : AspNetHostingMinimal {
+
+               private HttpContext context;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       context = new HttpContext (null);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Deny_Unrestricted ()
+               {
+                       DefaultAuthenticationEventArgs daea = new DefaultAuthenticationEventArgs (context);
+                       Assert.IsNotNull (daea.Context, "Context");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (HttpContext) });
+                       Assert.IsNotNull (ci, ".ctor(HttpContext)");
+                       return ci.Invoke (new object[1] { context });
+               }
+
+               public override Type Type {
+                       get { return typeof (DefaultAuthenticationEventArgs); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/DefaultAuthenticationModuleCas.cs b/mcs/class/System.Web/Test/System.Web.Security/DefaultAuthenticationModuleCas.cs
new file mode 100644 (file)
index 0000000..49b4b8f
--- /dev/null
@@ -0,0 +1,97 @@
+//
+// DefaultAuthenticationModuleCas.cs 
+//     - CAS unit tests for System.Web.Security.DefaultAuthenticationModule
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DefaultAuthenticationModuleCas : AspNetHostingMinimal {
+
+               private HttpApplication app;
+               private DefaultAuthenticationModule module;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       app = new HttpApplication ();
+                       module = new DefaultAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new DefaultAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new DefaultAuthenticationModule ();
+               }
+
+               private void Authenticate (object sender, DefaultAuthenticationEventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Module ()
+               {
+                       // only the ctor requires UnmanagedCode
+                       module.Init (app);
+                       module.Authenticate += new DefaultAuthenticationEventHandler (Authenticate);
+                       module.Authenticate -= new DefaultAuthenticationEventHandler (Authenticate);
+                       module.Dispose (); // but doesn't implement IDisposable
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (DefaultAuthenticationModule); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/FileAuthorizationModuleCas.cs b/mcs/class/System.Web/Test/System.Web.Security/FileAuthorizationModuleCas.cs
new file mode 100644 (file)
index 0000000..2a5e572
--- /dev/null
@@ -0,0 +1,96 @@
+//
+// FileAuthorizationModuleCas.cs 
+//     - CAS unit tests for System.Web.Security.FileAuthorizationModule
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class FileAuthorizationModuleCas : AspNetHostingMinimal {
+
+               private HttpApplication app;
+               private FileAuthorizationModule module;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       app = new HttpApplication ();
+                       module = new FileAuthorizationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new FileAuthorizationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new FileAuthorizationModule ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Module ()
+               {
+                       // only the ctor requires UnmanagedCode
+                       try {
+                               module.Init (app);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       module.Dispose (); // but doesn't implement IDisposable
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (FileAuthorizationModule); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationCas.cs b/mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationCas.cs
new file mode 100644 (file)
index 0000000..e469978
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// FormsAuthenticationCas.cs 
+//     - CAS unit tests for System.Web.Security.FormsAuthentication
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class FormsAuthenticationCas : AspNetHostingMinimal {
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Identity ()
+               {
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (FormsAuthentication); }
+               }
+       }
+}
index edb70a7abd3e580ebb8b8e8435f148df22939e51..fab7270c8e269766d3198b9443dedac55c848838 100644 (file)
@@ -37,25 +37,20 @@ using System.Security.Principal;
 using System.Web;
 using System.Web.Security;
 
-namespace MonoCasTests.System.Web {
+namespace MonoCasTests.System.Web.Security {
 
        [TestFixture]
        [Category ("CAS")]
-       public class FormsAuthenticationEventArgsCas {
+       public class FormsAuthenticationEventArgsCas : AspNetHostingMinimal {
 
+               private HttpContext context;
                private FormsAuthenticationEventArgs faea;
 
                [TestFixtureSetUp]
                public void FixtureSetUp ()
                {
-                       faea = new FormsAuthenticationEventArgs (new HttpContext (null));
-               }
-
-               [SetUp]
-               public void SetUp ()
-               {
-                       if (!SecurityManager.SecurityEnabled)
-                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+                       context = new HttpContext (null);
+                       faea = new FormsAuthenticationEventArgs (context);
                }
 
                [Test]
@@ -84,5 +79,18 @@ namespace MonoCasTests.System.Web {
                        Assert.IsNull (faea.Context.User, "Context.User-after");
                        Assert.IsNotNull (faea.User, "User-after");
                }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (HttpContext) });
+                       Assert.IsNotNull (ci, ".ctor(HttpContext)");
+                       return ci.Invoke (new object[1] { context });
+               }
+
+               public override Type Type {
+                       get { return typeof (DefaultAuthenticationEventArgs); }
+               }
        }
 }
diff --git a/mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationModuleCas.cs b/mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationModuleCas.cs
new file mode 100644 (file)
index 0000000..fe5bff2
--- /dev/null
@@ -0,0 +1,97 @@
+//
+// FormsAuthenticationModuleCas.cs 
+//     - CAS unit tests for System.Web.Security.FormsAuthenticationModule
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class FormsAuthenticationModuleCas : AspNetHostingMinimal {
+
+               private HttpApplication app;
+               private FormsAuthenticationModule module;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       app = new HttpApplication ();
+                       module = new FormsAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new FormsAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new FormsAuthenticationModule ();
+               }
+
+               private void Authenticate (object sender, FormsAuthenticationEventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Module ()
+               {
+                       // only the ctor requires UnmanagedCode
+                       module.Init (app);
+                       module.Authenticate += new FormsAuthenticationEventHandler (Authenticate);
+                       module.Authenticate -= new FormsAuthenticationEventHandler (Authenticate);
+                       module.Dispose (); // but doesn't implement IDisposable
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (FormsAuthenticationModule); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationTicketCas.cs b/mcs/class/System.Web/Test/System.Web.Security/FormsAuthenticationTicketCas.cs
new file mode 100644 (file)
index 0000000..3247324
--- /dev/null
@@ -0,0 +1,126 @@
+//
+// FormsAuthenticationTicketCasCas.cs
+//     - CAS unit tests for System.Web.Security.FormsAuthenticationTicketCas
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class FormsAuthenticationTicketCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor3 ()
+               {
+                       FormsAuthenticationTicket ticket = null;
+                       try {
+                               // this ctor got a problem on MS 1.x
+                               ticket = new FormsAuthenticationTicket ("mine", false, Int32.MaxValue);
+                       }
+                       catch (NullReferenceException) {
+#if NET_2_0
+                               Assert.Fail ("this should work on 2.0");
+#else
+                               Assert.Ignore ("fails with NullReferenceException on MS 1.x");
+#endif
+                       }
+                       Assert.AreEqual ("/", ticket.CookiePath, "CookiePath");
+                       Assert.IsTrue (ticket.Expiration.Year >= 6088, "Expiration");
+                       Assert.IsFalse (ticket.Expired, "Expired");
+                       Assert.IsFalse (ticket.IsPersistent, "IsPersistent");
+                       Assert.IsTrue (ticket.IssueDate <= DateTime.Now, "IssueDate");
+                       Assert.AreEqual ("mine", ticket.Name, "Name");
+                       Assert.AreEqual (String.Empty, ticket.UserData, "UserData");
+                       Assert.IsTrue (ticket.Version > 0, "Version");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor6 ()
+               {
+                       FormsAuthenticationTicket ticket = null;
+                       try {
+                               // this ctor got a problem on MS 1.x
+                               ticket = new FormsAuthenticationTicket (1, "mine", DateTime.MinValue, DateTime.MaxValue, true, "data");
+                       }
+                       catch (NullReferenceException) {
+#if NET_2_0
+                               Assert.Fail ("this should work on 2.0");
+#else
+                               Assert.Ignore ("fails with NullReferenceException on MS 1.x");
+#endif
+                       }
+                       Assert.AreEqual ("/", ticket.CookiePath, "CookiePath");
+                       Assert.AreEqual (DateTime.MaxValue, ticket.Expiration, "Expiration");
+                       Assert.IsFalse (ticket.Expired, "Expired");
+                       Assert.IsTrue (ticket.IsPersistent, "IsPersistent");
+                       Assert.AreEqual (DateTime.MinValue, ticket.IssueDate, "IssueDate");
+                       Assert.AreEqual ("mine", ticket.Name, "Name");
+                       Assert.AreEqual ("data", ticket.UserData, "UserData");
+                       Assert.AreEqual (1, ticket.Version, "Version");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor7 ()
+               {
+                       FormsAuthenticationTicket ticket = new FormsAuthenticationTicket (3, "mine", DateTime.MinValue, DateTime.Now.AddSeconds (-1), false, "data", "path");
+                       Assert.AreEqual ("path", ticket.CookiePath, "CookiePath");
+                       Assert.IsTrue (ticket.Expiration <= DateTime.Now, "Expiration");
+                       Assert.IsTrue (ticket.Expired, "Expired");
+                       Assert.IsFalse (ticket.IsPersistent, "IsPersistent");
+                       Assert.AreEqual (DateTime.MinValue, ticket.IssueDate, "IssueDate");
+                       Assert.AreEqual ("mine", ticket.Name, "Name");
+                       Assert.AreEqual ("data", ticket.UserData, "UserData");
+                       Assert.AreEqual (3, ticket.Version, "Version");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // we can't take the simpler (3 params) ctor as it fails under 1.x (NRE)
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[7] { typeof (int), typeof (string), typeof (DateTime), typeof (DateTime), typeof (bool), typeof (string), typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(string,bool,int)");
+                       return ci.Invoke (new object[7] { 3, "mine", DateTime.MinValue, DateTime.Now.AddSeconds (-1), false, "data", "path" });
+               }
+
+               public override Type Type {
+                       get { return typeof (FormsAuthenticationTicket); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/FormsIdentityCas.cs b/mcs/class/System.Web/Test/System.Web.Security/FormsIdentityCas.cs
new file mode 100644 (file)
index 0000000..3fb36a2
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// FormsIdentityCas.cs - CAS unit tests for System.Web.Security.FormsIdentity
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class FormsIdentityCas : AspNetHostingMinimal {
+
+               private FormsAuthenticationTicket ticket;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // other (simpler) ctors fails with NRE under 1.x
+                       ticket = new FormsAuthenticationTicket (3, "mine", DateTime.MinValue, DateTime.Now.AddSeconds (-1), false, "data", "path");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Identity ()
+               {
+                       FormsIdentity identity = new FormsIdentity (ticket);
+                       Assert.AreEqual ("Forms", identity.AuthenticationType, "AuthenticationType");
+                       Assert.IsTrue (identity.IsAuthenticated, "IsAuthenticated");
+                       Assert.AreEqual ("mine", identity.Name, "Name");
+                       Assert.IsTrue (Object.ReferenceEquals (ticket, identity.Ticket), "Ticket");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (FormsAuthenticationTicket) });
+                       Assert.IsNotNull (ci, ".ctor(FormsAuthenticationTicket)");
+                       return ci.Invoke (new object[1] { ticket });
+               }
+
+               public override Type Type {
+                       get { return typeof (FormsIdentity); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/FormsIdentityTest.cs b/mcs/class/System.Web/Test/System.Web.Security/FormsIdentityTest.cs
new file mode 100644 (file)
index 0000000..1cc0faf
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// FormsIdentityTest.cs - Unit tests for System.Web.Security.FormsIdentity
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoTests.System.Web.Security {
+
+       [TestFixture]
+       public class FormsIdentityTest {
+
+               [Test]
+               public void Null ()
+               {
+                       FormsIdentity identity = new FormsIdentity (null);
+                       Assert.AreEqual ("Forms", identity.AuthenticationType, "AuthenticationType");
+                       Assert.IsTrue (identity.IsAuthenticated, "IsAuthenticated");
+                       Assert.IsNull (identity.Ticket, "Ticket");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Null_Name ()
+               {
+                       FormsIdentity identity = new FormsIdentity (null);
+                       Assert.IsNull (identity.Name, "Name");
+               }
+
+               [Test]
+               public void Ticket ()
+               {
+                       FormsAuthenticationTicket ticket = new FormsAuthenticationTicket (3, "mine", DateTime.MinValue, DateTime.Now.AddSeconds (-1), false, "data", "path");
+                       FormsIdentity identity = new FormsIdentity (ticket);
+                       Assert.AreEqual ("Forms", identity.AuthenticationType, "AuthenticationType");
+                       Assert.IsTrue (identity.IsAuthenticated, "IsAuthenticated");
+                       Assert.AreEqual ("mine", identity.Name, "Name");
+                       Assert.IsNotNull (identity.Ticket, "Ticket");
+               }
+       }
+}
index e6084cfa48226a5bef1c5a73e9d3cd6a96894fc3..03ffbb87301992f14f4e8a4f3b94772a9201fc5e 100644 (file)
@@ -37,25 +37,20 @@ using System.Security.Principal;
 using System.Web;
 using System.Web.Security;
 
-namespace MonoCasTests.System.Web {
+namespace MonoCasTests.System.Web.Security {
 
        [TestFixture]
        [Category ("CAS")]
-       public class PassportAuthenticationEventArgsCas {
+       public class PassportAuthenticationEventArgsCas : AspNetHostingMinimal {
 
+               private HttpContext context;
                private PassportAuthenticationEventArgs paea;
 
                [TestFixtureSetUp]
                public void FixtureSetUp ()
                {
-                       paea = new PassportAuthenticationEventArgs (null, new HttpContext (null));
-               }
-
-               [SetUp]
-               public void SetUp ()
-               {
-                       if (!SecurityManager.SecurityEnabled)
-                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+                       context = new HttpContext (null);
+                       paea = new PassportAuthenticationEventArgs (null, context);
                }
 
                [Test]
@@ -87,5 +82,18 @@ namespace MonoCasTests.System.Web {
                        Assert.IsNull (paea.Identity, "Identity-after");
                        Assert.IsNotNull (paea.User, "User-after");
                }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[2] { typeof (PassportIdentity), typeof (HttpContext) });
+                       Assert.IsNotNull (ci, ".ctor(PassportIdentity,HttpContext)");
+                       return ci.Invoke (new object[2] { null, context });
+               }
+
+               public override Type Type {
+                       get { return typeof (PassportAuthenticationEventArgs); }
+               }
        }
 }
diff --git a/mcs/class/System.Web/Test/System.Web.Security/PassportAuthenticationModuleCas.cs b/mcs/class/System.Web/Test/System.Web.Security/PassportAuthenticationModuleCas.cs
new file mode 100644 (file)
index 0000000..e87131f
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// PassportAuthenticationModuleCas.cs 
+//     - CAS unit tests for System.Web.Security.PassportAuthenticationModule
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PassportAuthenticationModuleCas : AspNetHostingMinimal {
+
+               private HttpApplication app;
+               private PassportAuthenticationModule module;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       app = new HttpApplication ();
+                       module = new PassportAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new PassportAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new PassportAuthenticationModule ();
+               }
+
+               private void Authenticate (object sender, PassportAuthenticationEventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Module ()
+               {
+                       // only the ctor requires UnmanagedCode
+                       try {
+                               module.Init (app);
+                       }
+                       catch (NotImplementedException) {
+                               // Mono
+                       }
+                       module.Authenticate += new PassportAuthenticationEventHandler (Authenticate);
+                       module.Authenticate -= new PassportAuthenticationEventHandler (Authenticate);
+                       module.Dispose (); // but doesn't implement IDisposable
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (PassportAuthenticationModule); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/PassportIdentityCas.cs b/mcs/class/System.Web/Test/System.Web.Security/PassportIdentityCas.cs
new file mode 100644 (file)
index 0000000..6d7a8ed
--- /dev/null
@@ -0,0 +1,87 @@
+//
+// PassportIdentityCas.cs 
+//     - CAS unit tests for System.Web.Security.PassportIdentity
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PassportIdentityCas : AspNetHostingMinimal {
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_Unmanaged ()
+               {
+                       new PassportIdentity ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void Constructor_PermitOnly_Unmanaged ()
+               {
+                       try {
+                               new PassportIdentity ();
+                       }
+                       catch (NullReferenceException) {
+                               Assert.Ignore ("fails with NullReferenceException on MS");
+                       }
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, Unrestricted = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // the ctor NRE makes it more complex
+                       try {
+                               return base.CreateControl (action, level);
+                       }
+                       catch (TargetInvocationException tie) {
+                               // we really checking for security exceptions that occurs before a NRE can occurs
+                               if (tie.InnerException is NullReferenceException)
+                                       return String.Empty;
+                               else
+                                       return null;
+                       }
+               }
+
+               public override Type Type {
+                       get { return typeof (PassportIdentity); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Security/UrlAuthorizationModuleCas.cs b/mcs/class/System.Web/Test/System.Web.Security/UrlAuthorizationModuleCas.cs
new file mode 100644 (file)
index 0000000..c35aab5
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// UrlAuthorizationModuleCas.cs 
+//     - CAS unit tests for System.Web.Security.UrlAuthorizationModule
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class UrlAuthorizationModuleCas : AspNetHostingMinimal {
+
+               private HttpApplication app;
+               private UrlAuthorizationModule module;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       app = new HttpApplication ();
+                       module = new UrlAuthorizationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new UrlAuthorizationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new UrlAuthorizationModule ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Module ()
+               {
+                       // only the ctor requires UnmanagedCode
+                       module.Init (app);
+                       module.Dispose (); // but doesn't implement IDisposable
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (UrlAuthorizationModule); }
+               }
+       }
+}
index e7461d09b0387c2006f7f31f88640af9a6e8ce4b..b97d95f50e99a9570ad769278684bc9e9ac718e7 100644 (file)
@@ -37,25 +37,20 @@ using System.Security.Principal;
 using System.Web;
 using System.Web.Security;
 
-namespace MonoCasTests.System.Web {
+namespace MonoCasTests.System.Web.Security {
 
        [TestFixture]
        [Category ("CAS")]
-       public class WindowsAuthenticationEventArgsCas {
+       public class WindowsAuthenticationEventArgsCas : AspNetHostingMinimal {
 
+               private HttpContext context;
                private WindowsAuthenticationEventArgs waea;
 
                [TestFixtureSetUp]
                public void FixtureSetUp ()
                {
-                       waea = new WindowsAuthenticationEventArgs (null, new HttpContext (null));
-               }
-
-               [SetUp]
-               public void SetUp ()
-               {
-                       if (!SecurityManager.SecurityEnabled)
-                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+                       context = new HttpContext (null);
+                       waea = new WindowsAuthenticationEventArgs (null, context);
                }
 
                [Test]
@@ -87,5 +82,18 @@ namespace MonoCasTests.System.Web {
                        Assert.IsNull (waea.Identity, "Identity-after");
                        Assert.IsNotNull (waea.User, "User-after");
                }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[2] { typeof (WindowsIdentity), typeof (HttpContext) });
+                       Assert.IsNotNull (ci, ".ctor(WindowsIdentity,HttpContext)");
+                       return ci.Invoke (new object[2] { null, context });
+               }
+
+               public override Type Type {
+                       get { return typeof (WindowsAuthenticationEventArgs); }
+               }
        }
 }
diff --git a/mcs/class/System.Web/Test/System.Web.Security/WindowsAuthenticationModuleCas.cs b/mcs/class/System.Web/Test/System.Web.Security/WindowsAuthenticationModuleCas.cs
new file mode 100644 (file)
index 0000000..0cedfe2
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// WindowsAuthenticationModuleCas.cs 
+//     - CAS unit tests for System.Web.Security.WindowsAuthenticationModule
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Security;
+
+namespace MonoCasTests.System.Web.Security {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class WindowsAuthenticationModuleCas : AspNetHostingMinimal {
+
+               private HttpApplication app;
+               private WindowsAuthenticationModule module;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       app = new HttpApplication ();
+                       module = new WindowsAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new WindowsAuthenticationModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new WindowsAuthenticationModule ();
+               }
+
+               private void Authenticate (object sender, WindowsAuthenticationEventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Module ()
+               {
+                       // only the ctor requires UnmanagedCode
+                       try {
+                               module.Init (app);
+                       }
+                       catch (NotImplementedException) {
+                               // Mono
+                       }
+                       module.Authenticate += new WindowsAuthenticationEventHandler (Authenticate);
+                       module.Authenticate -= new WindowsAuthenticationEventHandler (Authenticate);
+                       module.Dispose (); // but doesn't implement IDisposable
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (WindowsAuthenticationModule); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.SessionState/ChangeLog b/mcs/class/System.Web/Test/System.Web.SessionState/ChangeLog
new file mode 100644 (file)
index 0000000..96d04c7
--- /dev/null
@@ -0,0 +1,4 @@
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * StateRuntimeCas.cs: New. CAS unit tests.
+       * SessionStateModuleCas.cs: New. CAS unit tests.
diff --git a/mcs/class/System.Web/Test/System.Web.SessionState/SessionStateModuleCas.cs b/mcs/class/System.Web/Test/System.Web.SessionState/SessionStateModuleCas.cs
new file mode 100644 (file)
index 0000000..0dfa117
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// WindowsAuthenticationModuleCas.cs 
+//     - CAS unit tests for System.Web.SessionState.WindowsAuthenticationModule
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.SessionState;
+
+namespace MonoCasTests.System.Web.SessionState {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class SessionStateModuleCas : AspNetHostingMinimal {
+
+               private HttpApplication app;
+               private SessionStateModule module;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       app = new HttpApplication ();
+                       module = new SessionStateModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new SessionStateModule ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new SessionStateModule ();
+               }
+
+               private void StartStop (object sender, EventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Module ()
+               {
+                       // only the ctor requires UnmanagedCode
+                       try {
+                               module.Init (app);
+                       }
+                       catch (NullReferenceException) {
+                               // fx2
+                       }
+                       module.Start += new EventHandler (StartStop);
+                       module.End += new EventHandler (StartStop);
+                       module.End -= new EventHandler (StartStop);
+                       module.Start -= new EventHandler (StartStop);
+                       module.Dispose (); // but doesn't implement IDisposable
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+
+               public override Type Type {
+                       get { return typeof (SessionStateModule); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.SessionState/StateRuntimeCas.cs b/mcs/class/System.Web/Test/System.Web.SessionState/StateRuntimeCas.cs
new file mode 100644 (file)
index 0000000..11a877c
--- /dev/null
@@ -0,0 +1,215 @@
+//
+// StateRuntimeCas.cs 
+//     - CAS unit tests for System.Web.SessionState.StateRuntime
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.SessionState;
+
+namespace MonoCasTests.System.Web.SessionState {
+
+       // note: the execution order (not user controlable) is very important 
+       // for the tests to execute properly. However the tests are protected 
+       // not to report errors if the order isn't repected.
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class StateRuntimeCas : AspNetHostingMinimal {
+
+               private StateRuntime runtime;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       try {
+                               // ensure that the static ctor has been called
+                               runtime = new StateRuntime ();
+                       }
+                       catch {
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       try {
+                               new StateRuntime ();
+                       }
+                       catch (TypeInitializationException) {
+                               Assert.Ignore ("fails on MS");
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Minimal)]
+#if NET_2_0
+               [ExpectedException (typeof (SecurityException))]
+#endif
+               public void Constructor_Deny_Minimal ()
+               {
+                       try {
+                               new StateRuntime ();
+                       }
+                       catch (TypeInitializationException) {
+                               Assert.Ignore ("fails on MS");
+                       }
+               }
+
+               [Test]
+#if NET_2_0
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Minimal)]
+#endif
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCodeMinimal ()
+               {
+                       try {
+                               new StateRuntime ();
+                       }
+                       catch (TypeInitializationException) {
+                               Assert.Ignore ("fails on MS");
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               public void ProcessRequest9_PermitOnly_Medium ()
+               {
+                       if (runtime == null)
+                               Assert.Ignore ("impossible to instantiate under MS");
+
+                       try {
+                               runtime.ProcessRequest (IntPtr.Zero, 0, null, 0, 0, 0, 0, 0, IntPtr.Zero);
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x
+                       }
+                       catch (DllNotFoundException) {
+                               // ms 2.0
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ProcessRequest9_Deny_Medium ()
+               {
+                       if (runtime == null)
+                               Assert.Ignore ("impossible to instantiate under MS");
+
+                       runtime.ProcessRequest (IntPtr.Zero, 0, null, 0, 0, 0, 0, 0, IntPtr.Zero);
+               }
+#if NET_2_0
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               public void ProcessRequest10_PermitOnly_Medium ()
+               {
+                       if (runtime == null)
+                               Assert.Ignore ("impossible to instantiate under MS");
+
+                       try {
+                               runtime.ProcessRequest (IntPtr.Zero, 0, null, 0, 0, 0, 0, 0, 0, IntPtr.Zero);
+                       }
+                       catch (DllNotFoundException) {
+                               // ms
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ProcessRequest10_Deny_Medium ()
+               {
+                       if (runtime == null)
+                               Assert.Ignore ("impossible to instantiate under MS");
+
+                       runtime.ProcessRequest (IntPtr.Zero, 0, null, 0, 0, 0, 0, 0, 0, IntPtr.Zero);
+               }
+#endif
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               [Category ("NotDotNet")] // freeze
+               public void StopProcessing_PermitOnly_UnmanagedCode ()
+               {
+                       if (runtime == null)
+                               Assert.Ignore ("impossible to instantiate under MS");
+
+                       try {
+                               runtime.StopProcessing ();
+                       }
+                       catch (SecurityException se) {
+                               Console.WriteLine (se);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void StopProcessing_Deny_UnmanagedCode ()
+               {
+                       if (runtime == null)
+                               Assert.Ignore ("may not be possible to instantiate under MS (run-order)");
+
+                       runtime.StopProcessing ();
+               }
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       try {
+                               return base.CreateControl (action, level);
+                       }
+                       catch (TypeInitializationException) {
+                               // ctor can't be called more than once (else it throws TIE)
+                               return String.Empty;
+                       }
+               }
+
+               public override Type Type {
+                       get { return typeof (StateRuntime); }
+               }
+       }
+}
index f6629e1a40499e74d68f81f9769352490d650f25..3a668f6f11e42042ad343d4484ce9e07f1b3b027 100644 (file)
@@ -1,3 +1,118 @@
+2005-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HtmlInputButtonTest.cs: make sure the onclick attribute is rendered
+       when we have a ServerClick event registered.
+
+2005-09-19  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HtmlAnchorCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlAnchorTest.cs: RaisePostBackEvent now throws a NRE under 2.0 RC.
+       * HtmlButtonCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlContainerControlCas.cs: New. CAS unit tests.
+       * HtmlFormCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlFormTest.cs: Fixed rendering output under 2.0 RC.
+       * HtmlImageCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlInputButtonCas.cs: Added "normal" unit tests execution under 
+       Deny Unrestricted.
+       * HtmlInputButtonTest.cs: Fixed attribute count for 2.0 RC.
+       * HtmlInputControlCas.cs: New. CAS unit tests.
+       * HtmlInputControlTest.cs: Fixed attribute count for 2.0 RC.
+       * HtmlInputCheckBoxCas.cs: Added "normal" unit tests execution under
+       Deny Unrestricted.
+       * HtmlInputCheckBoxTest.cs: Fixed attribute count for 2.0 RC (which is
+       now identical to 1.x results).
+       * HtmlInputFileCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlInputFileTest.cs: Fixed attribute count for 2.0 RC.
+       * HtmlInputHiddenCas.cs: Fixed attribute count for 2.0 RC.
+       * HtmlInputPasswordCas.cs: Added "normal" unit tests execution under 
+       Deny Unrestricted.
+       * HtmlInputPasswordTest.cs: Adjusted tests as 2.0 RC removed the 
+       ctor(string).
+       * HtmlInputRadioButtonCas.cs: Fixed attribute count for 2.0 RC.
+       * HtmlInputRadioButtonTest.cs: Added "normal" unit tests execution 
+       under Deny Unrestricted.
+       * HtmlInputResetCas.cs: Added "normal" unit tests execution under Deny
+       Unrestricted.
+       * HtmlInputResetTest.cs: Fixed attribute count for 2.0 RC.
+       * HtmlInputSubmitCas.cs: Added "normal" unit tests execution under 
+       Deny Unrestricted.
+       * HtmlInputSubmitTest.cs: Fixed attribute count for 2.0 RC.
+       * HtmlInputTextCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlInputTextTest.cs: Fixed attribute count for 2.0 RC.
+       * HtmlLinkCas.cs: New. CAS unit tests.
+       * HtmlMetaCas.cs: New. CAS unit tests.
+       * HtmlMetaTest.cs: Fixed rendering for 2.0 RC (tag ending).
+       * HtmlSelectCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlTableCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlTableCellCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlTableRowCas.cs: Added "normal" unit tests execution under Deny 
+       Unrestricted.
+       * HtmlTextAreaCas.cs: New. CAS unit tests.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HtmlInputTextTest.cs: Fix expected value for LoadPostData (in the 
+       cases where MS returns a NullReferenceException).
+
+2005-09-11  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputFileTest.cs (Attribute_Count): fix for 2.0.
+
+2005-09-11  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputFileTest.cs: new tests.
+
+2005-09-09  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlFormTest.cs: Add test for RenderChildren.
+
+2005-09-09  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlInputButtonTest.cs (RenderAttributes): add in
+       CausesValidation and ValidationGroup here.
+
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HtmlTableRowTest.cs: Added tests for InnerHtml and InnerText setters
+       * HtmlTableTest.cs: Added tests for InnerHtml and InnerText setters
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlFormTest.cs: more tests to get at the root of the confusion
+       that is the Name property.  Also, copy over Gonzalo's
+       Name_InsideNaming from HtmlInputControlTest.cs here.
+
+2005-09-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HtmlInputControlTest.cs: new tests for the case when the control is
+       inside a different naming container.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlLinkTest.cs: add empty render test.
+
+       * HtmlMetaTest.cs: same.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlLinkTest.cs: new tests.
+
+       * HtmlMetaTest.cs: new tests.
+
+2005-09-05  Chris Toshok  <toshok@ximian.com>
+
+       * HtmlFormTest.cs: add some more tests to make figure out the
+       property spot to be storing some of these attributes.
+
 2005-09-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * HtmlAnchorCas.cs, HtmlButtonCas.cs, HtmlEmptyTagControlBuilderCas.cs,
index a5914c14fe2a1ed6b54078b70c1060ff8a761e91..eaa9b88afe6a0f39c26216c80ccd0fb912cb3099 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlAnchorCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlAnchorTest unit = new HtmlAnchorTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.Target ();
+                       unit.HRef ();
+                       unit.AbsoluteHRef ();
+                       unit.RenderAttributes ();
+#if ONLY_1_1
+                       // sadly this started to throw NRE in 2.0 RC
+                       unit.IPostBackEventHandler_RaisePostBackEvent ();
+#endif
+               }
+
                public override Type Type {
                        get { return typeof (HtmlAnchor); }
                }
index 36f5d4a455a47e141f39cac37f3e088072cd4016..672515de7b0d244eaf92c2a4fcdaa200cf9f469e 100644 (file)
@@ -161,6 +161,9 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                }
 
                [Test]
+#if NET_2_0
+               [ExpectedException (typeof (NullReferenceException))] // since 2.0 RC :-(
+#endif
                public void IPostBackEventHandler_RaisePostBackEvent ()
                {
                        TestHtmlAnchor a = new TestHtmlAnchor ();
@@ -181,6 +184,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                }
 #if NET_2_0
                [Test]
+               [ExpectedException (typeof (NullReferenceException))] // since 2.0 RC :-(
                public void RaisePostBackEvent ()
                {
                        TestHtmlAnchor a = new TestHtmlAnchor ();
index d997ceccffb1664f1cd2e9b61ee2d9e94da2a4a3..9063b7dcabed97e98788ab5ec1e637234af3dbc8 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlButtonCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlButtonTest unit = new HtmlButtonTest ();
+                       unit.Defaults ();
+                       unit.CleanProperties ();
+                       unit.ViewState ();
+                       unit.RenderAttributes ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlButton); }
                }
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlContainerControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlContainerControlCas.cs
new file mode 100644 (file)
index 0000000..0f5621d
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// HtmlContainerControlCas.cs 
+//     - CAS unit tests for System.Web.UI.HtmlControls.HtmlContainerControl
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web.UI.HtmlControls;
+
+using MonoTests.System.Web.UI.HtmlControls;
+
+namespace MonoCasTests.System.Web.UI.HtmlControls {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HtmlContainerControlCas {
+
+               // note: we do not inherit from AspNetHostingMinimal because
+               // HtmlContainerControl is an abstract class
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlContainerControlTest unit = new HtmlContainerControlTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.CleanProperties ();
+                       unit.Render ();
+               }
+       }
+}
index 20ab1ddc939f198b199371509fc548c5c590eeff..a70e129532561c55841d2f415986268fae53ba87 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlFormCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlFormTest unit = new HtmlFormTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.Attributes ();
+                       unit.ViewState ();
+                       unit.Name_InsideNaming ();
+                       unit.RenderChildren ();
+#if NET_2_0
+                       unit.ControlCollection ();
+#endif
+               }
+
                public override Type Type {
                        get { return typeof (HtmlForm); }
                }
index 449b86b189f91644b5eb23c0d2f42ca53464692f..45136bbd0ad003928bf3967bc80400231cd4ed39 100644 (file)
@@ -29,6 +29,8 @@
 
 using System;
 using System.IO;
+using System.Text;
+using System.Web;
 using System.Web.UI;
 using System.Web.UI.HtmlControls;
 
@@ -36,9 +38,45 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Web.UI.HtmlControls {
 
+       public class FormPoker : HtmlForm {
+               public FormPoker () {
+                       TrackViewState ();
+               }
+
+               public object SaveState ()
+               {
+                       return SaveViewState ();
+               }
+
+               public void LoadState (object state)
+               {
+                       LoadViewState (state);
+               }
+
+               public string RenderChildren ()
+               {
+                       StringWriter sw = new StringWriter();
+                       HtmlTextWriter w = new HtmlTextWriter (sw);
+                       
+                       RenderChildren (w);
+
+                       return sw.ToString();
+               }
+
+#if NET_2_0
+               public ControlCollection GetControlCollection ()
+               {
+                       return CreateControlCollection();
+               }
+#endif
+       }
+
+       class FUControl : UserControl {
+       }
+
+
        [TestFixture]
        public class HtmlFormTest {
-
                [Test]
                public void DefaultProperties ()
                {
@@ -51,6 +89,10 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        Assert.AreEqual (String.Empty, form.Target, "Target");
 
                        Assert.AreEqual ("form", form.TagName, "TagName");
+
+#if NET_2_0
+                       Assert.IsFalse (form.SubmitDisabledControls, "TagName");
+#endif
                }
 
                [Test]
@@ -67,7 +109,124 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        form.Target = null;
                        Assert.AreEqual (String.Empty, form.Target, "Target");
 
+#if NET_2_0
+                       form.DefaultButton = null;
+                       Assert.AreEqual (String.Empty, form.DefaultButton, "DefaultButton");
+
+                       form.DefaultFocus = null;
+                       Assert.AreEqual (String.Empty, form.DefaultFocus, "DefaultFocus");
+#endif
                        Assert.AreEqual (0, form.Attributes.Count, "Attributes.Count");
+
+               }
+
+               [Test]
+               public void Attributes ()
+               {
+                       HtmlForm form = new HtmlForm ();
+                       IAttributeAccessor a = (IAttributeAccessor)form;
+
+#if NET_2_0
+                       /* not stored in Attributes */
+                       form.DefaultButton = "defaultbutton";
+                       Assert.IsNull (a.GetAttribute ("defaultbutton"), "A1");
+
+                       /* not stored in Attributes */
+                       form.DefaultFocus = "defaultfocus";
+                       Assert.IsNull (a.GetAttribute ("defaultfocus"), "A2");
+#endif
+                       form.Enctype = "enctype";
+                       Assert.AreEqual ("enctype", a.GetAttribute ("enctype"), "A3");
+
+                       form.Method = "method";
+                       Assert.AreEqual ("method", a.GetAttribute ("method"), "A4");
+
+                       /* not stored in Attributes */
+                       form.Name = "name";
+                       Assert.AreEqual (form.UniqueID, form.Name, "A5");
+                       Assert.IsNull (form.Name, "A6");
+                       Assert.IsNull (form.UniqueID, "A7");
+                       Assert.IsNull (a.GetAttribute ("name"), "A8");
+                       form.ID = "hithere";
+                       Assert.AreEqual ("hithere", form.Name, "A9");
+
+#if NET_2_0
+                       form.SubmitDisabledControls = true;
+                       Assert.IsNull (a.GetAttribute ("submitdisabledcontrols"), "A10");
+#endif
+
+                       form.Target = "target";
+                       Assert.AreEqual ("target", a.GetAttribute ("target"), "A11");
+               }
+
+               [Test]
+               public void ViewState ()
+               {
+                       FormPoker form = new FormPoker();
+                       FormPoker copy = new FormPoker();
+
+#if NET_2_0
+                       form.DefaultButton = "defaultbutton";
+                       form.DefaultFocus = "defaultfocus";
+#endif
+
+                       object state = form.SaveState();
+                       copy.LoadState (state);
+
+#if NET_2_0
+                       Assert.AreEqual ("", copy.DefaultButton, "A1");
+                       Assert.AreEqual ("defaultfocus", form.DefaultFocus, "A2");
+#endif
+
+               }
+
+               [Test]
+               public void Name_InsideNaming ()
+               {
+                       Control ctrl = new FUControl ();
+                       ctrl.ID = "parent";
+                       FormPoker form = new FormPoker ();
+                       ctrl.Controls.Add (form);
+                       Assert.IsNull (form.ID, "ID");
+                       form.Name = "name";
+                       Assert.AreEqual (form.Name, form.UniqueID, "name and unique id");
+
+                       form.ID = "id";
+                       Assert.AreEqual ("id", form.ID, "ID-2");
+                       Assert.AreEqual (form.UniqueID, form.Name, "Name-ID");
+
+                       form.Name = "name";
+                       Assert.AreEqual (form.Name, form.UniqueID, "UniqueID-2");
+
+                       form.ID = null;
+                       Assert.IsNull (form.ID, "ID-3");
+                       Assert.IsNotNull (form.UniqueID, "UniqueID-3");
+                       Assert.IsNotNull (form.Name, "Name-2");
+               }
+
+               [Test]
+               public void RenderChildren ()
+               {
+                       Page p = new Page();
+                       FormPoker form = new FormPoker ();
+                       form.Page = p;
+#if NET_2_0
+                       Assert.AreEqual ("\r\n<div>\r\n<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"\r\n__VIEWSTATE\" value=\"\" />\r\n</div>\r\n", form.RenderChildren (), "A1");
+#else
+                       Assert.AreEqual ("\r\n<input type=\"hidden\" name=\"__VIEWSTATE\" value=\"\" />", form.RenderChildren (), "A1");
+#endif
+               }
+
+#if NET_2_0
+               [Test]
+               public void ControlCollection ()
+               {
+                       FormPoker poker = new FormPoker();
+                       ControlCollection col = poker.GetControlCollection();
+                       Assert.AreEqual (col.GetType(), typeof (ControlCollection), "A1");
+                       Assert.IsFalse (col.IsReadOnly, "A2");
+                       Assert.AreEqual (0, col.Count, "A3");
                }
+#endif
        }
 }
index b7ecad734f008e92b34deec9473098e406b95cf3..a72de462f6e1e0fa8a609461b3661bd48d24ae32 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlImageCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlImageTest unit = new HtmlImageTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.Negative ();
+                       unit.RenderAttributes ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlImage); }
                }
index 2f20c4da1858d0e71a21509e14bd8c05d93b46ca..4518c8461a6528291738f14316b6e05cf0277c5d 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputButtonCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputButtonTest unit = new HtmlInputButtonTest ();
+                       unit.Defaults ();
+                       unit.CleanProperties ();
+                       unit.ViewState ();
+                       unit.RenderAttributes ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputButton); }
                }
index b0ff64feb434afe5f7cf196cf3c3444d9923aeaa..4837944c0b278b463c31bd01873c8adf85d9e230 100644 (file)
@@ -110,15 +110,45 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        HtmlTextWriter tw = new HtmlTextWriter (sw);
 
                        HtmlInputButtonPoker p = new HtmlInputButtonPoker ();
+                       
+                       p.Page = new Page ();
 
+                       p.CausesValidation = false;
+#if NET_2_0
+                       p.ValidationGroup = "VG";
+
+                       Assert.AreEqual (3, p.Attributes.Count, "A1");
+#else
+                       Assert.AreEqual (2, p.Attributes.Count, "A1");
+#endif
+
+                       p.DoRenderAttributes (tw);
 #if NET_2_0
-                       Assert.AreEqual (p.Attributes.Count, 0, "A1");
+                       Assert.AreEqual (" name type=\"button\" ValidationGroup=\"VG\" /", sw.ToString (), "A2");
 #else
-                       Assert.AreEqual (p.Attributes.Count, 1, "A1");
+                       Assert.AreEqual (" name type=\"button\" /", sw.ToString (), "A2");
 #endif
+               }
+
+               [Test]
+               public void OnClickAttribute ()
+               {
+                       StringWriter sw = new StringWriter ();
+                       HtmlTextWriter tw = new HtmlTextWriter (sw);
 
+                       HtmlInputButtonPoker p = new HtmlInputButtonPoker ();
+                       p.Page = new Page ();
+                       p.DoRenderAttributes (tw);
+                       string str = sw.ToString ();
+                       int found = str.IndexOf ("onclick");
+                       Assert.AreEqual (-1, found, "#01");
+                       p.ServerClick += new EventHandler (EmptyHandler);
+                       sw = new StringWriter ();
+                       tw = new HtmlTextWriter (sw);
                        p.DoRenderAttributes (tw);
-                       Assert.AreEqual (sw.ToString (), " name type=\"button\" /", "A2");
+                       str = sw.ToString ();
+                       found = str.IndexOf ("onclick");
+                       Assert.IsTrue (found >= 0, "#02");
                }
 
                private static void EmptyHandler (object sender, EventArgs e)
index f40909fc7259bec72881ad68b42972a63028aaf8..6e43322df418a5e1a4402e4a5305016a47f90551 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputCheckBoxCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputCheckBoxTest unit = new HtmlInputCheckBoxTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.CleanProperties ();
+                       unit.Render ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputCheckBox); }
                }
index ba55cb29b9944eb81e2817996b1dba5d1cc71b06..7e7afdf3a8765f91e41e814e7eac77005caebdcd 100644 (file)
@@ -51,20 +51,12 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                public void DefaultProperties ()
                {
                        HtmlInputCheckBox c = new HtmlInputCheckBox ();
-                       
-#if NET_2_0
-                       Assert.AreEqual (0, c.Attributes.Count, "Attributes.Count");
-#else
+               
                        Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count");
-#endif
 
                        Assert.IsFalse (c.Checked, "Checked");
                        
-#if NET_2_0
-                       Assert.AreEqual (0, c.Attributes.Count, "Attributes.Count after");
-#else
                        Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count after");
-#endif
                }
 
                [Test]
@@ -72,20 +64,12 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                {
                        HtmlInputCheckBox c = new HtmlInputCheckBox ();
                        
-#if NET_2_0
-                       Assert.AreEqual (0, c.Attributes.Count, "Attributes.Count");
-#else
                        Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count");
-#endif
 
                        c.Checked = true;
                        Assert.IsTrue (c.Checked, "Checked");
                        
-#if NET_2_0
-                       Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count after");
-#else
                        Assert.AreEqual (2, c.Attributes.Count, "Attributes.Count after");
-#endif
                }
 
                [Test]
@@ -94,20 +78,10 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        HtmlInputCheckBox c = new HtmlInputCheckBox ();
 
                        c.Checked = true;
-
-#if NET_2_0
-                       Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count");
-#else
                        Assert.AreEqual (2, c.Attributes.Count, "Attributes.Count");
-#endif
 
                        c.Checked = false;
-
-#if NET_2_0
-                       Assert.AreEqual (0, c.Attributes.Count, "Attributes.Count after");
-#else
                        Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count after");
-#endif
                }
 
                [Test]
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputControlCas.cs
new file mode 100644 (file)
index 0000000..bbd44d0
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// HtmlInputControlCas.cs 
+//     - CAS unit tests for System.Web.UI.HtmlControls.HtmlInputControl
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web.UI.HtmlControls;
+
+using MonoTests.System.Web.UI.HtmlControls;
+
+namespace MonoCasTests.System.Web.UI.HtmlControls {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HtmlInputControlCas {
+
+               // note: we do not inherit from AspNetHostingMinimal because
+               // HtmlInputControl is an abstract class
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputControlTest unit = new HtmlInputControlTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.CleanProperties ();
+                       unit.Name ();
+                       unit.Name_InsideNaming ();
+                       unit.IDversusValue ();
+                       unit.RenderAttributes ();
+                       unit.Constructor_Null ();
+                       unit.Password ();
+               }
+       }
+}
index ce4cf37ba4dbac1f5cebf0b4a332b0bc5221eac3..1fa9bc33f663bdf513bf262989d7d452946989ac 100644 (file)
@@ -37,6 +37,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Web.UI.HtmlControls {
 
        public class TestHtmlInputControl : HtmlInputControl {
+               bool name_called;
 
                public TestHtmlInputControl ()
                        : base ("mono")
@@ -54,17 +55,27 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        base.RenderAttributes (writer);
                        return writer.InnerWriter.ToString ();
                }
+
+               public override string Name {
+                       get {
+                               name_called = true;
+                               return base.Name;
+                       }
+               }
+
+               public bool NameCalled {
+                       get { return name_called; }
+                       set { name_called = value; }
+               }
+       }
+
+       public class UControl : UserControl {
        }
 
        [TestFixture]
        public class HtmlInputControlTest {
 
-#if NET_2_0
-               private const int defaultAttributesCount = 0;
-#else
-               // type is kept in Attributes under 1.x
                private const int defaultAttributesCount = 1;
-#endif
 
                [Test]
                public void DefaultProperties ()
@@ -134,6 +145,32 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        Assert.IsNull (ic.Name, "Name-2");
                }
 
+               [Test]
+               public void Name_InsideNaming ()
+               {
+                       Control ctrl = new UControl ();
+                       ctrl.ID = "parent";
+                       TestHtmlInputControl ic = new TestHtmlInputControl ();
+                       ctrl.Controls.Add (ic);
+                       Assert.IsNull (ic.ID, "ID");
+                       Assert.AreEqual (false, ic.NameCalled);
+                       ic.Name = "name";
+                       Assert.AreEqual (ic.Name, ic.UniqueID, "name and unique id");
+                       Assert.AreEqual (true, ic.NameCalled, "name called");
+
+                       ic.ID = "id";
+                       Assert.AreEqual ("id", ic.ID, "ID-2");
+                       Assert.AreEqual (ic.UniqueID, ic.Name, "Name-ID");
+
+                       ic.Name = "name";
+                       Assert.AreEqual (ic.Name, ic.UniqueID, "UniqueID-2");
+
+                       ic.ID = null;
+                       Assert.IsNull (ic.ID, "ID-3");
+                       Assert.IsNotNull (ic.UniqueID, "UniqueID-3");
+                       Assert.IsNotNull (ic.Name, "Name-2");
+               }
+
                [Test]
                public void IDversusValue ()
                {
index 67bc098c56d1f40d01171c930505822523e87881..83e853ce93f238544cdbd0c708dbe33c2563e5c9 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputFileCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputFileTest unit = new HtmlInputFileTest ();
+                       unit.Defaults ();
+                       unit.Attribute_Count ();
+                       unit.RenderAttributes ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputFile); }
                }
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputFileTest.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlInputFileTest.cs
new file mode 100644 (file)
index 0000000..4aeedd4
--- /dev/null
@@ -0,0 +1,137 @@
+//
+// HtmlInputFileTest.cs
+//     - Unit tests for System.Web.UI.HtmlControls.HtmlInputFile
+//
+// Author:
+//     Chris Toshok    (toshok@ximian.com)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web.UI.HtmlControls {
+
+       public class HtmlInputFilePoker : HtmlInputFile {
+
+               public HtmlInputFilePoker ()
+               {
+                       TrackViewState ();
+               }
+
+               public object SaveState ()
+               {
+                       return SaveViewState ();
+               }
+
+               public void LoadState (object state)
+               {
+                       LoadViewState (state);
+               }
+
+               public void DoRenderAttributes (HtmlTextWriter writer)
+               {
+                       RenderAttributes (writer);
+               }
+       }
+
+       [TestFixture]
+       public class HtmlInputFileTest {
+
+               [Test]
+               public void Defaults ()
+               {
+                       HtmlInputFilePoker p = new HtmlInputFilePoker ();
+
+                       /* MS throws a null exception on both
+                        * get_PostedFile and get_Value in this test,
+                        * which makes me think (in the PostedFile
+                        * case at least) they're directly accessing
+                        * Page.Request.Files (which our test doesn't
+                        * support) */
+
+                       Assert.AreEqual ("", p.Accept, "A1");
+                       Assert.AreEqual (-1, p.MaxLength, "A2");
+                       //Assert.IsNull (p.PostedFile, "A3");
+                       Assert.AreEqual (-1, p.Size, "A4");
+                       //Assert.AreEqual ("", p.Value, "A5");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ValueSetter ()
+               {
+                       HtmlInputFilePoker p = new HtmlInputFilePoker ();
+                       p.Value = "/etc/passwd";
+               }
+
+               [Test]
+               public void Attribute_Count ()
+               {
+                       HtmlInputFilePoker p = new HtmlInputFilePoker ();
+
+                       p.Accept = "*.*";
+                       p.MaxLength = 50;
+                       p.Size = 20;
+
+                       Assert.AreEqual (4, p.Attributes.Count, "A1");
+               }
+
+#if false
+               [Test]
+               public void ViewState ()
+               {
+                       HtmlInputButtonPoker p = new HtmlInputButtonPoker ();
+#if NET_2_0
+                       p.CausesValidation = false;
+                       p.ValidationGroup = "VG";
+#endif
+                       object s = p.SaveState();
+                       HtmlInputButtonPoker copy = new HtmlInputButtonPoker ();
+                       copy.LoadState (s);
+
+#if NET_2_0
+                       Assert.IsFalse (copy.CausesValidation, "A1");
+                       Assert.AreEqual ("VG", p.ValidationGroup, "A2");
+#endif
+               }
+#endif
+
+               [Test]
+               public void RenderAttributes ()
+               {
+                       StringWriter sw = new StringWriter ();
+                       HtmlTextWriter tw = new HtmlTextWriter (sw);
+
+                       HtmlInputFilePoker p = new HtmlInputFilePoker ();
+
+                       p.DoRenderAttributes (tw);
+                       Assert.AreEqual (" name type=\"file\" /", sw.ToString (), "A1");
+               }
+       }       
+}
+
index 458dd856abeccf9bf18bc3291dd28e8026df0274..0855a3c2700f1e57e5c1a78823071dd238f7e3ea 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputHiddenCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputHiddenTest unit = new HtmlInputHiddenTest ();
+                       unit.Defaults ();
+                       unit.PropertiesNull ();
+                       unit.Postback ();
+                       unit.TestPostbackHandling ();
+                       unit.Render ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputHidden); }
                }
index cbf86c3a2a1115ebcdfe6fc7a6f41281b6cc5385..e30a207c7213a6064c8445dbf17a6995a6fc6310 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputPasswordCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputPasswordTest unit = new HtmlInputPasswordTest ();
+                       unit.DefaultProperties ();
+                       unit.RenderAttributes ();
+                       unit.IPostBackDataHandler_RaisePostBackEvent ();
+                       unit.IPostBackDataHandler_LoadPostData ();
+                       unit.RaisePostBackEvent ();
+                       unit.LoadPostData ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputPassword); }
                }
index 0adeefc6254aede6f4563d49f90e4c35a97e4110..aceef2d0eff45e1d91a471a5dde6444d3fde65e1 100644 (file)
@@ -27,6 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if NET_2_0
+
 using System;
 using System.Collections.Specialized;
 using System.IO;
@@ -35,7 +37,6 @@ using System.Web.UI.HtmlControls;
 
 using NUnit.Framework;
 
-#if NET_2_0
 namespace MonoTests.System.Web.UI.HtmlControls {
 
        public class TestHtmlInputPassword : HtmlInputPassword {
@@ -51,11 +52,6 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                {
                }
 
-               public TestHtmlInputPassword (string type)
-                       : base (type)
-               {
-               }
-
                public string RenderAttributes ()
                {
                        HtmlTextWriter writer = new HtmlTextWriter (new StringWriter ());
@@ -88,7 +84,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                public string AttributeNewValue {
                        get { return attr_new_value; }
                }
-#if NET_2_0
+
                public bool LoadPost (string key, NameValueCollection nvc)
                {
                        return base.LoadPostData (key, nvc);
@@ -98,20 +94,13 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                {
                        base.RaisePostDataChangedEvent ();
                }
-#endif
        }
 
 
        [TestFixture]
        public class HtmlInputPasswordTest {
-               private const int defaultAttributesCount = 0;
 
-               [Test]
-               public void ConstructorType ()
-               {
-                       HtmlInputPassword it = new HtmlInputPassword ("mono");
-                       Assert.AreEqual ("mono", it.Type, "Type");
-               }
+               private const int defaultAttributesCount = 1;
 
                [Test]
                public void DefaultProperties ()
index 3be743503261358bde7ad4725060a86d68d93192..05c88f3d8e15acce780c893f754cfed54017533c 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputRadioButtonCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputRadioButtonTest unit = new HtmlInputRadioButtonTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.CleanProperties ();
+                       unit.Value_Existing ();
+                       unit.Value_Resetting ();
+                       unit.Value_ResetNull ();
+                       unit.IDversusValue ();
+                       unit.IPostBackDataHandler_RaisePostBackEvent ();
+                       unit.IPostBackDataHandler_LoadPostData_WrongId ();
+                       unit.IPostBackDataHandler_LoadPostData ();
+#if NET_2_0
+                       unit.RaisePostBackEvent ();
+                       unit.LoadPostData_WrongId ();
+                       unit.LoadPostData ();
+#endif
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputRadioButton); }
                }
index bc7ee868a26bfc47068894ead44fb8a34576369b..ee66a3d9c9dd5fb1ca89fcd3f58c039a27d4bae0 100644 (file)
@@ -61,12 +61,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
        [TestFixture]
        public class HtmlInputRadioButtonTest {
 
-#if NET_2_0
-               private const int defaultAttributesCount = 0;
-#else
-               // type is kept in Attributes under 1.x
                private const int defaultAttributesCount = 1;
-#endif
 
                [Test]
                public void DefaultProperties ()
index b0fc2dae10a699a6d52aa97f2498cc8e8e594cac..ec34cf9ef3c517ea44ad53d3d6a0b41fdc93baf5 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputResetCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputResetTest unit = new HtmlInputResetTest ();
+                       unit.OverrideProperties ();
+                       unit.Defaults ();
+                       unit.CleanProperties ();
+                       unit.RenderAttributes ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputReset); }
                }
index 67773f73e7834ec2ab7cd46d819cf1be505b01ac..414a5f2076b48a1873040f19ae9c23898e2de0a0 100644 (file)
@@ -64,6 +64,18 @@ namespace MonoTests.System.Web.UI.HtmlControls {
        [TestFixture]
        public class HtmlInputResetTest {
 
+               [Test]
+               public void OverrideProperties ()
+               {
+                       HtmlInputResetPoker p = new HtmlInputResetPoker ();
+
+                       Assert.IsTrue (p.CausesValidation, "A1");
+                       Assert.IsTrue (((HtmlInputButton)p).CausesValidation, "A2");
+
+                       Assert.AreEqual ("", p.ValidationGroup, "A3");
+                       Assert.AreEqual ("", ((HtmlInputButton)p).ValidationGroup, "A4");
+               }
+
                [Test]
                public void Defaults ()
                {
@@ -102,7 +114,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
 
                        HtmlInputResetPoker p = new HtmlInputResetPoker ();
 
-                       Assert.AreEqual (p.Attributes.Count, 0, "A1");
+                       Assert.AreEqual (p.Attributes.Count, 1, "A1");
 
                        p.DoRenderAttributes (tw);
                        Assert.AreEqual (sw.ToString (), " name type=\"reset\" /", "A2");
index 3c2052ea4e67638f0381a38b3425e56f5d0565c1..862a30f21a13db46ffb50a696655ffb9bd64afc4 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputSubmitCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputSubmitTest unit = new HtmlInputSubmitTest ();
+                       unit.Defaults ();
+                       unit.CleanProperties ();
+                       unit.RenderAttributes ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputSubmit); }
                }
index 2bc57d9017cdc2b1a0ebb84cb5cc99b475d95491..894f9ea1158f70445fd94f666423fde1723b53a4 100644 (file)
@@ -102,7 +102,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
 
                        HtmlInputSubmitPoker p = new HtmlInputSubmitPoker ();
 
-                       Assert.AreEqual (p.Attributes.Count, 0, "A1");
+                       Assert.AreEqual (p.Attributes.Count, 1, "A1");
 
                        p.DoRenderAttributes (tw);
                        Assert.AreEqual (sw.ToString (), " name type=\"submit\" /", "A2");
index 48578fadfca845ee4cbcec4f0bc032f54d3defdb..060e3c6ff1c04bdc63226a906281da7e26b19591 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlInputTextCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlInputTextTest unit = new HtmlInputTextTest ();
+                       unit.ConstructorType ();
+                       unit.DefaultProperties ();
+                       unit.CleanProperties ();
+                       unit.NullProperties ();
+                       unit.Password ();
+                       unit.RenderAttributes ();
+                       unit.RenderAttributes_Password ();
+                       unit.IPostBackDataHandler_RaisePostBackEvent ();
+                       unit.IPostBackDataHandler_LoadPostData ();
+#if NET_2_0
+                       unit.RaisePostBackEvent ();
+                       unit.LoadPostData ();
+#endif
+               }
+
                public override Type Type {
                        get { return typeof (HtmlInputText); }
                }
index 5b42cfc1155acffe811d3f14bbc6e0cff56620d5..afafbee7bd42ef8fa8b7a9bfce5819fc0fb8d4be 100644 (file)
@@ -103,12 +103,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
        [TestFixture]
        public class HtmlInputTextTest {
 
-#if NET_2_0
-               private const int defaultAttributesCount = 0;
-#else
-               // type is kept in Attributes under 1.x
                private const int defaultAttributesCount = 1;
-#endif
 
                [Test]
                public void ConstructorType ()
@@ -251,7 +246,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        IPostBackDataHandler pbdh = (it as IPostBackDataHandler);
                        NameValueCollection nvc = new NameValueCollection ();
                        nvc.Add ("id1", "mono");
-                       Assert.IsFalse (pbdh.LoadPostData (null, nvc), "LoadPostData");
+                       Assert.IsTrue (pbdh.LoadPostData (null, nvc), "LoadPostData");
                        Assert.AreEqual (String.Empty, it.Value, "Value");
                }
 
@@ -264,7 +259,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        IPostBackDataHandler pbdh = (it as IPostBackDataHandler);
                        NameValueCollection nvc = new NameValueCollection ();
                        nvc.Add ("id1", "mono");
-                       Assert.IsFalse (pbdh.LoadPostData ("id2", nvc), "LoadPostData");
+                       Assert.IsTrue (pbdh.LoadPostData ("id2", nvc), "LoadPostData");
                        Assert.AreEqual (String.Empty, it.Value, "Value");
                }
 
@@ -306,7 +301,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        it.ID = "id1";
                        NameValueCollection nvc = new NameValueCollection ();
                        nvc.Add ("id1", "mono");
-                       Assert.IsFalse (it.LoadPost (null, nvc), "LoadPostData");
+                       Assert.IsTrue (it.LoadPost (null, nvc), "LoadPostData");
                        Assert.AreEqual (String.Empty, it.Value, "Value");
                }
 
@@ -318,7 +313,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
                        it.ID = "id1";
                        NameValueCollection nvc = new NameValueCollection ();
                        nvc.Add ("id1", "mono");
-                       Assert.IsFalse (it.LoadPost ("id2", nvc), "LoadPostData");
+                       Assert.IsTrue (it.LoadPost ("id2", nvc), "LoadPostData");
                        Assert.AreEqual (String.Empty, it.Value, "Value");
                }
 
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlLinkCas.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlLinkCas.cs
new file mode 100644 (file)
index 0000000..ec4314d
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// HtmlLinkCas.cs 
+//     - CAS unit tests for System.Web.UI.HtmlControls.HtmlLink
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web.UI.HtmlControls;
+
+using MonoTests.System.Web.UI.HtmlControls;
+
+namespace MonoCasTests.System.Web.UI.HtmlControls {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HtmlLinkCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlLinkTest unit = new HtmlLinkTest ();
+                       unit.Defaults ();
+                       unit.Setters ();
+                       unit.Render ();
+                       unit.Render_EmptyHref ();
+               }
+
+               public override Type Type {
+                       get { return typeof (HtmlLink); }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlLinkTest.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlLinkTest.cs
new file mode 100644 (file)
index 0000000..120ac68
--- /dev/null
@@ -0,0 +1,87 @@
+//
+// HtmlLinkTest.cs - unit tests for System.Web.UI.HtmlControls.HtmlLink
+//
+// Author:
+//     Chris Toshok <toshok@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+
+namespace MonoTests.System.Web.UI.HtmlControls {
+
+       public class HtmlLinkPoker : HtmlLink {
+               public string Render ()
+               {
+                       HtmlTextWriter writer = new HtmlTextWriter (new StringWriter ());
+                       base.Render (writer);
+                       return writer.InnerWriter.ToString ();
+               }
+       }
+
+       [TestFixture]
+       public class HtmlLinkTest {
+               
+               [Test]
+               public void Defaults ()
+               {
+                       HtmlLinkPoker link = new HtmlLinkPoker ();
+
+                       Assert.AreEqual ("", link.Href, "A1");
+                       Assert.AreEqual (0, link.Attributes.Count, "A2");
+               }
+
+               [Test]
+               public void Setters ()
+               {
+                       HtmlLinkPoker link = new HtmlLinkPoker ();
+                       link.Href = "http://www.ximian.com/";
+                       Assert.AreEqual ("http://www.ximian.com/", link.Href, "A1");
+                       Assert.AreEqual (1, link.Attributes.Count, "A2");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       HtmlLinkPoker link = new HtmlLinkPoker ();
+                       link.Href = "http://www.ximian.com/";
+                       Assert.AreEqual ("<link href=\"http://www.ximian.com/\" />", link.Render(), "A1");
+               }
+
+               [Test]
+               public void Render_EmptyHref ()
+               {
+                       HtmlLinkPoker link = new HtmlLinkPoker ();
+                       Assert.AreEqual ("<link />", link.Render(), "A1");
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlMetaCas.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlMetaCas.cs
new file mode 100644 (file)
index 0000000..2f499e4
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// HtmlMetaCas.cs 
+//     - CAS unit tests for System.Web.UI.HtmlControls.HtmlMeta
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web.UI.HtmlControls;
+
+using MonoTests.System.Web.UI.HtmlControls;
+
+namespace MonoCasTests.System.Web.UI.HtmlControls {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HtmlMetaCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlMetaTest unit = new HtmlMetaTest ();
+                       unit.Defaults ();
+                       unit.Setters ();
+                       unit.Render ();
+                       unit.Render_Empty ();
+               }
+
+               public override Type Type {
+                       get { return typeof (HtmlMeta); }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlMetaTest.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlMetaTest.cs
new file mode 100644 (file)
index 0000000..f6d6c92
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// HtmlMetaTest.cs - unit tests for System.Web.UI.HtmlControls.HtmlMeta
+//
+// Author:
+//     Chris Toshok <toshok@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+
+namespace MonoTests.System.Web.UI.HtmlControls {
+
+       public class HtmlMetaPoker : HtmlMeta {
+               public string Render ()
+               {
+                       HtmlTextWriter writer = new HtmlTextWriter (new StringWriter ());
+                       base.Render (writer);
+                       return writer.InnerWriter.ToString ();
+               }
+       }
+
+       [TestFixture]
+       public class HtmlMetaTest {
+               
+               [Test]
+               public void Defaults ()
+               {
+                       HtmlMetaPoker meta = new HtmlMetaPoker ();
+
+                       Assert.AreEqual ("", meta.Content, "A1");
+                       Assert.AreEqual ("", meta.HttpEquiv, "A2");
+                       Assert.AreEqual ("", meta.Name, "A3");
+                       Assert.AreEqual ("", meta.Scheme, "A4");
+                       Assert.AreEqual (0, meta.Attributes.Count, "A5");
+               }
+
+               [Test]
+               public void Setters ()
+               {
+                       HtmlMetaPoker meta = new HtmlMetaPoker ();
+
+                       meta.Name = "Name";
+                       meta.Content = "Content";
+                       meta.HttpEquiv = "Equiv";
+                       meta.Scheme = "Scheme";
+
+                       Assert.AreEqual ("Name", meta.Name, "A1");
+                       Assert.AreEqual ("Content", meta.Content, "A2");
+                       Assert.AreEqual ("Equiv", meta.HttpEquiv, "A3");
+                       Assert.AreEqual ("Scheme", meta.Scheme, "A4");
+
+                       Assert.AreEqual (4, meta.Attributes.Count, "A2");
+               }
+
+               [Test]
+               public void Render ()
+               {
+                       HtmlMetaPoker meta = new HtmlMetaPoker ();
+                       meta.Name = "Name";
+                       meta.Content = "Content";
+                       meta.HttpEquiv = "Equiv";
+                       meta.Scheme = "Scheme";
+                       Assert.AreEqual ("<meta name=\"Name\" content=\"Content\" http-equiv=\"Equiv\" scheme=\"Scheme\" />", meta.Render(), "A1");
+               }
+
+               [Test]
+               public void Render_Empty ()
+               {
+                       HtmlMetaPoker meta = new HtmlMetaPoker ();
+                       Assert.AreEqual ("<meta />", meta.Render(), "A1");
+               }
+       }
+}
+
+#endif
index be4dfcbd1f8876bf3ee3b3d13327308f0ec3fab7..a12fc984a4b5ba9a1494c0bc1ccedf7f57a5c351 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlSelectCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlSelectTest unit = new HtmlSelectTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.SourceType ();
+                       unit.ViewStateCount ();
+                       unit.InternalDetails ();
+                       unit.Multiple ();
+                       unit.Big ();
+                       unit.OneRowIndividual ();
+                       unit.RenderAttributes ();
+                       unit.DataBind1 ();
+                       unit.DataBind2 ();
+                       unit.DataBind3 ();
+                       unit.DataBindDoubleCall ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlSelect); }
                }
index fe27a93dee3d75c55ef7f009d77198c5b07e5554..7ff0b74401be3f6a105860c1f14762b2f523c4a3 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlTableCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlTableTest unit = new HtmlTableTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.EmptyProperties ();
+                       unit.CleanProperties ();
+                       unit.MaxInt32 ();
+                       unit.MinInt32 ();
+                       unit.WrongTypeInt ();
+                       unit.Render_Table_Simple ();
+                       unit.Render_Table ();
+                       unit.Render_TableRow_Simple ();
+                       unit.Render_TableRow ();
+                       unit.Render_TableRowCell_Simple ();
+                       unit.Render_TableRowCell ();
+                       unit.HtmlTableRowControlCollectionAdd ();
+                       unit.HtmlTableRowControlCollectionAddAt ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlTable); }
                }
index f239056a348833bbd5cfeb660b7cafd88dde6b2e..d9205be126bd34a971fe587278648b2e0107713c 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlTableCellCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlTableCellTest unit = new HtmlTableCellTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.EmptyProperties ();
+                       unit.CleanProperties ();
+                       unit.Render ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlTableCell); }
                }
index a72a034e24f6ddb3b4580a66bcf7a839ecf2418a..306963fbec7863f04c28790efae5a4863fd224a8 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Security.Permissions;
 using System.Web.UI.HtmlControls;
 
+using MonoTests.System.Web.UI.HtmlControls;
+
 namespace MonoCasTests.System.Web.UI.HtmlControls {
 
        [TestFixture]
        [Category ("CAS")]
        public class HtmlTableRowCas : AspNetHostingMinimal {
 
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlTableRowTest unit = new HtmlTableRowTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.CleanProperties ();
+                       unit.Render ();
+                       unit.HtmlTableCellControlCollectionAdd ();
+                       unit.HtmlTableCellControlCollectionAddAt ();
+               }
+
                public override Type Type {
                        get { return typeof (HtmlTableRow); }
                }
index ada247e1b376a3d7241c323a378c501df66afbb9..97379579e6b2a3a2948a4f95f7775024e6b63f99 100644 (file)
@@ -106,7 +106,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
 
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
-               public void InnerHtml ()
+               public void InnerHtml_Get ()
                {
                        HtmlTableRow r = new HtmlTableRow ();
                        Assert.IsNotNull (r.InnerHtml);
@@ -114,12 +114,28 @@ namespace MonoTests.System.Web.UI.HtmlControls {
 
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
-               public void InnerText ()
+               public void InnerHtml_Set ()
+               {
+                       HtmlTableRow r = new HtmlTableRow ();
+                       r.InnerHtml = String.Empty;
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void InnerText_Get ()
                {
                        HtmlTableRow r = new HtmlTableRow ();
                        Assert.IsNotNull (r.InnerText);
                }
 
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void InnerText_Set ()
+               {
+                       HtmlTableRow r = new HtmlTableRow ();
+                       r.InnerText = String.Empty;
+               }
+
                private string AdjustLineEndings (string s)
                {
                        return s.Replace ("\r\n", Environment.NewLine);
index 827570f9ed7eb2361ecb27a149cc71a66b404bd1..87bb861949511b7cd0cbac9a8161339f5168b0cb 100644 (file)
@@ -172,7 +172,7 @@ namespace MonoTests.System.Web.UI.HtmlControls {
 
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
-               public void InnerHtml ()
+               public void InnerHtml_Get ()
                {
                        HtmlTable t = new HtmlTable ();
                        Assert.IsNotNull (t.InnerHtml);
@@ -180,12 +180,28 @@ namespace MonoTests.System.Web.UI.HtmlControls {
 
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
-               public void InnerText ()
+               public void InnerHtml_Set ()
+               {
+                       HtmlTable t = new HtmlTable ();
+                       t.InnerHtml = String.Empty;
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void InnerText_Get ()
                {
                        HtmlTable t = new HtmlTable ();
                        Assert.IsNotNull (t.InnerText);
                }
 
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void InnerText_Set ()
+               {
+                       HtmlTable t = new HtmlTable ();
+                       t.InnerText = String.Empty;
+               }
+
                private string AdjustLineEndings (string s)
                {
                        return s.Replace ("\r\n", Environment.NewLine);
diff --git a/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTextAreaCas.cs b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTextAreaCas.cs
new file mode 100644 (file)
index 0000000..1e7ff8a
--- /dev/null
@@ -0,0 +1,70 @@
+//
+// HtmlTextAreaCas.cs 
+//     - CAS unit tests for System.Web.UI.HtmlControls.HtmlTextArea
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web.UI.HtmlControls;
+
+using MonoTests.System.Web.UI.HtmlControls;
+
+namespace MonoCasTests.System.Web.UI.HtmlControls {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HtmlTextAreaCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HtmlTextAreaTest unit = new HtmlTextAreaTest ();
+                       unit.DefaultProperties ();
+                       unit.NullProperties ();
+                       unit.CleanProperties ();
+                       unit.Name ();
+                       unit.Value ();
+                       unit.RenderAttributes ();
+                       unit.Render ();
+                       unit.AddParsedSubObject_LiteralControl ();
+                       unit.AddParsedSubObject_DataBoundLiteralControl ();
+                       unit.IPostBackDataHandler_RaisePostBackEvent ();
+                       unit.IPostBackDataHandler_LoadPostData ();
+#if NET_2_0
+                       unit.RaisePostBackEvent ();
+                       unit.LoadPostData ();
+#endif
+               }
+
+               public override Type Type {
+                       get { return typeof (HtmlTextArea); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/BaseDataBoundControlTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/BaseDataBoundControlTest.cs
new file mode 100644 (file)
index 0000000..05df5ff
--- /dev/null
@@ -0,0 +1,103 @@
+//
+// Tests for System.Web.UI.WebControls.BaseDataBoundControl.cs 
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+       [TestFixture]   
+       public class BaseDataBoundControlTest { 
+               class Poker : BaseDataBoundControl {
+                       public Poker () {
+                               TrackViewState ();
+                       }
+
+                       public object SaveState () {
+                               return SaveViewState ();
+                       }
+
+                       public void LoadState (object state) {
+                               LoadViewState (state);
+                       }
+
+                       protected override void PerformSelect () 
+                       {
+                               Console.WriteLine ("PerformSelect\n{0}", Environment.StackTrace);
+                       }
+
+                       protected override void ValidateDataSource (object dataSource)
+                       {
+                               Console.WriteLine ("PerformSelect\n{0}", Environment.StackTrace);
+                       }
+
+                       public bool GetIsBoundUsingDataSourceID ()
+                       {
+                               return IsBoundUsingDataSourceID;
+                       }
+
+                       public bool GetInitialized ()
+                       {
+                               return Initialized;
+                       }
+               }
+               
+               [Test]
+               public void Defaults ()
+               {
+                       Poker p = new Poker ();
+
+                       Assert.IsNull (p.DataSource, "A1");
+                       Assert.AreEqual ("", p.DataSourceID, "A2");
+                       Assert.IsFalse (p.GetIsBoundUsingDataSourceID(), "A3");
+                       Assert.IsFalse (p.GetInitialized(), "A4");
+               }
+
+               [Test]
+               public void ViewState ()
+               {
+                       Poker p = new Poker ();
+                       Poker copy = new Poker ();
+
+                       p.DataSourceID = "hi";
+                       object state = p.SaveState ();
+                       copy.LoadState (state);
+
+                       Assert.AreEqual ("hi", copy.DataSourceID, "A1");
+               }
+       }
+}
+#endif
index b6e7ccb014801c2bc8431d77c4a848c16d1553f8..1aca8763223aedf1819a6d3bf98199061052a300 100644 (file)
@@ -600,7 +600,8 @@ namespace MonoTests.System.Web.UI.WebControls
                        PokerCalendar p = new PokerCalendar ();
                        p.TodaysDate = new DateTime (2005, 8, 4);
                        p.SelectedDate = p.TodaysDate;
-                       Assert.IsTrue (p.Render ().IndexOf ("color:White;background-color:Silver;")  != -1);
+                       string s = p.Render();
+                       Assert.IsTrue (s.IndexOf ("color:White") != 1 && s.IndexOf ("background-color:Silver") != -1, "A1");
                }
        }
 }
index 268c9b09ab6590564db64c62f8506a602810b215..da1ceec997533ca36d6a801d3080a8bc51aef13a 100644 (file)
@@ -1,3 +1,51 @@
+2005-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * DataGridTest.cs: fix expected/actual order. Added test for HeaderText
+       and empty ArrayList.
+
+2005-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TableCellTest.cs: TableCell does not get an automatic ID.
+
+2005-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TableStyleTest.cs: added test to check that GridLines is correctly
+       restored in LoadViewState.
+
+2005-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TableCellTest.cs: added new test cases for bug #76078.
+
+2005-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * ListItemTest.cs: tests for ListItem.
+       * RadioButtonListTest.cs: more test for load/raise.
+
+2005-09-09  Chris Toshok  <toshok@ximian.com>
+
+       * StyleTest.cs (FontInfo_Empty): test to see if changes to
+       Style.Font cause changes in the style's empty status.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * CalendarTest.cs (TestSelectedColorDefault): we need to split up
+       the color tests since they're rendered in different orders by
+       ms/us.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * ListControlTest.cs: add tests for the ControlState.
+
+2005-09-05  Chris Toshok  <toshok@ximian.com>
+
+       * FormViewTest.cs: new tests.
+
+2005-09-05  Chris Toshok  <toshok@ximian.com>
+
+       * DataBoundControlTest.cs: new tests.
+
+       * BaseDataBoundControlTest.cs: new tests.
+
 2005-09-01  Chris Toshok  <toshok@ximian.com>
 
        * ListControlTest.cs (DefaultProperties): add tests for TagKey,
diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/DataBoundControlTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/DataBoundControlTest.cs
new file mode 100644 (file)
index 0000000..fd2041d
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// Tests for System.Web.UI.WebControls.DataBoundControl.cs 
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+       [TestFixture]   
+       public class DataBoundControlTest {     
+               class Poker : DataBoundControl {
+                       protected override void PerformSelect () 
+                       {
+                               Console.WriteLine ("PerformSelect\n{0}", Environment.StackTrace);
+                       }
+               }
+               
+               [Test]
+               public void Defaults ()
+               {
+                       Poker p = new Poker ();
+                       Assert.AreEqual ("", p.DataMember, "A1");
+                       Assert.AreEqual ("", p.DataSourceID, "A2");
+               }
+       }
+}
+#endif
index 8ed5df7ea8473680f6987d8e5ea569db09c106c5..a244d22799aecb0de2ce69cfbc64cc815e986fd2 100644 (file)
@@ -1093,26 +1093,31 @@ namespace MonoTests.System.Web.UI.WebControls {
 
                        source.DataSource = list;
                        columns = p.CreateColumns (source, true);
-                       Assert.AreEqual (columns.Count, 1, "A1");
-                       Assert.AreEqual (((DataGridColumn) columns [0]).HeaderText, "Item", "A2");
+                       Assert.AreEqual (1, columns.Count, "A1");
+                       Assert.AreEqual ("Item", ((DataGridColumn) columns [0]).HeaderText, "A2");
 
                        AmazingEnumerable amazing = new AmazingEnumerable (list);
 
                        source.DataSource = amazing;
                        columns = p.CreateColumns (source, true);
-                       Assert.AreEqual (columns.Count, 1, "A3");
+                       Assert.AreEqual (1, columns.Count, "A3");
 
                        BoundColumn one = (BoundColumn) columns [0];
 
-                       Assert.AreEqual (one.HeaderText, "Item", "A4");
+                       Assert.AreEqual ("Item", one.HeaderText, "A4");
 
                        // I guess this makes it bind to itself ?
-                       Assert.AreEqual (one.DataField, BoundColumn.thisExpr, "A5"); 
+                       Assert.AreEqual (BoundColumn.thisExpr, one.DataField, "A5"); 
 
-                       Assert.AreEqual (one.DataFormatString, String.Empty, "A6");
-                       Assert.AreEqual (one.SortExpression, "Item", "A7");
-                       Assert.AreEqual (one.HeaderImageUrl, String.Empty, "A8");
-                       Assert.AreEqual (one.FooterText, String.Empty, "A9");
+                       Assert.AreEqual (String.Empty, one.DataFormatString, "A6");
+                       Assert.AreEqual ("Item", one.SortExpression, "A7");
+                       Assert.AreEqual (String.Empty, one.HeaderImageUrl, "A8");
+                       Assert.AreEqual (String.Empty, one.FooterText, "A9");
+                       Assert.AreEqual ("Item", one.HeaderText, "A10");
+
+                       source.DataSource = new ArrayList ();
+                       columns = p.CreateColumns (source, true);
+                       Assert.AreEqual (0, columns.Count, "A11");
                }
 
                [Test]
diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs
new file mode 100644 (file)
index 0000000..0950f3e
--- /dev/null
@@ -0,0 +1,113 @@
+//
+// Tests for System.Web.UI.WebControls.FormView.cs 
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+       [TestFixture]   
+       public class FormViewTest {     
+               class Poker : FormView {
+                       public Poker () {
+                               TrackViewState ();
+                       }
+
+                       public object SaveState () {
+                               return SaveViewState ();
+                       }
+
+                       public void LoadState (object state) {
+                               LoadViewState (state);
+                       }
+               }
+               
+               [Test]
+               public void Defaults ()
+               {
+                       Poker p = new Poker ();
+
+                       Assert.IsFalse (p.AllowPaging, "A1");
+                       Assert.AreEqual ("", p.BackImageUrl, "A2");
+                       Assert.IsNull (p.BottomPagerRow, "A3");
+                       Assert.AreEqual ("", p.Caption, "A4");
+                       Assert.AreEqual (TableCaptionAlign.NotSet, p.CaptionAlign ,"A5");
+                       Assert.AreEqual (-1, p.CellPadding, "A6");
+                       Assert.AreEqual (0, p.CellSpacing, "A7");
+                       Assert.AreEqual (FormViewMode.ReadOnly, p.CurrentMode, "A8");
+                       Assert.AreEqual (FormViewMode.ReadOnly, p.DefaultMode, "A9");
+                       Assert.IsNotNull (p.DataKeyNames, "A10");
+                       Assert.AreEqual (0, p.DataKeyNames.Length, "A10.1");
+                       Assert.IsNotNull (p.DataKey, "A11");
+                       Assert.AreEqual (0, p.DataKey.Values.Count, "A11.1");
+                       Assert.IsNull (p.EditItemTemplate, "A12");
+                       Assert.IsNotNull (p.EditRowStyle, "A13");
+                       Assert.IsTrue (Style.IsStyleEmpty (p.EditRowStyle), "A13.1");
+                       Assert.IsNotNull (p.EmptyDataRowStyle, "A14");
+                       Assert.IsTrue (Style.IsStyleEmpty (p.EmptyDataRowStyle), "A14.1");
+                       Assert.IsNull (p.EmptyDataTemplate, "A15");
+                       Assert.AreEqual ("", p.EmptyDataText, "A16");
+                       Assert.IsNull (p.FooterRow, "A17");
+                       Assert.IsNull (p.FooterTemplate, "A18");
+                       Assert.AreEqual ("", p.FooterText, "A19");
+                       Assert.IsNotNull (p.FooterStyle, "A20");
+                       Assert.IsTrue (Style.IsStyleEmpty (p.FooterStyle), "A20.1");
+                       Assert.AreEqual (GridLines.None, p.GridLines, "A21");
+                       Assert.IsNull (p.HeaderRow, "A22");
+                       Assert.IsNotNull (p.HeaderStyle, "A23");
+                       Assert.IsTrue (Style.IsStyleEmpty (p.HeaderStyle), "A23.1");
+                       Assert.IsNull (p.HeaderTemplate, "A24");
+                       Assert.AreEqual ("", p.HeaderText, "A25");
+                       Assert.AreEqual (HorizontalAlign.NotSet, p.HorizontalAlign, "A26");
+                       Assert.IsNull (p.InsertItemTemplate, "A27");
+                       Assert.IsNotNull (p.InsertRowStyle, "A28");
+                       Assert.IsTrue (Style.IsStyleEmpty (p.InsertRowStyle), "A28.1");
+                       Assert.IsNull (p.ItemTemplate, "A29");
+                       Assert.AreEqual (0, p.PageCount, "A30");
+                       Assert.AreEqual (0, p.PageIndex, "A31");
+                       Assert.IsNull (p.PagerTemplate, "A32");
+                       Assert.IsNull (p.Row, "A33");
+                       Assert.IsNotNull (p.RowStyle, "A34");
+                       Assert.IsTrue (Style.IsStyleEmpty (p.RowStyle), "A34.1");
+                       Assert.IsNull (p.SelectedValue, "A35");
+                       Assert.IsNull (p.TopPagerRow, "A36");
+                       Assert.IsNull (p.DataItem, "A37");
+                       Assert.AreEqual (0, p.DataItemCount, "A38");
+                       Assert.AreEqual (0, p.DataItemIndex, "A39");
+               }
+       }
+}
+#endif
index 3b814408c2f69c85b52c682070adeb60b09abd1a..adef1a989f6eef5b23c12efb6a361f373f504bc2 100644 (file)
@@ -66,6 +66,17 @@ namespace MonoTests.System.Web.UI.WebControls {
                        return ViewState [name];
                }
 
+#if NET_2_0
+               public void LoadControl (object state)
+               {
+                       LoadControlState (state);
+               }
+
+               public object SaveControl ()
+               {
+                       return SaveControlState ();
+               }
+#endif
                public string Render ()
                {
                        StringWriter sw = new StringWriter ();
@@ -195,6 +206,32 @@ namespace MonoTests.System.Web.UI.WebControls {
                        Assert.AreEqual (p.Items.Count, 2, "A9");
                }
 
+#if NET_2_0
+               [Test]
+               // Tests Save/Load ControlState
+               public void ControlState ()
+               {
+                       ListControlPoker a = new ListControlPoker ();
+                       ListControlPoker b = new ListControlPoker ();
+
+                       a.TrackState ();
+
+                       a.Items.Add ("a");
+                       a.Items.Add ("b");
+                       a.Items.Add ("c");
+                       a.SelectedIndex = 2;
+
+                       b.Items.Add ("a");
+                       b.Items.Add ("b");
+                       b.Items.Add ("c");
+
+                       object state = a.SaveControl();
+                       b.LoadControl (state);
+
+                       Assert.AreEqual (b.SelectedIndex, 2, "A1");
+               }
+#endif
+
                [Test]
                // Tests Save/Load/Track ViewState
                public void ViewState ()
diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/ListItemTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/ListItemTest.cs
new file mode 100644 (file)
index 0000000..df2e2dd
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// Tests for System.Web.UI.WebControls.ListItemTest.cs 
+//
+// Author:
+//     Gonzalo Paniagua Javier (gonzalo@novell.com)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+       [TestFixture]   
+       public class ListItemTest 
+       {
+               [Test]
+               public void Defaults ()
+               {
+                       ListItem li = new ListItem ();
+                       Assert.AreEqual ("", li.Text, "#01");
+                       Assert.AreEqual ("", li.Value, "#02");
+                       Assert.AreEqual (false, li.Selected, "#03");
+               }
+
+               [Test]
+               public void Defaults2 ()
+               {
+                       ListItem li = new ListItem ("something");
+                       Assert.AreEqual ("something", li.Text, "#01");
+                       Assert.AreEqual ("something", li.Value, "#02");
+                       Assert.AreEqual (false, li.Selected, "#03");
+               }
+
+               [Test]
+               public void Defaults3 ()
+               {
+                       ListItem li = new ListItem ("something", "else");
+                       Assert.AreEqual ("something", li.Text, "#01");
+                       Assert.AreEqual ("else", li.Value, "#02");
+                       Assert.AreEqual (false, li.Selected, "#03");
+               }
+
+               [Test]
+               [ExpectedException (typeof (HttpException))]
+               public void AllowedChildren ()
+               {
+                       IParserAccessor li = new ListItem ("something", "else");
+                       li.AddParsedSubObject ("hola");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void AllowedChildren2 ()
+               {
+                       IParserAccessor li = new ListItem ("something", "else");
+                       li.AddParsedSubObject (null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (HttpException))]
+               public void AllowedChildren3 ()
+               {
+                       IParserAccessor li = new ListItem ("something", "else");
+                       li.AddParsedSubObject (new CheckBox ());
+               }
+
+               [Test]
+               public void AllowedChildren4 ()
+               {
+                       ListItem li = new ListItem ("something", "else");
+                       IParserAccessor parser = (ListItem) li;
+                       parser.AddParsedSubObject (new LiteralControl ("Hola"));
+                       Assert.AreEqual ("Hola", li.Text, "#01");
+                       Assert.AreEqual ("else", li.Value, "#02");
+               }
+       }
+}
+
index 88c3027d3d2e10a031c3ad8c3bbf66ba862724ed..85d6ed2457a6f7b93c03f863ab454bd8e24082fe 100644 (file)
@@ -1,12 +1,13 @@
 //
 // Tests for System.Web.UI.WebControls.RadioButtonListTest.cs
 //
-// Author:
+// Authors:
 //     Jordi Mas i Hernandez (jordi@ximian.com)
-//
-
+//     Gonzalo Paniagua Javier (gonzalo@novell.com)
 //
 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -31,6 +32,7 @@
 using System.Web.UI.WebControls;
 using NUnit.Framework;
 using System;
+using System.Collections.Specialized;
 using System.Drawing;
 using System.IO;
 using System.Web;
@@ -134,7 +136,67 @@ namespace MonoTests.System.Web.UI.WebControls {
                        r.RepeatLayout = (RepeatLayout) 3;
                }
 
+               bool event_called;
+               void OnSelected (object sender, EventArgs args)
+               {
+                       event_called = true;
+               }
 
-       }
+               [Test]
+               public void LoadAndRaise1 ()
+               {
+                       RadioButtonList rbl = new RadioButtonList ();
+                       rbl.Items.Add (new ListItem ("Uno", "1"));
+                       rbl.Items.Add (new ListItem ("Dos", "2"));
+                       rbl.Items.Add (new ListItem ("Tres", "3"));
+                       rbl.SelectedIndex = 2;
+                       NameValueCollection nvc = new NameValueCollection ();
+                       nvc ["XXX"] = "3";
+
+                       IPostBackDataHandler handler = (IPostBackDataHandler) rbl;
+                       Assert.AreEqual (true, handler.LoadPostData ("XXX", nvc), "#01");
+                       rbl.SelectedIndexChanged += new EventHandler (OnSelected);
+                       event_called = false;
+                       handler.RaisePostDataChangedEvent ();
+                       // Not called. Value is the same as the selected previously
+                       Assert.AreEqual (false, event_called, "#02");
+                       Assert.AreEqual ("3", rbl.SelectedValue, "#03");
+               }
 
+               [Test]
+               public void LoadAndRaise2 ()
+               {
+                       RadioButtonList rbl = new RadioButtonList ();
+                       rbl.Items.Add (new ListItem ("Uno", "1"));
+                       rbl.Items.Add (new ListItem ("Dos", "2"));
+                       rbl.Items.Add (new ListItem ("Tres", "3"));
+                       rbl.SelectedIndex = 2;
+                       NameValueCollection nvc = new NameValueCollection ();
+                       nvc ["XXX"] = "2";
+
+                       IPostBackDataHandler handler = (IPostBackDataHandler) rbl;
+                       Assert.AreEqual (true, handler.LoadPostData ("XXX", nvc), "#01");
+                       rbl.SelectedIndexChanged += new EventHandler (OnSelected);
+                       event_called = false;
+                       handler.RaisePostDataChangedEvent ();
+                       Assert.AreEqual (true, event_called, "#02");
+                       Assert.AreEqual ("2", rbl.SelectedValue, "#03");
+               }
+
+               [Test]
+               public void LoadAndRaise3 ()
+               {
+                       RadioButtonList rbl = new RadioButtonList ();
+                       rbl.Items.Add (new ListItem ("Uno", "1"));
+                       rbl.Items.Add (new ListItem ("Dos", "2"));
+                       rbl.Items.Add (new ListItem ("Tres", "3"));
+                       rbl.SelectedIndex = 2;
+                       NameValueCollection nvc = new NameValueCollection ();
+                       nvc ["XXX"] = "blah";
+
+                       IPostBackDataHandler handler = (IPostBackDataHandler) rbl;
+                       Assert.AreEqual (false, handler.LoadPostData ("XXX", nvc), "#01");
+               }
+       }
 }
+
index 667d94d6795e3d8588154d823a25156f961aa6a9..69d780eafea1dfeefb4e896787ca5774cd8f3fb5 100644 (file)
@@ -430,6 +430,17 @@ namespace MonoTests.System.Web.UI.WebControls
                        Assert.AreEqual (1, s.StateBag.Count, "Count");
                }
 
+               [Test]
+               public void FontInfo_Empty ()
+               {
+                       FontInfo f;
+                       StyleTestClass s = new StyleTestClass ();
+                       f = s.Font;
+                       Assert.IsTrue (s.Empty, "Empty after getter");
+                       s.Font.Name = "Arial";
+                       Assert.IsFalse (s.Empty, "No longer empty");
+               }
+
                public void Render ()
                {
                        HtmlTextWriter  writer;
index 49635fbd6fd6081d114309dec9aceac69361b1e5..1c52b84fdd6160b48c25ce07213b9cb4dfa1afb4 100644 (file)
@@ -271,6 +271,46 @@ namespace MonoTests.System.Web.UI.WebControls {
                        Assert.AreEqual ("Go Mono", td.Text, "Text-2");
                }
 
+               [Test]
+               public void Add_LiteralControl_Literal_And_Literal ()
+               {
+                       TestTableCell td = new TestTableCell ();
+                       // this is moved into the (empty) Text property
+                       td.Add (new LiteralControl ("Mono"));
+                       Assert.IsFalse (td.HasControls (), "!HasControls");
+                       Assert.AreEqual ("Mono", td.Text, "Text");
+                       td.Add (new LiteralControl ("Mono2"));
+                       Assert.IsFalse (td.HasControls (), "HasControls-2");
+                       Assert.AreEqual ("Mono2", td.Text, "Text");
+                       Assert.AreEqual (0, td.Controls.Count, "NControls");
+               }
+
+               [Test]
+               public void Add_LiteralControl_Control_And_Literal ()
+               {
+                       TestTableCell td = new TestTableCell ();
+                       // this is moved into the (empty) Text property
+                       td.Add (new TableCell ());
+                       Assert.IsTrue (td.HasControls (), "HasControls");
+                       td.Add (new LiteralControl ("Mono2"));
+                       Assert.AreEqual (2, td.Controls.Count, "NControls");
+                       Assert.AreEqual (typeof (TableCell), td.Controls [0].GetType (), "type 1");
+                       Assert.AreEqual (typeof (LiteralControl), td.Controls [1].GetType (), "type 2");
+               }
+
+               [Test]
+               public void Add_LiteralControl_Literal_And_Control ()
+               {
+                       TestTableCell td = new TestTableCell ();
+                       // this is moved into the (empty) Text property
+                       td.Add (new LiteralControl ("Mono2"));
+                       Assert.IsFalse (td.HasControls (), "HasControls");
+                       td.Add (new TableCell ());
+                       Assert.AreEqual (2, td.Controls.Count, "NControls");
+                       Assert.AreEqual (typeof (LiteralControl), td.Controls [0].GetType (), "type 1");
+                       Assert.AreEqual (typeof (TableCell), td.Controls [1].GetType (), "type 2");
+               }
+
                [Test]
                public void HasControls_Text ()
                {
@@ -300,5 +340,15 @@ namespace MonoTests.System.Web.UI.WebControls {
                        // and removed from property
                        Assert.AreEqual (String.Empty, td.Text, "Test-2");
                }
+
+               [Test]
+               public void NoDefaultID ()
+               {
+                       Page page = new Page ();
+                       TableCell tc = new TableCell ();
+                       Assert.AreEqual (null, tc.ID, "#01");
+                       page.Controls.Add (tc);
+                       Assert.AreEqual (null, tc.ID, "#02");
+               }
        }
 }
index 730d53c19b6f8840773bd2430e6c73322009f4d9..88aa70b33be84c4f9bacb76dd6b2f953fb593f19 100644 (file)
@@ -56,6 +56,21 @@ namespace MonoTests.System.Web.UI.WebControls {
                public StateBag StateBag {
                        get { return base.ViewState; }
                }
+
+               public void LoadVS (object o)
+               {
+                       LoadViewState (o);
+               }
+
+               public void TrackVS ()
+               {
+                       TrackViewState ();
+               }
+
+               public object SaveVS ()
+               {
+                       return SaveViewState ();
+               }
 #if NET_2_0
                public void Fill (CssStyleCollection attributes, IUrlResolutionService urlResolver)
                {
@@ -327,6 +342,18 @@ namespace MonoTests.System.Web.UI.WebControls {
                        Assert.AreEqual (GridLines.Horizontal, ts.GridLines, "GridLines");
                        Assert.AreEqual (HorizontalAlign.Left, ts.HorizontalAlign, "HorizontalAlign");
                }
+
+               [Test]
+               public void GridLines_VS ()
+               {
+                       TestTableStyle ts = new TestTableStyle ();
+                       ts.TrackVS ();
+                       ts.GridLines = GridLines.Both;
+                       object o = ts.SaveVS ();
+                       ts = new TestTableStyle ();
+                       ts.LoadVS (o);
+                       Assert.AreEqual (GridLines.Both, ts.GridLines, "GL");
+               }
 #if NET_2_0
                private CssStyleCollection GetCssCollection ()
                {
diff --git a/mcs/class/System.Web/Test/System.Web.UI/AttributeCollectionCas.cs b/mcs/class/System.Web/Test/System.Web.UI/AttributeCollectionCas.cs
new file mode 100644 (file)
index 0000000..e7df8e8
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// AttributeCollectionCas.cs 
+//     - CAS unit tests for System.Web.UI.AttributeCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class AttributeCollectionCas : AspNetHostingMinimal {
+
+               private StateBag bag;
+               private HtmlTextWriter writer;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       bag = new StateBag ();
+                       writer = new HtmlTextWriter (new StringWriter ());
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       // nothing else is required
+                       AttributeCollection ac = new AttributeCollection (bag);
+
+                       Assert.AreEqual (0, ac.Count, "Count");
+                       Assert.IsNotNull (ac.CssStyle, "CssStyle");
+                       ac["mono"] = "monkey";
+                       Assert.AreEqual ("monkey", ac["mono"], "this");
+                       Assert.IsNotNull (ac.Keys, "Keys");
+
+                       ac.Add ("monkey", "mono");
+                       ac.AddAttributes (writer);
+                       ac.Clear ();
+                       ac.Remove ("mono");
+                       ac.Render (writer);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (StateBag) });
+                       Assert.IsNotNull (ci, ".ctor(StateBag)");
+                       return ci.Invoke (new object[1] { bag });
+               }
+
+               public override Type Type {
+                       get { return typeof (AttributeCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/BaseParserCas.cs b/mcs/class/System.Web/Test/System.Web.UI/BaseParserCas.cs
new file mode 100644 (file)
index 0000000..990e849
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// BaseParserCas.cs - CAS unit tests for System.Web.UI.BaseParser
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class BaseParserCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       new BaseParser ();
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (BaseParser); }
+               }
+       }
+}
index 2e2af176adc7a088ca8cb9ba5f252c8009ba7194..554eca8c3a63d048226cfc0597b72bcd70b1b164 100644 (file)
@@ -1,3 +1,73 @@
+2005-09-20  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * TestUrlPropertyAttribute.cs: Remove references to UrlTypes (removed 
+       in 2.0 RC). Fix compilation for tests under NET_2_0.
+
+2005-09-19  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * TagPrefixAttributeCas.cs: New. CAS unit tests.
+       * TemplateBuilderCas.cs: New. CAS unit tests.
+       * TemplateContainerAttributeCas.cs: New. CAS unit tests.
+       * TemplateControlCas.cs: New. CAS unit tests.
+       * ToolboxDataAttributeCas.cs: New. CAS unit tests.
+       * TripletCas.cs: New. CAS unit tests.
+       * UserControlCas.cs: New. CAS unit tests.
+       * UserControlControlBuilderCas.cs: New. CAS unit tests.
+       * ValidationPropertyAttributeCas.cs: New. CAS unit tests.
+       * ValidatorCollectionCas.cs: New. CAS unit tests.
+
+2005-09-15  Sebastien Pouliot  <sebastien@ximian.com>
+       * ParseChildrenAttributeCas.cs: New. CAS unit tests.
+       * PartialCachingAttributeCas.cs: New. CAS unit tests.
+       * PersistChildrenAttributeCas.cs: New. CAS unit tests.
+       * PersistenceModeAttributeCas.cs: New. CAS unit tests.
+       * PropertyConverterCas.cs: New. CAS unit tests.
+       * RootBuilderCas.cs: New. CAS unit tests.
+       * StateBagCas.cs: New. CAS unit tests.
+       * StateItemCas.cs: New. CAS unit tests.
+       * StaticPartialCachingControlCas.cs: New. CAS unit tests.
+
+2005-09-15  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * Html32TextWriterCas.cs: New. CAS unit tests.
+       * HtmlTextWriterCas.cs: New. CAS unit tests.
+       * ImageClickEventArgsCas.cs: New. CAS unit tests.
+       * LiteralControlCas.cs: New. CAS unit tests.
+       * LosFormatterCas.cs: New. CAS unit tests.
+       * ObjectConverterCas.cs: New. CAS unit tests.
+       * ObjectTagBuilderCas.cs: New. CAS unit tests.
+       * PageCas.cs: New. CAS unit tests.
+       * PairCas.cs: New. CAS unit tests.
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com> 
+       * DataBinderCas.cs: New. CAS unit tests.
+       * DataBindingCas.cs: New. CAS unit tests.
+       * DataBindingCollectionCas.cs: New. CAS unit tests.
+       * DataBindingHandlerAttributeCas.cs: New. CAS unit tests.
+       * DataBoundLiteralControlCas.cs: New. CAS unit tests.
+       * DesignerDataBoundLiteralControlCas.cs: New. CAS unit tests.
+       * DesignTimeParseDataCas.cs: New. CAS unit tests.
+       * DesignTimeTemplateParserCas.cs: New. CAS unit tests.
+       * EmptyCollectionCas.cs: New. CAS unit tests.
+
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AttributeCollectionCas.cs: New. CAS unit tests.
+       * BaseParserCas.cs: New. CAS unit tests.
+       * CompiledTemplateBuilderCas.cs: New. CAS unit tests.
+       * ConstructorNeedsTagAttributeCas.cs: New. CAS unit tests.
+       * ControlBuilderAttributeCas.cs: New. CAS unit tests.
+       * ControlBuilderCas.cs: New. CAS unit tests.
+       * ControlCas.cs: New. CAS unit tests.
+       * ControlCollectionCas.cs: New. CAS unit tests.
+       * CssStyleCollectionCas.cs: New. CAS unit tests.
+
+2005-09-07  Chris Toshok  <toshok@ximian.com>
+
+       * MinimizableAttributeTypeConverterTest.cs: new test.
+
 2005-08-25  Sebastien Pouliot  <sebastien@ximian.com>
 
        * TestUrlPropertyAttribute.cs: Fixed tests to match new beta2 API (and
diff --git a/mcs/class/System.Web/Test/System.Web.UI/CompiledTemplateBuilderCas.cs b/mcs/class/System.Web/Test/System.Web.UI/CompiledTemplateBuilderCas.cs
new file mode 100644 (file)
index 0000000..6fb7b6a
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// CompiledTemplateBuilderCas.cs 
+//     - CAS unit tests for System.Web.UI.CompiledTemplateBuilder
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class CompiledTemplateBuilderCas : AspNetHostingMinimal {
+
+               private Control control;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       control = new Control ();
+               }
+
+               private void BuildTemplate (Control control)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       CompiledTemplateBuilder ctb = new CompiledTemplateBuilder (new BuildTemplateMethod (BuildTemplate));
+                       ctb.InstantiateIn (control);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (BuildTemplateMethod) });
+                       Assert.IsNotNull (ci, ".ctor(BuildTemplateMethod)");
+                       return ci.Invoke (new object[1] { new BuildTemplateMethod (BuildTemplate) });
+               }
+
+               public override Type Type {
+                       get { return typeof (CompiledTemplateBuilder); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ConstructorNeedsTagAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ConstructorNeedsTagAttributeCas.cs
new file mode 100644 (file)
index 0000000..45fb4c9
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// ConstructorNeedsTagAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.ConstructorNeedsTagAttributeCas
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ConstructorNeedsTagAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ConstructorNeedsTagAttribute a1 = new ConstructorNeedsTagAttribute ();
+                       Assert.IsFalse (a1.NeedsTag, "NeedsTag-1");
+                       ConstructorNeedsTagAttribute a2 = new ConstructorNeedsTagAttribute (true);
+                       Assert.IsTrue (a2.NeedsTag, "NeedsTag-2");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ConstructorNeedsTagAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ControlBuilderAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ControlBuilderAttributeCas.cs
new file mode 100644 (file)
index 0000000..344bb03
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// ControlBuilderAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.ControlBuilderAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ControlBuilderAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ControlBuilderAttribute attr = new ControlBuilderAttribute (null);
+                       Assert.IsNull (attr.BuilderType, "BuilderType");
+                       Assert.IsTrue (attr.Equals (ControlBuilderAttribute.Default), "Equals");
+                       attr.GetHashCode ();
+                       Assert.IsTrue (attr.IsDefaultAttribute (), "IsDefaultAttribute");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (Type) });
+                       Assert.IsNotNull (ci, ".ctor(Type)");
+                       return ci.Invoke (new object[1] { null });
+               }
+
+               public override Type Type {
+                       get { return typeof (ControlBuilderAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ControlBuilderCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ControlBuilderCas.cs
new file mode 100644 (file)
index 0000000..054e4f5
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// ControlBuilderCas.cs - CAS unit tests for System.Web.UI.ControlBuilder
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ControlBuilderCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ControlBuilder cb = new ControlBuilder ();
+                       Assert.IsNull (cb.ControlType, "ControlType");
+                       Assert.IsFalse (cb.HasAspCode, "HasAspCode");
+                       cb.ID = "mono";
+                       Assert.AreEqual ("mono", cb.ID, "ID");
+                       Assert.AreEqual (typeof (Control), cb.NamingContainerType, "NamingContainerType");
+                       Assert.IsNull (cb.TagName, "TagName");
+                       Assert.IsTrue (cb.AllowWhitespaceLiterals (), "AllowWhitespaceLiterals");
+                       cb.AppendLiteralString ("mono");
+                       cb.AppendSubBuilder (cb);
+                       cb.CloseControl ();
+                       Assert.IsNull (cb.GetChildControlType (null, null), "GetChildControlType");
+                       Assert.IsTrue (cb.HasBody (), "HasBody");
+                       Assert.IsFalse (cb.HtmlDecodeLiterals (), "HtmlDecodeLiterals");
+                       cb.Init (null, cb, typeof (TemplateBuilder), "span", "mono", null);
+                       Assert.IsFalse (cb.NeedsTagInnerText (), "NeedsTagInnerText");
+                       //cb.OnAppendToParentBuilder (null);
+                       cb.SetTagInnerText ("mono");
+
+                       cb = ControlBuilder.CreateBuilderFromType (null, cb, typeof (TemplateBuilder), "span", "mono", null, 0, String.Empty);
+                       Assert.IsNotNull (cb, "CreateBuilderFromType");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ControlBuilder); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ControlCas.cs
new file mode 100644 (file)
index 0000000..e7c0127
--- /dev/null
@@ -0,0 +1,155 @@
+//
+// ControlCas.cs - CAS unit tests for System.Web.UI.Control
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ControlCas : AspNetHostingMinimal {
+
+               private Control control;
+               private HtmlTextWriter writer;
+               private Page page;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       control = new Control ();
+                       writer = new HtmlTextWriter (new StringWriter ());
+                       page = new Page ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       Control c = new Control ();
+                       Assert.IsNull (c.ClientID, "ClientID");
+                       Assert.IsNotNull (c.Controls, "Controls");
+                       c.EnableViewState = true;
+                       Assert.IsTrue (c.EnableViewState, "EnableViewState");
+                       c.ID = "mono";
+                       Assert.AreEqual ("mono", c.ID, "ID");
+                       Assert.IsNull (c.NamingContainer, "NamingContainer");
+                       Assert.IsNull (c.Page, "Page");
+                       Assert.IsNull (c.Parent, "Parent");
+                       Assert.IsNull (c.Site, "Site");
+                       Assert.AreEqual ("mono", c.UniqueID, "UniqueID");
+                       Assert.IsTrue (c.Visible, "Visible");
+#if NET_2_0
+                       c.AppRelativeTemplateSourceDirectory = String.Empty;
+                       Assert.AreEqual (String.Empty, c.AppRelativeTemplateSourceDirectory, "AppRelativeTemplateSourceDirectory");
+                       c.EnableTheming = true;
+                       Assert.IsTrue (c.EnableTheming, "EnableTheming");
+                       c.SkinID = String.Empty;
+                       Assert.AreEqual (String.Empty, c.SkinID, "SkinID");
+                       c.TemplateControl = null;
+                       Assert.IsNull (c.TemplateControl, "TemplateControl");
+                       Assert.AreEqual (String.Empty, c.TemplateSourceDirectory, "TemplateSourceDirectory");
+#endif
+               }
+
+               private void SetRenderMethodDelegate (HtmlTextWriter writer, Control control)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       Control c = new Control ();
+
+                       c.DataBind ();
+                       Assert.IsNull (c.FindControl ("mono"), "FindControl");
+
+                       Assert.IsFalse (c.HasControls (), "HasControls");
+                       c.RenderControl (writer);
+                       Assert.IsNotNull (c.ResolveUrl (String.Empty), "ResolveUrl");
+                       c.SetRenderMethodDelegate (new RenderMethod (SetRenderMethodDelegate));
+#if NET_2_0
+                       c.ApplyStyleSheetSkin (page);
+                       Assert.IsNotNull (c.ResolveClientUrl (String.Empty), "ResolveClientUrl");
+#endif
+                       c.Dispose ();
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void Focus_Deny_Unrestricted ()
+               {
+                       Control c = new Control ();
+                       page.Controls.Add (c);
+                       c.Focus ();
+                       // normal, no forms on page
+               }
+#endif
+
+               private void Handler (object sender, EventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Events_Deny_Unrestricted ()
+               {
+                       Control c = new Control ();
+                       c.DataBinding += new EventHandler (Handler);
+                       c.Disposed += new EventHandler (Handler);
+                       c.Init += new EventHandler (Handler);
+                       c.Load += new EventHandler (Handler);
+                       c.PreRender += new EventHandler (Handler);
+                       c.Unload += new EventHandler (Handler);
+
+                       c.DataBinding -= new EventHandler (Handler);
+                       c.Disposed -= new EventHandler (Handler);
+                       c.Init -= new EventHandler (Handler);
+                       c.Load -= new EventHandler (Handler);
+                       c.PreRender -= new EventHandler (Handler);
+                       c.Unload -= new EventHandler (Handler);
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (Control); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ControlCollectionCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ControlCollectionCas.cs
new file mode 100644 (file)
index 0000000..2bd1ee1
--- /dev/null
@@ -0,0 +1,92 @@
+//
+// ControlCollectionCas.cs 
+//     - CAS unit tests for System.Web.UI.ControlCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ControlCollectionCas : AspNetHostingMinimal {
+
+               private Control control;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       control = new Control ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       // note: using the same control (as owner) to add results 
+                       // in killing the ms runtime with a stackoverflow - FDBK36722
+                       ControlCollection cc = new ControlCollection (new Control ());
+                       Assert.AreEqual (0, cc.Count, "Count");
+                       Assert.IsFalse (cc.IsReadOnly, "IsReadOnly");
+                       Assert.IsFalse (cc.IsSynchronized, "IsSynchronized");
+                       Assert.IsNotNull (cc.SyncRoot, "SyncRoot");
+
+                       cc.Add (control);
+                       Assert.IsNotNull (cc[0], "this[int]");
+                       cc.Clear ();
+                       cc.AddAt (0, control);
+                       Assert.IsTrue (cc.Contains (control), "Contains");
+
+                       cc.CopyTo (new Control[1], 0);
+                       Assert.IsNotNull (cc.GetEnumerator (), "GetEnumerator");
+                       Assert.AreEqual (0, cc.IndexOf (control), "IndexOf");
+                       cc.RemoveAt (0);
+                       cc.Remove (control);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (Control) });
+                       Assert.IsNotNull (ci, ".ctor(Control)");
+                       return ci.Invoke (new object[1] { control });
+               }
+
+               public override Type Type {
+                       get { return typeof (ControlCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/CssStyleCollectionCas.cs b/mcs/class/System.Web/Test/System.Web.UI/CssStyleCollectionCas.cs
new file mode 100644 (file)
index 0000000..aa0fb00
--- /dev/null
@@ -0,0 +1,90 @@
+//
+// CssStyleCollectionCas.cs 
+//     - CAS unit tests for System.Web.UI.CssStyleCollectionCas
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class CssStyleCollectionCas : AspNetHostingMinimal {
+
+               private CssStyleCollection css;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       css = new Table ().Style;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       Assert.AreEqual (0, css.Count, "Count");
+                       css ["mono"] = "monkey";
+                       Assert.AreEqual ("monkey", css["mono"], "this[string]");
+                       Assert.IsNotNull (css.Keys, "Keys");
+                       css.Add ("monkey", "mono");
+                       css.Remove ("monkey");
+                       css.Clear ();
+#if NET_2_0
+                       css[HtmlTextWriterStyle.Top] = "1";
+                       Assert.AreEqual ("1", css[HtmlTextWriterStyle.Top], "this[HtmlTextWriterStyle]");
+                       Assert.IsNotNull (css.Value, "Value");
+                       css.Value = String.Empty;
+                       css.Add (HtmlTextWriterStyle.Left, "1");
+                       css.Remove (HtmlTextWriterStyle.Left);
+#endif
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // no public ctor is available but we know the Count property isn't protected
+                       MethodInfo mi = this.Type.GetProperty ("Count").GetGetMethod ();
+                       Assert.IsNotNull (mi, "Count");
+                       return mi.Invoke (css, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (CssStyleCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DataBinderCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DataBinderCas.cs
new file mode 100644 (file)
index 0000000..0bb9cf3
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// DataBinderCas.cs - CAS unit tests for System.Web.UI.DataBinder
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DataBinderCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Eval_Deny_Unrestricted ()
+               {
+                       Assert.IsNull (DataBinder.Eval (null, "Data"), "Eval(object,string)");
+                       Assert.AreEqual (String.Empty, DataBinder.Eval (null, "Data", null), "Eval(object,string,string)");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void GetIndexedPropertyValue2_Deny_Unrestricted ()
+               {
+                       DataBinder.GetIndexedPropertyValue (null, "Data");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void GetIndexedPropertyValue3_Deny_Unrestricted ()
+               {
+                       DataBinder.GetIndexedPropertyValue (null, "Data", "{0}");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void GetPropertyValue2_Deny_Unrestricted ()
+               {
+                       DataBinder.GetPropertyValue (null, "Data");
+                       Assert.IsNull (DataBinder.GetPropertyValue (null, "Data", "{0}"), "GetPropertyValue(object,string,string)");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void GetPropertyValue3_Deny_Unrestricted ()
+               {
+                       DataBinder.GetPropertyValue (null, "Data", "{0}");
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void GetDataItem_Deny_Unrestricted ()
+               {
+                       Assert.IsNull (DataBinder.GetDataItem (null), "GetDataItem(object)");
+                       bool found = true;
+                       Assert.IsNull (DataBinder.GetDataItem (null, out found), "GetDataItem(object,out bool)");
+                       Assert.IsFalse (found, "found");
+               }
+#endif
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (DataBinder); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DataBindingCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DataBindingCas.cs
new file mode 100644 (file)
index 0000000..087463d
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// DataBindingCas.cs - CAS unit tests for System.Web.UI.DataBinding
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DataBindingCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       DataBinding db = new DataBinding ("property", typeof (string), String.Empty);
+
+                       db.Expression = "expression";
+                       Assert.AreEqual ("expression", db.Expression, "Expression");
+                       Assert.AreEqual ("property", db.PropertyName, "PropertyName");
+                       Assert.AreEqual (typeof (string), db.PropertyType, "PropertyType");
+
+                       Assert.IsTrue (db.Equals (db), "Equals");
+                       Assert.IsTrue (db.GetHashCode () != 0, "GetHashCode"); // likely
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[3] { typeof (string), typeof (Type), typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(String,Type,String)");
+                       return ci.Invoke (new object[3] { String.Empty, typeof (string), String.Empty });
+               }
+
+               public override Type Type {
+                       get { return typeof (DataBinding); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DataBindingCollectionCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DataBindingCollectionCas.cs
new file mode 100644 (file)
index 0000000..90ec6d9
--- /dev/null
@@ -0,0 +1,92 @@
+//
+// DataBindingCollectionCas.cs 
+//     - CAS unit tests for System.Web.UI.DataBindingCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DataBindingCollectionCas : AspNetHostingMinimal {
+
+               private DataBinding db;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       db = new DataBinding ("property", typeof (string), "");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       DataBindingCollection dbc = new DataBindingCollection ();
+                       Assert.AreEqual (0, dbc.Count, "Count");
+                       Assert.IsFalse (dbc.IsReadOnly, "IsReadOnly");
+                       Assert.IsFalse (dbc.IsSynchronized, "IsSynchronized");
+                       dbc.Add (db);
+                       Assert.AreSame (db, dbc["property"], "this[string]");
+                       Assert.IsNotNull (dbc.RemovedBindings, "RemovedBindings");
+                       Assert.IsNotNull (dbc.SyncRoot, "SyncRoot");
+                       Assert.IsNotNull (dbc.GetEnumerator (), "GetEnumerator");
+                       dbc.CopyTo (new DataBinding[1], 0);
+                       dbc.Clear ();
+
+                       dbc.Add (db);
+                       dbc.Remove (db);
+
+                       dbc.Add (db);
+                       dbc.Remove ("property");
+                       dbc.Remove ("property", true);
+#if NET_2_0
+                       dbc.Changed += new EventHandler (Handler);
+                       Assert.IsFalse (dbc.Contains ("property"), "Contains");
+                       dbc.Changed -= new EventHandler (Handler);
+#endif
+               }
+
+#if NET_2_0
+               private void Handler (object sender, EventArgs e)
+               {
+               }
+#endif
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (DataBindingCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DataBindingHandlerAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DataBindingHandlerAttributeCas.cs
new file mode 100644 (file)
index 0000000..b7f25b2
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// DataBindingHandlerAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.DataBindingHandlerAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DataBindingHandlerAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor_Deny_Unrestricted ()
+               {
+                       DataBindingHandlerAttribute a = new DataBindingHandlerAttribute ();
+                       Assert.AreEqual (String.Empty, a.HandlerTypeName, "HandlerTypeName");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CtorString_Deny_Unrestricted ()
+               {
+                       DataBindingHandlerAttribute a = new DataBindingHandlerAttribute ("mono");
+                       Assert.AreEqual ("mono", a.HandlerTypeName, "HandlerTypeName");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CtorType_Deny_Unrestricted ()
+               {
+                       DataBindingHandlerAttribute a = new DataBindingHandlerAttribute (GetType ());
+                       Assert.IsTrue (a.HandlerTypeName.StartsWith ("MonoCasTests.System.Web.UI.DataBindingHandlerAttributeCas"), "HandlerTypeName");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Default_Deny_Unrestricted ()
+               {
+                       DataBindingHandlerAttribute a = DataBindingHandlerAttribute.Default;
+                       Assert.AreEqual (String.Empty, a.HandlerTypeName, "HandlerTypeName");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (DataBindingHandlerAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DataBoundLiteralControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DataBoundLiteralControlCas.cs
new file mode 100644 (file)
index 0000000..68be63d
--- /dev/null
@@ -0,0 +1,81 @@
+//
+// DataBoundLiteralControlCas.cs 
+//     - CAS unit tests for System.Web.UI.DataBoundLiteralControl
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DataBoundLiteralControlCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       DataBoundLiteralControl dblc = new DataBoundLiteralControl (1, 1);
+                       dblc.SetDataBoundString (0, "mono");
+                       dblc.SetStaticString (0, "monkey");
+                       Assert.AreEqual ("monkeymono", dblc.Text, "Text");
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ITextControl_Deny_Unrestricted ()
+               {
+                       ITextControl tc = new DataBoundLiteralControl (1, 1);
+                       Assert.AreEqual (String.Empty, tc.Text, "ITextControl.Text");
+                       // setter throw
+                       tc.Text = "singe";
+               }
+#endif
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[2] { typeof (int), typeof (int) });
+                       Assert.IsNotNull (ci, ".ctor(int,int)");
+                       return ci.Invoke (new object[2] { 1, 1 });
+               }
+
+               public override Type Type {
+                       get { return typeof (DataBoundLiteralControl); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DesignTimeParseDataCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DesignTimeParseDataCas.cs
new file mode 100644 (file)
index 0000000..60c4c6e
--- /dev/null
@@ -0,0 +1,86 @@
+//
+// DesignTimeParseDataCas.cs 
+//     - CAS unit tests for System.Web.UI.DesignTimeParseData
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DesignTimeParseDataCas : AspNetHostingMinimal {
+
+               private void Handler (object sender, EventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor2_Deny_Unrestricted ()
+               {
+                       DesignTimeParseData dtpd = new DesignTimeParseData (null, "parseText");
+                       dtpd.DataBindingHandler = new EventHandler (Handler);
+                       Assert.IsNotNull (dtpd.DataBindingHandler, "DataBindingHandler");
+                       Assert.IsNull (dtpd.DesignerHost, "DesignerHost");
+                       dtpd.DocumentUrl = String.Empty;
+                       Assert.AreEqual (String.Empty, dtpd.DocumentUrl, "DocumentUrl");
+                       Assert.AreEqual ("parseText", dtpd.ParseText, "ParseText");
+               }
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor3_Deny_Unrestricted ()
+               {
+                       DesignTimeParseData dtpd = new DesignTimeParseData (null, "parseText", "filter");
+                       Assert.AreEqual ("filter", dtpd.Filter, "Filter");
+                       dtpd.ShouldApplyTheme = true;
+                       Assert.IsTrue (dtpd.ShouldApplyTheme, "ShouldApplyTheme");
+                       Assert.IsNull (dtpd.UserControlRegisterEntries, "UserControlRegisterEntries");
+               }
+#endif
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[2] { typeof (IDesignerHost), typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(IDesignerHost,String)");
+                       return ci.Invoke (new object[2] { null, "parseText" });
+               }
+
+               public override Type Type {
+                       get { return typeof (DesignTimeParseData); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DesignTimeTemplateParserCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DesignTimeTemplateParserCas.cs
new file mode 100644 (file)
index 0000000..ed3b3dc
--- /dev/null
@@ -0,0 +1,174 @@
+//
+// DesignTimeTemplateParserCas.cs 
+//     - CAS unit tests for System.Web.UI.DesignTimeTemplateParser
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DesignTimeTemplateParserCas : AspNetHostingMinimal {
+
+               private DesignTimeParseData dtpd;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       dtpd = new DesignTimeParseData (null, "parseText");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, ControlThread = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ParseControl_Deny_ControlThread ()
+               {
+                       DesignTimeTemplateParser.ParseControl (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ParseControl_Deny_UnmanagedCode ()
+               {
+                       DesignTimeTemplateParser.ParseControl (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, ControlThread = true, UnmanagedCode = true)]
+#if ONLY_1_1
+               [ExpectedException (typeof (NullReferenceException))]
+#endif
+               public void ParseControl_PermitOnly_ControlThreadUnmanagedCode ()
+               {
+                       DesignTimeTemplateParser.ParseControl (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, ControlThread = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ParseTemplate_Deny_ControlThread ()
+               {
+                       DesignTimeTemplateParser.ParseTemplate (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ParseTemplate_Deny_UnmanagedCode ()
+               {
+                       DesignTimeTemplateParser.ParseTemplate (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, ControlThread = true, UnmanagedCode = true)]
+#if ONLY_1_1
+               [ExpectedException (typeof (NullReferenceException))]
+#endif
+               public void ParseTemplate_PermitOnly_ControlThreadUnmanagedCode ()
+               {
+                       DesignTimeTemplateParser.ParseTemplate (dtpd);
+               }
+#if NET_2_0
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, ControlThread = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ParseControls_Deny_ControlThread ()
+               {
+                       DesignTimeTemplateParser.ParseControls (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ParseControls_Deny_UnmanagedCode ()
+               {
+                       DesignTimeTemplateParser.ParseControls (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, ControlThread = true, UnmanagedCode = true)]
+               public void ParseControls_PermitOnly_ControlThreadUnmanagedCode ()
+               {
+                       DesignTimeTemplateParser.ParseControls (dtpd);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, ControlThread = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ParseTheme_Deny_ControlThread ()
+               {
+                       try {
+                               DesignTimeTemplateParser.ParseTheme (null, "theme", "path");
+                       }
+                       catch (Exception) {
+                               // security exception gets hidden :-(
+                               Assert.Ignore ("security exception gets hidden :-(");
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, ControlThread = true)]
+               public void ParseTheme_PermitOnly_ControlThread ()
+               {
+                       DesignTimeTemplateParser.ParseTheme (null, "theme", "path");
+               }
+#endif
+
+               // LinkDemand
+
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true, ControlThread = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       try {
+                               // static class 2.0 / no public ctor before (1.x)
+                               MethodInfo mi = this.Type.GetMethod ("ParseTemplate");
+                               Assert.IsNotNull (mi, "ParseTemplate");
+                               return mi.Invoke (null, new object[1] { dtpd });
+                       }
+                       catch (TargetInvocationException tie) {
+#if ONLY_1_1
+                               if (tie.InnerException is NullReferenceException)
+                                       return String.Empty;
+#endif
+                               throw tie;
+                       }
+               }
+
+               public override Type Type {
+                       get { return typeof (DesignTimeTemplateParser); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/DesignerDataBoundLiteralControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI/DesignerDataBoundLiteralControlCas.cs
new file mode 100644 (file)
index 0000000..99329a1
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// DesignerDataBoundLiteralControlCas.cs 
+//     - CAS unit tests for System.Web.UI.DesignerDataBoundLiteralControl
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class DesignerDataBoundLiteralControlCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       DesignerDataBoundLiteralControl ddblc = new DesignerDataBoundLiteralControl ();
+                       ddblc.Text = "mono";
+                       Assert.AreEqual ("mono", ddblc.Text, "Text");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (DesignerDataBoundLiteralControl); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/EmptyCollectionCas.cs b/mcs/class/System.Web/Test/System.Web.UI/EmptyCollectionCas.cs
new file mode 100644 (file)
index 0000000..875b474
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// EmptyControlCollectionCas.cs 
+//     - CAS unit tests for System.Web.UI.EmptyControlCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class EmptyControlCollectionCas : AspNetHostingMinimal {
+
+               private Control control;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       control = new Control ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Deny_Unrestricted ()
+               {
+                       EmptyControlCollection ec = new EmptyControlCollection (control);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void Add_Deny_Unrestricted ()
+               {
+                       EmptyControlCollection ec = new EmptyControlCollection (control);
+                       ec.Add (new Control ());
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void AddAt_Deny_Unrestricted ()
+               {
+                       EmptyControlCollection ec = new EmptyControlCollection (control);
+                       ec.AddAt (0, new Control ());
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (Control) });
+                       Assert.IsNotNull (ci, ".ctor(Control)");
+                       return ci.Invoke (new object[1] { control });
+               }
+
+               public override Type Type {
+                       get { return typeof (EmptyControlCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/Html32TextWriterCas.cs b/mcs/class/System.Web/Test/System.Web.UI/Html32TextWriterCas.cs
new file mode 100644 (file)
index 0000000..dd493c7
--- /dev/null
@@ -0,0 +1,96 @@
+//
+// Html32TextWriterCas.cs - CAS unit tests for System.Web.UI.Html32TextWriter
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class Html32TextWriterCas : AspNetHostingMinimal {
+
+               private StringWriter sw;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       sw = new StringWriter ();
+               }
+
+               private void Deny_Unrestricted (Html32TextWriter htw)
+               {
+#if NET_2_0
+                       htw.ShouldPerformDivTableSubstitution = true;
+                       Assert.IsTrue (htw.ShouldPerformDivTableSubstitution, "ShouldPerformDivTableSubstitution");
+                       htw.SupportsBold = true;
+                       Assert.IsTrue (htw.SupportsBold, "SupportsBold");
+                       htw.SupportsItalic = true;
+                       Assert.IsTrue (htw.SupportsItalic, "SupportsItalic");
+#endif
+                       htw.RenderBeginTag (HtmlTextWriterTag.Table);
+                       htw.RenderBeginTag ("<tr>");
+                       htw.RenderEndTag ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor1_Deny_Unrestricted ()
+               {
+                       Html32TextWriter htw = new Html32TextWriter (sw);
+                       Deny_Unrestricted (htw);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor2_Deny_Unrestricted ()
+               {
+                       Html32TextWriter htw = new Html32TextWriter (sw, String.Empty);
+                       Deny_Unrestricted (htw);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (TextWriter) });
+                       Assert.IsNotNull (ci, ".ctor(TextWriter)");
+                       return ci.Invoke (new object[1] { sw });
+               }
+
+               public override Type Type {
+                       get { return typeof (Html32TextWriter); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/HtmlTextWriterCas.cs b/mcs/class/System.Web/Test/System.Web.UI/HtmlTextWriterCas.cs
new file mode 100644 (file)
index 0000000..f8d19d8
--- /dev/null
@@ -0,0 +1,145 @@
+//
+// HtmlTextWriterCas.cs - CAS unit tests for System.Web.UI.HtmlTextWriter
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HtmlTextWriterCas : AspNetHostingMinimal {
+
+               private StringWriter sw;
+
+               [SetUp]
+               public override void SetUp ()
+               {
+                       base.SetUp ();
+                       sw = new StringWriter ();
+               }
+
+               private void Deny_Unrestricted (HtmlTextWriter htw)
+               {
+                       Assert.IsTrue (htw.Indent >= 0, "Indent");
+                       Assert.AreSame (sw, htw.InnerWriter, "InnerWriter");
+                       htw.NewLine = Environment.NewLine;
+                       Assert.IsNotNull (htw.NewLine, "NewLine");
+
+                       htw.AddAttribute (HtmlTextWriterAttribute.Bgcolor, "blue");
+                       htw.AddAttribute (HtmlTextWriterAttribute.Bgcolor, "blue", false);
+                       htw.AddAttribute ("align", "left");
+                       htw.AddAttribute ("align", "left", false);
+
+                       htw.AddStyleAttribute (HtmlTextWriterStyle.BackgroundColor, "blue");
+                       htw.AddStyleAttribute ("left", "1");
+
+                       htw.RenderBeginTag (HtmlTextWriterTag.Table);
+                       htw.RenderBeginTag ("<tr>");
+                       htw.RenderEndTag ();
+
+                       htw.WriteAttribute ("align", "left");
+                       htw.WriteAttribute ("align", "left", false);
+                       htw.WriteBeginTag ("table");
+                       htw.WriteEndTag ("table");
+                       htw.WriteFullBeginTag ("div");
+
+                       htw.WriteStyleAttribute ("left", "2");
+                       htw.WriteStyleAttribute ("left", "3", false);
+
+                       htw.Write (new char[1], 0, 1);
+                       htw.Write ((double)1.0);
+                       htw.Write (Char.MinValue);
+                       htw.Write (new char[1]);
+                       htw.Write ((int)1);
+                       htw.Write ("{0}", 1);
+                       htw.Write ("{0}{1}", 1, 2);
+                       htw.Write ("{0}{1}{2}", 1, 2, 3);
+                       htw.Write (String.Empty);
+                       htw.Write ((long)1);
+                       htw.Write (this);
+                       htw.Write ((float)1.0);
+                       htw.Write (false);
+
+                       htw.WriteLine (new char[1], 0, 1);
+                       htw.WriteLine ((double)1.0);
+                       htw.WriteLine (Char.MinValue);
+                       htw.WriteLine (new char[1]);
+                       htw.WriteLine ((int)1);
+                       htw.WriteLine ("{0}", 1);
+                       htw.WriteLine ("{0}{1}", 1, 2);
+                       htw.WriteLine ("{0}{1}{2}", 1, 2, 3);
+                       htw.WriteLine (String.Empty);
+                       htw.WriteLine ((long)1);
+                       htw.WriteLine (this);
+                       htw.WriteLine ((float)1.0);
+                       htw.WriteLine (false);
+                       htw.WriteLine ((uint)0);
+                       htw.WriteLine ();
+                       htw.WriteLineNoTabs (String.Empty);
+
+                       htw.Flush ();
+                       htw.Close ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor1_Deny_Unrestricted ()
+               {
+                       HtmlTextWriter htw = new HtmlTextWriter (sw);
+                       Deny_Unrestricted (htw);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor2_Deny_Unrestricted ()
+               {
+                       HtmlTextWriter htw = new HtmlTextWriter (sw, String.Empty);
+                       Deny_Unrestricted (htw);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (TextWriter) });
+                       Assert.IsNotNull (ci, ".ctor(TextWriter)");
+                       return ci.Invoke (new object[1] { sw });
+               }
+
+               public override Type Type {
+                       get { return typeof (HtmlTextWriter); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ImageClickEventArgsCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ImageClickEventArgsCas.cs
new file mode 100644 (file)
index 0000000..1f23157
--- /dev/null
@@ -0,0 +1,66 @@
+//
+// ImageClickEventArgsCas.cs 
+//     - CAS unit tests for System.Web.UI.ImageClickEventArgs
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ImageClickEventArgsCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ImageClickEventArgs icea = new ImageClickEventArgs (0, 0);
+                       Assert.AreEqual (0, icea.X, "X");
+                       Assert.AreEqual (0, icea.Y, "Y");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[2] { typeof (int), typeof (int) });
+                       Assert.IsNotNull (ci, ".ctor(int,int)");
+                       return ci.Invoke (new object[2] { 0, 0 });
+               }
+
+               public override Type Type {
+                       get { return typeof (ImageClickEventArgs); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/LiteralControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI/LiteralControlCas.cs
new file mode 100644 (file)
index 0000000..e142123
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// LiteralControlCas.cs 
+//     - CAS unit tests for System.Web.UI.LiteralControlCas
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class LiteralControlCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor0_Deny_Unrestricted ()
+               {
+                       LiteralControl lc = new LiteralControl ();
+                       Assert.IsNull (lc.Text, "Text");
+                       lc.Text = "mono";
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor1_Deny_Unrestricted ()
+               {
+                       LiteralControl lc = new LiteralControl ("mono");
+                       Assert.AreEqual ("mono", lc.Text, "Text");
+                       lc.Text = String.Empty;
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (LiteralControl); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/LosFormatterCas.cs b/mcs/class/System.Web/Test/System.Web.UI/LosFormatterCas.cs
new file mode 100644 (file)
index 0000000..1f75386
--- /dev/null
@@ -0,0 +1,85 @@
+//
+// LosFormatterCas.cs - CAS unit tests for System.Web.UI.LosFormatter
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class LosFormatterCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor0_Deny_Unrestricted ()
+               {
+                       LosFormatter lf = new LosFormatter ();
+
+                       MemoryStream ms = new MemoryStream ();
+                       lf.Serialize (ms, "mono");
+                       ms.Position = 0;
+                       Assert.IsNotNull (lf.Deserialize (ms), "Deserialize(Stream)");
+
+                       StringWriter sw = new StringWriter ();
+                       lf.Serialize (sw, "mono");
+                       string s = sw.ToString ();
+                       StringReader sr = new StringReader (s);
+                       Assert.IsNotNull (lf.Deserialize (sr), "Deserialize(TextReader)");
+
+                       Assert.IsNotNull (lf.Deserialize (s), "Deserialize(string)");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CtorBoolString_Deny_Unrestricted ()
+               {
+                       LosFormatter lf = new LosFormatter (true, String.Empty);
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CtorBoolByteArray_Deny_Unrestricted ()
+               {
+                       LosFormatter lf = new LosFormatter (true, (byte[])null);
+               }
+#endif
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (LosFormatter); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/MinimizableAttributeTypeConverterTest.cs b/mcs/class/System.Web/Test/System.Web.UI/MinimizableAttributeTypeConverterTest.cs
new file mode 100644 (file)
index 0000000..3a2da9c
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// Tests for System.Web.UI.MinimizableAttributeTypeConvert.cs 
+//
+// Author:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.IO;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Reflection;
+using NUnit.Framework;
+
+#if NET_2_0
+namespace MonoTests.System.Web.UI {
+
+       [TestFixture]
+       public class MinimizableAttributeTypeConverterTest {
+               private TypeConverter GetTypeConverter ()
+               {
+                       Type t = typeof (HtmlTableCell);
+                       PropertyInfo[] props;
+                       PropertyInfo pi = null;
+                       TypeConverter tc;
+
+                       props = t.GetProperties();
+
+                       foreach (PropertyInfo p in props) {
+                               if (p.Name == "NoWrap") {
+                                       pi = p;
+                                       break;
+                               }
+                       }
+
+                       object[] attrs = pi.GetCustomAttributes (typeof (TypeConverterAttribute), false);
+                       TypeConverterAttribute tca = (TypeConverterAttribute)attrs[0];
+
+                       Type tct = Type.GetType (tca.ConverterTypeName);
+                       tc = (TypeConverter)Activator.CreateInstance (tct);
+
+                       return tc;
+               }
+
+               [Test]
+               public void CanConvertFrom ()
+               {
+                       TypeConverter tc = GetTypeConverter ();
+
+                       Assert.IsFalse (tc.CanConvertFrom (typeof (bool)), "A1");
+                       Assert.IsTrue (tc.CanConvertFrom (typeof (string)), "A2");
+                       Assert.IsTrue (tc.CanConvertFrom (typeof (InstanceDescriptor)), "A3");
+               }
+
+               [Test]
+               public void CanConvertTo ()
+               {
+                       TypeConverter tc = GetTypeConverter ();
+
+                       Assert.IsFalse (tc.CanConvertTo (typeof (bool)), "A1");
+                       Assert.IsTrue (tc.CanConvertTo (typeof (string)), "A2");
+                       Assert.IsFalse (tc.CanConvertTo (typeof (InstanceDescriptor)), "A3");
+               }
+
+               [Test]
+               public void ConvertFrom ()
+               {
+                       TypeConverter tc = GetTypeConverter ();
+
+                       Assert.AreEqual ("hi", tc.ConvertTo ("hi", typeof (string)), "A1");
+                       Assert.AreEqual ("", tc.ConvertTo ("", typeof (string)), "A2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertFromNull ()
+               {
+                       TypeConverter tc = GetTypeConverter ();
+
+                       tc.ConvertFrom (null);
+               }
+
+
+               [Test]
+               public void ConvertTo ()
+               {
+                       TypeConverter tc = GetTypeConverter ();
+
+                       Assert.AreEqual ("hi", tc.ConvertTo ("hi", typeof (string)), "A1");
+                       Assert.AreEqual ("", tc.ConvertTo ("", typeof (string)), "A2");
+                       Assert.AreEqual ("", tc.ConvertTo (null, typeof (string)), "A3");
+                       Assert.AreEqual ("False", tc.ConvertTo (false, typeof (string)), "A4");
+                       Assert.AreEqual ("True", tc.ConvertTo (true, typeof (string)), "A5");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ObjectConverterCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ObjectConverterCas.cs
new file mode 100644 (file)
index 0000000..e251146
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// ObjectConverterCas.cs - CAS unit tests for System.Web.UI.ObjectConverter
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ObjectConverterCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor ()
+               {
+                       new ObjectConverter ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void ConvertValue_Deny_Unrestricted ()
+               {
+                       try {
+                               ObjectConverter.ConvertValue (String.Empty, typeof (String), String.Empty);
+                       }
+                       catch (NotImplementedException) {
+                       }
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ObjectConverter); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ObjectTagBuilderCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ObjectTagBuilderCas.cs
new file mode 100644 (file)
index 0000000..0c6addb
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// ObjectTagBuilderCas.cs - CAS unit tests for System.Web.UI.ObjectTagBuilder
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ObjectTagBuilderCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ObjectTagBuilder otb = new ObjectTagBuilder ();
+                       otb.AppendLiteralString (String.Empty);
+                       otb.AppendSubBuilder (new ControlBuilder ());
+                       try {
+                               otb.Init (null, null, null, null, null, null);
+                       }
+                       catch (HttpException) {
+                               // missing id
+                       }
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ObjectTagBuilder); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/PageCas.cs b/mcs/class/System.Web/Test/System.Web.UI/PageCas.cs
new file mode 100644 (file)
index 0000000..ebcef92
--- /dev/null
@@ -0,0 +1,352 @@
+//
+// PageCas.cs - CAS unit tests for System.Web.UI.Page
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PageCas : AspNetHostingMinimal {
+
+               private Control control;
+               private Page page;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       control = new Control ();
+                       control.ID = "mono";
+                       page = new Page ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       Page p = new Page ();
+                       Assert.IsNull (p.Application, "Application");
+                       p.ClientTarget = "mono";
+                       Assert.AreEqual ("mono", p.ClientTarget, "ClientTarget");
+                       p.EnableViewState = true;
+                       Assert.IsTrue (p.EnableViewState, "EnableViewState");
+                       p.ErrorPage = "error.html";
+                       Assert.AreEqual ("error.html", p.ErrorPage, "ErrorPage");
+                       p.ID = "mono";
+                       Assert.AreEqual ("mono", p.ID, "ID");
+                       Assert.IsFalse (p.IsPostBack, "IsPostBack");
+                       Assert.IsFalse (p.IsReusable, "IsReusable");
+                       p.SmartNavigation = false;
+                       Assert.IsFalse (p.SmartNavigation, "SmartNavigation");
+                       Assert.IsNotNull (p.Validators, "Validators");
+                       p.ViewStateUserKey = "mono";
+                       Assert.AreEqual ("mono", p.ViewStateUserKey, "ViewStateUserKey");
+                       p.Visible = true;
+                       Assert.IsTrue (p.Visible, "Visible");
+#if NET_2_0
+                       Assert.IsNotNull (p.ClientScript, "ClientScript");
+//                     p.CodePage = 0;
+//                     Assert.AreEqual (0, p.CodePage, "CodePage");
+//                     p.ContentType = "mono";
+//                     Assert.AreEqual ("mono", p.ContentType, "ContentType");
+                       Assert.IsNotNull (p.Culture, "Culture");
+                       Assert.IsNull (p.Form, "Form");
+                       Assert.IsNull (p.Header, "Header");
+                       Assert.IsFalse (p.IsCallback, "IsCallback");
+                       Assert.IsFalse (p.IsCrossPagePostBack, "IsCrossPagePostBack");
+                       Assert.IsTrue (p.LCID != 0, "LCID");
+                       p.MasterPageFile = String.Empty;
+                       Assert.AreEqual (String.Empty, p.MasterPageFile, "MasterPageFile");
+                       Assert.IsNull (p.Master, "Master");
+                       Assert.IsNull (p.PageAdapter, "PageAdapter");
+                       Assert.IsNull (p.PreviousPage, "PreviousPage");
+//                     p.ResponseEncoding = Encoding.UTF8.WebName;
+//                     Assert.AreEqual (Encoding.UTF8.WebName, p.ResponseEncoding, "ResponseEncoding");
+                       p.UICulture = "en-us";
+                       Assert.IsNotNull (p.UICulture, "UICulture");
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void Cache_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new Page ().Cache, "Cache");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void IsValid_Deny_Unrestricted ()
+               {
+                       Assert.IsFalse (new Page ().IsValid, "IsValid");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void Request_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new Page ().Request, "Request");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void Response_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new Page ().Response, "Response");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Server_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new Page ().Server, "Server");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void Session_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new Page ().Session, "Session");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Trace_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new Page ().Trace, "Trace");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void User_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new Page ().User, "User");
+               }
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void Buffer_set_Deny_Unrestricted ()
+               {
+                       page.Buffer = true;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (HttpException))]
+               public void Buffer_get_Deny_Unrestricted ()
+               {
+                       Assert.IsTrue (page.Buffer, "Buffer");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, ControlThread = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Culture_Deny_ControlThread ()
+               {
+                       page.Culture = "fr-ca";
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, ControlThread = true)]
+               public void Culture_PermitOnly_ControlThread ()
+               {
+                       page.Culture = "fr-ca";
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, ControlThread = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void LCID_Deny_ControlThread ()
+               {
+                       page.LCID = 0x409;
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, ControlThread = true)]
+               public void LCID_PermitOnly_ControlThread ()
+               {
+                       page.LCID = 0x409;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void TraceEnabled_set_Deny_Unrestricted ()
+               {
+                       page.TraceEnabled = false;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void TraceEnabled_get_Deny_Unrestricted ()
+               {
+                       Assert.IsFalse (page.TraceEnabled, "TraceEnabled");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void TraceModeValue_set_Deny_Unrestricted ()
+               {
+                       page.TraceModeValue = TraceMode.Default;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void TraceModeValue_get_Deny_Unrestricted ()
+               {
+                       Assert.AreEqual (TraceMode.Default, page.TraceModeValue, "TraceModeValue");
+               }
+#endif
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       Page p = new Page ();
+                       p.DesignerInitialize ();
+                       Assert.IsNotNull (p.GetPostBackClientEvent (control, "mono"), "GetPostBackClientEvent");
+                       Assert.IsNotNull (p.GetPostBackClientHyperlink (control, "mono"), "GetPostBackClientHyperlink");
+                       Assert.IsNotNull (p.GetPostBackEventReference (control), "GetPostBackEventReference(control)");
+                       Assert.IsNotNull (p.GetPostBackEventReference (control, "mono"), "GetPostBackEventReference(control,string)");
+                       Assert.AreEqual (0, p.GetTypeHashCode (), "GetTypeHashCode");
+                       Assert.IsFalse (p.IsClientScriptBlockRegistered ("mono"), "IsClientScriptBlockRegistered");
+                       Assert.IsFalse (p.IsStartupScriptRegistered ("mono"), "IsStartupScriptRegistered");
+                       p.RegisterArrayDeclaration ("arrayname", "value");
+                       p.RegisterClientScriptBlock ("key", "script");
+                       p.RegisterHiddenField ("name", "hidden");
+                       p.RegisterOnSubmitStatement ("key", "script");
+                       p.RegisterRequiresPostBack (new HtmlTextArea ());
+                       p.RegisterRequiresRaiseEvent (new HtmlAnchor ());
+                       p.RegisterStartupScript ("key", "script");
+                       p.Validate ();
+                       p.VerifyRenderingInServerForm (control);
+#if NET_2_0
+                       p.Controls.Add (control);
+                       Assert.IsNotNull (p.FindControl ("mono"), "FindControl");
+                       p.RegisterRequiresControlState (control);
+                       Assert.IsTrue (p.RequiresControlState (control), "RequiresControlState");
+                       p.UnregisterRequiresControlState (control);
+                       Assert.IsNotNull (p.GetValidators (String.Empty), "GetValidators");
+                       p.Validate (String.Empty);
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void MapPath_Deny_Unrestricted ()
+               {
+                       try {
+                               new Page ().MapPath ("/");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x + 2.0
+                       }
+                       catch (HttpException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+#if NET_2_0
+               [ExpectedException (typeof (SecurityException))]
+#else
+               [ExpectedException (typeof (NullReferenceException))]
+#endif
+               public void ProcessRequest_Deny_Unrestricted ()
+               {
+                       new Page ().ProcessRequest (new HttpContext (null));
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+#if NET_2_0
+               [ExpectedException (typeof (HttpException))]
+#else
+               // indirect for HttpApplicationState | HttpStaticObjectsCollection
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+#endif
+               public void ProcessRequest_PermitOnly_FileIOPermission ()
+               {
+                       new Page ().ProcessRequest (new HttpContext (null));
+               }
+
+#if NET_2_0
+               private void Handler (object sender, EventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Events_Deny_Unrestricted ()
+               {
+                       Page p = new Page ();
+                       p.InitComplete += new EventHandler (Handler);
+                       p.LoadComplete += new EventHandler (Handler);
+                       p.PreInit += new EventHandler (Handler);
+                       p.PreLoad += new EventHandler (Handler);
+                       p.PreRenderComplete += new EventHandler (Handler);
+                       p.SaveStateComplete += new EventHandler (Handler);
+
+                       p.InitComplete -= new EventHandler (Handler);
+                       p.LoadComplete -= new EventHandler (Handler);
+                       p.PreInit -= new EventHandler (Handler);
+                       p.PreLoad -= new EventHandler (Handler);
+                       p.PreRenderComplete -= new EventHandler (Handler);
+                       p.SaveStateComplete -= new EventHandler (Handler);
+               }
+#endif
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (Page); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/PairCas.cs b/mcs/class/System.Web/Test/System.Web.UI/PairCas.cs
new file mode 100644 (file)
index 0000000..0975ef3
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// PairCas.cs - CAS unit tests for System.Web.UI.Pair
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PairCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor0_Deny_Unrestricted ()
+               {
+                       Pair p = new Pair ();
+                       Assert.IsNull (p.First, "First");
+                       Assert.IsNull (p.Second, "Second");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor2_Deny_Unrestricted ()
+               {
+                       Pair p = new Pair (String.Empty, String.Empty);
+                       Assert.IsNotNull (p.First, "First");
+                       Assert.IsNotNull (p.Second, "Second");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (Pair); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ParseChildrenAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ParseChildrenAttributeCas.cs
new file mode 100644 (file)
index 0000000..f4797d1
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// ParseChildrenAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.ParseChildrenAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ParseChildrenAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor_Deny_Unrestricted ()
+               {
+                       ParseChildrenAttribute pca = new ParseChildrenAttribute ();
+                       Assert.IsFalse (pca.ChildrenAsProperties, "ChildrenAsProperties");
+                       Assert.AreEqual (String.Empty, pca.DefaultProperty, "DefaultProperty");
+                       Assert.IsTrue (pca.Equals (pca), "Equals");
+                       Assert.IsTrue (pca.IsDefaultAttribute (), "IsDefaultAttribute");
+                       // this throws a NullReferenceException on MS 2.0 beta2
+                       // Assert.IsTrue (pca.GetHashCode () != 0, "GetHashCode"); // likely
+#if NET_2_0
+                       Assert.AreEqual (typeof (Control), pca.ChildControlType, "ChildControlType");
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CtorBool_Deny_Unrestricted ()
+               {
+                       ParseChildrenAttribute pca = new ParseChildrenAttribute (true);
+                       Assert.IsTrue (pca.ChildrenAsProperties, "ChildrenAsProperties");
+                       Assert.AreEqual (String.Empty, pca.DefaultProperty, "DefaultProperty");
+                       Assert.IsTrue (pca.Equals (pca), "Equals");
+                       Assert.IsFalse (pca.IsDefaultAttribute (), "IsDefaultAttribute");
+                       Assert.IsTrue (pca.GetHashCode () != 0, "GetHashCode"); // likely
+#if NET_2_0
+                       Assert.AreEqual (typeof (Control), pca.ChildControlType, "ChildControlType");
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CtorBoolString_Deny_Unrestricted ()
+               {
+                       ParseChildrenAttribute pca = new ParseChildrenAttribute (true, "mono");
+                       Assert.IsTrue (pca.ChildrenAsProperties, "ChildrenAsProperties");
+                       Assert.AreEqual ("mono", pca.DefaultProperty, "DefaultProperty");
+                       Assert.IsTrue (pca.Equals (pca), "Equals");
+                       Assert.IsFalse (pca.IsDefaultAttribute (), "IsDefaultAttribute");
+                       Assert.IsTrue (pca.GetHashCode () != 0, "GetHashCode"); // likely
+#if NET_2_0
+                       Assert.AreEqual (typeof (Control), pca.ChildControlType, "ChildControlType");
+#endif
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CtorType_Deny_Unrestricted ()
+               {
+                       ParseChildrenAttribute pca = new ParseChildrenAttribute (typeof (string));
+                       Assert.IsFalse (pca.ChildrenAsProperties, "ChildrenAsProperties");
+                       Assert.AreEqual (String.Empty, pca.DefaultProperty, "DefaultProperty");
+                       Assert.IsTrue (pca.Equals (pca), "Equals");
+                       Assert.IsFalse (pca.IsDefaultAttribute (), "IsDefaultAttribute");
+                       Assert.IsTrue (pca.GetHashCode () != 0, "GetHashCode"); // likely
+                       Assert.AreEqual (typeof (string), pca.ChildControlType, "ChildControlType");
+               }
+#endif
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Static_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (ParseChildrenAttribute.Default, "Default");
+#if NET_2_0
+                       Assert.IsNotNull (ParseChildrenAttribute.ParseAsChildren, "ParseAsChildren");
+                       Assert.IsNotNull (ParseChildrenAttribute.ParseAsProperties, "ParseAsProperties");
+#endif
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ParseChildrenAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/PartialCachingAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/PartialCachingAttributeCas.cs
new file mode 100644 (file)
index 0000000..214e440
--- /dev/null
@@ -0,0 +1,118 @@
+//
+// PartialCachingAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.PartialCachingAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PartialCachingAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor1_Deny_Unrestricted ()
+               {
+                       PartialCachingAttribute pca = new PartialCachingAttribute (Int32.MinValue);
+                       Assert.AreEqual (Int32.MinValue, pca.Duration, "Duration");
+                       Assert.IsNull (pca.VaryByControls, "VaryByControls");
+                       Assert.IsNull (pca.VaryByCustom, "VaryByCustom");
+                       Assert.IsNull (pca.VaryByParams, "VaryByParams");
+#if NET_2_0
+                       Assert.IsNull (pca.SqlDependency, "SqlDependency");
+#endif
+                       Assert.IsFalse (pca.Shared, "Shared");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor4_Deny_Unrestricted ()
+               {
+                       PartialCachingAttribute pca = new PartialCachingAttribute (Int32.MaxValue, "1", "2", "3");
+                       Assert.AreEqual (Int32.MaxValue, pca.Duration, "Duration");
+                       Assert.AreEqual ("2", pca.VaryByControls, "VaryByControls");
+                       Assert.AreEqual ("3", pca.VaryByCustom, "VaryByCustom");
+                       Assert.AreEqual ("1", pca.VaryByParams, "VaryByParams");
+#if NET_2_0
+                       Assert.IsNull (pca.SqlDependency, "SqlDependency");
+#endif
+                       Assert.IsFalse (pca.Shared, "Shared");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor5_Deny_Unrestricted ()
+               {
+                       PartialCachingAttribute pca = new PartialCachingAttribute (0, "a", "b", "c", true);
+                       Assert.AreEqual (0, pca.Duration, "Duration");
+                       Assert.AreEqual ("b", pca.VaryByControls, "VaryByControls");
+                       Assert.AreEqual ("c", pca.VaryByCustom, "VaryByCustom");
+                       Assert.AreEqual ("a", pca.VaryByParams, "VaryByParams");
+#if NET_2_0
+                       Assert.IsNull (pca.SqlDependency, "SqlDependency");
+#endif
+                       Assert.IsTrue (pca.Shared, "Shared");
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor6_Deny_Unrestricted ()
+               {
+                       PartialCachingAttribute pca = new PartialCachingAttribute (0, "a", "b", "c", "sql", false);
+                       Assert.AreEqual (0, pca.Duration, "Duration");
+                       Assert.AreEqual ("b", pca.VaryByControls, "VaryByControls");
+                       Assert.AreEqual ("c", pca.VaryByCustom, "VaryByCustom");
+                       Assert.AreEqual ("a", pca.VaryByParams, "VaryByParams");
+                       Assert.AreEqual ("sql", pca.SqlDependency, "SqlDependency");
+                       Assert.IsFalse (pca.Shared, "Shared");
+               }
+#endif
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (int) });
+                       Assert.IsNotNull (ci, ".ctor(int)");
+                       return ci.Invoke (new object[1] { 0 });
+               }
+
+               public override Type Type {
+                       get { return typeof (PartialCachingAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/PersistChildrenAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/PersistChildrenAttributeCas.cs
new file mode 100644 (file)
index 0000000..9b3bce0
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// PersistChildrenAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.PersistChildrenAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PersistChildrenAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor1_Deny_Unrestricted ()
+               {
+                       PersistChildrenAttribute pca = new PersistChildrenAttribute (true);
+                       Assert.IsTrue (pca.Persist, "Persist");
+#if NET_2_0
+                       Assert.IsFalse (pca.UsesCustomPersistence, "UsesCustomPersistence");
+#endif
+                       Assert.IsTrue (pca.Equals (pca), "Equals");
+                       Assert.IsTrue (pca.IsDefaultAttribute (), "IsDefaultAttribute");
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor2_Deny_Unrestricted ()
+               {
+                       PersistChildrenAttribute pca = new PersistChildrenAttribute (false, true);
+                       Assert.IsFalse (pca.Persist, "Persist");
+                       Assert.IsTrue (pca.UsesCustomPersistence, "UsesCustomPersistence");
+                       Assert.IsTrue (pca.Equals (pca), "Equals");
+                       Assert.IsFalse (pca.IsDefaultAttribute (), "IsDefaultAttribute");
+               }
+#endif
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Static_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (PersistChildrenAttribute.Default, "Default");
+                       Assert.IsNotNull (PersistChildrenAttribute.Yes, "Yes");
+                       Assert.IsNotNull (PersistChildrenAttribute.No, "No");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (bool) });
+                       Assert.IsNotNull (ci, ".ctor(bool)");
+                       return ci.Invoke (new object[1] { false });
+               }
+
+               public override Type Type {
+                       get { return typeof (PersistChildrenAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/PersistenceModeAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/PersistenceModeAttributeCas.cs
new file mode 100644 (file)
index 0000000..578e4b1
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// PersistenceModeAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.PersistenceModeAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PersistenceModeAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       PersistenceModeAttribute pma = new PersistenceModeAttribute (PersistenceMode.Attribute);
+                       Assert.AreEqual (PersistenceMode.Attribute, pma.Mode, "Mode");
+                       Assert.IsTrue (pma.Equals (pma), "Equals");
+                       Assert.IsTrue (pma.IsDefaultAttribute (), "IsDefaultAttribute");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Static_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (PersistenceModeAttribute.Default, "Default");
+                       Assert.IsNotNull (PersistenceModeAttribute.Attribute, "Attribute");
+                       Assert.IsNotNull (PersistenceModeAttribute.EncodedInnerDefaultProperty, "EncodedInnerDefaultProperty");
+                       Assert.IsNotNull (PersistenceModeAttribute.InnerDefaultProperty, "InnerDefaultProperty");
+                       Assert.IsNotNull (PersistenceModeAttribute.InnerProperty, "InnerProperty");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (PersistenceMode) });
+                       Assert.IsNotNull (ci, ".ctor(PersistenceMode)");
+                       return ci.Invoke (new object[1] { PersistenceMode.Attribute });
+               }
+
+               public override Type Type {
+                       get { return typeof (PersistenceModeAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/PropertyConverterCas.cs b/mcs/class/System.Web/Test/System.Web.UI/PropertyConverterCas.cs
new file mode 100644 (file)
index 0000000..545f569
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// PropertyConverterCas.cs 
+//     - CAS unit tests for System.Web.UI.PropertyConverter
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class PropertyConverterCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void StaticMethods_Deny_Unrestricted ()
+               {
+                       Assert.AreEqual (SecurityAction.Demand, PropertyConverter.EnumFromString (typeof (SecurityAction), "Demand"), "EnumFromString");
+                       Assert.AreEqual ("Demand", PropertyConverter.EnumToString (typeof (SecurityAction), SecurityAction.Demand), "EnumToString");
+                       Assert.AreEqual (String.Empty, PropertyConverter.ObjectFromString (typeof (string), null, String.Empty), "ObjectFromString");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // static class 2.0 / no public ctor before (1.x)
+                       MethodInfo mi = this.Type.GetMethod ("EnumToString");
+                       Assert.IsNotNull (mi, "EnumToString");
+                       return mi.Invoke (null, new object[2] { typeof(SecurityAction), SecurityAction.Demand });
+               }
+
+               public override Type Type {
+                       get { return typeof (PropertyConverter); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/RootBuilderCas.cs b/mcs/class/System.Web/Test/System.Web.UI/RootBuilderCas.cs
new file mode 100644 (file)
index 0000000..2d98836
--- /dev/null
@@ -0,0 +1,87 @@
+//
+// RootBuilderCas.cs - CAS unit tests for System.Web.UI.RootBuilder
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class RootBuilderCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor1_Deny_Unrestricted ()
+               {
+                       RootBuilder rb = new RootBuilder (new PageParser ());
+                       try {
+                               rb.GetChildControlType (null, null);
+                       }
+                       catch (ArgumentNullException) {
+                               // mono and ms 1.x
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 - more likely parameters don't change this result
+                       }
+#if NET_2_0
+                       Assert.IsNotNull (rb.BuiltObjects, "BuiltObjects");
+#endif
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor0_Deny_Unrestricted ()
+               {
+                       RootBuilder rb = new RootBuilder ();
+                       Assert.IsNotNull (rb.BuiltObjects, "BuiltObjects");
+               }
+#endif
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (TemplateParser) });
+                       Assert.IsNotNull (ci, ".ctor(TemplateParser)");
+                       return ci.Invoke (new object[1] { null });
+               }
+
+               public override Type Type {
+                       get { return typeof (RootBuilder); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/StateBagCas.cs b/mcs/class/System.Web/Test/System.Web.UI/StateBagCas.cs
new file mode 100644 (file)
index 0000000..371fbfd
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// StateBagCas.cs - CAS unit tests for System.Web.UI.StateBag
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class StateBagCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       StateBag bag = new StateBag (true);
+                       Assert.IsNotNull (bag.Add ("key", "value"), "Add");
+                       Assert.AreEqual (1, bag.Count, "Count");
+                       Assert.IsNotNull (bag.GetEnumerator (), "GetEnumerator");
+                       bag.SetItemDirty ("key", true);
+                       Assert.IsTrue (bag.IsItemDirty ("key"), "IsItemDirty");
+                       bag.Remove ("key");
+
+                       bag.Clear ();
+                       bag["key"] = "value";
+                       Assert.IsNotNull (bag["key"], "this[string]");
+                       Assert.IsNotNull (bag.Keys, "Keys");
+                       Assert.IsNotNull (bag.Values, "Values");
+#if NET_2_0
+                       bag.SetDirty (true);
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void IStateManager_Deny_Unrestricted ()
+               {
+                       IStateManager sm = new StateBag ();
+                       Assert.IsFalse (sm.IsTrackingViewState, "IsTrackingViewState");
+                       object state = sm.SaveViewState ();
+                       sm.LoadViewState (state);
+                       sm.TrackViewState ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void IDictionary_Deny_Unrestricted ()
+               {
+                       IDictionary d = new StateBag ();
+                       d.Add ("key", "value");
+                       Assert.IsTrue (d.Contains ("key"), "Contains");
+                       Assert.AreEqual (1, d.Count, "Count");
+                       d.Remove ("key");
+                       d["key"] = "value";
+                       Assert.AreEqual ("value", d["key"], "this[string]");
+                       d.Clear ();
+                       Assert.IsFalse (d.IsFixedSize, "IsFixedSize");
+                       Assert.IsFalse (d.IsReadOnly, "IsReadOnly");
+
+                       ICollection c = (d as ICollection);
+                       Assert.IsFalse (c.IsSynchronized, "IsSynchronized");
+                       Assert.IsNotNull (c.SyncRoot, "SyncRoot");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (StateBag); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/StateItemCas.cs b/mcs/class/System.Web/Test/System.Web.UI/StateItemCas.cs
new file mode 100644 (file)
index 0000000..6c343c6
--- /dev/null
@@ -0,0 +1,74 @@
+//
+// StateItemCas.cs - CAS unit tests for System.Web.UI.StateItem
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class StateItemCas : AspNetHostingMinimal {
+
+               private StateItem item;
+
+               [TestFixtureSetUp]
+               public void FixtureSetup ()
+               {
+                       item = new StateBag ().Add ("key", "value");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       Assert.IsFalse (item.IsDirty, "IsDirty");
+                       item.IsDirty = true;
+                       Assert.AreEqual ("value", item.Value);
+                       item.Value = null;
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       MethodInfo mi = this.Type.GetProperty ("IsDirty").GetGetMethod ();
+                       Assert.IsNotNull (mi, ".ctor(TemplateParser)");
+                       return mi.Invoke (item, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (StateItem); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/StaticPartialCachingControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI/StaticPartialCachingControlCas.cs
new file mode 100644 (file)
index 0000000..2859177
--- /dev/null
@@ -0,0 +1,74 @@
+//
+// StaticPartialCachingControlCas.cs 
+//     - CAS unit tests for System.Web.UI.StaticPartialCachingControl
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class StaticPartialCachingControlCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Deny_Unrestricted ()
+               {
+                       new StaticPartialCachingControl (null, null, 0, null, null, null, null);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void BuildCachedControl_Deny_Unrestricted ()
+               {
+                       Control parent = new Control ();
+                       StaticPartialCachingControl.BuildCachedControl (parent, null, null, 0, null, null, null, null);
+                       Assert.AreEqual (1, parent.Controls.Count, "Count");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[7] { typeof (string), typeof (string),
+                               typeof (int), typeof (string), typeof (string), typeof (string), typeof (BuildMethod) });
+                       Assert.IsNotNull (ci, ".ctor(2xstring,int,3xstring,BuildMethod)");
+                       return ci.Invoke (new object[7] { null, null, null, null, null, null, null });
+               }
+
+               public override Type Type {
+                       get { return typeof (StaticPartialCachingControl); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/TagPrefixAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/TagPrefixAttributeCas.cs
new file mode 100644 (file)
index 0000000..95c24f8
--- /dev/null
@@ -0,0 +1,66 @@
+//
+// TagPrefixAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.TagPrefixAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class TagPrefixAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       TagPrefixAttribute tpa = new TagPrefixAttribute ("namespace", "prefix");
+                       Assert.AreEqual ("namespace", tpa.NamespaceName, "NamespaceName");
+                       Assert.AreEqual ("prefix", tpa.TagPrefix, "TagPrefix");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[2] { typeof (string), typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(string,string)");
+                       return ci.Invoke (new object[2] { "namespace", "prefix" });
+               }
+
+               public override Type Type {
+                       get { return typeof (TagPrefixAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/TemplateBuilderCas.cs b/mcs/class/System.Web/Test/System.Web.UI/TemplateBuilderCas.cs
new file mode 100644 (file)
index 0000000..cd0c362
--- /dev/null
@@ -0,0 +1,65 @@
+//
+// TemplateBuilderCas.cs - CAS unit tests for System.Web.UI.TemplateBuilder
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class TemplateBuilderCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       TemplateBuilder tb = new TemplateBuilder ();
+                       tb.Text = "mono";
+                       Assert.AreEqual ("mono", tb.Text, "Text");
+                       tb.InstantiateIn (new Control ());
+                       tb.Init (new PageParser (), new ControlBuilder (), null, null, null, null);
+                       Assert.IsFalse (tb.NeedsTagInnerText (), "NeedsTagInnerText");
+                       tb.SetTagInnerText ("mono");
+#if NET_2_0
+                       Assert.IsNotNull (tb.BuildObject (), "BuildObject");
+#endif
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (TemplateBuilder); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/TemplateContainerAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/TemplateContainerAttributeCas.cs
new file mode 100644 (file)
index 0000000..7b99796
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// TemplateContainerAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.TemplateContainerAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.ComponentModel;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [NUnit.Framework.Category ("CAS")]
+       public class TemplateContainerAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor1_Deny_Unrestricted ()
+               {
+                       TemplateContainerAttribute tca = new TemplateContainerAttribute (null);
+                       Assert.IsNull (tca.ContainerType, "ContainerType");
+#if NET_2_0
+                       Assert.AreEqual (BindingDirection.OneWay, tca.BindingDirection, "BindingDirection");
+#endif
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor2_Deny_Unrestricted ()
+               {
+                       TemplateContainerAttribute tca = new TemplateContainerAttribute (typeof (string), BindingDirection.TwoWay);
+                       Assert.AreEqual (typeof (string), tca.ContainerType, "ContainerType");
+                       Assert.AreEqual (BindingDirection.TwoWay, tca.BindingDirection, "BindingDirection");
+               }
+#endif
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (Type) });
+                       Assert.IsNotNull (ci, ".ctor(Type)");
+                       return ci.Invoke (new object[1] { null });
+               }
+
+               public override Type Type {
+                       get { return typeof (TemplateContainerAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/TemplateControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI/TemplateControlCas.cs
new file mode 100644 (file)
index 0000000..c21cc2e
--- /dev/null
@@ -0,0 +1,150 @@
+//
+// TemplateControlCas.cs - CAS unit tests for System.Web.UI.TemplateControl
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       class NonAbstractTemplateControl : TemplateControl {
+
+               public NonAbstractTemplateControl ()
+               {
+               }
+       }
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class TemplateControlCas {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if NET_2_0
+               [ExpectedException (typeof (ArgumentNullException))]
+#else
+               [ExpectedException (typeof (HttpException))]
+#endif
+               public void LoadControl_Deny_Unrestricted ()
+               {
+                       NonAbstractTemplateControl tc = new NonAbstractTemplateControl ();
+                       tc.LoadControl (null);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if NET_2_0
+               [ExpectedException (typeof (ArgumentNullException))]
+#else
+               [ExpectedException (typeof (HttpException))]
+#endif
+               public void LoadTemplate_Deny_Unrestricted ()
+               {
+                       NonAbstractTemplateControl tc = new NonAbstractTemplateControl ();
+                       tc.LoadTemplate (null);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ParseControl_Deny_Unrestricted ()
+               {
+                       NonAbstractTemplateControl tc = new NonAbstractTemplateControl ();
+                       try {
+                               tc.ParseControl (null);
+                       }
+                       catch (NullReferenceException) {
+#if NET_2_0
+                               throw;
+#else
+                               Assert.Ignore ("NRE");
+#endif
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ReadStringResource_Deny_Unrestricted ()
+               {
+                       try {
+                               TemplateControl.ReadStringResource (null);
+                       }
+                       catch (TypeInitializationException) {
+#if NET_2_0
+                               Assert.Ignore ("exception during initialization");
+#else
+                               throw;
+#endif
+                       }
+               }
+
+               private void Handler (object sender, EventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Events_Deny_Unrestricted ()
+               {
+                       NonAbstractTemplateControl tc = new NonAbstractTemplateControl ();
+                       tc.AbortTransaction += new EventHandler (Handler);
+                       tc.CommitTransaction += new EventHandler (Handler);
+                       tc.Error += new EventHandler (Handler);
+
+                       tc.AbortTransaction -= new EventHandler (Handler);
+                       tc.CommitTransaction -= new EventHandler (Handler);
+                       tc.Error -= new EventHandler (Handler);
+               }
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (TypeInitializationException))]
+               public void IFilterResolutionService_Deny_Unrestricted ()
+               {
+                       IFilterResolutionService frs = new NonAbstractTemplateControl ();
+                       try {
+                               Assert.AreEqual (0, frs.CompareFilters (String.Empty, String.Empty), "CompareFilters");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       try {
+                               Assert.IsFalse (frs.EvaluateFilter (String.Empty), "EvaluateFilter");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+#endif
+       }
+}
index 41be7173acbda48a00b3ac24413740a39cc29914..235d01c89b0c91f863ed20d8840d74a8ca3e7ecb 100644 (file)
@@ -45,7 +45,6 @@ namespace MonoTests.System.Web.UI
                UrlPropertyAttribute upa1;
                UrlPropertyAttribute upa2;
                string filter;
-               UrlTypes urlTypes;
 
                [TearDown]
                public void TearDown () {}
@@ -54,11 +53,9 @@ namespace MonoTests.System.Web.UI
                public void SetUp ()            
                {
                        filter = "filter";
-                       urlTypes = UrlTypes.DocRelative;
                        upa = new UrlPropertyAttribute ();
                        upa1 = new UrlPropertyAttribute (filter);
                        upa2 = new UrlPropertyAttribute (filter);
-                       upa2.AllowedTypes = urlTypes;
                }
 
                [Test]
@@ -69,19 +66,6 @@ namespace MonoTests.System.Web.UI
                        Assert.AreEqual (upa2.Filter, filter, "Filter#3");
                }
 
-               [Test]
-               public void TestAllowedTypes ()
-               {
-                       UrlTypes types = UrlTypes.Absolute |
-                                       UrlTypes.AppRelative |
-                                       UrlTypes.DocRelative |
-                                       UrlTypes.RootRelative;
-
-                       Assert.AreEqual (upa.AllowedTypes, types, "Types#1");
-                       Assert.AreEqual (upa1.AllowedTypes, types, "Types#2");
-                       Assert.AreEqual (upa2.AllowedTypes, urlTypes, "Types#3");
-               }
-
                [Test]
                public void TestGetHashCode ()
                {
@@ -99,14 +83,6 @@ namespace MonoTests.System.Web.UI
                        //Assert.IsTrue (upa.Equals (upa1), "Equals#2");
 
                        Assert.IsFalse (upa1.Equals (upa2), "Equals#3");
-                       
-                       upa1 = new UrlPropertyAttribute ("sanjay");
-                       upa1.AllowedTypes = UrlTypes.Absolute;
-                       Assert.IsFalse (upa2.Equals (upa1), "Equals#4");
-                       upa1 = new UrlPropertyAttribute ("sanjay");
-                       upa1.AllowedTypes = UrlTypes.DocRelative;
-                       //Assert.IsTrue (upa2.Equals (upa1), "Equals#5");
-
                }
                        
        }
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ToolboxDataAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ToolboxDataAttributeCas.cs
new file mode 100644 (file)
index 0000000..d4a2fe6
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// ToolboxDataAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.ToolboxDataAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ToolboxDataAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ToolboxDataAttribute tda = new ToolboxDataAttribute (null);
+                       Assert.IsNull (tda.Data, "Data");
+                       Assert.IsTrue (tda.Equals (tda), "Equals");
+                       Assert.IsFalse (tda.GetHashCode () == ToolboxDataAttribute.Default.GetHashCode (), "GetHashCode");
+#if NET_2_0
+                       // unexpected result as tda hash code is different from default
+                       // seems that null and String.Empty are both considered defaults...
+                       Assert.IsTrue (tda.IsDefaultAttribute (), "IsDefaultAttribute");
+#else
+                       Assert.IsFalse (tda.IsDefaultAttribute (), "IsDefaultAttribute");
+#endif
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(string)");
+                       return ci.Invoke (new object[1] { String.Empty });
+               }
+
+               public override Type Type {
+                       get { return typeof (ToolboxDataAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/TripletCas.cs b/mcs/class/System.Web/Test/System.Web.UI/TripletCas.cs
new file mode 100644 (file)
index 0000000..7c3a42d
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// TripletCas.cs - CAS unit tests for System.Web.UI.Triplet
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class TripletCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor0_Deny_Unrestricted ()
+               {
+                       Triplet t = new Triplet ();
+                       Assert.IsNull (t.First, "First");
+                       Assert.IsNull (t.Second, "Second");
+                       Assert.IsNull (t.Third, "Third");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor2_Deny_Unrestricted ()
+               {
+                       Triplet t = new Triplet (String.Empty, String.Empty);
+                       Assert.IsNotNull (t.First, "First");
+                       Assert.IsNotNull (t.Second, "Second");
+                       Assert.IsNull (t.Third, "Third");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Ctor3_Deny_Unrestricted ()
+               {
+                       Triplet t = new Triplet (String.Empty, String.Empty, String.Empty);
+                       Assert.IsNotNull (t.First, "First");
+                       Assert.IsNotNull (t.Second, "Second");
+                       Assert.IsNotNull (t.Third, "Third");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (Triplet); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/UserControlCas.cs b/mcs/class/System.Web/Test/System.Web.UI/UserControlCas.cs
new file mode 100644 (file)
index 0000000..3e6fafb
--- /dev/null
@@ -0,0 +1,157 @@
+//
+// UserControlCas.cs 
+//     - CAS unit tests for System.Web.UI.UserControlCas
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class UserControlCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       UserControl uc = new UserControl ();
+                       try {
+                               Assert.IsNull (uc.Application, "Application");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+                       Assert.IsNotNull (uc.Attributes, "Attributes");
+                       try {
+                               Assert.IsNull (uc.Cache, "Cache");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+                       try {
+                               Assert.IsFalse (uc.IsPostBack, "IsPostBack");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+                       try {
+                               Assert.IsNull (uc.Request, "Request");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+                       try {
+                               Assert.IsNull (uc.Response, "Response");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+                       try {
+                               Assert.IsNull (uc.Server, "Server");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+                       try {
+                               Assert.IsNull (uc.Session, "Session");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+                       try {
+                               Assert.IsNull (uc.Trace, "Trace");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 2.0 rc
+                       }
+#if NET_2_0
+                       try {
+                               Assert.IsNotNull (uc.CachePolicy, "CachePolicy");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void IUserControlDesignerAccessor_Deny_Unrestricted ()
+               {
+                       IUserControlDesignerAccessor ucda = new UserControl ();
+                       ucda.InnerText = "mono";
+                       Assert.AreEqual ("mono", ucda.InnerText, "InnerText");
+                       ucda.TagName = "monkey";
+                       Assert.AreEqual ("monkey", ucda.TagName, "TagName");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void InitializeAsUserControl_Deny_Unrestricted ()
+               {
+                       UserControl uc = new UserControl ();
+                       try {
+                               uc.InitializeAsUserControl (new Page ());
+                       }
+                       catch (TypeInitializationException tie) {
+                               // 2.0 - error initializing HttpRuntime
+                               Console.WriteLine (tie.InnerException);
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void MapPath_Deny_Unrestricted ()
+               {
+                       new UserControl ().MapPath ("/");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void IAttributeAccessor_Deny_Unrestricted ()
+               {
+                       IAttributeAccessor aa = new UserControl ();
+                       Assert.IsNull (aa.GetAttribute (null));
+                       aa.SetAttribute ("name", "value");
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (UserControl); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/UserControlControlBuilderCas.cs b/mcs/class/System.Web/Test/System.Web.UI/UserControlControlBuilderCas.cs
new file mode 100644 (file)
index 0000000..0721113
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// UserControlControlBuilderCas.cs 
+//     - CAS unit tests for System.Web.UI.UserControlControlBuilder
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class UserControlControlBuilderCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       UserControlControlBuilder uccb = new UserControlControlBuilder ();
+                       try {
+                               Assert.IsFalse (uccb.NeedsTagInnerText (), "NeedsTagInnerText");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.1
+                       }
+                       uccb.SetTagInnerText ("mono");
+               }
+
+#if NET_2_0
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Minimal)]
+               [ExpectedException (typeof (SecurityException))]
+               public void BuildObject_Deny_Minimal ()
+               {
+                       new UserControlControlBuilder ().BuildObject ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Minimal)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void BuildObject_PermitOnly_Minimal ()
+               {
+                       new UserControlControlBuilder ().BuildObject ();
+               }
+#endif
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (UserControlControlBuilder); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ValidationPropertyAttributeCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ValidationPropertyAttributeCas.cs
new file mode 100644 (file)
index 0000000..99becc0
--- /dev/null
@@ -0,0 +1,65 @@
+//
+// ValidationPropertyAttributeCas.cs 
+//     - CAS unit tests for System.Web.UI.ValidationPropertyAttribute
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ValidationPropertyAttributeCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ValidationPropertyAttribute vpa = new ValidationPropertyAttribute (null);
+                       Assert.IsNull (vpa.Name, "Name");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(string)");
+                       return ci.Invoke (new object[1] { String.Empty });
+               }
+
+               public override Type Type {
+                       get { return typeof (ValidationPropertyAttribute); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ValidatorCollectionCas.cs b/mcs/class/System.Web/Test/System.Web.UI/ValidatorCollectionCas.cs
new file mode 100644 (file)
index 0000000..8d3f5fd
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// ValidatorCollectionCas.cs 
+//     - CAS unit tests for System.Web.UI.ValidatorCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace MonoCasTests.System.Web.UI {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ValidatorCollectionCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       ValidatorCollection vc = new ValidatorCollection ();
+
+                       Assert.AreEqual (0, vc.Count, "Count");
+                       Assert.IsFalse (vc.IsReadOnly, "IsReadOnly");
+                       Assert.IsFalse (vc.IsSynchronized, "IsSynchronized");
+                       Assert.IsNotNull (vc.SyncRoot, "SyncRoot");
+
+                       vc.Add (null);
+                       Assert.IsNull (vc[0], "this[int]");
+                       Assert.IsTrue (vc.Contains (null), "Contains");
+                       Assert.IsNotNull (vc.GetEnumerator (), "GetEnumerator");
+                       vc.Remove (null);
+
+                       IValidator validator = new CustomValidator ();
+                       vc.Add (validator);
+                       vc.CopyTo (new IValidator[1], 0);
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ValidatorCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Util/ChangeLog b/mcs/class/System.Web/Test/System.Web.Util/ChangeLog
new file mode 100644 (file)
index 0000000..e0dc483
--- /dev/null
@@ -0,0 +1,4 @@
+2005-09-11  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * TransactionsCas.cs: New. CAS unit for Transactions.
+       * WorkItemCas.cs: New. CAS unit for Transactions.
diff --git a/mcs/class/System.Web/Test/System.Web.Util/TransactionsCas.cs b/mcs/class/System.Web/Test/System.Web.Util/TransactionsCas.cs
new file mode 100755 (executable)
index 0000000..54ca23a
--- /dev/null
@@ -0,0 +1,98 @@
+//
+// TransactionsCas.cs - CAS unit tests for System.Web.Util.Transactions
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.EnterpriseServices;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.Util;
+
+namespace MonoCasTests.System.Web.Util {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class TransactionsCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Deny_Unrestricted ()
+               {
+                       new Transactions ();
+               }
+
+               private void Callback ()
+               {
+               }
+
+               [Test]
+               // LAMESPEC - documented as AspNetHostingPermission, Level Medium
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void InvokeTransacted2_Deny_Unrestricted ()
+               {
+                       try {
+                               Transactions.InvokeTransacted (new TransactedCallback (Callback), TransactionOption.Required);
+                       }
+#if ONLY_1_1
+                       catch (TypeInitializationException) {
+                               // under 1.x, this _can_ trigger initialization of HttpRuntime
+                       }
+#endif
+                       catch (PlatformNotSupportedException) {
+                               // Mono and Windows prior to NT
+                       }
+               }
+
+               [Test]
+               // LAMESPEC - documented as AspNetHostingPermission, Level Medium
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void InvokeTransacted3_Deny_Unrestricted ()
+               {
+                       try {
+                               bool aborted = false;
+                               Transactions.InvokeTransacted (new TransactedCallback (Callback), TransactionOption.Required, ref aborted);
+                       }
+#if ONLY_1_1
+                       catch (TypeInitializationException) {
+                               // under 1.x, this _can_ trigger initialization of HttpRuntime
+                       }
+#endif
+                       catch (PlatformNotSupportedException) {
+                               // Mono and Windows prior to NT
+                       }
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (Transactions); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Util/WorkItemCas.cs b/mcs/class/System.Web/Test/System.Web.Util/WorkItemCas.cs
new file mode 100755 (executable)
index 0000000..7975193
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// WorkItemCas.cs - CAS unit tests for System.Web.Util.WorkItem
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web.Util;
+
+namespace MonoCasTests.System.Web.Util {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class WorkItemCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Deny_Unrestricted ()
+               {
+                       new WorkItem ();
+               }
+
+               private void Callback ()
+               {
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Post_Deny_UnmanagedCode ()
+               {
+                       WorkItem.Post (new WorkItemCallback (Callback));
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Post_PermitOnly_UnmanagedCode ()
+               {
+                       try {
+                               WorkItem.Post (new WorkItemCallback (Callback));
+                       }
+                       catch (PlatformNotSupportedException) {
+                               // Mono and Windows prior to NT
+                       }
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (WorkItem); }
+               }
+       }
+}
index 344e1e3491ae816f3eeac81ab99266db4e399575..3374e42bdda1deabfffd87d7fb99874232357b43 100644 (file)
@@ -1,3 +1,39 @@
+2005-09-14  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpWorkerRequestTest.cs: Add test cases for default values of new
+       2.0 APIs.
+
+2005-09-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * HttpApplicationCas.cs: New. CAS unit tests.
+       * HttpApplicationStateCas.cs: New. CAS unit tests.
+       * HttpBrowserCapabilitiesCas.cs: New. CAS unit tests.
+       * HttpCachePolicyCas.cs: New. CAS unit tests.
+       * HttpCacheVaryByHeadersCas.cs: New. CAS unit tests.
+       * HttpCacheVaryByParamsCas.cs: New. CAS unit tests.
+       * HttpClientCertificateCas.cs: New. CAS unit tests.
+       * HttpCompileExceptionCas.cs: New. CAS unit tests.
+       * HttpContextCas.cs: Add method/propertie CAS tests cases.
+       * HttpCookieCas.cs: New. CAS unit tests.
+       * HttpCookieCollectionCas.cs: New. CAS unit tests.
+       * HttpExceptionCas.cs: New. CAS unit tests.
+       * HttpFileCollectionCas.cs: New. CAS unit tests.
+       * HttpModuleCollectionCas.cs: New. CAS unit tests.
+       * HttpParseExceptionCas.cs: New. CAS unit tests.
+       * HttpRequestCas.cs: New. CAS unit tests.
+       * HttpRequestValidationExceptionCas.cs: New. CAS unit tests.
+       * HttpResponseCas.cs: New. CAS unit tests.
+       * HttpRuntimeCas.cs: New. CAS unit tests.
+       * HttpServerUtilityCas.cs: New. CAS unit tests.
+       * HttpStaticObjectsCollectionCas.cs: New. CAS unit tests.
+       * HttpUnhandledExceptionCas.cs: New. CAS unit tests.
+       * HttpUtilityCas.cs: New. CAS unit tests.
+       * HttpWorkerRequestCas.cs: New. CAS unit tests.
+       * HttpWriterCas.cs: New. CAS unit tests.
+       * ProcessInfoCas.cs: New. CAS unit tests.
+       * ProcessModelInfoCas.cs: New. CAS unit tests.
+       * TraceContextCas.cs: New. CAS unit tests.
+
 2005-09-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * HttpContextCas.cs: New. CAS unit tests for SkipAuthorization and
diff --git a/mcs/class/System.Web/Test/System.Web/HttpApplicationCas.cs b/mcs/class/System.Web/Test/System.Web/HttpApplicationCas.cs
new file mode 100755 (executable)
index 0000000..662d045
--- /dev/null
@@ -0,0 +1,251 @@
+//
+// HttpApplicationCas.cs - CAS unit tests for System.Web.HttpApplication
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpApplicationCas : AspNetHostingMinimal {
+
+               private void Handler (object sender, EventArgs e)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       // FIXME
+                       if (app.Application == null) {
+                               // ms 1.x/2.0
+                               Assert.IsNull (app.Application, "Application");
+                       } else {
+                               // mono
+                               Assert.IsNotNull (app.Application, "Application");
+                       }
+                       Assert.IsNull (app.Context, "Context");
+                       Assert.IsNotNull (app.Server, "Server");
+                       Assert.IsNull (app.Site, "Site");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Events_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       app.Disposed += new EventHandler (Handler);
+                       app.Error += new EventHandler (Handler);
+                       app.PreSendRequestContent += new EventHandler (Handler);
+                       app.PreSendRequestHeaders += new EventHandler (Handler);
+                       app.AcquireRequestState += new EventHandler (Handler);
+                       app.AuthenticateRequest += new EventHandler (Handler);
+                       app.AuthorizeRequest += new EventHandler (Handler);
+                       app.BeginRequest += new EventHandler (Handler);
+                       app.EndRequest += new EventHandler (Handler);
+                       app.PostRequestHandlerExecute += new EventHandler (Handler);
+                       app.PreRequestHandlerExecute += new EventHandler (Handler);
+                       app.ReleaseRequestState += new EventHandler (Handler);
+                       app.ResolveRequestCache += new EventHandler (Handler);
+                       app.UpdateRequestCache += new EventHandler (Handler);
+
+                       app.AddOnAcquireRequestStateAsync (null, null);
+                       app.AddOnAuthenticateRequestAsync (null, null);
+                       app.AddOnAuthorizeRequestAsync (null, null);
+                       app.AddOnBeginRequestAsync (null, null);
+                       app.AddOnEndRequestAsync (null, null);
+                       app.AddOnPostRequestHandlerExecuteAsync (null, null);
+                       app.AddOnPreRequestHandlerExecuteAsync (null, null);
+                       app.AddOnReleaseRequestStateAsync (null, null);
+                       app.AddOnResolveRequestCacheAsync (null, null);
+                       app.AddOnUpdateRequestCacheAsync (null, null);
+
+                       app.Disposed -= new EventHandler (Handler);
+                       app.Error -= new EventHandler (Handler);
+                       app.PreSendRequestContent -= new EventHandler (Handler);
+                       app.PreSendRequestHeaders -= new EventHandler (Handler);
+                       app.AcquireRequestState -= new EventHandler (Handler);
+                       app.AuthenticateRequest -= new EventHandler (Handler);
+                       app.AuthorizeRequest -= new EventHandler (Handler);
+                       app.BeginRequest -= new EventHandler (Handler);
+                       app.EndRequest -= new EventHandler (Handler);
+                       app.PostRequestHandlerExecute -= new EventHandler (Handler);
+                       app.PreRequestHandlerExecute -= new EventHandler (Handler);
+                       app.ReleaseRequestState -= new EventHandler (Handler);
+                       app.ResolveRequestCache -= new EventHandler (Handler);
+                       app.UpdateRequestCache -= new EventHandler (Handler);
+#if NET_2_0
+                       app.PostAuthenticateRequest += new EventHandler (Handler);
+                       app.PostAuthorizeRequest += new EventHandler (Handler);
+                       app.PostResolveRequestCache += new EventHandler (Handler);
+                       app.PostMapRequestHandler += new EventHandler (Handler);
+                       app.PostAcquireRequestState += new EventHandler (Handler);
+                       app.PostReleaseRequestState += new EventHandler (Handler);
+                       app.PostUpdateRequestCache += new EventHandler (Handler);
+
+                       app.AddOnPostAuthenticateRequestAsync (null, null);
+                       app.AddOnPostAuthenticateRequestAsync (null, null, null);
+                       app.AddOnPostAuthorizeRequestAsync (null, null);
+                       app.AddOnPostAuthorizeRequestAsync (null, null, null);
+                       app.AddOnPostResolveRequestCacheAsync (null, null);
+                       app.AddOnPostResolveRequestCacheAsync (null, null, null);
+                       app.AddOnPostMapRequestHandlerAsync (null, null);
+                       app.AddOnPostMapRequestHandlerAsync (null, null, null);
+                       app.AddOnPostAcquireRequestStateAsync (null, null);
+                       app.AddOnPostAcquireRequestStateAsync (null, null, null);
+                       app.AddOnPostReleaseRequestStateAsync (null, null);
+                       app.AddOnPostReleaseRequestStateAsync (null, null, null);
+                       app.AddOnPostUpdateRequestCacheAsync (null, null);
+                       app.AddOnPostUpdateRequestCacheAsync (null, null, null);
+
+                       app.AddOnAcquireRequestStateAsync (null, null, null);
+                       app.AddOnAuthenticateRequestAsync (null, null, null);
+                       app.AddOnAuthorizeRequestAsync (null, null, null);
+                       app.AddOnBeginRequestAsync (null, null, null);
+                       app.AddOnEndRequestAsync (null, null, null);
+                       app.AddOnPostRequestHandlerExecuteAsync (null, null, null);
+                       app.AddOnPreRequestHandlerExecuteAsync (null, null, null);
+                       app.AddOnReleaseRequestStateAsync (null, null, null);
+                       app.AddOnResolveRequestCacheAsync (null, null, null);
+                       app.AddOnUpdateRequestCacheAsync (null, null, null);
+
+                       app.PostAuthenticateRequest -= new EventHandler (Handler);
+                       app.PostAuthorizeRequest -= new EventHandler (Handler);
+                       app.PostResolveRequestCache -= new EventHandler (Handler);
+                       app.PostMapRequestHandler -= new EventHandler (Handler);
+                       app.PostAcquireRequestState -= new EventHandler (Handler);
+                       app.PostReleaseRequestState -= new EventHandler (Handler);
+                       app.PostUpdateRequestCache -= new EventHandler (Handler);
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       app.CompleteRequest ();
+                       app.GetVaryByCustomString (null, String.Empty);
+                       app.Dispose ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Modules_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       Assert.IsNotNull (app.Modules, "Modules");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void Modules_PermitOnly_High ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       Assert.IsNotNull (app.Modules, "Modules");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Request_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       try {
+                               Assert.IsNotNull (app.Request, "Request");
+                       }
+                       catch (HttpException) {
+                               // mono, ms 2.0
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Response_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       try {
+                               Assert.IsNotNull (app.Response, "Response");
+                       }
+                       catch (HttpException) {
+                               // mono, ms 2.0
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Session_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       try {
+                               Assert.IsNotNull (app.Session, "Session");
+                       }
+                       catch (HttpException) {
+                               // mono, ms 2.0
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void User_Deny_Unrestricted ()
+               {
+                       HttpApplication app = new HttpApplication ();
+                       try {
+                               Assert.IsNull (app.User);
+                       }
+                       catch (HttpException) {
+                               // mono, ms 2.0
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x
+                       }
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpApplication); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpApplicationStateCas.cs b/mcs/class/System.Web/Test/System.Web/HttpApplicationStateCas.cs
new file mode 100644 (file)
index 0000000..63dd5f7
--- /dev/null
@@ -0,0 +1,99 @@
+//
+// HttpApplicationStateCas.cs 
+//     - CAS unit tests for System.Web.HttpApplicationStateCas
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpApplicationStateCas : AspNetHostingMinimal {
+
+               private HttpContext context;
+               private HttpApplicationState appstate;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // running at fulltrust
+                       context = new HttpContext (null);
+                       appstate = context.Application;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (appstate.AllKeys, "AllKeys");
+                       Assert.IsNotNull (appstate.Contents, "Contents");
+                       Assert.IsNotNull (appstate.Count, "Count");
+                       appstate["mono"] = "monkey";
+                       Assert.AreEqual ("monkey", appstate["mono"], "this[string]");
+                       Assert.AreEqual ("monkey", appstate[0], "this[int]");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       appstate.Add (String.Empty, String.Empty);
+                       Assert.IsNotNull (appstate.Get (String.Empty), "Get(string)");
+                       Assert.IsNotNull (appstate.Get (0), "Get(int)");
+                       Assert.IsNotNull (appstate.GetKey (0), "GetKey(int)");
+                       appstate.Remove (String.Empty);
+                       appstate.RemoveAll ();
+                       appstate.Set (String.Empty, String.Empty);
+                       appstate.RemoveAt (0);
+                       appstate.Lock ();
+                       appstate.UnLock ();
+                       appstate.Clear ();
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // there are no public ctor so we're taking a method that we know isn't protected
+                       // (by a Demand) and call it thru reflection so any linkdemand (on the class) will
+                       // be promoted to a Demand
+                       MethodInfo mi = this.Type.GetProperty ("AllKeys").GetGetMethod ();
+                       return mi.Invoke (appstate, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpApplicationState); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpBrowserCapabilitiesCas.cs b/mcs/class/System.Web/Test/System.Web/HttpBrowserCapabilitiesCas.cs
new file mode 100755 (executable)
index 0000000..a3bac3b
--- /dev/null
@@ -0,0 +1,159 @@
+//
+// HttpBrowserCapabilitiesCas.cs 
+//     - CAS unit tests for System.Web.HttpBrowserCapabilities
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace MonoCasTests.System.Web {
+
+       // note: this[string] is throwing NullReferenceException everywhere
+       // so we "remove" it from action (only for full demands)
+       class BoolHttpBrowserCapabilities : HttpBrowserCapabilities {
+
+               public override string this [string key] {
+                       get { return "true"; }
+               }
+       }
+
+       class StringHttpBrowserCapabilities : HttpBrowserCapabilities {
+
+               public override string this [string key] {
+                       get { return String.Empty; }
+               }
+       }
+
+       class NumericHttpBrowserCapabilities : HttpBrowserCapabilities {
+
+               public override string this [string key] {
+                       get { return "1"; }
+               }
+       }
+
+       class VersionHttpBrowserCapabilities : HttpBrowserCapabilities {
+
+               public override string this [string key] {
+                       get { return "1.2.3.4"; }
+               }
+       }
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpBrowserCapabilitiesCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void BoolProperties_Deny_Unrestricted ()
+               {
+                       HttpBrowserCapabilities cap = new BoolHttpBrowserCapabilities ();
+                       Assert.IsTrue (cap.ActiveXControls, "ActiveXControls");
+                       Assert.IsTrue (cap.AOL, "AOL");
+                       Assert.IsTrue (cap.BackgroundSounds, "BackgroundSounds");
+                       Assert.IsTrue (cap.Beta, "Beta");
+                       Assert.IsTrue (cap.CDF, "CDF");
+                       Assert.IsTrue (cap.Cookies, "Cookies");
+                       Assert.IsTrue (cap.Crawler, "Crawler");
+                       Assert.IsTrue (cap.Frames, "Frames");
+                       Assert.IsTrue (cap.JavaApplets, "JavaApplets");
+                       Assert.IsTrue (cap.JavaScript, "JavaScript");
+                       Assert.IsTrue (cap.Tables, "Tables");
+                       Assert.IsTrue (cap.VBScript, "VBScript");
+                       Assert.IsTrue (cap.Win16, "Win16");
+                       Assert.IsTrue (cap.Win32, "Win32");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void StringProperties_Deny_Unrestricted ()
+               {
+                       HttpBrowserCapabilities cap = new StringHttpBrowserCapabilities ();
+                       Assert.IsNotNull (cap.Browser, "Browser");
+#if NET_2_0
+                       Assert.IsNull (cap.Browsers, "Browsers");
+#endif
+                       Assert.IsNotNull (cap.Platform, "Platform");
+                       Assert.IsNotNull (cap.Type, "Type");
+                       Assert.IsNotNull (cap.Version, "Version");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void TypeProperties_Deny_Unrestricted ()
+               {
+                       HttpBrowserCapabilities cap = new StringHttpBrowserCapabilities ();
+                       Assert.IsNull (cap.TagWriter, "TagWriter");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void NumericProperties_Deny_Unrestricted ()
+               {
+                       HttpBrowserCapabilities cap = new NumericHttpBrowserCapabilities ();
+                       // int
+                       Assert.AreEqual (1, cap.MajorVersion, "MajorVersion");
+                       // double
+                       Assert.AreEqual (1, cap.MinorVersion, "MinorVersion");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void VersionProperties_Deny_Unrestricted ()
+               {
+                       HttpBrowserCapabilities cap = new VersionHttpBrowserCapabilities ();
+                       Assert.IsNotNull (cap.ClrVersion, "ClrVersion");
+                       Assert.IsNotNull (cap.EcmaScriptVersion, "EcmaScriptVersion");
+                       Assert.IsNotNull (cap.MSDomVersion, "MSDomVersion");
+                       Assert.IsNotNull (cap.W3CDomVersion, "W3CDomVersion");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void GetClrVersions_Deny_Unrestricted ()
+               {
+                       HttpBrowserCapabilities cap = new StringHttpBrowserCapabilities ();
+#if NET_2_0
+                       Assert.IsNull (cap.GetClrVersions (), "GetClrVersions");
+#else
+                       Version[] versions = cap.GetClrVersions ();
+                       Assert.AreEqual (1, versions.Length, "GetClrVersions");
+                       Assert.AreEqual ("0.0", versions [0].ToString (), "Version[0]");
+#endif
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpBrowserCapabilities); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpCachePolicyCas.cs b/mcs/class/System.Web/Test/System.Web/HttpCachePolicyCas.cs
new file mode 100644 (file)
index 0000000..9b073dd
--- /dev/null
@@ -0,0 +1,147 @@
+//
+// HttpCachePolicyCas.cs - CAS unit tests for System.Web.HttpCachePolicyCas
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpCachePolicyCas : AspNetHostingMinimal {
+
+               private HttpResponse response;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       response = new HttpResponse (Console.Out);
+               }
+
+               private void Validate (HttpContext context, object data, ref HttpValidationStatus validationStatus)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HttpCachePolicy cache = response.Cache;
+                       Assert.IsNotNull (cache.VaryByHeaders, "VaryByHeaders");
+                       Assert.IsNotNull (cache.VaryByParams, "VaryByParams");
+                       cache.AddValidationCallback (new HttpCacheValidateHandler (Validate), null);
+                       cache.AppendCacheExtension ("mono");
+                       cache.SetCacheability (HttpCacheability.NoCache);
+                       cache.SetCacheability (HttpCacheability.NoCache, "mono");
+                       cache.SetETag ("etag");
+                       try {
+                               cache.SetETagFromFileDependencies ();
+                       }
+                       catch (TypeInitializationException) {
+                               // 1.1 tries to initialize HttpRuntime
+                       }
+                       catch (InvalidOperationException) {
+                               // expected
+                       }
+                       cache.SetExpires (DateTime.MinValue);
+                       cache.SetLastModified (DateTime.Now);
+                       try {
+                               cache.SetLastModifiedFromFileDependencies ();
+                       }
+                       catch (InvalidOperationException) {
+                               // expected
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       cache.SetMaxAge (TimeSpan.FromTicks (1000));
+                       try {
+                               cache.SetNoServerCaching ();
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       try {
+                               cache.SetNoStore ();
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       try {
+                               cache.SetNoTransforms ();
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       cache.SetProxyMaxAge (TimeSpan.FromTicks (2000));
+                       cache.SetRevalidation (HttpCacheRevalidation.None);
+                       cache.SetSlidingExpiration (true);
+                       try {
+                               cache.SetValidUntilExpires (true);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       cache.SetVaryByCustom ("custom");
+                       cache.SetAllowResponseInBrowserHistory (true);
+
+#if NET_2_0
+                       try {
+                               cache.SetOmitVaryStar (false);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       try {
+                               cache.SetDiskCacheable (false);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+#endif
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // no public ctor is available but we know that it's properties don't have any restrictions
+                       MethodInfo mi = this.Type.GetProperty ("VaryByHeaders").GetGetMethod ();
+                       Assert.IsNotNull (mi, "get_VaryByHeaders");
+                       return mi.Invoke (response.Cache, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpCachePolicy); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpCacheVaryByHeadersCas.cs b/mcs/class/System.Web/Test/System.Web/HttpCacheVaryByHeadersCas.cs
new file mode 100644 (file)
index 0000000..636b712
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// HttpCacheVaryByHeadersCas.cs 
+//     - CAS unit tests for System.Web.HttpCacheVaryByHeaders
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpCacheVaryByHeadersCas : AspNetHostingMinimal {
+
+               private HttpResponse response;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       response = new HttpResponse (Console.Out);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HttpCacheVaryByHeaders cache = response.Cache.VaryByHeaders;
+                       Assert.IsFalse (cache.AcceptTypes, "AcceptTypes");
+                       cache.AcceptTypes = true;
+                       Assert.IsFalse (cache.UserAgent, "UserAgent");
+                       cache.UserAgent = true;
+                       Assert.IsFalse (cache.UserCharSet, "UserCharSet");
+                       cache.UserCharSet = true;
+                       Assert.IsFalse (cache.UserLanguage, "UserLanguage");
+                       cache.UserLanguage = true;
+                       Assert.IsFalse (cache["mono"], "this[string]");
+                       cache["mono"] = true;
+                       cache.VaryByUnspecifiedParameters ();
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // no public ctor is available but we know that it's properties don't have any restrictions
+                       MethodInfo mi = this.Type.GetProperty ("AcceptTypes").GetGetMethod ();
+                       Assert.IsNotNull (mi, "get_AcceptTypes");
+                       return mi.Invoke (response.Cache.VaryByHeaders, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpCacheVaryByHeaders); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpCacheVaryByParamsCas.cs b/mcs/class/System.Web/Test/System.Web/HttpCacheVaryByParamsCas.cs
new file mode 100644 (file)
index 0000000..a44297e
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// HttpCacheVaryByParamsCas.cs 
+//     - CAS unit tests for System.Web.HttpCacheVaryByParams
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpCacheVaryByParamsCas : AspNetHostingMinimal {
+
+               private HttpResponse response;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       response = new HttpResponse (Console.Out);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HttpCacheVaryByParams cache = response.Cache.VaryByParams;
+                       Assert.IsFalse (cache.IgnoreParams, "IgnoreParams");
+                       cache.IgnoreParams = true;
+                       Assert.IsFalse (cache["mono"], "this[string]");
+                       cache["mono"] = true;
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // no public ctor is available but we know that it's properties don't have any restrictions
+                       MethodInfo mi = this.Type.GetProperty ("IgnoreParams").GetGetMethod ();
+                       Assert.IsNotNull (mi, "get_IgnoreParams");
+                       return mi.Invoke (response.Cache.VaryByParams, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpCacheVaryByParams); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpClientCertificateCas.cs b/mcs/class/System.Web/Test/System.Web/HttpClientCertificateCas.cs
new file mode 100644 (file)
index 0000000..c28ce3e
--- /dev/null
@@ -0,0 +1,101 @@
+//
+// HttpCacheVaryByParamsCas.cs 
+//     - CAS unit tests for System.Web.HttpCacheVaryByParams
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+#if ONLY_1_1
+       [Category ("NotDotNet")] // we don't want to duplicate this
+#endif
+       public class HttpClientCertificateCas : AspNetHostingMinimal {
+
+               private HttpClientCertificate hcc;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       HttpWorkerRequest hwr = new MonoTests.System.Web.MyHttpWorkerRequest ();
+                       hcc = new HttpContext (hwr).Request.ClientCertificate;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       // from HttpClientCertificateTest
+                       Assert.AreEqual (0, hcc.BinaryIssuer.Length, "BinaryIssuer");
+                       Assert.AreEqual (0, hcc.CertEncoding, "CertEncoding");
+                       Assert.AreEqual (0, hcc.Certificate.Length, "Certificate");
+                       Assert.AreEqual (String.Empty, hcc.Cookie, "Cookie");
+                       Assert.AreEqual (0, hcc.Flags, "Flags");
+                       Assert.IsFalse (hcc.IsPresent, "IsPresent");
+                       Assert.AreEqual (String.Empty, hcc.Issuer, "Issuer");
+                       Assert.IsTrue (hcc.IsValid, "IsValid");
+                       Assert.AreEqual (0, hcc.KeySize, "KeySize");
+                       Assert.AreEqual (0, hcc.PublicKey.Length, "PublicKey");
+                       Assert.AreEqual (0, hcc.SecretKeySize, "SecretKeySize");
+                       Assert.AreEqual (String.Empty, hcc.SerialNumber, "SerialNumber");
+                       Assert.AreEqual (String.Empty, hcc.ServerIssuer, "ServerIssuer");
+                       Assert.AreEqual (String.Empty, hcc.ServerSubject, "ServerSubject");
+                       Assert.AreEqual (String.Empty, hcc.Subject, "Subject");
+                       DateTime start = DateTime.Now.AddMinutes (1);
+                       DateTime end = start.AddMinutes (-2);
+                       // creation time - doesn't update (at least after first call)
+                       Assert.IsTrue (hcc.ValidFrom < start, "ValidFrom <");
+                       Assert.IsTrue (hcc.ValidFrom > end, "ValidFrom >");
+                       Assert.IsTrue (hcc.ValidUntil < start, "ValidUntil <");
+                       Assert.IsTrue (hcc.ValidUntil > end, "ValidUntil >");
+
+                       // NameValueCollection stuff
+                       Assert.AreEqual (0, hcc.Count, "Count");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // no public ctor is available but we know that it's properties don't have any restrictions
+                       MethodInfo mi = this.Type.GetProperty ("IsPresent").GetGetMethod ();
+                       Assert.IsNotNull (mi, "get_IsPresent");
+                       return mi.Invoke (hcc, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpClientCertificate); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpCompileExceptionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpCompileExceptionCas.cs
new file mode 100644 (file)
index 0000000..1ab04a6
--- /dev/null
@@ -0,0 +1,145 @@
+//
+// HttpCompileExceptionCas.cs 
+//     - CAS unit tests for System.Web.HttpCompileException
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+// Note: class exists in 1.x but has no public ctor
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom.Compiler;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpCompileExceptionCas : AspNetHostingMinimal {
+
+               private HttpCompileException hce;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       hce = new HttpCompileException ();
+               }
+
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor0_Deny_Unrestricted ()
+               {
+                       HttpCompileException e = new HttpCompileException ();
+                       Assert.IsNotNull (e.Message, "Message");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor1_Deny_Unrestricted ()
+               {
+                       HttpCompileException e = new HttpCompileException ("message");
+                       Assert.IsNotNull (e.Message, "Message");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2a_Deny_Unrestricted ()
+               {
+                       HttpCompileException e = new HttpCompileException (new CompilerResults (null), "source");
+                       Assert.IsNotNull (e.Message, "Message");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2b_Deny_Unrestricted ()
+               {
+                       HttpCompileException e = new HttpCompileException ("message", new Exception ());
+                       Assert.IsNotNull (e.Message, "Message");
+               }
+
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Results_Deny_High ()
+               {
+                       Assert.IsNull (hce.Results, "Results");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void Results_PermitOnly_High ()
+               {
+                       Assert.IsNull (hce.Results, "Results");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void SourceCode_Deny_High ()
+               {
+                       Assert.IsNull (hce.SourceCode, "SourceCode");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void SourceCode_PermitOnly_High ()
+               {
+                       Assert.IsNull (hce.SourceCode, "SourceCode");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SerializationFormatter = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetObjectData_Deny_SerializationFormatter ()
+               {
+                       hce.GetObjectData (null, new StreamingContext ());
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, SerializationFormatter = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void GetObjectData_PermitOnly_SerializationFormatter ()
+               {
+                       hce.GetObjectData (null, new StreamingContext ());
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpCompileException); }
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index cfcc02dfbe449c6b943ba33346e53333f8676495..188e7e95b544374ed4725dff0e898effa6a1c802 100644 (file)
 using NUnit.Framework;
 
 using System;
+using System.Globalization;
+using System.IO;
 using System.Reflection;
 using System.Security;
 using System.Security.Permissions;
 using System.Security.Principal;
 using System.Web;
+using System.Web.Handlers;
 
 namespace MonoCasTests.System.Web {
 
        [TestFixture]
        [Category ("CAS")]
-       public class HttpContextCas {
+       public class HttpContextCas : AspNetHostingMinimal {
 
                private HttpContext context;
+               private HttpRequest request;
+               private HttpResponse response;
+               private StringWriter sw;
+               private IHttpHandler handler;
 
                [TestFixtureSetUp]
                public void FixtureSetUp ()
                {
+                       // running at fulltrust
                        context = new HttpContext (null);
+                       request = new HttpRequest (String.Empty, "http://localhost/", String.Empty);
+                       sw = new StringWriter ();
+                       response = new HttpResponse (sw);
+                       handler = new TraceHandler ();
                }
 
-               [SetUp]
-               public void SetUp ()
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructors_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (new HttpContext (null), "ctor(HttpWorkerRequest)");
+                       Assert.IsNotNull (new HttpContext (request, response), "ctor(HttpRequest,HttpResponse)");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       // AllErrors value depends on the execution order
+                       Exception[] exceptions = context.AllErrors;
+                       Assert.IsNull (context.ApplicationInstance, "ApplicationInstance");
+                       context.ApplicationInstance = new HttpApplication ();
+                       Assert.IsNotNull (context.Cache, "Cache");
+                       Assert.IsNull (context.Error, "Error");
+                       Assert.IsNull (context.Handler, "Handler");
+                       context.Handler = handler;
+                       // FIXME: Mono returns false, MS returns true
+                       bool b = context.IsCustomErrorEnabled;
+                       Assert.IsFalse (context.IsDebuggingEnabled, "IsDebuggingEnabled");
+                       Assert.IsNotNull (context.Items, "Items");
+                       Assert.IsNotNull (context.Request, "Request");
+                       Assert.IsNotNull (context.Response, "Response");
+                       Assert.IsNotNull (context.Server, "Server");
+                       Assert.IsNull (context.Session, "Session");
+                       // note: only SkipAuthorization setter is protected
+                       Assert.IsFalse (context.SkipAuthorization, "SkipAuthorization");
+                       Assert.IsTrue (context.Timestamp < DateTime.MaxValue, "Timestamp");
+                       Assert.IsNotNull (context.Trace, "Trace");
+                       // note: only User setter is protected
+                       Assert.IsNull (context.User, "User");
+#if NET_2_0
+                       Assert.IsNotNull (context.Application, "Application");
+                       Assert.IsNotNull (context.CurrentHandler, "CurrentHandler");
+                       Assert.IsNull (context.PreviousHandler, "PreviousHandler");
+//                     Assert.IsNull (context.Profile, "Profile");
+#endif
+                       // static properties
+                       Assert.IsNull (HttpContext.Current, "Current");
+               }
+
+#if ONLY_1_1
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Application_Deny_UnmanagedCode ()
+               {
+                       Assert.IsNotNull (context.Application, "Application");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Application_PermitOnly_UnmanagedCode ()
                {
-                       if (!SecurityManager.SecurityEnabled)
-                               Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+                       Assert.IsNotNull (context.Application, "Application");
                }
+#endif
 
                [Test]
                [SecurityPermission (SecurityAction.Deny, ControlPrincipal = true)]
@@ -85,5 +151,79 @@ namespace MonoCasTests.System.Web {
                {
                        context.User = new GenericPrincipal (new GenericIdentity ("me"), null);
                }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       context.AddError (new Exception ());
+                       context.ClearError ();
+                       try {
+                               context.GetConfig (String.Empty);
+                       }
+                       catch (NullReferenceException) {
+                       }
+
+                       try {
+                               context.RewritePath (String.Empty);
+                       }
+                       catch (NullReferenceException) {
+                       }
+
+                       try {
+                               context.RewritePath (String.Empty, String.Empty, String.Empty);
+                       }
+                       catch (NullReferenceException) {
+                       }
+#if NET_2_0
+                       context.GetSection (String.Empty);
+
+                       try {
+                               context.RewritePath (String.Empty, true);
+                       }
+                       catch (NullReferenceException) {
+                       }
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void StaticMethods_Deny_Unrestricted ()
+               {
+                       HttpContext.GetAppConfig (String.Empty);
+#if NET_2_0
+                       HttpContext.GetGlobalResourceObject (String.Empty, String.Empty);
+                       HttpContext.GetGlobalResourceObject (String.Empty, String.Empty, CultureInfo.InvariantCulture);
+                       try {
+                               HttpContext.GetLocalResourceObject ("/", String.Empty);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       catch (NullReferenceException) {
+                       }
+                       try {
+                               HttpContext.GetLocalResourceObject ("/", String.Empty, CultureInfo.InvariantCulture);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       catch (NullReferenceException) {
+                       }
+#endif
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (HttpWorkerRequest) });
+                       Assert.IsNotNull (ci, ".ctor(HttpWorkerRequest)");
+                       return ci.Invoke (new object[1] { null });
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpContext); }
+               }
        }
 }
diff --git a/mcs/class/System.Web/Test/System.Web/HttpCookieCas.cs b/mcs/class/System.Web/Test/System.Web/HttpCookieCas.cs
new file mode 100644 (file)
index 0000000..567b1a7
--- /dev/null
@@ -0,0 +1,100 @@
+//
+// HttpCookieCas.cs - CAS unit tests for System.Web.HttpCookie
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpCookieCas : AspNetHostingMinimal {
+
+               private void GetSetProperties (HttpCookie biscuit)
+               {
+                       Assert.IsNull (biscuit.Domain, "Domain");
+                       biscuit.Domain = String.Empty;
+
+                       Assert.AreEqual (DateTime.MinValue, biscuit.Expires, "Domain");
+                       biscuit.Expires = DateTime.MaxValue;
+
+                       Assert.IsFalse (biscuit.HasKeys, "HasKeys");
+                       biscuit["mono"] = "monkey";
+                       Assert.AreEqual ("monkey", biscuit["mono"], "this");
+
+                       Assert.IsNull (biscuit.Name, "Name");
+                       biscuit.Name = "my";
+
+                       Assert.AreEqual ("/", biscuit.Path, "Path");
+                       biscuit.Path = String.Empty;
+
+                       Assert.IsFalse (biscuit.Secure, "Secure");
+                       biscuit.Secure = true;
+
+                       Assert.IsTrue (biscuit.Value.IndexOf ("mono=monkey") >= 0, "Value");
+                       biscuit.Value = "monkey=mono&singe=monkey";
+#if NET_2_0
+                       Assert.IsFalse (biscuit.HttpOnly, "HttpOnly");
+                       biscuit.HttpOnly = true;
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor1_Deny_Unrestricted ()
+               {
+                       HttpCookie biscuit = new HttpCookie (null);
+                       GetSetProperties (biscuit);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2_Deny_Unrestricted ()
+               {
+                       HttpCookie biscuit = new HttpCookie (null, String.Empty);
+                       GetSetProperties (biscuit);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(Type)");
+                       return ci.Invoke (new object[1] { null });
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpCookie); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpCookieCollectionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpCookieCollectionCas.cs
new file mode 100644 (file)
index 0000000..990a4b0
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// HttpCookieCollectionCas.cs 
+//     - CAS unit tests for System.Web.HttpCookieCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpCookieCollectionCas : AspNetHostingMinimal {
+
+               private HttpCookie biscuit;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       biscuit = new HttpCookie (null);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       HttpCookieCollection jar = new HttpCookieCollection ();
+                       jar.Add (biscuit);
+                       jar.CopyTo (new object[1], 0);
+                       Assert.IsNull (jar.GetKey (0), "GetKey");
+                       jar.Remove ("chocolat");
+                       jar.Set (biscuit);
+                       Assert.IsNotNull (jar.Get (0), "Get(int)");
+                       Assert.IsNull (jar.Get ("chocolat"), "Get(string)");
+                       Assert.IsNotNull (jar[0], "this[int]");
+                       Assert.IsNull (jar["chocolat"], "this[string]");
+                       Assert.AreEqual (1, jar.AllKeys.Length, "AllKeys");
+                       jar.Clear ();
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpCookieCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpExceptionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpExceptionCas.cs
new file mode 100644 (file)
index 0000000..1ad4eb9
--- /dev/null
@@ -0,0 +1,116 @@
+//
+// HttpExceptionCas.cs - CAS unit tests for System.Web.HttpException
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpExceptionCas : AspNetHostingMinimal {
+
+               private HttpException he;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       he = new HttpException ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void CreateFromLastError ()
+               {
+                       Assert.IsNotNull (HttpException.CreateFromLastError ("mono"));
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor0_Deny_Unrestricted ()
+               {
+                       HttpException e = new HttpException ();
+                       e.GetHtmlErrorMessage (); // null for ms, non-null for mono
+                       Assert.AreEqual (500, e.GetHttpCode (), "HttpCode");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor1_Deny_Unrestricted ()
+               {
+                       HttpException e = new HttpException ("message");
+                       e.GetHtmlErrorMessage (); // null for ms, non-null for mono
+                       Assert.AreEqual (500, e.GetHttpCode (), "HttpCode");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2a_Deny_Unrestricted ()
+               {
+                       HttpException e = new HttpException (501, "message");
+                       e.GetHtmlErrorMessage (); // null for ms, non-null for mono
+                       Assert.AreEqual (501, e.GetHttpCode (), "HttpCode");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2b_Deny_Unrestricted ()
+               {
+                       HttpException e = new HttpException ("message", new Exception ());
+                       e.GetHtmlErrorMessage (); // null for ms, non-null for mono
+                       Assert.AreEqual (500, e.GetHttpCode (), "HttpCode");
+               }
+#if NET_2_0
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SerializationFormatter = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetObjectData_Deny_SerializationFormatter ()
+               {
+                       he.GetObjectData (null, new StreamingContext ());
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, SerializationFormatter = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void GetObjectData_PermitOnly_SerializationFormatter ()
+               {
+                       he.GetObjectData (null, new StreamingContext ());
+               }
+#endif
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpException); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpFileCollectionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpFileCollectionCas.cs
new file mode 100644 (file)
index 0000000..28cb6e4
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// HttpFileCollectionCas.cs 
+//     - CAS unit tests for System.Web.HttpFileCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpFileCollectionCas : AspNetHostingMinimal {
+
+               private HttpFileCollection coll;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       coll = new HttpRequest (String.Empty, "http://localhost/", String.Empty).Files;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (coll.AllKeys, "AllKeys");
+                       coll.CopyTo (new object[0], 0);
+                       Assert.IsNull (coll.Get ("mono"), "Get(string)");
+                       Assert.IsNull (coll["mono"], "this[string]");
+                       try {
+                               Assert.IsNull (coll[0], "this[int]");
+                       }
+                       catch (ArgumentOutOfRangeException) {
+                               // normal (can't avoid it)
+                       }
+                       try {
+                               Assert.IsNull (coll.GetKey (0), "GetKey(int)");
+                       }
+                       catch (ArgumentOutOfRangeException) {
+                               // normal (can't avoid it)
+                       }
+                       try {
+                               Assert.IsNull (coll.Get (0), "Get(int)");
+                       }
+                       catch (ArgumentOutOfRangeException) {
+                               // normal (can't avoid it)
+                       }
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // no public ctor is available but we know that it's properties don't have any restrictions
+                       MethodInfo mi = this.Type.GetProperty ("AllKeys").GetGetMethod ();
+                       Assert.IsNotNull (mi, "get_AllKeys");
+                       return mi.Invoke (coll, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpFileCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpModuleCollectionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpModuleCollectionCas.cs
new file mode 100644 (file)
index 0000000..8b93046
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// HttpModuleCollectionCas.cs 
+//     - CAS unit tests for System.Web.HttpModuleCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpModuleCollectionCas : AspNetHostingMinimal {
+
+               private HttpModuleCollection coll;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       coll = new HttpApplication ().Modules;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (coll.AllKeys, "AllKeys");
+                       coll.CopyTo (new object[0], 0);
+                       Assert.IsNull (coll.Get ("mono"), "Get(string)");
+                       Assert.IsNull (coll["mono"], "this[string]");
+                       try {
+                               Assert.IsNull (coll[0], "this[int]");
+                       }
+                       catch (ArgumentOutOfRangeException) {
+                               // normal (can't avoid it)
+                       }
+                       try {
+                               Assert.IsNull (coll.GetKey (0), "GetKey(int)");
+                       }
+                       catch (ArgumentOutOfRangeException) {
+                               // normal (can't avoid it)
+                       }
+                       try {
+                               Assert.IsNull (coll.Get (0), "Get(int)");
+                       }
+                       catch (ArgumentOutOfRangeException) {
+                               // normal (can't avoid it)
+                       }
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // no public ctor is available but we know that it's properties don't have any restrictions
+                       MethodInfo mi = this.Type.GetProperty ("AllKeys").GetGetMethod ();
+                       Assert.IsNotNull (mi, "get_AllKeys");
+                       return mi.Invoke (coll, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpModuleCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpParseExceptionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpParseExceptionCas.cs
new file mode 100644 (file)
index 0000000..71f26e5
--- /dev/null
@@ -0,0 +1,126 @@
+//
+// HttpParseExceptionCas.cs 
+//     - CAS unit tests for System.Web.HttpParseException
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+// Note: class exists in 1.x but has no public ctor
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom.Compiler;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpParseExceptionCas : AspNetHostingMinimal {
+
+               private HttpParseException hpe;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       hpe = new HttpParseException ();
+               }
+
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor0_Deny_Unrestricted ()
+               {
+                       HttpParseException e = new HttpParseException ();
+                       Assert.IsNull (e.FileName, "FileName");
+                       Assert.AreEqual (0, e.Line, "Line");
+                       Assert.IsNull (e.VirtualPath, "VirtualPath");
+                       Assert.AreEqual (1, e.ParserErrors.Count, "ParserErrors");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor1_Deny_Unrestricted ()
+               {
+                       HttpParseException e = new HttpParseException ("message");
+                       Assert.IsNull (e.FileName, "FileName");
+                       Assert.AreEqual (0, e.Line, "Line");
+                       Assert.IsNull (e.VirtualPath, "VirtualPath");
+                       Assert.AreEqual (1, e.ParserErrors.Count, "ParserErrors");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2_Deny_Unrestricted ()
+               {
+                       HttpParseException e = new HttpParseException ("message", new Exception ());
+                       Assert.IsNull (e.FileName, "FileName");
+                       Assert.AreEqual (0, e.Line, "Line");
+                       Assert.IsNull (e.VirtualPath, "VirtualPath");
+                       Assert.AreEqual (1, e.ParserErrors.Count, "ParserErrors");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor5_Deny_Unrestricted ()
+               {
+                       HttpParseException e = new HttpParseException ("message", new Exception (), "virtualPath", "sourceCode", 100);
+                       Assert.IsNull (e.FileName, "FileName");
+                       Assert.AreEqual (100, e.Line, "Line");
+                       Assert.AreEqual ("virtualPath", e.VirtualPath, "VirtualPath");
+                       Assert.AreEqual (1, e.ParserErrors.Count, "ParserErrors");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, SerializationFormatter = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetObjectData_Deny_SerializationFormatter ()
+               {
+                       hpe.GetObjectData (null, new StreamingContext ());
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, SerializationFormatter = true)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void GetObjectData_PermitOnly_SerializationFormatter ()
+               {
+                       hpe.GetObjectData (null, new StreamingContext ());
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpParseException); }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/Test/System.Web/HttpRequestCas.cs b/mcs/class/System.Web/Test/System.Web/HttpRequestCas.cs
new file mode 100644 (file)
index 0000000..5fb60ed
--- /dev/null
@@ -0,0 +1,310 @@
+//
+// HttpRequestCas.cs - CAS unit tests for System.Web.HttpRequest
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpRequestCas : AspNetHostingMinimal {
+
+               private HttpRequest request;
+               private string tempfile;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       request = new HttpRequest (String.Empty, "http://localhost/", String.Empty);
+                       tempfile = Path.GetTempFileName ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       Assert.IsNull (request.AcceptTypes, "AcceptTypes");
+                       Assert.IsNull (request.ApplicationPath, "ApplicationPath");
+                       request.Browser = null;
+                       try {
+                               Assert.IsNotNull (request.Browser, "Browser");
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+
+                       request.ContentEncoding = null;
+                       try {
+                               Assert.IsNull (request.ContentEncoding, "ContentEncoding");
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+                       catch (HttpException) {
+                               // mono
+                       }
+
+                       Assert.AreEqual (0, request.ContentLength, "ContentLength");
+                       Assert.AreEqual (String.Empty, request.ContentType, "ContentType");
+                       request.ContentType = null;
+                       Assert.IsNotNull (request.Cookies, "Cookies");
+
+                       try {
+                               Assert.AreEqual ("/", request.CurrentExecutionFilePath, "CurrentExecutionFilePath");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x
+                       }
+
+                       try {
+                               Assert.AreEqual ("/", request.FilePath, "FilePath");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x
+                       }
+
+                       Assert.IsNotNull (request.Files, "Files");
+
+                       try {
+                               Assert.IsNotNull (request.Filter, "Filter");
+                               request.Filter = null;
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+
+                       Assert.IsNotNull (request.Form, "Form");
+                       Assert.IsNotNull (request.Headers, "Headers");
+                       Assert.AreEqual ("GET", request.HttpMethod, "HttpMethod");
+                       Assert.IsNotNull (request.InputStream, "InputStream");
+                       Assert.IsFalse (request.IsSecureConnection, "IsSecureConnection");
+                       Assert.IsNotNull (request.Path, "Path");
+
+                       try {
+                               Assert.IsNotNull (request.PathInfo, "PathInfo");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x
+                       }
+
+                       Assert.IsNotNull (request.QueryString, "QueryString");
+                       Assert.IsNotNull (request.RawUrl, "RawUrl");
+                       Assert.AreEqual ("GET", request.RequestType, "RequestType");
+                       request.RequestType = null;
+                       Assert.AreEqual (0, request.TotalBytes, "TotalBytes");
+                       Assert.IsNotNull (request.Url, "Url");
+                       Assert.IsNull (request.UrlReferrer, "UrlReferrer");
+                       Assert.IsNull (request.UserAgent, "UserAgent");
+                       Assert.IsNull (request.UserHostAddress, "UserHostAddress");
+                       Assert.IsNull (request.UserHostName, "UserHostName");
+                       Assert.IsNull (request.UserLanguages, "UserLanguages");
+#if NET_2_0
+                       Assert.IsFalse (request.IsLocal, "IsLocal");
+#endif
+               }
+
+#if NET_2_0
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Low)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ClientCertificate_Deny_Low ()
+               {
+                       Assert.IsNotNull (request.ClientCertificate, "ClientCertificate");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Low)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void ClientCertificate_PermitOnly_Low ()
+               {
+                       Assert.IsNotNull (request.ClientCertificate, "ClientCertificate");
+               }
+#else
+               // ClientCertificate fails before hitting the SecurityException
+#endif
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void IsAuthenticated_Deny_Unrestricted ()
+               {
+                       Assert.IsNull (request.IsAuthenticated, "IsAuthenticated");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Low)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Params_Deny_Low ()
+               {
+                       Assert.IsNotNull (request.Params, "Params");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Low)]
+               public void Params_PermitOnly_Low ()
+               {
+                       Assert.IsNotNull (request.Params, "Params");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Low)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ServerVariables_Deny_Low ()
+               {
+                       Assert.IsNotNull (request.ServerVariables, "ServerVariables");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Low)]
+               public void ServerVariables_PermitOnly_Low ()
+               {
+                       Assert.IsNotNull (request.ServerVariables, "ServerVariables");
+                       Assert.IsNull (request["mono"], "this[string]");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Low)]
+               [ExpectedException (typeof (SecurityException))]
+               public void This_Deny_Low ()
+               {
+                       Assert.IsNull (request["mono"], "this[string]");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               // default path is null [ExpectedException (typeof (SecurityException))]
+               public void PhysicalApplicationPath_Deny_FileIOPermission ()
+               {
+                       try {
+                               Assert.IsNull (request.PhysicalApplicationPath, "PhysicalApplicationPath");
+                       }
+                       catch (ArgumentNullException) {
+                               // ms 2.0
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               // default path is null and mess up the security check
+               public void PhysicalApplicationPath_PermitOnly_FileIOPermission ()
+               {
+                       try {
+                               Assert.IsNull (request.PhysicalApplicationPath, "PhysicalApplicationPath");
+                       }
+                       catch (ArgumentNullException) {
+                               // ms 2.0
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               //[ExpectedException (typeof (ArgumentException))]
+               public void PhysicalPath_Deny_FileIOPermission ()
+               {
+                       // strange - must be a special case not to check (and fail) a 
+                       // FileIOPermission check (strangeest part being that this isn't
+                       // done for PhysicalApplicationPath)
+                       Assert.AreEqual (String.Empty, request.PhysicalPath, "PhysicalPath");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void PhysicalPath_PermitOnly_FileIOPermission ()
+               {
+                       Assert.IsNotNull (request.PhysicalPath, "PhysicalPath");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (request.BinaryRead (0), "BinaryRead");
+                       Assert.IsNull (request.MapImageCoordinates ("mono"), "MapImageCoordinates");
+
+                       try {
+                               Assert.IsNull (request.MapPath ("/mono"), "MapPath");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x fails
+                       }
+
+                       try {
+                               request.MapPath ("/mono", "/", true);
+                       }
+                       catch (HttpException) {
+                               // ms 2.0
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.0
+                       }
+
+                       request.ValidateInput ();
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void SaveAs_Deny_Write ()
+               {
+                       request.SaveAs (tempfile, true);
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void SaveAs_PermitOnly_Write ()
+               {
+                       request.SaveAs (tempfile, true);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[3] { typeof (string), typeof (string), typeof (string) });
+                       Assert.IsNotNull (ci, ".ctor(string,string,string)");
+                       return ci.Invoke (new object[3] { String.Empty, "http://localhost/", String.Empty });
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpRequest); }
+               }
+       }
+}
index 7ffb47783f10af346a03e5d2ffef80dd057d6136..c42084f9ca981e96342c74a8e217c77d6202b9ea 100644 (file)
@@ -328,6 +328,8 @@ namespace MonoTests.System.Web {
                                        break;
                                case HttpWorkerRequest.HeaderReferer:
                                        switch (return_kind){
+                                       case 1: return null;
+                                       case 2: return "http://www.mono-project.com/test.aspx";
                                        case 15: return "http://www.mono-project.com";
                                        }
                                        break;
@@ -347,7 +349,6 @@ namespace MonoTests.System.Web {
                                        }
                                        break;
                                }
-
                                return "";
                        }
 
@@ -626,6 +627,18 @@ namespace MonoTests.System.Web {
                        Assert.AreEqual (null, coords, "coords2");
                }
 
+               [Test]
+               public void TestReferer ()
+               {
+                       HttpContext c = Cook (1);
+
+                       Assert.AreEqual (null, c.Request.UrlReferrer, "REF1");
+
+                       c = Cook (2);
+                       Assert.AreEqual ("http://www.mono-project.com/test.aspx", c.Request.UrlReferrer.ToString (), "REF1");                   
+               }
+               
+
                [Test]
                public void NegativeContentLength ()
                {
diff --git a/mcs/class/System.Web/Test/System.Web/HttpRequestValidationExceptionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpRequestValidationExceptionCas.cs
new file mode 100644 (file)
index 0000000..bd0f4a2
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// HttpRequestValidationExceptionCas.cs 
+//     - CAS unit tests for System.Web.HttpRequestValidationException
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+// Note: class exists in 1.1 but has no public ctor
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom.Compiler;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpRequestValidationExceptionCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor0_Deny_Unrestricted ()
+               {
+                       new HttpRequestValidationException ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor1_Deny_Unrestricted ()
+               {
+                       new HttpRequestValidationException ("message");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2_Deny_Unrestricted ()
+               {
+                       new HttpRequestValidationException ("message", new Exception ());
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpRequestValidationException); }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/Test/System.Web/HttpResponseCas.cs b/mcs/class/System.Web/Test/System.Web/HttpResponseCas.cs
new file mode 100644 (file)
index 0000000..4692090
--- /dev/null
@@ -0,0 +1,445 @@
+//
+// HttpResponseCas.cs - CAS unit tests for System.Web.HttpResponse
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+using System.Web.Caching;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpResponseCas : AspNetHostingMinimal {
+
+               private StringWriter writer;
+               private String fname;
+               private FileStream fs;
+               private IntPtr handle;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // running at full-trust
+                       writer = new StringWriter ();
+               }
+
+               [SetUp]
+               public override void SetUp ()
+               {
+                       // running at full-trust too
+                       base.SetUp ();
+
+                       fname = Path.GetTempFileName ();
+                       fs = new FileStream (fname, FileMode.Open, FileAccess.Read);
+                       handle = fs.Handle;
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       try {
+                               if (fs != null)
+                                       fs.Close ();
+                               handle = IntPtr.Zero;
+                               if (File.Exists (fname))
+                                       File.Delete (fname);
+                       }
+                       catch {
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+
+                       response.Buffer = false;                        
+                       Assert.IsFalse (response.Buffer, "Buffer");
+
+                       response.BufferOutput = false;
+                       Assert.IsFalse (response.BufferOutput, "BufferOutput");
+
+                       Assert.IsNotNull (response.Cache, "Cache");
+
+                       response.CacheControl = "public";
+                       Assert.AreEqual ("public", response.CacheControl, "CacheControl");
+
+                       response.ContentEncoding = Encoding.UTF8;
+                       Assert.AreEqual (Encoding.UTF8, response.ContentEncoding, "ContentEncoding");
+
+                       response.ContentType = String.Empty;
+                       Assert.AreEqual (String.Empty, response.ContentType, "ContentType");
+
+                       response.Charset = Encoding.UTF8.WebName;
+                       Assert.AreEqual (Encoding.UTF8.WebName, response.Charset, "Charset");
+
+                       Assert.IsNotNull (response.Cookies, "Cookies");
+
+                       try {
+                               response.Expires = 2;
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+                       Assert.IsTrue (response.Expires > 0, "Expires");
+
+                       response.ExpiresAbsolute = DateTime.MinValue;
+                       Assert.AreEqual (DateTime.MinValue, response.ExpiresAbsolute, "ExpiresAbsolute");
+
+                       Assert.IsTrue (response.IsClientConnected, "IsClientConnected");
+                       Assert.IsNotNull (response.Output, "Ouput");
+
+                       response.RedirectLocation = String.Empty;
+                       Assert.AreEqual (String.Empty, response.RedirectLocation, "RedirectLocation");
+
+                       response.Status = "501 Not Ok";
+                       Assert.AreEqual ("501 Not Ok", response.Status, "Status");
+
+                       response.StatusCode = 501;
+                       Assert.AreEqual (501, response.StatusCode, "StatusCode");
+
+                       response.StatusDescription = "Not Ok";
+                       Assert.AreEqual ("Not Ok", response.StatusDescription, "StatusDescription");
+
+                       response.SuppressContent = false;
+                       Assert.IsFalse (response.SuppressContent, "SuppressContent");
+#if NET_2_0
+                       response.HeaderEncoding = Encoding.UTF8;
+                       Assert.AreEqual (Encoding.UTF8, response.HeaderEncoding, "HeaderEncoding");
+
+                       Assert.IsFalse (response.IsRequestBeingRedirected, "IsRequestBeingRedirected");
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if ONLY_1_1
+               [Category ("NotDotNet")] // triggers a TypeInitializationException in HttpRuntime
+#endif
+               public void Filter_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       try {
+                               response.Filter = new MemoryStream ();
+                       }
+                       catch (HttpException) {
+                               // ms
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+
+                       try {
+                               Assert.IsNull (response.Filter, "Filter");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if ONLY_1_1
+               [Category ("NotDotNet")] // triggers a TypeInitializationException in HttpRuntime
+#endif
+               public void OutputStream_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       try {
+                               Assert.IsNotNull (response.OutputStream, "OutputStream");
+                       }
+                       catch (HttpException) {
+                               // ms 2.0
+                       }
+               }
+
+               private string Callback (HttpContext context)
+               {
+                       return string.Empty;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.AddCacheItemDependencies (new ArrayList ());
+                       response.AddCacheItemDependency (String.Empty);
+                       response.AddFileDependencies (new ArrayList ());
+                       response.AddFileDependency (fname);
+#if NET_2_0
+                       response.AddCacheDependency (new CacheDependency[0]);
+                       response.AddCacheItemDependencies (new string [0]);
+                       response.AddFileDependencies (new string [0]);
+#endif
+
+                       try {
+                               response.AppendCookie (new HttpCookie ("mono"));
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+
+                       try {
+                               Assert.IsNull (response.ApplyAppPathModifier (null), "ApplyAppPathModifier");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+
+                       try {
+                               response.Clear ();
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+               
+                       try {
+                               response.ClearContent ();
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+               
+                       try {
+                               response.ClearHeaders ();
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+
+                       try {
+                               response.Redirect ("http://www.mono-project.com");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+                       try {
+                               response.Redirect ("http://www.mono-project.com", false);
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+
+                       try {
+                               response.SetCookie (new HttpCookie ("mono"));
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+
+                       response.Write (String.Empty);
+                       response.Write (Char.MinValue);
+                       response.Write (new char[0], 0, 0);
+                       response.Write (this);
+#if NET_2_0
+                       response.WriteSubstitution (new HttpResponseSubstitutionCallback (Callback));
+#endif
+
+                       response.Flush ();
+
+                       response.Close ();
+
+                       try {
+                               response.End ();
+                       }
+                       catch (NullReferenceException) {
+                               // ms 
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if ONLY_1_1
+               [Category ("NotDotNet")] // triggers a TypeInitializationException in HttpRuntime
+#endif
+               public void AppendHeader_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.AppendHeader ("monkey", "mono");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if ONLY_1_1
+               [Category ("NotDotNet")] // triggers a TypeInitializationException in HttpRuntime
+#endif
+               public void AddHeader_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       try {
+                               response.AddHeader (String.Empty, String.Empty);
+                       }
+                       catch (HttpException) {
+                               // ms 2.0
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if ONLY_1_1
+               [Category ("NotDotNet")] // triggers a TypeInitializationException in HttpRuntime
+#endif
+               public void BinaryWrite_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       try {
+                               response.BinaryWrite (new byte[0]);
+                       }
+                       catch (HttpException) {
+                               // ms 
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+#if ONLY_1_1
+               [Category ("NotDotNet")] // triggers a TypeInitializationException in HttpRuntime
+#endif
+               public void Pics_Deny_Unrestricted ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       try {
+                               response.Pics (String.Empty);
+                       }
+                       catch (HttpException) {
+                               // ms 
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void AppendToLog_Deny_Medium ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.AppendToLog ("mono");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               public void AppendToLog_PermitOnly_Medium ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.AppendToLog ("mono");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void TransmitFile_Deny_FileIOPermission ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.TransmitFile (fname);
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void TransmitFile_PermitOnly_FileIOPermission ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.TransmitFile (fname);
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void WriteFile_String_Deny_FileIOPermission ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.WriteFile (fname);
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void WriteFile_StringBool_Deny_FileIOPermission ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.WriteFile (fname, false);
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void WriteFile_StringIntInt_Deny_FileIOPermission ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.WriteFile (fname, 0, 1);
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void WriteFile_PermitOnly_FileIOPermission ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.WriteFile (fname);
+                       response.WriteFile (fname, false);
+                       response.WriteFile (fname, 0, 0);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void WriteFile_Deny_UnmanagedCode ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.WriteFile (handle, 0, 1);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void WriteFile_PermitOnly_UnmanagedCode ()
+               {
+                       HttpResponse response = new HttpResponse (writer);
+                       response.WriteFile (handle, 0, 1);
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (TextWriter) });
+                       Assert.IsNotNull (ci, ".ctor(TextWriter)");
+                       return ci.Invoke (new object[1] { writer });
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpResponse); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpRuntimeCas.cs b/mcs/class/System.Web/Test/System.Web/HttpRuntimeCas.cs
new file mode 100644 (file)
index 0000000..efa741a
--- /dev/null
@@ -0,0 +1,265 @@
+//
+// HttpRuntimeCas.cs - CAS unit tests for System.Web.HttpRuntime
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Principal;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpRuntimeCas : AspNetHostingMinimal {
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       // static ctor at fulltrust
+                       new HttpRuntime ();
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Deny_Unrestricted ()
+               {
+                       new HttpRuntime ();
+               }
+#else
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new HttpRuntime ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new HttpRuntime ();
+               }
+#endif
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void StaticProperties ()
+               {
+                       Assert.IsNull (HttpRuntime.AppDomainAppVirtualPath, "AppDomainAppVirtualPath");
+                       Assert.IsNotNull (HttpRuntime.Cache, "Cache");
+#if NET_2_0
+                       ApplicationShutdownReason asr = HttpRuntime.ShutdownReason;
+                       Assert.AreEqual (asr, asr, "ShutdownReason"); // value depends on execution order
+#endif
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void AppDomainAppPath_Deny ()
+               {
+                       try {
+                               Assert.IsNotNull (HttpRuntime.AppDomainAppPath, "AppDomainAppPath");
+                       }
+                       catch (ArgumentNullException) {
+                               Assert.Ignore ("fails before the security check");
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void BinDirectory_Deny ()
+               {
+                       try {
+                               Assert.IsNotNull (HttpRuntime.BinDirectory, "BinDirectory");
+                       }
+                       catch (ArgumentException) {
+                               Assert.Ignore ("fails before the security check");
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void CodegenDir_Deny ()
+               {
+                       try {
+                               Assert.IsNotNull (HttpRuntime.CodegenDir, "CodegenDir");
+                       }
+                       catch (ArgumentNullException) {
+                               Assert.Ignore ("fails before the security check");
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void AppDomainAppId_Deny_High ()
+               {
+                       Assert.IsNull (HttpRuntime.AppDomainAppId, "AppDomainAppId");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void AppDomainId_Deny_High ()
+               {
+                       Assert.IsNull (HttpRuntime.AppDomainId, "AppDomainId");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void PermitOnly_High ()
+               {
+                       Assert.IsNull (HttpRuntime.AppDomainAppId, "AppDomainAppId");
+                       Assert.IsNull (HttpRuntime.AppDomainId, "AppDomainId");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Low)]
+               [ExpectedException (typeof (SecurityException))]
+               public void IsOnUNCShare_Deny_High ()
+               {
+                       Assert.IsFalse (HttpRuntime.IsOnUNCShare, "IsOnUNCShare");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void IsOnUNCShare_PermitOnly_High ()
+               {
+                       try {
+                               Assert.IsFalse (HttpRuntime.IsOnUNCShare, "IsOnUNCShare");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void AspInstallDirectory_Deny_FileIOPermission ()
+               {
+                       if (HttpRuntime.AspInstallDirectory == null)
+                               Assert.Ignore ("null isn't checked for FileIOPermission");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ClrInstallDirectory_Deny_FileIOPermission ()
+               {
+                       Assert.IsNotNull (HttpRuntime.ClrInstallDirectory, "ClrInstallDirectory");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void MachineConfigurationDirectory_Deny_FileIOPermission ()
+               {
+                       Assert.IsNotNull (HttpRuntime.MachineConfigurationDirectory, "MachineConfigurationDirectory");
+               }
+
+               [Test]
+               [FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+               public void PermitOnly_PathDiscovery ()
+               {
+                       string s = HttpRuntime.AspInstallDirectory; // null in unit tests for mono
+                       Assert.IsNotNull (HttpRuntime.ClrInstallDirectory, "ClrInstallDirectory");
+                       Assert.IsNotNull (HttpRuntime.MachineConfigurationDirectory, "MachineConfigurationDirectory");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Close_Deny_Unmanaged ()
+               {
+                       HttpRuntime.Close ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Close_PermitOnly_Unmanaged ()
+               {
+                       HttpRuntime.Close ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ProcessRequest_Deny_Medium ()
+               {
+                       HttpRuntime.ProcessRequest (null);
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ProcessRequest_PermitOnly_Medium ()
+               {
+                       HttpRuntime.ProcessRequest (null);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void UnloadAppDomain_Deny_Unmanaged ()
+               {
+                       HttpRuntime.UnloadAppDomain ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void UnloadAppDomain_PermitOnly_Unmanaged ()
+               {
+                       HttpRuntime.UnloadAppDomain ();
+               }
+
+               // LinkDemand
+
+               // note: the .ctor also has a LinkDemand for UnmanagedCode (which mess up the results)
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (VoidType);
+                       Assert.IsNotNull (ci, "default .ctor");
+                       return ci.Invoke (null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpRuntime); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpServerUtilityCas.cs b/mcs/class/System.Web/Test/System.Web/HttpServerUtilityCas.cs
new file mode 100644 (file)
index 0000000..a55f7e5
--- /dev/null
@@ -0,0 +1,283 @@
+//
+// HttpServerUtilityCas.cs - CAS unit tests for System.Web.HttpServerUtility
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpServerUtilityCas : AspNetHostingMinimal {
+
+               private const string url = "http://www.mono-project.com/";
+
+               private StringWriter sw;
+               private HttpContext context;
+               private HttpServerUtility hsu;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       sw = new StringWriter ();
+                       context = new HttpContext (null);
+                       hsu = context.Server;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       try {
+                               Assert.IsTrue (hsu.ScriptTimeout > 0, "ScriptTimeout");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x, mono
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void ScriptTimeout_Deny_Unrestricted ()
+               {
+                       hsu.ScriptTimeout = 1;
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               public void ScriptTimeout_PermitOnly_Unrestricted ()
+               {
+                       hsu.ScriptTimeout = 1;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       hsu.ClearError ();
+
+                       Assert.IsNull (hsu.GetLastError (), "GetLastError");
+
+                       Assert.IsNotNull (hsu.HtmlDecode (String.Empty), "HtmlDecode(string)");
+                       hsu.HtmlDecode (String.Empty, sw);
+
+                       Assert.IsNotNull (hsu.HtmlEncode (String.Empty), "HtmlEncode(string)");
+                       hsu.HtmlEncode (String.Empty, sw);
+
+                       try {
+                               Assert.IsNull (hsu.MapPath (String.Empty), "MapPath(string)");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x
+                       }
+
+                       try {
+                               hsu.Transfer ("/");
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+                       try {
+                               hsu.Transfer ("/", true);
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+                       try {
+                               hsu.Transfer ("/", false);
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+#if NET_2_0
+                       try {
+                               hsu.Transfer ((IHttpHandler)null, true);
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+                       try {
+                               hsu.Transfer ((IHttpHandler)null, false);
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+#endif
+                       try {
+                               Assert.IsNotNull (hsu.UrlDecode (url), "UrlDecode(string)");
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+                       try {
+                               hsu.UrlDecode ("http://www.mono-project.com/", sw);
+                       }
+                       catch (NullReferenceException) {
+                               // ms
+                       }
+
+                       Assert.IsNotNull (hsu.UrlEncode (String.Empty), "UrlEncode(string)");
+                       hsu.UrlEncode (String.Empty, sw);
+
+                       Assert.IsNotNull (hsu.UrlPathEncode (String.Empty), "UrlPathEncode(string)");
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void CreateObject_String_Deny_UnmanagedCode ()
+               {
+                       hsu.CreateObject (String.Empty);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               [ExpectedException (typeof (HttpException))] // String.Empty isn't valid
+               public void CreateObject_String_PermitOnly_UnmanagedCode ()
+               {
+                       hsu.CreateObject (String.Empty);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void CreateObject_Type_Deny_UnmanagedCode ()
+               {
+                       hsu.CreateObject (String.Empty);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void CreateObject_Type_PermitOnly_UnmanagedCode ()
+               {
+                       try {
+                               hsu.CreateObject (typeof (string));
+                       }
+                       catch (MissingMethodException) {
+                               // ms
+                       }
+                       catch (HttpException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void CreateObjectFromClsid_String_Deny_UnmanagedCode ()
+               {
+                       hsu.CreateObjectFromClsid (String.Empty);
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void CreateObjectFromClsid_PermitOnly_UnmanagedCode ()
+               {
+                       try {
+                               hsu.CreateObjectFromClsid (String.Empty);
+                       }
+                       catch (FormatException) {
+                               // ms (not a valid guid)
+                       }
+                       catch (HttpException) {
+                               // mono
+                       }
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Execute_String_Deny_Unrestricted ()
+               {
+                       hsu.Execute (String.Empty);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Execute_StringTextWriter_Deny_Unrestricted ()
+               {
+                       hsu.Execute (String.Empty, sw);
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Execute_StringTextWriterTrue_Deny_Unrestricted ()
+               {
+                       hsu.Execute (String.Empty, sw, true);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Execute_StringTextWriterFalse_Deny_Unrestricted ()
+               {
+                       hsu.Execute (String.Empty, sw, false);
+               }
+#endif
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
+               [ExpectedException (typeof (SecurityException))]
+               public void MachineName_Deny_Medium ()
+               {
+                       Assert.IsNotNull (hsu.MachineName, "MachineName");
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
+               public void MachineName_PermitOnly_Medium ()
+               {
+                       Assert.IsNotNull (hsu.MachineName, "MachineName");
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // there are no public ctor so we're taking a method that we know isn't protected
+                       // (by a Demand) and call it thru reflection so any linkdemand (on the class) will
+                       // be promoted to a Demand
+                       MethodInfo mi = this.Type.GetMethod ("HtmlDecode", new Type[1] { typeof (string) } );
+                       return mi.Invoke (hsu, new object[1] { String.Empty });
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpServerUtility); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpStaticObjectsCollectionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpStaticObjectsCollectionCas.cs
new file mode 100644 (file)
index 0000000..6a9ebe7
--- /dev/null
@@ -0,0 +1,126 @@
+//
+// HttpStaticObjectsCollectionCas.cs 
+//     - CAS unit tests for System.Web.HttpStaticObjectsCollection
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpStaticObjectsCollectionCas : AspNetHostingMinimal {
+
+               private HttpStaticObjectsCollection hsoc;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       hsoc = new HttpStaticObjectsCollection ();
+               }
+
+#if NET_2_0
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Deny_Unrestricted ()
+               {
+                       new HttpStaticObjectsCollection ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Serialization ()
+               {
+                       MemoryStream ms = new MemoryStream ();
+                       BinaryWriter writer = new BinaryWriter (ms);
+                       HttpStaticObjectsCollection hsoc = new HttpStaticObjectsCollection ();
+                       hsoc.Serialize (writer);
+
+                       ms.Position = 0;
+                       BinaryReader reader = new BinaryReader (ms);
+                       Assert.IsNotNull (HttpStaticObjectsCollection.Deserialize (reader));
+               }
+#else
+               [Test]
+               [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+               [ExpectedException (typeof (SecurityException))]
+               public void Constructor_Deny_UnmanagedCode ()
+               {
+                       new HttpStaticObjectsCollection ();
+               }
+
+               [Test]
+               [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
+               public void Constructor_PermitOnly_UnmanagedCode ()
+               {
+                       new HttpStaticObjectsCollection ();
+               }
+#endif
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       Assert.AreEqual (0, hsoc.Count, "Count");
+                       Assert.IsNotNull (hsoc.GetEnumerator (), "GetEnumerator");
+                       Assert.IsNull (hsoc.GetObject ("mono"), "GetObject");
+                       Assert.IsNull (hsoc["mono"], "this[string]");
+                       Assert.IsTrue (hsoc.IsReadOnly, "IsReadOnly");
+                       Assert.IsFalse (hsoc.IsSynchronized, "IsSynchronized");
+                       Assert.IsNotNull (hsoc.SyncRoot, "SyncRoot");
+#if NET_2_0
+                       Assert.IsTrue (hsoc.NeverAccessed, "NeverAccessed");
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       hsoc.CopyTo (new object[0], 0);
+               }
+
+               // LinkDemand
+#if ONLY_1_1
+               [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       return base.CreateControl (action, level);
+               }
+#endif
+               public override Type Type {
+                       get { return typeof (HttpStaticObjectsCollection); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpUnhandledExceptionCas.cs b/mcs/class/System.Web/Test/System.Web/HttpUnhandledExceptionCas.cs
new file mode 100644 (file)
index 0000000..9d42c69
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// HttpUnhandledExceptionCas.cs 
+//     - CAS unit tests for System.Web.HttpUnhandledException
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+// Note: class exists in 1.x but has no public ctor
+
+using NUnit.Framework;
+
+using System;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpUnhandledExceptionCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor0_Deny_Unrestricted ()
+               {
+                       new HttpUnhandledException ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor1_Deny_Unrestricted ()
+               {
+                       new HttpUnhandledException ("message");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor2_Deny_Unrestricted ()
+               {
+                       new HttpUnhandledException ("message", new Exception ());
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpUnhandledException); }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Web/Test/System.Web/HttpUtilityCas.cs b/mcs/class/System.Web/Test/System.Web/HttpUtilityCas.cs
new file mode 100644 (file)
index 0000000..b6b5161
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// HttpUtilityCas.cs - CAS unit tests for System.Web.HttpUtility
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.IO;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpUtilityCas : AspNetHostingMinimal {
+
+               private StringWriter sw;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       sw = new StringWriter ();
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void StaticMethods_Deny_Unrestricted ()
+               {
+                       try {
+                               Assert.IsNull (HttpUtility.HtmlAttributeEncode (null), "HtmlAttributeEncode(string)");
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x
+                       }
+                       try {
+                               HttpUtility.HtmlAttributeEncode (null, sw);
+                       }
+                       catch (NullReferenceException) {
+                               // ms 1.x
+                       }
+
+                       Assert.AreEqual (String.Empty, HttpUtility.HtmlDecode (String.Empty), "HtmlDecode(string)");
+                       HttpUtility.HtmlDecode (String.Empty, sw);
+
+                       Assert.AreEqual (String.Empty, HttpUtility.HtmlEncode (String.Empty), "HtmlEncode(string)");
+                       HttpUtility.HtmlEncode (String.Empty, sw);
+
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlDecode (String.Empty), "UrlDecode(string)");
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlDecode (String.Empty, Encoding.ASCII), "UrlDecode(string,Encoding)");
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlDecode (new byte[0], Encoding.ASCII), "UrlDecode(byte[],Encoding)");
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlDecode (new byte[0], 0, 0, Encoding.ASCII), "UrlDecode(byte[],int,int,Encoding)");
+
+                       Assert.AreEqual (0, HttpUtility.UrlDecodeToBytes (String.Empty).Length, "UrlDecodeToBytes(string)");
+                       Assert.AreEqual (0, HttpUtility.UrlDecodeToBytes (String.Empty, Encoding.ASCII).Length, "UrlDecodeToBytes(string,Encoding)");
+                       Assert.AreEqual (0, HttpUtility.UrlDecodeToBytes (new byte[0]).Length, "UrlDecodeToBytes(byte[])");
+                       Assert.AreEqual (0, HttpUtility.UrlDecodeToBytes (new byte[0], 0, 0).Length, "UrlDecodeToBytes(byte[],int,int)");
+
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlEncode (String.Empty), "UrlEncode(string)");
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlEncode (String.Empty, Encoding.ASCII), "UrlEncode(string,Encoding)");
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlEncode (new byte[0]), "UrlEncode(byte[],Encoding)");
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlEncode (new byte[0], 0, 0), "UrlEncode(byte[],int,int,Encoding)");
+
+                       Assert.AreEqual (0, HttpUtility.UrlEncodeToBytes (String.Empty).Length, "UrlEncodeToBytes(string)");
+                       Assert.AreEqual (0, HttpUtility.UrlEncodeToBytes (String.Empty, Encoding.ASCII).Length, "UrlEncodeToBytes(string,Encoding)");
+                       Assert.AreEqual (0, HttpUtility.UrlEncodeToBytes (new byte[0]).Length, "UrlEncodeToBytes(byte[])");
+                       Assert.AreEqual (0, HttpUtility.UrlEncodeToBytes (new byte[0], 0, 0).Length, "UrlEncodeToBytes(byte[],int,int)");
+
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlEncodeUnicode (String.Empty), "UrlEncodeUnicode(string)");
+
+                       Assert.AreEqual (0, HttpUtility.UrlEncodeUnicodeToBytes (String.Empty).Length, "UrlEncodeUnicodeToBytes(string)");
+
+                       Assert.AreEqual (String.Empty, HttpUtility.UrlPathEncode (String.Empty), "UrlPathEncode(string)");
+#if NET_2_0
+                       try {
+                               Assert.IsNotNull (HttpUtility.ParseQueryString (String.Empty), "ParseQueryString(string)");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       try {
+                               Assert.IsNotNull (HttpUtility.ParseQueryString (String.Empty, Encoding.ASCII), "ParseQueryString(string)");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+#endif
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (HttpUtility); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpWorkerRequestCas.cs b/mcs/class/System.Web/Test/System.Web/HttpWorkerRequestCas.cs
new file mode 100644 (file)
index 0000000..a22402f
--- /dev/null
@@ -0,0 +1,219 @@
+//
+// HttpWorkerRequestCas.cs - CAS unit tests for System.Web.HttpWorkerRequest
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+using System.Web.Caching;
+
+namespace MonoCasTests.System.Web {
+
+       class CasHttpWorkerRequest : HttpWorkerRequest {
+
+               public override void EndOfRequest ()
+               {
+               }
+
+               public override void FlushResponse (bool finalFlush)
+               {
+               }
+
+               public override string GetHttpVerbName ()
+               {
+                       return null;
+               }
+
+               public override string GetHttpVersion ()
+               {
+                       return null;
+               }
+
+               public override string GetLocalAddress ()
+               {
+                       return null;
+               }
+
+               public override int GetLocalPort ()
+               {
+                       return 0;
+               }
+
+               public override string GetQueryString ()
+               {
+                       return null;
+               }
+
+               public override string GetRawUrl ()
+               {
+                       return null;
+               }
+
+               public override string GetRemoteAddress ()
+               {
+                       return null;
+               }
+
+               public override int GetRemotePort ()
+               {
+                       return 0;
+               }
+
+               public override string GetUriPath ()
+               {
+                       return null;
+               }
+
+               public override void SendKnownResponseHeader (int index, string value)
+               {
+               }
+
+               public override void SendResponseFromFile (IntPtr handle, long offset, long length)
+               {
+               }
+
+               public override void SendResponseFromFile (string filename, long offset, long length)
+               {
+               }
+
+               public override void SendResponseFromMemory (byte[] data, int length)
+               {
+               }
+
+               public override void SendStatus (int statusCode, string statusDescription)
+               {
+               }
+
+               public override void SendUnknownResponseHeader (string name, string value)
+               {
+               }
+       }
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpWorkerRequestCas {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       CasHttpWorkerRequest hwr = new CasHttpWorkerRequest ();
+                       Assert.IsNull (hwr.MachineConfigPath, "MachineConfigPath");
+                       Assert.IsNull (hwr.MachineInstallDirectory, "MachineInstallDirectory");
+#if NET_2_0
+                       Assert.IsNotNull (hwr.RequestTraceIdentifier, "RequestTraceIdentifier");
+                       Assert.IsNull (hwr.RootWebConfigPath, "RootWebConfigPath");
+#endif
+               }
+
+               private void Callback (HttpWorkerRequest wr, object extraData)
+               {
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       CasHttpWorkerRequest hwr = new CasHttpWorkerRequest ();
+                       hwr.CloseConnection ();
+                       Assert.IsNull (hwr.GetAppPath (), "GetAppPath");
+                       Assert.IsNull (hwr.GetAppPathTranslated (), "GetAppPathTranslated");
+                       Assert.IsNull (hwr.GetAppPoolID (), "GetAppPoolID");
+                       Assert.AreEqual (0, hwr.GetBytesRead (), "GetBytesRead");
+                       Assert.IsNull (hwr.GetFilePath (), "GetFilePath");
+                       Assert.IsNull (hwr.GetFilePathTranslated (), "GetGetFilePathTranslated");
+                       Assert.IsNull (hwr.GetKnownRequestHeader (0), "GetKnownRequestHeader");
+                       Assert.AreEqual (String.Empty, hwr.GetPathInfo (), "GetPathInfo");
+                       Assert.IsNull (hwr.GetPreloadedEntityBody (), "GetPreloadedEntityBody");
+                       Assert.AreEqual ("http", hwr.GetProtocol (), "GetProtocol");
+                       Assert.IsNull (hwr.GetQueryStringRawBytes (), "GetQueryStringRawBytes");
+                       Assert.AreEqual (0, hwr.GetRequestReason (), "GetRequestReason");
+                       Assert.IsNull (hwr.GetServerVariable (null), "GetServerVariable");
+                       Assert.IsNull (hwr.GetUnknownRequestHeader (null), "GetUnknownRequestHeader");
+                       Assert.IsNull (hwr.GetUnknownRequestHeaders (), "GetUnknownRequestHeaders");
+                       Assert.AreEqual (IntPtr.Zero, hwr.GetUserToken (), "GetUserToken");
+                       Assert.IsFalse (hwr.HasEntityBody (), "HasEntityBody");
+                       Assert.IsTrue (hwr.HeadersSent (), "HeadersSent");
+                       Assert.IsTrue (hwr.IsClientConnected (), "IsClientConnected");
+                       Assert.IsFalse (hwr.IsEntireEntityBodyIsPreloaded (), "IsEntireEntityBodyIsPreloaded");
+                       Assert.IsFalse (hwr.IsSecure (), "IsSecure");
+                       Assert.IsNull (hwr.MapPath (null), "MapPath");
+
+                       try {
+                               Assert.AreEqual (0, hwr.ReadEntityBody (new byte[1], 1), "ReadEntityBody(byte[],int)");
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+
+                       try {
+                               hwr.SendCalculatedContentLength (0);
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+
+                       hwr.SendResponseFromMemory (IntPtr.Zero, 0);
+                       hwr.SetEndOfSendNotification (new HttpWorkerRequest.EndOfSendNotification (Callback), null);
+
+                       Assert.IsNotNull (hwr.GetClientCertificate (), "GetClientCertificate");
+                       Assert.IsNotNull (hwr.GetClientCertificateBinaryIssuer (), "GetClientCertificateBinaryIssuer");
+                       Assert.AreEqual (0, hwr.GetClientCertificateEncoding (), "GetClientCertificateEncoding");
+                       Assert.IsNotNull (hwr.GetClientCertificatePublicKey (), "GetClientCertificatePublicKey");
+                       DateTime dt = DateTime.Now.AddMinutes (1);
+                       Assert.IsTrue (hwr.GetClientCertificateValidFrom () < dt, "GetClientCertificateValidFrom");
+                       Assert.IsTrue (hwr.GetClientCertificateValidUntil () < dt, "GetClientCertificateValidUntil");
+                       Assert.AreEqual (0, hwr.GetConnectionID (), "GetConnectionID");
+                       Assert.AreEqual (0, hwr.GetUrlContextID (), "GetUrlContextID");
+                       Assert.AreEqual (IntPtr.Zero, hwr.GetVirtualPathToken (), "GetVirtualPathToken");
+#if NET_2_0
+                       Assert.AreEqual (0, hwr.GetPreloadedEntityBody (new byte[0], 0), "GetPreloadedEntityBody(byte[],int)");
+                       Assert.AreEqual (0, hwr.GetPreloadedEntityBodyLength (), "GetPreloadedEntityBodyLength");
+                       Assert.AreEqual (0, hwr.GetTotalEntityBodyLength (), "GetTotalEntityBodyLength");
+                       Assert.AreEqual (0, hwr.ReadEntityBody (new byte[1], 0, 1), "ReadEntityBody(byte[],int,int)");
+#endif
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void StaticMethods_Deny_Unrestricted ()
+               {
+                       Assert.AreEqual (-1, HttpWorkerRequest.GetKnownRequestHeaderIndex ("mono"), "GetKnownRequestHeaderIndex");
+                       Assert.AreEqual ("Cache-Control", HttpWorkerRequest.GetKnownRequestHeaderName (0), "GetKnownRequestHeaderName");
+                       Assert.AreEqual (-1, HttpWorkerRequest.GetKnownResponseHeaderIndex ("mono"), "GetKnownResponseHeaderIndex");
+                       Assert.AreEqual ("Cache-Control", HttpWorkerRequest.GetKnownResponseHeaderName (0), "GetKnownResponseHeaderName");
+                       Assert.AreEqual ("OK", HttpWorkerRequest.GetStatusDescription (200), "GetStatusDescription");
+               }
+       }
+}
index 15632037883f1c91fb79eea097220b9dc6aaf9ad..df78daa16763a9c407da1e8c4071743c29404feb 100644 (file)
@@ -305,7 +305,16 @@ namespace MonoTests.System.Web {
                        Assert.AreEqual (true, f.IsClientConnected (), "F32");
                        Assert.AreEqual (false, f.IsEntireEntityBodyIsPreloaded (), "F33");
                        Assert.AreEqual (false, f.IsSecure (), "F34");
-                       
+
+                       Assert.AreEqual (0, f.ReadEntityBody (null, Int32.MaxValue), "ReadEntityBody(byte[],int)");
+#if NET_2_0
+                       Assert.AreEqual (Guid.Empty.ToString (), f.RequestTraceIdentifier.ToString (), "RequestTraceIdentifier");
+                       Assert.IsNull (f.RootWebConfigPath, "RootWebConfigPath");
+                       Assert.AreEqual (0, f.GetPreloadedEntityBody (null, Int32.MinValue), "GetPreloadedEntityBody(byte[],int)");
+                       Assert.AreEqual (0, f.GetPreloadedEntityBodyLength (), "GetPreloadedEntityBodyLength");
+                       Assert.AreEqual (0, f.GetTotalEntityBodyLength (), "GetTotalEntityBodyLength");
+                       Assert.AreEqual (0, f.ReadEntityBody (null, 0, 0), "ReadEntityBody(byte[],int,int)");
+#endif
                }
 
                [Test] public void Test_GetKnownHeaderName ()
diff --git a/mcs/class/System.Web/Test/System.Web/HttpWriterCas.cs b/mcs/class/System.Web/Test/System.Web/HttpWriterCas.cs
new file mode 100644 (file)
index 0000000..70b91c0
--- /dev/null
@@ -0,0 +1,94 @@
+//
+// HttpWriterCas.cs - CAS unit tests for System.Web.HttpWriter
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+using System.Web.Caching;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class HttpWriterCas : AspNetHostingMinimal {
+
+               private HttpWriter writer;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       HttpContext context = new HttpContext (null);
+                       writer = (HttpWriter) context.Response.Output;
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Properties_Deny_Unrestricted ()
+               {
+                       Assert.IsNotNull (writer.Encoding, "Encoding");
+                       Assert.IsNotNull (writer.OutputStream, "OutputStream");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Methods_Deny_Unrestricted ()
+               {
+                       writer.Write (Char.MinValue);
+                       writer.Write (this);
+                       writer.Write (String.Empty);
+                       writer.Write (new char [1], 0, 1);
+                       writer.WriteLine ();
+                       writer.WriteString ("mono", 0, 4);
+                       writer.WriteBytes (new byte[1], 0, 1);
+                       writer.Flush ();
+                       writer.Close ();
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       // there are no public ctor so we're taking a method that we know isn't protected
+                       // (by a Demand) and call it thru reflection so any linkdemand (on the class) will
+                       // be promoted to a Demand
+                       MethodInfo mi = this.Type.GetProperty ("OutputStream").GetGetMethod ();
+                       return mi.Invoke (writer, null);
+               }
+
+               public override Type Type {
+                       get { return typeof (HttpWriter); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/ProcessInfoCas.cs b/mcs/class/System.Web/Test/System.Web/ProcessInfoCas.cs
new file mode 100644 (file)
index 0000000..127d4aa
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// ProcessInfoCas.cs - CAS unit tests for System.Web.ProcessInfo
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ProcessInfoCas : AspNetHostingMinimal {
+
+               private void CheckProperties (ProcessInfo pi)
+               {
+                       Assert.AreEqual (TimeSpan.Zero, pi.Age, "Age");
+                       Assert.AreEqual (0, pi.PeakMemoryUsed, "PeakMemoryUsed");
+                       Assert.AreEqual (0, pi.ProcessID, "ProcessID");
+                       Assert.AreEqual (0, pi.RequestCount, "RequestCount");
+                       Assert.AreEqual (ProcessShutdownReason.None, pi.ShutdownReason, "ShutdownReason");
+                       Assert.AreEqual (DateTime.MinValue, pi.StartTime, "StartTime");
+                       Assert.AreEqual (0, (int)pi.Status, "Status");
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor0 ()
+               {
+                       ProcessInfo pi = new ProcessInfo ();
+                       CheckProperties (pi);
+                       pi.SetAll (DateTime.MinValue, TimeSpan.Zero, 0, 0, 0, ProcessShutdownReason.None, 0);
+                       CheckProperties (pi);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor7 ()
+               {
+                       ProcessInfo pi = new ProcessInfo (DateTime.MinValue, TimeSpan.Zero, 0, 0, 0, ProcessShutdownReason.None, 0);
+                       CheckProperties (pi);
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ProcessInfo); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/ProcessModelInfoCas.cs b/mcs/class/System.Web/Test/System.Web/ProcessModelInfoCas.cs
new file mode 100644 (file)
index 0000000..fb2e16b
--- /dev/null
@@ -0,0 +1,105 @@
+//
+// ProcessModelInfoCas.cs - CAS unit tests for System.Web.ProcessModelInfo
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class ProcessModelInfoCas : AspNetHostingMinimal {
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor0 ()
+               {
+                       new ProcessModelInfo ();
+                       // everything else is static so...
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetCurrentProcessInfo_Deny_High ()
+               {
+                       ProcessModelInfo.GetCurrentProcessInfo ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void GetCurrentProcessInfo_PermitOnly_High ()
+               {
+                       try {
+                               ProcessModelInfo.GetCurrentProcessInfo ();
+                       }
+                       catch (HttpException) {
+                               // ms 2.x - kind of expected (as we're not running ASP.NET)
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x - fails initializing HttpRuntime
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetHistory_Deny_High ()
+               {
+                       ProcessModelInfo.GetHistory (0);
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void GetHistory_PermitOnly_High ()
+               {
+                       try {
+                               ProcessModelInfo.GetHistory (0);
+                       }
+                       catch (HttpException) {
+                               // ms 2.x - kind of expected (as we're not running ASP.NET)
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+                       catch (TypeInitializationException) {
+                               // ms 1.x - fails initializing HttpRuntime
+                       }
+               }
+
+               // LinkDemand
+
+               public override Type Type {
+                       get { return typeof (ProcessModelInfo); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/TraceContextCas.cs b/mcs/class/System.Web/Test/System.Web/TraceContextCas.cs
new file mode 100644 (file)
index 0000000..dc2d13f
--- /dev/null
@@ -0,0 +1,128 @@
+//
+// TraceContextCas.cs - CAS unit tests for System.Web.TraceContext
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Web;
+
+namespace MonoCasTests.System.Web {
+
+       [TestFixture]
+       [Category ("CAS")]
+       public class TraceContextCas : AspNetHostingMinimal {
+
+               private HttpContext context;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       context = new HttpContext (null);
+               }
+
+               [Test]
+               [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+               public void Constructor_Properties_Events ()
+               {
+                       TraceContext tc = new TraceContext (context);
+
+                       tc.IsEnabled = false;
+                       Assert.IsFalse (tc.IsEnabled, "IsEnabled");
+
+                       Assert.AreEqual (TraceMode.SortByTime, tc.TraceMode, "TraceMode");
+                       tc.TraceMode = TraceMode.Default;
+#if NET_2_0
+                       tc.TraceFinished += new TraceContextEventHandler (Handler);
+                       tc.TraceFinished -= new TraceContextEventHandler (Handler);
+#endif
+               }
+#if NET_2_0
+               private void Handler (object sender, TraceContextEventArgs e)
+               {
+               }
+#endif
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetCurrentProcessInfo_Deny_High ()
+               {
+                       ProcessModelInfo.GetCurrentProcessInfo ();
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void GetCurrentProcessInfo_PermitOnly_High ()
+               {
+                       try {
+                               ProcessModelInfo.GetCurrentProcessInfo ();
+                       }
+                       catch (HttpException) {
+                               // expected (as we're not running ASP.NET)
+                       }
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
+               [ExpectedException (typeof (SecurityException))]
+               public void GetHistory_Deny_High ()
+               {
+                       ProcessModelInfo.GetHistory (0);
+               }
+
+               [Test]
+               [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
+               public void GetHistory_PermitOnly_High ()
+               {
+                       try {
+                               ProcessModelInfo.GetHistory (0);
+                       }
+                       catch (HttpException) {
+                               // expected (as we're not running ASP.NET)
+                       }
+                       catch (NotImplementedException) {
+                               // mono
+                       }
+               }
+
+               // LinkDemand
+
+               public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
+               {
+                       ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (HttpContext) });
+                       Assert.IsNotNull (ci, ".ctor(HttpContext)");
+                       return ci.Invoke (new object[1] { context });
+               }
+
+               public override Type Type {
+                       get { return typeof (TraceContext); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/Test/jsunit-tests/customvalidator/nofunc.aspx b/mcs/class/System.Web/Test/jsunit-tests/customvalidator/nofunc.aspx
new file mode 100644 (file)
index 0000000..bdad285
--- /dev/null
@@ -0,0 +1,61 @@
+<%@ Page Language="C#" AutoEventWireup="True" %>
+ <html>
+ <head>
+       <script runat="server">
+       void ButtonClick(Object sender, EventArgs e)
+       {
+           if (Page.IsValid)
+           {
+               Label1.Text="Page is valid.";
+           }
+           else
+           {
+               Label1.Text="Page is not valid!!";
+           }
+       }
+       </script>
+ </head>
+
+<body>
+  <h3>test for bug #76087</h3>
+
+  <form runat="server">
+        <asp:TextBox id="TextBox1" 
+              runat="server"/>
+
+       <!-- a dynamic uplevel validator.  -->
+       <asp:CustomValidator id="CV_dynamic_uplevel"
+                ControlToValidate="TextBox1"
+               Display="dynamic"
+               runat="server"/>*</asp:CustomValidator>
+
+       <asp:Label id="Label1"
+           runat="server"/>
+
+       <asp:Button id="Submit" Text="Submit" OnClick="ButtonClick" runat="server"/>
+  </form>
+
+
+<script Language="JavaScript">
+    var TestFixture = {
+       CV_nofunc_pre: function () {
+           JSUnit_TestCausesPageLoad ();
+
+           var submit = JSUnit_GetElement ("Submit");
+
+           JSUnit_Click (submit)
+       },
+
+       CV_nofunc_post: function () {
+           JSUnit_BindElement ("Label1");
+
+           Assert.AreEqual ("Page is valid.", "JSUnit_GetElement ().innerHTML", "innerHTML");
+       }
+
+    };
+
+</script>
+
+</body>
+
+</html>
\ No newline at end of file
index e1cf5df43899f63e3d25c9e1726b9f9d411476af..a6671fc9eba9e82c3b37041f4d30c75cc1a98cae 100644 (file)
@@ -21,6 +21,7 @@
 
         { url:"customvalidator/properties.aspx" },
         { url:"customvalidator/submit.aspx" },
+        { url:"customvalidator/nofunc.aspx" },
        { url:"rangevalidator/properties.aspx" },
        { url:"rangevalidator/submit.aspx" },
        { url:"rangevalidator/disabled.aspx" },
diff --git a/mcs/class/System.Web/Test/standalone/datagrid/datagrid-column-style.aspx b/mcs/class/System.Web/Test/standalone/datagrid/datagrid-column-style.aspx
new file mode 100644 (file)
index 0000000..d84ed47
--- /dev/null
@@ -0,0 +1,33 @@
+<%@ Page language="c#" %>
+<%@ Import namespace="System.Data" %>
+<html>
+<head>
+<script runat="server">
+        void Page_Load(object sender, System.EventArgs e)
+       {
+               DataTable dt = new DataTable();
+               dt.Columns.Add("col1");
+               dt.Columns.Add("col2");
+               DataRow dr = dt.NewRow();
+               dt.Rows.Add(dr);
+               dt.Rows[0]["col1"] = "Center";
+               dt.Rows[0]["col2"] = "Left";
+               DataGrid1.DataSource = dt.DefaultView;
+               DataGrid1.DataBind();
+       }
+</script>
+<title>DataGridTest</title>
+</head>
+<body>
+The 'Center' word should be centered.
+<br>
+<form id="Form1" method="post" runat="server">
+       <asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
+       <Columns>
+               <asp:BoundColumn ItemStyle-HorizontalAlign="Center" HeaderText="Column1 23456789" DataField="col1"></asp:BoundColumn>
+               <asp:BoundColumn ItemStyle-HorizontalAlign="Left" HeaderText="Column2 34567891" DataField="col2"></asp:BoundColumn>
+       </Columns>
+       </asp:DataGrid>
+</form>
+</body>
+</html>
diff --git a/mcs/class/System.Web/Test/standalone/htmlform/disabledcontrols.aspx b/mcs/class/System.Web/Test/standalone/htmlform/disabledcontrols.aspx
new file mode 100644 (file)
index 0000000..14fff66
--- /dev/null
@@ -0,0 +1,69 @@
+<%@ page language="C#"%>
+
+<script runat="server">
+
+  void Page_Load(Object sender, EventArgs e)
+  {
+    
+    if (IsPostBack)
+    {
+       // the second time through, print out the submitted form info
+       foreach (string key in Page.Request.Form.AllKeys) {
+               Response.Write (String.Format ("{0}: {1}<br/>", key, Page.Request.Form[key]));
+       }
+    }
+    else
+    {
+    // The first time the page loads, set the values
+    // of the HtmlInputText and HtmlInputCheckBox controls.
+
+      InputText1.Value = "Test";
+      InputCheckBox1.Checked = true;
+    }
+  }
+  
+</script>
+
+<html>
+
+<head id="Head1" 
+      runat="server">
+
+    <title>HtmlForm SubmitDisabledControls Property Example</title>
+
+</head>
+
+<body>
+
+  <form id="form1" 
+       submitdisabledcontrols="true"
+        runat="server">
+    
+      <h3>HtmlForm SubmitDisabledControls Property Example</h3>
+    
+      <input id="InputText1" 
+             name="InputText1" 
+             type="text"
+             runat="server" />
+
+      <input id="InputCheckBox1" 
+             name="InputCheckBox1" 
+             type="Checkbox" 
+             runat="server" />
+    
+      <asp:Button id="PostBackButton"
+                  text="Post back"
+                  runat="server" />
+
+  </form>    
+    
+</body>
+
+</html>
+
+<script Language="javascript">
+
+    // Disable the HTML controls on the form.
+    document.getElementById('InputText1').disabled = true;
+    document.getElementById('InputCheckBox1').disabled = true;
+</script>
diff --git a/mcs/class/System.Web/Test/standalone/htmlselect/datasourceid.aspx b/mcs/class/System.Web/Test/standalone/htmlselect/datasourceid.aspx
new file mode 100644 (file)
index 0000000..7c3d116
--- /dev/null
@@ -0,0 +1,21 @@
+<%@ Page Language="C#" AutoEventWireup="True" %>
+<%@ Import Namespace="System.Data" %>
+
+<html>
+<head>
+<script runat="server">
+       void Page_Load (object s, EventArgs e)
+       {
+               if (IsPostBack)
+                       return;
+       }
+</script>
+</head>
+<body>
+       <form runat="server">
+               <select runat="server" DataSourceID="XmlDataSource" DataTextField="name"> </select>
+
+               <asp:XmlDataSource ID="XmlDataSource" runat="server" DataFile="iran.xml" XPath="IranHistoricalPlaces/Place"/>
+       </form>
+</body>
+</html>
diff --git a/mcs/class/System.Web/Test/standalone/htmlselect/iran.xml b/mcs/class/System.Web/Test/standalone/htmlselect/iran.xml
new file mode 100644 (file)
index 0000000..dd10d56
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<IranHistoricalPlaces name="places">
+ <Place name="Taghe Bostan">
+  <City>Kermanshah</City>
+  <Antiquity>2000</Antiquity>
+ </Place>
+ <Place name="Persepolis">
+  <City>Shiraz</City>
+  <Antiquity>2500</Antiquity>
+ </Place>
+</IranHistoricalPlaces>
\ No newline at end of file
diff --git a/mcs/class/System.Web/Test/standalone/validators/login.aspx b/mcs/class/System.Web/Test/standalone/validators/login.aspx
new file mode 100644 (file)
index 0000000..bc79cb0
--- /dev/null
@@ -0,0 +1,34 @@
+<%@ Page Language="C#" EnableViewState="false" %>
+<%@ Import Namespace="System.Web.Security" %>
+<html>
+<script language="C#" runat=server>
+       void Login_Click (object sender, EventArgs e)
+       {
+               Console.WriteLine("In Login_Click");
+        if (IsPostBack == true && Page.IsValid)
+        {
+                       Console.WriteLine("Before RedirectFromLoginPage: Name=" + name.Value);
+                       FormsAuthentication.RedirectFromLoginPage(name.Value, PersistCookie.Checked);
+               }
+               else
+                       Console.WriteLine("No IsPostBack or Page not valid");
+       }
+</script>
+<head>
+<title>Login</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<form method="POST" action="login.aspx" runat="server">
+<asp:ValidationSummary runat="server" HeaderText="Please fix the following errors:" />
+Name: <input type="text" id="name" runat=server/></td><td><ASP:RequiredFieldValidator ControlToValidate="name"
+                        Display="Static" ErrorMessage="Please enter a name" runat=server>*</ASP:RequiredFieldValidator>
+<p />
+Password:<asp:textbox id="password" textmode="password" runat="server" />
+<p />
+<ASP:CheckBox id=PersistCookie runat="server" checked="true" /> activate autologin
+<p />
+<asp:button text="Login" OnClick="Login_Click" runat=server/>
+</form>
+</body>
+</html>
diff --git a/mcs/class/System.Web/browscap.ini.diff b/mcs/class/System.Web/browscap.ini.diff
new file mode 100644 (file)
index 0000000..8729f5b
--- /dev/null
@@ -0,0 +1,86 @@
+Index: browscap.ini
+===================================================================
+--- browscap.ini       (revision 49079)
++++ browscap.ini       (working copy)
+@@ -4958,6 +4958,8 @@
+ version=1.3
+ majorver=1
+ minorver=3
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ [Mozilla/5.0 (Macintosh; U; PPC Mac OS X; *) AppleWebKit/* (*) Safari/412*]
+ parent=Safari
+@@ -12398,6 +12400,8 @@
+ stripper=False
+ wap=False
+ netclr=False
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.0
+@@ -12424,6 +12428,8 @@
+ stripper=False
+ wap=False
+ netclr=False
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ [Mozilla/5.0 (Macintosh; *; PPC Mac OS X Mach-O; *rv:*) Gecko/* Firefox/1.0*]
+ parent=Firefox 1.0
+@@ -12469,6 +12475,9 @@
+ parent=Firefox 1.0
+ platform=Linux
++[Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050725 Firefox/1.0.6 (Ubuntu package 1.0.6)]
++parent=Firefox 1.0
++
+ [Mozilla/5.0 (X11; *; OpenBSD*; *rv:*) Gecko/* Firefox/1.0*]
+ parent=Firefox 1.0
+ platform=OpenBSD
+@@ -12713,6 +12722,8 @@
+ stripper=False
+ wap=False
+ netclr=False
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; StarOffice 5.0
+@@ -12999,6 +13010,8 @@
+ stripper=False
+ wap=False
+ netclr=False
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.8
+@@ -13025,6 +13038,8 @@
+ stripper=False
+ wap=False
+ netclr=False
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 1.5
+@@ -13278,6 +13293,8 @@
+ netclr=False
+ AK=False
+ SK=False
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 6.0
+@@ -13306,6 +13323,8 @@
+ netclr=False
+ AK=False
+ SK=False
++ecmascriptversion=1.3
++w3cdomversion=1.0
+ [Mozilla/?.0 (compatible; MSIE 6.0*;*Windows NT 5.2*)*]
+ parent=IE 6.0
index fc5f4432b895e02573bc6a81da5228eca0c946eb..817fc53e64719f5ab96b93b180985d4208a146f2 100644 (file)
@@ -1,3 +1,29 @@
+2005-09-13  Chris Toshok  <toshok@ximian.com>
+
+       * WebUIValidation.js (CustomValidatorEvaluateIsValid): the default
+       if an evaluationfunc wasn't provided is "valid".  Fixes #76078.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * webform.js (wasControlEnabled): use __enabledControlArray,
+       generated by the HtmlControl foo when using
+       SubmitDisabledControls.
+       (WebForm_ReEnableControls): used by HtmlForm's
+       SubmitDisabledControls.
+
+2005-09-06  Chris Toshok  <toshok@ximian.com>
+
+       * WebUIValidation.js (ValidatorCommonOnSubmit): reorder things so
+       that for validationsummary's we show the message box after we
+       display the summary.  This is because the alert blocks further
+       execution.
+       (ValidatorGetErrorMessage): return the errormessage in preference
+       to the text.
+       (ValidatorGetText): new function, return the text in preference to
+       the error message.
+       (ValidatorFailed): use ValidatorGetText, and always set the
+       innerHTML, not just when we don't have validationsummary's.
+       
 2005-08-27  Chris Toshok  <toshok@ximian.com>
 
        * webform.js: add copyright blurb, and add implementation of
index 3efefd58919946dedd7a5c8ca0f6deb4077f237e..dbea30eb40d6c31b05d7cafaac468ad89fcc8fe4 100644 (file)
@@ -67,28 +67,6 @@ function ValidatorCommonOnSubmit ()
                        if (header == null)
                                header = "";
 
-                       attr = vs.getAttribute ("showmessagebox");
-                       if (attr != null && attr.toLowerCase() == "true") {
-                               var v_contents = "";
-
-                               for (var v in Page_Validators) {
-                                       var vo = Page_Validators [v];
-
-                                       if (vo.getAttribute ("isvalid").toLowerCase() == "false") {
-                                               var text = ValidatorGetErrorMessage (vo);
-                                               if (text != null && text != "") {
-                                                       v_contents += "-" + text + "\n";
-                                               }
-                                       }
-                               }
-
-                               var alert_header = header;
-                               if (alert_header != "")
-                                       alert_header += "\n";
-                               summary_contents = alert_header + v_contents;
-                               alert (summary_contents);
-                       }
-
                        attr = vs.getAttribute ("showsummary");
                        if (attr == null || attr.toLowerCase() == "true") {
                                var displaymode = vs.getAttribute ("displaymode");
@@ -132,6 +110,28 @@ function ValidatorCommonOnSubmit ()
                                vs.innerHTML = html;
                                vs.style.display = "block";
                        }
+
+                       attr = vs.getAttribute ("showmessagebox");
+                       if (attr != null && attr.toLowerCase() == "true") {
+                               var v_contents = "";
+
+                               for (var v in Page_Validators) {
+                                       var vo = Page_Validators [v];
+
+                                       if (vo.getAttribute ("isvalid").toLowerCase() == "false") {
+                                               var text = ValidatorGetErrorMessage (vo);
+                                               if (text != null && text != "") {
+                                                       v_contents += "-" + text + "\n";
+                                               }
+                                       }
+                               }
+
+                               var alert_header = header;
+                               if (alert_header != "")
+                                       alert_header += "\n";
+                               summary_contents = alert_header + v_contents;
+                               alert (summary_contents);
+                       }
                }
        }
 
@@ -310,7 +310,7 @@ function CustomValidatorEvaluateIsValid (validator)
 
        var ctrl_value = ValidatorTrim (ValidatorGetValue (ControlToValidate));
 
-       var result = false;
+       var result = true;
 
        if (evaluationfunc && evaluationfunc != "") {
                args = {Value:ctrl_value, IsValid:false};
@@ -357,7 +357,17 @@ function ValidatorUpdateDisplay (v, valid)
 
 function ValidatorGetErrorMessage (v)
 {
-       var text = v.getAttribute ("text");
+       var text = v.getAttribute ("errormessage");
+       if (text == null || text == "")
+               text = v.getAttribute ("text"); 
+       if (text == null)
+               text = "";
+       return text;
+}
+
+function ValidatorGetText (v)
+{
+       var text = v.getAttribute ("text");     
        if (text == null || text == "")
                text = v.getAttribute ("errormessage");
        if (text == null)
@@ -367,10 +377,8 @@ function ValidatorGetErrorMessage (v)
 
 function ValidatorFailed (v)
 {
-       var text = ValidatorGetErrorMessage (v);
-       if (text != "" && !have_validation_summaries) {
-               v.innerHTML = text;
-       }
+       var text = ValidatorGetText (v);
+       v.innerHTML = text;
 
        ValidatorUpdateDisplay (v, false);
 }
index 256cd0be2c8aebbf3bf85851f80407079d701013..5e78889a2c1262af3144a055d0a56a46a4179525 100644 (file)
@@ -38,6 +38,31 @@ function WebForm_AutoFocus (id)
        }
 }
 
+function wasControlEnabled (id)
+{
+       if (typeof (__enabledControlArray) == 'undefined')
+               return false;
+
+       for (var i = 0; i < __enabledControlArray.length; i ++) {
+               if (id == __enabledControlArray[i])
+                       return true;
+       }
+
+       return false;
+}
+
+function WebForm_ReEnableControls()
+{
+       if (typeof (theForm) == 'undefined')
+               return;
+
+       for (var i = 0; i < theForm.childNodes.length; i ++) {
+               var node = theForm.childNodes[i];
+               if (node.disabled && wasControlEnabled (node.id))
+                       node.disabled = false;
+       }
+}
+
 function WebForm_DoPostback (ctrl, par, url, apb, pval, tf, csubm, vg)
 {
        if (pval && typeof(Page_ClientValidate) == "function" && !Page_ClientValidate())
index 49ad80defefa7e27b43f65e95c8d4beb4633e61e..d3c3496761111b9404dd56ec61a1e49c59f0954b 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-20 Konstantin Triger <kostat@mainsoft.com>
+
+        * Added jay.bat to run jay in java prebuild step
+        * System.XML.vmwcsproj: added prebuild step
+
 2005-08-31  Sebastien Pouliot  <sebastien@ximian.com>
 
        * Makefile: /unsafe isn't required to build System.Xml.
index d419ff209ac06f191a3ffa620a74206b457bd783..f57d7cca654b6d1ef6199446f4cc1a26adab1aef 100644 (file)
@@ -1,3 +1,13 @@
+2005-09-16  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ScriptCompilerInfo.cs : Compile correct replacement result.
+         Fixed bug #76116.
+
+2005-09-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Compiler.cs : (Compile) check children only when it is the document
+         element. Fixed bug #76046.
+
 2005-08-25  Atsushi Enomoto  <atsushi@ximian.com>
 
        * ScriptCompilerInfo.cs : It should not be "#line" when the source is
index 57b80b88218f1c20e86d309feb8a57976ea509c6..1b9f817213463b684c7e62178a94d6ddbf90a390 100644 (file)
@@ -137,7 +137,8 @@ namespace Mono.Xml.Xsl
                                this.res = new XmlUrlResolver ();
                        this.evidence = evidence;
 
-                       if (!nav.MoveToFirstChild ())
+                       // reject empty document.
+                       if (nav.NodeType == XPathNodeType.Root && !nav.MoveToFirstChild ())
                                throw new XsltCompileException ("Stylesheet root element must be either \"stylesheet\" or \"transform\" or any literal element.", null, nav);
                                
                        outputs [""] = new XslOutput ("");
index ef619c36801d3100340dd9cbf2ea0a0bf1c5b161..cbd9037287f2cc07d6eda60df784823d25b6e817 100644 (file)
@@ -102,7 +102,7 @@ namespace Mono.Xml.Xsl
                                DateTime.Now.ToString (CultureInfo.InvariantCulture))
                                .Replace ("{1}", classSuffix)
                                .Replace ("{2}", code);
-                       source = FormatSource (li, filename, code);
+                       source = FormatSource (li, filename, source);
 
                        CompilerResults res = compiler.CompileAssemblyFromSource (parameters, source);
                        foreach (CompilerError err in res.Errors)
index 3e17553ff1ede92844d6a8a1f8674a7b4e2c56d9..d3ffff2c57fc36beadc455ba613f126627a79dc5 100644 (file)
@@ -1,7 +1,7 @@
 <VisualStudioProject>\r
        <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{10268504-30C6-4B25-A4D7-FB0604173427}">\r
                <Build>\r
-                       <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="System.Xml" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="System.XML1" RunPostBuildEvent="OnBuildSuccess" StartupObject="">\r
+                       <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="System.Xml" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="$(ProjectDir)\jay.bat $(ProjectDir)" PostBuildEvent="" RootNamespace="System.XML1" RunPostBuildEvent="OnBuildSuccess" StartupObject="">\r
                                <Config Name="Debug" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_JVM" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" NoStdLib="false" NoWarn="" Optimize="false" OutputPath="bin\Debug\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4" />\r
                                <Config Name="Release" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_JVM" DocumentationFile="" DebugSymbols="false" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="" Optimize="true" OutputPath="bin\Release\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4" />\r
                                <Config Name="Debug_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;TARGET_JVM" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" NoStdLib="false" NoWarn="1595" Optimize="false" OutputPath="bin\Debug_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4" />\r
index f6cc388b79540223b1f0ee7a4ee0d28d9c828fb5..440e8b8fd420b4638d2e55966973bb682072871f 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-16  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XslTransform.cs : When Transform() returns XmlReader, allow empty
+         results. Fixed bug #76115.
+
 2005-08-31  Sebastien Pouliot  <sebastien@ximian.com>
 
        * XsltArgumentList.cs: Added a LinkDemand for Unrestricted on 
index 17ba1a584a47d323a8e5fa11bb9d46620edf9f33..2281ba9b789f74465d76f467a45d875fc8978c02 100644 (file)
@@ -90,7 +90,7 @@ namespace System.Xml.Xsl {
                        MemoryStream stream = new MemoryStream ();\r
                        Transform (input, args, new XmlTextWriter (stream, null), resolver);\r
                        stream.Position = 0;\r
-                       return new XmlTextReader (stream);\r
+                       return new XmlTextReader (stream, XmlNodeType.Element, null);\r
                }\r
 \r
 #if NET_1_1\r
index d7ff149ac0ede776c6d20e17d82f36efec3fb436..d3b2a14f86f2d950c1ac4790ca7eca597c83d31d 100644 (file)
@@ -1,3 +1,15 @@
+2005-09-14  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XmlTextReader.cs : when there is a heading half of surrogate at the
+         end of read buffer, it didn't treat it as a surrogate.
+         Fixed bug #76102.
+
+2005-09-14  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XmlTextWriter.cs : for surrogate pair, output character reference
+         as a single character instead of two reference pairs. Fixed bug #76095.
+         Patch by Brion Vibber.
+
 2005-08-31  Sebastien Pouliot  <sebastien@ximian.com>
 
        * XmlDocument.cs: Added an InheritanceDemand for Unrestricted on 
index 1c33b6f1f162974524aee62ee443c400260fac57..c859192db8b9bcfc366f272d1a62eab3b16890cb 100644 (file)
@@ -1084,9 +1084,9 @@ namespace System.Xml
                private int PeekChar ()
                {
                        if (peekCharsLength == peekCharsIndex) {
-                               if (!ReadTextReader ())
+                               if (!ReadTextReader (-1))
                                        return -1;
-                                       return PeekChar ();
+                               return PeekChar ();
                        }
 
                        char c = peekChars [peekCharsIndex];
@@ -1094,13 +1094,12 @@ namespace System.Xml
                                return -1;
                        if (!char.IsSurrogate (c))
                                return c;
-                       if (peekCharsLength == peekCharsIndex+1) {
-                               if (!ReadTextReader ())
+                       if (peekCharsLength == peekCharsIndex + 1) {
+                               if (!ReadTextReader (c))
                                        //FIXME: copy MS.NET behaviour when unpaired surrogate found
-                       return peekChars [peekCharsIndex];
-                               return PeekChar ();
+                                       return c;
                        }
-            
+
                        char highhalfChar = peekChars [peekCharsIndex];
                        char lowhalfChar = peekChars [peekCharsIndex+1];
 
@@ -1132,10 +1131,14 @@ namespace System.Xml
                        return ch;
                }
 
-               private bool ReadTextReader ()
+               private bool ReadTextReader (int remained)
                {
                        peekCharsIndex = 0;
-                       peekCharsLength = reader.Read (peekChars, 0, peekCharCapacity);
+                       if (remained >= 0)
+                               peekChars [0] = (char) remained;
+                       int offset = remained >= 0 ? 1 : 0;
+                       peekCharsLength = reader.Read (peekChars, offset,
+                               peekCharCapacity - offset) + offset;
                        return (peekCharsLength != 0);
                }
 
index 19d93a49b9db3367f87b5656096a23b85e49f4c4..2cbb6a053109ca7b87551444ee77a2bfad8e7ab1 100644 (file)
@@ -1011,11 +1011,18 @@ openElements [openElementCount - 1]).IndentingOverriden;
                                        pos = 6; break;
                                default:
                                        if (XmlChar.IsInvalid (source [i])) {
-                                               if (checkCharacters)
-                                                       throw new ArgumentException (String.Format ("Character hexadecimal value {0:4x} is invalid.", (int) source [i]));
-                                               invalid = source [i];
-                                               pos = -1;
-                                               break;
+                                               if (Char.IsSurrogate (source [i]) && source [i] < 0xDC00 &&
+                                                   i + 1 < count && Char.IsSurrogate (source [i + 1]) && source [i + 1] >= 0xDC00) {
+                                                       // A legitimate UTF-16 surrogate pair; let it through.
+                                                       i++;
+                                                       continue;
+                                               } else {
+                                                       if (checkCharacters)
+                                                               throw new ArgumentException (String.Format ("Character hexadecimal value {0:4x} is invalid.", (int) source [i]));
+                                                       invalid = source [i];
+                                                       pos = -1;
+                                                       break;
+                                               }
                                        }
                                        else
                                                continue;
index 2964d183f6b25e523a07dfaf8bc95267d335620b..bd2e23adf6d029a65cf368a85c5f67d2a96b9147 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XslTransformTests.cs : added testcase for bug #76115.
+       * MSXslScriptTests.cs : added testcase for bug #76116.
+
+2005-09-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XslTransformTests.cs : added testcase for bug #76046.
+
 2005-08-31  Sebastien Pouliot  <sebastien@ximian.com>
 
        * XsltArgumentListCas.cs: New. CAS unit tests for AddExtensionObject.
index 0aa7ff26fef1b2e222c9b8761899b660583f6ec2..67e025ad1bde512d3a413a8ed5079cb088fba951 100644 (file)
@@ -188,5 +188,30 @@ namespace MonoTests.System.Xml.Xsl
                        xslt.Load (new XmlTextReader (script, XmlNodeType.Document, null));
                        xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (TextWriter.Null));
                }
+
+               [Test]
+               [Category ("NotWorking")] // it depends on "mcs" existence
+               public void CompileNoLineInfoSource ()
+               {
+                       // bug #76116
+                       string xslt = @"<xslt:stylesheet xmlns:xslt='http://www.w3.org/1999/XSL/Transform' version='1.0' xmlns:msxsl='urn:schemas-microsoft-com:xslt' xmlns:stringutils='urn:schemas-sourceforge.net-blah' xmlns:nant='unknown-at-this-time'>
+    <xslt:output method='text' />
+    <msxsl:script language='C#' implements-prefix='stringutils'>
+    <![CDATA[
+        string PadRight( string str, int padding) {
+            return str.PadRight(padding);
+        }
+    ]]>
+    </msxsl:script>
+    <xslt:template match='/'>
+        <foo/>
+    </xslt:template>
+</xslt:stylesheet>";
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml (xslt);
+
+                       XslTransform t = new XslTransform ();
+                       t.Load (doc);
+               }
        }
 }
index 030342049cdf50ec3c07c1f1c7984768f86f0140..a53b95eea1e6723d126527e4036054643e76840a 100644 (file)
@@ -272,5 +272,36 @@ namespace MonoTests.System.Xml.Xsl
                        XPathDocument xmlDocument = new XPathDocument (new StringReader (xmlText));
                        transform.Transform (xmlDocument, null, TextWriter.Null);
                }
+
+               // bug #76046
+               [Test]
+               public void LoadStyleFromNonRoot ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       XslTransform xslt = new XslTransform ();
+                       doc.LoadXml ("<root><dummy /><xsl:transform xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0' /></root>");
+                       XmlNode node = doc.ChildNodes [0].ChildNodes [1];
+                       xslt.Load (node, null, null);
+               }
+
+               [Test]
+               public void ReturnEmptyResultsAsXmlReader ()
+               {
+                       // bug #76115
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml ("<xsl:transform xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0' />");
+                       XslTransform xslt = new XslTransform ();
+                       xslt.Load (doc, null, null);
+                       XmlReader reader = xslt.Transform(doc, null, new XmlUrlResolver ());
+                       reader.Read ();
+
+                       // another case - with xsl:output standalone='yes'
+                       doc.LoadXml ("<xsl:transform xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0' ><xsl:output standalone='yes' indent='no'/><xsl:template match='/'><foo/></xsl:template></xsl:transform>");
+                       xslt = new XslTransform ();
+                       xslt.Load (doc, null, null);
+                       reader = xslt.Transform (doc, null, new XmlUrlResolver ());
+                       while (!reader.EOF)
+                               reader.Read (); // btw no XMLdecl output.
+               }
        }
 }
index fbda69c71578a606f92d05421e309a0e0c36e9b9..e392717d17c15cfedb12dbfbab51b5280654113b 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-14  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XmlTextReaderTests.cs : added #76102 testcase.
+
+2005-09-14  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XmlTextWriterTests.cs : added #76095 testcase.
+
 2005-08-31  Sebastien Pouliot  <sebastien@ximian.com>
 
        * XmlSecureResolverTests.cs: Added more test cases for CreateEvidence.
index 534d35dcdc98898c2f27895df43630614c6daaab..9e872c20eeb4864b0f6908ba778aaa628f5d8024 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Makefile: build fix.
+
 2005-08-17  Atsushi Enomoto  <atsushi@ximian.com>
 
        * xmlconf.cs: we need error message to do real-world debugging.
index 0ae40fa985d5ec84f1f68991e982052255f108fe..42503d6af0405d1d5f0ffdc7e67565a41a1e1201 100644 (file)
@@ -3,7 +3,7 @@
 RUNTIME=mono\r
 XMLCONF_OPTIONS=\r
 CSCOMPILE=mcs\r
-REFERENCES=-d:NUNIT_SUPPORT -r:NUnit.Core -r:NUnit.Framework
+REFERENCES=-d:NUNIT_SUPPORT -r:nunit.core -r:nunit.framework
 TEST_ARCHIVE=xmlts20031210.zip\r
 TEST_CATALOG=xmlconf/xmlconf.xml\r
 TEST_PROG=xmlconf.dll\r
@@ -45,5 +45,5 @@ $(TEST_CATALOG): $(TEST_ARCHIVE)
        touch $(TEST_CATALOG)\r
 \r
 .cs.dll:
-       $(CSCOMPILE) /t:library $< $(REFERENCES)
+       $(CSCOMPILE) /t:library /lib:$(nunit_MONO_PATH) $< $(REFERENCES)
 
index cddb729133118f31951837b10a7e89572e19cdc3..2fd877ec9f5b93d8533148c69ad4735576fdf7ee 100644 (file)
@@ -1115,5 +1115,19 @@ namespace MonoTests.System.Xml
                                XmlNodeType.Document, null);
                        xtr.Read ();
                }
+
+               [Test] // bug #76102
+               public void SurrogateAtReaderByteCache ()
+               {
+                       XmlTextReader xtr = null;
+                       try {
+                               xtr = new XmlTextReader (File.OpenText ("Test/XmlFiles/76102.xml"));
+                               while (!xtr.EOF)
+                                       xtr.Read ();
+                       } finally {
+                               if (xtr != null)
+                                       xtr.Close ();
+                       }
+               }
        }
 }
index 9b9052800a145089ad3f09f0fa29c65cf85f134d..77ff021bd45063836a2d40954bd57eec31b9ec77 100644 (file)
@@ -1400,5 +1400,17 @@ namespace MonoTests.System.Xml
                        xtw.WriteQualifiedName ("n2", "");
                        xtw.WriteEndAttribute ();
                }
+
+               [Test] // bug #76095
+               public void SurrogatePairsInWriteString ()
+               {
+                       MemoryStream ms = new MemoryStream ();
+                       XmlWriter writer = new XmlTextWriter(ms, null);
+                       writer.WriteElementString("a", "\ud800\udf39");
+                       writer.Close();
+                       byte [] referent = new byte [] {0x3c, 0x61, 0x3e, 0xf0,
+                               0x90, 0x8c, 0xb9, 0x3c, 0x2f, 0x61, 0x3e};
+                       NUnit.Framework.Assert.AreEqual (referent, ms.ToArray ());
+               }
        }
 }
diff --git a/mcs/class/System.XML/Test/XmlFiles/76102.xml b/mcs/class/System.XML/Test/XmlFiles/76102.xml
new file mode 100644 (file)
index 0000000..8ca085a
--- /dev/null
@@ -0,0 +1 @@
+<a>************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************𐌹</a>
\ No newline at end of file
index 344aee80fda9ec70b6d3b96b77fc89ce6704101a..33bcac850a1f0c9facfa262bb6662127f8936143 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-14  Atsushi Enomoto <atsushi@ximian.com>
+
+       * 76102.xml : added test for bug #76102.
+
 2004-09-06  Atsushi Enomoto <atsushi@ximian.com>
 
        * added simple.xml (to be used for some tests).
diff --git a/mcs/class/System.XML/jay.bat b/mcs/class/System.XML/jay.bat
new file mode 100755 (executable)
index 0000000..e5b77fb
--- /dev/null
@@ -0,0 +1,13 @@
+echo "processing Parser.jay..."\r
+%1\..\..\jay\jay.exe -ct < %1\..\..\jay\skeleton.cs %1\System.Xml.XPath\Parser.jay > %1\System.Xml.XPath\Parser.cs\r
+\r
+echo "generating PatternParser.jay..."\r
+sed "s/\%%start Expr/\%%start Pattern/" %1\System.Xml.XPath\Parser.jay >%1\Mono.Xml.Xsl\PatternParser.jay\r
+\r
+echo "processing PatternParser.jay..."\r
+echo #define XSLT_PATTERN > %1\Mono.Xml.Xsl\PatternParser.cs\r
+%1\..\..\jay\jay.exe -ct < %1\..\..\jay\skeleton.cs %1\Mono.Xml.Xsl\PatternParser.jay >> %1\Mono.Xml.Xsl\PatternParser.cs\r
+\r
+echo "generating PatternTokenizer.cs"\r
+echo #define XSLT_PATTERN > %1\Mono.Xml.Xsl\PatternTokenizer.cs\r
+type %1\System.Xml.XPath\Tokenizer.cs >> %1\Mono.Xml.Xsl\PatternTokenizer.cs
\ No newline at end of file
diff --git a/mcs/class/System.Xml.XLinq/Assembly/AssemblyInfo.cs b/mcs/class/System.Xml.XLinq/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..1d1352e
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Ximian, Inc.  http://www.ximian.com
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the System.Xml.XLinq assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyTitle ("System.Xml.XLinq.dll")]
+[assembly: AssemblyDescription ("System.Xml.XLinq.dll")]
+[assembly: AssemblyConfiguration ("Development version")]
+[assembly: AssemblyCompany ("MONO development team")]
+[assembly: AssemblyProduct ("MONO CLI")]
+[assembly: AssemblyCopyright ("(c) 2003 Various Authors")]
+[assembly: AssemblyTrademark ("")]
+
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDefaultAlias ("System.Xml.XLinq.dll")]
+[assembly: AssemblyInformationalVersion ("0.0.0.1")]
+[assembly: NeutralResourcesLanguage ("en-US")]
+
+[assembly: ComVisible (false)]
+
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
diff --git a/mcs/class/System.Xml.XLinq/Assembly/ChangeLog b/mcs/class/System.Xml.XLinq/Assembly/ChangeLog
new file mode 100644 (file)
index 0000000..140a603
--- /dev/null
@@ -0,0 +1,4 @@
+2005-09-20  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * AssemblyInfo.cs : new file.
+
diff --git a/mcs/class/System.Xml.XLinq/ChangeLog b/mcs/class/System.Xml.XLinq/ChangeLog
new file mode 100644 (file)
index 0000000..bc4e0dd
--- /dev/null
@@ -0,0 +1,5 @@
+2005-09-20  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Makefile,
+         System.Xml.XLinq.dll.sources : new files.
+
diff --git a/mcs/class/System.Xml.XLinq/Makefile b/mcs/class/System.Xml.XLinq/Makefile
new file mode 100644 (file)
index 0000000..82a7d3d
--- /dev/null
@@ -0,0 +1,15 @@
+thisdir = class/System.Xml.XLinq
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Xml.XLinq.dll
+LIB_MCS_FLAGS = \
+               /r:System.dll \
+               /r:System.Xml.dll \
+               /d:LIST_BASED
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES =
+
+include ../../build/library.make
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq.dll.sources b/mcs/class/System.Xml.XLinq/System.Xml.XLinq.dll.sources
new file mode 100644 (file)
index 0000000..31b412f
--- /dev/null
@@ -0,0 +1,9 @@
+Assembly/AssemblyInfo.cs
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+System.Xml.XLinq/System.Xml.XLinq.cs
+System.Xml.XLinq/XAttribute.cs
+System.Xml.XLinq/XElementSequence.cs
+System.Xml.XLinq/XIterators.cs
+System.Xml.XLinq/XName.cs
+System.Xml.XLinq/XUtil.cs
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq/ChangeLog b/mcs/class/System.Xml.XLinq/System.Xml.XLinq/ChangeLog
new file mode 100644 (file)
index 0000000..2c2f0c0
--- /dev/null
@@ -0,0 +1,6 @@
+2005-09-20  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XAttribute.cs, XIterators.cs, XName.cs, XElementSequence.cs,
+         System.Xml.XLinq.cs :
+         Minimum implementation to run ms XLinqIntro.
+
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq/System.Xml.XLinq.cs b/mcs/class/System.Xml.XLinq/System.Xml.XLinq/System.Xml.XLinq.cs
new file mode 100644 (file)
index 0000000..914c4c5
--- /dev/null
@@ -0,0 +1,1286 @@
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using XPI = System.Xml.XLinq.XProcessingInstruction;
+
+
+namespace System.Xml.XLinq
+{
+       #region XMLdecl, Doctype, Comment, PI
+
+       public class XDeclaration : XNode
+       {
+               string encoding, standalone, version;
+
+               public XDeclaration (XmlReader reader)
+                       : this (reader.GetAttribute ("version"),
+                               reader.GetAttribute ("encoding"),
+                               reader.GetAttribute ("standalone"))
+               {
+               }
+
+               public XDeclaration (string version, string encoding, string standalone)
+               {
+                       this.version = version;
+                       this.encoding = encoding;
+                       this.standalone = standalone;
+               }
+
+               public string Encoding {
+                       get { return encoding; }
+                       set { encoding = value; }
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.XmlDeclaration; }
+               }
+
+               public string Standalone {
+                       get { return standalone; }
+                       set { standalone = value; }
+               }
+
+               public string Version {
+                       get { return version; }
+                       set { version = value; }
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.AppendFormat ("version=\"{0}\"", version);
+                       if (encoding != null)
+                               sb.AppendFormat (" encoding=\"{0}\"", encoding);
+                       if (standalone != null)
+                               sb.AppendFormat (" standalone=\"{0}\"", standalone);
+                       // "xml" is not allowed PI, but because of nasty
+                       // XmlWriter API design it must pass.
+                       w.WriteProcessingInstruction ("xml", sb.ToString ());
+               }
+       }
+
+       public class XDocumentType : XNode
+       {
+               string pubid, sysid, intSubset;
+
+               public XDocumentType ()
+               {
+               }
+
+               public XDocumentType (XmlReader reader)
+               {
+                       if (reader.NodeType != XmlNodeType.DocumentType)
+                               throw new ArgumentException ();
+
+                       pubid = reader.GetAttribute ("PUBLIC");
+                       sysid = reader.GetAttribute ("SYSTEM");
+                       intSubset = reader.Value;
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.DocumentType; }
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       XDocument doc = Document;
+                       XElement root = doc.Root;
+                       if (root != null)
+                               w.WriteDocType (root.Name.LocalName, pubid, sysid, intSubset);
+               }
+       }
+
+       public class XProcessingInstruction : XNode
+       {
+               string name;
+               string value;
+
+               public XProcessingInstruction (XmlReader r)
+               {
+                       if (r.NodeType != XmlNodeType.ProcessingInstruction)
+                               throw new ArgumentException ();
+
+                       name = r.Name;
+                       value = r.Value;
+               }
+
+               public XProcessingInstruction (string name, string value)
+               {
+                       this.name = name;
+                       this.value = value;
+               }
+
+               public string Data {
+                       get { return value; }
+                       set { this.value = value; }
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.ProcessingInstruction; }
+               }
+
+               public string Target {
+                       get { return name; }
+                       set { name = value; }
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       w.WriteProcessingInstruction (name, value);
+               }
+       }
+
+       public class XComment : XNode
+       {
+               string value;
+
+               public XComment (string value)
+               {
+                       this.value = value;
+               }
+
+               public XComment (XmlReader r)
+               {
+                       if (r.NodeType != XmlNodeType.Comment)
+                               throw new ArgumentException ();
+                       value = r.Value;
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.Comment; }
+               }
+
+               public string Value {
+                       get { return value; }
+                       set { this.value = value; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       XComment c = obj as XComment;
+                       return c != null && c.value == value;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return value.GetHashCode () ^ (int) NodeType;
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       w.WriteComment (value);
+               }
+       }
+
+       #endregion
+
+
+       #region CharacterData
+
+       public abstract class XCharacterNode : XNode
+       {
+               public override bool Equals (object obj)
+               {
+                       XCharacterNode n = obj as XCharacterNode;
+                       if (n == null)
+                               return false;
+                       return n.NodeType == NodeType &&
+                               ToString () == n.ToString ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       return ((int) NodeType) ^ ToString ().GetHashCode ();
+               }
+       }
+
+       // It is documented to exist, but I use it only in !LIST_BASED mode.
+       internal class XText : XCharacterNode
+       {
+               string value;
+
+               public XText (string value)
+               {
+                       this.value = value;
+               }
+
+               public XText (XmlReader r)
+               {
+                       if (r.NodeType != XmlNodeType.Text)
+                               throw new ArgumentException ();
+                       value = r.Value;
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.Text; }
+               }
+
+               public string Value {
+                       get { return value; }
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       w.WriteString (value);
+               }
+       }
+
+       public class XCData : XCharacterNode
+       {
+               string value;
+
+               public XCData (string value)
+               {
+                       this.value = value;
+               }
+
+               public XCData (XmlReader r)
+               {
+                       if (r.NodeType != XmlNodeType.CDATA)
+                               throw new ArgumentException ();
+                       value = r.Value;
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.CDATA; }
+               }
+
+               public string Value {
+                       get { return value; }
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       int start = 0;
+                       StringBuilder sb = null;
+                       for (int i = 0; i < value.Length - 2; i++) {
+                               if (value [i] == ']' && value [i + 1] == ']'
+                                       && value [i + 2] == '>') {
+                                       if (sb == null)
+                                               sb = new StringBuilder ();
+                                       sb.Append (value, start, i - start);
+                                       sb.Append ("]]&gt;");
+                                       start = i + 3;
+                               }
+                       }
+                       if (start != 0 && start != value.Length)
+                               sb.Append (value, start, value.Length - start);
+                       w.WriteCData (sb == null ? value : sb.ToString ());
+               }
+       }
+
+       #endregion
+
+
+       #region Tree structures
+
+       public abstract class XContainer : XNode
+       {
+#if LIST_BASED
+               List <object> list = new List <object> ();
+
+               internal object FirstChild {
+                       get { return list.Count > 0 ? list [0] : null; }
+               }
+
+               internal object LastChild {
+                       get { return list.Count > 0 ? list [list.Count - 1] : null; }
+               }
+#else
+               XNode lastChild;
+
+               internal XNode FirstChild {
+                       get { return lastChild != null ? lastChild.InternalNext : null; }
+               }
+
+               internal XNode LastChild {
+                       get { return lastChild; }
+                       set { lastChild = value; }
+               }
+#endif
+
+               void CheckChildType (object o)
+               {
+                       if (o == null || o is string || o is XNode)
+                               return;
+                       if (o is IEnumerable) {
+                               foreach (object oc in ((IEnumerable) o))
+                                       CheckChildType (oc);
+                               return;
+                       }
+                       else
+                               throw new ArgumentException ("Invalid child type: " + o.GetType ());
+               }
+
+               private void AddAttribute (XAttribute attr)
+               {
+                       if (this is XElement)
+                               ((XElement) this).SetAttributeNode (attr);
+                       else
+                               throw new ArgumentException ("Attribute is not allowed here.");
+               }
+
+               public void Add (object content)
+               {
+                       if (content == null)
+                               return;
+                       if (content is XAttribute) {
+                               AddAttribute ((XAttribute) content);
+                               return;
+                       }
+                       CheckChildType (content);
+#if LIST_BASED
+                       if (content is XNode)
+                               ((XNode) content).Parent = this;
+                       list.Add (content);
+#else
+                       XNode n = XUtil.ToNode (content);
+                       n.Parent = this;
+                       if (lastChild == null) {
+                               lastChild = n;
+                               n.InternalNext = n;
+                       }
+                       else {
+                               XNode firstChild = lastChild != null ? lastChild.InternalNext : null;
+                               lastChild.UpdateTree (this, n);
+                               n.UpdateTree (this, firstChild);
+                       }
+#endif
+               }
+
+               public void Add (params object [] content)
+               {
+                       for (int i = 0; i < content.Length; i++)
+                               Add (content [i]);
+               }
+
+               public void AddFirst (object content)
+               {
+                       if (content == null)
+                               return;
+                       if (content is XAttribute) {
+                               AddAttribute ((XAttribute) content);
+                               return;
+                       }
+                       CheckChildType (content);
+#if LIST_BASED
+                       if (content is XNode)
+                               ((XNode) content).Parent = this;
+                       list.Insert (0, content);
+#else
+                       XNode n = XUtil.ToNode (content);
+                       n.Parent = this;
+                       if (lastChild == null) {
+                               lastChild = n;
+                               n.InternalNext = n;
+                       }
+                       else {
+                               n.UpdateTree (this, lastChild.InternalNext);
+                               lastChild.UpdateTree (this, n);
+                       }
+#endif
+               }
+
+               public void AddFirst (params object [] content)
+               {
+                       for (int i = content.Length - 1; i >= 0; i--)
+                               AddFirst (content [i]);
+               }
+
+#if LIST_BASED
+               internal object GetNextSibling (object target)
+               {
+                       int i = list.IndexOf (target);
+                       return i + 1 == list.Count ? null : list [i + 1];
+               }
+
+               internal void InsertBefore (object from, object target)
+               {
+                       if (target is XAttribute) {
+                               AddAttribute ((XAttribute) target);
+                               return;
+                       }
+                       CheckChildType (target);
+                       int index = list.IndexOf (from);
+                       if (target is XNode)
+                               ((XNode) target).Parent = this;
+                       list.Insert (index, target);
+               }
+
+               internal void InsertBefore (object from, params object [] target)
+               {
+                       foreach (object o in target)
+                               CheckChildType (o);
+                       if (target.Length == 0)
+                               return;
+                       int index = list.IndexOf (from);
+                       if (index == 0) {
+                               List <object> tmp = list;
+                               list = new List <object> (list.Count + target.Length);
+                               Add (target);
+                               list.AddRange (tmp);
+                       } else {
+                               InsertAfter (list [index - 1], target);
+                       }
+               }
+
+               internal void InsertAfter (object from, object target)
+               {
+                       if (target is XAttribute) {
+                               AddAttribute ((XAttribute) target);
+                               return;
+                       }
+                       CheckChildType (target);
+                       int index = list.IndexOf (from);
+                       if (target is XNode)
+                               ((XNode) target).Parent = this;
+                       list.Insert (index + 1, target);
+               }
+
+               internal void InsertAfter (object from, params object [] target)
+               {
+                       for (int i = 0; i < target.Length; i++) {
+                               CheckChildType (target [i]);
+                               InsertAfter (from, target [i]);
+                               from = target [i];
+                       }
+               }
+
+               internal void RemoveChild (object target)
+               {
+                       list.Remove (target);
+               }
+#endif
+
+               public IEnumerable <object> Content ()
+               {
+#if LIST_BASED
+                       return list;
+#else
+                       return new XChildrenIterator (this);
+#endif
+               }
+
+               public IEnumerable <T> Content<T> ()
+               {
+                       return new XFilterIterator <T> (Content (), null);
+               }
+
+               public IEnumerable <XElement> Descendants ()
+               {
+                       return new XFilterIterator <XElement> (
+                               new XDescendantIterator <object> (Content ()), null);
+               }
+
+               public IEnumerable <XElement> Descendants (XName name)
+               {
+                       return new XFilterIterator <XElement> (
+                               new XDescendantIterator <object> (
+                                       Content ()), name);
+               }
+
+               public IEnumerable <T> Descendants <T> ()
+               {
+                       return new XFilterIterator <T> (
+                               new XDescendantIterator <object> (Content ()), null);
+               }
+
+               public IEnumerable <XElement> Elements ()
+               {
+                       return new XFilterIterator <XElement> (Content (), null);
+               }
+
+               public IEnumerable <XElement> Elements (XName name)
+               {
+                       return new XFilterIterator <XElement> (Content (), name);
+               }
+
+               public void ReadContentFrom (XmlReader reader)
+               {
+                       if (reader.IsEmptyElement)
+                               reader.Read ();
+                       else {
+                               reader.Read ();
+                               do {
+                                       if (reader.NodeType == XmlNodeType.EndElement)
+                                               // end of the element.
+                                               break;
+                                       if (reader.NodeType == XmlNodeType.Text)
+                                               Add (reader.Value);
+                                       else
+                                               Add (XNode.ReadFrom (reader));
+                               } while (reader.Read ());
+                               reader.Read ();
+                       }
+               }
+
+               public void RemoveContent ()
+               {
+#if LIST_BASED
+                       foreach (object o in list)
+                               if (o is XNode)
+                                       ((XNode) o).Parent = null;
+#else
+                       foreach (XNode n in Content ())
+                               n.Remove ();
+#endif
+               }
+
+               public void ReplaceContent (object content)
+               {
+                       RemoveContent ();
+                       Add (content);
+               }
+
+               public void ReplaceContent (params object [] content)
+               {
+                       RemoveContent ();
+                       Add (content);
+               }
+
+               public void WriteContentTo (XmlWriter writer)
+               {
+                       foreach (object o in Content ()) {
+                               if (o is string)
+                                       writer.WriteString ((string) o);
+                               else if (o is XNode)
+                                       ((XNode) o).WriteTo (writer);
+                               else
+                                       throw new SystemException ("INTERNAL ERROR: list content item was " + o.GetType ());
+                       }
+               }
+       }
+
+       public class XDocument : XContainer
+       {
+               public XDocument ()
+               {
+               }
+
+               public XDocument (params object [] content)
+               {
+                       Add (content);
+               }
+
+               public XDocument (XDocument other)
+               {
+                       foreach (object o in other.Content ())
+                               Add (XUtil.Clone (o));
+               }
+
+               public XDeclaration Declaration {
+                       get {
+                               IEnumerator<XDeclaration> e = Content <XDeclaration> ().GetEnumerator ();
+                               return e.MoveNext () ? e.Current : null;
+                       }
+               }
+
+               public XDocumentType DocumentType {
+                       get {
+                               IEnumerator<XDocumentType> e = Content <XDocumentType> ().GetEnumerator ();
+                               return e.MoveNext () ? e.Current : null;
+                       }
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.Document; }
+               }
+
+               public XElement Root {
+                       get {
+                               IEnumerator<XElement> e = Elements ().GetEnumerator ();
+                               return e.MoveNext () ? e.Current : null;
+                       }
+               }
+
+               public static XDocument Load (string uri)
+               {
+                       return Load (uri, false);
+               }
+
+               public static XDocument Load (string uri, bool preserveWhitespaces)
+               {
+                       XmlReaderSettings s = new XmlReaderSettings ();
+                       // FIXME: finish System.Xml 2.0
+//                     s.IgnoreWhitespaces = !preserveWhitespaces;
+                       using (XmlReader r = XmlReader.Create (uri, s)) {
+                               return Load (r);
+                       }
+               }
+
+               public static XDocument Load (TextReader reader)
+               {
+                       return Load (reader, false);
+               }
+
+               public static XDocument Load (TextReader reader, bool preserveWhitespaces)
+               {
+                       XmlReaderSettings s = new XmlReaderSettings ();
+                       // FIXME: finish System.Xml 2.0
+//                     s.IgnoreWhitespaces = !preserveWhitespaces;
+//                     using (XmlReader r = XmlReader.Create (reader, s)) {
+                       using (XmlReader r = XmlReader.Create (reader)) {
+                               return Load (r);
+                       }
+               }
+
+               public static XDocument Load (XmlReader reader)
+               {
+                       XDocument doc = new XDocument ();
+                       if (reader.ReadState == ReadState.Initial)
+                               reader.Read ();
+                       for (; !reader.EOF; reader.Read ())
+                               if (reader.NodeType == XmlNodeType.Text)
+                                       doc.Add (reader.Value);
+                               else
+                                       doc.Add (XNode.ReadFrom (reader));
+                       return doc;
+               }
+
+               public static XDocument Parse (string s)
+               {
+                       return Parse (s, false);
+               }
+
+               public static XDocument Parse (string s, bool preserveWhitespaces)
+               {
+                       return Load (new StringReader (s), preserveWhitespaces);
+               }
+
+               public void Save (string filename)
+               {
+                       Save (filename, false);
+               }
+
+               public void Save (string filename, bool ignoreWhitespaces)
+               {
+                       XmlWriterSettings s = new XmlWriterSettings ();
+                       if (ignoreWhitespaces) {
+                               // hacky!
+                               s.Indent = true;
+                               s.IndentChars = String.Empty;
+                               s.NewLineChars = String.Empty;
+                       }
+                       using (XmlWriter w = XmlWriter.Create (filename)) {
+                               Save (w);
+                       }
+               }
+
+               public void Save (TextWriter tw)
+               {
+                       Save (tw, false);
+               }
+
+               public void Save (TextWriter tw, bool ignoreWhitespaces)
+               {
+                       XmlWriterSettings s = new XmlWriterSettings ();
+                       if (ignoreWhitespaces) {
+                               // hacky!
+                               s.Indent = true;
+                               s.IndentChars = String.Empty;
+                               s.NewLineChars = String.Empty;
+                       }
+                       using (XmlWriter w = XmlWriter.Create (tw)) {
+                               Save (w);
+                       }
+               }
+
+               public void Save (XmlWriter w)
+               {
+                       WriteTo (w);
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       WriteContentTo (w);
+               }
+       }
+
+       public class XElement : XContainer
+       {
+               static IEnumerable <XElement> emptySequence =
+                       new List <XElement> ();
+
+               public static IEnumerable <XElement> EmptySequence {
+                       get { return emptySequence; }
+               }
+
+               XName name;
+               List <XAttribute> attributes;
+
+               public XElement (XElement source)
+               {
+                       name = source.name;
+                       Add (source.Content<object> ());
+               }
+
+               public XElement (XmlReader source)
+               {
+                       if (source.NodeType != XmlNodeType.Element)
+                               throw new InvalidOperationException ();
+                       name = XName.Get (source.LocalName, source.NamespaceURI);
+                       if (source.MoveToFirstAttribute ()) {
+                               do {
+                                       SetAttribute (XName.Get (source.LocalName, source.NamespaceURI), source.Value);
+                               } while (source.MoveToNextAttribute ());
+                               source.MoveToElement ();
+                       }
+               }
+
+               public XElement (XName name)
+               {
+                       this.name = name;
+               }
+
+               public XElement (XName name, params object [] contents)
+               {
+                       this.name = name;
+                       Add (contents);
+               }
+
+               internal List <XAttribute> SafeAttributes {
+                       get {
+                               if (attributes == null)
+                                       attributes = new List <XAttribute> ();
+                               return attributes;
+                       }
+               }
+
+               public bool HasAttributes {
+                       get { return attributes != null && attributes.Count > 0; }
+               }
+
+               public bool HasElements {
+                       get { return Elements ().GetEnumerator ().MoveNext (); }
+               }
+
+               public bool IsEmpty {
+                       get { return !Content <object> ().GetEnumerator ().MoveNext (); }
+               }
+
+               public XName Name {
+                       get { return name; }
+               }
+
+               public override XmlNodeType NodeType {
+                       get { return XmlNodeType.Element; }
+               }
+
+               public string Value {
+                       get {
+                               StringBuilder sb = null;
+                               foreach (string s in Content <string> ()) {
+                                       if (sb == null)
+                                               sb = new StringBuilder ();
+                                       sb.Append (s);
+                               }
+                               return sb == null ? String.Empty : sb.ToString ();
+                       }
+                       set {
+                               RemoveContent ();
+                               Add (value);
+                       }
+               }
+
+               IEnumerable <XElement> GetAncestorList (XName name, bool getMeIn)
+               {
+                       List <XElement> list = new List <XElement> ();
+                       if (getMeIn)
+                               list.Add (this);
+                       for (XElement el = Parent as XElement; el != null; el = el.Parent as XElement)
+                               if (name == null || el.Name == name)
+                                       list.Add (el);
+                       return list;
+               }
+
+               public XAttribute Attribute (XName name)
+               {
+                       if (attributes == null)
+                               return null;
+                       foreach (XAttribute a in attributes)
+                               if (a.Name == name)
+                                       return a;
+                       return null;
+               }
+
+               public IEnumerable <XElement> Ancestors ()
+               {
+                       return GetAncestorList (null, false);
+               }
+
+               public IEnumerable <XElement> Ancestors (XName name)
+               {
+                       return GetAncestorList (name, false);
+               }
+
+               public IEnumerable <XAttribute> Attributes ()
+               {
+                       return attributes != null ? attributes : XAttribute.EmptySequence;
+               }
+
+               public IEnumerable <XAttribute> Attributes (XName name)
+               {
+                       XAttribute a = Attribute (name);
+                       if (a == null)
+                               return XAttribute.EmptySequence;
+                       List <XAttribute> list = new List <XAttribute> ();
+                       list.Add (a);
+                       return list;
+               }
+
+               public override bool Equals (object obj)
+               {
+                       XElement e = obj as XElement;
+                       if (e == null || name != e.name)
+                               return false;
+                       IEnumerator e1 = Content ().GetEnumerator ();
+                       IEnumerator e2 = e.Content ().GetEnumerator ();
+                       do {
+                               if (e1.MoveNext ()) {
+                                       if (e2.MoveNext ()) {
+                                               if (!e1.Equals (e2.Current))
+                                                       return false;
+                                       }
+                                       else
+                                               return false;
+                               }
+                               else if (e2.MoveNext ())
+                                       return false;
+                       } while (true);
+               }
+
+               public override int GetHashCode ()
+               {
+                       int i = name.GetHashCode ();
+                       foreach (XAttribute a in Attributes ())
+                               i ^= a.GetHashCode ();
+                       foreach (object o in Content ())
+                               i ^= o.GetHashCode ();
+                       return i;
+               }
+
+               // Only XAttribute.set_Parent() can invoke this.
+               internal void InternalAppendAttribute (XAttribute attr)
+               {
+                       if (attr.Parent != this)
+                               throw new SystemException ("INTERNAL ERROR: should not happen.");
+                       SafeAttributes.Add (attr);
+               }
+
+               internal void InternalRemoveAttribute (XAttribute attr)
+               {
+                       if (attr.Parent != this)
+                               throw new SystemException ("INTERNAL ERROR: should not happen.");
+                       attributes.Remove (attr);
+               }
+
+               public static XElement Load (string uri)
+               {
+                       return Load (uri, false);
+               }
+
+               public static XElement Load (string uri, bool preserveWhitespaces)
+               {
+                       XmlReaderSettings s = new XmlReaderSettings ();
+                       // FIXME: finish System.Xml 2.0
+//                     s.IgnoreWhitespaces = !preserveWhitespaces;
+                       using (XmlReader r = XmlReader.Create (uri, s)) {
+                               return Load (r);
+                       }
+               }
+
+               public static XElement Load (TextReader tr)
+               {
+                       return Load (tr, false);
+               }
+
+               public static XElement Load (TextReader tr, bool preserveWhitespaces)
+               {
+                       XmlReaderSettings s = new XmlReaderSettings ();
+                       // FIXME: finish System.Xml 2.0
+//                     s.IgnoreWhitespaces = !preserveWhitespaces;
+//                     using (XmlReader r = XmlReader.Create (tr, s)) {
+                       using (XmlReader r = XmlReader.Create (tr)) {
+                               return Load (r);
+                       }
+               }
+
+               public static XElement Load (XmlReader r)
+               {
+                       XElement e = new XElement (r);
+                       e.ReadContentFrom (r);
+                       return e;
+               }
+
+               public static explicit operator bool (XElement e)
+               {
+                       return e.Value == "true";
+               }
+
+               // FIXME: similar operator overloads should go here.
+
+               public static XElement Parse (string s)
+               {
+                       return Parse (s, false);
+               }
+
+               public static XElement Parse (string s, bool preserveWhitespaces)
+               {
+                       return Load (new StringReader (s), preserveWhitespaces);
+               }
+
+               public void RemoveAll ()
+               {
+                       RemoveAttributes ();
+                       RemoveContent ();
+               }
+
+               public void RemoveAttributes ()
+               {
+                       if (attributes != null)
+                               foreach (XAttribute a in attributes)
+                                       a.Parent = null;
+                       attributes = null;
+               }
+
+               public void Save (string filename)
+               {
+                       Save (filename, false);
+               }
+
+               public void Save (string filename, bool ignoreWhitespaces)
+               {
+                       XmlWriterSettings s = new XmlWriterSettings ();
+                       if (ignoreWhitespaces) {
+                               // hacky!
+                               s.Indent = true;
+                               s.IndentChars = String.Empty;
+                               s.NewLineChars = String.Empty;
+                       }
+                       using (XmlWriter w = XmlWriter.Create (filename)) {
+                               Save (w);
+                       }
+               }
+
+               public void Save (TextWriter tw)
+               {
+                       Save (tw, false);
+               }
+
+               public void Save (TextWriter tw, bool ignoreWhitespaces)
+               {
+                       XmlWriterSettings s = new XmlWriterSettings ();
+                       if (ignoreWhitespaces) {
+                               // hacky!
+                               s.Indent = true;
+                               s.IndentChars = String.Empty;
+                               s.NewLineChars = String.Empty;
+                       }
+                       using (XmlWriter w = XmlWriter.Create (tw)) {
+                               Save (w);
+                       }
+               }
+
+               public void Save (XmlWriter w)
+               {
+                       WriteTo (w);
+               }
+
+               public IEnumerable <XElement> SelfAndAncestors ()
+               {
+                       return GetAncestorList (null, true);
+               }
+
+               public IEnumerable <XElement> SelfAndAncestors (XName name)
+               {
+                       return GetAncestorList (name, true);
+               }
+
+               public IEnumerable <XElement> SelfAndDescendants ()
+               {
+                       List <XElement> list = new List <XElement> ();
+                       list.Add (this);
+                       list.AddRange (Descendants ());
+                       return list;
+               }
+
+               public IEnumerable <XElement> SelfAndDescendants (XName name)
+               {
+                       List <XElement> list = new List <XElement> ();
+                       if (name == this.name)
+                               list.Add (this);
+                       list.AddRange (Descendants (name));
+                       return list;
+               }
+
+               public IEnumerable <T> SelfAndDescendants <T> ()
+               {
+                       List <T> list = new List <T> ();
+                       // since "this" is regarded as never castable to T,
+                       // we need to anonymize this.
+                       object o = this;
+                       if (o is T)
+                               list.Add ((T) o);
+                       list.AddRange (Descendants <T> ());
+                       return list;
+               }
+
+               public void SetAttribute (XName name, object value)
+               {
+                       XAttribute a = Attribute (name);
+                       if (value == null) {
+                               if (a != null)
+                                       a.Remove ();
+                       } else {
+                               if (a == null) {
+                                       new XAttribute (name, value).Parent = this;
+                               }
+                               else
+                                       a.Value = XUtil.ToString (value);
+                       }
+               }
+
+               public void SetAttributeNode (XAttribute attr)
+               {
+                       foreach (XAttribute a in Attributes (attr.Name))
+                               a.Remove ();
+                       attr.Parent = this;
+               }
+
+               public void SetElement (XName name, object value)
+               {
+                       IEnumerator <XElement> en = Elements (name).GetEnumerator ();
+                       XElement e = en.MoveNext () ? en.Current : null;
+                       if (value == null) {
+                               if (e != null)
+                                       e.Remove ();
+                       } else {
+                               if (e == null)
+                                       Add (new XElement (name, value));
+                               else
+                                       e.Value = XUtil.ToString (value);
+                       }
+               }
+
+               public override void WriteTo (XmlWriter w)
+               {
+                       w.WriteStartElement (name.LocalName, name.NamespaceName);
+
+                       if (attributes != null) {
+                               foreach (XAttribute a in attributes) {
+                                       if (a.Name.NamespaceName == XUtil.XmlnsNamespace && a.Name.LocalName != String.Empty)
+                                               w.WriteAttributeString ("xmlns", a.Name.LocalName, XUtil.XmlnsNamespace, a.Value);
+                                       else
+                                               w.WriteAttributeString (a.Name.LocalName, a.Name.NamespaceName, a.Value);
+                               }
+                       }
+
+                       WriteContentTo (w);
+
+                       w.WriteEndElement ();
+               }
+       }
+
+       public abstract class XNode
+       {
+               XContainer parent;
+#if !LIST_BASED
+               XNode next;
+#endif
+
+               public XDocument Document {
+                       get {
+                               XContainer e = Parent;
+                               if (e == null)
+                                       return null;
+                               do {
+                                       XContainer p = e.Parent;
+                                       if (p == null)
+                                               return e as XDocument; // might be XElement
+                               } while (true);
+                       }
+               }
+
+               public abstract XmlNodeType NodeType { get; }
+
+#if LIST_BASED
+               internal object
+#else
+               internal XNode
+#endif
+               PreviousSibling {
+                       get {
+                               if (parent == null || object.ReferenceEquals (parent.FirstChild, this))
+                                       return null;
+#if LIST_BASED
+                               IEnumerator e = Parent.Content ().GetEnumerator ();
+                               for (object o = null; e.MoveNext (); o = e.Current)
+                                       if (object.ReferenceEquals (e.Current, this))
+                                               return o;
+                               return null;
+#else
+                               for (XNode n = Parent.LastChild.next; n != null; n = n.next)
+                                       if (n.next == this)
+                                               return n;
+                               return null;
+#endif
+                       }
+               }
+
+#if LIST_BASED
+               internal object
+#else
+               internal XNode
+#endif
+               NextSibling {
+                       get {
+                               if (parent == null || object.ReferenceEquals (parent.LastChild, this))
+                                       return null;
+#if LIST_BASED
+                               return parent.GetNextSibling (this);
+#else
+                               return next;
+#endif
+                       }
+               }
+
+#if !LIST_BASED
+               internal XNode InternalNext {
+                       get { return next; }
+                       set { next = value; }
+               }
+#endif
+
+               public XContainer Parent {
+                       get { return parent; }
+                       internal set { parent = value; }
+               }
+
+#if !LIST_BASED
+               internal void UpdateTree (XContainer parent, XNode next)
+               {
+                       this.parent = parent;
+                       this.next = next;
+               }
+#endif
+
+               public string Xml {
+                       get {
+                               StringWriter sw = new StringWriter ();
+                               XmlWriter xw = XmlWriter.Create (sw);
+                               WriteTo (xw);
+                               xw.Close ();
+                               return sw.ToString ();
+                       }
+               }
+
+               public void AddAfterThis (object content)
+               {
+                       if (Parent == null)
+                               throw new InvalidOperationException ();
+#if LIST_BASED
+                       Parent.InsertAfter (this, content);
+#else
+                       XNode n = XUtil.ToNode (content);
+                       n.parent = Parent;
+                       n.next = next;
+                       next = n;
+                       if (Parent.LastChild == null || object.ReferenceEquals (Parent.LastChild, this))
+                               Parent.LastChild = n;
+#endif
+               }
+
+               public void AddAfterThis (params object [] content)
+               {
+                       if (Parent == null)
+                               throw new InvalidOperationException ();
+#if LIST_BASED
+                       Parent.InsertAfter (this, content);
+#else
+                       foreach (object o in new XFilterIterator <object> (content, null))
+                               AddAfterThis (o);
+#endif
+               }
+
+               public void AddBeforeThis (object content)
+               {
+                       if (Parent == null)
+                               throw new InvalidOperationException ();
+#if LIST_BASED
+                       Parent.InsertBefore (this, content);
+#else
+                       XNode n = XUtil.ToNode (content);
+                       n.parent = Parent;
+                       n.next = this;
+                       XNode p = PreviousSibling;
+                       if (p != null)
+                               PreviousSibling.next = n;
+                       else
+                               Parent.LastChild.next = this;
+                       if (Parent.LastChild == null || object.ReferenceEquals (Parent.LastChild, this))
+                               Parent.LastChild = n;
+#endif
+               }
+
+               public void AddBeforeThis (params object [] content)
+               {
+                       if (Parent == null)
+                               throw new InvalidOperationException ();
+#if LIST_BASED
+                       Parent.InsertBefore (this, content);
+#else
+                       foreach (object o in new XFilterIterator <object> (content, null))
+                               AddBeforeThis (o);
+#endif
+               }
+
+               public static XNode ReadFrom (XmlReader r)
+               {
+                       switch (r.NodeType) {
+                       case XmlNodeType.Element:
+                               return XElement.Load (r);
+                       case XmlNodeType.Text:
+                               throw new InvalidOperationException ();
+                       case XmlNodeType.CDATA:
+                               return new XCData (r);
+                       case XmlNodeType.ProcessingInstruction:
+                               return new XPI (r);
+                       case XmlNodeType.Comment:
+                               return new XComment (r);
+                       case XmlNodeType.XmlDeclaration:
+                               return new XDeclaration (r);
+                       case XmlNodeType.DocumentType:
+                               return new XDocumentType (r);
+                       default:
+                               throw new NotSupportedException ();
+                       }
+               }
+
+               public void Remove ()
+               {
+#if LIST_BASED
+                       Parent.RemoveChild (this);
+#else
+                       PreviousSibling.next = NextSibling;
+                       parent = null;
+#endif
+               }
+
+               public override string ToString ()
+               {
+                       return Xml;
+               }
+
+               public abstract void WriteTo (XmlWriter w);
+       }
+
+       #endregion
+}
+
+#endif
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XAttribute.cs b/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XAttribute.cs
new file mode 100644 (file)
index 0000000..59eb3f8
--- /dev/null
@@ -0,0 +1,93 @@
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using XPI = System.Xml.XLinq.XProcessingInstruction;
+
+
+namespace System.Xml.XLinq
+{
+       public class XAttribute
+       {
+               static IEnumerable <XAttribute> emptySequence =
+                       new List <XAttribute> ();
+
+               public static IEnumerable <XAttribute> EmptySequence {
+                       get { return emptySequence; }
+               }
+
+               XName name;
+               object value;
+               XElement parent;
+
+               public XAttribute (XAttribute source)
+               {
+                       name = source.name;
+                       value = source.value;
+               }
+
+               public XAttribute (XName name, object value)
+               {
+                       this.name = name;
+                       this.value = XUtil.ToString (value);
+               }
+
+               public XName Name {
+                       get { return name; }
+               }
+
+               public XElement Parent {
+                       get { return parent; }
+                       internal set {
+                               parent = value;
+                               value.InternalAppendAttribute (this);
+                       }
+               }
+
+               public string Value {
+                       get { return XUtil.ToString (value); }
+                       set { this.value = value; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       XAttribute a = obj as XAttribute;
+                       if (a == null)
+                               return false;
+                       return a.Name == name && a.value == value;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return name.GetHashCode () ^ value.GetHashCode ();
+               }
+
+               public static explicit operator bool (XAttribute a)
+               {
+                       return XUtil.ToBoolean (a.value);
+               }
+
+               public static explicit operator Nullable <bool> (XAttribute a)
+               {
+                       return a.value == null || String.Empty == a.value as string ?
+                               null : XUtil.ToNullableBoolean (a.value);
+               }
+
+               // FIXME: similar conversion methods follow.
+
+               public void Remove ()
+               {
+                       if (parent != null) {
+                               parent.InternalRemoveAttribute (this);
+                               parent = null;
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XElementSequence.cs b/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XElementSequence.cs
new file mode 100644 (file)
index 0000000..a8f52dd
--- /dev/null
@@ -0,0 +1,37 @@
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System.Xml.XLinq
+{
+       // [ExtensionAttribute]
+       public static class XElementSequence
+       {
+               // [ExtensionAttribute]
+               public static IEnumerable <XElement> Ancestors (IEnumerable <XElement> source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               // [ExtensionAttribute]
+               public static IEnumerable <XElement> Ancestors (IEnumerable <XElement> source, XName name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               // [ExtensionAttribute]
+               public static IEnumerable <XAttribute> Attributes (IEnumerable <XAttribute> source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               // [ExtensionAttribute]
+               public static IEnumerable <XAttribute> Attributes (IEnumerable <XAttribute> source, XName name)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XIterators.cs b/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XIterators.cs
new file mode 100644 (file)
index 0000000..5379f4e
--- /dev/null
@@ -0,0 +1,104 @@
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using XPI = System.Xml.XLinq.XProcessingInstruction;
+
+
+namespace System.Xml.XLinq
+{
+       // Iterators
+       internal class XFilterIterator <T> : IEnumerable <T>
+       {
+               IEnumerable <object> source;
+               XName name;
+
+               public XFilterIterator (IEnumerable <object> source, XName name)
+               {
+                       this.source = source;
+                       this.name = name;
+               }
+
+               public IEnumerator <T> GetEnumerator ()
+               {
+                       foreach (object o in source) {
+                               if (! (o is T))
+                                       continue;
+                               if (name != null && (! (o is XElement) || ((XElement) o).Name != name))
+                                       continue;
+                               yield return o as T;
+                       }
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return GetEnumerator ();
+               }
+       }
+
+       internal class XDescendantIterator <T> : IEnumerable <T>
+       {
+               IEnumerable <T> source;
+
+               public XDescendantIterator (IEnumerable <object> source)
+               {
+                       this.source = new XFilterIterator <T> (source, null);
+               }
+
+               public IEnumerator <T> GetEnumerator ()
+               {
+                       foreach (T t1 in source) {
+                               yield return t1;
+                               XContainer xc = t1 as XContainer;
+                               if (xc == null || xc.FirstChild == null)
+                                       continue;
+                               foreach (T t2 in new XDescendantIterator <T> (xc.Content ()))
+                                       yield return t2;
+                       }
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return GetEnumerator ();
+               }
+       }
+
+#if !LIST_BASED
+       internal class XChildrenIterator : IEnumerable <object>
+       {
+               XContainer source;
+               XNode n;
+
+               public XChildrenIterator (XContainer source)
+               {
+                       this.source = source;
+               }
+
+               public IEnumerator <object> GetEnumerator ()
+               {
+                       if (n == null) {
+                               n = source.FirstChild;
+                               if (n == null)
+                                       yield break;
+                       }
+                       do {
+                               yield return n;
+                               n = n.NextSibling;
+                       } while (n != source.LastChild);
+                       yield break;
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return GetEnumerator ();
+               }
+       }
+#endif
+}
+
+#endif
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XName.cs b/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XName.cs
new file mode 100644 (file)
index 0000000..5f8d8ec
--- /dev/null
@@ -0,0 +1,114 @@
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using XPI = System.Xml.XLinq.XProcessingInstruction;
+
+namespace System.Xml.XLinq
+{
+       public class XName
+       {
+               string expanded;
+               string local;
+               string ns;
+
+               private XName (string expanded)
+               {
+                       if (expanded == null || expanded.Length == 0)
+                               throw ErrorInvalidExpandedName ();
+                       this.expanded = expanded;
+                       if (expanded [0] == '{') {
+                               for (int i = 1; i < expanded.Length; i++) {
+                                       if (expanded [i] == '}')
+                                               ns = expanded.Substring (1, i - 1);
+                               }
+                               if (ns == null || ns.Length == 0) // {}foo is invalid
+                                       throw ErrorInvalidExpandedName ();
+                               if (expanded.Length == ns.Length + 2) // {foo} is invalid
+                                       throw ErrorInvalidExpandedName ();
+                               local = expanded.Substring (ns.Length + 2);
+                       }
+                       else {
+                               local = expanded;
+                               ns = String.Empty;
+                       }
+               }
+
+               private XName (string local, string ns)
+               {
+                       this.local = local;
+                       this.ns = ns;
+               }
+
+               private Exception ErrorInvalidExpandedName ()
+               {
+                       return new ArgumentException ("Invalid expanded name.");
+               }
+
+               public string ExpandedName {
+                       get {
+                               if (expanded == null)
+                                       expanded = ns != null ? String.Concat ("{", ns, "}", local) : local;
+                               return expanded;
+                       }
+               }
+
+               public string LocalName {
+                       get { return local; }
+               }
+
+               public string NamespaceName {
+                       get { return ns; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       XName n = obj as XName;
+                       return n != null && this == n;
+               }
+
+               public static XName Get (string expandedName)
+               {
+                       return new XName (expandedName);
+               }
+
+               public static XName Get (string localName, string namespaceName)
+               {
+                       return new XName (localName, namespaceName);
+               }
+
+               public override int GetHashCode ()
+               {
+                       return local.GetHashCode () ^ ns.GetHashCode ();
+               }
+
+               public static bool operator == (XName n1, XName n2)
+               {
+                       return (object) n1 == null && (object) n2 == null ||
+                               object.ReferenceEquals (n1, n2) ||
+                               n1.local == n2.local && n1.ns == n2.ns;
+               }
+
+               public static implicit operator XName (string s)
+               {
+                       return Get (s);
+               }
+
+               public static bool operator != (XName n1, XName n2)
+               {
+                       return ! (n1 == n2);
+               }
+
+               public override string ToString ()
+               {
+                       return ExpandedName;
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XUtil.cs b/mcs/class/System.Xml.XLinq/System.Xml.XLinq/XUtil.cs
new file mode 100644 (file)
index 0000000..a5ea226
--- /dev/null
@@ -0,0 +1,74 @@
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using XPI = System.Xml.XLinq.XProcessingInstruction;
+
+namespace System.Xml.XLinq
+{
+       internal static class XUtil
+       {
+               public const string XmlnsNamespace =
+                       "http://www.w3.org/2000/xmlns/";
+
+               // FIXME: implement
+               public static string ToString (object o)
+               {
+                       if (o is string)
+                               return (string) o;
+                       throw new NotImplementedException ();
+               }
+
+               public static bool ToBoolean (object o)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Nullable <bool> ToNullableBoolean (object o)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               // FIXME: this method is not enough by design.
+               public static XNode ToNode (object o)
+               {
+                       XNode n = o as XNode;
+                       if (n != null)
+                               return n;
+                       if (o is string)
+                               return new XText ((string) o);
+                       if (o is IEnumerable)
+                               throw new NotImplementedException ();
+                       return new XText (o.ToString ());
+               }
+
+               public static object Clone (object o)
+
+               {
+                       if (o is string)
+                               return (string) o;
+                       if (o is XElement)
+                               return new XElement ((XElement) o);
+                       if (o is XCData)
+                               return new XCData (((XCData) o).Value);
+                       if (o is XComment)
+                               return new XComment (((XComment) o).Value);
+                       XPI pi = o as XPI;
+                       if (pi != null)
+                               return new XPI (pi.Target, pi.Data);
+                       XDeclaration xd = o as XDeclaration;
+                       if (xd != null)
+                               return new XDeclaration (xd.Version, xd.Encoding, xd.Standalone);
+                       XDocumentType dtd = o as XDocumentType;
+                       if (dtd != null)
+                               throw new NotImplementedException ();
+                       throw new ArgumentException ();
+               }
+       }
+}
+#endif
index 57a6d83f03ee48ee79fefd5c3ce80833fd4cd6f1..73d11a7d5dbd109dbf5937ce5e85d5b6431e21ae 100644 (file)
@@ -1,3 +1,24 @@
+2005-09-19  Chris Toshok  <toshok@ximian.com>
+
+       * System.Configuration/ProviderBase.cs: nuke this - it's in
+       System.Configuration.Provider.
+
+       * System/InvalidDataException.cs: move this to System.IO, where it
+       belongs.
+       
+       * System.dll.sources: track movement of InvalidDataException.cs
+       and removal of ProviderBase.cs
+
+2005-09-19  Gert Driesen <drieseng@users.sourceforge.net>
+
+       * System_test.dll.sources: Added TypeConverterTest.cs and
+       PropertyDescriptorCollection.cs.
+
+2005-09-04  David Waite  <mass@akuma.org>
+
+       * System.dll.sources, System_test.dll.sources: Added LinkedList.cs,
+       LinkedListNode.cs and LinkedListTest.cs
+
 2005-08-28 Gert Driesen <drieseng@users.sourceforge.net>
 
        * System_test.dll.sources: Added DateTimeConverterTests.cs.
index bfdf513cd499076b06937885512f4a8965d092dd..52137efaab8de986bac67bafbafaa5305feddcec 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-04  David Waite  <mass@akuma.org>
+
+       * LinkedList.cs, LinkedListNode.cs: added implementation of LinkedList<T>
+
 2005-08-08  Kamil Skalski  <nazgul@nemerle.org>
 
        * Queue.cs, Stack.cs: remove implementation of ICollection<T>,
diff --git a/mcs/class/System/System.Collections.Generic/LinkedList.cs b/mcs/class/System/System.Collections.Generic/LinkedList.cs
new file mode 100644 (file)
index 0000000..1572688
--- /dev/null
@@ -0,0 +1,492 @@
+//
+// System.Collections.Generic.LinkedListNode
+//
+// Author:
+//    David Waite
+//
+// (C) 2005 David Waite (mass@akuma.org)
+//
+
+//
+// Copyright (C) 2005 David Waite
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+
+namespace System.Collections.Generic
+{
+       [Serializable, ComVisible (false)]
+       public class LinkedList <T> : ICollection <T>, ICollection, ISerializable, IDeserializationCallback
+       {
+               const string DataArrayKey = "DataArray";
+               const string VersionKey = "version";            
+               uint count, version;
+               object syncRoot;
+               // Internally a circular list - first.back == last
+               internal LinkedListNode <T> first;
+               internal SerializationInfo si;
+               
+               public LinkedList ()
+               {
+                       syncRoot = new object ();
+                       first = null;
+                       count = version = 0;
+               }
+               
+               public LinkedList (IEnumerable <T> collection) : this ()
+               {
+                       foreach (T item in collection)
+                               AddLast (item);
+               }
+               
+               protected LinkedList (SerializationInfo info, StreamingContext context) : this ()
+               {
+                       si = info;
+                       syncRoot = new object ();
+               }
+               
+               void VerifyReferencedNode (LinkedListNode <T> node)
+               {
+                       if (node == null)
+                               throw new ArgumentNullException ("node");
+                       
+                       if (node.List != this)
+                               throw new InvalidOperationException ();
+               }
+               
+               static void VerifyBlankNode (LinkedListNode <T> newNode)
+               {
+                       if (newNode == null)
+                               throw new ArgumentNullException ("newNode");
+
+                       if (newNode.List != null)
+                               throw new InvalidOperationException ();
+               }
+               
+               public LinkedListNode <T> AddAfter (LinkedListNode <T> node, T value)
+               {
+                       VerifyReferencedNode (node);                    
+                       LinkedListNode <T> newNode = new LinkedListNode <T> (this, value, node, node.forward);
+                       count++;
+                       version++;
+                       return newNode;
+               }
+
+               public void AddAfter (LinkedListNode <T> node, LinkedListNode <T> newNode)
+               {
+                       VerifyReferencedNode (node);
+                       VerifyBlankNode (newNode);
+                       newNode.InsertBetween (node, node.forward, this);
+                       count++;
+                       version++;
+               }
+               
+               public LinkedListNode <T> AddBefore (LinkedListNode <T> node, T value)
+               {
+                       VerifyReferencedNode (node);
+                       LinkedListNode <T> newNode = new LinkedListNode <T> (this, value, node.back, node);
+                       count++;
+                       version++;
+                       
+                       if (node == first)
+                               first = newNode;
+                       return newNode;
+               }
+               
+               public void AddBefore (LinkedListNode <T> node, LinkedListNode <T> newNode)
+               {
+                       VerifyReferencedNode (node);
+                       VerifyBlankNode (newNode);
+                       newNode.InsertBetween (node.back, node, this);
+                       count++;
+                       version++;
+                       
+                       if (node == first)
+                               first = newNode;
+               }               
+               
+               public void AddFirst (LinkedListNode <T> node)
+               {
+                       VerifyBlankNode (node);
+                       if (first == null)
+                               node.SelfReference (this);
+                       else
+                               node.InsertBetween (first.back, first, this);
+                       count++;
+                       version++;
+                       first = node;                   
+               }
+               
+               public LinkedListNode <T> AddFirst (T value)
+               {
+                       LinkedListNode <T> newNode;
+                       if (first == null)
+                               newNode = new LinkedListNode <T> (this, value);
+                       else
+                               newNode = new LinkedListNode <T> (this, value, first.back, first);
+                       count++;
+                       version++;
+                       first = newNode;
+                       return newNode;
+               }
+               
+               public LinkedListNode <T> AddLast (T value)
+               {
+                       LinkedListNode <T> newNode;
+                       if (first == null)
+                       {
+                               newNode = new LinkedListNode <T> (this, value);
+                               first = newNode;
+                       }
+                       else
+                               newNode = new LinkedListNode <T> (this, value, first.back, first);
+                       count++;
+                       version++;
+                       return newNode;
+               }
+               
+               public void AddLast (LinkedListNode <T> node)
+               {
+                       VerifyBlankNode (node);
+                       if (first == null)
+                       {
+                               node.SelfReference (this);
+                               first = node;
+                       }
+                       else
+                               node.InsertBetween (first.back, first, this);
+                       count++;
+                       version++;
+               }
+               
+               public void Clear ()
+               {
+                       count = 0;
+                       first = null;
+                       version++;
+               }
+               
+               public bool Contains (T value)
+               {
+                       LinkedListNode <T> node = first;
+                       if (node == null)
+                               return false;
+                       do
+                       {
+                               if (value.Equals (node.Value))
+                                       return true;
+                               node = node.forward;
+                       }
+                       while (node != first);
+
+                       return false;
+               }
+               
+               public void CopyTo (T [] array, int index)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if ( (uint) index < (uint) array.GetLowerBound (0))
+                               throw new ArgumentOutOfRangeException ("index");                                
+                       if (array.Rank != 1)
+                               throw new ArgumentException ("array", "Array is multidimensional");
+                       if (array.Length - index + array.GetLowerBound (0) < count)
+                               throw new ArgumentException ("number of items exceeds capacity");
+                               
+                       LinkedListNode <T> node = first;
+                       if (first == null)
+                               return;
+                       do
+                       {
+                               array [index] = node.Value;
+                               index++;
+                               node = node.forward;
+                       }
+                       while (node != first);
+               }
+               
+               public LinkedListNode <T> Find (T value)
+               {
+                       LinkedListNode <T> node = first;
+                       if (node == null)
+                               return null;
+                       do
+                       {
+                               if ( (value == null && node.Value == null) || value.Equals (node.Value))
+                                       return node;
+                               node = node.forward;
+                       }
+                       while (node != first);
+
+                       return null;
+               }
+               
+               public LinkedListNode <T> FindLast (T value)
+               {
+                       LinkedListNode <T> node = first;
+                       if (node == null)
+                               return null;
+                       do
+                       {
+                               node = node.back;
+                               if (value.Equals (node.Value))
+                                       return node;
+                       }
+                       while (node != first);
+
+                       return null;
+               }
+               
+               public Enumerator GetEnumerator ()
+               {
+                       return new Enumerator (this);
+               }
+               
+               [SecurityPermission (SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
+               public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       T [] data = new T [count];
+                       CopyTo (data, 0);
+                       info.AddValue (DataArrayKey, data, typeof (T []));
+                       info.AddValue (VersionKey, version);
+               }
+               
+               public void OnDeserialization (object sender)
+               {
+                       if (si != null)
+                       {
+                               T [] data = (T []) si.GetValue (DataArrayKey, typeof (T []));
+                               if (data != null)
+                                       foreach (T item in data)
+                                               AddLast (item);
+                               version = si.GetUInt32 (VersionKey);
+                               si = null;
+                       }
+               }
+               
+               public bool Remove (T value)
+               {
+                       LinkedListNode <T> node = Find (value);
+                       if (node == null)
+                               return false;
+                       Remove (node);
+                       return true;
+               }
+               
+               public void Remove (LinkedListNode <T> node)
+               {
+                       VerifyReferencedNode (node);
+                       count--;
+                       if (count == 0)
+                               first = null;
+
+                       if (node == first)
+                               first = first.forward;
+
+                       version++;
+                       node.Detach ();
+               }
+               
+               public void RemoveFirst ()
+               {
+                       if (first != null)
+                               Remove (first);
+               }
+               
+               public void RemoveLast ()
+               {
+                       if (first != null)
+                               Remove (first.back);                    
+               }
+               
+               void ICollection <T>.Add (T value)
+               {
+                       AddLast (value);
+               }
+               
+               void ICollection.CopyTo (Array array, int index)
+               {
+                       T [] Tarray = array as T [];
+                       if (Tarray == null)
+                               throw new ArgumentException ("array");
+                       CopyTo (Tarray, index);
+               }
+               
+               IEnumerator <T> IEnumerable <T>.GetEnumerator ()
+               {
+                       return GetEnumerator ();
+               }
+               
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return GetEnumerator ();
+               }
+               
+               public int Count {
+                       get { return (int) count; }
+               }
+               
+               public LinkedListNode <T> First {
+                       get { return first; }
+               }
+               
+               public LinkedListNode <T> Last {
+                       get { return (first != null) ? first.back : null; }
+               }
+               
+               bool ICollection <T>.IsReadOnly {
+                       get { return false; }
+               }
+               
+               bool ICollection.IsSynchronized {
+                       get { return false; }
+               }
+               
+               object ICollection.SyncRoot {
+                       get { return syncRoot; }
+               }
+
+               [Serializable, StructLayout (LayoutKind.Sequential)]
+               public struct Enumerator : IEnumerator <T>, IDisposable, IEnumerator, ISerializable, IDeserializationCallback
+               {
+                       const String VersionKey = "version";
+                       const String IndexKey = "index";
+                       const String ListKey = "list";
+                       
+                       LinkedList <T> list;
+                       LinkedListNode <T> current;
+                       int index;
+                       uint version;
+                       SerializationInfo si;
+                       
+                       internal Enumerator (LinkedList <T> parent)
+                       {
+                               si= null;
+                               this.list = parent;
+                               current = null;
+                               index = -1;
+                               version = parent.version;
+                       }
+                       
+                       internal Enumerator (SerializationInfo info, StreamingContext context)
+                       {
+                               si = info;
+                               list = (LinkedList <T>) si.GetValue (ListKey, typeof (LinkedList <T>));
+                               index = si.GetInt32 (IndexKey);
+                               version = si.GetUInt32 (VersionKey);
+                               current = null;
+                       }
+                       
+                       public T Current {
+                               get {
+                                       if (list == null)
+                                               throw new ObjectDisposedException (null);
+                                       if (current == null)
+                                               throw new InvalidOperationException ();
+                                       return current.Value;
+                               }
+                       }
+                       
+                       object IEnumerator.Current {
+                               get { return Current; }
+                       }
+                       
+                       public bool MoveNext ()
+                       {
+                               if (list == null)
+                                       throw new ObjectDisposedException (null);
+                               if (version != list.version)
+                                       throw new InvalidOperationException ("list modified");
+
+                               if (current == null)
+                                       current = list.first;
+                               else
+                               {                               
+                                       current = current.forward;
+                                       if (current == list.first)
+                                               current = null;
+                               }
+                               if (current == null)
+                               {
+                                       index = -1;
+                                       return false;
+                               }
+                               ++index;
+                               return true;
+                       }
+                       
+                       void IEnumerator.Reset ()
+                       {
+                               if (list == null)
+                                       throw new ObjectDisposedException (null);
+                               if (version != list.version)
+                                       throw new InvalidOperationException ("list modified");
+
+                               current = null;
+                               index = -1;
+                       }
+                       
+                       public void Dispose ()
+                       {
+                               if (list == null)
+                                       throw new ObjectDisposedException (null);
+                               current = null;
+                               list = null;
+                       }
+                       
+                       [SecurityPermission (SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
+                       void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+                       {
+                               if (list == null)
+                                       throw new ObjectDisposedException (null);
+                               info.AddValue (VersionKey, version);
+                               info.AddValue (IndexKey, index);
+                       }
+                       
+                       void IDeserializationCallback.OnDeserialization (object sender)
+                       {
+                               if (si == null)
+                                       return;
+                                                               
+                               if (list.si != null)
+                                       ( (IDeserializationCallback) list).OnDeserialization (this);
+
+                               si = null;
+                               
+                               if (version == list.version && index != -1)
+                               {
+                                       LinkedListNode <T> node = list.First;
+                                       
+                                       for (int i = 0; i < index; i++)
+                                               node = node.forward;
+                                               
+                                       current = node;
+                               }
+                       }
+               }
+       }
+}
+#endif
\ No newline at end of file
diff --git a/mcs/class/System/System.Collections.Generic/LinkedListNode.cs b/mcs/class/System/System.Collections.Generic/LinkedListNode.cs
new file mode 100644 (file)
index 0000000..089ff80
--- /dev/null
@@ -0,0 +1,112 @@
+//
+// System.Collections.Generic.LinkedListNode
+//
+// Author:
+//    David Waite
+//
+// (C) 2005 David Waite (mass@akuma.org)
+//
+
+//
+// Copyright (C) 2005 David Waite
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Collections.Generic
+{
+       [ComVisible (false)]
+       public sealed class LinkedListNode <T>
+       {
+               T item;
+               LinkedList <T> container;
+
+               internal LinkedListNode <T> forward, back;
+               
+               public LinkedListNode (T value)
+               {
+                       item = value;
+               }
+
+               internal LinkedListNode (LinkedList <T> list, T value)
+               {
+                       container = list;
+                       item = value;
+                       this.back = this.forward = this;
+               }
+
+               internal LinkedListNode (LinkedList <T> list, T value, LinkedListNode <T> previousNode, LinkedListNode <T> nextNode)
+               {
+                       container = list;
+                       item = value;
+                       this.back = previousNode;
+                       this.forward = nextNode;
+                       previousNode.forward = this;
+                       nextNode.back = this;
+               }
+               
+               internal void Detach ()
+               {
+                       back.forward = forward;
+                       forward.back = back;
+
+                       forward = back = null;
+                       container = null;
+               }
+               
+               internal void SelfReference (LinkedList <T> list)
+               {
+                       forward = this;
+                       back = this;
+                       container = list;
+               }
+               
+               internal void InsertBetween (LinkedListNode <T> previousNode, LinkedListNode <T> nextNode, LinkedList <T> list)
+               {
+                       previousNode.forward = this;
+                       nextNode.back = this;
+                       this.forward = nextNode;
+                       this.back = previousNode;
+                       this.container = list;
+               } 
+                               
+               public LinkedList <T> List {
+                       get { return container; }
+               }
+               
+               public LinkedListNode <T> Next {
+                       get { return (container != null && forward != container.first) ? forward : null; }
+               }
+
+               public LinkedListNode <T> Previous {
+                       get { return (container != null && this != container.first) ? back : null ; }
+               }
+
+               public T Value { 
+                       get { return item; }
+                       set { item = value; }
+               }
+       }
+}
+#endif
index d5330e317dd784b5ae89e25523e8b22ce8e6f359..aa2243fc39a5e755ba9ecbe4d68fe4f7cf650737 100644 (file)
@@ -1,3 +1,16 @@
+2005-09-19  Gert Driesen <drieseng@users.sourceforge.net>
+
+       * TypeDescriptor.cs: Remove usage of removed internal
+       PropertyDescriptorCollection ctor. Return read-only collection.
+       * PropertyDescriptorCollection.cs: Removed internal ctor taking
+       ArrayList. Add ctor for making read-only collection. Added
+       read-only checks. Implemented IsReadOnly and IsFixedSize. Empty now
+       returns read-only collection to match MS.NET.
+
+2005-09-12  Gert Driesen <drieseng@users.sourceforge.net>
+
+       * TypeConverter.cs: Only return browsable properties in GetProperties.
+
 2005-08-28  Gert Driesen <drieseng@users.sourceforge.net>
 
        * DateTimeConverter.cs: ConvertTo must return zero-length string
index 8e363144afe4ce2de96e70d8d18d4a5204573681..7c3e3fa2dd930fa7c283d6cbbcb40c6b4ac93b12 100644 (file)
@@ -37,17 +37,12 @@ namespace System.ComponentModel
        /// <summary>
        /// Represents a collection of PropertyDescriptor objects.
        /// </summary>
-       //[DefaultMember ("Item")]
        public class PropertyDescriptorCollection : IList, ICollection, IEnumerable, IDictionary
        {
-               public static readonly PropertyDescriptorCollection Empty = new PropertyDescriptorCollection ((ArrayList)null);
-               ArrayList properties;
+               public static readonly PropertyDescriptorCollection Empty = new PropertyDescriptorCollection (null, true);
+               private ArrayList properties;
+               private bool readOnly;
 
-               internal PropertyDescriptorCollection (ArrayList list)
-               {
-                       properties = list;
-               }
-               
                public PropertyDescriptorCollection (PropertyDescriptor[] properties)
                {
                        this.properties = new ArrayList ();
@@ -56,6 +51,16 @@ namespace System.ComponentModel
 
                        this.properties.AddRange (properties);
                }
+
+#if NET_2_0
+               public
+#else
+               internal
+#endif
+               PropertyDescriptorCollection (PropertyDescriptor[] properties, bool readOnly) : this (properties)
+               {
+                       this.readOnly = readOnly;
+               }
                
                private PropertyDescriptorCollection ()
                {
@@ -63,6 +68,9 @@ namespace System.ComponentModel
 
                public int Add (PropertyDescriptor value)
                {
+                       if (readOnly) {
+                               throw new NotSupportedException ();
+                       }
                        properties.Add (value);
                        return properties.Count - 1;
                }
@@ -74,11 +82,18 @@ namespace System.ComponentModel
 
                void IDictionary.Add (object key, object value)
                {
+                       if ((value as PropertyDescriptor) == null) {
+                               throw new ArgumentException ("value");
+                       }
+
                        Add ((PropertyDescriptor) value);
                }
 
                public void Clear ()
                {
+                       if (readOnly) {
+                               throw new NotSupportedException ();
+                       }
                        properties.Clear ();
                }
 
@@ -114,6 +129,10 @@ namespace System.ComponentModel
 
                public virtual PropertyDescriptor Find (string name, bool ignoreCase)
                {
+                       if (name == null) {
+                               throw new ArgumentNullException ("name");
+                       }
+
                        foreach (PropertyDescriptor p in properties) {
                                if (0 == String.Compare (name, p.Name, ignoreCase))
                                        return p;
@@ -144,6 +163,9 @@ namespace System.ComponentModel
 
                public void Insert (int index, PropertyDescriptor value)
                {
+                       if (readOnly) {
+                               throw new NotSupportedException ();
+                       }
                        properties.Insert (index, value);
                }
 
@@ -154,6 +176,9 @@ namespace System.ComponentModel
 
                public void Remove (PropertyDescriptor value)
                {
+                       if (readOnly) {
+                               throw new NotSupportedException ();
+                       }
                        properties.Remove (value);
                }
 
@@ -169,6 +194,9 @@ namespace System.ComponentModel
 
                public void RemoveAt (int index)
                {
+                       if (readOnly) {
+                               throw new NotSupportedException ();
+                       }
                        properties.RemoveAt (index);
                }
 
@@ -252,31 +280,42 @@ namespace System.ComponentModel
                internal PropertyDescriptorCollection Filter (Attribute[] attributes)
                {
                        ArrayList list = new ArrayList ();
-                       foreach (PropertyDescriptor pd in properties)
-                               if (pd.Attributes.Contains (attributes))
+                       foreach (PropertyDescriptor pd in properties) {
+                               if (pd.Attributes.Contains (attributes)) {
                                        list.Add (pd);
-                                       
-                       return new PropertyDescriptorCollection (list);
+                               }
+                       }
+                       PropertyDescriptor[] descriptors = new PropertyDescriptor[list.Count];
+                       list.CopyTo (descriptors);
+                       return new PropertyDescriptorCollection (descriptors, true);
                }
                
                bool IDictionary.IsFixedSize
                {
                        get {
-                               return true;
+#if NET_2_0
+                               return readOnly;
+#else
+                               return !readOnly;
+#endif
                        }
                }
 
                bool IList.IsFixedSize
                {
                        get {
-                               return true;
+#if NET_2_0
+                               return readOnly;
+#else
+                               return !readOnly;
+#endif
                        }
                }
 
                bool IList.IsReadOnly
                {
                        get {
-                               return false;
+                               return readOnly;
                        }
                }
 
@@ -284,7 +323,7 @@ namespace System.ComponentModel
                {
                        get 
                        {
-                               return false;
+                               return readOnly;
                        }
                }
 
@@ -335,6 +374,10 @@ namespace System.ComponentModel
                                return this [(string) key];
                        }
                        set {
+                               if (readOnly) {
+                                       throw new NotSupportedException ();
+                               }
+
                                if (!(key is string) || (value as PropertyDescriptor) == null)
                                        throw new ArgumentException ();
                                int idx = properties.IndexOf (value);
@@ -358,6 +401,9 @@ namespace System.ComponentModel
                                return properties [index];
                        }
                        set {
+                               if (readOnly) {
+                                       throw new NotSupportedException ();
+                               }
                                properties [index] = value;
                        }
                }
index 18dc749e8ebc291b0e757d8972b77dd091a63793..522cee34a9bd8a2b23b548a29cfc66af7a58743e 100644 (file)
@@ -190,7 +190,7 @@ namespace System.ComponentModel
 
                public PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value)
                {
-                       return GetProperties (context, value, null);
+                       return GetProperties (context, value, new Attribute[1] { BrowsableAttribute.Yes });
                }
 
                public virtual PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context,
index 85955e6550027f7034122192f75820a12e9eedf1..178ac189efca8d0137b63110b737af938b859470 100644 (file)
@@ -737,10 +737,10 @@ public sealed class TypeDescriptor
                                ITypeDescriptorFilterService filter = (ITypeDescriptorFilterService) _component.Site.GetService (typeof(ITypeDescriptorFilterService));
                                cache = filter.FilterProperties (_component, t);
                        }
-                       
-                       ArrayList atts = new ArrayList ();
-                       atts.AddRange (t.Values);
-                       PropertyDescriptorCollection attCol = new PropertyDescriptorCollection (atts);
+
+                       PropertyDescriptor[] descriptors = new PropertyDescriptor[t.Values.Count];
+                       t.Values.CopyTo (descriptors, 0);
+                       PropertyDescriptorCollection attCol = new PropertyDescriptorCollection (descriptors, true);
                        if (cache) _properties = attCol;
                        return attCol;
                }
@@ -782,7 +782,7 @@ public sealed class TypeDescriptor
                        for (int n=0; n<props.Length; n++)
                                descs [n] = new ReflectionPropertyDescriptor (props[n]);
 
-                       _properties = new PropertyDescriptorCollection (descs);
+                       _properties = new PropertyDescriptorCollection (descs, true);
                        return _properties;
                }
        }
index 5bd4bcc01721a0e850e60ed627a82529cb31a26f..6cb9edee31c0e29f3ffda35dcbf78086d71f9c81 100644 (file)
@@ -1,3 +1,16 @@
+2005-09-19  Chris Toshok  <toshok@ximian.com>
+
+       * System.Configuration/SettingsProvider.cs,
+       System.Configuration/SettingsPropertyValueCollection.cs,
+       System.Configuration/SettingsPropertyCollection.cs,
+       System.Configuration/SettingsProviderCollection.cs,
+       System.Configuration/SettingsBase.cs,
+       System.Configuration/SettingsSerializeAs.cs,
+       System.Configuration/SettingsPropertyValue.cs,
+       System.Configuration/SettingsProperty.cs,
+       System.Configuration/SettingsContext.cs,
+       System.Configuration/SettingsAttributeDictionary.cs: new files.
+
 2005-07-05  Raja R Harinath  <rharinath@novell.com>
 
        * ConfigurationSettings.cs (ConnectionStrings): Change XML_DEP
diff --git a/mcs/class/System/System.Configuration/ProviderBase.cs b/mcs/class/System/System.Configuration/ProviderBase.cs
deleted file mode 100644 (file)
index f65f090..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// System.Configuration.ProviderBase.cs
-//
-// Authors:
-//     Duncan Mak (duncan@ximian.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-
-#if NET_2_0
-using System.Collections.Specialized;
-
-namespace System.Configuration
-{
-       public abstract class ProviderBase
-       {
-               string name;
-               NameValueCollection configuration;
-               
-               protected ProviderBase ()
-               {
-               }
-
-               public virtual string Name {
-                       get { return name; }
-               }
-
-               [MonoTODO]
-               public virtual void Initialize (string name, NameValueCollection configuration)
-               {
-                       this.name = name;
-                       this.configuration = configuration;
-               }
-       }
-}
-#endif
diff --git a/mcs/class/System/System.Configuration/SettingsAttributeDictionary.cs b/mcs/class/System/System.Configuration/SettingsAttributeDictionary.cs
new file mode 100644 (file)
index 0000000..a9cbd2d
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.SettingsProperty.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Configuration
+{
+       [SerializableAttribute] 
+       public class SettingsAttributeDictionary : Hashtable
+       {
+               public SettingsAttributeDictionary ()
+               {
+               }
+
+               public SettingsAttributeDictionary (SettingsAttributeDictionary attributes)
+                       : base (attributes)
+               {
+               }
+
+       }
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsBase.cs b/mcs/class/System/System.Configuration/SettingsBase.cs
new file mode 100644 (file)
index 0000000..abb20cc
--- /dev/null
@@ -0,0 +1,103 @@
+//
+// System.Web.UI.WebControls.SettingsBase.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.ComponentModel;
+
+namespace System.Configuration
+{
+
+       public abstract class SettingsBase
+       {
+               protected SettingsBase ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Initialize (SettingsContext context,    
+                                       SettingsPropertyCollection properties,
+                                       SettingsProviderCollection providers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual void Save ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static SettingsBase Synchronized (SettingsBase settingsBase)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual SettingsContext Context {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [Browsable (false)]
+               public bool IsSynchronized {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public virtual object this [ string propertyName ] {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public virtual SettingsPropertyCollection Properties {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public virtual SettingsPropertyValueCollection PropertyValues {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public virtual SettingsProviderCollection Providers {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsContext.cs b/mcs/class/System/System.Configuration/SettingsContext.cs
new file mode 100644 (file)
index 0000000..2b0f8cf
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.WebControls.SettingsPropertyValueCollection.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Configuration
+{
+
+       [Serializable] 
+       public class SettingsContext : Hashtable
+       {
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsProperty.cs b/mcs/class/System/System.Configuration/SettingsProperty.cs
new file mode 100644 (file)
index 0000000..31c4440
--- /dev/null
@@ -0,0 +1,174 @@
+//
+// System.Web.UI.WebControls.SettingsProperty.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Configuration
+{
+       public class SettingsProperty
+       {
+               public SettingsProperty (SettingsProperty propertyToCopy)
+                       : this (propertyToCopy.Name,
+                               propertyToCopy.PropertyType,
+                               propertyToCopy.Provider,
+                               propertyToCopy.IsReadOnly,
+                               propertyToCopy.DefaultValue,
+                               propertyToCopy.SerializeAs,
+                               new SettingsAttributeDictionary (propertyToCopy.Attributes),
+                               propertyToCopy.ThrowOnErrorDeserializing,
+                               propertyToCopy.ThrowOnErrorSerializing)
+               {
+               }
+
+               public SettingsProperty (string name)
+                       : this (name,
+                               null,
+                               null,
+                               false,
+                               null,
+                               SettingsSerializeAs.String,
+                               new SettingsAttributeDictionary(),
+                               false,
+                               false)
+               {
+               }
+
+               public SettingsProperty (string name,
+                                        Type propertyType,
+                                        SettingsProvider provider,
+                                        bool isReadOnly,
+                                        object defaultValue,
+                                        SettingsSerializeAs serializeAs,
+                                        SettingsAttributeDictionary attributes,
+                                        bool throwOnErrorDeserializing,
+                                        bool throwOnErrorSerializing)
+               {
+                       this.name = name;
+                       this.propertyType = propertyType;
+                       this.provider = provider;
+                       this.isReadOnly = isReadOnly;
+                       this.defaultValue = defaultValue;
+                       this.serializeAs = serializeAs;
+                       this.attributes = attributes;
+                       this.throwOnErrorDeserializing = throwOnErrorDeserializing;
+                       this.throwOnErrorSerializing = throwOnErrorSerializing;
+               }
+
+               public virtual SettingsAttributeDictionary Attributes {
+                       get {
+                               return attributes;
+                       }
+               }
+
+               public virtual object DefaultValue {
+                       get {
+                               return defaultValue;
+                       }
+                       set {
+                               defaultValue = value;
+                       }
+               }
+
+               public virtual bool IsReadOnly {
+                       get {
+                               return isReadOnly;
+                       }
+                       set {
+                               isReadOnly = value;
+                       }
+               }
+
+               public virtual string Name {
+                       get {
+                               return name;
+                       }
+                       set {
+                               name = value;
+                       }
+               }
+
+               public virtual Type PropertyType {
+                       get {
+                               return propertyType;
+                       }
+                       set {
+                               propertyType = value;
+                       }
+               }
+
+               public virtual SettingsProvider Provider {
+                       get {
+                               return provider;
+                       }
+                       set {
+                               provider = value;
+                       }
+               }
+
+               public virtual SettingsSerializeAs SerializeAs {
+                       get {
+                               return serializeAs;
+                       }
+                       set {
+                               serializeAs = value;
+                       }
+               }
+
+               public bool ThrowOnErrorDeserializing {
+                       get {
+                               return throwOnErrorDeserializing;
+                       }
+                       set {
+                               throwOnErrorDeserializing = value;
+                       }
+               }
+
+               public bool ThrowOnErrorSerializing {
+                       get {
+                               return throwOnErrorSerializing;
+                       }
+                       set {
+                               throwOnErrorSerializing = value;
+                       }
+               }
+
+               string name;
+               Type propertyType;
+               SettingsProvider provider;
+               bool isReadOnly;
+               object defaultValue;
+               SettingsSerializeAs serializeAs;
+               SettingsAttributeDictionary attributes;
+               bool throwOnErrorDeserializing;
+               bool throwOnErrorSerializing;
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsPropertyCollection.cs b/mcs/class/System/System.Configuration/SettingsPropertyCollection.cs
new file mode 100644 (file)
index 0000000..7a38dd4
--- /dev/null
@@ -0,0 +1,130 @@
+//
+// System.Web.UI.WebControls.SettingsPropertyCollection.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Configuration.Provider;
+
+namespace System.Configuration
+{
+
+       public class SettingsPropertyCollection : ICloneable, ICollection, IEnumerable
+       {
+               public SettingsPropertyCollection ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void Add (SettingsProperty property)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void Clear ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public object Clone ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void CopyTo (Array array, int index)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void Remove (string name)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void SetReadOnly ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               protected void OnAdd (SettingsProperty property)
+               {
+               }
+
+               protected void OnAddComplete (SettingsProperty property)
+               {
+               }
+
+               protected void OnClear ()
+               {
+               }
+
+               protected void OnClearComplete ()
+               {
+               }
+
+               protected void OnRemove (SettingsProperty property)
+               {
+               }
+
+               protected void OnRemoveComplete (SettingsProperty property)
+               {
+               }
+
+               public int Count {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public bool IsSynchronized {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public SettingsProperty this [ string name ] {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public object SyncRoot {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsPropertyValue.cs b/mcs/class/System/System.Configuration/SettingsPropertyValue.cs
new file mode 100644 (file)
index 0000000..b86e5d0
--- /dev/null
@@ -0,0 +1,99 @@
+//
+// System.Web.UI.WebControls.SettingsPropertyValue.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Configuration
+{
+
+       public class SettingsPropertyValue
+       {
+               public SettingsPropertyValue (SettingsProperty property)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public bool Deserialized {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public bool IsDirty {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public string Name {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public SettingsProperty Property {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public object PropertyValue {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public object SerializedValue {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public bool UsingDefaultValue {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsPropertyValueCollection.cs b/mcs/class/System/System.Configuration/SettingsPropertyValueCollection.cs
new file mode 100644 (file)
index 0000000..c550bf0
--- /dev/null
@@ -0,0 +1,106 @@
+//
+// System.Web.UI.WebControls.SettingsPropertyValueCollection.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Configuration.Provider;
+
+namespace System.Configuration
+{
+
+       public class SettingsPropertyValueCollection : ICloneable, ICollection, IEnumerable
+       {
+               public SettingsPropertyValueCollection ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void Add (SettingsPropertyValue property)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void Clear ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public object Clone ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void CopyTo (Array array, int index)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public IEnumerator GetEnumerator ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void Remove (string name)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public void SetReadOnly ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public int Count {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public bool IsSynchronized {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public SettingsPropertyValue this [ string name ] {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public object SyncRoot {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsProvider.cs b/mcs/class/System/System.Configuration/SettingsProvider.cs
new file mode 100644 (file)
index 0000000..3fe34e0
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// System.Web.UI.WebControls.SettingsProvider.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+
+using System.Configuration.Provider;
+
+namespace System.Configuration
+{
+
+       public abstract class SettingsProvider : ProviderBase
+       {
+               protected SettingsProvider ()
+               {
+               }
+
+               public abstract SettingsPropertyValueCollection GetPropertyValues (SettingsContext context,
+                                                                                  SettingsPropertyCollection collection);
+
+               public abstract void SetPropertyValues (SettingsContext context,
+                                                       SettingsPropertyValueCollection collection);
+
+               public abstract string ApplicationName { get; set; }
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsProviderCollection.cs b/mcs/class/System/System.Configuration/SettingsProviderCollection.cs
new file mode 100644 (file)
index 0000000..8d9e02a
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// System.Web.UI.WebControls.SettingsProviderCollection.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Configuration.Provider;
+
+namespace System.Configuration
+{
+       public class SettingsProviderCollection : System.Configuration.Provider.ProviderCollection
+       {
+               public SettingsProviderCollection ()
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public override void Add (ProviderBase provider)
+               {
+                               throw new NotImplementedException ();
+               }
+
+               public new SettingsProvider this [ string name ] { 
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System/System.Configuration/SettingsSerializeAs.cs b/mcs/class/System/System.Configuration/SettingsSerializeAs.cs
new file mode 100644 (file)
index 0000000..2dc4944
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.WebControls.SettingsSerializeAs.cs
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Configuration
+{
+       public enum SettingsSerializeAs
+       {
+               String = 0,
+               Xml = 1,
+               Binary = 2,
+               ProviderSpecific = 3
+       }
+}
+
+#endif
diff --git a/mcs/class/System/System.IO/InvalidDataException.cs b/mcs/class/System/System.IO/InvalidDataException.cs
new file mode 100644 (file)
index 0000000..e64d90c
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// System.InvalidDataException.cs
+//
+// Authors:
+//   Christopher James Lahey <clahey@ximian.com>
+//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2004 Novell, Inc.  http://www.novell.com
+//
+
+#if NET_2_0
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.IO
+{
+       [Serializable]
+       public class InvalidDataException : SystemException
+       {
+               const int Result = unchecked ((int)0x80131503);
+
+               // Constructors
+               public InvalidDataException ()
+                       : base (Locale.GetText ("Invalid data format."))
+               {
+                       HResult = Result;
+               }
+
+               public InvalidDataException (string message)
+                       : base (message)
+               {
+                       HResult = Result;
+               }
+
+               public InvalidDataException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+                       HResult = Result;
+               }
+
+               protected InvalidDataException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+               }
+       }
+}
+
+#endif
index ddb0ef6d5096a3c970841b4647d02efcf49ffb03..62a00b13a3c5cbfc088d58042960626f26d07176 100644 (file)
@@ -129,6 +129,8 @@ System.CodeDom/FieldDirection.cs
 System.CodeDom/MemberAttributes.cs
 System.Collections.Generic/Queue.cs
 System.Collections.Generic/Stack.cs
+System.Collections.Generic/LinkedList.cs
+System.Collections.Generic/LinkedListNode.cs
 System.Collections.Specialized/BitVector32.cs
 System.Collections.Specialized/CollectionsUtil.cs
 System.Collections.Specialized/HybridDictionary.cs
@@ -347,7 +349,6 @@ System.Configuration/IConfigurationSystem.cs
 System.Configuration/IgnoreSectionHandler.cs
 System.Configuration/NameValueFileSectionHandler.cs
 System.Configuration/NameValueSectionHandler.cs
-System.Configuration/ProviderBase.cs
 System.Configuration/SingleTagSectionHandler.cs
 System.Diagnostics/AlphabeticalEnumConverter.cs
 System.Diagnostics/BooleanSwitch.cs
@@ -417,6 +418,7 @@ System.IO/FileSystemEventHandler.cs
 System.IO/FileSystemWatcher.cs
 System.IO/IFileWatcher.cs
 System.IO/InternalBufferOverflowException.cs
+System.IO/InvalidDataException.cs
 System.IO/IODescriptionAttribute.cs
 System.IO/KeventWatcher.cs
 System.IO/MonoIO.cs
@@ -617,7 +619,6 @@ System.Timers/TimersDescriptionAttribute.cs
 System.Web/AspNetHostingPermission.cs
 System.Web/AspNetHostingPermissionAttribute.cs
 System.Web/AspNetHostingPermissionLevel.cs
-System/InvalidDataException.cs
 System/SRDescriptionAttribute.cs
 ../../build/common/MonoTODOAttribute.cs
 System/UriBuilder.cs
diff --git a/mcs/class/System/System/InvalidDataException.cs b/mcs/class/System/System/InvalidDataException.cs
deleted file mode 100644 (file)
index fbb6d15..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// System.InvalidDataException.cs
-//
-// Authors:
-//   Christopher James Lahey <clahey@ximian.com>
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2004 Novell, Inc.  http://www.novell.com
-//
-
-#if NET_2_0
-
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace System
-{
-       [Serializable]
-       public class InvalidDataException : SystemException
-       {
-               const int Result = unchecked ((int)0x80131503);
-
-               // Constructors
-               public InvalidDataException ()
-                       : base (Locale.GetText ("Invalid data format."))
-               {
-                       HResult = Result;
-               }
-
-               public InvalidDataException (string message)
-                       : base (message)
-               {
-                       HResult = Result;
-               }
-
-               public InvalidDataException (string message, Exception innerException)
-                       : base (message, innerException)
-               {
-                       HResult = Result;
-               }
-
-               protected InvalidDataException (SerializationInfo info, StreamingContext context)
-                       : base (info, context)
-               {
-               }
-       }
-}
-
-#endif
index 48226469410253489779c550a3e326109584312d..7f0f0beafc5cb5953442139d59ba1bdd1be0c498 100644 (file)
@@ -24,6 +24,7 @@ System.CodeDom.Compiler/CodeGeneratorTestBase.cs
 System.CodeDom.Compiler/IndentedTextWriterTest.cs
 System.Collections.Generic/QueueTest.cs
 System.Collections.Generic/StackTest.cs
+System.Collections.Generic/LinkedListTest.cs
 System.Collections.Specialized/BasicOperationsTest.cs
 System.Collections.Specialized/BitVector32Test.cs
 System.Collections.Specialized/HybridDictionaryTest.cs
@@ -39,9 +40,11 @@ System.ComponentModel/Int16ConverterTests.cs
 System.ComponentModel/Int32ConverterTests.cs
 System.ComponentModel/Int64ConverterTests.cs
 System.ComponentModel/LicenseManagerTests.cs
+System.ComponentModel/PropertyDescriptorCollectionTests.cs
 System.ComponentModel/SByteConverterTests.cs
 System.ComponentModel/SingleConverterTests.cs
 System.ComponentModel/ToolboxItemAttributeTests.cs
+System.ComponentModel/TypeConverterTests.cs
 System.ComponentModel/TypeDescriptorTests.cs
 System.ComponentModel/UInt16ConverterTests.cs
 System.ComponentModel/UInt32ConverterTests.cs
index 6eb42f899a5a9fc73cf2b64b4766ce7e599cc930..da63ee4590f8bb0fff5999e2baad61404c609c7d 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-19  Chris Toshok  <toshok@ximian.com>
+
+       * System.Configuration/SettingsPropertyTest.cs: new tests.
+
 2005-01-18  Jonathan Pryor  <jonpryor@vt.edu>
 
        * test-config-file: Remove "string-value" switch, as it causes
index 5665e8a1eccd0df62343ce871eefd4a6179010e7..a3f0a102c032780a3c2f0c20c70c985000a9060b 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-12  Gert Driesen <drieseng@users.sourceforge.net>
+
+       * VBCodeProviderTest.cs: Re-enabled CreateCompiler test as bug #75223
+       is fixed.
+
 2005-07-30  Gert Driesen <drieseng@users.sourceforge.net>
 
        * CodeGeneratorFromTypeTest.cs: Added NewSlot tests.
index c97927e67dc6044c45c13207e93662374e067fb5..f7586f551d0dab5f8315d286d274deb7ea667367 100644 (file)
@@ -116,8 +116,6 @@ namespace MonoTests.Microsoft.VisualBasic
 #if NET_2_0
                // there's not yet an mbas for the 2.0 profile
                [Category ("NotWorking")]
-#else
-               [Ignore ("Bug #75223")]
 #endif
                public void CreateCompiler ()
                {
index 559b7263a93d0d52a7492669ce645b4bbd5d4526..d64b9c9179a5e8f59bad8a57635aa88e58617de3 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-04  David Waite  <mass@akuma.org>
+
+       * LinkedListTest.cs: Added tests for LinkedList<T>
+
 2005-05-13  Atsushi Enomoto  <atsushi@ximian.com>
 
        * QueueTest.cs, StackTest.cs: moved from mscorlib test.
diff --git a/mcs/class/System/Test/System.Collections.Generic/LinkedListTest.cs b/mcs/class/System/Test/System.Collections.Generic/LinkedListTest.cs
new file mode 100644 (file)
index 0000000..b96e94a
--- /dev/null
@@ -0,0 +1,249 @@
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections.Generic
+{
+       [TestFixture]
+       public class LinkedListTest
+       {
+               LinkedList <int> intlist;
+               LinkedList <string> strings;
+
+               [SetUp]
+               public void Setup ()
+               {
+                       intlist = new LinkedList <int> ();
+                       
+                       // 2 3 4
+                       intlist.AddLast (3);
+                       intlist.AddLast (4);
+                       intlist.AddFirst (2);
+
+                       string [] tmpStrings = new string [] { "foo", "bar", "baz" };
+                       // FIXME workaround for 74953
+                       
+                       List <string> workaround = new List <string> ();
+                       foreach (string s in tmpStrings)
+                               workaround.Add (s);
+
+                       // strings = new LinkedList <string> (tmpStrings);
+                       strings = new LinkedList <string> (workaround);
+               }
+
+               [Test]
+               public void AddedTest ()
+               {
+                       int i = 2;
+                       foreach (int current in intlist)
+                       {
+                               Assert.AreEqual (i, current);
+                               i++;
+                       }
+                       Assert.AreEqual (5, i);
+               }
+
+               [Test]
+               public void CreatedTest ()
+               {
+                       string [] values = new string [] { "foo", "bar", "baz" };
+                       int i = 0;
+                       foreach (string current in strings)
+                       {
+                               Assert.AreEqual (values [i], current);
+                               i++;
+                       }
+                       Assert.AreEqual (3, i);
+               }
+
+               [Test]
+               public void NonCircularNodeTest ()
+               {
+                       LinkedListNode <int> node = intlist.First;
+                       Assert.AreEqual (2, node.Value);
+                       LinkedListNode <int> previous = node.Previous;
+                       Assert.IsNull (previous);
+
+                       node = node.Next;
+                       Assert.IsNotNull (node);
+                       Assert.AreEqual (3, node.Value);
+
+                       node = node.Next;
+                       Assert.IsNotNull (node);
+                       Assert.AreEqual (4, node.Value);
+
+                       node = node.Next;
+                       Assert.IsNull (node);
+               }
+
+               [Test]
+               public void ClearTest ()
+               {
+                       intlist.Clear ();
+                       Assert.AreEqual (0, intlist.Count);
+               }
+
+               [Test]
+               public void ContainsTest ()
+               {
+                       Assert.IsTrue (intlist.Contains (3));
+                       Assert.IsFalse (intlist.Contains (5));
+               }
+
+               [Test]
+               public void AddBeforeAndAfterTest ()
+               {
+                       LinkedListNode <int> node = intlist.Find (3);
+                       intlist.AddAfter (node, new LinkedListNode <int> (5));
+                       LinkedListNode <int> sixNode = intlist.AddAfter (node, 6);
+                       LinkedListNode <int> sevenNode = intlist.AddBefore (node, 7);
+                       intlist.AddBefore (node, new LinkedListNode <int> (8));
+
+                       Assert.AreEqual (6, sixNode.Value);
+                       Assert.AreEqual (7, sevenNode.Value);
+
+                       // 2 7 8 3 6 5 4
+                       int [] values = new int [] { 2, 7, 8, 3, 6, 5, 4 };
+                       int i = 0;
+                       foreach (int current in intlist)
+                       {
+                               Assert.AreEqual (values [i], current);
+                               i++;
+                       }
+                       for (LinkedListNode <int> current = intlist.First; current != null; current = current.Next )
+                               Assert.AreSame (intlist, current.List);
+               }
+
+               [Test]
+               public void CopyToTest ()
+               {
+                       int [] values = new int [] { 2, 3, 4 };
+                       int [] output = new int [3];
+                       intlist.CopyTo (output, 0);
+                       for (int i = 0; i < 3; i++)
+                               Assert.AreEqual (values [i], output [i]);
+               }
+
+               [Test]
+               public void FindTest ()
+               {
+                       intlist.AddFirst (4);
+
+                       LinkedListNode <int> head, tail;
+                       head = intlist.Find (4);
+                       tail = intlist.FindLast (4);
+                       Assert.AreEqual (intlist.First, head);
+                       Assert.AreEqual (intlist.Last, tail);
+               }
+
+               [Test]
+               public void RemoveTest ()
+               {
+                       Assert.IsTrue (intlist.Remove (3));
+                       Assert.AreEqual (2, intlist.Count);
+
+                       int [] values = { 2, 4 };
+                       int i = 0;
+                       foreach (int current in intlist)
+                       {
+                               Assert.AreEqual (values [i], current);
+                               i++;
+                       }
+                       Assert.IsFalse (intlist.Remove (5));
+
+                       LinkedListNode <string> node = strings.Find ("baz");
+                       strings.Remove (node);
+
+                       Assert.IsNull (node.List);
+                       Assert.IsNull (node.Previous);
+                       Assert.IsNull (node.Next);
+
+                       string [] values2 = { "foo", "bar" };
+                       i = 0;
+                       foreach (string current in strings)
+                       {
+                               Assert.AreEqual (values2 [i], current);
+                               i++;
+                       }
+               }
+
+               [Test, ExpectedException (typeof (ArgumentNullException))]
+               public void RemoveNullNodeTest ()
+               {
+                       intlist.Remove (null);
+               }
+
+               [Test, ExpectedException (typeof (InvalidOperationException))]
+               public void RemoveInvalidNodeTest ()
+               {
+                       intlist.Remove (new LinkedListNode <int> (4));
+               }
+
+               [Test]
+               public void RemoveFirstLastTest ()
+               {
+                       strings.RemoveFirst ();
+                       strings.RemoveLast ();
+                       Assert.AreEqual (1, strings.Count);
+                       Assert.AreEqual ("bar", strings.First.Value);
+               }
+
+               [Test]
+               public void ListSerializationTest ()
+               {
+                       BinaryFormatter formatter = new BinaryFormatter();
+                       MemoryStream stream = new MemoryStream();
+                       formatter.Serialize(stream, intlist);
+
+                       stream.Position = 0;
+                       object deserialized = formatter.Deserialize(stream);
+
+                       Assert.IsTrue(deserialized is LinkedList <int>);
+
+                       LinkedList <int> dlist = deserialized as LinkedList <int>;
+
+                       int [] values = { 2, 3, 4 };
+                       int i = 0;
+                       foreach (int value in dlist)
+                       {
+                               Assert.AreEqual (values [i], value);
+                               i++;
+                       }
+                       Assert.AreEqual(3, i);
+               }
+
+               /* FIXME: disabled pending fix for #75299
+               [Test]
+               */
+               public void EnumeratorSerializationTest ()
+               {
+                       BinaryFormatter formatter = new BinaryFormatter ();
+                       MemoryStream stream = new MemoryStream ();
+                       LinkedList<int>.Enumerator e = intlist.GetEnumerator ();
+                       formatter.Serialize (stream, e);
+
+                       stream.Position = 0;
+                       object deserialized = formatter.Deserialize(stream);
+
+                       Assert.IsTrue(deserialized is LinkedList <int>.Enumerator);
+
+                       LinkedList <int>.Enumerator d = (LinkedList <int>.Enumerator) deserialized;
+
+                       int [] values = { 2, 3, 4 };
+                       int i = 0;
+                       while (d.MoveNext ())
+                       {
+                               Assert.AreEqual (values [i], d.Current);
+                               i++;
+                       }
+                       Assert.AreEqual(3, i);
+               }
+       }
+}
+
+#endif
index 5f2fc78afb1e7f6e61230b314addf60e81147ceb..4401d72e1056a56b8e785539670971dd2041a9a0 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-19 Gert Driesen <drieseng@users.sourceforge.net>
+
+       * TypeConverterTests.cs: Added tests for TypeConverter.
+       * PropertyDescriptorCollection.cs: Added tests for PropertyDescriptor
+       Collection.
+
 2005-08-28 Gert Driesen <drieseng@users.sourceforge.net>
 
        * DateTimeConverterTests.cs: Added tests for DateTimeConverter.
diff --git a/mcs/class/System/Test/System.ComponentModel/PropertyDescriptorCollectionTests.cs b/mcs/class/System/Test/System.ComponentModel/PropertyDescriptorCollectionTests.cs
new file mode 100644 (file)
index 0000000..6791185
--- /dev/null
@@ -0,0 +1,375 @@
+//
+// System.ComponentModel.PropertyDescriptorCollection test cases
+//
+// Authors:
+//     Gert Driesen (drieseng@users.sourceforge.net)
+//
+// (c) 2005 Novell, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.ComponentModel
+{
+       [TestFixture]
+       public class PropertyDescriptorCollectionTests
+       {
+               [Test]
+               public void Empty ()
+               {
+                       PropertyDescriptorCollection descriptors = PropertyDescriptorCollection.Empty;
+                       AssertReadOnly (descriptors, "Empty");
+               }
+
+               [Test]
+               public void Find ()
+               {
+                       PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection (
+                               new PropertyDescriptor[] { new MockPropertyDescriptor("A", 1), 
+                                       new MockPropertyDescriptor("b", 2)});
+
+                       Assert.IsNotNull (descriptors.Find ("A", false), "#1");
+                       Assert.IsNotNull (descriptors.Find ("b", false), "#2");
+                       Assert.IsNull (descriptors.Find ("a", false), "#3");
+                       Assert.IsNotNull (descriptors.Find ("a", true), "#4");
+               }
+
+               [Test]
+               [ExpectedException (typeof(ArgumentNullException))]
+               public void Find_NullKey ()
+               {
+                       PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection (
+                               new PropertyDescriptor[] { new MockPropertyDescriptor("A", 1), 
+                                       new MockPropertyDescriptor("b", 2)});
+                       descriptors.Find (null, false);
+               }
+
+               [Test]
+               public void IList ()
+               {
+                       IList list = ((IList) new PropertyDescriptorCollection (null));
+
+                       Assert.AreEqual (0, list.Count, "#1");
+#if NET_2_0
+                       Assert.IsFalse (list.IsFixedSize, "#2");
+#else
+                       Assert.IsTrue (list.IsFixedSize, "#2");
+#endif
+                       Assert.IsFalse (list.IsReadOnly, "#3");
+                       Assert.IsFalse (list.IsSynchronized, "#4");
+                       Assert.IsNull (list.SyncRoot, "#5");
+               }
+
+               [Test]
+               public void IList_Add_Null ()
+               {
+                       IList list = ((IList) new PropertyDescriptorCollection (null));
+                       Assert.AreEqual (0, list.Count, "#1");
+                       list.Add (null);
+                       Assert.AreEqual (1, list.Count, "#2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidCastException))]
+               public void IList_Add_NoPropertyDescriptor ()
+               {
+                       IList list = ((IList) new PropertyDescriptorCollection (null));
+                       list.Add (5);
+               }
+
+               [Test]
+               public void IDictionary ()
+               {
+                       IDictionary dictionary = ((IDictionary) new PropertyDescriptorCollection (null));
+
+                       Assert.AreEqual (0, dictionary.Count, "#1");
+#if NET_2_0
+                       Assert.IsFalse (dictionary.IsFixedSize, "#2");
+#else
+                       Assert.IsTrue (dictionary.IsFixedSize, "#2");
+#endif
+                       Assert.IsFalse (dictionary.IsReadOnly, "#3");
+                       Assert.IsFalse (dictionary.IsSynchronized, "#4");
+                       Assert.IsNull (dictionary.SyncRoot, "#5");
+               }
+
+
+               [Test]
+               [ExpectedException (typeof(ArgumentException))]
+               public void IDictionary_Add_Null ()
+               {
+                       IDictionary dictionary = ((IDictionary) new PropertyDescriptorCollection (null));
+                       dictionary.Add ("whatever", null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void IDictionary_Add_NoPropertyDescriptor ()
+               {
+                       IDictionary dictionary = ((IDictionary) new PropertyDescriptorCollection (null));
+                       dictionary.Add ("whatever", 5);
+               }
+
+#if NET_2_0
+               public void ReadOnly ()
+               {
+                       PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null, true);
+                       AssertReadOnly (descriptors, "ReadOnly");
+               }
+#endif
+
+               private void AssertReadOnly (PropertyDescriptorCollection descriptors, string testCase)
+               {
+                       MockPropertyDescriptor mockPropertyDescr = new MockPropertyDescriptor (
+                               "Date", DateTime.Now);
+
+                       try {
+                               descriptors.Add (mockPropertyDescr);
+                               Assert.Fail (testCase + "#1");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               descriptors.Add (null);
+                               Assert.Fail (testCase + "#2");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               descriptors.Clear ();
+                               Assert.Fail (testCase + "#3");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               descriptors.Insert (0, mockPropertyDescr);
+                               Assert.Fail (testCase + "#4");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               descriptors.Insert (0, null);
+                               Assert.Fail (testCase + "#5");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               descriptors.Remove (mockPropertyDescr);
+                               Assert.Fail (testCase + "#6");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               descriptors.Remove (null);
+                               Assert.Fail (testCase + "#7");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               descriptors.RemoveAt (0);
+                               Assert.Fail (testCase + "#8");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       IList list = (IList) descriptors;
+                       Assert.IsTrue (((IList) descriptors).IsReadOnly, testCase + "#9");
+#if NET_2_0
+                       Assert.IsTrue (((IList) descriptors).IsFixedSize, testCase + "#10");
+#else
+                       Assert.IsFalse (((IList) descriptors).IsFixedSize, testCase + "#10");
+#endif
+
+                       try {
+                               list.Add (mockPropertyDescr);
+                               Assert.Fail (testCase + "#11");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               list.Add (null);
+                               Assert.Fail (testCase + "#12");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               list.Clear ();
+                               Assert.Fail (testCase + "#13");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               list.Insert (0, mockPropertyDescr);
+                               Assert.Fail (testCase + "#14");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               list.Insert (0, null);
+                               Assert.Fail (testCase + "#15");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               list.Remove (mockPropertyDescr);
+                               Assert.Fail (testCase + "#16");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               list.Remove (null);
+                               Assert.Fail (testCase + "#17");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               list.RemoveAt (0);
+                               Assert.Fail (testCase + "#18");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               list[0] = mockPropertyDescr;
+                               Assert.Fail (testCase + "#19");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               list[0] = null;
+                               Assert.Fail (testCase + "#20");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       IDictionary dictionary = (IDictionary) descriptors;
+                       Assert.IsTrue (dictionary.IsReadOnly, testCase + "#21");
+#if NET_2_0
+                       Assert.IsTrue (dictionary.IsFixedSize, testCase + "#22");
+#else
+                       Assert.IsFalse (dictionary.IsFixedSize, testCase + "#22");
+#endif
+
+                       try {
+                               dictionary.Add ("test", mockPropertyDescr);
+                               Assert.Fail (testCase + "#23");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // value is checked before read-only check
+                       try {
+                               dictionary.Add ("test", null);
+                               Assert.Fail (testCase + "#24");
+                       } catch (ArgumentException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               dictionary.Clear ();
+                               Assert.Fail (testCase + "#25");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       try {
+                               dictionary[0] = mockPropertyDescr;
+                               Assert.Fail (testCase + "#26");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       // ensure read-only check if performed before value is checked
+                       try {
+                               dictionary[0] = null;
+                               Assert.Fail (testCase + "#27");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+               }
+
+               private class MockPropertyDescriptor : PropertyDescriptor
+               {
+                       private object _value;
+
+                       public MockPropertyDescriptor (string name, object value) : base (name, null)
+                       {
+                               _value = value;
+                       }
+
+                       public override bool CanResetValue (object component)
+                       {
+                               return true;
+                       }
+
+                       public override object GetValue (object component)
+                       {
+                               return _value;
+                       }
+
+                       public override void ResetValue (object component)
+                       {
+                               _value = null;
+                       }
+
+                       public override void SetValue (object component, object value)
+                       {
+                               _value = value;
+                       }
+
+                       public override bool ShouldSerializeValue (object component)
+                       {
+                               return false;
+                       }
+
+                       public override Type ComponentType {
+                               get {
+                                       if (_value != null) {
+                                               return _value.GetType ();
+                                       }
+                                       return null;
+                               }
+                       }
+
+                       public override bool IsReadOnly {
+                               get {
+                                       return false;
+                               }
+                       }
+
+                       public override Type PropertyType {
+                               get {
+                                       return ComponentType;
+                               }
+                       }
+               }
+       }
+}
+
diff --git a/mcs/class/System/Test/System.ComponentModel/TypeConverterTests.cs b/mcs/class/System/Test/System.ComponentModel/TypeConverterTests.cs
new file mode 100644 (file)
index 0000000..2a2f79e
--- /dev/null
@@ -0,0 +1,134 @@
+//
+// System.ComponentModel.TypeConverter test cases
+//
+// Authors:
+//     Gert Driesen (drieseng@users.sourceforge.net)
+//
+// (c) 2005 Novell, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.ComponentModel
+{
+       [TestFixture]
+       public class TypeConverterTests
+       {
+               [Test]
+               public void DefaultImplementation ()
+               {
+                       BConverter converter = new BConverter ();
+                       C c = new C ();
+
+                       Assert.IsNull (converter.GetProperties (c), "#1");
+                       Assert.IsNull (converter.GetProperties (null, c), "#2");
+                       Assert.IsNull (converter.GetProperties (null, c, null), "#3");
+
+                       Assert.IsNull (converter.GetProperties (null), "#4");
+                       Assert.IsNull (converter.GetProperties (null, null), "#5");
+                       Assert.IsNull (converter.GetProperties (null, null, null), "#6");
+                       Assert.IsFalse (converter.GetCreateInstanceSupported (), "#7");
+                       Assert.IsFalse (converter.GetCreateInstanceSupported (null), "#8");
+                       Assert.IsFalse (converter.GetPropertiesSupported (), "#9");
+                       Assert.IsFalse (converter.GetPropertiesSupported (null), "#10");
+
+                       Assert.IsTrue (converter.CanConvertFrom (typeof (InstanceDescriptor)), "#11");
+                       Assert.IsTrue (converter.CanConvertFrom (null, typeof (InstanceDescriptor)), "#12");
+                       Assert.IsTrue (converter.CanConvertTo (typeof (string)), "#13");
+                       Assert.IsTrue (converter.CanConvertTo (null, typeof (string)), "#14");
+               }
+
+               [Test]
+               public void GetProperties ()
+               {
+                       PropertyDescriptorCollection properties = null;
+                       C c = new C ();
+                       TypeConverter converter = TypeDescriptor.GetConverter (c);
+
+                       Assert.AreEqual (typeof (AConverter).FullName, converter.GetType ().FullName, "#1");
+
+                       properties = converter.GetProperties (c);
+                       Assert.AreEqual (1, properties.Count, "#2");
+                       Assert.AreEqual ("A", properties[0].Name, "#3");
+
+                       // ensure collection is read-only
+                       try {
+                               properties.Clear ();
+                               Assert.Fail ("#4");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       properties = converter.GetProperties (null, c);
+                       Assert.AreEqual (1, properties.Count, "#5");
+                       Assert.AreEqual ("A", properties[0].Name, "#6");
+
+
+                       // ensure collection is read-only
+                       try {
+                               properties.Clear ();
+                               Assert.Fail ("#7");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       properties = converter.GetProperties (null, c, null);
+                       Assert.AreEqual (2, properties.Count, "#8");
+
+                       // ensure collection is read-only
+                       try {
+                               properties.Clear ();
+                               Assert.Fail ("#9");
+                       } catch (NotSupportedException) {
+                               // read-only collection cannot be modified
+                       }
+
+                       properties = converter.GetProperties (null);
+                       Assert.IsNull (properties, "#10");
+
+                       properties = converter.GetProperties (null, null);
+                       Assert.IsNull (properties, "#11");
+
+                       properties = converter.GetProperties (null, null, null);
+                       Assert.IsNull (properties, "#12");
+               }
+       }
+
+       [TypeConverter (typeof (AConverter))]
+       public class C
+       {
+               [Browsable (true)]
+               public int A {
+                       get { return 0; }
+               }
+
+               [Browsable (false)]
+               public int B {
+                       get { return 0; }
+               }
+       }
+
+       public class AConverter : TypeConverter
+       {
+               public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value, Attribute[] attributes)
+               {
+                       if (value is C) {
+                               return TypeDescriptor.GetProperties (value, attributes);
+                       }
+                       return base.GetProperties (context, value, attributes);
+               }
+
+               public override bool GetPropertiesSupported (ITypeDescriptorContext context)
+               {
+                       return true;
+               }
+       }
+
+       public class BConverter : TypeConverter
+       {
+       }
+}
diff --git a/mcs/class/System/Test/System.Configuration/SettingsPropertyTest.cs b/mcs/class/System/Test/System.Configuration/SettingsPropertyTest.cs
new file mode 100644 (file)
index 0000000..4b73b83
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// System.Configuration.SettingsPropertyTest.cs - Unit tests for
+// System.Configuration.SettingsProperty.
+//
+// Author:
+//     Chris Toshok  <toshok@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Text;
+using System.Configuration;
+using System.Collections.Specialized;
+using NUnit.Framework;
+
+namespace MonoTests.System.Configuration {
+
+       [TestFixture]
+       public class SettingsPropertyTest {
+
+               [Test]
+               public void Ctor_1 ()
+               {
+                       SettingsProperty p = new SettingsProperty ("property",
+                                                                  typeof (int),
+                                                                  null,
+                                                                  true,
+                                                                  10,
+                                                                  SettingsSerializeAs.Binary,
+                                                                  null,
+                                                                  true,
+                                                                  false);
+
+                       Assert.AreEqual ("property", p.Name, "A1");
+                       Assert.AreEqual (typeof (int), p.PropertyType, "A2");
+                       Assert.AreEqual (null, p.Provider, "A3");
+                       Assert.AreEqual (10, (int)p.DefaultValue, "A4");
+                       Assert.AreEqual (SettingsSerializeAs.Binary, p.SerializeAs, "A5");
+                       Assert.IsNull (p.Attributes, "A6");
+                       Assert.IsTrue (p.ThrowOnErrorDeserializing, "A7");
+                       Assert.IsFalse (p.ThrowOnErrorSerializing, "A8");
+                       Assert.IsTrue (p.IsReadOnly, "A9");
+               }
+
+               [Test]
+               public void Ctor_2 ()
+               {
+                       SettingsProperty q = new SettingsProperty ("property",
+                                                                  typeof (int),
+                                                                  null,
+                                                                  true,
+                                                                  10,
+                                                                  SettingsSerializeAs.Binary,
+                                                                  new SettingsAttributeDictionary(),
+                                                                  true,
+                                                                  false);
+
+                       SettingsProperty p = new SettingsProperty (q);
+
+                       Assert.AreEqual ("property", p.Name, "A1");
+                       Assert.AreEqual (typeof (int), p.PropertyType, "A2");
+                       Assert.AreEqual (null, p.Provider, "A3");
+                       Assert.AreEqual (10, (int)p.DefaultValue, "A4");
+                       Assert.AreEqual (SettingsSerializeAs.Binary, p.SerializeAs, "A5");
+                       Assert.IsNotNull (p.Attributes, "A6");
+                       Assert.IsTrue (p.ThrowOnErrorDeserializing, "A7");
+                       Assert.IsFalse (p.ThrowOnErrorSerializing, "A8");
+                       Assert.IsTrue (p.IsReadOnly, "A9");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void Ctor_2_ArgNull ()
+               {
+                       /* same as above, but a null
+                        * SettingsAttributeDictionary, which causes a
+                        * ANE in the ctor. */
+                       SettingsProperty q = new SettingsProperty ("property",
+                                                                  typeof (int),
+                                                                  null,
+                                                                  true,
+                                                                  10,
+                                                                  SettingsSerializeAs.Binary,
+                                                                  null,
+                                                                  true,
+                                                                  false);
+
+                       SettingsProperty p = new SettingsProperty (q);
+               }
+
+               [Test]
+               public void Ctor_3 ()
+               {
+                       SettingsProperty p = new SettingsProperty ("property");
+
+                       Assert.AreEqual ("property", p.Name, "A1");
+                       Assert.AreEqual (null, p.PropertyType, "A2");
+                       Assert.AreEqual (null, p.Provider, "A3");
+                       Assert.AreEqual (null, p.DefaultValue, "A4");
+                       Assert.AreEqual (SettingsSerializeAs.String, p.SerializeAs, "A5");
+                       Assert.IsNotNull (p.Attributes, "A6");
+                       Assert.IsFalse (p.ThrowOnErrorDeserializing, "A7");
+                       Assert.IsFalse (p.ThrowOnErrorSerializing, "A8");
+                       Assert.IsFalse (p.IsReadOnly, "A9");
+               }
+
+       }
+
+}
+
+#endif
index 49f62e726531ddd07852e5c958aaa2669075573a..a5de84d1c0cde96d65748b5e4bc12954ef331abe 100644 (file)
@@ -1,3 +1,14 @@
+2005-09-20  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * SimpleCollator.cs : In IsPrefix/IsSuffix, if target is an empty string,
+         immediately return true.
+
+2005-09-09  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * SimpleCollator.cs : IsSuffix() optimization logic was buggy, so just
+         use pretty simple way with LastIndexOf() (no significant perf.
+         problem).
+
 2005-09-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * README, Collation-notes.txt, CollationDataStructures.txt :
index db967572438e9eadf93315d9fcc14e83293a0809..6f5d16f30b02c49936b18cdd7ef547710a47ed5f 100644 (file)
@@ -1111,6 +1111,8 @@ Console.WriteLine (" -> '{0}'", c.Replacement);
 
                public bool IsPrefix (string s, string target, int start, int length, CompareOptions opt)
                {
+                       if (target.Length == 0)
+                               return true;
                        PreviousInfo prev = new PreviousInfo (false);
                        byte [] sk1 = new byte [4];
                        byte [] sk2 = new byte [4];
@@ -1136,6 +1138,11 @@ Console.WriteLine (" -> '{0}'", c.Replacement);
 
                public bool IsSuffix (string s, string target, int start, int length, CompareOptions opt)
                {
+                       if (target.Length == 0)
+                               return true;
+                       int last = LastIndexOf (s, target, start, length, opt);
+                       return last >= 0 && Compare (s, last, s.Length - last, target, 0, target.Length, opt) == 0;
+/*
                        // quick check : simple codepoint comparison
                        if (s.Length >= target.Length) {
                                int si = start;
@@ -1151,6 +1158,7 @@ Console.WriteLine (" -> '{0}'", c.Replacement);
                        byte [] sk1 = new byte [4];
                        byte [] sk2 = new byte [4];
                        return IsSuffix (opt, s, target, start, length, ref prev, sk1, sk2);
+*/
                }
 
                bool IsSuffix (COpt opt, string s, string t, int start, int length, ref PreviousInfo prev, byte [] sk1, byte [] sk2)
index cc88bf42e7479a71143c39710b82adcd62027be7..695589ec57f7511855f791932dc9a17a3da74593 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * X509Certificate.cs: Fixed version property (bug #76012). Added
+       ISerializable (for 2.0 so we're not breaking current compatibility).
+
 2005-04-27  Sebastien Pouliot  <sebastien@ximian.com>
 
        * PKCS12.cs: New. Copied from Mono.Security.dll to allow support of
index 263e09ba3351279baeb7e1913017bcaec32a982e..e145b30e6c296e77c54f68bc1ef43c53175f0039 100644 (file)
 //
 
 using System;
+using System.Runtime.Serialization;
 using System.Security.Cryptography;
 using SSCX = System.Security.Cryptography.X509Certificates;
+using System.Security.Permissions;
 using System.Text;
 
 namespace Mono.Security.X509 {
@@ -41,11 +43,12 @@ namespace Mono.Security.X509 {
        //      http://www.itu.int/ITU-T/studygroups/com17/languages/
 
 #if INSIDE_CORLIB
-       internal
+       internal class X509Certificate : ISerializable {
+#elif NET_2_0
+       public class X509Certificate : ISerializable {
 #else
-       public 
+       public class X509Certificate {
 #endif
-       class X509Certificate {
 
                private ASN1 decoder;
 
@@ -111,9 +114,9 @@ namespace Mono.Security.X509 {
                                // Certificate / TBSCertificate / Version
                                ASN1 v = decoder [0][tbs];
                                version = 1;                    // DEFAULT v1
-                               if (v.Tag == 0xA0) {
+                               if ((v.Tag == 0xA0) && (v.Count > 0)) {
                                        // version (optional) is present only in v2+ certs
-                                       version += v.Value [0]; // zero based
+                                       version += v [0].Value [0];     // zero based
                                        tbs++;
                                }
 
@@ -498,5 +501,19 @@ namespace Mono.Security.X509 {
                                        return false;
                        }
                }
+
+#if INSIDE_CORLIB || NET_2_0
+               protected X509Certificate (SerializationInfo info, StreamingContext context)
+               {
+                       Parse ((byte[]) info.GetValue ("raw", typeof (byte[])));
+               }
+
+               [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
+               public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       info.AddValue ("raw", m_encodedcert);
+                       // note: we NEVER serialize the private key
+               }
+#endif
        }
 }
index fb034c06f0d77b34d49846503ca9064815594640..88fcdaf0604cfad6473b74670b9ce8b2ccca0c15 100644 (file)
@@ -64,21 +64,21 @@ namespace System.Collections.Generic {
                        }
                }
 
-               Slot [] _table;
-               int _usedSlots;
-               private int _threshold;
+               Slot [] table;
+               int used_slots;
+               private int threshold;
 
-               IEqualityComparer<TKey> _hcp;
-               SerializationInfo _serializationInfo;
+               IEqualityComparer<TKey> hcp;
+               SerializationInfo serialization_info;
 
-               private uint _generation;
+               private uint generation;
 
                public int Count {
-                       get { return _usedSlots; }
+                       get { return used_slots; }
                        /* FIXME: this should be 'private' not 'internal'.  */
                        internal set {
-                               _usedSlots = value;
-                               ++_generation;
+                               used_slots = value;
+                               ++generation;
                        }
                }
 
@@ -97,7 +97,7 @@ namespace System.Collections.Generic {
                                if (slot == null) {
                                        DoAdd (index, key, value);
                                } else {
-                                       ++_generation;
+                                       ++generation;
                                        slot.Data = new KeyValuePair<TKey, TValue> (key, value);
                                }
                        }
@@ -140,24 +140,27 @@ namespace System.Collections.Generic {
 
                protected Dictionary (SerializationInfo info, StreamingContext context)
                {
-                       _serializationInfo = info;
+                       serialization_info = info;
                }
 
                void SetThreshold ()
                {
-                       _threshold = (int)(_table.Length * DEFAULT_LOAD_FACTOR);
-                       if (_threshold == 0 && _table.Length > 0)
-                               _threshold = 1;
+                       threshold = (int)(table.Length * DEFAULT_LOAD_FACTOR);
+                       if (threshold == 0 && table.Length > 0)
+                               threshold = 1;
                }
 
                private void Init (int capacity, IEqualityComparer<TKey> hcp)
                {
                        if (capacity < 0)
                                throw new ArgumentOutOfRangeException ("capacity");
-                       this._hcp = (hcp != null) ? hcp : EqualityComparer<TKey>.Default;
-                       _table = new Slot [capacity];
+                       this.hcp = (hcp != null) ? hcp : EqualityComparer<TKey>.Default;
+                       if (capacity == 0)
+                               capacity = INITIAL_SIZE;
+                       
+                       table = new Slot [capacity];
                        SetThreshold ();
-                       _generation = 0;
+                       generation = 0;
                }
 
                void CopyTo (KeyValuePair<TKey, TValue> [] array, int index)
@@ -171,8 +174,8 @@ namespace System.Collections.Generic {
                        if (array.Length - index < Count)
                                throw new ArgumentException ("Destination array cannot hold the requested elements!");
 
-                       for (int i = 0; i < _table.Length; ++i) {
-                               for (Slot slot = _table [i]; slot != null; slot = slot.Next)
+                       for (int i = 0; i < table.Length; ++i) {
+                               for (Slot slot = table [i]; slot != null; slot = slot.Next)
                                        array [index++] = slot.Data;
                        }
                }
@@ -183,12 +186,12 @@ namespace System.Collections.Generic {
                        //       Hashtable is automatically increased
                        //       to the smallest prime number that is larger
                        //       than twice the current number of Hashtable buckets
-                       uint newSize = (uint) Hashtable.ToPrime ((_table.Length << 1) | 1);
+                       uint newSize = (uint) Hashtable.ToPrime ((table.Length << 1) | 1);
 
                        Slot nextslot = null;
-                       Slot [] oldTable = _table;
+                       Slot [] oldTable = table;
 
-                       _table = new Slot [newSize];
+                       table = new Slot [newSize];
                        SetThreshold ();
 
                        int index;
@@ -197,8 +200,8 @@ namespace System.Collections.Generic {
                                        nextslot = slot.Next;
 
                                        index = DoHash (slot.Data.Key);
-                                       slot.Next = _table [index];
-                                       _table [index] = slot;
+                                       slot.Next = table [index];
+                                       table [index] = slot;
                                }
                        }
                }
@@ -214,30 +217,30 @@ namespace System.Collections.Generic {
 
                void DoAdd (int index, TKey key, TValue value)
                {
-                       if (Count++ >= _threshold) {
+                       if (Count++ >= threshold) {
                                Resize ();
                                index = DoHash (key);
                        }
-                       _table [index] = new Slot (key, value, _table [index]);
+                       table [index] = new Slot (key, value, table [index]);
                }
 
                private int DoHash (TKey key)
                {
-                       int size = this._table.Length;
-                       int h = _hcp.GetHashCode (key) & Int32.MaxValue;
+                       int size = this.table.Length;
+                       int h = hcp.GetHashCode (key) & Int32.MaxValue;
                        int spot = (int) ((uint) h % size);
                        return spot;
                }
 
                public IEqualityComparer<TKey> Comparer {
-                       get { return _hcp; }
+                       get { return hcp; }
                }
 
                public void Clear ()
                {
                        Count = 0;
-                       for (int i = 0; i < _table.Length; i++)
-                               _table [i] = null;
+                       for (int i = 0; i < table.Length; i++)
+                               table [i] = null;
                }
 
                public bool ContainsKey (TKey key)
@@ -250,8 +253,8 @@ namespace System.Collections.Generic {
                {
                        IEqualityComparer<TValue> cmp = EqualityComparer<TValue>.Default;
 
-                       for (int i = 0; i < _table.Length; ++i) {
-                               for (Slot slot = _table [i]; slot != null; slot = slot.Next) {
+                       for (int i = 0; i < table.Length; ++i) {
+                               for (Slot slot = table [i]; slot != null; slot = slot.Next) {
                                        if (cmp.Equals (value, slot.Data.Value))
                                                return true;
                                }
@@ -265,31 +268,31 @@ namespace System.Collections.Generic {
                        if (info == null)
                                throw new ArgumentNullException ("info");
 
-                       info.AddValue ("hcp", _hcp);
+                       info.AddValue ("hcp", hcp);
                        KeyValuePair<TKey, TValue> [] data = null;
                        if (Count > 0) {
                                data = new KeyValuePair<TKey,TValue> [Count];
                                CopyTo (data, 0);
                        }
                        info.AddValue ("data", data);
-                       info.AddValue ("buckets_hint", _table.Length);
+                       info.AddValue ("buckets_hint", table.Length);
                }
 
                public virtual void OnDeserialization (object sender)
                {
-                       if (_serializationInfo == null)
+                       if (serialization_info == null)
                                return;
 
-                       _hcp = (IEqualityComparer<TKey>) _serializationInfo.GetValue ("hcp", typeof (IEqualityComparer<TKey>));
+                       hcp = (IEqualityComparer<TKey>) serialization_info.GetValue ("hcp", typeof (IEqualityComparer<TKey>));
                        KeyValuePair<TKey, TValue> [] data =
                                (KeyValuePair<TKey, TValue> [])
-                               _serializationInfo.GetValue ("data", typeof (KeyValuePair<TKey, TValue> []));
+                               serialization_info.GetValue ("data", typeof (KeyValuePair<TKey, TValue> []));
 
-                       int buckets = _serializationInfo.GetInt32 ("buckets_hint");
+                       int buckets = serialization_info.GetInt32 ("buckets_hint");
                        if (buckets < INITIAL_SIZE)
                                buckets = INITIAL_SIZE;
 
-                       _table = new Slot [buckets];
+                       table = new Slot [buckets];
                        SetThreshold ();
                        Count = 0;
 
@@ -297,7 +300,7 @@ namespace System.Collections.Generic {
                                for (int i = 0; i < data.Length; ++i)
                                        Add (data [i].Key, data [i].Value);
                        }
-                       _serializationInfo = null;
+                       serialization_info = null;
                }
 
                public bool Remove (TKey key)
@@ -308,10 +311,10 @@ namespace System.Collections.Generic {
                                return false;
 
                        --Count;
-                       if (slot == _table [index]) {
-                               _table [index] = _table [index].Next;
+                       if (slot == table [index]) {
+                               table [index] = table [index].Next;
                        } else {
-                               Slot prev = _table [index];
+                               Slot prev = table [index];
                                while (prev.Next != slot)
                                        prev = prev.Next;
                                prev.Next = slot.Next;
@@ -328,8 +331,8 @@ namespace System.Collections.Generic {
                        if (key == null)
                                throw new ArgumentNullException ("key");
                        index = DoHash (key);
-                       Slot slot = _table [index];
-                       while (slot != null && !_hcp.Equals (key, slot.Data.Key))
+                       Slot slot = table [index];
+                       while (slot != null && !hcp.Equals (key, slot.Data.Key))
                                slot = slot.Next;
                        return slot;
                }
@@ -466,47 +469,47 @@ namespace System.Collections.Generic {
                public struct Enumerator : IEnumerator<KeyValuePair<TKey,TValue>>,
                        IDisposable, IDictionaryEnumerator, IEnumerator
                {
-                       Dictionary<TKey, TValue> _dictionary;
-                       uint _stamp;
+                       Dictionary<TKey, TValue> dictionary;
+                       uint stamp;
 
-                       Slot _current;
-                       int _nextIndex;
+                       Slot current;
+                       int next_index;
 
                        internal Enumerator (Dictionary<TKey, TValue> dictionary)
                        {
-                               _dictionary = dictionary;
-                               _stamp = dictionary._generation;
+                               this.dictionary = dictionary;
+                               stamp = dictionary.generation;
 
                                // The following stanza is identical to IEnumerator.Reset (),
                                // but because of the definite assignment rule, we cannot call it here.
-                               _nextIndex = 0;
-                               _current = null;
+                               next_index = 0;
+                               current = null;
                        }
 
                        public bool MoveNext ()
                        {
-                               if (_dictionary == null)
+                               if (dictionary == null)
                                        throw new ObjectDisposedException (null);
-                               if (_dictionary._generation != _stamp)
+                               if (dictionary.generation != stamp)
                                        throw new InvalidOperationException ("out of sync");
 
-                               // Pre-condition: _current == null => this is the first call
+                               // Pre-condition: current == null => this is the first call
                                // to MoveNext ()
-                               if (_current != null)
-                                       _current = _current.Next;
+                               if (current != null)
+                                       current = current.Next;
 
-                               while (_current == null && _nextIndex < _dictionary._table.Length)
-                                       _current = _dictionary._table [_nextIndex++];
+                               while (current == null && next_index < dictionary.table.Length)
+                                       current = dictionary.table [next_index++];
 
-                               // Post-condition: _current == null => this is the last call
+                               // Post-condition: current == null => this is the last call
                                // to MoveNext()
-                               return _current != null;
+                               return current != null;
                        }
 
                        public KeyValuePair<TKey, TValue> Current {
                                get {
                                        VerifyState ();
-                                       return _current.Data;
+                                       return current.Data;
                                }
                        }
 
@@ -516,14 +519,14 @@ namespace System.Collections.Generic {
 
                        void IEnumerator.Reset ()
                        {
-                               _nextIndex = 0;
-                               _current = null;
+                               next_index = 0;
+                               current = null;
                        }
 
                        DictionaryEntry IDictionaryEnumerator.Entry {
                                get {
                                        VerifyState ();
-                                       return new DictionaryEntry (_current.Data.Key, _current.Data.Value);
+                                       return new DictionaryEntry (current.Data.Key, current.Data.Value);
                                }
                        }
 
@@ -537,30 +540,30 @@ namespace System.Collections.Generic {
 
                        void VerifyState ()
                        {
-                               if (_dictionary == null)
+                               if (dictionary == null)
                                        throw new ObjectDisposedException (null);
-                               if (_dictionary._generation != _stamp)
+                               if (dictionary.generation != stamp)
                                        throw new InvalidOperationException ("out of sync");
-                               if (_current == null)
+                               if (current == null)
                                        throw new InvalidOperationException ();
                        }
                        public void Dispose ()
                        {
-                               _current = null;
-                               _dictionary = null;
+                               current = null;
+                               dictionary = null;
                        }
                }
 
                // This collection is a read only collection
                [Serializable]
                public sealed class KeyCollection : ICollection<TKey>, IEnumerable<TKey>, ICollection, IEnumerable {
-                       Dictionary<TKey, TValue> _dictionary;
+                       Dictionary<TKey, TValue> dictionary;
 
                        public KeyCollection (Dictionary<TKey, TValue> dictionary)
                        {
                                if (dictionary == null)
                                        throw new ArgumentNullException ("dictionary");
-                               _dictionary = dictionary;
+                               this.dictionary = dictionary;
                        }
 
                        public void CopyTo (TKey [] array, int index)
@@ -571,7 +574,7 @@ namespace System.Collections.Generic {
                                        throw new ArgumentOutOfRangeException ("index");
                                if (index >= array.Length)
                                        throw new ArgumentException ("index larger than largest valid index of array");
-                               if (array.Length - index < _dictionary.Count)
+                               if (array.Length - index < dictionary.Count)
                                        throw new ArgumentException ("Destination array cannot hold the requested elements!");
 
                                foreach (TKey k in this)
@@ -580,7 +583,7 @@ namespace System.Collections.Generic {
 
                        public Enumerator GetEnumerator ()
                        {
-                               return new Enumerator (_dictionary);
+                               return new Enumerator (dictionary);
                        }
 
                        void ICollection<TKey>.Add (TKey item)
@@ -595,7 +598,7 @@ namespace System.Collections.Generic {
 
                        bool ICollection<TKey>.Contains (TKey item)
                        {
-                               return _dictionary.ContainsKey (item);
+                               return dictionary.ContainsKey (item);
                        }
 
                        bool ICollection<TKey>.Remove (TKey item)
@@ -619,7 +622,7 @@ namespace System.Collections.Generic {
                        }
 
                        public int Count {
-                               get { return _dictionary.Count; }
+                               get { return dictionary.Count; }
                        }
 
                        bool ICollection<TKey>.IsReadOnly {
@@ -631,38 +634,38 @@ namespace System.Collections.Generic {
                        }
 
                        object ICollection.SyncRoot {
-                               get { return ((ICollection) _dictionary).SyncRoot; }
+                               get { return ((ICollection) dictionary).SyncRoot; }
                        }
 
                        public struct Enumerator : IEnumerator<TKey>, IDisposable, IEnumerator {
-                               Dictionary<TKey, TValue>.Enumerator _hostEnumerator;
+                               Dictionary<TKey, TValue>.Enumerator host_enumerator;
 
                                internal Enumerator (Dictionary<TKey, TValue> host)
                                {
-                                       _hostEnumerator = host.GetEnumerator ();
+                                       host_enumerator = host.GetEnumerator ();
                                }
 
                                public void Dispose ()
                                {
-                                       _hostEnumerator.Dispose ();
+                                       host_enumerator.Dispose ();
                                }
 
                                public bool MoveNext ()
                                {
-                                       return _hostEnumerator.MoveNext ();
+                                       return host_enumerator.MoveNext ();
                                }
 
                                public TKey Current {
-                                       get { return _hostEnumerator.Current.Key; }
+                                       get { return host_enumerator.Current.Key; }
                                }
 
                                object IEnumerator.Current {
-                                       get { return _hostEnumerator.Current.Key; }
+                                       get { return host_enumerator.Current.Key; }
                                }
 
                                void IEnumerator.Reset ()
                                {
-                                       ((IEnumerator)_hostEnumerator).Reset ();
+                                       ((IEnumerator)host_enumerator).Reset ();
                                }
                        }
                }
@@ -670,13 +673,13 @@ namespace System.Collections.Generic {
                // This collection is a read only collection
                [Serializable]
                public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, ICollection, IEnumerable {
-                       Dictionary<TKey, TValue> _dictionary;
+                       Dictionary<TKey, TValue> dictionary;
 
                        public ValueCollection (Dictionary<TKey, TValue> dictionary)
                        {
                                if (dictionary == null)
                                        throw new ArgumentNullException ("dictionary");
-                               _dictionary = dictionary;
+                               this.dictionary = dictionary;
                        }
 
                        public void CopyTo (TValue [] array, int index)
@@ -687,7 +690,7 @@ namespace System.Collections.Generic {
                                        throw new ArgumentOutOfRangeException ("index");
                                if (index >= array.Length)
                                        throw new ArgumentException ("index larger than largest valid index of array");
-                               if (array.Length - index < _dictionary.Count)
+                               if (array.Length - index < dictionary.Count)
                                        throw new ArgumentException ("Destination array cannot hold the requested elements!");
 
                                foreach (TValue k in this)
@@ -696,7 +699,7 @@ namespace System.Collections.Generic {
 
                        public Enumerator GetEnumerator ()
                        {
-                               return new Enumerator (_dictionary);
+                               return new Enumerator (dictionary);
                        }
 
                        void ICollection<TValue>.Add (TValue item)
@@ -711,7 +714,7 @@ namespace System.Collections.Generic {
 
                        bool ICollection<TValue>.Contains (TValue item)
                        {
-                               return _dictionary.ContainsValue (item);
+                               return dictionary.ContainsValue (item);
                        }
 
                        bool ICollection<TValue>.Remove (TValue item)
@@ -735,7 +738,7 @@ namespace System.Collections.Generic {
                        }
 
                        public int Count {
-                               get { return _dictionary.Count; }
+                               get { return dictionary.Count; }
                        }
 
                        bool ICollection<TValue>.IsReadOnly {
@@ -747,38 +750,38 @@ namespace System.Collections.Generic {
                        }
 
                        object ICollection.SyncRoot {
-                               get { return ((ICollection) _dictionary).SyncRoot; }
+                               get { return ((ICollection) dictionary).SyncRoot; }
                        }
 
                        public struct Enumerator : IEnumerator<TValue>, IDisposable, IEnumerator {
-                               Dictionary<TKey, TValue>.Enumerator _hostEnumerator;
+                               Dictionary<TKey, TValue>.Enumerator host_enumerator;
 
                                internal Enumerator (Dictionary<TKey,TValue> host)
                                {
-                                       _hostEnumerator = host.GetEnumerator ();
+                                       host_enumerator = host.GetEnumerator ();
                                }
 
                                public void Dispose ()
                                {
-                                       _hostEnumerator.Dispose();
+                                       host_enumerator.Dispose();
                                }
 
                                public bool MoveNext ()
                                {
-                                       return _hostEnumerator.MoveNext ();
+                                       return host_enumerator.MoveNext ();
                                }
 
                                public TValue Current {
-                                       get { return _hostEnumerator.Current.Value; }
+                                       get { return host_enumerator.Current.Value; }
                                }
 
                                object IEnumerator.Current {
-                                       get { return _hostEnumerator.Current.Value; }
+                                       get { return host_enumerator.Current.Value; }
                                }
 
                                void IEnumerator.Reset ()
                                {
-                                       ((IEnumerator)_hostEnumerator).Reset ();
+                                       ((IEnumerator)host_enumerator).Reset ();
                                }
                        }
                }
index c21be287a8ecacd2bed86dabc48b1d6a8b4866f4..87179d771a2670256a1720fe370150dbd6c2e2e6 100644 (file)
@@ -35,6 +35,9 @@ namespace System.Collections
 {
        [Serializable]
        [MonoTODO ("Fix serialization compatibility with MS.NET")]
+#if NET_2_0
+       [Obsolete ("Please use StringComparer instead.")]
+#endif
        public class CaseInsensitiveHashCodeProvider : IHashCodeProvider
        {
                static readonly CaseInsensitiveHashCodeProvider singleton = new CaseInsensitiveHashCodeProvider ();
index cd1b5d31dbb6f1eacc76387ee720fbefceda5b4a..25cd303531ca613d264284c66011681b2693dd37 100644 (file)
@@ -81,6 +81,10 @@ namespace System.Collections {
                private IComparer comparerRef;
                private SerializationInfo serializationInfo;
 
+#if NET_2_0
+               private IEqualityComparer equalityComparer;
+#endif
+
                private static readonly int [] primeTbl = {
                        11,
                        19,
@@ -124,7 +128,9 @@ namespace System.Collections {
 
                public Hashtable () : this (0, 1.0f) {}
 
-
+#if NET_2_0
+               [Obsolete ("Please use Hashtable(int, float, IEqualityComparer) instead")]
+#endif
                public Hashtable (int capacity, float loadFactor, IHashCodeProvider hcp, IComparer comparer) {
                        if (capacity<0)
                                throw new ArgumentOutOfRangeException ("capacity", "negative capacity");
@@ -148,7 +154,6 @@ namespace System.Collections {
 
                        this.inUse = 0;
                        this.modificationCount = 0;
-
                }
 
                public Hashtable (int capacity, float loadFactor) :
@@ -160,6 +165,9 @@ namespace System.Collections {
                {
                }
 
+#if NET_2_0
+               [Obsolete ("Please use Hashtable(int, IEqualityComparer) instead")]
+#endif
                public Hashtable (int capacity,
                                  IHashCodeProvider hcp,
                                  IComparer comparer)
@@ -167,7 +175,9 @@ namespace System.Collections {
                {
                }
 
-
+#if NET_2_0
+               [Obsolete ("Please use Hashtable(IDictionary, float, IEqualityComparer) instead")]
+#endif
                public Hashtable (IDictionary d, float loadFactor,
                                  IHashCodeProvider hcp, IComparer comparer)
                        : this (d!=null ? d.Count : 0,
@@ -194,11 +204,17 @@ namespace System.Collections {
                {
                }
 
+#if NET_2_0
+               [Obsolete ("Please use Hashtable(IDictionary, IEqualityComparer) instead")]
+#endif
                public Hashtable (IDictionary d, IHashCodeProvider hcp, IComparer comparer)
                                 : this (d, 1.0f, hcp, comparer)
                {
                }
 
+#if NET_2_0
+               [Obsolete ("Please use Hashtable(IEqualityComparer) instead")]
+#endif
                public Hashtable (IHashCodeProvider hcp, IComparer comparer)
                                 : this (1, 1.0f, hcp, comparer)
                {
@@ -209,10 +225,37 @@ namespace System.Collections {
                        serializationInfo = info;
                }
 
+#if NET_2_0
+               public Hashtable (IDictionary d, IEqualityComparer equalityComparer) : this (d, 1.0f, equalityComparer)
+               {
+               }
+
+               public Hashtable (IDictionary d, float loadFactor, IEqualityComparer equalityComparer) : this (d, loadFactor)
+               {
+                       this.equalityComparer = equalityComparer;
+               }
+
+               public Hashtable (IEqualityComparer equalityComparer) : this (1, 1.0f, equalityComparer)
+               {
+               }
+
+               public Hashtable (int capacity, IEqualityComparer equalityComparer) : this (capacity, 1.0f, equalityComparer)
+               {
+               }
+
+               public Hashtable (int capacity, float loadFactor, IEqualityComparer equalityComparer) : this (capacity, loadFactor)
+               {
+                       this.equalityComparer = equalityComparer;
+               }
+#endif
+
                //
                // Properties
                //
 
+#if NET_2_0
+               [Obsolete ("Please use EqualityComparer property.")]
+#endif
                protected IComparer comparer {
                        set {
                                comparerRef = value;
@@ -222,6 +265,9 @@ namespace System.Collections {
                        }
                }
 
+#if NET_2_0
+               [Obsolete ("Please use EqualityComparer property.")]
+#endif
                protected IHashCodeProvider hcp {
                        set {
                                hcpRef = value;
@@ -231,6 +277,14 @@ namespace System.Collections {
                        }
                }
 
+#if NET_2_0
+               protected IEqualityComparer EqualityComparer {
+                       get {
+                               return equalityComparer;
+                       }
+               }
+#endif
+
                // ICollection
 
                public virtual int Count {
@@ -453,7 +507,13 @@ namespace System.Collections {
 
                public virtual object Clone ()
                {
+#if NET_2_0
+                       Hashtable ht = new Hashtable (Count, equalityComparer);
+                       ht.hcp = this.hcp;
+                       ht.comparer = this.comparer;
+#else
                        Hashtable ht = new Hashtable (Count, hcp, comparer);
+#endif
                        ht.inUse = 0;
                        ht.loadFactor = this.loadFactor;
 
@@ -468,6 +528,9 @@ namespace System.Collections {
                        return ht;
                }
 
+#if NET_2_0
+               [MonoTODO ("Serialize equalityComparer")]
+#endif
                public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
                {
                        if (info == null)
@@ -491,6 +554,9 @@ namespace System.Collections {
 
                }
 
+#if NET_2_0
+               [MonoTODO ("Serialize equalityComparer")]
+#endif
                public virtual void OnDeserialization (object sender)
                {
                        if (serializationInfo == null) return;
@@ -538,6 +604,10 @@ namespace System.Collections {
                /// <summary>Returns the hash code for the specified key.</summary>
                protected virtual int GetHash (Object key)
                {
+#if NET_2_0
+                       if (equalityComparer != null)
+                               return equalityComparer.GetHashCode (key);
+#endif
                        if (hcpRef == null)
                                return key.GetHashCode ();
                        
@@ -550,6 +620,10 @@ namespace System.Collections {
                /// </summary>
                protected virtual bool KeyEquals (Object item, Object key)
                {
+#if NET_2_0
+                       if (equalityComparer != null)
+                               return equalityComparer.Equals (item, key);
+#endif
                        if (comparerRef == null)
                                return item.Equals (key);
                        
index 6af5a6ad65bbbce4078d0958341690fa0c897aa4..59aece710939593606a2700d2960040cfe7a95cb 100644 (file)
@@ -35,6 +35,9 @@ using System;
 
 namespace System.Collections {
 
+#if NET_2_0
+       [Obsolete ("Please use IEqualityComparer instead.")]
+#endif
        public interface IHashCodeProvider {
                int GetHashCode (object obj);
        }
index 0c666ee5ccb7e5683f24ada9b11039d291ba462e..14f42219b2b14c1d2ca5f04e61013bb52bd7383c 100644 (file)
@@ -41,6 +41,15 @@ namespace System.IO {
                int m_encoding_max_byte;
 
                byte[] m_buffer;
+
+               Decoder decoder;
+               char [] charBuffer;
+               
+               //
+               // 128 chars should cover most strings in one grab.
+               //
+               const int MaxBufferSize = 128;
+
                
                private bool m_disposed = false;
 
@@ -55,7 +64,7 @@ namespace System.IO {
 
                        m_stream = input;
                        m_encoding = encoding;
-                       m_encoding_max_byte = m_encoding.GetMaxByteCount(1);
+                       decoder = encoding.GetDecoder ();
                        m_buffer = new byte [32];
                }
 
@@ -79,6 +88,7 @@ namespace System.IO {
                        m_buffer = null;
                        m_encoding = null;
                        m_stream = null;
+                       charBuffer = null;
                }
 
                void IDisposable.Dispose() 
@@ -441,12 +451,44 @@ namespace System.IO {
                         * not chars
                         */
                        int len = Read7BitEncodedInt();
+                       
+                       if (len < 0)
+                               throw new IOException ("Invalid binary file (string len < 0)");
 
-                       FillBuffer(len);
+                       if (len == 0)
+                               return String.Empty;
+                       
                        
-                       char[] str = m_encoding.GetChars(m_buffer, 0, len);
+                       if (charBuffer == null)
+                               charBuffer = new char [MaxBufferSize];
+
+                       //
+                       // We read the string here in small chunks. Also, we
+                       // Attempt to optimize the common case of short strings.
+                       //
+                       StringBuilder sb = null;
+                       do {
+                               int readLen = (len > MaxBufferSize)
+                                               ? MaxBufferSize
+                                               : len;
+                               
+                               FillBuffer (readLen);
+                               
+                               int cch = decoder.GetChars (m_buffer, 0, readLen, charBuffer, 0);
+
+                               if (sb == null && readLen == len) // ok, we got out the easy way, dont bother with the sb
+                                       return new String (charBuffer, 0, cch);
+
+                               if (sb == null)
+                                       // Len is a fairly good estimate of the number of chars in a string
+                                       // Most of the time 1 byte == 1 char
+                                       sb = new StringBuilder (len);
+                               
+                               sb.Append (charBuffer, 0, cch);
+                               len -= cch;
+                       } while (len > 0);
 
-                       return(new String(str));
+                       return sb.ToString();
                }
 
                public virtual float ReadSingle() {
index f770c132bc6bd69cbcdfb8f6b943adf002d8061f..d1dac005acbabfd66495e69113b6945e5dc92398 100644 (file)
@@ -1,3 +1,15 @@
+2005-09-11  Ben Maurer  <bmaurer@ximian.com>
+
+       * BinaryReader.cs: An optimization for ReadString that had been
+       approved/well tested for a while but never gotten in. Bug #52754.
+
+2005-09-05  Miguel de Icaza  <miguel@novell.com>
+
+       * MonoIOError.cs: expose the ERROR_DIR_NOT_EMPTY as we are
+       throwing it. 
+
+       * MonoIO.cs: Return a properly named error.
+
 2005-08-23  Raja R Harinath  <rharinath@novell.com>
 
        Fix #75679.
index 84c5994762a92a1bbb99936f6b0f94608927e80a..36ef4e806f4823f0ed4f8d753e0da1f645d6e3b0 100644 (file)
@@ -100,6 +100,10 @@ namespace System.IO
                        case MonoIOError.ERROR_LOCK_VIOLATION:
                                message = String.Format ("Lock violation on path {0}", path);
                                return new IOException (message);
+
+                       case MonoIOError.ERROR_DIR_NOT_EMPTY:
+                               message = String.Format ("Directory {0} is not empty", path);
+                               return new IOException (message);
                                
                        default:
                                message = String.Format ("Win32 IO returned {0}. Path: {1}", error, path);
index 02ec3053f137ff6321fa6f379aa59c0f6936d063..03e2476bf1fa14c9f0b00c0c1bcfe0d40bdaff2f 100644 (file)
@@ -148,7 +148,9 @@ namespace System.IO
                ERROR_BUSY_DRIVE = 142,\r
                ERROR_SAME_DRIVE = 143,\r
                ERROR_DIR_NOT_ROOT = 144,\r
+       */
                ERROR_DIR_NOT_EMPTY = 145,\r
+       /*
                ERROR_IS_SUBST_PATH = 146,\r
                ERROR_IS_JOIN_PATH = 147,\r
                ERROR_PATH_BUSY = 148,\r
index a4c69656d2e42d198156ce24620d05fabbeed00b..5da821169277cb09686218e9dd3df15128a83431 100644 (file)
@@ -1,3 +1,14 @@
+2005-09-14  Martin Baulig  <martin@ximian.com>
+
+       * LocalBuilder.cs
+       (LocalBuilder.Mono_GetLocalIndex): New static internal method;
+       same as the .NET 2.0 property `LocalIndex'.
+
+Mon Sep 5 18:08:09 CEST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * EventBuilder.cs, FieldBuilder.cs, MethodBuilder.cs, TypeBuilder.cs,
+       PropertyBuilder.cs: take care of the SpecialName attribute (bug #75768).
+
 2005-09-01  Raja R Harinath  <rharinath@novell.com>
 
        * CustomAttributeBuilder.cs (get_umarshal): Don't cause a nullref
index 0908c13d5fe07ca2c16e645d5a14d3e37092d410..f315a06890ce6c9eba0016c3905acbe444cdd421 100644 (file)
@@ -360,13 +360,6 @@ namespace System.Reflection.Emit {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
-               public override bool HasGenericArguments {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
                [MonoTODO]
                public override bool ContainsGenericParameters {
                        get {
index 8f5493b651ae7167452db0155f2e211a74bc8f47..94de43595017b1e38ecaaf097be0513d411efdba 100644 (file)
@@ -108,6 +108,13 @@ namespace System.Reflection.Emit {
                        if (customBuilder == null)
                                throw new ArgumentNullException ("customBuilder");
                        RejectIfCreated ();
+#if NET_2_0
+                       string attrname = customBuilder.Ctor.ReflectedType.FullName;
+                       if (attrname == "System.Runtime.CompilerServices.SpecialNameAttribute") {
+                               attrs |= EventAttributes.SpecialName;
+                               return;
+                       }
+#endif
                        if (cattrs != null) {
                                CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
                                cattrs.CopyTo (new_array, 0);
index 99cc161a05fe25daaf4fd76a50a7733154ba4431..e5117f11a8f9d114e105c77aa4372413db2ab8e0 100644 (file)
@@ -147,6 +147,11 @@ namespace System.Reflection.Emit {
                        } else if (attrname == "System.NonSerializedAttribute") {
                                attrs |= FieldAttributes.NotSerialized;
                                return;
+#if NET_2_0
+                       } else if (attrname == "System.Runtime.CompilerServices.SpecialNameAttribute") {
+                               attrs |= FieldAttributes.SpecialName;
+                               return;
+#endif
                        } else if (attrname == "System.Runtime.InteropServices.MarshalAsAttribute") {
                                attrs |= FieldAttributes.HasFieldMarshal;
                                marshal_info = CustomAttributeBuilder.get_umarshal (customBuilder, true);
index 2ff5a516819362fab70ca569efd49f3ab330c126..5b145956d58a64b6f9119e1b57c295b9f1131809 100644 (file)
@@ -316,10 +316,6 @@ namespace System.Reflection.Emit
                        throw not_supported ();
                }
 
-               public override bool HasGenericArguments {
-                       get { return false; }
-               }
-
                public override bool ContainsGenericParameters {
                        get { return true; }
                }
index b8abc524d568d35796c685af55e3f48f635070e3..ae37eedcb4c26480ef746c4ba19b9e55f97befef 100644 (file)
@@ -115,6 +115,11 @@ namespace System.Reflection.Emit {
                }
 #endif
 
+               internal static int Mono_GetLocalIndex (LocalBuilder builder)
+               {
+                       return builder.position;
+               }
+
                internal string Name {
                        get { return name; }
                }
index b2cd75262f2535767291b0fa83c86c50ce37b628..42edac5a2a9470e4c75142c895ab8ce3ff5902d7 100644 (file)
@@ -351,6 +351,12 @@ namespace System.Reflection.Emit {
                                                ThrowOnUnmappableChar = (bool)value;
 #endif
                                }
+#if NET_2_0
+                       if (attrname == "System.Runtime.CompilerServices.SpecialNameAttribute") {
+                               attrs |= MethodAttributes.SpecialName;
+                               return;
+                       }
+#endif
 
                                attrs |= MethodAttributes.PinvokeImpl;
                                if (preserveSig)
@@ -461,7 +467,7 @@ namespace System.Reflection.Emit {
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public override extern MethodInfo BindGenericParameters (Type [] types);
+               public override extern MethodInfo MakeGenericMethod (Type [] types);
 
                public override bool Mono_IsInflatedMethod {
                        get {
index 8f7c2a4bb49faac3464fe1401819f0d56569f779..bfd1cc4e3511374470c82795a38d4778d8f97ce2 100644 (file)
@@ -133,6 +133,13 @@ namespace System.Reflection.Emit {
                        def_value = defaultValue;
                }
                public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+#if NET_2_0
+                       string attrname = customBuilder.Ctor.ReflectedType.FullName;
+                       if (attrname == "System.Runtime.CompilerServices.SpecialNameAttribute") {
+                               attrs |= PropertyAttributes.SpecialName;
+                               return;
+                       }
+#endif
                        if (cattrs != null) {
                                CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
                                cattrs.CopyTo (new_array, 0);
index cef949a0f83d43e377017481ce142aec8ae27add..1adb2e54e1be11cca1b781b6e84a3d03ace54477 100644 (file)
@@ -1275,6 +1275,11 @@ namespace System.Reflection.Emit {
                                        }
                                }
                                return;
+#if NET_2_0
+                       } else if (attrname == "System.Runtime.CompilerServices.SpecialNameAttribute") {
+                               attrs |= TypeAttributes.SpecialName;
+                               return;
+#endif
                        } else if (attrname == "System.SerializableAttribute") {
                                attrs |= TypeAttributes.Serializable;
                                return;
@@ -1468,12 +1473,6 @@ namespace System.Reflection.Emit {
                        return base.GetGenericTypeDefinition ();
                }
 
-               public override bool HasGenericArguments {
-                       get {
-                               return generic_params != null;
-                       }
-               }
-
                public override bool ContainsGenericParameters {
                        get {
                                return generic_params != null;
index 768e724c6a813a3f06676db7438019d2814bcf6e..54a88fe4c773c4a17bbfa9234d0f2612ff6704b4 100644 (file)
@@ -700,7 +700,7 @@ namespace System.Reflection {
                internal static extern MethodBase MonoDebugger_GetMethod (Assembly assembly, int token);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               internal static extern int MonoDebugger_GetMethodToken (Assembly assembly, MethodBase method);
+               internal static extern int MonoDebugger_GetMethodToken (MethodBase method);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal static extern Type MonoDebugger_GetLocalTypeFromSignature (Assembly assembly, byte[] signature);
index 695fa1b1931c2ea4233ecce24c95873c85579fb0..579b07eb1e86c61689b22687b39d2999e72fdbb4 100644 (file)
@@ -103,7 +103,7 @@ namespace System.Reflection {
                        codebase = si.GetString ("_CodeBase");
                        version = (Version)si.GetValue ("_Version", typeof (Version));
                        publicKey = (byte[])si.GetValue ("_PublicKey", typeof (byte[]));
-                       keyToken = (byte[])si.GetValue ("_PublicToken", typeof (byte[]));
+                       keyToken = (byte[])si.GetValue ("_PublicKeyToken", typeof (byte[]));
                        hashalg = (AssemblyHashAlgorithm)si.GetValue ("_HashAlgorithm", typeof (AssemblyHashAlgorithm));
                        keypair = (StrongNameKeyPair)si.GetValue ("_StrongNameKeyPair", typeof (StrongNameKeyPair));
                        versioncompat = (AssemblyVersionCompatibility)si.GetValue ("_VersionCompatibility", typeof (AssemblyVersionCompatibility));
@@ -262,7 +262,7 @@ namespace System.Reflection {
 
                        info.AddValue ("_Name", name);
                        info.AddValue ("_PublicKey", publicKey);
-                       info.AddValue ("_PublicToken", keyToken);
+                       info.AddValue ("_PublicKeyToken", keyToken);
                        info.AddValue ("_CultureInfo", cultureinfo != null ? cultureinfo.LCID : -1);
                        info.AddValue ("_CodeBase", codebase);
                        info.AddValue ("_Version", Version);
index 89f362f8593c87fb06675e666e013493c4baecc1..c095b5d8d806709312e8c06af4787ff04da4cc9e 100644 (file)
@@ -1,3 +1,38 @@
+2005-09-17  Zoltan Varga  <vargaz@freemail.hu>
+
+       * Module.cs: Remove obsolete Mvid property.
+
+2005-09-09  Martin Baulig  <martin@ximian.com>
+
+       Reflect latest API changes in the August CTP.
+
+       * MethodBase.cs (MethodBase.MakeGenericMethod): Removed.
+
+       * MethodInfo.cs (MethodInfo.MakeGenericMethod): Added here.
+
+2005-09-08  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AssemblyName.cs: Apply second half of Chris Micacchi's patch
+
+2005-09-07  Miguel de Icaza  <miguel@novell.com>
+
+       * AssemblyName.cs: Apply patch from Chris Micacchi to serialize
+       the keyToken as "_PublicKeyToken".
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Reflect latest API changes in the August CTP.
+
+       * GenericParameterAttributes.cs: Here.
+
+       * MethodBase.cs (MethodBase.BindGenericParameters): Renamed to
+       MakeGenericMethod().    
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       * Assembly.cs (MonoDebugger_GetMethodToken): Don't take an
+       `Assembly' argument.
+
 2005-08-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * Assembly.cs: made GetManifestResourceInternal internal. Fixes the
index e8836f2e23d23aabe08e78ac80e9b2ba3de1ebfb..ed092d585aac0170db4b858da42796498a40c218 100644 (file)
@@ -37,19 +37,18 @@ namespace System.Reflection
        [Flags]
        public enum GenericParameterAttributes
        {
-               NonVariant                      = 0,
                Covariant                       = 1,
                Contravariant                   = 2,
 
                VarianceMask                    = Covariant | Contravariant,
 
-               NoSpecialConstraint             = 0,
+               None                            = 0,
                ReferenceTypeConstraint         = 4,
-               ValueTypeConstraint             = 8,
+               NotNullableValueTypeConstraint  = 8,
                DefaultConstructorConstraint    = 16,
 
                SpecialConstraintMask           = 
-               ReferenceTypeConstraint | ValueTypeConstraint | DefaultConstructorConstraint
+               ReferenceTypeConstraint | NotNullableValueTypeConstraint | DefaultConstructorConstraint
        }
 }
 #endif
index f7471107802c361a681a63a70be6138788f994f6..7dac45b5593d96f72e76f97b15bb798722f570eb 100644 (file)
@@ -177,11 +177,6 @@ namespace System.Reflection {
                }
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
-               public virtual MethodInfo BindGenericParameters (Type [] types)
-               {
-                       throw new NotSupportedException ();
-               }
-
                public virtual Type [] GetGenericArguments ()
                {
                        throw new NotSupportedException ();
index d00b3c9a641ebb0d2e132d41deadd5d810ad94d2..feb8eef2fd7bfaaeac8e3d8e2bbda3fa49e7c090 100644 (file)
@@ -87,5 +87,12 @@ namespace System.Reflection {
                {
                        throw new NotImplementedException ();
                }
+
+#if NET_2_0 || BOOTSTRAP_NET_2_0
+               public virtual MethodInfo MakeGenericMethod (params Type [] types)
+               {
+                       throw new NotSupportedException (this.GetType().ToString ());
+               }
+#endif
        }
 }
index b1f961a735cfbd3df7a3d866736b34f2a7ed6120..3778e5a3d12cd1e82a1dffe5c170e700ee49b983 100644 (file)
@@ -277,13 +277,7 @@ namespace System.Reflection {
                        return name;
                }
 
-#if NET_2_0
-               [Obsolete ("Please use ModuleVersionId instead - this will be removed before Whidbey ships.")]
-               public
-#else
-               internal 
-#endif
-               Guid MvId {
+               internal Guid MvId {
                        get {
                                return Mono_GetGuid (this);
                        }
index 263e4d16844da8c5839e2426b328d6748a09d743..d8ae01301c1895734ca392c6db494a3f93608acd 100644 (file)
@@ -253,7 +253,7 @@ namespace System.Reflection {
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public override extern MethodInfo BindGenericParameters (Type [] types);
+               public override extern MethodInfo MakeGenericMethod (Type [] types);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public override extern Type [] GetGenericArguments ();
index a2d644bbfa2f11cb2392cd7c034081a3803c1dd1..5dbb01d786e8e4c7f06532d06e69ee08fe9732d8 100644 (file)
@@ -260,11 +260,6 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 
-               public override bool HasGenericArguments {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
 
                public override bool ContainsGenericParameters {
                        get {
index f78ca4d3c0a4818c694dd76d940f2b7b0de7b25e..0fb43aa194d540f383fc965cb32b91ad08eae535 100644 (file)
@@ -1,9 +1,13 @@
-2005-09-02  Sebastien Pouliot  <sebastien@ximian.com> 
-
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
        * CodeAccessPermission.cs: Fix Deny for permissions that do not return
        null for empty intersection (common on flags-based permissions).
        * PermissionBuilder.cs: Add an helper call to create an empty 
        (PermissionState.None) permission from a type.
+       * SecurityManager.cs: Added AppDomain support in InheritanceDemand. 
+       Fixed some another small difference between 1.x and 2.0 (wrt 
+       unrestricted permissions). Fixed error reporting for InheritanceDemand
+       (was LinkDemand).
 
 2005-06-30  Sebastien Pouliot  <sebastien@ximian.com> 
 
index 6016ddeb37fd7bff1eea28c0e4abd7f0a9fa6078..a27d37ae7f0145da7fb6fc87c8462d0c8e25a4a8 100644 (file)
@@ -216,8 +216,15 @@ namespace System.Security {
                        PermissionSet granted = ad.GrantedPermissionSet;
                        if (granted == null)
                                return null;
-                       if ((ad.GrantedPermissionSet.Count == 0) && ad.GrantedPermissionSet.IsUnrestricted ())
+#if NET_2_0
+                       if (granted.IsUnrestricted ())
+                               return null;
+#else
+                       if ((granted.Count == 0) && granted.IsUnrestricted ())
                                return null;
+#endif
+                       if (ps.IsUnrestricted ())
+                               return new SecurityPermission (SecurityPermissionFlag.NoFlags);
 
                        foreach (IPermission p in ps) {
                                if (p is CodeAccessPermission) {
@@ -807,7 +814,7 @@ namespace System.Security {
                                break;
                        }
 
-                       throw new SecurityException (message, an, granted, refused, method, SecurityAction.LinkDemand, null, null, null);
+                       throw new SecurityException (message, an, granted, refused, method, SecurityAction.InheritanceDemand, null, null, null);
                }
 
                // internal - get called by the class loader
@@ -815,7 +822,7 @@ namespace System.Security {
                // Called when
                // - class inheritance
                // - method overrides
-               private unsafe static bool InheritanceDemand (Assembly a, RuntimeDeclSecurityActions *actions)
+               private unsafe static bool InheritanceDemand (AppDomain ad, Assembly a, RuntimeDeclSecurityActions *actions)
                {
                        try {
                                PermissionSet ps = null;
@@ -823,10 +830,18 @@ namespace System.Security {
                                if (actions->cas.size > 0) {
                                        ps = Decode (actions->cas.blob, actions->cas.size);
                                        result = (SecurityManager.CheckPermissionSet (a, ps, false) == null);
+                                       if (result) {
+                                               // also check appdomain
+                                               result = (SecurityManager.CheckPermissionSet (ad, ps) == null);
+                                       }
                                }
                                if (actions->noncas.size > 0) {
                                        ps = Decode (actions->noncas.blob, actions->noncas.size);
                                        result = (SecurityManager.CheckPermissionSet (a, ps, true) == null);
+                                       if (result) {
+                                               // also check appdomain
+                                               result = (SecurityManager.CheckPermissionSet (ad, ps) == null);
+                                       }
                                }
 #if NET_2_0
                                // success if one of the permission is granted
@@ -836,7 +851,7 @@ namespace System.Security {
                                                result = false;
                                                foreach (PermissionSet pset in psc) {
                                                        if (SecurityManager.CheckPermissionSet (a, pset, false) == null) {
-                                                               result = true;
+                                                               result = (SecurityManager.CheckPermissionSet (ad, pset) == null);
                                                                break;
                                                        }
                                                }
index 601759b6401d205dca6b9bdf93d67d96e6611f58..1f21b4ff30bd6190b2bd0ac038c3da017a30d4f1 100644 (file)
@@ -1,3 +1,17 @@
+2005-09-11  Zoltan Varga  <vargaz@gmail.com>
+
+       * Thread.cs (MemoryBarrier): Make this an icall.
+
+2005-09-10  Zoltan Varga  <vargaz@gmail.com>
+
+       * Thread.cs (Interrupt): Make this throw a NotImplementedException.
+
+2005-09-09  Martin Baulig  <martin@ximian.com>
+
+       * Timer.cs (Timer.Runner.Start): Silently catch
+       ObjectDisposedException and return; works around some race
+       condition on thread abort.      
+
 2005-08-19  Dick Porter  <dick@ximian.com>
 
        * Thread.cs: Reserve 64 bits for the thread ID.
index 7d8caa9b13df4c9f03b0f9cb38f0239922f75ca2..c7ba97e56287d6bc8949b05e9553f1fcba403921 100644 (file)
@@ -576,6 +576,7 @@ namespace System.Threading {
                [SecurityPermission (SecurityAction.Demand, ControlThread=true)]
                public void Interrupt ()
                {
+                       throw new NotImplementedException ();
                }
 
                // The current thread joins with 'this'. Set ms to 0 to block
@@ -608,11 +609,8 @@ namespace System.Threading {
                }
 
 #if NET_1_1
-               [MonoTODO ("seems required for multi-processors systems like Itanium")]
-               public static void MemoryBarrier ()
-               {
-                       // Will be implemented when we support Itanium
-               }
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public extern static void MemoryBarrier ();
 #endif
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern void Resume_internal();
index cf06e40c2ade5c1bdd0248bc244746d6c675c3ff..ea626e2484792870d1ed433923fa680680316197 100644 (file)
@@ -128,10 +128,18 @@ namespace System.Threading
                                                if (aborted)
                                                        break;
 
-                                               wait.Reset ();
+                                               try {
+                                                       wait.Reset ();
+                                               } catch (ObjectDisposedException) {
+                                                       // FIXME: There is some race condition
+                                                       //        here when the thread is being
+                                                       //        aborted on exit.
+                                                       return;
+                                               }
+
                                                signaled = wait.WaitOne (period, false);
 
-                                               if (aborted)
+                                               if (aborted || disposed)
                                                        break;
 
                                                if (!signaled) {
index 2b8750367311430f2c99d8e1d00172ab94a068af..ad54e7d1851fd5826f3b5ffcac7c9c07f0675cf6 100644 (file)
@@ -1,3 +1,61 @@
+2005-09-19  Zoltan Varga  <vargaz@gmail.com>
+
+       * MonoCustomAttrs.cs (GetCustomAttributesInternal): Add
+       attributeType parameter.
+       (IsDefined): New icall.
+
+       * MonoCustomAttrs.cs: Avoid instantiating all custom attrs of an
+       object when only a specific attribute type is requested. Fixes #76062.
+
+       * Environment.cs: Bump corlib version.
+
+2005-09-09  Zoltan Varga  <vargaz@gmail.com>
+
+       * TypeLoadException.cs MissingMethodException.cs MissingFieldException.cs: Add new ctors called by the runtime. Improve Message property.
+
+2005-09-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTime.cs : (_DoParse) don't check ticks range before computing
+         the actual value. Fixed bug #76082.
+
+2005-09-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * TimeZone.cs : When the target DateTime is in the range of
+         DST end to DST + delta, don't adjust UtcOffset gap between that of
+         DST and that of STD. This should fix bug #75985.
+
+2005-09-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * TimeZone.cs, DateTime.cs :
+         - ToLocalTime() and ToUniversalTime() are moved to TimeZone.
+         - Added more COM patterns. Patch by Ankit Jain. Fixed bug #72132.
+         - use ToLocalTime() and don't depend on the own offset computation.
+           Parse() with 'Z' pattern is closer to correct value on switching
+           Daylight Saving Time. See bug #75985.
+
+2005-09-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTime.cs : (DoParse) DateTimeStyles.AdjustToUniversal was not
+         handled as expected and it kept time value as local one.
+         Patch by Brion Vibber. Fixed bug #75995.
+
+2005-09-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTime.cs : Literal escape (\) was not checking format as
+         expected. Fixed bug #75213.
+
+2005-09-05  Miguel de Icaza  <miguel@novell.com>
+
+       * MonoType.cs: Patch from Jonathan Chambers to implement
+       Type.GUID. 
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Reflect latest API changes in the August CTP.
+
+       * Type.cs (Type.HasGenericArguments): Removed.
+       (Type.BindGenericParameters): Renamed to MakeGenericType().
+
 2005-09-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DateTime.cs : another idiotic COM dependent format.
 
 2005-08-09  Miguel de Icaza  <miguel@novell.com>
 
+       * AppDomainSetup.cs: Full-pathization of the appBase should only
+       be done on Windows, the ":" condition never applied to Linux.
+
        * ConsoleKey.cs: Include a few aliases for a few values that were
        introduced recently.
 
index 3dacd5485d34be0d84d5b3f91fb147b284d84bb9..93e2c01e04d388bd9fa393e3f0a0472810b7bb0f 100644 (file)
@@ -118,8 +118,12 @@ namespace System
                        "dd-MMM-yy",
 
                        // DayOfTheWeek, dd full_month_name yyyy
-                       // FIXME: 1054(th-TH) rejects it
+                       // FIXME: 1054(th-TH) rejects them
                        "dddd, dd MMMM yyyy",
+                       "dddd, dd MMMM yyyy HH:mm",
+                       "dddd, dd MMMM yyyy HH:mm:ss",
+
+                       "yyyy MMMM",
                        // DayOfTheWeek, dd yyyy. This works for every locales.
                        "MMMM dd, yyyy",
 #if NET_1_1
@@ -228,20 +232,8 @@ namespace System
                /// </summary>
                /// 
                public DateTime (long newticks)
-                       // `local' must default to false here to avoid
-                       // a recursion loop.
-                       : this (false, newticks) {}
-
-               internal DateTime (bool local, long newticks)
                {
                        ticks = new TimeSpan (newticks);
-                       if (local) {
-                               TimeZone tz = TimeZone.CurrentTimeZone;
-
-                               TimeSpan utcoffset = tz.GetUtcOffset (this);
-
-                               ticks = ticks + utcoffset;
-                       }
                        if (ticks.Ticks < MinValue.Ticks || ticks.Ticks > MaxValue.Ticks)
                            throw new ArgumentOutOfRangeException ();
                }
@@ -381,7 +373,7 @@ namespace System
                {
                        get     
                        {
-                               return new DateTime (true, GetNow ());
+                               return new DateTime (GetNow ()).ToLocalTime ();
                        }
                }
 
@@ -569,7 +561,7 @@ namespace System
                        if (fileTime < 0)
                                throw new ArgumentOutOfRangeException ("fileTime", "< 0");
 
-                       return new DateTime (true, w32file_epoch + fileTime);
+                       return new DateTime (w32file_epoch + fileTime).ToLocalTime ();
                }
 
 #if NET_1_1
@@ -578,7 +570,7 @@ namespace System
                        if (fileTime < 0)
                                throw new ArgumentOutOfRangeException ("fileTime", "< 0");
 
-                       return new DateTime (false, w32file_epoch + fileTime);
+                       return new DateTime (w32file_epoch + fileTime);
                }
 #endif
 
@@ -906,15 +898,14 @@ namespace System
                                        num = 0;
                                        continue;
                                } else if (chars[pos] == '\\') {
-                                       if (pos+1 >= len)
+                                       pos += num + 1;
+                                       num = 0;
+                                       if (pos >= len)
                                                return false;
 
-                                       if (s [valuePos] != chars [pos + num])
+                                       if (s [valuePos] != chars [pos])
                                                return false;
                                        valuePos++;
-                                       if (valuePos == s.Length)
-                                               return false;
-
                                        pos++;
                                        continue;
                                } else if (chars[pos] == '%') {
@@ -1293,9 +1284,11 @@ namespace System
                        // If no timezone was specified, default to the local timezone.
                        TimeSpan utcoffset;
 
-                       if (useutc)
+                       if (useutc) {
+                               if ((style & DateTimeStyles.AdjustToUniversal) != 0)
+                                       use_localtime = false;
                                utcoffset = new TimeSpan (0, 0, 0);
-                       else if (tzsign == -1) {
+                       else if (tzsign == -1) {
                                TimeZone tz = TimeZone.CurrentTimeZone;
                                utcoffset = tz.GetUtcOffset (result);
                        } else {
@@ -1314,7 +1307,9 @@ namespace System
 
                        long newticks = (result.ticks - utcoffset).Ticks;
 
-                       result = new DateTime (use_localtime, newticks);
+                       result = new DateTime (false, new TimeSpan (newticks));
+                       if (use_localtime)
+                               result = result.ToLocalTime ();
 
                        return true;
                }
@@ -1798,47 +1793,14 @@ namespace System
                        return this._ToString (format, dfi);
                }
 
-               public DateTime ToLocalTime()
+               public DateTime ToLocalTime ()
                {
-                       TimeZone tz = TimeZone.CurrentTimeZone;
-
-                       TimeSpan offset = tz.GetUtcOffset (this);
-
-                       if (offset.Ticks > 0) {
-                               if (DateTime.MaxValue - offset < this)
-                                       return DateTime.MaxValue;
-                       } else if (offset.Ticks < 0) {
-                               // MS.NET fails to check validity here 
-                               // - it may throw ArgumentOutOfRangeException
-                               /*
-                               if (DateTime.MinValue - offset > this)
-                                       return DateTime.MinValue;
-                               */
-                       }
-                       
-                       DateTime lt = new DateTime(true, ticks+offset);
-                       TimeSpan ltoffset = tz.GetUtcOffset(lt);
-                       if(ltoffset != offset)
-                               lt = lt.Add(ltoffset.Subtract(offset));
-
-                       return lt;
+                       return TimeZone.CurrentTimeZone.ToLocalTime (this);
                }
 
                public DateTime ToUniversalTime()
                {
-                       TimeZone tz = TimeZone.CurrentTimeZone;
-
-                       TimeSpan offset = tz.GetUtcOffset (this);
-
-                       if (offset.Ticks < 0) {
-                               if (DateTime.MaxValue + offset < this)
-                                       return DateTime.MaxValue;
-                       } else if (offset.Ticks > 0) {
-                               if (DateTime.MinValue + offset > this)
-                                       return DateTime.MinValue;
-                       }
-
-                       return new DateTime (false, ticks - offset);
+                       return TimeZone.CurrentTimeZone.ToUniversalTime (this);
                }
 
                /*  OPERATORS */
index fb111f936bba5f8245876f04372c10e512c23e95..b872df68c2781f78531888b197d01e5b13ed6323 100644 (file)
@@ -59,7 +59,7 @@ namespace System {
                 * Changes which are already detected at runtime, like the addition
                 * of icalls, do not require an increment.
                 */
-               private const int mono_corlib_version = 40;
+               private const int mono_corlib_version = 41;
                
                [MonoTODO]
                public enum SpecialFolder
index 6fb49e882357397c3226a0ef026cee447b9eefc9..db670c6c9b7976daef1ec09536751d67bd78f350 100644 (file)
@@ -75,7 +75,7 @@ namespace System
                                if (ClassName == null)
                                        return base.Message;
 
-                               String msg = Locale.GetText ("Field {0}.{1} not found.");
+                               String msg = Locale.GetText ("Field '{0}.{1}' not found.");
                                return String.Format (msg, ClassName, MemberName);
                        }
                }
index 5cdb129c590d540683ec3bb99facee26fa8297c2..b8b7ff7e3185cd87691c2951781fb8b87917239e 100644 (file)
@@ -71,7 +71,7 @@ namespace System
                                if (ClassName == null)
                                        return base.Message;
 
-                               String msg = Locale.GetText ("Method {0}.{1} not found.");
+                               String msg = Locale.GetText ("Method not found: '{0}.{1}'.");
                                return String.Format (msg, ClassName, MemberName);
                        }
                }
index 461391b8ae414d34d7fa675e9453dda4a8fce691..5aa04ed5438970b7c2bd237c9d5927af2b1564a0 100644 (file)
@@ -45,12 +45,9 @@ namespace System
        internal class MonoCustomAttrs
        {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               internal static extern object[] GetCustomAttributesInternal (ICustomAttributeProvider obj, bool pseudoAttrs);
-
-               internal static object[] GetCustomAttributesBase (ICustomAttributeProvider obj)
-               {
-                       object[] attrs = GetCustomAttributesInternal (obj, false);
+               internal static extern object[] GetCustomAttributesInternal (ICustomAttributeProvider obj, Type attributeType, bool pseudoAttrs);
 
+               internal static object[] GetPseudoCustomAttributes (ICustomAttributeProvider obj, Type attributeType) {
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                        object[] pseudoAttrs = null;
 
@@ -64,6 +61,27 @@ namespace System
                        else if (obj is Type)
                                pseudoAttrs = ((Type)obj).GetPseudoCustomAttributes ();
 
+                       if ((attributeType != null) && (pseudoAttrs != null)) {
+                               for (int i = 0; i < pseudoAttrs.Length; ++i)
+                                       if (attributeType.IsAssignableFrom (pseudoAttrs [i].GetType ()))
+                                               if (pseudoAttrs.Length == 1)
+                                                       return pseudoAttrs;
+                                               else
+                                                       return new object [] { pseudoAttrs [i] };
+                               return new object [0];
+                       }
+                       else
+                               return pseudoAttrs;
+#else
+                       return null;
+#endif
+               }
+
+               internal static object[] GetCustomAttributesBase (ICustomAttributeProvider obj, Type attributeType)
+               {
+                       object[] attrs = GetCustomAttributesInternal (obj, attributeType, false);
+
+                       object[] pseudoAttrs = GetPseudoCustomAttributes (obj, attributeType);
                        if (pseudoAttrs != null) {
                                object[] res = new object [attrs.Length + pseudoAttrs.Length];
                                System.Array.Copy (attrs, res, attrs.Length);
@@ -72,9 +90,6 @@ namespace System
                        }
                        else
                                return attrs;
-#else
-                       return attrs;
-#endif
                }
 
                internal static Attribute GetCustomAttribute (ICustomAttributeProvider obj,
@@ -102,7 +117,7 @@ namespace System
                                throw new ArgumentNullException ("obj");
 
                        object[] r;
-                       object[] res = GetCustomAttributesBase (obj);
+                       object[] res = GetCustomAttributesBase (obj, attributeType);
                        // shortcut
                        if (!inherit && res.Length == 1)
                        {
@@ -196,7 +211,7 @@ namespace System
                                if ((btype = GetBase (btype)) != null)
                                {
                                        inheritanceLevel++;
-                                       res = GetCustomAttributesBase (btype);
+                                       res = GetCustomAttributesBase (btype, attributeType);
                                }
                        } while (inherit && btype != null);
 
@@ -222,7 +237,7 @@ namespace System
                                throw new ArgumentNullException ("obj");
 
                        if (!inherit)
-                               return (object[]) GetCustomAttributesBase (obj).Clone ();
+                               return (object[]) GetCustomAttributesBase (obj, null).Clone ();
 
                        return GetCustomAttributes (obj, null, inherit);
                }
@@ -243,10 +258,15 @@ namespace System
 
                internal static bool IsDefined (ICustomAttributeProvider obj, Type attributeType, bool inherit)
                {
-                       object [] res = GetCustomAttributesBase (obj);
-                       foreach (object attr in res)
-                               if (attributeType.Equals (attr.GetType ()))
-                                       return true;
+                       if (IsDefinedInternal (obj, attributeType))
+                               return true;
+
+                       object[] pseudoAttrs = GetPseudoCustomAttributes (obj, attributeType);
+                       if (pseudoAttrs != null) {
+                               for (int i = 0; i < pseudoAttrs.Length; ++i)
+                                       if (attributeType.IsAssignableFrom (pseudoAttrs [i].GetType ()))
+                                               return true;
+                       }
 
                        ICustomAttributeProvider btype;
                        if (inherit && ((btype = GetBase (obj)) != null))
@@ -255,6 +275,9 @@ namespace System
                        return false;
                }
 
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               internal static extern bool IsDefinedInternal (ICustomAttributeProvider obj, Type AttributeType);
+
                // Handles Type, MonoProperty and MonoMethod.
                // The runtime has also cases for MonoEvent, MonoField, Assembly and ParameterInfo,
                // but for those we return null here.
index 7c145c730d73245c98768a31966493c674c1dbc5..6ae48e0f31b477310c5a70414b4a5df0d5eed85c 100644 (file)
@@ -486,7 +486,10 @@ namespace System
 
                public override Guid GUID {
                        get {
-                               return Guid.Empty;
+                               object[] att = GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), true);
+                               if (att.Length == 0)
+                                       return Guid.Empty;
+                               return new Guid(((System.Runtime.InteropServices.GuidAttribute)att[0]).Value);
                        }
                }
 
@@ -568,17 +571,12 @@ namespace System
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern override Type [] GetGenericArguments ();
 
-               public extern override bool HasGenericArguments {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
-               }
-
                public override bool ContainsGenericParameters {
                        get {
                                if (IsGenericParameter)
                                        return true;
 
-                               if (HasGenericArguments) {
+                               if (IsGenericType) {
                                        foreach (Type arg in GetGenericArguments ())
                                                if (arg.ContainsGenericParameters)
                                                        return true;
index cdbd724df51f891077723dc1719ebc82d475f983..ff85afd6e8aa5ab6a899de3408d2a5acba349eba 100644 (file)
@@ -59,6 +59,11 @@ namespace System
                        }
                }
 
+               internal static void ClearCurrentTimeZone ()
+               {
+                       currentTimeZone = null;
+               }
+
                public abstract string DaylightName {
                        get;
                }
@@ -103,12 +108,48 @@ namespace System
 
                public virtual DateTime ToLocalTime (DateTime time)
                {
-                       return time + GetUtcOffset (time);
+                       DaylightTime dlt = GetDaylightChanges (time.Year);
+                       TimeSpan utcOffset = GetUtcOffset (time);
+                       if (utcOffset.Ticks > 0) {
+                               if (DateTime.MaxValue - utcOffset < time)
+                                       return DateTime.MaxValue;
+                       //} else if (utcOffset.Ticks < 0) {
+                       //      LAMESPEC: MS.NET fails to check validity here
+                       //      it may throw ArgumentOutOfRangeException.
+                       }
+
+                       DateTime local = time.Add (utcOffset);
+                       if (dlt.Delta.Ticks == 0)
+                               return local;
+
+                       // FIXME: check all of the combination of
+                       //      - basis: local-based or UTC-based
+                       //      - hemisphere: Northern or Southern
+                       //      - offset: positive or negative
+
+                       // PST should work fine here.
+                       if (local < dlt.End && dlt.End.Subtract (dlt.Delta) <= local)
+                               return local;
+                       if (local >= dlt.Start && dlt.Start.Add (dlt.Delta) > local)
+                               return local.Subtract (dlt.Delta);
+
+                       TimeSpan localOffset = GetUtcOffset (local);
+                       return time.Add (localOffset);
                }
 
                public virtual DateTime ToUniversalTime (DateTime time)
                {
-                       return time - GetUtcOffset (time);
+                       TimeSpan offset = GetUtcOffset (time);
+
+                       if (offset.Ticks < 0) {
+                               if (DateTime.MaxValue + offset < time)
+                                       return DateTime.MaxValue;
+                       } else if (offset.Ticks > 0) {
+                               if (DateTime.MinValue + offset > time)
+                                       return DateTime.MinValue;
+                       }
+
+                       return new DateTime (time.Ticks - offset.Ticks);
                }
        }
 
index 9a83f152b806cd18087f7ae15f5e6be09de1a60f..7aca1c950d2aa82683a5f01c6d15c2e35f3cf198 100644 (file)
@@ -1081,10 +1081,6 @@ namespace System {
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                public abstract Type[] GetGenericArguments ();
 
-               public abstract bool HasGenericArguments {
-                       get;
-               }
-
                public abstract bool ContainsGenericParameters {
                        get;
                }
@@ -1117,16 +1113,7 @@ namespace System {
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               static extern Type BindGenericParameters (Type gt, Type [] types);
-
-#if NET_2_0
-               [ComVisible (true)]
-               [ObsoleteAttribute("BindGenericParameters() has been deprecated. Please use MakeGenericType() instead - this will be removed before Whidbey ships.")]
-#endif         
-               public Type BindGenericParameters (Type [] types)
-               {
-                       return MakeGenericType (types);
-               }
+               static extern Type MakeGenericType (Type gt, Type [] types);
 
                public virtual Type MakeGenericType (params Type[] types)
                {
@@ -1136,7 +1123,7 @@ namespace System {
                                if (t == null)
                                        throw new ArgumentNullException ("types");
                        }
-                       Type res = BindGenericParameters (this, types);
+                       Type res = MakeGenericType (this, types);
                        if (res == null)
                                throw new TypeLoadException ();
                        return res;
index 6014a6ff0e58197b6bf02386011009b52139373e..0adf396369842c500db5191c5aa81b4ad7bb4c12 100644 (file)
@@ -41,8 +41,7 @@ namespace System
                const int Result = unchecked ((int)0x80131522);
                
                // Fields
-               private string msg;
-               private string type;
+               private string className, assemblyName;
 
                // Constructors
                public TypeLoadException ()
@@ -63,34 +62,42 @@ namespace System
                        HResult = Result;
                }
 
+               internal TypeLoadException (string className, string assemblyName) : this ()
+               {
+                       this.className = className;
+                       this.assemblyName = assemblyName;
+               }
+
                protected TypeLoadException (SerializationInfo info, StreamingContext context)
                        : base (info, context)
                {
                        if (info == null)
                                throw new ArgumentNullException ("info");
 
-                       type = info.GetString ("TypeLoadClassName");
+                       className = info.GetString ("TypeLoadClassName");
+                       assemblyName = info.GetString ("TypeLoadAssemblyName");
                }
 
                // Properties
                public override string Message {
                        get {
-                               if (type == null)
+                               if (className != null) {
+                                       if ((assemblyName != null) && (assemblyName != String.Empty))
+                                               return String.Format ("Could not load type '{0}' from assembly '{1}'.", className, assemblyName);
+                                       else
+                                               return String.Format ("Could not load type '{0}'.", className);
+                               }
+                               else
                                        return base.Message;
-
-                               if (msg == null)
-                                       msg = "Cannot load type '" + type + "'";
-
-                               return msg;
                        }
                }
 
                public string TypeName {
                        get { 
-                               if (type == null)
-                                       return "";
-
-                               return type;
+                               if (className == null)
+                                       return String.Empty;
+                               else
+                                       return className;
                        }
                }
 
@@ -101,8 +108,8 @@ namespace System
                                throw new ArgumentNullException ("info");
 
                        base.GetObjectData (info, context);
-                       info.AddValue ("TypeLoadClassName", type, typeof (string)); 
-                       info.AddValue ("TypeLoadAssemblyName", "", typeof (string)); 
+                       info.AddValue ("TypeLoadClassName", className, typeof (string)); 
+                       info.AddValue ("TypeLoadAssemblyName", assemblyName, typeof (string)); 
                        info.AddValue ("TypeLoadMessageArg", "", typeof (string)); 
                        info.AddValue ("TypeLoadResourceID", 0, typeof (int)); 
                }
index c727cee9ad5e5a5082956cd4897c2bb8e65d4c77..4d9d141b41c1dff35347ace3d8a021662460f98c 100644 (file)
@@ -578,6 +578,43 @@ namespace MonoTests.System.Collections.Generic {
                                Assert.AreEqual(i, d3[i]);
                        }
                }
+
+               [Test]
+               public void ZeroCapacity ()
+               {
+                       Dictionary<int, int> x = new Dictionary <int, int> (0);
+                       x.Add (1, 2);
+                       
+                       x = new Dictionary <int, int> (0);
+                       x.Clear ();
+
+                       x = new Dictionary <int, int> (0);
+                       int aa = x.Count;
+                       
+                       x = new Dictionary <int, int> (0);
+                       try {
+                               int j = x [1];
+                       } catch (KeyNotFoundException){
+                       }
+
+                       bool b;
+                       b = x.ContainsKey (10);
+                       b = x.ContainsValue (10);
+
+                       x = new Dictionary <int, int> (0);
+                       x.Remove (10);
+                       
+                       x = new Dictionary <int, int> (0);
+                       int intv;
+                       x.TryGetValue (1, out intv);
+
+                       object oa = x.Keys;
+                       object ob = x.Values;
+                       foreach (KeyValuePair<int,int> a in x){
+                       }
+
+                       
+               }
        }
 }
 
index 566ce4ea2d32a89129be36a8c26ba285d1da9562..d51e901c3a37cc9d19fc7f85de292f1ef36efb03 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-20  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * CompareInfoTest.cs : added empty string cases for IsPrefix/IsSuffix.
+
+2005-09-09  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * CompareInfoTest.cs : added another test for IsSuffix() that I found.
+
 2005-08-14  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * TextInfoTest.cs: Added ListSeparator test.
index 48c85990dbe278e2688b8ed6a687bf2344eb8b09..a1c92ad3fe582bbbddb9afe3c16ed861c898b0a2 100644 (file)
@@ -848,6 +848,10 @@ public class CompareInfoTest : Assertion
                // extender in source
                AssertIsPrefix ("#9", false, "\u30D1\u30FC", "\u30D1\u30A2");
                AssertIsPrefix ("#10", true, "\u30D1\u30FC", "\u30D1\u30A2", CompareOptions.IgnoreNonSpace);
+
+               // empty suffix always matches the source.
+               AssertIsPrefix ("#11", true, "", "");
+               AssertIsPrefix ("#12", true, "/test.css", "");
        }
 
        [Test]
@@ -874,6 +878,14 @@ public class CompareInfoTest : Assertion
                // extender in source
                AssertIsSuffix ("#14", false, "\u30D1\u30FC", "\u30D1\u30A2");
                AssertIsSuffix ("#15", true, "\u30D1\u30FC", "\u30D1\u30A2", CompareOptions.IgnoreNonSpace);
+               // optimization sanity check
+               AssertIsSuffix ("#16", true,
+                       "/configuration/system.runtime.remoting",
+                       "system.runtime.remoting");
+
+               // empty suffix always matches the source.
+               AssertIsSuffix ("#17", true, "", "");
+               AssertIsSuffix ("#18", true, "/test.css", "");
        }
 
        [Test]
index 7c9bcd968e8e800563056e6f9f5aeacae6e49360..f6182c3f6a87ca3a7fb93c1c5039f298119a4641 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-08  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * MemoryStreamTest.cs: Add more tests for publicly visible (or not)
+       contents. Started converting tests to NUnit 2.2 API.
+
 2005-07-04  Sebastien Pouliot  <sebastien@ximian.com>
 
        * DirectoryInfoTest.cs: Added tests for getting parent of root 
index b325edf299398098c4fccb3d8c4c357265405062..b6cc40f9e4f3907a123dc88078f0c2f99e4f2b9d 100644 (file)
@@ -18,7 +18,7 @@ using System.Text;
 namespace MonoTests.System.IO
 {
        [TestFixture]
-       public class MemoryStreamTest : Assertion
+       public class MemoryStreamTest
        {
                MemoryStream testStream;
                byte [] testStreamData;
@@ -41,7 +41,7 @@ namespace MonoTests.System.IO
                void VerifyTestData (string id, byte [] testBytes, int start, int count)
                {
                        if (testBytes == null)
-                               Fail (id + "+1 testBytes is null");
+                               Assert.Fail (id + "+1 testBytes is null");
 
                        if (start < 0 ||
                            count < 0  ||
@@ -59,10 +59,25 @@ namespace MonoTests.System.IO
                                                        start + test,
                                                        testBytes [test],
                                                        testStreamData [start + test]);
-                               Fail (id + "-3" + failStr);
+                               Assert.Fail (id + "-3" + failStr);
                        }
                }
 
+               public void AssertEquals (string message, int expected, int actual)
+               {
+                       Assert.AreEqual (expected, actual, message);
+               }
+
+               public void AssertEquals (string message, long expected, long actual)
+               {
+                       Assert.AreEqual (expected, actual, message);
+               }
+
+               public void AssertEquals (string message, bool expected, bool actual)
+               {
+                       Assert.AreEqual (expected, actual, message);
+               }
+
                [Test]
                public void ConstructorsOne ()
                {
@@ -84,7 +99,7 @@ namespace MonoTests.System.IO
                        byte [] buffer = ms.GetBuffer ();
                        // Begin: wow!!!
                        AssertEquals ("#03", -1, ms.ReadByte ());
-                       AssertEquals ("#04", null, buffer); // <--
+                       Assert.IsNull (buffer, "#04"); // <--
                        ms.Read (new byte [5], 0, 5);
                        AssertEquals ("#05", 0, ms.Position);
                        AssertEquals ("#06", 0, ms.Length);
@@ -119,7 +134,7 @@ namespace MonoTests.System.IO
                        } catch (Exception) {
                                return;
                        }
-                       Fail ("#04");
+                       Assert.Fail ("#04");
                }
 
                [Test]
@@ -146,17 +161,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!gotException)
-                               Fail ("#05");
-
-                       gotException = false;
-                       try {
-                               ms.GetBuffer ();
-                       } catch (UnauthorizedAccessException) {
-                               gotException = true;
-                       }
-
-                       if (!gotException)
-                               Fail ("#06");
+                               Assert.Fail ("#05");
 
                        ms.Capacity = 100; // Allowed. It's the same as the one in the ms.
                                           // This is lame, as the length is 50!!!
@@ -169,7 +174,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!gotException)
-                               Fail ("#07");
+                               Assert.Fail ("#07");
 
                        AssertEquals ("#08", 50, ms.ToArray ().Length);
                }
@@ -204,7 +209,7 @@ namespace MonoTests.System.IO
                        VerifyTestData ("R3", readBytes, 80, 20);
 
                        int readByte = testStream.ReadByte();
-                       AssertEquals (-1, readByte);
+                       Assert.AreEqual (-1, readByte, "R4");
                }
 
                [Test]
@@ -297,7 +302,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!thrown)
-                               Fail ("#01");
+                               Assert.Fail ("#01");
 
                        thrown = false;
                        try {
@@ -307,7 +312,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!thrown)
-                               Fail ("#02");
+                               Assert.Fail ("#02");
 
                        // The first exception thrown is ObjectDisposed, not ArgumentNull
                        thrown = false;
@@ -318,7 +323,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!thrown)
-                               Fail ("#03");
+                               Assert.Fail ("#03");
 
                        thrown = false;
                        try {
@@ -328,7 +333,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!thrown)
-                               Fail ("#03");
+                               Assert.Fail ("#03");
                }
 
                [Test]
@@ -376,7 +381,7 @@ namespace MonoTests.System.IO
                                thrown = true;
                        }
                        if (!thrown)
-                               Fail ("#01");
+                               Assert.Fail ("#01");
                        
                        thrown = false;
                        try {
@@ -386,7 +391,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!thrown)
-                               Fail ("#02");
+                               Assert.Fail ("#02");
 
                        thrown=false;
                        try {
@@ -397,7 +402,7 @@ namespace MonoTests.System.IO
                        }
 
                        if (!thrown)
-                               Fail ("#03");
+                               Assert.Fail ("#03");
 
                        ms=new MemoryStream (256);
 
@@ -540,7 +545,60 @@ namespace MonoTests.System.IO
                        ms.SetLength (4);
                        ms.Seek (4, SeekOrigin.End);
                        ms.WriteByte (0xFF);
-                       AssertEquals ("Result", "01-01-01-01-00-00-00-00-FF", BitConverter.ToString (ms.ToArray ()));
+                       Assert.AreEqual ("01-01-01-01-00-00-00-00-FF", BitConverter.ToString (ms.ToArray ()), "Result");
+               }
+
+               [Test]
+               public void PubliclyVisible ()
+               {
+                       MemoryStream ms = new MemoryStream ();
+                       Assert.IsNotNull (ms.GetBuffer (), "ctor()");
+
+                       ms = new MemoryStream (1);
+                       Assert.IsNotNull (ms.GetBuffer (), "ctor(1)");
+
+                       ms = new MemoryStream (new byte[1], 0, 1, true, true);
+                       Assert.IsNotNull (ms.GetBuffer (), "ctor(byte[],int,int,bool,bool");
+               }
+
+               [Test]
+               [ExpectedException (typeof (UnauthorizedAccessException))]
+               public void PubliclyVisible_Ctor_ByteArray ()
+               {
+                       MemoryStream ms = new MemoryStream (new byte[0]);
+                       Assert.IsNotNull (ms.GetBuffer ());
+               }
+
+               [Test]
+               [ExpectedException (typeof (UnauthorizedAccessException))]
+               public void PubliclyVisible_Ctor_ByteArray_Boolean ()
+               {
+                       MemoryStream ms = new MemoryStream (new byte[0], true);
+                       Assert.IsNotNull (ms.GetBuffer ());
+               }
+
+               [Test]
+               [ExpectedException (typeof (UnauthorizedAccessException))]
+               public void PubliclyVisible_Ctor_ByteArray_Int_Int ()
+               {
+                       MemoryStream ms = new MemoryStream (new byte[1], 0, 1);
+                       Assert.IsNotNull (ms.GetBuffer ());
+               }
+
+               [Test]
+               [ExpectedException (typeof (UnauthorizedAccessException))]
+               public void PubliclyVisible_Ctor_ByteArray_Int_Int_Boolean ()
+               {
+                       MemoryStream ms = new MemoryStream (new byte[1], 0, 1, true);
+                       Assert.IsNotNull (ms.GetBuffer ());
+               }
+
+               [Test]
+               [ExpectedException (typeof (UnauthorizedAccessException))]
+               public void PubliclyVisible_Ctor_ByteArray_Int_Int_Boolean_Boolean ()
+               {
+                       MemoryStream ms = new MemoryStream (new byte[1], 0, 1, true, false);
+                       Assert.IsNotNull (ms.GetBuffer ());
                }
        }
 }
index f6387bae15f347c0a3ec288837758d865d81d40a..5d808ce0335c1a11617feee2eb3248f3e067f6f2 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTimeTest.cs : test for #76082.
+
+2005-09-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTimeTest.cs : test for #72132.
+
+2005-09-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTimeTest.cs : test for #75995.
+
+2005-09-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTimeTest.cs : test for #75213.
+
 2005-09-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DateTimeTest.cs : another COM dependent idiotic parse.
index 1b07004821134bee9f60c481a3519bcebfdbf307..4907a6074576344a23feb1cb8633be2a5e327cc9 100644 (file)
@@ -593,6 +593,11 @@ public class DateTimeTest : Assertion
                        Fail ("z02");
                } catch (FormatException) {
                }
+
+               // Bug #75213 : literal escaping.
+               t1 = DateTime.ParseExact ("20050707132527Z",
+                       "yyyyMMddHHmmss\\Z", CultureInfo.InvariantCulture);
+               AssertEquals ("Literal1.Ticks", 632563395270000000, t1.Ticks);
        }
 
        [Ignore ("need to fix tests that run on different timezones")]
@@ -675,12 +680,22 @@ public class DateTimeTest : Assertion
                AssertEquals ("H14", t2.Ticks, t1.Ticks);
 
                t2 = new DateTime (2002, 2, 1);
-               t1 = DateTime.Parse ("2002 February");
+               t1 = DateTime.Parse ("2002 February", new CultureInfo ("ja-JP"));
                AssertEquals ("H15", t2.Ticks, t1.Ticks);
 
                t2 = new DateTime (DateTime.Today.Year, 2, 8);
                t1 = DateTime.Parse ("February 8");
                AssertEquals ("H16", t2.Ticks, t1.Ticks);
+
+               // bug #72132
+               t2 = new DateTime (2002, 2, 25, 5, 25, 22);
+               t1 = DateTime.Parse ("Monday, 25 February 2002 05:25:22",
+                       new CultureInfo ("hi-IN"));
+               AssertEquals ("H17", t2.Ticks, t1.Ticks);
+               t2 = new DateTime (2002, 2, 25, 5, 25, 0);
+               t1 = DateTime.Parse ("Monday, 25 February 2002 05:25",
+                       new CultureInfo ("hi-IN"));
+               AssertEquals ("H18", t2.Ticks, t1.Ticks);
        }
 
        public void TestParse3 ()
@@ -897,6 +912,22 @@ public class DateTimeTest : Assertion
                } finally {
                        Thread.CurrentThread.CurrentCulture = ci;
                }
+
+               // bug #76082
+               AssertEquals ("bug #76082", DateTime.MinValue,
+                       DateTime.ParseExact ("00010101T00:00:00",
+                               "yyyyMMdd'T'HH':'mm':'ss",
+                               DateTimeFormatInfo.InvariantInfo));
+       }
+
+       [Test]
+       public void DateTimeStylesAdjustToUniversal ()
+       {
+               // bug #75995 : AdjustToUniversal
+               DateTime t1 = DateTime.Parse ("2005-09-05T22:29:00Z",
+                       CultureInfo.InvariantCulture,
+                       DateTimeStyles.AdjustToUniversal);
+               AssertEquals ("2005-09-05 22:29:00Z", t1.ToString ("u"));
        }
 
        [Test]
diff --git a/mcs/errors/CS0619-43-lib.cs b/mcs/errors/CS0619-43-lib.cs
new file mode 100644 (file)
index 0000000..71ea9c3
--- /dev/null
@@ -0,0 +1,5 @@
+public class Error
+{
+    [System.ObsoleteAttribute ("Obsolete constant", true)]
+    public const decimal C = 4;
+}
\ No newline at end of file
index 850825236b2c8489274331de14d9fd546e194996..88a1c0fc614117b6d062188dcc6214f44397892e 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * gcs0208-2.cs, gcs0208-3.cs, gcs0208-4.cs : added test with related
+         to #75772.
+
 2005-09-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * cs0418-3.cs, cs0418-4.cs, cs0418-5.cs,
index 5906b50f87f8a71d27b48c09d78729b13d465680..60a2aad5eb32b35a8246778cf0698b6436dd9ad6 100644 (file)
@@ -31,7 +31,7 @@ TEST_SUPPORT_FILES = \
        CS0118-2-lib.dll CS0122-10-lib.dll CS0122-14-lib.dll CS0122-15-lib.dll CS0433-lib.dll CS0433-2-lib.dll \
        CS0534-3-lib.dll CS0534-4-lib.dll CS0571-3-lib.dll \
        CS0612-2-lib.dll CS0618-2-lib.dll CS0619-8-lib.dll CS0619-17-lib.dll CS0619-32-lib.dll CS0619-33-lib.dll CS0619-36-lib.dll CS0619-42-lib.dll \
-       CS1546-lib.dll CS2015-lib.dll CS3005-16-lib.dll CS3013-module.dll
+       CS0619-43-lib.dll CS1546-lib.dll CS2015-lib.dll CS3005-16-lib.dll CS3013-module.dll
 
 all-local:
 
diff --git a/mcs/errors/cs0019-11.cs b/mcs/errors/cs0019-11.cs
new file mode 100644 (file)
index 0000000..8c08f74
--- /dev/null
@@ -0,0 +1,10 @@
+// cs0019-11.cs: Operator `&&' cannot be applied to operands of type `null' and `null'
+// Line : 8
+
+public class C
+{
+    public static void Main()
+    {
+        bool l = (null && null);
+    }
+}
index 1a6d8aaa4b85890c36dcd05d50d8921f31d6189c..8c828f6c2b3505bda6e06bf2d2ba68904448cf1d 100644 (file)
@@ -9,7 +9,7 @@ public class Driver {
     floats[0] = 1.0f;
     unsafe {
       fixed (float *fp = &floats[0]) {
-       Console.WriteLine ("foo" + fp);
+      Console.WriteLine ("foo" + fp);
       }
     }
   }
index b65e055a5f8b5e38cfb831ef24a0b9f621b2a511..f2cd3457a43a2532e620cecab305b18b7742c39d 100644 (file)
@@ -1,4 +1,4 @@
-// cs0149.cs: Method 'MainClass.Delegate()' does not match delegate 'void TestDelegate()'
+// cs0149.cs: Method name expected
 // Line: 8
 
 delegate void TestDelegate();
index bbc376480871466111e4a6d635bdf77098e991e0..aa7e6a29ba5001dbe0847394f88053d926924ea0 100644 (file)
@@ -1,4 +1,4 @@
-// cs0246-13.cs : The type or namespace name `class' could not be found. Are you missing a using directive or an assembly reference?
+// cs0246-13.cs: The type or namespace name `class' could not be found. Are you missing a using directive or an assembly reference?
 // Line: 9
 using System;
 
diff --git a/mcs/errors/cs0619-43.cs b/mcs/errors/cs0619-43.cs
new file mode 100644 (file)
index 0000000..343391b
--- /dev/null
@@ -0,0 +1,7 @@
+// cs0619-43.cs: `Error.C' is obsolete: `Obsolete constant'
+// Line: 6
+// Compiler options: -reference:CS0619-43-lib.dll
+
+class A {
+       public decimal C = Error.C;
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0619-44.cs b/mcs/errors/cs0619-44.cs
new file mode 100644 (file)
index 0000000..08d6a66
--- /dev/null
@@ -0,0 +1,13 @@
+// cs0619-44.cs: `Obsolete' is obsolete: `!!!'
+// Line: 9
+
+[System.Obsolete("!!!", true)]
+class Obsolete {
+}
+
+class Class {
+               void VV ()
+               {
+                       object[] o = new object [] { new Obsolete () };
+               }
+}
diff --git a/mcs/errors/cs0619-45.cs b/mcs/errors/cs0619-45.cs
new file mode 100644 (file)
index 0000000..c8433ae
--- /dev/null
@@ -0,0 +1,11 @@
+// cs0619-45.cs: `A' is obsolete: `!!!'
+// Line: 9
+
+[System.Obsolete("!!!", true)]
+class A: System.Attribute
+{
+}
+
+[A]
+class Obsolete {
+}
diff --git a/mcs/errors/cs0619-46.cs b/mcs/errors/cs0619-46.cs
new file mode 100644 (file)
index 0000000..5a0ea64
--- /dev/null
@@ -0,0 +1,18 @@
+// cs0619-46.cs: `Obsolete' is obsolete: `!!!'
+// Line: 16
+
+using System;
+
+[Obsolete("Is obsolete", true)]
+class C
+{
+       public static string SS;
+}
+
+class MainClass
+{
+    public static void Main ()
+    {
+        Console.WriteLine (C.SS);
+    }
+}
index ed8b375424b47fba5cd97b28b346209edd15d9c6..4b93edad1eb7f36de12d2b46eb23115e30b42b95 100644 (file)
@@ -1,6 +1,7 @@
 // cs0665-2.cs : Assignment in conditional expression is always constant; did you mean to use == instead of = ?
+// Line: 10
 // Compiler options: /warnaserror
-// Line: 9
+
 class Test
 {
        public bool Foo (bool x)
index 817daeead6ae5a98df6683a1a2d315e3d287d645..6b42211b8411a469d1e33af600d5f7ade2cc7f43 100644 (file)
@@ -1,6 +1,7 @@
 // cs0665.cs : Assignment in conditional expression is always constant; did you mean to use == instead of = ?
+// Line: 10
 // Compiler options: /warnaserror
-// Line: 9
+
 class Test
 {
        public void Foo (bool x)
index 392fa6eed94d6f707efab12fa97ffe444fbdad5a..f6927e58b9b9d946e98a84c35481de35ba044e9d 100644 (file)
@@ -1,5 +1,5 @@
 // cs1548-2.cs: Error during assembly signing. The speficied file `cs1548-2.cs' does not have a private key
-// Line: 6
+// Line: 0
 
 using System.Reflection;
 
index b0e61f2ac7adbfbe9597f73843e654f8c19eab2b..175286015063136a35dd53695521d51d4fbdcd66 100644 (file)
@@ -1,5 +1,5 @@
 // cs1548-3.cs: Error during assembly signing. The speficied file `cs1548.pub' does not have a private key
-// Line: 6
+// Line: 0
 
 using System.Reflection;
 
index 1ef39cd5c723d9d537c780d6a7f35d09ac8bd655..2cbc3726e49500b4efc0c0c19a434287be15d576 100644 (file)
@@ -1,5 +1,5 @@
 // cs1548.cs: Error during assembly signing. The speficied file `file_not_found.snk' does not exist
-// Line: 6
+// Line: 0
 
 using System.Reflection;
 
index d2b19c7b502c4b42b1bc6fe5ad44daf27b2321de..aa9ecd3fad4b613d5f39d1b4e9540e0ab275da6d 100644 (file)
@@ -1,5 +1,5 @@
 // cs1606.cs: Could not sign the assembly. ECMA key can only be used to delay-sign assemblies
-// Line: 6
+// Line: 0
 
 using System.Reflection;
 
diff --git a/mcs/errors/cs1674-2.cs b/mcs/errors/cs1674-2.cs
new file mode 100644 (file)
index 0000000..f6f4478
--- /dev/null
@@ -0,0 +1,14 @@
+// cs1674-2.cs: `object': type used in a using statement must be implicitly convertible to `System.IDisposable'
+// Line: 10
+
+using System;
+
+class C
+{
+       void Method (IDisposable i)
+       {
+               using (object o = i)
+               {
+               }
+    }
+}
\ No newline at end of file
index ed35993286354c454048011773e5fd06d64b9d66..8499d9c0b8f9827b16cb81a5fb284f85efc42b8c 100644 (file)
@@ -1,4 +1,4 @@
-// cs1674.cs: `int': type used in a using statement must be implicitly convertible to 'System.IDisposable'
+// cs1674.cs: `int': type used in a using statement must be implicitly convertible to `System.IDisposable'
 // Line: 8
 
 class C
index 4d4df8704c9d78ef53b82f723ce3f726665be239..7280e3f276054831ad9253c469d92783bb3381c2 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-1.cs: Identifier `CLSClass.Method(int)' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 8
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant (true)]
 
index cdce15fedf6a9423a437cb78d7fddecc77870826..6679f047f6cb53db794270effc31a5e14d502c42 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-10.cs: Identifier `System.Icomparable' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 8
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index ba86ec71f2f4d2212643528869ec6a693f3babbd..be40f0bca0153c4ad8ddb9d3e1a4117603a23b1a 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-11.cs: Identifier `clsInterface' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 10
+// Compiler options: -warnaserror
 
 using System;
 [assembly:CLSCompliant (true)]
index 9719dfff68540b28fad4f952e2972ce8f1773d4e..c3cb31748e82d21578a392c26512a32fe4838b0b 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-12.cs: Identifier `CLSClass.NameAbC(int)' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 9
+// Compiler options: -warnaserror
 
 using System;
 [assembly:CLSCompliant (true)]
index cfb6deba2587614ea73e35a059f5a197c4a159f8..92f8c1e7bfdbde45f531b9e27b33646915bba023 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-13.cs: Identifier `CLSEnum.Label' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 9
+// Compiler options: -warnaserror
 
 //
 // NOTE: This is only an error in MCS - in GMCS, it's just a warning.
index 8e51786111ddc1f4e562ac66077fae24d369d4cf..554f6711d402ac657e9ed9d1f13ef33faa5efdb7 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-14.cs: Identifier `i1' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 9
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 08e368b952dc5fe97638332ddc01da65fc5e8d9e..69001a3fc1fdf5642f3f0a63174afe6a3c16a483 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-15.cs: Identifier `a' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 10
+// Compiler options: -warnaserror
 
 using System;
 [assembly:CLSCompliant (true)]
index eceafa7127c413e1729bebc1135a2a1d9287cba8..d575af0f89a2b0a5782be9c71a1af51f2a93a366 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-17.cs: Identifier `CLSClass.op_implicit()' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 12
+// Compiler options: -warnaserror
 
 using System;
 [assembly:CLSCompliant(true)]
index 63dfbafcf55bbaa7551d178bd686420a3d7bf020..f3aaa5d2777669691737813e35ded1f34a9ad50f 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-18.cs: Identifier `B.TEST()' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 15
+// Compiler options: -warnaserror
 
 using System;
 
index e19859d62377c0d2bf43fae970d1cd34e14def79..009174e071b39c30ba109811efb07c205316f5cd 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-2.cs: Identifier `CLSClass.Index' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 14
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 0cf8fa1add5c2818ebe7424ff8cde71c0625d177..a9151283d194a1243383a98ea3d85ec2d9e2b424 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-20.cs: Identifier `I.BLAH.get' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 15
+// Compiler options: -warnaserror
 
 using System.Runtime.CompilerServices;
 using System;
index 14a862c0f28b030decff84f321b38483fdb2b119..d69f3a19769a3ca6e099a71dcd01c9834619a705 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-21.cs: Identifier `CLSClass.NameAbC' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 12
+// Compiler options: -warnaserror
 
 using System;
 [assembly:CLSCompliant (true)]
index 05d4e4336a20cdb0a402d00fcb36bdda8ea322f5..45d2e88b18dce779ea7f607182aa23e2813936b0 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-22.cs: Identifier `X.index' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 8
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index d1db4e39a31f07eff7f73955fef2d8cb1538b8a0..2f1e889f0ebf61658753be230a6666160d8dcb32 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-23.cs: Identifier `CLSClass.get_A()' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 8
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 5f774ec1b1c586ebd5c37e6e6be5a478675eb76e..45f5f900b0ed062dc94d0cda0c01c991b4f45e84 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-3.cs: Identifier `CLSClass.value' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 15
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 0a02efa97d0e1ec87d52845a791a6a59331309c4..be4f1cb6ad7ff5cc7d7b7bc563b1bee6494c91b0 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-4.cs: Identifier `CLSClass.constant' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 8
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 9a7398e30d5d40c7fb77fd6e1b6c6591358b331e..f3b6064e03ebad7f8a54d9f88611ea6c898edece 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-5.cs: Identifier `CLSClass.Event_A' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 13
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 5b5b656f33a2b00699e413a48f1cffd8d9191a44..fb3bcf350730c50f63ea7af14adb887fd4053cdd 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-6.cs: Identifier `I1' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 9
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 8093e49d9c96df44dc06ee306591b9b110e701f8..7c8ec0b46ca1179fcbd3a26318b99bfa40013158 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-7.cs: Identifier `CLSClass.this[int].set' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 8
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index 1f53803315d2d11dab7b5a66eb976bb896d90f54..49d8977e60137c8f4bca148e715f02e293f3def7 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-8.cs: Identifier `II.Foo()' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 9
+// Compiler options: -warnaserror
 
 using System;
 [assembly:CLSCompliant(true)]
index 6a962b6725425555ceb1a66a400467f214548d94..6fa8c6c702908beedfdddef95b8300890b8fd3e5 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005-9.cs: Identifier `c1' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 9
+// Compiler options: -warnaserror
 
 [assembly:System.CLSCompliant(true)]
 
index cc1910a54635fb35ea166c8673e2b25d324dcc22..084b4ca06032936e04c1623ab095c7277ebc7c3b 100644 (file)
@@ -1,6 +1,6 @@
 // cs3005.cs: Identifier `ErrorCS3005.FOO' differing only in case is not CLS-compliant
-// Compiler options: -warnaserror
 // Line: 9
+// Compiler options: -warnaserror
 
 using System;
 [assembly: CLSCompliant (true)]
index 13c97e6ee7e870a115cbc36170d6ea8b48028f5d..b7f686e8879f0b942491635cb5c67760662ec159 100644 (file)
@@ -1,4 +1,4 @@
-// CS0019: Operator ?? cannot be applied to operands of type `int' and `int'
+// CS0019: Operator `??' cannot be applied to operands of type `int' and `int'
 // Line: 8
 class X
 {
index d9819f677a1a61e66454cb7b0109123a1be2e1ac..3c1bf8acdb6345d3ce44d3029fd7479c8c2c1712 100644 (file)
@@ -1,6 +1,6 @@
-// cs8200.cs: Do not allow type-parameter-constraint-clauses when
-// there is no type-parameter list
-//
+// cs0080.cs: Constraints are not allowed on non-generic declarations
+// Line: 5
+
 using System.Collections;
 class Dingus where T : IEnumerable {
 }
index ea69074190f4021d589e244a5d2cc7551cf9fc6b..a79b7b8fff92e209bc55321fcc717d309ce4040b 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0102.cs: The type 'X`1' already contains a definition for 'T'
+// gcs0102.cs: The type `X`1' already contains a definition for `T'
 // Line: 11
 
 class X <T> {
diff --git a/mcs/errors/gcs0208-2.cs b/mcs/errors/gcs0208-2.cs
new file mode 100644 (file)
index 0000000..553ba71
--- /dev/null
@@ -0,0 +1,13 @@
+// cs0208-2.cs : Cannot take the address of, get the size of, or declare a pointer to a managed type `Splay<T>.Node'
+// Line: 8
+// Compiler options: /unsafe
+public class Splay<T>
+{
+  unsafe private struct Node
+  {
+    private Node *            left, right;
+    private Node *            parent;
+    private T                 data;
+  } 
+}
+
diff --git a/mcs/errors/gcs0208-3.cs b/mcs/errors/gcs0208-3.cs
new file mode 100644 (file)
index 0000000..9c24ad5
--- /dev/null
@@ -0,0 +1,17 @@
+// cs0208-3.cs : Cannot take the address of, get the size of, or declare a pointer to a managed type `Splay<T>.Node'
+// Line: 10
+// Compiler options: /unsafe
+// Similar code to #75772, but without field of type T.
+// Compiler options: /unsafe
+public class Splay<T>
+{
+  unsafe private struct Node
+  {
+    private Node *            left, right;
+    private Node *            parent;
+//    private T                 data;
+
+    public static void Main () {}
+  } 
+}
+
diff --git a/mcs/errors/gcs0208-4.cs b/mcs/errors/gcs0208-4.cs
new file mode 100644 (file)
index 0000000..6298886
--- /dev/null
@@ -0,0 +1,15 @@
+// cs0208-4.cs : Cannot take the address of, get the size of, or declare a pointer to a managed type `Splay<T>.Node'
+// Line: 10
+// Compiler options: /unsafe
+// similar one to #75772 but using a class instead of a struct.
+// Compiler options: /unsafe
+public class Splay<T>
+{
+  unsafe private class Node
+  {
+    private Node *            left, right;
+    private Node *            parent;
+    private T                 data;
+  } 
+}
+
index 2c4fc5edd7df6cd0fdd7d5110faf502a72fcd173..1c5e807bcc79f5f3832c058cd2654db30aafc4fd 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0208.cs: Cannot take the size of an unmanaged type (X`1)
+// gcs0208.cs: Cannot take the address of, get the size of, or declare a pointer to a managed type `X<A>'
 // Line: 12
 // Compiler options: -unsafe
 
index 3e04ad761d49de7f2121348f1492b3d590f810b4..f5ce9f7c099080bbf06a83abf76c090ca1ceb7cf 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0246.cs: Cannot find type 'List`2'
+// gcs0246.cs: The type or namespace name `List`2' could not be found. Are you missing a using directive or an assembly reference?
 // Line: 8
 
 using System.Collections.Generic;
index c19167be6f93e7eb5fca34d516beb732111f7b7b..82144da2b02d5c8175e97ecb5ed3ab8f4ff8a822 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0246.cs: Cannot find type 'Stack'
+// gcs0246.cs: The type or namespace name `Stack' could not be found. Are you missing a using directive or an assembly reference?
 // Line: 9
 
 class Stack<T>
index 5a873787bd2452ea958adbe73d4f6bbdd667e69d..743d2fc1a2fc8dd111496ff40b000497e287e8ed 100644 (file)
@@ -1,5 +1,5 @@
 // CS8217: Generic type `Stack' takes 1 type parameters, but specified 2.
-// line: 10
+// Line: 10
 class Stack<T> {
 }
 
index 14278b3d8604593cf6785b9b662ecaadb9da59ca..49d2fbe63deb64d221e0f32fa355c2ab95c02b90 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0246.cs: Cannot find type 'DateTime`1'
+// gcs0246.cs: The type or namespace name `DateTime`1' could not be found. Are you missing a using directive or an assembly reference?
 // Line: 8
 
 using System;
index db6c33d977217fd6c633ce90104915d09be898ca..7e22a259f1b83ac1bfc8ef0a4c071e63fe6ba365 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0246.cs: Cannot find type 'Stack`1'
+// gcs0246.cs: The type or namespace name `Stack`1' could not be found. Are you missing a using directive or an assembly reference?
 // Line: 9
 
 class Stack
index 1ce9b4cef55ac896d627df13b1e7eaff4c9b4e5b..c9353f1711069724c35fe57085b9267f00febf48 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0246.cs: Cannot find type 'NotExist`1'
+// gcs0246.cs: The type or namespace name `NotExist`1' could not be found. Are you missing a using directive or an assembly reference?
 // Line: 6
 
 class X
index 4eb1d929da7260fcaa945d1bbc7ca6397908f118..d9f3591c16cc19be663565206f0d5735f24046b7 100644 (file)
@@ -1,5 +1,4 @@
-// CS0304: Cannot create an instance of the variable type 'T' because it
-// doesn't have the new() constraint
+// CS0304: Cannot create an instance of the variable type 'T' because it doesn't have the new() constraint
 // Line: 9
 
 public class Foo<T>
index 0b93cd4eba0a2d7218ad1e17059dc406345e82e8..2471cf7bd1d1973edd5b4a23fa372a31797ce994 100644 (file)
@@ -1,5 +1,4 @@
-// CS0309: The type 'B' must be convertible to 'I' in order to use it as
-//         parameter 'T' in the generic type or method 'Foo<T>'
+// CS0309: The type 'B' must be convertible to 'I' in order to use it as parameter 'T' in the generic type or method 'Foo<T>'
 // Line: 21
 
 public class Foo<T>
index 2a5bc1223cc56c8ae5c31c39ddb34973f09f3b8e..cbac2327327de32ca99afbe1cf1ef64d3b3102fe 100644 (file)
@@ -1,5 +1,4 @@
-// CS0309: The type 'B' must be convertible to 'A' in order to use it
-// as parameter 'T' in the generic type or method 'Foo<T>'
+// CS0309: The type 'B' must be convertible to 'A' in order to use it as parameter 'T' in the generic type or method 'Foo<T>'
 // Line: 35
 using System;
 
diff --git a/mcs/errors/gcs0309-5.cs b/mcs/errors/gcs0309-5.cs
new file mode 100644 (file)
index 0000000..8cbdfb3
--- /dev/null
@@ -0,0 +1,8 @@
+// CS0309: The type `System.Int32' must be convertible to `System.EventArgs' in order to use it as parameter `T' in the generic type or method `System.EventHandler`1<T>'
+// Line: 5
+class X {
+       System.EventHandler <int> x;
+       static void Main () {}
+}
+
+
index 68bcbbd18dfd91c26f42400f1a64bde2cf2b4831..7937c2123b1779afee14f19806b79e5b570712f9 100644 (file)
@@ -1,5 +1,4 @@
-// CS0309: The type 'B' must be convertible to 'A' in order to use it as
-// parameter 'T' in the generic type or method 'Foo<T>'
+// CS0309: The type 'B' must be convertible to 'A' in order to use it as parameter 'T' in the generic type or method 'Foo<T>'
 // Line: 20
 
 public class Foo<T>
index 62e4f3198878d8425be663353bb20857f292b56d..6692a1c899469dc5079090b3984aab008ce0911c 100644 (file)
@@ -1,5 +1,4 @@
-// CS0310: The type 'A' must have a public parameterless constructor in
-//         order to use it as parameter 'T' in the generic type or method 'Foo<T>'
+// CS0310: The type 'A' must have a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'Foo<T>'
 // Line: 20
 
 public class Foo<T>
index bf3547f61204e8f971bbb8d01fce874d460cebdf..c7ae022d7c21ab634a9827367595fc4ee1b2a454 100644 (file)
@@ -1,5 +1,4 @@
-// CS0310: The type 'A' must have a public parameterless constructor in
-// order to use it as parameter 'T' in the generic type or method 'Foo<T>'
+// CS0310: The type 'A' must have a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'Foo<T>'
 // Line: 18
 
 public class Foo<T>
index acb580009976fabb62fe56fbca6976316432e1ab..1730fff66d8529c64ac67e61b1a0dc70f2656fe0 100644 (file)
@@ -1,5 +1,4 @@
-// CS0310: The type 'A' must have a public parameterless constructor in
-// order to use it as parameter 'T' in the generic type or method 'Foo<T>'
+// CS0310: The type 'A' must have a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'Foo<T>'
 // Line: 18
 
 public class Foo<T>
index ba64d7ce916ed8866fc68f34dfd5665a925d8768..7a362e679d2a84f2fcc7c3e73c431f30e1605b67 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0405.cs: Duplicate constraint `I' for type parameter `T'.
+// gcs0405.cs: Duplicate constraint `I' for type parameter `T'
 // Line: 8
 
 interface I { }
index d2a6b149de02d58a6a5276d15013bc9a4a0551b4..3cebd543739be5370d55136610c8fb96b3df018a 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0411.cs: The type arguments for method `Foo' cannot be infered from the usage. Try specifying the type arguments explicitly.
+// gcs0411.cs: The type arguments for method `Foo' cannot be infered from the usage. Try specifying the type arguments explicitly
 // Line: 15
 
 class Test<A>
index 5525ee8b371bbfba681d413deb520dd52cdb4703..9b2c9bf795f52bdca7f3fd145413ad18769475da 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0411.cs: The type arguments for method `Foo' cannot be infered from the usage. Try specifying the type arguments explicitly.
+// gcs0411.cs: The type arguments for method `Foo' cannot be infered from the usage. Try specifying the type arguments explicitly
 // Line: 15
 
 class Test<A,B>
index 078d299db7512ee6c09b9ab832220e7d221f0b36..f76b5f26d7881791b4d984cea439e90eace05670 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0411.cs: The type arguments for method `T X.G ()' cannot be infered from the usage. Try specifying the type arguments explicitly.
+// gcs0411.cs: The type arguments for method `T X.G()' cannot be infered from the usage. Try specifying the type arguments explicitly
 // Line: 17
 
 using System;
index a23c467394e72b6f3f92d87119391742aa0d049d..50d7d61929c5165d4bddb187da8304ad0743602a 100644 (file)
@@ -1,4 +1,4 @@
-// CS0411: The type arguments for method `World' cannot be infered from the usage. Try specifying the type arguments explicitly.
+// CS0411: The type arguments for method `World' cannot be infered from the usage. Try specifying the type arguments explicitly
 // Line: 16
 public interface IFoo<T>
 { }
index fea0c439ef2df54869d933b3c1717fe489ae4973..67caa5a8a7f9a6b109374b90a997b0dd4ec7e336 100644 (file)
@@ -1,4 +1,4 @@
-// CS0411: The type arguments for method `World' cannot be infered from the usage. Try specifying the type arguments explicitly.
+// CS0411: The type arguments for method `World' cannot be infered from the usage. Try specifying the type arguments explicitly
 // Line: 16
 public interface IFoo<T>
 { }
index b560052580cec0986e1715066d3e9881bdc794b4..815602d5e6a04456414ab238813282dbcc9220a5 100644 (file)
@@ -1,4 +1,4 @@
-// CS0411: The type arguments for method `Test' cannot be infered from the usage. Try specifying the type arguments explicitly.
+// CS0411: The type arguments for method `Test' cannot be infered from the usage. Try specifying the type arguments explicitly
 // Line: 15
 using System;
 
index d9ff41082d895fc49092503fe247a324a7b119f0..1b77817d0ffc81c9458efc0901fb61b98e217bc6 100644 (file)
@@ -1,4 +1,4 @@
-// gcs0411.cs: The type arguments for method `Foo' cannot be infered from the usage. Try specifying the type arguments explicitly.
+// gcs0411.cs: The type arguments for method `Foo' cannot be infered from the usage. Try specifying the type arguments explicitly
 // Line: 15
 
 class Test<A>
index a68f30598b7673e173abd355854f1f1228cc08e3..4ff103883d6a79bd9006d204951b47bc7af1ab75 100644 (file)
@@ -1,4 +1,4 @@
-// CS0417: 'T': Cannot provide arguments when creating an instance of a variable type
+// CS0417.cs: `T': Cannot provide arguments when creating an instance of a variable type
 // Line: 9
 
 public class Foo<T>
index c210ba0efccceaf790ce9d635cd738ae3f08ad2c..5bc9fe785219680c36137800e5a6b842c7b2cd96 100644 (file)
@@ -1,5 +1,4 @@
-// CS0452: The type `X' must be a reference type in order to use it as type
-//         parameter `T' in the generic type or method `MyObject<T>'.
+// CS0452: The type `X' must be a reference type in order to use it as type parameter `T' in the generic type or method `MyObject<T>'.
 // Line: 13
 public class MyObject<T>
        where T : class
index b6cd6cd13ad665912f00859185d8a7db6f066cb9..a3226cffffc42bcba12fb845e8588e5568790340 100644 (file)
@@ -1,5 +1,4 @@
-// CS0453: The type `X' must be a value type in order to use it as type
-//         parameter `T' in the generic type or method `MyValue<T>'.
+// CS0453: The type `X' must be a value type in order to use it as type parameter `T' in the generic type or method `MyValue<T>'.
 // Line: 10
 public class MyValue<T>
        where T : struct
index a4484e522375ce847a0d217421222888e61c47e8..c640be781bf480b202dd8ecd734327a5fb537919 100644 (file)
@@ -1,5 +1,5 @@
-// cs0698.cs: Generic type can not derive from Attribute class
-// Line: 5
+// cs0698.cs: A generic type cannot derive from `System.Attribute' because it is an attribute class
+// Line: 6
 
 using System;
 
index fe0c61a316969a6b2686f54cdf05a3321c984ee6..ab5f0a7f793163cbc6c781c4556d65620d157e6e 100644 (file)
 # csXXXX.cs NO ERROR   : error test case doesn't report any error. An exception is considered
 #                        as NO ERROR and CS5001 is automatically ignored.
 
-cs0029-3.cs
-cs0034-2.cs NO ERROR
-cs0034-3.cs NO ERROR
-cs0037-3.cs
-cs0037-4.cs
 cs0121-3.cs NO ERROR
-cs0159-3.cs
-cs0165-10.cs NO ERROR
-cs0165-11.cs NO ERROR
 cs0201.cs
 cs0202.cs # new in GMCS
 cs0229-2.cs
@@ -27,15 +19,7 @@ cs0229.cs NO ERROR
 cs0266-2.cs NO ERROR
 cs0266-3.cs
 cs0266.cs
-cs0418-3.cs NO ERROR
-cs0418-4.cs
-cs0418-5.cs
 cs0428.cs
-cs0431.cs
-cs0432-2.cs
-cs0432.cs
-cs0440.cs
-cs0441-2.cs
 cs0525.cs
 cs0526.cs
 cs0547-2.cs # new in GMCS; grammar issue
@@ -44,22 +28,7 @@ cs0548-4.cs
 cs0548.cs
 cs0560.cs
 cs0567.cs
-cs0619-39.cs NO ERROR
-cs0619-40.cs NO ERROR
-cs0642-2.cs NO ERROR
-cs0642-3.cs
-cs0642-4.cs
-cs0642-5.cs NO ERROR
-cs0642-6.cs NO ERROR
-cs0642.cs NO ERROR
 cs0647-15.cs NO ERROR # corlib bug 73143
-cs0652-2.cs NO ERROR
-cs0652-3.cs NO ERROR
-cs0652-4.cs NO ERROR
-cs0652.cs NO ERROR
-cs0665-2.cs NO ERROR
-cs0687.cs
-cs1010-2.cs
 cs1013.cs # new in GMCS; grammar issue
 cs1041.cs # new in GMCS; grammar issue
 cs1501-5.cs
@@ -75,13 +44,11 @@ cs1638.cs NO ERROR
 cs1641.cs
 cs1666.cs NO ERROR
 cs2007.cs
-gcs0694.cs NO ERROR
-gcs1644-2.cs NO ERROR
 
-cs0139-2.cs NO ERROR
+cs0612-2.cs NO ERROR
 cs0619-42.cs
-cs0642-10.cs NO ERROR
-cs0642-7.cs NO ERROR
-cs0642-8.cs NO ERROR
-cs0642-9.cs NO ERROR
-cs1546.cs
+cs0619-43.cs NO ERROR
+cs0619-45.cs NO ERROR
+cs0619-46.cs NO ERROR
+cs0619-31.cs NO ERROR
+cs1674-2.cs
\ No newline at end of file
index 6e0d45dd543e4b86fa91f35de0711e3c34f05539..8f227a29c1635d1bee9bd4e04a316fd2ec750c13 100644 (file)
@@ -23,13 +23,16 @@ cs0428.cs
 cs0525.cs
 cs0526.cs
 cs0547.cs
-cs0548-4.cs
 cs0548.cs
+cs0548-4.cs
 cs0560.cs
 cs0567.cs
 cs0612-2.cs NO ERROR
 cs0619-42.cs
 cs0619-31.cs NO ERROR
+cs0619-43.cs NO ERROR
+cs0619-45.cs NO ERROR
+cs0619-46.cs NO ERROR
 cs0647-15.cs NO ERROR # corlib bug 73143
 cs1501-5.cs
 cs1513.cs
@@ -40,4 +43,5 @@ cs1586.cs
 cs1638.cs NO ERROR
 cs1641.cs
 cs1666.cs NO ERROR
+cs1674-2.cs
 cs2007.cs
index 00258dd2900dfe65a1ff2acb76e72a8dd4ff71a9..e7da9e14cfa13d8643821c3c32b0dba86bdda1a8 100644 (file)
@@ -1,3 +1,386 @@
+2005-09-15  Raja R Harinath  <rharinath@novell.com>
+
+       * Makefile (PROGRAM): Make profile specific.
+       (gmcs.exe) [PROFILE=net_2_0]: Add utility rule to copy gmcs.exe to
+       the current directory.
+
+       Fix test-455.cs.
+       * expression.cs (Invocation.EmitCall): Remove optimization on
+       this_call since it doesn't handle 'this' being a value type.
+
+2005-09-05  Geoff Norton  <gnorton@customerdna.com>
+
+       * driver.cs: Ensure file handles are closed after parsing
+
+2005-09-05  Miguel de Icaza  <miguel@novell.com>
+
+       * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
+       if the underlying types are the same, otherwise we need to produce
+       code that will do the proper cast.
+
+       This was exposed by Marek's constant rewrite which produced
+       invalid code for the call site:
+
+       enum X : long { a }
+       void Method (X v) {}
+
+       Method ((X) 5)
+
+       This fixes test-49.cs
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       * expression.cs (As.DoResolve): Use `probe_type.IsValueType'
+       instead of `TypeManager.IsValueType (probe_type)'; fixes #75668.
+
+       * cs-parser.jay (delegate_declaration): Small fix for #75852.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * typemanager.cs: (IsUnmanagedType) : generic parameter is not allowed
+         to be a pointer type due to the spec 25.2, so check if declaring
+         type is generic type definition. Fixed bug #75772.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       Fixed bug #75957.
+       * generic.cs : (TypeManager.IsEqual(Type,Type)): it should work when
+         both types are not defined by methods.
+       * expression.cs : (Invocation.IsApplicable): it should work when
+         the argument type is equal to the parameter type, not only when
+         ImplicitConversionExists() returns true.
+
+2005-09-02  Raja R Harinath  <rharinath@novell.com>
+
+       * attribute.cs (GetMarshal): Work even if "DefineCustom" is
+       internal.
+
+       Fix #75941.
+       * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
+       flow-branching for LocalVariableReferences in case we were invoked
+       from a MemberAccess.
+       * expression.cs (LocalVariableReference.VerifyAssigned): New.
+       Carved out of ...
+       (LocalVariableReference.DoResolveBase): ... this.
+       (MemberAccess.Resolve): Do the check that was disabled during
+       SimpleNameResolve.
+
+2005-09-01  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * class.cs :
+         (PartialContainer.Create): check abstract/sealed/static strictly
+         but abstract/sealed can exist only at one side. Fixed bug #75883.
+
+2005-09-01  Kornél Pál  <kornelpal@hotmail.com>
+
+       Fix #75945.
+       * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
+       specified, don't default to UnmanagedType.I4.
+
+2005-09-01  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * expression.cs : conditional operator should check possibly
+         incorrect assign expression. Fixed bug #75946.
+
+2005-08-30  Raja R Harinath  <rharinath@novell.com>
+
+       Fix #75934.
+       * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
+       (ScopeInfo.EmitScopeType): Use it to construct field names from
+       names of captured locals.
+
+       Fix #75929.
+       * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
+       * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
+       Pass 'target_type' to BoxedCast.  Don't default to 'object'.
+       (ExplicitConversion): Remove enum cases already handled by
+       implicit conversion.  Move implicit conversion check to the beginning.
+       * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
+       * expression.cs (ArrayCreation.EmitDynamicInitializers):
+       Don't treat System.Enum as a struct.
+
+2005-08-30  Jb Evain  <jbevain@gmail.com>
+
+       * attribute.cs: handles as expression in parameters.
+
+2005-08-30  Raja R Harinath  <rharinath@novell.com>
+
+       Fix #75802.
+       * class.cs (TypeContainer.VerifyClsName): Don't use a
+       PartialContainer when verifying CLS compliance.
+       (AbstractPropertyEventMethod): Set Parent here, ...
+       (PropertyMethod): ... not here.
+
+2005-08-30  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * attribute.cs : escaped attribute name should not be allowed to be
+         resolved (e.g. @class as classAttribute). Fixed bug #75930.
+
+2005-08-29  Raja R Harinath  <rharinath@novell.com>
+
+       Fix #75927.
+       * convert.cs (ImplicitStandardConversionExists): Allow zero also
+       when converting a long constant to unsigned long.
+       * expression.cs (Invocation.OverloadResolve): Add sanity check to
+       detect where IsApplicable and VerifyArgumentsCompat disagree.
+
+2005-08-29  Raja R Harinath  <rharinath@novell.com>
+       and Carlos Alberto Cortez  <carlos@unixmexico.org>
+
+       Fix #75848.
+       * class.cs (TypeContainer.CanElideInitializer): New helper.
+       (TypeContainer.EmitFieldInitializers): Use it to determine if we
+       can safely emitting the initializer of a field.
+
+2005-08-25  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * statement.cs : (Continue.Resolve()) Unlike break, continue is not
+         allowed inside a switch (without loop). Fixed bug #75433.
+
+2005-08-26  Kornél Pál  <kornelpal@hotmail.com>
+
+       * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
+       * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
+
+2005-08-25  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * driver.cs : kinda reverting the default encoding changes (not exact 
+         revert since I noticed that "codepage:reset" might not work fine).
+
+2005-08-25  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
+         Location. Now getter and setter store location correctly.
+         (errors/cs0111-12.cs now reports the expected location.)
+
+2005-08-25  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * driver.cs : Use default encoding on the environment.
+         Removed (now that) extra parameter for SeekableStreamReader.
+       * support.cs : (SeekableStreamReader) third .ctor() argument for
+         StreamReader is not required (always true). preamble size could
+         be acquired in simpler and safe way.
+
+2005-08-24  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * cs-parser.jay: report CS0642 at warning level 3
+         and report CS0642 for an if else statement also
+         fixes bug #74745. Patch by John Luke (and a bit
+         modified by me).
+         Removed extra CS0642 warning check for "while",
+         "for" and "fixed".
+       * statement.cs: In Block.Resolve(), CS0642 check
+         is reimplemented to check a sequence of an empty
+         statement and a block.
+
+         Both fix bug #66777.
+
+2005-08-24  Marek Safar  <marek.safar@seznam.cz>
+
+       * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
+       detection until I fix it.
+       
+       * cs-tokenizer.cs: Changed error message.
+       
+       * cs-parser.jay: Fixed 2 error locations.
+       
+       * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
+       (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
+       properties.
+       
+       * enum.cs (GetSignatureForError): Fixed.
+       
+       * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
+       method detection.
+       
+       * class.cs,
+       * typemanager.cs (RegisterProperty): Removed.
+       
+       * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
+
+2005-08-24  Raja R Harinath  <rharinath@novell.com>
+
+       Fix #75874.
+       * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
+       (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
+
+2005-08-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * expression.cs : tiny fix is required for not warning positive ulong.
+         See test-441.cs.
+
+2005-08-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * expression.cs : add CS0652 check for constant and integral
+         expression. Fixed bug #53974.
+
+2005-08-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * expression.cs : in DoNumericPromotions(), check if there is implicit
+         conversion overload for string (to check CS0034). Fixed bug #52492.
+
+2005-08-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
+
+2005-08-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ecore.cs : report location when it is *not* Null.
+
+2005-08-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * codegen.cs,
+         ecore.cs,
+         flowanalysis.cs,
+         expression.cs:
+         Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
+         correctly. Fixed bug #75721.
+
+2005-08-23  Raja R Harinath  <rharinath@novell.com>
+
+       * support.cs (SeekableStreamReader.Position): Avoid an expensive
+       loop that performs 'min (pos, char_count)'.
+
+       Fix #75862.
+       * expression.cs (Unary.ResolveOperator): Don't discard implicit
+       converted value in Operator.OnesComplement.
+
+2005-08-22  Ben Maurer  <bmaurer@ximian.com>
+
+       * anonymous.cs: If the anon method is pulled into a helper class,
+       it needs to be `internal' not `private'. Fixes runtime behavior on
+       msft. bug #75704
+
+2005-08-17  Marek Safar  <marek.safar@seznam.cz>
+
+       Fix #75803
+       * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
+       is a partial class.
+
+2005-08-16  Marek Safar  <marek.safar@seznam.cz>
+
+       The big constants rewrite
+       Fix #75746, #75685 and more
+       As a side effect saved 1MB for MWF ;-)
+       
+       * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
+       (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
+       enum based for corlib compilation.
+       
+       * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
+       subtractions.
+       
+       * class.cs (FixedField.Define): Use ResolveAsConstant.
+       
+       * const.cs (IConstant): Interface constants and enums.
+       (Const.ResolveValue): New method for constant resolvning.
+       (ExternalConstant): Constants from imported assemblies.
+       
+       * constant.cs (Constant.GetTypedValue): Used to get constant with forced
+       conversion; like enums.
+       (Constant.ToType): Converts this constant to different type.
+       (Constant.Increment): Adds 1.
+       
+       * convert.cs (ImplicitConversionRequired): Simplified.
+       
+       * cs-parser.jay: Create EnumMember directly.
+       
+       * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
+       
+       * doc.cs (GenerateEnumDocComment): Removed.
+       
+       * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
+       (ConvertIntLiteral): Removed.
+       (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
+       
+       * enum.cs (EnumMember): Implement IConstant.
+       (Enum.IsValidEnumConstant): Removed.
+       (Enum.GetNextDefaultValue): Removed.
+       (Enum.FindMembers): Updated.
+       (Enum.GenerateDocComment): Iterate enum members.
+       
+       * expression.cs (Cast.TryReduce): Handle enums correctly.
+       (New.Constantify): Made public.
+       (MemberAccess.DoResolve): Removed contant specific if(s).
+       
+       * literal.cs (NullLiteral): Implement new abstract methods.
+       
+       * statement.cs (GotoCase.Resolve): Use new constant methods.
+       (SwitchLabel.ResolveAndReduce): Use new constant methods.
+       
+       * typemanager.cs (LookupEnum): Removed.
+       (IsEnumType): Fixed to work with corlib.
+       (RegisterConstant): Removed.
+       (LookupConstant): Removed.
+       (GetConstant): Changed to work with IConstant.
+
+2005-08-04  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * location.cs : Fixed overflown (>255) column number.
+
+2005-08-03  Raja R Harinath  <rharinath@novell.com>
+
+       First cut of the qualified-alias-member feature.
+       * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
+       token.
+       * cs-parser.jay (DOUBLE_COLON): New token.
+       (namespace_or_type_name): Add rule for recognizing
+       qualified-alias-members.
+       (primary_expression): Likewise.
+       (element_access): Allow QualifiedAliasMember as a possible
+       type-bearing expression.
+       (local_variable_type, local_variable_pointer_type): Likewise.
+       * namespace.cs (NamespaceEntry.LookupAlias): New.  Looks up
+       aliases in the current and enclosing namespace declarations.
+       (NamespaceEntry.UsingAlias): Add CS0440 warning.
+       * decl.cs (MemberName.is_double_colon): New.
+       (MemberName.MemberName): Add new constructor for alias-member.
+       (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
+       * expression.cs (QualifiedAliasMember): New expression type.
+
+2005-08-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * location.cs : it borked when no argument was specified.
+
+2005-08-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * location.cs : tiny ToString() format fix.
+
+2005-08-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * statement.cs : oops, it was missing.
+
+2005-08-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       A set of fixes for precise line/column location.
+
+       * location.cs :
+         "token" field now holds a file/line "delta", a line number offset 
+         from the segment, and a column number. See also:
+         http://lists.ximian.com/pipermail/mono-devel-list/2004-
+         December/009508.html
+         Removed static IsNull. Use instance IsNull property instead.
+       * cs-tokenizer.cs :
+         For some tokens it stores Location. For Identifier it stores
+         LocatedToken which is a pair of string name and location.
+         Column numbers are adjusted only at getChar().
+       * report.cs :
+         Use Location.ToString() for reporting (it now contains column).
+       * cs-parser.jay :
+         Largely modified to use LocatedToken instead of
+         string (IDENTIFIER), and to acquire Location from some tokens.
+       * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
+         iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
+         codegen.cs :
+         Now MemberName holds Location. DeclSpace.ctor() receives Location
+         as a parameter. Removed extra parameters to all derived classes.
+         Replaced Location.IsNull() with instance property.
+       * assign.cs, expression.cs :
+         Added .ctor() overload that omits Location.
+       * attribute.cs :
+         Added "nameEscaped" flag that indicates the identifier was escaped
+         in the source file. This fixes bug #57047.
+
 2005-09-02  Martin Baulig  <martin@ximian.com>
 
        * class.cs: Make CS3005 a warning, not an error.
index 10e72ad4ceed4019685ab2909377be582674fa9c..72f03b5626fa2d375f017550f2710511e3f436f9 100644 (file)
@@ -11,16 +11,24 @@ BUILT_SOURCES = cs-parser.cs
 
 EXTRA_DISTFILES = cs-parser.jay
 
-PROGRAM = gmcs.exe
+PROGRAM = $(topdir)/class/lib/$(PROFILE)/gmcs.exe
 PROGRAM_COMPILE = $(BOOT_COMPILE)
 
-CLEAN_FILES = y.output
+CLEAN_FILES = y.output *.exe *.mdb
 
 cs-parser.cs: cs-parser.jay $(topdir)/jay/skeleton.cs
        $(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
 
 include ../build/executable.make
 
+ifeq (net_2_0, $(PROFILE))
+# Utility rule to make debugging somewhat easier.
+all-local: gmcs.exe
+gmcs.exe: $(PROGRAM)
+       cp -p $< $@
+       test ! -f $<.mdb || cp -p $<.mdb $@.mdb
+endif
+
 clean-local: clean-net_2_0_bootstrap
 clean-net_2_0_bootstrap:
        cd .. && $(MAKE) PROFILE=net_2_0_bootstrap clean
index 0cda34131e8dae42ae483a7be738036b5656a776..61026448973fad4970ee2f0ae2d6874991299b08 100644 (file)
@@ -51,7 +51,7 @@ namespace Mono.CSharp {
                public string[] TypeParameters;
                public Type[] TypeArguments;
                protected bool unreachable;
-               
+
                //
                // The modifiers applied to the method, we aggregate them
                //
@@ -168,6 +168,9 @@ namespace Mono.CSharp {
                        
                        if (type_host == null)
                                throw new Exception (String.Format ("Type host is null, Scope is {0}", Scope == null ? "null" : "Not null"));
+
+                       if (current_type != type_host)
+                               method_modifiers = Modifiers.INTERNAL;
                        
                        if (current_type == type_host && ec.IsStatic){
                                if (ec.IsStatic){
@@ -185,22 +188,21 @@ namespace Mono.CSharp {
                                foreach (string t in TypeParameters)
                                        args.Add (new SimpleName (t, loc));
 
-                               member_name = new MemberName (name, args);
+                               member_name = new MemberName (name, args, loc);
 
                                generic_method = new GenericMethod (
                                        ec.DeclSpace.NamespaceEntry,
                                        (TypeContainer) ec.TypeContainer,
-                                       member_name, loc);
+                                       member_name);
 
                                generic_method.SetParameterInfo (null);
                        } else
-                               member_name = new MemberName (name);
+                               member_name = new MemberName (name, loc);
 
                        method = new Method (
                                (TypeContainer) ec.TypeContainer, generic_method,
                                new TypeExpression (invoke_mb.ReturnType, loc),
-                               method_modifiers, false, member_name,
-                               Parameters, null, loc);
+                               method_modifiers, false, member_name, Parameters, null);
                        method.Block = Block;
 
                        //
@@ -362,7 +364,7 @@ namespace Mono.CSharp {
                {
                        MethodInfo builder = method.MethodData.MethodBuilder;
                        if (TypeArguments != null)
-                               return builder.BindGenericParameters (TypeArguments);
+                               return builder.MakeGenericMethod (TypeArguments);
                        else
                                return builder;
                }
@@ -598,7 +600,7 @@ namespace Mono.CSharp {
                        Console.WriteLine ("NeedThis=" + NeedThis);
                        foreach (LocalInfo li in locals){
                                Pad ();
-                               Console.WriteLine ("var {0}", li.Name);
+                               Console.WriteLine ("var {0}", MakeFieldName (li.Name));
                        }
                        
                        foreach (ScopeInfo si in children)
@@ -613,6 +615,11 @@ namespace Mono.CSharp {
                        return String.Format ("<>AnonHelp<{0}>", id);
                }
 
+               private string MakeFieldName (string local_name)
+               {
+                       return "<" + id + ":" + local_name + ">";
+               }
+
                public void EmitScopeType (EmitContext ec)
                {
                        // EmitDebug ();
@@ -642,7 +649,7 @@ namespace Mono.CSharp {
 
                        foreach (LocalInfo info in locals)
                                info.FieldBuilder = ScopeTypeBuilder.DefineField (
-                                       info.Name, info.VariableType, FieldAttributes.Assembly);
+                                       MakeFieldName (info.Name), info.VariableType, FieldAttributes.Assembly);
 
                        if (HostsParameters){
                                Hashtable captured_parameters = CaptureContext.captured_parameters;
@@ -1065,12 +1072,24 @@ namespace Mono.CSharp {
                        AdjustMethodScope (am, topmost);
                }
 
-               public void CaptureThis ()
+               public void CaptureThis (AnonymousContainer am)
                {
                        CaptureContext parent = ParentCaptureContext;
-                       if (parent != null)
-                               parent.CaptureThis ();
+                       if (parent != null) {
+                               parent.CaptureThis (am);
+                               return;
+                       }
                        referenced_this = true;
+
+                       if (topmost == null){
+                               //
+                               // Create one ScopeInfo, if there are none.
+                               //
+                               topmost = new ScopeInfo (this, toplevel_owner);
+                               scopes [toplevel_owner.ID] = topmost;
+                       
+                               AdjustMethodScope (am, topmost);
+                       }
                }
 
                public bool HaveCapturedVariables {
index 0a4daf6631b4a63c7770ac8492a1f1cfc1eebb79..cf4135405b9624ee41441fb33520e258c962e890 100644 (file)
@@ -258,6 +258,11 @@ namespace Mono.CSharp {
                protected bool is_embedded = false;
                protected bool must_free_temp = false;
 
+               public Assign (Expression target, Expression source)
+                       : this (target, source, target.Location)
+               {
+               }
+
                public Assign (Expression target, Expression source, Location l)
                {
                        this.target = target;
@@ -591,15 +596,15 @@ namespace Mono.CSharp {
                Binary.Operator op;
                public Expression original_source;
                
-               public CompoundAssign (Binary.Operator op, Expression target, Expression source, Location l)
-                       : base (target, source, l)
+               public CompoundAssign (Binary.Operator op, Expression target, Expression source)
+                       : base (target, source, target.Location)
                {
                        original_source = source;
                        this.op = op;
                }
 
                protected CompoundAssign (CompoundAssign embedded, Location l)
-                       : this (embedded.op, embedded.target, embedded.source, l)
+                       : this (embedded.op, embedded.target, embedded.source)
                {
                        this.is_embedded = true;
                }
@@ -629,7 +634,7 @@ namespace Mono.CSharp {
                        // into a tree, to guarantee that we do not have side
                        // effects.
                        //
-                       source = new Binary (op, target, original_source, loc);
+                       source = new Binary (op, target, original_source);
                        return base.DoResolve (ec);
                }
        }
index 8275e0a278c3a2bf1e3eb30fd110c7849f6e09fa..6d11c840e7c2580b753fe1fc0d7b5f3c6641b11e 100644 (file)
@@ -85,6 +85,8 @@ namespace Mono.CSharp {
                
                bool resolve_error;
 
+               readonly bool nameEscaped;
+
                static AttributeUsageAttribute DefaultUsageAttribute = new AttributeUsageAttribute (AttributeTargets.All);
                static Assembly orig_sec_assembly;
 
@@ -97,7 +99,7 @@ namespace Mono.CSharp {
 
                static PtrHashtable usage_attr_cache = new PtrHashtable ();
                
-               public Attribute (string target, Expression left_expr, string identifier, ArrayList args, Location loc)
+               public Attribute (string target, Expression left_expr, string identifier, ArrayList args, Location loc, bool nameEscaped)
                {
                        LeftExpr = left_expr;
                        Identifier = identifier;
@@ -105,6 +107,7 @@ namespace Mono.CSharp {
                        Arguments = args;
                        Location = loc;
                        ExplicitTarget = target;
+                       this.nameEscaped = nameEscaped;
                }
 
                void Error_InvalidNamedArgument (string name)
@@ -193,9 +196,9 @@ namespace Mono.CSharp {
                {
                        bool t1_is_attr = false;
                        Type t1 = ResolvePossibleAttributeType (ec, Identifier, true, ref t1_is_attr);
-                       // FIXME: Shouldn't do this for quoted attributes: [@A]
                        bool t2_is_attr = false;
-                       Type t2 = ResolvePossibleAttributeType (ec, Identifier + "Attribute", true, ref t2_is_attr);
+                       Type t2 = nameEscaped ? null :
+                               ResolvePossibleAttributeType (ec, Identifier + "Attribute", true, ref t2_is_attr);
 
                        if (t1_is_attr && t2_is_attr) {
                                Report.Error (1614, Location, "`{0}' is ambiguous between `{0}' and `{0}Attribute'. Use either `@{0}' or `{0}Attribute'", GetSignatureForError ());
@@ -239,26 +242,14 @@ namespace Mono.CSharp {
                //
                public static bool GetAttributeArgumentExpression (Expression e, Location loc, Type arg_type, out object result)
                {
-                       if (e is EnumConstant) {
-                               if (RootContext.StdLib)
-                                       result = ((EnumConstant)e).GetValueAsEnumType ();
-                               else
-                                       result = ((EnumConstant)e).GetValue ();
-
-                               return true;
-                       }
-
                        Constant constant = e as Constant;
                        if (constant != null) {
-                               if (e.Type != arg_type) {
-                                       constant = Const.ChangeType (loc, constant, arg_type);
-                                       if (constant == null) {
-                                               result = null;
-                                               Error_AttributeArgumentNotValid (loc);
-                                               return false;
-                                       }
+                               constant = constant.ToType (arg_type, loc);
+                               if (constant == null) {
+                                       result = null;
+                                       return false;
                                }
-                               result = constant.GetValue ();
+                               result = constant.GetTypedValue ();
                                return true;
                        } else if (e is TypeOf) {
                                result = ((TypeOf) e).TypeArg;
@@ -270,6 +261,9 @@ namespace Mono.CSharp {
                        } else if (e is EmptyCast) {
                                Expression child = ((EmptyCast)e).Child;
                                return GetAttributeArgumentExpression (child, loc, child.Type, out result);
+                       } else if (e is As) {
+                               As as_e = (As) e;
+                               return GetAttributeArgumentExpression (as_e.Expr, loc, as_e.ProbeType.Type, out result);
                        }
 
                        result = null;
@@ -963,9 +957,18 @@ namespace Mono.CSharp {
                        return null;
                }
 
+               //
+               // Theoretically, we can get rid of this, since FieldBuilder.SetCustomAttribute()
+               // and ParameterBuilder.SetCustomAttribute() are supposed to handle this attribute.
+               // However, we can't, since it appears that the .NET 1.1 SRE hangs when given a MarshalAsAttribute.
+               //
                public UnmanagedMarshal GetMarshal (Attributable attr)
                {
-                       UnmanagedType UnmanagedType = (UnmanagedType)System.Enum.Parse (typeof (UnmanagedType), pos_values [0].ToString ());
+                       UnmanagedType UnmanagedType;
+                       if (!RootContext.StdLib || pos_values [0].GetType () != typeof (UnmanagedType))
+                               UnmanagedType = (UnmanagedType) System.Enum.ToObject (typeof (UnmanagedType), pos_values [0]);
+                       else
+                               UnmanagedType = (UnmanagedType) pos_values [0];
 
                        object value = GetFieldValue ("SizeParamIndex");
                        if (value != null && UnmanagedType != UnmanagedType.LPArray) {
@@ -974,12 +977,12 @@ namespace Mono.CSharp {
                        }
 
                        object o = GetFieldValue ("ArraySubType");
-                       UnmanagedType array_sub_type = o == null ? UnmanagedType.I4 : (UnmanagedType) o;
-                       
+                       UnmanagedType array_sub_type = o == null ? (UnmanagedType) 0x50 /* NATIVE_MAX */ : (UnmanagedType) o;
+
                        switch (UnmanagedType) {
                        case UnmanagedType.CustomMarshaler: {
                                MethodInfo define_custom = typeof (UnmanagedMarshal).GetMethod ("DefineCustom",
-                                                                       BindingFlags.Static | BindingFlags.Public);
+                                       BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                                if (define_custom == null) {
                                        Report.RuntimeMissingSupport (Location, "set marshal info");
                                        return null;
@@ -997,7 +1000,8 @@ namespace Mono.CSharp {
                                object size_param_index = GetFieldValue ("SizeParamIndex");
 
                                if ((size_const != null) || (size_param_index != null)) {
-                                       MethodInfo define_array = typeof (UnmanagedMarshal).GetMethod ("DefineLPArrayInternal", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
+                                       MethodInfo define_array = typeof (UnmanagedMarshal).GetMethod ("DefineLPArrayInternal",
+                                               BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                                        if (define_array == null) {
                                                Report.RuntimeMissingSupport (Location, "set marshal info");
                                                return null;
@@ -1014,7 +1018,7 @@ namespace Mono.CSharp {
                        }
                        case UnmanagedType.SafeArray:
                                return UnmanagedMarshal.DefineSafeArray (array_sub_type);
-                       
+
                        case UnmanagedType.ByValArray:
                                FieldMember fm = attr as FieldMember;
                                if (fm == null) {
@@ -1022,10 +1026,10 @@ namespace Mono.CSharp {
                                        return null;
                                }
                                return UnmanagedMarshal.DefineByValArray ((int) GetFieldValue ("SizeConst"));
-                       
+
                        case UnmanagedType.ByValTStr:
                                return UnmanagedMarshal.DefineByValTStr ((int) GetFieldValue ("SizeConst"));
-                       
+
                        default:
                                return UnmanagedMarshal.DefineUnmanagedMarshal (UnmanagedType);
                        }
@@ -1038,12 +1042,17 @@ namespace Mono.CSharp {
 
                public MethodImplOptions GetMethodImplOptions ()
                {
-                       return (MethodImplOptions)System.Enum.Parse (typeof (MethodImplOptions), pos_values [0].ToString ());
+                       if (pos_values [0].GetType () != typeof (MethodImplOptions))
+                               return (MethodImplOptions)System.Enum.ToObject (typeof (MethodImplOptions), pos_values [0]);
+                       return (MethodImplOptions)pos_values [0];
                }
 
                public LayoutKind GetLayoutKindValue ()
                {
-                       return (LayoutKind)System.Enum.Parse (typeof (LayoutKind), pos_values [0].ToString ());
+                       if (!RootContext.StdLib || pos_values [0].GetType () != typeof (LayoutKind))
+                               return (LayoutKind)System.Enum.ToObject (typeof (LayoutKind), pos_values [0]);
+
+                       return (LayoutKind)pos_values [0];
                }
 
                /// <summary>
@@ -1272,8 +1281,8 @@ namespace Mono.CSharp {
                public readonly NamespaceEntry ns;
 
                public GlobalAttribute (TypeContainer container, string target, 
-                                       Expression left_expr, string identifier, ArrayList args, Location loc):
-                       base (target, left_expr, identifier, args, loc)
+                                       Expression left_expr, string identifier, ArrayList args, Location loc, bool nameEscaped):
+                       base (target, left_expr, identifier, args, loc, nameEscaped)
                {
                        ns = container.NamespaceEntry;
                }
@@ -1687,9 +1696,14 @@ namespace Mono.CSharp {
                        if (mb.DeclaringType is TypeBuilder)
                                return null;
 
-                       PropertyInfo pi = PropertyExpr.AccessorTable [mb] as PropertyInfo;
-                       if (pi != null)
-                               return GetMemberObsoleteAttribute (pi);
+                       if (mb.IsSpecialName) {
+                               PropertyInfo pi = PropertyExpr.AccessorTable [mb] as PropertyInfo;
+                               if (pi != null) {
+                                       // FIXME: This is buggy as properties from this assembly are included as well
+                                       return null;
+                                       //return GetMemberObsoleteAttribute (pi);
+                               }
+                       }
 
                        return GetMemberObsoleteAttribute (mb);
                }
index c14eab475516664c1ec43215c8dfa5244a1d521e..0c69e1c5d3dfc80be89753efb9f04014b287e1c0 100644 (file)
@@ -450,13 +450,17 @@ namespace Mono.CSharp {
                                        if (right is EnumConstant){
                                                return null;
                                        }
-                                       if (((EnumConstant) left).Child.Type != right.Type)
+
+                                       right = right.ToType (((EnumConstant) left).Child.Type, loc);
+                                       if (right == null)
                                                return null;
 
                                        wrap_as = left.Type;
                                } else if (right is EnumConstant){
-                                       if (((EnumConstant) right).Child.Type != left.Type)
+                                       left = left.ToType (((EnumConstant) right).Child.Type, loc);
+                                       if (left == null)
                                                return null;
+
                                        wrap_as = right.Type;
                                }
 
@@ -564,18 +568,32 @@ namespace Mono.CSharp {
                                wrap_as = null;
                                if (left is EnumConstant){
                                        if (right is EnumConstant){
-                                               if (left.Type == right.Type)
-                                                       wrap_as = TypeManager.EnumToUnderlying (left.Type);
-                                               else
+                                               if (left.Type != right.Type) {
+                                                       Binary.Error_OperatorCannotBeApplied (loc, "-", left.Type, right.Type);
+                                                       return null;
+                                               }
+
+                                               wrap_as = TypeManager.EnumToUnderlying (left.Type);
+                                               right = ((EnumConstant) right).Child.ToType (wrap_as, loc);
+                                               if (right == null)
+                                                       return null;
+
+                                               left = ((EnumConstant) left).Child.ToType (wrap_as, loc);
+                                               if (left == null)
                                                        return null;
                                        }
-                                       if (((EnumConstant) left).Child.Type != right.Type)
-                                               return null;
+                                       else {
+                                               right = right.ToType (((EnumConstant) left).Child.Type, loc);
+                                               if (right == null)
+                                                       return null;
 
-                                       wrap_as = left.Type;
+                                               wrap_as = left.Type;
+                                       }
                                } else if (right is EnumConstant){
-                                       if (((EnumConstant) right).Child.Type != left.Type)
+                                       left = left.ToType (((EnumConstant) right).Child.Type, loc);
+                                       if (left == null)
                                                return null;
+
                                        wrap_as = right.Type;
                                }
 
index 537492ffa65d29798f6a6708d95c3cd9c39a4ce9..90fc9f2be7ae53380aa8a5371fa50942fc1b00da 100644 (file)
@@ -471,8 +471,8 @@ namespace Mono.CSharp {
                GenericTypeParameterBuilder[] gen_params;
 
                public TypeContainer (NamespaceEntry ns, TypeContainer parent, MemberName name,
-                                     Attributes attrs, Kind kind, Location l)
-                       : base (ns, parent, name, attrs, l)
+                                     Attributes attrs, Kind kind)
+                       : base (ns, parent, name, attrs)
                {
                        if (parent != null && parent != RootContext.Tree.Types && parent.NamespaceEntry != ns)
                                throw new InternalErrorException ("A nested type should be in the same NamespaceEntry as its enclosing class");
@@ -867,6 +867,16 @@ namespace Mono.CSharp {
                        }
                }
 
+               bool CanElideInitializer (Type field_type, Constant c)
+               {
+                       if (field_type == c.Type)
+                               return true;
+                       if (TypeManager.IsValueType (field_type) || TypeManager.HasElementType (field_type))
+                               return false;
+                       // Reference type with null initializer.
+                       return c.Type == TypeManager.null_type;
+               }
+
                //
                // Emits the instance field initializers
                //
@@ -902,10 +912,8 @@ namespace Mono.CSharp {
                                        return false;
 
                                Constant c = e as Constant;
-                               if (c != null) {
-                                       if (c.IsDefaultValue)
-                                               continue;
-                               }
+                               if (c != null && c.IsDefaultValue && CanElideInitializer (f.MemberType, c))
+                                       continue;
 
                                a.EmitStatement (ec);
                        }
@@ -975,7 +983,7 @@ namespace Mono.CSharp {
                                                      "not specify different base classes",
                                                      Name);
 
-                                       if (!Location.IsNull (base_loc))
+                                       if (!base_loc.IsNull)
                                                Report.LocationOfPreviousError (base_loc);
 
                                        return null;
@@ -2538,10 +2546,10 @@ namespace Mono.CSharp {
 
                        foreach (DictionaryEntry entry in defined_names) {
                                MemberCore mc = (MemberCore)entry.Value;
-                               if (!mc.IsClsComplianceRequired (this))
+                               if (!mc.IsClsComplianceRequired (mc.Parent))
                                        continue;
 
-                               string name = (string)entry.Key;
+                               string name = (string) entry.Key;
                                string basename = name.Substring (name.LastIndexOf ('.') + 1);
 
                                string lcase = basename.ToLower (System.Globalization.CultureInfo.InvariantCulture);
@@ -2558,9 +2566,9 @@ namespace Mono.CSharp {
                                        continue;                                       
 
                                if (found is MemberInfo) {
-                                       if (basename == ((MemberInfo)found).Name)
+                                       if (basename == ((MemberInfo) found).Name)
                                                continue;
-                                       Report.SymbolRelatedToPreviousError ((MemberInfo)found);
+                                       Report.SymbolRelatedToPreviousError ((MemberInfo) found);
                                } else {
                                        Report.SymbolRelatedToPreviousError ((MemberCore) found);
                                }
@@ -2674,33 +2682,34 @@ namespace Mono.CSharp {
                public readonly TypeAttributes DefaultTypeAttributes;
 
                static PartialContainer Create (NamespaceEntry ns, TypeContainer parent,
-                                               MemberName member_name, int mod_flags, Kind kind,
-                                               Location loc)
+                                               MemberName member_name, int mod_flags, Kind kind)
                {
+
+                       if (!CheckModFlags (0, mod_flags, member_name))
+                               return null;
+
                        PartialContainer pc = RootContext.Tree.GetDecl (member_name) as PartialContainer;
                        if (pc != null) {
                                if (pc.Kind != kind) {
                                        Report.Error (
-                                               261, loc, "Partial declarations of `{0}' " +
-                                               "must be all classes, all structs or " +
-                                               "all interfaces", member_name.GetTypeName ());
+                                               261, member_name.Location,
+                                               "Partial declarations of `{0}' must be all classes, " +
+                                               "all structs or all interfaces",
+                                               member_name.GetTypeName ());
                                        return null;
                                }
 
-                               if (pc.OriginalModFlags != mod_flags) {
-                                       Report.Error (
-                                               262, loc, "Partial declarations of `{0}' " +
-                                               "have conflicting accessibility modifiers",
-                                               member_name.GetTypeName ());
+                               if (!CheckModFlags (pc.OriginalModFlags, mod_flags, member_name))
                                        return null;
-                               }
+                               pc.ModFlags |= (mod_flags & pc.AllowedModifiers);
 
                                if (pc.IsGeneric) {
                                        if (pc.CountTypeParameters != member_name.CountTypeArguments) {
                                                Report.Error (
-                                                       264, loc, "Partial declarations of `{0}' " +
-                                                       "must have the same type parameter names in " +
-                                                       "the same order", member_name.GetTypeName ());
+                                                       264, member_name.Location,
+                                                       "Partial declarations of `{0}' must have the " +
+                                                       "same type parameter names in the same order",
+                                                       member_name.GetTypeName ());
                                                return null;
                                        }
 
@@ -2712,9 +2721,10 @@ namespace Mono.CSharp {
                                                        continue;
 
                                                Report.Error (
-                                                       264, loc, "Partial declarations of `{0}' " +
-                                                       "must have the same type parameter names in " +
-                                                       "the same order", member_name.GetTypeName ());
+                                                       264, member_name.Location,
+                                                       "Partial declarations of `{0}' must have the " +
+                                                       "same type parameter names in the same order",
+                                                       member_name.GetTypeName ());
                                                return null;
                                        }
                                }
@@ -2725,7 +2735,7 @@ namespace Mono.CSharp {
                        if (parent is ClassPart)
                                parent = ((ClassPart) parent).PartialContainer;
 
-                       pc = new PartialContainer (ns.NS, parent, member_name, mod_flags, kind, loc);
+                       pc = new PartialContainer (ns.NS, parent, member_name, mod_flags, kind);
 
                        if (kind == Kind.Interface) {
                                if (!parent.AddInterface (pc))
@@ -2742,25 +2752,55 @@ namespace Mono.CSharp {
                        return pc;
                }
 
+               static bool CheckModFlags (int flags_org, int flags, MemberName member_name)
+               {
+                       // Check (abstract|static|sealed) sanity.
+                       int tmp = (flags_org | flags) & (Modifiers.ABSTRACT | Modifiers.SEALED | Modifiers.STATIC);
+                       if ((tmp & Modifiers.ABSTRACT) != 0) {
+                               if ((tmp & (Modifiers.STATIC | Modifiers.SEALED)) != 0) {
+                                       Report.Error (
+                                               418, member_name.Location, 
+                                               "`{0}': an abstract class cannot be sealed or static", member_name.ToString ());
+                                       return false;
+                               }
+                       } else if (tmp == (Modifiers.SEALED | Modifiers.STATIC)) {
+                               Report.Error (441, member_name.Location, "`{0}': a class cannot be both static and sealed", member_name.ToString ());
+                               return false;
+                       }
+
+                       if (flags_org == 0)
+                               return true;
+
+                       // Check conflicts.
+                       if (0 != ((flags_org ^ flags) & (0xFFFFFFFF ^ (Modifiers.SEALED | Modifiers.ABSTRACT)))) {
+                               Report.Error (
+                                       262, member_name.Location, "Partial declarations of `{0}' " +
+                                       "have conflicting accessibility modifiers",
+                                       member_name.GetName ());
+                               return false;
+                       }
+                       return true;
+               }
+
                public static ClassPart CreatePart (NamespaceEntry ns, TypeContainer parent,
                                                    MemberName name, int mod, Attributes attrs,
                                                    Kind kind, Location loc)
                {
-                       PartialContainer pc = Create (ns, parent, name, mod, kind, loc);
+                       PartialContainer pc = Create (ns, parent, name, mod, kind);
                        if (pc == null) {
                                // An error occured; create a dummy container, but don't
                                // register it.
-                               pc = new PartialContainer (ns.NS, parent, name, mod, kind, loc);
+                               pc = new PartialContainer (ns.NS, parent, name, mod, kind);
                        }
 
-                       ClassPart part = new ClassPart (ns, pc, parent, mod, attrs, kind, loc);
+                       ClassPart part = new ClassPart (ns, pc, parent, mod, attrs, kind);
                        pc.AddPart (part);
                        return part;
                }
 
                protected PartialContainer (Namespace ns, TypeContainer parent,
-                                           MemberName name, int mod, Kind kind, Location l)
-                       : base (null, parent, name, null, kind, l)
+                                           MemberName name, int mod, Kind kind)
+                       : base (null, parent, name, null, kind)
                {
                        this.Namespace = ns;
 
@@ -2790,7 +2830,7 @@ namespace Mono.CSharp {
                        else
                                accmods = Modifiers.PRIVATE;
 
-                       this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
+                       this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, Location);
                        this.OriginalModFlags = mod;
                }
 
@@ -2818,8 +2858,8 @@ namespace Mono.CSharp {
                Constraints[] constraints;
 
                public ClassPart (NamespaceEntry ns, PartialContainer pc, TypeContainer parent,
-                                 int mod, Attributes attrs, Kind kind, Location l)
-                       : base (ns, parent, pc.MemberName, attrs, kind, l)
+                                 int mod, Attributes attrs, Kind kind)
+                       : base (ns, parent, pc.MemberName, attrs, kind)
                {
                        this.PartialContainer = pc;
                        this.IsPartial = true;
@@ -2830,7 +2870,7 @@ namespace Mono.CSharp {
                        else
                                accmods = Modifiers.PRIVATE;
 
-                       this.ModFlags = Modifiers.Check (pc.AllowedModifiers, mod, accmods, l);
+                       this.ModFlags = Modifiers.Check (pc.AllowedModifiers, mod, accmods, pc.MemberName.Location);
 
                        if (pc.IsGeneric)
                                constraints = new Constraints [pc.CountCurrentTypeParameters];
@@ -2928,9 +2968,8 @@ namespace Mono.CSharp {
                ListDictionary declarative_security;
 
                public ClassOrStruct (NamespaceEntry ns, TypeContainer parent,
-                                     MemberName name, Attributes attrs, Kind kind,
-                                     Location l)
-                       : base (ns, parent, name, attrs, kind, l)
+                                     MemberName name, Attributes attrs, Kind kind)
+                       : base (ns, parent, name, attrs, kind)
                {
                }
 
@@ -2990,11 +3029,11 @@ namespace Mono.CSharp {
        /// </summary>
        public sealed class StaticClass: Class {
                public StaticClass (NamespaceEntry ns, TypeContainer parent, MemberName name, int mod,
-                                   Attributes attrs, Location l)
-                       : base (ns, parent, name, mod, attrs, l)
+                                   Attributes attrs)
+                       : base (ns, parent, name, mod, attrs)
                {
                        if (RootContext.Version == LanguageVersion.ISO_1) {
-                               Report.FeatureIsNotStandardized (l, "static classes");
+                               Report.FeatureIsNotStandardized (Location, "static classes");
                        }
                }
 
@@ -3086,8 +3125,8 @@ namespace Mono.CSharp {
                        Modifiers.UNSAFE;
 
                public Class (NamespaceEntry ns, TypeContainer parent, MemberName name, int mod,
-                             Attributes attrs, Location l)
-                       : base (ns, parent, name, attrs, Kind.Class, l)
+                             Attributes attrs)
+                       : base (ns, parent, name, attrs, Kind.Class)
                {
                        this.ModFlags = mod;
                }
@@ -3187,8 +3226,8 @@ namespace Mono.CSharp {
                        Modifiers.PRIVATE;
 
                public Struct (NamespaceEntry ns, TypeContainer parent, MemberName name,
-                              int mod, Attributes attrs, Location l)
-                       : base (ns, parent, name, attrs, Kind.Struct, l)
+                              int mod, Attributes attrs)
+                       : base (ns, parent, name, attrs, Kind.Struct)
                {
                        int accmods;
                        
@@ -3197,7 +3236,7 @@ namespace Mono.CSharp {
                        else
                                accmods = Modifiers.PRIVATE;
                        
-                       this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
+                       this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, Location);
 
                        this.ModFlags |= Modifiers.SEALED;
                }
@@ -3235,9 +3274,9 @@ namespace Mono.CSharp {
                        Modifiers.UNSAFE    |
                        Modifiers.PRIVATE;
 
-               public Interface (NamespaceEntry ns, TypeContainer parent, MemberName name,
-                                 int mod, Attributes attrs, Location l)
-                       : base (ns, parent, name, attrs, Kind.Interface, l)
+               public Interface (NamespaceEntry ns, TypeContainer parent, MemberName name, int mod,
+                                 Attributes attrs)
+                       : base (ns, parent, name, attrs, Kind.Interface)
                {
                        int accmods;
 
@@ -3246,7 +3285,7 @@ namespace Mono.CSharp {
                        else
                                accmods = Modifiers.PRIVATE;
 
-                       this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
+                       this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, name.Location);
                }
 
                public override PendingImplementation GetPendingImplementations ()
@@ -3308,10 +3347,9 @@ namespace Mono.CSharp {
 
                public MethodCore (TypeContainer parent, GenericMethod generic,
                                   Expression type, int mod, int allowed_mod, bool is_iface,
-                                  MemberName name, Attributes attrs, Parameters parameters,
-                                  Location loc)
+                                  MemberName name, Attributes attrs, Parameters parameters)
                        : base (parent, generic != null ? generic : (DeclSpace) parent,
-                               type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs, loc)
+                               type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs)
                {
                        Parameters = parameters;
                        IsInterface = is_iface;
@@ -3890,7 +3928,7 @@ namespace Mono.CSharp {
                        this.builder = builder;
                        
                        CodeGen.SymbolWriter.OpenMethod (
-                               file, this, start.Row, 0, end.Row, 0);
+                               file, this, start.Row, start.Column, end.Row, start.Column);
                }
 
                public string Name {
@@ -3927,11 +3965,11 @@ namespace Mono.CSharp {
                                return null;
 
                        Location start_loc = block.StartLocation;
-                       if (Location.IsNull (start_loc))
+                       if (start_loc.IsNull)
                                return null;
 
                        Location end_loc = block.EndLocation;
-                       if (Location.IsNull (end_loc))
+                       if (end_loc.IsNull)
                                return null;
 
                        ISourceFile file = start_loc.SourceFile;
@@ -3975,11 +4013,10 @@ namespace Mono.CSharp {
                //
                public Method (TypeContainer parent, GenericMethod generic,
                               Expression return_type, int mod, bool is_iface,
-                              MemberName name, Parameters parameters, Attributes attrs,
-                              Location l)
+                              MemberName name, Parameters parameters, Attributes attrs)
                        : base (parent, generic, return_type, mod,
                                is_iface ? AllowedInterfaceModifiers : AllowedModifiers,
-                               is_iface, name, attrs, parameters, l)
+                               is_iface, name, attrs, parameters)
                {
                }
 
@@ -4550,9 +4587,9 @@ namespace Mono.CSharp {
                // my very own code has static constructors.
                //
                public Constructor (TypeContainer ds, string name, int mod, Parameters args,
-                                   ConstructorInitializer init, Location l)
+                                   ConstructorInitializer init, Location loc)
                        : base (ds, null, null, mod, AllowedModifiers, false,
-                               new MemberName (name), null, args, l)
+                               new MemberName (name, loc), null, args)
                {
                        Initializer = init;
                }
@@ -5255,10 +5292,11 @@ namespace Mono.CSharp {
        // TODO: Should derive from MethodCore
        public class Destructor : Method {
 
-               public Destructor (TypeContainer ds, Expression return_type, int mod, string name,
-                                  Parameters parameters, Attributes attrs, Location l)
-                       : base (ds, null, return_type, mod, false, new MemberName (name),
-                               parameters, attrs, l)
+               public Destructor (TypeContainer ds, Expression return_type, int mod,
+                                  string name, Parameters parameters, Attributes attrs,
+                                  Location l)
+                       : base (ds, null, return_type, mod, false, new MemberName (name, l),
+                               parameters, attrs)
                { }
 
                public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
@@ -5294,7 +5332,7 @@ namespace Mono.CSharp {
                public string ShortName {
                        get { return MemberName.Name; }
                        set {
-                               SetMemberName (new MemberName (MemberName.Left, value));
+                               SetMemberName (new MemberName (MemberName.Left, value, Location));
                        }
                }
 
@@ -5337,13 +5375,13 @@ namespace Mono.CSharp {
                //
                protected MemberBase (TypeContainer parent, DeclSpace ds, Expression type, int mod,
                                      int allowed_mod, int def_mod, MemberName name,
-                                     Attributes attrs, Location loc)
-                       : base (parent, name, attrs, loc)
+                                     Attributes attrs)
+                       : base (parent, name, attrs)
                {
                        this.ds = ds;
                        explicit_mod_flags = mod;
                        Type = type;
-                       ModFlags = Modifiers.Check (allowed_mod, mod, def_mod, loc);
+                       ModFlags = Modifiers.Check (allowed_mod, mod, def_mod, Location);
                        IsExplicitImpl = (MemberName.Left != null);
                }
 
@@ -5435,7 +5473,7 @@ namespace Mono.CSharp {
                        }
 
                        if (IsExplicitImpl) {
-                               Expression expr = MemberName.Left.GetTypeExpression (Location);
+                               Expression expr = MemberName.Left.GetTypeExpression ();
                                TypeExpr iface_texpr = expr.ResolveAsTypeTerminal (ec);
                                if (iface_texpr == null)
                                        return false;
@@ -5511,7 +5549,7 @@ namespace Mono.CSharp {
                                return false;
 
                        if (IsExplicitImpl) {
-                               Expression expr = MemberName.Left.GetTypeExpression (Location);
+                               Expression expr = MemberName.Left.GetTypeExpression ();
                                TypeExpr texpr = expr.ResolveAsTypeTerminal (ec);
                                if (texpr == null)
                                        return false;
@@ -5584,9 +5622,9 @@ namespace Mono.CSharp {
                //
                protected FieldBase (TypeContainer parent, Expression type, int mod,
                                     int allowed_mod, MemberName name, object init,
-                                    Attributes attrs, Location loc)
+                                    Attributes attrs)
                        : base (parent, parent, type, mod, allowed_mod, Modifiers.PRIVATE,
-                               name, attrs, loc)
+                               name, attrs)
                {
                        this.init = init;
                }
@@ -5729,11 +5767,11 @@ namespace Mono.CSharp {
        public abstract class FieldMember: FieldBase
        {
                protected FieldMember (TypeContainer parent, Expression type, int mod,
-                       int allowed_mod, MemberName name, object init, Attributes attrs, Location loc)
-                       : base (parent, type, mod, allowed_mod | Modifiers.ABSTRACT, name, init, attrs, loc)
+                       int allowed_mod, MemberName name, object init, Attributes attrs)
+                       : base (parent, type, mod, allowed_mod | Modifiers.ABSTRACT, name, init, attrs)
                {
                        if ((mod & Modifiers.ABSTRACT) != 0)
-                               Report.Error (681, loc, "The modifier 'abstract' is not valid on fields. Try using a property instead");
+                               Report.Error (681, Location, "The modifier 'abstract' is not valid on fields. Try using a property instead");
                }
 
                public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
@@ -5874,7 +5912,7 @@ namespace Mono.CSharp {
 
                public FixedField (TypeContainer parent, Expression type, int mod, string name,
                        Expression size_expr, Attributes attrs, Location loc):
-                       base (parent, type, mod, AllowedModifiers, new MemberName (name), null, attrs, loc)
+                       base (parent, type, mod, AllowedModifiers, new MemberName (name, loc), null, attrs)
                {
                        if (RootContext.Version == LanguageVersion.ISO_1)
                                Report.FeatureIsNotStandardized (loc, "fixed size buffers");
@@ -5899,16 +5937,10 @@ namespace Mono.CSharp {
                                return false;
                        }
 
-                       Expression e = size_expr.Resolve (Parent.EmitContext);
-                       if (e == null)
+                       Constant c = size_expr.ResolveAsConstant (Parent.EmitContext, this);
+                       if (c == null)
                                return false;
 
-                       Constant c = e as Constant;
-                       if (c == null) {
-                               Const.Error_ExpressionMustBeConstant (e.Location, GetSignatureForError ());
-                               return false;
-                       }
-
                        IntConstant buffer_size_const = c.ToInt (Location);
                        if (buffer_size_const == null)
                                return false;
@@ -6004,8 +6036,8 @@ namespace Mono.CSharp {
 
                public Field (TypeContainer parent, Expression type, int mod, string name,
                              Object expr_or_array_init, Attributes attrs, Location loc)
-                       : base (parent, type, mod, AllowedModifiers, new MemberName (name),
-                               expr_or_array_init, attrs, loc)
+                       : base (parent, type, mod, AllowedModifiers, new MemberName (name, loc),
+                               expr_or_array_init, attrs)
                {
                }
 
@@ -6145,7 +6177,7 @@ namespace Mono.CSharp {
                ReturnParameter return_attributes;
 
                public AbstractPropertyEventMethod (MemberBase member, string prefix)
-                       : base (null, SetupName (prefix, member), null, member.Location)
+                       : base (member.Parent, SetupName (prefix, member, member.Location), null)
                {
                        this.prefix = prefix;
                        IsDummy = true;
@@ -6153,21 +6185,21 @@ namespace Mono.CSharp {
 
                public AbstractPropertyEventMethod (MemberBase member, Accessor accessor,
                                                    string prefix)
-                       : base (null, SetupName (prefix, member),
-                               accessor.Attributes, accessor.Location)
+                       : base (member.Parent, SetupName (prefix, member, accessor.Location),
+                               accessor.Attributes)
                {
                        this.prefix = prefix;
                        this.block = accessor.Block;
                }
 
-               static MemberName SetupName (string prefix, MemberBase member)
+               static MemberName SetupName (string prefix, MemberBase member, Location loc)
                {
-                       return new MemberName (member.MemberName.Left, prefix + member.ShortName);
+                       return new MemberName (member.MemberName.Left, prefix + member.ShortName, loc);
                }
 
                public void UpdateName (MemberBase member)
                {
-                       SetMemberName (SetupName (prefix, member));
+                       SetMemberName (SetupName (prefix, member, Location));
                }
 
                #region IMethodData Members
@@ -6458,14 +6490,12 @@ namespace Mono.CSharp {
                                : base (method, prefix)
                        {
                                this.method = method;
-                               Parent = method.Parent;
                        }
 
                        public PropertyMethod (MethodCore method, Accessor accessor, string prefix)
                                : base (method, accessor, prefix)
                        {
                                this.method = method;
-                               Parent = method.Parent;
                                this.ModFlags = accessor.ModFlags;
                                yields = accessor.Yields;
 
@@ -6603,10 +6633,9 @@ namespace Mono.CSharp {
 
                public PropertyBase (TypeContainer parent, Expression type, int mod_flags,
                                     int allowed_mod, bool is_iface, MemberName name,
-                                    Parameters parameters, Attributes attrs,
-                                    Location loc)
+                                    Parameters parameters, Attributes attrs)
                        : base (parent, null, type, mod_flags, allowed_mod, is_iface, name,
-                               attrs, parameters, loc)
+                               attrs, parameters)
                {
                }
 
@@ -6829,13 +6858,12 @@ namespace Mono.CSharp {
                const int AllowedInterfaceModifiers =
                        Modifiers.NEW;
 
-               public Property (TypeContainer parent, Expression type, int mod_flags,
-                                bool is_iface, MemberName name, Attributes attrs,
-                                Accessor get_block, Accessor set_block, Location loc)
-                       : base (parent, type, mod_flags,
+               public Property (TypeContainer ds, Expression type, int mod, bool is_iface,
+                                MemberName name, Attributes attrs, Accessor get_block,
+                                Accessor set_block)
+                       : base (ds, type, mod,
                                is_iface ? AllowedInterfaceModifiers : AllowedModifiers,
-                               is_iface, name, Parameters.EmptyReadOnlyParameters, attrs,
-                               loc)
+                               is_iface, name, Parameters.EmptyReadOnlyParameters, attrs)
                {
                        if (get_block == null)
                                Get = new GetMethod (this);
@@ -6882,16 +6910,15 @@ namespace Mono.CSharp {
                                prop_attr |= PropertyAttributes.RTSpecialName |
                        PropertyAttributes.SpecialName;
 
-                               PropertyBuilder = Parent.TypeBuilder.DefineProperty (
-                                       Name, prop_attr, MemberType, null);
-                               
-                               if (!Get.IsDummy)
-                                       PropertyBuilder.SetGetMethod (GetBuilder);
-                               
-                               if (!Set.IsDummy)
-                                       PropertyBuilder.SetSetMethod (SetBuilder);
+                       PropertyBuilder = Parent.TypeBuilder.DefineProperty (
+                               Name, prop_attr, MemberType, null);
+
+                       if (!Get.IsDummy)
+                               PropertyBuilder.SetGetMethod (GetBuilder);
+
+                       if (!Set.IsDummy)
+                               PropertyBuilder.SetSetMethod (SetBuilder);
 
-                               TypeManager.RegisterProperty (PropertyBuilder, GetBuilder, SetBuilder);
                        return true;
                }
        }
@@ -7051,9 +7078,8 @@ namespace Mono.CSharp {
 
                public EventProperty (TypeContainer parent, Expression type, int mod_flags,
                                      bool is_iface, MemberName name, Object init,
-                                     Attributes attrs, Accessor add, Accessor remove,
-                                     Location loc)
-                       : base (parent, type, mod_flags, is_iface, name, init, attrs, loc)
+                                     Attributes attrs, Accessor add, Accessor remove)
+                       : base (parent, type, mod_flags, is_iface, name, init, attrs)
                {
                        Add = new AddDelegateMethod (this, add);
                        Remove = new RemoveDelegateMethod (this, remove);
@@ -7080,8 +7106,8 @@ namespace Mono.CSharp {
 
                public EventField (TypeContainer parent, Expression type, int mod_flags,
                                   bool is_iface, MemberName name, Object init,
-                                  Attributes attrs, Location loc)
-                       : base (parent, type, mod_flags, is_iface, name, init, attrs, loc)
+                                  Attributes attrs)
+                       : base (parent, type, mod_flags, is_iface, name, init, attrs)
                {
                        Add = new AddDelegateMethod (this);
                        Remove = new RemoveDelegateMethod (this);
@@ -7298,11 +7324,10 @@ namespace Mono.CSharp {
                public MethodBuilder AddBuilder, RemoveBuilder;
 
                public Event (TypeContainer parent, Expression type, int mod_flags,
-                             bool is_iface, MemberName name, Object init, Attributes attrs,
-                             Location loc)
+                             bool is_iface, MemberName name, Object init, Attributes attrs)
                        : base (parent, type, mod_flags,
                                is_iface ? AllowedInterfaceModifiers : AllowedModifiers,
-                               name, init, attrs, loc)
+                               name, init, attrs)
                {
                        IsInterface = is_iface;
                }
@@ -7541,10 +7566,10 @@ namespace Mono.CSharp {
                //
                public Indexer (TypeContainer parent, Expression type, MemberName name, int mod,
                                bool is_iface, Parameters parameters, Attributes attrs,
-                               Accessor get_block, Accessor set_block, Location loc)
+                               Accessor get_block, Accessor set_block)
                        : base (parent, type, mod,
                                is_iface ? AllowedInterfaceModifiers : AllowedModifiers,
-                               is_iface, name, parameters, attrs, loc)
+                               is_iface, name, parameters, attrs)
                {
                        if (get_block == null)
                                Get = new GetIndexerMethod (this);
@@ -7768,7 +7793,7 @@ namespace Mono.CSharp {
                                 int mod_flags, Parameters parameters,
                                 ToplevelBlock block, Attributes attrs, Location loc)
                        : base (parent, null, ret_type, mod_flags, AllowedModifiers, false,
-                               new MemberName ("op_" + type), attrs, parameters, loc)
+                               new MemberName ("op_" + type, loc), attrs, parameters)
                {
                        OperatorType = type;
                        Block = block;
@@ -7835,7 +7860,7 @@ namespace Mono.CSharp {
 
                        OperatorMethod = new Method (
                                Parent, null, Type, ModFlags, false, MemberName,
-                               Parameters, OptAttributes, Location);
+                               Parameters, OptAttributes);
 
                        OperatorMethod.Block = Block;
                        OperatorMethod.IsOperator = this;                       
index 3e14794eb3795a086c11b5d873e58c5c5e55ae62..e1f599076cf1207e91febaa5fafb834c6af876fd 100644 (file)
@@ -259,6 +259,11 @@ namespace Mono.CSharp {
                /// </summary>
                public bool DoFlowAnalysis;
 
+               /// <summary>
+               ///   Whether we're control flow analysis disabled on struct
+               /// </summary>
+               public bool OmitStructFlowAnalysis;
+
                /// <summary>
                ///   Keeps track of the Type to LocalBuilder temporary storage created
                ///   to store structures (used to compute the address of the structure
@@ -517,7 +522,7 @@ namespace Mono.CSharp {
 
                public void CaptureThis ()
                {
-                       capture_context.CaptureThis ();
+                       capture_context.CaptureThis (CurrentAnonymousMethod);
                }
                
                
@@ -622,7 +627,7 @@ namespace Mono.CSharp {
 
                        capture_context = block.CaptureContext;
 
-                       if (!Location.IsNull (loc))
+                       if (!loc.IsNull)
                                CurrentFile = loc.File;
 
 #if PRODUCTION
@@ -736,13 +741,13 @@ namespace Mono.CSharp {
                /// </summary>
                public void Mark (Location loc, bool check_file)
                {
-                       if ((CodeGen.SymbolWriter == null) || Location.IsNull (loc))
+                       if ((CodeGen.SymbolWriter == null) || loc.IsNull)
                                return;
 
                        if (check_file && (CurrentFile != loc.File))
                                return;
 
-                       CodeGen.SymbolWriter.MarkSequencePoint (ig, loc.Row, 0);
+                       CodeGen.SymbolWriter.MarkSequencePoint (ig, loc.Row, loc.Column);
                }
 
                public void DefineLocalVariable (string name, LocalBuilder builder)
index 7f4e5fe60666c54791fe7ee312287701d0aee235..39fe478eb9224584d4f4133c40446b99cf49df78 100644 (file)
@@ -9,15 +9,6 @@
 //
 //
 
-//
-// This is needed because the following situation arises:
-//
-//     The FieldBuilder is declared with the real type for an enumeration
-//
-//     When we attempt to set the value for the constant, the FieldBuilder.SetConstant
-//     function aborts because it requires its argument to be of the same type
-//
-
 namespace Mono.CSharp {
 
        using System;
@@ -25,14 +16,17 @@ namespace Mono.CSharp {
        using System.Reflection.Emit;
        using System.Collections;
 
-       public class Const : FieldMember {
-               public Expression Expr;
-               EmitContext const_ec;
-
-               bool resolved = false;
-               object ConstantValue = null;
+       public interface IConstant
+       {
+               void CheckObsoleteness (Location loc);
+               bool ResolveValue ();
+               Constant Value { get; }
+       }
 
-               bool in_transit = false;
+       public class Const : FieldMember, IConstant {
+               Expression Expr;
+               Constant value;
+               bool in_transit;
 
                public const int AllowedModifiers =
                        Modifiers.NEW |
@@ -44,24 +38,12 @@ namespace Mono.CSharp {
                public Const (TypeContainer parent, Expression constant_type, string name,
                              Expression expr, int mod_flags, Attributes attrs, Location loc)
                        : base (parent, constant_type, mod_flags, AllowedModifiers,
-                               new MemberName (name), expr, attrs, loc)
+                               new MemberName (name, loc), expr, attrs)
                {
                        Expr = expr;
                        ModFlags |= Modifiers.STATIC;
                }
 
-#if DEBUG
-               void dump_tree (Type t)
-               {
-                       Console.WriteLine ("Dumping hierarchy");
-                       while (t != null){
-                               Console.WriteLine ("   " + t.FullName + " " +
-                                       (t.GetType ().IsEnum ? "yes" : "no"));
-                               t = t.BaseType;
-                       }
-               }
-#endif
-
                protected override bool CheckBase ()
                {
                        // Constant.Define can be called when the parent type hasn't yet been populated
@@ -84,18 +66,9 @@ namespace Mono.CSharp {
                        if (!base.Define ())
                                return false;
 
-                       const_ec = new EmitContext (Parent, Location, null, MemberType, ModFlags);
-
                        Type ttype = MemberType;
                        while (ttype.IsArray)
                            ttype = TypeManager.GetElementType (ttype);
-                       
-                       if (!TypeManager.IsBuiltinType(ttype) && (!ttype.IsSubclassOf(TypeManager.enum_type)) && !(Expr is NullLiteral)){
-                               Report.Error (
-                                       -3, Location,
-                                       "Constant type is not valid (only system types are allowed)");
-                               return false;
-                       }
 
                        FieldAttributes field_attr = FieldAttributes.Static | Modifiers.FieldAttr (ModFlags);
                        // Decimals cannot be emitted into the constant blob.  So, convert to 'readonly'.
@@ -113,210 +86,122 @@ namespace Mono.CSharp {
 
                        return true;
                }
-
-               //
-               // Changes the type of the constant expression `expr' to the Type `type'
-               // Returns null on failure.
-               //
-               public static Constant ChangeType (Location loc, Constant expr, Type type)
+               
+               /// <summary>
+               ///  Emits the field value by evaluating the expression
+               /// </summary>
+               public override void Emit ()
                {
-                       if (type == TypeManager.object_type)
-                               return expr;
-
-                       bool fail;
-
-                       // from the null type to any reference-type.
-                       if (expr.Type == TypeManager.null_type && !type.IsValueType && !TypeManager.IsEnumType (type))
-                               return NullLiteral.Null;
+                       if (!ResolveValue ())
+                               return;
 
-                       if (!Convert.ImplicitStandardConversionExists (Convert.ConstantEC, expr, type)){
-                               Convert.Error_CannotImplicitConversion (loc, expr.Type, type);
-                               return null;
-                       }
-
-                       // Special-case: The 0 literal can be converted to an enum value,
-                       // and ImplicitStandardConversionExists will return true in that case.
-                       if (expr.Type == TypeManager.int32_type && TypeManager.IsEnumType (type)){
-                               if (expr is IntLiteral && ((IntLiteral) expr).Value == 0)
-                                       return new EnumConstant (expr, type);
+                       if (value.Type == TypeManager.decimal_type) {
+                               Decimal d = ((DecimalConstant)value).Value;
+                               int[] bits = Decimal.GetBits (d);
+                               object[] args = new object[] { (byte)(bits [3] >> 16), (byte)(bits [3] >> 31), (uint)bits [2], (uint)bits [1], (uint)bits [0] };
+                               CustomAttributeBuilder cab = new CustomAttributeBuilder (TypeManager.decimal_constant_attribute_ctor, args);
+                               FieldBuilder.SetCustomAttribute (cab);
                        }
-                       
-                       object constant_value = TypeManager.ChangeType (expr.GetValue (), type, out fail);
-                       if (fail){
-                               Convert.Error_CannotImplicitConversion (loc, expr.Type, type);
-                               
-                               //
-                               // We should always catch the error before this is ever
-                               // reached, by calling Convert.ImplicitStandardConversionExists
-                               //
-                               throw new Exception (
-                                                    String.Format ("LookupConstantValue: This should never be reached {0} {1}", expr.Type, type));
+                       else{
+                               FieldBuilder.SetConstant (value.GetTypedValue ());
                        }
 
-                       Constant retval;
-                       if (type == TypeManager.int32_type)
-                               retval = new IntConstant ((int) constant_value);
-                       else if (type == TypeManager.uint32_type)
-                               retval = new UIntConstant ((uint) constant_value);
-                       else if (type == TypeManager.int64_type)
-                               retval = new LongConstant ((long) constant_value);
-                       else if (type == TypeManager.uint64_type)
-                               retval = new ULongConstant ((ulong) constant_value);
-                       else if (type == TypeManager.float_type)
-                               retval = new FloatConstant ((float) constant_value);
-                       else if (type == TypeManager.double_type)
-                               retval = new DoubleConstant ((double) constant_value);
-                       else if (type == TypeManager.string_type)
-                               retval = new StringConstant ((string) constant_value);
-                       else if (type == TypeManager.short_type)
-                               retval = new ShortConstant ((short) constant_value);
-                       else if (type == TypeManager.ushort_type)
-                               retval = new UShortConstant ((ushort) constant_value);
-                       else if (type == TypeManager.sbyte_type)
-                               retval = new SByteConstant ((sbyte) constant_value);
-                       else if (type == TypeManager.byte_type)
-                               retval = new ByteConstant ((byte) constant_value);
-                       else if (type == TypeManager.char_type)
-                               retval = new CharConstant ((char) constant_value);
-                       else if (type == TypeManager.bool_type)
-                               retval = new BoolConstant ((bool) constant_value);
-                       else if (type == TypeManager.decimal_type)
-                               retval = new DecimalConstant ((decimal) constant_value);
-                       else
-                               throw new Exception ("LookupConstantValue: Unhandled constant type: " + type);
-                       
-                       return retval;
+                       base.Emit ();
                }
-               
-               /// <summary>
-               ///  Looks up the value of a constant field. Defines it if it hasn't
-               ///  already been. Similar to LookupEnumValue in spirit.
-               /// </summary>
-               public bool LookupConstantValue (out object value)
+
+               public static void Error_ExpressionMustBeConstant (Location loc, string e_name)
+               {
+                       Report.Error (133, loc, "The expression being assigned to `{0}' must be constant", e_name);
+               }
+
+               public static void Error_CyclicDeclaration (MemberCore mc)
                {
-                       if (resolved) {
-                               value = ConstantValue;
+                       Report.Error (110, mc.Location, "The evaluation of the constant value for `{0}' involves a circular definition",
+                               mc.GetSignatureForError ());
+               }
+
+               #region IConstant Members
+
+               public bool ResolveValue ()
+               {
+                       if (value != null)
                                return true;
-                       }
 
+                       SetMemberIsUsed ();
                        if (in_transit) {
-                               Report.Error (110, Location,
-                                             "The evaluation of the constant value for `" +
-                                             Name + "' involves a circular definition.");
-                               value = null;
+                               Error_CyclicDeclaration (this);
+                               // Suppress cyclic errors
+                               value = New.Constantify (MemberType);
                                return false;
                        }
 
                        in_transit = true;
-                       int errors = Report.Errors;
-
-                       //
-                       // We might have cleared Expr ourselves in a recursive definition
-                       //
-                       if (Expr == null){
-                               value = null;
+                       EmitContext ec = new EmitContext (Parent, Location, null, MemberType, ModFlags);
+                       value = Expr.ResolveAsConstant (ec, this);
+                       if (value == null)
                                return false;
-                       }
 
-                       Expr = Expr.Resolve (const_ec);
+                       value = value.ToType (MemberType, Location);
+                       if (value == null)
+                               return false;
 
                        in_transit = false;
+                       return true;
+               }
 
-                       if (Expr == null) {
-                               Error_ExpressionMustBeConstant (Location, GetSignatureForError ());
-                               value = null;
-                               return false;
+               public Constant Value {
+                       get {
+                               return value;
                        }
+               }
 
-                       Expression real_expr = Expr;
-
-                       Constant ce = Expr as Constant;
-                       if (ce == null){
-                               UnCheckedExpr un_expr = Expr as UnCheckedExpr;
-                               CheckedExpr ch_expr = Expr as CheckedExpr;
-                               EmptyCast ec_expr = Expr as EmptyCast;
-
-                               if ((un_expr != null) && (un_expr.Expr is Constant))
-                                       Expr = un_expr.Expr;
-                               else if ((ch_expr != null) && (ch_expr.Expr is Constant))
-                                       Expr = ch_expr.Expr;
-                               else if ((ec_expr != null) && (ec_expr.Child is Constant))
-                                       Expr = ec_expr.Child;
-                               else if (Expr is ArrayCreation){
-                                       Report.Error (133, Location, "Arrays can not be constant");
-                               } else {
-                                       if (errors == Report.Errors)
-                                               Report.Error (150, Location, "A constant value is expected");
-                                       value = null;
-                                       return false;
-                               }
-
-                               ce = Expr as Constant;
-                       }
+               #endregion
+       }
 
-                       if (MemberType != real_expr.Type) {
-                               ce = ChangeType (Location, ce, MemberType);
-                               if (ce == null){
-                                       value = null;
-                                       return false;
-                               }
-                               Expr = ce;
-                       }
+       public class ExternalConstant: IConstant
+       {
+               FieldInfo fi;
+               Constant value;
 
-                       if (ce != null)
-                               ConstantValue = ce.GetValue ();
-
-                       if (MemberType.IsEnum){
-                               //
-                               // This sadly does not work for our user-defined enumerations types ;-(
-                               //
-                               try {
-                                       ConstantValue = System.Enum.ToObject (
-                                               MemberType, ConstantValue);
-                               } catch (ArgumentException){
-                                       Report.Error (
-                                               -16, Location,
-                                               ".NET SDK 1.0 does not permit to create the constant "+
-                                               " field from a user-defined enumeration");
-                               }
-                       }
+               public ExternalConstant (FieldInfo fi)
+               {
+                       this.fi = fi;
+               }
 
-                       if (ce is DecimalConstant) {
-                               Decimal d = ((DecimalConstant)ce).Value;
-                               int[] bits = Decimal.GetBits (d);
-                               object[] args = new object[] { (byte)(bits [3] >> 16), (byte)(bits [3] >> 31), (uint)bits [2], (uint)bits [1], (uint)bits [0] };
-                               CustomAttributeBuilder cab = new CustomAttributeBuilder (TypeManager.decimal_constant_attribute_ctor, args);
-                               FieldBuilder.SetCustomAttribute (cab);
-                       }
-                       else{
-                               FieldBuilder.SetConstant (ConstantValue);
-                       }
+               #region IConstant Members
 
-                       if (!TypeManager.RegisterFieldValue (FieldBuilder, ConstantValue))
-                               throw new Exception ("Cannot register const value");
+               public void CheckObsoleteness (Location loc)
+               {
+                       ObsoleteAttribute oa = AttributeTester.GetMemberObsoleteAttribute (fi);
+                       if (oa == null) {
+                               return;
+                       }
 
-                       value = ConstantValue;
-                       resolved = true;
-                       return true;
+                       AttributeTester.Report_ObsoleteMessage (oa, TypeManager.GetFullNameSignature (fi), loc);
                }
-               
-               
-               /// <summary>
-               ///  Emits the field value by evaluating the expression
-               /// </summary>
-               public override void Emit ()
+
+               public bool ResolveValue ()
                {
-                       object value;
-                       LookupConstantValue (out value);
-                       base.Emit ();
+                       if (value != null)
+                               return true;
+
+                       if (fi.DeclaringType.IsEnum) {
+                               value = Expression.Constantify (fi.GetValue (fi), TypeManager.EnumToUnderlying (fi.FieldType));
+                               value = new EnumConstant (value, fi.DeclaringType);
+                               return true;
+                       }
+
+                       value = Expression.Constantify (fi.GetValue (fi), fi.FieldType);
+                       return true;
                }
 
-               public static void Error_ExpressionMustBeConstant (Location loc, string e_name)
-               {
-                       Report.Error (133, loc, "The expression being assigned to `{0}' must be constant", e_name);
+               public Constant Value {
+                       get {
+                               return value;
+                       }
                }
 
+               #endregion
        }
-}
-
 
+}
index cd79171903f379a61e077f8caf4ffcab5afba74a..5992158f3e6892d397bbdf8b887ab4f9444e8d86 100644 (file)
@@ -38,6 +38,11 @@ namespace Mono.CSharp {
                /// </summary>
                public abstract object GetValue ();
 
+               public virtual object GetTypedValue ()
+               {
+                       return GetValue ();
+               }
+
                /// <summary>
                ///   Constants are always born in a fully resolved state
                /// </summary>
@@ -46,10 +51,14 @@ namespace Mono.CSharp {
                        return this;
                }
 
-               public virtual void Error_ConstantValueCannotBeConverted (Location loc, Type t)
+               public override void Error_ValueCannotBeConverted (Location loc, Type t)
                {
-                       Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
-                               AsString (), TypeManager.CSharpName (t));
+                       // string is not real constant
+                       if (type == TypeManager.string_type)
+                               base.Error_ValueCannotBeConverted (loc, t);
+                       else
+                               Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
+                                       AsString (), TypeManager.CSharpName (t));
                }
 
 
@@ -134,6 +143,73 @@ namespace Mono.CSharp {
                        return c;
                }
 
+               public virtual Constant ToType (Type type, Location loc)
+               {
+                       if (Type == type)
+                               return this;
+
+                       if (type == TypeManager.object_type)
+                               return this;
+
+                       if (!Convert.ImplicitStandardConversionExists (Convert.ConstantEC, this, type)){
+                               Error_ValueCannotBeConverted (loc, type);
+                               return null;
+                       }
+
+                       // Special-case: The 0 literal can be converted to an enum value,
+                       // and ImplicitStandardConversionExists will return true in that case.
+                       if (IsZeroInteger && Type == TypeManager.int32_type && TypeManager.IsEnumType (type)) {
+                               return new EnumConstant (this, type);
+                       }
+
+                       bool fail;                      
+                       object constant_value = TypeManager.ChangeType (GetValue (), type, out fail);
+                       if (fail){
+                               Convert.Error_CannotImplicitConversion (loc, Type, type);
+                               
+                               //
+                               // We should always catch the error before this is ever
+                               // reached, by calling Convert.ImplicitStandardConversionExists
+                               //
+                               throw new Exception (
+                                       String.Format ("LookupConstantValue: This should never be reached {0} {1}", Type, type));
+                       }
+
+                       Constant retval;
+                       if (type == TypeManager.int32_type)
+                               retval = new IntConstant ((int) constant_value);
+                       else if (type == TypeManager.uint32_type)
+                               retval = new UIntConstant ((uint) constant_value);
+                       else if (type == TypeManager.int64_type)
+                               retval = new LongConstant ((long) constant_value);
+                       else if (type == TypeManager.uint64_type)
+                               retval = new ULongConstant ((ulong) constant_value);
+                       else if (type == TypeManager.float_type)
+                               retval = new FloatConstant ((float) constant_value);
+                       else if (type == TypeManager.double_type)
+                               retval = new DoubleConstant ((double) constant_value);
+                       else if (type == TypeManager.string_type)
+                               retval = new StringConstant ((string) constant_value);
+                       else if (type == TypeManager.short_type)
+                               retval = new ShortConstant ((short) constant_value);
+                       else if (type == TypeManager.ushort_type)
+                               retval = new UShortConstant ((ushort) constant_value);
+                       else if (type == TypeManager.sbyte_type)
+                               retval = new SByteConstant ((sbyte) constant_value);
+                       else if (type == TypeManager.byte_type)
+                               retval = new ByteConstant ((byte) constant_value);
+                       else if (type == TypeManager.char_type)
+                               retval = new CharConstant ((char) constant_value);
+                       else if (type == TypeManager.bool_type)
+                               retval = new BoolConstant ((bool) constant_value);
+                       else if (type == TypeManager.decimal_type)
+                               retval = new DecimalConstant ((decimal) constant_value);
+                       else
+                               throw new Exception ("LookupConstantValue: Unhandled constant type: " + type);
+                       
+                       return retval;
+               }
+
                public virtual DecimalConstant ConvertToDecimal ()
                {
                        return null;
@@ -168,6 +244,8 @@ namespace Mono.CSharp {
                {
                        return null;
                }
+
+               public abstract Constant Increment ();
                
                public abstract bool IsDefaultValue {
                        get;
@@ -215,7 +293,12 @@ namespace Mono.CSharp {
                        else
                                ec.ig.Emit (OpCodes.Ldc_I4_0);
                }
-               
+
+               public override Constant Increment ()
+               {
+                       throw new NotSupportedException ();
+               }
+       
                public override bool IsDefaultValue {
                        get {
                                return !Value;
@@ -288,6 +371,11 @@ namespace Mono.CSharp {
                        return new IntConstant (Value);
                }
                
+               public override Constant Increment ()
+               {
+                       return new ByteConstant (checked ((byte)(Value + 1)));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -388,6 +476,11 @@ namespace Mono.CSharp {
                {
                        return new IntConstant (Value);
                }
+
+               public override Constant Increment ()
+               {
+                       return new CharConstant (checked ((char)(Value + 1)));
+               }
                
                public override bool IsDefaultValue {
                        get {
@@ -464,6 +557,11 @@ namespace Mono.CSharp {
                        return new IntConstant (Value);
                }
                
+               public override Constant Increment ()
+               {
+                   return new SByteConstant (checked((sbyte)(Value + 1)));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -536,6 +634,11 @@ namespace Mono.CSharp {
                        return new IntConstant (Value);
                }
 
+               public override Constant Increment ()
+               {
+                       return new ShortConstant (checked((short)(Value + 1)));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -608,6 +711,11 @@ namespace Mono.CSharp {
                        return new IntConstant (Value);
                }
                
+               public override Constant Increment ()
+               {
+                       return new UShortConstant (checked((ushort)(Value + 1)));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -743,6 +851,11 @@ namespace Mono.CSharp {
                        return this;
                }
 
+               public override Constant Increment ()
+               {
+                       return new IntConstant (checked(Value + 1));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -814,7 +927,12 @@ namespace Mono.CSharp {
                {
                        return null;
                }
-               
+       
+               public override Constant Increment ()
+               {
+                       return new UIntConstant (checked(Value + 1));
+               }
+       
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -901,6 +1019,11 @@ namespace Mono.CSharp {
                {
                        return null;
                }
+
+               public override Constant Increment ()
+               {
+                       return new LongConstant (checked(Value + 1));
+               }
                
                public override bool IsDefaultValue {
                        get {
@@ -976,6 +1099,11 @@ namespace Mono.CSharp {
                        return null;
                }
                
+               public override Constant Increment ()
+               {
+                       return new ULongConstant (checked(Value + 1));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -1043,6 +1171,11 @@ namespace Mono.CSharp {
                        return null;
                }
 
+               public override Constant Increment ()
+               {
+                       return new FloatConstant (checked(Value + 1));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -1111,6 +1244,11 @@ namespace Mono.CSharp {
                        return null;
                }
 
+               public override Constant Increment ()
+               {
+                       return new DoubleConstant (checked(Value + 1));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -1177,6 +1315,11 @@ namespace Mono.CSharp {
                        ig.Emit (OpCodes.Newobj, TypeManager.void_decimal_ctor_five_args);
                }
 
+               public override Constant Increment ()
+               {
+                       return new DecimalConstant (checked (Value + 1));
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == 0;
@@ -1219,6 +1362,11 @@ namespace Mono.CSharp {
                                ec.ig.Emit (OpCodes.Ldstr, Value);
                }
 
+               public override Constant Increment ()
+               {
+                       throw new NotSupportedException ();
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Value == null;
index 349e66c34cbaaf20a5455ddf6e0b133623438cd0..515f759260c93ea88ae7383304326f2acc6296ce 100644 (file)
@@ -88,7 +88,7 @@ namespace Mono.CSharp {
 
                        if (gc == null) {
                                if (target_type == TypeManager.object_type)
-                                       return new BoxedCast (expr);
+                                       return new BoxedCast (expr, target_type);
 
                                return null;
                        }
@@ -148,7 +148,7 @@ namespace Mono.CSharp {
                                        return null;
 
                                if (TypeManager.IsValueType (expr_type))
-                                       return new BoxedCast (expr);
+                                       return new BoxedCast (expr, target_type);
                                if (expr_type.IsClass || expr_type.IsInterface || expr_type == TypeManager.enum_type){
                                        if (expr_type == TypeManager.anonymous_method_type)
                                                return null;
@@ -158,7 +158,7 @@ namespace Mono.CSharp {
                                return null;
                        } else if (target_type == TypeManager.value_type) {
                                if (TypeManager.IsValueType (expr_type))
-                                       return new BoxedCast (expr);
+                                       return new BoxedCast (expr, target_type);
                                if (expr_type == TypeManager.null_type)
                                        return new NullCast (expr, target_type);
 
@@ -170,7 +170,7 @@ namespace Mono.CSharp {
                                // a boxing conversion
                                //
                                if (expr_type.IsEnum || expr_type.IsGenericParameter)
-                                       return new BoxedCast (expr);
+                                       return new BoxedCast (expr, target_type);
 
                                return new EmptyCast (expr, target_type);
                        }
@@ -772,7 +772,7 @@ namespace Mono.CSharp {
                                // we just inline it
                                //
                                long v = ((LongConstant) expr).Value;
-                               if (v > 0)
+                               if (v >= 0)
                                        return true;
                        }
                        
@@ -1388,7 +1388,7 @@ namespace Mono.CSharp {
                        // e.g. target_type is IComparable, IConvertible, IFormattable
                        //
                        if (target_type.IsInterface && target_type.IsAssignableFrom (ic.Type))
-                               return new BoxedCast (ic);
+                               return new BoxedCast (ic, target_type);
 
                        return null;
                }
@@ -1436,15 +1436,7 @@ namespace Mono.CSharp {
                                }
                        }
 
-                       if (source is Constant){
-                               Constant c = (Constant) source;
-
-                               c.Error_ConstantValueCannotBeConverted (loc, target_type);
-                               return null;
-                       }
-                       
-                       Error_CannotImplicitConversion (loc, source.Type, target_type);
-
+                       source.Error_ValueCannotBeConverted (loc, target_type);
                        return null;
                }
 
@@ -1922,15 +1914,13 @@ namespace Mono.CSharp {
                        Type expr_type = expr.Type;
                        Type original_expr_type = expr_type;
 
+                       Expression ne = ImplicitConversionStandard (ec, expr, target_type, loc);
+
+                       if (ne != null)
+                               return ne;
+
                        if (expr_type.IsSubclassOf (TypeManager.enum_type)){
-                               if (target_type == TypeManager.enum_type ||
-                                   target_type == TypeManager.object_type) {
-                                       if (expr is EnumConstant)
-                                               expr = ((EnumConstant) expr).Child;
-                                       // We really need all these casts here .... :-(
-                                       expr = new BoxedCast (new EmptyCast (expr, expr_type));
-                                       return new EmptyCast (expr, target_type);
-                               } else if ((expr_type == TypeManager.enum_type) && target_type.IsValueType &&
+                               if ((expr_type == TypeManager.enum_type) && target_type.IsValueType &&
                                           target_type.IsSubclassOf (TypeManager.enum_type))
                                        return new UnboxCast (expr, target_type);
 
@@ -1944,14 +1934,6 @@ namespace Mono.CSharp {
                                expr_type = expr.Type;
                        }
 
-                       int errors = Report.Errors;
-                       Expression ne = ImplicitConversionStandard (ec, expr, target_type, loc);
-                       if (Report.Errors > errors)
-                               return null;
-
-                       if (ne != null)
-                               return ne;
-
                        if (TypeManager.IsNullableType (expr.Type) && TypeManager.IsNullableType (target_type))
                                return new Nullable.LiftedConversion (
                                        expr, target_type, false, true, loc).Resolve (ec);
@@ -2040,12 +2022,10 @@ namespace Mono.CSharp {
                        if (ne != null)
                                return ne;
 
-                       if (expr is NullLiteral){
-                               ((NullLiteral)expr).Error_ConstantValueCannotBeConverted (loc, target_type);
-                               return null;
-                       }
-
-                       Error_CannotConvertType (loc, original_expr_type, target_type);
+                       if (expr is Constant)
+                               expr.Error_ValueCannotBeConverted (loc, target_type);
+                       else
+                               Error_CannotConvertType (loc, original_expr_type, target_type);
                        return null;
                }
 
index 1706134e2cad779a5a4da5630f9dc6f7176ae485..edd817410662857a1d6b7dae5766b313d5d1db9f 100644 (file)
@@ -230,6 +230,7 @@ namespace Mono.CSharp
 %token INTERR         "?"
 
 /* C# multi-character operators. */
+%token DOUBLE_COLON          "::"
 %token OP_INC                 "++"
 %token OP_DEC                 "--"
 %token OP_SHIFT_LEFT          "<<"
@@ -340,17 +341,18 @@ using_alias_directive
        : USING IDENTIFIER ASSIGN 
          namespace_or_type_name SEMICOLON
          {
-               current_namespace.UsingAlias ((string) $2, (MemberName) $4, lexer.Location);
+               LocatedToken lt = (LocatedToken) $2;
+               current_namespace.UsingAlias (lt.Value, (MemberName) $4, (Location) $1);
          }
        | USING error {
-               CheckIdentifierToken (yyToken);
+               CheckIdentifierToken (yyToken, GetLocation ($2));
          }
        ;
 
 using_namespace_directive
        : USING namespace_name SEMICOLON 
          {
-               current_namespace.Using ((MemberName) $2, lexer.Location);
+               current_namespace.Using ((MemberName) $2, (Location) $1);
           }
        ;
 
@@ -362,17 +364,17 @@ using_namespace_directive
 namespace_declaration
        : opt_attributes NAMESPACE namespace_or_type_name
          {
+               MemberName name = (MemberName) $3;
+
                if ($1 != null) {
-                       Report.Error(1671, Lexer.Location, "A namespace declaration cannot have modifiers or attributes");
+                       Report.Error(1671, name.Location, "A namespace declaration cannot have modifiers or attributes");
                }
 
-               MemberName name = (MemberName) $3;
-
                if (name.TypeArguments != null)
                        syntax_error (lexer.Location, "namespace name expected");
 
                current_namespace = new NamespaceEntry (
-                       current_namespace, file, name.GetName (), lexer.Location);
+                       current_namespace, file, name.GetName (), name.Location);
          } 
          namespace_body opt_semicolon
          { 
@@ -434,7 +436,7 @@ namespace_member_declaration
                        DeclSpace ds = (DeclSpace)$1;
 
                        if ((ds.ModFlags & (Modifiers.PRIVATE|Modifiers.PROTECTED)) != 0){
-                               Report.Error (1527, lexer.Location, 
+                               Report.Error (1527, ds.Location, 
                                "Namespace elements cannot be explicitly declared as private, protected or protected internal");
                        }
                }
@@ -445,10 +447,10 @@ namespace_member_declaration
          }
 
        | field_declaration {
-               Report.Error (116, lexer.Location, "A namespace can only contain types and namespace declarations");
+               Report.Error (116, ((MemberCore) $1).Location, "A namespace can only contain types and namespace declarations");
          }
        | method_declaration {
-               Report.Error (116, lexer.Location, "A namespace can only contain types and namespace declarations");
+               Report.Error (116, ((MemberCore) $1).Location, "A namespace can only contain types and namespace declarations");
          }
        ;
 
@@ -463,7 +465,7 @@ type_declaration
 //
 //     | error {
 //             Console.WriteLine ("Token=" + yyToken);
-//             Report.Error (1518, lexer.Location, "Expected class, struct, interface, enum or delegate");
+//             Report.Error (1518, GetLocation ($1), "Expected class, struct, interface, enum or delegate");
 //       }
        ;
 
@@ -572,8 +574,9 @@ attribute_target_specifier
 attribute_target
        : IDENTIFIER
          {
-               CheckAttributeTarget ((string) $1);
-               $$ = $1;
+               LocatedToken lt = (LocatedToken) $1;
+               CheckAttributeTarget (lt.Value, lt.Location);
+               $$ = lt.Value; // Location won't be required anymore.
          }
         | EVENT  { $$ = "event"; }       
         | RETURN { $$ = "return"; }
@@ -598,29 +601,26 @@ attribute_list
        ;
 
 attribute
-       : attribute_name
+       : attribute_name opt_attribute_arguments
          {
-               $$ = lexer.Location;
-         }
-         opt_attribute_arguments
-         {
-               Location loc = (Location) $2;
                MemberName mname = (MemberName) $1;
                if (mname.IsGeneric) {
                        Report.Error (404, lexer.Location,
                                      "'<' unexpected: attributes cannot be generic");
                }
 
+               ArrayList arguments = (ArrayList) $2;
                MemberName left = mname.Left;
                string identifier = mname.Name;
 
-               Expression left_expr = left == null ? null : left.GetTypeExpression (loc);
+               Expression left_expr = left == null ? null : left.GetTypeExpression ();
 
                if (current_attr_target == "assembly" || current_attr_target == "module")
+                       // FIXME: supply "nameEscaped" parameter here.
                        $$ = new GlobalAttribute (current_class, current_attr_target,
-                                                 left_expr, identifier, (ArrayList) $3, loc);
+                                                 left_expr, identifier, arguments, mname.Location, lexer.IsEscapedIdentifier (mname.Location));
                else
-                       $$ = new Attribute (current_attr_target, left_expr, identifier, (ArrayList) $3, loc);
+                       $$ = new Attribute (current_attr_target, left_expr, identifier, arguments, mname.Location, lexer.IsEscapedIdentifier (mname.Location));
          }
        ;
 
@@ -707,7 +707,7 @@ named_argument_list
          }
          | named_argument_list COMMA expression
            {
-                 Report.Error (1016, lexer.Location, "Named attribute argument expected");
+                 Report.Error (1016, ((Expression) $3).Location, "Named attribute argument expected");
                  $$ = null;
                }
         ;
@@ -715,8 +715,9 @@ named_argument_list
 named_argument
        : IDENTIFIER ASSIGN expression
          {
+               // FIXME: keep location
                $$ = new DictionaryEntry (
-                       (string) $1
+                       ((LocatedToken) $1).Value
                        new Argument ((Expression) $3, Argument.AType.Expression));
          }
        ;
@@ -761,19 +762,17 @@ struct_declaration
          member_name
          { 
                MemberName name = MakeName ((MemberName) $6);
-               bool partial = (bool) $3;
-
-               if (partial) {
+               if ($3 != null) {
                        ClassPart part = PartialContainer.CreatePart (
                                current_namespace, current_class, name, (int) $2,
-                               (Attributes) $1, Kind.Struct, lexer.Location);
+                               (Attributes) $1, Kind.Struct, (Location) $3);
 
                        current_container = part.PartialContainer;
                        current_class = part;
                } else {
                        current_class = new Struct (
                                current_namespace, current_class, name, (int) $2,
-                               (Attributes) $1, lexer.Location);
+                               (Attributes) $1);
 
                        current_container.AddClassOrStruct (current_class);
                        current_container = current_class;
@@ -803,7 +802,7 @@ struct_declaration
                $$ = pop_current_class ();
          }
        | opt_attributes opt_modifiers opt_partial STRUCT error {
-               CheckIdentifierToken (yyToken);
+               CheckIdentifierToken (yyToken, GetLocation ($5));
          }
        ;
 
@@ -894,12 +893,12 @@ constant_declarators
 constant_declarator
        : IDENTIFIER ASSIGN constant_expression
          {
-               $$ = new VariableDeclaration ((string) $1, $3, lexer.Location);
+               $$ = new VariableDeclaration ((LocatedToken) $1, $3);
          }
        | IDENTIFIER
          {
                // A const field requires a value to be provided
-               Report.Error (145, lexer.Location, "A const field requires a value to be provided");
+               Report.Error (145, ((LocatedToken) $1).Location, "A const field requires a value to be provided");
                $$ = null;
          }
        ;
@@ -924,6 +923,7 @@ field_declaration
                                Lexer.doc_state = XmlCommentState.Allowed;
                        }
                        current_container.AddField (field);
+                       $$ = field; // FIXME: might be better if it points to the top item
                }
          }
        | opt_attributes
@@ -945,6 +945,7 @@ field_declaration
                                        Lexer.doc_state = XmlCommentState.Allowed;
                                }
                                current_container.AddField (field);
+                               $$ = field; // FIXME: might be better if it points to the top item
                        }
          }
        | opt_attributes
@@ -952,7 +953,7 @@ field_declaration
          VOID  
          variable_declarators
          SEMICOLON {
-               Report.Error (670, lexer.Location, "Fields cannot have void type");
+               Report.Error (670, (Location) $3, "Fields cannot have void type");
          }
        ;
 
@@ -974,7 +975,7 @@ fixed_variable_declarators
 fixed_variable_declarator
        : IDENTIFIER OPEN_BRACKET expression CLOSE_BRACKET
          {
-               $$ = new VariableDeclaration ((string) $1, $3, lexer.Location);
+               $$ = new VariableDeclaration ((LocatedToken) $1, $3);
          }
        ;
 
@@ -997,15 +998,15 @@ variable_declarators
 variable_declarator
        : IDENTIFIER ASSIGN variable_initializer
          {
-               $$ = new VariableDeclaration ((string) $1, $3, lexer.Location);
+               $$ = new VariableDeclaration ((LocatedToken) $1, $3);
          }
        | IDENTIFIER
          {
-               $$ = new VariableDeclaration ((string) $1, null, lexer.Location);
+               $$ = new VariableDeclaration ((LocatedToken) $1, null);
          }
        | IDENTIFIER OPEN_BRACKET opt_expression CLOSE_BRACKET
          {
-               Report.Error (650, lexer.Location, "Syntax error, bad array declarator. To declare a managed array the rank specifier precedes the variable's identifier. " +
+               Report.Error (650, ((LocatedToken) $1).Location, "Syntax error, bad array declarator. To declare a managed array the rank specifier precedes the variable's identifier. " +
                        "To declare a fixed size buffer field, use the fixed keyword before the field type");
                $$ = null;
          }
@@ -1022,11 +1023,11 @@ variable_initializer
          }
        | STACKALLOC type OPEN_BRACKET expression CLOSE_BRACKET
          {
-               $$ = new StackAlloc ((Expression) $2, (Expression) $4, lexer.Location);
+               $$ = new StackAlloc ((Expression) $2, (Expression) $4, (Location) $1);
          }
        | STACKALLOC type
          {
-               Report.Error (1575, lexer.Location, "A stackalloc expression requires [] after type");
+               Report.Error (1575, (Location) $1, "A stackalloc expression requires [] after type");
                 $$ = null;
          }
        ;
@@ -1092,14 +1093,13 @@ method_header
 
                GenericMethod generic = null;
                if (name.TypeArguments != null) {
-                       generic = new GenericMethod (current_namespace, current_class,
-                                                    name, lexer.Location);
+                       generic = new GenericMethod (current_namespace, current_class, name);
 
                        generic.SetParameterInfo ((ArrayList) $9);
                }
 
                method = new Method (current_class, generic, (Expression) $3, (int) $2, false,
-                                    name, (Parameters) $6, (Attributes) $1, lexer.Location);
+                                    name, (Parameters) $6, (Attributes) $1);
 
                current_local_parameters = (Parameters) $6;
 
@@ -1128,15 +1128,13 @@ method_header
                Method method;
                GenericMethod generic = null;
                if (name.TypeArguments != null) {
-                       generic = new GenericMethod (current_namespace, current_class,
-                                                    name, lexer.Location);
+                       generic = new GenericMethod (current_namespace, current_class, name);
 
                        generic.SetParameterInfo ((ArrayList) $9);
                }
 
                method = new Method (current_class, generic, TypeManager.system_void_expr,
-                                    (int) $2, false, name, (Parameters) $6, (Attributes) $1,
-                                    lexer.Location);
+                                    (int) $2, false, name, (Parameters) $6, (Attributes) $1);
 
                current_local_parameters = (Parameters) $6;
 
@@ -1150,13 +1148,12 @@ method_header
          type 
          modifiers namespace_or_type_name OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
          {
-               Report.Error (1585, lexer.Location, 
+               MemberName name = (MemberName) $5;
+               Report.Error (1585, name.Location, 
                        "Member modifier `{0}' must precede the member type and name", Modifiers.Name ((int) $4));
-               MemberName name = (MemberName) $4;
 
                Method method = new Method (current_class, null, TypeManager.system_void_expr,
-                                           0, false, name, (Parameters) $6, (Attributes) $1,
-                                           lexer.Location);
+                                           0, false, name, (Parameters) $6, (Attributes) $1);
 
                current_local_parameters = (Parameters) $6;
 
@@ -1207,12 +1204,13 @@ formal_parameter_list
          }
        | parameter_array COMMA fixed_parameters
          {
-               Report.Error (231, lexer.Location, "A params parameter must be the last parameter in a formal parameter list");
+               if ($1 != null)
+                       Report.Error (231, ((Parameter) $1).Location, "A params parameter must be the last parameter in a formal parameter list");
                $$ = null;
          }
        | ARGLIST COMMA fixed_parameters
          {
-               Report.Error (257, lexer.Location, "An __arglist parameter must be the last parameter in a formal parameter list");
+               Report.Error (257, (Location) $1, "An __arglist parameter must be the last parameter in a formal parameter list");
                $$ = null;
          }
        | parameter_array 
@@ -1248,28 +1246,30 @@ fixed_parameter
          type
          IDENTIFIER
          {
-               $$ = new Parameter ((Expression) $3, (string) $4, (Parameter.Modifier) $2, (Attributes) $1, lexer.Location);
+               LocatedToken lt = (LocatedToken) $4;
+               $$ = new Parameter ((Expression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location);
          }
        | opt_attributes
          opt_parameter_modifier
          type
          IDENTIFIER OPEN_BRACKET CLOSE_BRACKET
          {
-               Report.Error (1552, lexer.Location, "Array type specifier, [], must appear before parameter name");
+               LocatedToken lt = (LocatedToken) $4;
+               Report.Error (1552, lt.Location, "Array type specifier, [], must appear before parameter name");
                $$ = null;
          }
        | opt_attributes
          opt_parameter_modifier
          type
          {
-               Report.Error (1001, lexer.Location, "Identifier expected");
+               Report.Error (1001, GetLocation ($3), "Identifier expected");
                $$ = null;
          }
        | opt_attributes
          opt_parameter_modifier
          type
          error {
-               CheckIdentifierToken (yyToken);
+               CheckIdentifierToken (yyToken, GetLocation ($4));
                $$ = null;
          }
        | opt_attributes
@@ -1279,7 +1279,8 @@ fixed_parameter
          ASSIGN
          constant_expression
           {
-                Report.Error (241, lexer.Location, "Default parameter specifiers are not permitted");
+               LocatedToken lt = (LocatedToken) $4;
+               Report.Error (241, lt.Location, "Default parameter specifiers are not permitted");
                 $$ = null;
           }
        ;
@@ -1297,16 +1298,17 @@ parameter_modifier
 parameter_array
        : opt_attributes PARAMS type IDENTIFIER
          { 
-               $$ = new Parameter ((Expression) $3, (string) $4, Parameter.Modifier.PARAMS, (Attributes) $1, lexer.Location);
+               LocatedToken lt = (LocatedToken) $4;
+               $$ = new Parameter ((Expression) $3, lt.Value, Parameter.Modifier.PARAMS, (Attributes) $1, lt.Location);
                note ("type must be a single-dimension array type"); 
          }
        | opt_attributes PARAMS parameter_modifier type IDENTIFIER 
          {
-               Report.Error (1611, lexer.Location, "The params parameter cannot be declared as ref or out");
+               Report.Error (1611, (Location) $2, "The params parameter cannot be declared as ref or out");
                 $$ = null;
          }
        | opt_attributes PARAMS type error {
-               CheckIdentifierToken (yyToken);
+               CheckIdentifierToken (yyToken, GetLocation ($4));
                $$ = null;
          }
        ;
@@ -1325,8 +1327,6 @@ property_declaration
                implicit_value_parameter_type = (Expression) $3;
 
                lexer.PropertyParsing = true;
-
-               $$ = lexer.Location;
          }
          accessor_declarations 
          {
@@ -1343,14 +1343,13 @@ property_declaration
                Accessor get_block = (Accessor) pair.First;
                Accessor set_block = (Accessor) pair.Second;
 
-               Location loc = (Location) $7;
                MemberName name = (MemberName) $4;
 
                if (name.TypeArguments != null)
                        syntax_error (lexer.Location, "a property can't have type arguments");
 
                prop = new Property (current_class, (Expression) $3, (int) $2, false,
-                                    name, (Attributes) $1, get_block, set_block, loc);
+                                    name, (Attributes) $1, get_block, set_block);
                
                current_container.AddProperty (prop);
                implicit_value_parameter_type = null;
@@ -1384,7 +1383,7 @@ accessor_declarations
         }
        | error
          {
-               Report.Error (1014, lexer.Location, "A get or set accessor expected");
+               Report.Error (1014, GetLocation ($1), "A get or set accessor expected");
                $$ = null;
          }
        ;
@@ -1405,10 +1404,10 @@ get_accessor_declaration
           accessor_body
          {
                if (has_get) {
-                       Report.Error (1007, lexer.Location, "Property accessor already defined");
+                       Report.Error (1007, (Location) $3, "Property accessor already defined");
                        break;
                }
-               Accessor accessor = new Accessor ((ToplevelBlock) $5, (int) $2, (Attributes) $1, lexer.Location);
+               Accessor accessor = new Accessor ((ToplevelBlock) $5, (int) $2, (Attributes) $1, (Location) $3);
                has_get = true;
                current_local_parameters = null;
                lexer.PropertyParsing = true;
@@ -1432,7 +1431,7 @@ set_accessor_declaration
                Parameter [] args;
                Parameter implicit_value_parameter = new Parameter (
                        implicit_value_parameter_type, "value", 
-                       Parameter.Modifier.NONE, null, lexer.Location);
+                       Parameter.Modifier.NONE, null, (Location) $3);
 
                if (parsing_indexer == false) {
                        args  = new Parameter [1];
@@ -1460,10 +1459,10 @@ set_accessor_declaration
          accessor_body
          {
                if (has_set) {
-                       Report.Error (1007, lexer.Location, "Property accessor already defined");
+                       Report.Error (1007, ((LocatedToken) $3).Location, "Property accessor already defined");
                        break;
                }
-               Accessor accessor = new Accessor ((ToplevelBlock) $5, (int) $2, (Attributes) $1, lexer.Location);
+               Accessor accessor = new Accessor ((ToplevelBlock) $5, (int) $2, (Attributes) $1, (Location) $3);
                has_set = true;
                current_local_parameters = null;
                lexer.PropertyParsing = true;
@@ -1497,19 +1496,18 @@ interface_declaration
          member_name
          {
                MemberName name = MakeName ((MemberName) $6);
-               bool partial = (bool) $3;
 
-               if (partial) {
+               if ($3 != null) {
                        ClassPart part = PartialContainer.CreatePart (
                                current_namespace, current_class, name, (int) $2,
-                               (Attributes) $1, Kind.Interface, lexer.Location);
+                               (Attributes) $1, Kind.Interface, (Location) $3);
 
                        current_container = part.PartialContainer;
                        current_class = part;
                } else {
                        current_class = new Interface (
                                current_namespace, current_class, name, (int) $2,
-                               (Attributes) $1, lexer.Location);
+                               (Attributes) $1);
 
                        current_container.AddInterface (current_class);
                        current_container = current_class;
@@ -1541,7 +1539,7 @@ interface_declaration
                $$ = pop_current_class ();
          }
        | opt_attributes opt_modifiers opt_partial INTERFACE error {
-               CheckIdentifierToken (yyToken);
+               CheckIdentifierToken (yyToken, GetLocation ($5));
          }
        ;
 
@@ -1570,7 +1568,7 @@ interface_member_declaration
                Method m = (Method) $1;
 
                if (m.IsExplicitImpl)
-                       Report.Error (541, lexer.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
+                       Report.Error (541, m.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
                                m.GetSignatureForError ());
 
                current_container.AddMethod (m);
@@ -1586,7 +1584,7 @@ interface_member_declaration
                Property p = (Property) $1;
 
                if (p.IsExplicitImpl)
-                       Report.Error (541, lexer.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
+                       Report.Error (541, p.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
                                p.GetSignatureForError ());
 
                current_container.AddProperty (p);
@@ -1600,7 +1598,7 @@ interface_member_declaration
                        Event e = (Event) $1;
 
                        if (e.IsExplicitImpl)
-                       Report.Error (541, lexer.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
+                       Report.Error (541, e.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
                                e.GetSignatureForError ());
                        
                        current_container.AddEvent (e);
@@ -1617,7 +1615,7 @@ interface_member_declaration
                Indexer i = (Indexer) $1;
 
                if (i.IsExplicitImpl)
-                       Report.Error (541, lexer.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
+                       Report.Error (541, i.Location, "`{0}': explicit interface declaration can only be declared in a class or struct",
                                i.GetSignatureForError ());
 
                current_container.AddIndexer (i);
@@ -1628,41 +1626,41 @@ interface_member_declaration
        | delegate_declaration
          {
                if ($1 != null) {
-                       Report.Error (524, lexer.Location, "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
+                       Report.Error (524, GetLocation ($1), "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
                                ((MemberCore)$1).GetSignatureForError ());
                }
          }
        | class_declaration
          {
                if ($1 != null) {
-                       Report.Error (524, lexer.Location, "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
+                       Report.Error (524, GetLocation ($1), "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
                                ((MemberCore)$1).GetSignatureForError ());
                }
          }
        | struct_declaration
          {
                if ($1 != null) {
-                       Report.Error (524, lexer.Location, "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
+                       Report.Error (524, GetLocation ($1), "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
                                ((MemberCore)$1).GetSignatureForError ());
                }
          }
        | enum_declaration 
          {
                if ($1 != null) {
-                       Report.Error (524, lexer.Location, "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
+                       Report.Error (524, GetLocation ($1), "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
                                ((MemberCore)$1).GetSignatureForError ());
                }
          }
        | interface_declaration 
          {
                if ($1 != null) {
-                       Report.Error (524, lexer.Location, "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
+                       Report.Error (524, GetLocation ($1), "`{0}': Interfaces cannot declare classes, structs, interfaces, delegates, enumerations or constants",
                                ((MemberCore)$1).GetSignatureForError ());
                }
          } 
        | constant_declaration
          {
-               Report.Error (525, lexer.Location, "Interfaces cannot contain fields or constants");
+               Report.Error (525, GetLocation ($1), "Interfaces cannot contain fields or constants");
          }
        ;
 
@@ -1670,7 +1668,7 @@ opt_new
        : opt_modifiers 
          {
                int val = (int) $1;
-               val = Modifiers.Check (Modifiers.NEW | Modifiers.UNSAFE, val, 0, lexer.Location);
+               val = Modifiers.Check (Modifiers.NEW | Modifiers.UNSAFE, val, 0, GetLocation ($1));
                $$ = val;
          }
        ;
@@ -1708,14 +1706,13 @@ interface_method_declaration
 
                GenericMethod generic = null;
                if (name.TypeArguments != null) {
-                       generic = new GenericMethod (current_namespace, current_class,
-                                                    name, lexer.Location);
+                       generic = new GenericMethod (current_namespace, current_class, name);
 
                        generic.SetParameterInfo ((ArrayList) $9);
                }
 
                $$ = new Method (current_class, generic, (Expression) $3, (int) $2, true, name,
-                                (Parameters) $6, (Attributes) $1, lexer.Location);
+                                (Parameters) $6, (Attributes) $1);
                if (RootContext.Documentation != null)
                        ((Method) $$).DocComment = Lexer.consume_doc_comment ();
          }
@@ -1737,14 +1734,13 @@ interface_method_declaration
 
                GenericMethod generic = null;
                if (name.TypeArguments != null) {
-                       generic = new GenericMethod (current_namespace, current_class,
-                                                    name, lexer.Location);
+                       generic = new GenericMethod (current_namespace, current_class, name);
 
                        generic.SetParameterInfo ((ArrayList) $9);
                }
 
                $$ = new Method (current_class, generic, TypeManager.system_void_expr, (int) $2,
-                                true, name, (Parameters) $6, (Attributes) $1, lexer.Location);
+                                true, name, (Parameters) $6, (Attributes) $1);
                if (RootContext.Documentation != null)
                        ((Method) $$).DocComment = Lexer.consume_doc_comment ();
          }
@@ -1760,15 +1756,18 @@ interface_property_declaration
          { lexer.PropertyParsing = false; }
          CLOSE_BRACE
          {
+               LocatedToken lt = (LocatedToken) $4;
+               MemberName name = new MemberName (lt.Value, lt.Location);
+
                if ($3 == TypeManager.system_void_expr) {
-                       Report.Error (547, lexer.Location, "`{0}': property or indexer cannot have void type", $4);
+                       Report.Error (547, lt.Location, "`{0}': property or indexer cannot have void type", lt.Value);
                        break;
                }
 
                if ($7 == null) {
                        Property p = new Property (current_class, (Expression) $3, (int) $2, true,
-                                  new MemberName ((string) $4), (Attributes) $1,
-                                  null, null, lexer.Location);
+                                  name, (Attributes) $1,
+                                  null, null);
 
                        Report.Error (548, lexer.Location, "`{0}': property or indexer must have at least one accessor", p.GetSignatureForError ());
                        break;
@@ -1777,15 +1776,15 @@ interface_property_declaration
                 InterfaceAccessorInfo pinfo = (InterfaceAccessorInfo) $7;
 
                $$ = new Property (current_class, (Expression) $3, (int) $2, true,
-                                  new MemberName ((string) $4), (Attributes) $1,
-                                  pinfo.Get, pinfo.Set, lexer.Location);
+                                  name, (Attributes) $1,
+                                  pinfo.Get, pinfo.Set);
                if (RootContext.Documentation != null)
                        ((Property) $$).DocComment = Lexer.consume_doc_comment ();
          }
        | opt_attributes
          opt_new
          type error {
-               CheckIdentifierToken (yyToken);
+               CheckIdentifierToken (yyToken, GetLocation ($4));
                $$ = null;
          }
        ;
@@ -1793,24 +1792,24 @@ interface_property_declaration
 interface_accessors
        : opt_attributes opt_modifiers GET SEMICOLON    
          { 
-               $$ = new InterfaceAccessorInfo (true, false, (Attributes) $1, null, (int) $2, 0, lexer.Location, lexer.Location); 
+               $$ = new InterfaceAccessorInfo (true, false, (Attributes) $1, null, (int) $2, 0, (Location) $3, (Location) $3); 
          }
        | opt_attributes opt_modifiers GET OPEN_BRACE
          {  
-               Report.Error (531, lexer.Location, "`{0}': interface members cannot have a definition", ".get");
-               $$ = new InterfaceAccessorInfo (true, false, (Attributes) $1, null, (int) $2, 0, lexer.Location, lexer.Location);
+               Report.Error (531, (Location) $3, "`{0}': interface members cannot have a definition", ".get");
+               $$ = new InterfaceAccessorInfo (true, false, (Attributes) $1, null, (int) $2, 0, (Location) $3, (Location) $3);
          }
        | opt_attributes opt_modifiers SET SEMICOLON            
          { 
-               $$ = new InterfaceAccessorInfo (false, true, null, (Attributes) $1, 0, (int) $2, lexer.Location, lexer.Location); 
+               $$ = new InterfaceAccessorInfo (false, true, null, (Attributes) $1, 0, (int) $2, (Location) $3, (Location) $3); 
          }
        | opt_attributes opt_modifiers GET SEMICOLON opt_attributes opt_modifiers SET SEMICOLON 
          { 
-               $$ = new InterfaceAccessorInfo (true, true, (Attributes) $1, (Attributes) $5, (int) $2, (int) $6, lexer.Location, lexer.Location); 
+               $$ = new InterfaceAccessorInfo (true, true, (Attributes) $1, (Attributes) $5, (int) $2, (int) $6, (Location) $3, (Location) $7); 
          }
        | opt_attributes opt_modifiers SET SEMICOLON opt_attributes opt_modifiers GET SEMICOLON
          { 
-               $$ = new InterfaceAccessorInfo (true, true, (Attributes) $5, (Attributes) $1, (int) $6, (int) $2, lexer.Location, lexer.Location); 
+               $$ = new InterfaceAccessorInfo (true, true, (Attributes) $5, (Attributes) $1, (int) $6, (int) $2, (Location) $3, (Location) $3); 
          }
        |
          {
@@ -1821,18 +1820,20 @@ interface_accessors
 interface_event_declaration
        : opt_attributes opt_new EVENT type IDENTIFIER SEMICOLON
          {
+               LocatedToken lt = (LocatedToken) $5;
                $$ = new EventField (current_class, (Expression) $4, (int) $2, true,
-                                    new MemberName ((string) $5), null,
-                                    (Attributes) $1, lexer.Location);
+                                    new MemberName (lt.Value, lt.Location), null,
+                                    (Attributes) $1);
                if (RootContext.Documentation != null)
                        ((EventField) $$).DocComment = Lexer.consume_doc_comment ();
          }
        | opt_attributes opt_new EVENT type error {
-               CheckIdentifierToken (yyToken);
+               CheckIdentifierToken (yyToken, GetLocation ($5));
                $$ = null;
          }
        | opt_attributes opt_new EVENT type IDENTIFIER ASSIGN  {
-               Report.Error (68, lexer.Location, "`{0}.{1}': event in interface cannot have initializer", current_container.Name, $5);
+               LocatedToken lt = (LocatedToken) $5;
+               Report.Error (68, lt.Location, "`{0}.{1}': event in interface cannot have initializer", current_container.Name, lt.Value);
                $$ = null;
          }
        | opt_attributes opt_new EVENT type IDENTIFIER OPEN_BRACE
@@ -1844,7 +1845,7 @@ interface_event_declaration
                lexer.EventParsing = false;
          }
          CLOSE_BRACE {
-               Report.Error (69, lexer.Location, "Event in interface cannot have add or remove accessors");
+               Report.Error (69, (Location) $3, "Event in interface cannot have add or remove accessors");
                $$ = null;
          }
        ;
@@ -1860,9 +1861,9 @@ interface_indexer_declaration
          {
                if ($10 == null) {
                        Indexer i = new Indexer (current_class, (Expression) $3,
-                                 new MemberName (TypeContainer.DefaultIndexerName),
+                                 new MemberName (TypeContainer.DefaultIndexerName, (Location) $4),
                                  (int) $2, true, (Parameters) $6, (Attributes) $1,
-                                 null, null, lexer.Location);
+                                 null, null);
 
                        Report.Error (548, lexer.Location, "`{0}': property or indexer must have at least one accessor", i.GetSignatureForError ());
                        break;
@@ -1871,9 +1872,9 @@ interface_indexer_declaration
                InterfaceAccessorInfo info = (InterfaceAccessorInfo) $10;
 
                $$ = new Indexer (current_class, (Expression) $3,
-                                 new MemberName (TypeContainer.DefaultIndexerName),
+                                 new MemberName (TypeContainer.DefaultIndexerName, (Location) $4),
                                  (int) $2, true, (Parameters) $6, (Attributes) $1,
-                                 info.Get, info.Set, lexer.Location);
+                                 info.Get, info.Set);
                if (RootContext.Documentation != null)
                        ((Indexer) $$).DocComment = ConsumeStoredComment ();
          }
@@ -1926,8 +1927,9 @@ operator_declarator
        : type OPERATOR overloadable_operator 
          OPEN_PARENS type IDENTIFIER CLOSE_PARENS
          {
+               LocatedToken lt = (LocatedToken) $6;
                Operator.OpType op = (Operator.OpType) $3;
-               CheckUnaryOperator (op);
+               CheckUnaryOperator (op, lt.Location);
 
                if (op == Operator.OpType.Addition)
                        op = Operator.OpType.UnaryPlus;
@@ -1938,7 +1940,7 @@ operator_declarator
                Parameter [] pars = new Parameter [1];
                Expression type = (Expression) $5;
 
-               pars [0] = new Parameter (type, (string) $6, Parameter.Modifier.NONE, null, lexer.Location);
+               pars [0] = new Parameter (type, lt.Value, Parameter.Modifier.NONE, null, lt.Location);
 
                current_local_parameters = new Parameters (pars, null);
 
@@ -1947,8 +1949,8 @@ operator_declarator
                        Lexer.doc_state = XmlCommentState.NotAllowed;
                }
 
-               $$ = new OperatorDeclaration (op, (Expression) $1, type, (string) $6,
-                                             null, null, lexer.Location);
+               $$ = new OperatorDeclaration (op, (Expression) $1, type, lt.Value,
+                                             null, null, (Location) $2);
          }
        | type OPERATOR overloadable_operator
          OPEN_PARENS 
@@ -1956,15 +1958,17 @@ operator_declarator
                type IDENTIFIER 
          CLOSE_PARENS
           {
-               CheckBinaryOperator ((Operator.OpType) $3);
+               LocatedToken ltParam1 = (LocatedToken) $6;
+               LocatedToken ltParam2 = (LocatedToken) $9;
+               CheckBinaryOperator ((Operator.OpType) $3, (Location) $2);
 
                Parameter [] pars = new Parameter [2];
 
                Expression typeL = (Expression) $5;
                Expression typeR = (Expression) $8;
 
-              pars [0] = new Parameter (typeL, (string) $6, Parameter.Modifier.NONE, null, lexer.Location);
-              pars [1] = new Parameter (typeR, (string) $9, Parameter.Modifier.NONE, null, lexer.Location);
+              pars [0] = new Parameter (typeL, ltParam1.Value, Parameter.Modifier.NONE, null, ltParam1.Location);
+              pars [1] = new Parameter (typeR, ltParam2.Value, Parameter.Modifier.NONE, null, ltParam2.Location);
 
               current_local_parameters = new Parameters (pars, null);
 
@@ -1974,8 +1978,8 @@ operator_declarator
                }
               
               $$ = new OperatorDeclaration ((Operator.OpType) $3, (Expression) $1, 
-                                            typeL, (string) $6,
-                                            typeR, (string) $9, lexer.Location);
+                                            typeL, ltParam1.Value,
+                                            typeR, ltParam2.Value, (Location) $2);
           }
        | conversion_operator_declarator
        | type OPERATOR overloadable_operator
@@ -1985,14 +1989,14 @@ operator_declarator
                type IDENTIFIER
          CLOSE_PARENS
          {
-               Report.Error (1534, lexer.Location, "Overloaded binary operator `{0}' takes two parameters",
+               Report.Error (1534, (Location) $2, "Overloaded binary operator `{0}' takes two parameters",
                        Operator.GetName ((Operator.OpType) $3));
                $$ = null;
          }
        | type OPERATOR overloadable_operator 
          OPEN_PARENS CLOSE_PARENS
          {
-               Report.Error (1535, lexer.Location, "Overloaded unary operator `{0}' takes one parameter",
+               Report.Error (1535, (Location) $2, "Overloaded unary operator `{0}' takes one parameter",
                        Operator.GetName ((Operator.OpType) $3));
                $$ = null;
          }
@@ -2029,9 +2033,10 @@ overloadable_operator
 conversion_operator_declarator
        : IMPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS
          {
+               LocatedToken lt = (LocatedToken) $6;
                Parameter [] pars = new Parameter [1];
 
-               pars [0] = new Parameter ((Expression) $5, (string) $6, Parameter.Modifier.NONE, null, lexer.Location);
+               pars [0] = new Parameter ((Expression) $5, lt.Value, Parameter.Modifier.NONE, null, lt.Location);
 
                current_local_parameters = new Parameters (pars, null);  
                  
@@ -2040,14 +2045,15 @@ conversion_operator_declarator
                        Lexer.doc_state = XmlCommentState.NotAllowed;
                }
 
-               $$ = new OperatorDeclaration (Operator.OpType.Implicit, (Expression) $3, (Expression) $5, (string) $6,
-                                             null, null, lexer.Location);
+               $$ = new OperatorDeclaration (Operator.OpType.Implicit, (Expression) $3, (Expression) $5, lt.Value,
+                                             null, null, (Location) $2);
          }
        | EXPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS
          {
+               LocatedToken lt = (LocatedToken) $6;
                Parameter [] pars = new Parameter [1];
 
-               pars [0] = new Parameter ((Expression) $5, (string) $6, Parameter.Modifier.NONE, null, lexer.Location);
+               pars [0] = new Parameter ((Expression) $5, lt.Value, Parameter.Modifier.NONE, null, lt.Location);
 
                current_local_parameters = new Parameters (pars, null);  
                  
@@ -2056,16 +2062,16 @@ conversion_operator_declarator
                        Lexer.doc_state = XmlCommentState.NotAllowed;
                }
 
-               $$ = new OperatorDeclaration (Operator.OpType.Explicit, (Expression) $3, (Expression) $5, (string) $6,
-                                             null, null, lexer.Location);
+               $$ = new OperatorDeclaration (Operator.OpType.Explicit, (Expression) $3, (Expression) $5, lt.Value,
+                                             null, null, (Location) $2);
          }
        | IMPLICIT error 
          {
-               syntax_error (lexer.Location, "'operator' expected");
+               syntax_error ((Location) $1, "'operator' expected");
          }
        | EXPLICIT error 
          {
-               syntax_error (lexer.Location, "'operator' expected");
+               syntax_error ((Location) $1, "'operator' expected");
          }
        ;
 
@@ -2127,14 +2133,15 @@ constructor_declarator
                        Lexer.doc_state = XmlCommentState.Allowed;
                }
          }
-         OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS _mark_
+         OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
          {
                current_local_parameters = (Parameters) $4;
          }
          opt_constructor_initializer
          {
-               $$ = new Constructor (current_class, (string) $1, 0, (Parameters) $4,
-                                     (ConstructorInitializer) $8, (Location) $6);
+               LocatedToken lt = (LocatedToken) $1;
+               $$ = new Constructor (current_class, lt.Value, 0, (Parameters) $4,
+                                     (ConstructorInitializer) $7, lt.Location);
          }
        ;
 
@@ -2151,14 +2158,14 @@ opt_constructor_initializer
 constructor_initializer
        : COLON BASE OPEN_PARENS opt_argument_list CLOSE_PARENS
          {
-               $$ = new ConstructorBaseInitializer ((ArrayList) $4, lexer.Location);
+               $$ = new ConstructorBaseInitializer ((ArrayList) $4, (Location) $2);
          }
        | COLON THIS OPEN_PARENS opt_argument_list CLOSE_PARENS
          {
-               $$ = new ConstructorThisInitializer ((ArrayList) $4, lexer.Location);
+               $$ = new ConstructorThisInitializer ((ArrayList) $4, (Location) $2);
          }
        | COLON error {
-               Report.Error (1018, lexer.Location, "Keyword this or base expected");
+               Report.Error (1018, (Location) $1, "Keyword this or base expected");
                $$ = null;
          }
        ;
@@ -2179,12 +2186,13 @@ destructor_declaration
          }
          IDENTIFIER OPEN_PARENS CLOSE_PARENS block
          {
-               if ((string) $5 != current_container.MemberName.Name){
-                       Report.Error (574, lexer.Location, "Name of destructor must match name of class");
+               LocatedToken lt = (LocatedToken) $5;
+               if (lt.Value != current_container.MemberName.Name){
+                       Report.Error (574, lt.Location, "Name of destructor must match name of class");
                } else if (current_container.Kind != Kind.Class){
-                       Report.Error (575, lexer.Location, "Only class types can contain destructor");
+                       Report.Error (575, lt.Location, "Only class types can contain destructor");
                } else {
-                       Location l = lexer.Location;
+                       Location l = lt.Location;
 
                        int m = (int) $2;
                        if (!RootContext.StdLib && current_container.Name == "System.Object")
@@ -2211,12 +2219,12 @@ event_declaration
          {
                foreach (VariableDeclaration var in (ArrayList) $5) {
 
-                       MemberName name = new MemberName (var.identifier);
+                       MemberName name = new MemberName (var.identifier,
+                               var.Location);
 
                        Event e = new EventField (
                                current_class, (Expression) $4, (int) $2, false, name,
-                               var.expression_or_array_initializer, (Attributes) $1,
-                               lexer.Location);
+                               var.expression_or_array_initializer, (Attributes) $1);
 
                        current_container.AddEvent (e);
 
@@ -2229,7 +2237,7 @@ event_declaration
        | opt_attributes
          opt_modifiers
          EVENT type namespace_or_type_name
-         OPEN_BRACE _mark_
+         OPEN_BRACE
          {
                implicit_value_parameter_type = (Expression) $4;  
                lexer.EventParsing = true;
@@ -2240,39 +2248,42 @@ event_declaration
          }
          CLOSE_BRACE
          {
-               Location loc = (Location) $7;
                MemberName name = (MemberName) $5;
 
-               if ($9 == null){
-                       Report.Error (65, lexer.Location, "`{0}.{1}': event property must have both add and remove accessors",
+               if ($8 == null){
+                       Report.Error (65, (Location) $3, "`{0}.{1}': event property must have both add and remove accessors",
                                current_container.Name, name);
                        $$ = null;
                } else {
-                       Pair pair = (Pair) $9;
+                       Pair pair = (Pair) $8;
                        
                        if (name.TypeArguments != null)
                                syntax_error (lexer.Location, "an event can't have type arguments");
 
-                       Event e = new EventProperty (
-                               current_class, (Expression) $4, (int) $2, false, name, null,
-                               (Attributes) $1, (Accessor) pair.First, (Accessor) pair.Second,
-                               loc);
-                       if (RootContext.Documentation != null) {
-                               e.DocComment = Lexer.consume_doc_comment ();
-                               Lexer.doc_state = XmlCommentState.Allowed;
-                       }
+                       if (pair.First == null || pair.Second == null)
+                               // CS0073 is already reported, so no CS0065 here.
+                               $$ = null;
+                       else {
+                               Event e = new EventProperty (
+                                       current_class, (Expression) $4, (int) $2, false, name, null,
+                                       (Attributes) $1, (Accessor) pair.First, (Accessor) pair.Second);
+                               if (RootContext.Documentation != null) {
+                                       e.DocComment = Lexer.consume_doc_comment ();
+                                       Lexer.doc_state = XmlCommentState.Allowed;
+                               }
 
-                       current_container.AddEvent (e);
-                       implicit_value_parameter_type = null;
+                               current_container.AddEvent (e);
+                               implicit_value_parameter_type = null;
+                       }
                }
          }
        | opt_attributes opt_modifiers EVENT type namespace_or_type_name error {
                MemberName mn = (MemberName) $5;
 
                if (mn.Left != null)
-                       Report.Error (71, lexer.Location, "An explicit interface implementation of an event must use property syntax");
+                       Report.Error (71, mn.Location, "An explicit interface implementation of an event must use property syntax");
                else 
-                       Report.Error (71, lexer.Location, "Event declaration should use property syntax");
+                       Report.Error (71, mn.Location, "Event declaration should use property syntax");
 
                if (RootContext.Documentation != null)
                        Lexer.doc_state = XmlCommentState.Allowed;
@@ -2292,7 +2303,7 @@ event_accessor_declarations
        | remove_accessor_declaration { $$ = null; } 
        | error
          { 
-               Report.Error (1055, lexer.Location, "An add or remove accessor expected");
+               Report.Error (1055, GetLocation ($1), "An add or remove accessor expected");
                $$ = null;
          }
        | { $$ = null; }
@@ -2304,7 +2315,7 @@ add_accessor_declaration
                Parameter [] args = new Parameter [1];
                Parameter implicit_value_parameter = new Parameter (
                        implicit_value_parameter_type, "value", 
-                       Parameter.Modifier.NONE, null, lexer.Location);
+                       Parameter.Modifier.NONE, null, (Location) $2);
 
                args [0] = implicit_value_parameter;
                
@@ -2313,15 +2324,15 @@ add_accessor_declaration
          }
           block
          {
-               $$ = new Accessor ((ToplevelBlock) $4, 0, (Attributes) $1, lexer.Location);
+               $$ = new Accessor ((ToplevelBlock) $4, 0, (Attributes) $1, (Location) $2);
                lexer.EventParsing = true;
          }
        | opt_attributes ADD error {
-               Report.Error (73, lexer.Location, "An add or remove accessor must have a body");
+               Report.Error (73, (Location) $2, "An add or remove accessor must have a body");
                $$ = null;
          }
        | opt_attributes modifiers ADD {
-               Report.Error (1609, lexer.Location, "Modifiers cannot be placed on event accessor declarations");
+               Report.Error (1609, (Location) $3, "Modifiers cannot be placed on event accessor declarations");
                $$ = null;
          }
        ;
@@ -2332,7 +2343,7 @@ remove_accessor_declaration
                Parameter [] args = new Parameter [1];
                Parameter implicit_value_parameter = new Parameter (
                        implicit_value_parameter_type, "value", 
-                       Parameter.Modifier.NONE, null, lexer.Location);
+                       Parameter.Modifier.NONE, null, (Location) $2);
 
                args [0] = implicit_value_parameter;
                
@@ -2341,22 +2352,22 @@ remove_accessor_declaration
          }
           block
          {
-               $$ = new Accessor ((ToplevelBlock) $4, 0, (Attributes) $1, lexer.Location);
+               $$ = new Accessor ((ToplevelBlock) $4, 0, (Attributes) $1, (Location) $2);
                lexer.EventParsing = true;
          }
        | opt_attributes REMOVE error {
-               Report.Error (73, lexer.Location, "An add or remove accessor must have a body");
+               Report.Error (73, (Location) $2, "An add or remove accessor must have a body");
                $$ = null;
          }
        | opt_attributes modifiers REMOVE {
-               Report.Error (1609, lexer.Location, "Modifiers cannot be placed on event accessor declarations");
+               Report.Error (1609, (Location) $3, "Modifiers cannot be placed on event accessor declarations");
                $$ = null;
          }
        ;
 
 indexer_declaration
        : opt_attributes opt_modifiers indexer_declarator 
-         OPEN_BRACE _mark_
+         OPEN_BRACE
          {
                IndexerDeclaration decl = (IndexerDeclaration) $3;
 
@@ -2376,28 +2387,27 @@ indexer_declaration
          }
          CLOSE_BRACE
          { 
-               if ($7 == null)
+               if ($6 == null)
                        break;
 
                // The signature is computed from the signature of the indexer.  Look
                // at section 3.6 on the spec
-               Location loc = (Location) $5;
                Indexer indexer;
                IndexerDeclaration decl = (IndexerDeclaration) $3;
-               Pair pair = (Pair) $7;
+               Pair pair = (Pair) $6;
                Accessor get_block = (Accessor) pair.First;
                Accessor set_block = (Accessor) pair.Second;
 
                MemberName name;
                if (decl.interface_type != null)
-                       name = new MemberName (decl.interface_type,
-                                              TypeContainer.DefaultIndexerName, null);
+                       name = new MemberName (
+                               decl.interface_type, TypeContainer.DefaultIndexerName, decl.location);
                else
-                       name = new MemberName (TypeContainer.DefaultIndexerName);
+                       name = new MemberName (TypeContainer.DefaultIndexerName, decl.location);
 
                indexer = new Indexer (current_class, decl.type, name,
                                       (int) $2, false, decl.param_list, (Attributes) $1,
-                                      get_block, set_block, loc);
+                                      get_block, set_block);
 
                if (RootContext.Documentation != null)
                        indexer.DocComment = ConsumeStoredComment ();
@@ -2416,16 +2426,16 @@ indexer_declarator
                Parameters pars = (Parameters) $4;
                if (pars.HasArglist) {
                        // "__arglist is not valid in this context"
-                       Report.Error (1669, lexer.Location, "__arglist is not valid in this context");
+                       Report.Error (1669, (Location) $2, "__arglist is not valid in this context");
                } else if (pars.FixedParameters == null && pars.ArrayParameter == null){
-                       Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
+                       Report.Error (1551, (Location) $2, "Indexers must have at least one parameter");
                }
                if (RootContext.Documentation != null) {
                        tmpComment = Lexer.consume_doc_comment ();
                        Lexer.doc_state = XmlCommentState.Allowed;
                }
 
-               $$ = new IndexerDeclaration ((Expression) $1, null, pars);
+               $$ = new IndexerDeclaration ((Expression) $1, null, pars, (Location) $2);
          }
        | type namespace_or_type_name DOT THIS OPEN_BRACKET opt_formal_parameter_list CLOSE_BRACKET
          {
@@ -2433,14 +2443,13 @@ indexer_declarator
 
                if (pars.HasArglist) {
                        // "__arglist is not valid in this context"
-                       Report.Error (1669, lexer.Location, "__arglist is not valid in this context");
+                       Report.Error (1669, (Location) $4, "__arglist is not valid in this context");
                } else if (pars.FixedParameters == null && pars.ArrayParameter == null){
-                       Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
+                       Report.Error (1551, (Location) $4, "Indexers must have at least one parameter");
                }
 
                MemberName name = (MemberName) $2;
-
-               $$ = new IndexerDeclaration ((Expression) $1, name, pars);
+               $$ = new IndexerDeclaration ((Expression) $1, name, pars, (Location) $4);
 
                if (RootContext.Documentation != null) {
                        tmpComment = Lexer.consume_doc_comment ();
@@ -2461,27 +2470,31 @@ enum_declaration
          enum_body
          opt_semicolon
          {
-               bool partial = (bool) $3;
+               LocatedToken lt = (LocatedToken) $5;
+               Location enum_location = lt.Location;
 
-               if (partial) {
-                       Report.Error (267, lexer.Location, "The partial modifier can only appear immediately before `class', `struct' or `interface'");
+               if ($3 != null) {
+                       Report.Error (267, lt.Location, "The partial modifier can only appear immediately before `class', `struct' or `interface'");
                        break;  // assumes that the parser put us in a switch
                }
 
-               Location enum_location = lexer.Location;
-
-               MemberName name = MakeName (new MemberName ((string) $5));
+               MemberName name = MakeName (new MemberName (lt.Value, enum_location));
                Enum e = new Enum (current_namespace, current_class, (Expression) $6, (int) $2,
-                                  name, (Attributes) $1, enum_location);
+                                  name, (Attributes) $1);
                
                if (RootContext.Documentation != null)
                        e.DocComment = enumTypeComment;
 
+
+               EnumMember em = null;
                foreach (VariableDeclaration ev in (ArrayList) $8) {
-                       e.AddEnumMember (ev.identifier, 
-                                        (Expression) ev.expression_or_array_initializer,
-                                        ev.Location, ev.OptAttributes,
-                                        ev.DocComment);
+                       em = new EnumMember (e, em, (Expression) ev.expression_or_array_initializer,
+                               new MemberName (ev.identifier, ev.Location), ev.OptAttributes);
+
+//                     if (RootContext.Documentation != null)
+                               em.DocComment = ev.DocComment;
+
+                       e.AddEnumMember (em);
                }
 
                current_container.AddEnum (e);
@@ -2540,7 +2553,8 @@ enum_member_declarations
 enum_member_declaration
        : opt_attributes IDENTIFIER 
          {
-               VariableDeclaration vd = new VariableDeclaration ((string) $2, null, lexer.Location, (Attributes) $1);
+               VariableDeclaration vd = new VariableDeclaration (
+                       (LocatedToken) $2, null, (Attributes) $1);
 
                if (RootContext.Documentation != null) {
                        vd.DocComment = Lexer.consume_doc_comment ();
@@ -2551,7 +2565,6 @@ enum_member_declaration
          }
        | opt_attributes IDENTIFIER
          {
-               $$ = lexer.Location;
                if (RootContext.Documentation != null) {
                        tmpComment = Lexer.consume_doc_comment ();
                        Lexer.doc_state = XmlCommentState.NotAllowed;
@@ -2559,7 +2572,8 @@ enum_member_declaration
          }
           ASSIGN expression
          { 
-               VariableDeclaration vd = new VariableDeclaration ((string) $2, $5, lexer.Location, (Attributes) $1);
+               VariableDeclaration vd = new VariableDeclaration (
+                       (LocatedToken) $2, $5, (Attributes) $1);
 
                if (RootContext.Documentation != null)
                        vd.DocComment = ConsumeStoredComment ();
@@ -2578,10 +2592,9 @@ delegate_declaration
          type member_name
          OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
          {
-               Location l = lexer.Location;
                MemberName name = MakeName ((MemberName) $6);
                Delegate del = new Delegate (current_namespace, current_class, (Expression) $5,
-                                            (int) $2, name, (Parameters) $8, (Attributes) $1, l);
+                                            (int) $2, name, (Parameters) $8, (Attributes) $1);
 
                if (RootContext.Documentation != null) {
                        del.DocComment = Lexer.consume_doc_comment ();
@@ -2599,7 +2612,7 @@ delegate_declaration
          }
          SEMICOLON
          {
-               current_delegate.SetParameterInfo ((ArrayList) $10);
+               current_delegate.SetParameterInfo ((ArrayList) $11);
                $$ = current_delegate;
 
                current_delegate = null;
@@ -2621,14 +2634,21 @@ opt_nullable
 
 namespace_or_type_name
        : member_name
+       | IDENTIFIER DOUBLE_COLON IDENTIFIER {
+               LocatedToken lt1 = (LocatedToken) $1;
+               LocatedToken lt2 = (LocatedToken) $3;
+               $$ = new MemberName (lt1.Value, lt2.Value, lt2.Location);
+         }
        | namespace_or_type_name DOT IDENTIFIER opt_type_argument_list {
-               $$ = new MemberName ((MemberName) $1, (string) $3, (TypeArguments) $4);
+               LocatedToken lt = (LocatedToken) $3;
+               $$ = new MemberName ((MemberName) $1, lt.Value, (TypeArguments) $4, lt.Location);
          }
        ;
 
 member_name
        : IDENTIFIER opt_type_argument_list {
-               $$ = new MemberName ((string) $1, (TypeArguments) $2);
+               LocatedToken lt = (LocatedToken) $1;
+               $$ = new MemberName (lt.Value, (TypeArguments) $2, lt.Location);
          }
        ;
 
@@ -2666,7 +2686,8 @@ type_arguments
 type
        : namespace_or_type_name opt_nullable
          {
-               $$ = ((MemberName) $1).GetTypeExpression (lexer.Location);
+               MemberName name = (MemberName) $1;
+               $$ = name.GetTypeExpression ();
 
                if ((bool) $2)
                        $$ = new ComposedCast ((Expression) $$, "?", lexer.Location);
@@ -2688,11 +2709,11 @@ pointer_type
                // can't perform checks during this phase - we do it during
                // semantic analysis.
                //
-               $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, "*");
          }
        | VOID STAR
          {
-               $$ = new ComposedCast (TypeManager.system_void_expr, "*", lexer.Location);
+               $$ = new ComposedCast (TypeManager.system_void_expr, "*", (Location) $1);
          }
        ;
 
@@ -2704,19 +2725,19 @@ non_expression_type
          }
        | non_expression_type rank_specifier
          {
-               $$ = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, (string) $2);
          }
        | non_expression_type STAR
          {
-               $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, "*");
          }
        | expression rank_specifiers 
          {
-               $$ = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, (string) $2);
          }
        | expression STAR 
          {
-               $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, "*");
          }
        
        //
@@ -2725,7 +2746,7 @@ non_expression_type
        //
        | multiplicative_expression STAR 
          {
-               $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, "*");
          }
        ;
 
@@ -2780,7 +2801,7 @@ array_type
                if ((bool) $3)
                        rank_specifiers += "?";
 
-               $$ = new ComposedCast ((Expression) $1, rank_specifiers, lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, rank_specifiers);
          }
        ;
 
@@ -2794,7 +2815,14 @@ primary_expression
          }
        | member_name
          {
-               $$ = ((MemberName) $1).GetTypeExpression (lexer.Location);
+               MemberName mn = (MemberName) $1;
+               $$ = mn.GetTypeExpression ();
+         }
+       | IDENTIFIER DOUBLE_COLON IDENTIFIER
+         {
+               LocatedToken lt1 = (LocatedToken) $1;
+               LocatedToken lt2 = (LocatedToken) $3;
+               $$ = new QualifiedAliasMember (lt1.Value, lt2.Value, lt2.Location);
          }
        | parenthesized_expression
        | default_value_expression
@@ -2879,20 +2907,22 @@ parenthesized_expression
                // If a parenthesized expression is followed by a minus, we need to wrap
                // the expression inside a ParenthesizedExpression for the CS0075 check
                // in Binary.DoResolve().
-               $$ = new ParenthesizedExpression ((Expression) $1, lexer.Location);
+               $$ = new ParenthesizedExpression ((Expression) $1);
          }
        ;;
 
 member_access
        : primary_expression DOT IDENTIFIER opt_type_argument_list
          {
-               $$ = new MemberAccess ((Expression) $1, (string) $3,
-                                      (TypeArguments) $4, lexer.Location);
+               LocatedToken lt = (LocatedToken) $3;
+               $$ = new MemberAccess ((Expression) $1, lt.Value,
+                                      (TypeArguments) $4, lt.Location);
          }
        | predefined_type DOT IDENTIFIER opt_type_argument_list
          {
-               $$ = new MemberAccess ((Expression) $1, (string) $3,
-                                      (TypeArguments) $4, lexer.Location);
+               LocatedToken lt = (LocatedToken) $3;
+               $$ = new MemberAccess ((Expression) $1, lt.Value,
+                                      (TypeArguments) $4, lt.Location);
          }
        ;
 
@@ -2901,33 +2931,35 @@ predefined_type
        ;
 
 invocation_expression
-       : primary_expression OPEN_PARENS opt_argument_list CLOSE_PARENS
+       : primary_expression {
+               $$ = lexer.Location;
+         } OPEN_PARENS opt_argument_list CLOSE_PARENS
          {
                if ($1 == null) {
-                       Location l = lexer.Location;
+                       Location l = (Location) $3;
                        Report.Error (1, l, "Parse error");
                }
-               $$ = new Invocation ((Expression) $1, (ArrayList) $3, lexer.Location);
+               $$ = new Invocation ((Expression) $1, (ArrayList) $4);
          }
        | parenthesized_expression_0 CLOSE_PARENS_OPEN_PARENS OPEN_PARENS CLOSE_PARENS
          {
-               $$ = new Invocation ((Expression) $1, new ArrayList (), lexer.Location);
+               $$ = new Invocation ((Expression) $1, new ArrayList ());
          }
        | parenthesized_expression_0 CLOSE_PARENS_OPEN_PARENS primary_expression
          {
-               $$ = new InvocationOrCast ((Expression) $1, (Expression) $3, lexer.Location);
+               $$ = new InvocationOrCast ((Expression) $1, (Expression) $3);
          }
        | parenthesized_expression_0 CLOSE_PARENS_OPEN_PARENS OPEN_PARENS non_simple_argument CLOSE_PARENS
          {
                ArrayList args = new ArrayList (1);
                args.Add ($4);
-               $$ = new Invocation ((Expression) $1, args, lexer.Location);
+               $$ = new Invocation ((Expression) $1, args);
          }
        | parenthesized_expression_0 CLOSE_PARENS_OPEN_PARENS OPEN_PARENS argument_list COMMA argument CLOSE_PARENS
          {
                ArrayList args = ((ArrayList) $4);
                args.Add ($6);
-               $$ = new Invocation ((Expression) $1, args, lexer.Location);
+               $$ = new Invocation ((Expression) $1, args);
          }
        ;
 
@@ -2950,7 +2982,8 @@ argument_list
                $$ = list;
          }
        | argument_list error {
-               CheckToken (1026, yyToken, "Expected `,' or `)'");
+               CheckToken (1026, yyToken, "Expected `,' or `)'", GetLocation ($2));
+               $$ = null;
          }
        ;
 
@@ -2980,12 +3013,12 @@ non_simple_argument
                Argument[] args = new Argument [list.Count];
                list.CopyTo (args, 0);
 
-               Expression expr = new Arglist (args, lexer.Location);
+               Expression expr = new Arglist (args, (Location) $1);
                $$ = new Argument (expr, Argument.AType.Expression);
          }
        | ARGLIST
          {
-               $$ = new Argument (new ArglistAccess (lexer.Location), Argument.AType.ArgList);
+               $$ = new Argument (new ArglistAccess ((Location) $1), Argument.AType.ArgList);
          }
        ;
 
@@ -2996,7 +3029,7 @@ variable_reference
 element_access
        : primary_expression OPEN_BRACKET expression_list CLOSE_BRACKET 
          {
-               $$ = new ElementAccess ((Expression) $1, (ArrayList) $3, lexer.Location);
+               $$ = new ElementAccess ((Expression) $1, (ArrayList) $3);
          }
        | primary_expression rank_specifiers
          {
@@ -3009,16 +3042,16 @@ element_access
                  
                Expression expr = (Expression) $1;  
                if (expr is ComposedCast){
-                       $$ = new ComposedCast (expr, (string) $2, lexer.Location);
-               } else if (!(expr is SimpleName || expr is MemberAccess || expr is ConstructedType)){
-                       Error_ExpectingTypeName (lexer.Location, expr);
+                       $$ = new ComposedCast (expr, (string) $2);
+               } else if (!(expr is SimpleName || expr is MemberAccess || expr is ConstructedType || expr is QualifiedAliasMember)){
+                       Error_ExpectingTypeName (expr);
                        $$ = TypeManager.system_object_expr;
                } else {
                        //
                        // So we extract the string corresponding to the SimpleName
                        // or MemberAccess
                        // 
-                       $$ = new ComposedCast (expr, (string) $2, lexer.Location);
+                       $$ = new ComposedCast (expr, (string) $2);
                }
          }
        ;
@@ -3041,21 +3074,22 @@ expression_list
 this_access
        : THIS
          {
-               $$ = new This (current_block, lexer.Location);
+               $$ = new This (current_block, (Location) $1);
          }
        ;
 
 base_access
        : BASE DOT IDENTIFIER
          {
-               $$ = new BaseAccess ((string) $3, lexer.Location);
+               LocatedToken lt = (LocatedToken) $3;
+               $$ = new BaseAccess (lt.Value, lt.Location);
          }
        | BASE OPEN_BRACKET expression_list CLOSE_BRACKET
          {
-               $$ = new BaseIndexerAccess ((ArrayList) $3, lexer.Location);
+               $$ = new BaseIndexerAccess ((ArrayList) $3, (Location) $1);
          }
        | BASE error {
-               Report.Error (175, lexer.Location, "Use of keyword `base' is not valid in this context");
+               Report.Error (175, (Location) $1, "Use of keyword `base' is not valid in this context");
                $$ = null;
          }
        ;
@@ -3064,7 +3098,7 @@ post_increment_expression
        : primary_expression OP_INC
          {
                $$ = new UnaryMutator (UnaryMutator.Mode.PostIncrement,
-                                      (Expression) $1, lexer.Location);
+                                      (Expression) $1, (Location) $2);
          }
        ;
 
@@ -3072,7 +3106,7 @@ post_decrement_expression
        : primary_expression OP_DEC
          {
                $$ = new UnaryMutator (UnaryMutator.Mode.PostDecrement,
-                                      (Expression) $1, lexer.Location);
+                                      (Expression) $1, (Location) $2);
          }
        ;
 
@@ -3084,7 +3118,7 @@ new_expression
 object_or_delegate_creation_expression
        : NEW type OPEN_PARENS opt_argument_list CLOSE_PARENS
          {
-               $$ = new New ((Expression) $2, (ArrayList) $4, lexer.Location);
+               $$ = new New ((Expression) $2, (ArrayList) $4, (Location) $1);
          }
        ;
 
@@ -3093,20 +3127,21 @@ array_creation_expression
          opt_rank_specifier
          opt_array_initializer
          {
-               $$ = new ArrayCreation ((Expression) $2, (ArrayList) $4, (string) $6, (ArrayList) $7, lexer.Location);
+               $$ = new ArrayCreation ((Expression) $2, (ArrayList) $4, (string) $6, (ArrayList) $7, (Location) $1);
          }
        | NEW type rank_specifiers array_initializer
          {
-               $$ = new ArrayCreation ((Expression) $2, (string) $3, (ArrayList) $4, lexer.Location);
+               $$ = new ArrayCreation ((Expression) $2, (string) $3, (ArrayList) $4, (Location) $1);
          }
        | NEW error
          {
-               Report.Error (1031, lexer.Location, "Type expected");
+               Report.Error (1031, (Location) $1, "Type expected");
                 $$ = null;
          }          
        | NEW type error 
          {
-               Report.Error (1526, lexer.Location, "A new expression requires () or [] after type");
+               Report.Error (1526, (Location) $1, "A new expression requires () or [] after type");
+               $$ = null;
          }
        ;
 
@@ -3234,11 +3269,11 @@ void_pointer_expression
 typeof_expression
        : TYPEOF OPEN_PARENS VOID CLOSE_PARENS
          {
-               $$ = new TypeOfVoid (lexer.Location);
+               $$ = new TypeOfVoid ((Location) $1);
          }
        | TYPEOF OPEN_PARENS void_pointer_expression CLOSE_PARENS
          {
-               $$ = new TypeOf ((Expression) $3, lexer.Location);
+               $$ = new TypeOf ((Expression) $3, (Location) $1);
          }
        | TYPEOF OPEN_PARENS
          {
@@ -3253,21 +3288,21 @@ typeof_expression
 
 sizeof_expression
        : SIZEOF OPEN_PARENS type CLOSE_PARENS { 
-               $$ = new SizeOf ((Expression) $3, lexer.Location);
+               $$ = new SizeOf ((Expression) $3, (Location) $1);
          }
        ;
 
 checked_expression
        : CHECKED OPEN_PARENS expression CLOSE_PARENS
          {
-               $$ = new CheckedExpr ((Expression) $3, lexer.Location);
+               $$ = new CheckedExpr ((Expression) $3, (Location) $1);
          }
        ;
 
 unchecked_expression
        : UNCHECKED OPEN_PARENS expression CLOSE_PARENS
          {
-               $$ = new UnCheckedExpr ((Expression) $3, lexer.Location);
+               $$ = new UnCheckedExpr ((Expression) $3, (Location) $1);
          }
        ;
 
@@ -3275,14 +3310,15 @@ pointer_member_access
        : primary_expression OP_PTR IDENTIFIER
          {
                Expression deref;
+               LocatedToken lt = (LocatedToken) $3;
 
-               deref = new Unary (Unary.Operator.Indirection, (Expression) $1, lexer.Location);
-               $$ = new MemberAccess (deref, (string) $3, lexer.Location);
+               deref = new Unary (Unary.Operator.Indirection, (Expression) $1, lt.Location);
+               $$ = new MemberAccess (deref, lt.Value, lt.Location);
          }
        ;
 
 anonymous_method_expression
-       : DELEGATE opt_anonymous_method_signature _mark_
+       : DELEGATE opt_anonymous_method_signature
          {
                oob_stack.Push (current_local_parameters);
                current_local_parameters = (Parameters)$2;
@@ -3294,14 +3330,14 @@ anonymous_method_expression
          } 
          block
          {
-               Location loc = (Location) $3;
+               Location loc = (Location) $1;
                top_current_block = (Block) oob_stack.Pop ();
                current_block = (Block) oob_stack.Pop ();
                if (RootContext.Version == LanguageVersion.ISO_1){
-                               Report.FeatureIsNotStandardized (lexer.Location, "anonymous methods");
-                               $$ = null;
+                       Report.FeatureIsNotStandardized (loc, "anonymous methods");
+                       $$ = null;
                } else  {
-                       ToplevelBlock anon_block = (ToplevelBlock) $5;
+                       ToplevelBlock anon_block = (ToplevelBlock) $4;
 
                        anon_block.Parent = current_block;
                        $$ = new AnonymousMethod ((Parameters) $2, (ToplevelBlock) top_current_block, 
@@ -3352,10 +3388,11 @@ anonymous_method_parameter_list
 
 anonymous_method_parameter
        : opt_parameter_modifier type IDENTIFIER {
-               $$ = new Parameter ((Expression) $2, (string) $3, (Parameter.Modifier) $1, null, lexer.Location);
+               LocatedToken lt = (LocatedToken) $3;
+               $$ = new Parameter ((Expression) $2, lt.Value, (Parameter.Modifier) $1, null, lt.Location);
          }
        | PARAMS type IDENTIFIER {
-               Report.Error (1670, lexer.Location, "The `params' modifier is not allowed in anonymous method declaration");
+               Report.Error (1670, ((LocatedToken) $3).Location, "The `params' modifier is not allowed in anonymous method declaration");
                $$ = null;
          }
        ;
@@ -3371,11 +3408,11 @@ unary_expression
        : primary_expression
        | BANG prefixed_unary_expression
          {
-               $$ = new Unary (Unary.Operator.LogicalNot, (Expression) $2, lexer.Location);
+               $$ = new Unary (Unary.Operator.LogicalNot, (Expression) $2, (Location) $1);
          }
        | TILDE prefixed_unary_expression
          {
-               $$ = new Unary (Unary.Operator.OnesComplement, (Expression) $2, lexer.Location);
+               $$ = new Unary (Unary.Operator.OnesComplement, (Expression) $2, (Location) $1);
          }
        | cast_expression
        ;
@@ -3383,11 +3420,11 @@ unary_expression
 cast_list
        : parenthesized_expression_0 CLOSE_PARENS_CAST unary_expression
          {
-               $$ = new Cast ((Expression) $1, (Expression) $3, lexer.Location);
+               $$ = new Cast ((Expression) $1, (Expression) $3);
          }
        | parenthesized_expression_0 CLOSE_PARENS_OPEN_PARENS cast_expression
          {
-               $$ = new Cast ((Expression) $1, (Expression) $3, lexer.Location);
+               $$ = new Cast ((Expression) $1, (Expression) $3);
          }     
        ;
 
@@ -3395,7 +3432,7 @@ cast_expression
        : cast_list
        | OPEN_PARENS non_expression_type CLOSE_PARENS prefixed_unary_expression
          {
-               $$ = new Cast ((Expression) $2, (Expression) $4, lexer.Location);
+               $$ = new Cast ((Expression) $2, (Expression) $4);
          }
        ;
 
@@ -3407,29 +3444,29 @@ prefixed_unary_expression
        : unary_expression
        | PLUS prefixed_unary_expression
          { 
-               $$ = new Unary (Unary.Operator.UnaryPlus, (Expression) $2, lexer.Location);
+               $$ = new Unary (Unary.Operator.UnaryPlus, (Expression) $2, (Location) $1);
          } 
        | MINUS prefixed_unary_expression 
          { 
-               $$ = new Unary (Unary.Operator.UnaryNegation, (Expression) $2, lexer.Location);
+               $$ = new Unary (Unary.Operator.UnaryNegation, (Expression) $2, (Location) $1);
          }
        | OP_INC prefixed_unary_expression 
          {
                $$ = new UnaryMutator (UnaryMutator.Mode.PreIncrement,
-                                      (Expression) $2, lexer.Location);
+                                      (Expression) $2, (Location) $1);
          }
        | OP_DEC prefixed_unary_expression 
          {
                $$ = new UnaryMutator (UnaryMutator.Mode.PreDecrement,
-                                      (Expression) $2, lexer.Location);
+                                      (Expression) $2, (Location) $1);
          }
        | STAR prefixed_unary_expression
          {
-               $$ = new Unary (Unary.Operator.Indirection, (Expression) $2, lexer.Location);
+               $$ = new Unary (Unary.Operator.Indirection, (Expression) $2, (Location) $1);
          }
        | BITWISE_AND prefixed_unary_expression
          {
-               $$ = new Unary (Unary.Operator.AddressOf, (Expression) $2, lexer.Location);
+               $$ = new Unary (Unary.Operator.AddressOf, (Expression) $2, (Location) $1);
          }
        ;
 
@@ -3437,7 +3474,7 @@ pre_increment_expression
        : OP_INC prefixed_unary_expression 
          {
                $$ = new UnaryMutator (UnaryMutator.Mode.PreIncrement,
-                                      (Expression) $2, lexer.Location);
+                                      (Expression) $2, (Location) $1);
          }
        ;
 
@@ -3445,7 +3482,7 @@ pre_decrement_expression
        : OP_DEC prefixed_unary_expression 
          {
                $$ = new UnaryMutator (UnaryMutator.Mode.PreDecrement,
-                                      (Expression) $2, lexer.Location);
+                                      (Expression) $2, (Location) $1);
          }
        ;
 
@@ -3454,17 +3491,17 @@ multiplicative_expression
        | multiplicative_expression STAR prefixed_unary_expression
          {
                $$ = new Binary (Binary.Operator.Multiply, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | multiplicative_expression DIV prefixed_unary_expression
          {
                $$ = new Binary (Binary.Operator.Division, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | multiplicative_expression PERCENT prefixed_unary_expression 
          {
                $$ = new Binary (Binary.Operator.Modulus, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3473,12 +3510,12 @@ additive_expression
        | additive_expression PLUS multiplicative_expression 
          {
                $$ = new Binary (Binary.Operator.Addition, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | additive_expression MINUS multiplicative_expression
          {
                $$ = new Binary (Binary.Operator.Subtraction, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3487,12 +3524,12 @@ shift_expression
        | shift_expression OP_SHIFT_LEFT additive_expression
          {
                $$ = new Binary (Binary.Operator.LeftShift, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | shift_expression OP_SHIFT_RIGHT additive_expression
          {
                $$ = new Binary (Binary.Operator.RightShift, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ; 
 
@@ -3523,36 +3560,36 @@ relational_expression
        | relational_expression OP_LT shift_expression
          {
                $$ = new Binary (Binary.Operator.LessThan, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | relational_expression OP_GT shift_expression
          {
                $$ = new Binary (Binary.Operator.GreaterThan, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | relational_expression OP_LE shift_expression
          {
                $$ = new Binary (Binary.Operator.LessThanOrEqual, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | relational_expression OP_GE shift_expression
          {
                $$ = new Binary (Binary.Operator.GreaterThanOrEqual, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | relational_expression IS
          {
                yyErrorFlag = 3;
          } nullable_type_or_conditional
          {
-               $$ = new Is ((Expression) $1, (Expression) $4, lexer.Location);
+               $$ = new Is ((Expression) $1, (Expression) $4, (Location) $2);
          }
        | relational_expression AS
          {
                yyErrorFlag = 3;
          } nullable_type_or_conditional
          {
-               $$ = new As ((Expression) $1, (Expression) $4, lexer.Location);
+               $$ = new As ((Expression) $1, (Expression) $4, (Location) $2);
          }
        ;
 
@@ -3561,12 +3598,12 @@ equality_expression
        | equality_expression OP_EQ relational_expression
          {
                $$ = new Binary (Binary.Operator.Equality, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        | equality_expression OP_NE relational_expression
          {
                $$ = new Binary (Binary.Operator.Inequality, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ; 
 
@@ -3575,7 +3612,7 @@ and_expression
        | and_expression BITWISE_AND equality_expression
          {
                $$ = new Binary (Binary.Operator.BitwiseAnd, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3584,7 +3621,7 @@ exclusive_or_expression
        | exclusive_or_expression CARRET and_expression
          {
                $$ = new Binary (Binary.Operator.ExclusiveOr, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3593,7 +3630,7 @@ inclusive_or_expression
        | inclusive_or_expression BITWISE_OR exclusive_or_expression
          {
                $$ = new Binary (Binary.Operator.BitwiseOr, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3602,7 +3639,7 @@ conditional_and_expression
        | conditional_and_expression OP_AND inclusive_or_expression
          {
                $$ = new Binary (Binary.Operator.LogicalAnd, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3611,7 +3648,7 @@ conditional_or_expression
        | conditional_or_expression OP_OR conditional_and_expression
          {
                $$ = new Binary (Binary.Operator.LogicalOr, 
-                                (Expression) $1, (Expression) $3, lexer.Location);
+                                (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3619,7 +3656,7 @@ conditional_expression
        : conditional_or_expression
        | conditional_or_expression INTERR expression COLON expression 
          {
-               $$ = new Conditional ((Expression) $1, (Expression) $3, (Expression) $5, lexer.Location);
+               $$ = new Conditional ((Expression) $1, (Expression) $3, (Expression) $5);
          }
        | conditional_or_expression INTERR INTERR expression
          {
@@ -3636,77 +3673,57 @@ conditional_expression
 assignment_expression
        : prefixed_unary_expression ASSIGN expression
          {
-               $$ = new Assign ((Expression) $1, (Expression) $3, lexer.Location);
+               $$ = new Assign ((Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_MULT_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.Multiply, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.Multiply, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_DIV_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.Division, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.Division, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_MOD_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.Modulus, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.Modulus, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_ADD_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.Addition, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.Addition, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_SUB_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.Subtraction, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.Subtraction, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_SHIFT_LEFT_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.LeftShift, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.LeftShift, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_SHIFT_RIGHT_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.RightShift, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.RightShift, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_AND_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.BitwiseAnd, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.BitwiseAnd, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_OR_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.BitwiseOr, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.BitwiseOr, (Expression) $1, (Expression) $3);
          }
        | prefixed_unary_expression OP_XOR_ASSIGN expression
          {
-               Location l = lexer.Location;
-
                $$ = new CompoundAssign (
-                       Binary.Operator.ExclusiveOr, (Expression) $1, (Expression) $3, l);
+                       Binary.Operator.ExclusiveOr, (Expression) $1, (Expression) $3);
          }
        ;
 
@@ -3737,13 +3754,12 @@ class_declaration
          member_name
          {
                MemberName name = MakeName ((MemberName) $6);
-               bool partial = (bool) $3;
                int mod_flags = (int) $2;
 
-               if (partial) {
+               if ($3 != null) {
                        ClassPart part = PartialContainer.CreatePart (
                                current_namespace, current_class, name, mod_flags,
-                               (Attributes) $1, Kind.Class, lexer.Location);
+                               (Attributes) $1, Kind.Class, (Location) $3);
 
                        current_container = part.PartialContainer;
                        current_class = part;
@@ -3751,11 +3767,11 @@ class_declaration
                        if ((mod_flags & Modifiers.STATIC) != 0) {
                                current_class = new StaticClass (
                                        current_namespace, current_class, name,
-                                       mod_flags, (Attributes) $1, lexer.Location);
+                                       mod_flags, (Attributes) $1);
                        } else {
                                current_class = new Class (
                                        current_namespace, current_class, name,
-                                       mod_flags, (Attributes) $1, lexer.Location);
+                                       mod_flags, (Attributes) $1);
                        }
 
                        current_container.AddClassOrStruct (current_class);
@@ -3797,9 +3813,9 @@ class_declaration
 
 opt_partial
        : /* empty */
-         { $$ = (bool) false; }
+         { $$ = null; }
        | PARTIAL
-         { $$ = (bool) true; }
+         { $$ = $1; } // location
        ;
 
 opt_modifiers
@@ -3870,7 +3886,8 @@ type_parameter_constraints_clauses
 
 type_parameter_constraints_clause
        : WHERE IDENTIFIER COLON type_parameter_constraints {
-               $$ = new Constraints ((string) $2, (ArrayList) $4, lexer.Location);
+               LocatedToken lt = (LocatedToken) $2;
+               $$ = new Constraints (lt.Value, (ArrayList) $4, lt.Location);
          }
        ; 
 
@@ -3918,10 +3935,10 @@ block
        : OPEN_BRACE 
          {
                if (current_block == null){
-                       current_block = new ToplevelBlock ((ToplevelBlock) top_current_block, current_local_parameters, lexer.Location);
+                       current_block = new ToplevelBlock ((ToplevelBlock) top_current_block, current_local_parameters, (Location) $1);
                        top_current_block = current_block;
                } else {
-                       current_block = new Block (current_block, lexer.Location, Location.Null);
+                       current_block = new Block (current_block, (Location) $1, Location.Null);
                }
          } 
          opt_statement_list CLOSE_BRACE 
@@ -3929,7 +3946,7 @@ block
                while (current_block.Implicit)
                        current_block = current_block.Parent;
                $$ = current_block;
-               current_block.SetEndLocation (lexer.Location);
+               current_block.SetEndLocation ((Location) $4);
                current_block = current_block.Parent;
                if (current_block == null)
                        top_current_block = null;
@@ -3981,12 +3998,12 @@ embedded_statement
        : valid_declaration_statement
        | declaration_statement
          {
-                 Report.Error (1023, lexer.Location, "An embedded statement may not be a declaration or labeled statement");
+                 Report.Error (1023, GetLocation ($1), "An embedded statement may not be a declaration or labeled statement");
                  $$ = null;
          }
        | labeled_statement
          {
-                 Report.Error (1023, lexer.Location, "An embedded statement may not be a declaration or labeled statement");
+                 Report.Error (1023, GetLocation ($1), "An embedded statement may not be a declaration or labeled statement");
                  $$ = null;
          }
        ;
@@ -4001,9 +4018,10 @@ empty_statement
 labeled_statement
        : IDENTIFIER COLON 
          {
-               LabeledStatement labeled = new LabeledStatement ((string) $1, lexer.Location);
+               LocatedToken lt = (LocatedToken) $1;
+               LabeledStatement labeled = new LabeledStatement (lt.Value, lt.Location);
 
-               if (current_block.AddLabel ((string) $1, labeled, lexer.Location))
+               if (current_block.AddLabel (lt.Value, labeled, lt.Location))
                        current_block.AddStatement (labeled);
          }
          statement
@@ -4014,8 +4032,9 @@ declaration_statement
          {
                if ($1 != null){
                        DictionaryEntry de = (DictionaryEntry) $1;
+                       Expression e = (Expression) de.Key;
 
-                       $$ = declare_local_variables ((Expression) de.Key, (ArrayList) de.Value, lexer.Location);
+                       $$ = declare_local_variables (e, (ArrayList) de.Value, e.Location);
                }
          }
 
@@ -4055,8 +4074,8 @@ local_variable_type
                // Blah i;
                  
                Expression expr = (Expression) $1;  
-               if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast || expr is ConstructedType)) {
-                       Error_ExpectingTypeName (lexer.Location, expr);
+               if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast || expr is ConstructedType || expr is QualifiedAliasMember)) {
+                       Error_ExpectingTypeName (expr);
                        $$ = null;
                } else {
                        //
@@ -4067,7 +4086,7 @@ local_variable_type
                        if ((string) $2 == "")
                                $$ = $1;
                        else
-                               $$ = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
+                               $$ = new ComposedCast ((Expression) $1, (string) $2);
                }
          }
        | builtin_types opt_rank_specifier_or_nullable
@@ -4075,7 +4094,7 @@ local_variable_type
                if ((string) $2 == "")
                        $$ = $1;
                else
-                       $$ = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
+                       $$ = new ComposedCast ((Expression) $1, (string) $2);
          }
         ;
 
@@ -4083,26 +4102,25 @@ local_variable_pointer_type
        : primary_expression STAR
          {
                Expression expr = (Expression) $1;  
-               Location l = lexer.Location;
 
-               if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast || expr is ConstructedType)) {
-                       Error_ExpectingTypeName (l, expr);
+               if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast || expr is ConstructedType || expr is QualifiedAliasMember)) {
+                       Error_ExpectingTypeName (expr);
 
                        $$ = null;
                } else 
-                       $$ = new ComposedCast ((Expression) $1, "*", l);
+                       $$ = new ComposedCast ((Expression) $1, "*");
          }
         | builtin_types STAR
          {
-               $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);;
+               $$ = new ComposedCast ((Expression) $1, "*");
          }
         | VOID STAR
          {
-               $$ = new ComposedCast (TypeManager.system_void_expr, "*", lexer.Location);;
+               $$ = new ComposedCast (TypeManager.system_void_expr, "*", (Location) $1);
          }
        | local_variable_pointer_type STAR
           {
-               $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);
+               $$ = new ComposedCast ((Expression) $1, "*");
          }
         ;
 
@@ -4122,7 +4140,7 @@ local_variable_declaration
                        if ((string) $2 == "")
                                t = (Expression) $1;
                        else
-                               t = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
+                               t = new ComposedCast ((Expression) $1, (string) $2);
                        $$ = new DictionaryEntry (t, $3);
                } else 
                        $$ = null;
@@ -4151,15 +4169,15 @@ expression_statement
        // because statement_expression is used for example in for_statement
        //
 statement_expression
-       : invocation_expression         { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
-       | object_creation_expression    { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
-       | assignment_expression         { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
-       | post_increment_expression     { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
-       | post_decrement_expression     { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
-       | pre_increment_expression      { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
-       | pre_decrement_expression      { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+       : invocation_expression         { $$ = new StatementExpression ((ExpressionStatement) $1); }
+       | object_creation_expression    { $$ = new StatementExpression ((ExpressionStatement) $1); }
+       | assignment_expression         { $$ = new StatementExpression ((ExpressionStatement) $1); }
+       | post_increment_expression     { $$ = new StatementExpression ((ExpressionStatement) $1); }
+       | post_decrement_expression     { $$ = new StatementExpression ((ExpressionStatement) $1); }
+       | pre_increment_expression      { $$ = new StatementExpression ((ExpressionStatement) $1); }
+       | pre_decrement_expression      { $$ = new StatementExpression ((ExpressionStatement) $1); }
        | error {
-               Report.Error (1002, lexer.Location, "Expecting `;'");
+               Report.Error (1002, GetLocation ($1), "Expecting `;'");
                $$ = null;
          }
        ;
@@ -4175,37 +4193,46 @@ selection_statement
        ; 
 
 if_statement
-       : IF OPEN_PARENS _mark_ boolean_expression CLOSE_PARENS 
+       : IF OPEN_PARENS boolean_expression CLOSE_PARENS 
          embedded_statement
          { 
-               Location l = (Location) $3;
+               Location l = (Location) $1;
 
-               $$ = new If ((Expression) $4, (Statement) $6, l);
+               $$ = new If ((Expression) $3, (Statement) $5, l);
 
-               if (RootContext.WarningLevel >= 4){
-                       if ($6 == EmptyStatement.Value)
-                               Report.Warning (642, lexer.Location, "Possible mistaken empty statement");
+               if (RootContext.WarningLevel >= 3){
+                       // FIXME: location for warning should be loc property of $5.
+                       if ($5 == EmptyStatement.Value)
+                               Report.Warning (642, l, "Possible mistaken empty statement");
                }
 
          }
-       | IF OPEN_PARENS _mark_ boolean_expression CLOSE_PARENS
+       | IF OPEN_PARENS boolean_expression CLOSE_PARENS
          embedded_statement ELSE embedded_statement
          {
-               Location l = (Location) $3;
+               Location l = (Location) $1;
+
+               $$ = new If ((Expression) $3, (Statement) $5, (Statement) $7, l);
 
-               $$ = new If ((Expression) $4, (Statement) $6, (Statement) $8, l);
+               if (RootContext.WarningLevel >= 3){
+                       // FIXME: location for warning should be loc property of $5 and $7.
+                       if ($5 == EmptyStatement.Value)
+                               Report.Warning (642, l, "Possible mistaken empty statement");
+                       if ($7 == EmptyStatement.Value)
+                               Report.Warning (642, l, "Possible mistaken empty statement");
+               }
          }
        ;
 
 switch_statement
-       : SWITCH OPEN_PARENS _mark_
+       : SWITCH OPEN_PARENS
          { 
                switch_stack.Push (current_block);
          }
          expression CLOSE_PARENS 
          switch_block
          {
-               $$ = new Switch ((Expression) $5, (ArrayList) $7, (Location) $3);
+               $$ = new Switch ((Expression) $4, (ArrayList) $6, (Location) $1);
                current_block = (Block) switch_stack.Pop ();
          }
        ;
@@ -4277,11 +4304,11 @@ switch_labels
        ;
 
 switch_label
-       : CASE constant_expression COLON        { $$ = new SwitchLabel ((Expression) $2, lexer.Location); }
-       | DEFAULT COLON                         { $$ = new SwitchLabel (null, lexer.Location); }
+       : CASE constant_expression COLON        { $$ = new SwitchLabel ((Expression) $2, (Location) $1); }
+       | DEFAULT COLON                         { $$ = new SwitchLabel (null, (Location) $2); }
        | error {
                Report.Error (
-                       1523, lexer.Location
+                       1523, GetLocation ($1)
                        "The keyword case or default must precede code in switch block");
          }
        ;
@@ -4294,31 +4321,26 @@ iteration_statement
        ;
 
 while_statement
-       : WHILE OPEN_PARENS _mark_ boolean_expression CLOSE_PARENS embedded_statement
+       : WHILE OPEN_PARENS boolean_expression CLOSE_PARENS embedded_statement
          {
-               Location l = (Location) $3;
-               $$ = new While ((Expression) $4, (Statement) $6, l);
-       
-               if (RootContext.WarningLevel >= 4){
-                       if ($6 == EmptyStatement.Value)
-                               Report.Warning (642, lexer.Location, "Possible mistaken empty statement");
-               }
+               Location l = (Location) $1;
+               $$ = new While ((Expression) $3, (Statement) $5, l);
          }
        ;
 
 do_statement
        : DO embedded_statement 
-         WHILE OPEN_PARENS _mark_ boolean_expression CLOSE_PARENS SEMICOLON
+         WHILE OPEN_PARENS boolean_expression CLOSE_PARENS SEMICOLON
          {
-               Location l = (Location) $5;
+               Location l = (Location) $1;
 
-               $$ = new Do ((Statement) $2, (Expression) $6, l);
+               $$ = new Do ((Statement) $2, (Expression) $5, l);
          }
        ;
 
 for_statement
        : FOR OPEN_PARENS 
-         opt_for_initializer SEMICOLON _mark_
+         opt_for_initializer SEMICOLON
          {
                Block assign_block = new Block (current_block);
                current_block = assign_block;
@@ -4354,12 +4376,12 @@ for_statement
                                if (expr != null) {
                                        Assign a = new Assign (var, expr, decl.Location);
                                        
-                                       assign_block.AddStatement (new StatementExpression (a, lexer.Location));
+                                       assign_block.AddStatement (new StatementExpression (a));
                                }
                        }
                        
                        // Note: the $$ below refers to the value of this code block, not of the LHS non-terminal.
-                       // This can be referred to as $6 below.
+                       // This can be referred to as $5 below.
                        $$ = null;
                } else {
                        $$ = $3;
@@ -4369,14 +4391,9 @@ for_statement
          opt_for_iterator CLOSE_PARENS 
          embedded_statement
          {
-               Location l = (Location) $5;
+               Location l = (Location) $1;
 
-               For f = new For ((Statement) $6, (Expression) $7, (Statement) $9, (Statement) $11, l);
-
-               if (RootContext.WarningLevel >= 4){
-                       if ($11 == EmptyStatement.Value)
-                               Report.Warning (642, lexer.Location, "Possible mistaken empty statement");
-               }
+               For f = new For ((Statement) $5, (Expression) $6, (Statement) $8, (Statement) $10, l);
 
                current_block.AddStatement (f);
                while (current_block.Implicit)
@@ -4431,38 +4448,39 @@ statement_expression_list
 foreach_statement
        : FOREACH OPEN_PARENS type IN expression CLOSE_PARENS
          {
-               Report.Error (230, lexer.Location, "Type and identifier are both required in a foreach statement");
+               Report.Error (230, (Location) $1, "Type and identifier are both required in a foreach statement");
                $$ = null;
          }
-       | FOREACH OPEN_PARENS type IDENTIFIER IN _mark_
+       | FOREACH OPEN_PARENS type IDENTIFIER IN
          expression CLOSE_PARENS 
          {
                Block foreach_block = new Block (current_block);
                current_block = foreach_block;
 
-               Location l = lexer.Location;
+               LocatedToken lt = (LocatedToken) $4;
+               Location l = lt.Location;
                LocalInfo vi;
 
-               vi = foreach_block.AddVariable ((Expression) $3, (string) $4, l);
+               vi = foreach_block.AddVariable ((Expression) $3, lt.Value, l);
                if (vi != null) {
                        vi.SetReadOnlyContext (LocalInfo.ReadOnlyContext.Foreach);
 
                        // Get a writable reference to this read-only variable.
                        //
                        // Note that the $$ here refers to the value of _this_ code block,
-                       // not the value of the LHS non-terminal.  This can be referred to as $9 below.
-                       $$ = new LocalVariableReference (foreach_block, (string) $4, l, vi, false);
+                       // not the value of the LHS non-terminal.  This can be referred to as $8 below.
+                       $$ = new LocalVariableReference (foreach_block, lt.Value, l, vi, false);
                } else {
                        $$ = null;
                }
          } 
          embedded_statement 
          {
-               LocalVariableReference v = (LocalVariableReference) $9;
-               Location l = (Location) $6;
+               LocalVariableReference v = (LocalVariableReference) $8;
+               Location l = (Location) $1;
 
                if (v != null) {
-                       Foreach f = new Foreach ((Expression) $3, v, (Expression) $7, (Statement) $10, l);
+                       Foreach f = new Foreach ((Expression) $3, v, (Expression) $6, (Statement) $9, l);
                        current_block.AddStatement (f);
                }
 
@@ -4485,88 +4503,91 @@ jump_statement
 break_statement
        : BREAK SEMICOLON
          {
-               $$ = new Break (lexer.Location);
+               $$ = new Break ((Location) $1);
          }
        ;
 
 continue_statement
        : CONTINUE SEMICOLON
          {
-               $$ = new Continue (lexer.Location);
+               $$ = new Continue ((Location) $1);
          }
        ;
 
 goto_statement
        : GOTO IDENTIFIER SEMICOLON 
          {
-               $$ = new Goto ((string) $2, lexer.Location);
+               LocatedToken lt = (LocatedToken) $2;
+               $$ = new Goto (lt.Value, lt.Location);
          }
        | GOTO CASE constant_expression SEMICOLON
          {
-               $$ = new GotoCase ((Expression) $3, lexer.Location);
+               $$ = new GotoCase ((Expression) $3, (Location) $1);
          }
        | GOTO DEFAULT SEMICOLON 
          {
-               $$ = new GotoDefault (lexer.Location);
+               $$ = new GotoDefault ((Location) $1);
          }
        ; 
 
 return_statement
        : RETURN opt_expression SEMICOLON
          {
-               $$ = new Return ((Expression) $2, lexer.Location);
+               $$ = new Return ((Expression) $2, (Location) $1);
          }
        ;
 
 throw_statement
        : THROW opt_expression SEMICOLON
          {
-               $$ = new Throw ((Expression) $2, lexer.Location);
+               $$ = new Throw ((Expression) $2, (Location) $1);
          }
        ;
 
 yield_statement 
        : IDENTIFIER RETURN expression SEMICOLON
          {
-               string s = (string) $1;
+               LocatedToken lt = (LocatedToken) $1;
+               string s = lt.Value;
                if (s != "yield"){
-                       Report.Error (1003, lexer.Location, "; expected");
+                       Report.Error (1003, lt.Location, "; expected");
                        $$ = null;
                }
                if (RootContext.Version == LanguageVersion.ISO_1){
-                       Report.FeatureIsNotStandardized (lexer.Location, "yield statement");
+                       Report.FeatureIsNotStandardized (lt.Location, "yield statement");
                        $$ = null;
                }
                if (iterator_container == null){
-                       Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
+                       Report.Error (204, lt.Location, "yield statement can only be used within a method, operator or property");
                        $$ = null;
                } else {
                        iterator_container.SetYields ();
-                       $$ = new Yield ((Expression) $3, lexer.Location); 
+                       $$ = new Yield ((Expression) $3, lt.Location); 
                }
          }
        | IDENTIFIER RETURN SEMICOLON
          {
-               Report.Error (1627, lexer.Location, "Expression expected after yield return");
+               Report.Error (1627, (Location) $2, "Expression expected after yield return");
                $$ = null;
          }
        | IDENTIFIER BREAK SEMICOLON
          {
-               string s = (string) $1;
+               LocatedToken lt = (LocatedToken) $1;
+               string s = lt.Value;
                if (s != "yield"){
-                       Report.Error (1003, lexer.Location, "; expected");
+                       Report.Error (1003, lt.Location, "; expected");
                        $$ = null;
                }
                if (RootContext.Version == LanguageVersion.ISO_1){
-                       Report.FeatureIsNotStandardized (lexer.Location, "yield statement");
+                       Report.FeatureIsNotStandardized (lt.Location, "yield statement");
                        $$ = null;
                }
                if (iterator_container == null){
-                       Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
+                       Report.Error (204, lt.Location, "yield statement can only be used within a method, operator or property");
                        $$ = null;
                } else {
                        iterator_container.SetYields ();
-                       $$ = new YieldBreak (lexer.Location);
+                       $$ = new YieldBreak (lt.Location);
                }
          }
        ;
@@ -4617,7 +4638,8 @@ try_statement
          }
        | TRY block error 
          {
-               Report.Error (1524, lexer.Location, "Expected catch or finally");
+               Report.Error (1524, (Location) $1, "Expected catch or finally");
+               $$ = null;
          }
        ;
 
@@ -4652,21 +4674,19 @@ catch_clause
        : CATCH opt_catch_args 
          {
                Expression type = null;
-               string id = null;
                
                if ($2 != null) {
                        DictionaryEntry cc = (DictionaryEntry) $2;
                        type = (Expression) cc.Key;
-                       id   = (string) cc.Value;
+                       LocatedToken lt = (LocatedToken) cc.Value;
 
-                       if (id != null){
+                       if (lt != null){
                                ArrayList one = new ArrayList (4);
-                               Location loc = lexer.Location;
 
-                               one.Add (new VariableDeclaration (id, null, loc));
+                               one.Add (new VariableDeclaration (lt, null));
 
                                current_block = new Block (current_block);
-                               Block b = declare_local_variables (type, one, loc);
+                               Block b = declare_local_variables (type, one, lt.Location);
                                current_block = b;
                        }
                }
@@ -4677,9 +4697,10 @@ catch_clause
                if ($2 != null){
                        DictionaryEntry cc = (DictionaryEntry) $2;
                        type = (Expression) cc.Key;
-                       id   = (string) cc.Value;
+                       LocatedToken lt = (LocatedToken) cc.Value;
 
-                       if (id != null){
+                       if (lt != null){
+                               id = lt.Value;
                                while (current_block.Implicit)
                                        current_block = current_block.Parent;
                                current_block = current_block.Parent;
@@ -4720,7 +4741,7 @@ unchecked_statement
 unsafe_statement
        : UNSAFE 
          {
-               RootContext.CheckUnsafeOption (lexer.Location);
+               RootContext.CheckUnsafeOption ((Location) $1);
          } block {
                $$ = new Unsafe ((Block) $3);
          }
@@ -4729,11 +4750,11 @@ unsafe_statement
 fixed_statement
        : FIXED OPEN_PARENS 
          type fixed_pointer_declarators 
-         CLOSE_PARENS _mark_
+         CLOSE_PARENS
          {
                ArrayList list = (ArrayList) $4;
                Expression type = (Expression) $3;
-               Location l = lexer.Location;
+               Location l = (Location) $1;
                int top = list.Count;
 
                Block assign_block = new Block (current_block);
@@ -4755,14 +4776,9 @@ fixed_statement
          }
          embedded_statement 
          {
-               Location l = (Location) $6;
+               Location l = (Location) $1;
 
-               Fixed f = new Fixed ((Expression) $3, (ArrayList) $4, (Statement) $8, l);
-
-               if (RootContext.WarningLevel >= 4){
-                       if ($8 == EmptyStatement.Value)
-                               Report.Warning (642, lexer.Location, "Possible mistaken empty statement");
-               }
+               Fixed f = new Fixed ((Expression) $3, (ArrayList) $4, (Statement) $7, l);
 
                current_block.AddStatement (f);
                while (current_block.Implicit)
@@ -4790,12 +4806,14 @@ fixed_pointer_declarators
 
 fixed_pointer_declarator
        : IDENTIFIER ASSIGN expression
-         {     
-               $$ = new Pair ($1, $3);
+         {
+               LocatedToken lt = (LocatedToken) $1;
+               // FIXME: keep location
+               $$ = new Pair (lt.Value, $3);
          }
        | IDENTIFIER
          {
-               Report.Error (210, lexer.Location, "You must provide an initializer in a fixed or using statement declaration");
+               Report.Error (210, ((LocatedToken) $1).Location, "You must provide an initializer in a fixed or using statement declaration");
                $$ = null;
          }
        ;
@@ -4807,19 +4825,19 @@ lock_statement
          } 
          embedded_statement
          {
-               $$ = new Lock ((Expression) $3, (Statement) $6, lexer.Location);
+               $$ = new Lock ((Expression) $3, (Statement) $6, (Location) $1);
          }
        ;
 
 using_statement
-       : USING OPEN_PARENS resource_acquisition CLOSE_PARENS _mark_
+       : USING OPEN_PARENS resource_acquisition CLOSE_PARENS
          {
                Block assign_block = new Block (current_block);
                current_block = assign_block;
 
                if ($3 is DictionaryEntry){
                        DictionaryEntry de = (DictionaryEntry) $3;
-                       Location l = lexer.Location;
+                       Location l = (Location) $1;
 
                        Expression type = (Expression) de.Key;
                        ArrayList var_declarators = (ArrayList) de.Value;
@@ -4856,11 +4874,11 @@ using_statement
                                vars.Add (new DictionaryEntry (var, expr));                             
 
                                // Assign a = new Assign (var, expr, decl.Location);
-                               // assign_block.AddStatement (new StatementExpression (a, lexer.Location));
+                               // assign_block.AddStatement (new StatementExpression (a));
                        }
 
                        // Note: the $$ here refers to the value of this code block and not of the LHS non-terminal.
-                       // It can be referred to as $6 below.
+                       // It can be referred to as $5 below.
                        $$ = new DictionaryEntry (type, vars);
                 } else {
                        $$ = $3;
@@ -4868,7 +4886,7 @@ using_statement
          } 
          embedded_statement
          {
-               Using u = new Using ($6, (Statement) $7, (Location) $5);
+               Using u = new Using ($5, (Statement) $6, (Location) $1);
                current_block.AddStatement (u);
                while (current_block.Implicit)
                        current_block = current_block.Parent;
@@ -4882,11 +4900,6 @@ resource_acquisition
        | expression
        ;
 
-// Utility rule to save location information
-_mark_
-       : /* empty */
-       { $$ = lexer.Location; }
-
 %%
 
 // <summary>
@@ -4899,15 +4912,15 @@ public class VariableDeclaration {
        public Attributes OptAttributes;
        public string DocComment;
 
-       public VariableDeclaration (string id, object eoai, Location l, Attributes opt_attrs)
+       public VariableDeclaration (LocatedToken lt, object eoai, Attributes opt_attrs)
        {
-               this.identifier = id;
+               this.identifier = lt.Value;
                this.expression_or_array_initializer = eoai;
-               this.Location = l;
+               this.Location = lt.Location;
                this.OptAttributes = opt_attrs;
        }
 
-       public VariableDeclaration (string id, object eoai, Location l) : this (id, eoai, l, null)
+       public VariableDeclaration (LocatedToken lt, object eoai) : this (lt, eoai, null)
        {
        }
 }
@@ -4938,13 +4951,15 @@ public class IndexerDeclaration {
        public Expression type;
        public MemberName interface_type;
        public Parameters param_list;
+       public Location location;
 
        public IndexerDeclaration (Expression type, MemberName interface_type,
-                                  Parameters param_list)
+                                  Parameters param_list, Location loc)
        {
                this.type = type;
                this.interface_type = interface_type;
                this.param_list = param_list;
+               this.location = loc;
        }
 }
 
@@ -4991,12 +5006,12 @@ public class OperatorDeclaration {
 
 }
 
-void Error_ExpectingTypeName (Location l, Expression expr)
+void Error_ExpectingTypeName (Expression expr)
 {
        if (expr is Invocation){
-               Report.Error (1002, l, "Expecting `;'");
+               Report.Error (1002, expr.Location, "Expecting `;'");
        } else {
-               Report.Error (-1, l, "Invalid Type definition");
+               Report.Error (-1, expr.Location, "Invalid Type definition");
        }
 }
 
@@ -5093,7 +5108,7 @@ Block declare_local_variables (Expression type, ArrayList variable_declarators,
 
                assign = new Assign (var, expr, decl.Location);
 
-               implicit_block.AddStatement (new StatementExpression (assign, lexer.Location));
+               implicit_block.AddStatement (new StatementExpression (assign));
        }
        
        return implicit_block;
@@ -5115,7 +5130,7 @@ Block declare_local_constants (Expression type, ArrayList declarators)
        return implicit_block;
 }
 
-void CheckAttributeTarget (string a)
+void CheckAttributeTarget (string a, Location l)
 {
        switch (a) {
 
@@ -5123,14 +5138,13 @@ void CheckAttributeTarget (string a)
                return;
                
        default :
-               Location l = lexer.Location;
                Report.Error (658, l, "`" + a + "' is an invalid attribute target");
                break;
        }
 
 }
 
-void CheckUnaryOperator (Operator.OpType op)
+void CheckUnaryOperator (Operator.OpType op, Location l)
 {
        switch (op) {
                
@@ -5146,14 +5160,13 @@ void CheckUnaryOperator (Operator.OpType op)
                break;
                
        default :
-               Location l = lexer.Location;
                Report.Error (1019, l, "Overloadable unary operator expected"); 
                break;
                
        }
 }
 
-void CheckBinaryOperator (Operator.OpType op)
+void CheckBinaryOperator (Operator.OpType op, Location l)
 {
        switch (op) {
                
@@ -5176,7 +5189,6 @@ void CheckBinaryOperator (Operator.OpType op)
                break;
                
        default :
-               Location l = lexer.Location;
                Report.Error (1020, l, "Overloadable binary operator expected");
                break;
        }
@@ -5238,18 +5250,18 @@ public void parse ()
        RootContext.Tree.Types.NamespaceEntry = null;
 }
 
-void CheckToken (int error, int yyToken, string msg)
+void CheckToken (int error, int yyToken, string msg, Location loc)
 {
        if (yyToken >= Token.FIRST_KEYWORD && yyToken <= Token.LAST_KEYWORD){
-               Report.Error (error, lexer.Location, String.Format ("{0}: `{1}' is a keyword", msg, yyNames [yyToken].ToLower ()));
+               Report.Error (error, loc, String.Format ("{0}: `{1}' is a keyword", msg, yyNames [yyToken].ToLower ()));
                return;
        }               
-       Report.Error (error, lexer.Location, msg);
+       Report.Error (error, loc, msg);
 }
 
-void CheckIdentifierToken (int yyToken)
+void CheckIdentifierToken (int yyToken, Location loc)
 {
-       CheckToken (1041, yyToken, "Identifier expected");
+       CheckToken (1041, yyToken, "Identifier expected", loc);
 }
 
 string ConsumeStoredComment ()
@@ -5260,5 +5272,18 @@ string ConsumeStoredComment ()
        return s;
 }
 
+Location GetLocation (object obj)
+{
+       if (obj is MemberCore)
+               return ((MemberCore) obj).Location;
+       if (obj is MemberName)
+               return ((MemberName) obj).Location;
+       if (obj is LocatedToken)
+               return ((LocatedToken) obj).Location;
+       if (obj is Location)
+               return (Location) obj;
+       return lexer.Location;
+}
+
 /* end end end */
 }
index 9dda5070b915ad169ed182d4ca3293b8242b5c20..99f73b8270cf1a4767d83983274cd8d2812752fc 100644 (file)
@@ -32,17 +32,21 @@ namespace Mono.CSharp
        public class Tokenizer : yyParser.yyInput
        {
                SeekableStreamReader reader;
-               public SourceFile ref_name;
-               public SourceFile file_name;
-               public int ref_line = 1;
-               public int line = 1;
-               public int col = 1;
-               public int current_token;
+               SourceFile ref_name;
+               SourceFile file_name;
+               int ref_line = 1;
+               int line = 1;
+               int col = 0;
+               int previous_col;
+               int current_token;
                bool handle_get_set = false;
                bool handle_remove_add = false;
                bool handle_assembly = false;
                bool handle_constraints = false;
                bool handle_typeof = false;
+               Location current_location;
+               Location current_comment_location = Location.Null;
+               ArrayList escapedIdentifiers = new ArrayList ();
 
                //
                // XML documentation buffer. The save point is used to divide
@@ -173,12 +177,20 @@ namespace Mono.CSharp
                        set {
                                if (value == XmlCommentState.Allowed) {
                                        check_incorrect_doc_comment ();
-                                       consume_doc_comment ();
+                                       reset_doc_comment ();
                                }
                                xmlDocState = value;
                        }
                }
 
+               public bool IsEscapedIdentifier (Location loc)
+               {
+                       foreach (LocatedToken lt in escapedIdentifiers)
+                               if (lt.Location.Equals (loc))
+                                       return true;
+                       return false;
+               }
+
                //
                // Class variables
                // 
@@ -384,9 +396,7 @@ namespace Mono.CSharp
                }
 
                public Location Location {
-                       get {
-                               return new Location (ref_line);
-                       }
+                       get { return current_location; }
                }
 
                void define (string def)
@@ -419,7 +429,7 @@ namespace Mono.CSharp
                        // FIXME: This could be `Location.Push' but we have to
                        // find out why the MS compiler allows this
                        //
-                       Mono.CSharp.Location.Push (file);
+                       Mono.CSharp.Location.Push (file, 0);
                }
 
                static bool is_identifier_start_character (char c)
@@ -532,8 +542,10 @@ namespace Mono.CSharp
 
                        switch (c){
                        case '{':
+                               val = Location;
                                return Token.OPEN_BRACE;
                        case '}':
+                               val = Location;
                                return Token.CLOSE_BRACE;
                        case '[':
                                // To block doccomment inside attribute declaration.
@@ -552,8 +564,13 @@ namespace Mono.CSharp
 
                                // Save current position and parse next token.
                                int old = reader.Position;
+                               int old_ref_line = ref_line;
+                               int old_col = col;
+
                                int new_token = token ();
                                reader.Position = old;
+                               ref_line = old_ref_line;
+                               col = old_col;
                                putback_char = -1;
 
                                if (new_token == Token.OPEN_PARENS)
@@ -568,11 +585,11 @@ namespace Mono.CSharp
 
                        case ',':
                                return Token.COMMA;
-                       case ':':
-                               return Token.COLON;
                        case ';':
+                               val = Location;
                                return Token.SEMICOLON;
                        case '~':
+                               val = Location;
                                return Token.TILDE;
                        case '?':
                                return Token.INTERR;
@@ -646,24 +663,32 @@ namespace Mono.CSharp
                        d = peekChar ();
                        if (c == '+'){
                                
-                               if (d == '+')
+                               if (d == '+') {
+                                       val = Location;
                                        t = Token.OP_INC;
+                               }
                                else if (d == '=')
                                        t = Token.OP_ADD_ASSIGN;
-                               else
+                               else {
+                                       val = Location;
                                        return Token.PLUS;
+                               }
                                doread = true;
                                return t;
                        }
                        if (c == '-'){
-                               if (d == '-')
+                               if (d == '-') {
+                                       val = Location;
                                        t = Token.OP_DEC;
+                               }
                                else if (d == '=')
                                        t = Token.OP_SUB_ASSIGN;
                                else if (d == '>')
                                        t = Token.OP_PTR;
-                               else
+                               else {
+                                       val = Location;
                                        return Token.MINUS;
+                               }
                                doread = true;
                                return t;
                        }
@@ -673,6 +698,7 @@ namespace Mono.CSharp
                                        doread = true;
                                        return Token.OP_NE;
                                }
+                               val = Location;
                                return Token.BANG;
                        }
 
@@ -692,6 +718,7 @@ namespace Mono.CSharp
                                        doread = true;
                                        return Token.OP_AND_ASSIGN;
                                }
+                               val = Location;
                                return Token.BITWISE_AND;
                        }
 
@@ -711,6 +738,7 @@ namespace Mono.CSharp
                                        doread = true;
                                        return Token.OP_MULT_ASSIGN;
                                }
+                               val = Location;
                                return Token.STAR;
                        }
 
@@ -738,6 +766,15 @@ namespace Mono.CSharp
                                return Token.CARRET;
                        }
 
+                       if (c == ':'){
+                               if (d == ':'){
+                                       doread = true;
+                                       return Token.DOUBLE_COLON;
+                               }
+                               val = Location;
+                               return Token.COLON;
+                       }
+
                        return Token.ERROR;
                }
 
@@ -1200,13 +1237,22 @@ namespace Mono.CSharp
 
                int getChar ()
                {
-                       if (putback_char != -1){
-                               int x = putback_char;
+                       int x;
+                       if (putback_char != -1) {
+                               x = putback_char;
                                putback_char = -1;
-
-                               return x;
                        }
-                       return reader.Read ();
+                       else
+                               x = reader.Read ();
+                       if (x == '\n') {
+                               line++;
+                               ref_line++;
+                               previous_col = col;
+                               col = 0;
+                       }
+                       else
+                               col++;
+                       return x;
                }
 
                int peekChar ()
@@ -1233,6 +1279,14 @@ namespace Mono.CSharp
                                Console.WriteLine ("Current [{0}] putting back [{1}]  ", putback_char, c);
                                throw new Exception ("This should not happen putback on putback");
                        }
+                       if (c == '\n' || col == 0) {
+                               // It won't happen though.
+                               line--;
+                               ref_line--;
+                               col = previous_col;
+                       }
+                       else
+                               col--;
                        putback_char = c;
                }
 
@@ -1342,22 +1396,16 @@ namespace Mono.CSharp
                        cmd = static_cmd_arg.ToString ();
 
                        if (c == '\n'){
-                               line++;
-                               ref_line++;
                                return;
-                       } else if (c == '\r')
-                               col = 0;
+                       }
 
                        // skip over white space
                        while ((c = getChar ()) != -1 && (c != '\n') && ((c == '\r') || (c == ' ') || (c == '\t')))
                                ;
 
                        if (c == '\n'){
-                               line++;
-                               ref_line++;
                                return;
                        } else if (c == '\r'){
-                               col = 0;
                                return;
                        } else if (c == -1){
                                arg = "";
@@ -1371,11 +1419,6 @@ namespace Mono.CSharp
                                static_cmd_arg.Append ((char) c);
                        }
 
-                       if (c == '\n'){
-                               line++;
-                               ref_line++;
-                       } else if (c == '\r')
-                               col = 0;
                        arg = static_cmd_arg.ToString ().Trim ();
                }
 
@@ -1390,7 +1433,7 @@ namespace Mono.CSharp
                        if (arg == "default"){
                                ref_line = line;
                                ref_name = file_name;
-                               Location.Push (ref_name);
+                               Location.Push (ref_name, line);
                                return true;
                        } else if (arg == "hidden"){
                                //
@@ -1412,7 +1455,7 @@ namespace Mono.CSharp
                                        ref_name = Location.LookupFile (name);
                                        file_name.HasLineDirective = true;
                                        ref_name.HasLineDirective = true;
-                                       Location.Push (ref_name);
+                                       Location.Push (ref_name, ref_line);
                                } else {
                                        ref_line = System.Int32.Parse (arg);
                                }
@@ -1714,6 +1757,8 @@ namespace Mono.CSharp
                        string cmd, arg;
                        bool region_directive = false;
 
+                       current_location = new Location (ref_line, Col);
+
                        get_cmd_arg (out cmd, out arg);
 
                        // Eat any trailing whitespaces and single-line comments
@@ -1932,11 +1977,7 @@ namespace Mono.CSharp
                                if (c == '\n'){
                                        if (!quoted)
                                                Report.Error (1010, Location, "Newline in constant");
-                                       line++;
-                                       ref_line++;
-                                       col = 0;
-                               } else
-                                       col++;
+                               }
 
                                if (!quoted){
                                        c = escape (c);
@@ -1967,6 +2008,8 @@ namespace Mono.CSharp
                                // Save current position and parse next token.
                                int old = reader.Position;
                                int old_putback = putback_char;
+                               int old_ref_line = ref_line;
+                               int old_col = col;
 
                                putback_char = -1;
 
@@ -1977,12 +2020,14 @@ namespace Mono.CSharp
                                        (next_token == Token.ENUM); // "partial" is a keyword in 'partial enum', even though it's not valid
 
                                reader.Position = old;
+                               ref_line = old_ref_line;
+                               col = old_col;
                                putback_char = old_putback;
 
                                if (ok)
                                        return res;
                                else {
-                                       val = "partial";
+                                       val = new LocatedToken (Location, "partial");
                                        return Token.IDENTIFIER;
                                }
                        }
@@ -1993,11 +2038,13 @@ namespace Mono.CSharp
                private int consume_identifier (int s, bool quoted) 
                {
                        int pos = 1;
-                       int c;
+                       int c = -1;
                        
                        id_builder [0] = (char) s;
                                        
-                       while ((c = reader.Read ()) != -1) {
+                       current_location = new Location (ref_line, Col);
+
+                       while ((c = getChar ()) != -1) {
                                if (is_identifier_part_character ((char) c)){
                                        if (pos == max_id_size){
                                                Report.Error (645, Location, "Identifier too long (limit is 512 chars)");
@@ -2005,10 +2052,10 @@ namespace Mono.CSharp
                                        }
                                        
                                        id_builder [pos++] = (char) c;
-                                       putback_char = -1;
-                                       col++;
+//                                     putback_char = -1;
                                } else {
-                                       putback_char = c;
+//                                     putback_char = c;
+                                       putback (c);
                                        break;
                                }
                        }
@@ -2019,8 +2066,10 @@ namespace Mono.CSharp
                        //
                        if (!quoted && (s >= 'a' || s == '_')){
                                int keyword = GetKeyword (id_builder, pos);
-                               if (keyword != -1)
+                               if (keyword != -1) {
+                                       val = Location;
                                return keyword;
+                               }
                        }
 
                        //
@@ -2031,6 +2080,9 @@ namespace Mono.CSharp
                        if (identifiers [pos] != null) {
                                val = identifiers [pos][id_builder];
                                if (val != null) {
+                                       val = new LocatedToken (Location, (string) val);
+                                       if (quoted)
+                                               escapedIdentifiers.Add (val);
                                        return Token.IDENTIFIER;
                                }
                        }
@@ -2048,6 +2100,9 @@ namespace Mono.CSharp
 
                        identifiers [pos] [chars] = val;
 
+                       val = new LocatedToken (Location, (string) val);
+                       if (quoted)
+                               escapedIdentifiers.Add (val);
                        return Token.IDENTIFIER;
                }
 
@@ -2060,12 +2115,11 @@ namespace Mono.CSharp
                        
                        val = null;
                        // optimization: eliminate col and implement #directive semantic correctly.
-                       for (;(c = getChar ()) != -1; col++) {
+                       for (;(c = getChar ()) != -1;) {
                                if (c == ' ')
                                        continue;
                                
                                if (c == '\t') {
-                                       col = (((col + 8) / 8) * 8) - 1;
                                        continue;
                                }
                                
@@ -2076,9 +2130,6 @@ namespace Mono.CSharp
                                        if (peekChar () == '\n')
                                                getChar ();
 
-                                       line++;
-                                       ref_line++;
-                                       col = 0;
                                        any_token_seen |= tokens_seen;
                                        tokens_seen = false;
                                        comments_seen = false;
@@ -2095,6 +2146,7 @@ namespace Mono.CSharp
                                                        getChar ();
                                                        // Don't allow ////.
                                                        if ((d = peekChar ()) != '/') {
+                                                               update_comment_location ();
                                                                if (doc_state == XmlCommentState.Allowed)
                                                                        handle_one_line_xml_comment ();
                                                                else if (doc_state == XmlCommentState.NotAllowed)
@@ -2102,11 +2154,7 @@ namespace Mono.CSharp
                                                        }
                                                }
                                                while ((d = getChar ()) != -1 && (d != '\n') && d != '\r')
-                                                       col++;
                                                if (d == '\n'){
-                                                       line++;
-                                                       ref_line++;
-                                                       col = 0;
                                                }
                                                any_token_seen |= tokens_seen;
                                                tokens_seen = false;
@@ -2117,6 +2165,7 @@ namespace Mono.CSharp
                                                bool docAppend = false;
                                                if (RootContext.Documentation != null && peekChar () == '*') {
                                                        getChar ();
+                                                       update_comment_location ();
                                                        // But when it is /**/, just do nothing.
                                                        if (peekChar () == '/') {
                                                                getChar ();
@@ -2139,7 +2188,6 @@ namespace Mono.CSharp
                                                while ((d = getChar ()) != -1){
                                                        if (d == '*' && peekChar () == '/'){
                                                                getChar ();
-                                                               col++;
                                                                comments_seen = true;
                                                                break;
                                                        }
@@ -2147,9 +2195,6 @@ namespace Mono.CSharp
                                                                xml_comment_buffer.Append ((char) d);
                                                        
                                                        if (d == '\n'){
-                                                               line++;
-                                                               ref_line++;
-                                                               col = 0;
                                                                any_token_seen |= tokens_seen;
                                                                tokens_seen = false;
                                                                // 
@@ -2172,9 +2217,6 @@ namespace Mono.CSharp
                        is_punct_label:
                                // white space
                                if (c == '\n'){
-                                       line++;
-                                       ref_line++;
-                                       col = 0;
                                        any_token_seen |= tokens_seen;
                                        tokens_seen = false;
                                        comments_seen = false;
@@ -2201,17 +2243,12 @@ namespace Mono.CSharp
                                        cont = handle_preprocessing_directive (cont);
 
                                        if (cont){
-                                               col = 0;
                                                continue;
                                        }
-                                       col = 1;
 
                                        bool skipping = false;
-                                       for (;(c = getChar ()) != -1; col++){
+                                       for (;(c = getChar ()) != -1;){
                                                if (c == '\n'){
-                                                       col = 0;
-                                                       line++;
-                                                       ref_line++;
                                                        skipping = false;
                                                } else if (c == ' ' || c == '\t' || c == '\v' || c == '\r' || c == 0xa0)
                                                        continue;
@@ -2251,6 +2288,7 @@ namespace Mono.CSharp
                                        return consume_identifier (c);
                        }
 
+                       current_location = new Location (ref_line, Col);
                        if ((t = is_punct ((char)c, ref doread)) != Token.ERROR){
                                tokens_seen = true;
                                if (doread){
@@ -2284,6 +2322,10 @@ namespace Mono.CSharp
                                        Report.Error (1011, Location, error_details);
                                        return Token.ERROR;
                                }
+                               if (c == '\r' || c == '\n') {
+                                       Report.Error (1010, Location, "Newline in constant");
+                                       return Token.ERROR;
+                               }
                                c = escape (c);
                                if (c == -1)
                                        return Token.ERROR;
@@ -2297,13 +2339,11 @@ namespace Mono.CSharp
 
                                        // Try to recover, read until newline or next "'"
                                        while ((c = getChar ()) != -1){
-                                               if (c == '\n' || c == '\''){
-                                                       line++;
-                                                       ref_line++;
-                                                       col = 0;
+                                               if (c == '\n'){
+                                                       break;
+                                               }
+                                               else if (c == '\'')
                                                        break;
-                                               } else
-                                                       col++;
                                        }
                                        return Token.ERROR;
                                }
@@ -2345,7 +2385,6 @@ namespace Mono.CSharp
                        while ((c = peekChar ()) == ' ')
                                getChar (); // skip heading whitespaces.
                        while ((c = peekChar ()) != -1 && c != '\n' && c != '\r') {
-                               col++;
                                xml_comment_buffer.Append ((char) getChar ());
                        }
                        if (c == '\r' || c == '\n')
@@ -2383,6 +2422,18 @@ namespace Mono.CSharp
                        xml_comment_buffer.Insert (current_comment_start, String.Join (Environment.NewLine, lines));
                }
 
+               //
+               // Updates current comment location.
+               //
+               private void update_comment_location ()
+               {
+                       if (current_comment_location.IsNull) {
+                               // "-2" is for heading "//" or "/*"
+                               current_comment_location =
+                                       new Location (ref_line, col - 2);
+                       }
+               }
+
                //
                // Checks if there was incorrect doc comments and raise
                // warnings.
@@ -2399,10 +2450,13 @@ namespace Mono.CSharp
                //
                private void warn_incorrect_doc_comment ()
                {
-                       doc_state = XmlCommentState.Error;
-                       // in csc, it is 'XML comment is not placed on a valid 
-                       // language element'. But that does not make sense.
-                       Report.Warning (1587, 2, Location, "XML comment is not placed on a valid language element");
+                       if (doc_state != XmlCommentState.Error) {
+                               doc_state = XmlCommentState.Error;
+                               // in csc, it is 'XML comment is not placed on 
+                               // a valid language element'. But that does not
+                               // make sense.
+                               Report.Warning (1587, 2, Location, "XML comment is not placed on a valid language element");
+                       }
                }
 
                //
@@ -2413,12 +2467,18 @@ namespace Mono.CSharp
                {
                        if (xml_comment_buffer.Length > 0) {
                                string ret = xml_comment_buffer.ToString ();
-                               xml_comment_buffer.Length = 0;
+                               reset_doc_comment ();
                                return ret;
                        }
                        return null;
                }
 
+               void reset_doc_comment ()
+               {
+                       xml_comment_buffer.Length = 0;
+                       current_comment_location = Location.Null;
+               }
+
                public void cleanup ()
                {
                        if (ifstack != null && ifstack.Count >= 1) {
index 0e2a9bb337d09f6d112533c24273670510524727..186293cd2f020fd86f3f7f7d2336ed94288b8d6e 100644 (file)
@@ -27,56 +27,82 @@ namespace Mono.CSharp {
                public readonly TypeArguments TypeArguments;
 
                public readonly MemberName Left;
+               public readonly Location Location;
+
+               public static readonly MemberName Null = new MemberName ("", Location.Null);
 
-               public static readonly MemberName Null = new MemberName ("");
+               bool is_double_colon;
 
-               public MemberName (string name)
+               private MemberName (MemberName left, string name, bool is_double_colon,
+                                   TypeArguments args, Location loc)
                {
                        this.Name = name;
+                       this.Location = loc;
+                       this.is_double_colon = is_double_colon;
+                       this.TypeArguments = args;
+                       this.Left = left;
                }
 
-               public MemberName (string name, TypeArguments args)
-                       : this (name)
+               public MemberName (string name, TypeArguments args, Location loc)
+                       : this (name, loc)
                {
                        this.TypeArguments = args;
                }
 
-               public MemberName (MemberName left, string name)
-                       : this (left, name, null)
+               public MemberName (string name, Location loc)
                {
+                       this.Name = name;
+                       this.Location = loc;
+               }
+
+               public MemberName (MemberName left, string name, Location loc)
+                       : this (name, loc)
+               {
+                       this.Left = left;
                }
 
-               public MemberName (MemberName left, string name, TypeArguments args)
-                       : this (name, args)
+               public MemberName (MemberName left, string name, TypeArguments args, Location loc)
+                       : this (name, args, loc)
                {
                        this.Left = left;
                }
 
+               public MemberName (string alias, string name, Location loc)
+                       : this (new MemberName (alias, loc), name, true, null, loc)
+               {
+               }
+
                public MemberName (MemberName left, MemberName right)
-                       : this (left, right.Name, right.TypeArguments)
+                       : this (left, right, left != null ? left.Location : right != null ? right.Location : Location.Null)
                {
-                       Name = right.Name;
-                       Left = (right.Left == null) ? left : new MemberName (left, right.Left);
-                       TypeArguments = right.TypeArguments;
+               }
+
+               public MemberName (MemberName left, MemberName right, Location loc)
+                       : this (null, right.Name, false, right.TypeArguments, loc)
+               {
+                       if (right.is_double_colon)
+                               throw new InternalErrorException ("Cannot append double_colon member name");
+                       this.Left = (right.Left == null) ? left : new MemberName (left, right.Left);
                }
 
                static readonly char [] dot_array = { '.' };
 
-               public static MemberName FromDotted (string name)
+               public static MemberName FromDotted (string name, Location loc)
                {
                        string [] elements = name.Split (dot_array);
                        int count = elements.Length;
                        int i = 0;
-                       MemberName n = new MemberName (elements [i++]);
+                       MemberName n = new MemberName (elements [i++], loc);
                        while (i < count)
-                               n = new MemberName (n, elements [i++]);
+                               n = new MemberName (n, elements [i++], loc);
                        return n;
                }
 
                public string GetName ()
                {
+                       string connect = is_double_colon ? "::" : ".";
                        if (Left != null)
-                               return Left.GetName () + "." + Name;
+                               return Left.GetName () + connect + Name;
                        else
                                return Name;
                }
@@ -95,8 +121,9 @@ namespace Mono.CSharp {
                public string GetName (bool is_generic)
                {
                        string name = is_generic ? Basename : Name;
+                       string connect = is_double_colon ? "::" : ".";
                        if (Left != null)
-                               return Left.GetName (is_generic) + "." + name;
+                               return Left.GetName (is_generic) + connect + name;
                        else
                                return name;
                }
@@ -112,8 +139,9 @@ namespace Mono.CSharp {
 
                public string MethodName {
                        get {
+                               string connect = is_double_colon ? "::" : ".";
                                if (Left != null)
-                                       return Left.FullName + "." + Name;
+                                       return Left.FullName + connect + Name;
                                else
                                        return Name;
                        }
@@ -134,8 +162,9 @@ namespace Mono.CSharp {
 
                public string GetTypeName ()
                {
+                       string connect = is_double_colon ? "::" : ".";
                        if (Left != null)
-                               return Left.GetTypeName () + "." +
+                               return Left.GetTypeName () + connect +
                                        MakeName (Name, TypeArguments);
                        else
                                return MakeName (Name, TypeArguments);
@@ -164,33 +193,36 @@ namespace Mono.CSharp {
                        return true;
                }
 
-               public Expression GetTypeExpression (Location loc)
+               public Expression GetTypeExpression ()
                {
                        if (IsUnbound) {
-                               if (!CheckUnbound (loc))
+                               if (!CheckUnbound (Location))
                                        return null;
 
-                               return new UnboundTypeExpression (this, loc);
+                               return new UnboundTypeExpression (this, Location);
                        }
 
-                       if (Left != null) {
-                               Expression lexpr = Left.GetTypeExpression (loc);
-
-                               return new MemberAccess (lexpr, Name, TypeArguments, loc);
-                       } else {
+                       if (Left == null) {
                                if (TypeArguments != null)
-                                       return new SimpleName (Basename, TypeArguments, loc);
+                                       return new SimpleName (Basename, TypeArguments, Location);
                                else
-                                       return new SimpleName (Name, loc);
+                                       return new SimpleName (Name, Location);
                        }
+
+                       if (is_double_colon) {
+                               if (Left.Left != null)
+                                       throw new InternalErrorException ("The left side of a :: should be an identifier");
+                               return new QualifiedAliasMember (Left.Name, Name, Location);
+                       }
+
+                       Expression lexpr = Left.GetTypeExpression ();
+                       return new MemberAccess (lexpr, Name, TypeArguments, Location);
                }
 
                public MemberName Clone ()
                {
-                       if (Left != null)
-                               return new MemberName (Left.Clone (), Name, TypeArguments);
-                       else
-                               return new MemberName (Name, TypeArguments);
+                       MemberName left_clone = Left == null ? null : Left.Clone ();
+                       return new MemberName (left_clone, Name, is_double_colon, TypeArguments, Location);
                }
 
                public string Basename {
@@ -213,8 +245,9 @@ namespace Mono.CSharp {
 
                public override string ToString ()
                {
+                       string connect = is_double_colon ? "::" : ".";
                        if (Left != null)
-                               return Left.FullName + "." + FullName;
+                               return Left.FullName + connect + FullName;
                        else
                                return FullName;
                }
@@ -230,6 +263,8 @@ namespace Mono.CSharp {
                                return true;
                        if (other == null || Name != other.Name)
                                return false;
+                       if (is_double_colon != other.is_double_colon)
+                               return false;
 
                        if ((TypeArguments != null) &&
                            (other.TypeArguments == null || TypeArguments.Count != other.TypeArguments.Count))
@@ -249,6 +284,8 @@ namespace Mono.CSharp {
                        int hash = Name.GetHashCode ();
                        for (MemberName n = Left; n != null; n = n.Left)
                                hash ^= n.Name.GetHashCode ();
+                       if (is_double_colon)
+                               hash ^= 0xbadc01d;
 
                        if (TypeArguments != null)
                                hash ^= TypeArguments.Count << 5;
@@ -291,7 +328,9 @@ namespace Mono.CSharp {
                /// <summary>
                ///   Location where this declaration happens
                /// </summary>
-               public readonly Location Location;
+               public Location Location {
+                       get { return member_name.Location; }
+               }
 
                /// <summary>
                ///   XML documentation comment
@@ -326,8 +365,7 @@ namespace Mono.CSharp {
                /// </summary>
                internal Flags caching_flags;
 
-               public MemberCore (TypeContainer parent, MemberName name, Attributes attrs,
-                                  Location loc)
+               public MemberCore (TypeContainer parent, MemberName name, Attributes attrs)
                        : base (attrs)
                {
                        if (parent is PartialContainer && !(this is PartialContainer))
@@ -335,7 +373,6 @@ namespace Mono.CSharp {
 
                        Parent = parent;
                        member_name = name;
-                       Location = loc;
                        caching_flags = Flags.Obsolete_Undetected | Flags.ClsCompliance_Undetected | Flags.HasCompliantAttribute_Undetected | Flags.Excluded_Undetected;
                }
 
@@ -451,6 +488,19 @@ namespace Mono.CSharp {
                        return obsolete;
                }
 
+               /// <summary>
+               /// Checks for ObsoleteAttribute presence. It's used for testing of all non-types elements
+               /// </summary>
+               public void CheckObsoleteness (Location loc)
+               {
+                       ObsoleteAttribute oa = GetObsoleteAttribute (Parent);
+                       if (oa == null) {
+                               return;
+                       }
+
+                       AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc);
+               }
+
                /// <summary>
                /// Analyze whether CLS-Compliant verification must be execute for this MemberCore.
                /// </summary>
@@ -646,8 +696,8 @@ namespace Mono.CSharp {
                static string[] attribute_targets = new string [] { "type" };
 
                public DeclSpace (NamespaceEntry ns, TypeContainer parent, MemberName name,
-                                 Attributes attrs, Location l)
-                       : base (parent, name, attrs, l)
+                                 Attributes attrs)
+                       : base (parent, name, attrs)
                {
                        NamespaceEntry = ns;
                        Basename = name.Basename;
@@ -1339,6 +1389,9 @@ namespace Mono.CSharp {
                                Report.SymbolRelatedToPreviousError (t);
                        }
                        else {
+                               if (val is PartialContainer)
+                                       return true;
+
                                Report.SymbolRelatedToPreviousError ((DeclSpace)val);
                        }
                        Report.Warning (3005, Location, "Identifier `{0}' differing only in case is not CLS-compliant", GetSignatureForError ());
index ea11d0b8680439846f437c299af5da21bd073689..57999dc8dd705fa127ef11a20c2ee907874c906f 100644 (file)
@@ -50,14 +50,14 @@ namespace Mono.CSharp {
 
                public Delegate (NamespaceEntry ns, TypeContainer parent, Expression type,
                                 int mod_flags, MemberName name, Parameters param_list,
-                                Attributes attrs, Location l)
-                       : base (ns, parent, name, attrs, l)
+                                Attributes attrs)
+                       : base (ns, parent, name, attrs)
 
                {
                        this.ReturnType = type;
                        ModFlags        = Modifiers.Check (AllowedModifiers, mod_flags,
                                                           IsTopLevel ? Modifiers.INTERNAL :
-                                                          Modifiers.PRIVATE, l);
+                                                          Modifiers.PRIVATE, name.Location);
                        Parameters      = param_list;
                }
 
@@ -859,7 +859,8 @@ namespace Mono.CSharp {
                                delegate_instance_expression = ec.GetThis (loc);
 
                        if (delegate_instance_expression != null && delegate_instance_expression.Type.IsValueType)
-                               delegate_instance_expression = new BoxedCast (delegate_instance_expression);
+                               delegate_instance_expression = new BoxedCast (
+                                       delegate_instance_expression, TypeManager.object_type);
 
                        method_group = mg;
                        eclass = ExprClass.Value;
index 604672b12184fa7c176dab40047112c853e2e91f..dd9bf36120bf9ea8f1e65728afa22bc5a2bac99c 100644 (file)
@@ -738,16 +738,6 @@ namespace Mono.CSharp {
                        }
                }
 
-               // Enum
-               public static void GenerateEnumDocComment (Enum e, DeclSpace ds)
-               {
-                       GenerateDocComment (e, ds);
-                       foreach (string name in e.ordered_enums) {
-                               MemberCore mc = e.GetDefinition (name);
-                               GenerateDocComment (mc, e);
-                       }
-               }
-
                private static void Normalize (MemberCore mc, ref string name)
                {
                        if (name.Length > 0 && name [0] == '@')
@@ -881,10 +871,12 @@ namespace Mono.CSharp {
 
                        if (root.Enums != null)
                                foreach (Enum e in root.Enums)
-                                       DocUtil.GenerateEnumDocComment (e, null);
+                                       e.GenerateDocComment (null);
 
                        IDictionary table = new ListDictionary ();
                        foreach (ClassPart cp in PartialComments.Keys) {
+                               // FIXME: IDictionary does not guarantee that the keys will be
+                               //        accessed in the order they were added.
                                table [cp.PartialContainer] += cp.DocComment;
                        }
                        foreach (PartialContainer pc in table.Keys) {
index 58aa1702476a53a02930b80ec3cfae253642af9f..5b341b3e7af1dbe3ad7c3d2f0c618c2924f83541 100644 (file)
@@ -193,6 +193,7 @@ namespace Mono.CSharp
                        reader.Position = 0;
                        parser = new CSharpParser (reader, file, defines);
                        parser.ErrorOutput = Report.Stderr;
+#if FIXME
                        try {
                                parser.parse ();
                        } catch (Exception ex) {
@@ -200,6 +201,13 @@ namespace Mono.CSharp
                        } finally {
                                input.Close ();
                        }
+#else
+                       try {
+                               parser.parse ();
+                       } finally {
+                               input.Close ();
+                       }
+#endif
                }
                
                static void OtherFlags ()
@@ -1310,7 +1318,7 @@ namespace Mono.CSharp
                                default:
                                        try {
                                                encoding = Encoding.GetEncoding (
-                                                       Int32.Parse (value));
+                                               Int32.Parse (value));
                                        } catch {
                                                Report.Error (2016, "Code page `{0}' is invalid or not installed", value);
                                        }
@@ -1649,7 +1657,7 @@ namespace Mono.CSharp
 
                                if (ep == null) {
                                        if (RootContext.MainClass != null) {
-                                               DeclSpace main_cont = RootContext.Tree.GetDecl (MemberName.FromDotted (RootContext.MainClass));
+                                               DeclSpace main_cont = RootContext.Tree.GetDecl (MemberName.FromDotted (RootContext.MainClass, Location.Null));
                                                if (main_cont == null) {
                                                        Report.Error (1555, "Could not find `{0}' specified for Main method", RootContext.MainClass); 
                                                        return false;
index 35dd433aeaf30da313e93100553d8d73ea8df1bc..3d4786437d3a1dc56537c96eb66eb7a1f6286b47 100644 (file)
@@ -59,7 +59,12 @@ namespace Mono.CSharp {
                DisableFlowAnalysis     = 8,
 
                // Set if this is resolving the first part of a MemberAccess.
-               Intermediate            = 16
+               Intermediate            = 16,
+
+               // Disable control flow analysis _of struct_ while resolving the expression.
+               // This is used when resolving the instance expression of a field expression.
+               DisableStructFlowAnalysis       = 32,
+
        }
 
        //
@@ -123,10 +128,10 @@ namespace Mono.CSharp {
                /// </summary>
                public void Error (int error, string s)
                {
-                       if (!Location.IsNull (loc))
-                               Report.Error (error, loc, s);
-                       else
+                       if (loc.IsNull)
                                Report.Error (error, s);
+                       else
+                               Report.Error (error, loc, s);
                }
 
                /// <summary>
@@ -287,6 +292,17 @@ namespace Mono.CSharp {
                        Report.Error (122, loc, "`{0}' is inaccessible due to its protection level", name);
                }
 
+               public virtual void Error_ValueCannotBeConverted (Location loc, Type t)
+               {
+                       Convert.Error_CannotImplicitConversion (loc, Type, t);
+               }
+
+               protected static void Error_TypeDoesNotContainDefinition (Location loc, Type type, string name)
+               {
+                       Report.Error (117, loc, "`{0}' does not contain a definition for `{1}'",
+                               TypeManager.CSharpName (type), name);
+               }
+
                ResolveFlags ExprClassToResolveFlags ()
                {
                        switch (eclass) {
@@ -325,8 +341,11 @@ namespace Mono.CSharp {
                                return ResolveAsTypeStep (ec, false);
 
                        bool old_do_flow_analysis = ec.DoFlowAnalysis;
+                       bool old_omit_struct_analysis = ec.OmitStructFlowAnalysis;
                        if ((flags & ResolveFlags.DisableFlowAnalysis) != 0)
                                ec.DoFlowAnalysis = false;
+                       if ((flags & ResolveFlags.DisableStructFlowAnalysis) != 0)
+                               ec.OmitStructFlowAnalysis = true;
 
                        Expression e;
                        bool intermediate = (flags & ResolveFlags.Intermediate) == ResolveFlags.Intermediate;
@@ -337,6 +356,7 @@ namespace Mono.CSharp {
                                e = DoResolve (ec);
 
                        ec.DoFlowAnalysis = old_do_flow_analysis;
+                       ec.OmitStructFlowAnalysis = old_omit_struct_analysis;
 
                        if (e == null)
                                return null;
@@ -370,6 +390,31 @@ namespace Mono.CSharp {
                        return e;
                }
 
+               public Constant ResolveAsConstant (EmitContext ec, MemberCore mc)
+               {
+                       Expression e = Resolve (ec);
+                       if (e != null) {
+                               Constant c = e as Constant;
+                               if (c != null)
+                                       return c;
+
+                               EmptyCast empty = e as EmptyCast;
+                               if (empty != null) {
+                                       c = empty.Child as Constant;
+                                       if (c != null) {
+                                               // TODO: not sure about this maybe there is easier way how to use EmptyCast
+                                               if (e.Type.IsEnum)
+                                                       c.Type = e.Type;
+
+                                               return c;
+                                       }
+                               }
+                       }
+
+                       Const.Error_ExpressionMustBeConstant (loc, mc.GetSignatureForError ());
+                       return null;
+               }
+
                /// <summary>
                ///   Resolves an expression for LValue assignment
                /// </summary>
@@ -495,6 +540,8 @@ namespace Mono.CSharp {
                /// <summary>
                ///   Returns a fully formed expression after a MemberLookup
                /// </summary>
+               /// 
+               // TODO: This can be heavily cached
                public static Expression ExprClassFromMemberInfo (EmitContext ec, MemberInfo mi, Location loc)
                {
                        if (mi is EventInfo)
@@ -706,9 +753,7 @@ namespace Mono.CSharp {
                                        Report.Error (103, loc, "The name `{0}' does not exist in the context of `{1}'",
                                                name, class_name);
                                else
-                                       Report.Error (
-                                               117, loc, "`" + TypeManager.CSharpName (queried_type) + "' does not contain a " +
-                                               "definition for `" + name + "'");
+                                       Error_TypeDoesNotContainDefinition (loc, queried_type, name);
                                return;
                        }
 
@@ -890,268 +935,6 @@ namespace Mono.CSharp {
                {
                        Report.Error (214, loc, "Pointers and fixed size buffers may only be used in an unsafe context");
                }
-               
-               /// <summary>
-               ///   Converts the IntConstant, UIntConstant, LongConstant or
-               ///   ULongConstant into the integral target_type.   Notice
-               ///   that we do not return an `Expression' we do return
-               ///   a boxed integral type.
-               ///
-               ///   FIXME: Since I added the new constants, we need to
-               ///   also support conversions from CharConstant, ByteConstant,
-               ///   SByteConstant, UShortConstant, ShortConstant
-               ///
-               ///   This is used by the switch statement, so the domain
-               ///   of work is restricted to the literals above, and the
-               ///   targets are int32, uint32, char, byte, sbyte, ushort,
-               ///   short, uint64 and int64
-               /// </summary>
-               public static object ConvertIntLiteral (Constant c, Type target_type, Location loc)
-               {
-                       if (!Convert.ImplicitStandardConversionExists (Convert.ConstantEC, c, target_type)){
-                               Convert.Error_CannotImplicitConversion (loc, c.Type, target_type);
-                               return null;
-                       }
-                       
-                       if (c.Type == target_type)
-                               return ((Constant) c).GetValue ();
-
-                       //
-                       // Make into one of the literals we handle, we dont really care
-                       // about this value as we will just return a few limited types
-                       // 
-                       if (c is EnumConstant)
-                               c = ((EnumConstant)c).WidenToCompilerConstant ();
-
-                       if (c is IntConstant){
-                               int v = ((IntConstant) c).Value;
-                               
-                               if (target_type == TypeManager.uint32_type){
-                                       if (v >= 0)
-                                               return (uint) v;
-                               } else if (target_type == TypeManager.char_type){
-                                       if (v >= Char.MinValue && v <= Char.MaxValue)
-                                               return (char) v;
-                               } else if (target_type == TypeManager.byte_type){
-                                       if (v >= Byte.MinValue && v <= Byte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.sbyte_type){
-                                       if (v >= SByte.MinValue && v <= SByte.MaxValue)
-                                               return (sbyte) v;
-                               } else if (target_type == TypeManager.short_type){
-                                       if (v >= Int16.MinValue && v <= UInt16.MaxValue)
-                                               return (short) v;
-                               } else if (target_type == TypeManager.ushort_type){
-                                       if (v >= UInt16.MinValue && v <= UInt16.MaxValue)
-                                               return (ushort) v;
-                               } else if (target_type == TypeManager.int64_type)
-                                       return (long) v;
-                               else if (target_type == TypeManager.uint64_type){
-                                       if (v > 0)
-                                               return (ulong) v;
-                               }
-
-                       } else if (c is UIntConstant){
-                               uint v = ((UIntConstant) c).Value;
-
-                               if (target_type == TypeManager.int32_type){
-                                       if (v <= Int32.MaxValue)
-                                               return (int) v;
-                               } else if (target_type == TypeManager.char_type){
-                                       if (v >= Char.MinValue && v <= Char.MaxValue)
-                                               return (char) v;
-                               } else if (target_type == TypeManager.byte_type){
-                                       if (v <= Byte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.sbyte_type){
-                                       if (v <= SByte.MaxValue)
-                                               return (sbyte) v;
-                               } else if (target_type == TypeManager.short_type){
-                                       if (v <= UInt16.MaxValue)
-                                               return (short) v;
-                               } else if (target_type == TypeManager.ushort_type){
-                                       if (v <= UInt16.MaxValue)
-                                               return (ushort) v;
-                               } else if (target_type == TypeManager.int64_type)
-                                       return (long) v;
-                               else if (target_type == TypeManager.uint64_type)
-                                       return (ulong) v;
-                       } else if (c is LongConstant){ 
-                               long v = ((LongConstant) c).Value;
-
-                               if (target_type == TypeManager.int32_type){
-                                       if (v >= UInt32.MinValue && v <= UInt32.MaxValue)
-                                               return (int) v;
-                               } else if (target_type == TypeManager.uint32_type){
-                                       if (v >= 0 && v <= UInt32.MaxValue)
-                                               return (uint) v;
-                               } else if (target_type == TypeManager.char_type){
-                                       if (v >= Char.MinValue && v <= Char.MaxValue)
-                                               return (char) v;
-                               } else if (target_type == TypeManager.byte_type){
-                                       if (v >= Byte.MinValue && v <= Byte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.sbyte_type){
-                                       if (v >= SByte.MinValue && v <= SByte.MaxValue)
-                                               return (sbyte) v;
-                               } else if (target_type == TypeManager.short_type){
-                                       if (v >= Int16.MinValue && v <= UInt16.MaxValue)
-                                               return (short) v;
-                               } else if (target_type == TypeManager.ushort_type){
-                                       if (v >= UInt16.MinValue && v <= UInt16.MaxValue)
-                                               return (ushort) v;
-                               } else if (target_type == TypeManager.uint64_type){
-                                       if (v > 0)
-                                               return (ulong) v;
-                               }
-                       } else if (c is ULongConstant){
-                               ulong v = ((ULongConstant) c).Value;
-
-                               if (target_type == TypeManager.int32_type){
-                                       if (v <= Int32.MaxValue)
-                                               return (int) v;
-                               } else if (target_type == TypeManager.uint32_type){
-                                       if (v <= UInt32.MaxValue)
-                                               return (uint) v;
-                               } else if (target_type == TypeManager.char_type){
-                                       if (v >= Char.MinValue && v <= Char.MaxValue)
-                                               return (char) v;
-                               } else if (target_type == TypeManager.byte_type){
-                                       if (v >= Byte.MinValue && v <= Byte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.sbyte_type){
-                                       if (v <= (int) SByte.MaxValue)
-                                               return (sbyte) v;
-                               } else if (target_type == TypeManager.short_type){
-                                       if (v <= UInt16.MaxValue)
-                                               return (short) v;
-                               } else if (target_type == TypeManager.ushort_type){
-                                       if (v <= UInt16.MaxValue)
-                                               return (ushort) v;
-                               } else if (target_type == TypeManager.int64_type){
-                                       if (v <= Int64.MaxValue)
-                                               return (long) v;
-                               }
-                       } else if (c is ByteConstant){
-                               byte v = ((ByteConstant) c).Value;
-                               
-                               if (target_type == TypeManager.int32_type)
-                                       return (int) v;
-                               else if (target_type == TypeManager.uint32_type)
-                                       return (uint) v;
-                               else if (target_type == TypeManager.char_type)
-                                       return (char) v;
-                               else if (target_type == TypeManager.sbyte_type){
-                                       if (v <= SByte.MaxValue)
-                                               return (sbyte) v;
-                               } else if (target_type == TypeManager.short_type)
-                                       return (short) v;
-                               else if (target_type == TypeManager.ushort_type)
-                                       return (ushort) v;
-                               else if (target_type == TypeManager.int64_type)
-                                       return (long) v;
-                               else if (target_type == TypeManager.uint64_type)
-                                       return (ulong) v;
-                       } else if (c is SByteConstant){
-                               sbyte v = ((SByteConstant) c).Value;
-                               
-                               if (target_type == TypeManager.int32_type)
-                                       return (int) v;
-                               else if (target_type == TypeManager.uint32_type){
-                                       if (v >= 0)
-                                               return (uint) v;
-                               } else if (target_type == TypeManager.char_type){
-                                       if (v >= 0)
-                                               return (char) v;
-                               } else if (target_type == TypeManager.byte_type){
-                                       if (v >= 0)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.short_type)
-                                       return (short) v;
-                               else if (target_type == TypeManager.ushort_type){
-                                       if (v >= 0)
-                                               return (ushort) v;
-                               } else if (target_type == TypeManager.int64_type)
-                                       return (long) v;
-                               else if (target_type == TypeManager.uint64_type){
-                                       if (v >= 0)
-                                               return (ulong) v;
-                               }
-                       } else if (c is ShortConstant){
-                               short v = ((ShortConstant) c).Value;
-                               
-                               if (target_type == TypeManager.int32_type){
-                                       return (int) v;
-                               } else if (target_type == TypeManager.uint32_type){
-                                       if (v >= 0)
-                                               return (uint) v;
-                               } else if (target_type == TypeManager.char_type){
-                                       if (v >= 0)
-                                               return (char) v;
-                               } else if (target_type == TypeManager.byte_type){
-                                       if (v >= Byte.MinValue && v <= Byte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.sbyte_type){
-                                       if (v >= SByte.MinValue && v <= SByte.MaxValue)
-                                               return (sbyte) v;
-                               } else if (target_type == TypeManager.ushort_type){
-                                       if (v >= 0)
-                                               return (ushort) v;
-                               } else if (target_type == TypeManager.int64_type)
-                                       return (long) v;
-                               else if (target_type == TypeManager.uint64_type)
-                                       return (ulong) v;
-                       } else if (c is UShortConstant){
-                               ushort v = ((UShortConstant) c).Value;
-                               
-                               if (target_type == TypeManager.int32_type)
-                                       return (int) v;
-                               else if (target_type == TypeManager.uint32_type)
-                                       return (uint) v;
-                               else if (target_type == TypeManager.char_type){
-                                       if (v >= Char.MinValue && v <= Char.MaxValue)
-                                               return (char) v;
-                               } else if (target_type == TypeManager.byte_type){
-                                       if (v >= Byte.MinValue && v <= Byte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.sbyte_type){
-                                       if (v <= SByte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.short_type){
-                                       if (v <= Int16.MaxValue)
-                                               return (short) v;
-                               } else if (target_type == TypeManager.int64_type)
-                                       return (long) v;
-                               else if (target_type == TypeManager.uint64_type)
-                                       return (ulong) v;
-
-                       } else if (c is CharConstant){
-                               char v = ((CharConstant) c).Value;
-                               
-                               if (target_type == TypeManager.int32_type)
-                                       return (int) v;
-                               else if (target_type == TypeManager.uint32_type)
-                                       return (uint) v;
-                               else if (target_type == TypeManager.byte_type){
-                                       if (v >= Byte.MinValue && v <= Byte.MaxValue)
-                                               return (byte) v;
-                               } else if (target_type == TypeManager.sbyte_type){
-                                       if (v <= SByte.MaxValue)
-                                               return (sbyte) v;
-                               } else if (target_type == TypeManager.short_type){
-                                       if (v <= Int16.MaxValue)
-                                               return (short) v;
-                               } else if (target_type == TypeManager.ushort_type)
-                                       return (short) v;
-                               else if (target_type == TypeManager.int64_type)
-                                       return (long) v;
-                               else if (target_type == TypeManager.uint64_type)
-                                       return (ulong) v;
-
-                       }
-                       c.Error_ConstantValueCannotBeConverted (loc, target_type);
-                       return null;
-               }
 
                //
                // Load the object from the pointer.  
@@ -1523,6 +1306,11 @@ namespace Mono.CSharp {
                        child.Emit (ec);
                }
 
+               public override Constant Increment ()
+               {
+                       throw new NotSupportedException ();
+               }
+
                public override bool IsDefaultValue {
                        get {
                                throw new NotImplementedException ();
@@ -1568,69 +1356,21 @@ namespace Mono.CSharp {
                        return Child.GetValue ();
                }
 
-               public object GetValueAsEnumType ()
+               public override object GetTypedValue ()
                {
+                       // FIXME: runtime is not ready to work with just emited enums
+                       if (!RootContext.StdLib) {
+                               return Child.GetValue ();
+                       }
+
                        return System.Enum.ToObject (type, Child.GetValue ());
                }
-
-               //
-               // Converts from one of the valid underlying types for an enumeration
-               // (int32, uint32, int64, uint64, short, ushort, byte, sbyte) to
-               // one of the internal compiler literals: Int/UInt/Long/ULong Literals.
-               //
-               public Constant WidenToCompilerConstant ()
+               
+               public override void Error_ValueCannotBeConverted (Location loc, Type t)
                {
-                       Type t = TypeManager.EnumToUnderlying (Child.Type);
-                       object v = ((Constant) Child).GetValue ();;
-                       
-                       if (t == TypeManager.int32_type)
-                               return new IntConstant ((int) v);
-                       if (t == TypeManager.uint32_type)
-                               return new UIntConstant ((uint) v);
-                       if (t == TypeManager.int64_type)
-                               return new LongConstant ((long) v);
-                       if (t == TypeManager.uint64_type)
-                               return new ULongConstant ((ulong) v);
-                       if (t == TypeManager.short_type)
-                               return new ShortConstant ((short) v);
-                       if (t == TypeManager.ushort_type)
-                               return new UShortConstant ((ushort) v);
-                       if (t == TypeManager.byte_type)
-                               return new ByteConstant ((byte) v);
-                       if (t == TypeManager.sbyte_type)
-                               return new SByteConstant ((sbyte) v);
-
-                       throw new Exception ("Invalid enumeration underlying type: " + t);
+                       Convert.Error_CannotImplicitConversion (loc, Type, t);
                }
 
-               //
-               // Extracts the value in the enumeration on its native representation
-               //
-               public object GetPlainValue ()
-               {
-                       Type t = TypeManager.EnumToUnderlying (Child.Type);
-                       object v = ((Constant) Child).GetValue ();;
-                       
-                       if (t == TypeManager.int32_type)
-                               return (int) v;
-                       if (t == TypeManager.uint32_type)
-                               return (uint) v;
-                       if (t == TypeManager.int64_type)
-                               return (long) v;
-                       if (t == TypeManager.uint64_type)
-                               return (ulong) v;
-                       if (t == TypeManager.short_type)
-                               return (short) v;
-                       if (t == TypeManager.ushort_type)
-                               return (ushort) v;
-                       if (t == TypeManager.byte_type)
-                               return (byte) v;
-                       if (t == TypeManager.sbyte_type)
-                               return (sbyte) v;
-
-                       return null;
-               }
-               
                public override string AsString ()
                {
                        return Child.AsString ();
@@ -1666,6 +1406,11 @@ namespace Mono.CSharp {
                        return Child.ConvertToInt ();
                }
 
+               public override Constant Increment()
+               {
+                       return new EnumConstant (Child.Increment (), type);
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return Child.IsDefaultValue;
@@ -1681,6 +1426,27 @@ namespace Mono.CSharp {
                                return Child.IsNegative;
                        }
                }
+
+               public override Constant ToType (Type type, Location loc)
+               {
+                       if (Type == type) {
+                               // This is workaround of mono bug. It can be removed when the latest corlib spreads enough
+                               if (TypeManager.IsEnumType (type.UnderlyingSystemType))
+                                       return this;
+
+                               if (type.UnderlyingSystemType != Child.Type)
+                                       Child = Child.ToType (type.UnderlyingSystemType, loc);
+                               return this;
+                       }
+
+                       if (!Convert.ImplicitStandardConversionExists (Convert.ConstantEC, this, type)){
+                               Error_ValueCannotBeConverted (loc, type);
+                               return null;
+                       }
+
+                       return Child.ToType (type, loc);
+               }
+
        }
 
        /// <summary>
@@ -1691,12 +1457,6 @@ namespace Mono.CSharp {
        /// </summary>
        public class BoxedCast : EmptyCast {
 
-               public BoxedCast (Expression expr)
-                       : base (expr, TypeManager.object_type) 
-               {
-                       eclass = ExprClass.Value;
-               }
-
                public BoxedCast (Expression expr, Type target_type)
                        : base (expr, target_type)
                {
@@ -2287,14 +2047,15 @@ namespace Mono.CSharp {
                        if (current_block != null){
                                LocalInfo vi = current_block.GetLocalInfo (Name);
                                if (vi != null){
-                                       Expression var;
-                                       
-                                       var = new LocalVariableReference (ec.CurrentBlock, Name, loc);
-                                       
-                                       if (right_side != null)
+                                       LocalVariableReference var = new LocalVariableReference (ec.CurrentBlock, Name, loc);
+                                       if (right_side != null) {
                                                return var.ResolveLValue (ec, right_side, loc);
-                                       else
-                                               return var.Resolve (ec);
+                                       } else {
+                                               ResolveFlags rf = ResolveFlags.VariableOrValue;
+                                               if (intermediate)
+                                                       rf |= ResolveFlags.DisableFlowAnalysis;
+                                               return var.Resolve (ec, rf);
+                                       }
                                }
 
                                ParameterReference pref = current_block.Toplevel.GetParameterReference (Name, loc);
@@ -2674,7 +2435,7 @@ namespace Mono.CSharp {
                {
                        Expression expr;
                        if (name.Left != null) {
-                               Expression lexpr = name.Left.GetTypeExpression (loc);
+                               Expression lexpr = name.Left.GetTypeExpression ();
                                expr = new MemberAccess (lexpr, name.Basename, loc);
                        } else {
                                expr = new SimpleName (name.Basename, loc);
@@ -3096,7 +2857,7 @@ namespace Mono.CSharp {
                                if (gen_params.Length != atypes.Length)
                                        continue;
 
-                               list.Add (mi.BindGenericParameters (atypes));
+                               list.Add (mi.MakeGenericMethod (atypes));
                        }
 
                        if (list.Count > 0) {
@@ -3183,39 +2944,31 @@ namespace Mono.CSharp {
                public override Expression ResolveMemberAccess (EmitContext ec, Expression left, Location loc,
                                                                SimpleName original)
                {
-                       bool left_is_type = left is TypeExpr;
-
                        FieldInfo fi = FieldInfo.Mono_GetGenericFieldDefinition ();
 
-                       Type decl_type = fi.DeclaringType;
-                       
-                       bool is_emitted = fi is FieldBuilder;
-                       Type t = fi.FieldType;
-                       
-                       if (is_emitted) {
-                               Const c = TypeManager.LookupConstant ((FieldBuilder) fi);
-                               
-                               if (c != null) {
-                                       object o;
-                                       if (!c.LookupConstantValue (out o))
-                                               return null;
-
-                                       c.SetMemberIsUsed ();
-                                       object real_value = ((Constant) c.Expr).GetValue ();
+                       if (fi.IsLiteral) {
+                               IConstant ic = TypeManager.GetConstant (fi);
+                               if (ic == null) {
+                                       ic = new ExternalConstant (fi);
+                                       TypeManager.RegisterConstant (fi, ic);
+                               }
 
-                                       Expression exp = Constantify (real_value, t);
-                                       
-                                       if (!left_is_type && 
-                                           (original == null || !original.IdenticalNameAndTypeName (ec, left, loc))) {
-                                               Report.SymbolRelatedToPreviousError (c);
-                                               error176 (loc, c.GetSignatureForError ());
-                                               return null;
-                                       }
-                                       
-                                       return exp;
+                               bool left_is_type = left is TypeExpr;
+                               if (!left_is_type && (original == null || !original.IdenticalNameAndTypeName (ec, left, loc))) {
+                                       Report.SymbolRelatedToPreviousError (FieldInfo);
+                                       error176 (loc, TypeManager.GetFullNameSignature (FieldInfo));
+                                       return null;
                                }
+
+                               if (ic.ResolveValue ())
+                                       ic.CheckObsoleteness (loc);
+
+                               return ic.Value;
                        }
 
+                       bool is_emitted = fi is FieldBuilder;
+                       Type t = fi.FieldType;
+                       
                        //
                        // Decimal constants cannot be encoded in the constant blob, and thus are marked
                        // as IsInitOnly ('readonly' in C# parlance).  We get its value from the 
@@ -3227,46 +2980,6 @@ namespace Mono.CSharp {
                                        return new DecimalConstant (((System.Runtime.CompilerServices.DecimalConstantAttribute) attrs [0]).Value);
                        }
                        
-                       if (fi.IsLiteral) {
-                               object o;
-
-                               if (is_emitted)
-                                       o = TypeManager.GetValue ((FieldBuilder) fi);
-                               else
-                                       o = fi.GetValue (fi);
-                               
-                               if (decl_type.IsSubclassOf (TypeManager.enum_type)) {
-                                       if (!left_is_type &&
-                                           (original == null || !original.IdenticalNameAndTypeName (ec, left, loc))) {
-                                               error176 (loc, TypeManager.GetFullNameSignature (FieldInfo));
-                                               return null;
-                                       }                                       
-                                       
-                                       Expression enum_member = MemberLookup (
-                                              ec, decl_type, "value__", MemberTypes.Field,
-                                              AllBindingFlags | BindingFlags.NonPublic, loc); 
-                                       
-                                       Enum en = TypeManager.LookupEnum (decl_type);
-                                       
-                                       Constant c;
-                                       if (en != null)
-                                               c = Constantify (o, en.UnderlyingType);
-                                       else 
-                                               c = Constantify (o, enum_member.Type);
-                                       
-                                       return new EnumConstant (c, decl_type);
-                               }
-
-                               Expression exp = Constantify (o, t);
-                               
-                               if (!left_is_type) {
-                                       error176 (loc, TypeManager.GetFullNameSignature (FieldInfo));
-                                       return null;
-                               }
-                               
-                               return exp;
-                       }
-                       
                        if (t.IsPointer && !ec.InUnsafe) {
                                UnsafeError (loc);
                                return null;
@@ -3319,9 +3032,7 @@ namespace Mono.CSharp {
                                ObsoleteAttribute oa;
                                FieldBase f = TypeManager.GetField (FieldInfo);
                                if (f != null) {
-                                       oa = f.GetObsoleteAttribute (f.Parent);
-                                       if (oa != null)
-                                               AttributeTester.Report_ObsoleteMessage (oa, f.GetSignatureForError (), loc);
+                                       f.CheckObsoleteness (loc);
                                        // To be sure that type is external because we do not register generated fields
                                } else if (!(FieldInfo.DeclaringType is TypeBuilder)) {                                
                                        oa = AttributeTester.GetMemberObsoleteAttribute (FieldInfo);
@@ -3780,6 +3491,26 @@ namespace Mono.CSharp {
 
                        return true;
                }
+
+               void Error_PropertyNotFound (MethodInfo mi, bool getter)
+               {
+                       // TODO: correctly we should compare arguments but it will lead to bigger changes
+                       if (mi is MethodBuilder) {
+                               Error_TypeDoesNotContainDefinition (loc, PropertyInfo.DeclaringType, Name);
+                               return;
+                       }
+
+                       StringBuilder sig = new StringBuilder (TypeManager.CSharpName (mi.DeclaringType));
+                       sig.Append ('.');
+                       ParameterData iparams = TypeManager.GetParameterData (mi);
+                       sig.Append (getter ? "get_" : "set_");
+                       sig.Append (Name);
+                       sig.Append (iparams.GetSignatureForError ());
+
+                       Report.SymbolRelatedToPreviousError (mi);
+                       Report.Error (1546, loc, "Property `{0}' is not supported by the C# language. Try to call the accessor method `{1}' directly",
+                               Name, sig.ToString ());
+               }
                
                override public Expression DoResolve (EmitContext ec)
                {
@@ -3788,10 +3519,7 @@ namespace Mono.CSharp {
 
                        if (getter != null){
                                if (TypeManager.GetArgumentTypes (getter).Length != 0){
-                                       Report.Error (
-                                               117, loc, "`{0}' does not contain a " +
-                                               "definition for `{1}'.", getter.DeclaringType,
-                                               Name);
+                                       Error_PropertyNotFound (getter, true);
                                        return null;
                                }
                        }
@@ -3866,10 +3594,7 @@ namespace Mono.CSharp {
                        }
 
                        if (TypeManager.GetArgumentTypes (setter).Length != 1){
-                               Report.Error (
-                                       117, loc, "`{0}' does not contain a " +
-                                       "definition for `{1}'.", getter.DeclaringType,
-                                       Name);
+                               Error_PropertyNotFound (setter, false);
                                return null;
                        }
 
index 0c92c6ad00322e86416727db3adf12d4677560bb..2561d5087daaa4fd6f3a5692377c9c6401fff699 100644 (file)
@@ -20,20 +20,26 @@ using System.Xml;
 
 namespace Mono.CSharp {
 
-       class EnumMember: MemberCore {
+       public class EnumMember: MemberCore, IConstant {
                static string[] attribute_targets = new string [] { "field" };
 
-               Enum parent_enum;
                public FieldBuilder builder;
-               internal readonly Expression Type;
 
-               public EnumMember (Enum parent_enum, Expression expr, string name,
-                                  Location loc, Attributes attrs):
-                       base (null, new MemberName (name), attrs, loc)
+               readonly Enum parent_enum;
+               readonly Expression ValueExpr;
+               readonly EnumMember prev_member;
+
+               Constant value;
+               bool in_transit;
+
+               public EnumMember (Enum parent_enum, EnumMember prev_member, Expression expr,
+                               MemberName name, Attributes attrs):
+                       base (parent_enum.Parent, name, attrs)
                {
                        this.parent_enum = parent_enum;
                        this.ModFlags = parent_enum.ModFlags;
-                       this.Type = expr;
+                       this.ValueExpr = expr;
+                       this.prev_member = prev_member;
                }
 
                public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
@@ -60,17 +66,81 @@ namespace Mono.CSharp {
                        }
                }
 
-               public void DefineMember (TypeBuilder tb)
+               bool IsValidEnumType (Type t)
+               {
+                       return (t == TypeManager.int32_type || t == TypeManager.uint32_type || t == TypeManager.int64_type ||
+                               t == TypeManager.byte_type || t == TypeManager.sbyte_type || t == TypeManager.short_type ||
+                               t == TypeManager.ushort_type || t == TypeManager.uint64_type || t == TypeManager.char_type ||
+                               t.IsEnum);
+               }
+       
+               public override bool Define ()
                {
-                       FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static
-                               | FieldAttributes.Literal;
-                       
+                       const FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal;
+                       TypeBuilder tb = parent_enum.TypeBuilder;
                        builder = tb.DefineField (Name, tb, attr);
+
+                       TypeManager.RegisterConstant (builder, this);
+                       return true;
                }
 
-               public override bool Define ()
+               public bool ResolveValue ()
                {
-                       throw new NotImplementedException ();
+                       if (value != null)
+                               return true;
+
+                       if (in_transit) {
+                               // suppress cyclic errors
+                               value = new EnumConstant (New.Constantify (parent_enum.UnderlyingType), parent_enum.TypeBuilder);
+                               Const.Error_CyclicDeclaration (this);
+                               return false;
+                       }
+
+                       if (ValueExpr != null) {
+                               in_transit = true;
+
+                               Constant c = ValueExpr.ResolveAsConstant (parent_enum.EmitContext, this);
+                               if (c == null)
+                                       return false;
+
+                               if (c is EnumConstant)
+                                       c = ((EnumConstant)c).Child;
+                                       
+                               c = c.ToType (parent_enum.UnderlyingType, Location);
+                               if (c == null)
+                                       return false;
+
+                               if (!IsValidEnumType (c.Type)) {
+                                       Report.Error (1008, Location, "Type byte, sbyte, short, ushort, int, uint, long or ulong expected");
+                                       return false;
+                               }
+
+                               in_transit = false;
+                               value = new EnumConstant (c, parent_enum.TypeBuilder);
+                               return true;
+                       }
+
+                       if (prev_member == null) {
+                               value = new EnumConstant (New.Constantify (parent_enum.UnderlyingType), parent_enum.TypeBuilder);
+                               return true;
+                       }
+
+                       if (!prev_member.ResolveValue ())
+                               return false;
+
+                       in_transit = true;
+
+                       try {
+                               value = prev_member.value.Increment ();
+                       }
+                       catch (OverflowException) {
+                               Report.Error (543, Location, "The enumerator value `{0}' is too large to fit in its type `{1}'",
+                                       GetSignatureForError (), TypeManager.CSharpName (parent_enum.UnderlyingType));
+                               return false;
+                       }
+                       in_transit = false;
+
+                       return true;
                }
 
                public void Emit (EmitContext ec)
@@ -78,12 +148,15 @@ namespace Mono.CSharp {
                        if (OptAttributes != null)
                                OptAttributes.Emit (ec, this); 
 
+                       if (ResolveValue ())
+                               builder.SetConstant (value.GetValue ());
+
                        Emit ();
                }
 
                public override string GetSignatureForError()
                {
-                       return String.Concat (parent_enum.GetSignatureForError (), '.', base.GetSignatureForError ());
+                       return String.Concat (parent_enum.GetSignatureForError (), '.', Name);
                }
 
                public override string[] ValidAttributeTargets {
@@ -107,31 +180,26 @@ namespace Mono.CSharp {
                public override string DocCommentHeader {
                        get { return "F:"; }
                }
+
+               #region IConstant Members
+
+               public Constant Value {
+                       get {
+                               return value;
+                       }
+               }
+
+               #endregion
        }
 
        /// <summary>
        ///   Enumeration container
        /// </summary>
        public class Enum : DeclSpace {
-               public ArrayList ordered_enums;
-               
-               public Expression BaseType;
-               
+               Expression BaseType;
                public Type UnderlyingType;
 
-               Hashtable member_to_location;
-
-               //
-               // This is for members that have been defined
-               //
-               Hashtable member_to_value;
-
-               //
-               // This is used to mark members we're currently defining
-               //
-               Hashtable in_transit;
-               
-               ArrayList field_builders;
+               static MemberList no_list = new MemberList (new object[0]);
                
                public const int AllowedModifiers =
                        Modifiers.NEW |
@@ -141,40 +209,23 @@ namespace Mono.CSharp {
                        Modifiers.PRIVATE;
 
                public Enum (NamespaceEntry ns, TypeContainer parent, Expression type,
-                            int mod_flags, MemberName name, Attributes attrs, Location l)
-                       : base (ns, parent, name, attrs, l)
+                            int mod_flags, MemberName name, Attributes attrs)
+                       : base (ns, parent, name, attrs)
                {
                        this.BaseType = type;
                        ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
-                                                   IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, l);
-
-                       ordered_enums = new ArrayList ();
-                       member_to_location = new Hashtable ();
-                       member_to_value = new Hashtable ();
-                       in_transit = new Hashtable ();
-                       field_builders = new ArrayList ();
+                                                   IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, name.Location);
                }
 
-               /// <summary>
-               ///   Adds @name to the enumeration space, with @expr
-               ///   being its definition.  
-               /// </summary>
-               public void AddEnumMember (string name, Expression expr, Location loc, Attributes opt_attrs, string documentation)
+               public void AddEnumMember (EnumMember em)
                {
-                       if (name == "value__") {
-                               Report.Error (76, loc, "An item in an enumeration cannot have an identifier `value__'");
+                       if (em.Name == "value__") {
+                               Report.Error (76, em.Location, "An item in an enumeration cannot have an identifier `value__'");
                                return;
                        }
 
-                       EnumMember em = new EnumMember (this, expr, name, loc, opt_attrs);
-                       em.DocComment = documentation;
-                       if (!AddToContainer (em, name))
+                       if (!AddToContainer (em, em.Name))
                                return;
-
-
-                       // TODO: can be almost deleted
-                       ordered_enums.Add (name);
-                       member_to_location.Add (name, loc);
                }
                
                public override TypeBuilder DefineType ()
@@ -235,377 +286,16 @@ namespace Mono.CSharp {
 
                        TypeManager.AddUserType (Name, this);
 
-                       return TypeBuilder;
-               }
-
-               bool IsValidEnumConstant (Expression e)
-               {
-                       if (!(e is Constant))
-                               return false;
-
-                       if (e is IntConstant || e is UIntConstant || e is LongConstant ||
-                           e is ByteConstant || e is SByteConstant || e is ShortConstant ||
-                           e is UShortConstant || e is ULongConstant || e is EnumConstant ||
-                           e is CharConstant)
-                               return true;
-                       else
-                               return false;
-               }
-
-               object GetNextDefaultValue (object default_value)
-               {
-                       if (UnderlyingType == TypeManager.int32_type) {
-                               int i = (int) default_value;
-                               
-                               if (i < System.Int32.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       } else if (UnderlyingType == TypeManager.uint32_type) {
-                               uint i = (uint) default_value;
-
-                               if (i < System.UInt32.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       } else if (UnderlyingType == TypeManager.int64_type) {
-                               long i = (long) default_value;
-
-                               if (i < System.Int64.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       } else if (UnderlyingType == TypeManager.uint64_type) {
-                               ulong i = (ulong) default_value;
-
-                               if (i < System.UInt64.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       } else if (UnderlyingType == TypeManager.short_type) {
-                               short i = (short) default_value;
-
-                               if (i < System.Int16.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       } else if (UnderlyingType == TypeManager.ushort_type) {
-                               ushort i = (ushort) default_value;
-
-                               if (i < System.UInt16.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       } else if (UnderlyingType == TypeManager.byte_type) {
-                               byte i = (byte) default_value;
-
-                               if (i < System.Byte.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       } else if (UnderlyingType == TypeManager.sbyte_type) {
-                               sbyte i = (sbyte) default_value;
-
-                               if (i < System.SByte.MaxValue)
-                                       return ++i;
-                               else
-                                       return null;
-                       }
-
-                       return null;
-               }
-
-               /// <summary>
-               ///  Determines if a standard implicit conversion exists from
-               ///  expr_type to target_type
-               /// </summary>
-               public static bool ImplicitConversionExists (Type expr_type, Type target_type)
-               {
-                       expr_type = TypeManager.TypeToCoreType (expr_type);
-
-                       if (expr_type == TypeManager.void_type)
-                               return false;
-                       
-                       if (expr_type == target_type)
-                               return true;
-
-                       // First numeric conversions 
-
-                       if (expr_type == TypeManager.sbyte_type){
-                               //
-                               // From sbyte to short, int, long, float, double.
-                               //
-                               if ((target_type == TypeManager.int32_type) || 
-                                   (target_type == TypeManager.int64_type) ||
-                                   (target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.float_type)  ||
-                                   (target_type == TypeManager.short_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-                               
-                       } else if (expr_type == TypeManager.byte_type){
-                               //
-                               // From byte to short, ushort, int, uint, long, ulong, float, double
-                               // 
-                               if ((target_type == TypeManager.short_type) ||
-                                   (target_type == TypeManager.ushort_type) ||
-                                   (target_type == TypeManager.int32_type) ||
-                                   (target_type == TypeManager.uint32_type) ||
-                                   (target_type == TypeManager.uint64_type) ||
-                                   (target_type == TypeManager.int64_type) ||
-                                   (target_type == TypeManager.float_type) ||
-                                   (target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-       
-                       } else if (expr_type == TypeManager.short_type){
-                               //
-                               // From short to int, long, float, double
-                               // 
-                               if ((target_type == TypeManager.int32_type) ||
-                                   (target_type == TypeManager.int64_type) ||
-                                   (target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.float_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-                                       
-                       } else if (expr_type == TypeManager.ushort_type){
-                               //
-                               // From ushort to int, uint, long, ulong, float, double
-                               //
-                               if ((target_type == TypeManager.uint32_type) ||
-                                   (target_type == TypeManager.uint64_type) ||
-                                   (target_type == TypeManager.int32_type) ||
-                                   (target_type == TypeManager.int64_type) ||
-                                   (target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.float_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-                                   
-                       } else if (expr_type == TypeManager.int32_type){
-                               //
-                               // From int to long, float, double
-                               //
-                               if ((target_type == TypeManager.int64_type) ||
-                                   (target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.float_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-                                       
-                       } else if (expr_type == TypeManager.uint32_type){
-                               //
-                               // From uint to long, ulong, float, double
-                               //
-                               if ((target_type == TypeManager.int64_type) ||
-                                   (target_type == TypeManager.uint64_type) ||
-                                   (target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.float_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-                                       
-                       } else if ((expr_type == TypeManager.uint64_type) ||
-                                  (expr_type == TypeManager.int64_type)) {
-                               //
-                               // From long/ulong to float, double
-                               //
-                               if ((target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.float_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-                                   
-                       } else if (expr_type == TypeManager.char_type){
-                               //
-                               // From char to ushort, int, uint, long, ulong, float, double
-                               // 
-                               if ((target_type == TypeManager.ushort_type) ||
-                                   (target_type == TypeManager.int32_type) ||
-                                   (target_type == TypeManager.uint32_type) ||
-                                   (target_type == TypeManager.uint64_type) ||
-                                   (target_type == TypeManager.int64_type) ||
-                                   (target_type == TypeManager.float_type) ||
-                                   (target_type == TypeManager.double_type) ||
-                                   (target_type == TypeManager.decimal_type))
-                                       return true;
-
-                       } else if (expr_type == TypeManager.float_type){
-                               //
-                               // float to double
-                               //
-                               if (target_type == TypeManager.double_type)
-                                       return true;
-                       }       
-                       
-                       return false;
-               }
-
-               /// <summary>
-               ///  This is used to lookup the value of an enum member. If the member is undefined,
-               ///  it attempts to define it and return its value
-               /// </summary>
-               public object LookupEnumValue (string name, Location loc)
-               {
-                       if (ec == null)
-                               Report.Error (-1, loc, "Enum.LookupEnumValue () called too soon");
-                       
-                       object default_value = null;
-                       Constant c = null;
-
-                       default_value = member_to_value [name];
-
-                       if (default_value != null)
-                               return default_value;
-
-                       //
-                       // This may happen if we're calling a method in System.Enum, for instance
-                       // Enum.IsDefined().
-                       //
-                       if (!defined_names.Contains (name))
-                               return null;
-
-                       if (in_transit.Contains (name)) {
-                               Report.Error (110, loc, "The evaluation of the constant value for `" +
-                                             Name + "." + name + "' involves a circular definition.");
-                               return null;
-                       }
-
-                       //
-                       // So if the above doesn't happen, we have a member that is undefined
-                       // We now proceed to define it 
-                       //
-                       Expression val = this [name];
-
-                       if (val == null) {
-                               
-                               int idx = ordered_enums.IndexOf (name);
-
-                               if (idx == 0)
-                                       default_value = 0;
-                               else {
-                                       for (int i = 0; i < idx; ++i) {
-                                               string n = (string) ordered_enums [i];
-                                               Location m_loc = (Mono.CSharp.Location)
-                                                       member_to_location [n];
-                                               in_transit.Add (name, true);
-                                               default_value = LookupEnumValue (n, m_loc);
-                                               in_transit.Remove (name);
-                                               if (default_value == null)
-                                                       return null;
-                                       }
-                                       
-                                       default_value = GetNextDefaultValue (default_value);
-                               }
-                               
-                       } else {
-                               in_transit.Add (name, true);
-                               val = val.Resolve (EmitContext);
-                               in_transit.Remove (name);
-
-                               if (val == null)
-                                       return null;
-
-                               if (!IsValidEnumConstant (val)) {
-                                       Report.Error (1008, loc,
-                                               "Type byte, sbyte, short, ushort, int, uint, long or ulong expected");
-                                       return null;
-                               }
-
-                               c = (Constant) val;
-                               default_value = c.GetValue ();
-
-                               if (default_value == null) {
-                                       c.Error_ConstantValueCannotBeConverted (loc, UnderlyingType);
+                       foreach (EnumMember em in defined_names.Values) {
+                               if (!em.Define ())
                                        return null;
-                               }
-
-                               if (val is EnumConstant){
-                                       Type etype = TypeManager.EnumToUnderlying (c.Type);
-                                       
-                                       if (!ImplicitConversionExists (etype, UnderlyingType)){
-                                               Convert.Error_CannotImplicitConversion (
-                                                       loc, c.Type, UnderlyingType);
-                                               return null;
-                                       }
-                               }
                        }
 
-                       EnumMember em = (EnumMember) defined_names [name];
-                       em.DefineMember (TypeBuilder);
-
-                       bool fail;
-                       default_value = TypeManager.ChangeType (default_value, UnderlyingType, out fail);
-                       if (fail){
-                               c.Error_ConstantValueCannotBeConverted (loc, UnderlyingType);
-                               return null;
-                       }
-
-                       em.builder.SetConstant (default_value);
-                       field_builders.Add (em.builder);
-                       member_to_value [name] = default_value;
-
-                       if (!TypeManager.RegisterFieldValue (em.builder, default_value))
-                               return null;
-
-                       return default_value;
+                       return TypeBuilder;
                }
                
                public override bool Define ()
                {
-                       //
-                       // If there was an error during DefineEnum, return
-                       //
-                       if (TypeBuilder == null)
-                               return false;
-
-                       if (ec == null)
-                               throw new InternalErrorException ("Enum.Define () called too soon");
-                       
-                       object default_value = 0;
-                       
-               
-                       foreach (string name in ordered_enums) {
-                               //
-                               // Have we already been defined, thanks to some cross-referencing ?
-                               // 
-                               if (member_to_value.Contains (name))
-                                       continue;
-                               
-                               Location loc = (Mono.CSharp.Location) member_to_location [name];
-
-                               if (this [name] != null) {
-                                       default_value = LookupEnumValue (name, loc);
-
-                                       if (default_value == null)
-                                               return true;
-                               } else {
-                                       EnumMember em = (EnumMember) defined_names [name];
-
-                                       em.DefineMember (TypeBuilder);
-                                       FieldBuilder fb = em.builder;
-                                       
-                                       if (default_value == null) {
-                                          Report.Error (543, loc, "The enumerator value `{0}.{1}' is too large to fit in its type `{2}'",
-                                                  GetSignatureForError (), name, TypeManager.CSharpName (this.UnderlyingType));
-                                               return false;
-                                       }
-
-                                       bool fail;
-                                       default_value = TypeManager.ChangeType (default_value, UnderlyingType, out fail);
-                                       if (fail){
-                                               //TODO: really interested if can be reached
-                                               throw new NotImplementedException ();
-                                       }
-
-                                       fb.SetConstant (default_value);
-                                       field_builders.Add (fb);
-                                       member_to_value [name] = default_value;
-                                       
-                                       if (!TypeManager.RegisterFieldValue (fb, default_value))
-                                               return false;
-                               }
-
-                               default_value = GetNextDefaultValue (default_value);
-                       }
-
                        return true;
                }
 
@@ -621,7 +311,24 @@ namespace Mono.CSharp {
 
                        base.Emit ();
                }
-               
+
+               //
+               // IMemberFinder
+               //
+               public override MemberList FindMembers (MemberTypes mt, BindingFlags bf,
+                       MemberFilter filter, object criteria)
+               {
+                       if ((mt & MemberTypes.Field) == 0)
+                               return no_list;
+
+                       EnumMember em = defined_names [criteria] as EnumMember;
+                       if (em == null)
+                               return no_list;
+
+                       FieldBuilder[] fb = new FieldBuilder[] { em.builder };
+                       return new MemberList (fb);
+               }
+
                void VerifyClsName ()
                {
                        HybridDictionary dict = new HybridDictionary (defined_names.Count, true);
@@ -652,27 +359,7 @@ namespace Mono.CSharp {
 
                        return true;
                }
-               
-               //
-               // IMemberFinder
-               //
-               public override MemberList FindMembers (MemberTypes mt, BindingFlags bf,
-                                                       MemberFilter filter, object criteria)
-               {
-                       ArrayList members = new ArrayList ();
-
-                       if ((mt & MemberTypes.Field) != 0) {
-                               if (criteria is string && member_to_value [criteria] == null) {
-                                       LookupEnumValue ((string) criteria, Location.Null);
-                               }
-                               
-                               foreach (FieldBuilder fb in field_builders)
-                                       if (filter (fb, criteria) == true)
-                                               members.Add (fb);
-                       }
-
-                       return new MemberList (members);
-               }
+       
 
                public override MemberCache MemberCache {
                        get {
@@ -680,19 +367,6 @@ namespace Mono.CSharp {
                        }
                }
 
-               public ArrayList ValueNames {
-                       get {
-                               return ordered_enums;
-                       }
-               }
-
-               // indexer
-               public Expression this [string name] {
-                       get {
-                               return ((EnumMember) defined_names [name]).Type;
-                       }
-               }
-
                public override AttributeTargets AttributeTargets {
                        get {
                                return AttributeTargets.Enum;
@@ -707,7 +381,6 @@ namespace Mono.CSharp {
                        }
                }
 
-
                protected override void VerifyObsoleteAttribute()
                {
                        // UnderlyingType is never obsolete
@@ -719,7 +392,11 @@ namespace Mono.CSharp {
                //
                internal override void GenerateDocComment (DeclSpace ds)
                {
-                       DocUtil.GenerateEnumDocComment (this, ds);
+                       base.GenerateDocComment (ds);
+
+                       foreach (EnumMember em in defined_names.Values) {
+                               em.GenerateDocComment (this);
+                       }
                }
 
                //
index 30251901b16e3dd81282840953d31640b42d6376..6a3e5433f6d05cca75ee9534b0e13e8f9fd2bbc3 100644 (file)
@@ -91,10 +91,10 @@ namespace Mono.CSharp {
        {
                public Expression Expr;
 
-               public ParenthesizedExpression (Expression expr, Location loc)
+               public ParenthesizedExpression (Expression expr)
                {
                        this.Expr = expr;
-                       this.loc = loc;
+                       this.loc = expr.Location;
                }
 
                public override Expression DoResolve (EmitContext ec)
@@ -394,28 +394,24 @@ namespace Mono.CSharp {
                                        Expression e;
 
                                        e = Convert.ImplicitConversion (ec, Expr, TypeManager.int32_type, loc);
-                                       if (e != null){
-                                               type = TypeManager.int32_type;
-                                               return this;
-                                       }
+                                       if (e != null)
+                                               goto ok;
                                        e = Convert.ImplicitConversion (ec, Expr, TypeManager.uint32_type, loc);
-                                       if (e != null){
-                                               type = TypeManager.uint32_type;
-                                               return this;
-                                       }
+                                       if (e != null)
+                                               goto ok;
                                        e = Convert.ImplicitConversion (ec, Expr, TypeManager.int64_type, loc);
-                                       if (e != null){
-                                               type = TypeManager.int64_type;
-                                               return this;
-                                       }
+                                       if (e != null)
+                                               goto ok;
                                        e = Convert.ImplicitConversion (ec, Expr, TypeManager.uint64_type, loc);
-                                       if (e != null){
-                                               type = TypeManager.uint64_type;
-                                               return this;
-                                       }
+                                       if (e != null)
+                                               goto ok;
                                        Error23 (expr_type);
                                        return null;
+                               ok:
+                                       Expr = e;
+                                       expr_type = e.Type;
                                }
+
                                type = expr_type;
                                return this;
 
@@ -1235,7 +1231,7 @@ namespace Mono.CSharp {
                        eclass = ExprClass.Value;
                        Type etype = expr.Type;
 
-                       if (TypeManager.IsValueType (probe_type)){
+                       if (probe_type.IsValueType) {
                                Report.Error (77, loc, "The as operator must be used with a reference type (`" +
                                              TypeManager.CSharpName (probe_type) + "' is a value type)");
                                return null;
@@ -1272,6 +1268,11 @@ namespace Mono.CSharp {
                Expression target_type;
                Expression expr;
                        
+               public Cast (Expression cast_type, Expression expr)
+                       : this (cast_type, expr, cast_type.Location)
+               {
+               }
+
                public Cast (Expression cast_type, Expression expr, Location loc)
                {
                        this.target_type = cast_type;
@@ -1339,11 +1340,18 @@ namespace Mono.CSharp {
                        return true;
                }
 
+               // TODO: move to constant
                /// <summary>
                ///   Attempts to do a compile-time folding of a constant cast.
                /// </summary>
                Expression TryReduce (EmitContext ec, Type target_type)
                {
+                       if (expr.Type == target_type)
+                               return expr;
+
+                       if (TypeManager.IsEnumType (target_type) && TypeManager.EnumToUnderlying (target_type) == expr.Type)
+                               return new EnumConstant ((Constant)expr, target_type);
+
                        Expression real_expr = expr;
                        if (real_expr is EnumConstant)
                                real_expr = ((EnumConstant) real_expr).Child;
@@ -1891,12 +1899,12 @@ namespace Mono.CSharp {
                        oper_names [(int) Operator.LogicalAnd] = "op_LogicalAnd";
                }
 
-               public Binary (Operator oper, Expression left, Expression right, Location loc)
+               public Binary (Operator oper, Expression left, Expression right)
                {
                        this.oper = oper;
                        this.left = left;
                        this.right = right;
-                       this.loc = loc;
+                       this.loc = left.Location;
                }
 
                public Operator Oper {
@@ -2023,7 +2031,7 @@ namespace Mono.CSharp {
                // type, otherwise ConvertImplict() already finds the user-defined conversion for us,
                // so we don't explicitly check for performance reasons.
                //
-               bool DoNumericPromotions (EmitContext ec, Type l, Type r, bool check_user_conv)
+               bool DoNumericPromotions (EmitContext ec, Type l, Type r, Expression lexpr, Expression rexpr, bool check_user_conv)
                {
                        if (IsOfType (ec, l, r, TypeManager.double_type, check_user_conv)){
                                //
@@ -2175,6 +2183,12 @@ namespace Mono.CSharp {
                                left = ForceConversion (ec, left, TypeManager.int32_type);
                                right = ForceConversion (ec, right, TypeManager.int32_type);
 
+                               bool strConv =
+                                       Convert.ImplicitConversionExists (ec, lexpr, TypeManager.string_type) &&
+                                       Convert.ImplicitConversionExists (ec, rexpr, TypeManager.string_type);
+                               if (strConv && left != null && right != null)
+                                       Error_OperatorAmbiguous (loc, oper, l, r);
+
                                type = TypeManager.int32_type;
                        }
 
@@ -2248,10 +2262,10 @@ namespace Mono.CSharp {
                                type = e.Type;
 
                                if (type == TypeManager.int32_type || type == TypeManager.uint32_type){
-                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (31), loc);
+                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (31));
                                        right = right.DoResolve (ec);
                                } else {
-                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (63), loc);
+                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (63));
                                        right = right.DoResolve (ec);
                                }
 
@@ -2290,7 +2304,7 @@ namespace Mono.CSharp {
                                                return null;
                                        }
 
-                                       left = new BoxedCast (left);
+                                       left = new BoxedCast (left, TypeManager.object_type);
                                        Type = TypeManager.bool_type;
                                        return this;
                                }
@@ -2301,7 +2315,7 @@ namespace Mono.CSharp {
                                                return null;
                                        }
 
-                                       right = new BoxedCast (right);
+                                       right = new BoxedCast (right, TypeManager.object_type);
                                        Type = TypeManager.bool_type;
                                        return this;
                                }
@@ -2745,7 +2759,7 @@ namespace Mono.CSharp {
                        // This will leave left or right set to null if there is an error
                        //
                        bool check_user_conv = is_user_defined (l) && is_user_defined (r);
-                       DoNumericPromotions (ec, l, r, check_user_conv);
+                       DoNumericPromotions (ec, l, r, left, right, check_user_conv);
                        if (left == null || right == null){
                                Error_OperatorCannotBeApplied (loc, OperName (oper), l, r);
                                return null;
@@ -2841,18 +2855,119 @@ namespace Mono.CSharp {
                        }
 
                        if (rc != null && lc != null){
+                               int prev_e = Report.Errors;
                                Expression e = ConstantFold.BinaryFold (
                                        ec, oper, lc, rc, loc);
-                               if (e != null)
+                               if (e != null || Report.Errors != prev_e)
                                        return e;
                        }
 
                        if (TypeManager.IsNullableType (left.Type) || TypeManager.IsNullableType (right.Type))
                                return new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec);
 
+                       // Check CS0652 warning here (before resolving operator).
+                       if (oper == Operator.Equality ||
+                           oper == Operator.Inequality ||
+                           oper == Operator.LessThanOrEqual ||
+                           oper == Operator.LessThan ||
+                           oper == Operator.GreaterThanOrEqual ||
+                           oper == Operator.GreaterThan){
+                               CheckUselessComparison (left as Constant, right.Type);
+                               CheckUselessComparison (right as Constant, left.Type);
+                       }
+
                        return ResolveOperator (ec);
                }
 
+               private void CheckUselessComparison (Constant c, Type type)
+               {
+                       if (c == null || !IsTypeIntegral (type)
+                               || c is StringConstant
+                               || c is BoolConstant
+                               || c is CharConstant
+                               || c is FloatConstant
+                               || c is DoubleConstant
+                               || c is DecimalConstant
+                               )
+                               return;
+
+                       long value = 0;
+
+                       if (c is ULongConstant) {
+                               ulong uvalue = ((ULongConstant) c).Value;
+                               if (uvalue > long.MaxValue) {
+                                       if (type == TypeManager.byte_type ||
+                                           type == TypeManager.sbyte_type ||
+                                           type == TypeManager.short_type ||
+                                           type == TypeManager.ushort_type ||
+                                           type == TypeManager.int32_type ||
+                                           type == TypeManager.uint32_type ||
+                                           type == TypeManager.int64_type)
+                                               WarnUselessComparison (type);
+                                       return;
+                               }
+                               value = (long) uvalue;
+                       }
+                       else if (c is ByteConstant)
+                               value = ((ByteConstant) c).Value;
+                       else if (c is SByteConstant)
+                               value = ((SByteConstant) c).Value;
+                       else if (c is ShortConstant)
+                               value = ((ShortConstant) c).Value;
+                       else if (c is UShortConstant)
+                               value = ((UShortConstant) c).Value;
+                       else if (c is IntConstant)
+                               value = ((IntConstant) c).Value;
+                       else if (c is UIntConstant)
+                               value = ((UIntConstant) c).Value;
+                       else if (c is LongConstant)
+                               value = ((LongConstant) c).Value;
+
+                       if (value != 0) {
+                               if (IsValueOutOfRange (value, type))
+                                       WarnUselessComparison (type);
+                               return;
+                       }
+               }
+
+               private bool IsValueOutOfRange (long value, Type type)
+               {
+                       if (IsTypeUnsigned (type) && value < 0)
+                               return true;
+                       return type == TypeManager.sbyte_type && (value >= 0x80 || value < -0x80) ||
+                               type == TypeManager.byte_type && value >= 0x100 ||
+                               type == TypeManager.short_type && (value >= 0x8000 || value < -0x8000) ||
+                               type == TypeManager.ushort_type && value >= 0x10000 ||
+                               type == TypeManager.int32_type && (value >= 0x80000000 || value < -0x80000000) ||
+                               type == TypeManager.uint32_type && value >= 0x100000000;
+               }
+
+               private static bool IsTypeIntegral (Type type)
+               {
+                       return type == TypeManager.uint64_type ||
+                               type == TypeManager.int64_type ||
+                               type == TypeManager.uint32_type ||
+                               type == TypeManager.int32_type ||
+                               type == TypeManager.ushort_type ||
+                               type == TypeManager.short_type ||
+                               type == TypeManager.sbyte_type ||
+                               type == TypeManager.byte_type;
+               }
+
+               private static bool IsTypeUnsigned (Type type)
+               {
+                       return type == TypeManager.uint64_type ||
+                               type == TypeManager.uint32_type ||
+                               type == TypeManager.ushort_type ||
+                               type == TypeManager.byte_type;
+               }
+
+               private void WarnUselessComparison (Type type)
+               {
+                       Report.Warning (652, 2, loc, "Comparison to integral constant is useless; the constant is outside the range of type `{0}'",
+                               TypeManager.CSharpName (type));
+               }
+
                /// <remarks>
                ///   EmitBranchable is called from Statement.EmitBoolExpression in the
                ///   context of a conditional bool expression.  This function will return
@@ -3597,12 +3712,12 @@ namespace Mono.CSharp {
        public class Conditional : Expression {
                Expression expr, trueExpr, falseExpr;
                
-               public Conditional (Expression expr, Expression trueExpr, Expression falseExpr, Location l)
+               public Conditional (Expression expr, Expression trueExpr, Expression falseExpr)
                {
                        this.expr = expr;
                        this.trueExpr = trueExpr;
                        this.falseExpr = falseExpr;
-                       this.loc = l;
+                       this.loc = expr.Location;
                }
 
                public Expression Expr {
@@ -3641,6 +3756,11 @@ namespace Mono.CSharp {
                                        return null;
                        }
                        
+                       Assign ass = expr as Assign;
+                       if (ass != null && ass.Source is Constant) {
+                               Report.Warning (665, 3, loc, "Assignment in conditional expression is always constant; did you mean to use == instead of = ?");
+                       }
+
                        trueExpr = trueExpr.Resolve (ec);
                        falseExpr = falseExpr.Resolve (ec);
 
@@ -3754,6 +3874,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public bool VerifyAssigned (EmitContext ec)
+               {
+                       VariableInfo variable_info = local_info.VariableInfo;
+                       return variable_info == null || variable_info.IsAssigned (ec, loc);
+               }
+
                protected Expression DoResolveBase (EmitContext ec, Expression lvalue_right_side)
                {
                        if (local_info == null) {
@@ -3791,7 +3917,7 @@ namespace Mono.CSharp {
                                return e.Resolve (ec);
                        }
 
-                       if ((variable_info != null) && !variable_info.IsAssigned (ec, loc))
+                       if (!VerifyAssigned (ec))
                                return null;
 
                        if (lvalue_right_side == null)
@@ -4083,7 +4209,7 @@ namespace Mono.CSharp {
                {
                        DoResolveBase (ec);
 
-                       if (is_out && ec.DoFlowAnalysis && !IsAssigned (ec, loc))
+                       if (is_out && ec.DoFlowAnalysis && (!ec.OmitStructFlowAnalysis || !vi.TypeInfo.IsStruct) && !IsAssigned (ec, loc))
                                return null;
 
                        return this;
@@ -4451,11 +4577,11 @@ namespace Mono.CSharp {
                // FIXME: only allow expr to be a method invocation or a
                // delegate invocation (7.5.5)
                //
-               public Invocation (Expression expr, ArrayList arguments, Location l)
+               public Invocation (Expression expr, ArrayList arguments)
                {
                        this.expr = expr;
                        Arguments = arguments;
-                       loc = l;
+                       loc = expr.Location;
                }
 
                public Expression Expr {
@@ -4465,7 +4591,7 @@ namespace Mono.CSharp {
                }
 
                /// <summary>
-               ///   Determines "better conversion" as specified in 7.4.2.3
+               ///   Determines "better conversion" as specified in 14.4.2.3
                ///
                ///    Returns : p    if a->p is better,
                ///              q    if a->q is better,
@@ -4883,7 +5009,7 @@ namespace Mono.CSharp {
                                if (a_mod == p_mod ||
                                    (a_mod == Parameter.Modifier.NONE && p_mod == Parameter.Modifier.PARAMS)) {
                                        if (a_mod == Parameter.Modifier.NONE) {
-                                                if (!Convert.ImplicitConversionExists (ec,
+                                                if (!TypeManager.IsEqual (a.Type, pd.ParameterType (i)) && !Convert.ImplicitConversionExists (ec,
                                                                                        a.Expr,
                                                                                        pd.ParameterType (i)))
                                                        return false;
@@ -5040,7 +5166,13 @@ namespace Mono.CSharp {
 
                                        VerifyArgumentsCompat (ec, Arguments, arg_count,
                                                c, false, null, may_fail, loc);
-                                        break;
+
+                                       if (!may_fail && errors == Report.Errors)
+                                               throw new InternalErrorException (
+                                                       "VerifyArgumentsCompat and IsApplicable do not agree; " +
+                                                       "likely reason: ImplicitConversion and ImplicitConversionExists have gone out of sync");
+
+                                       break;
                                }
 
                                if (!may_fail && errors == Report.Errors) {
@@ -5144,7 +5276,6 @@ namespace Mono.CSharp {
                                        method_params = cand_params;
                                }
                        }
-
                        //
                        // Now check that there are no ambiguities i.e the selected method
                        // should be better than all the others
@@ -5425,12 +5556,8 @@ namespace Mono.CSharp {
                                return null;
                        }
 
-                       if ((method.Attributes & MethodAttributes.SpecialName) != 0){
-                               if (TypeManager.LookupDeclSpace (method.DeclaringType) != null || TypeManager.IsSpecialMethod (method)) {
-                                       Report.Error (571, loc, "`{0}': cannot explicitly call operator or accessor",
-                                               TypeManager.CSharpSignature (method, true));
-                                       return null;
-                               }
+                       if ((method.Attributes & MethodAttributes.SpecialName) != 0 && IsSpecialMethodInvocation (method)) {
+                               return null;
                        }
                        
                        if (mg.InstanceExpression != null)
@@ -5440,6 +5567,32 @@ namespace Mono.CSharp {
                        return this;
                }
 
+               bool IsSpecialMethodInvocation (MethodBase method)
+               {
+                       IMethodData md = TypeManager.GetMethod (method);
+                       if (md != null) {
+                               if (!(md is AbstractPropertyEventMethod) && !(md is Operator))
+                                       return false;
+                       } else {
+                               if (!TypeManager.IsSpecialMethod (method))
+                                       return false;
+
+                               int args = TypeManager.GetParameterData (method).Count;
+                               if (method.Name.StartsWith ("get_") && args > 0)
+                                       return false;
+                               else if (method.Name.StartsWith ("set_") && args > 2)
+                                       return false;
+
+                               // TODO: check operators and events as well ?
+                       }
+
+                       Report.SymbolRelatedToPreviousError (method);
+                       Report.Error (571, loc, "`{0}': cannot explicitly call operator or accessor",
+                               TypeManager.CSharpSignature (method, true));
+       
+                       return true;
+               }
+
                // <summary>
                //   Emits the list of arguments as an array
                // </summary>
@@ -5684,51 +5837,46 @@ namespace Mono.CSharp {
                                //
                                if (!omit_args) {
                                        Type t = null;
-                                       if (this_call) {
-                                               ig.Emit (OpCodes.Ldarg_0);
-                                               t = decl_type;
-                                       } else {
-                                               Type iexpr_type = instance_expr.Type;
+                                       Type iexpr_type = instance_expr.Type;
 
+                                       //
+                                       // Push the instance expression
+                                       //
+                                       if (TypeManager.IsValueType (iexpr_type)) {
                                                //
-                                               // Push the instance expression
-                                               //
-                                               if (TypeManager.IsValueType (iexpr_type)) {
+                                               // Special case: calls to a function declared in a 
+                                               // reference-type with a value-type argument need
+                                               // to have their value boxed.
+                                               if (decl_type.IsValueType ||
+                                                   iexpr_type.IsGenericParameter) {
                                                        //
-                                                       // Special case: calls to a function declared in a 
-                                                       // reference-type with a value-type argument need
-                                                       // to have their value boxed.
-                                                       if (decl_type.IsValueType ||
-                                                           iexpr_type.IsGenericParameter) {
-                                                               //
-                                                               // If the expression implements IMemoryLocation, then
-                                                               // we can optimize and use AddressOf on the
-                                                               // return.
-                                                               //
-                                                               // If not we have to use some temporary storage for
-                                                               // it.
-                                                               if (instance_expr is IMemoryLocation) {
-                                                                       ((IMemoryLocation)instance_expr).
-                                                                               AddressOf (ec, AddressOp.LoadStore);
-                                                               } else {
-                                                                       LocalTemporary temp = new LocalTemporary (ec, iexpr_type);
-                                                                       instance_expr.Emit (ec);
-                                                                       temp.Store (ec);
-                                                                       temp.AddressOf (ec, AddressOp.Load);
-                                                               }
-
-                                                               // avoid the overhead of doing this all the time.
-                                                               if (dup_args)
-                                                                       t = TypeManager.GetReferenceType (iexpr_type);
+                                                       // If the expression implements IMemoryLocation, then
+                                                       // we can optimize and use AddressOf on the
+                                                       // return.
+                                                       //
+                                                       // If not we have to use some temporary storage for
+                                                       // it.
+                                                       if (instance_expr is IMemoryLocation) {
+                                                               ((IMemoryLocation)instance_expr).
+                                                                       AddressOf (ec, AddressOp.LoadStore);
                                                        } else {
+                                                               LocalTemporary temp = new LocalTemporary (ec, iexpr_type);
                                                                instance_expr.Emit (ec);
-                                                               ig.Emit (OpCodes.Box, instance_expr.Type);
-                                                               t = TypeManager.object_type;
+                                                               temp.Store (ec);
+                                                               temp.AddressOf (ec, AddressOp.Load);
                                                        }
+
+                                                       // avoid the overhead of doing this all the time.
+                                                       if (dup_args)
+                                                               t = TypeManager.GetReferenceType (iexpr_type);
                                                } else {
                                                        instance_expr.Emit (ec);
-                                                       t = instance_expr.Type;
+                                                       ig.Emit (OpCodes.Box, instance_expr.Type);
+                                                       t = TypeManager.object_type;
                                                }
+                                       } else {
+                                               instance_expr.Emit (ec);
+                                               t = instance_expr.Type;
                                        }
 
                                        if (dup_args) {
@@ -5796,11 +5944,11 @@ namespace Mono.CSharp {
                Expression expr;
                Expression argument;
 
-               public InvocationOrCast (Expression expr, Expression argument, Location loc)
+               public InvocationOrCast (Expression expr, Expression argument)
                {
                        this.expr = expr;
                        this.argument = argument;
-                       this.loc = loc;
+                       this.loc = expr.Location;
                }
 
                public override Expression DoResolve (EmitContext ec)
@@ -5979,7 +6127,7 @@ namespace Mono.CSharp {
                /// <summary>
                /// Converts complex core type syntax like 'new int ()' to simple constant
                /// </summary>
-               Expression Constantify (Type t)
+               public static Constant Constantify (Type t)
                {
                        if (t == TypeManager.int32_type)
                                return new IntConstant (0);
@@ -6077,11 +6225,13 @@ namespace Mono.CSharp {
                        }
 
                        if (type.IsAbstract && type.IsSealed) {
+                               Report.SymbolRelatedToPreviousError (type);
                                Report.Error (712, loc, "Cannot create an instance of the static class `{0}'", TypeManager.CSharpName (type));
                                return null;
                        }
 
                        if (type.IsInterface || type.IsAbstract){
+                               Report.SymbolRelatedToPreviousError (type);
                                Report.Error (144, loc, "Cannot create an instance of the abstract class or interface `{0}'", TypeManager.CSharpName (type));
                                return null;
                        }
@@ -6851,7 +7001,7 @@ namespace Mono.CSharp {
                                        if (e is StringConstant || e is DecimalConstant || !(e is Constant) ||
                                            num_automatic_initializers <= max_automatic_initializers) {
                                                Type etype = e.Type;
-                                               
+
                                                ig.Emit (OpCodes.Dup);
 
                                                for (int idx = 0; idx < dims; idx++) 
@@ -6861,7 +7011,8 @@ namespace Mono.CSharp {
                                                // If we are dealing with a struct, get the
                                                // address of it, so we can store it.
                                                //
-                                               if ((dims == 1) && etype.IsValueType &&
+                                               if ((dims == 1) && 
+                                                   TypeManager.IsValueType (etype) &&
                                                    (!TypeManager.IsBuiltinOrEnum (etype) ||
                                                     etype == TypeManager.decimal_type)) {
                                                        if (e is New){
@@ -7039,7 +7190,7 @@ namespace Mono.CSharp {
                        if (!ResolveBase (ec))
                                return null;
 
-                       if ((variable_info != null) && !variable_info.IsAssigned (ec)) {
+                       if ((variable_info != null) && !(type.IsValueType && ec.OmitStructFlowAnalysis) && !variable_info.IsAssigned (ec)) {
                                Error (188, "The `this' object cannot be used before all of its fields are assigned to");
                                variable_info.SetAssigned (ec);
                                return this;
@@ -7359,11 +7510,94 @@ namespace Mono.CSharp {
                }
        }
 
+       /// <summary>
+       ///   Implements the qualified-alias-member (::) expression.
+       /// </summary>
+       public class QualifiedAliasMember : Expression
+       {
+               string alias, identifier;
+
+               public QualifiedAliasMember (string alias, string identifier, Location l)
+               {
+                       this.alias = alias;
+                       this.identifier = identifier;
+                       loc = l;
+               }
+
+               public override FullNamedExpression ResolveAsTypeStep (EmitContext ec, bool silent)
+               {
+                       if (alias == "global")
+                               return new MemberAccess (Namespace.Root, identifier, loc).ResolveAsTypeStep (ec, silent);
+
+                       int errors = Report.Errors;
+                       FullNamedExpression fne = ec.DeclSpace.NamespaceEntry.LookupAlias (alias);
+                       if (fne == null) {
+                               if (errors == Report.Errors)
+                                       Report.Error (432, loc, "Alias `{0}' not found", alias);
+                               return null;
+                       }
+                       if (fne.eclass != ExprClass.Namespace) {
+                               if (!silent)
+                                       Report.Error (431, loc, "`{0}' cannot be used with '::' since it denotes a type", alias);
+                               return null;
+                       }
+                       return new MemberAccess (fne, identifier, loc).ResolveAsTypeStep (ec, silent);
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       FullNamedExpression fne;
+                       if (alias == "global") {
+                               fne = Namespace.Root;
+                       } else {
+                               int errors = Report.Errors;
+                               fne = ec.DeclSpace.NamespaceEntry.LookupAlias (alias);
+                               if (fne == null) {
+                                       if (errors == Report.Errors)
+                                               Report.Error (432, loc, "Alias `{0}' not found", alias);
+                                       return null;
+                               }
+                       }
+
+                       Expression retval = new MemberAccess (fne, identifier, loc).DoResolve (ec);
+                       if (retval == null)
+                               return null;
+
+                       if (!(retval is FullNamedExpression)) {
+                               Report.Error (687, loc, "The expression `{0}::{1}' did not resolve to a namespace or a type", alias, identifier);
+                               return null;
+                       }
+
+                       // We defer this check till the end to match the behaviour of CSC
+                       if (fne.eclass != ExprClass.Namespace) {
+                               Report.Error (431, loc, "`{0}' cannot be used with '::' since it denotes a type", alias);
+                               return null;
+                       }
+                       return retval;
+               }
+
+               public override void Emit (EmitContext ec)
+               {
+                       throw new InternalErrorException ("QualifiedAliasMember found in resolved tree");
+               }
+
+
+               public override string ToString ()
+               {
+                       return alias + "::" + identifier;
+               }
+
+               public override string GetSignatureForError ()
+               {
+                       return ToString ();
+               }
+       }
+
        /// <summary>
        ///   Implements the member access expression
        /// </summary>
        public class MemberAccess : Expression {
-               public string Identifier;
+               public readonly string Identifier;  // TODO: LocatedToken
                Expression expr;
                TypeArguments args;
                
@@ -7385,6 +7619,8 @@ namespace Mono.CSharp {
                        get { return expr; }
                }
 
+               // TODO: this method has very poor performace for Enum fields and
+               // probably for other constants as well
                Expression DoResolve (EmitContext ec, Expression right_side)
                {
                        if (type != null)
@@ -7400,7 +7636,7 @@ namespace Mono.CSharp {
                        SimpleName original = expr as SimpleName;
                        Expression new_expr = expr.Resolve (ec,
                                ResolveFlags.VariableOrValue | ResolveFlags.Type |
-                               ResolveFlags.Intermediate | ResolveFlags.DisableFlowAnalysis);
+                               ResolveFlags.Intermediate | ResolveFlags.DisableStructFlowAnalysis);
 
                        if (new_expr == null)
                                return null;
@@ -7417,54 +7653,7 @@ namespace Mono.CSharp {
                                return retval;
                        }
 
-                       //
-                       // TODO: I mailed Ravi about this, and apparently we can get rid
-                       // of this and put it in the right place.
-                       // 
-                       // Handle enums here when they are in transit.
-                       // Note that we cannot afford to hit MemberLookup in this case because
-                       // it will fail to find any members at all
-                       //
-
                        Type expr_type = new_expr.Type;
-                       if (new_expr is TypeExpr){
-                               if (!ec.DeclSpace.CheckAccessLevel (expr_type)){
-                                       ErrorIsInaccesible (loc, TypeManager.CSharpName (expr_type));
-                                       return null;
-                               }
-
-                               if (expr_type == TypeManager.enum_type || expr_type.IsSubclassOf (TypeManager.enum_type)){
-                                       Enum en = TypeManager.LookupEnum (expr_type);
-
-                                       if (en != null) {
-                                               object value = en.LookupEnumValue (Identifier, loc);
-                                               if (value != null){
-                                                       MemberCore mc = en.GetDefinition (Identifier);
-                                                       ObsoleteAttribute oa = mc.GetObsoleteAttribute (en);
-                                                       if (oa != null) {
-                                                               AttributeTester.Report_ObsoleteMessage (oa, mc.GetSignatureForError (), Location);
-                                                       }
-                                                       oa = en.GetObsoleteAttribute (en);
-                                                       if (oa != null) {
-                                                               AttributeTester.Report_ObsoleteMessage (oa, en.GetSignatureForError (), Location);
-                                                       }
-
-                                                       Constant c = Constantify (value, en.UnderlyingType);
-                                                       return new EnumConstant (c, expr_type);
-                                               }
-                                       } else {
-                                               CheckObsoleteAttribute (expr_type);
-
-                                               FieldInfo fi = expr_type.GetField (Identifier);
-                                               if (fi != null) {
-                                                       ObsoleteAttribute oa = AttributeTester.GetMemberObsoleteAttribute (fi);
-                                                       if (oa != null)
-                                                               AttributeTester.Report_ObsoleteMessage (oa, TypeManager.GetFullNameSignature (fi), Location);
-                                               }
-                                       }
-                               }
-                       }
-
                        if (expr_type.IsPointer){
                                Error (23, "The `.' operator can not be applied to pointer operands (" +
                                       TypeManager.CSharpName (expr_type) + ")");
@@ -7524,15 +7713,22 @@ namespace Mono.CSharp {
                                return mg.ResolveGeneric (ec, args);
                        }
 
+                       if (original != null && !TypeManager.IsValueType (expr_type)) {
+                               me = member_lookup as MemberExpr;
+                               if (me != null && me.IsInstance) {
+                                       LocalVariableReference var = new_expr as LocalVariableReference;
+                                       if (var != null && !var.VerifyAssigned (ec))
+                                               return null;
+                               }
+                       }
+
                        // The following DoResolve/DoResolveLValue will do the definite assignment
                        // check.
 
                        if (right_side != null)
-                               member_lookup = member_lookup.DoResolveLValue (ec, right_side);
+                               return member_lookup.DoResolveLValue (ec, right_side);
                        else
-                               member_lookup = member_lookup.DoResolve (ec);
-
-                       return member_lookup;
+                               return member_lookup.DoResolve (ec);
                }
 
                public override Expression DoResolve (EmitContext ec)
@@ -7753,11 +7949,11 @@ namespace Mono.CSharp {
                public ArrayList  Arguments;
                public Expression Expr;
                
-               public ElementAccess (Expression e, ArrayList e_list, Location l)
+               public ElementAccess (Expression e, ArrayList e_list)
                {
                        Expr = e;
 
-                       loc  = l;
+                       loc  = e.Location;
                        
                        if (e_list == null)
                                return;
@@ -7990,6 +8186,8 @@ namespace Mono.CSharp {
                                ig.Emit (OpCodes.Ldobj, type);
                        } else if (type.IsGenericParameter)
                                ig.Emit (OpCodes.Ldelem_Any, type);
+                       else if (type.IsPointer)
+                               ig.Emit (OpCodes.Ldelem_I);
                        else
                                ig.Emit (OpCodes.Ldelem_Ref);
                }
@@ -8030,7 +8228,9 @@ namespace Mono.CSharp {
                        } else if (t.IsGenericParameter) {
                                has_type_arg = true;
                                return OpCodes.Stelem_Any;
-                       } else
+                       } else if (t.IsPointer)
+                               return OpCodes.Stelem_I;
+                       else
                                return OpCodes.Stelem_Ref;
                }
 
@@ -8795,6 +8995,11 @@ namespace Mono.CSharp {
                Expression left;
                string dim;
                
+               public ComposedCast (Expression left, string dim)
+                       : this (left, dim, left.Location)
+               {
+               }
+
                public ComposedCast (Expression left, string dim, Location l)
                {
                        this.left = left;
index 7a3efad149aefb4abb9b77ff34b525cebeadf66d..fac60a500f305dc6a386406e02ebcbf30dfa7229 100644 (file)
@@ -1899,7 +1899,9 @@ namespace Mono.CSharp
 
                public bool IsAssigned (EmitContext ec)
                {
-                       return !ec.DoFlowAnalysis || ec.CurrentBranching.IsAssigned (this);
+                       return !ec.DoFlowAnalysis ||
+                               ec.OmitStructFlowAnalysis && TypeInfo.IsStruct ||
+                               ec.CurrentBranching.IsAssigned (this);
                }
 
                public bool IsAssigned (EmitContext ec, Location loc)
@@ -1959,7 +1961,9 @@ namespace Mono.CSharp
 
                public bool IsFieldAssigned (EmitContext ec, string name, Location loc)
                {
-                       if (!ec.DoFlowAnalysis || ec.CurrentBranching.IsFieldAssigned (this, name))
+                       if (!ec.DoFlowAnalysis ||
+                               ec.OmitStructFlowAnalysis && TypeInfo.IsStruct ||
+                               ec.CurrentBranching.IsFieldAssigned (this, name))
                                return true;
 
                        Report.Error (170, loc,
index fe9ccdeee32810f0c126e6dcd3297664dfd8f12e..90010bb2616c1c8f3a63656377c77a639ba00464 100644 (file)
@@ -33,7 +33,7 @@ namespace Mono.CSharp {
                }
 
                public bool HasValueTypeConstraint {
-                       get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; }
+                       get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
                }
 
                public virtual bool HasClassConstraint {
@@ -199,7 +199,7 @@ namespace Mono.CSharp {
                                        if (sc == SpecialConstraint.ReferenceType)
                                                attrs |= GenericParameterAttributes.ReferenceTypeConstraint;
                                        else
-                                               attrs |= GenericParameterAttributes.ValueTypeConstraint;
+                                               attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint;
                                        continue;
                                }
 
@@ -539,7 +539,7 @@ namespace Mono.CSharp {
 
                public TypeParameter (TypeContainer parent, string name,
                                      Constraints constraints, Location loc)
-                       : base (parent, new MemberName (name), null, loc)
+                       : base (parent, new MemberName (name, loc), null)
                {
                        this.name = name;
                        this.constraints = constraints;
@@ -1427,9 +1427,8 @@ namespace Mono.CSharp {
 
        public class GenericMethod : DeclSpace
        {
-               public GenericMethod (NamespaceEntry ns, TypeContainer parent,
-                                     MemberName name, Location l)
-                       : base (ns, parent, name, null, l)
+               public GenericMethod (NamespaceEntry ns, TypeContainer parent, MemberName name)
+                       : base (ns, parent, name, null)
                { }
 
                public override TypeBuilder DefineType ()
@@ -1692,7 +1691,7 @@ namespace Mono.CSharp {
                        if (tc != null)
                                return tc.IsGeneric ? tc.CountTypeParameters : 0;
                        else
-                               return t.HasGenericArguments ? t.GetGenericArguments ().Length : 0;
+                               return t.IsGenericType ? t.GetGenericArguments ().Length : 0;
                }
 
                public static Type[] GetTypeArguments (Type t)
@@ -1774,7 +1773,8 @@ namespace Mono.CSharp {
                                return IsEqual (b, a);
 
                        if (a.IsGenericParameter && b.IsGenericParameter) {
-                               if ((a.DeclaringMethod == null) || (b.DeclaringMethod == null))
+                               if (a.DeclaringMethod != b.DeclaringMethod &&
+                                   (a.DeclaringMethod == null || b.DeclaringMethod == null))
                                        return false;
                                return a.GenericParameterPosition == b.GenericParameterPosition;
                        }
@@ -2128,7 +2128,7 @@ namespace Mono.CSharp {
                                if (infered_types [i] == null)
                                        return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = ((MethodInfo)method).MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2199,7 +2199,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = ((MethodInfo)method).MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2227,7 +2227,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = ((MethodInfo)method).MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2543,7 +2543,7 @@ namespace Mono.CSharp {
 
                        protected override Expression ResolveUnderlying (Expression unwrap, EmitContext ec)
                        {
-                               return new Conditional (unwrap, true_expr, false_expr, loc);
+                               return new Conditional (unwrap, true_expr, false_expr);
                        }
                }
 
@@ -2591,7 +2591,7 @@ namespace Mono.CSharp {
                                        is_boolean = true;
                                } else if ((Oper == Binary.Operator.Equality) || (Oper == Binary.Operator.Inequality)) {
                                        if (!(left is NullLiteral) && !(right is NullLiteral)) {
-                                               underlying = new Binary (Oper, left, right, loc).Resolve (ec);
+                                               underlying = new Binary (Oper, left, right).Resolve (ec);
                                                if (underlying == null)
                                                        return null;
                                        }
@@ -2602,14 +2602,14 @@ namespace Mono.CSharp {
                                           (Oper == Binary.Operator.GreaterThan) ||
                                           (Oper == Binary.Operator.LessThanOrEqual) ||
                                           (Oper == Binary.Operator.GreaterThanOrEqual)) {
-                                       underlying = new Binary (Oper, left, right, loc).Resolve (ec);
+                                       underlying = new Binary (Oper, left, right).Resolve (ec);
                                        if (underlying == null)
                                                return null;
 
                                        type = TypeManager.bool_type;
                                        is_comparision = true;
                                } else {
-                                       underlying = new Binary (Oper, left, right, loc).Resolve (ec);
+                                       underlying = new Binary (Oper, left, right).Resolve (ec);
                                        if (underlying == null)
                                                return null;
 
index 05e0ada4f5c7a4b78f3151fb8b204fc09f61d467..908f09cc154e9885928131f3aad20542ab2b64ce 100644 (file)
@@ -348,9 +348,9 @@ namespace Mono.CSharp {
                                TypeArguments args = new TypeArguments (loc);
                                foreach (TypeParameter tparam in generic.CurrentTypeParameters)
                                        args.Add (new SimpleName (tparam.Name, loc));
-                               return new MemberName (proxy_name, args);
+                               return new MemberName (proxy_name, args, loc);
                        } else
-                               return new MemberName (proxy_name);
+                               return new MemberName (proxy_name, loc);
                }
 
                //
@@ -360,7 +360,7 @@ namespace Mono.CSharp {
                                 InternalParameters parameters, int modifiers)
                        : base (container.NamespaceEntry, container,
                                MakeProxyName (m_container.MethodName.Name, generic, m_container.Location),
-                               (modifiers & Modifiers.UNSAFE) | Modifiers.PRIVATE, null, m_container.Location)
+                               (modifiers & Modifiers.UNSAFE) | Modifiers.PRIVATE, null)
                {
                        this.orig_method = m_container;
 
@@ -634,7 +634,7 @@ namespace Mono.CSharp {
                                Type t = this_type;
                                args.Add (new Argument (
                                        new ThisParameterReference (t, Location)));
-                               cc.CaptureThis ();
+                               cc.CaptureThis (move_next_method);
                        }
 
                        args.Add (new Argument (new BoolLiteral (false)));
@@ -750,14 +750,14 @@ namespace Mono.CSharp {
                        if (is_generic) {
                                left = new MemberName (
                                        "System.Collections.Generic.IEnumerator",
-                                       generic_args);
+                                       generic_args, Location);
                                type = iterator_type_expr;
                        } else {
-                               left = new MemberName ("System.Collections.IEnumerator");
+                               left = new MemberName ("System.Collections.IEnumerator", Location);
                                type = TypeManager.system_object_expr;
                        }
 
-                       MemberName name = new MemberName (left, "Current", null);
+                       MemberName name = new MemberName (left, "Current", null, Location);
 
                        ToplevelBlock get_block = new ToplevelBlock (
                                block, parameters.Parameters, Location);
@@ -766,7 +766,7 @@ namespace Mono.CSharp {
                                new Binary (
                                        Binary.Operator.LessThanOrEqual,
                                        new FieldExpression (this, pc_field),
-                                       new IntLiteral ((int) State.Running), Location),
+                                       new IntLiteral ((int) State.Running)),
                                Create_ThrowInvalidOperation (),
                                new Return (
                                        new FieldExpression (this, current_field), Location),
@@ -775,7 +775,7 @@ namespace Mono.CSharp {
                        Accessor getter = new Accessor (get_block, 0, null, Location);
 
                        Property current = new Property (
-                               this, type, 0, false, name, null, getter, null, Location);
+                               this, type, 0, false, name, null, getter, null);
                        AddProperty (current);
                }
 
@@ -797,19 +797,18 @@ namespace Mono.CSharp {
                        if (is_generic) {
                                left = new MemberName (
                                        "System.Collections.Generic.IEnumerable",
-                                       generic_args);
+                                       generic_args, Location);
                                type = generic_enumerator_type;
                        } else {
-                               left = new MemberName ("System.Collections.IEnumerable");
+                               left = new MemberName ("System.Collections.IEnumerable", Location);
                                type = enumerator_type;
                        }
 
-                       MemberName name = new MemberName (left, "GetEnumerator", null);
+                       MemberName name = new MemberName (left, "GetEnumerator", Location);
 
                        Method get_enumerator = new Method (
                                this, null, type, 0, false, name,
-                               Parameters.EmptyReadOnlyParameters, null,
-                               Location.Null);
+                               Parameters.EmptyReadOnlyParameters, null);
                        AddMethod (get_enumerator);
 
                        get_enumerator.Block = new ToplevelBlock (
@@ -833,8 +832,8 @@ namespace Mono.CSharp {
                        get_enumerator.Block.AddStatement (new If (
                                new Binary (
                                        Binary.Operator.Equality,
-                                       new Invocation (ce, args, Location),
-                                       uninitialized, Location),
+                                       new Invocation (ce, args),
+                                       uninitialized),
                                new Return (new ThisParameterReference (type.Type, Location),
                                            Location),
                                Location));
@@ -1003,8 +1002,8 @@ namespace Mono.CSharp {
                        {
                                method = new Method (
                                        iterator, null, TypeManager.system_boolean_expr,
-                                       Modifiers.PUBLIC, false, new MemberName ("MoveNext"),
-                                       Parameters.EmptyReadOnlyParameters, null, loc);
+                                       Modifiers.PUBLIC, false, new MemberName ("MoveNext", loc),
+                                       Parameters.EmptyReadOnlyParameters, null);
 
                                method.Block = Block;
 
@@ -1163,8 +1162,8 @@ namespace Mono.CSharp {
                {
                        Method reset = new Method (
                                this, null, TypeManager.system_void_expr, Modifiers.PUBLIC,
-                               false, new MemberName ("Reset"),
-                               Parameters.EmptyReadOnlyParameters, null, Location);
+                               false, new MemberName ("Reset", Location),
+                               Parameters.EmptyReadOnlyParameters, null);
                        AddMethod (reset);
 
                        reset.Block = new ToplevelBlock (Location);
@@ -1178,8 +1177,8 @@ namespace Mono.CSharp {
                {
                        dispose = new Method (
                                this, null, TypeManager.system_void_expr, Modifiers.PUBLIC,
-                               false, new MemberName ("Dispose"),
-                               Parameters.EmptyReadOnlyParameters, null, Location);
+                               false, new MemberName ("Dispose", Location),
+                               Parameters.EmptyReadOnlyParameters, null);
                        AddMethod (dispose);
 
                        dispose.Block = new ToplevelBlock (block, parameters.Parameters, Location);
index 2bae4f3d779f0e23ddb930f2df7c7b406d31b61f..e46a9809cd6cad6f2534a589c15316f500f11cdb 100644 (file)
@@ -80,6 +80,11 @@ namespace Mono.CSharp {
                        ec.ig.Emit (OpCodes.Ldnull);
                }
 
+               public override Constant Increment ()
+               {
+                       throw new NotSupportedException ();
+               }
+
                public override bool IsDefaultValue {
                        get {
                                return true;
@@ -101,11 +106,20 @@ namespace Mono.CSharp {
                        return "null";
                }
 
-               public override void Error_ConstantValueCannotBeConverted (Location loc, Type t)
+               public override void Error_ValueCannotBeConverted (Location loc, Type t)
                {
                        Report.Error (37, loc, "Cannot convert null to `{0}' because it is a value type",
                                TypeManager.CSharpName (t));
                }
+
+               public override Constant ToType (Type type, Location loc)
+               {
+                       if (!type.IsValueType && !TypeManager.IsEnumType (type))
+                               return NullLiteral.Null;
+
+                       return base.ToType (type, loc);
+               }
+
        }
 
        //
index 56df73ef2b983a774e4f941ec51bf23115773a69..19c246be8c067d3859310b47be43d309b02dbeb9 100644 (file)
@@ -3,8 +3,10 @@
 //
 // Author:
 //   Miguel de Icaza
+//   Atsushi Enomoto  <atsushi@ximian.com>
 //
 // (C) 2001 Ximian, Inc.
+// (C) 2005 Novell, Inc.
 //
 
 using System;
@@ -51,20 +53,41 @@ namespace Mono.CSharp {
        ///
        /// <remarks>
        ///   This uses a compact representation and a couple of auxiliary
-       ///   structures to keep track of tokens to (file,line) mappings.
+       ///   structures to keep track of tokens to (file,line and column) 
+       ///   mappings. The usage of the bits is:
+       ///   
+       ///     - 16 bits for "checkpoint" which is a mixed concept of
+       ///       file and "line segment"
+       ///     - 8 bits for line delta (offset) from the line segment
+       ///     - 8 bits for column number.
        ///
-       ///   We could probably also keep track of columns by storing those
-       ///   in 8 bits (and say, map anything after char 255 to be `255+').
+       ///   http://lists.ximian.com/pipermail/mono-devel-list/2004-December/009508.html
        /// </remarks>
        public struct Location {
                int token; 
 
+               struct Checkpoint {
+                       public readonly int LineOffset;
+                       public readonly int File;
+
+                       public Checkpoint (int file, int line)
+                       {
+                               File = file;
+                               LineOffset = line - (int) (line % (1 << line_delta_bits));
+                       }
+               }
+
                static ArrayList source_list;
                static Hashtable source_files;
-               static int source_bits;
-               static int source_mask;
+               static int checkpoint_bits;
                static int source_count;
                static int current_source;
+               static int line_delta_bits;
+               static int line_delta_mask;
+               static int column_bits;
+               static int column_mask;
+               static Checkpoint [] checkpoints;
+               static int checkpoint_index;
 
                public readonly static Location Null = new Location (-1);
                
@@ -73,6 +96,7 @@ namespace Mono.CSharp {
                        source_files = new Hashtable ();
                        source_list = new ArrayList ();
                        current_source = 0;
+                       checkpoints = new Checkpoint [10];
                }
 
                public static void Reset ()
@@ -112,17 +136,6 @@ namespace Mono.CSharp {
                        }
                }
 
-               static int log2 (int number)
-               {
-                       int bits = 0;
-                       while (number > 0) {
-                               bits++;
-                               number /= 2;
-                       }
-
-                       return bits;
-               }
-
                // <summary>
                //   After adding all source files we want to compile with AddFile(), this method
                //   must be called to `reserve' an appropriate number of bits in the token for the
@@ -131,8 +144,16 @@ namespace Mono.CSharp {
                // </summary>
                static public void Initialize ()
                {
-                       source_bits = log2 (source_list.Count) + 2;
-                       source_mask = (1 << source_bits) - 1;
+                       checkpoints = new Checkpoint [source_list.Count * 2];
+                       if (checkpoints.Length > 0)
+                               checkpoints [0] = new Checkpoint (0, 0);
+
+                       column_bits = 8;
+                       column_mask = 0xFF;
+                       line_delta_bits = 8;
+                       line_delta_mask = 0xFF00;
+                       checkpoint_index = 0;
+                       checkpoint_bits = 16;
                }
 
                // <remarks>
@@ -143,7 +164,7 @@ namespace Mono.CSharp {
                        string path = name == "" ? "" : Path.GetFullPath (name);
 
                        if (!source_files.Contains (path)) {
-                               if (source_count >= (1 << source_bits))
+                               if (source_count >= (1 << checkpoint_bits))
                                        return new SourceFile (name, path, 0);
 
                                source_files.Add (path, ++source_count);
@@ -156,9 +177,10 @@ namespace Mono.CSharp {
                        return (SourceFile) source_list [index - 1];
                }
 
-               static public void Push (SourceFile file)
+               static public void Push (SourceFile file, int line)
                {
                        current_source = file.Index;
+                       // File is always pushed before being changed.
                }
 
                // <remarks>
@@ -174,30 +196,73 @@ namespace Mono.CSharp {
                }
                
                public Location (int row)
+                       : this (row, 0)
                {
-                       if (row < 0)
+               }
+
+               public Location (int row, int column)
+               {
+                       if (row <= 0)
                                token = 0;
-                       else
-                               token = current_source + (row << source_bits);
+                       else {
+                               if (column > 255)
+                                       column = 255;
+                               int target = -1;
+                               int delta = 0;
+                               int max = checkpoint_index < 10 ?
+                                       checkpoint_index : 10;
+                               for (int i = 0; i < max; i++) {
+                                       int offset = checkpoints [checkpoint_index - i].LineOffset;
+                                       delta = row - offset;
+                                       if (delta >= 0 &&
+                                               delta < (1 << line_delta_bits) &&
+                                               checkpoints [checkpoint_index - i].File == current_source) {
+                                               target = checkpoint_index - i;
+                                               break;
+                                       }
+                               }
+                               if (target == -1) {
+                                       AddCheckpoint (current_source, row);
+                                       target = checkpoint_index;
+                                       delta = row % (1 << line_delta_bits);
+                               }
+                               long l = column +
+                                       (long) (delta << column_bits) +
+                                       (long) (target << (line_delta_bits + column_bits));
+                               token = l > 0xFFFFFFFF ? 0 : (int) l;
+                       }
+               }
+
+               static void AddCheckpoint (int file, int row)
+               {
+                       if (checkpoints.Length == ++checkpoint_index) {
+                               Checkpoint [] tmp = new Checkpoint [checkpoint_index * 2];
+                               Array.Copy (checkpoints, tmp, checkpoints.Length);
+                               checkpoints = tmp;
+                       }
+                       checkpoints [checkpoint_index] = new Checkpoint (file, row);
                }
 
                public override string ToString ()
                {
-                       return Name + ": (" + Row + ")";
+                       if (column_bits == 0)
+                               return Name + "(" + Row + "):";
+                       else
+                               return Name + "(" + Row + "," + Column +
+                                       (Column == column_mask ? "+):" : "):");
                }
                
                /// <summary>
                ///   Whether the Location is Null
                /// </summary>
-               static public bool IsNull (Location l)
-               {
-                       return l.token == 0;
+               public bool IsNull {
+                       get { return token == 0; }
                }
 
                public string Name {
                        get {
-                               int index = token & source_mask;
-                               if ((token == 0) || (index == 0))
+                               int index = File;
+                               if (token == 0 || index == 0)
                                        return "Internal";
 
                                SourceFile file = (SourceFile) source_list [index - 1];
@@ -205,18 +270,32 @@ namespace Mono.CSharp {
                        }
                }
 
+               int CheckpointIndex {
+                       get { return (int) ((token & 0xFFFF0000) >> (line_delta_bits + column_bits)); }
+               }
+
                public int Row {
                        get {
                                if (token == 0)
                                        return 1;
+                               return checkpoints [CheckpointIndex].LineOffset + ((token & line_delta_mask) >> column_bits);
+                       }
+               }
 
-                               return token >> source_bits;
+               public int Column {
+                       get {
+                               if (token == 0)
+                                       return 1;
+                               return (int) (token & column_mask);
                        }
                }
 
                public int File {
                        get {
-                               return token & source_mask;
+                               if (token == 0)
+                                       return 0;
+if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format ("Should not happen. Token is {0:X04}, checkpoints are {1}, index is {2}", token, checkpoints.Length, CheckpointIndex));
+                               return checkpoints [CheckpointIndex].File;
                        }
                }
 
@@ -234,11 +313,28 @@ namespace Mono.CSharp {
                // If we don't have a symbol writer, this property is always null.
                public SourceFile SourceFile {
                        get {
-                               int index = token & source_mask;
+                               int index = File;
                                if (index == 0)
                                        return null;
                                return (SourceFile) source_list [index - 1];
                        }
                }
        }
+
+       public class LocatedToken
+       {
+               public readonly Location Location;
+               public readonly string Value;
+
+               public LocatedToken (Location loc, string value)
+               {
+                       Location = loc;
+                       Value = value;
+               }
+
+               public override string ToString ()
+               {
+                       return Location.ToString () + Value;
+               }
+       }
 }
index 5eccd46ac98b9eb915f142dc6b7654ee815a781a..72c853919bed8e10990f025db57bacdb7a631e7d 100644 (file)
@@ -71,11 +71,12 @@ namespace Mono.CSharp {
                                throw new InternalErrorException ("Namespace has a null fullname");
 
                        if (parent != null && parent.MemberName != MemberName.Null)
-                               MemberName = new MemberName (parent.MemberName, name);
+                               MemberName = new MemberName (
+                                       parent.MemberName, name, parent.MemberName.Location);
                        else if (name == "")
                                MemberName = MemberName.Null;
                        else
-                               MemberName = new MemberName (name);
+                               MemberName = new MemberName (name, Location.Null);
 
                        entries = new ArrayList ();
                        namespaces = new Hashtable ();
@@ -273,7 +274,7 @@ namespace Mono.CSharp {
                        public UsingEntry (NamespaceEntry entry, MemberName name, Location loc)
                        {
                                Name = name;
-                               Expr = name.GetTypeExpression (loc);
+                               Expr = name.GetTypeExpression ();
                                NamespaceEntry = entry;
                                Location = loc;
                        }
@@ -313,7 +314,7 @@ namespace Mono.CSharp {
                        public AliasEntry (NamespaceEntry entry, string name, MemberName alias, Location loc)
                        {
                                Name = name;
-                               Alias = alias.GetTypeExpression (loc);
+                               Alias = alias.GetTypeExpression ();
                                NamespaceEntry = entry;
                                Location = loc;
                        }
@@ -451,6 +452,11 @@ namespace Mono.CSharp {
                                return;
                        }
 
+                       if (RootContext.Version == LanguageVersion.Default &&
+                           name == "global" && RootContext.WarningLevel >= 2)
+                               Report.Warning (440, loc, "An alias named `global' will not be used when resolving 'global::';" +
+                                       " the global namespace will be used instead");
+
                        aliases [name] = new AliasEntry (Doppelganger, name, alias, loc);
                }
 
@@ -471,6 +477,22 @@ namespace Mono.CSharp {
                                name, t1.FullName, t2.FullName);
                }
 
+               // Looks-up a alias named @name in this and surrounding namespace declarations
+               public FullNamedExpression LookupAlias (string name)
+               {
+                       AliasEntry entry = null;
+                       // We use Parent rather than ImplicitParent since we know implicit namespace declarations
+                       // cannot have using entries.
+                       for (NamespaceEntry n = this; n != null; n = n.Parent) {
+                               if (n.aliases == null)
+                                       continue;
+                               entry = n.aliases [name] as AliasEntry;
+                               if (entry != null)
+                                       return entry.Resolve ();
+                       }
+                       return null;
+               }
+
                private FullNamedExpression Lookup (DeclSpace ds, string name, Location loc, bool ignore_cs0104)
                {
                        //
index b6f2842e2daffae2e184bbe06a27ee39652168cd..bcdfffb558225d3437add24fd5845d4a2d0444dd 100644 (file)
@@ -123,11 +123,11 @@ namespace Mono.CSharp {
 
                        public virtual void Print (int code, Location location, string text)
                        {
-                               if (location.Equals (Location.Null)) {
+                               if (location.IsNull) {
                                        Print (code, "", text);
                                        return;
                                }
-                               Print (code, String.Format ("{0}({1})", location.Name, location.Row), text);
+                               Print (code, location.ToString (), text);
                        }
                }
 
@@ -287,7 +287,7 @@ namespace Mono.CSharp {
                
                static public void LocationOfPreviousError (Location loc)
                {
-                       Stderr.WriteLine (String.Format ("{0}({1}) (Location of symbol related to previous error)", loc.Name, loc.Row));
+                       Stderr.WriteLine (String.Format ("{0} (Location of symbol related to previous error)", loc));
                }    
         
                static public void RuntimeMissingSupport (Location loc, string feature) 
@@ -301,7 +301,7 @@ namespace Mono.CSharp {
                /// </summary>
                static public void SymbolRelatedToPreviousError (Location loc, string symbol)
                {
-                       SymbolRelatedToPreviousError (String.Format ("{0}({1})", loc.Name, loc.Row), symbol);
+                       SymbolRelatedToPreviousError (loc.ToString (), symbol);
                }
 
                static public void SymbolRelatedToPreviousError (MemberInfo mi)
@@ -350,7 +350,7 @@ namespace Mono.CSharp {
 
                public static void ExtraInformation (Location loc, string msg)
                {
-                       extra_information.Add (String.Format ("{0}({1}) {2}", loc.Name, loc.Row, msg));
+                       extra_information.Add (String.Format ("{0} {1}", loc, msg));
                }
 
                public static WarningRegions RegisterWarningRegion (Location location)
index 7f611340e8f05cad01134ad17b515191a84174b3..5fe7e02470cb4aaf593ddac59a3412f867db8158 100644 (file)
@@ -80,7 +80,7 @@ namespace Mono.CSharp {
                
                public void Error (int error, string s)
                {
-                       if (!Location.IsNull (loc))
+                       if (!loc.IsNull)
                                Report.Error (error, loc, s);
                                else
                                Report.Error (error, s);
@@ -410,7 +410,7 @@ namespace Mono.CSharp {
                Expression Test;
                readonly Statement InitStatement;
                readonly Statement Increment;
-               readonly Statement Statement;
+               public readonly Statement Statement;
                bool infinite, empty;
                
                public For (Statement initStatement,
@@ -527,10 +527,10 @@ namespace Mono.CSharp {
        public class StatementExpression : Statement {
                ExpressionStatement expr;
                
-               public StatementExpression (ExpressionStatement expr, Location l)
+               public StatementExpression (ExpressionStatement expr)
                {
                        this.expr = expr;
-                       loc = l;
+                       loc = expr.Location;
                }
 
                public override bool Resolve (EmitContext ec)
@@ -800,21 +800,24 @@ namespace Mono.CSharp {
                        if (expr == null)
                                return false;
 
-                       if (!(expr is Constant)){
+                       Constant c = expr as Constant;
+                       if (c == null) {
                                Error (150, "A constant value is expected");
                                return false;
                        }
 
-                       object val = Expression.ConvertIntLiteral (
-                               (Constant) expr, ec.Switch.SwitchType, loc);
+                       c = c.ToType (ec.Switch.SwitchType, loc);
+                       if (c == null)
+                               return false;
 
+                       object val = c.GetValue ();
                        if (val == null)
-                               return false;
+                               val = c;
                                        
                        sl = (SwitchLabel) ec.Switch.Elements [val];
 
                        if (sl == null){
-                               Report.Error (159, loc, "No such label `case {0}:' within the scope of the goto statement", val);
+                               Report.Error (159, loc, "No such label `case {0}:' within the scope of the goto statement", c.GetValue () == null ? "null" : val);
                                return false;
                        }
 
@@ -947,7 +950,7 @@ namespace Mono.CSharp {
 
                public override bool Resolve (EmitContext ec)
                {
-                       if (!ec.CurrentBranching.InLoop () && !ec.CurrentBranching.InSwitch ()){
+                       if (!ec.CurrentBranching.InLoop ()){
                                Error (139, "No enclosing loop out of which to break or continue");
                                return false;
                        } else if (ec.InFinally) {
@@ -1509,7 +1512,7 @@ namespace Mono.CSharp {
                        // treat it as if the variable declaration was in error.
                        //
                        Report.SymbolRelatedToPreviousError (loc, name);
-                       Error_AlreadyDeclared (kvi.Location, name, "child");
+                       Error_AlreadyDeclared (kvi.Location, name, "parent or current");
                        return false;
                }
 
@@ -1758,11 +1761,9 @@ namespace Mono.CSharp {
                                                continue;
                                        }
 
-                                       if (e.Type != variable_type){
-                                               e = Const.ChangeType (vi.Location, ce, variable_type);
-                                               if (e == null)
-                                                       continue;
-                                       }
+                                       e = ce.ToType (variable_type, vi.Location);
+                                       if (e == null)
+                                               continue;
 
                                        constants.Remove (name);
                                        constants.Add (name, e);
@@ -1856,6 +1857,36 @@ namespace Mono.CSharp {
                bool unreachable_shown;
                bool unreachable;
 
+               private void CheckPossibleMistakenEmptyStatement (Statement s)
+               {
+                       Statement body;
+
+                       // Some statements are wrapped by a Block. Since
+                       // others' internal could be changed, here I treat
+                       // them as possibly wrapped by Block equally.
+                       Block b = s as Block;
+                       if (b != null && b.statements.Count == 1)
+                               s = (Statement) b.statements [0];
+
+                       if (s is Lock)
+                               body = ((Lock) s).Statement;
+                       else if (s is For)
+                               body = ((For) s).Statement;
+                       else if (s is Foreach)
+                               body = ((Foreach) s).Statement;
+                       else if (s is While)
+                               body = ((While) s).Statement;
+                       else if (s is Using)
+                               body = ((Using) s).Statement;
+                       else if (s is Fixed)
+                               body = ((Fixed) s).Statement;
+                       else
+                               return;
+
+                       if (body == null || body is EmptyStatement)
+                               Report.Warning (642, 3, s.loc, "Possible mistaken empty statement");
+               }
+
                public override bool Resolve (EmitContext ec)
                {
                        Block prev_block = ec.CurrentBlock;
@@ -1877,6 +1908,11 @@ namespace Mono.CSharp {
                        int statement_count = statements.Count;
                        for (int ix = 0; ix < statement_count; ix++){
                                Statement s = (Statement) statements [ix];
+                               // Check possible empty statement (CS0642)
+                               if (RootContext.WarningLevel >= 3 &&
+                                       ix + 1 < statement_count &&
+                                               statements [ix + 1] is Block)
+                                       CheckPossibleMistakenEmptyStatement (s);
 
                                if (unreachable) {
                                        if (s is Block)
@@ -2322,20 +2358,17 @@ namespace Mono.CSharp {
                                return false;
                        }
 
-                       if (required_type == TypeManager.string_type) {
-                               if (c.Type == TypeManager.string_type) {
-                                       converted = c.GetValue ();
-                                       return true;
-                               }
-
-                               if (e is NullLiteral) {
-                                       converted = e;
-                                       return true;
-                               }
+                       if (required_type == TypeManager.string_type && e is NullLiteral) {
+                               converted = e;
+                               return true;
                        }
 
-                       converted = Expression.ConvertIntLiteral (c, required_type, loc);
-                       return converted != null;
+                       c = c.ToType (required_type, loc);
+                       if (c == null)
+                               return false;
+
+                       converted = c.GetValue ();
+                       return true;
                }
 
                public void Erorr_AlreadyOccurs ()
@@ -3054,7 +3087,7 @@ namespace Mono.CSharp {
 
        public class Lock : ExceptionStatement {
                Expression expr;
-               Statement Statement;
+               public Statement Statement;
                LocalBuilder temp;
                        
                public Lock (Expression expr, Statement stmt, Location l)
@@ -3325,6 +3358,10 @@ namespace Mono.CSharp {
                        loc = l;
                }
 
+               public Statement Statement {
+                       get { return statement; }
+               }
+
                public override bool Resolve (EmitContext ec)
                {
                        if (!ec.InUnsafe){
@@ -3757,7 +3794,7 @@ namespace Mono.CSharp {
 
        public class Using : ExceptionStatement {
                object expression_or_block;
-               Statement Statement;
+               public Statement Statement;
                ArrayList var_list;
                Expression expr;
                Type expr_type;
@@ -4073,7 +4110,11 @@ namespace Mono.CSharp {
                        statement = stmt;
                        loc = l;
                }
-               
+
+               public Statement Statement {
+                       get { return statement; }
+               }
+
                public override bool Resolve (EmitContext ec)
                {
                        expr = expr.Resolve (ec);
@@ -4285,7 +4326,7 @@ namespace Mono.CSharp {
                                        list.Add (counter [i]);
                                }
 
-                               access = new ElementAccess (copy, list, loc).Resolve (ec);
+                               access = new ElementAccess (copy, list).Resolve (ec);
                                if (access == null)
                                        return false;
 
@@ -4642,7 +4683,7 @@ namespace Mono.CSharp {
                                enumerator = new TemporaryVariable (enumerator_type, loc);
                                enumerator.Resolve (ec);
 
-                               init = new Invocation (get_enumerator, new ArrayList (), loc);
+                               init = new Invocation (get_enumerator, new ArrayList ());
                                init = init.Resolve (ec);
                                if (init == null)
                                        return false;
@@ -4653,7 +4694,7 @@ namespace Mono.CSharp {
                                        MethodGroupExpr mg = new MethodGroupExpr (mi, loc);
                                        mg.InstanceExpression = enumerator;
 
-                                       move_next_expr = new Invocation (mg, new ArrayList (), loc);
+                                       move_next_expr = new Invocation (mg, new ArrayList ());
                                }
 
                                get_current.InstanceExpression = enumerator;
index 9b9f6878a767e3e64ba84596be8ad662cd46fd0b..e858f05d5bc30b4206c568af1dbc36f16044b0eb 100644 (file)
@@ -447,7 +447,6 @@ namespace Mono.CSharp {
                        // Let the StreamWriter autodetect the encoder
                        reader.Peek ();
                        
-                       Encoding enc = reader.CurrentEncoding;
                        preamble_size = (int) reader.BaseStream.Position;
                }
 
@@ -481,23 +480,20 @@ namespace Mono.CSharp {
                                if ((value >= buffer_start) && (value < buffer_start + buffer_size)) {
                                        int byte_offset = value - buffer_start;
 
-                                       // pos is an index into a char
-                                       // buffer so it might be
-                                       // greater than the buffer
-                                       // length now, if the buffer
-                                       // contains multibyte chars
+                                       // If we have an uni-byte encoding, 'pos' will be the same as 
+                                       // 'byte_offset'.  If we have a multi-byte encoding, 'byte_offset'
+                                       // can be bigger than the desired value of 'pos', but not smaller.
+                                       // (IOW, the number of characters <= number of bytes)
+                                       //
+                                       // So, we start pos off at byte_offset, and fix it up.
                                        pos = byte_offset;
-                                       
-                                       // encoded characters can take
-                                       // more than 1 byte length.
-                                       while ((pos > buffer.Length) ||
-                                              reader.CurrentEncoding.GetByteCount (buffer, 0, pos) > byte_offset) {
-                                               pos--;
-                                       }
-                                       
+                                       if (pos > char_count)
+                                               pos = char_count;
+                                       while (reader.CurrentEncoding.GetByteCount (buffer, 0, pos) > byte_offset)
+                                               --pos;
                                        return;
                                }
-                               
+
                                if (value == 0) // Skip preamble
                                        value = preamble_size;
 
index 0123b7b6cd5cc759467c297839da9f2e38fb696e..529716d76f90003c8ee62dd7563d0565c41815b2 100644 (file)
@@ -63,7 +63,9 @@ namespace Mono.CSharp {
                        sighelper.AddArgument (builder.LocalType);
                        byte[] signature = sighelper.GetSignature ();
 
-                       DefineLocalVariable (name, signature);
+                       int index = MonoDebuggerSupport.GetLocalIndex (builder);
+
+                       DefineLocalVariable (index, name, signature);
                }
 
                public int OpenScope (ILGenerator ig)
index 2215e38abeaca95d9427246b1595dc950bc6d415..da1045ad250e1767a90547a6a28b969bb0ec501d 100644 (file)
@@ -74,7 +74,7 @@ namespace Mono.CSharp
        public sealed class RootTypes : TypeContainer
        {
                public RootTypes ()
-                       : base (null, null, MemberName.Null, null, Kind.Root, Location.Null)
+                       : base (null, null, MemberName.Null, null, Kind.Root)
                {
                        ec = new EmitContext (null, this, Location.Null, null, null, 0, false);
                }
index 5bcbedc04372184dca2e22f73acbd3724725e71b..417ae15132083fbce1163cf87149fcacc8a5e874 100644 (file)
@@ -283,11 +283,9 @@ public partial class TypeManager {
                builder_to_method = null;
                
                fields = null;
-               builder_to_constant = null;
                fieldbuilders_to_fields = null;
                events = null;
                priv_fields_events = null;
-               properties = null;
 
                type_hash = null;
                
@@ -489,11 +487,6 @@ public partial class TypeManager {
                return builder_to_declspace [t] as Delegate;
        }
 
-       public static Enum LookupEnum (Type t)
-       {
-               return builder_to_declspace [t] as Enum;
-       }
-       
        public static Class LookupClass (Type t)
        {
                return (Class) builder_to_declspace [t];
@@ -1592,11 +1585,12 @@ public partial class TypeManager {
        
        public static bool IsEnumType (Type t)
        {
-               if (t.IsSubclassOf (TypeManager.enum_type))
+               if (builder_to_declspace [t] is Enum)
                        return true;
-               else
-                       return false;
+
+               return t.IsEnum;
        }
+
        public static bool IsBuiltinOrEnum (Type t)
        {
                if (IsBuiltinType (t))
@@ -1651,7 +1645,14 @@ public partial class TypeManager {
 
                bool retval = true;
 
-               if (t is TypeBuilder){
+               for (Type p = t.DeclaringType; p != null; p = p.DeclaringType) {
+                       if (p.IsGenericTypeDefinition) {
+                               retval = false;
+                               break;
+                       }
+               }
+
+               if (t is TypeBuilder && retval) {
                        TypeContainer tc = LookupTypeContainer (t);
                        if (tc.Fields != null){
                                foreach (Field f in tc.Fields){
@@ -1666,7 +1667,7 @@ public partial class TypeManager {
                                        }
                                }
                        }
-               } else {
+               } else if (retval) {
                        FieldInfo [] fields = t.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                        
                        foreach (FieldInfo f in fields){
@@ -1833,27 +1834,6 @@ public partial class TypeManager {
        {
                return t.IsArray || t.IsPointer || t.IsByRef;
        }
-
-       static Hashtable builder_to_constant;
-
-       public static void RegisterConstant (FieldBuilder fb, Const c)
-       {
-               if (builder_to_constant == null)
-                       builder_to_constant = new PtrHashtable ();
-
-               if (builder_to_constant.Contains (fb))
-                       return;
-
-               builder_to_constant.Add (fb, c);
-       }
-
-       public static Const LookupConstant (FieldBuilder fb)
-       {
-               if (builder_to_constant == null)
-                       return null;
-               
-               return (Const) builder_to_constant [fb];
-       }
        
        /// <summary>
        ///   Gigantic work around for missing features in System.Reflection.Emit follows.
@@ -1963,23 +1943,17 @@ public partial class TypeManager {
                }
        }
        
-       // <remarks>
-       //  This is a workaround the fact that GetValue is not
-       //  supported for dynamic types
-       // </remarks>
-       static public bool RegisterFieldValue (FieldBuilder fb, object value)
+       public static void RegisterConstant (FieldInfo fb, IConstant ic)
        {
-               if (fields.Contains (fb))
-                       return false;
-
-               fields.Add (fb, value);
-
-               return true;
+               fields.Add (fb, ic);
        }
 
-       static public object GetValue (FieldBuilder fb)
+       public static IConstant GetConstant (FieldInfo fb)
        {
-               return fields [fb];
+               if (fb == null)
+                       return null;
+
+               return (IConstant)fields [fb];
        }
 
        static public bool RegisterFieldBase (FieldBuilder fb, FieldBase f)
@@ -2059,27 +2033,9 @@ public partial class TypeManager {
                        return (MemberInfo) priv_fields_events [ei];
        }
                
-       static Hashtable properties;
-       
-       static public bool RegisterProperty (PropertyBuilder pb, MethodBase get, MethodBase set)
-       {
-               if (properties == null)
-                       properties = new Hashtable ();
-
-               if (properties.Contains (pb))
-                       return false;
-
-               properties.Add (pb, new Pair (get, set));
-
-               return true;
-       }
-
        static public bool RegisterIndexer (PropertyBuilder pb, MethodBase get,
                                             MethodBase set, Type[] args)
        {
-               if (!RegisterProperty (pb, get,set))
-                       return false;
-
                indexer_arguments.Add (pb, args);
 
                return true;
index 4e8e996613d45ef6a8bda29d631a13b12da9130e..8b84b8666c8f1788b0e42f131297720b61ef7bb3 100644 (file)
@@ -1,3 +1,44 @@
+2005-09-15  Ankit Jain  <jankit@novell.com>
+
+       * DeclSecurity.cs (IDeclSecurityTarget.AddDeclSecurity): Remove.
+         (IDeclSecurityTarget.AddPermission),
+         (IDeclSecurityTarget.AddPermissionSet): New.
+         (DeclSecurity.IDeclSecurityTarget): Implement new interface methods.
+         (DeclSecurity.sec_action),
+         (DeclSecurity.data): Remove.
+         (DeclSecurity.permissionset_table): New.
+         (DeclSecurity.ctor): Replace parameterized constructor with a default one.
+         (DeclSecurity.AddTo): AddDeclSecurity for all Security Actions in the permissionset_table.
+       * TypeDef.cs (TypeDef.declsecurity_list): Remove.
+         (TypeDef.decl_sec): New.
+         (TypeDef.IDeclSecurityTarget): Implement new interface methods.
+         (TypeDef.DefineContents): Use new decl_sec instead of declsecurity_list.
+       * CodeGen.cs (CodeGen.assembly_declsec): Change type from ArrayList to DeclSecurity.
+         (CodeGen.EndAssemblyRef): Set current_customattrtarget and current_declsectarget to null.
+         (CodeGen.IDeclSecurityTarget): Implement new interface methods.
+         (CodeGen.Write): Add assembly_declsec to the assembly (using DeclSecurity.AddTo).
+       * ExternTable.cs (ExternAssembly.declsec_list): Remove.
+         (ExternAssembly.decl_sec): New.
+         (ExternAssembly.Resolve): Use new decl_sec instead of declsec_list.
+         (ExternAssembly.IDeclSecurityTarget): Implement new interface methods.
+       * MethodDef.cs (MethodDef.declsecurity_list): Remove.
+         (MethodDef.decl_sec): New.
+         (MethodDef.IDeclSecurityTarget): Implement new interface methods.
+         (MethodDef.WriteCode): Use new decl_sec instead of declsecurity_list.
+       * ExternTypeRef.cs (ExternTypeRef.GetReflectedType): New.  
+
+2005-09-08  Ankit Jain  <jankit@novell.com>
+
+       * CodeGen.cs (CodeGen.stack_reserve): New.
+         (CodeGen.SetStackReserve): New.
+         (CodeGen.Write): SetStackReserve on the pefile.
+
+2005-09-06  Ankit Jain  <jankit@novell.com>
+
+       * ExternTable.cs (ExternRef.is_resolved): New.
+         (ExternModule.Resolve, ExternAssembly.Resolve,
+         ExternTable.Resolve): Return if is_resolved. Set to true at the end.
+
 2005-08-29  Ankit Jain  <jankit@novell.com>
 
        * InstrTable.cs (inst_table): Comment out stelem and ldelem opcodes.
index 67074605e6b15415ef8e857ae5b1bcd4960a2ad9..b8574c07a1fb0ba4be138b51deb3490c5ad8b38c 100644 (file)
@@ -16,6 +16,8 @@ using System.Collections;
 using System.Reflection;\r
 using System.Reflection.Emit;\r
 using System.Text;\r
+using System.Security;\r
+\r
 \r
 namespace Mono.ILASM {\r
 \r
@@ -44,7 +46,7 @@ namespace Mono.ILASM {
                 private string assembly_locale;\r
                 private int assembly_hash_algorithm;\r
                 private ArrayList assembly_custom_attributes;\r
-                private ArrayList assembly_declsec;\r
+                private DeclSecurity assembly_declsec;\r
                         \r
                 private TypeManager type_manager;\r
                 private ExternTable extern_table;\r
@@ -59,6 +61,7 @@ namespace Mono.ILASM {
                 private int sub_system;\r
                 private int cor_flags;\r
                 private long image_base;\r
+                private long stack_reserve;\r
 \r
                 private string output_file;\r
                private string debug_file;\r
@@ -93,6 +96,7 @@ namespace Mono.ILASM {
                         sub_system = -1;\r
                         cor_flags = -1;\r
                         image_base = -1;\r
+                        stack_reserve = -1;\r
                         entry_point = false;\r
                 }\r
 \r
@@ -183,6 +187,11 @@ namespace Mono.ILASM {
                         this.image_base = image_base;\r
                 }\r
 \r
+                public void SetStackReserve (long stack_reserve)\r
+                {\r
+                        this.stack_reserve = stack_reserve;\r
+                }\r
+\r
                 public void SetAssemblyName (string name)\r
                 {\r
                         assembly_name = name;\r
@@ -348,6 +357,8 @@ namespace Mono.ILASM {
                 public void EndAssemblyRef ()\r
                 {\r
                         current_assemblyref = null;\r
+                        current_customattrtarget = null;\r
+                        current_declsectarget = null;\r
                 }\r
 \r
                 public void AddToDefineContentsList (TypeDef typedef)\r
@@ -385,11 +396,28 @@ namespace Mono.ILASM {
                         assembly_custom_attributes.Add (attribute);\r
                 }\r
 \r
-                public void AddAssemblyDeclSecurity (DeclSecurity decl_sec)\r
+                public void AddAssemblyPermission (PEAPI.SecurityAction sec_action, object perm)\r
                 {\r
                         if (assembly_declsec == null)\r
-                                assembly_declsec = new ArrayList ();\r
-                        assembly_declsec.Add (decl_sec);\r
+                                assembly_declsec = new DeclSecurity ();\r
+\r
+                        PermissionSet ps = perm as PermissionSet;\r
+                        if (ps == null)\r
+                                assembly_declsec.AddPermission (sec_action, (IPermission) perm);\r
+                        else\r
+                                assembly_declsec.AddPermissionSet (sec_action, ps);\r
+                }\r
+\r
+                public void AddPermission (PEAPI.SecurityAction sec_action, object perm)\r
+                {\r
+                        if (CurrentDeclSecurityTarget == null)\r
+                                return;\r
+\r
+                        PermissionSet ps = perm as PermissionSet;\r
+                        if (ps == null)\r
+                                CurrentDeclSecurityTarget.AddPermission (sec_action, (IPermission) perm);\r
+                        else\r
+                                CurrentDeclSecurityTarget.AddPermissionSet (sec_action, ps);\r
                 }\r
 \r
                 public void Write ()\r
@@ -432,15 +460,15 @@ namespace Mono.ILASM {
                                                 cattr.AddTo (this, asmb);\r
                                 }\r
                                 \r
-                                if (assembly_declsec != null) {\r
-                                        foreach (DeclSecurity decl_sec in assembly_declsec)\r
-                                                decl_sec.AddTo (this, asmb);\r
-                                }\r
+                                if (assembly_declsec != null)\r
+                                        assembly_declsec.AddTo (this, asmb);        \r
 \r
                                 if (sub_system != -1)\r
                                         pefile.SetSubSystem ((PEAPI.SubSystem) sub_system);\r
                                 if (cor_flags != -1)\r
                                         pefile.SetCorFlags (cor_flags);\r
+                                if (stack_reserve != -1)\r
+                                        pefile.SetStackReserve (stack_reserve);\r
 \r
                                 asmb.AddAssemblyInfo(assembly_major_version,\r
                                                 assembly_minor_version, assembly_build_version,\r
index cc284a067bba19f5bf3acb9f2963374509c0e45e..274d05e1d15fa98617da1bf97918efda18280ccc 100644 (file)
 
 using System;
 using System.Collections;
+using System.Security;
+using System.Security.Permissions;
 
 namespace Mono.ILASM {
 
         public interface IDeclSecurityTarget {
-                void AddDeclSecurity (DeclSecurity declsecurity);
+                void AddPermission (PEAPI.SecurityAction sec_action, IPermission iper);
+                void AddPermissionSet (PEAPI.SecurityAction sec_action, PermissionSet perm_set);
         }
 
         public class DeclSecurity {
 
-               private PEAPI.SecurityAction sec_action;
-               private byte[] data;
+                private Hashtable permissionset_table;
 
-               public DeclSecurity (PEAPI.SecurityAction sec_action, byte [] data)
+                public DeclSecurity ()
                 {
-                       this.sec_action = sec_action;
-                        this.data = data;
+                        permissionset_table = new Hashtable ();        
                 }
 
+                public void AddPermission (PEAPI.SecurityAction sec_action, IPermission perm)
+                {
+                        PermissionSet ps = (PermissionSet) permissionset_table [sec_action];
+                        if (ps == null) {
+                                ps = new PermissionSet (PermissionState.None);        
+                                permissionset_table [sec_action] = ps;
+                        }
+
+                        ps.AddPermission (perm);
+                }
+
+                public void AddPermissionSet (PEAPI.SecurityAction sec_action, PermissionSet perm_set)
+                {
+                        PermissionSet ps = (PermissionSet) permissionset_table [sec_action];
+                        if (ps == null) {
+                                permissionset_table [sec_action] = perm_set;
+                                return;
+                        }
+
+                        foreach (IPermission iper in perm_set)
+                                ps.AddPermission (iper);
+                }
+               
                 public void AddTo (CodeGen code_gen, PEAPI.MetaDataElement elem)
                 {
-                        code_gen.PEFile.AddDeclSecurity (sec_action, data, elem);
+                        System.Text.UnicodeEncoding ue = new System.Text.UnicodeEncoding ();
+                        foreach (PEAPI.SecurityAction sec_action in permissionset_table.Keys)
+                                code_gen.PEFile.AddDeclSecurity (sec_action, 
+                                        ue.GetBytes (((PermissionSet) permissionset_table [sec_action]).ToXml ().ToString ()), 
+                                        elem);
                 }
 
         }
index 33905e30a923b0bc842281f5decb11f7ab43d137..9339658a5731385741d5b3617e4d73cd3074d59a 100644 (file)
@@ -10,6 +10,7 @@
 using System;
 using System.Collections;
 using System.Reflection;
+using System.Security;
 
 namespace Mono.ILASM {
 
@@ -24,6 +25,7 @@ namespace Mono.ILASM {
                 protected Hashtable class_table;
                 protected Hashtable typeref_table;
                 protected ArrayList customattr_list;
+                protected bool is_resolved;
 
                 public abstract void Resolve (CodeGen codegen);
                 public abstract PEAPI.IExternRef GetExternRef ();
@@ -101,10 +103,15 @@ namespace Mono.ILASM {
 
                 public override void Resolve (CodeGen codegen)
                 {
+                        if (is_resolved)
+                                return;
+
                         ModuleRef = codegen.PEFile.AddExternModule (name);
                         if (customattr_list != null)
                                 foreach (CustomAttr customattr in customattr_list)
                                         customattr.AddTo (codegen, ModuleRef);
+
+                        is_resolved = true;
                 }
 
                 
@@ -123,7 +130,7 @@ namespace Mono.ILASM {
                 private byte [] public_key_token;
                 private string locale;
                 private byte [] hash;
-                private ArrayList declsec_list;
+                private DeclSecurity decl_sec;
 
                 public ExternAssembly (string name, AssemblyName asmb_name) : base (name)
                 {
@@ -133,6 +140,9 @@ namespace Mono.ILASM {
 
                 public override void Resolve (CodeGen code_gen)
                 {
+                        if (is_resolved)
+                                return;
+
                         AssemblyRef = code_gen.PEFile.AddExternAssembly (name);
                         if (major != -1)
                                 AssemblyRef.AddVersionInfo (major, minor, build, revision);
@@ -149,11 +159,12 @@ namespace Mono.ILASM {
                                 foreach (CustomAttr customattr in customattr_list)
                                         customattr.AddTo (code_gen, AssemblyRef);
                                         
-                        if (declsec_list != null)
-                                foreach (DeclSecurity decl_sec in declsec_list)
-                                        decl_sec.AddTo (code_gen, AssemblyRef);
+                        if (decl_sec != null)
+                                decl_sec.AddTo (code_gen, AssemblyRef);
 
                         class_table = new Hashtable ();
+
+                        is_resolved = true;
                 }
 
                 public override PEAPI.IExternRef GetExternRef ()
@@ -161,12 +172,20 @@ namespace Mono.ILASM {
                         return AssemblyRef;
                 }
                 
-                public void AddDeclSecurity (DeclSecurity decl_sec)
+                public void AddPermissionSet (PEAPI.SecurityAction sec_action, PermissionSet ps)
                 {
-                        if (declsec_list == null)
-                                declsec_list = new ArrayList ();
+                        if (decl_sec == null)
+                                decl_sec = new DeclSecurity ();
 
-                        declsec_list.Add (decl_sec);
+                        decl_sec.AddPermissionSet (sec_action, ps);        
+                }
+                
+                public void AddPermission (PEAPI.SecurityAction sec_action, IPermission iper)
+                {
+                        if (decl_sec == null)
+                                decl_sec = new DeclSecurity ();
+
+                        decl_sec.AddPermission (sec_action, iper);
                 }
 
                 public void SetVersion (int major, int minor, int build, int revision)
@@ -204,6 +223,7 @@ namespace Mono.ILASM {
 
                 Hashtable assembly_table;
                 Hashtable module_table;
+                bool is_resolved;
                 
                 public void AddCorlib ()
                 {
@@ -258,6 +278,9 @@ namespace Mono.ILASM {
 
                 public void Resolve (CodeGen code_gen)
                 {
+                        if (is_resolved)
+                                return;
+
                         if (assembly_table != null)
                                 foreach (ExternAssembly ext in assembly_table.Values)
                                         ext.Resolve (code_gen);
@@ -265,6 +288,8 @@ namespace Mono.ILASM {
                                 return;
                         foreach (ExternModule ext in module_table.Values)
                                 ext.Resolve (code_gen);
+
+                       is_resolved = true;     
                 }
 
                 public ExternTypeRef GetTypeRef (string asmb_name, string full_name, bool is_valuetype)
index bcf6879bd4e4c6cde75474934c235dbd7ea64440..e8d379e30115131f2badbfa153ff131824d5aaba 100644 (file)
@@ -183,6 +183,21 @@ namespace Mono.ILASM {
 
                         return klass;
                 }        
+
+                public System.Type GetReflectedType ()
+                {
+                        ExternRef er = extern_ref as ExternRef;
+                        if (er != null) {
+                                ExternAssembly ea = er as ExternAssembly;
+                                if (ea != null) {
+                                        System.Reflection.Assembly asm = System.Reflection.Assembly.Load (er.Name);
+
+                                        return asm.GetType (FullName);
+                                }/* else ExternModule */
+
+                        } /*else - nested type? */
+                        return null;
+                }
         }
 
 }
index 7d4e98474a061d908f26708e3f2756902a6f9160..e060ef21de0674debc548dd3918d4f08ea418ca4 100644 (file)
@@ -11,6 +11,7 @@
 using System;
 using System.Text;
 using System.Collections;
+using System.Security;
 
 
 namespace Mono.ILASM {
@@ -33,7 +34,7 @@ namespace Mono.ILASM {
                 private ArrayList param_list;
                 private ArrayList inst_list;
                 private ArrayList customattr_list;
-                private ArrayList declsecurity_list;
+                private DeclSecurity decl_sec;
                 private Hashtable label_table;
                 private Hashtable labelref_table;
                 private ArrayList label_list;
@@ -185,12 +186,20 @@ namespace Mono.ILASM {
                         customattr_list.Add (customattr);
                 }
 
-                public void AddDeclSecurity (DeclSecurity declsecurity)
+                public void AddPermissionSet (PEAPI.SecurityAction sec_action, PermissionSet ps)
                 {
-                        if (declsecurity_list == null)
-                                declsecurity_list = new ArrayList ();
-
-                        declsecurity_list.Add (declsecurity);
+                        if (decl_sec == null)
+                                decl_sec = new DeclSecurity ();
+                        
+                        decl_sec.AddPermissionSet (sec_action, ps);
+                }
+                
+                public void AddPermission (PEAPI.SecurityAction sec_action, IPermission iper)
+                {
+                        if (decl_sec == null)
+                                decl_sec = new DeclSecurity ();
+                        
+                        decl_sec.AddPermission (sec_action, iper);
                 }
 
                 public void AddRetTypeMarshalInfo (PEAPI.NativeType native_type)
@@ -402,10 +411,8 @@ namespace Mono.ILASM {
                                }
 
                         /// Add declarative security to this method
-                        if (declsecurity_list != null) {
-                                foreach (DeclSecurity declsecurity in declsecurity_list)
-                                        declsecurity.AddTo (code_gen, methoddef);
-
+                       if (decl_sec != null) {
+                               decl_sec.AddTo (code_gen, methoddef);
                                 methoddef.AddMethAttribute (PEAPI.MethAttr.HasSecurity);
                         }        
 
index 2122b291cfb8fdffc512a6da1ed3e17d47b43c60..f2c45be08a99a95f88ca4073856488dc346b2072 100644 (file)
@@ -10,6 +10,7 @@
 
 using System;
 using System.Collections;
+using System.Security;
 
 namespace Mono.ILASM {
 
@@ -32,7 +33,7 @@ namespace Mono.ILASM {
                 private ArrayList field_list;
                 private Hashtable method_table;
                 private ArrayList customattr_list;
-                private ArrayList declsecurity_list;
+                private DeclSecurity decl_sec;
                 private ArrayList event_list;
                 private ArrayList property_list;
                 private ArrayList typar_list;
@@ -213,12 +214,20 @@ namespace Mono.ILASM {
                         customattr_list.Add (customattr);
                 }
 
-                public void AddDeclSecurity (DeclSecurity declsecurity)
+                public void AddPermissionSet (PEAPI.SecurityAction sec_action, PermissionSet ps)
                 {
-                        if (declsecurity_list == null)
-                                declsecurity_list = new ArrayList ();
+                        if (decl_sec == null)
+                                decl_sec = new DeclSecurity ();
 
-                        declsecurity_list.Add (declsecurity);
+                        decl_sec.AddPermissionSet (sec_action, ps);
+                }
+
+                public void AddPermission (PEAPI.SecurityAction sec_action, IPermission iper)
+                {
+                        if (decl_sec == null)
+                                decl_sec = new DeclSecurity ();
+
+                        decl_sec.AddPermission (sec_action, iper);
                 }
 
                 public void AddGenericParam (string id)
@@ -368,11 +377,9 @@ namespace Mono.ILASM {
                                }
                         }
                         
-                        /// Add declarative security to this method
-                        if (declsecurity_list != null) {
-                                foreach (DeclSecurity declsecurity in declsecurity_list)
-                                        declsecurity.AddTo (code_gen, classdef);
-
+                        /// Add declarative security to this class
+                        if (decl_sec != null) {
+                                decl_sec.AddTo (code_gen, classdef);
                                 classdef.AddAttribute (PEAPI.TypeAttr.HasSecurity);
                        }       
 
index 7b7a426d9459d63f2c791079334f8e50f818d1cf..ed1b54a484184a76edb2c36cfe2f3aac1bc8b57d 100644 (file)
@@ -1,3 +1,24 @@
+2005-09-15  Ankit Jain  <jankit@novell.com>
+
+       * ILParser.jay (ILParser.NameValuePair): New.
+         (ILParser.PermPair): New.
+         (ILParser.CheckSecurityActionValidity): New.
+         (ILParser.ClassRefToObject): New.
+         (ILParser.TypeSpecToPermPair): New.
+         (class_decl | sec_decl): Use the new codegen.AddPermission .
+         (method_decl | sec_decl): Use the new codegen.AddPermission .
+         (sec_decl | D_PERMISSION ..): Use the new TypeSpecToPermPair method.
+         (sec_decl | D_PERMISSIONSET ..): Use PermissionSetAttribute to create PermissionSet
+         which will validate the bytearray.
+         (nameval_pairs): Create ArrayList of NameValuePair.
+         (nameval_pair): Create NameValuePair.
+         (cavalue | class_ref): Use ClassRefToObject.
+         (assembly_decl | sec_decl): Use the new codegen.AddAssemblyPermission .
+
+2005-09-08  Ankit Jain  <jankit@novell.com>
+
+       * ILParser.jay (decl | D_STACKRESERVE int64): New. Set stack reserve.
+
 2005-08-29  Ankit Jain  <jankit@novell.com>
 
        * ILParser.jay : Comment out K_LCID token.
index 4f314cb325bdc4860d14b422233908292866196a..76898863d5dc3b1ddb371574fbef79731c36d894 100644 (file)
@@ -11,6 +11,9 @@ using System;
 using System.IO;\r
 using System.Collections;\r
 using System.Globalization;\r
+using System.Reflection;\r
+using System.Security;\r
+using System.Security.Permissions;\r
 \r
 namespace Mono.ILASM {\r
 \r
@@ -26,7 +29,75 @@ namespace Mono.ILASM {
                 private PEAPI.PInvokeAttr pinvoke_attr;\r
                 private ILTokenizer tokenizer;\r
                static int yacc_verbose_flag;\r
+\r
+                class NameValuePair {\r
+                        public string Name;\r
+                        public object Value;\r
+\r
+                        public NameValuePair (string name, object value)\r
+                        {\r
+                                this.Name = name;\r
+                                this.Value = value;\r
+                        }\r
+                }\r
+\r
+                class PermPair {\r
+                        public PEAPI.SecurityAction sec_action;\r
+                        public object perm;\r
+\r
+                        public PermPair (PEAPI.SecurityAction sec_action, object perm)\r
+                        {\r
+                                this.sec_action = sec_action;\r
+                                this.perm = perm;\r
+                        }\r
+                }\r
+\r
+                public bool CheckSecurityActionValidity (System.Security.Permissions.SecurityAction action, bool for_assembly)\r
+                {\r
+                        if ((action == System.Security.Permissions.SecurityAction.RequestMinimum || \r
+                                action == System.Security.Permissions.SecurityAction.RequestOptional || \r
+                                action == System.Security.Permissions.SecurityAction.RequestRefuse) && !for_assembly) {\r
+                                Console.Error.WriteLine (String.Format ("System.Security.Permissions.SecurityAction '{0}' is not valid for this declaration", action));\r
+                                return false;\r
+                        }\r
+\r
+                        return true;\r
+                }\r
+\r
+                public object ClassRefToObject (object class_ref, object val)\r
+                {\r
+                        ExternTypeRef etr = class_ref as ExternTypeRef;\r
+                        if (etr == null)\r
+                                /* FIXME: report error? can be PrimitiveTypeRef or TypeRef */\r
+                                return null;\r
                                 \r
+                        System.Type t = etr.GetReflectedType ();\r
+                        return (t.IsEnum ? Enum.Parse (t, String.Format ("{0}", val)) : val);\r
+                }\r
+\r
+               /* Converts a type_spec to a corresponding PermPair */\r
+                PermPair TypeSpecToPermPair (object action, object type_spec, ArrayList pairs)\r
+                {\r
+                        ExternTypeRef etr = type_spec as ExternTypeRef;\r
+                        if (etr == null)\r
+                                /* FIXME: could be PrimitiveTypeRef or TypeRef \r
+                                          Report what error? */\r
+                                return null;\r
+\r
+                        System.Type t = etr.GetReflectedType ();\r
+                        object obj = Activator.CreateInstance (t, \r
+                                                new object [] {(System.Security.Permissions.SecurityAction) (short) action});\r
+\r
+                        if (pairs != null)\r
+                                foreach (NameValuePair pair in pairs) {\r
+                                        PropertyInfo pi = t.GetProperty (pair.Name);\r
+                                        pi.SetValue (obj, pair.Value, null);\r
+                                }\r
+\r
+                        IPermission iper = (IPermission) t.GetMethod ("CreatePermission").Invoke (obj, null);\r
+                        return new PermPair ((PEAPI.SecurityAction) action, iper);\r
+                }\r
+\r
                public ILParser (CodeGen codegen, ILTokenizer tokenizer)\r
                 {\r
                        this.codegen = codegen;\r
@@ -429,6 +500,10 @@ decl                       : class_all
                           {\r
                                 codegen.SetImageBase ((long) $2);\r
                           }\r
+                       | D_STACKRESERVE int64\r
+                          {\r
+                               codegen.SetStackReserve ((long) $2);\r
+                          }\r
                        | extsource_spec\r
                        | language_decl\r
                        ;\r
@@ -658,7 +733,11 @@ class_decl         : method_all
                        | data_decl\r
                        | sec_decl\r
                          {\r
-                               codegen.CurrentDeclSecurityTarget.AddDeclSecurity ((DeclSecurity) $1);\r
+                               PermPair pp = (PermPair) $1;\r
+                               if (!CheckSecurityActionValidity ((System.Security.Permissions.SecurityAction) (short) pp.sec_action, false))\r
+                                       throw new Exception (String.Format ("Invalid security action : {0}", pp.sec_action));\r
+\r
+                               codegen.AddPermission (pp.sec_action, pp.perm);\r
                          }\r
                        | extsource_spec\r
                        | customattr_decl\r
@@ -1846,7 +1925,11 @@ method_decl              : D_EMITBYTE int32
                        | instr\r
                        | sec_decl\r
                          {\r
-                               codegen.CurrentDeclSecurityTarget.AddDeclSecurity ((DeclSecurity) $1);\r
+                               PermPair pp = (PermPair) $1;\r
+                               if (!CheckSecurityActionValidity ((System.Security.Permissions.SecurityAction) (short) pp.sec_action, false))\r
+                                       throw new Exception (String.Format ("Invalid security action : {0}", pp.sec_action));\r
+\r
+                               codegen.AddPermission (pp.sec_action, pp.perm);\r
                          }\r
                        | extsource_spec\r
                        | language_decl\r
@@ -2493,28 +2576,65 @@ custom_type             : call_conv type type_spec DOUBLE_COLON D_CTOR OPEN_PARENS type_lis
                        ;\r
 \r
 sec_decl               : D_PERMISSION sec_action type_spec OPEN_PARENS nameval_pairs CLOSE_PARENS\r
+                         {\r
+                                $$ = TypeSpecToPermPair ($2, $3, (ArrayList) $5);\r
+                         }\r
                        | D_PERMISSION sec_action type_spec\r
+                         {\r
+                                $$ = TypeSpecToPermPair ($2, $3, null);\r
+                         }\r
                        | D_PERMISSIONSET sec_action ASSIGN bytes_list\r
                          {\r
-                               $$ = new DeclSecurity ((PEAPI.SecurityAction) $2, (byte []) $4);\r
+                               System.Text.UnicodeEncoding ue = new System.Text.UnicodeEncoding ();\r
+                               PermissionSetAttribute psa = new PermissionSetAttribute ((System.Security.Permissions.SecurityAction) (short) $2);\r
+                               psa.XML = ue.GetString ((byte []) $4);\r
+                               $$ = new PermPair ((PEAPI.SecurityAction) $2, psa.CreatePermissionSet ());\r
                          }\r
                        ;\r
 \r
 nameval_pairs          : nameval_pair \r
+                         {\r
+                               ArrayList pairs = new ArrayList ();\r
+                               pairs.Add ($1);\r
+                               $$ = pairs;\r
+                         }\r
                        | nameval_pairs COMMA nameval_pair\r
+                         {\r
+                               ArrayList pairs = (ArrayList) $1;\r
+                               pairs.Add ($3);\r
+                               $$ = pairs;\r
+                         }\r
                        ;\r
 \r
 nameval_pair           : comp_qstring ASSIGN cavalue\r
+                         {\r
+                               $$ = new NameValuePair ((string) $1, $3);\r
+                         }\r
                        ;\r
 \r
 cavalue                : truefalse\r
                        | int32\r
                        | int32 OPEN_PARENS int32 CLOSE_PARENS\r
+                         {\r
+                               $$ = $3;\r
+                         }\r
                        | comp_qstring \r
                        | class_ref OPEN_PARENS K_INT8 COLON int32 CLOSE_PARENS\r
+                         {\r
+                               $$ = ClassRefToObject ($1, (byte) (int) $5);\r
+                         }\r
                        | class_ref OPEN_PARENS K_INT16 COLON int32 CLOSE_PARENS\r
+                         {\r
+                               $$ = ClassRefToObject ($1, (short) (int) $5);\r
+                         }\r
                        | class_ref OPEN_PARENS K_INT32 COLON int32 CLOSE_PARENS\r
+                         {\r
+                               $$ = ClassRefToObject ($1, (int) $5);\r
+                         }\r
                        | class_ref OPEN_PARENS int32 CLOSE_PARENS\r
+                         {\r
+                               $$ = ClassRefToObject ($1, (int) $3);\r
+                         }\r
                        ;\r
 \r
 sec_action             : K_REQUEST\r
@@ -2667,7 +2787,11 @@ assembly_decl            : D_PUBLICKEY ASSIGN bytes_list
                          }\r
                        | sec_decl\r
                          {\r
-                               codegen.AddAssemblyDeclSecurity ((DeclSecurity) $1);\r
+                               PermPair pp = (PermPair) $1;\r
+                               if (!CheckSecurityActionValidity ((System.Security.Permissions.SecurityAction) (short) pp.sec_action, true))\r
+                                       throw new Exception (String.Format ("Invalid security action : {0}", pp.sec_action));\r
+\r
+                               codegen.AddAssemblyPermission (pp.sec_action, pp.perm);\r
                          }\r
                        ;\r
 \r
index 83cb14ff9ec3a4c8dd34e0945163de2b1e729e07..7337b3d8e1da2f0047ae1457438ea5d3c8748d2f 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-15  Ankit Jain  <jankit@novell.com>
+
+       * test-perm_fail-[1234].il: New. Negative Tests for .permission directive.
+       * test-perm_pass-1.il: New. Test for .permission directive.
+
 2005-08-23  Ankit Jain  <jankit@novell.com>
 
        * test-byref.il: New. Test for a call with byref return type.
diff --git a/mcs/ilasm/tests/test-perm_fail-1.il b/mcs/ilasm/tests/test-perm_fail-1.il
new file mode 100644 (file)
index 0000000..6e02e11
--- /dev/null
@@ -0,0 +1,19 @@
+.assembly extern mscorlib
+{
+}
+.assembly 'test-perm_fail-1'
+{
+}
+
+  .class interface public auto ansi abstract foo
+  {
+
+    .method public virtual  hidebysig  newslot  abstract 
+           instance default void abc ()  cil managed 
+    {
+       //Invalid enum value 
+       .permission demand [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (1))
+
+    }
+    
+  }
diff --git a/mcs/ilasm/tests/test-perm_fail-2.il b/mcs/ilasm/tests/test-perm_fail-2.il
new file mode 100644 (file)
index 0000000..64d9773
--- /dev/null
@@ -0,0 +1,18 @@
+.assembly extern mscorlib
+{
+}
+.assembly 'test-perm_fail-2'
+{
+}
+
+  .class interface public auto ansi abstract foo
+  {
+
+    .method public virtual  hidebysig  newslot  abstract 
+           instance default void abc ()  cil managed 
+    {
+       //reqopt allowed only for .assembly
+       .permission reqopt [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (16))
+    
+    }
+  }
diff --git a/mcs/ilasm/tests/test-perm_fail-3.il b/mcs/ilasm/tests/test-perm_fail-3.il
new file mode 100644 (file)
index 0000000..92c0611
--- /dev/null
@@ -0,0 +1,18 @@
+.assembly extern mscorlib
+{
+}
+.assembly 'test-perm_fail-3'
+{
+}
+
+  .class interface public auto ansi abstract foo
+  {
+
+    .method public virtual  hidebysig  newslot  abstract 
+           instance default void abc ()  cil managed 
+    {
+       //reqmin allowed only for .assembly
+       .permission reqmin [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (16))
+    
+    }
+  }
diff --git a/mcs/ilasm/tests/test-perm_fail-4.il b/mcs/ilasm/tests/test-perm_fail-4.il
new file mode 100644 (file)
index 0000000..b5f2bd5
--- /dev/null
@@ -0,0 +1,18 @@
+.assembly extern mscorlib
+{
+}
+.assembly 'test-perm_fail-4'
+{
+}
+
+  .class interface public auto ansi abstract foo
+  {
+
+    .method public virtual  hidebysig  newslot  abstract 
+           instance default void abc ()  cil managed 
+    {
+       //reqrefuse allowed only for .assembly
+       .permission reqrefuse [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (16))
+    
+    }
+  }
diff --git a/mcs/ilasm/tests/test-perm_pass-1.il b/mcs/ilasm/tests/test-perm_pass-1.il
new file mode 100644 (file)
index 0000000..31bcc28
--- /dev/null
@@ -0,0 +1,165 @@
+// Test for Syntactically valid .permission usage
+// The combination of security action and the permissions might not make sense
+
+.assembly extern mscorlib
+{
+}
+.assembly 'test-perm_pass-1'
+{
+    .permissionset reqopt =  (
+  3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00   // <.P.e.r.m.i.s.s.
+  69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00   // i.o.n.S.e.t. .c.
+  6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00   // l.a.s.s.=.".S.y.
+  73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00   // s.t.e.m...S.e.c.
+  75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00   // u.r.i.t.y...P.e.
+  72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+  53 00 65 00 74 00 22 00 0A 00 20 00 20 00 20 00   // S.e.t."... . . .
+  20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+  20 00 20 00 20 00 20 00 76 00 65 00 72 00 73 00   //  . . . .v.e.r.s.
+  69 00 6F 00 6E 00 3D 00 22 00 31 00 22 00 3E 00   // i.o.n.=.".1.".>.
+  0A 00 20 00 20 00 20 00 3C 00 49 00 50 00 65 00   // .. . . .<.I.P.e.
+  72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+  20 00 63 00 6C 00 61 00 73 00 73 00 3D 00 22 00   //  .c.l.a.s.s.=.".
+  53 00 79 00 73 00 74 00 65 00 6D 00 2E 00 53 00   // S.y.s.t.e.m...S.
+  65 00 63 00 75 00 72 00 69 00 74 00 79 00 2E 00   // e.c.u.r.i.t.y...
+  50 00 65 00 72 00 6D 00 69 00 73 00 73 00 69 00   // P.e.r.m.i.s.s.i.
+  6F 00 6E 00 73 00 2E 00 53 00 65 00 63 00 75 00   // o.n.s...S.e.c.u.
+  72 00 69 00 74 00 79 00 50 00 65 00 72 00 6D 00   // r.i.t.y.P.e.r.m.
+  69 00 73 00 73 00 69 00 6F 00 6E 00 2C 00 20 00   // i.s.s.i.o.n.,. .
+  6D 00 73 00 63 00 6F 00 72 00 6C 00 69 00 62 00   // m.s.c.o.r.l.i.b.
+  2C 00 20 00 56 00 65 00 72 00 73 00 69 00 6F 00   // ,. .V.e.r.s.i.o.
+  6E 00 3D 00 32 00 2E 00 30 00 2E 00 30 00 2E 00   // n.=.2...0...0...
+  30 00 2C 00 20 00 43 00 75 00 6C 00 74 00 75 00   // 0.,. .C.u.l.t.u.
+  72 00 65 00 3D 00 6E 00 65 00 75 00 74 00 72 00   // r.e.=.n.e.u.t.r.
+  61 00 6C 00 2C 00 20 00 50 00 75 00 62 00 6C 00   // a.l.,. .P.u.b.l.
+  69 00 63 00 4B 00 65 00 79 00 54 00 6F 00 6B 00   // i.c.K.e.y.T.o.k.
+  65 00 6E 00 3D 00 62 00 37 00 37 00 61 00 35 00   // e.n.=.b.7.7.a.5.
+  63 00 35 00 36 00 31 00 39 00 33 00 34 00 65 00   // c.5.6.1.9.3.4.e.
+  30 00 38 00 39 00 22 00 0A 00 20 00 20 00 20 00   // 0.8.9."... . . .
+  20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+  20 00 20 00 20 00 20 00 20 00 76 00 65 00 72 00   //  . . . . .v.e.r.
+  73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 22 00   // s.i.o.n.=.".1.".
+  0A 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   // .. . . . . . . .
+  20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+  20 00 46 00 6C 00 61 00 67 00 73 00 3D 00 22 00   //  .F.l.a.g.s.=.".
+  53 00 6B 00 69 00 70 00 56 00 65 00 72 00 69 00   // S.k.i.p.V.e.r.i.
+  66 00 69 00 63 00 61 00 74 00 69 00 6F 00 6E 00   // f.i.c.a.t.i.o.n.
+  22 00 2F 00 3E 00 0A 00 3C 00 2F 00 50 00 65 00   // "./.>...<./.P.e.
+  72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+  53 00 65 00 74 00 3E 00 0A 00                   ) // S.e.t.>...
+
+.permissionset demand =  (
+  3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00   // <.P.e.r.m.i.s.s.
+  69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00   // i.o.n.S.e.t. .c.
+  6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00   // l.a.s.s.=.".S.y.
+  73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00   // s.t.e.m...S.e.c.
+  75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00   // u.r.i.t.y...P.e.
+  72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+  53 00 65 00 74 00 22 00 0A 00 20 00 20 00 20 00   // S.e.t."... . . .
+  20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+  20 00 20 00 20 00 20 00 76 00 65 00 72 00 73 00   //  . . . .v.e.r.s.
+  69 00 6F 00 6E 00 3D 00 22 00 31 00 22 00 3E 00   // i.o.n.=.".1.".>.
+  0A 00 20 00 20 00 20 00 3C 00 49 00 50 00 65 00   // .. . . .<.I.P.e.
+  72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+  20 00 63 00 6C 00 61 00 73 00 73 00 3D 00 22 00   //  .c.l.a.s.s.=.".
+  53 00 79 00 73 00 74 00 65 00 6D 00 2E 00 53 00   // S.y.s.t.e.m...S.
+  65 00 63 00 75 00 72 00 69 00 74 00 79 00 2E 00   // e.c.u.r.i.t.y...
+  50 00 65 00 72 00 6D 00 69 00 73 00 73 00 69 00   // P.e.r.m.i.s.s.i.
+  6F 00 6E 00 73 00 2E 00 53 00 65 00 63 00 75 00   // o.n.s...S.e.c.u.
+  72 00 69 00 74 00 79 00 50 00 65 00 72 00 6D 00   // r.i.t.y.P.e.r.m.
+  69 00 73 00 73 00 69 00 6F 00 6E 00 2C 00 20 00   // i.s.s.i.o.n.,. .
+  6D 00 73 00 63 00 6F 00 72 00 6C 00 69 00 62 00   // m.s.c.o.r.l.i.b.
+  2C 00 20 00 56 00 65 00 72 00 73 00 69 00 6F 00   // ,. .V.e.r.s.i.o.
+  6E 00 3D 00 32 00 2E 00 30 00 2E 00 30 00 2E 00   // n.=.2...0...0...
+  30 00 2C 00 20 00 43 00 75 00 6C 00 74 00 75 00   // 0.,. .C.u.l.t.u.
+  72 00 65 00 3D 00 6E 00 65 00 75 00 74 00 72 00   // r.e.=.n.e.u.t.r.
+  61 00 6C 00 2C 00 20 00 50 00 75 00 62 00 6C 00   // a.l.,. .P.u.b.l.
+  69 00 63 00 4B 00 65 00 79 00 54 00 6F 00 6B 00   // i.c.K.e.y.T.o.k.
+  65 00 6E 00 3D 00 62 00 37 00 37 00 61 00 35 00   // e.n.=.b.7.7.a.5.
+  63 00 35 00 36 00 31 00 39 00 33 00 34 00 65 00   // c.5.6.1.9.3.4.e.
+  30 00 38 00 39 00 22 00 0A 00 20 00 20 00 20 00   // 0.8.9."... . . .
+  20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+  20 00 20 00 20 00 20 00 20 00 76 00 65 00 72 00   //  . . . . .v.e.r.
+  73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 22 00   // s.i.o.n.=.".1.".
+  0A 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   // .. . . . . . . .
+  20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+  20 00 46 00 6C 00 61 00 67 00 73 00 3D 00 22 00   //  .F.l.a.g.s.=.".
+  53 00 6B 00 69 00 70 00 56 00 65 00 72 00 69 00   // S.k.i.p.V.e.r.i.
+  66 00 69 00 63 00 61 00 74 00 69 00 6F 00 6E 00   // f.i.c.a.t.i.o.n.
+  22 00 2F 00 3E 00 0A 00 3C 00 2F 00 50 00 65 00   // "./.>...<./.P.e.
+  72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+  53 00 65 00 74 00 3E 00 0A 00                   ) // S.e.t.>...
+
+}
+
+  .class interface public auto ansi abstract foo
+  {
+
+    .method public virtual  hidebysig  newslot  abstract 
+           instance default void abc ()  cil managed 
+    {
+       //.permission demand [mscorlib]System.Security.Permissions.FileIOPermissionAttribute ("Write"="/tmp", "Read"="/tmp")
+       .permission demand [mscorlib]System.Security.Permissions.ReflectionPermissionAttribute ("MemberAccess"=true)
+       .permission deny [mscorlib]System.Security.Permissions.ReflectionPermissionAttribute
+
+       //IsolatedStorageContainment - enum
+       .permission demand [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (16))
+       .permission deny [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (int32:16))
+       .permission assert [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (int16:16))
+       .permission permitonly [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UsageAllowed"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (int8:16))
+
+       // UserQuota - long
+       // This is the *correct* way to specify the value for UserQuota ...
+       .permission linkcheck [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UserQuota"=70000)
+       
+       // ... but the following are also valid
+       .permission demand [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UserQuota"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (70000))
+       .permission deny [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UserQuota"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (int32:70000))
+       .permission assert [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UserQuota"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (int16:70000))
+       .permission permitonly [mscorlib]System.Security.Permissions.IsolatedStorageFilePermissionAttribute ("UserQuota"=[mscorlib]System.Security.Permissions.IsolatedStorageContainment (int8:1000))
+
+        .permissionset deny =  (
+        3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00   // <.P.e.r.m.i.s.s.
+        69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00   // i.o.n.S.e.t. .c.
+        6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00   // l.a.s.s.=.".S.y.
+        73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00   // s.t.e.m...S.e.c.
+        75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00   // u.r.i.t.y...P.e.
+        72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+        53 00 65 00 74 00 22 00 0A 00 20 00 20 00 20 00   // S.e.t."... . . .
+        20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+        20 00 20 00 20 00 20 00 76 00 65 00 72 00 73 00   //  . . . .v.e.r.s.
+        69 00 6F 00 6E 00 3D 00 22 00 31 00 22 00 3E 00   // i.o.n.=.".1.".>.
+        0A 00 20 00 20 00 20 00 3C 00 49 00 50 00 65 00   // .. . . .<.I.P.e.
+        72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+        20 00 63 00 6C 00 61 00 73 00 73 00 3D 00 22 00   //  .c.l.a.s.s.=.".
+        53 00 79 00 73 00 74 00 65 00 6D 00 2E 00 53 00   // S.y.s.t.e.m...S.
+        65 00 63 00 75 00 72 00 69 00 74 00 79 00 2E 00   // e.c.u.r.i.t.y...
+        50 00 65 00 72 00 6D 00 69 00 73 00 73 00 69 00   // P.e.r.m.i.s.s.i.
+        6F 00 6E 00 73 00 2E 00 53 00 65 00 63 00 75 00   // o.n.s...S.e.c.u.
+        72 00 69 00 74 00 79 00 50 00 65 00 72 00 6D 00   // r.i.t.y.P.e.r.m.
+        69 00 73 00 73 00 69 00 6F 00 6E 00 2C 00 20 00   // i.s.s.i.o.n.,. .
+        6D 00 73 00 63 00 6F 00 72 00 6C 00 69 00 62 00   // m.s.c.o.r.l.i.b.
+        2C 00 20 00 56 00 65 00 72 00 73 00 69 00 6F 00   // ,. .V.e.r.s.i.o.
+        6E 00 3D 00 31 00 2E 00 30 00 2E 00 35 00 30 00   // n.=.1...0...5.0.
+        30 00 30 00 2E 00 30 00 2C 00 20 00 43 00 75 00   // 0.0...0.,. .C.u.
+        6C 00 74 00 75 00 72 00 65 00 3D 00 6E 00 65 00   // l.t.u.r.e.=.n.e.
+        75 00 74 00 72 00 61 00 6C 00 2C 00 20 00 50 00   // u.t.r.a.l.,. .P.
+        75 00 62 00 6C 00 69 00 63 00 4B 00 65 00 79 00   // u.b.l.i.c.K.e.y.
+        54 00 6F 00 6B 00 65 00 6E 00 3D 00 62 00 37 00   // T.o.k.e.n.=.b.7.
+        37 00 61 00 35 00 63 00 35 00 36 00 31 00 39 00   // 7.a.5.c.5.6.1.9.
+        33 00 34 00 65 00 30 00 38 00 39 00 22 00 0A 00   // 3.4.e.0.8.9."...
+        20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+        20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+        76 00 65 00 72 00 73 00 69 00 6F 00 6E 00 3D 00   // v.e.r.s.i.o.n.=.
+        22 00 31 00 22 00 0A 00 20 00 20 00 20 00 20 00   // ".1."... . . . .
+        20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00   //  . . . . . . . .
+        20 00 20 00 20 00 20 00 46 00 6C 00 61 00 67 00   //  . . . .F.l.a.g.
+        73 00 3D 00 22 00 55 00 6E 00 6D 00 61 00 6E 00   // s.=.".U.n.m.a.n.
+        61 00 67 00 65 00 64 00 43 00 6F 00 64 00 65 00   // a.g.e.d.C.o.d.e.
+        22 00 2F 00 3E 00 0A 00 3C 00 2F 00 50 00 65 00   // "./.>...<./.P.e.
+        72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00   // r.m.i.s.s.i.o.n.
+        53 00 65 00 74 00 3E 00 0A 00                   ) // S.e.t.>...
+
+    }
+    
+  }
index 5d994050ebd2e3cbdd4e8629a3bbb506b73de39a..e2ef90e9a68c574ae5e492c77143a3bc59401458 100755 (executable)
@@ -1,3 +1,7 @@
+2005-09-20 Konstantin Triger <kostat@mainsift.com>
+
+       * Added jay.vcproj to build jay on pure Win32
+
 2005-03-14  Raja R Harinath  <rharinath@novell.com>
 
        * Makefile (install-local, uninstall-local): Disable when
diff --git a/mcs/jay/jay.vcproj b/mcs/jay/jay.vcproj
new file mode 100755 (executable)
index 0000000..a516b02
--- /dev/null
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="7.10"\r
+       Name="jay"\r
+       ProjectGUID="{5D485D32-3B9F-4287-AB24-C8DA5B89F537}"\r
+       RootNamespace="jay"\r
+       Keyword="Win32Proj">\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"/>\r
+       </Platforms>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               PreprocessorDefinitions="SKEL_DIRECTORY=&quot;&quot;.&quot;&quot;"\r
+                               MinimalRebuild="TRUE"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="5"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="TRUE"\r
+                               DebugInformationFormat="4"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(ProjectDir)/jay.exe"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="TRUE"\r
+                               ProgramDatabaseFile="$(OutDir)/jay.pdb"\r
+                               SubSystem="1"\r
+                               TargetMachine="1"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="SKEL_DIRECTORY=&quot;&quot;.&quot;&quot;"\r
+                               RuntimeLibrary="4"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="TRUE"\r
+                               DebugInformationFormat="3"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(ProjectDir)/jay.exe"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="TRUE"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="1"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">\r
+                       <File\r
+                               RelativePath=".\closure.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\error.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\lalr.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\lr0.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\main.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\mkpar.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\output.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\reader.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\symtab.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\verbose.c">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\warshall.c">\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">\r
+                       <File\r
+                               RelativePath=".\defs.h">\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
index 6a0e0c6b40d98e0611dec8bed292cca557d6cf7a..d990d8e86e4fb3f2fed1a95d7f6cb340a16f3da6 100644 (file)
@@ -1,3 +1,15 @@
+2005-09-16  Renato Suga <renato@psl-pr.softwarelivre.org>
+       * mb-parser.jay:rules goto_statement and for_statement changed in order to recognize error BC30757
+       
+       * statement.cs: class added property LabelName and uncomented string label_name. These changes allow one to get the LabelName when reporting an error
+
+       * block.cs: added property bool HasGotoStatement and property String LAbelName. The first one combined with HasLabeledStatement allows one to identify the aforementioned error.
+
+2005-09-15  Maverson Eduardo Schulze Rosa <maverson@gmail.com>
+           Alexandre Rocha Lima e Marcondes
+           <alexandre@psl-pr.softwarelivre.org>
+       *  mb-parser.jay : Error statement statemet support.
+
 2005-08-23 Satya Sudha K <ksathyasudha@novell.com>
        * statement.cs : 
                StatementSequence : Avoid Resolving multiple times
index bca628081f4ef3c1ea8d726d95197945e1ce9fcb..51ded72f41a9be52e468056ef4dbdc96a0ac6e95 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-15  Maverson Eduardo Schulze Rosa <maverson@gmail.com>
+           Alexandre Rocha Lima e Marcondes
+           <alexandre@psl-pr.softwarelivre.org>
+       *  Error.vb : Error statement runtime test.
 
 2005-05-03  Ritvik Mayank  <mritvik@novell.com>
        Made correction in few test cases
diff --git a/mcs/mbas/Test/rerrors/Test/Error.vb b/mcs/mbas/Test/rerrors/Test/Error.vb
new file mode 100644 (file)
index 0000000..1f391ae
--- /dev/null
@@ -0,0 +1,22 @@
+' Authors:
+'   Alexandre Rocha Lima e Marcondes (alexandre@psl-pr.softwarelivre.org)
+'   Maverson Eduardo Schulze Rosa (maverson@gmail.com)
+'
+' GrupoTIC - UFPR - Federal University of Paraná
+
+Imports System
+Imports Nunit.Framework
+
+<TestFixture> _
+Public Class errorstmt
+
+               <Test, ExpectedException (GetType (System.FormatException))> _
+        Public Sub TestErrorString()
+               error "aaa"
+        End Sub
+        <Test, ExpectedException (GetType (System.InvalidCastException))> _
+        Public Sub TestErrorObject()
+            error new Object()
+        End Sub
+End Class
+
index 1c59e6d165cdef05aff30a15e1b955102833080d..24e5c453e69f380943ca08d3f64932d8825c7c6a 100644 (file)
@@ -11,6 +11,7 @@ AssignmentStatements4.vb
 ConditionalStatements1.vb
 DecimalLiteral1.vb
 DoubleLiteral1.vb
+Error.vb
 ExceptionHandling1.vb
 ExpConversionDoubletoByte1.vb
 ExpConversionDoubletoDecimal2.vb
@@ -88,3 +89,4 @@ ShiftOperators1.vb
 StringLiterals1.vb
 Variables1.vb
 Variables2.vb
+
index 9ec207f94b54fe58e7eb181f54c54162da738a2d..21d86c4e390c99056ef203ac92a4301e414a208c 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-15  Maverson Eduardo Schulze Rosa <maverson@gmail.com>
+           Alexandre Rocha Lima e Marcondes
+           <alexandre@psl-pr.softwarelivre.org>
+       *  Error.vb : Error statement test.
+
 2005-07-13 Maverson Eduardo Schulze Rosa <maverson@gmail.com>
        *  LocalDeclarationB.vb : Static local on classes and modules test.
        *  LocalDeclarationC.vb : Inner block static local test.
diff --git a/mcs/mbas/Test/tests/statements/Error.vb b/mcs/mbas/Test/tests/statements/Error.vb
new file mode 100644 (file)
index 0000000..2837d81
--- /dev/null
@@ -0,0 +1,23 @@
+' Authors:
+'   Alexandre Rocha Lima e Marcondes (alexandre@psl-pr.softwarelivre.org)
+'   Maverson Eduardo Schulze Rosa (maverson@gmail.com)
+'
+' GrupoTIC - UFPR - Federal University of Paraná
+
+
+Module errorstmt
+
+        Public Dim error_number as integer = 11
+
+        Sub Main()
+               Try
+                error error_number
+                
+                Catch  ex As System.Exception
+                       If not (ex.GetType() = GetType(System.DivideByZeroException)) Then
+                               Throw new System.Exception("#A1 Error not working")
+                       End If
+                End Try        
+        End Sub
+End Module
+
index 6002903aaf738abc8249c8fa11433691e42ce2aa..af732cc9e25d152ab11ce34b414103c343c4feef 100644 (file)
@@ -188,6 +188,30 @@ namespace Mono.MonoBASIC {
                                return false;
                        }
                }
+               
+               public bool HasGotoStatement {
+                       get {
+                               foreach( Statement s in statements ) {
+                                       if( s is Goto )
+                                               return true;
+                                       else if (s is Block )
+                                               return ( ((Block) s).HasLabeledStatement);
+                               }
+                               return false;
+                       }
+               }
+               
+               public string LabelName {
+                       get {
+                               foreach( Statement s in statements ) {
+                                       if( s is LabeledStatement )
+                                               return ((LabeledStatement)s).LabelName;
+                                       else if (s is Block )
+                                               return ( ((Block) s).LabelName);
+                               }
+                               return "";
+                       }
+               }
                                
                /// <summary>
                ///   Adds a label to the current block. 
index bf73a42ae856f5658aa43cda2b60663932572f63..d204d5808ffd24193a72cb99521c866afd002728 100644 (file)
@@ -2786,6 +2786,7 @@ embedded_statement
        | synclock_statement
        | jump_statement
        | array_handling_statement 
+       | error_statement
        ;
 /*        
 empty_statement
@@ -2796,6 +2797,20 @@ empty_statement
        ;        
 */
 
+error_statement
+       : ERROR _mark_ expression {
+       
+               Expression primary_expression = DecomposeQI ("Microsoft.VisualBasic.CompilerServices.ProjectData.CreateProjectError", (Location) $2 );
+               
+               Argument error_number = new Argument ((Expression) $3, Argument.AType.Expression);
+               ArrayList args = new ArrayList();
+               args.Add(error_number);
+               
+               Invocation CreateProjectErrorInvoke =  new Invocation (primary_expression, args, (Location)$2);
+               $$ = new Throw (CreateProjectErrorInvoke ,(Location)$2);
+       }
+;
+
 with_statement
         // : WITH _mark_ expression end_of_stmt /* was : WITH qualified_identifier end_of_stmt */
         : WITH _mark_ qualified_identifier end_of_stmt /* was : WITH qualified_identifier end_of_stmt */
@@ -2920,6 +2935,7 @@ goto_statement
                $$ = new Goto (current_block, (string) $2, lexer.Location);
 
                current_block = block;
+               current_block.SetEndLocation(lexer.Location);
          }
        ;
        
@@ -3374,6 +3390,8 @@ for_statement
                }
 
                Block inner_statement = end_block();
+               if (!inner_statement.HasGotoStatement && inner_statement.HasLabeledStatement)
+                       Report.Error(30757, inner_statement.Parent.EndLocation, "'Goto "+inner_statement.LabelName+"' is not valid because '"+inner_statement.LabelName+"' is inside a 'For' or 'ForEach' statement that does not contain this statement.");
                Location l = (Location)$2;
                Expression for_var = (Expression) DecomposeQI ((string)$3, l);
                        
@@ -6070,3 +6088,6 @@ void HandleConditionalDirective(IfElseStateMachine.Token tok, BoolLiteral expr)
 }
 /* end end end */
 }
+
+
+
index e675aa63ec5cb19a03a37b698571156b11c53975..e39c369397a06ea543ae13f50fc8893cdf621bd6 100644 (file)
@@ -935,7 +935,7 @@ namespace Mono.MonoBASIC {
 
        public class LabeledStatement : Statement {
                public readonly Location Location;
-               //string label_name;
+               string label_name;
                bool defined;
                bool referenced;
                Label label;
@@ -944,9 +944,15 @@ namespace Mono.MonoBASIC {
                
                public LabeledStatement (string label_name, Location l)
                {
-                       //this.label_name = label_name;
+                       this.label_name = label_name;
                        this.Location = l;
                }
+               
+               public string LabelName {
+                       get {
+                               return label_name;
+                       }
+               }
 
                public Label LabelTarget (EmitContext ec)
                {
index 39db7c060f4dabcd28d7192a6729a67bf9ae886b..10043cf0da0c2047eb904ab551896a4efbf499d1 100644 (file)
@@ -1,3 +1,66 @@
+2005-09-19  Marek Safar  <marek.safar@seznam.cz>
+
+       * cs-parser.jay: interface_accessors replaced by
+       accessor_declarations.
+
+       * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
+       location.
+       
+       * statement.cs (GotoCase.Resolve): Convert null constant to
+       null case.
+       (SwitchLabel.ResolveAndReduce): Ditto.
+       (SwitchLabel.NullStringCase): Custom null stamp.
+       (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
+       
+       typemanager.cs (CSharpSignature): Don't skip first argument
+       for full names.
+
+2005-09-18  Miguel de Icaza  <miguel@novell.com>
+
+       * driver.cs: Set InEmacs based on the environment variable EMACS. 
+
+       * location.cs (InEmacs): in this mode, do not report column
+       location as it confuses Emacs.
+
+2005-09-16  Marek Safar  <marek.safar@seznam.cz>
+
+       * cfold.cs, constant.cs, convert.cs, ecore.cs,
+       expression.cs, iterators.cs, literal.cs: Store constants and
+       literals location.
+       
+       * class.cs (MemberBase.ShortName): Pass location.
+       
+       * cs-parser.jay: Some location fixes.
+       
+       * ecore.cs (Expression.Location): Made virtual.
+
+2005-09-05  Miguel de Icaza  <miguel@novell.com>
+
+       * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
+       if the underlying types are the same, otherwise we need to produce
+       code that will do the proper cast.
+
+       This was exposed by Marek's constant rewrite which produced
+       invalid code for the call site:
+
+       enum X : long { a }
+       void Method (X v) {}
+
+       Method ((X) 5)
+
+       This fixes test-49.cs
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * attribute.cs : (Attribute.IsValidArgumentType): array of string/
+         Type/Object should be allowed as well. Fixed bug #75968.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * expression.cs : (Binary.DoResolve): when one is enum constant and
+         another is constant 0, then return enum one *as enum type*.
+         Fixed bug 74846.
+
 2005-09-02  Raja R Harinath  <rharinath@novell.com>
 
        * attribute.cs (GetMarshal): Work even if "DefineCustom" is
index af8e518fcf37b18e13105ee85ebbdf167f6b49e4..7a046567ef9cd4e969ac62ccecd1bf9e17f2a014 100644 (file)
@@ -271,8 +271,10 @@ namespace Mono.CSharp {
 
                bool IsValidArgumentType (Type t)
                {
+                       if (t.IsArray)
+                               t = t.GetElementType ();
+
                        return TypeManager.IsPrimitiveType (t) ||
-                               (t.IsArray && TypeManager.IsPrimitiveType (t.GetElementType ())) ||
                                TypeManager.IsEnumType (t) ||
                                t == TypeManager.string_type ||
                                t == TypeManager.object_type ||
index 0c69e1c5d3dfc80be89753efb9f04014b287e1c0..f9cc1d2204e198a9e9baf72f954f89697740e9ac 100644 (file)
@@ -118,9 +118,9 @@ namespace Mono.CSharp {
                                if (ic != null){
                                        if (ic.Value >= 0){
                                                if (left == other)
-                                                       left = new UIntConstant ((uint) ic.Value);
+                                                       left = new UIntConstant ((uint) ic.Value, ic.Location);
                                                else
-                                                       right = new UIntConstant ((uint) ic.Value);
+                                                       right = new UIntConstant ((uint) ic.Value, ic.Location);
                                                return;
                                        }
                                }
@@ -235,7 +235,7 @@ namespace Mono.CSharp {
                                        IntConstant v;
                                        int res = ((IntConstant) left).Value | ((IntConstant) right).Value;
                                        
-                                       v = new IntConstant (res);
+                                       v = new IntConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -244,7 +244,7 @@ namespace Mono.CSharp {
                                        UIntConstant v;
                                        uint res = ((UIntConstant)left).Value | ((UIntConstant)right).Value;
                                        
-                                       v = new UIntConstant (res);
+                                       v = new UIntConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -253,7 +253,7 @@ namespace Mono.CSharp {
                                        LongConstant v;
                                        long res = ((LongConstant)left).Value | ((LongConstant)right).Value;
                                        
-                                       v = new LongConstant (res);
+                                       v = new LongConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -263,7 +263,7 @@ namespace Mono.CSharp {
                                        ulong res = ((ULongConstant)left).Value |
                                                ((ULongConstant)right).Value;
                                        
-                                       v = new ULongConstant (res);
+                                       v = new ULongConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -273,7 +273,7 @@ namespace Mono.CSharp {
                                        ushort res = (ushort) (((UShortConstant)left).Value |
                                                               ((UShortConstant)right).Value);
                                        
-                                       v = new UShortConstant (res);
+                                       v = new UShortConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -283,7 +283,7 @@ namespace Mono.CSharp {
                                        short res = (short) (((ShortConstant)left).Value |
                                                             ((ShortConstant)right).Value);
                                        
-                                       v = new ShortConstant (res);
+                                       v = new ShortConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -300,7 +300,7 @@ namespace Mono.CSharp {
                                        IntConstant v;
                                        int res = ((IntConstant) left).Value & ((IntConstant) right).Value;
                                        
-                                       v = new IntConstant (res);
+                                       v = new IntConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -309,7 +309,7 @@ namespace Mono.CSharp {
                                        UIntConstant v;
                                        uint res = ((UIntConstant)left).Value & ((UIntConstant)right).Value;
                                        
-                                       v = new UIntConstant (res);
+                                       v = new UIntConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -318,7 +318,7 @@ namespace Mono.CSharp {
                                        LongConstant v;
                                        long res = ((LongConstant)left).Value & ((LongConstant)right).Value;
                                        
-                                       v = new LongConstant (res);
+                                       v = new LongConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -328,7 +328,7 @@ namespace Mono.CSharp {
                                        ulong res = ((ULongConstant)left).Value &
                                                ((ULongConstant)right).Value;
                                        
-                                       v = new ULongConstant (res);
+                                       v = new ULongConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -338,7 +338,7 @@ namespace Mono.CSharp {
                                        ushort res = (ushort) (((UShortConstant)left).Value &
                                                               ((UShortConstant)right).Value);
                                        
-                                       v = new UShortConstant (res);
+                                       v = new UShortConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -348,7 +348,7 @@ namespace Mono.CSharp {
                                        short res = (short) (((ShortConstant)left).Value &
                                                             ((ShortConstant)right).Value);
                                        
-                                       v = new ShortConstant (res);
+                                       v = new ShortConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -365,7 +365,7 @@ namespace Mono.CSharp {
                                        IntConstant v;
                                        int res = ((IntConstant) left).Value ^ ((IntConstant) right).Value;
                                        
-                                       v = new IntConstant (res);
+                                       v = new IntConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -374,7 +374,7 @@ namespace Mono.CSharp {
                                        UIntConstant v;
                                        uint res = ((UIntConstant)left).Value ^ ((UIntConstant)right).Value;
                                        
-                                       v = new UIntConstant (res);
+                                       v = new UIntConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -383,7 +383,7 @@ namespace Mono.CSharp {
                                        LongConstant v;
                                        long res = ((LongConstant)left).Value ^ ((LongConstant)right).Value;
                                        
-                                       v = new LongConstant (res);
+                                       v = new LongConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -393,7 +393,7 @@ namespace Mono.CSharp {
                                        ulong res = ((ULongConstant)left).Value ^
                                                ((ULongConstant)right).Value;
                                        
-                                       v = new ULongConstant (res);
+                                       v = new ULongConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -403,7 +403,7 @@ namespace Mono.CSharp {
                                        ushort res = (ushort) (((UShortConstant)left).Value ^
                                                               ((UShortConstant)right).Value);
                                        
-                                       v = new UShortConstant (res);
+                                       v = new UShortConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -413,7 +413,7 @@ namespace Mono.CSharp {
                                        short res = (short)(((ShortConstant)left).Value ^
                                                            ((ShortConstant)right).Value);
                                        
-                                       v = new ShortConstant (res);
+                                       v = new ShortConstant (res, left.Location);
                                        if (result_type == null)
                                                return v;
                                        else
@@ -435,7 +435,7 @@ namespace Mono.CSharp {
                                        if (left_is_string && right_is_string)
                                                return new StringConstant (
                                                        ((StringConstant) left).Value +
-                                                       ((StringConstant) right).Value);
+                                                       ((StringConstant) right).Value, left.Location);
                                        
                                        return null;
                                }
@@ -480,7 +480,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DoubleConstant) left).Value +
                                                                         ((DoubleConstant) right).Value);
                                                
-                                               result = new DoubleConstant (res);
+                                               result = new DoubleConstant (res, left.Location);
                                        } else if (left is FloatConstant){
                                                float res;
                                                
@@ -491,7 +491,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((FloatConstant) left).Value +
                                                                         ((FloatConstant) right).Value);
                                                
-                                               result = new FloatConstant (res);
+                                               result = new FloatConstant (res, left.Location);
                                        } else if (left is ULongConstant){
                                                ulong res;
                                                
@@ -502,7 +502,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((ULongConstant) left).Value +
                                                                         ((ULongConstant) right).Value);
 
-                                               result = new ULongConstant (res);
+                                               result = new ULongConstant (res, left.Location);
                                        } else if (left is LongConstant){
                                                long res;
                                                
@@ -513,7 +513,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((LongConstant) left).Value +
                                                                         ((LongConstant) right).Value);
                                                
-                                               result = new LongConstant (res);
+                                               result = new LongConstant (res, left.Location);
                                        } else if (left is UIntConstant){
                                                uint res;
                                                
@@ -524,7 +524,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((UIntConstant) left).Value +
                                                                         ((UIntConstant) right).Value);
                                                
-                                               result = new UIntConstant (res);
+                                               result = new UIntConstant (res, left.Location);
                                        } else if (left is IntConstant){
                                                int res;
 
@@ -535,7 +535,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((IntConstant) left).Value +
                                                                         ((IntConstant) right).Value);
 
-                                               result = new IntConstant (res);
+                                               result = new IntConstant (res, left.Location);
                                        } else if (left is DecimalConstant) {
                                                decimal res;
 
@@ -546,7 +546,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DecimalConstant) left).Value +
                                                                ((DecimalConstant) right).Value);
 
-                                               result = new DecimalConstant (res);
+                                               result = new DecimalConstant (res, left.Location);
                                        } else {
                                                throw new Exception ( "Unexepected addition input: " + left);
                                        }
@@ -612,7 +612,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DoubleConstant) left).Value -
                                                                         ((DoubleConstant) right).Value);
                                                
-                                               result = new DoubleConstant (res);
+                                               result = new DoubleConstant (res, left.Location);
                                        } else if (left is FloatConstant){
                                                float res;
                                                
@@ -623,7 +623,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((FloatConstant) left).Value -
                                                                         ((FloatConstant) right).Value);
                                                
-                                               result = new FloatConstant (res);
+                                               result = new FloatConstant (res, left.Location);
                                        } else if (left is ULongConstant){
                                                ulong res;
                                                
@@ -634,7 +634,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((ULongConstant) left).Value -
                                                                         ((ULongConstant) right).Value);
                                                
-                                               result = new ULongConstant (res);
+                                               result = new ULongConstant (res, left.Location);
                                        } else if (left is LongConstant){
                                                long res;
                                                
@@ -645,7 +645,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((LongConstant) left).Value -
                                                                         ((LongConstant) right).Value);
                                                
-                                               result = new LongConstant (res);
+                                               result = new LongConstant (res, left.Location);
                                        } else if (left is UIntConstant){
                                                uint res;
                                                
@@ -656,7 +656,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((UIntConstant) left).Value -
                                                                         ((UIntConstant) right).Value);
                                                
-                                               result = new UIntConstant (res);
+                                               result = new UIntConstant (res, left.Location);
                                        } else if (left is IntConstant){
                                                int res;
 
@@ -667,7 +667,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((IntConstant) left).Value -
                                                                         ((IntConstant) right).Value);
 
-                                               result = new IntConstant (res);
+                                               result = new IntConstant (res, left.Location);
                                        } else if (left is DecimalConstant) {
                                                decimal res;
 
@@ -678,7 +678,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DecimalConstant) left).Value -
                                                                ((DecimalConstant) right).Value);
 
-                                               return new DecimalConstant (res);
+                                               return new DecimalConstant (res, left.Location);
                                        } else {
                                                throw new Exception ( "Unexepected subtraction input: " + left);
                                        }
@@ -706,7 +706,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DoubleConstant) left).Value *
                                                                ((DoubleConstant) right).Value);
                                                
-                                               return new DoubleConstant (res);
+                                               return new DoubleConstant (res, left.Location);
                                        } else if (left is FloatConstant){
                                                float res;
                                                
@@ -717,7 +717,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((FloatConstant) left).Value *
                                                                ((FloatConstant) right).Value);
                                                
-                                               return new FloatConstant (res);
+                                               return new FloatConstant (res, left.Location);
                                        } else if (left is ULongConstant){
                                                ulong res;
                                                
@@ -728,7 +728,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((ULongConstant) left).Value *
                                                                ((ULongConstant) right).Value);
                                                
-                                               return new ULongConstant (res);
+                                               return new ULongConstant (res, left.Location);
                                        } else if (left is LongConstant){
                                                long res;
                                                
@@ -739,7 +739,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((LongConstant) left).Value *
                                                                ((LongConstant) right).Value);
                                                
-                                               return new LongConstant (res);
+                                               return new LongConstant (res, left.Location);
                                        } else if (left is UIntConstant){
                                                uint res;
                                                
@@ -750,7 +750,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((UIntConstant) left).Value *
                                                                ((UIntConstant) right).Value);
                                                
-                                               return new UIntConstant (res);
+                                               return new UIntConstant (res, left.Location);
                                        } else if (left is IntConstant){
                                                int res;
 
@@ -761,7 +761,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((IntConstant) left).Value *
                                                                ((IntConstant) right).Value);
 
-                                               return new IntConstant (res);
+                                               return new IntConstant (res, left.Location);
                                        } else if (left is DecimalConstant) {
                                                decimal res;
 
@@ -772,7 +772,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DecimalConstant) left).Value *
                                                                ((DecimalConstant) right).Value);
 
-                                               return new DecimalConstant (res);
+                                               return new DecimalConstant (res, left.Location);
                                        } else {
                                                throw new Exception ( "Unexepected multiply input: " + left);
                                        }
@@ -797,7 +797,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DoubleConstant) left).Value /
                                                                ((DoubleConstant) right).Value);
                                                
-                                               return new DoubleConstant (res);
+                                               return new DoubleConstant (res, left.Location);
                                        } else if (left is FloatConstant){
                                                float res;
                                                
@@ -808,7 +808,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((FloatConstant) left).Value /
                                                                ((FloatConstant) right).Value);
                                                
-                                               return new FloatConstant (res);
+                                               return new FloatConstant (res, left.Location);
                                        } else if (left is ULongConstant){
                                                ulong res;
                                                
@@ -819,7 +819,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((ULongConstant) left).Value /
                                                                ((ULongConstant) right).Value);
                                                
-                                               return new ULongConstant (res);
+                                               return new ULongConstant (res, left.Location);
                                        } else if (left is LongConstant){
                                                long res;
                                                
@@ -830,7 +830,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((LongConstant) left).Value /
                                                                ((LongConstant) right).Value);
                                                
-                                               return new LongConstant (res);
+                                               return new LongConstant (res, left.Location);
                                        } else if (left is UIntConstant){
                                                uint res;
                                                
@@ -841,7 +841,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((UIntConstant) left).Value /
                                                                ((UIntConstant) right).Value);
                                                
-                                               return new UIntConstant (res);
+                                               return new UIntConstant (res, left.Location);
                                        } else if (left is IntConstant){
                                                int res;
 
@@ -852,7 +852,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((IntConstant) left).Value /
                                                                ((IntConstant) right).Value);
 
-                                               return new IntConstant (res);
+                                               return new IntConstant (res, left.Location);
                                        } else if (left is DecimalConstant) {
                                                decimal res;
 
@@ -863,7 +863,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DecimalConstant) left).Value /
                                                                ((DecimalConstant) right).Value);
 
-                                               return new DecimalConstant (res);
+                                               return new DecimalConstant (res, left.Location);
                                        } else {
                                                throw new Exception ( "Unexepected division input: " + left);
                                        }
@@ -892,7 +892,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((DoubleConstant) left).Value %
                                                                         ((DoubleConstant) right).Value);
                                                
-                                               return new DoubleConstant (res);
+                                               return new DoubleConstant (res, left.Location);
                                        } else if (left is FloatConstant){
                                                float res;
                                                
@@ -903,7 +903,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((FloatConstant) left).Value %
                                                                         ((FloatConstant) right).Value);
                                                
-                                               return new FloatConstant (res);
+                                               return new FloatConstant (res, left.Location);
                                        } else if (left is ULongConstant){
                                                ulong res;
                                                
@@ -914,7 +914,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((ULongConstant) left).Value %
                                                                         ((ULongConstant) right).Value);
                                                
-                                               return new ULongConstant (res);
+                                               return new ULongConstant (res, left.Location);
                                        } else if (left is LongConstant){
                                                long res;
                                                
@@ -925,7 +925,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((LongConstant) left).Value %
                                                                         ((LongConstant) right).Value);
                                                
-                                               return new LongConstant (res);
+                                               return new LongConstant (res, left.Location);
                                        } else if (left is UIntConstant){
                                                uint res;
                                                
@@ -936,7 +936,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((UIntConstant) left).Value %
                                                                         ((UIntConstant) right).Value);
                                                
-                                               return new UIntConstant (res);
+                                               return new UIntConstant (res, left.Location);
                                        } else if (left is IntConstant){
                                                int res;
 
@@ -947,7 +947,7 @@ namespace Mono.CSharp {
                                                        res = unchecked (((IntConstant) left).Value %
                                                                         ((IntConstant) right).Value);
 
-                                               return new IntConstant (res);
+                                               return new IntConstant (res, left.Location);
                                        } else {
                                                throw new Exception ( "Unexepected modulus input: " + left);
                                        }
@@ -971,19 +971,19 @@ namespace Mono.CSharp {
 
                                IntConstant lic;
                                if ((lic = left.ConvertToInt ()) != null)
-                                       return new IntConstant (lic.Value << lshift_val);
+                                       return new IntConstant (lic.Value << lshift_val, left.Location);
 
                                UIntConstant luic;
                                if ((luic = left.ConvertToUInt ()) != null)
-                                       return new UIntConstant (luic.Value << lshift_val);
+                                       return new UIntConstant (luic.Value << lshift_val, left.Location);
 
                                LongConstant llc;
                                if ((llc = left.ConvertToLong ()) != null)
-                                       return new LongConstant (llc.Value << lshift_val);
+                                       return new LongConstant (llc.Value << lshift_val, left.Location);
 
                                ULongConstant lulc;
                                if ((lulc = left.ConvertToULong ()) != null)
-                                       return new ULongConstant (lulc.Value << lshift_val);
+                                       return new ULongConstant (lulc.Value << lshift_val, left.Location);
 
                                Binary.Error_OperatorCannotBeApplied (loc, "<<", lt, rt);
                                break;
@@ -1001,19 +1001,19 @@ namespace Mono.CSharp {
 
                                IntConstant ric;
                                if ((ric = left.ConvertToInt ()) != null)
-                                       return new IntConstant (ric.Value >> rshift_val);
+                                       return new IntConstant (ric.Value >> rshift_val, left.Location);
 
                                UIntConstant ruic;
                                if ((ruic = left.ConvertToUInt ()) != null)
-                                       return new UIntConstant (ruic.Value >> rshift_val);
+                                       return new UIntConstant (ruic.Value >> rshift_val, left.Location);
 
                                LongConstant rlc;
                                if ((rlc = left.ConvertToLong ()) != null)
-                                       return new LongConstant (rlc.Value >> rshift_val);
+                                       return new LongConstant (rlc.Value >> rshift_val, left.Location);
 
                                ULongConstant rulc;
                                if ((rulc = left.ConvertToULong ()) != null)
-                                       return new ULongConstant (rulc.Value >> rshift_val);
+                                       return new ULongConstant (rulc.Value >> rshift_val, left.Location);
 
                                Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
                                break;
@@ -1022,7 +1022,7 @@ namespace Mono.CSharp {
                                if (left is BoolConstant && right is BoolConstant){
                                        return new BoolConstant (
                                                ((BoolConstant) left).Value &&
-                                               ((BoolConstant) right).Value);
+                                               ((BoolConstant) right).Value, left.Location);
                                }
                                break;
 
@@ -1030,7 +1030,7 @@ namespace Mono.CSharp {
                                if (left is BoolConstant && right is BoolConstant){
                                        return new BoolConstant (
                                                ((BoolConstant) left).Value ||
-                                               ((BoolConstant) right).Value);
+                                               ((BoolConstant) right).Value, left.Location);
                                }
                                break;
                                
@@ -1038,26 +1038,26 @@ namespace Mono.CSharp {
                                if (left is BoolConstant && right is BoolConstant){
                                        return new BoolConstant (
                                                ((BoolConstant) left).Value ==
-                                               ((BoolConstant) right).Value);
+                                               ((BoolConstant) right).Value, left.Location);
                                
                                }
                                if (left is NullLiteral){
                                        if (right is NullLiteral)
-                                               return new BoolConstant (true);
+                                               return new BoolConstant (true, left.Location);
                                        else if (right is StringConstant)
                                                return new BoolConstant (
-                                                       ((StringConstant) right).Value == null);
+                                                       ((StringConstant) right).Value == null, left.Location);
                                } else if (right is NullLiteral){
                                        if (left is NullLiteral)
-                                               return new BoolConstant (true);
+                                               return new BoolConstant (true, left.Location);
                                        else if (left is StringConstant)
                                                return new BoolConstant (
-                                                       ((StringConstant) left).Value == null);
+                                                       ((StringConstant) left).Value == null, left.Location);
                                }
                                if (left is StringConstant && right is StringConstant){
                                        return new BoolConstant (
                                                ((StringConstant) left).Value ==
-                                               ((StringConstant) right).Value);
+                                               ((StringConstant) right).Value, left.Location);
                                        
                                }
 
@@ -1087,31 +1087,31 @@ namespace Mono.CSharp {
                                else
                                        return null;
 
-                               return new BoolConstant (bool_res);
+                               return new BoolConstant (bool_res, left.Location);
 
                        case Binary.Operator.Inequality:
                                if (left is BoolConstant && right is BoolConstant){
                                        return new BoolConstant (
                                                ((BoolConstant) left).Value !=
-                                               ((BoolConstant) right).Value);
+                                               ((BoolConstant) right).Value, left.Location);
                                }
                                if (left is NullLiteral){
                                        if (right is NullLiteral)
-                                               return new BoolConstant (false);
+                                               return new BoolConstant (false, left.Location);
                                        else if (right is StringConstant)
                                                return new BoolConstant (
-                                                       ((StringConstant) right).Value != null);
+                                                       ((StringConstant) right).Value != null, left.Location);
                                } else if (right is NullLiteral){
                                        if (left is NullLiteral)
-                                               return new BoolConstant (false);
+                                               return new BoolConstant (false, left.Location);
                                        else if (left is StringConstant)
                                                return new BoolConstant (
-                                                       ((StringConstant) left).Value != null);
+                                                       ((StringConstant) left).Value != null, left.Location);
                                }
                                if (left is StringConstant && right is StringConstant){
                                        return new BoolConstant (
                                                ((StringConstant) left).Value !=
-                                               ((StringConstant) right).Value);
+                                               ((StringConstant) right).Value, left.Location);
                                        
                                }
                                DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);
@@ -1140,7 +1140,7 @@ namespace Mono.CSharp {
                                else
                                        return null;
 
-                               return new BoolConstant (bool_res);
+                               return new BoolConstant (bool_res, left.Location);
 
                        case Binary.Operator.LessThan:
                                DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);
@@ -1169,7 +1169,7 @@ namespace Mono.CSharp {
                                else
                                        return null;
 
-                               return new BoolConstant (bool_res);
+                               return new BoolConstant (bool_res, left.Location);
                                
                        case Binary.Operator.GreaterThan:
                                DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);
@@ -1198,7 +1198,7 @@ namespace Mono.CSharp {
                                else
                                        return null;
 
-                               return new BoolConstant (bool_res);
+                               return new BoolConstant (bool_res, left.Location);
 
                        case Binary.Operator.GreaterThanOrEqual:
                                DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);
@@ -1227,7 +1227,7 @@ namespace Mono.CSharp {
                                else
                                        return null;
 
-                               return new BoolConstant (bool_res);
+                               return new BoolConstant (bool_res, left.Location);
 
                        case Binary.Operator.LessThanOrEqual:
                                DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);
@@ -1256,7 +1256,7 @@ namespace Mono.CSharp {
                                else
                                        return null;
 
-                               return new BoolConstant (bool_res);
+                               return new BoolConstant (bool_res, left.Location);
                        }
                                        
                        return null;
index b28a01af5959b9a5609b5dd4d01ce49a73b368da..abcf9ba569955ca107d56dbf136c3f7c116a87af 100644 (file)
@@ -4925,7 +4925,7 @@ namespace Mono.CSharp {
                public string ShortName {
                        get { return MemberName.Name; }
                        set {
-                               SetMemberName (new MemberName (MemberName.Left, value));
+                               SetMemberName (new MemberName (MemberName.Left, value, Location));
                        }
                }
 
index 8e0823b7ed87740ae24cbc4730773514be9df567..da7c0cb3fe051523c4e911d1b2ba689da9761b3f 100755 (executable)
@@ -28,7 +28,7 @@
                     BaseAddress = "285212672"\r
                     CheckForOverflowUnderflow = "false"\r
                     ConfigurationOverrideFile = ""\r
-                    DefineConstants = "DEBUG;TRACE"\r
+                    DefineConstants = "DEBUG;TRACE;NET_1_1"\r
                     DocumentationFile = ""\r
                     DebugSymbols = "true"\r
                     FileAlignment = "4096"\r
@@ -70,7 +70,7 @@
                 />\r
                 <Reference\r
                     Name = "System.XML"\r
-                    AssemblyName = "System.XML"\r
+                    AssemblyName = "System.Xml"\r
                     HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"\r
                 />\r
             </References>\r
                     SubType = "Code"\r
                     BuildAction = "Compile"\r
                 />\r
+                <File\r
+                    RelPath = "Consts.cs"\r
+                    Link = "..\build\common\Consts.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
                 <File\r
                     RelPath = "convert.cs"\r
                     SubType = "Code"\r
index bee3c077a038d7628a34d1f508082a2558471dfd..3f72833379e6988688954440508d8b0174a77bdd 100644 (file)
@@ -17,6 +17,12 @@ namespace Mono.CSharp {
        ///   Base class for constants and literals.
        /// </summary>
        public abstract class Constant : Expression {
+
+               protected Constant (Location loc)
+               {
+                       this.loc = loc;
+               }
+
                /// <remarks>
                ///   This is different from ToString in that ToString
                ///   is supposed to be there for debugging purposes,
@@ -177,33 +183,33 @@ namespace Mono.CSharp {
 
                        Constant retval;
                        if (type == TypeManager.int32_type)
-                               retval = new IntConstant ((int) constant_value);
+                               retval = new IntConstant ((int) constant_value, loc);
                        else if (type == TypeManager.uint32_type)
-                               retval = new UIntConstant ((uint) constant_value);
+                               retval = new UIntConstant ((uint) constant_value, loc);
                        else if (type == TypeManager.int64_type)
-                               retval = new LongConstant ((long) constant_value);
+                               retval = new LongConstant ((long) constant_value, loc);
                        else if (type == TypeManager.uint64_type)
-                               retval = new ULongConstant ((ulong) constant_value);
+                               retval = new ULongConstant ((ulong) constant_value, loc);
                        else if (type == TypeManager.float_type)
-                               retval = new FloatConstant ((float) constant_value);
+                               retval = new FloatConstant ((float) constant_value, loc);
                        else if (type == TypeManager.double_type)
-                               retval = new DoubleConstant ((double) constant_value);
+                               retval = new DoubleConstant ((double) constant_value, loc);
                        else if (type == TypeManager.string_type)
-                               retval = new StringConstant ((string) constant_value);
+                               retval = new StringConstant ((string) constant_value, loc);
                        else if (type == TypeManager.short_type)
-                               retval = new ShortConstant ((short) constant_value);
+                               retval = new ShortConstant ((short) constant_value, loc);
                        else if (type == TypeManager.ushort_type)
-                               retval = new UShortConstant ((ushort) constant_value);
+                               retval = new UShortConstant ((ushort) constant_value, loc);
                        else if (type == TypeManager.sbyte_type)
-                               retval = new SByteConstant ((sbyte) constant_value);
+                               retval = new SByteConstant ((sbyte) constant_value, loc);
                        else if (type == TypeManager.byte_type)
-                               retval = new ByteConstant ((byte) constant_value);
+                               retval = new ByteConstant ((byte) constant_value, loc);
                        else if (type == TypeManager.char_type)
-                               retval = new CharConstant ((char) constant_value);
+                               retval = new CharConstant ((char) constant_value, loc);
                        else if (type == TypeManager.bool_type)
-                               retval = new BoolConstant ((bool) constant_value);
+                               retval = new BoolConstant ((bool) constant_value, loc);
                        else if (type == TypeManager.decimal_type)
-                               retval = new DecimalConstant ((decimal) constant_value);
+                               retval = new DecimalConstant ((decimal) constant_value, loc);
                        else
                                throw new Exception ("LookupConstantValue: Unhandled constant type: " + type);
                        
@@ -267,7 +273,8 @@ namespace Mono.CSharp {
        public class BoolConstant : Constant {
                public readonly bool Value;
                
-               public BoolConstant (bool val)
+               public BoolConstant (bool val, Location loc):
+                       base (loc)
                {
                        type = TypeManager.bool_type;
                        eclass = ExprClass.Value;
@@ -319,7 +326,8 @@ namespace Mono.CSharp {
        public class ByteConstant : Constant {
                public readonly byte Value;
 
-               public ByteConstant (byte v)
+               public ByteConstant (byte v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.byte_type;
                        eclass = ExprClass.Value;
@@ -343,37 +351,37 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
                {
-                       return new ULongConstant (Value);
+                       return new ULongConstant (Value, loc);
                }
 
                public override LongConstant ConvertToLong ()
                {
-                       return new LongConstant (Value);
+                       return new LongConstant (Value, loc);
                }
 
                public override UIntConstant ConvertToUInt ()
                {
-                       return new UIntConstant (Value);
+                       return new UIntConstant (Value, loc);
                }
 
                public override IntConstant ConvertToInt ()
                {
-                       return new IntConstant (Value);
+                       return new IntConstant (Value, loc);
                }
 
                public override Constant Increment ()
                {
-                       return new ByteConstant (checked ((byte)(Value + 1)));
+                       return new ByteConstant (checked ((byte)(Value + 1)), loc);
                }
 
                public override bool IsDefaultValue {
@@ -396,7 +404,8 @@ namespace Mono.CSharp {
        public class CharConstant : Constant {
                public readonly char Value;
 
-               public CharConstant (char v)
+               public CharConstant (char v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.char_type;
                        eclass = ExprClass.Value;
@@ -449,37 +458,37 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
                {
-                       return new ULongConstant (Value);
+                       return new ULongConstant (Value, loc);
                }
 
                public override LongConstant ConvertToLong ()
                {
-                       return new LongConstant (Value);
+                       return new LongConstant (Value, loc);
                }
 
                public override UIntConstant ConvertToUInt ()
                {
-                       return new UIntConstant (Value);
+                       return new UIntConstant (Value, loc);
                }
 
                public override IntConstant ConvertToInt ()
                {
-                       return new IntConstant (Value);
+                       return new IntConstant (Value, loc);
                }
 
                public override Constant Increment ()
                {
-                       return new CharConstant (checked ((char)(Value + 1)));
+                       return new CharConstant (checked ((char)(Value + 1)), loc);
                }
                
                public override bool IsDefaultValue {
@@ -502,7 +511,8 @@ namespace Mono.CSharp {
        public class SByteConstant : Constant {
                public readonly sbyte Value;
 
-               public SByteConstant (sbyte v)
+               public SByteConstant (sbyte v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.sbyte_type;
                        eclass = ExprClass.Value;
@@ -526,25 +536,25 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
                {
                        if (Value >= 0)
-                               return new ULongConstant ((ulong) Value);
+                               return new ULongConstant ((ulong) Value, loc);
                        
                        return null;
                }
 
                public override LongConstant ConvertToLong ()
                {
-                       return new LongConstant (Value);
+                       return new LongConstant (Value, loc);
                }
 
                public override UIntConstant ConvertToUInt ()
@@ -554,12 +564,12 @@ namespace Mono.CSharp {
 
                public override IntConstant ConvertToInt ()
                {
-                       return new IntConstant (Value);
+                       return new IntConstant (Value, loc);
                }
 
                public override Constant Increment ()
                {
-                   return new SByteConstant (checked((sbyte)(Value + 1)));
+                   return new SByteConstant (checked((sbyte)(Value + 1)), loc);
                }
 
                public override bool IsDefaultValue {
@@ -582,7 +592,8 @@ namespace Mono.CSharp {
        public class ShortConstant : Constant {
                public readonly short Value;
 
-               public ShortConstant (short v)
+               public ShortConstant (short v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.short_type;
                        eclass = ExprClass.Value;
@@ -606,12 +617,12 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
@@ -621,7 +632,7 @@ namespace Mono.CSharp {
 
                public override LongConstant ConvertToLong ()
                {
-                       return new LongConstant (Value);
+                       return new LongConstant (Value, loc);
                }
 
                public override UIntConstant ConvertToUInt ()
@@ -631,12 +642,12 @@ namespace Mono.CSharp {
 
                public override IntConstant ConvertToInt ()
                {
-                       return new IntConstant (Value);
+                       return new IntConstant (Value, loc);
                }
 
                public override Constant Increment ()
                {
-                       return new ShortConstant (checked((short)(Value + 1)));
+                       return new ShortConstant (checked((short)(Value + 1)), loc);
                }
 
                public override bool IsDefaultValue {
@@ -659,7 +670,8 @@ namespace Mono.CSharp {
        public class UShortConstant : Constant {
                public readonly ushort Value;
 
-               public UShortConstant (ushort v)
+               public UShortConstant (ushort v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.ushort_type;
                        eclass = ExprClass.Value;
@@ -683,37 +695,37 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
                {
-                       return new ULongConstant (Value);
+                       return new ULongConstant (Value, loc);
                }
 
                public override LongConstant ConvertToLong ()
                {
-                       return new LongConstant (Value);
+                       return new LongConstant (Value, loc);
                }
 
                public override UIntConstant ConvertToUInt ()
                {
-                       return new UIntConstant (Value);
+                       return new UIntConstant (Value, loc);
                }
 
                public override IntConstant ConvertToInt ()
                {
-                       return new IntConstant (Value);
+                       return new IntConstant (Value, loc);
                }
        
                public override Constant Increment ()
                {
-                       return new UShortConstant (checked((ushort)(Value + 1)));
+                       return new UShortConstant (checked((ushort)(Value + 1)), loc);
                }
 
                public override bool IsDefaultValue {
@@ -736,7 +748,8 @@ namespace Mono.CSharp {
        public class IntConstant : Constant {
                public readonly int Value;
 
-               public IntConstant (int v)
+               public IntConstant (int v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.int32_type;
                        eclass = ExprClass.Value;
@@ -812,17 +825,17 @@ namespace Mono.CSharp {
 
                public override DecimalConstant ConvertToDecimal()
                {
-                       return new DecimalConstant (Value);
+                       return new DecimalConstant (Value, loc);
                }
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
@@ -830,12 +843,12 @@ namespace Mono.CSharp {
                        if (Value < 0)
                                return null;
 
-                       return new ULongConstant ((ulong) Value);
+                       return new ULongConstant ((ulong) Value, loc);
                }
 
                public override LongConstant ConvertToLong ()
                {
-                       return new LongConstant (Value);
+                       return new LongConstant (Value, loc);
                }
 
                public override UIntConstant ConvertToUInt ()
@@ -843,7 +856,7 @@ namespace Mono.CSharp {
                        if (Value < 0)
                                return null;
 
-                       return new UIntConstant ((uint) Value);
+                       return new UIntConstant ((uint) Value, loc);
                }
 
                public override IntConstant ConvertToInt ()
@@ -853,7 +866,7 @@ namespace Mono.CSharp {
 
                public override Constant Increment ()
                {
-                       return new IntConstant (checked(Value + 1));
+                       return new IntConstant (checked(Value + 1), loc);
                }
 
                public override bool IsDefaultValue {
@@ -876,7 +889,8 @@ namespace Mono.CSharp {
        public class UIntConstant : Constant {
                public readonly uint Value;
 
-               public UIntConstant (uint v)
+               public UIntConstant (uint v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.uint32_type;
                        eclass = ExprClass.Value;
@@ -900,22 +914,22 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
                {
-                       return new ULongConstant (Value);
+                       return new ULongConstant (Value, loc);
                }
 
                public override LongConstant ConvertToLong ()
                {
-                       return new LongConstant (Value);
+                       return new LongConstant (Value, loc);
                }
 
                public override UIntConstant ConvertToUInt ()
@@ -930,7 +944,7 @@ namespace Mono.CSharp {
        
                public override Constant Increment ()
                {
-                       return new UIntConstant (checked(Value + 1));
+                       return new UIntConstant (checked(Value + 1), loc);
                }
        
                public override bool IsDefaultValue {
@@ -953,7 +967,8 @@ namespace Mono.CSharp {
        public class LongConstant : Constant {
                public readonly long Value;
 
-               public LongConstant (long v)
+               public LongConstant (long v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.int64_type;
                        eclass = ExprClass.Value;
@@ -989,12 +1004,12 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
@@ -1002,7 +1017,7 @@ namespace Mono.CSharp {
                        if (Value < 0)
                                return null;
                        
-                       return new ULongConstant ((ulong) Value);
+                       return new ULongConstant ((ulong) Value, loc);
                }
 
                public override LongConstant ConvertToLong ()
@@ -1022,7 +1037,7 @@ namespace Mono.CSharp {
 
                public override Constant Increment ()
                {
-                       return new LongConstant (checked(Value + 1));
+                       return new LongConstant (checked(Value + 1), loc);
                }
                
                public override bool IsDefaultValue {
@@ -1045,7 +1060,8 @@ namespace Mono.CSharp {
        public class ULongConstant : Constant {
                public readonly ulong Value;
 
-               public ULongConstant (ulong v)
+               public ULongConstant (ulong v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.uint64_type;
                        eclass = ExprClass.Value;
@@ -1071,12 +1087,12 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
                {
-                       return new FloatConstant (Value);
+                       return new FloatConstant (Value, loc);
                }
 
                public override ULongConstant ConvertToULong ()
@@ -1101,7 +1117,7 @@ namespace Mono.CSharp {
 
                public override Constant Increment ()
                {
-                       return new ULongConstant (checked(Value + 1));
+                       return new ULongConstant (checked(Value + 1), loc);
                }
 
                public override bool IsDefaultValue {
@@ -1124,7 +1140,8 @@ namespace Mono.CSharp {
        public class FloatConstant : Constant {
                public readonly float Value;
 
-               public FloatConstant (float v)
+               public FloatConstant (float v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.float_type;
                        eclass = ExprClass.Value;
@@ -1148,7 +1165,7 @@ namespace Mono.CSharp {
 
                public override DoubleConstant ConvertToDouble ()
                {
-                       return new DoubleConstant (Value);
+                       return new DoubleConstant (Value, loc);
                }
 
                public override FloatConstant ConvertToFloat ()
@@ -1173,7 +1190,7 @@ namespace Mono.CSharp {
 
                public override Constant Increment ()
                {
-                       return new FloatConstant (checked(Value + 1));
+                       return new FloatConstant (checked(Value + 1), loc);
                }
 
                public override bool IsDefaultValue {
@@ -1192,7 +1209,8 @@ namespace Mono.CSharp {
        public class DoubleConstant : Constant {
                public readonly double Value;
 
-               public DoubleConstant (double v)
+               public DoubleConstant (double v, Location loc):
+                       base (loc)
                {
                        type = TypeManager.double_type;
                        eclass = ExprClass.Value;
@@ -1246,7 +1264,7 @@ namespace Mono.CSharp {
 
                public override Constant Increment ()
                {
-                       return new DoubleConstant (checked(Value + 1));
+                       return new DoubleConstant (checked(Value + 1), loc);
                }
 
                public override bool IsDefaultValue {
@@ -1265,7 +1283,8 @@ namespace Mono.CSharp {
        public class DecimalConstant : Constant {
                public readonly decimal Value;
 
-               public DecimalConstant (decimal d)
+               public DecimalConstant (decimal d, Location loc):
+                       base (loc)
                {
                        type = TypeManager.decimal_type;
                        eclass = ExprClass.Value;
@@ -1317,7 +1336,7 @@ namespace Mono.CSharp {
 
                public override Constant Increment ()
                {
-                       return new DecimalConstant (checked (Value + 1));
+                       return new DecimalConstant (checked (Value + 1), loc);
                }
 
                public override bool IsDefaultValue {
@@ -1336,7 +1355,8 @@ namespace Mono.CSharp {
        public class StringConstant : Constant {
                public readonly string Value;
 
-               public StringConstant (string s)
+               public StringConstant (string s, Location loc):
+                       base (loc)
                {
                        type = TypeManager.string_type;
                        eclass = ExprClass.Value;
index df378c7a62aa072366cb786bdfa7701be8720a00..8cdda18621b55f881a0429ca79dfd1728edd971e 100644 (file)
@@ -298,7 +298,7 @@ namespace Mono.CSharp {
                                        //
                                        long v = ((LongConstant) expr).Value;
                                        if (v >= 0)
-                                               return new ULongConstant ((ulong) v);
+                                               return new ULongConstant ((ulong) v, expr.Location);
                                } 
                        }
                        
@@ -1212,19 +1212,19 @@ namespace Mono.CSharp {
 
                        if (target_type == TypeManager.sbyte_type){
                                if (value >= SByte.MinValue && value <= SByte.MaxValue)
-                                       return new SByteConstant ((sbyte) value);
+                                       return new SByteConstant ((sbyte) value, ic.Location);
                        } else if (target_type == TypeManager.byte_type){
                                if (value >= Byte.MinValue && value <= Byte.MaxValue)
-                                       return new ByteConstant ((byte) value);
+                                       return new ByteConstant ((byte) value, ic.Location);
                        } else if (target_type == TypeManager.short_type){
                                if (value >= Int16.MinValue && value <= Int16.MaxValue)
-                                       return new ShortConstant ((short) value);
+                                       return new ShortConstant ((short) value, ic.Location);
                        } else if (target_type == TypeManager.ushort_type){
                                if (value >= UInt16.MinValue && value <= UInt16.MaxValue)
-                                       return new UShortConstant ((ushort) value);
+                                       return new UShortConstant ((ushort) value, ic.Location);
                        } else if (target_type == TypeManager.uint32_type){
                                if (value >= 0)
-                                       return new UIntConstant ((uint) value);
+                                       return new UIntConstant ((uint) value, ic.Location);
                        } else if (target_type == TypeManager.uint64_type){
                                //
                                // we can optimize this case: a positive int32
@@ -1232,11 +1232,11 @@ namespace Mono.CSharp {
                                // to do it.
                                //
                                if (value >= 0)
-                                       return new ULongConstant ((ulong) value);
+                                       return new ULongConstant ((ulong) value, ic.Location);
                        } else if (target_type == TypeManager.double_type)
-                               return new DoubleConstant ((double) value);
+                               return new DoubleConstant ((double) value, ic.Location);
                        else if (target_type == TypeManager.float_type)
-                               return new FloatConstant ((float) value);
+                               return new FloatConstant ((float) value, ic.Location);
                        
                        if (value == 0 && ic is IntLiteral && TypeManager.IsEnumType (target_type)){
                                Type underlying = TypeManager.EnumToUnderlying (target_type);
@@ -1247,9 +1247,9 @@ namespace Mono.CSharp {
                                // to EnumConstant
                                //
                                if (underlying == TypeManager.int64_type)
-                                       e = new LongLiteral (0);
+                                       e = new LongLiteral (0, ic.Location);
                                else if (underlying == TypeManager.uint64_type)
-                                       e = new ULongLiteral (0);
+                                       e = new ULongLiteral (0, ic.Location);
 
                                return new EnumConstant (e, target_type);
                        }
index ad10147fa7ca60ffab3d4bfb3daf8352a6e3d80b..5880df29440d1fc80d14ef9dad4e5bdd7ba5ed81 100644 (file)
@@ -1622,8 +1622,11 @@ interface_property_declaration
          type IDENTIFIER 
          OPEN_BRACE 
          { lexer.PropertyParsing = true; }
-         interface_accessors 
-         { lexer.PropertyParsing = false; }
+         accessor_declarations 
+         {
+               has_get = has_set = false; 
+               lexer.PropertyParsing = false;
+         }
          CLOSE_BRACE
          {
                LocatedToken lt = (LocatedToken) $4;
@@ -1634,22 +1637,37 @@ interface_property_declaration
                        break;
                }
 
+               Property p = null;
                if ($7 == null) {
-                       Property p = new Property (current_class, (Expression) $3, (int) $2, true,
+                       p = new Property (current_class, (Expression) $3, (int) $2, true,
                                   name, (Attributes) $1,
                                   null, null);
 
-                       Report.Error (548, lexer.Location, "`{0}': property or indexer must have at least one accessor", p.GetSignatureForError ());
+                       Report.Error (548, p.Location, "`{0}': property or indexer must have at least one accessor", p.GetSignatureForError ());
                        break;
                }
 
-                InterfaceAccessorInfo pinfo = (InterfaceAccessorInfo) $7;
-
-               $$ = new Property (current_class, (Expression) $3, (int) $2, true,
+               Pair pair = (Pair) $7;
+               p = new Property (current_class, (Expression) $3, (int) $2, true,
                                   name, (Attributes) $1,
-                                  pinfo.Get, pinfo.Set);
+                                  (Accessor)pair.First, (Accessor)pair.Second);
+
+               if (pair.First != null && ((Accessor)(pair.First)).Block != null) {
+                       Report.Error (531, p.Location, "`{0}.get': interface members cannot have a definition", p.GetSignatureForError ());
+                       $$ = null;
+                       break;
+               }
+
+               if (pair.Second != null && ((Accessor)(pair.Second)).Block != null) {
+                       Report.Error (531, p.Location, "`{0}.set': interface members cannot have a definition", p.GetSignatureForError ());
+                       $$ = null;
+                       break;
+               }
+
                if (RootContext.Documentation != null)
-                       ((Property) $$).DocComment = Lexer.consume_doc_comment ();
+                       p.DocComment = Lexer.consume_doc_comment ();
+
+               $$ = p;
          }
        | opt_attributes
          opt_new
@@ -1659,33 +1677,6 @@ interface_property_declaration
          }
        ;
 
-interface_accessors
-       : opt_attributes opt_modifiers GET SEMICOLON    
-         { 
-               $$ = new InterfaceAccessorInfo (true, false, (Attributes) $1, null, (int) $2, 0, (Location) $3, (Location) $3); 
-         }
-       | opt_attributes opt_modifiers GET OPEN_BRACE
-         {  
-               Report.Error (531, (Location) $3, "`{0}': interface members cannot have a definition", ".get");
-               $$ = new InterfaceAccessorInfo (true, false, (Attributes) $1, null, (int) $2, 0, (Location) $3, (Location) $3);
-         }
-       | opt_attributes opt_modifiers SET SEMICOLON            
-         { 
-               $$ = new InterfaceAccessorInfo (false, true, null, (Attributes) $1, 0, (int) $2, (Location) $3, (Location) $3); 
-         }
-       | opt_attributes opt_modifiers GET SEMICOLON opt_attributes opt_modifiers SET SEMICOLON 
-         { 
-               $$ = new InterfaceAccessorInfo (true, true, (Attributes) $1, (Attributes) $5, (int) $2, (int) $6, (Location) $3, (Location) $7); 
-         }
-       | opt_attributes opt_modifiers SET SEMICOLON opt_attributes opt_modifiers GET SEMICOLON
-         { 
-               $$ = new InterfaceAccessorInfo (true, true, (Attributes) $5, (Attributes) $1, (int) $6, (int) $2, (Location) $3, (Location) $3); 
-         }
-       |
-         {
-               $$ = null;
-         }
-       ;
 
 interface_event_declaration
        : opt_attributes opt_new EVENT type IDENTIFIER SEMICOLON
@@ -1725,28 +1716,46 @@ interface_indexer_declaration
          OPEN_BRACKET formal_parameter_list CLOSE_BRACKET
          OPEN_BRACE 
          { lexer.PropertyParsing = true; }
-         interface_accessors 
-         { lexer.PropertyParsing = false; }
+         accessor_declarations 
+         { 
+               has_get = has_set = false;
+               lexer.PropertyParsing = false;
+         }
          CLOSE_BRACE
          {
+               Indexer i = null;
                if ($10 == null) {
-                       Indexer i = new Indexer (current_class, (Expression) $3,
-                                 new MemberName (TypeContainer.DefaultIndexerName),
+                       i = new Indexer (current_class, (Expression) $3,
+                                 new MemberName (TypeContainer.DefaultIndexerName, (Location) $4),
                                  (int) $2, true, (Parameters) $6, (Attributes) $1,
                                  null, null);
 
-                       Report.Error (548, lexer.Location, "`{0}': property or indexer must have at least one accessor", i.GetSignatureForError ());
+                       Report.Error (548, i.Location, "`{0}': property or indexer must have at least one accessor", i.GetSignatureForError ());
                        break;
                }
 
-               InterfaceAccessorInfo info = (InterfaceAccessorInfo) $10;
-
-               $$ = new Indexer (current_class, (Expression) $3,
+               Pair pair = (Pair) $10;
+               i = new Indexer (current_class, (Expression) $3,
                                  new MemberName (TypeContainer.DefaultIndexerName, (Location) $4),
                                  (int) $2, true, (Parameters) $6, (Attributes) $1,
-                                 info.Get, info.Set);
+                                  (Accessor)pair.First, (Accessor)pair.Second);
+
+               if (pair.First != null && ((Accessor)(pair.First)).Block != null) {
+                       Report.Error (531, i.Location, "`{0}.get': interface members cannot have a definition", i.GetSignatureForError ());
+                       $$ = null;
+                       break;
+               }
+
+               if (pair.Second != null && ((Accessor)(pair.Second)).Block != null) {
+                       Report.Error (531, i.Location, "`{0}.set': interface members cannot have a definition", i.GetSignatureForError ());
+                       $$ = null;
+                       break;
+               }
+
                if (RootContext.Documentation != null)
-                       ((Indexer) $$).DocComment = ConsumeStoredComment ();
+                       i.DocComment = ConsumeStoredComment ();
+
+               $$ = i;
          }
        ;
 
@@ -2515,7 +2524,7 @@ pointer_type
                // can't perform checks during this phase - we do it during
                // semantic analysis.
                //
-               $$ = new ComposedCast ((Expression) $1, "*");
+               $$ = new ComposedCast ((Expression) $1, "*", Lexer.Location);
          }
        | VOID STAR
          {
@@ -2644,15 +2653,15 @@ literal
        : boolean_literal
        | integer_literal
        | real_literal
-       | LITERAL_CHARACTER     { $$ = new CharLiteral ((char) lexer.Value); }
-       | LITERAL_STRING        { $$ = new StringLiteral ((string) lexer.Value); }
-       | NULL                  { $$ = NullLiteral.Null; }
+       | LITERAL_CHARACTER     { $$ = new CharLiteral ((char) lexer.Value, lexer.Location); }
+       | LITERAL_STRING        { $$ = new StringLiteral ((string) lexer.Value, lexer.Location); } 
+       | NULL                  { $$ = new NullLiteral (lexer.Location); }
        ;
 
 real_literal
-       : LITERAL_FLOAT         { $$ = new FloatLiteral ((float) lexer.Value); }
-       | LITERAL_DOUBLE        { $$ = new DoubleLiteral ((double) lexer.Value); }
-       | LITERAL_DECIMAL       { $$ = new DecimalLiteral ((decimal) lexer.Value); }
+       : LITERAL_FLOAT         { $$ = new FloatLiteral ((float) lexer.Value, lexer.Location); }
+       | LITERAL_DOUBLE        { $$ = new DoubleLiteral ((double) lexer.Value, lexer.Location); }
+       | LITERAL_DECIMAL       { $$ = new DecimalLiteral ((decimal) lexer.Value, lexer.Location); }
        ;
 
 integer_literal
@@ -2660,28 +2669,21 @@ integer_literal
                object v = lexer.Value;
 
                if (v is int){
-                       int i = (int) v;
-
-                       if (i == 0)
-                               $$ = IntLiteral.Zero;
-                       else if (i == 1)
-                               $$ = IntLiteral.One;
-                       else
-                               $$ = new IntLiteral (i);
+                       $$ = new IntLiteral ((int) v, lexer.Location);
                } else if (v is uint)
-                       $$ = new UIntLiteral ((UInt32) v);
+                       $$ = new UIntLiteral ((UInt32) v, lexer.Location);
                else if (v is long)
-                       $$ = new LongLiteral ((Int64) v);
+                       $$ = new LongLiteral ((Int64) v, lexer.Location);
                else if (v is ulong)
-                       $$ = new ULongLiteral ((UInt64) v);
+                       $$ = new ULongLiteral ((UInt64) v, lexer.Location);
                else
                        Console.WriteLine ("OOPS.  Unexpected result from scanner");
          }
        ;
 
 boolean_literal
-       : TRUE                  { $$ = new BoolLiteral (true); }
-       | FALSE                 { $$ = new BoolLiteral (false); }
+       : TRUE                  { $$ = new BoolLiteral (true, lexer.Location); }
+       | FALSE                 { $$ = new BoolLiteral (false, lexer.Location); }
        ;
 
 parenthesized_expression_0
@@ -3176,7 +3178,8 @@ cast_expression
        : cast_list
        | OPEN_PARENS non_expression_type CLOSE_PARENS prefixed_unary_expression
          {
-               $$ = new Cast ((Expression) $2, (Expression) $4);
+               // TODO: wrong location
+               $$ = new Cast ((Expression) $2, (Expression) $4, lexer.Location);
          }
        ;
 
@@ -3737,7 +3740,7 @@ local_variable_type
                if ((string) $2 == "")
                        $$ = $1;
                else
-                       $$ = new ComposedCast ((Expression) $1, (string) $2);
+                       $$ = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
          }
         ;
 
@@ -4568,25 +4571,6 @@ public class VariableDeclaration {
        }
 }
 
-/// <summary>
-///  Used to pass around interface property information
-/// </summary>
-public class InterfaceAccessorInfo {
-
-        public readonly Accessor Get, Set;
-
-        public InterfaceAccessorInfo (bool has_get, bool has_set,
-                                      Attributes get_attrs, Attributes set_attrs, int get_mod, int set_mod, Location get_loc, Location set_loc)
-        {
-               if (has_get)
-                       Get = new Accessor (null, get_mod, get_attrs, get_loc);
-               if (has_set)
-                       Set = new Accessor (null, set_mod, set_attrs, set_loc);
-        }
-
-}
-
-
 // <summary>
 //   A class used to hold info about an indexer declarator
 // </summary>
index 3cbc6fc98cae83936ac7222f9cbbc6e1697fc2aa..a8130b6139c977a75001b09a36644b4e5c776f49 100644 (file)
@@ -279,8 +279,10 @@ namespace Mono.CSharp
 
                public static int counter1, counter2;
                
-       public static int Main (string[] args)
+               public static int Main (string[] args)
                {
+                       Location.InEmacs = Environment.GetEnvironmentVariable ("EMACS") == "t";
+
                        bool ok = MainDriver (args);
                        
                        if (ok && Report.Errors == 0) {
index 25be959853383847aa3e5492693d172d81eb6e0b..aeadfe713cd4c9a535ce00eae1e351323c082bc7 100644 (file)
@@ -119,7 +119,7 @@ namespace Mono.CSharp {
                        set { type = value; }
                }
 
-               public Location Location {
+               public virtual Location Location {
                        get { return loc; }
                }
 
@@ -481,33 +481,33 @@ namespace Mono.CSharp {
                public static Constant Constantify (object v, Type t)
                {
                        if (t == TypeManager.int32_type)
-                               return new IntConstant ((int) v);
+                               return new IntConstant ((int) v, Location.Null);
                        else if (t == TypeManager.uint32_type)
-                               return new UIntConstant ((uint) v);
+                               return new UIntConstant ((uint) v, Location.Null);
                        else if (t == TypeManager.int64_type)
-                               return new LongConstant ((long) v);
+                               return new LongConstant ((long) v, Location.Null);
                        else if (t == TypeManager.uint64_type)
-                               return new ULongConstant ((ulong) v);
+                               return new ULongConstant ((ulong) v, Location.Null);
                        else if (t == TypeManager.float_type)
-                               return new FloatConstant ((float) v);
+                               return new FloatConstant ((float) v, Location.Null);
                        else if (t == TypeManager.double_type)
-                               return new DoubleConstant ((double) v);
+                               return new DoubleConstant ((double) v, Location.Null);
                        else if (t == TypeManager.string_type)
-                               return new StringConstant ((string) v);
+                               return new StringConstant ((string) v, Location.Null);
                        else if (t == TypeManager.short_type)
-                               return new ShortConstant ((short)v);
+                               return new ShortConstant ((short)v, Location.Null);
                        else if (t == TypeManager.ushort_type)
-                               return new UShortConstant ((ushort)v);
+                               return new UShortConstant ((ushort)v, Location.Null);
                        else if (t == TypeManager.sbyte_type)
-                               return new SByteConstant (((sbyte)v));
+                               return new SByteConstant ((sbyte)v, Location.Null);
                        else if (t == TypeManager.byte_type)
-                               return new ByteConstant ((byte)v);
+                               return new ByteConstant ((byte)v, Location.Null);
                        else if (t == TypeManager.char_type)
-                               return new CharConstant ((char)v);
+                               return new CharConstant ((char)v, Location.Null);
                        else if (t == TypeManager.bool_type)
-                               return new BoolConstant ((bool) v);
+                               return new BoolConstant ((bool) v, Location.Null);
                        else if (t == TypeManager.decimal_type)
-                               return new DecimalConstant ((decimal) v);
+                               return new DecimalConstant ((decimal) v, Location.Null);
                        else if (TypeManager.IsEnumType (t)){
                                Type real_type = TypeManager.TypeToCoreType (v.GetType ());
                                if (real_type == t)
@@ -517,7 +517,7 @@ namespace Mono.CSharp {
 
                                return new EnumConstant (e, t);
                        } else if (v == null && !TypeManager.IsValueType (t))
-                               return NullLiteral.Null;
+                               return new NullLiteral (Location.Null);
                        else
                                throw new Exception ("Unknown type for constant (" + t +
                                                     "), details: " + v);
@@ -1236,7 +1236,8 @@ namespace Mono.CSharp {
        public class NullCast : Constant {
                protected Expression child;
                                
-               public NullCast (Expression child, Type return_type)
+               public NullCast (Expression child, Type return_type):
+                       base (Location.Null)
                {
                        eclass = child.eclass;
                        type = return_type;
@@ -1291,7 +1292,8 @@ namespace Mono.CSharp {
        public class EnumConstant : Constant {
                public Constant Child;
 
-               public EnumConstant (Constant child, Type enum_type)
+               public EnumConstant (Constant child, Type enum_type):
+                       base (child.Location)
                {
                        eclass = child.eclass;
                        this.Child = child;
@@ -2666,11 +2668,11 @@ namespace Mono.CSharp {
                        // as IsInitOnly ('readonly' in C# parlance).  We get its value from the 
                        // DecimalConstantAttribute metadata.
                        //
-                       //TODO: incorporare in GetContant otherwise we miss all error checks + obsoleteness check
+                       //TODO: incorporate in GetContant otherwise we miss all error checks + obsoleteness check
                        if (FieldInfo.IsInitOnly && !is_emitted && t == TypeManager.decimal_type) {
                                object[] attrs = FieldInfo.GetCustomAttributes (TypeManager.decimal_constant_attribute_type, false);
                                if (attrs.Length == 1)
-                                       return new DecimalConstant (((System.Runtime.CompilerServices.DecimalConstantAttribute) attrs [0]).Value);
+                                       return new DecimalConstant (((System.Runtime.CompilerServices.DecimalConstantAttribute) attrs [0]).Value, Location.Null);
                        }
                        
                        if (t.IsPointer && !ec.InUnsafe) {
index c07719c82338e683ef0d71099c2b4e379c4a0e18..3848f1a1d1af7a04022d87c71cdf21a710dce509 100644 (file)
@@ -106,6 +106,13 @@ namespace Mono.CSharp {
                {
                        throw new Exception ("Should not happen");
                }
+
+               public override Location Location
+               {
+                       get {
+                               return Expr.Location;
+                       }
+               }
        }
        
        /// <summary>
@@ -187,37 +194,37 @@ namespace Mono.CSharp {
                        Expression e = null;
 
                        if (expr is IntConstant)
-                               e = new IntConstant (-((IntConstant) expr).Value);
+                               e = new IntConstant (-((IntConstant) expr).Value, expr.Location);
                        else if (expr is UIntConstant){
                                uint value = ((UIntConstant) expr).Value;
 
                                if (value < 2147483649)
-                                       return new IntConstant (-(int)value);
+                                       return new IntConstant (-(int)value, expr.Location);
                                else
-                                       e = new LongConstant (-value);
+                                       e = new LongConstant (-value, expr.Location);
                        }
                        else if (expr is LongConstant)
-                               e = new LongConstant (-((LongConstant) expr).Value);
+                               e = new LongConstant (-((LongConstant) expr).Value, expr.Location);
                        else if (expr is ULongConstant){
                                ulong value = ((ULongConstant) expr).Value;
 
                                if (value < 9223372036854775809)
-                                       return new LongConstant(-(long)value);
+                                       return new LongConstant(-(long)value, expr.Location);
                        }
                        else if (expr is FloatConstant)
-                               e = new FloatConstant (-((FloatConstant) expr).Value);
+                               e = new FloatConstant (-((FloatConstant) expr).Value, expr.Location);
                        else if (expr is DoubleConstant)
-                               e = new DoubleConstant (-((DoubleConstant) expr).Value);
+                               e = new DoubleConstant (-((DoubleConstant) expr).Value, expr.Location);
                        else if (expr is DecimalConstant)
-                               e = new DecimalConstant (-((DecimalConstant) expr).Value);
+                               e = new DecimalConstant (-((DecimalConstant) expr).Value, expr.Location);
                        else if (expr is ShortConstant)
-                               e = new IntConstant (-((ShortConstant) expr).Value);
+                               e = new IntConstant (-((ShortConstant) expr).Value, expr.Location);
                        else if (expr is UShortConstant)
-                               e = new IntConstant (-((UShortConstant) expr).Value);
+                               e = new IntConstant (-((UShortConstant) expr).Value, expr.Location);
                        else if (expr is SByteConstant)
-                               e = new IntConstant (-((SByteConstant) expr).Value);
+                               e = new IntConstant (-((SByteConstant) expr).Value, expr.Location);
                        else if (expr is ByteConstant)
-                               e = new IntConstant (-((ByteConstant) expr).Value);
+                               e = new IntConstant (-((ByteConstant) expr).Value, expr.Location);
                        return e;
                }
 
@@ -254,7 +261,7 @@ namespace Mono.CSharp {
                                }
                                
                                BoolConstant b = (BoolConstant) e;
-                               result = new BoolConstant (!(b.Value));
+                               result = new BoolConstant (!(b.Value), b.Location);
                                return true;
                                
                        case Operator.OnesComplement:
@@ -303,13 +310,13 @@ namespace Mono.CSharp {
                                }
 
                                if (expr_type == TypeManager.int32_type){
-                                       result = new IntConstant (~ ((IntConstant) e).Value);
+                                       result = new IntConstant (~ ((IntConstant) e).Value, e.Location);
                                } else if (expr_type == TypeManager.uint32_type){
-                                       result = new UIntConstant (~ ((UIntConstant) e).Value);
+                                       result = new UIntConstant (~ ((UIntConstant) e).Value, e.Location);
                                } else if (expr_type == TypeManager.int64_type){
-                                       result = new LongConstant (~ ((LongConstant) e).Value);
+                                       result = new LongConstant (~ ((LongConstant) e).Value, e.Location);
                                } else if (expr_type == TypeManager.uint64_type){
-                                       result = new ULongConstant (~ ((ULongConstant) e).Value);
+                                       result = new ULongConstant (~ ((ULongConstant) e).Value, e.Location);
                                } else {
                                        result = null;
                                        Error23 (expr_type);
@@ -1337,7 +1344,7 @@ namespace Mono.CSharp {
                        if (expr.Type == target_type)
                                return expr;
 
-                       if (TypeManager.IsEnumType (target_type))
+                       if (TypeManager.IsEnumType (target_type) && TypeManager.EnumToUnderlying (target_type) == expr.Type)
                                return new EnumConstant ((Constant)expr, target_type);
 
                        Expression real_expr = expr;
@@ -1350,28 +1357,28 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, SByte.MinValue, SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type)
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                if (target_type == TypeManager.ushort_type)
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                if (target_type == TypeManager.int32_type)
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                if (target_type == TypeManager.uint32_type)
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type)
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type)
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is SByteConstant){
                                sbyte v = ((SByteConstant) real_expr).Value;
@@ -1379,38 +1386,38 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type)
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                if (target_type == TypeManager.ushort_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                } if (target_type == TypeManager.int32_type)
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                if (target_type == TypeManager.uint32_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                } if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is ShortConstant){
                                short v = ((ShortConstant) real_expr).Value;
@@ -1418,43 +1425,43 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckRange (ec, v, target_type, Byte.MinValue, Byte.MaxValue))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, SByte.MinValue, SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.ushort_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int32_type)
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                if (target_type == TypeManager.uint32_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MinValue, Char.MaxValue))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is UShortConstant){
                                ushort v = ((UShortConstant) real_expr).Value;
@@ -1462,37 +1469,37 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckRange (ec, v, target_type, Byte.MinValue, Byte.MaxValue))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, SByte.MinValue, SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type) {
                                        if (!CheckRange (ec, v, target_type, Int16.MinValue, Int16.MaxValue))
                                                return null;
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int32_type)
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                if (target_type == TypeManager.uint32_type)
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type)
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MinValue, Char.MaxValue))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is IntConstant){
                                int v = ((IntConstant) real_expr).Value;
@@ -1500,46 +1507,46 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckRange (ec, v, target_type, Byte.MinValue, Byte.MaxValue))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, SByte.MinValue, SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type) {
                                        if (!CheckRange (ec, v, target_type, Int16.MinValue, Int16.MaxValue))
                                                return null;
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.ushort_type) {
                                        if (!CheckRange (ec, v, target_type, UInt16.MinValue, UInt16.MaxValue))
                                                return null;
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.uint32_type) {
                                        if (!CheckRange (ec, v, target_type, Int32.MinValue, Int32.MaxValue))
                                                return null;
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MinValue, Char.MaxValue))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is UIntConstant){
                                uint v = ((UIntConstant) real_expr).Value;
@@ -1547,43 +1554,43 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MinValue, Char.MaxValue))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, SByte.MinValue, SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type) {
                                        if (!CheckRange (ec, v, target_type, Int16.MinValue, Int16.MaxValue))
                                                return null;
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.ushort_type) {
                                        if (!CheckRange (ec, v, target_type, UInt16.MinValue, UInt16.MaxValue))
                                                return null;
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int32_type) {
                                        if (!CheckRange (ec, v, target_type, Int32.MinValue, Int32.MaxValue))
                                                return null;
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type)
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MinValue, Char.MaxValue))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is LongConstant){
                                long v = ((LongConstant) real_expr).Value;
@@ -1591,49 +1598,49 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckRange (ec, v, target_type, Byte.MinValue, Byte.MaxValue))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, SByte.MinValue, SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type) {
                                        if (!CheckRange (ec, v, target_type, Int16.MinValue, Int16.MaxValue))
                                                return null;
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.ushort_type) {
                                        if (!CheckRange (ec, v, target_type, UInt16.MinValue, UInt16.MaxValue))
                                                return null;
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int32_type) {
                                        if (!CheckRange (ec, v, target_type, Int32.MinValue, Int32.MaxValue))
                                                return null;
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.uint32_type) {
                                        if (!CheckRange (ec, v, target_type, UInt32.MinValue, UInt32.MaxValue))
                                                return null;
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.uint64_type) {
                                        if (!CheckUnsigned (ec, v, target_type))
                                                return null;
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MinValue, Char.MaxValue))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is ULongConstant){
                                ulong v = ((ULongConstant) real_expr).Value;
@@ -1641,101 +1648,101 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckRange (ec, v, target_type, Byte.MaxValue))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, (ulong) SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type) {
                                        if (!CheckRange (ec, v, target_type, (ulong) Int16.MaxValue))
                                                return null;
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.ushort_type) {
                                        if (!CheckRange (ec, v, target_type, UInt16.MaxValue))
                                                return null;
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int32_type) {
                                        if (!CheckRange (ec, v, target_type, Int32.MaxValue))
                                                return null;
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.uint32_type) {
                                        if (!CheckRange (ec, v, target_type, UInt32.MaxValue))
                                                return null;
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int64_type) {
                                        if (!CheckRange (ec, v, target_type, (ulong) Int64.MaxValue))
                                                return null;
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MaxValue))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is FloatConstant){
                                float v = ((FloatConstant) real_expr).Value;
        
                                if (target_type == TypeManager.byte_type)
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                if (target_type == TypeManager.sbyte_type)
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                if (target_type == TypeManager.short_type)
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                if (target_type == TypeManager.ushort_type)
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                if (target_type == TypeManager.int32_type)
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                if (target_type == TypeManager.uint32_type)
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type)
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type)
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
                        if (real_expr is DoubleConstant){
                                double v = ((DoubleConstant) real_expr).Value;
        
                                if (target_type == TypeManager.byte_type){
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                } if (target_type == TypeManager.sbyte_type)
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                if (target_type == TypeManager.short_type)
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                if (target_type == TypeManager.ushort_type)
-                                       return new UShortConstant ((ushort) v);
+                                       return new UShortConstant ((ushort) v, real_expr.Location);
                                if (target_type == TypeManager.int32_type)
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                if (target_type == TypeManager.uint32_type)
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type)
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.char_type)
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
 
                        if (real_expr is CharConstant){
@@ -1744,37 +1751,37 @@ namespace Mono.CSharp {
                                if (target_type == TypeManager.byte_type) {
                                        if (!CheckRange (ec, v, target_type, Byte.MinValue, Byte.MaxValue))
                                                return null;
-                                       return new ByteConstant ((byte) v);
+                                       return new ByteConstant ((byte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.sbyte_type) {
                                        if (!CheckRange (ec, v, target_type, SByte.MinValue, SByte.MaxValue))
                                                return null;
-                                       return new SByteConstant ((sbyte) v);
+                                       return new SByteConstant ((sbyte) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.short_type) {
                                        if (!CheckRange (ec, v, target_type, Int16.MinValue, Int16.MaxValue))
                                                return null;
-                                       return new ShortConstant ((short) v);
+                                       return new ShortConstant ((short) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.int32_type)
-                                       return new IntConstant ((int) v);
+                                       return new IntConstant ((int) v, real_expr.Location);
                                if (target_type == TypeManager.uint32_type)
-                                       return new UIntConstant ((uint) v);
+                                       return new UIntConstant ((uint) v, real_expr.Location);
                                if (target_type == TypeManager.int64_type)
-                                       return new LongConstant ((long) v);
+                                       return new LongConstant ((long) v, real_expr.Location);
                                if (target_type == TypeManager.uint64_type)
-                                       return new ULongConstant ((ulong) v);
+                                       return new ULongConstant ((ulong) v, real_expr.Location);
                                if (target_type == TypeManager.float_type)
-                                       return new FloatConstant ((float) v);
+                                       return new FloatConstant ((float) v, real_expr.Location);
                                if (target_type == TypeManager.double_type)
-                                       return new DoubleConstant ((double) v);
+                                       return new DoubleConstant ((double) v, real_expr.Location);
                                if (target_type == TypeManager.char_type) {
                                        if (!CheckRange (ec, v, target_type, Char.MinValue, Char.MaxValue))
                                                return null;
-                                       return new CharConstant ((char) v);
+                                       return new CharConstant ((char) v, real_expr.Location);
                                }
                                if (target_type == TypeManager.decimal_type)
-                                       return new DecimalConstant ((decimal) v);
+                                       return new DecimalConstant ((decimal) v, real_expr.Location);
                        }
 
                        return null;
@@ -2062,7 +2069,7 @@ namespace Mono.CSharp {
                                                        long ll = ((LongConstant) right).Value;
 
                                                        if (ll >= 0)
-                                                               right = new ULongConstant ((ulong) ll);
+                                                               right = new ULongConstant ((ulong) ll, right.Location);
                                                } else {
                                                        e = Convert.ImplicitNumericConversion (ec, right, l, loc);
                                                        if (e != null)
@@ -2079,7 +2086,7 @@ namespace Mono.CSharp {
                                                long ll = ((LongConstant) left).Value;
                                                
                                                if (ll > 0)
-                                                       left = new ULongConstant ((ulong) ll);
+                                                       left = new ULongConstant ((ulong) ll, right.Location);
                                        } else {
                                                e = Convert.ImplicitNumericConversion (ec, left, r, loc);
                                                if (e != null)
@@ -2123,7 +2130,7 @@ namespace Mono.CSharp {
                                                int val = ic.Value;
                                                
                                                if (val >= 0){
-                                                       right = new UIntConstant ((uint) val);
+                                                       right = new UIntConstant ((uint) val, ic.Location);
                                                        type = l;
                                                        
                                                        return true;
@@ -2136,7 +2143,7 @@ namespace Mono.CSharp {
                                                int val = ic.Value;
                                                
                                                if (val >= 0){
-                                                       left = new UIntConstant ((uint) val);
+                                                       left = new UIntConstant ((uint) val, ic.Location);
                                                        type = r;
                                                        return true;
                                                }
@@ -2184,14 +2191,19 @@ namespace Mono.CSharp {
                }
 
                static public void Error_OperatorCannotBeApplied (Location loc, string name, Type l, Type r)
+               {
+                       Error_OperatorCannotBeApplied (loc, name, TypeManager.CSharpName (l), TypeManager.CSharpName (r));
+               }
+
+               public static void Error_OperatorCannotBeApplied (Location loc, string name, string left, string right)
                {
                        Report.Error (19, loc, "Operator `{0}' cannot be applied to operands of type `{1}' and `{2}'",
-                              name, TypeManager.CSharpName (l), TypeManager.CSharpName (r));
+                               name, left, right);
                }
                
                void Error_OperatorCannotBeApplied ()
                {
-                       Error_OperatorCannotBeApplied (loc, OperName (oper), left.Type, right.Type);
+                       Error_OperatorCannotBeApplied (Location, OperName (oper), left.GetSignatureForError (), right.GetSignatureForError ());
                }
 
                static bool is_unsigned (Type t)
@@ -2250,10 +2262,10 @@ namespace Mono.CSharp {
                                type = e.Type;
 
                                if (type == TypeManager.int32_type || type == TypeManager.uint32_type){
-                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (31));
+                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntConstant (31, loc));
                                        right = right.DoResolve (ec);
                                } else {
-                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (63));
+                                       right = new Binary (Binary.Operator.BitwiseAnd, right, new IntConstant (63, loc));
                                        right = right.DoResolve (ec);
                                }
 
@@ -2351,7 +2363,7 @@ namespace Mono.CSharp {
                                
                                // Simple constant folding
                                if (left is StringConstant && right is StringConstant)
-                                       return new StringConstant (((StringConstant) left).Value + ((StringConstant) right).Value);
+                                       return new StringConstant (((StringConstant) left).Value + ((StringConstant) right).Value, left.Location);
                                
                                if (l == TypeManager.string_type || r == TypeManager.string_type) {
 
@@ -2765,7 +2777,7 @@ namespace Mono.CSharp {
                                        return null;
 
                                if (left.eclass == ExprClass.Type) {
-                                       Error (75, "To cast a negative value, you must enclose the value in parentheses");
+                                       Report.Error (75, loc, "To cast a negative value, you must enclose the value in parentheses");
                                        return null;
                                }
                        } else
@@ -2805,6 +2817,14 @@ namespace Mono.CSharp {
                                                lc;
                                }
                        }
+                       else if (oper == Operator.BitwiseOr) {
+                               if (lc is EnumConstant &&
+                                   rc != null && rc.IsZeroInteger)
+                                       return lc;
+                               if (rc is EnumConstant &&
+                                   lc != null && lc.IsZeroInteger)
+                                       return rc;
+                       }
 
                        if (rc != null && lc != null){
                                int prev_e = Report.Errors;
@@ -3330,7 +3350,7 @@ namespace Mono.CSharp {
                        if (operand is StringConstant && operands.Count != 0) {
                                StringConstant last_operand = operands [operands.Count - 1] as StringConstant;
                                if (last_operand != null) {
-                                       operands [operands.Count - 1] = new StringConstant (last_operand.Value + ((StringConstant) operand).Value);
+                                       operands [operands.Count - 1] = new StringConstant (last_operand.Value + ((StringConstant) operand).Value, last_operand.Location);
                                        return;
                                }
                        }
@@ -3487,7 +3507,7 @@ namespace Mono.CSharp {
 
                protected void Error19 ()
                {
-                       Binary.Error_OperatorCannotBeApplied (loc, is_and ? "&&" : "||", type, type);
+                       Binary.Error_OperatorCannotBeApplied (loc, is_and ? "&&" : "||", left.GetSignatureForError (), right.GetSignatureForError ());
                }
 
                protected void Error218 ()
@@ -3625,7 +3645,7 @@ namespace Mono.CSharp {
 
                                Constant right_const = right as Constant;
                                if (right_const != null && size != 0) {
-                                       Expression ex = ConstantFold.BinaryFold (ec, Binary.Operator.Multiply, new IntConstant (size), right_const, loc);
+                                       Expression ex = ConstantFold.BinaryFold (ec, Binary.Operator.Multiply, new IntConstant (size, right.Location), right_const, loc);
                                        if (ex == null)
                                                return;
                                        ex.Emit (ec);
@@ -5711,7 +5731,7 @@ namespace Mono.CSharp {
                        }
 
                        if (IsMethodExcluded (method, ec))
-                return; 
+                               return; 
                        
                        if (!is_static){
                                if (instance_expr == EmptyExpression.Null) {
@@ -6011,31 +6031,31 @@ namespace Mono.CSharp {
                public static Constant Constantify (Type t)
                {
                        if (t == TypeManager.int32_type)
-                               return new IntConstant (0);
+                               return new IntConstant (0, Location.Null);
                        if (t == TypeManager.uint32_type)
-                               return new UIntConstant (0);
+                               return new UIntConstant (0, Location.Null);
                        if (t == TypeManager.int64_type)
-                               return new LongConstant (0);
+                               return new LongConstant (0, Location.Null);
                        if (t == TypeManager.uint64_type)
-                               return new ULongConstant (0);
+                               return new ULongConstant (0, Location.Null);
                        if (t == TypeManager.float_type)
-                               return new FloatConstant (0);
+                               return new FloatConstant (0, Location.Null);
                        if (t == TypeManager.double_type)
-                               return new DoubleConstant (0);
+                               return new DoubleConstant (0, Location.Null);
                        if (t == TypeManager.short_type)
-                               return new ShortConstant (0);
+                               return new ShortConstant (0, Location.Null);
                        if (t == TypeManager.ushort_type)
-                               return new UShortConstant (0);
+                               return new UShortConstant (0, Location.Null);
                        if (t == TypeManager.sbyte_type)
-                               return new SByteConstant (0);
+                               return new SByteConstant (0, Location.Null);
                        if (t == TypeManager.byte_type)
-                               return new ByteConstant (0);
+                               return new ByteConstant (0, Location.Null);
                        if (t == TypeManager.char_type)
-                               return new CharConstant ('\0');
+                               return new CharConstant ('\0', Location.Null);
                        if (t == TypeManager.bool_type)
-                               return new BoolConstant (false);
+                               return new BoolConstant (false, Location.Null);
                        if (t == TypeManager.decimal_type)
-                               return new DecimalConstant (0);
+                               return new DecimalConstant (0, Location.Null);
 
                        return null;
                }
@@ -6415,7 +6435,7 @@ namespace Mono.CSharp {
                        int i = 0;
                        for (ArrayList probe = initializers; probe != null;) {
                                if (probe.Count > 0 && probe [0] is ArrayList) {
-                                       Expression e = new IntConstant (probe.Count);
+                                       Expression e = new IntConstant (probe.Count, Location.Null);
                                        arguments.Add (new Argument (e, Argument.AType.Expression));
 
                                        bounds [i++] =  probe.Count;
@@ -6423,7 +6443,7 @@ namespace Mono.CSharp {
                                        probe = (ArrayList) probe [0];
                                        
                                } else {
-                                       Expression e = new IntConstant (probe.Count);
+                                       Expression e = new IntConstant (probe.Count, Location.Null);
                                        arguments.Add (new Argument (e, Argument.AType.Expression));
 
                                        bounds [i++] = probe.Count;
@@ -7301,7 +7321,7 @@ namespace Mono.CSharp {
 
                        int size_of = GetTypeSize (type_queried);
                        if (size_of > 0) {
-                               return new IntConstant (size_of);
+                               return new IntConstant (size_of, loc);
                        }
 
                        if (!ec.InUnsafe) {
index a8ebfdd844017ed868e18e9264a72f56877521e4..a358f1dc4b31ca13697ff7d23161ae977f111f41 100644 (file)
@@ -498,7 +498,7 @@ namespace Mono.CSharp {
                                cc.CaptureThis ();
                        }
 
-                       args.Add (new Argument (new BoolLiteral (false)));
+                       args.Add (new Argument (new BoolLiteral (false, Location)));
 
                        for (int i = 0; i < parameters.Count; i++) {
                                Type t = parameters.ParameterType (i);
@@ -603,7 +603,7 @@ namespace Mono.CSharp {
                                new Binary (
                                        Binary.Operator.LessThanOrEqual,
                                        new FieldExpression (this, pc_field),
-                                       new IntLiteral ((int) State.Running)),
+                                       new IntLiteral ((int) State.Running, pc_field.Location)),
                                Create_ThrowInvalidOperation (),
                                new Return (
                                        new FieldExpression (this, current_field), Location),
@@ -651,8 +651,8 @@ namespace Mono.CSharp {
                                "CompareExchange", Location);
 
                        Expression pc = new FieldExpression (this, pc_field);
-                       Expression before = new IntLiteral ((int) State.Running);
-                       Expression uninitialized = new IntLiteral ((int) State.Uninitialized);
+                       Expression before = new IntLiteral ((int) State.Running, Location);
+                       Expression uninitialized = new IntLiteral ((int) State.Uninitialized, Location);
 
                        ArrayList args = new ArrayList ();
                        args.Add (new Argument (pc, Argument.AType.Ref));
@@ -674,7 +674,7 @@ namespace Mono.CSharp {
                                args.Add (new Argument (new CapturedThisReference (this, Location)));
                        }
 
-                       args.Add (new Argument (new BoolLiteral (true)));
+                       args.Add (new Argument (new BoolLiteral (true, Location)));
 
                        for (int i = 0; i < parameters.Count; i++) {
                                Expression cp = new CapturedParameterReference (
index 8582a4f8dfcd4facf87622c8242f002da9add880..6d3a4ceeac0c7a19c6e910c9e912c7bea0df4326 100644 (file)
@@ -47,14 +47,8 @@ namespace Mono.CSharp {
        // The null Literal constant
        //
        public class NullLiteral : Constant {
-               public static readonly NullLiteral Null;
-
-               static NullLiteral ()
-               {
-                       Null = new NullLiteral ();
-               }
-                       
-               public NullLiteral ()
+               public NullLiteral (Location loc):
+                       base (loc)
                {
                        eclass = ExprClass.Value;
                }
@@ -115,7 +109,7 @@ namespace Mono.CSharp {
                public override Constant ToType (Type type, Location loc)
                {
                        if (!type.IsValueType && !TypeManager.IsEnumType (type))
-                               return NullLiteral.Null;
+                               return this;
 
                        return base.ToType (type, loc);
                }
@@ -126,14 +120,15 @@ namespace Mono.CSharp {
        // A null literal in a pointer context
        //
        public class NullPointer : NullLiteral {
-               public new static readonly NullLiteral Null;
+               public static readonly NullLiteral Null;
 
                static NullPointer ()
                {
                        Null = new NullPointer ();
                }
 
-               private NullPointer ()
+               private NullPointer ():
+                       base (Location.Null)
                {
                        type = TypeManager.object_type;
                }
@@ -148,7 +143,7 @@ namespace Mono.CSharp {
        }
 
        public class BoolLiteral : BoolConstant {
-               public BoolLiteral (bool val) : base (val)
+               public BoolLiteral (bool val, Location loc) : base (val, loc)
                {
                }
 
@@ -160,7 +155,7 @@ namespace Mono.CSharp {
        }
 
        public class CharLiteral : CharConstant {
-               public CharLiteral (char c) : base (c)
+               public CharLiteral (char c, Location loc) : base (c, loc)
                {
                }
 
@@ -172,15 +167,7 @@ namespace Mono.CSharp {
        }
 
        public class IntLiteral : IntConstant {
-               public static IntLiteral One, Zero;
-               
-               static IntLiteral ()
-               {
-                       Zero = new IntLiteral (0);
-                       One = new IntLiteral (1);
-               }
-               
-               public IntLiteral (int l) : base (l)
+               public IntLiteral (int l, Location loc) : base (l, loc)
                {
                }
 
@@ -192,7 +179,7 @@ namespace Mono.CSharp {
        }
 
        public class UIntLiteral : UIntConstant {
-               public UIntLiteral (uint l) : base (l)
+               public UIntLiteral (uint l, Location loc) : base (l, loc)
                {
                }
 
@@ -204,7 +191,7 @@ namespace Mono.CSharp {
        }
        
        public class LongLiteral : LongConstant {
-               public LongLiteral (long l) : base (l)
+               public LongLiteral (long l, Location loc) : base (l, loc)
                {
                }
 
@@ -217,7 +204,7 @@ namespace Mono.CSharp {
        }
 
        public class ULongLiteral : ULongConstant {
-               public ULongLiteral (ulong l) : base (l)
+               public ULongLiteral (ulong l, Location loc) : base (l, loc)
                {
                }
 
@@ -230,7 +217,7 @@ namespace Mono.CSharp {
        
        public class FloatLiteral : FloatConstant {
                
-               public FloatLiteral (float f) : base (f)
+               public FloatLiteral (float f, Location loc) : base (f, loc)
                {
                }
 
@@ -242,7 +229,7 @@ namespace Mono.CSharp {
        }
 
        public class DoubleLiteral : DoubleConstant {
-               public DoubleLiteral (double d) : base (d)
+               public DoubleLiteral (double d, Location loc) : base (d, loc)
                {
                }
 
@@ -255,7 +242,7 @@ namespace Mono.CSharp {
        }
 
        public class DecimalLiteral : DecimalConstant {
-               public DecimalLiteral (decimal d) : base (d)
+               public DecimalLiteral (decimal d, Location loc) : base (d, loc)
                {
                }
 
@@ -267,7 +254,7 @@ namespace Mono.CSharp {
        }
 
        public class StringLiteral : StringConstant {
-               public StringLiteral (string s) : base (s)
+               public StringLiteral (string s, Location loc) : base (s, loc)
                {
                }
 
index 19c246be8c067d3859310b47be43d309b02dbeb9..f48e2816eb9f3597b32dfc4e5d1901c6714bbcb8 100644 (file)
@@ -88,8 +88,9 @@ namespace Mono.CSharp {
                static int column_mask;
                static Checkpoint [] checkpoints;
                static int checkpoint_index;
-
+               
                public readonly static Location Null = new Location (-1);
+               public static bool InEmacs;
                
                static Location ()
                {
@@ -245,7 +246,7 @@ namespace Mono.CSharp {
 
                public override string ToString ()
                {
-                       if (column_bits == 0)
+                       if (column_bits == 0 || InEmacs)
                                return Name + "(" + Row + "):";
                        else
                                return Name + "(" + Row + "," + Column +
index 523925120ebb1e273e420bc0845bc935e1ff1be7..7378a6fca16edc61c6341349c952c7a50083c90e 100644 (file)
@@ -36,4 +36,4 @@ tree.cs
 ../class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
 ../class/Mono.CompilerServices.SymbolWriter/MonoSymbolWriter.cs
 ../class/corlib/Mono.Security.Cryptography/CryptoConvert.cs
-../build/common/Consts.cs
\ No newline at end of file
+../build/common/Consts.cs
index 8277e894d88e82069b05a85d13cc751d5c0a8569..d717fba709339e2335e66f816595c62d231f2b4e 100644 (file)
@@ -812,7 +812,7 @@ namespace Mono.CSharp {
 
                        object val = c.GetValue ();
                        if (val == null)
-                               val = c;
+                               val = SwitchLabel.NullStringCase;
                                        
                        sl = (SwitchLabel) ec.Switch.Elements [val];
 
@@ -1917,7 +1917,7 @@ namespace Mono.CSharp {
 
                                        if (!unreachable_shown && (RootContext.WarningLevel >= 2)) {
                                                Report.Warning (
-                                                       162, loc, "Unreachable code detected");
+                                                       162, s.loc, "Unreachable code detected");
                                                unreachable_shown = true;
                                        }
                                }
@@ -2301,6 +2301,8 @@ namespace Mono.CSharp {
                Label il_label_code;
                bool  il_label_code_set;
 
+               public static readonly object NullStringCase = new object ();
+
                //
                // if expr == null, then it is the default case.
                //
@@ -2358,7 +2360,7 @@ namespace Mono.CSharp {
                        }
 
                        if (required_type == TypeManager.string_type && e is NullLiteral) {
-                               converted = e;
+                               converted = NullStringCase;
                                return true;
                        }
 
@@ -2856,7 +2858,7 @@ namespace Mono.CSharp {
 
                        ig.Emit (OpCodes.Ldloc, val);
                        
-                       if (Elements.Contains (NullLiteral.Null)){
+                       if (Elements.Contains (SwitchLabel.NullStringCase)){
                                ig.Emit (OpCodes.Brfalse, null_target);
                        } else
                                ig.Emit (OpCodes.Brfalse, default_target);
@@ -2895,7 +2897,7 @@ namespace Mono.CSharp {
                                        if (sl.Label != null){
                                                object lit = sl.Converted;
 
-                                               if (lit is NullLiteral){
+                                               if (lit == SwitchLabel.NullStringCase){
                                                        null_found = true;
                                                        if (label_count == 1)
                                                                ig.Emit (OpCodes.Br, next_test);
@@ -3881,7 +3883,7 @@ namespace Mono.CSharp {
                {
                        if (!TypeManager.ImplementsInterface (expr_type, TypeManager.idisposable_type)){
                                if (Convert.ImplicitConversion (ec, expr, TypeManager.idisposable_type, loc) == null) {
-                                       Report.Error (1674, loc, "`{0}': type used in a using statement must be implicitly convertible to 'System.IDisposable'",
+                                       Report.Error (1674, loc, "`{0}': type used in a using statement must be implicitly convertible to `System.IDisposable'",
                                                TypeManager.CSharpName (expr_type));
                                        return false;
                                }
index 0123b7b6cd5cc759467c297839da9f2e38fb696e..529716d76f90003c8ee62dd7563d0565c41815b2 100644 (file)
@@ -63,7 +63,9 @@ namespace Mono.CSharp {
                        sighelper.AddArgument (builder.LocalType);
                        byte[] signature = sighelper.GetSignature ();
 
-                       DefineLocalVariable (name, signature);
+                       int index = MonoDebuggerSupport.GetLocalIndex (builder);
+
+                       DefineLocalVariable (index, name, signature);
                }
 
                public int OpenScope (ILGenerator ig)
index c133019859293d00589d28533f3a350dd46a8561..d5060cbf04d9696e2cb71c1cb88a6af10e57798d 100644 (file)
@@ -796,8 +796,13 @@ public class TypeManager {
                if (mb.IsSpecialName && !mb.IsConstructor) {
                        if (iparams.Count > 1) {
                                sig.Append ("this[");
-                               int before_ret_val = parameters.LastIndexOf (',');
-                               sig.Append (parameters.Substring (1, before_ret_val - 1));
+                               if (show_accessor) {
+                                       sig.Append (parameters.Substring (1, parameters.Length - 2));
+                               }
+                               else {
+                                       int before_ret_val = parameters.LastIndexOf (',');
+                                       sig.Append (parameters.Substring (1, before_ret_val - 1));
+                               }
                                sig.Append (']');
                        } else {
                                sig.Append (mb.Name.Substring (4));
index b27b17e17377f65ac5b53c355cd3e5c8a7b858ad..aad6c1f0077cb49540580dd252bb078e9f4a2312 100644 (file)
@@ -1,3 +1,37 @@
+2005-09-15  Raja R Harinath  <rharinath@novell.com>
+
+       * test-455.cs: New test.  Distilled from a failing unit test of
+       System.Runtime.Serialization.Formatters.Soap.dll.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * gtest-200.cs : test for bug #75668.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * gtest-198.cs : fix. missing main.
+       * gtest-199.cs : test code similar to #75772.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * known-issues-gmcs: new tests are not passing with gmcs.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * test-454.cs : test for #75968.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * test-453.cs : test for #75846.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * gtest-198.cs : test for #75957.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * known-issues-gmcs : tset-49 is not working, should be IGNORED.
+
 2005-09-02  Raja R Harinath  <rharinath@novell.com>
 
        * test-452.cs: New test from #75941.
diff --git a/mcs/tests/gtest-197.cs b/mcs/tests/gtest-197.cs
new file mode 100644 (file)
index 0000000..ce9cf08
--- /dev/null
@@ -0,0 +1,73 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Martin.Collections.Generic {
+       [Serializable]
+       public abstract class EqualityComparer <T> : IEqualityComparer <T> {
+               
+               static EqualityComparer ()
+               {
+                       if (typeof (IEquatable <T>).IsAssignableFrom (typeof (T)))
+                               _default = (EqualityComparer <T>) Activator.CreateInstance (typeof (IEquatableOfTEqualityComparer<>).MakeGenericType (typeof (T)));
+                       else
+                               _default = new DefaultComparer ();
+               }
+               
+               
+               public abstract int GetHashCode (T obj);
+               public abstract bool Equals (T x, T y);
+       
+               static readonly EqualityComparer <T> _default;
+               
+               public static EqualityComparer <T> Default {
+                       get {
+                               return _default;
+                       }
+               }
+               
+               [Serializable]
+               class DefaultComparer : EqualityComparer<T> {
+       
+                       public override int GetHashCode (T obj)
+                       {
+                               return obj.GetHashCode ();
+                       }
+       
+                       public override bool Equals (T x, T y)
+                       {
+                               if (x == null)
+                                       return y == null;
+                               
+                               return x.Equals (y);
+                       }
+               }
+       }
+       
+       [Serializable]
+       class IEquatableOfTEqualityComparer <T> : EqualityComparer <T> where T : IEquatable <T> {
+
+               public override int GetHashCode (T obj)
+               {
+                       return obj.GetHashCode ();
+               }
+
+               public override bool Equals (T x, T y)
+               {
+                       if (x == null)
+                               return y == null;
+                       
+                       return x.Equals (y);
+               }
+       }
+
+       public interface IEqualityComparer<T> {
+               bool Equals (T x, T y);
+               int GetHashCode (T obj);
+       }
+
+       class X
+       {
+               static void Main ()
+               { }
+       }
+}
diff --git a/mcs/tests/gtest-198.cs b/mcs/tests/gtest-198.cs
new file mode 100644 (file)
index 0000000..aba3702
--- /dev/null
@@ -0,0 +1,26 @@
+// gtest-198.cs : bug #75957
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassLibrary2
+{
+        public class List1<T> : List<T>
+        { }
+
+        public class List2<T>
+        {
+                private List1<T> _List = new List1<T>();
+                public void AddItem(T item)
+                {
+                        _List.Add(item);
+                }
+        }
+
+       class Foo
+       {
+               public static void Main () {}
+       }
+}
+
diff --git a/mcs/tests/gtest-199.cs b/mcs/tests/gtest-199.cs
new file mode 100644 (file)
index 0000000..cbe8ee7
--- /dev/null
@@ -0,0 +1,17 @@
+// Compiler options: /unsafe
+
+// similar code from #75772.
+public class Splay<T>
+{
+  unsafe private struct Node
+  {
+    private int* foo;
+    private T                 data;
+  } 
+}
+
+class Foo 
+{
+  public static void Main () {}
+}
+
diff --git a/mcs/tests/gtest-200.cs b/mcs/tests/gtest-200.cs
new file mode 100644 (file)
index 0000000..b7e219b
--- /dev/null
@@ -0,0 +1,27 @@
+class Test
+{
+
+ public static T QueryInterface<T>(object val)
+   where T : class
+ {
+     if (val == null)
+         return null;
+
+     // First, see if the given object can be directly cast
+     // to the requested type.  This will be a common case,
+     // especially when checking for standard behavior interface
+     // implementations (like IXrcDataElement).
+     T tval = val as T;
+     if (tval != null)
+         return tval;
+
+     // ... rest of method unimportant and omitted ...
+     return null;
+ }
+}
+
+class Driver
+{
+ public static void Main () {}
+}
+
diff --git a/mcs/tests/gtest-201.cs b/mcs/tests/gtest-201.cs
new file mode 100644 (file)
index 0000000..5c4f2ae
--- /dev/null
@@ -0,0 +1,37 @@
+using System;
+using MSG = System.Collections.Generic;
+
+public class HashSet<T>
+{
+       long value;
+
+       public HashSet (long value)
+       {
+               this.value = value;
+       }
+
+       public long Test ()
+       {
+               return value;
+       }
+
+       public MSG.IEnumerator<long> GetEnumerator()
+       {
+               yield return Test ();
+       }
+}
+
+class X
+{
+       static int Main ()
+       {
+               HashSet<int> hb = new HashSet<int> (12345678);
+
+               foreach (long value in hb) {
+                       if (value != 12345678)
+                               return 1;
+               }
+
+               return 0;
+       }
+}
index 2175bafd08dfb57f1038fad06efd2447c0235472..1fd387b89b30fb59f77dadc91f309e1517e70854 100644 (file)
@@ -6,35 +6,12 @@
 
 gtest-179.cs IGNORE
 gtest-187.cs IGNORE
-test-308.cs
-test-425.cs
-test-426.cs
-test-427.cs
-test-428.cs
-test-429.cs
-test-430.cs
-test-431.cs
-test-432.cs
-test-433.cs
-test-434.cs
-test-435.cs
-test-436.cs
-test-437.cs
-test-438.cs
 test-439.cs IGNORE             # Compiles to invalid IL
 test-442.cs IGNORE             # Compiles to invalid IL
-test-443.cs
-test-445.cs
-test-446.cs
-test-447.cs
-test-450.cs
-test-451.cs
+test-453.cs IGNORE
+test-454.cs IGNORE
 
-test-49.cs
 test-50.cs IGNORE      # Windows-only test
 test-67.cs IGNORE      # Windows-only test
 test-anon-27.cs
 test-xml-027.cs
-test-anon-31.cs
-test-partial-08.cs
-test-partial-09.cs
index 5e5fdf32cb6a2fe7f529d54de43092539aa8ba9a..12847651ed1c49aab83a0b52d953d834ed16a0cd 100644 (file)
@@ -7,7 +7,5 @@
 test-50.cs IGNORE      # Windows-only tests
 test-67.cs IGNORE      # Windows-only test
 
-test-49.cs IGNORE
-
 test-anon-27.cs
 test-xml-027.cs
diff --git a/mcs/tests/test-453.cs b/mcs/tests/test-453.cs
new file mode 100644 (file)
index 0000000..3543b0d
--- /dev/null
@@ -0,0 +1,17 @@
+using System;
+
+class C {
+       internal enum Flags {
+               Removed = 0,
+               Public  = 1
+       }
+
+       static Flags    _enumFlags;
+               
+       public static void Main()
+       {
+               if ((Flags.Removed | 0).ToString () != "Removed")
+                       throw new ApplicationException ();
+       }
+}
+
diff --git a/mcs/tests/test-454.cs b/mcs/tests/test-454.cs
new file mode 100644 (file)
index 0000000..9032303
--- /dev/null
@@ -0,0 +1,36 @@
+// string array initializer is allowed as a parameter type.
+using System;
+
+class FooAttribute : Attribute
+{
+       public string [] StringValues;
+       public object [] ObjectValues;
+       public Type [] Types;
+
+       public FooAttribute ()
+       {
+       }
+}
+
+[Foo (StringValues = new string [] {"foo", "bar", "baz"},
+       ObjectValues = new object [] {1, 'A', "B"},
+       Types = new Type [] {typeof (int), typeof (Type)}
+       )]
+class Test
+{
+       public static void Main () 
+       {
+               FooAttribute foo = (FooAttribute) typeof (Test)
+                       .GetCustomAttributes (false) [0];
+               if (foo.StringValues [0] != "foo"
+                       || foo.StringValues [1] != "bar"
+                       || foo.StringValues [2] != "baz"
+                       || 1 != (int) foo.ObjectValues [0]
+                       || 'A' != (char) foo.ObjectValues [1]
+                       || "B" != (string) foo.ObjectValues [2]
+                       || foo.Types [0] != typeof (int)
+                       || foo.Types [1] != typeof (Type)
+                       )
+                       throw new ApplicationException ();
+       }
+}
diff --git a/mcs/tests/test-455.cs b/mcs/tests/test-455.cs
new file mode 100644 (file)
index 0000000..754f344
--- /dev/null
@@ -0,0 +1,15 @@
+struct Foo {
+       public int x;
+       public override int GetHashCode ()
+       {
+               return base.GetHashCode ();
+       }
+}
+
+class Test {
+       static void Main ()
+       {
+               Foo foo = new Foo ();
+               System.Console.WriteLine (foo.GetHashCode ());
+       }
+}
index 0134231aa4d37fc847b1209ee16337fdd8642da3..8bb1f0262431b6a041f25d2b92bd9b368c5162f8 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-19  Marek Safar  <marek.safar@seznam.cz>
+
+       * compiler-tester: Reverted Martin's revert and ignore gmcs error
+       tests for new checks as most of them are not "valid".
+
 2005-08-31  Martin Baulig  <martin@ximian.com>
 
        * compiler-tester: Reverted Marek's latest changes - they were
index 839ae926926597b9e83b5d2846f18ebccdf71184..86fd1d100942c0da3a7e9fc29eae4d97949cb95a 100644 (file)
@@ -470,17 +470,24 @@ namespace TestRunner {
        {
                string expected_message;
                string error_message;
+               bool check_msg;
+               bool check_error_line;
 
                protected enum CompilerError {
                        Expected,
                        Wrong,
                        Missing,
-                       WrongMessage
+                       WrongMessage,
+                       MissingLocation
                }
 
-               public NegativeChecker (ITester tester, string log_file, string issue_file):
+               public NegativeChecker (ITester tester, string log_file, string issue_file, bool check_msg):
                        base (tester, log_file, issue_file)
                {
+//TODO: need to review gmcs first
+#if !NET_2_0
+                       this.check_msg = check_msg;
+#endif
                }
 
                protected override bool AnalyzeTestFile(int row, string line)
@@ -499,6 +506,17 @@ namespace TestRunner {
                                expected_message = line.Substring (index + 1).Trim ();
                        }
 
+                       if (row == 2) {
+                               string filtered = line.Replace (" ", "");
+                               check_error_line = !filtered.StartsWith ("//Line:0");
+
+                               if (!filtered.StartsWith ("//Line:")) {
+                                       LogLine ("IGNORING: Wrong test syntax (second line must have `// Line: xx' syntax");
+                                       ++ignored;
+                                       return false;
+                               }
+                       }
+
                        return base.AnalyzeTestFile (row, line);
                }
 
@@ -547,11 +565,21 @@ namespace TestRunner {
                        while (line != null) {
 
                                if (line.IndexOf (tested_text) != -1) {
-//                                     string msg = line.Substring (line.IndexOf (':', 22) + 1).TrimEnd ('.').Trim ();
-//                                     if (msg != expected_message && msg != expected_message.Replace ('`', '\'')) {
-//                                             error_message = msg;
-//                                             return CompilerError.WrongMessage;
-//                                     }
+                                       if (check_msg) {
+                                               int first = line.IndexOf (':');
+                                               int second = line.IndexOf (':', first + 1);
+                                               if (second == -1)
+                                                       second = first;
+
+                                               string msg = line.Substring (second + 1).TrimEnd ('.').Trim ();
+                                               if (msg != expected_message && msg != expected_message.Replace ('`', '\'')) {
+                                                       error_message = msg;
+                                                       return CompilerError.WrongMessage;
+                                               }
+
+                                               if (check_error_line && line.IndexOf (".cs(") == -1)
+                                                       return CompilerError.MissingLocation;
+                                       }
                                        return CompilerError.Expected;
                                }
 
@@ -603,8 +631,8 @@ namespace TestRunner {
                                        }
                                        else {
                                                LogLine ("REGRESSION (CORRECT ERROR -> WRONG ERROR MESSAGE)");
-                                               Console.WriteLine ("E: {0}", expected_message);
-                                               Console.WriteLine ("W: {0}", error_message);
+                                               LogLine ("Exp: {0}", expected_message);
+                                               LogLine ("Was: {0}", error_message);
                                        }
                                        break;
 
@@ -624,6 +652,22 @@ namespace TestRunner {
                                        }
 
                                        break;
+
+                               case CompilerError.MissingLocation:
+                                       if (know_issues.Contains (file)) {
+                                               LogLine ("KNOWN ISSUE (Missing error location)");
+                                               know_issues.Remove (file);
+                                               return false;
+                                       }
+                                       if (no_error_list.Contains (file)) {
+                                               LogLine ("REGRESSION (NO ERROR -> MISSING ERROR LOCATION)");
+                                               no_error_list.Remove (file);
+                                       }
+                                       else {
+                                               LogLine ("REGRESSION (CORRECT ERROR -> MISSING ERROR LOCATION)");
+                                       }
+                                       break;
+
                        }
 
                        regression.Add (file);
@@ -664,7 +708,7 @@ namespace TestRunner {
                        Checker checker;
                        switch (mode) {
                                case "negative":
-                                       checker = new NegativeChecker (tester, log_fname, issue_file);
+                                       checker = new NegativeChecker (tester, log_fname, issue_file, true);
                                        break;
                                case "positive":
                                        checker = new PositiveChecker (tester, log_fname, issue_file);
index a7b888559ea331cc631f864baf9fc3e67247e52c..3b998a433a41e4f161b0261327d5b6282e754352 100644 (file)
@@ -1,3 +1,15 @@
+2005-09-10  Miguel de Icaza  <miguel@novell.com>
+
+       * driver.cs: Only symlink if the file that we are symlking to
+       exists.   This fixes all the stale symlinks on $prefix/mono/1.0/
+       to config files that do not exist.
+
+2005-09-05  Miguel de Icaza  <miguel@novell.com>
+
+       * driver.cs (Uninstall): Add workaround, Directory.GetFiles does
+       not return symlinks inside the directories which makes this break
+       on uninstall (make distcheck on monodoc exposed this).
+
 2005-07-01  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * driver.cs (Install): Copy the linked resource files
index 2281bf77c84eb336c105fe019780deff60ac9c2f..d330d82b00d8a6fad43a4974f71ccd37f9a64a76 100644 (file)
@@ -295,7 +295,15 @@ namespace Mono.Tools {
                                        foreach (string ext in siblings) {
                                                string sibling = String.Concat (pkg_path, ext);
                                                string sref = String.Concat (ref_path, ext);
-                                               symlink (sibling, sref);
+                                               if (File.Exists (sibling))
+                                                       symlink (sibling, sref);
+                                               else {
+                                                       try {
+                                                               File.Delete (sref);
+                                                       } catch {
+                                                               // Ignore error, just delete files that should not be there.
+                                                       }
+                                               }
                                        }
                                        WriteLine ("Package exported to: {0} -> {1}", ref_path, pkg_path);
                                } else {
@@ -342,15 +350,23 @@ namespace Mono.Tools {
                                        File.Delete (link);
                                        if (Directory.GetFiles (link_dir).Length == 0) {
                                                WriteLine ("Cleaning package directory, it is empty.");
-                                               Directory.Delete (link_dir);
+                                               try {
+                                                       Directory.Delete (link_dir);
+                                               } catch {
+                                                       // Workaround: GetFiles does not list Symlinks
+                                               }
                                        }
                                }
                                WriteLine ("Assembly removed from the gac.");
                        }
 
                        if(Directory.GetDirectories (asmdir).Length == 0) {
-                               WriteLine ("Cleaning assembly dir, its empty");
-                               Directory.Delete (asmdir);
+                               WriteLine ("Cleaning assembly dir, it is empty");
+                               try {
+                                       Directory.Delete (asmdir);
+                               } catch {
+                                       // Workaround: GetFiles does not list Symlinks
+                               }
                        }
 
                        return true;
index d8d1033f7c507e090f27195cd40a802eb33cbc94..b2967876238e10d01b2ac7b0dcd4b6fc8fb27ee4 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-31  Geoff Norton  <gnorton@customerdna.com>
+
+       * LOADER: Whoops; forgot to rm the new file.
+
+2005-09-31  Geoff Norton  <gnorton@customerdna.com>
+
+       * LOADER: We exposed an apple bug.  This caused duplicates of the
+       main window to open by having AppName in Resources.  Modified from
+       a patch provided by Aaron Flynt (aaron@aaronflynt.com)
+
+2005-09-31  Geoff Norton  <gnorton@customerdna.com>
+
+       * LOADER: Launch a runtime generated symlink to mono instead of
+       /usr/bin/mono.  This makes the Application Title in the menu appear
+       correctly and not as "mono".
+
 2005-03-30  Geoff Norton  <gnorton@customerdna.com>
        
        * LOADER: Handle names with " " in them.  Thanks to 
index 59400c6fa054c26c0cef30b278ad18f7709ae3da..ffade6772c687b312ee32a1ed93f6c1001ed29fa 100755 (executable)
@@ -16,11 +16,8 @@ PWD=`pwd`
 APP_PATH=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+3] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }'`
 
 # Fetch the app name (its our own name)
-if [ "$X11_MODE" -eq "1" ]; then
-       APP_NAME=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") {idx++} printf("%s", patharr[idx]); }'`
-else
-       APP_NAME=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") {idx++} printf("%s.exe", patharr[idx]); }'`
-fi
+APP_NAME=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") {idx++} printf("%s", patharr[idx]); }'`
+ASSEMBLY=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") {idx++} printf("%s.exe", patharr[idx]); }'`
 
 # Setup the environment for MWF if needed
 if [ "$MWF_MODE" -eq "1" ]; then
@@ -39,5 +36,8 @@ cd "$APP_PATH/Contents/Resources"
 if [ "$X11_MODE" -eq "1" ]; then
        open-x11 "$APP_NAME"
 else
-       mono "$APP_NAME"
+       if [ ! -d "./bin" ]; then mkdir bin ; fi
+       if [ -f "./bin/$APP_NAME" ]; then rm -f "./bin/$APP_NAME" ; fi
+       ln -s `which mono` "./bin/$APP_NAME" 
+       "./bin/$APP_NAME" "$ASSEMBLY"
 fi
index 2042e17a46a75d9a103c879d6ffc101967e63961..6707afb0e2a55b8317411835621c91e32dc74a70 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-13  Cesar Lopez Nataren  <cnataren@novell.com>
+
+       * mjs.cs: Add support for flags parsing.
+
 2005-02-14  Cesar Lopez Nataren  <cnataren@novell.com>
 
        * Added this file.
index e465837c91ff95bbb3f91a022b3a291f4078168f..88a0caa4c02fe42396db8457bb072586cbc9d474 100644 (file)
@@ -3,6 +3,6 @@ SUBDIRS =
 include ../../build/rules.make
 
 PROGRAM = mjs.exe
-LOCAL_MCS_FLAGS = -r:Microsoft.JScript.dll -r:Microsoft.Vsa.dll
+LOCAL_MCS_FLAGS = /r:Microsoft.JScript.dll /r:Microsoft.Vsa.dll /debug+
 
 include ../../build/executable.make
index 91e7bf16e55bea6130e995dccd6f235ffd467993..0944a3e99e1722d4b219298e3d0c4b2f49a6aaca 100644 (file)
@@ -5,7 +5,7 @@
 //     Cesar Lopez Nataren (cesar@ciencias.unam.mx)
 //
 // (C) 2003, Cesar Lopez Nataren
-// (C) 2005, Novell Inc. (http://www.novell.com)
+// (C) Copyright 2005, Novell Inc. (http://www.novell.com)
 //
 
 //
 
 using System;
 using System.IO;
+using System.Text;
 using Microsoft.Vsa;
 using Microsoft.JScript;
+using System.Reflection;
+using System.Collections;
 using Microsoft.JScript.Vsa;
+using System.Reflection.Emit;
+using Mono.CSharp;
 
-class Driver {         
-       public static void Main (string [] args) {
+namespace Mono.JScript {
        
-               if (args.Length < 1) {
-                       Console.WriteLine ("Usage: mjs filename.js");
+       class Driver {
+               //
+               // Assemblies references to be linked. Initialized with
+               // mscorlib.dll
+               //
+               private static ArrayList references;
+
+               // Lookup paths
+               private static ArrayList link_paths;
+
+               // jscript files
+               private static ArrayList files;
+                       
+               private static string first_source;
+
+               private static bool want_debugging_support = false;
+
+               private static string output_file;
+
+               private static Assembly [] assemblies = new Assembly [0];
+
+               private static bool StdLib;
+
+               private static void Usage ()
+               {
+                       Console.WriteLine ("Mono JScript compiler\n" +
+                                          "(C) 2003 - 2004 Cesar Lopez Nataren\n" +
+                                          "(C) 2004 - 2005 Novell Inc (http://novell.com)\n\n" +
+                                          "mjs [options] source-file\n" +
+                                          "   /about              About the Mono JScript compiler\n" +
+                                          "   /lib:PATH1,PATH2    Adds the paths to the assembly link path\n" +
+                                          "   /r[eference]:ASS    Reference the specified assembly\n");
+               }
+
+               private static void About ()
+               {
+                       Console.WriteLine (
+                                          "The Mono JScript compiler is:\n" +
+                                          "(C) 2003 - 2004 Cesar Lopez Nataren\n" +
+                                          "(C) 2004 - 2005 Novell Inc.\n\n" +
+                                          "The compiler source code is released under the terms of both the MIT X11 and MPL\n" +
+                                          "The compiler was written by Cesar Lopez Nataren");
                        Environment.Exit (0);
                }
 
-               VsaEngine engine = new VsaEngine ();
-               engine.InitVsaEngine ("mjs:com.mono-project", new MonoEngineSite ());
+               /// <summary>
+               ///   Loads all assemblies referenced on the command line
+               /// </summary>
+               private static void LoadReferences ()
+               {
+                       foreach (string r in references)
+                               LoadAssembly (r, false);
+                       return;
+               }
+
+               private static void LoadAssembly (string assembly, bool soft)
+               {
+                       Assembly a;
+                       string total_log = "";
+
+                       try {
+                               char [] path_chars = { '/', '\\' };
+
+                               if (assembly.IndexOfAny (path_chars) != -1) {
+                                       a = Assembly.LoadFrom (assembly);
+                               } else {
+                                       string ass = assembly;
+                                       if (ass.EndsWith (".dll") || ass.EndsWith (".exe"))
+                                               ass = assembly.Substring (0, assembly.Length - 4);
+                                       a = Assembly.Load (ass);
+                               }
+                               AddAssembly (a);
+
+                       } catch (FileNotFoundException){
+                               foreach (string dir in link_paths){
+                                       string full_path = Path.Combine (dir, assembly);
+                                       if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe"))
+                                               full_path += ".dll";
+
+                                       try {
+                                               a = Assembly.LoadFrom (full_path);
+                                               AddAssembly (a);
+                                               return;
+                                       } catch (FileNotFoundException ff) {
+                                               total_log += ff.FusionLog;
+                                               continue;
+                                       }
+                               }
+                               if (!soft)
+                                       Console.WriteLine ("Cannot find assembly `" + assembly + "'" );
+                       } catch (BadImageFormatException f) {
+                               Console.WriteLine ("Cannot load assembly (bad file format)" + f.FusionLog);
+                       } catch (FileLoadException f){
+                               Console.WriteLine ("Cannot load assembly " + f.FusionLog);
+                       } catch (ArgumentNullException){
+                               Console.WriteLine ("Cannot load assembly (null argument)");
+                       }
+               }       
+
+               /// <summary>
+               ///   Registers an assembly to load types from.
+               /// </summary>
+               private static void AddAssembly (Assembly a)
+               {
+                       foreach (Assembly assembly in assemblies) {
+                               if (a == assembly)
+                                       return;
+                       }
+
+                       int top = assemblies.Length;
+                       Assembly [] n = new Assembly [top + 1];
+
+                       assemblies.CopyTo (n, 0);
+               
+                       n [top] = a;
+                       assemblies = n;
+               }
+
+               static string [] LoadArgs (string file)
+               {
+                       StreamReader f;
+                       ArrayList args = new ArrayList ();
+                       string line;
+                       try {
+                               f = new StreamReader (file);
+                       } catch {
+                               return null;
+                       }
+
+                       StringBuilder sb = new StringBuilder ();
+                       
+                       while ((line = f.ReadLine ()) != null){
+                               int t = line.Length;
+
+                               for (int i = 0; i < t; i++){
+                                       char c = line [i];
+                                       
+                                       if (c == '"' || c == '\''){
+                                               char end = c;
+                                               
+                                               for (i++; i < t; i++){
+                                                       c = line [i];
+
+                                                       if (c == end)
+                                                               break;
+                                                       sb.Append (c);
+                                               }
+                                       } else if (c == ' '){
+                                               if (sb.Length > 0){
+                                                       args.Add (sb.ToString ());
+                                                       sb.Length = 0;
+                                               }
+                                       } else
+                                               sb.Append (c);
+                               }
+                               if (sb.Length > 0){
+                                       args.Add (sb.ToString ());
+                                       sb.Length = 0;
+                               }
+                       }
+
+                       string [] ret_value = new string [args.Count];
+                       args.CopyTo (ret_value, 0);
+
+                       return ret_value;
+               }       
+
+               //
+               // Returns the directory where the system assemblies are installed
+               //
+               static string GetSystemDir ()
+               {
+                       return Path.GetDirectoryName (typeof (object).Assembly.Location);
 
-               foreach (string fn in args) {
-                       IVsaCodeItem item = (IVsaCodeItem) engine.Items.CreateItem (fn, VsaItemType.Code, VsaItemFlag.None);
-                       item.SourceText = GetCodeFromFile (fn);
                }
-               engine.Compile ();
-       }
 
-       static string GetCodeFromFile (string fn)
-       {
-               try {
-                       StreamReader reader = new StreamReader (fn);
-                       return reader.ReadToEnd ();
-               } catch (FileNotFoundException) {
-                       throw new JScriptException (JSError.FileNotFound);
-               } catch (ArgumentNullException) {
-                       throw new JScriptException (JSError.FileNotFound);
-               } catch (ArgumentException) {
-                       throw new JScriptException (JSError.FileNotFound);
-               } catch (IOException) {
-                       throw new JScriptException (JSError.NoError);
-               } catch (OutOfMemoryException) {
-                       throw new JScriptException (JSError.OutOfMemory);
+               static void SetOutputFile (string name)
+               {
+                       output_file = name;
                }
-       }
-}
 
-class MonoEngineSite : IVsaSite {
-       public void GetCompiledState (out byte [] pe, out byte [] debugInfo)
-       {
-               throw new NotImplementedException ();
-       }
+               static void Version ()
+               {
+                       string version = Assembly.GetExecutingAssembly ().GetName ().Version.ToString ();
+                       Console.WriteLine ("Mono JScript compiler version {0}", version);
+                       Environment.Exit (0);
+               }
+       
+               static bool UnixParseOption (string arg, ref string [] args, ref int i)
+               {
+                       switch (arg){
+                       case "--version":
+                               Version ();
+                               return true;
+                               
+                       case "/?": case "/h": case "/help":
+                       case "--help":
+                               Usage ();
+                               Environment.Exit (0);
+                               return true;
+                       case "-o": 
+                       case "--output":
+                               if ((i + 1) >= args.Length){
+                                       Usage ();
+                                       Environment.Exit (1);
+                               }
+                               SetOutputFile (args [++i]);
+                               return true;
+                       case "-r":
+                               if ((i + 1) >= args.Length){
+                                       Usage ();
+                                       Environment.Exit (1);
+                               }
+                               
+                               references.Add (args [++i]);
+                               return true;
+                               
+                       case "-L":
+                               if ((i + 1) >= args.Length){
+                                       Usage ();       
+                                       Environment.Exit (1);
+                               }
+                               link_paths.Add (args [++i]);
+                               return true;
+                               
+                       case "--about":
+                               About ();
+                               return true;
+                       }
+                       return false;
+               }
 
-       public object GetEventSourceInstance (string itemName, string eventSourceName)
-       {
-               throw new NotImplementedException ();
-       }
+               //
+               // This parses the -arg and /arg options to the compiler, even if the strings
+               // in the following text use "/arg" on the strings.
+               //
+               static bool CSCParseOption (string option, ref string [] args, ref int i)
+               {
+                       int idx = option.IndexOf (':');
+                       string arg, value;
+                       if (idx == -1){
+                               arg = option;
+                               value = "";
+                       } else {
+                               arg = option.Substring (0, idx);
 
-       public object GetGlobalInstance (string name)
-       {
-               throw new NotImplementedException ();
-       }
+                               value = option.Substring (idx + 1);
+                       }
+
+                       switch (arg){
+                       case "/nologo":
+                               return true;
+
+                       case "/out":
+                               if (value == ""){
+                                       Usage ();
+                                       Environment.Exit (1);
+                               }
+                               SetOutputFile (value);
+                               return true;
+
+                       case "/r":
+                       case "/reference": {
+                               if (value == ""){
+                                       Console.WriteLine ("/reference requires an argument");
+                                       Environment.Exit (1);
+                               }
+
+                               string [] refs = value.Split (new char [] { ';', ',' });
+                               foreach (string r in refs){
+                                       references.Add (r);
+                               }
+                               return true;
+                       }
+
+                       case "/lib": {
+                               string [] libdirs;
+                               
+                               if (value == ""){
+                                       Console.WriteLine ("/lib requires an argument");
+                                       Environment.Exit (1);
+                               }
+
+                               libdirs = value.Split (new Char [] { ',' });
+                               foreach (string dir in libdirs)
+                                       link_paths.Add (dir);
+                               return true;
+                       }
+                       }
+                       return false;
+               }
+       
+               static string [] AddArgs (string [] args, string [] extra_args)
+               {
+                       string [] new_args;
+                       new_args = new string [extra_args.Length + args.Length];
+
+                       // if args contains '--' we have to take that into account
+                       // split args into first half and second half based on '--'
+                       // and add the extra_args before --
+                       int split_position = Array.IndexOf (args, "--");
+                       if (split_position != -1)
+                               {
+                                       Array.Copy (args, new_args, split_position);
+                                       extra_args.CopyTo (new_args, split_position);
+                                       Array.Copy (args, split_position, new_args, split_position + extra_args.Length, args.Length - split_position);
+                               }
+                       else
+                               {
+                                       args.CopyTo (new_args, 0);
+                                       extra_args.CopyTo (new_args, args.Length);
+                               }
 
-       public void Notify (string notify, object info)
-       {
-               throw new NotImplementedException ();
+                       return new_args;
+               }
+
+               //
+               // Given a path specification, splits the path from the file/pattern
+               //
+               static void SplitPathAndPattern (string spec, out string path, out string pattern)
+               {
+                       int p = spec.LastIndexOf ('/');
+                       if (p != -1){
+                               //
+                               // Windows does not like /file.cs, switch that to:
+                               // "\", "file.cs"
+                               //
+                               if (p == 0){
+                                       path = "\\";
+                                       pattern = spec.Substring (1);
+                               } else {
+                                       path = spec.Substring (0, p);
+                                       pattern = spec.Substring (p + 1);
+                               }
+                               return;
+                       }
+
+                       p = spec.LastIndexOf ('\\');
+                       if (p != -1){
+                               path = spec.Substring (0, p);
+                               pattern = spec.Substring (p + 1);
+                               return;
+                       }
+
+                       path = ".";
+                       pattern = spec;
+               }
+
+               static void ProcessFile (string f)
+               {
+                       if (first_source == null)
+                               first_source = f;
+
+                       files.Add (f);
+               }
+
+               static void CompileFiles (string spec, bool recurse)
+               {
+                       string path, pattern;
+
+                       SplitPathAndPattern (spec, out path, out pattern);
+                       if (pattern.IndexOf ('*') == -1){
+                               ProcessFile (spec);
+                               return;
+                       }
+
+                       string [] files = null;
+                       try {
+                               files = Directory.GetFiles (path, pattern);
+                       } catch (System.IO.DirectoryNotFoundException) {
+                               Console.WriteLine ("Source file `" + spec + "' could not be found");
+                               return;
+                       } catch (System.IO.IOException){
+                               Console.WriteLine ("Source file `" + spec + "' could not be found");
+                               return;
+                       }
+                       foreach (string f in files)
+                               ProcessFile (f);
+
+                       if (!recurse)
+                               return;
+                       
+                       string [] dirs = null;
+
+                       try {
+                               dirs = Directory.GetDirectories (path);
+                       } catch {
+                       }
+                       
+                       foreach (string d in dirs) {
+                                       
+                               // Don't include path in this string, as each
+                               // directory entry already does
+                               CompileFiles (d + "/" + pattern, true);
+                       }
+               }
+
+               internal static bool MainDriver (string [] args)
+               {
+                       int i;
+                       bool parsing_options = true;
+
+                       references = new ArrayList ();
+                       link_paths = new ArrayList ();
+                       files = new ArrayList ();
+
+                       Hashtable response_file_list = null;
+
+                       for (i = 0; i < args.Length; i++){
+                               string arg = args [i];
+                               if (arg == "")
+                                       continue;
+                               
+                               if (arg.StartsWith ("@")){
+                                       string [] extra_args;
+                                       string response_file = arg.Substring (1);
+
+                                       if (response_file_list == null)
+                                               response_file_list = new Hashtable ();
+                                       
+                                       if (response_file_list.Contains (response_file)){
+                                               Console.WriteLine ("Response file `" + response_file + "' specified multiple times");
+                                               Environment.Exit (1);
+                                       }
+                                       
+                                       response_file_list.Add (response_file, response_file);
+                                                   
+                                       extra_args = LoadArgs (response_file);
+                                       if (extra_args == null){
+                                               Console.WriteLine ("Unable to open response file: " + response_file);
+                                               return false;
+                                       }
+
+                                       args = AddArgs (args, extra_args);
+                                       continue;
+                               }
+
+                               if (parsing_options){
+                                       if (arg == "--"){
+                                               parsing_options = false;
+                                               continue;
+                                       }
+                                       
+                                       if (arg.StartsWith ("-")){
+                                               if (UnixParseOption (arg, ref args, ref i))
+                                                       continue;
+
+                                               // Try a -CSCOPTION
+                                               string csc_opt = "/" + arg.Substring (1);
+                                               if (CSCParseOption (csc_opt, ref args, ref i))
+                                                       continue;
+                                       } else {
+                                               if (arg.StartsWith ("/")){
+                                                       if (CSCParseOption (arg, ref args, ref i))
+                                                               continue;
+                                               }
+                                       }
+                               }
+                               CompileFiles (arg, false); 
+                       }
+
+                       //
+                       // If there is nothing to put in the assembly, and we are not a library
+                       //
+                       if (first_source == null) /* && embedded_resources == null && resources == null) */ {
+                               Console.WriteLine ("fatal error JS2026: No input sources specified");
+                               return false;
+                       }
+
+                       //
+                       // Load Core Library for default compilation
+                       //
+                       if (StdLib)
+                               references.Insert (0, "mscorlib");
+
+
+                       //
+                       // Load assemblies required
+                       //
+                       link_paths.Add (GetSystemDir ());
+                       link_paths.Add (Directory.GetCurrentDirectory ());
+                       LoadReferences ();
+                       return true;
+               }
+       
+               //
+               // Entry point
+               //
+               private static void Main (string [] args) {
+       
+                       if (args.Length < 1) {
+                               Usage ();
+                               Environment.Exit (0);
+                       }                       
+                       MainDriver (args);
+                       VsaEngine engine = new VsaEngine ();
+                       engine.InitVsaEngine ("mjs:com.mono-project", new MonoEngineSite ());
+                       
+                       foreach (string asm in references) {
+                               IVsaReferenceItem item = (IVsaReferenceItem) engine.Items.CreateItem (asm, VsaItemType.Reference, VsaItemFlag.None);
+                               item.AssemblyName = asm;
+                       }
+
+                       string asm_name = String.Empty;
+                       
+                       foreach (Assembly assembly in assemblies) {
+                               asm_name = assembly.GetName ().FullName;
+                               IVsaReferenceItem item = (IVsaReferenceItem) engine.Items.CreateItem (asm_name, VsaItemType.Reference, VsaItemFlag.None);
+                               item.AssemblyName = asm_name;
+                       }
+
+                       foreach (string file in files) {
+                               IVsaCodeItem item = (IVsaCodeItem) engine.Items.CreateItem (file, VsaItemType.Code, VsaItemFlag.None);
+                               item.SourceText = GetCodeFromFile (file);
+                       }
+                       engine.SetOption ("debug", want_debugging_support);
+                       engine.SetOption ("link_path", link_paths);
+                       engine.SetOption ("first_source", first_source);
+                       engine.SetOption ("assemblies", assemblies);
+                       engine.Compile ();
+               }
+
+               static string GetCodeFromFile (string fn)
+               {
+                       try {
+                               StreamReader reader = new StreamReader (fn);
+                               return reader.ReadToEnd ();
+                       } catch (FileNotFoundException) {
+                               throw new JScriptException (JSError.FileNotFound);
+                       } catch (ArgumentNullException) {
+                               throw new JScriptException (JSError.FileNotFound);
+                       } catch (ArgumentException) {
+                               throw new JScriptException (JSError.FileNotFound);
+                       } catch (IOException) {
+                               throw new JScriptException (JSError.NoError);
+                       } catch (OutOfMemoryException) {
+                               throw new JScriptException (JSError.OutOfMemory);
+                       }
+               }
        }
 
-       public bool OnCompilerError (IVsaError error)
-       {
-               throw new NotImplementedException ();
+       class MonoEngineSite : IVsaSite {
+               public void GetCompiledState (out byte [] pe, out byte [] debugInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public object GetEventSourceInstance (string itemName, string eventSourceName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public object GetGlobalInstance (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Notify (string notify, object info)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool OnCompilerError (IVsaError error)
+               {
+                       throw new NotImplementedException ();
+               }
        }
 }
index 8c203f8357f7c72cd136ba938ee531f4fe905ac2..ce43be2001f10751e71b976e7379b9a4c9dfefef 100644 (file)
@@ -1,3 +1,18 @@
+2005-09-07  Jonathan Pryor  <jonpryor@vt.edu>
+
+       * mono-shlib-cop.cs: Use Assembly.LoadWithPartialName instead of
+         Assembly.Load(AssemblyName) for loading -r: assemblies, since this
+         actually works (though it's also deprecated in .NET 2.0, with no
+         replacement).  If the first LoadWithPartialName fails, try again after
+         removing any .dll extension (since the .dll isn't part of the assembly
+         name, but I often specify it anyway).
+
+2005-09-07  Jonathan Pryor  <jonpryor@vt.edu>
+
+       * mono-shlib-cop.cs: Patch from John Luke to fix use of Path.Combine (don't
+         want to use an `/'-prefixed path as the 2nd parameter) and improve XML
+         node selection.
+
 2005-07-18  Jonathan Pryor  <jonpryor@vt.edu>
 
        * mono-shlib-cop.exe.config: .config file to help with testing.
index 1d1e3a12c544def12dc78e601d79db77b2a68718..87fc670a5f1c3fac0defa00bd85e502adaf215c5 100644 (file)
@@ -187,25 +187,24 @@ namespace Mono.Unmanaged.Check {
                        mono_configs = new XmlDocument [prefixes.Length];
                        for (int i = 0; i < mono_configs.Length; ++i) {
                                mono_configs [i] = new XmlDocument ();
-                               mono_configs [i].Load (Path.Combine (prefixes [i], "/etc/mono/config"));
+                               mono_configs [i].Load (Path.Combine (prefixes [i], "etc/mono/config"));
                        }
                }
 
                public string GetDllmapEntry (string assemblyPath, string library)
                {
-                       string xpath = "//dllmap[@dll=\"" + library + "\"]";
+                       string xpath = "/configuration/dllmap[@dll=\"" + library + "\"]";
 
                        XmlDocument d = GetAssemblyConfig (assemblyPath);
                        if (d != null) {
-                               XmlNodeList maps = d.SelectNodes (xpath);
-                               if (maps.Count > 0)
-                                       return maps [0].Attributes ["target"].Value;
+                               XmlNode map = d.SelectSingleNode (xpath);
+                               if (map != null)
+                                       return map.Attributes ["target"].Value;
                        }
                        foreach (XmlDocument config in mono_configs) {
-                               XmlNodeList maps = config.SelectNodes (xpath);
-                               Trace.WriteLine (string.Format ("{0} <dllmap/> entries found!", maps.Count));
-                               if (maps.Count > 0)
-                                       return maps [0].Attributes ["target"].Value;
+                               XmlNode map = config.SelectSingleNode (xpath);
+                               if (map != null)
+                                       return map.Attributes ["target"].Value;
                        }
                        return null;
                }
@@ -243,16 +242,25 @@ namespace Mono.Unmanaged.Check {
 
                public void CheckWithPartialName (string partial, AssemblyCheckInfo report)
                {
-                       AssemblyName an = new AssemblyName ();
-                       an.Name = partial;
-                       try {
-                               Assembly a = Assembly.Load (an);
-                               Check (a, report);
-                       }
-                       catch (FileNotFoundException e) {
+                       string p = partial;
+                       Assembly a;
+                       bool retry;
+
+                       do {
+                               a = Assembly.LoadWithPartialName (p);
+                               retry = p.EndsWith (".dll");
+                               if (retry) {
+                                       p = p.Substring (0, p.Length-4);
+                               }
+                       } while (a == null && retry);
+
+                       if (a == null) {
                                report.Errors.Add (new MessageInfo (null, null, 
-                                       "Could not load assembly reference `" + partial + "': " + e.Message));
+                                       "Could not load assembly reference `" + partial + "'."));
+                               return;
                        }
+
+                       Check (a, report);
                }
 
                private void Check (Assembly a, AssemblyCheckInfo report)
index cfea4c0e9fed0c53686edae94de78f6627d1d336..fc91d4594b925fd80b4a25809c0e2ebd524295aa 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-05  Michal Moskal  <malekith@nemerle.org>
+       
+       * outline.cs: Use new names of the GenericParameterAttributes enum.
+
 2005-08-19  Ben Maurer  <bmaurer@novell.com>
 
        * outline.cs:
index 63c08b7e3786f98fd462a47c786ace7433c4d1a0..291fd239b15f5574bb1391adb082e11a970ae46b 100644 (file)
@@ -700,7 +700,7 @@ public class Outline {
                        GenericParameterAttributes attrs = t.GenericParameterAttributes & GenericParameterAttributes.SpecialConstraintMask;
                        GenericParameterAttributes [] interesting = {
                                GenericParameterAttributes.ReferenceTypeConstraint,
-                               GenericParameterAttributes.ValueTypeConstraint,
+                               GenericParameterAttributes.NotNullableValueTypeConstraint,
                                GenericParameterAttributes.DefaultConstructorConstraint
                        };
                        
@@ -735,7 +735,7 @@ public class Outline {
                                case GenericParameterAttributes.ReferenceTypeConstraint:
                                        o.Write ("class");
                                        break;
-                               case GenericParameterAttributes.ValueTypeConstraint:
+                               case GenericParameterAttributes.NotNullableValueTypeConstraint:
                                        o.Write ("struct");
                                        break;
                                case GenericParameterAttributes.DefaultConstructorConstraint:
index d57218ee7cf3c0372544f237faec674ee02a296e..938d8b4801303e78e29b513eb46143ef8c257041 100644 (file)
@@ -150,9 +150,9 @@ namespace Mono.Tools.CertView {
                        try {
                                // preprocess some informations
                                foreach (X509Extension xe in x509.Extensions) {
-                                       if ((!extensions.ContainsKey (xe.OID)) && (xe.Critical))
+                                       if ((!extensions.ContainsKey (xe.Oid)) && (xe.Critical))
                                                status = unknownCriticalExtension;
-                                       if (xe.OID == "2.5.29.17") {
+                                       if (xe.Oid == "2.5.29.17") {
                                                SubjectAltNameExtension san = new SubjectAltNameExtension (xe);
                                                subjectAltName = san.RFC822;
                                        }
@@ -179,7 +179,7 @@ namespace Mono.Tools.CertView {
                {
                        X509Extension xe = x509.Extensions [i];
                        object[] extn = new object [1] { xe };
-                       return CreateExtensionFromOid (xe.OID, extn); 
+                       return CreateExtensionFromOid (xe.Oid, extn); 
                }
 
                public string Extension (int i, bool detailed) 
index 98edf189513ee66308742a6d3bf4d4b2a4730a38..764006d8e37990b825983d9b892a9a56e16b42d9 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-05  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * certview.glade: Removed filenames for bitmaps.
+       * gcertview.cs: Fix compilation. Use resources not files for UI stuff.
+       * CertificateFormatter.cs: Fix compilation.
+       * Makefile: Build Gtk# version using resources. Minor fixes.
+       * TODO: All future development will occur in mono-tools.
+
 2004-03-21  Sebastien Pouliot  <sebastien@ximian.com>
 
        * ChangeLog: commited missing ChangeLog entries.
index 7e411b00d1e813d4adf97cdfa6acf3b32c2f3b42..377d396f01544b966efe696ca173a29e879d9f05 100644 (file)
@@ -2,7 +2,7 @@ thisdir = tools/security/certview
 SUBDIRS = 
 include ../../../build/rules.make
 
-RESGEN = monoresgen
+RESGEN = resgen
 LOCAL_MCS_FLAGS = /lib:$(topdir)/class/lib /r:Mono.Security.dll /r:System.Xml.dll /win32icon:mono.ico
 
 # SWF isn't quite good enough to build this yet.
@@ -20,30 +20,34 @@ test-local run-test-local:
 
 DISTFILES = \
        CertificateViewer.cs            \
-       CertificateFormatter.cs         \
+       CertificateFormatter.cs                 \
        X509ExtensionsHandler.cs        \
        certview.exe.config             \
        certview.glade                  \
        certview.gladep                 \
        gcertview.cs                    \
        gcertview.exe.config            \
-       mono.ico                        \
-       $(wildcard *.bmp)               \
+       mono.ico                                \
+       $(resources)
+
+resources = $(wildcard *.bmp)          \
        $(wildcard *.png)
 
 dist-local: dist-default
 
-sources = CertificateViewer.cs CertificateFormatter.cs X509ExtensionsHandler.cs ../AssemblyInfo.cs
+sources = CertificateViewer.cs CertificateFormatter.cs X509ExtensionsHandler.cs ../AssemblyInfo.cs ../../../build/common/Consts.cs
 cv_libs = /r:System.Windows.Forms.dll /r:System.Drawing.dll
-gcv_libs = /r:gdk-sharp.dll /r:glib-sharp.dll /r:glade-sharp.dll /r:gtk-sharp.dll
+gcv_libs = -pkg:gtk-sharp -pkg:glade-sharp
 
 certview.exe: $(sources) Mono.Tools.CertView.CertificateViewer.resources
-       $(CSCOMPILE) $(cv_libs) /res:Mono.Tools.CertView.CertificateViewer.resources $(sources)
+       $(CSCOMPILE) $(cv_libs) -resource:Mono.Tools.CertView.CertificateViewer.resources $(sources)
 
 # We can't make this by default since it relies on GTK#
 
-gcertview.exe: gcertview.cs CertificateFormatter.cs X509ExtensionsHandler.cs ../AssemblyInfo.cs
-       $(CSCOMPILE) $(gcv_libs) /unsafe $^
+ress= $(foreach res,$(resources), $(addprefix -resource:,$(res)),$(notdir $(res)))
+
+gcertview.exe: gcertview.cs CertificateFormatter.cs X509ExtensionsHandler.cs ../AssemblyInfo.cs ../../../build/common/Consts.cs
+       $(CSCOMPILE) $(gcv_libs) $^ -resource:certview.glade $(ress)
 
 Mono.Tools.CertView.CertificateViewer.resources: CertificateViewer.resx
        $(RESGEN) $^ $@
index 85d52b886bc15000050855faed9e2fa4308926aa..b4c288981142b12ebe2f984993bafe5433cddaf5 100644 (file)
@@ -1,22 +1 @@
-Mono X.509 GUI tools
-
-1.     Certificate Viewer
-
-Support both (Gtk# and SWF)
-
-TODO
-- Add support for X509Chain
-- Add support for X509Stores
-
-
-2.     CRL Viewer
-
-TODO
-
-
-3.     Certificate Manager
-
-TODO
-- Manage certificate stores
-- Reuse certificate viewer
-- Reuse CRL viewer
+All future development will occur in mono-tools.
index 3d2f789fbda6f680ea1e5454c51893205bebab58..4914dd37805c8f3a251fbe8efc4254d046662f89 100644 (file)
@@ -2,6 +2,7 @@
 <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
 
 <glade-interface>
+<requires lib="gnome"/>
 
 <widget class="GtkWindow" id="CertificateViewer">
   <property name="visible">True</property>
   <property name="modal">False</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
   <signal name="delete_event" handler="OnWindowDeleteEvent" last_modification_time="Wed, 30 Apr 2003 02:22:24 GMT"/>
 
   <child>
@@ -52,7 +59,6 @@
                      <child>
                        <widget class="GtkImage" id="brokenSealImage">
                          <property name="visible">True</property>
-                         <property name="pixbuf">wax-seal-broken.png</property>
                          <property name="xalign">0.5</property>
                          <property name="yalign">0.5</property>
                          <property name="xpad">0</property>
@@ -68,7 +74,6 @@
                      <child>
                        <widget class="GtkImage" id="sealImage">
                          <property name="visible">True</property>
-                         <property name="pixbuf">wax-seal.png</property>
                          <property name="xalign">0.5</property>
                          <property name="yalign">0.5</property>
                          <property name="xpad">0</property>
                          <property name="yalign">0.5</property>
                          <property name="xpad">0</property>
                          <property name="ypad">0</property>
+                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                         <property name="width_chars">-1</property>
+                         <property name="single_line_mode">False</property>
+                         <property name="angle">0</property>
                        </widget>
                        <packing>
                          <property name="padding">0</property>
                          <property name="visible">True</property>
                          <property name="can_focus">True</property>
                          <property name="editable">False</property>
+                         <property name="overwrite">False</property>
+                         <property name="accepts_tab">True</property>
                          <property name="justification">GTK_JUSTIFY_LEFT</property>
                          <property name="wrap_mode">GTK_WRAP_WORD</property>
                          <property name="cursor_visible">True</property>
                              <property name="yalign">0.5</property>
                              <property name="xpad">0</property>
                              <property name="ypad">0</property>
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
                            </widget>
                            <packing>
                              <property name="left_attach">0</property>
                                  <property name="max_length">0</property>
                                  <property name="text" translatable="yes"></property>
                                  <property name="has_frame">False</property>
-                                 <property name="invisible_char" translatable="yes">*</property>
+                                 <property name="invisible_char">*</property>
                                  <property name="activates_default">False</property>
                                </widget>
                                <packing>
                                  <property name="yalign">0.5</property>
                                  <property name="xpad">0</property>
                                  <property name="ypad">0</property>
+                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
                                </widget>
                                <packing>
                                  <property name="padding">0</property>
                                  <property name="max_length">0</property>
                                  <property name="text" translatable="yes"></property>
                                  <property name="has_frame">False</property>
-                                 <property name="invisible_char" translatable="yes">*</property>
+                                 <property name="invisible_char">*</property>
                                  <property name="activates_default">False</property>
                                </widget>
                                <packing>
                              <property name="yalign">0.5</property>
                              <property name="xpad">0</property>
                              <property name="ypad">0</property>
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
                            </widget>
                            <packing>
                              <property name="left_attach">0</property>
                              <property name="yalign">0.5</property>
                              <property name="xpad">0</property>
                              <property name="ypad">0</property>
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
                            </widget>
                            <packing>
                              <property name="left_attach">0</property>
                              <property name="max_length">0</property>
                              <property name="text" translatable="yes"></property>
                              <property name="has_frame">False</property>
-                             <property name="invisible_char" translatable="yes">*</property>
+                             <property name="invisible_char">*</property>
                              <property name="activates_default">False</property>
                            </widget>
                            <packing>
                              <property name="yalign">0.5</property>
                              <property name="xpad">0</property>
                              <property name="ypad">0</property>
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
                            </widget>
                            <packing>
                              <property name="left_attach">1</property>
                              <property name="max_length">0</property>
                              <property name="text" translatable="yes"></property>
                              <property name="has_frame">False</property>
-                             <property name="invisible_char" translatable="yes">*</property>
+                             <property name="invisible_char">*</property>
                              <property name="activates_default">False</property>
                            </widget>
                            <packing>
                              <property name="yalign">0.5</property>
                              <property name="xpad">0</property>
                              <property name="ypad">0</property>
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
                            </widget>
                            <packing>
                              <property name="left_attach">1</property>
                      <property name="sensitive">False</property>
                      <property name="can_focus">True</property>
                      <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
                      <signal name="clicked" handler="OnIssuerStatementButtonClicked" last_modification_time="Wed, 30 Apr 2003 02:23:07 GMT"/>
 
                      <child>
                          <property name="yalign">0.5</property>
                          <property name="xscale">0</property>
                          <property name="yscale">0</property>
+                         <property name="top_padding">0</property>
+                         <property name="bottom_padding">0</property>
+                         <property name="left_padding">0</property>
+                         <property name="right_padding">0</property>
 
                          <child>
                            <widget class="GtkHBox" id="hbox4">
                                  <property name="yalign">0.5</property>
                                  <property name="xpad">0</property>
                                  <property name="ypad">0</property>
+                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
                                </widget>
                                <packing>
                                  <property name="padding">0</property>
                      <property name="yalign">0.5</property>
                      <property name="xpad">0</property>
                      <property name="ypad">0</property>
+                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                     <property name="width_chars">-1</property>
+                     <property name="single_line_mode">False</property>
+                     <property name="angle">0</property>
                    </widget>
                    <packing>
                      <property name="padding">5</property>
              <property name="yalign">0.5</property>
              <property name="xpad">0</property>
              <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
            </widget>
            <packing>
              <property name="type">tab</property>
                      <property name="yalign">0.5</property>
                      <property name="xpad">0</property>
                      <property name="ypad">0</property>
+                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                     <property name="width_chars">-1</property>
+                     <property name="single_line_mode">False</property>
+                     <property name="angle">0</property>
                    </widget>
                    <packing>
                      <property name="padding">1</property>
                          <property name="max_length">0</property>
                          <property name="text" translatable="yes"></property>
                          <property name="has_frame">True</property>
-                         <property name="invisible_char" translatable="yes">*</property>
+                         <property name="invisible_char">*</property>
                          <property name="activates_default">False</property>
                          <signal name="changed" handler="OnShowComboChanged" last_modification_time="Sat, 03 May 2003 17:48:19 GMT"/>
                        </widget>
                          <property name="rules_hint">False</property>
                          <property name="reorderable">False</property>
                          <property name="enable_search">False</property>
+                         <property name="fixed_height_mode">False</property>
+                         <property name="hover_selection">False</property>
+                         <property name="hover_expand">False</property>
                          <signal name="cursor_changed" handler="OnCursorChanged" last_modification_time="Sat, 03 May 2003 01:02:31 GMT"/>
                        </widget>
                      </child>
                          <property name="visible">True</property>
                          <property name="can_focus">True</property>
                          <property name="editable">False</property>
+                         <property name="overwrite">False</property>
+                         <property name="accepts_tab">True</property>
                          <property name="justification">GTK_JUSTIFY_LEFT</property>
                          <property name="wrap_mode">GTK_WRAP_WORD</property>
                          <property name="cursor_visible">True</property>
              <property name="yalign">0.5</property>
              <property name="xpad">0</property>
              <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
            </widget>
            <packing>
              <property name="type">tab</property>
                      <property name="rules_hint">False</property>
                      <property name="reorderable">False</property>
                      <property name="enable_search">False</property>
+                     <property name="fixed_height_mode">False</property>
+                     <property name="hover_selection">False</property>
+                     <property name="hover_expand">False</property>
                    </widget>
                  </child>
                </widget>
                      <property name="xpad">0</property>
                      <property name="ypad">0</property>
                      <property name="mnemonic_widget">certStatusTextview</property>
+                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                     <property name="width_chars">-1</property>
+                     <property name="single_line_mode">False</property>
+                     <property name="angle">0</property>
                    </widget>
                    <packing>
                      <property name="padding">0</property>
                          <property name="visible">True</property>
                          <property name="can_focus">True</property>
                          <property name="editable">False</property>
+                         <property name="overwrite">False</property>
+                         <property name="accepts_tab">True</property>
                          <property name="justification">GTK_JUSTIFY_LEFT</property>
                          <property name="wrap_mode">GTK_WRAP_WORD</property>
                          <property name="cursor_visible">True</property>
              <property name="yalign">0.5</property>
              <property name="xpad">0</property>
              <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
            </widget>
            <packing>
              <property name="type">tab</property>
              <property name="label">gtk-ok</property>
              <property name="use_stock">True</property>
              <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
              <signal name="clicked" handler="OnOkButtonClicked" last_modification_time="Thu, 01 May 2003 19:52:34 GMT"/>
            </widget>
            <packing>
index 67c1ef50f1214ee7efad6d385f58839068b759bf..7abeecb654f13f5008dd10022c141a7d4bc67612 100644 (file)
@@ -84,12 +84,15 @@ namespace Mono.Tools.CertView {
                {
                        Application.Init();
 
-                       Glade.XML gxml = new Glade.XML ("certview.glade", "CertificateViewer", null);
+                       Glade.XML gxml = new Glade.XML (null, "certview.glade", "CertificateViewer", null);
                        gxml.Autoconnect (this);
 
                        cf = new CertificateFormatter (filename);
 
                        // init UI
+                       brokenSealImage.Pixbuf = new Pixbuf (null, "wax-seal-broken.png");
+                       sealImage.Pixbuf = new Pixbuf (null, "wax-seal.png");
+
                        Tooltips tt = new Tooltips ();
                        issuedToEntry.Text = cf.Issuer (false);
                        tt.SetTip (issuedToEntry, issuedToEntry.Text, issuedToEntry.Text);
@@ -138,7 +141,7 @@ namespace Mono.Tools.CertView {
                                        icon = 3;
                                string exts = xe.ToString ();
                                string details;
-                               if (xe.Name == xe.OID) {
+                               if (xe.Name == xe.Oid) {
                                        exts = cf.Extension (i, false);
                                        details = cf.Extension (i, true);
                                }
@@ -190,11 +193,11 @@ namespace Mono.Tools.CertView {
                                if (dataFunc == null) {
                                        dataFunc = new TreeCellDataFunc (SetCellData);
                                        version = new Pixbuf [5];
-                                       version [0] = new Pixbuf ("v1.bmp");
-                                       version [1] = new Pixbuf ("v2.bmp");
-                                       version [2] = new Pixbuf ("v3.bmp");
-                                       version [3] = new Pixbuf ("v3critical.bmp");
-                                       version [4] = new Pixbuf ("mono.bmp");
+                                       version [0] = new Pixbuf (null, "v1.bmp");
+                                       version [1] = new Pixbuf (null, "v2.bmp");
+                                       version [2] = new Pixbuf (null, "v3.bmp");
+                                       version [3] = new Pixbuf (null, "v3critical.bmp");
+                                       version [4] = new Pixbuf (null, "mono.bmp");
                                }
 
                                return dataFunc;
index 60894065dd14fad158af851c3d4360cdecb59ca6..e9810bae5f132e880879c63f20a4a985ac443900 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-08  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * soapsuds.cs: passing just file name would be better than full
+         assembly name.
+
 2004-03-25  Lluis Sanchez Gual  <lluis@ximian.com>
 
        * soapsuds.cs: Execute the tool from a new domain that has the current
index f3cdd434e9888b6787bad103e57d855b1b34369e..11f11d9ec37445c60b2c3ed74e6fcfaf66ebef2e 100644 (file)
@@ -77,7 +77,7 @@ class Runner
                        
                        if (inputAssembly != null)
                        {
-                               assembly = Assembly.Load (inputAssembly);
+                               assembly = Assembly.LoadFile (inputAssembly);
                                foreach (Type t in assembly.GetTypes ())
                                        types.Add (new ServiceType (t, serviceEndpoint));
                        }
diff --git a/mcs/tools/xbuild/AssemblyInfo.cs b/mcs/tools/xbuild/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..5e8a6fd
--- /dev/null
@@ -0,0 +1,32 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;  
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
diff --git a/mcs/tools/xbuild/ChangeLog b/mcs/tools/xbuild/ChangeLog
new file mode 100644 (file)
index 0000000..b23dc30
--- /dev/null
@@ -0,0 +1,41 @@
+2005-09-11  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * xbuild.exe.sources: Added Consts.cs from common build files.
+       * LoggerInfo.cs: Public key token update.
+       * Parameters.cs, Main.cs: Changed to use BinPath instead of hard-coded path.
+       * Makefile: Added installing of xbuild's files.
+       * Microsoft.Common.tasks: Moved from main directory and changed to use
+       assemblies from GAC.
+
+2005-09-09  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Main.cs: FxVersion.
+       * Makefile: Fixed Microsoft.Build.Utilities.dll name.
+
+2005-09-05  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Microsoft.Build.xsd, MSBuild/Microsoft.Build.Core.xsd,
+       Microsoft.Build.Commontypes.xsd: Added schema files.
+
+2005-08-30  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Main.cs, Parameters.cs: Added default target(s) handling.
+
+2005-08-29  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * LoggerInfo.cs: Removed AssemblyLoadInfo property, changed to inherit
+       AssemblyLoadInfo.
+       * XBuild.targets: Updated.
+       * Parameters.cs: Removed debugging info and removed line producing
+       errors.
+       * Main.cs: Added check if engine is null.
+
+2005-08-24  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Parameters.cs, Main.cs: Changed paths to absolute paths. They should be
+       separated to .in file probably when moving to autotools.
+
+2005-08-12  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * CommandLineException.cs, LoggerInfo.cs, Main.cs, Parameters.cs:
+       Added.
diff --git a/mcs/tools/xbuild/CommandLineException.cs b/mcs/tools/xbuild/CommandLineException.cs
new file mode 100644 (file)
index 0000000..039a688
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// CommandLineException.cs: Represents various exceptions thrown during parsing
+// command line parameters.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Mono.XBuild.CommandLine {
+       [Serializable]
+       public class CommandLineException : Exception {
+               int errorCode;
+               
+               public CommandLineException ()
+                       : base ("Unknown command line exception has occured.")
+               {
+               }
+               
+               public CommandLineException (string message)
+                       : base (message) 
+               {
+               }
+               
+               public CommandLineException (string message, int errorCode)
+                       : base (message)
+               {
+                       this.errorCode = errorCode;
+               }
+               
+               public CommandLineException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+               
+               public CommandLineException (string message, Exception innerException, int errorCode)
+                       : base (message, innerException)
+               {
+                       this.errorCode = errorCode;
+               }
+               
+               public CommandLineException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+                       errorCode = info.GetInt32 ("ErrorCode");
+               }
+               
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("ErrorCode", errorCode);
+               }
+               
+               public int ErrorCode {
+                       get { return errorCode; }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/xbuild/LoggerInfo.cs b/mcs/tools/xbuild/LoggerInfo.cs
new file mode 100644 (file)
index 0000000..94198ef
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// LoggerInfo.cs: Contains information about logger parameters.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Globalization;
+using System.Reflection;
+using Mono.XBuild.Shared;
+
+namespace Mono.XBuild.CommandLine {
+       public class LoggerInfo : AssemblyLoadInfo {
+       
+               string  parameters;
+       
+               public LoggerInfo ()
+               {
+               }
+               
+               public LoggerInfo (string s)
+               {
+                       string version = null;
+                       string culture = null;
+                       string name = null;
+                       string filename = null;
+                       string loggerClass = null;
+               
+                       string[] temp1 = s.Split (':');
+                       string[] temp2 = temp1[1].Split (',');
+                       
+                       // FIXME: replace all of this with readable code
+                       loggerClass = temp2 [0];
+                       if (temp2.Length == 4) {
+                               name = temp2 [1];
+                               version = temp2 [2].Split ('=') [1];
+                               string[] temp3 = temp2 [3].Split (';');
+                               if (temp3.Length == 1) {
+                                       culture = temp2 [3].Split ('=') [1];
+                               }
+                               if (temp3.Length > 1 ) {
+                                       culture = temp3 [0].Split ('=') [1];
+                                       parameters = temp3 [1];
+                               }
+                       }
+                       if (temp2.Length == 2) {
+                               string[] temp3 = temp2 [1].Split (';');
+                               if (temp3 [0].EndsWith (".dll")) {
+                                       filename = temp2 [1];
+                               } else {
+                                       name = temp2 [1];
+                               }
+                               if (temp3.Length > 1)
+                                       parameters = temp3 [1];
+                       }
+                       
+                       if (name != null)
+                               SetAssemblyName (LoadInfoType.AssemblyName, null, name, version, culture, null,loggerClass);
+                       else if (filename != null)
+                               SetAssemblyName (LoadInfoType.AssemblyFilename, filename, null, null, null, null, loggerClass);
+               }
+               
+               public string Parameters {
+                       get { return parameters; }
+               }
+       }
+}
diff --git a/mcs/tools/xbuild/MSBuild/Microsoft.Build.Commontypes.xsd b/mcs/tools/xbuild/MSBuild/Microsoft.Build.Commontypes.xsd
new file mode 100644 (file)
index 0000000..390189b
--- /dev/null
@@ -0,0 +1,1581 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003"
+elementFormDefault="qualified">
+
+    <!-- =================== INCLUDE COMMON SCHEMA =========================== -->
+    <xs:include schemaLocation="Microsoft.Build.Core.xsd"/>
+    
+    <!-- ======================== ITEMS =====================================-->
+    <!-- Possible Types include SimpleItemType (no meta-data subelements), GenericItemType (any meta-data), or something more specific.-->
+    <xs:element name="Reference" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Reference to an assembly</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="HintPath">
+                                <xs:annotation>
+                                    <xs:documentation>Relative or absolute path to the assembly (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="Name">
+                                <xs:annotation>
+                                    <xs:documentation>Friendly display name (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="FusionName">
+                                <xs:annotation>
+                                    <xs:documentation>Fusion name of the assembly (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                            
+                            <xs:element name="SpecificVersion">
+                                <xs:annotation>
+                                    <xs:documentation>Whether only the version in the fusion name should be referenced (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="Aliases">
+                                <xs:annotation>
+                                    <xs:documentation>Aliases for the reference (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="Private">
+                                <xs:annotation>
+                                    <xs:documentation>Whether the reference should be copied to the output folder (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                        </xs:choice>
+                    </xs:sequence>
+                    <!-- redefine Include just to give a specific description -->
+                    <xs:attribute name="Include" type="xs:string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>Assembly name or filename</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="COMReference" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Reference to a COM component</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="Name">
+                                <xs:annotation>
+                                    <xs:documentation>Friendly display name (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="Guid">
+                                <xs:annotation>
+                                    <xs:documentation>GUID in the form {00000000-0000-0000-0000-000000000000}</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="VersionMajor">
+                                <xs:annotation>
+                                    <xs:documentation>Major part of the version number</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="VersionMinor">
+                                <xs:annotation>
+                                    <xs:documentation>Minor part of the version number</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="Lcid">
+                                <xs:annotation>
+                                    <xs:documentation>Locale ID</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="WrapperTool">
+                                <xs:annotation>
+                                    <xs:documentation>Wrapper tool, such as tlbimp</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="Isolated">
+                                <xs:annotation>
+                                    <xs:documentation>Is it isolated (boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                        </xs:choice>
+                    </xs:sequence>
+                    <!-- redefine Include just to give a specific description -->
+                    <xs:attribute name="Include" type="xs:string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>COM component name</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="COMFileReference" substitutionGroup="msb:Item">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="WrapperTool"/>
+                        </xs:choice>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="NativeReference" substitutionGroup="msb:Item">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="Name"/>
+                            <xs:element name="HintPath"/>
+                        </xs:choice>
+                    </xs:sequence>
+                    <!-- redefine Include just to give a specific description -->
+                    <xs:attribute name="Include" type="xs:string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>Path to native reference</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>                    
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ProjectReference" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Reference to another project</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="Name">
+                                <xs:annotation>
+                                    <xs:documentation>Friendly display name (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="Project">
+                                <xs:annotation>
+                                    <xs:documentation>Project GUID, in the form {00000000-0000-0000-0000-000000000000}</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="Package"/>
+                        </xs:choice>
+                    </xs:sequence>
+                    <!-- redefine Include just to give a specific description -->
+                    <xs:attribute name="Include" type="xs:string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>Path to project file</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>    
+    <xs:element name="Compile" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Source files for compiler</xs:documentation>
+        </xs:annotation>        
+        <xs:complexType>           
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">                       
+                        <xs:choice>
+                            <xs:element name="SubType"/>
+                            <xs:element name="DependentUpon"/>
+                            <xs:element name="AutoGen">
+                                <xs:annotation>
+                                    <xs:documentation>Whether file was generated from another file (boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                 
+                            <xs:element name="DesignTime"/>
+                            <xs:element name="Link">
+                                <xs:annotation>
+                                    <xs:documentation>Notional path within project to display if the file is physically located outside of the project file's cone (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="DesignTimeSharedInput"/>
+                            <xs:element name="InProject">
+                                <xs:annotation>
+                                    <xs:documentation>Display in user interface (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                        </xs:choice>
+                    </xs:sequence>
+                    <!-- redefine Include just to give a specific description -->
+                    <xs:attribute name="Include" type="xs:string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>Semi-colon separated list of source files (wildcards are allowed)</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>                    
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="EmbeddedResource" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Resources to be embedded in the generated assembly</xs:documentation>
+        </xs:annotation>        
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="DependentUpon"/>
+                            <xs:element name="Generator">
+                                <xs:annotation>
+                                    <xs:documentation>Name of any file generator that is run on this item</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                               
+                            <xs:element name="LastGenOutput">
+                                <xs:annotation>
+                                    <xs:documentation>File that was created by any file generator that was run on this item</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                 
+                            <xs:element name="CustomToolNamespace">
+                                <xs:annotation>
+                                    <xs:documentation>Namespace into which any file generator that is run on this item should create code</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="Link">
+                                <xs:annotation>
+                                    <xs:documentation>Notional path within project to display if the file is physically located outside of the project file's cone (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="InProject">
+                                <xs:annotation>
+                                    <xs:documentation>Display in user interface (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="SubType"/>
+                        </xs:choice>
+                    </xs:sequence>
+                    <!-- redefine Include just to give a specific description -->
+                    <xs:attribute name="Include" type="xs:string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>Semi-colon separated list of resource files (wildcards are allowed)</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>                    
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Content" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Files that are not compiled, but may be embedded or published</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="DependentUpon"/>
+                            <xs:element name="Generator">
+                                <xs:annotation>
+                                    <xs:documentation>Name of any file generator that is run on this item</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                  
+                            <xs:element name="LastGenOutput"/>
+                            <xs:element name="CustomToolNamespace"/>
+                            <xs:element name="Link">
+                                <xs:annotation>
+                                    <xs:documentation>Notional path within project to display if the file is physically located outside of the project file's cone (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="Group"/>
+                            <xs:element name="PublishState">
+                            <xs:annotation>
+                                <xs:documentation>Default, Included, Excluded, DataFile, or Prerequisite</xs:documentation>
+                            </xs:annotation>
+                            </xs:element>
+                            <xs:element name="IsAssembly"/>
+                            <xs:element name="InProject">
+                                <xs:annotation>
+                                    <xs:documentation>Display in user interface (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="SubType"/>
+                            <xs:element name="CopyToOutputDirectory">
+                                <xs:annotation>
+                                    <xs:documentation>Copy file to output directory (optional, boolean, default false)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                    
+                        </xs:choice>
+                    </xs:sequence>
+                    <!-- redefine Include just to give a specific description -->
+                    <xs:attribute name="Include" type="xs:string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>Semi-colon separated list of content files (wildcards are allowed)</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>    
+    <xs:element name="None" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Files that should have no role in the build process</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <!-- UNDONE. Remove all but Link when #318721 is fixed-->
+                            <xs:element name="DependentUpon"/>
+                            <xs:element name="Generator">
+                                <xs:annotation>
+                                    <xs:documentation>Name of any file generator that is run on this item</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                  
+                            <xs:element name="LastGenOutput"/>
+                            <xs:element name="CustomToolNamespace"/>
+                            <xs:element name="Link">
+                                <xs:annotation>
+                                    <xs:documentation>Notional path within project to display if the file is physically located outside of the project file's cone (optional)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="InProject">
+                                <xs:annotation>
+                                    <xs:documentation>Display in user interface (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                        </xs:choice>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Folder" type="msb:SimpleItemType" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Folder on disk</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="Import" type="msb:SimpleItemType" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Assemblies whose namespaces should be imported by the Visual Basic compiler</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="Service" type="msb:SimpleItemType" substitutionGroup="msb:Item"/>
+    <xs:element name="WebReferences" type="msb:SimpleItemType" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Name of Web References folder to display in user interface</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="WebReferenceUrl" substitutionGroup="msb:Item">
+        <xs:annotation>
+            <xs:documentation>Represents a reference to a web service</xs:documentation>
+        </xs:annotation>        
+            <xs:complexType>
+                <xs:complexContent>
+                    <xs:extension base="msb:SimpleItemType">
+                        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                            <xs:choice>
+                                <xs:element name="UrlBehavior"/>
+                                <xs:element name="RelPath"/>
+                                <xs:element name="UpdateFromURL"/>
+                                <xs:element name="ServiceLocationURL"/>
+                                <xs:element name="CachedDynamicPropName"/>
+                                <xs:element name="CachedAppSettingsObjectName"/>
+                                <xs:element name="CachedSettingsPropName"/>
+                            </xs:choice>
+                        </xs:sequence>
+                        <!-- redefine Include just to give a specific description -->
+                        <xs:attribute name="Include" type="xs:string" use="required">
+                            <xs:annotation>
+                                <xs:documentation>URL to web service</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>                        
+                    </xs:extension>
+                </xs:complexContent>
+            </xs:complexType>
+    </xs:element>
+    <xs:element name="BootstrapperFile" substitutionGroup="msb:Item">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="InProject">
+                                <xs:annotation>
+                                    <xs:documentation>Display in user interface (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="ProductName"/>
+                            <xs:element name="Install"/>
+                        </xs:choice>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="PublishFile" substitutionGroup="msb:Item">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xs:choice>
+                            <xs:element name="InProject">
+                                <xs:annotation>
+                                    <xs:documentation>Display in user interface (optional, boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                                
+                            <xs:element name="Group"/>
+                            <xs:element name="IsAssembly">
+                                <xs:annotation>
+                                    <xs:documentation>(boolean)</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element name="PublishState">
+                                <xs:annotation>
+                                    <xs:documentation>Default, Included, Excluded, DataFile, or Prerequisite</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>                            
+                        </xs:choice>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <!-- ======================== PROPERTIES =====================================-->
+    <!-- Possible Types include StringPropertyType (text with no subelements), GenericPropertyType (any content), or something more specific.-->
+    <xs:element name="AllowUnsafeBlocks" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ApplicationIcon" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ApplicationRevision" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>integer</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="ApplicationVersion" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Matches the expression "\d\.\d\.\d\.(\d|\*)"</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="AppDesignerFolder" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Name of folder for Application Designer</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="AssemblyKeyContainerName" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="AssemblyKeyProviderName" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="AssemblyName" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Name of output assembly</xs:documentation>
+        </xs:annotation>
+    </xs:element>           
+    <xs:element name="AssemblyOriginatorKeyFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="AssemblyOriginatorKeyFileType" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="AssemblyOriginatorKeyMode" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="AssemblyType" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="AutorunEnabled" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>         
+    <xs:element name="BaseAddress" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="BootstrapperComponentsLocation" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>HomeSite, Relative, or Absolute</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="BootstrapperComponentsUrl" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="BootstrapperEnabled" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="CheckForOverflowUnderflow" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="CodePage" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="Configuration" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ConfigurationOverrideFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="CreateWebPageOnPublish" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="DebugSecurityZoneURL" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DebugSymbols" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Whether to emit symbols (boolean)</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="DebugType" type="msb:StringPropertyType" substitutionGroup="msb:Property">   
+        <xs:annotation>
+            <xs:documentation>none, pdbonly, or full</xs:documentation>
+        </xs:annotation>
+    </xs:element>         
+    <xs:element name="DefaultClientScript" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DefaultHTMLPageLayout" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DefaultTargetSchema" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DefineConstants" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DefineDebug" type="msb:StringPropertyType" substitutionGroup="msb:Property">   
+        <xs:annotation>
+            <xs:documentation>Whether DEBUG is defined (boolean)</xs:documentation>
+        </xs:annotation>
+    </xs:element>          
+    <xs:element name="DefineTrace" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Whether TRACE is defined (boolean)</xs:documentation>
+        </xs:annotation>
+    </xs:element>          
+    <xs:element name="DelaySign" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DisableLangXtns" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DisallowUrlActiviation" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="DeployDirSuffix" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="DocumentationFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="EnableASPDebugging" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="EnableASPXDebugging" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="EnableSQLServerDebugging" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="EnableSecurityDebugging" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="EnableUnmanagedDebugging" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ErrorReport" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ExcludedPermissions" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="FallbackCulture" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="FileAlignment" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="FileUpgradeFlags" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="FormFactorID" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="FxCopLogFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="FxCopProjectFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="FxCopRules" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="GenerateManifests" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="GenerateSerializationAssemblies" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="Install" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="InstallFrom" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Web, Unc, or Disk</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="InstallUrl" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="IsWebBootstrapper" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="JCPA" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="LangVersion" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ManifestCertificateThumbprint" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ManifestKeyFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="MapFileExtensions" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>                
+    <xs:element name="MinimumRequiredVersion" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Matches the expression "\d\.\d\.\d\.\d"</xs:documentation>
+        </xs:annotation>
+    </xs:element>                
+    <xs:element name="MyType" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="NoConfig" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>    
+    <xs:element name="NoStandardLibraries" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="NoStdLib" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Whether standard libraries (such as mscorlib) should be referenced automatically (boolean)</xs:documentation>
+        </xs:annotation>
+    </xs:element>          
+    <xs:element name="NoWarn" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Comma separated list of disabled warnings</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="OpenBrowserOnPublish" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>                
+    <xs:element name="Optimize" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Should compiler optimize output (boolean)</xs:documentation>
+        </xs:annotation>
+    </xs:element>     
+    <xs:element name="OptionCompare" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Option Compare setting (Text or Binary)</xs:documentation>
+        </xs:annotation>
+    </xs:element>         
+    <xs:element name="OptionExplicit" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Should Option Explicit be set (On or Off)</xs:documentation>
+        </xs:annotation>
+    </xs:element>         
+    <xs:element name="OptionStrict" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Should Option Strict be set (On or Off)</xs:documentation>
+        </xs:annotation>
+    </xs:element>            
+    <xs:element name="OSVersion" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="OutputPath" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Path to output folder, with trailing slash</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="OutputType" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Type of output to generate (WinExe, Exe, or Library)</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="Platform" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="PlatformFamilyName" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>    
+    <xs:element name="PlatformID" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>    
+    <xs:element name="PlatformTarget" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="PostBuildEvent" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Command line to be run at the end of build</xs:documentation>
+        </xs:annotation>
+    </xs:element>          
+    <xs:element name="PreBuildEvent" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Command line to be run at the start of build</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="ProductName" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ProductVersion" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ProjectGuid" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ProjectType" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ProjectTypeGuids" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="PublisherName" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="PublishUrl" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="RecursePath" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ReferencePath" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Semi-colon separated list of folders to search during reference resolution</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="RegisterForComInterop" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="RemoteDebugEnabled" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="RemoteDebugMachine" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="RemoveIntegerChecks" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="ResponseFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="RootNamespace" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="RunFxCop" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="RunPostBuildEvent" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="SchemaVersion" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="SecureScoping" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="SignAssembly" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="SignManifests" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartAction" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartArguments" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartPage" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartProgram" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartURL" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartWithIE" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartWorkingDirectory" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="StartupObject" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Type that contains the main entry point</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="SupportUrl" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="TargetCulture" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="TargetZone" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="TreatWarningsAsErrors" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="TrustUrlParameters" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>                
+    <xs:element name="TypeComplianceDiagnostics" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="UpdateEnabled" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>                
+    <xs:element name="UpdateInterval" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="UpdateIntervalUnits" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Hours, Days, or Weeks</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="UpdateMode" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Foreground or Background</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="UpdatePeriodically" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="UpdateRequired" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>boolean</xs:documentation>
+        </xs:annotation>
+    </xs:element>                
+    <xs:element name="UpdateUrl" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>    
+    <xs:element name="UTF8OutPut" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="UseVSHostingProcess" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="VSTO_TrustAssembliesLocation" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="WarningLevel" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>integer between 0 and 4 inclusive</xs:documentation>
+        </xs:annotation>
+    </xs:element>        
+    <xs:element name="WarningsAsErrors" type="msb:StringPropertyType" substitutionGroup="msb:Property">
+        <xs:annotation>
+            <xs:documentation>Comma separated list of warning numbers to treat as errors</xs:documentation>
+        </xs:annotation>
+    </xs:element>          
+    <xs:element name="WebPage" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <xs:element name="Win32ResourceFile" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>
+    <!-- ======================== TASKS =====================================-->
+    <xs:element name="AL" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="OutputAssembly" use="required" />
+                    <xs:attribute name="AlgorithmId" />
+                    <xs:attribute name="BaseAddress" />
+                    <xs:attribute name="CompanyName" />
+                    <xs:attribute name="Configuration" />
+                    <xs:attribute name="Copyright" />
+                    <xs:attribute name="Culture" />
+                    <xs:attribute name="DelaySign" />
+                    <xs:attribute name="Description" />
+                    <xs:attribute name="EmbedResources" />
+                    <xs:attribute name="EvidenceFile" />
+                    <xs:attribute name="FileVersion" />
+                    <xs:attribute name="Flags" />
+                    <xs:attribute name="GenerateFullPaths" />
+                    <xs:attribute name="KeyContainer" />
+                    <xs:attribute name="KeyFile" />
+                    <xs:attribute name="LinkResources" />
+                    <xs:attribute name="MainEntryPoint" />
+                    <xs:attribute name="Platform" />
+                    <xs:attribute name="ProductName" />
+                    <xs:attribute name="ProductVersion" />
+                    <xs:attribute name="ResponseFiles" />
+                    <xs:attribute name="SourceModules" />
+                    <xs:attribute name="TargetType" />
+                    <xs:attribute name="TemplateFile" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="Title" />
+                    <xs:attribute name="ToolPath" />
+                    <xs:attribute name="Trademark" />
+                    <xs:attribute name="Version" />
+                    <xs:attribute name="Win32Icon" />
+                    <xs:attribute name="Win32Resource" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="AspNetCompiler" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Clean" />
+                    <xs:attribute name="Debug" />
+                    <xs:attribute name="Force" />
+                    <xs:attribute name="MetabasePath" />
+                    <xs:attribute name="PhysicalPath" />
+                    <xs:attribute name="TargetPath" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                    <xs:attribute name="Updateable" />
+                    <xs:attribute name="VirtualPath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="AssignCulture" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Files" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="AssignTargetPath" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="RootFolder" use="required" />
+                    <xs:attribute name="Files" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Copy" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="DestinationFiles" />
+                    <xs:attribute name="DestinationFolder" />
+                    <xs:attribute name="SkipUnchangedFiles" />
+                    <xs:attribute name="SourceFiles" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="CreateCSharpManifestResourceName" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="ResourceFiles" use="required" />
+                    <xs:attribute name="RootNamespace" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="CreateItem" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AdditionalMetadata" />
+                    <xs:attribute name="Exclude" />
+                    <xs:attribute name="Include" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="CreateJSharpManifestResourceName" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="ResourceFiles" use="required" />
+                    <xs:attribute name="RootNamespace" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="CreateProperty" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Value" />
+                    <xs:attribute name="ValueSetByTask" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="CreateVisualBasicManifestResourceName" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="ResourceFiles" use="required" />
+                    <xs:attribute name="RootNamespace" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Csc" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AdditionalLibPaths" />
+                    <xs:attribute name="AddModules" />
+                    <xs:attribute name="AllowUnsafeBlocks" />
+                    <xs:attribute name="BaseAddress" />
+                    <xs:attribute name="CheckForOverflowUnderflow" />
+                    <xs:attribute name="CodePage" />
+                    <xs:attribute name="DebugType" />
+                    <xs:attribute name="DefineConstants" />
+                    <xs:attribute name="DelaySign" />
+                    <xs:attribute name="DisabledWarnings" />
+                    <xs:attribute name="DocumentationFile" />
+                    <xs:attribute name="EmitDebugInformation" />
+                    <xs:attribute name="ErrorReport" />
+                    <xs:attribute name="FileAlignment" />
+                    <xs:attribute name="GenerateFullPaths" />
+                    <xs:attribute name="KeyContainer" />
+                    <xs:attribute name="KeyFile" />
+                    <xs:attribute name="LangVersion" />
+                    <xs:attribute name="LinkResources" />
+                    <xs:attribute name="MainEntryPoint" />
+                    <xs:attribute name="NoConfig" />
+                    <xs:attribute name="NoLogo" />
+                    <xs:attribute name="NoStandardLib" />
+                    <xs:attribute name="Optimize" />
+                    <xs:attribute name="OutputAssembly" />
+                    <xs:attribute name="Platform" />
+                    <xs:attribute name="References" />
+                    <xs:attribute name="Resources" />
+                    <xs:attribute name="ResponseFiles" />
+                    <xs:attribute name="Sources" />
+                    <xs:attribute name="TargetType" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                    <xs:attribute name="TreatWarningsAsErrors" />
+                    <xs:attribute name="UseHostCompilerIfAvailable" />
+                    <xs:attribute name="Utf8Output" />
+                    <xs:attribute name="WarningLevel" />
+                    <xs:attribute name="WarningsAsErrors" />
+                    <xs:attribute name="WarningsNotAsErrors" />
+                    <xs:attribute name="Win32Icon" />
+                    <xs:attribute name="Win32Resource" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Delete" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Files" use="required" />
+                    <xs:attribute name="DeletedFiles" />
+                    <xs:attribute name="TreatErrorsAsWarnings" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Error" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Text" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Exec" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Command" use="required" />
+                    <xs:attribute name="IgnoreExitCode" />
+                    <xs:attribute name="Outputs" />
+                    <xs:attribute name="StandardErrorEncoding" />
+                    <xs:attribute name="StandardOutputEncoding" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="WorkingDirectory" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="FindUnderPath" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Path" use="required" />
+                    <xs:attribute name="Files" />
+                    <xs:attribute name="InPath" />
+                    <xs:attribute name="OutOfPath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="FormatUrl" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="InputUrl" />
+                    <xs:attribute name="OutputUrl" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="FormatVersion" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="FormatType" />
+                    <xs:attribute name="OutputVersion" />
+                    <xs:attribute name="Revision" />
+                    <xs:attribute name="Version" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="FxCop" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="ApplyLogFileXsl" />
+                    <xs:attribute name="Assemblies" />
+                    <xs:attribute name="ConsoleXsl" />
+                    <xs:attribute name="DependentAssemblyPaths" />
+                    <xs:attribute name="Imports" />
+                    <xs:attribute name="LogFile" />
+                    <xs:attribute name="LogFileXsl" />
+                    <xs:attribute name="OutputToConsole" />
+                    <xs:attribute name="PlatformPath" />
+                    <xs:attribute name="Project" />
+                    <xs:attribute name="RuleAssemblies" />
+                    <xs:attribute name="Rules" />
+                    <xs:attribute name="Summary" />
+                    <xs:attribute name="ToolPath" />
+                    <xs:attribute name="UpdateProjectFile" />
+                    <xs:attribute name="Verbose" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GenerateApplicationManifest" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AssemblyName" />
+                    <xs:attribute name="AssemblyVersion" />
+                    <xs:attribute name="ClrVersion" />
+                    <xs:attribute name="ConfigFile" />
+                    <xs:attribute name="Dependencies" />
+                    <xs:attribute name="Description" />
+                    <xs:attribute name="EntryPoint" />
+                    <xs:attribute name="Files" />
+                    <xs:attribute name="IconFile" />
+                    <xs:attribute name="InputManifest" />
+                    <xs:attribute name="IsolatedComReferences" />
+                    <xs:attribute name="ManifestType" />
+                    <xs:attribute name="MaxTargetPath" />
+                    <xs:attribute name="OSVersion" />
+                    <xs:attribute name="OutputManifest" />
+                    <xs:attribute name="Platform" />
+                    <xs:attribute name="TargetCulture" />
+                    <xs:attribute name="TrustInfoFile" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GenerateBootstrapper" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="ApplicationFile" />
+                    <xs:attribute name="ApplicationName" />
+                    <xs:attribute name="ApplicationUrl" />
+                    <xs:attribute name="BootstrapperComponentFiles" />
+                    <xs:attribute name="BootstrapperItems" />
+                    <xs:attribute name="BootstrapperKeyFile" />
+                    <xs:attribute name="ComponentsLocation" />
+                    <xs:attribute name="ComponentsUrl" />
+                    <xs:attribute name="CopyComponents" />
+                    <xs:attribute name="Culture" />
+                    <xs:attribute name="FallbackCulture" />
+                    <xs:attribute name="OutputPath" />
+                    <xs:attribute name="Path" />
+                    <xs:attribute name="SupportUrl" />
+                    <xs:attribute name="Validate" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GenerateDeploymentManifest" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AssemblyName" />
+                    <xs:attribute name="AssemblyVersion" />
+                    <xs:attribute name="DeploymentUrl" />
+                    <xs:attribute name="Description" />
+                    <xs:attribute name="DisallowUrlActivation" />
+                    <xs:attribute name="EntryPoint" />
+                    <xs:attribute name="InputManifest" />
+                    <xs:attribute name="Install" />
+                    <xs:attribute name="MaxTargetPath" />
+                    <xs:attribute name="MapFileExtensions" />
+                    <xs:attribute name="MinimumRequiredVersion" />
+                    <xs:attribute name="OutputManifest" />
+                    <xs:attribute name="Platform" />
+                    <xs:attribute name="Product" />
+                    <xs:attribute name="Publisher" />
+                    <xs:attribute name="SupportUrl" />
+                    <xs:attribute name="TargetCulture" />
+                    <xs:attribute name="TrustUrlParameters" />
+                    <xs:attribute name="UpdateEnabled" />
+                    <xs:attribute name="UpdateInterval" />
+                    <xs:attribute name="UpdateMode" />
+                    <xs:attribute name="UpdateUnit" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GenerateResource" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Sources" use="required" />
+                    <xs:attribute name="FilesWritten" />
+                    <xs:attribute name="NeverLockTypeAssemblies" />
+                    <xs:attribute name="OutputResources" />
+                   <xs:attribute name="References" />
+                    <xs:attribute name="StateFile" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="UseSourcePath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GetAssemblyIdentity" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AssemblyFiles" use="required" />
+                    <xs:attribute name="Assemblies" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GetFrameworkPath" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Path" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GetFrameworkSdkPath" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Path" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GetLinkedFilesFromResX" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Sources" use="required" />
+                    <xs:attribute name="StateFile" />
+                    <xs:attribute name="UseSourcePath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="LC" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="LicenseTarget" use="required" />
+                    <xs:attribute name="Sources" use="required" />
+                    <xs:attribute name="NoLogo" />
+                    <xs:attribute name="OutputDirectory" />
+                    <xs:attribute name="OutputLicense" />
+                    <xs:attribute name="ReferencedAssemblies" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="MakeDir" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Directories" use="required" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Message" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Importance" />
+                    <xs:attribute name="Text" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="MSBuild" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Projects" use="required" />
+                    <xs:attribute name="RebaseOutputs" />
+                    <xs:attribute name="StopOnFirstFailure" />
+                    <xs:attribute name="RunEachTargetSeparately" />
+                    <xs:attribute name="Targets" />
+                    <xs:attribute name="Properties" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ReadLinesFromFile" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="File" use="required" />
+                    <xs:attribute name="Lines" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="RegisterAssembly" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Assemblies" use="required" />
+                    <xs:attribute name="CreateCodeBase" />
+                    <xs:attribute name="StateFile" />
+                    <xs:attribute name="TypeLibFiles" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="RemoveDir" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Directories" use="required" />
+                    <xs:attribute name="RemovedDirectories" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="RemoveDuplicates" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Filtered" />
+                    <xs:attribute name="Inputs" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ResGen" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Sources" use="required" />
+                    <xs:attribute name="FilesWritten" />
+                    <xs:attribute name="OutputResources" />
+                    <xs:attribute name="References" />
+                    <xs:attribute name="StateFile" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                    <xs:attribute name="UseSourcePath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ResolveAssemblyReference" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="SearchPaths" use="required" />
+                    <xs:attribute name="AppConfigFile" />
+                    <xs:attribute name="Assemblies" />
+                    <xs:attribute name="AssemblyFiles" />
+                    <xs:attribute name="AutoUnify" />
+                    <xs:attribute name="CandidateAssemblyFiles" />
+                    <xs:attribute name="FilesWritten" />
+                    <xs:attribute name="FindDependencies" />
+                    <xs:attribute name="FindRelatedFiles" />
+                    <xs:attribute name="FindSatellites" />
+                    <xs:attribute name="InstalledAssemblyTables" />
+                    <xs:attribute name="Silent" />
+                    <xs:attribute name="StateFile" />
+                    <xs:attribute name="TargetFrameworkDirectory" />
+                    <xs:attribute name="TargetProcessorArchitecture" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ResolveComReference" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="DelaySign" />
+                    <xs:attribute name="KeyContainer" />
+                    <xs:attribute name="KeyFile" />
+                    <xs:attribute name="NoClassMembers" />
+                    <xs:attribute name="ResolvedAssemblyReferences" />
+                    <xs:attribute name="ResolvedFiles" />
+                    <xs:attribute name="ResolvedModules" />
+                    <xs:attribute name="StateFile" />
+                    <xs:attribute name="TypeLibFiles" />
+                    <xs:attribute name="TypeLibNames" />
+                    <xs:attribute name="WrapperOutputDirectory" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ResolveKeySource" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AutoClosePasswordPromptShow" />
+                    <xs:attribute name="AutoClosePasswordPromptTimeout" />
+                    <xs:attribute name="CertificateFile" />
+                    <xs:attribute name="CertificateThumbprint" />
+                    <xs:attribute name="KeyFile" />
+                    <xs:attribute name="ResolvedKeyContainer" />
+                    <xs:attribute name="ResolvedKeyFile" />
+                    <xs:attribute name="ResolvedThumbprint" />
+                    <xs:attribute name="SuppressAutoClosePasswordPrompt" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="GenerateTrustInfo" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="BaseManifest" />
+                    <xs:attribute name="ExcludedPermissions" />
+                    <xs:attribute name="TargetZone" use="required" />
+                    <xs:attribute name="TrustInfoFile" use="required" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ResolveManifestFiles" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="EntryPoint" />
+                    <xs:attribute name="TrustInfoFile" />
+                    <xs:attribute name="Dependencies" /> <!-- obsolete -->
+                    <xs:attribute name="ExtraFiles" />
+                    <xs:attribute name="Files" />
+                    <xs:attribute name="ManagedAssemblies" />
+                    <xs:attribute name="NativeAssemblies" />
+                    <xs:attribute name="OutputAssemblies" />
+                    <xs:attribute name="OutputDependencies" /> <!-- obsolete -->
+                    <xs:attribute name="OutputFiles" />
+                    <xs:attribute name="OutputPrerequisites" /> <!-- obsolete -->
+                    <xs:attribute name="OutputSatellites" /> <!-- obsolete -->
+                    <xs:attribute name="PublishFiles" />
+                    <xs:attribute name="Satellites" /> <!-- obsolete -->
+                    <xs:attribute name="SatelliteAssemblies" />
+                    <xs:attribute name="TargetCulture" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ResolveNativeReference" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="NativeReferences" use="required" />
+                    <xs:attribute name="ContainedComComponents" />
+                    <xs:attribute name="ContainedLooseEtcFiles" />
+                    <xs:attribute name="ContainedLooseTlbFiles" />
+                    <xs:attribute name="ContainedNetAssemblies" />
+                    <xs:attribute name="ContainedTypeLibraries" />
+                    <xs:attribute name="ContainingReferenceFiles" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="ResolveVCProjectOutput" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="ProjectReferences" use="required" />
+                    <xs:attribute name="Configuration" />
+                    <xs:attribute name="PreresolvedVCOutputs" />
+                    <xs:attribute name="ResolvedOutputPaths" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="SGen" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="BuildAssemblyName" use="required" />
+                    <xs:attribute name="BuildAssemblyPath" use="required" />
+                    <xs:attribute name="ShouldGenerateSerializer" use="required" />
+                    <xs:attribute name="DelaySign" />
+                    <xs:attribute name="KeyContainer" />
+                    <xs:attribute name="KeyFile" />
+                    <xs:attribute name="References" />
+                    <xs:attribute name="SerializationAssembly" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="SignFile" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="CertificateThumbprint" use="required" />
+                    <xs:attribute name="SigningTarget" use="required" />
+                    <xs:attribute name="TimestampUrl" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Touch" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Files" use="required" />
+                    <xs:attribute name="AlwaysCreate" />
+                    <xs:attribute name="ForceTouch" />
+                    <xs:attribute name="Time" />
+                    <xs:attribute name="TouchedFiles" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="UnregisterAssembly" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Assemblies" />
+                    <xs:attribute name="StateFile" />
+                    <xs:attribute name="TypeLibFiles" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="UpdateManifest" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="InputManifest" use="required" />
+                    <xs:attribute name="ApplicationManifest" />
+                    <xs:attribute name="ApplicationPath" />
+                    <xs:attribute name="OutputManifest" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Vbc" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AdditionalLibPaths" />
+                    <xs:attribute name="AddModules" />
+                    <xs:attribute name="BaseAddress" />
+                    <xs:attribute name="CodePage" />
+                    <xs:attribute name="DebugType" />
+                    <xs:attribute name="DefineConstants" />
+                    <xs:attribute name="DelaySign" />
+                    <xs:attribute name="DisabledWarnings" />
+                    <xs:attribute name="DocumentationFile" />
+                    <xs:attribute name="EmitDebugInformation" />
+                    <xs:attribute name="ErrorReport" />
+                    <xs:attribute name="FileAlignment" />
+                    <xs:attribute name="GenerateDocumentation" />
+                    <xs:attribute name="Imports" />
+                    <xs:attribute name="KeyContainer" />
+                    <xs:attribute name="KeyFile" />
+                    <xs:attribute name="LinkResources" />
+                    <xs:attribute name="MainEntryPoint" />
+                    <xs:attribute name="NoConfig" />
+                    <xs:attribute name="NoLogo" />
+                    <xs:attribute name="NoStandardLib" />
+                    <xs:attribute name="NoWarnings" />
+                    <xs:attribute name="Optimize" />
+                    <xs:attribute name="OptionCompare" />
+                    <xs:attribute name="OptionExplicit" />
+                    <xs:attribute name="OptionStrict" />
+                    <xs:attribute name="OutputAssembly" />
+                    <xs:attribute name="Platform" />
+                    <xs:attribute name="References" />
+                    <xs:attribute name="RemoveIntegerChecks" />
+                    <xs:attribute name="Resources" />
+                    <xs:attribute name="ResponseFiles" />
+                    <xs:attribute name="RootNamespace" />
+                    <xs:attribute name="SdkPath" />
+                    <xs:attribute name="Sources" />
+                    <xs:attribute name="TargetCompactFramework" />
+                    <xs:attribute name="TargetType" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                    <xs:attribute name="TreatWarningsAsErrors" />
+                    <xs:attribute name="UseHostCompilerIfAvailable" />
+                    <xs:attribute name="Utf8Output" />
+                    <xs:attribute name="Verbosity" />
+                    <xs:attribute name="WarningsAsErrors" />
+                    <xs:attribute name="WarningsNotAsErrors" />
+                    <xs:attribute name="Win32Icon" />
+                    <xs:attribute name="Win32Resource" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="VCBuild" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Projects" use="required" />
+                    <xs:attribute name="Clean" />
+                    <xs:attribute name="Configuration" />
+                    <xs:attribute name="Override" />
+                    <xs:attribute name="Rebuild" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Vjc" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="AdditionalLibPaths" />
+                    <xs:attribute name="AddModules" />
+                    <xs:attribute name="BaseAddress" />
+                    <xs:attribute name="CodePage" />
+                    <xs:attribute name="DebugType" />
+                    <xs:attribute name="DefineConstants" />
+                    <xs:attribute name="DelaySign" />
+                    <xs:attribute name="DisabledWarnings" />
+                    <xs:attribute name="DisableExtensions" />
+                    <xs:attribute name="DocumentationFile" />
+                    <xs:attribute name="EmitDebugInformation" />
+                    <xs:attribute name="FileAlignment" />
+                    <xs:attribute name="Jcpa" />
+                    <xs:attribute name="KeyContainer" />
+                    <xs:attribute name="KeyFile" />
+                    <xs:attribute name="LinkResources" />
+                    <xs:attribute name="MainEntryPoint" />
+                    <xs:attribute name="NoConfig" />
+                    <xs:attribute name="NoLogo" />
+                    <xs:attribute name="Optimize" />
+                    <xs:attribute name="OutputAssembly" />
+                    <xs:attribute name="References" />
+                    <xs:attribute name="Resources" />
+                    <xs:attribute name="ResponseFiles" />
+                    <xs:attribute name="SecureScoping" />
+                    <xs:attribute name="Sources" />
+                    <xs:attribute name="TargetType" />
+                    <xs:attribute name="Timeout" />
+                    <xs:attribute name="ToolPath" />
+                    <xs:attribute name="TreatWarningsAsErrors" />
+                    <xs:attribute name="Utf8Output" />
+                    <xs:attribute name="WarningLevel" />
+                    <xs:attribute name="Win32Icon" />
+                    <xs:attribute name="Win32Resource" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="VjsResGen" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Sources" use="required" />
+                    <xs:attribute name="OutputResx" />
+                    <xs:attribute name="WildCards" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="Warning" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="Text" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="WriteLinesToFile" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="File" use="required" />
+                    <xs:attribute name="Lines" />
+                    <xs:attribute name="Overwrite" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
diff --git a/mcs/tools/xbuild/MSBuild/Microsoft.Build.Core.xsd b/mcs/tools/xbuild/MSBuild/Microsoft.Build.Core.xsd
new file mode 100644 (file)
index 0000000..9ab9bda
--- /dev/null
@@ -0,0 +1,390 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003" xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+    <!-- ======================================================================================= -->
+    <xs:element name="Project">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:group ref="msb:ProjectLevelTagExceptTargetOrImportType" minOccurs="0" maxOccurs="unbounded"/>
+                <!-- must be at least one Target or Import tag-->
+                <xs:group ref="msb:TargetOrImportType"/>
+                <xs:group ref="msb:ProjectLevelTagType" minOccurs="0" maxOccurs="unbounded"/>
+            </xs:sequence>
+            <xs:attribute name="DefaultTargets" type="xs:string" use="optional">
+                <xs:annotation>
+                    <xs:documentation>Optional semi-colon separated list of one or more targets that will be built if no targets are otherwise specified</xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+        </xs:complexType>
+    </xs:element>
+    <!-- ======================================================================================= -->
+    <xs:group name="ProjectLevelTagExceptTargetOrImportType">
+        <xs:choice>
+            <xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
+            <xs:element name="ItemGroup" type="msb:ItemGroupType"/>
+            <xs:element name="Choose" type="msb:ChooseType"/>
+            <xs:element name="Error" type="msb:WarningErrorOutsideTargetType">
+                <xs:annotation>
+                    <xs:documentation>Logs an Error event</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="Warning" type="msb:WarningErrorOutsideTargetType">
+                <xs:annotation>
+                    <xs:documentation>Logs a Warning event</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="Message" type="msb:MessageOutsideTargetType"/>
+            <xs:element name="UsingTask" type="msb:UsingTaskType"/>
+            <xs:element name="ProjectExtensions" type="msb:ProjectExtensionsType"/>
+        </xs:choice>
+    </xs:group>
+    <!-- ======================================================================================= -->    
+    <xs:group name="ProjectLevelTagType">
+        <xs:choice>
+            <xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
+            <xs:element name="ItemGroup" type="msb:ItemGroupType"/>
+            <xs:element name="Choose" type="msb:ChooseType"/>
+            <xs:element name="Error" type="msb:WarningErrorOutsideTargetType">
+                <xs:annotation>
+                    <xs:documentation>Logs an Error event</xs:documentation>
+                </xs:annotation>
+            </xs:element>                
+            <xs:element name="Warning" type="msb:WarningErrorOutsideTargetType">
+                <xs:annotation>
+                    <xs:documentation>Logs a Warning event</xs:documentation>
+                </xs:annotation>
+            </xs:element>                
+            <xs:element name="Message" type="msb:MessageOutsideTargetType"/>
+            <xs:element name="UsingTask" type="msb:UsingTaskType"/>
+            <xs:element name="Target" type="msb:TargetType"/>
+            <xs:element name="Import" type="msb:ImportType"/>
+            <xs:element name="ProjectExtensions" type="msb:ProjectExtensionsType"/>
+        </xs:choice>
+    </xs:group>
+    <!-- ======================================================================================= -->
+    <xs:group name="TargetOrImportType">
+        <xs:choice>
+            <xs:element name="Target" type="msb:TargetType"/>
+            <xs:element name="Import" type="msb:ImportType"/>
+        </xs:choice>
+    </xs:group>    
+    <!-- ======================================================================================= -->        
+    <xs:complexType name="TargetType">
+        <xs:annotation>
+            <xs:documentation>Groups tasks into a section of the build process</xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:choice minOccurs="0" maxOccurs="unbounded">
+                <xs:element ref="msb:Task"/>
+            </xs:choice>
+            <xs:element name="OnError" type="msb:OnErrorType" minOccurs="0" maxOccurs="unbounded"/>
+            <!-- no elements are allowed under Target after an OnError element-->
+        </xs:sequence>
+        <xs:attribute name="Name" type="msb:non_empty_string" use="required">
+            <xs:annotation>
+                <xs:documentation>Name of the target</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="DependsOnTargets" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional semi-colon separated list of targets that should be run before this target</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>            
+        <xs:attribute name="Inputs" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional semi-colon separated list of files that form inputs into this target. Their timestamps will be compared with the timestamps of files in Outputs to determine whether the Target is up to date</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>                
+        <xs:attribute name="Outputs" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional semi-colon separated list of files that form outputs into this target. Their timestamps will be compared with the timestamps of files in Inputs to determine whether the Target is up to date</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the Target and the targets it depends on should be run</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>            
+    </xs:complexType>
+    <!-- ======================================================================================= -->        
+    <xs:complexType name="PropertyGroupType">
+        <xs:annotation>
+            <xs:documentation>Groups property definitions</xs:documentation>
+        </xs:annotation>
+        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+            <xs:element ref="msb:Property"/>
+        </xs:sequence>
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the PropertyGroup should be used</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>                
+    </xs:complexType>
+    <!-- ======================================================================================= -->        
+    <xs:complexType name="ItemGroupType">
+        <xs:annotation>
+            <xs:documentation>Groups item list definitions</xs:documentation>
+        </xs:annotation>        
+        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+            <xs:element ref="msb:Item"/>
+        </xs:sequence>
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the ItemGroup should be used</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>                
+    </xs:complexType>
+    <!-- ======================================================================================= -->
+    <xs:complexType name="ChooseType">
+        <xs:annotation>
+            <xs:documentation>Groups When and Otherwise elements</xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="When" type="msb:WhenType" maxOccurs="unbounded"/>
+            <xs:element name="Otherwise" type="msb:OtherwiseType" minOccurs="0"/>
+        </xs:sequence>
+    </xs:complexType>
+    <!-- ======================================================================================= -->
+    <xs:complexType name="WhenType">
+        <xs:annotation>
+            <xs:documentation>Groups PropertyGroup and/or ItemGroup elements</xs:documentation>
+        </xs:annotation>
+        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+            <xs:choice>
+                <xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
+                <xs:element name="ItemGroup" type="msb:ItemGroupType"/>
+                <xs:element name="Choose" type="msb:ChooseType"/>
+            </xs:choice>
+        </xs:sequence>
+        <xs:attribute name="Condition" type="xs:string" use="required">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the child PropertyGroups and/or ItemGroups should be used</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+    </xs:complexType>
+    <!-- ======================================================================================= -->
+    <xs:complexType name="OtherwiseType">
+        <xs:annotation>
+            <xs:documentation>Groups PropertyGroup and/or ItemGroup elements that are used if no Conditions on sibling When elements evaluate to true</xs:documentation>
+        </xs:annotation>        
+        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+            <xs:choice>
+                <xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
+                <xs:element name="ItemGroup" type="msb:ItemGroupType"/>
+                <xs:element name="Choose" type="msb:ChooseType"/>
+            </xs:choice>
+        </xs:sequence>
+    </xs:complexType>
+    <!-- ======================================================================================= -->        
+    <xs:complexType name="OnErrorType">
+        <xs:annotation>
+            <xs:documentation>Specifies targets to execute in the event of a recoverable error</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the targets should be executed</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="ExecuteTargets" type="msb:non_empty_string" use="required">
+            <xs:annotation>
+                <xs:documentation>Semi-colon separated list of targets to execute</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>            
+    </xs:complexType>
+    <!-- ======================================================================================= -->        
+    <xs:complexType name="MessageOutsideTargetType">
+        <xs:annotation>
+            <xs:documentation>Logs an informational Message event, with an optional Importance</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the Message should be logged</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>            
+        <xs:attribute name="Importance" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional priority level. Allowed values are Low, Normal (default), and High</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+        <xs:attribute name="Text" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Text to log</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+    </xs:complexType>
+    <!-- ======================================================================================= -->        
+    <xs:complexType name="WarningErrorOutsideTargetType">
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the text should be logged</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+        <xs:attribute name="Text" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Text to log</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+    </xs:complexType>    
+    <!-- ======================================================================================= -->    
+    <xs:complexType name="UsingTaskType">
+        <xs:annotation>
+            <xs:documentation>Declares where to load a task that will be used in the project</xs:documentation>
+        </xs:annotation>        
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the declaration should be evaluated</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>                
+        <xs:attribute name="AssemblyName" type="msb:non_empty_string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional name of assembly containing the task. Either AssemblyName or AssemblyFile must be used</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="AssemblyFile" type="msb:non_empty_string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional path to assembly containing the task. Either AssemblyName or AssemblyFile must be used</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>            
+        <xs:attribute name="TaskName" type="msb:non_empty_string" use="required">
+            <xs:annotation>
+                <xs:documentation>Name of task class in the assembly</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+    </xs:complexType>
+    <!-- ======================================================================================= -->  
+    <xs:complexType name="ImportType">
+        <xs:annotation>
+            <xs:documentation>Declares that the contents of another project file should be inserted at this location</xs:documentation>
+        </xs:annotation>        
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the import should occur</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>              
+        <xs:attribute name="Project" type="msb:non_empty_string" use="required">
+            <xs:annotation>
+                <xs:documentation>Project file to import</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>            
+    </xs:complexType>
+    <!-- ======================================================================================= -->  
+    <xs:complexType name="ProjectExtensionsType" mixed="true">
+        <xs:annotation>
+            <xs:documentation>Optional section used by MSBuild hosts, that may contain arbitrary XML content that is ignored by MSBuild itself</xs:documentation>
+        </xs:annotation>
+        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+            <xs:any processContents="skip"/>
+        </xs:sequence>
+    </xs:complexType>    
+    <!-- ======================================================================================= -->
+    <xs:element name="Item" type="msb:SimpleItemType" abstract="true"/>
+    <!-- ======================================================================================= -->   
+    <!-- convenience type for items that have no meta-data-->
+    <xs:complexType name="SimpleItemType">
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the items should be evaluated</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+        <xs:attribute name="Include" type="xs:string" use="required">
+            <xs:annotation>
+                <xs:documentation>Semi-colon separated list of files (wildcards are allowed) or other item names to include in this item list</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+        <xs:attribute name="Exclude" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Semi-colon separated list of files (wildcards are allowed) or other item names to exclude from the Include list</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>             
+    </xs:complexType>
+    <!-- ======================================================================================= -->      
+    <!-- general utility type allowing an item type to be defined but not its child meta-data-->
+    <xs:complexType name="GenericItemType">
+        <xs:complexContent>
+            <xs:extension base="msb:SimpleItemType">
+                <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                    <xs:any namespace="##any" processContents="skip"/>  
+                </xs:sequence>      
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+    <!-- ======================================================================================= -->  
+    <!-- no type declared on this abstract element, so either a simple or complex type can be substituted for it.-->
+    <xs:element name="Property" abstract="true"/>
+    <!-- ======================================================================================= -->      
+    <!-- convenience type for properties that just want to allow text and no elements in them-->
+    <xs:complexType name="StringPropertyType">
+        <xs:simpleContent>
+            <xs:extension base="xs:string">
+                <xs:attribute name="Condition" type="xs:string" use="optional">
+                    <xs:annotation>
+                        <xs:documentation>Optional expression evaluated to determine whether the property should be evaluated</xs:documentation>
+                    </xs:annotation>
+                </xs:attribute>
+            </xs:extension>
+        </xs:simpleContent>
+    </xs:complexType>
+    <!-- ======================================================================================= -->      
+    <!-- general utility type allowing text and/or elements inside-->
+    <xs:complexType name="GenericPropertyType" mixed="true">
+        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+            <xs:any namespace="##any" processContents="skip"/>
+        </xs:sequence>
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the property should be evaluated</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+    </xs:complexType>
+    <!-- ======================================================================================= -->
+    <xs:element name="Task" type="msb:TaskType" abstract="true"/>
+    <!-- ======================================================================================= -->
+    <xs:complexType name="TaskType">
+        <xs:sequence minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="Output">
+                <xs:annotation>
+                    <xs:documentation>Optional element specifying a specific task output to be gathered</xs:documentation>
+                </xs:annotation>
+                <xs:complexType>
+                    <xs:attribute name="TaskParameter" type="msb:non_empty_string" use="required">
+                        <xs:annotation>
+                            <xs:documentation>Task parameter to gather. Matches the name of a .NET Property on the task class that has an [Output] attribute</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                    <xs:attribute name="ItemName" type="msb:non_empty_string" use="optional">
+                        <xs:annotation>
+                            <xs:documentation>Optional name of an item list to put the gathered outputs into. Either ItemName or PropertyName must be specified</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                    <xs:attribute name="PropertyName" type="msb:non_empty_string" use="optional">
+                        <xs:annotation>
+                            <xs:documentation>Optional name of a property to put the gathered output into. Either PropertyName or ItemName must be specified</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                    <xs:attribute name="Condition" type="xs:string" use="optional">
+                        <xs:annotation>
+                            <xs:documentation>Optional expression evaluated to determine whether the output should be gathered</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute name="Condition" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional expression evaluated to determine whether the task should be executed</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="ContinueOnError" type="msb:non_empty_string" use="optional">
+            <xs:annotation>
+                <xs:documentation>Optional boolean indicating whether a recoverable task error should be ignored. Default false</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>            
+        <!-- We don't need the anyAttribute here because other types deriving from this type will add the right attributes.-->
+    </xs:complexType>
+    <!-- ======================================================================================= -->  
+    <!-- XSD considers an empty-valued attribute to satisfy use="required", but we want it to have a non-empty value in most cases, hence this utility type. -->
+    <xs:simpleType name="non_empty_string">
+        <xs:restriction base="xs:string">
+            <xs:minLength value="1"/>
+        </xs:restriction>
+    </xs:simpleType>
+</xs:schema>
diff --git a/mcs/tools/xbuild/Main.cs b/mcs/tools/xbuild/Main.cs
new file mode 100644 (file)
index 0000000..834bce8
--- /dev/null
@@ -0,0 +1,296 @@
+//
+// Main.cs: Main program file of command line utility.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+using Mono.XBuild.Shared;
+
+namespace Mono.XBuild.CommandLine {
+       public class MainClass {
+               
+               Parameters      parameters;
+               string[]        args;
+               string          binPath;
+               string          defaultSchema;
+               
+               Engine          engine;
+               Project         project;
+               
+               public static void Main (string[] args)
+               {
+                       MainClass mc = new MainClass ();
+                       mc.args = args;
+                       mc.Execute ();
+               }
+               
+               public MainClass ()
+               {
+                       binPath = Path.GetDirectoryName (typeof (object).Assembly.Location);
+                       defaultSchema = Path.Combine (binPath, "Microsoft.Build.xsd");
+                       parameters = new Parameters (this);
+               }
+               
+               public void Execute ()
+               {
+                       try {
+                               parameters.ParseArguments (args);
+                               
+                               if (parameters.DisplayVersion == true)
+                                       Display (version);
+                               
+                               engine  = new Engine (binPath);
+                               
+                               engine.GlobalProperties = this.parameters.Properties;
+                               
+                               if (parameters.NoConsoleLogger == false ) {
+                                       ConsoleLogger cl = new ConsoleLogger ();
+                                       cl.Parameters = parameters.ConsoleLoggerParameters;
+                                       cl.Verbosity = parameters.LoggerVerbosity; 
+                                       engine.RegisterLogger (cl);
+                               }
+                               
+                               foreach (LoggerInfo li in parameters.Loggers) {
+                                       Assembly assembly;
+                                       if (li.InfoType == LoadInfoType.AssemblyFilename)
+                                               assembly = Assembly.LoadFrom (li.Filename);
+                                       else
+                                               assembly = Assembly.Load (li.AssemblyName);
+                                       ILogger logger = (ILogger)Activator.CreateInstance (assembly.GetType (li.ClassName));
+                                       logger.Parameters = li.Parameters;
+                                       engine.RegisterLogger (logger); 
+                               }
+                               
+                               project = engine.CreateNewProject ();
+                               
+                               if (parameters.Validate == true) {
+                                       if (parameters.ValidationSchema == null)
+                                               project.SchemaFile = defaultSchema;
+                                       else
+                                               project.SchemaFile = parameters.ValidationSchema;
+                               }
+
+                               project.LoadFromFile (parameters.ProjectFile);
+                               
+                               engine.BuildProject (project, parameters.Targets, new Hashtable ());
+                       }
+                       catch (CommandLineException cex) {
+                               switch (cex.ErrorCode) {
+                               case 1:
+                                       ReportErrorFromException (cex);
+                                       break;
+                               case 2:
+                                       ReportErrorFromException (cex);
+                                       break;
+                               case 3:
+                                       if (parameters.NoLogo)
+                                               ReportErrorFromException (cex);
+                                       else {
+                                               Display (version);
+                                               Display (usage);
+                                       }
+                                       break;
+                               case 4:
+                                       ReportErrorFromException (cex);
+                                       break;
+                               case 5:
+                                       Version ();
+                                       break;
+                               case 6:
+                                       Usage ();
+                                       break;
+                               case 7:
+                                       ReportErrorFromException (cex);
+                                       break;
+                               default:
+                                       throw;
+                               }
+                       }
+                       catch (InvalidProjectFileException ipfe ) {
+                               ReportError (0008, ipfe.Message);
+                       }
+                       catch (Exception ex) {
+                               ReportError (0, String.Format ("{0}\n{1}",ex.Message, ex.StackTrace));
+                       }
+                       finally {
+                               if (engine != null)
+                                       engine.UnregisterAllLoggers ();
+                       }
+               }
+               
+               private void Display (string[] array) {
+                       foreach (string s in array)
+                               Console.WriteLine (s);
+               }
+               
+               private void Version ()
+               {
+                       Display (version);
+                       Environment.Exit (0);
+               }
+               
+               private void Usage ()
+               {
+                       Display (version);
+                       Display (usage);
+                       Environment.Exit (0);
+               }
+               
+               private void ReportErrorFromException (CommandLineException cex)
+               {
+                       ReportError (cex.ErrorCode, cex.Message);
+               }
+               
+                private void ReportError (int errorNum, string msg) {
+                        Console.WriteLine (String.Format ("MSBUILD: error MSBUILD{0:0000}: {1}", errorNum, msg));
+                        Environment.Exit (1);
+                }
+
+                private void ReportWarning (int errorNum, string msg) {
+                        Console.WriteLine (String.Format ("MSBUILD: warning MSBUILD{0:0000}: {1}", errorNum, msg));
+                }
+
+                private void ReportInvalidArgument (string option, string value) {
+                        ReportError (1012, String.Format ("'{0}' is not a valid setting for option '{1}'", value, option));
+                }
+
+                private void ReportMissingArgument (string option) {
+                        ReportError (1003, String.Format ("Compiler option '{0}' must be followed by an argument", option));
+                }
+
+                private void ReportNotImplemented (string option) {
+                        ReportError (0, String.Format ("Compiler option '{0}' is not implemented", option));
+                }
+
+                private void ReportMissingFileSpec (string option) {
+                        ReportError (1008, String.Format ("Missing file specification for '{0}' command-line option", option));
+                }
+
+                private void ReportMissingText (string option) {
+                        ReportError (1010, String.Format ("Missing ':<text>' for '{0}' option", option));
+                }
+
+               string[] usage = {
+                       "",
+                       "Syntax:              xbuild.exe [options] [project file]",
+                       "",
+                       "Description:         Builds the specified targets in the project file. If",
+                       "                     a project file is not specified, MSBuild searches the",
+                       "                     current working directory for a file that has a file",
+                       "                     extension that ends in \"proj\" and uses that file.",
+                       "",
+                       "Switches:",
+                       "",
+                       "  /help              Display this usage message. (Short form: /? or /h)",
+                       "",
+                       "  /nologo            Do not display the startup banner and copyright message.",
+                       "",
+                       "  /version           Display version information only. (Short form: /ver)",
+                       "",
+                       "  @<file>            Insert command-line settings from a text file. To specify",
+                       "                     multiple response files, specify each response file",
+                       "                     separately.",
+                       "",
+                       "  /noautoresponse    Do not auto-include the MSBuild.rsp file. (Short form:",
+                       "                     /noautorsp)",
+                       "",
+                       "  /target:<targets>  Build these targets in this project. Use a semicolon or a",
+                       "                     comma to separate multiple targets, or specify each",
+                       "                     target separately. (Short form: /t)",
+                       "                     Example:",
+                       "                       /target:Resources;Compile",
+                       "",
+                       "  /property:<n>=<v>  Set or override these project-level properties. <n> is",
+                       "                     the property name, and <v> is the property value. Use a",
+                       "                     semicolon or a comma to separate multiple properties, or",
+                       "                     specify each property separately. (Short form: /p)",
+                       "                     Example:",
+                       @"                       /property:WarningLevel=2;OutDir=bin\Debug\",
+                       "",
+                       "  /logger:<logger>   Use this logger to log events from MSBuild. To specify",
+                       "                     multiple loggers, specify each logger separately.",
+                       "                     The <logger> syntax is:",
+                       "                        [<logger class>,]<logger assembly>[;<logger parameters>]",
+                       "                     The <logger class> syntax is:",
+                       "                        [<partial or full namespace>.]<logger class name>",
+                       "                     The <logger assembly> syntax is:",
+                       "                        {<assembly name>[,<strong name>] | <assembly file>}",
+                       "                     The <logger parameters> are optional, and are passed",
+                       "                     to the logger exactly as you typed them. (Short form: /l)",
+                       "                     Examples:",
+                       "                       /logger:XMLLogger,MyLogger,Version=1.0.2,Culture=neutral",
+                       @"                       /logger:XMLLogger,C:\Loggers\MyLogger.dll;OutputAsHTML",
+                       "",
+                       "  /verbosity:<level> Display this amount of information in the event log.",
+                       "                     The available verbosity levels are: q[uiet], m[inimal],",
+                       "                     n[ormal], d[etailed], and diag[nostic]. (Short form: /v)",
+                       "                     Example:",
+                       "                       /verbosity:quiet",
+                       "",
+                       "  /consoleloggerparameters:<parameters>",
+                       "                     Parameters to console logger. (Short form: /clp)",
+                       "                     The available parameters are:",
+                       "                        PerformanceSummary--show time spent in tasks, targets",
+                       "                            and projects.",
+                       "                        NoSummary--don't show error and warning summary at the",
+                       "                            end.",
+                       "                     Example:",
+                       "                        /consoleloggerparameters:PerformanceSummary;NoSummary",
+                       "",
+                       "  /noconsolelogger   Disable the default console logger and do not log events",
+                       "                     to the console. (Short form: /noconlog)",
+                       "",
+                       "  /validate          Validate the project against the default schema. (Short",
+                       "                     form: /val)",
+                       "",
+                       "  /validate:<schema> Validate the project against the specified schema. (Short",
+                       "                     form: /val)",
+                       "                     Example:",
+                       "                       /validate:MyExtendedBuildSchema.xsd",
+                       "",
+                       "Examples:",
+                       "",
+                       "        MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release",
+                       "        MSBuild MyApp.csproj /t:Clean /p:Configuration=Debug",
+               };
+               
+               string[] version = {
+                       "XBuild Engine Version 0.1",
+                       String.Format ("Mono, Version {0}", Consts.MonoVersion),
+                       "Copyright (C) Marek Sieradzki 2005. All rights reserved.",
+               };
+               
+               internal string BinPath {
+                       get { return binPath; }
+               }
+       }
+}
diff --git a/mcs/tools/xbuild/Makefile b/mcs/tools/xbuild/Makefile
new file mode 100644 (file)
index 0000000..0cdb590
--- /dev/null
@@ -0,0 +1,22 @@
+thisdir = tools/xbuild
+SUBDIRS = 
+include ../../build/rules.make
+
+LOCAL_MCS_FLAGS = -r:Microsoft.Build.Framework.dll -r:Microsoft.Build.Utilities.dll -r:Microsoft.Build.Engine.dll
+PROGRAM = xbuild.exe
+
+include ../../build/executable.make
+
+# FIXME: it causes warnings, maybe only part of executable.make should be included?
+
+install-local:
+       $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib/mono/1.0
+       $(INSTALL_DATA) xbuild.rsp $(DESTDIR)$(prefix)/lib/mono/1.0
+       $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib/mono/1.0
+       $(INSTALL_DATA) Microsoft.Build.xsd $(DESTDIR)$(prefix)/lib/mono/1.0
+       $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib/mono/1.0
+       $(INSTALL_DATA) Microsoft.Common.tasks $(DESTDIR)$(prefix)/lib/mono/1.0
+       $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib/mono/1.0/MSBuild
+       $(INSTALL_DATA) MSBuild/Microsoft.Build.Commontypes.xsd $(DESTDIR)$(prefix)/lib/mono/1.0/MSBuild
+       $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib/mono/1.0/MSBuild
+       $(INSTALL_DATA) MSBuild/Microsoft.Build.Core.xsd $(DESTDIR)$(prefix)/lib/mono/1.0/MSBuild
diff --git a/mcs/tools/xbuild/Microsoft.Build.xsd b/mcs/tools/xbuild/Microsoft.Build.xsd
new file mode 100644 (file)
index 0000000..2bbff03
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003" 
+xmlns:xs="http://www.w3.org/2001/XMLSchema"
+xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003"
+elementFormDefault="qualified">
+
+    <!-- =================== IMPORT COMMON SCHEMA =========================== -->
+    <xs:include schemaLocation="MSBuild\Microsoft.Build.CommonTypes.xsd"/>
+
+    <!-- ========= ADD CUSTOM ITEMS, PROPERTIES, AND TASKS BELOW ======= -->
+    <!-- Note that these will be in the msbuild namespace. A future version of
+        msbuild may require that custom itemtypes, properties, and tasks be in a 
+        custom namespace, but currently msbuild only supports the msbuild namespace. -->
+    
+    <!-- example custom itemtype with particular meta-data required-->
+    <!--<xs:element name="MyItem" substitutionGroup="msb:Item">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:SimpleItemType">
+                    <xs:sequence maxOccurs="1">
+                        <xs:choice>
+                            <xs:element name="MyMetaData" type="xs:string"/>
+                        </xs:choice>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>-->
+    
+    <!-- Example custom itemtype with NO meta-data -->
+    <!--<xs:element name="MySimpleItem" type="msb:SimpleItemType" substitutionGroup="msb:Item"/>-->
+    
+    <!-- Example custom itemtype with ANY meta-data -->
+    <!--<xs:element name="MyFlexibleItem" type="msb:GenericItemType" substitutionGroup="msb:Item"/>-->
+
+    <!-- example custom property that allows string content only-->
+    <!--<xs:element name="MySimpleProperty" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>-->
+
+    <!-- example custom task with single required parameter-->
+    <!--<xs:element name="MyTask" substitutionGroup="msb:Task">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="msb:TaskType">
+                    <xs:attribute name="MyParameter" type="xs:boolean" use="required"/>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>-->
+    
+</xs:schema>
diff --git a/mcs/tools/xbuild/Microsoft.Common.tasks b/mcs/tools/xbuild/Microsoft.Common.tasks
new file mode 100644 (file)
index 0000000..2b670ed
--- /dev/null
@@ -0,0 +1,23 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <UsingTask TaskName="Microsoft.Build.Tasks.AL"                  AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Copy"                AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.CreateItem"          AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.CreateProperty"      AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Csc"                 AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Delete"              AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Error"               AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Exec"                AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.FindUnderPath"       AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.GenerateResource"    AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.GetFramworkPath"     AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.GetFramworkSdkPath"  AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.MakeDir"             AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Message"             AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.MSBuild"             AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.ReadLinesFromFile"   AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.RemoveDir"           AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.SignFile"            AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Touch"               AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.Warning"             AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.WriteLinesToFile"    AssemblyName="Microsoft.Build.Tasks, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+</Project>
diff --git a/mcs/tools/xbuild/Parameters.cs b/mcs/tools/xbuild/Parameters.cs
new file mode 100644 (file)
index 0000000..8b4f80a
--- /dev/null
@@ -0,0 +1,315 @@
+//
+// Parameters.cs: Class that contains information about command line parameters
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2005 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Text;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Mono.XBuild.CommandLine {
+       public class Parameters {
+       
+               string                  consoleLoggerParameters;
+               bool                    displayHelp;
+               bool                    displayVersion;
+               IList                   flatArguments;
+               IList                   loggers;
+               LoggerVerbosity         loggerVerbosity;
+               bool                    noConsoleLogger;
+               bool                    noLogo;
+               string                  projectFile;
+               BuildPropertyGroup      properties;
+               IList                   remainingArguments;
+               Hashtable               responseFiles;
+               string[]                targets;
+               bool                    validate;
+               string                  validationSchema;
+               
+               string                  responseFile;
+       
+               public Parameters (MainClass mc)
+               {
+                       consoleLoggerParameters = "";
+                       displayHelp = false;
+                       displayVersion = true;
+                       loggers = new ArrayList ();
+                       loggerVerbosity = LoggerVerbosity.Normal;
+                       noConsoleLogger = false;
+                       noLogo = false;
+                       properties = new BuildPropertyGroup ();
+                       targets = new string [0];
+                       
+                       responseFile = Path.Combine (mc.BinPath, "xbuild.rsp");
+               }
+               
+               public void ParseArguments (string[] args)
+               {
+                       bool autoResponse = true;
+                       flatArguments = new ArrayList ();
+                       remainingArguments = new ArrayList ();
+                       responseFiles = new Hashtable ();
+                       foreach (string s in args) {
+                               if (s.StartsWith ("/noautoresponse") || s.StartsWith ("/noautorsp")) {
+                                       autoResponse = false;
+                                       continue;
+                               }
+                               if (s [0] != '@') {
+                                       flatArguments.Add (s);
+                                       continue;
+                               }
+                               string responseFilename = Path.GetFullPath (s.Substring (1));
+                               if (responseFiles.ContainsKey (responseFilename))
+                                       throw new CommandLineException ("We already have " + responseFilename + "file.", 0001);
+                               responseFiles [responseFilename] = responseFilename;
+                               LoadResponseFile (responseFilename);
+                       }
+                       if (autoResponse == true) {
+                               // FIXME: we do not allow nested auto response file
+                               LoadResponseFile (responseFile);
+                       }
+                       foreach (string s in flatArguments) {
+                               if (s [0] == '/') {
+                                       ParseFlatArgument (s);
+                               } else
+                                       remainingArguments.Add (s);
+                       }
+                       if (remainingArguments.Count == 0) {
+                               string[] files = Directory.GetFiles (Directory.GetCurrentDirectory (), "*.??proj");
+                               if (files.Length > 0)
+                                       projectFile = files [0];
+                               else
+                                       throw new CommandLineException ("No .proj file specified and no found in current directory.", 0003);
+                       } else if (remainingArguments.Count == 1) {
+                               projectFile = (string) remainingArguments [0];
+                       } else {
+                               throw new CommandLineException ("Too many project files specified.", 0004);
+                       }
+               }
+               
+               private void LoadResponseFile (string filename)
+               {
+                       StreamReader sr = null;
+                       string line;
+                       try {
+                               sr = new StreamReader (filename);
+                                StringBuilder sb = new StringBuilder ();
+
+                                while ((line = sr.ReadLine ()) != null) {
+                                        int t = line.Length;
+
+                                        for (int i = 0; i < t; i++) {
+                                                char c = line [i];
+
+                                                if (c == '"' || c == '\'') {
+                                                        char end = c;
+
+                                                        for (i++; i < t; i++) {
+                                                                c = line [i];
+
+                                                                if (c == end)
+                                                                        break;
+                                                                sb.Append (c);
+                                                        }
+                                                } else if (c == ' ') {
+                                                        if (sb.Length > 0) {
+                                                                flatArguments.Add (sb.ToString ());
+                                                                sb.Length = 0;
+                                                        }
+                                                } else
+                                                        sb.Append (c);
+                                        }
+                                        if (sb.Length > 0){
+                                                flatArguments.Add (sb.ToString ());
+                                                sb.Length = 0;
+                                        }
+                                }
+                        } catch (Exception ex) {
+                                throw new CommandLineException ("Error during loading response file.", ex, 0002);
+                        } finally {
+                                if (sr != null)
+                                        sr.Close ();
+                        }
+               }
+               
+               private void ParseFlatArgument (string s)
+               {
+                       switch (s) {
+                       case "/help":
+                       case "/h":
+                       case "/?":
+                               throw new CommandLineException ("Show usage", 0006);
+                       case "/nologo":
+                               noLogo = true;
+                               break;
+                       case "/version":
+                       case "/ver":
+                               throw new CommandLineException ("Show version", 0005);
+                       case "/noconsolelogger":
+                       case "/noconlog":
+                               noConsoleLogger = true;
+                               break;
+                       case "/validate":
+                       case "/val":
+                               validate = true;
+                               break;
+                       default:
+                               if (s.StartsWith ("/target:") || s.StartsWith ("/t:")) {
+                                       ProcessTarget (s);
+                               }
+                               if (s.StartsWith ("/property:") || s.StartsWith ("/p:")) {
+                                       ProcessProperty (s);
+                               }
+                               if (s.StartsWith ("/logger:") || s.StartsWith ("/l:")) {
+                                       ProcessLogger (s);
+                               }
+                               if (s.StartsWith ("/verbosity:") || s.StartsWith ("/v:")) {
+                                       ProcessVerbosity (s);
+                               }
+                               if (s.StartsWith ("/consoleloggerparameters:") || s.StartsWith ("/clp:")) {
+                                       ProcessConsoleLoggerParameters (s);
+                               }
+                               if (s.StartsWith ("/validate:") || s.StartsWith ("/val:")) {
+                                       ProcessValidate (s);
+                               }
+                               break;
+                       }
+               }
+               
+               internal void ProcessTarget (string s)
+               {
+                       string[] temp = s.Split (':');
+                       targets = temp [1].Split (';');
+               }
+               
+               internal void ProcessProperty (string s)
+               {
+                       string[] parameter, splittedProperties, property;
+                       parameter = s.Split (':');
+                       splittedProperties = parameter [1].Split (';');
+                       foreach (string st in splittedProperties) {
+                               property = st.Split ('=');
+                               properties.AddNewProperty (property [0], property [1]);
+                       }
+               }
+               
+               internal void ProcessLogger (string s)
+               {
+                       loggers.Add (new LoggerInfo (s));
+               }
+               
+               internal void ProcessVerbosity (string s)
+               {
+                       string[] temp = s.Split (':');
+                       switch (temp [1]) {
+                       case "q":
+                       case "quiet":
+                               loggerVerbosity = LoggerVerbosity.Quiet;
+                               break;
+                       case "m":
+                       case "minimal":
+                               loggerVerbosity = LoggerVerbosity.Minimal;
+                               break;
+                       case "n":
+                       case "normal":
+                               loggerVerbosity = LoggerVerbosity.Normal;
+                               break;
+                       case "d":
+                       case "detailed":
+                               loggerVerbosity = LoggerVerbosity.Detailed;
+                               break;
+                       case "diag":
+                       case "diagnostic":
+                               loggerVerbosity = LoggerVerbosity.Diagnostic;
+                               break;
+                       }
+               }
+               
+               internal void ProcessConsoleLoggerParameters (string s)
+               {
+                       consoleLoggerParameters = s; 
+               }
+               
+               internal void ProcessValidate (string s)
+               {
+                       string[] temp;
+                       validate = true;
+                       temp = s.Split (':');
+                       validationSchema = temp [1];
+               }
+               public bool DisplayHelp {
+                       get { return displayHelp; }
+               }
+               
+               public bool NoLogo {
+                       get { return noLogo; }
+               }
+               
+               public bool DisplayVersion {
+                       get { return displayVersion; }
+               }
+               
+               public string ProjectFile {
+                       get { return projectFile; }
+               }
+               
+               public string[] Targets {
+                       get { return targets; }
+               }
+               
+               public BuildPropertyGroup Properties {
+                       get { return properties; }
+               }
+               
+               public IList Loggers {
+                       get { return loggers; }
+               }
+               
+               public LoggerVerbosity LoggerVerbosity {
+                       get { return loggerVerbosity; }
+               }
+               
+               public string ConsoleLoggerParameters {
+                       get { return consoleLoggerParameters; }
+               }
+               
+               public bool NoConsoleLogger {
+                       get { return noConsoleLogger; }
+               }
+               
+               public bool Validate {
+                       get { return validate; }
+               }
+               
+               public string ValidationSchema {
+                       get { return validationSchema; }
+               }
+               
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/xbuild/README b/mcs/tools/xbuild/README
new file mode 100644 (file)
index 0000000..86102cb
--- /dev/null
@@ -0,0 +1,11 @@
+This is Microsoft.Build(XBuild) implementation. It will consist of:
+
+Microsoft.Build.Engine
+Microsoft.Build.Framework
+Microsoft.Build.Tasks
+Microsoft.Build.Utilities
+
+There are .targets files that can be used to build XBuild. To do it you must have finished build in xbuild/bin/Debug.
+Microsoft.Build.csproj is not a regular VS2005 project.
+
+It is licensed on MIT X11 license.
diff --git a/mcs/tools/xbuild/XBuild.targets b/mcs/tools/xbuild/XBuild.targets
new file mode 100644 (file)
index 0000000..bbaa91e
--- /dev/null
@@ -0,0 +1,25 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <ItemGroup>
+               <XBuildSources Include="xbuild/*.cs" />
+               <XBuildExe Include="xbuild.exe" />
+               <!-- not all of them are really used -->
+               <XBuildReferences Include="Microsoft.Build.Engine.dll" />
+               <XBuildReferences Include="Microsoft.Build.Framework.dll" />
+               <XBuildReferences Include="Microsoft.Build.Utilities.dll" />
+               <XBuildReferences Include="Microsoft.Build.Tasks.dll" />
+       </ItemGroup>
+       <Target
+               Name="XBuild"
+               DependsOnTargets="MicrosoftBuildEngine"
+               Inputs="@(XBuildSources)"
+               Outputs="@(XBuildExe)"
+       >
+               <Csc
+                       Sources="@(XBuildSources)"
+                       TargetType="exe"
+                       OutputAssembly="@(XBuildExe)"
+                       References="@(XBuildReferences)"
+                       WarningLevel="3"
+               />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/AL/AL.csproj b/mcs/tools/xbuild/tests/AL/AL.csproj
new file mode 100644 (file)
index 0000000..ec8d118
--- /dev/null
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <Target Name="Main" >
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/ChangeLog b/mcs/tools/xbuild/tests/ChangeLog
new file mode 100644 (file)
index 0000000..80bfaae
--- /dev/null
@@ -0,0 +1,15 @@
+2005-09-11  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * Touch.csproj, Message.csproj, Exec.csproj, WriteLinesToFile.csproj,
+       Error.csproj, ReadLinesFromFile.csproj, FindUnderPath.csproj,
+       RemoveDir.csproj, AL.csproj, MSBuild.csproj, SignFile.csproj,
+       GenerateResource.csproj, Delete.csproj, Warning.csproj, Copy.csproj,
+       MakeDir.csproj: Changed path to Microsoft.Common.tasks to use
+       MSBuildBinPath.
+
+2005-09-03  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * AL, Copy, CreateItem, CreateProperty, Error, Exec, FindUnderPath,
+       GenerateResource, MakeDir, Message, MSBuild, ReadLinesFromFile,
+       RemoveDir, SignFile, Touch, Warning, WriteLinesToFile: Created
+       separate directories for each task test.
diff --git a/mcs/tools/xbuild/tests/Copy/Copy.csproj b/mcs/tools/xbuild/tests/Copy/Copy.csproj
new file mode 100644 (file)
index 0000000..d20bb0b
--- /dev/null
@@ -0,0 +1,16 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <FilesToCopy Include="a;b" />
+       </ItemGroup>
+       <Target Name="Main" >
+               <Touch Files="@(FilesToCopy)" AlwaysCreate="true" >
+                       <Output TaskParameter="TouchedFiles" ItemName="TouchedFiles" />
+               </Touch>
+               <Message Text="@(TouchedFiles) -> @(TouchedFiles->'%(Filename).copy')" />
+               <Copy SourceFiles="@(TouchedFiles)" DestinationFiles="@(TouchedFiles->'%(Filename).copy')">
+                       <Output TaskParameter="CopiedFiles" ItemName="CopiedFiles" />
+               </Copy>
+               <Message Text="Successfully copied files are: @(CopiedFiles)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Delete/Delete.csproj b/mcs/tools/xbuild/tests/Delete/Delete.csproj
new file mode 100644 (file)
index 0000000..cc47133
--- /dev/null
@@ -0,0 +1,13 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <Files Include="a;b;c" />
+       </ItemGroup>
+       <Target Name="Main" >
+               <Touch Files="@(Files)" AlwaysCreate="true"/>
+               <Delete Files="@(Files)" >
+                       <Output TaskParameter="DeletedFiles" ItemName="DeletedFiles" />
+               </Delete>
+               <Message Text="Successfully deleted files are: @(DeletedFiles)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Error/Error.csproj b/mcs/tools/xbuild/tests/Error/Error.csproj
new file mode 100644 (file)
index 0000000..1e698e8
--- /dev/null
@@ -0,0 +1,6 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <Target Name="Main" >
+               <Error Text="Error's text." />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Exec/Exec.csproj b/mcs/tools/xbuild/tests/Exec/Exec.csproj
new file mode 100644 (file)
index 0000000..e01203e
--- /dev/null
@@ -0,0 +1,14 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <PropertyGroup>
+               <Command>ls</Command>
+       </PropertyGroup>
+       <Target Name="Main" >
+               <Exec Command="$(Command)" >
+                       <Output TaskParameter="ExitCode" PropertyName="ExitCode" />
+                       <Output TaskParameter="Outputs" ItemName="Outputs" />
+               </Exec>
+               <Message Text="'$(Command)' execution returned with $(ExitCode)" />
+               <Message Text="It produced this outputs: @(Outputs)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/FindUnderPath/FindUnderPath.csproj b/mcs/tools/xbuild/tests/FindUnderPath/FindUnderPath.csproj
new file mode 100644 (file)
index 0000000..5286724
--- /dev/null
@@ -0,0 +1,16 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <Files Include="dir/a;a" />
+       </ItemGroup>
+       <Target Name="Main" >
+               <MakeDir Directories="dir" />
+               <Touch Files="@(Files)" AlwaysCreate="true"/>
+               <FindUnderPath Files="@(Files)" Path="dir">
+                       <Output TaskParameter="InPath" ItemName="InPath" />
+                       <Output TaskParameter="OutOfPath" ItemName="OutOfPath" />
+               </FindUnderPath>
+               <Message Text="Files in path: @(InPath)" />
+               <Message Text="Files out of path: @(OutOfPath)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/GenerateResource/GenerateResource.csproj b/mcs/tools/xbuild/tests/GenerateResource/GenerateResource.csproj
new file mode 100644 (file)
index 0000000..31da1a4
--- /dev/null
@@ -0,0 +1,13 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <Files Include="Sample.resx" />
+       </ItemGroup>
+       <Target Name="Main" >
+               <GenerateResource Sources="@(Files)" OutputResources="@(Files->'%(Filename).resources')"/>
+       </Target>
+       
+       <Target Name="Clean" >
+               <Delete Files="@(Files->'%(Filename).resources')" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/GenerateResource/Sample.resx b/mcs/tools/xbuild/tests/GenerateResource/Sample.resx
new file mode 100644 (file)
index 0000000..413aeb8
--- /dev/null
@@ -0,0 +1,831 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 1.3
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">1.3</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1">this is my long string</data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        [base64 mime encoded serialized .NET Framework object]
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        [base64 mime encoded string representing a byte array form of the .NET Framework object]
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used forserialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>1.3</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="last_open" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAADftJREFUaEPVmntY
+        1FUax0efbbtaarr12D5bu6WbopZ5SVs1a3fV2rQsUcu8FJqlKCZkF9t1H7VUFBQVCXVFzTIIROU+DJoK
+        iCggKgjC3JgZ5sZlbiAzot993zMMgjLjpT/W5Xk+npnf5Zz3e8573vOeM3YaGG0ddv89nX7fWSLpJKG/
+        zuJf91+nTq3XWq/SffdntHtOfGm91/bdlnrb1t2J/q4CpvT3usiu1XKHn+YkNRwuNV2GN0qMLvjivNEJ
+        X5wzONERX2VZry5IdWwCIPk1SIIyGjKuXr0Kb1y5cgU3o7m5Gd64fPkyOiK+xAGZvOkKiVj1fyuAheVr
+        m5oDUx1L71TE/3QEWICLKDU2XZmb5PjoTkTcVAC71q9xIXYtby7kEWBpdOKIvKF59kGH/+2KuGsElOjt
+        iCu2Xp6e6Bh3OyLuCgHWRop0JEBWVoetefUu/3j78FsVcXcIuORCqYEElNfh+1NGfHu4pum1H+39bkXE
+        XSUgq0VAaFYVlqaaGl+KsT15MxF3rYCQAwp8ctBo/9Nma09fIv5nAgp1jQjKuCxYlOHCwnQXAltYQOWC
+        NDcTfrLuvSsFcAiVKZoFmfLLXnk3wb7zjgV44r+vVMFbnG8b+10uF3zhdDrREY2XmvDefvsOnwIWptmk
+        3vIVz/U7NcBjVFNTE3xx6dIlNDY23oC9oRHT99u3+xaQapV664HbMcCbEWxYQ0ODTxwOBzrCYm/AjET7
+        Np8CApPrpdw4s7vYgJAs1TVkSoTcAsGZCtyMT9MrMG1DHEbODsbgie/Db9RYPP3cMPiNHIshE6Zj1Owl
+        eC98H/YUqGGz2QS1FjtmHrBH+xQw/1BNpsPRQD3gHbvdAV/YbHZqsGNyc09gypSpeLT7oxj8wmAsXvwp
+        wsPC8eOP+5CeniHK8PANWLIkGEOGDEX3bt0xebI/jh49BlOdDbNuKuBgTaYvA/ie1WrzicViRX19ewoK
+        ivDOO5Px5B+exLrQdSgpKYXRaLoppaUXhKCnnvojJkx8C6+vztzncwQ+OWDOtFhsYOKKqxF6XIV1zDEF
+        wo4rEZ5NcHlcgQ1UbqTvETkqQolNxOZcFSJPEFRupTKK+GD5BvTo+RhWrFyFqiqNMFqvNyA5OQVBixbj
+        r6/+Fc8/9zx69+6N5wY+h1fGvIp5H32M+PgE6HTV4nmtVofVq9egW/eernt/e6/XVFvy8X6jrLbWAqZS
+        V4PzVTU4pzbjLFGsMhFmFClNKFQaUaAw4jRxisiXG3CSyKs0ILfCgJyLBhy9oMXUmXPRt28/nDyZ39rb
+        UVFR8OvXHwEfBiAxMREqlUpEnK+//lpEJ7VajaSkJMz/ZD4G9B+AVatWCcEs5PTpAvR+prf9kYcf2UXb
+        8d9cPxqSefH6LLO5Hr4wmergC4OhBsycOXMxbux4KJUq0fiZM8UYP+41zJo5i9433bAW8ES9PkTztc9C
+        luKlES8hOztH1KNWV2Hs2HENJOL7GwR89LM+y2isowfroNbVQqGtcaMxQ0WlmkZFrTNDrTWjikptdQ10
+        AjOqqdTra6g0Y+WKbzBo0AvUu2rRaHh4uHCTtLQ0n4tYR2vMkSNHkJCQgBHDR4hRqq7WC1ccOGCg/YH7
+        H1jWVoRkbmx1FhvCbCP//jylDEuJz5LLEJx0AcHJF7DkUCmW0OdPqVx86AKCDpZiEbHwQCkCiSnr4/G7
+        x5/A+XPnhfHr1q2HP0WS+vr62zbeYrHgiSeeQGlpqQjtn1LUWrp0qaiXJ3iPR3vYyZVGeERI5v6kO6yl
+        3vWFRmOCL14cNgJRUd+JRjhsDnp+EAUFy20bz6MREBCAwMDA1nd5joweNRqpqWmi/pidMXi4y8PnSUQn
+        FiGZs093WK1mP/OOSmUk1+iY6O9iyOAXaA4YRQQZNnQY8vLy7sj42NhY9O/fXyxibV3r4sWLwh0VCqUQ
+        QZHLSgLeFQICftAeVlKEYWRnNEg6VYVk5nQVUgsILok0+pxOZBDSwipkFmqQWaTBsBGjsWf3HlFxMC1G
+        Kyl03ix34vtOpwd3IieXy9GrVy8UFRWJe9fXsWPHDsx4f4ZoJzY2Dt26disSAj78XnNELjdSBUbspTi/
+        RVaJzbIKbCIiiI2ZFQiXXkRYRjnCqFyfXo7QtHKsTS3Hv2Lz0KVLVzHBuHe4l3jIfWeeLnrGiaZLTvJx
+        Ll2UJ7ndZEP4xpZrdJ2euV7Iy6NfRn7+KTHSDz34UCONQk/JB3s0Ry5SDPdFebkeHbF69Ua89eYk0Svb
+        tm3HV19+5dV4NoaNYqMvkdGNtJFvaCAcLiz/1wqMH/+6+MzX+B4/wyKdbYRERkZixYoVor23J73d0LlT
+        5zmS2bs0v5SVGeCLCxf06Ig5AQsofK4UFU6bOs2r77caT+c/wnAy1G5zwmZxIkuWTVHn96is0MJa777G
+        9/gZIYTeYeE8qlqtFjwK3N7ataHo+kjXbZJZMZpfSksNFKIM+OGoEttlcuyQKbAzy02MQI5dVO6mUnBY
+        jj3EqL9NxE6KClzh8BeHdxg2Pca7XcVtuJWMLDmvwI7teymdeBY/x6agxuRCrdmFuloXLPUuIcRhJ8H0
+        DovwuFN/v/6iPZ53PXv0lEpm7tQcPXdOD+bHI0r8J5MEENuJbVI5ojPk+C69kpBja1olIoktqRXYQuWz
+        A4aKjJIrpEWmQ/cRbsM932K8hXq5WmfDM0/3xqwZs/GP197CsV/O4vTJSpSc1UEpp1Xf0IR6EsIjwoL5
+        XY8Azp24Pak0kzPcEsmMHVVHi4v18MWZM3pKC25k8ODhrQIoX0FISIjIcTyTWPQ++zy5AvcmG1RX40JB
+        fjlG/WW0iDh+/QYiInw31nwTheX/DMMXS1ciaOEXFO9j3SLESNC5ES1iXD/nSpwnZWRIeVE7L5mxXXOs
+        qMhAlXmnsFAPpqCgug16vDZ+EnbF7BI9MmTwELHrahuBeAJy77M/26xO1Ne5YKbfG/QaJ+bPC4Zf34GI
+        2Z6M8nNOQUWpE8oK8nWlCwatEzX0rIXesdO7TU3u0Opxod27dqMHu9D70Zpjp08bKOsz4D/pKmxJkiMy
+        WYGodpAb0ffoZHKrFAW2p7p53X8evv12tRAw4Y0JYvlv1/tCAPe+2x3Yx43VTuhULigvuoTRJYUunD1J
+        5NPxYoETF887oWIRaidMeveI8SjwaPLqzh3F7a1ZsxaU3G2TTP9Oeyw/30Dx1YCYNMrpk5SIJLYwhyjf
+        P6hAxAE5ocDGRDk2EOGJlYQc7y5ahzcmvCUq5Nw9LCysQwF2ch9LHfUoTVQ99WyVwoVK6m02uDDXhbwj
+        Tpz8xYkzeeQqZ2hRK3NBw6Ogc4vmCc0dExcXJ3Ijbm/SpLcdtA58IHlvq/Z4Xp6RQqB3TpwwgMnNbU96
+        ehn1QleR7p49ew5jXh7TsQCaiK0CyH2q5C5UlLh7/3S2C9lSJ3JlbjGlhSTggrOdgAaHW8BU2ppy0ODN
+        zoMPPMgLWQ/Ju5Ha4zk5RvgiO9tAuXnHDH9xjEiwuFfenPim2LB4UgV3BHJPYI4+3Jvs29y78jKn6G12
+        nwISUZBDbnTKhbKzTijKXcLN2N34Pa4vOzsbI/8yUrTD++hu3boXilRi2hZd9vHjJjBrYpVYG6tCKJXr
+        4mhbSaz/maAyLI62lfQ5PF6FDS1EUBnwWTT6USThZI4jBe+8eMHhRt0rr3vhYjdgf2a/1pF/qytpFMiN
+        yordrlRCPc/Gc+/zCFVXkWByOfZ9Tss5TeE0ggX49fOztSZz0zZXZx89aqZTADMiE6oQuV+DzVRuiid+
+        dpcbqQyPVSOshfVUrv9JjdCfSCyVffxeRETEptbeGT9ufMsouFOHa2sALVZklJF8myepmgxV0GTm0WB4
+        YvP8YIFGEtpIEUyk2LQV9dQfHb3tapeHulxLp6dG6HMOHzbDTU2HZGWZ4YuoKBkef6yX2EJyD334QQBC
+        Q0NF710/ChwWeTKze1TTfNCpKeKQu7DLsOEcYuvI1Xjk2HhOsSdOmCjq5Q0TLV7tNzRTNhpyZLJa+CIz
+        swa+kErNCApaR0M7QGSlvK2cTEcqDGeOIoHjHIjCKbsSpwrsThznTfQ7sonEsGvxd54vbDi7TeCCQIz9
+        +1jK08pFnXRYYL/vvvuD220p/cONOVJpHS3N7cnIqKPVzk16eq1P0tJqae9bC3//QIpEr1JqrhA9tnfv
+        D2Ll5MXOSQsRC2mbD/EEFSutjefJtXyHTyjY5z1uw4cEY8a84qCd2A3npJLJYabctLR6MsA7qan1tKXz
+        TkpKHZikpBpM8Q/C00/3oaiWK0RUVsoxc8ZMcRa0Z8+e1tMJdi+ZTNYadmtra4W7vPP2O3jjH2+IsMzv
+        5+WdxFNPPmUn46No4na+4VRi8vqa3JQUKxngneRkCx1KeScpqZ6Mt7Ty+ecxlCk+jmXL/tl6SnHs2HH6
+        vkycNLxApxejRo5C32f7ivSY99BD6VgxJDhEJGmeo5Tly/+Nrt0edd7zm3tmeDudk0z9wbpsXrwt8eN4
+        2wHi4CdMgu0QMz/BlsQsSLAlB+63pbSQunC/LXVhoi2NyvRFTKItPchNxuJEm3TxAZv0/Y0nsvsMHWvq
+        0fPx5pUrv7laXHxWGOZBoVCIw6+Kisp218/RRF397Rr87rFeV/487O9107+MmOnzaPFmP6L92vs07ANp
+        47GPVk4LZazWBQsCmzmP4cXv4MFDYn7w98DAhc19+vzZQuc+Vno+lt4bdCtt/6r/KXIrDXie4WMQYght
+        A0Mojm+lcJhC5NNpdCp9j6Lrn9H9YZ7jklut+7/JKVwBwotNkwAAAABJRU5ErkJggg==
+</value>
+  </data>
+  <data name="Red">
+    <value>Rot</value>
+  </data>
+  <data name="folder_with_paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
+        CxMBAJqcGAAAD0tJREFUaEPFmQlUVFeaxx/IUguKRo12MkmnuxM98cwkJmPapMdsRpOMY5bOMn1cMsak
+        R4OmoygtoJSC7IqyFzsoigIqKEsha0GxF1XUvldRFEUJKGuxC9Q330NRcAFcMqlz/tz77rvvvf/vu+t7
+        WBG/wu8/N26k4m3fHhgYeHkQ/3R3d6vUSqUSywZQll/hkU/vlv9w3kdlHPVezoxP2Oty0DN0j6v3cXdv
+        5h6v46f/6h92/hM3r7B1+9x93nFjeP7p6T31Kd1pv5u7raev3wpmXPwhoVLVfIlVdvNMZhWcyuRbQhIK
+        bgZEZpo9/KKvM3xOcv1PhHh5+vrORVk/pcc/+W0Q4K3UjMwglaHJ1Dk4NNLc2WPJ4aggIEkKgam9lqPx
+        6rGUXPEoX6kfUjUZFYHBwQzUs0/+5KdwBzcG44M8NjsSjWk6BgZHe8csYB4dA1VzJ5wv0MAvx4VwmqWB
+        InUraMwD0D4wOCDV6eSJKSm/eAcG/uEpWHi8W7gxjtA9vLw/YBWXxqsajbqO/qGx3lGACXUOjoBY3wGJ
+        uUpIl5sg63oPcPuH4drwKHQMDI/WiiRV6Veydx4+6vv7x3Pw+FdZMY74zA9jxr2fkp55Xtfc1tbZP2Ix
+        DwNMVjcetwyOgbjvJpxp74OEG2bI6OwHXu8wtA9ZoLVnYLSaLy48nZK+3fXgkUWPb+cRrlyyZCmx5bvt
+        9n6BJ9cnp1zMacUwd/VboHsApqgLj1uwvBYpIlt7IPl6H5y+3gtxbWZIwbzSPAo38Hzzjd6RGr6s2NM7
+        4Nt9LgdtUFaPYOfRqyKAfcDx0E2sgnKWsaXX3NFjsXSaATp7p8rYMwbF7UOQ1NoLZ1Hx18zjSmwxw6lW
+        TFHKrhFo6x61NDZ3d1VzZUVo/hOU46O7msUVb7+9Zg7KISw88Uc2R8DSNnS0t3cBdJDqvqsbeKzvGANW
+        6wCcudYLSaZeSEDFN99OTWaIQ53Gc+ev9YGo/Sa03BgZ0zV23Shm87Ijmac+ddrl/MwsLM2+yrp1G2wP
+        HvR9MSrq7LaiYj5bo+3sutEOcK9a2i2guj4KLNMgJDaZIRaVaETz9yjBaIYkLIvB85dN/SBqG4GWtpEx
+        taa972p+bWJsXOrH27btfHot8e033z3j7x/x+eXMUpFe3zfQ1gZA6vokmdosIGtB88ZBCNX3QGIj9ncU
+        sxG7jAEHcBMaNmArYD4JFYnlZ5v6IBrTi8Z+ULWOjt9PIr7WyWJVM48FRq/55uutFNTsI/2wmruc/rk8
+        MiKFIRG3DRubRiwt13CAolonSdI8Chca+8FP1wXp+j4Ib+iB6AbsKo1oVo/9H9NkVKweobA8HeuebOiG
+        U3icSJ5HTdxPwG++fjmDE4PmX0HNfrX+5BNiqZMT8QGDQfzv8ePEfiaT8E5KIiLOnLG9dO7cH4QX0reP
+        iOqlFkPDMJiMANdui9c4Aucb+oGpw2jr+iBI0wNxWow4HkfoeiAey2IbeiFKh90JlYD5EG03JDcgHNaJ
+        QqVgPhHPKZrGoKnh5oiAZ9KmnStkbvvO6aVPP/7Cbtpm2LaNsEGtuHKF8CgvJ7K5XIJbV0eIeDxCzecT
+        xvp6op3Pt+2rrfndWGnJARDV88GgG4UGvQXKdMNwVtsHcRo0qDFDuNoM0epeiMSUicfRWM5ERWM+BtNx
+        IVw8ppHj52+JzCdq+uCKbhBE+lHQqQaH6qqNmqT4bD9fb+aK/3hn7cMhXFwIKmpzZSVRo9MRoyYTAQ9T
+        Tc3LUMnxBBFPChLNKISpelAYRRUCKDGyyh6IwTRCiQBYHo3lEXhM5mPIOigyH4dpONaNwjx5HIb141UY
+        CBRLMwRi7RjoFMPDZUXqhuTEq64+R5ivvvynV+c8sCUCAwkHlLtIRCinMz9xrqryVSgp8IIqQTN4yzsh
+        TtEHEYpeCJbj7IL5QFk3xOBxFCpUgbMRppGYhiMIWRaNOibvHq8bosAA4LlEzAfgdXFyHOSKfriqHAaD
+        CsaVny2WJ0RlO//ixHj+gQBBQYQDioEA6tkANDVZQ13tCsi8cBSUkiE4I+uHBBlGD+WLJpKlfXBSisZk
+        GGk0dFLWAxEy7Dp4PhzTECkObrzGH+vGShEKy/wwf07aD0EkPB4Xy4dBL8c1BaWTjY3lZYqE/l4x+xHg
+        /lYICCDoKFcEUMwGgKyj01GBx30NcjPDoKLWCGniAQgXo2FJHxwX90Ak5iMkZghFg0wsC8d8CIpMmeLe
+        8ToxYoS7XR4jQQhxNyRg3WLJTRALb4KophtKcmWQlV4yFnwsUPb37WujN2yw+2bVKhs6gtzdcnh5EXTU
+        XgSQzhaguRkhtFSoKFsFZQVxkF+hg1TBAIQK0bQAzQp6IITMC7EbiTDqIiybEFle3wP+FQbwKhTD0bwa
+        8L9aDgFXi+BsfiHk518FTkEWcApToTSfOZqdccCYmrKxICT495G7d1NdNm+2nzsF4MABgobaIRQSotkC
+        kPVIiIYGKygrXg+c/NNQWN4Msbw+YPIxwrUdEFBhggC2DnzZcvAvlUBQqRCOlfLgWFkNRJVWgm/BZQjK
+        TYbg7CgIzwmGizlBcDXXD4pyD0Nx3gFLWeHu4drKLSZuzepCheLF2MrKBf5eXnRnFNkCd3+7dhFU1FYE
+        4M8WwGgkoLGRBCBALLaFwrz/grxL53GGaoPAKgOcLFGAT1YpuKWmgVdKPHifDwOf1AA4lnYYQtP/CSGZ
+        P8MFzl7IER8AjuoQSJWHQa88Mq4GBQOUov0j/JqtbTVV/5qj1T4XYTItOlZRseCoiwvtRxT54eDub+tW
+        goL6CgFqZwPQ1ESATEZAaSkBOTkEZGVZQ1rqXEiKXwlxkT/B6WQGxFx2hXNl7sASMiBX4gEsySHIxzRP
+        ehBYUjcolbpDjtwVKuUHQSY/DDo5Gr8tuWAv1Fb+tZNd8kqVXr80tLl58XESoLx8AeOHHyj/jaJMAfjs
+        M8Ie9TEuWJVkt5gMoVAQUFNjBWy2NWrOuEpLbaCqyhYEAjsEsUdRQCKhAp+3CMpLXwdO8fdQXrUP2EI3
+        KJS7Q7HiIJSgilAT+XyFO1TLMfIyBmhkR3CmuSUpfzeI69fjvV5pq65aVGA0LgoizZPicBa44iD+FGU/
+        BWDNGsIW9RauwCV6/VQALtdq3DCXa39HdXUU7DZU7D40hL0rY5MDaLWLQCxYDZL67cAXu0IFmiRNTxYb
+        o16F5TLZYdBI0ThKI0YY3i40vxaU8pdALndsraubdwdAq10YlJ8/3/nNN23eQNlOAVi2jJiDegm3Ebkq
+        FWGZ3ALl5dZQWWk3xehk0/fmjUY6qFXPgETwHpr5O9RjVylTkBDuwEaQUhQZeTWa194x7w6y+p0gqPsQ
+        lIrnwGCYi4Gg3+Dx5rGxBU6Q0edynzmZmjpv1+LFVktQ923wyDnVsaCAuCAWEyNTAeZgd7GfNcAEkFKx
+        GFvhfYTYDQKZB3ButwJX7nEn6mTktTgupPwdUM99FzRqRyADQN4DAToQoGICgMWaHxQc7LBtyvR5z7Js
+        k5VFJOEmrn8qANnfKY8MYDQ6gAqjKeS9B1LBfuDJDoEE+7v6dtRJ86RE3O9BxP8zGl6I0/It87cBuuvr
+        53InALKzHX18fenfTLcrtbp0iYiqqSG6JuZ4jYYYH6w83qMDkCYMhnkI8SJG9yOQCJ1BLWGMm74VeQYI
+        a7eAVPjvoNU8eyfykwDMCCAwGheOd6HLlx0PubnRNky7rU5LI4Krq4m2CYDaWgLN24JKRX3kFpgwYmic
+        B3LpC7h73QhK4R40fhjUOPeLeVtxsK9E84vR/NTJ4HYL9AsEDjIEOEkCXLzouH/nTsr70wKkpBABVVWE
+        kQQgFyocEyAS2WHT3v+A6Qby/QPbAUTCF0HC/xLk9U4grd8C9bwVoNfPf+i9dTraoFDooCYBmpsXHcMB
+        7PTFF3arpgVITiY88Z1ANwGQn2+NAI8+gB8GJxL8EaorXkPzy2YMCgLcRAA9CaDXLzyekjJv2+uv2yyb
+        FiAxkXBHgPEdKdkCTxuAHBONGHWDwXHGLolrzKhE4mBC82FFRfNDExLmfrZ0qTW5iXv4LyaGcMa1YHxD
+        dwvABlvg8Qbwo3SxB9VtbKRZlEr6Dbl8QWxa2rwT4eEOax/4LjAZJzyccOJwiDoSwGAgoLDQFlfc3waA
+        HNg6Hb2Lz5+fgtH3DQx0eGfa6JMnT5wgfigrIyrJzRquyMDh2OGS/vgz0JO2gsFA76mtdcxkMh08PDzo
+        b8wI4OdHbMEdJlurvbXTlErtccv8ZDPQk0AggBkBWCEhdOeff6aumBEAvwd9zWYT+WT08/KsQKOhzDhb
+        PInBma5FgF4ud16Rvz9t51df2f9xRoD9+4mNJSVEllJpBbm51uPvvTM95Nc8j63fX1bmUOHjQ/129Wqb
+        JTMC7NhBrCsqIi6qVCSAzW8OgGvBQGYmrS4wkLL2hResaTMC/O1vxJrCQuIcCcBi2f5WAGPYqjdRQ2o1
+        rTMujlIdFUWZeQCTdOvWEatw+5B0C8DutwDAdxG6GdVsMjnI1GoHTlQUNSksjLp8xuiTFVauJJZlZBDh
+        PJ41VFRQcK/yq8xAGF16D8qEJlUGg0O9WOxQVVhIL7l0iZ6Zmko/lZxMD4uLo/kGB9Ncdu+2/+qnn+xn
+        9/+zpUuJJfHxhH9hofWYUkl94C5xFoMWo0h2AXoP7u/b9Hq6QSSiaaqqaGIOh1bJZtPyioroqVev0mNz
+        cuhBGRl0j3Pn6D/FxNC/PnGCvu7oUfq7rq60Pzs5Ud/YtIny6kcf2T734Ye203+dntQ8DiEhVocyMuaQ
+        fXC6GWi8n6LBPtyzdMvltHaJhGYSi2laNCsWCulV9fX0vLo6emp5OT36yhWaX2IizQUj+qOnJ+1bZ2fa
+        BvyysPbLL+3e+ctfbF5bvnzOv6CHqS/qs+oz91eyCQ21dk5Pt+lDgxbcRo8aDLQR7EpDqAGUGdWFplsa
+        Guga7KO8mhp68eXL1EunTlFjw8OpPp6e1J9x0dmyeTPli/Xr7T7CHeTKBQusFqIe/GX5MY0+9LKwMJt/
+        pKbadWMXGNJo6NcrKmgNWVlUQVoapeDUKUpyWBgFv45R9u7ZY/8/339v9/mmTbZvenjY/y4+nuqIAHMR
+        gIYAVASgIIAdAtiieWvU07b64Pvt22fzHoNh63v6NNUjIYGy48wZyufnz1PeTU6mvMVkUv7N25vy8q5d
+        9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==
+</value>
+  </data>
+  <data name="monitor-computer" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD31JREFUaEPVmQdY
+        VHe6xvFe9+59dJPsJttMTNas2WQfs4nuborGGzVmLdHYwIKiG0VAI6BIH5A6dJDelCkgRXrvvXcQaYJU
+        UXoRLAgMzHu/cxRkaJZr7j7L87xMOTPnvL//+/2/859zFgGQ+rf+YwD+nfWTm9/p2fTWWk7c5x+f4v+w
+        +ke+7V9VfGLWnA8t/VQrtv5TrbiWT7TiOz7WiO1b/flXx15mIF8KQFDQ958eOb3L9P2KvlKyDVdQtA11
+        UrwYmXDaJaVcyS2jTskts1nBNevOSdesHiWX1AHNS6n3nMKLxyILGlB9ewiDw+MQizGlkZFRrF+/Xuf/
+        DNBzX/Tft++OrsipaNzkF5PxozA81Z0fkZFyJb7omjC+pJYXV9J0Obb0tkdUcbdbWE6fV2TOvcjMClFx
+        zS103h3GqEgsYWzS5NiYCM3NLUhLS4e3tw94PP6UzM0t2O9s3LjR5KUACgoKLlbV3Gi6VlnbVlRe1ZWe
+        W9SbllM4VFJRI2pu68TDR2OYmJjb2KRBZntHRyfy8vLh7x8APl/AijHq5cWHUOiD1NR0FkIkkhx9Hk/A
+        Amzbts3ypQDS09O9Ozq7MD6BBdXXfxclpeUICQkDjzHHGnxsVCAQIi4uAbW1NzA8/GjOFKaXzPTnzPeJ
+        H7t377Z7KYDExESlkrKKMRpoVNc2ICIqjsx5w4svpEcSTwg+GQwLi0B5eQUGB4deyOB8xiffZwZiRATI
+        7D/o8lIA1dXVq5NS0gfvjQBGxlx0dnW/UoPPArjsJQBz7O+OHLvxmzV/k6Nz0pIXAZFqbGxcmpSS1tP/
+        EHD14OERjQYzIqPjwBhJ9KS0mJifZeZltntRGTLHPukpEKs0d4p3efBavlbXjl2143vz1377u0+eBcO2
+        0dj4xDud9wB7Vx6GHoEdkfukB6PAQ9IwlRejnwLOi0q0i4592kMg5g5DbENTyInkPjwu1s/Mvy9rZlm6
+        5aSS4MPPPj9O6bw2E4gFCA4Nb2i7C9g689D7AKz6aFSYkRkYBqhDYpDA5oNj5g+bGolJ7UWS8/bxQ3Pv
+        GFQJwJ6Mu5F4IxD7koJHIY4iJY5BHN3dLzb09m2T5+jH/2PvPsvfv7P8M3YZxPzzueJX1dQH2Ln5oJV2
+        1j4EdJCYVJjR6b4P9JBYMBILRmLAXhSOuijb7SZITMkFh4SjomUQ590F4ktk2pt0lUyHk+LIeCopRwRx
+        CamSOnCdaEJsLfAZfvvbPb3/9dcNoSyAg5NzakXrfVyJyEBmWRNa+oHWAeAWiUnmNunOINDOaCG450iN
+        LctpJRkVm4jsqg6cd/SEP5kOJcWQksl4FqmQjF8jCVLSRWsOnej6hZx6h5RDygOpbDGkpJUDWABTrplN
+        bNZ1JBa3QBiahvoe4GbvYzVQMo2kJoJqJrUQFAtHUCwcQbFwc4CxyT2jJBNSsxFf2IRT5/RH9x0+cWeX
+        vFIPr7xyPI9Mh1bfEK//56neX8qe7ZAyCRqUyhiDVA4ZnpS0ylUWwMjIaO8l34jholYRuI4+qOwEqkjV
+        XUANqbYbuEGqI7BJuAaCY8FIDNiLwk2WZEp2KYJTq2Bq40UnwiHk5DSAo2fTu2H73p5FWp79Ukn3JU1P
+        B5BRDWQBeDzeO9aOngOFtwADWz5KbwNld4By0rV2oIJ0vQOoJLFgLwg3V0lOJpdZXAthdBGMbXgswKTO
+        apr1SIw2Y5zK5meuWfilggmkMkSQ2n82iAVwdnZexLWy785pBjhWfOS3AgUkBqiIURtQTCohsOeBY1Mj
+        sak9I7ncila4BWXCcAGA/whsxFu6Xlil54UDYfVYa34VUqmPGIDgqeW0nqHZrfRGQMuSjwx6zGwCskjZ
+        BMWA5bYAeaSZcCwYaRKMTY4SY5OjxNjkFijJfKpPa3489KzmTuC36i7Y4p4KxZIJHM8ahEzAtacAB849
+        BVDT1K1PqgfULQRgHpNvAimk1AYgjcTAzQRj4QiKhaPEWDhKjE3uOVJj4Aob78PIJRS6NHBzldAHF4Q4
+        FHETGwx42GTsjb/p8/A7NSdIZU1A6oBayFQCCqeVy6KqxqBh44eI66OIrQXibgDxpIQ6IJERgT0v3Fyp
+        zQVXfGsCWja+0LKYAaDBZefASiqbb1wS8D7nMpaahUAq5eHTSX1Q7fF5gNEB2aMhvKRGmPlkwy22AWFV
+        QDgpohqIJEXVANGkGAKbC44FI7GpPSO5mXDqlj7QsPBGTc3g00n8BODnNnFYFH5n7k508HzYFMD273Zo
+        GLpFit2TboPjmYKr14DACiCIFHwdCCGFVgJhJBaMxIK9BBxTkil1IriFFEDTSggDzyRo2wWirKxzFsCs
+        TkSpLAppfdyFDqmHPwXYvn2dgob5/SulE1A09oFPKXCF5FsG+JH8y4EAEgM2C46gWLgFUoupnoBTWDnO
+        0Ugrc4VQNveFXXgdu19GGrYhyM9vmQJQfZLAFED8XbxuFICVVEqrFAwhFdnJAERMAUhLSy/d/88z/cIS
+        4LiBEF5FAI9RMcAnCeh9Zps3QbFwBMXCPTFAzWEWmH1ELc6YXcEpEyGUTHxgGlABQbGY3Q+/aAKGgnyo
+        Gl2GtoknHFyuSpTQJMDP3fOwXOcS1loEQT73AZTomN/SnGABZDWfAjDzYIe0XOelQuAYzXzXPMAtH3An
+        eRQAniRm22XSJBwLRmLBSLZRzVDi+kPeQIATNAgcfiE888bZ7zCyiW2Hipk/1IwuwcDsMqKjiyU6z/Qu
+        pKph2suM/grywpjeH1zFdqKdHin4VO0i/Qbog9ThGQCbtu1pYYwf4Qhhnw04kBxpJ04k51zAhcSCkRgw
+        y+h2KJgG4Zi+AMf0BFBzzYRT5ii7nZEzrcY0XNNwxuAytIw94e4ZTj9Lu+Y1PR/AkdhWbKCy/ojK51cc
+        PhaFtT2e1Ee0oiSuC32xfnMNY/qQjhBW6YB1Bo0ayTbzsUxj+nDCLByyOgLI6gpwyi4JVkkPWNBJ6QU2
+        YI+KGz7ba4Jz2jZITq58LsPTzTPPVdUfJ/CWih1+T2fhxbzS2Z3oiLYkwKrVn2ebRPXh8IWrMIgfgX7U
+        EI6ZxUJaS4D92gL8YB4Nk5i7sCGYSZknDUPOOHx4vazF+AdbbPHG5gy8tncUr22rh7IyR5yUVCGeae55
+        Xk8CzNWFpt47oh0tkcCKlX/2ULRLwVl+DXaqukHWMBSc0G6Yp0FCZ/lVY9sUrdp2HdMe+Pjrkw+XSbdj
+        udyEpPbWIDGxgq4LRcLIyAFcrut4UdHt507juQDkdGIkAN588025bQoWY0bJgPE06UYM4aCe39j3ikYj
+        MkoaY2ZuHhMZdXVw9vKH3Gl78SrFcczUhwcr6EpczZThkpJ22NsLoa9vI3Zx8RdVVfUvCKNy3rRvwdFn
+        5oCMSpIEwOuvv/7Hv2yQGeLEi3HCsXBit+rFcWVzD1gLA2id04qawUEJCcNioMflY91Z0SytOVIk3rJz
+        d5uRseNAVdWAhFkGzNzcDZqapqLg4MzxuUpqXgD/OqzYp9j3P1v39Ur9+p2tEgDL3n33vZWfrh06Z+GM
+        0Ny8WYZnAvhEx8HK3hfbdMZmadOpYmTdvAknX9/732zbkX327IXy1NQq0UyzQUEZTCrQ0bEYSU+vm5ov
+        yudNniaQOY5fnLa4t+nQqQ6uhcdARUUPXRGMekBXKVZMAXy2fv1WjpVVw0yT872uHBhAbPk1uhjmCBmD
+        IRwwGZXQTpU8pNfXg/1cSen49n37rnz44SdHDx9WCLe39+6cWUKVlf3w8AjBuXOGYzRfHskraT+UulQ4
+        /mdphW75M5wu6mZP4W+PSAKsWr16h1tg4N1nma/o70dJTw/yOzqQfecO0qisuBau2HkqGidtRiQkcz4L
+        0ZWV7OcKOjuR1dyMnQcOxDEnzCVLlizbuPE7a+pSxQkJ5aMzUymk9biCsh6+3ys3UF19d9ZcqWoephJ0
+        76cE3mUTkFNSKlnIPGO8uLsbOazpW0hsakJM/U1E3LgBF14IpOVtoO76SEJHtVPhX1KCGCoj5vPpt27B
+        LzNzfM3atbKTK2AysOijj1btOXhQPsjGxquNKY3pMPLyZ9unvy4t7YCJiXODtPRRwYoVH6xnrwvR36/t
+        +ILR+QDKenvZEWcMJDQ2IZK6T3B1NfwqKuBdVgbry/5QVLeHMX9YQif1E3ApNxf+FdcRQp+PqqtnQbbJ
+        7E+c63Ih+Xjr66+3mP74o25uTEzRI8b4JEBgYPo9JSWNtC+/3KBJn1s6/ftSixcv/ktAcop4LgDGfB6Z
+        Z0olroF+I9TUsoYEpaW0PiqkJUYu9Fy8oGHoAvurDyV0xjgGF9PS4FlYCGFpGQKuX0d4bS2kj5+gXw0L
+        35d7//0/bdm//wffr77a3Lxnz2H+8uUrvpjvO0wCSzmW1qKZANepbAqpdjNutSG+sZE9OGOeT2XhSjcy
+        LmZmwjwlFWdsHWFkdQn8yAcSOm8aDm5iIuyzsmjdlE+r2VL4XbuGb7/fS78gXt2NRXYOyMge6ynv6pJo
+        m8zo57a3I6WlBdHUTYKqqtiS8SgoIFPZrHmDuHgouLmDY2SP4MQhhNA1nElpmwfDIDYOlqlpcMzOoZVs
+        IdRt7PHl2k0vdR9g3gSYDevWfeOoY2hOl1KenqxKqdswkzaZukcU1X1gZRVbCu75BTT6WTBLToE+GTwX
+        HEILLyO4C/ORlHMPkcmd0LW6gh/0LVlABpQBVrvoCMUzmv3Llr373itPgLmpICsrn2ls7ojI3Hw2iXKm
+        /imB1JZWtpMwE9envJwdSWZErai+jalEODExOKFvin2yilA2dcRRrjXUQ8OgFxsLk0RaraakQIFjBDsH
+        7webN+/Qe5Xm2S40raUtoQkT4uDkPcF1cEVUYRGKqKwy29rY7sG0zKvU15kUPNkJnAOb9Aw2CQZENyIC
+        F2jEDeMTWOPGlI6SuRVU9c1ga8vvXLt246lXbV4C4ElPXbR1624HX9+EQf+AZJhau8LUyR3BBBNPXSjy
+        Rh07F67QGZhXXMLOB2dqlQ5UIkxZWSYlQcXBGWcucGFq5Y709Fpa73Br1qz54tufwvwsgMmDvP32u2t2
+        7TroyeFYVZMJscA7GlZ2l8G1caeO4wyOpQM0zW2hybWFDvci9Kn0jCxcYEcXhpOTr9O94Nh7Cgrn09at
+        26Qz112VVwkjsZibuWM6+OK//33diePHVYPV1AwzdXUtq8zM3O54e8cNM0YjIwvErq5XBy5csGvS0uKW
+        qKhwEnfuPOD13nt/XP0qTS60rwUB5jlj/ozA3v/DH1Z+98Ybv/qSnv/m/8vsnH7+lQd/Fcf+X104LlAR
+        5z/iAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAChxJREFUWEfNmPl3
+        lPUVxmvX32p/6p/gsdqqgCxCIlpwqxU3IgWDtaBAlYTsxEjAEFBCksmiEEDBgBANmx7coIh7gklm35dk
+        9n3L7DOJTZ4+b0LSOTXIkNPT05zznPedmTfJJ/fe5977zQ0AfvJ/+SWA/afmzll4+4svVB4sKqruKC6m
+        tlR3bCmhSqs7SgSVUeXVHaWCKqo7yiqpquqO8q1X14MPP9w40++62ns/gBIeXLggf63FnIbXA/h8gD8A
+        BIJAMAyEIkA4SsWB4SQQSQHRDBAbBeLfA4kxavyH2lxRO7Z02f3HcoW7Kph5MA2PC/+G82fBDRNwCi6R
+        BTdydbiG/Wewq+3s94uX/nF3LnAzgi2Yn7/WbEzD7cR/Da626TSOXgLKtu9PL1qc//y14K4KNqRPw2UH
+        3I4sOC/TOhW5EFN7jcjFs9JaVHcKO44DnZ8B6za/Eps3f/6yH4ObEWz+nXmFJm0KLityh4ux5qbSmmbN
+        XUlr/J+T9VZYcRIFTGLtUeDIhXE88XRR6Kabb77puop//ry8QqMmBacZcF4DLpAduRngYjSEALemrBs3
+        M4ErdwE1nUDHxyN4YMUz7l/feONvZoKbOWICmCoFxyDgmIKzZaXVTbdOpVVw7BSc4NgpODo2eiVygmMr
+        6jvxl9JurC47iU21p1G15wyqXz2Ce5c9NJA72Ny8QoMiBbuJYDnATbSTH4GLMq0T7eRKWrPbyR5RS2/O
+        YHfOWbJGJ03CZgB+KzdgpdqNzboAKg0h1BjCqDYGUWrwY73Rhwe0dtyvc+BBnR3PDvlQbg2h1h5GvSOM
+        bfYgSmx+rDa78SeTfUIFFhc8349N97oGUcvl6wLTipOw6oDfKczYoglgpz6CRkMELcYIRINR7DEN42UC
+        bjB48Te9B88ZPaixhLDXFkG7PYIDzihed0XQ4BpGlT2AjVYv/m7zotThh390fLoR721p/S5nsHmMmGYg
+        CYsGaFVHcVAbxzFDEu9QXaYkTlDHTQm8bY6jfZCw5gjaqKP2BN5zJXHKncJZ6pSbr718zhNDhzuCDm8E
+        b/miCIyMT6aV7aSxra0vd7A7lqxR9yVhVgF5SjueVHvxoiaIrbphbNOFUaMLoVwfxLN6H5ZrHLhbY8cy
+        ar3Jj/KhEHZYwqizMpVMa7E5gKdMbtxncGC50Y7Hh9xwpsama66xtf36wFSXkxhSAu8rUzivGsHn2lF8
+        rhM0gi/0GXxp4pU6P5TGec7VC5Y0vnaM4FvnKHpcGVx2p3HZw6tvFF9507joT+FiIIUvQmkEBcdema8E
+        y92Vc29fslrRk8CgHJgns+BhpQvrlH4Uq4MoZ+TKtUFsZt2tUnsYURsWKC3IU1mxlvX2gokmGQyhajDI
+        awAbhvxYYXAiX2tFnsaCh4wO2GJj08O/sfX16wOTf5OASQpskvtQIw+hURVFuzqGfaoY3tDE0K6L4lWm
+        tlzjR5HOhzKdH3tpiPYh1qQ5hkOWGA5aaQAbn2Nqq5nSlyx+1NmC8MTGp6dEU+sb4pxrbO5tS1bLvkrA
+        yG+ploWwW04nKqOEiuOgJoH9BNyvjaFZG8UObYh1F0SdPox2YxQdQ3G8SVMcpo5Y4uiw8jnLMF6xBFFP
+        1zbah+GKjE+uTRxhTa37JDmDzSGY9MsEDP0sfpkNTyo82KQIoko5jBpVGC+pQqig1tIUy2iOfJUN96kc
+        WMeolbHXbTOFUUttM4VQxNQWGNw0iA33am0ooBGsobHJtYlToqllH/Pyw2V1xpE05w+LV4kvxaGnX84O
+        pPGxOIML0lF8Jh+Z0CXVKC5qRvCJOo0PtEl8oEvhnJ7FbcrgkmAK8yi+NGfwjYWFb+V79gw+cdBEjiQ+
+        d2fgyZqvzS0dspzB7vj94lUDF+PQsSffKbXiEbkbz8rZCuRhlCtCKFMGsZFmeIqRvFthxwKFFUsZuUIN
+        2wrTWsW0VhnYXhi9DWwpj+pcWKRm8VOPGVww+8amR1iz6DrB+i/Eoe0BqgZYGwOsMTGLWprAQUkch2QJ
+        dMhiaFNEUa8MYwfTuksdxj7W3WF9nI04ManBBA6ZomgzRVDPtL7K9Lax3py+8cl1nZFrFh1QXFfE+s/H
+        ofkGeF7sQ8VACHUEa5LG0CiJYq+UQLIItjOCRYzkJqUPxaoAdmjC2KPlJKBjRVQrR9geA0cXo/eiwYdS
+        ox/b2EosboJx4RTgmppnA/Y1cJfYisclLH4JUyMdxkvUVmkYm2UBFMo8WCazI09uw3KFA39V8Zezz9Wy
+        jWzXsvg5JV6gIQo0LtwtGERtx0qmdcg1NrE2CQedZtEhtvEci/+OW+8q6D8fg4Zgx3s4+3oz+KB3BB9d
+        HsWHfWl81D+CczTFOUkGp6UpdMuTOM016WP1CD6lLtAYF7UZXOSEOG9g4ZvSeJ/z9dxgCv/ghHByXfdy
+        p/MSrrn5EAffLMAWSGz4s8SN9eIASsVhlFGlYha1JIDVMi/yGbGFjNhSRmwNI1aiDqGS9VapYUth9Naz
+        pazQuHEXI3YPI/ao1gWjbQweHnQEuOamN9WzAnutl2tML5tmbxKdvQkc4ww99l0CR/oTeKs/PmGKvRKa
+        g3X3pjyBE5ytXYoE3lUn8S6bcaeGZqEpWnURvKHnM4YYLNZxuHnQEeBEzW9xh5lFxFb1e7BxIICqfrqv
+        LzKh7f0RbOXrUjr2abEHq6QePCP1oljO+lJG8IpiGDtV3ETo1irO1w1qHwpUbqymNmp9MJjH4BJWdcKJ
+        mg5rcwa7/dZFK/s+jU7U2HKxA0+JvdhMZ1b1sfivqJhQ6+jY+/n5vVIHHpG5sJFgNYTaTtVxSrzMVlKi
+        pElUXjygdOAhpRNPc/DrB8fgtPAExoOOqPEw19EcI5YN1sniP9GTwkka4HRPBmd7RnCG15NUd28anZe5
+        CDKt7/TTJBIaQkpjSDP4UJHBOUGqDE6pUzjBtHZpEzjDKWE2jsMxxBMY4USNb88OLF/iwAqm6jm2iy0D
+        YVT0D6OkP4Tn+7n2MJJLxDYskthxj8yJQva0LRz6lexvldxIShjBDQo/HlO6sZgTQtBjTKfGMDZ50CEc
+        wXiymEXEDnIv62Thd/WyLfSk0f1tGu99ywjw/hijeaAnjgOM2iHqeB+fYRs5Q52WcL2W8cp2cpzt5LAy
+        MaEummJQNz5x0BHgRHs7cwe77ZaFT3z3SWSixnKVllNCGGHCfNXzeCFsJsLaZOJSM8gxPcTBI2zEZjYH
+        C8tdOOgIcKKGTmPOEZsN2MQfcA24wRngRA1HGbccUzlrsFnAifYc45H6fwGWDccz9nRaudkLaTUxrcJZ
+        YiqtBKMFcgS75aZ5jzbUHve1737fK6ht11lPtlrrz3im1LLzlHtKorqT7mnt5P3ObpeovtvVsovX3e+5
+        WgS9JqjLKai1ocu56snn9DmD8Z/FN1C/ytIveZ+tX/D1lH7O+yn9jPfZ+ilfT0n4mRO61j/thM//BR1x
+        NCLR9Yu7AAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="mbox_error.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+        XEMBOS4mtwAABChJREFUaEPVmVuITVEYx5fLmXGdaTSa3Br3mDAeCIlxeRAiRBE6pWQy5dJMETURDZHL
+        FHIrzYuEGCK5ZR4kxIMm5VqIcnkh0ZAs/2/sc2adddl77bP32efMqX9n5uy91/r/1rfWty67A+ectesP
+        AbRntWvzrb0n7NZHd+wHzYaqoO3QPmgvVAuthqZDRWHVGwoADE2BDnZk7Dm+aVDZ6KEDOCoITCAAGIh3
+        YuyRpWE3qGsUtXRA0gJAZTM7M0YtaNPSfu65gDLL/ID4BkAFu7yMTwTYKgidnqPz8z3QFmgFVG4HXWUL
+        YQ0A0z3zGKNQa1t0MX4/D/2gvOChT7h+AprhDnPYBsIKAKZ75zP2WGc+DhNPLUyboJrw7CwzyGkvCE8A
+        mI51YeyBbH4gKr0SwLgMdAxlYVzpotvgBuEJEGPsnGyeWuxziOYTMAgxH6GH2GGCcAWA8RrZ/MIMGBej
+        8d480OfpIIwAMD5SNl+RYfMJkFeop68aiRe+ANB1kFTa+mQB/n4dEQCBIN3pxkOtDKGNAIxPklv/ZITm
+        E5GoViG+UzoXIbQAWNM0iABRdR05M9GcUqxCVLsCECH0VwRozELrJ2B2qgBPvACWi+aHZ9E8QXzUj4Ux
+        CQilC8H8KRFgc5YBCGKOCrHBCID1zksR4HYOAOxXAc5oAWjZIGcfDPu2xVkRNlLxeDQqKUnWe1cFaDYB
+        DBUBBsitX16O5yL6VFQkAb5o0qkJYIIIMC5HAGgcaBZ6ecqmHuanigDY6Kau7bMUAQJAbpdn5gIdQMoM
+        jHDkDACW9DJAVx1AygJuSI4AfFPNt5jGQA85C/0RIWIxzktLo1F+fjL6tE+QfCVXpspEhnXQW/Hm+zkw
+        DxxXARrdZuKzIkBdDgAsVQG2ugFUigDKQI4Y6Bfq66YCTHYD6C+PA5oJvY5KMnX9qGr+jed+AACXRYgl
+        WQQoUwHqbADmy1G4mgUIHGvrtpWDPQFaJwjGmkQITBD8d4QQzagLGVEGOGK1J3YAcPKXWsDKiABo7qHk
+        IdVP++E+1gAOxAEZgjbamRqwiXIX6LtOpWxeWUpob2DsngyBVy8ZgaAlw1y9eePxoufRIswPgz7IEHS8
+        iK1baCB3UJYm41A3atI1rHEeMERhPArCviK1X2L7xncHhKDNykZ9q5N5OlQuDgzgjIexKOyZDEH/0zHg
+        NggvyKwjAmd8HYQ9uC5V0m/XoUI381ZjICXnojVQKL0GMlXKR+PaGqgewo38FnQDwgKr9W0NZbJBLs87
+        Zdd7GffVhZTU9f8V6lc3kDSvUYQX2Zr3HQEpGr1QGV5/sZ9pmhWj+A5l1PgxHigCEkh3VL4WwhGSr7eW
+        Lbj/IrQsHeOhAUgwhTCEgzS2CcI+hF1ywG46Y+cQvtdD06COQYxnBCAMQ37L8JzI/BYY9f3/AJQMVypF
+        n/EwAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="No">
+    <value>Nein</value>
+  </data>
+  <data name="folder" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABMNJREFUaEPtmW1o
+        U1cYx5+mSZPcvHax6GTIGBNfPlUp6FBERIeonTCoyHBWOuyLVKE207UYCY3isszg2iTFpJ2hXW1ybReb
+        tkq0nQhN04rECSW0VavWFtlg3YeBjK3b2TkdnV1y09x7d+dtsIHny3055/87z8t9zkkGQgjS+kcA0tnS
+        WvxM9KTz6i8CLATvvT4hhEutdNkyWLtzJxw4ehQ+PXsWvnS5oKWhAXouXYLwsWPgEMMjjB7AYlWFhVBh
+        s4H74kUINDXBYHs7TEaj8MfEBKDJyUQbHIQXGzfCerYQeA5q1SrIy8+HT8rK4JTJBE4837f19dBfWQmj
+        +L6CzViMABYLhJ49YxbKJH72WnU12GcnxQIyly6Fd7Ztg4JDh+B4VRXYrFb4xuGA3sZGiAUCMHXvHvMc
+        fX0wrdfD27wA8MRZHR3wfD6hye4NDMBPdXVwDYfV3dZWmAyHYfrpU+4LMTwMaMMGeJ8vgD4Ugl/4AAj5
+        zu7dUMQXQNrWBj8KKYbPWCTs5gKQyFi5Upa7ejUY/nWdiRIn7WM+kwrxDsmLQECCSktlvSYTVXf+vCbg
+        dmvv+v26511d+t9WrMhamxIAl8X7QohJNsaDB4Bu3MhAPl8mNhk2OfL7KWxqdOuWHj15sgRXukRratI9
+        xp7ISAngdkPffwUgVSwSAXTligQLlM6I9PmU2FQoGNSioSEDo0gm4bPXnE5tT3zEMJZRpxOusQWIxQB1
+        dUlQa6sUWxY2BTYK0bQG9fdno/Fx5tWcT2iyexaL2s0KwG4HPxOAz0eEyrDJsSmxqdH16zo0MsJ9NfkA
+        FBcrP2MFcO4ceOIB7twBdPu2nrPb+QhleufhQwPavFmezwrg9GmwxwP4/RJBw4ErWDCo+xknsJYVgNEI
+        5niAy5dloq0+gfV4tFGmks+YxMXFUJkIoBAVwGZTt7EG2LcPDicCUKICGI2qL1gDkA5ybjdKPjwdHVpR
+        AfbulZewBli3Dt4j9X3WC93dEjQ8/GpKJVNyRyLZ0/EtxD9tOyMVwFukJ58FIB8prlVDyOe93sQWIhUA
+        FQzC1EsAuagAtbXq3mStddJNfUsLjL8EUIoKYDarGjgDeL0wRADIHph0iUKGBNexiooU1ZwBPB6IEADS
+        UZKmjOukQj0/OsrcQsybA+QmPjIJEQCazsReEK6j5Ap29SpzC5ES4MIFaCMAZMPBdVIhn3e5NPfn2xsn
+        TWJ8BPI1AfD7xW0hampUIV4AZjN89TeASlQPlJUpfbwATp4Ey8gIoO5ucVqIsTEDunlT/+uuXcwtRMoc
+        OHIETnR2ShDZSAgZ03PHItvNcDh7urlZN4FjfcBqVbdXVVG1hYXKE1u2ZH1IUfBmqrOhpDmwfz+U0rQw
+        LUQ0+safNK2bcrs139vtmk6TSV1fUqI4tWOH7OOcHHgXb1QkqYRy/g5s3w4f0TT7FiIWM+DTBt0Lr1c7
+        5nBoe86cUTWWl1M1e/YoDq9ZI1uPRcr5iuSVA3l5sJWcLsx1+aNHM3H5e3Oz5gePRx21WlV+o1H5eUGB
+        vDw3V7oVi9T8HyJ5ASxfDksqKuSjTqfqO7OZch08qDy+aZP8Aywy51WL5AWwkEQuAixkb7w+f/ItVC8s
+        ekBsz6S9B/4C+eG8h3vJrfkAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="Green">
+    <value>Grün</value>
+  </data>
+  <data name="Define Colours &gt;&gt;">
+    <value>Farben definieren &gt;&gt;</value>
+  </data>
+  <data name="Ignore">
+    <value>Ignorieren</value>
+  </data>
+  <data name="Help">
+    <value>Hilfe</value>
+  </data>
+  <data name="Add Colours">
+    <value>Farben hinzufügen</value>
+  </data>
+  <data name="Retry">
+    <value>Wiederholen</value>
+  </data>
+  <data name="mbox_info.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+        XEMBOS4mtwAABL5JREFUaEPVmX1olVUcx0+3ba6VDmP7w15w+TJ0rJc/EhuytuqP0Gz4UqhoDoLYcOAW
+        TpQFW2KaKFZihbMg/CdCxTeU0VK2P0SdzD9CGlsrfGtg7Y81pFjiPH5/u7vee16fc577aHcXvmz3uec5
+        5/s5v3N+5zzneYRzzib0hwAmsia0+bHRE3XvYzg+DS2E6qAt0G5oF9QMfQC9Bk2Nqt1IAGCoHPqCsVgf
+        /tKkctHFccDSdGDSAoCBasYe7XY0bINqo6iFAQkFgMbeYCyLetClp33KHEGdJT4g3gBo4NNg46/A9PtQ
+        M7QL2gk1QWugF12A6lwhnAFgejJjORRqg4F3cP0w9M9YarDrT/z+DfS6DeYrFwgnAJguZGzSJb35apj4
+        xcG0CaoT975pAvk+CCIQAKazGcvtUs0XodGTaRiXgVpRV5YO5IANwgEg+5Bqnnrsr0DzM2ZwvnEj5ytW
+        BA2pxO+XUOccHcRWE4QVAMYbVfNLA43T+C8q4nx4GM2Of/budYX4wzTR39ZBGAFgfK5qvsLJPAHU1yfN
+        039DQ64AVO436Ck5Er96AmQfFgGmoMLfnQEWLxYBurt9AKhsm24oNcsQ2gjAeJna+986m0+k0G3bOB8Y
+        4Pz8ec5LsWEITq9ymQ0yxC1K56kQBoDYARHAfej4m7SB0ZpSIENssALEFyx2VwQ4FqL3wvS47p5PZICf
+        gwBWi+aL/0fzBHRTNxdeSEAoQwjmvxMBNnsDlJVxXlGhV2FhmMgskiEaLAA5/SLAGS+Aqiox+8jfenvD
+        AHwmA/ygBYhvG+TN2i0vgAULOB8dNUN0dIQBOCsDXDYBzBIBnvUyn8hAxcWcL1/O+eBgEqS1lfPKSs6z
+        ssIADCrp1AQwXwR4ORRAAuTKlSRATU0Y46n3KBu9HIIQJjHMvyoClGcQwGQ5ClN0ANIKPD+DAHJlgMd0
+        ANIGbmaGAAzL5kdMc+AJNQvdCQ0R3Ryg5wQhO97fmWoWstg1sfCFDADYLwMcs63EB0WA7RkAsFIG+MgG
+        UCsChJ/I0Qyh/2A+TwbAchk/lNbthZ5R5wGthP55PBqAfbL5qw7PA+yECPGuM0BuLufTp8d140ZyIWtq
+        il8rKPDtiBIZYLsLQJUahVNOEO3t9s0c7ZNoS+EW0d2yefqOs47kOw3bQ32nCDEXN98ObLinxw5Av65d
+        6wJwGW3FZICvU81r58D9yYFzPzUK7wUClJdz3tJiVgN28nl5QQC09lDyEHI/PQ9PcwYYo2PscxWCHrSD
+        DKT7+xLd0KmVzVsjkBKJcypE3QOCoC3DWzrzxuNFh6NFNhsAAyoEHS/2RwjSgbqUjEMwnbqeN64D2jAx
+        Ng8VDaoQ2WhgR5oQ9LDyoa7X6RodKiPxmt+kBkYgZSi9hMp6VQiaaHQM+DHU5wHThbLroRyT+R/RVr7N
+        vNMcEHIuegOV0msgU6O4/jxUA+2BjkCnoXboIERvayiTPWe5f6zuPUHGvYaQkrrir1D/toOEen9GEV7m
+        at47AlI0nkRjO6F/IwC5jjoafYynFQEJ5HE0vg464wkygvJHoVVhjEcGIMHkw9AiaBO0Hzo+DvbT+Nz5
+        En/roUoolo7xBwIQhSHfOpzTqG/FD6v8PRJO78MpB02PAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="desktop" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACj1JREFUaEPtmQtQ
+        E3cex9eKr7vO2evUu/Zs72F7147edTrezdmWdmyvnfM8q5718BwRX1WEU4vYIohKtYjhKSQ8E0ICojwl
+        ikAtiqL4FpQozxACBAiEEBIgLIIC3/vvQtLwTBC8a2eOme8kM1l2P9/v7/vf3WymAKB+0H+MgR+yftDw
+        bHu+z+lT1PZn58zZ/dbixd5bV22J4qz2yUz+RHjr1ofRd2pmHinY+D83QABnzJ69a76t7WGHVfahh+0O
+        nT6xQnD96ieJUtmnkqJG+wvlHTultX1u1Rp4qrTgNGvANzTCt1KO6cIq36dugADaTJ/uPG/Roq/sVnwa
+        dNDOMyVmZfiV3GUnCsv+kfZA9a9zZe1OBcpe18omfFHbAi91M47pmwikekwdliswPabaf8IGCOAzRC8v
+        XHjwk6V/9/VY82VC1Cruxexlx+8WrUy9X2eXWdq69WZNj4usCS7VOrjXa+Gj0YBLII06pqnHgfzrcE2N
+        h3uCEPvjwnFYenvQNubbM+89y6sZAwFWGSCAP58/f99fliw5usdul5i3OjA7c5k4X7oiSar89EyJbtO1
+        qkc7itXYqdDBRanrH3WTBr4E1ChOUxM87t3DzrQUfC7mY19cJHziw8A9GYq4U+G4k58GvT4fNC1lFSvh
+        Y883GYP2Yb6/PSVKYqAmaOASsP1Hr766992PPvLZZbeNH2h3NEtCFkrBigRp1SpJsXZ9rqJr+/1GOMt1
+        cFbosVtJRq1qxqGG4XIrKoNTegYco/lwFYbDSxQKX3EIIk9wkXP5JBobr5kgjbCjvebeTIWzKHrE4+x4
+        UEvWgPIYa+A9x3j+unw1HMtbsEXWiu1yPb6saYE7AR1Ju0tq8FlmDjZECeAUEQa3qBB8LQxGkDAQkkwh
+        5PLzVkNaMiFXXIRjkD++lDcOYtlaWM8YCGYN2O7LEDmUtsKlklTAgrbweIhLDkVh4Wm0thZMGuhYRphq
+        fRHMgePNUhOfQ34DpglrQ/oNeGSI1txvg2Opfkw5RMejsCjriaGb2h/gVrMMSXW1ECsbIarRELUQtcGH
+        1NPSNIJiebA/ncsyrrmhxrToWp7JwMqCdmyQto6qtSeykH0lyeJBFPpiXGioRHytCnFKNWKVzRDX6Mlr
+        O1LraORrOqFtp9HRMVhiYsSSAeZzSXY81vATsfKKBtMEdQMGSIWW3OiA3e32EbUy+RbiJNFjHuCwrA1x
+        NQZ820CjQtcJwxDAocBPaoAxcfd+FhYHJDIGwkwT+OBKB5bnGYbpb6dl4AhCLKYjJvCWIMf63NoJGAz3
+        cD4pGPZvvo2tz72kXUtR/2TXwDsXaHx8oWOQPjyrhosfxyI8k8rTNnDzjgQhCQI4bFoPLbl9yyNqIIqg
+        qPOsgYVZD/FeZqdJtukG2B/0QXv7vadqwGCg0U4kqh6+BhSKHEQkRsErIR5H7skQ2Qa4+fmjj4D3EgmJ
+        3CgqlzWwIK0Lf0x9aNIyj0BoNDetgh/vBBhoFpws5rY2Gq1ERgPNzTcRlyaAd4IYB3KustDmCiSL3c1h
+        HQ7MfQ3v/3n13V9T1M8oW/cM0WsJ3VhwvIvVBx4CVFRetBreWgMmaCN4Kw09kbbFAPfUb+B3Uoh9krPg
+        abqGgYeoDPBKSwMvOQZXriVhoWs0poU1CPoXMTHwsqgb8/jd+JOnBNfvnB4X/FgGRoPW62nkXS9AQHwy
+        3E+mIUChGQYdru/FV+fOIzBJBElWDLlwfnev9OauGNiENkSbDMyJeIzfeN5CSmb8uOGHGjD22rwiTNIM
+        tI4oIycP++NT8XVB2TBopi7eN+7CJzEW4pRIqFR5I/IscBbChtcYYzLwk2M9eH1b7BPBGw0M7XWrGXSL
+        jkZLCwN/FQezh3ebU65iF2t4QgSKijMtcsx3JBMIaRSZDMw42ot5m57cgKja0L8gB3rNJK1joIm0BLxZ
+        SyP928vwzLhoSp3p9b6kdPjFJsPjVLZFaPMr9etbRLA5phabDFAHgV+uOz6unZjvUFhlYOthDq0l0Ay4
+        ppnGEcld7OSlQXA8FTxxMgLjUiBOTEdVjQ715OrNl1t3K2E85m83xMImUB03eQYUBjZpY9oMNKMmDQ11
+        E41L8k48e6IPaSUPoWqkWeh6FY06otp6YqBifAZ+t9HcwN6z4olOILrSwAKbQzcS8EY1jQYCzEAfud2N
+        2Sf7kFvRyUIzUpIbvJpaGlHjNPD6RrHZBCbBgIAYUA+kzUITMdAqJmkiJuk6AvzXrMd4JbkXBZX94NVK
+        mtSIRqTM+gkUSM/h+c2XzQ2kiyY6AX6FgYU2pm2CHqgImzSRVEHjxcRe2Gb0oIy8V1TTqCSKJN8Grbmd
+        ZrZZvpsLag8m10AUMTC01wy0sSJs0gNpSx48xFtne+F67RFkZBIVxEiElQbSshIxa2vx5BuIlBmG9bra
+        rCIKUhMm6coqGnIibkEX1l7uAb+wC+VyGuFllifQ0VGId7fyWPhJn0B4uYHttHmvGWi2IgPQTNIVJHEm
+        9dIKGr753eR50CNkFj9EeKllA4H8CDzjpH5KBkoNpooYe80kLWegiRhoJmlGZQS+VEa+XpbRCJN2Q3C/
+        G0ElY38n1mpvY8EGvgl+yATOTHgRhxIDTEWGQsuGQDPgJeU0igl8fimNaGknOA86yFlIPeYidvEOALWr
+        8ykaKDGYkjamzSY9kPZdApxQRINX1I6IUi2EcjWSa5SoJA8BLJ19Ksmt/SvrEwfBT/oEuMUGUz0KScIM
+        LJfAMotTUNEPK9eXWIQdycwaF29Qrr2WDdg4N2D5jqPk8d/1cR/IqbAdYeU6ckVVI0lZC5nuyWDNDVRX
+        X0SEMAjPb7gwDH7QBN7b278G2NPT7h78fkMEzl1KHbcJS1UY7XPmydv1GynghAZjm9cxLHUJwx828vHC
+        +kxQjg2D4Q/0YYZfV+cs/1bVFH77jv5no+YGBs6xL2y+hP1B3Ek3UVWVg/gUAb44GoQ1e0Px7vZI/Mr+
+        OKZvkoJyefQd7F5gqvfjxzMDOnQzfVvKqED9Kep4zwHqDGypHMw0/1VpRAPMNKY6NWCpMwf19VfHbYRJ
+        Ne9aKry5wfjMi4slLpGYv1GI59Zng3LSDE21b4bfQ3qWX2v9NF/tNSqCDqNSsJGAzrXm569RDbCVIovn
+        DQcBzp5PHtUE8/gjhjyzcT3KxWq3cCzaHo256xIwdVMRqeTj4an6k1Q5LaUk1VSSqieVjncI7AxrYEfa
+        hnp/hAoZL9fG159uzsNefy4u5aXiUAgPm73C8fHnAjC3tT+2vwjKuWV4qr4kVV993TSONo+kyiWpOhDQ
+        Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J
+        9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l
+        IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="Hue">
+    <value>Farbt</value>
+  </data>
+  <data name="mbox_warn.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+        XEMBOS4mtwAABLtJREFUaEPtmWtoVEcUx+/efb9ujGAKtoKk1mekUgkV+1KkSH1QlYjUZ7C2FcUiVTAF
+        BQWr9V0q0jaIQbSUBFrFKGpFUPCB+EA/aLW11EdbTW1Sq631k6fn3Oy4s3PP7p3s3phdMPBPZvfeu/P/
+        zTkzZ2bjAwCjpH8IoJT1RMxjhEOdNUidAoCGN6HQs52e9Ku+ZADQ7LiUaTIua1pnQHgaATQcQf2UBaAN
+        3+/lNYTXAF9mMS8isbtoAdD4ZNX8K6/61TSi1x95CeFJBNBUd9SvMsCQl/xw92EZvDk6wEEM9QrCK4Dt
+        6ujvPxy3Ac7/kIREImMyE9CJogFAMzNV83VLw7Z5oS31US4Kn3oBUVAE0HhPVKsMMGx4e+qomjYzyEGM
+        KRSiUIAmdfSPnEiwAL+1WtC70lQhfsbn44VA5A2AHX+gml++MsKaF9Fo2h3jotDwxAHQeB/UAxlgxKhA
+        TvMCYuGiMAdRmy9EXhFA483q6J88x6cONx+qX3bUh/v4eZX5QHQYADtaqJpfs4FPnTv3LSCwU+cT0PbA
+        ehwhmidMxd7X6QDYaZXa8Vtj+dRZvT4CZWXp9b9qsAm376YhVq6JcBBLOgrRoQig+UMyQCxm2IVKTZNN
+        m1lzoK5QY8axVXpYRyC0AdB4nTr6n22JOsy3/mtBxTM+x+gGgwZcb0lHgKAvXk1Ct3LHvWc8B0Dj1ar5
+        iTVBdtU5fobNb5hRy99f38BW6Y26EFoRQPPHZYDy7j64/IszdWhUv93jXOsty4Afr/P30zO174a4+fC2
+        DoQrABpfoY7+V9ucqSPmwRdbnSNKE5ZbTsV7f9yz4IW+jip9A/std4PICYAf8LpqfuoMPhWEmeWfZE7g
+        vv1M+POfzNznYHbtZav0zkIBzsoAzz7nc0xE1cz8DzPT4bvmmFaFps9ZXMdW6fdyQWSNABpfq47+9m/c
+        zdRMSe86x47X217IgzDceYp7iD76ZYNgAfCB0ar52e+HtEbyjZHt24RwmK8RueYCXTt2ml3FvtcGwM79
+        qEsyQOXzJrT87Z7HZKD/gPbJSOngZjbb9bUb2UK4lINwRAA736yOPm2Ddc3cvGPZ80Te++g+K983YRJ7
+        AHpNhcgAQOMTVPPzFuilzo7GGNBB3jQN+wy8bEX+ESCQK9eS0KPCUaUvZAVA40nUNRlgUJWpNfKr1vF7
+        n6s3sxcvnag07GSr9OcyxOMIoPGt6ujvOdD+zUIu0dygTZ36LFVr2k67Pe92fc5ctkrXCAgbAH/eUQ0s
+        WqKXAr+3WfaKIz8fChlAKeVmTuf6X/9ZMHCQo0rfwv4qUt6NHviiRTYwtJr/ZiFbh427YkDr94tDTJg+
+        K2gfYnTM6d7TfDDO7ZUaBcDX6ugfOuqeOrqde3Xfx8vYKj2P0scR/mTSABKtJkLxuAFClPNC0agBpEgk
+        LUopIUonIToTCAUCBgj5/QaQaAUT8vkMEFI9Sq8fOQBy3MyFsevfS+VR1xtRMkF7IEsZwPaeAuiGxGUp
+        WfhXiIqbUALbQnFsC8WwTYpKov/UCIWxLRTCtlAQ20IBbJNoHyZkYlvIh21bObcSboeHYrzueqQsRtPs
+        VqLYjWqfB0oN5GkKdXXEnkagqyPwP76kA5sYKmTOAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="monitor-planet" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD6JJREFUaEPVmXdU
+        VNfaxo/GfBo1GuONuUmMJTHGllhCchV74VOxtxgrKkhVFCkWlEAAEQQB6SoggrRh6EMZemfoAlKkqiBg
+        A0VABH3uew5CBtCgN/pHZq1nTTtzzvPbb9l7n+kHgPlHP1iAf7L+0ea57HnT0S8tLR1cWFi4Li8v74Iw
+        WZRgGO5RrRXk0awf4HffIyg+OzQ03Cc4OPiAv7//mDc957s4rk+AysrKcQXFpS7qwX7PJnvK4XOfORgX
+        NAUTQydhsnAyJgknYYJgGr7ykcTXHqsh6ayF85f5Oa6urmvehcG+zvFagKqqqsGFZcVWOwU27R86zsZI
+        388xIWQCZkXMwoKYBZCKk8KK+BVYHr8cS2KXYHbUbEwNn4rRwaPx0dWxGGu/E7oOVhm2trYz+jLxd75/
+        JQCZH+eeGVU83GktGPdBGBU4ClPCpmB+zHysTVyL7anbIZsuC4UMBchnyEMmTQabkzdzUBKREhgnGIeB
+        /IFgHMdhkdWhNjMzs23/i8mV50uGTTtwRWLinvN7f1RwsJhxwCVohrpvyiyNwOwZshZJr6wBMj/9ckxR
+        Qz/b6WB4DD7x/wSTwiZhYcxCziRrWuuaFvSu6+F04WkYFBjgZN5JHMo+hN2i3ZBOkOYg2Ej04/UD4zIU
+        X+nJw8DA4ORLiH52SbWjNGzD58qe9pBXNPGyUTIPDFGxjkhRsY3KVrGLLlSxj61QtourOWwf/cDQPemJ
+        e0zBC9GNu7jb2Ib258CLF4CdnV1pLwAy/0V4enXNB7P5YFyHYoDPAIwVjOXSY0PSBihlKkEnXweWNyzh
+        VOGEqzev4krlFdiX2cOk0AR6+frQTD2Og2GaUA/ShXaQOfQEF2Ho6Q8Lj2Q4ByXfdRKk1TgGJt33jkhr
+        jM8ueV5eU4/m1uecKXG1tDxFUVExQkPD4OPD7xKPx4eb21U4Ojreovmrf1cKkfkBafm3M4ctuA5mVBwY
+        q18wzG8YJodNxrK4ZVyaHM89jvMl5+F5yxPCWiES7iUg9m4sknOSkZ6Xhbi0ZCRmiFBYUo6HDY1do9XT
+        HPu+ra0dFRWViI6OAZ/v2yUfn47XQUEC5Obmo7HxSS849nsvL+8aAhjSBUDdRvHn/WVghoSCmV8JRm8/
+        RgaMxHThdKxOXM2ljn6BPpwrnBFeE47chlzcarqFksYSxKXG4TmZ6qnqOzVITEqGr58/fH39OPH5Hc8B
+        AYHIyMjCw4f1vQy+Clj8MxZAIBA8IIDPOAAy/7GFW0kD82EAmO8ywPx/NZgDzvjM7wvMjJjJFa5ypjKX
+        866Vroipi+GMt7S3oK6lDsL4CLQ8A4SRsfDhk1nWsF8AUlJSUVtb99YG+wLgUZQiY+IbCWAMB1BSUqL6
+        5TwyzviCmX0DzOoaML/exKdXJbkIrEpYxXWbP67/AcdyR4TWhCLrYRZKG0tR+KgQfKEvqu89hqs7j4tC
+        Xwb+7vee3r6IT8lsI4DvOYCY1OJk5qNgMB/4g1lBo7+hDsy2+xhqK4fvQ7/n+vxO0U6u+5wrPge3SjcI
+        bicg6nYehOUFuBIqRGJ6Ljx9Bbjf0MRF42kb0Ep61k75Tp2D7R7vCs7T2w8p2UUYMmToLIaWB6MOW914
+        wY3+iIiO0d9yF8zuB+h/oByjA2bil8hfuDTan7EfJ/JOwPS6GxySWuCc1ArH2Kew8a+Eu28oYkTXkZJV
+        gPpm4FEL8Pgp0Eh60go0kZoJrAuOwP5XOE+eH9Lyb+KbCROXMrm5uVILD1LasACfRoJZWwtm6z0wex+C
+        UX6EoQ6a+C70O8yLnof1SeuxL30f1DKNoC3yhm5qIHTSXOm1FRzc3FBQ1QQ3nxDUNgJ1pHtPgPukB03A
+        QxIL1kBgr4WjiHGRewnHRe1l3xdPOw8CyKR5YeqPMzcxWVlZu6bJFHcAsCm0hiLQCaDyCMyxWnzqs4DW
+        PhMxJ2oOt3zYkrIFu0S7sDdtL/ak7cG21G0wv2yHG/cAG2cf3KwHbpFuNwBVpOpHQM1joJbEgt3tCUdg
+        r4PrFrWXKXnVyw85lU8w82fJfYxIJNL8Vr6qA4DVgtKuFGIUCOBwI5g/sjDEYxE3qf0Q/gM3sbEzM1sb
+        i2MXc9HRtTuN/BrA8pIPB1JCKr0PlD0AykkVD4FKEgdG6gS78zo4ihgXOTG4xxQ9NiWvePgh985zSMxZ
+        qMYkJSUdmXaUUobx6wCYktVVxMzeejBKLyF0RejvsghDfIdwa6PxgvH4NuRbbt3zeeDnUDE9jKwqwPQC
+        H3kEwsJcrwUK6oBCUtFdoJjEwREYC8eBkViwm51wYlHrBUfpyKalk7s/sqqBOQuXH2fi4uK2LzaitBmT
+        1AEwlCayldSJNlEhb7/fUQvyDR0gahSdS8u4NVJPbTPYhZSK5zjjwEfGbSCTYFigbLpQDunaHSCXoDg4
+        AuuEKyK4LrDOqPWE65GSF9z8IboJLFy+/ncmMjJyyeZz5WCWi6XRl/EdtcBCsPWw4wHXlRgZgjkSCMbr
+        o14A8/QWgp9QBn07PpIqgORKIIWUShdiL5Z2C0gnsF5wBNYJ1xU1AuwVNTE4e7cgxJU+x9LVvxkyYWFh
+        w/WcU9oYFZoQJoj+rIXJlErSd8Cso660keYFFmYziX22XdALYLzhdJg4BsHIMRQhec2IprViLCmuDIgv
+        BxJIiQTWBUdQHByB9YTrFjUC7JmSl7wjEZzTiOUb95hyE5k3PyBksGorpUo7mJFRHRD9qSamXQMjRZFh
+        J7eVBMMCsc/aR3sBDNfeApXjlnAQFMIhpBChRUBYMS0vWN0AIklRJUA0KYaFI7BecBQxLnJicOkE2DNq
+        lwNT4JFUB+mtCuc5AB6PJ7NMn+YCNgq7msAMolm5syt9QpObBLXZRbfBLCYtukV14dQdwJHW/lL+2KWk
+        B6+MZpyyD4N/PhBwHQgkBRUAwSTi6gAjhb+Ei2DhCIqDI7BecOJRe5mSbmHXcEFYgVU7DtpzAO7u7h9a
+        XuKVDzz4rANiPeX94JA/IfpRRP6dAGZ6AZj/UL3MzQPj0/9PCDUFMJMKsW7bMXhfA9TN/eCVA+41Lxfw
+        IfHzAF+SHwv2Ei6I4FgwClpvOAIThxMWtsLcIx4nLXnQOOsOl6RHWCuj4dS1nKYNwsb1+lQDLACr/W00
+        8rQ3+IBWqJ3RYJ/7UWp9RHBugzsATKeAGRbEHbd0hQrcsoBDpn64kgG4ZoJ7f5Xkng14kDwJTByOT3Ac
+        GEk8agF57TDzFEHzHA/qZjxoWgbCNqKWO9elhMc4fJZfM1d6x9lue2Ira1v/qVq0J+iEYJ9lmsFMTO8O
+        wYJc+pQgBlFEqB5eAv5nriyc0gEVEz9cFNGFSI5p1LdJzvT5ZZILgV0hMHE4Fswj+wWMiezQWR5UTUg0
+        CKbBt7jfOaW9gK5rZssOTaus5TvUnSf/vESOVqIf99pSWlhYDDEwOZ/z5WFqoeIQnSCr6HNJqpVJmdSJ
+        vgajKN2xAfqa5pDpufh+/kGYR9RD4Yw/rGjLbUOyTab9K8k+BXBIBS6QOuEMvAuhfMYHikY8KJ7hw4BX
+        wh3Dyiz8PmT1rt5cK/9HsMTSXw3+9eX4H151Y6DXXQkjI6PRJ/RMiieqFfWGEIdyWUKbHkozsc8+k7aC
+        mnU0ZE/7wzSOTJDM4wGLBFpikHS8y7Hf0Bf79HmQNfDBiSv5sEoEJ8u4dqhax7cu23uufu46BZdvfpi7
+        jUZ5UF93M155W0VHR2fY8eMnBPPVwjBAhdprz2iw742ce30+aHMM1imbQf5sOHRDmnGMV41d+tSddH2w
+        W88HahcycTbmOQfG6pRP1Yv1Rxwf/bz5bP3XSx3ah60sx7AVJe1k/F99Ge/8/rU3trS0tPqr0WPfQe0H
+        05SiMED56V9HhKD6y9VDYpUCjnlXY/NxNyhaJcMgog1G0eCkH96KvWdCm1bK6Ves36XRNHqecfvYnS0Y
+        t7u9S6PXF7QSwIi/DdB5AkVFxWFycnK6O2X2VyyUOYtvZCMxUu46hshXY4DSEwyUv4uP9xVh5M5YjF9j
+        jMm/SL3QiwA6pepS8mKzhl37DnXjdo0zlgi7lovrDQ1wdA/Esh22mKHU1k2Tfs15SgDD3xmA+Im2bt06
+        ZdOmTepr1661lZaW9peSkkpdvHixcP78+Zdnz55tICEhsfyriT9VbdHhP910yPSZhukluAqjkPfwIWda
+        XI5egdiv6YhF6s+6SVIuE0rHjqVLrVun8CYQfd7cfZOTdB4zb+nS1crHtOuSKyt7Ge4J4MQPxCkjV2zQ
+        ae2mlarpyKypgfDatfZ1v/3mRNH4v7/y8M4A1mzdetArMupJT6Pi7/Pq65F57x5EtbVwFIRCz+gC9ho/
+        7abNmimIpQEQ0e2Y1Dt3aHmilPhX3eidANAFPtDUN6h5nflrlEJpdXVIqKpCFJkLLS2DV1YWlFS1oWbV
+        0k0yJxIQUFCAsLIyRN+8ifCiIkhISmq+LgrvBEBi3rzd8TduvDJt2BFPrK5GJBkXlJSAT+Y8qJCvEIDa
+        UX0o66VAz6m5S4q60XDJzIJnbh78CgsRUlKKrfIKtFp69V9h7wRg8Urpq/mUHj0jwJpnR11YXo4AGknW
+        1OXMTNinptLElgBDa2fsUbXEea+mLqkZCnE+MREXRCK4EKR3Xj5ktY7R7YD3CDDtx1maTv6B3QByHjxA
+        MuUwO/KBxcWceeeMDNgkJ8M0Nhb6QiGOWzhAWescrgQ96dKJs2EwjIjEubg42KWkcNHYuGsfbTzfIwDV
+        wEClI0ebxCPQOfrhlMu+BYVwy87hRtU8Pp4zqB0sgKLxOWjoWCIwurFL2sY8nAoJgVFkFM4nJOLERWq1
+        S1a6vVcA9uQbN+700je1RjrlOwvSCcAWoziABQGcJoCTAgHkLK2hpK6L8Nga6Fl40sLOGgr2F6ATEooz
+        UVFQt7SB1knj5jFjJkx97wAjRowYvn27Qujps7bwiopBVwrRfwDiKWRLKWQWG0dRiOBGeo+BMRTMraDp
+        74/jQcH4nf7QOOXnB2UdQxiZXLwnJbXmLye0d1LEXQsraqcbNmy3u+wiaDWzcsYZm4vwIsPhVMT+XBHn
+        ckXsQEXMFioLYhwdzaWLPhlXNjaD1mlzWDt4019SNoWSkguW9DWRvlOAzov99NOc9QoKR9ytrT2qrnoI
+        YWLhiNMWF6FPRatrYQ9tC1ucOGcNbVMbnDKxwe/GNnTMZfrTI6Xt6NEzotWrfzs9bty4f/dlvteG5k1+
+        8DbHsKtKKan1p1RVT/GOHTOK0dW1yDM3d6nm8WKfOjsHNxga2padOmWapqFhELJnz0HHGTN+WvU253/v
+        AK/cQTHMYAKbSPqC1O9tDfc8/r2k0N819Ta//8cD/Bf1OK6O+/e5egAAAABJRU5ErkJggg==
+</value>
+  </data>
+  <data name="User Colors">
+    <value>Benutzerdefinierte Farben</value>
+  </data>
+  <data name="Sat">
+    <value>Sätt</value>
+  </data>
+  <data name="OK">
+    <value>Ok</value>
+  </data>
+  <data name="Blue">
+    <value>Blau</value>
+  </data>
+  <data name="Base Colours">
+    <value>Grundfarben</value>
+  </data>
+  <data name="back_arrow" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACTtJREFUaEPVmXls
+        VUUYxVtrLJFUTZTFJUgQgooouEAxGheM/qMREo0b0aCJ0bA0smihRUE0alwQlQfiAu67uOPCYlUoguKK
+        Ii4gsgikaGmLRoz1/B73NNPb+15f+4wJvhzv5c52zvd9M/PNtLCxsbFgj/4PAXsy/jPyBXMLOghHCqXC
+        2cKFwlUReOcbZdTp8F8ZLS8BInKocI4wVpgpzBYeEh6O8Iiehr9RTl3a0PbQfMS0WYAGLBT6CZMCwpB8
+        VJgj+PeY3uJwGfWoTzsE0Rd9FrZVTM4CEohjUUjwg+jjwhPCk8JTwtMJ4Dvl1KM+7fjRD/21WUhOAtRx
+        R2GUQIiExCFhws/o/VnhOeH5CC/oafgb5dSjvgXRTyiEsTrm4o1WBaij7sJtAq62xU0cK0MGchB9UXg5
+        wjw943AZ9ahPO9rTD4YIhdzO2K2JyCpAHZwipASsTtzicgZiQCwZkn5F/35VeE14XXgjAXynnHrUR5DF
+        0J+FMA7jzYJDNhEZBaghS96DAXmsg8tt8Zf0joVNGsJvCvOFtyO8o6fhb5RTj/oWQz/0Z48wDuMhAs+X
+        ZhKRKEAN+ggsdawS/Jh0odWxHBbEoiYN0XeF94QFwsIE8J1y6lHfYujHHsGr9gbj8mPu9UkS0UKAKh4u
+        3C8QNnHyuBtrYTksCAGIQArCi4T3haoIH+hp+Bvl1KM+7SzEHqF/xomLmAG3uIhmAlRhL2FKRB734UZb
+        nk6xEuSxOiFh4osjwh8WzCio7jm+90/9xh2/Qd+qAyzV+xLhI+HDqD7tLIT+6Jf+GScU4XC6GY6hiLiA
+        waqAu1htHPNYwuRx9VuR1QgHLIllIbTkoKmdvqmYMblh09baxrLU+Fp9WxHDcv3740gUYiyEfugPb9C/
+        Q8oiPCfgNThRgApKhHsF4t6rDROWmHTYhOSxHuEBkepjr++/Yd6C+bu2/bazEYxOjduh758H+EzvK4VP
+        I1GhEPqhv1AEnmBcxocHqx+8CO8Si2jygD5eIjDjCR0mDxsNqwIT1mGDhRiEwbDeUi10y8+dMGT7mrUb
+        08SNUalx9SpfFeBrvX8lfBGJspBl6X529xeKcDgxPjzgAy/4XdpMgD4UCaH1cVkYOkwwx7wtv7RwZuEn
+        l065onZLTX0z8ogYlRrboDbfBVit92+FbwTEIASvfCLgDUTYE8wtxmPccD7Ay14oSp9l0v+bW9BXIPZD
+        68dDh6WPWE2HTdEDRZ9eecvVdVu3N7Qgj4CRqbE7Ve+nAD/q/QdhjYAYvPNlTAThSP+Mw3iEbBhKoRf6
+        hgKGq6KXTWKNmPPEtfUJHZbAj4rvK1454vay+jBk4u8jU2P+UN31wi/R82c910WCvtcT7+ANi2DCE06s
+        UozDeHEveC6wvF+5+zS5Oz2eLnjy4qYw9rFCk/WLphetGH3H2IZs5CkbkbruT7XbHGCT3llaEbVWwBuI
+        wBOEExOcVcqhFPeC54LD6IE0d/1vfyFcOnGTw4fljM2KmHxfU3zJBeUX1bZGnvIJqZt2nThpwE7jpMqB
+        DUK9UCfUDqgs/X1ARen2ARWDagZWDNo2sOLkLaUTT94sbDxsUjdCDC8wLuPDwysS/FjiWVL3RwA7b3z1
+        iYcPm03VqWWnbd3w6/bEmM9FVK51zrt56BbGExg3HkbhPOiOgH6BgDD+SdJYylg6F/YZ03fd59+u+SdX
+        EvnUO2/qEAQwmRHA+PCAD4b1PGDB6Y+AMyIBTAwLIDNsEnBI5WFfvb5oQdMmlQ+5XNoGApgHoQB4hRP5
+        DAScJsRXoFDAu8eW9/sxvlHlQqS9dWICWEDsgbiA0xFwXGseUPmiiyZfVtNeQm1t1wYPHIeAbrnMgX2m
+        71M97ckZf7SVTHvqRwI8ibPNgW4IIIlL2oXZwsNNrKr7lB7fvf1B1d+5kNq8bUcjK1Z7cO6U870KxTcz
+        lvdwFSrxRnaPCpxCk/8n7QPpBK7nxF5r36pa3KqIa+4YuatzeZcdQl305L228w1dfhNqhG1dru/6q7Cp
+        y/iuvwjru447eK3wQ8nU/chiGS9pH4Af+8B9QqFzoWH6R7gTk8g5C222E+v70iMm9Fz35uKFWUWMSI2J
+        78Qb1ZadmJTCO7FzInZistPWdmJ4eSe+PMyFeiesRBlzIdWt7lF+xLqn3ngp49Ia5EKkDsDESerIheIJ
+        HbkQJ7hcc6HeoQDyobtiYZQpH2JykTUuO+DWA1aX3TW+ISmdjrJRyJKROhN1EkdaHc9GSeTol/4z5UEO
+        n2mET5OAKKUeEoRRpoyUmAxPYst0d7HyrBvOqfls1epmu3SW8wDEfbAhgeM8YPLZzgPhqWxo0omsOPJC
+        eJi3F7wrk5f4RObjJIOv6DWx9/o5857+KzhS1uk7BxcD0qTOPsiEJzKfA3wi8wGfcZ2FhtYvbiEg8gKX
+        WfFdOTzYODcKRRCzxO7HHW8rWXXtnWV1LKHRmZgTFysKT5+JsTjx7jMx7eNnYh8n42di0p1B2W4lmAvl
+        AksqRzdmvA83PtiHVyq+B0rfSqSFzC5YfvqEwVsurhwWv5XwjQQeQ7BvJXxP5GNkSN7Jm1eeCrVrdgWf
+        dLHVSZXuFsJQ8vk4LoI8hYwR1zP5sCQWXVI8uQOhwuEkBKRtcerTjvb0E94LMU78XohDV6esF1tNcbU7
+        veDEk0kEscku7WsWCPieCFLh7RxEDb5T7nsgXzHSD/3RbxJ5rjlb3Mo1W4VaKJtbcJQazQpEOJyYE74b
+        5cBtIVjQ14yIAeH9qL/5OpH6Ju7bOPr1PRDjseNy2Dq6TZe7gSeOUWO2bHuCTn1fhIvjQohfSIU31BA1
+        +E459XwXSs5FP/Tn+x+TJwrStw/tEhCtTAeqk0rBE9s31UxuBrQQXE8IYE3AOTYOlzlUQuL0x1JJ/ywg
+        NwoH5fUHjsATe6uzywRft+NaNjsGZGAmOa5HDIcOiAFEGf5GOfWoTzsTpz/65Udutndr5LPOgaTG6pTJ
+        PVLAG/wYEIvhcsQk/Z3MfxvjacLUoz7taG/ioxgjF+KJG1muDSMhI/T0bQYutxgsCbFMoNykaYdXMUqb
+        iOclIAitfTXwicJwwWcKJrx/EDT8jXKSMdqcJOybq+ESoyKfxglLL5tgT+EE4UxhaATe+UZZi80oHw6t
+        /pk1n87/j7Z7vIB/AbqI4PWoWfWuAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="Color">
+    <value>Farbe</value>
+  </data>
+  <data name="Abort">
+    <value>Abbrechen</value>
+  </data>
+  <data name="folder_arrow_up" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB6pJREFUaEO9mQtQ
+        lFUUx/+77LJP3o32HMvUIqxMe/hEGlHTMTVSS53M8UFoTWmDItSWGiMWkQgLu6CwmbtLigpJVgrjjFkO
+        A6mlkZQUmNRMNb2cqWzSbucu7bIL34tlF2eu7Hzf/b57fvece8//nk/FGMNA/1NFq25kl1hnSMblAAPZ
+        MBGzkIvvMRuFBBDZ37EH1njAiJdwEmfA8Am159GIB/BgfyAGFmABbDhNhnMAb3PjF8zBdvKGLhiQAQPA
+        BMxALX4PMN4LcZKAMj3emNJXiAEBoNk1wEJB4z/zQr/34Fekoagv3hgYgAUo7RU6YjDcG1lowlikKvFG
+        2AEodKajRiR0pDxSTd54FFbyhl4KpM8A9EKtVouhd9+Nh1NSsOKmm3AXXVMLDcIHp9Bplg0dMZBT5I1s
+        8sY4TBODEASggQcnJWHGtGlYt3Qp3sjMhPOVV3B42zacdjjQeewY/m5rA+vsBPvwQ1xJTcVTggALaAZ7
+        7jpy60Do/n78hnko4Wup5zgegMREjFm5EuUFBThhteLrAwdw6dNPwb77TlnLycG7vV48HlNxgAYOxmD+
+        DIFrDtDfreig3NGADDiQiPm9xiEqVW4uzis1VqjfoUP49frrMdz7ck/o5AQXOje4wZ6qAMvfDbavBmzY
+        MKRIroHbb8e9J07gSn8A+LOvvYYTNBHuwkIcnfAcfgaP3yBmf62t2+vffAM2bhxWSAKMHYsVFy4oCxUl
+        kG9/ABZd62f8cbDBlWBG/2sSYBvKA22ZORPZkgBjxmBea2toAPiMjcwAG0VGpFEYrH8TrKoOjF+3VoFp
+        6+W98lxZoC2LF+NVSYARI/DgKXK3ktmV6/Pll2BSkzGlSB4gvQfAqlWw+62tG0aP1syfO1dnWb3aYEtO
+        1i6jTR0jjh7t/xqQg+P391J46Q9JQyy2gn1A/RwONaus1LCsLF3Hli2mY0VF5ra6upg/WlvjabKvYR0d
+        CWzyZG06P1MkVFfjNyUGhKLPJFqkUos7ZZOGNTfHUY5J8Bgq1urrYy/HxqqGcwC13Y7OUBjX8x0tLWB1
+        tAbeektNTcN27dKxaZYISYDZtkhJw71AxcXm8zwFeBLZ9u1oDRagowOMMjNzu9XM6dRQi2S7d+upGdnB
+        g9Hs88+7XO5thU4zowwhCjG9VBlAbq6p3nMc5v+9/jqa5QA++wyspkZFhkZQ01LTMZfLyPbsMbPGxlh2
+        8aK0y70ALS3xLHaXOEByiVaRB9auNZT7APLycFQI4OxZMLtdz6qqTKy+Poa1tSkzUip2+b17SzSiHrif
+        7sk9z++npelyfAAbN+KgEMD+/Sraw0NjtL9RC206UYC7rBGyAGfOxLOkpIipPoDsbLiEAHi4KJmNvvbZ
+        VGHyiDWh3WhEsVp2TKcz+kdawCYfwJo1sAsDKFtQfQVobIpl+reFAYYoACgoMDf7khv/kZ6OfGEAg+xs
+        9NV4b//EIuHtNKlY3usWi7E6AGDhQrzcE4ALvL17TWEDSBZZyJOs8os4PV3v00eebZQU3/M9ARoawE6d
+        igsbwOyySME1MFsmD1y4kMCmTNGuDPDA+PFY9u23gYKOJ6Zgw0PJc09WCO9ES216yXEbGmIvx8WphgYA
+        0JEyle/5/l7gyUqJIcH2yXDoe3uAkuWLFUbJcW22qPP+8toTQqRIbzt+HFcDAXRhBVi6s7cHzHvBmmiH
+        kpqUrVu7JESAB2hPvaa2NlCRut3SMxHszHufe7y8N4CSLLx+vbFMCCBi585uRcp1z+HD0WH1wBx770W8
+        rFQ6/jn8Y4/pNvQC4BdKSroVaXW1irW3h15C+HstlURbQCYmRevYFyU5aWfPxrNRozQBBWBfLFE1wadI
+        XS75vbi/IXQnJSx/gJspA/NTltR73e7on3oWt3wAVBbxKVKXKzwSwmscF4iD7KpuANJFq2S2T/4sHSub
+        BCtz/CLVdN7x7kIuV/gkBDfk/YYYpnqvWwsNK1UrkuqbN5v2iAJYLHBygPZ2LiHMYV3AWypJjVLp0hNC
+        jWCWSmU73tNPG/JEAdatg40DHDkCdvp0+CQE98AzOwy+8BldqFF0muMSYvr0yOWiAKtXdylSlyu8EoID
+        zPs/B0RQoaukWpm3Gxpirl53nfpmUYAnnoClCyC8EoIDTCzvOlJOLlA+Vnm5+QehCp1vF5ozB2s4gNMZ
+        XgnBAYba1cy0D2z/Eelkee5cPJVlYv4qLY1qz8gwuCQBJk7Esi4AZQsq2DzQ1BTHoqn6tr6ia6fjhQIq
+        GPxTVhZ1kU5aTRs3mmqefdZQMn++7oUJE7Rpej2ulayNem+OHImH6GuLp/oQrHFiz/EF+NFHsVcdjqgf
+        snMMX4xaEPE1lUV2LFqk25SSol0yaJDqVrHPVFLG+87E/IfBgDtKS1X/ymVDMSN5KZCXBKuqoi4VFprP
+        8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B
+        bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe
+        incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==
+</value>
+  </data>
+  <data name="mbox_question.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+        XEMBOS4mtwAAA1pJREFUaEPtl11oUmEYx/2aigx30ag2XXURYQwTkiBDMaSrugi61CBidhVaKUF4M6Iy
+        ugga9kHBRqMkKiq6ihYYMYqtj6tiUBch0UAq4oSY0Nbs/4xz4PBybJ4v5wGFP8ej7/ue/+99nvO872tu
+        NBomQ38IwMgytPnl7DHy7HcBOiF63RQSRwHlOAaN9fb2vnW5XN+dTudvfK95vd5v4XD4/ejo6KNqtZpD
+        n4PQdsiqNoqaRACmh6E3EC0q/5Xb7ebS6fRYxwDAcADiVjIu/t9sNjcSicQsIE5DATVRUBUBmLJAH+SY
+        F7fN5XLPYJ6isVcphFqA/UrNUz+8H3WO467wEDuVQKgFuMEC2O32xWQy+XJmZuZmpVK5Vi6XrxeLxfs+
+        n++rFGyhUHjMA5zHtUcuhFqAV6ypeDz+mjd0Edc9UD/kHBkZGUTbRbZ9KpV6wbenVBpuN8BH1tDU1NRt
+        3tA+psT2oO0ftn0mk3kuAoi2G2BWbGhoaOiHyMwgA3BAKoUmJiYeiPqE2w0QHRgYqGDRqvn9/i+lUumW
+        FACM26E5FqCvr69Wr9cLqwbAz1YWVxLlsKBTzOxfZc1bLJalfD7/hOm3pa0R4B+2GVcSmaZKchRaLxiB
+        8ROseZvNtoBtxVPG/Fncy95aqKpCK80WjFPe/xUDYH/E3cOHMX8J97Q3ku1HdodWHwLTG6FfYvMOh+Pn
+        9PT0JGOeyu2OVsdl2+kJcJdNHabi0PtyDtqk1Dz10wUAxtdAC2IA2jZI5PxaNeb1BIiysx8MBj+rrThS
+        sHpFYBsLkM1mS4YBWA6tyXSHIGjvHwqFPtVqtcsiACq3mkyeJoM0M4NqGaQdKTPz9PIeMQQATNJ+SLxC
+        C99l73maAesaAf6hhxiIw7iXveK2FQC53w8dE4SD/EmPx7MLJpxapY4wjuYRgGk6J7+T2DrTqhwwAoBD
+        at/P/3a8C8CUXz1SqGkEIpEIHV6i0AatIqEHgBXpMs+mkdVqXRofH3/IV6QLuHq0gNAcgF+Ft+LQMhmL
+        xeYESZy+dncsAG/M1mQRExazLsBytLUIY5MxLPj9TJMo0BFS9gFe6jl6AtDY66CEhBSdf1cDQO8J0jWF
+        dDev9zvQBWilwLRllloxorRNF0DpzGnVz/AR+AcOBL1o7Kmu0QAAAABJRU5ErkJggg==
+</value>
+  </data>
+  <data name="Yes">
+    <value>Ja</value>
+  </data>
+  <data name="Bri">
+    <value>Hell</value>
+  </data>
+  <data name="Cancel">
+    <value>Abbrechen</value>
+  </data>
+  <data name="window" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAfNJREFUaEPtmk8o
+        REEcxxe7J/9WbvawVxcpBzkhpUi5OLg67EWSFAclxcnJHrW5UFw4iDO2uMiKZ6WltSVa689jd7Nr/6j3
+        NbslntFr9Gqnec3W57avme98f7/vTO9NGQCb0L+CAJEhi49WgiYo4wUBneXlRQGklsTBbi/OeVpcAQ4p
+        gG+52aUDnBu+4mcTO+uQb2oBRKLGiQ+SQqPFFOrqhXpPdjOR6BvAC5l7jxTAyzVrO3AcPMHG4gJFKHrH
+        1CcrCjCyThPOsvXZEeZwiCkdCpZ0Yxs6cLC/C9/kMEXw+opJgGeNbHJDNEqCTcA26rEJu44ddEkBkA7I
+        EvruIdnERhsY9xS6Sb2hkPm/uc1lmWJ0KwzM79FEcmwxeoZlnMKn4wLb7DHK63jwn3GtfZT4z0rw+q90
+        gNfKf41rcQfSaTzEYhT3uRxTjJbCHUMHEl7vny99VL+fScDE7AJc7laK8yeV6fnGlya4VLeO/uQg+z5g
+        VoBnbIa8Z22gUGKPTAKqn2phe7TpaHvtkALAWkLSAVlCJlOIewm9rq4i39xM8RwIMKUIdwFmN6LIewah
+        eJIiqmlMC3CpJRDS4jrC2ht7jJoVUIrnLX4WEuBVu3SgFHVuNIalHGh3OJCprEJKJMics+QTU7fQFz2K
+        N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="folder_star" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACKZJREFUaEPVmg1M
+        lPcdx//3fs9z99yBEJt1WzqTrc2SZmk6a+K2LpvGtGE1jd1qRnWmXRpaK77WicU5GOCqgnIg4AsHihYq
+        xyFUsWoEkbM4DirH+/sd9waKAqIyqw3+f/s9d0B5u+OgGK4kv+S457k/38/v/3v7P4cAAMgP+ocH+CHb
+        vIqvWK3+HZrYmwPxuszb9XkFMIaqMyvXqT//+u8q4VQiq95VLTKuVRv9FuBGmKrUtIGjNVu4zNqPOcFY
+        oTVbuT+ZNnJ91R+qHvktQO02zlq/U0kbditpY7QihRfaFKMQNv1bEdf4L+WT+kglrfsHN+iXAHURSgmK
+        HGreo6Ct+xW07SBL2zRscruGvdyWyNLWBJa2fKqgCDPglwDo6Z/zwtuTWGo+zFBLOkM7M4dNy1DzUYZ2
+        pCDUAbZ3XgGwivwULaTqPdUKUzj3BwyZ36L4JejhDzpSUXAGQ22fyan9tJw68mTUqZdRhw5/z5FT6wk5
+        D9Iz5wDY+KRoCl/6B4pXGNeoG258qKK12zmMdSVtjWdpRxrjEujIldOuQhm9+aWU3rrktpsXpLT7nBuG
+        h7McY+5jeNViuBXWf6I8iMm9CR2yEtdWT1lGUZyYZcnzS5eSNaGhZOeWLUQTHU1yEhJIyeHDpCE7m/To
+        dKR/82ZyDe8dVz2mLIfvqX5p2sTd55OyGeO6/RDrChdePC+0p1hK71yT0DvXJbT3upj2lkvo7VI3iPMM
+        QpzCnTjCuPKCdwBWLIoV7DMsw2IXwEsvkRe3bSOavXvJ+eRkUnn8OLEbDOSxzUagq8uzNTcT+tpr5C++
+        7ARWnNDGKCVticfYPiJHz6KHv5DCrWIJ3Lkuhv5qEQzUozUI4W6tmPZXiumdMolrZ/jQ4oHbk1nKJz2G
+        obZ6A+fqHYRhyMKsLNLrTai3a1FRJGcsAL97zz5LfrFiBQl9/32yIzKSaPbvJ7kpKaSsNEE60JbEgCVT
+        Do48Kdy8iOK/QvE1IrjfJoRBmwAG7QJ4YBbRe40i2meU0J4SKe36YngXMOxa9ilSGv6pHN11EhJC3p3O
+        094AjEZyf98+cjotjZzHnTPl5pJbFRXkid0+eeec+J75lBysWTJwFri932sUw71mIfzPIYBHfQQe3yXw
+        8KaQPugQ0bsm3AWDhHYXyaj9c1dCx0/cbbJmDYmYrfdn+jmbSQgdRxiwnpRBVyECXJFAX5UI7rUK4WG3
+        AL4dJDD0LYFHvQI62CmkAxhKfG7wYYRV6gkm8/JJAKtWkc0zFTKb+61GETTvY6HjEAJMuwMCTzvQgxXs
+        x+NCdvlyEjYbQTP5jOWaCOoiFdAUy0K7hoHO4RzonioHMJQemIWYzCLaWyGht4ql4CyU4a7JoSNVDpgD
+        XzXsUkpGIMjLL5O3LBbv1WYmYife21EshhvrOajdpoTGKAW0JjBgPioHezbmwbgqJMYqhNYggrs1YujD
+        3LhdJoHuL6WY8DKEZqAtiYXhKpQ4CrBwIfl1dfXTA2i+IoKyoxK4+KkMru5loPIACw0pfCViwJ4rh65z
+        MkxmKdw2YEX677CVS6CnVArdF9D7Z2SAfQCwDwBfgvlSPNwHVo+cJn9SXEwefh8vO50EsBrB6dMCyMoS
+        o0nhJG75iRMs6HQcVFUtAKczGHvKd2a9ogLsxIDNDBNaBt3nsaxechsvnAfDTgy2IhYcTYHQVhkIcX+T
+        R2An/j124mXYiZeOALBY+np8AWhqIlBUJEBhIhQpQZPhawbFKqCkJAAslqBxIscKnvi686IaYxrzIYMB
+        HBcAq4wrVHjROAsBzkIuQOslzrVmQYG6H3tM4KQqxL+Rnk7MUwHk5YlQoBSN96YCF1FBXd0Cn0V6AzCf
+        VQNOo4DTKOA0ChZ0hL1cDZ0nEUrL5wkDOI2CtUTt+nupqarqqTq+a5RITSU1UwMo5kTsVCBtOjXgeYBP
+        SmjXKsHR6naMvQ7D5RCLyc4CngfAWh7oej8uTnnGI4BGQ65NBGhpIXARt9mbF7/PtZasAKxMHLSdUoPT
+        Pj70bF8HQmOMEnD4A5vJDbZxI3PAIwDOKhcmApw7J4TOTt9jeqYwzRmB0H7e7d2prLN8AZi2cOAwB7kK
+        QEiIbINHgNhYopsIkJ8veWre5wU7bdM7x2Jwe7+8PHDomWfIix4Bdu0iGRMB9FgNZurVp3W/VqvqxAo0
+        5aMXVxLzZ4HJAKzfAMTHK0s9nTlcAGFhJHYsgMNBID/fXX/9wSIj2eNeAfDYuGMsgMEggOrquan3c+GA
+        devkUV4B8Fi4fixAfr7ILzzPw7e0BMGSJdJVXgFeeYX8deypLA+Pe3PhublYIz8/YAATOMArwHPPkd/U
+        1X03ker1OGD5SfwnJ3O13h4auJIYf35WVkYej4SRXv/0RoiZOiYmRlnoC4AqP9/9ZKKxkcDlywF+swPh
+        4QrNtAD8DVotsfIAZ88KwWr1j/LpcATDypWyTT4B4GOReh4gL0/sN943GAKfLFok/ZVPAElJ5DoPoNP5
+        zwiRmqrs8zRCjJ6JR17gc89LPIBe7z8jRGwsa/HmfVcBGrlhzx6i55+mFRT4zwixc6f8rM8Au3eTE1ev
+        CqCmZn5GCJstGAyGgG+ys1Xm9HTu6sGD3Km33/bcgSeF0Pbt5BB/Bp5pnZ7J/XxVMRoXDOXkqJzHjnEV
+        Go1SHxWlSAwLYz5etky6Ch/p/2g6j0+8PhpC69eT/+j1czNCmPAYqNer+rVarjYxkSuKjlYe/ugj+a7X
+        X5euDQ4mz2NiimYq1OsowV9cu5Z8otMxPu9AY2MQ9gz1NxkZnCUpSVkSE6M4Hh7Oxr35puyDF16QLEaR
+        Xr+gnnOAN94g4Xl540eI9vYg/mA/lJmpuJ2WpjBhVdBt3apIWL2a2bp4sWwFilTPlZDZrjMaQvgtzR8j
+        IpjOhATWsGMHk/7OO/LIV1+V/nk2cTlbMbP53Lz+q8FsBHtM4rlYbD7W+D9MzRR6eEGuxwAAAABJRU5E
+        rkJggg==
+</value>
+  </data>
+  <data name="errorProvider.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
+        AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////
+        //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP
+        +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+        +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/
+        //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP
+        +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA
+        AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+        +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg
+        /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP
+        +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP
+        +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX
+        +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////
+        //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/mcs/tools/xbuild/tests/MSBuild/MSBuild.csproj b/mcs/tools/xbuild/tests/MSBuild/MSBuild.csproj
new file mode 100644 (file)
index 0000000..ec8d118
--- /dev/null
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <Target Name="Main" >
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/MakeDir/MakeDir.csproj b/mcs/tools/xbuild/tests/MakeDir/MakeDir.csproj
new file mode 100644 (file)
index 0000000..5b3a2c1
--- /dev/null
@@ -0,0 +1,17 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <!-- DirectoryScanner can only select files so we can not select directories by '*' -->
+               <DirectoriesToCreate Include="a;b;c" />
+       </ItemGroup>
+       <Target Name="CreateDirectories" >
+               <MakeDir Directories="@(DirectoriesToCreate)" >
+                       <Output TaskParameter="DirectoriesCreated" ItemName="DirectoriesCreated" />
+               </MakeDir>
+               <Message Text="Directories successfully created: @(DirectoriesCreated)" />
+       </Target>
+       
+       <Target Name="Clean">
+               <RemoveDir Directories="@(DirectoriesToCreate)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Message/Message.csproj b/mcs/tools/xbuild/tests/Message/Message.csproj
new file mode 100644 (file)
index 0000000..f3ac0a1
--- /dev/null
@@ -0,0 +1,6 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <Target Name="Main" >
+               <Message Text="Message's text." />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/ReadLinesFromFile/ReadLinesFromFile.csproj b/mcs/tools/xbuild/tests/ReadLinesFromFile/ReadLinesFromFile.csproj
new file mode 100644 (file)
index 0000000..7475e4b
--- /dev/null
@@ -0,0 +1,9 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <Target Name="Main" >
+               <ReadLinesFromFile File="file" >
+                       <Output TaskParameter="Lines" ItemName="Lines" />
+               </ReadLinesFromFile>
+               <Message Text="Read lines: @(Lines)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/ReadLinesFromFile/file b/mcs/tools/xbuild/tests/ReadLinesFromFile/file
new file mode 100644 (file)
index 0000000..de98044
--- /dev/null
@@ -0,0 +1,3 @@
+a
+b
+c
diff --git a/mcs/tools/xbuild/tests/RemoveDir/RemoveDir.csproj b/mcs/tools/xbuild/tests/RemoveDir/RemoveDir.csproj
new file mode 100644 (file)
index 0000000..03b3ad2
--- /dev/null
@@ -0,0 +1,16 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <DirectoriesToRemove Include="a;b;c" />
+       </ItemGroup>
+       <Target Name="Main" >
+               <MakeDir Directories="@(DirectoriesToRemove)" >
+                       <Output TaskParameter="DirectoriesCreated" ItemName="DirectoriesCreated" />
+               </MakeDir>
+               <Message Text="Created directories: @(DirectoriesCreated)" />
+               <RemoveDir Directories="@(DirectoriesToRemove)">
+                       <Output TaskParameter="RemovedDirectories" ItemName="RemovedDirectories" />
+               </RemoveDir>
+               <Message Text="Removed directories: @(RemovedDirectories)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/SignFile/SignFile.csproj b/mcs/tools/xbuild/tests/SignFile/SignFile.csproj
new file mode 100644 (file)
index 0000000..ec8d118
--- /dev/null
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <Target Name="Main" >
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Touch/Touch.csproj b/mcs/tools/xbuild/tests/Touch/Touch.csproj
new file mode 100644 (file)
index 0000000..58b11ba
--- /dev/null
@@ -0,0 +1,16 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <Files Include="a;b;c" />
+       </ItemGroup>
+       <Target Name="Main" >
+               <Touch Files="@(Files)" AlwaysCreate="true" >
+                       <Output TaskParameter="TouchedFiles" ItemName="TouchedFiles" />
+               </Touch>
+               <Message Text="Touched files: @(TouchedFiles)" />
+       </Target>
+       
+       <Target Name="Clean" >
+               <Delete Files="@(Files)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Warning/Warning.csproj b/mcs/tools/xbuild/tests/Warning/Warning.csproj
new file mode 100644 (file)
index 0000000..64171a9
--- /dev/null
@@ -0,0 +1,6 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <Target Name="Main" >
+               <Warning Text="Warning's text." />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/WriteLinesToFile/WriteLinesToFile.csproj b/mcs/tools/xbuild/tests/WriteLinesToFile/WriteLinesToFile.csproj
new file mode 100644 (file)
index 0000000..b3159a5
--- /dev/null
@@ -0,0 +1,10 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       <Import Project="$(MSBuildBinPath)/Microsoft.Common.tasks" />
+       <ItemGroup>
+               <File Include="file" />
+       </ItemGroup>
+       <Target Name="Main" >
+               <Touch Files="@(File)" AlwaysCreate="true"/>
+               <WriteLinesToFile File="@(File)" Lines="a;b;c;d" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/xbuild.exe.sources b/mcs/tools/xbuild/xbuild.exe.sources
new file mode 100644 (file)
index 0000000..da20cf2
--- /dev/null
@@ -0,0 +1,6 @@
+../../build/common/Consts.cs
+AssemblyInfo.cs
+CommandLineException.cs
+LoggerInfo.cs
+Main.cs
+Parameters.cs
diff --git a/mcs/tools/xbuild/xbuild.mdp b/mcs/tools/xbuild/xbuild.mdp
new file mode 100644 (file)
index 0000000..7c4be66
--- /dev/null
@@ -0,0 +1,32 @@
+<Project name="xbuild" fileversion="2.0" language="C#" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Debug" assembly="xbuild" />
+      <Build debugmode="True" target="Exe" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="./bin/Release" assembly="xbuild" />
+      <Build debugmode="False" target="Exe" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+      <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
+  <Contents>
+    <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
+    <File name="./CommandLineException.cs" subtype="Code" buildaction="Compile" />
+    <File name="./LoggerInfo.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Main.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Parameters.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Engine" />
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Tasks" />
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Framework" />
+    <ProjectReference type="Project" localcopy="True" refto="Microsoft.Build.Utilities" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/mcs/tools/xbuild/xbuild.mds b/mcs/tools/xbuild/xbuild.mds
new file mode 100644 (file)
index 0000000..dd5a891
--- /dev/null
@@ -0,0 +1,16 @@
+<Combine name="xbuild" fileversion="2.0">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="xbuild" />
+    </Configuration>
+    <Configuration name="Release" ctype="CombineConfiguration">
+      <Entry configuration="Debug" build="True" name="xbuild" />
+    </Configuration>
+  </Configurations>
+  <StartMode startupentry="xbuild" single="True">
+    <Execute type="None" entry="xbuild" />
+  </StartMode>
+  <Entries>
+    <Entry filename="./xbuild.mdp" />
+  </Entries>
+</Combine>
\ No newline at end of file
diff --git a/mcs/tools/xbuild/xbuild.rsp b/mcs/tools/xbuild/xbuild.rsp
new file mode 100644 (file)
index 0000000..e69de29
index 43647c10abf6826dc83900b66d9077455080a82f..f6433ce994eed4215dd7779c71009c843df652b8 100644 (file)
@@ -1,3 +1,16 @@
+2005-09-11  Zoltan Varga  <vargaz@gmail.com>
+
+       * ia64/ia64-codegen.h (ia64_unw_pop_frames): New unwind macro.
+
+2005-09-10  Zoltan Varga  <vargaz@gmail.com>
+
+       * ia64/ia64-codegen.h: Remove 'manual' emitting of instructions. 
+       Integrate emission of unwind directives into the assembly macros.
+
+2005-09-04  Zoltan Varga  <vargaz@gmail.com>
+
+       * ia64/ia64-codegen.h (ia64_no_stop): New macro.
+
 2005-08-27  Zoltan Varga  <vargaz@gmail.com>
 
        * ia64/ia64-codegen.h: Fix some bugs.
index 6c84d13a1553b3269a5fea4ccf6ff1f4a1191e9c..185228f2e745887318c763b1e3f3545d6bca07df 100644 (file)
 #define _IA64_CODEGEN_H_
 
 #include <glib.h>
+#include <string.h>
+
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
 
 typedef enum {
        IA64_INS_TYPE_A,
@@ -111,6 +115,7 @@ typedef enum {
 } Ia64BranchRegister;
 
 typedef enum {
+       IA64_CCV = 32,
        IA64_PFS = 64
 } Ia64ApplicationRegister;
 
@@ -163,6 +168,7 @@ typedef enum {
        IA64_WRITE_FR,
        IA64_READ_AR,
        IA64_WRITE_AR,
+       IA64_NO_STOP,
        IA64_END_OF_INS,
        IA64_NONE
 } Ia64Dependency;
@@ -175,15 +181,19 @@ typedef enum {
  */
 
 #define IA64_INS_BUFFER_SIZE 4
+#define MAX_UNW_OPS 8
 
 typedef struct {
        guint8 *buf;
-    guint automatic : 1;
        guint one_ins_per_bundle : 1;
+       int nins, template, dep_info_pos, unw_op_pos, unw_op_count;
        guint64 instructions [IA64_INS_BUFFER_SIZE];
-       int itypes [IA64_INS_BUFFER_SIZE], stops [IA64_INS_BUFFER_SIZE];
+       int itypes [IA64_INS_BUFFER_SIZE];
+       guint8 *region_start;
        guint8 dep_info [128];
-       int nins, template, dep_info_pos;
+       unw_dyn_op_t unw_ops [MAX_UNW_OPS];
+       /* The index of the instruction to which the given unw op belongs */
+    guint8 unw_ops_pos [MAX_UNW_OPS];
 } Ia64CodegenState;
 
 #ifdef IA64_SIMPLE_EMIT_BUNDLE
@@ -192,22 +202,14 @@ G_GNUC_UNUSED static void ia64_emit_bundle (Ia64CodegenState *code, gboolean flu
 void ia64_emit_bundle (Ia64CodegenState *code, gboolean flush);
 #endif
 
-/*
- * There are two code generation modes:
- * - in automatic mode, bundling and stops are handled automatically by the
- *   code generation macros.
- *   FIXME: In order to simplify things, we emit a stop after every instruction for
- *   now.
- * - in non-automatic mode, the caller is responsible for handling bundling and
- *   stops using the appropriate macros.
- */
-
 #define ia64_codegen_init(code, codegen_buf) do { \
     code.buf = codegen_buf; \
+    code.region_start = code.buf; \
     code.nins = 0; \
-    code.automatic = 1; \
     code.one_ins_per_bundle = 0; \
     code.dep_info_pos = 0; \
+    code.unw_op_count = 0; \
+    code.unw_op_pos = 0; \
 } while (0)
 
 #define ia64_codegen_close(code) do { \
@@ -218,25 +220,34 @@ void ia64_emit_bundle (Ia64CodegenState *code, gboolean flush);
     ia64_emit_bundle (&code, TRUE); \
 } while (0)
 
-#define ia64_codegen_set_automatic(code, is_automatic) do { \
-    code.automatic = (is_automatic); \
-} while (0)
-
 #define ia64_codegen_set_one_ins_per_bundle(code, is_one) do { \
     ia64_begin_bundle (code); \
     code.one_ins_per_bundle = (is_one); \
 } while (0)
 
-#define ia64_stop(code) do { \
-    g_assert ((code.nins > 0)); \
-    code.stops [code.nins - 1] = 1; \
-} while (0)
-
 #define ia64_begin_bundle_template(code, bundle_template) do { \
     ia64_emit_bundle (&code, TRUE); \
     code.template = (bundle_template); \
 } while (0)
 
+#define ia64_unw_save_reg(code, reg, dreg) do { \
+    g_assert (code.unw_op_count <= MAX_UNW_OPS); \
+    code.unw_ops_pos [code.unw_op_count] = code.nins; \
+       _U_dyn_op_save_reg (&(code.unw_ops [code.unw_op_count ++]), _U_QP_TRUE, -1, reg, dreg); \
+} while (0)
+
+#define ia64_unw_add(code, reg, val) do { \
+    g_assert (code.unw_op_count <= MAX_UNW_OPS); \
+    code.unw_ops_pos [code.unw_op_count] = code.nins; \
+       _U_dyn_op_add (&(code.unw_ops [code.unw_op_count ++]), _U_QP_TRUE, code.nins, reg, val); \
+} while (0)
+
+#define ia64_unw_pop_frames(code, nframes) do { \
+    g_assert (code.unw_op_count <= MAX_UNW_OPS); \
+    code.unw_ops_pos [code.unw_op_count] = code.nins; \
+       _U_dyn_op_pop_frames (&(code.unw_ops [code.unw_op_count ++]), _U_QP_TRUE, code.nins, (nframes)); \
+} while (0)
+
 #if 0
 /* To ease debugging, emit instructions immediately */
 #define EMIT_BUNDLE(itype, code) ((itype != IA64_INS_TYPE_LX) || (code.nins == 2)) ia64_emit_bundle (&code, FALSE);
@@ -245,21 +256,19 @@ void ia64_emit_bundle (Ia64CodegenState *code, gboolean flush);
 #endif
 
 #define ia64_emit_ins(code, itype, ins) do { \
-    if (G_LIKELY (code.automatic)) { \
-               code.instructions [code.nins] = ins; \
-        code.itypes [code.nins] = itype; \
-        code.nins ++; \
-        code.dep_info [code.dep_info_pos ++] = IA64_END_OF_INS; \
-        code.dep_info [code.dep_info_pos ++] = 0; \
-        EMIT_BUNDLE (itype, code); \
-        if (code.nins == IA64_INS_BUFFER_SIZE) \
-           ia64_emit_bundle (&code, FALSE); \
-    } else { \
-        g_assert (code.nins < 3); \
-        code.instructions [code.nins] = ins; \
-        code.itypes [code.nins] = itype; \
-        code.nins ++; \
-    } \
+    code.instructions [code.nins] = ins; \
+    code.itypes [code.nins] = itype; \
+    code.nins ++; \
+    code.dep_info [code.dep_info_pos ++] = IA64_END_OF_INS; \
+    code.dep_info [code.dep_info_pos ++] = 0; \
+    EMIT_BUNDLE (itype, code); \
+    if (code.nins == IA64_INS_BUFFER_SIZE) \
+        ia64_emit_bundle (&code, FALSE); \
+} while (0)
+
+#define ia64_no_stop(code) do { \
+     code.dep_info [code.dep_info_pos ++] = IA64_NO_STOP; \
+     code.dep_info [code.dep_info_pos ++] = 0; \
 } while (0)
 
 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
@@ -1685,7 +1694,7 @@ typedef enum {
 
 #define ia64_br_call_hint_pred(code, qp, b1, disp, bwh, ph, dh) ia64_b3 ((code), (qp), (b1), (disp), (bwh), (ph), (dh))
 
-#define ia64_b4(code, qp, b2, bwh, ph, dh, x6, btype) do { read_pr ((code), (qp)); read_br ((code), (b2)); check_bwh ((bwh)); check_ph ((ph)); check_dh ((dh)); ia64_emit_ins_8 ((code), IA64_INS_TYPE_B, (qp), 0, (btype), 6, (ph), 12, (b2), 13, (x6), 27, (bwh), 33, (dh), 35, (0), 37); } while (0)
+#define ia64_b4(code, qp, b2, bwh, ph, dh, x6, btype) do { read_pr ((code), (qp)); read_br_branch ((code), (b2)); check_bwh ((bwh)); check_ph ((ph)); check_dh ((dh)); ia64_emit_ins_8 ((code), IA64_INS_TYPE_B, (qp), 0, (btype), 6, (ph), 12, (b2), 13, (x6), 27, (bwh), 33, (dh), 35, (0), 37); } while (0)
 
 #define ia64_br_cond_reg_hint_pred(code, qp, b1, bwh, ph, dh) ia64_b4 ((code), (qp), (b1), (bwh), (ph), (dh), 0x20, 0)
 #define ia64_br_ia_reg_hint_pred(code, qp, b1, bwh, ph, dh) ia64_b4 ((code), (qp), (b1), (bwh), (ph), (dh), 0x20, 1)
@@ -1892,7 +1901,7 @@ typedef enum {
 
 #define ia64_break_x_pred(code, qp, imm) ia64_x1 ((code), (qp), (imm), 0, 0x00)
 
-#define ia64_x2(code, qp, r1, imm, vc) do { if (code.automatic && (code.nins > IA64_INS_BUFFER_SIZE - 2)) ia64_emit_bundle (&(code), FALSE); read_pr ((code), (qp)); write_gr ((code), (r1)); ia64_emit_ins_1 ((code), IA64_INS_TYPE_LX, ((gint64)(imm) >> 22) & 0x1ffffffffffULL, 0); ia64_emit_ins_9 ((code), IA64_INS_TYPE_LX, (qp), 0, (r1), 6, (gint64)(imm) & 0x7f, (13), (vc), 20, ((gint64)(imm) >> 21) & 0x1, 21, ((gint64)(imm) >> 16) & 0x1f, 22, ((gint64)(imm) >> 7) & 0x1ff, 27, ((gint64)(imm) >> 63) & 0x1, 36, (6), 37); } while (0)
+#define ia64_x2(code, qp, r1, imm, vc) do { if (code.nins > IA64_INS_BUFFER_SIZE - 2) ia64_emit_bundle (&(code), FALSE); read_pr ((code), (qp)); write_gr ((code), (r1)); ia64_emit_ins_1 ((code), IA64_INS_TYPE_LX, ((gint64)(imm) >> 22) & 0x1ffffffffffULL, 0); ia64_emit_ins_9 ((code), IA64_INS_TYPE_LX, (qp), 0, (r1), 6, (gint64)(imm) & 0x7f, (13), (vc), 20, ((gint64)(imm) >> 21) & 0x1, 21, ((gint64)(imm) >> 16) & 0x1f, 22, ((gint64)(imm) >> 7) & 0x1ff, 27, ((gint64)(imm) >> 63) & 0x1, 36, (6), 37); } while (0)
 
 #define ia64_movl_pred(code, qp, r1, imm) ia64_x2 ((code), (qp), (r1), (imm), 0)
 
index df0f03a2ad3474891fd671118c20ce09f9579869..13ac767705133f8024885166e062ad1263f6bfff 100644 (file)
@@ -1,3 +1,45 @@
+2005-09-20  Ankit Jain  <jankit@novell.com>
+
+       * monodis.1: Update documentation for --output.
+
+2005-09-20  Ankit Jain  <jankit@novell.com>
+
+       * main.c (table_list): Add --mresources to the table.
+         (usage): Don't add "--mresources" explicitly for usage output.
+         (main): Remove explicit handling for --mresources.
+
+2005-09-20  Ankit Jain  <jankit@novell.com>
+
+       * main.c (main): Dump managed resources when --output is specified.
+
+2005-09-08  Ankit Jain  <jankit@novell.com>
+
+       * monodis.1: Document --customattr, --declsec, --forward-decls, --implmap,
+         --marshal, --methodimpl, --methodspec, --mresources, --nested, --standalonesig,
+         and --typespec.
+
+2005-09-08  Ankit Jain  <jankit@novell.com>
+
+       * main.c (dis_nt_header): New. Dump pe_stack_reserve if different from the
+         default value (0x100000).
+         (disassemble_file): Call dis_nt_header.
+
+2005-09-06  Ankit Jain  <jankit@novell.com>
+
+       * main.cs (dis_directive_assemblyref): Use the row id into the AssemblyRef
+         table instead of 1 for dump_cattrs.
+         Spotted by Harinath.
+
+2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       quick build fix.
+       * get.cs : (dis_get_custom_attrs) added assembly reference support.
+       * main.cs: (dis_directive_assemblyref) use MONO_TOKEN_ASSEMBLY_REF.
+
+2005-09-05  Ankit Jain  <jankit@novell.com>
+
+       * main.c (dis_directive_assemblyref): Dump custom attributes.
+
 2005-08-29  Ankit Jain  <jankit@novell.com>
 
        * get.c (dis_stringify_marshal_spec): Add new case for MONO_NATIVE_CUSTOM.
index 60a3697acf99f3402cc90bb487b0625d171285f0..4fe67d70d830c896f7db1f1346fe7c828f85f29b 100644 (file)
@@ -2302,6 +2302,9 @@ dis_get_custom_attrs (MonoImage *m, guint32 token)
        case MONO_TABLE_ASSEMBLY:
                idx |= MONO_CUSTOM_ATTR_ASSEMBLY;
                break;
+       case MONO_TABLE_ASSEMBLYREF:
+               idx |= MONO_CUSTOM_ATTR_ASSEMBLYREF;
+               break;
        case MONO_TABLE_MODULE:
                idx |= MONO_CUSTOM_ATTR_MODULE;
                break;
index bc5cdaa5baa3fef35d3493b9dc8caaef2ca3dad1..8242bb9970b8f51f8fb0f8458abd215f8a2e4892 100644 (file)
@@ -211,6 +211,7 @@ dis_directive_assemblyref (MonoImage *m)
                         cols [MONO_ASSEMBLYREF_MAJOR_VERSION], cols [MONO_ASSEMBLYREF_MINOR_VERSION], 
                         cols [MONO_ASSEMBLYREF_BUILD_NUMBER], cols [MONO_ASSEMBLYREF_REV_NUMBER]
                        );
+               dump_cattrs (m, MONO_TOKEN_ASSEMBLY_REF | (i + 1), "  ");
                if (cols [MONO_ASSEMBLYREF_CULTURE]){
                        fprintf (output, "  .locale %s\n", mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_CULTURE]));
                }
@@ -265,6 +266,14 @@ dis_directive_moduleref (MonoImage *m)
        
 }
 
+static void
+dis_nt_header (MonoImage *m)
+{
+       MonoCLIImageInfo *image_info = m->image_info;
+       if (image_info && image_info->cli_header.nt.pe_stack_reserve != 0x100000)
+               fprintf (output, ".stackreserve 0x%x\n", image_info->cli_header.nt.pe_stack_reserve);
+}
+
 static void
 dis_directive_file (MonoImage *m)
 {
@@ -1371,6 +1380,7 @@ struct {
        { "--methodspec",  MONO_TABLE_METHODSPEC,       dump_table_methodspec },
        { "--moduleref",   MONO_TABLE_MODULEREF,        dump_table_moduleref },
        { "--module",      MONO_TABLE_MODULE,           dump_table_module },
+       { "--mresources",  0,   dis_mresource },
        { "--nested",      MONO_TABLE_NESTEDCLASS,      dump_table_nestedclass },
        { "--param",       MONO_TABLE_PARAM,            dump_table_param },
        { "--parconst",    MONO_TABLE_GENERICPARAMCONSTRAINT, dump_table_parconstraint },
@@ -1419,6 +1429,7 @@ disassemble_file (const char *file)
                dis_directive_mresource (img);
                dis_directive_module (img);
                dis_directive_moduleref (img);
+               dis_nt_header (img);
                 if (dump_managed_resources)
                        dis_mresource (img);
                if (dump_forward_decls) {
@@ -1707,7 +1718,7 @@ usage (void)
                if (((i-2) % 5) == 0)
                        g_string_append_c (args, '\n');
        }
-       g_string_append (args, "[--forward-decls]\n[--mresources]");
+       g_string_append (args, "[--forward-decls]");
        fprintf (stderr,
                 "monodis -- Mono Common Intermediate Language Dissassembler\n" 
                 "Usage is: monodis %s file ..\n", args->str);
@@ -1744,6 +1755,7 @@ main (int argc, char *argv [])
                                                 argv [i]+9, strerror (errno));
                                        exit (1);
                                }
+                               dump_managed_resources = TRUE;
                                continue;
                        } else if (strncmp (argv [i], "--filter=", 9) == 0) {
                                load_filter (argv [i]+9);
@@ -1751,9 +1763,6 @@ main (int argc, char *argv [])
                        } else if (strcmp (argv [i], "--forward-decls") == 0) {
                                dump_forward_decls = TRUE;
                                continue;
-                       } else if (strcmp (argv [i], "--mresources") == 0) {
-                               dump_managed_resources = TRUE;
-                               continue;
                        } else if (strcmp (argv [i], "--help") == 0)
                                usage ();
                        for (j = 0; table_list [j].name != NULL; j++) {
index fe7c8647aeb7e744de38ff25e5d7b18663f80132..9fdad5eea01e48e0314ac10f552f0a74fb2622d9 100644 (file)
@@ -4,7 +4,7 @@
 .\" Author:
 .\"   Miguel de Icaza (miguel@gnu.org)
 .\"
-.TH Mono "Mono 1.0"
+.TH Mono "Mono 1.1.x"
 .SH NAME
 monodis \- CIL image content dumper and disassembler.
 .SH SYNOPSIS
@@ -17,24 +17,35 @@ monodis \- CIL image content dumper and disassembler.
 [\-\-assemblyref]
 [\-\-classlayout]
 [\-\-constant]
+[\-\-customattr]
+[\-\-declsec]
 [\-\-event]
 [\-\-exported]
 [\-\-fields]
 [\-\-file]
+[\-\-forward-decls]
 [\-\-genericpar]
+[\-\-implmap]
 [\-\-interface]
 [\-\-manifest]
+[\-\-marshal]
 [\-\-memberref]
 [\-\-method]
+[\-\-methodimpl]
 [\-\-methodsem]
+[\-\-methodspec]
 [\-\-module]
 [\-\-moduleref]
+[\-\-mresources]
+[\-\-nested]
 [\-\-param]
 [\-\-parconst]
 [\-\-property]
 [\-\-propertymap]
+[\-\-standalonesig]
 [\-\-typedef]
 [\-\-typeref]
+[\-\-typespec]
 [\-\-blob]
 [FILES...]
 .SH DESCRIPTION
@@ -47,88 +58,116 @@ The following Generic options are supported:
 Displays usage instructions.
 .TP
 .I "--output=FILENAME"
-Write output into \fIFILENAME\fP.
+Write output into \fIFILENAME\fP and dump any embedded managed resources.
 .TP
 .I "--mscorlib"
 For non-corlib assemblies, use "mscorlib" as the assembly name. This
 is useful for round-tripping the IL with ilasm.
 .TP
 .I "--show-method-tokens"
-Display tokens for dissasembled methods
+Display tokens for dissasembled methods.
 .TP
 .I "--assembly"
-Dumps the contents of the assembly table
+Dumps the contents of the Assembly table.
 .TP
 .I "--assemblyref"
-Dumps the contents of the assemblyref table
+Dumps the contents of the AssemblyRef table.
 .TP
 .I "--classlayout"
-Dumps the contents of the classlayout table
+Dumps the contents of the ClassLayout table.
 .TP
 .I "--constant"
-Dumps the contents of the constant table
+Dumps the contents of the Constant table.
+.TP
+.I "--customattr"
+Dumps the contents of the CustomAttribute table.
+.TP
+.I "--declsec"
+Dumps the contents of the DeclSec table.
 .TP
 .I "--event"
-Dumps the contents of the event table
+Dumps the contents of the Event table.
 .TP
 .I "--exported"
-Dumps the contents of the ExportedTypes table
+Dumps the contents of the ExportedType table.
 .TP
 .I "--fields"
-Dumps the contents of the fields table
+Dumps the contents of the Field table.
 .TP
 .I "--file"
-Dumps the contents of the file table
+Dumps the contents of the File table.
+.TP
+.I "--forward-decls"
+Dumps forward declarations for classes.
 .TP
 .I "--genericpar"
-Dumps the contents of the generic parameter table.
+Dumps the contents of the GenericParam table.
+.TP
+.I "--implmap"
+Dumps the contents of the ImplMap table.
+.TP
 .I "--interface"
-Dumps the contents of the interface table
+Dumps the contents of the InterfaceImpl table.
 .TP
 .I "--manifest"
-Dumps the contents of the manifest table.
+Dumps the contents of the ManifestResource table.
+.TP
+.I "--marshal"
+Dumps the contents of the FieldMarshal table.
 .TP
 .I "--memberref"
-Dumps the contents of the memberref table
+Dumps the contents of the MemberRef table.
 .TP
 .I "--method"
-Dumps the contents of the method table
+Dumps the contents of the MethodDef table.
+.TP
+.I "--methodimpl"
+Dumps the contents of the MethodImpl table.
 .TP
 .I "--methodspec"
-Dumps the contents of the method spec table.
+Dumps the contents of the MethodSpec table.
 .TP
 .I "--methodsem"
-Dumps the contents of the methodsem table
+Dumps the contents of the MethodSemantics table.
 .TP
 .I "--module"
-Dumps the contents of the module table
+Dumps the contents of the Module table.
 .TP
 .I "--moduleref"
-Dumps the contents of the moduleref table
+Dumps the contents of the ModuleRef table.
+.TP
+.I "--mresources"
+Dumps the managed resources embedded in the assembly.
+.TP
+.I "--nested"
+Dumps the contents of the NestedClass table.
 .TP
 .I "--param"
-Dumps the contents of the param table
+Dumps the contents of the Param table.
 .TP
 .I "--parconst"
-Dumps the contents of the gemeric parameter constraint table
+Dumps the contents of the GenericParameterConstraint table.
 .TP
 .I "--property"
-Dumps the contents of the property table
+Dumps the contents of the Property table.
 .TP
 .I "--propertymap"
-Dumps the contents of the propertymap table
+Dumps the contents of the PropertyMap table.
+.TP
+.I "--standalonesig"
+Dumps the contents of the StandAloneSig table.
 .TP
 .I "--typedef"
-Dumps the contents of the typedef table
+Dumps the contents of the TypeDef table.
 .TP
 .I "--typespec"
-Dumps the contents of the typespec table
+Dumps the contents of the TypeSpec table.
 .TP
 .I "--typeref"
-Dumps the contents of the typeref table
+Dumps the contents of the TypeRef table.
 .TP
 .I "--blob"
-Dumps the entire contents of the blob stream as hex
+Dumps the entire contents of the blob stream as hex.
 .PP
 If no flags are specified the program dumps the content of the image
 in a format that can be used to rountrip the code.
index 3c9eb0f19d3635e8191f6e3ae82a5dfd431929a7..8edf962766fd0153a533ea7fc1737ece9272778b 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
 <monodoc>
-  <source provider="monohb" basefile="monoapi" path="embed"/>
+  <source provider="xhtml" basefile="monoapi" path="embed"/>
 </monodoc>
index 8c9ab8e35a9f832f03eaf867ffca868141b1b457..ff30e853b242f2bd13843aea383a929b66b11218 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * io.c:
+       (CreateFile): if the file is a named pipe, treat the handle as a pipe,
+       not as a file. Fixes bug #76075.
+
 2005-08-27  Zoltan Varga  <vargaz@gmail.com>
 
        * atomic.h: Add support for intel icc.
index d2c1d06494aaf17f21aa748fc2b2853c31e7c951..f831b22d06e900ddb795bcce7e6b568083fed499 100644 (file)
@@ -1428,6 +1428,7 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
        mode_t perms=0644;
        gchar *filename;
        int fd, ret;
+       int handle_type;
        struct stat statbuf;
        
        mono_once (&io_ops_once, io_ops_init);
@@ -1540,8 +1541,12 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
        file_handle.fileaccess=fileaccess;
        file_handle.sharemode=sharemode;
        file_handle.attrs=attrs;
-       
-       handle = _wapi_handle_new_fd (WAPI_HANDLE_FILE, fd, &file_handle);
+
+#ifndef S_ISFIFO
+#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
+#endif
+       handle_type = (S_ISFIFO (statbuf.st_mode)) ? WAPI_HANDLE_PIPE : WAPI_HANDLE_FILE;
+       handle = _wapi_handle_new_fd (handle_type, fd, &file_handle);
        if (handle == _WAPI_HANDLE_INVALID) {
                g_warning ("%s: error creating file handle", __func__);
                g_free (filename);
index 508b4cfa7c8cf99bd18681905d9584bf8b97aaef..4547addc68eab8869cb4aacc9851836b1a4fb7ef 100644 (file)
@@ -1,3 +1,140 @@
+2005-09-19  Zoltan Varga  <vargaz@gmail.com>
+
+       * appdomain.c (MONO_CORLIB_VERSION): Bump corlib version.
+
+       * icall.c (custom_attrs_defined_internal): New icall.
+
+       * reflection.c (mono_reflection_get_custom_attrs_by_type): New helper
+       function.
+       (mono_custom_attrs_construct_by_type): New helper function.
+
+2005-09-17  Zoltan Varga  <vargaz@freemail.hu>
+
+       * marshal.c (ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni): Null
+       terminate the resulting string. Fixes #76123.
+
+2005-09-16  Martin Baulig  <martin@ximian.com>
+
+       * mono-debug.c
+       (mono_debug_add_method): Ignore inflated methods for the moment.
+
+2005-09-14  Martin Baulig  <martin@ximian.com>
+
+       * debug-mono-symfile.h (MONO_SYMBOL_FILE_VERSION): Bump version to 39.
+
+2005-09-13  Zoltan Varga  <vargaz@gmail.com>
+
+       * metadata.c (mono_class_get_overrides_full): Modify signature to explicitly
+       return a success/failure indication.
+       (mono_metadata_interfaces_from_typedef_full): Ditto.
+       (get_constraints): Ditto.
+
+2005-09-12  Zoltan Varga  <vargaz@gmail.com>
+
+       * marshal.c (emit_marshal_array): Fix handling of null arrays.
+       
+       * marshal.c (emit_marshal_array): Add support for returning string
+       arrays from delegates. Fixes #76063.
+
+       * marshal.c: Use the emit_ldloc/stloc macros where possible.
+
+2005-09-11  Zoltan Varga  <vargaz@gmail.com>
+
+       * threads.c (ves_icall_System_Threading_Thread_MemoryBarrier): New
+       icall.
+
+2005-09-09  Zoltan Varga  <vargaz@gmail.com>
+
+       * reflection.c icall.c: Fix after mono_get_exception_type_load
+       signature change.
+
+       * assembly.c (mono_assembly_get_assemblyref): New helper function.
+       (mono_assembly_load_reference): Use the new helper.
+
+       * class-internals.h (MonoLoaderError): New structure containing 
+       information about type loading errors.
+
+       * class-internals.h loader.c: Add APIs to store per-thread loader
+       error information.
+
+       * loader.c class.c: Set the loader error if needed.
+
+       * exception.h exception.c: Add functions to throw MissingMethod/MissingFieldExceptions.
+
+Thu Sep 8 18:54:07 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * decimal.c: fixed to handle the broken ARM fp format.
+
+Wed Sep 7 22:17:58 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * icall.c: on ARM use the libc strtod(), since bsd_strtod() seems
+       broken.
+
+2005-09-06  Martin Baulig  <martin@ximian.com>
+
+       * domain.c (supported_runtimes): Added v2.0.50727.
+
+Tue Sep 6 11:40:24 CEST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * culture-info.h: reduce the size of some structures.
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Reflect latest API changes in the August CTP.
+
+       * icall.c
+       ("Type.BindGenericParameters"): Renamed to "MakeGenericType".
+       ("MonoType.HasGenericArguments"): Removed.
+       ("MonoMethod.BindGenericParameters"): Renamed to
+       "MakeGenericMethod".
+       ("MethodBuilder.BindGenericParameters"): Renamed to
+       "MakeGenericMethod".    
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       * mono-debug-debugger.c: Moved the debugger icalls into icall.c.
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Applying a patch from Michal Moskal <malekith@nemerle.org>.
+
+       * icall.c (ves_icall_Type_get_IsGenericType): Return true also if
+       generic_container is non-NULL.
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Applying a patch from Michal Moskal <malekith@nemerle.org>.
+
+       * object.c (set_value): In MONO_TYPE_VALUETYPE, add generics support.
+
+2005-08-29  Michal Moskal  <malekith@nemerle.org>
+
+       * reflection.c (encode_locals,
+       mono_reflection_sighelper_get_signature_local): Increase buffer sizes
+       for large generic types.
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Applying a patch from Michal Moskal <malekith@nemerle.org>.
+
+       * class.c (mono_dup_array_type): New public method.
+       (mono_metadata_signature_deep_dup): New public method.
+       (dup_type): Correctly duplicate array and function types.
+
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Applying a patch from Michal Moskal <malekith@nemerle.org>.
+
+       * reflection.c (get_default_param_value_blobs): Handle generic types
+       and generic methods.
+
+2005-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * class.c: Fixed error reporting (method/class were inversed) for 
+       inheritance demands.
+       * security-manager.c|h: Added the AppDomain when calling the managed
+       System.Security.SecurityManager.InheritanceDemand method.
+
 2005-09-01  Raja R Harinath  <rharinath@novell.com>
 
        * reflection.c (encode_marshal_blob): 'marshaltype' and
index 0e8c3b376368045ed1db18e18ae2c4a9955ca317..8d26abbac59298c69646a638f318a66512963141 100644 (file)
@@ -30,7 +30,7 @@
 #include <mono/metadata/threadpool.h>
 #include <mono/utils/mono-uri.h>
 
-#define MONO_CORLIB_VERSION 40
+#define MONO_CORLIB_VERSION 41
 
 CRITICAL_SECTION mono_delegate_section;
 
index f13f277e1dec35845864cc7abd3a004ad4ecf823..1bc2948829ae005e6484c8d84022e053f6836c14 100644 (file)
@@ -561,12 +561,45 @@ mono_assembly_remap_version (MonoAssemblyName *aname, MonoAssemblyName *dest_ana
        return aname;
 }
 
+/*
+ * mono_assembly_get_assemblyref:
+ *
+ *   Fill out ANAME with the assembly name of the INDEXth assembly reference in IMAGE.
+ */
 void
-mono_assembly_load_reference (MonoImage *image, int index)
+mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname)
 {
        MonoTableInfo *t;
        guint32 cols [MONO_ASSEMBLYREF_SIZE];
        const char *hash;
+
+       t = &image->tables [MONO_TABLE_ASSEMBLYREF];
+
+       mono_metadata_decode_row (t, index, cols, MONO_ASSEMBLYREF_SIZE);
+               
+       hash = mono_metadata_blob_heap (image, cols [MONO_ASSEMBLYREF_HASH_VALUE]);
+       aname->hash_len = mono_metadata_decode_blob_size (hash, &hash);
+       aname->hash_value = hash;
+       aname->name = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_NAME]);
+       aname->culture = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_CULTURE]);
+       aname->flags = cols [MONO_ASSEMBLYREF_FLAGS];
+       aname->major = cols [MONO_ASSEMBLYREF_MAJOR_VERSION];
+       aname->minor = cols [MONO_ASSEMBLYREF_MINOR_VERSION];
+       aname->build = cols [MONO_ASSEMBLYREF_BUILD_NUMBER];
+       aname->revision = cols [MONO_ASSEMBLYREF_REV_NUMBER];
+
+       if (cols [MONO_ASSEMBLYREF_PUBLIC_KEY]) {
+               gchar *token = assemblyref_public_tok (image, cols [MONO_ASSEMBLYREF_PUBLIC_KEY], aname->flags);
+               g_strlcpy (aname->public_key_token, token, MONO_PUBLIC_KEY_TOKEN_LENGTH);
+               g_free (token);
+       } else {
+               memset (aname->public_key_token, 0, MONO_PUBLIC_KEY_TOKEN_LENGTH);
+       }
+}
+
+void
+mono_assembly_load_reference (MonoImage *image, int index)
+{
        MonoAssembly *reference;
        MonoAssemblyName aname;
        MonoImageOpenStatus status;
@@ -581,28 +614,7 @@ mono_assembly_load_reference (MonoImage *image, int index)
        if (reference)
                return;
 
-       t = &image->tables [MONO_TABLE_ASSEMBLYREF];
-
-       mono_metadata_decode_row (t, index, cols, MONO_ASSEMBLYREF_SIZE);
-               
-       hash = mono_metadata_blob_heap (image, cols [MONO_ASSEMBLYREF_HASH_VALUE]);
-       aname.hash_len = mono_metadata_decode_blob_size (hash, &hash);
-       aname.hash_value = hash;
-       aname.name = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_NAME]);
-       aname.culture = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_CULTURE]);
-       aname.flags = cols [MONO_ASSEMBLYREF_FLAGS];
-       aname.major = cols [MONO_ASSEMBLYREF_MAJOR_VERSION];
-       aname.minor = cols [MONO_ASSEMBLYREF_MINOR_VERSION];
-       aname.build = cols [MONO_ASSEMBLYREF_BUILD_NUMBER];
-       aname.revision = cols [MONO_ASSEMBLYREF_REV_NUMBER];
-
-       if (cols [MONO_ASSEMBLYREF_PUBLIC_KEY]) {
-               gchar *token = assemblyref_public_tok (image, cols [MONO_ASSEMBLYREF_PUBLIC_KEY], aname.flags);
-               g_strlcpy (aname.public_key_token, token, MONO_PUBLIC_KEY_TOKEN_LENGTH);
-               g_free (token);
-       } else {
-               memset (aname.public_key_token, 0, MONO_PUBLIC_KEY_TOKEN_LENGTH);
-       }
+       mono_assembly_get_assemblyref (image, index, &aname);
 
        if (image->assembly->ref_only) {
                /* We use the loaded corlib */
index 48cef0eb7740e43c584596bb9450b034fdfd508a..a8c0b4e5719c1c4427963458eb91484853ad0765 100644 (file)
@@ -30,6 +30,7 @@ MonoAssembly* mono_assembly_load_with_partial_name (const char *name, MonoImageO
 
 MonoAssembly* mono_assembly_loaded     (MonoAssemblyName *aname);
 MonoAssembly* mono_assembly_loaded_full (MonoAssemblyName *aname, gboolean refonly);
+void          mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname);
 void          mono_assembly_load_reference (MonoImage *image, int index);
 void          mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status);
 MonoImage*    mono_assembly_load_module (MonoAssembly *assembly, guint32 idx);
index d58ae66c01b9b548c06daa53492daa706413e952..a3d9d1ceb4c4f6e808f370462c29c89b5b889a08 100644 (file)
@@ -448,6 +448,22 @@ typedef struct {
        MonoMethodSignature *sig;
 } MonoJitICallInfo;
 
+/*
+ * Information about a type load error encountered by the loader.
+ */
+typedef enum {
+       MONO_LOADER_ERROR_TYPE,
+       MONO_LOADER_ERROR_METHOD,
+       MONO_LOADER_ERROR_FIELD
+} MonoLoaderErrorKind;
+
+typedef struct {
+       MonoLoaderErrorKind kind;
+       char *class_name, *assembly_name; /* If kind == TYPE */
+       MonoClass *klass; /* If kind != TYPE */
+       const char *member_name; /* If kind != TYPE */
+} MonoLoaderError;
+
 #define mono_class_has_parent(klass,parent) (((klass)->idepth >= (parent)->idepth) && ((klass)->supertypes [(parent)->idepth - 1] == (parent)))
 
 typedef struct {
@@ -505,8 +521,8 @@ mono_class_get_implemented_interfaces (MonoClass *klass);
 gboolean
 mono_class_is_open_constructed_type (MonoType *t);
 
-MonoMethod**
-mono_class_get_overrides_full (MonoImage *image, guint32 type_token, gint32 *num_overrides,
+gboolean
+mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides,
                               MonoGenericContext *generic_context);
 
 MonoMethod*
@@ -609,6 +625,21 @@ mono_loader_lock           (void);
 void
 mono_loader_unlock         (void);
 
+void
+mono_loader_set_error_type_load (char *class_name, char *assembly_name);
+
+void
+mono_loader_set_error_method_load (MonoClass *klass, const char *member_name);
+
+void
+mono_loader_set_error_field_load (MonoClass *klass, const char *member_name);
+
+MonoLoaderError*
+mono_loader_get_last_error (void);
+
+void
+mono_loader_clear_error    (void);
+
 void 
 mono_icall_init            (void);
 
@@ -660,5 +691,8 @@ mono_class_get_exception_for_failure (MonoClass *klass);
 char*
 mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
 
+MonoArrayType *mono_dup_array_type (MonoArrayType *a);
+MonoMethodSignature *mono_metadata_signature_deep_dup (MonoMethodSignature *sig);
+
 #endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */
 
index 83b3bf03d9591ec63da16f33c9e08cd29e446c57..25d81a159a3a5ad8cd9f38bacfb7a0ecb47d8cc1 100644 (file)
@@ -123,10 +123,52 @@ dup_type (MonoType* t, const MonoType *original)
        r->byref = original->byref;
        if (t->type == MONO_TYPE_PTR)
                t->data.type = dup_type (t->data.type, original->data.type);
+       else if (t->type == MONO_TYPE_ARRAY)
+               t->data.array = mono_dup_array_type (t->data.array);
+       else if (t->type == MONO_TYPE_FNPTR)
+               t->data.method = mono_metadata_signature_deep_dup (t->data.method);
        mono_stats.generics_metadata_size += sizeof (MonoType);
        return r;
 }
 
+/* Copy everything mono_metadata_free_array free. */
+MonoArrayType *
+mono_dup_array_type (MonoArrayType *a)
+{
+       a = g_memdup (a, sizeof (MonoArrayType));
+       if (a->sizes)
+               a->sizes = g_memdup (a->sizes, a->numsizes * sizeof (int));
+       if (a->lobounds)
+               a->lobounds = g_memdup (a->lobounds, a->numlobounds * sizeof (int));
+       return a;
+}
+
+/* Copy everything mono_metadata_free_method_signature free. */
+MonoMethodSignature*
+mono_metadata_signature_deep_dup (MonoMethodSignature *sig)
+{
+       int i;
+       
+       sig = mono_metadata_signature_dup (sig);
+       
+       sig->ret = dup_type (sig->ret, sig->ret);
+       for (i = 0; i < sig->param_count; ++i)
+               sig->params [i] = dup_type (sig->params [i], sig->params [i]);
+       
+       return sig;
+}
+
+static char*
+_mono_stringify_aname (MonoAssemblyName *aname)
+{
+       return g_strdup_printf (
+               "%s, Version=%d.%d.%d.%d, Culture=%s, PublicKeyToken=%s",
+               aname->name,
+               aname->major, aname->minor, aname->build, aname->revision,
+               aname->culture && *aname->culture? aname->culture: "neutral",
+               aname->public_key_token [0] ? (char *)aname->public_key_token : "null");
+}
+
 static void
 _mono_type_get_assembly_name (MonoClass *klass, GString *str)
 {
@@ -1331,8 +1373,7 @@ mono_class_setup_vtable (MonoClass *class)
        else
                context = (MonoGenericContext *) class->generic_container;              
 
-       overrides = mono_class_get_overrides_full (
-               class->image, class->type_token, &onum, context);
+       mono_class_get_overrides_full (class->image, class->type_token, &overrides, &onum, context);
        mono_class_setup_vtable_general (class, overrides, onum);
        g_free (overrides);
 
@@ -2400,15 +2441,16 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token)
                context->gclass = mono_get_shared_generic_class (context->container, FALSE);
        }
 
-       if (cols [MONO_TYPEDEF_EXTENDS])
+       if (cols [MONO_TYPEDEF_EXTENDS]) {
                parent = mono_class_get_full (
                        image, mono_metadata_token_from_dor (cols [MONO_TYPEDEF_EXTENDS]), context);
+       }
 
        mono_class_setup_parent (class, parent);
 
        mono_class_setup_mono_type (class);
 
-       interfaces = mono_metadata_interfaces_from_typedef_full (image, type_token, &icount, context);
+       mono_metadata_interfaces_from_typedef_full (image, type_token, &interfaces, &icount, context);
 
        class->interfaces = interfaces;
        class->interface_count = icount;
@@ -3217,6 +3259,53 @@ mono_class_name_from_token (MonoImage *image, guint32 type_token, MonoGenericCon
        return NULL;
 }
 
+static char *
+mono_assembly_name_from_token (MonoImage *image, guint32 type_token, MonoGenericContext *context)
+{
+       if (image->dynamic)
+               return g_strdup_printf ("DynamicAssembly %s", image->name);
+       
+       switch (type_token & 0xff000000){
+       case MONO_TOKEN_TYPE_DEF:
+               return _mono_stringify_aname (&image->assembly->aname);
+               break;
+       case MONO_TOKEN_TYPE_REF: {
+               MonoAssemblyName aname;
+               guint32 cols [MONO_TYPEREF_SIZE];
+               MonoTableInfo  *t = &image->tables [MONO_TABLE_TYPEREF];
+               guint32 idx;
+       
+               mono_metadata_decode_row (t, (type_token&0xffffff)-1, cols, MONO_TYPEREF_SIZE);
+
+               idx = cols [MONO_TYPEREF_SCOPE] >> MONO_RESOLTION_SCOPE_BITS;
+               switch (cols [MONO_TYPEREF_SCOPE] & MONO_RESOLTION_SCOPE_MASK) {
+               case MONO_RESOLTION_SCOPE_MODULE:
+                       /* FIXME: */
+                       return g_strdup ("");
+               case MONO_RESOLTION_SCOPE_MODULEREF:
+                       /* FIXME: */
+                       return g_strdup ("");
+               case MONO_RESOLTION_SCOPE_TYPEREF:
+                       /* FIXME: */
+                       return g_strdup ("");
+               case MONO_RESOLTION_SCOPE_ASSEMBLYREF:
+                       mono_assembly_get_assemblyref (image, idx - 1, &aname);
+                       return _mono_stringify_aname (&aname);
+               default:
+                       g_assert_not_reached ();
+               }
+               break;
+       }
+       case MONO_TOKEN_TYPE_SPEC:
+               /* FIXME: */
+               return g_strdup ("");
+       default:
+               g_assert_not_reached ();
+       }
+
+       return NULL;
+}
+
 /**
  * mono_class_get:
  * @image: the image where the class resides
@@ -3250,8 +3339,8 @@ _mono_class_get (MonoImage *image, guint32 type_token, MonoGenericContext *conte
 
        if (!class){
                char *name = mono_class_name_from_token (image, type_token, context);
-               g_warning ("The class %s could not be loaded, used in %s (token 0x%08x)", name, image->name, type_token);
-               g_free (name);
+               char *assembly = mono_assembly_name_from_token (image, type_token, context);
+               mono_loader_set_error_type_load (name, assembly);
        }
 
        return class;
@@ -3767,6 +3856,8 @@ mono_ldtoken (MonoImage *image, guint32 token, MonoClass **handle_class,
                if (handle_class)
                        *handle_class = mono_defaults.typehandle_class;
                class = mono_class_get_full (image, token, context);
+               if (!class)
+                       return NULL;
                mono_class_init (class);
                /* We return a MonoType* as handle */
                return &class->byval_arg;
@@ -3776,16 +3867,20 @@ mono_ldtoken (MonoImage *image, guint32 token, MonoClass **handle_class,
                if (handle_class)
                        *handle_class = mono_defaults.typehandle_class;
                class = mono_class_create_from_typespec (image, token, context);
+               if (!class)
+                       return NULL;
                mono_class_init (class);
                return &class->byval_arg;
        }
        case MONO_TOKEN_FIELD_DEF: {
                MonoClass *class;
                guint32 type = mono_metadata_typedef_from_field (image, mono_metadata_token_index (token));
-               class = mono_class_get_full (image, MONO_TOKEN_TYPE_DEF | type, context);
-               mono_class_init (class);
                if (handle_class)
                        *handle_class = mono_defaults.fieldhandle_class;
+               class = mono_class_get_full (image, MONO_TOKEN_TYPE_DEF | type, context);
+               if (!class)
+                       return NULL;
+               mono_class_init (class);
                return mono_class_get_field (class, token);
        }
        case MONO_TOKEN_METHOD_DEF: {
@@ -4598,7 +4693,7 @@ mono_class_get_exception_for_failure (MonoClass *klass)
                MonoDomain *domain = mono_domain_get ();
                MonoSecurityManager* secman = mono_security_manager_get_methods ();
                MonoMethod *method = klass->exception_data;
-               guint32 error = (method) ? MONO_METADATA_INHERITANCEDEMAND_CLASS : MONO_METADATA_INHERITANCEDEMAND_METHOD;
+               guint32 error = (method) ? MONO_METADATA_INHERITANCEDEMAND_METHOD : MONO_METADATA_INHERITANCEDEMAND_CLASS;
                MonoObject *exc = NULL;
                gpointer args [4];
 
index b51cdfc73b08bb6bfc7176988849e5e76658c70a..09720b71edf64de38a692ab22dccee55b118fe95 100644 (file)
@@ -36,8 +36,8 @@ typedef struct {
        const stridx_t month_names [NUM_MONTHS];
        const stridx_t abbreviated_month_names [NUM_MONTHS];
 
-       gint calendar_week_rule;
-       gint first_day_of_week;
+       gint8 calendar_week_rule;
+       gint8 first_day_of_week;
 
        const stridx_t date_separator;
        const stridx_t time_separator;  
@@ -66,15 +66,15 @@ typedef struct {
        const stridx_t negative_sign;
        const stridx_t positive_sign;
 
-       gint currency_negative_pattern;
-       gint currency_positive_pattern;
-       gint percent_negative_pattern;
-       gint percent_positive_pattern;
-       gint number_negative_pattern;
+       gint8 currency_negative_pattern;
+       gint8 currency_positive_pattern;
+       gint8 percent_negative_pattern;
+       gint8 percent_positive_pattern;
+       gint8 number_negative_pattern;
 
-       gint currency_decimal_digits;
-       gint percent_decimal_digits;
-       gint number_decimal_digits;
+       gint8 currency_decimal_digits;
+       gint8 percent_decimal_digits;
+       gint8 number_decimal_digits;
 
        const gint currency_group_sizes [GROUP_SIZE];
        const gint percent_group_sizes [GROUP_SIZE];
@@ -90,9 +90,9 @@ typedef struct {
 } TextInfoEntry;
 
 typedef struct {
-       gint lcid;
-       gint parent_lcid;
-       gint specific_lcid;
+       gint16 lcid;
+       gint16 parent_lcid;
+       gint16 specific_lcid;
        gint16 region_entry_index;
        const stridx_t name;
        const stridx_t icu_name;
index 7e7019641203671f1cc785e66b479f42d0ae7518..ec0def69efff1c222863cbef006895cc423b78b1 100644 (file)
@@ -126,7 +126,7 @@ struct _MonoSymbolFile {
        MonoSymbolFileOffsetTable *offset_table;
 };
 
-#define MONO_SYMBOL_FILE_VERSION               38
+#define MONO_SYMBOL_FILE_VERSION               39
 #define MONO_SYMBOL_FILE_MAGIC                 0x45e82623fd7fa614ULL
 
 G_BEGIN_DECLS
index 58d2b2407f9837f16f658865599633e5a8fb71b7..ee1887008dde29588d1834d46f61f4582acf5de5 100644 (file)
@@ -1470,6 +1470,17 @@ DECINLINE static void buildIEEE754Double(double* pd, int sign, int texp, guint64
 
     PRECONDITION(sign == 0 || sign == 1);
     *p = (((guint64)sign) << 63) | (((guint64)((1023+texp)&0x7ff)) << 52) | mantisse;
+#ifdef ARM_FPU_FPA
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+    {
+           guint32 temp;
+           guint32 *t = (guint32)p;
+           temp = t [0];
+           t [0] = t [1];
+           t [1] = temp;
+    }
+#endif
+#endif
 }
 
 double mono_decimal2double(/*[In]*/decimal_repr* pA)
index dea5c82647f9d390c5b92e8dd578e4bafc247cb8..56fe392ad3f3aa4f18532e66b72c569ba34154bc 100644 (file)
@@ -98,7 +98,8 @@ static MonoJitInfoTable *aot_modules = NULL;
 static const MonoRuntimeInfo supported_runtimes[] = {
        {"v1.0.3705", "1.0", { {1,0,5000,0}, {7,0,5000,0} }     },
        {"v1.1.4322", "1.0", { {1,0,5000,0}, {7,0,5000,0} }     },
-       {"v2.0.50215","2.0", { {2,0,0,0},    {8,0,0,0} }        }
+       {"v2.0.50215","2.0", { {2,0,0,0},    {8,0,0,0} }        },
+       {"v2.0.50727","2.0", { {2,0,0,0},    {8,0,0,0} }        }
 };
 
 
index 725161488c607a6b25f1f4aaf5bc0946b3081b47..469561cb8528d2ebef33b42aa4a3b39d91907df5 100644 (file)
@@ -21,7 +21,8 @@
  * @name_space: the namespace for the class
  * @name: class name
  *
- * Creates an exception of the given namespace/name class.
+ * Creates an exception of the given namespace/name class in the
+ * current domain.
  *
  * Returns: the initialized exception instance.
  */
@@ -32,6 +33,18 @@ mono_exception_from_name (MonoImage *image, const char *name_space,
        return mono_exception_from_name_domain (mono_domain_get (), image, name_space, name);
 }
 
+/**
+ * mono_exception_from_name_domain:
+ * @domain: Domain where the return object will be created.
+ * @image: the Mono image where to look for the class
+ * @name_space: the namespace for the class
+ * @name: class name
+ *
+ * Creates an exception object of the given namespace/name class on
+ * the given domain.
+ *
+ * Returns: the initialized exception instance.
+ */
 MonoException *
 mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, 
                                 const char* name_space, const char *name)
@@ -155,6 +168,11 @@ mono_exception_from_name_msg (MonoImage *image, const char *name_space,
        return ex;
 }
 
+/**
+ * mono_get_exception_divide_by_zero:
+ *
+ * Returns: a new instance of the System.DivideByZeroException
+ */
 MonoException *
 mono_get_exception_divide_by_zero ()
 {
@@ -162,6 +180,11 @@ mono_get_exception_divide_by_zero ()
                                         "DivideByZeroException");
 }
 
+/**
+ * mono_get_exception_security:
+ *
+ * Returns: a new instance of the System.Security.SecurityException
+ */
 MonoException *
 mono_get_exception_security ()
 {
@@ -169,6 +192,11 @@ mono_get_exception_security ()
                                         "SecurityException");
 }
 
+/**
+ * mono_get_exception_thread_abort:
+ *
+ * Returns: a new instance of the System.Threading.ThreadAbortException.
+ */
 MonoException *
 mono_get_exception_thread_abort ()
 {
@@ -176,6 +204,11 @@ mono_get_exception_thread_abort ()
                                         "ThreadAbortException");
 }
 
+/**
+ * mono_get_exception_arithmetic:
+ *
+ * Returns: a new instance of the System.ArithmeticException.
+ */
 MonoException *
 mono_get_exception_arithmetic ()
 {
@@ -183,6 +216,11 @@ mono_get_exception_arithmetic ()
                                         "ArithmeticException");
 }
 
+/**
+ * mono_get_exception_overflow:
+ *
+ * Returns: a new instance of the System.OverflowException
+ */
 MonoException *
 mono_get_exception_overflow ()
 {
@@ -190,6 +228,11 @@ mono_get_exception_overflow ()
                                         "OverflowException");
 }
 
+/**
+ * mono_get_exception_null_reference:
+ *
+ * Returns: a new instance of the System.NullReferenceException
+ */
 MonoException *
 mono_get_exception_null_reference ()
 {
@@ -197,27 +240,47 @@ mono_get_exception_null_reference ()
                                         "NullReferenceException");
 }
 
+/**
+ * mono_get_exception_execution_engine:
+ * @msg: the message to pass to the user
+ *
+ * Returns: a new instance of the System.ExecutionEngineException
+ */
 MonoException *
 mono_get_exception_execution_engine (const char *msg)
 {
-       return mono_exception_from_name_msg (mono_get_corlib (), "System",
-                                                                                "ExecutionEngineException", msg);
+       return mono_exception_from_name_msg (mono_get_corlib (), "System", "ExecutionEngineException", msg);
 }
 
+/**
+ * mono_get_exception_serialization:
+ * @msg: the message to pass to the user
+ *
+ * Returns: a new instance of the System.Runtime.Serialization.SerializationException
+ */
 MonoException *
 mono_get_exception_serialization (const char *msg)
 {
-       return mono_exception_from_name_msg (mono_get_corlib (), "System.Runtime.Serialization",
-                                                                                "SerializationException", msg);
+       return mono_exception_from_name_msg (mono_get_corlib (), "System.Runtime.Serialization", "SerializationException", msg);
 }
 
+/**
+ * mono_get_exception_invalid_cast:
+ *
+ * Returns: a new instance of the System.InvalidCastException
+ */
 MonoException *
 mono_get_exception_invalid_cast ()
 {
-       return mono_exception_from_name (mono_get_corlib (), "System",
-                                        "InvalidCastException");
+       return mono_exception_from_name (mono_get_corlib (), "System", "InvalidCastException");
 }
 
+/**
+ * mono_get_exception_invalid_operation:
+ * @msg: the message to pass to the user
+ *
+ * Returns: a new instance of the System.InvalidOperationException
+ */
 MonoException *
 mono_get_exception_invalid_operation (const char *msg)
 {
@@ -225,6 +288,11 @@ mono_get_exception_invalid_operation (const char *msg)
                                        "InvalidOperationException", msg);
 }
 
+/**
+ * mono_get_exception_index_out_of_range:
+ *
+ * Returns: a new instance of the System.IndexOutOfRangeException
+ */
 MonoException *
 mono_get_exception_index_out_of_range ()
 {
@@ -232,6 +300,11 @@ mono_get_exception_index_out_of_range ()
                                         "IndexOutOfRangeException");
 }
 
+/**
+ * mono_get_exception_array_type_mismatch:
+ *
+ * Returns: a new instance of the System.ArrayTypeMismatchException
+ */
 MonoException *
 mono_get_exception_array_type_mismatch ()
 {
@@ -239,19 +312,28 @@ mono_get_exception_array_type_mismatch ()
                                         "ArrayTypeMismatchException");
 }
 
+/**
+ * mono_get_exception_type_load:
+ * @class_name: the name of the class that could not be loaded
+ * @assembly_name: the assembly where the class was looked up.
+ *
+ * Returns: a new instance of the System.TypeLoadException.
+ */
 MonoException *
-mono_get_exception_type_load (MonoString *type_name)
+mono_get_exception_type_load (MonoString *class_name, char *assembly_name)
 {
-       MonoTypeLoadException *exc;
-       
-       exc = (MonoTypeLoadException *) mono_exception_from_name (mono_get_corlib (),
-                                       "System",
-                                       "TypeLoadException");
+       MonoString *s = assembly_name ? mono_string_new (mono_domain_get (), assembly_name) : mono_string_new (mono_domain_get (), "");
 
-       exc->type_name = type_name;
-       return (MonoException *) exc;
+       return mono_exception_from_name_two_strings (mono_get_corlib (), "System",
+                                                    "TypeLoadException", class_name, s);
 }
 
+/**
+ * mono_get_exception_not_implemented:
+ * @msg: the message to pass to the user
+ *
+ * Returns: a new instance of the System.NotImplementedException
+ */
 MonoException *
 mono_get_exception_not_implemented (const char *msg)
 {
@@ -266,13 +348,46 @@ mono_get_exception_not_implemented (const char *msg)
        return ex;
 }
 
+/**
+ * mono_get_exception_missing_method:
+ * @class_name: the class where the lookup was performed.
+ * @member_name: the name of the missing method.
+ *
+ * Returns: a new instance of the System.MissingMethodException
+ */
 MonoException *
-mono_get_exception_missing_method ()
+mono_get_exception_missing_method (const char *class_name, const char *member_name)
 {
-       return mono_exception_from_name (mono_get_corlib (), "System",
-                                        "MissingMethodException");
+       MonoString *s1 = mono_string_new (mono_domain_get (), class_name);
+       MonoString *s2 = mono_string_new (mono_domain_get (), member_name);
+
+       return mono_exception_from_name_two_strings (mono_get_corlib (), "System",
+                                                    "MissingMethodException", s1, s2);
+}
+
+/**
+ * mono_get_exception_missing_field:
+ * @class_name: the class where the lookup was performed
+ * @member_name: the name of the missing method.
+ *
+ * Returns: a new instance of the System.MissingFieldException
+ */
+MonoException *
+mono_get_exception_missing_field (const char *class_name, const char *member_name)
+{
+       MonoString *s1 = mono_string_new (mono_domain_get (), class_name);
+       MonoString *s2 = mono_string_new (mono_domain_get (), member_name);
+
+       return mono_exception_from_name_two_strings (mono_get_corlib (), "System",
+                                                    "MissingFieldException", s1, s2);
 }
 
+/**
+ * mono_get_exception_argument_null:
+ * @arg: the name of the argument that is null
+ *
+ * Returns: a new instance of the System.ArgumentNullException
+ */
 MonoException*
 mono_get_exception_argument_null (const char *arg)
 {
@@ -288,6 +403,12 @@ mono_get_exception_argument_null (const char *arg)
        return ex;
 }
 
+/**
+ * mono_get_exception_argument:
+ * @arg: the name of the invalid argument.
+ *
+ * Returns: a new instance of the System.ArgumentException
+ */
 MonoException *
 mono_get_exception_argument (const char *arg, const char *msg)
 {
@@ -303,6 +424,12 @@ mono_get_exception_argument (const char *arg, const char *msg)
        return ex;
 }
 
+/**
+ * mono_get_exception_argument_out_of_range:
+ * @arg: the name of the out of range argument.
+ *
+ * Returns: a new instance of the System.ArgumentOutOfRangeException
+ */
 MonoException *
 mono_get_exception_argument_out_of_range (const char *arg)
 {
@@ -318,6 +445,12 @@ mono_get_exception_argument_out_of_range (const char *arg)
        return ex;
 }
 
+/**
+ * mono_get_exception_thread_state:
+ * @msg: the message to present to the user
+ *
+ * Returns: a new instance of the System.Threading.ThreadStateException
+ */
 MonoException *
 mono_get_exception_thread_state (const char *msg)
 {
@@ -325,6 +458,12 @@ mono_get_exception_thread_state (const char *msg)
                mono_get_corlib (), "System.Threading", "ThreadStateException", msg);
 }
 
+/**
+ * mono_get_exception_io:
+ * @msg: the message to present to the user
+ *
+ * Returns: a new instance of the System.IO.IOException
+ */
 MonoException *
 mono_get_exception_io (const char *msg)
 {
@@ -332,6 +471,12 @@ mono_get_exception_io (const char *msg)
                mono_get_corlib (), "System.IO", "IOException", msg);
 }
 
+/**
+ * mono_get_exception_file_not_found:
+ * @fname: the name of the file not found.
+ *
+ * Returns: a new instance of the System.IO.FileNotFoundException
+ */
 MonoException *
 mono_get_exception_file_not_found (MonoString *fname)
 {
@@ -339,6 +484,13 @@ mono_get_exception_file_not_found (MonoString *fname)
                mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname);
 }
 
+/**
+ * mono_get_exception_file_not_found2:
+ * @msg: an informative message for the user.
+ * @fname: the name of the file not found.
+ *
+ * Returns: a new instance of the System.IO.FileNotFoundException
+ */
 MonoException *
 mono_get_exception_file_not_found2 (const char *msg, MonoString *fname)
 {
@@ -348,6 +500,13 @@ mono_get_exception_file_not_found2 (const char *msg, MonoString *fname)
                mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname);
 }
 
+/**
+ * mono_get_exception_type_initialization:
+ * @type_name: the name of the type that failed to initialize.
+ * @inner: the inner exception.
+ *
+ * Returns: a new instance of the System.TypeInitializationException
+ */
 MonoException *
 mono_get_exception_type_initialization (const gchar *type_name, MonoException *inner)
 {
@@ -381,36 +540,71 @@ mono_get_exception_type_initialization (const gchar *type_name, MonoException *i
        return (MonoException *) exc;
 }
 
+/**
+ * mono_get_exception_synchronization_lock:
+ * @inner: the inner exception.
+ *
+ * Returns: a new instance of the System.TypeInitializationException
+ */
 MonoException *
 mono_get_exception_synchronization_lock (const char *msg)
 {
        return mono_exception_from_name_msg (mono_get_corlib (), "System.Threading", "SynchronizationLockException", msg);
 }
 
+/**
+ * mono_get_exception_cannot_unload_appdomain:
+ * @inner: the inner exception.
+ *
+ * Returns: a new instance of the System.CannotUnloadAppDomainException
+ */
 MonoException *
 mono_get_exception_cannot_unload_appdomain (const char *msg)
 {
        return mono_exception_from_name_msg (mono_get_corlib (), "System", "CannotUnloadAppDomainException", msg);
 }
 
+/**
+ * mono_get_exception_appdomain_unloaded
+ *
+ * Returns: a new instance of the System.AppDomainUnloadedException
+ */
 MonoException *
 mono_get_exception_appdomain_unloaded (void)
 {
        return mono_exception_from_name (mono_get_corlib (), "System", "AppDomainUnloadedException");
 }
 
+/**
+ * mono_get_exception_bad_image_format:
+ * @msg: an informative message for the user.
+ *
+ * Returns: a new instance of the System.BadImageFormatException
+ */
 MonoException *
 mono_get_exception_bad_image_format (const char *msg)
 {
        return mono_exception_from_name_msg (mono_get_corlib (), "System", "BadImageFormatException", msg);
 }      
 
+/**
+ * mono_get_exception_stack_overflow:
+ *
+ * Returns: a new instance of the System.StackOverflowException
+ */
 MonoException *
 mono_get_exception_stack_overflow (void)
 {
        return mono_exception_from_name (mono_get_corlib (), "System", "StackOverflowException");       
 }
 
+/**
+ * mono_get_exception_reflection_type_load:
+ * @types: an array of types that were defined in the moduled loaded.
+ * @exceptions: an array of exceptions that were thrown during the type loading.
+ *
+ * Returns: a new instance of the System.Reflection.ReflectionTypeLoadException
+ */
 MonoException *
 mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions)
 {
index 66a8d3a19cd2ad265a765e1a12988e05e41ec4cf..21791f00b480a1435d870771af087ddfe17a4709 100644 (file)
@@ -70,10 +70,13 @@ MonoException *
 mono_get_exception_array_type_mismatch (void);
 
 MonoException *
-mono_get_exception_type_load           (MonoString *type_name);
+mono_get_exception_type_load           (MonoString *class_name, char *assembly_name);
 
 MonoException *
-mono_get_exception_missing_method      (void);
+mono_get_exception_missing_method      (const char *class_name, const char *member_name);
+
+MonoException *
+mono_get_exception_missing_field       (const char *class_name, const char *member_name);
 
 MonoException *
 mono_get_exception_not_implemented     (const char *msg);
index 16f14668b1431a64a6995a3a052f7a619f4c801a..390333dc13e13d9bbc791e727d9d1a4e45bc18f0 100644 (file)
@@ -78,8 +78,13 @@ mono_double_ParseImpl (char *ptr)
 
        MONO_ARCH_SAVE_REGS;
 
+#ifdef __arm__
+       if (*ptr)
+               result = strtod (ptr, &endptr);
+#else
        if (*ptr)
                result = bsd_strtod (ptr, &endptr);
+#endif
 
        if (!*ptr || (endptr && *endptr))
                mono_raise_exception (mono_exception_from_name (mono_get_corlib (),
@@ -1022,7 +1027,7 @@ ves_icall_type_from_name (MonoString *name,
        g_free (str);
        if (type == NULL){
                if (throwOnError)
-                       mono_raise_exception (mono_get_exception_type_load (name));
+                       mono_raise_exception (mono_get_exception_type_load (name, NULL));
        }
        
        return type;
@@ -1846,7 +1851,7 @@ ves_icall_Type_GetGenericTypeDefinition_impl (MonoReflectionType *type)
 }
 
 static MonoReflectionType*
-ves_icall_Type_BindGenericParameters (MonoReflectionType *type, MonoArray *type_array)
+ves_icall_Type_MakeGenericType (MonoReflectionType *type, MonoArray *type_array)
 {
        MonoType *geninst, **types;
        int i, count;
@@ -1885,7 +1890,7 @@ ves_icall_Type_get_IsGenericType (MonoReflectionType *type)
        MONO_ARCH_SAVE_REGS;
 
        klass = mono_class_from_mono_type (type->type);
-       return klass->generic_class != NULL;
+       return klass->generic_class != NULL || klass->generic_container != NULL;
 }
 
 static gint32
@@ -1930,18 +1935,6 @@ ves_icall_Type_GetGenericParameterConstraints (MonoReflectionType *type)
        return res;
 }
 
-static MonoBoolean
-ves_icall_MonoType_get_HasGenericArguments (MonoReflectionType *type)
-{
-       MonoClass *klass;
-       MONO_ARCH_SAVE_REGS;
-
-       klass = mono_class_from_mono_type (type->type);
-       if (klass->generic_container || klass->generic_class)
-               return TRUE;
-       return FALSE;
-}
-
 static MonoBoolean
 ves_icall_MonoType_get_IsGenericParameter (MonoReflectionType *type)
 {
@@ -3455,7 +3448,7 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as
                g_list_free (info.modifiers);
                g_list_free (info.nested);
                if (throwOnError) /* uhm: this is a parse error, though... */
-                       mono_raise_exception (mono_get_exception_type_load (name));
+                       mono_raise_exception (mono_get_exception_type_load (name, NULL));
                /*g_print ("failed parse\n");*/
                return NULL;
        }
@@ -3498,7 +3491,7 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as
        g_list_free (info.nested);
        if (!type) {
                if (throwOnError)
-                       mono_raise_exception (mono_get_exception_type_load (name));
+                       mono_raise_exception (mono_get_exception_type_load (name, NULL));
                /* g_print ("failed find\n"); */
                return NULL;
        }
@@ -5977,6 +5970,12 @@ ves_icall_MonoDebugger_check_runtime_version (MonoString *fname)
                return NULL;
 }
 
+static gint32
+ves_icall_MonoDebugger_GetMethodToken (MonoReflectionMethod *method)
+{
+       return method->method->token;
+}
+
 static gint32
 ves_icall_MonoDebugger_GetMethodIndex (MonoReflectionMethod *rmethod)
 {
@@ -5991,6 +5990,61 @@ ves_icall_MonoDebugger_GetMethodIndex (MonoReflectionMethod *rmethod)
        return index - rmethod->method->klass->method.first;
 }
 
+static MonoReflectionMethod *
+ves_icall_MonoDebugger_GetMethod (MonoReflectionAssembly *assembly, guint32 token)
+{
+       MonoMethod *method;
+
+       MONO_ARCH_SAVE_REGS;
+
+       method = mono_get_method (mono_assembly_get_image (assembly->assembly), token, NULL);
+
+       return mono_method_get_object (mono_domain_get (), method, NULL);
+}
+
+static MonoReflectionType *
+ves_icall_MonoDebugger_GetType (MonoReflectionAssembly *assembly, guint32 token)
+{
+       MonoClass *klass;
+
+       MONO_ARCH_SAVE_REGS;
+
+       klass = mono_class_get (mono_assembly_get_image (assembly->assembly), token);
+       if (!klass) {
+               g_warning (G_STRLOC ": %x", token);
+               return NULL;
+       }
+
+       return mono_type_get_object (mono_domain_get (), &klass->byval_arg);
+}
+
+static MonoReflectionType *
+ves_icall_MonoDebugger_GetLocalTypeFromSignature (MonoReflectionAssembly *assembly, MonoArray *signature)
+{
+       MonoDomain *domain; 
+       MonoImage *image;
+       MonoType *type;
+       const char *ptr;
+       int len = 0;
+
+       MONO_ARCH_SAVE_REGS;
+
+       MONO_CHECK_ARG_NULL (assembly);
+       MONO_CHECK_ARG_NULL (signature);
+
+       domain = mono_domain_get();
+       image = mono_assembly_get_image (assembly->assembly);
+
+       ptr = mono_array_addr (signature, char, 0);
+       g_assert (*ptr++ == 0x07);
+       len = mono_metadata_decode_value (ptr, &ptr);
+       g_assert (len == 1);
+
+       type = mono_metadata_parse_type (image, MONO_PARSE_LOCAL, 0, ptr, &ptr);
+
+       return mono_type_get_object (domain, type);
+}
+
 static MonoReflectionType*
 ves_icall_MonoDebugger_MakeArrayType (MonoReflectionType *type, int rank)
 {
@@ -6027,6 +6081,12 @@ custom_attrs_defined_internal (MonoObject *obj, MonoReflectionType *attr_type)
        return found;
 }
 
+static MonoArray*
+custom_attrs_get_by_type (MonoObject *obj, MonoReflectionType *attr_type)
+{
+       return mono_reflection_get_custom_attrs_by_type (obj, attr_type ? mono_class_from_mono_type (attr_type->type) : NULL);
+}
+
 static MonoBoolean
 GCHandle_CheckCurrentDomain (guint32 gchandle)
 {
@@ -6446,7 +6506,7 @@ static const IcallEntry math_icalls [] = {
 
 static const IcallEntry customattrs_icalls [] = {
        {"GetCustomAttributesDataInternal", mono_reflection_get_custom_attrs_data},
-       {"GetCustomAttributesInternal", mono_reflection_get_custom_attrs},
+       {"GetCustomAttributesInternal", custom_attrs_get_by_type},
        {"IsDefinedInternal", custom_attrs_defined_internal}
 };
 
@@ -6488,7 +6548,6 @@ static const IcallEntry monotype_icalls [] = {
        {"get_BaseType", ves_icall_get_type_parent},
        {"get_DeclaringMethod", ves_icall_MonoType_get_DeclaringMethod},
        {"get_DeclaringType", ves_icall_MonoType_get_DeclaringType},
-       {"get_HasGenericArguments", ves_icall_MonoType_get_HasGenericArguments},
        {"get_IsGenericParameter", ves_icall_MonoType_get_IsGenericParameter},
        {"get_Module", ves_icall_MonoType_get_Module},
        {"get_Name", ves_icall_MonoType_get_Name},
@@ -6600,11 +6659,11 @@ static const IcallEntry generictypeparambuilder_icalls [] = {
 };
 
 static const IcallEntry monomethod_icalls [] = {
-       {"BindGenericParameters", mono_reflection_bind_generic_method_parameters},
        {"GetDllImportAttribute", ves_icall_MonoMethod_GetDllImportAttribute},
        {"GetGenericArguments", ves_icall_MonoMethod_GetGenericArguments},
        {"GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition},
        {"InternalInvoke", ves_icall_InternalInvoke},
+       {"MakeGenericMethod", mono_reflection_bind_generic_method_parameters},
        {"get_HasGenericParameters", ves_icall_MonoMethod_get_HasGenericParameters},
        {"get_IsGenericMethodDefinition", ves_icall_MonoMethod_get_IsGenericMethodDefinition},
        {"get_Mono_IsInflatedMethod", ves_icall_MonoMethod_get_Mono_IsInflatedMethod},
@@ -6679,7 +6738,7 @@ static const IcallEntry dynamicmethod_icalls [] = {
 };
 
 static const IcallEntry methodbuilder_icalls [] = {
-       {"BindGenericParameters", mono_reflection_bind_generic_method_parameters}
+       {"MakeGenericMethod", mono_reflection_bind_generic_method_parameters}
 };
 
 static const IcallEntry modulebuilder_icalls [] = {
@@ -6891,6 +6950,7 @@ static const IcallEntry thread_icalls [] = {
        {"GetSerializedCurrentUICulture", ves_icall_System_Threading_Thread_GetSerializedCurrentUICulture},
        {"GetState", ves_icall_System_Threading_Thread_GetState},
        {"Join_internal", ves_icall_System_Threading_Thread_Join_internal},
+       {"MemoryBarrier", ves_icall_System_Threading_Thread_MemoryBarrier},
        {"ResetAbort_internal()", ves_icall_System_Threading_Thread_ResetAbort},
        {"Resume_internal()", ves_icall_System_Threading_Thread_Resume},
        {"SetCachedCurrentCulture", ves_icall_System_Threading_Thread_SetCachedCurrentCulture},
@@ -6946,7 +7006,6 @@ static const IcallEntry waithandle_icalls [] = {
 };
 
 static const IcallEntry type_icalls [] = {
-       {"BindGenericParameters", ves_icall_Type_BindGenericParameters},
        {"Equals", ves_icall_type_Equals},
        {"GetGenericParameterAttributes", ves_icall_Type_GetGenericParameterAttributes},
        {"GetGenericParameterConstraints_impl", ves_icall_Type_GetGenericParameterConstraints},
@@ -6958,6 +7017,7 @@ static const IcallEntry type_icalls [] = {
        {"GetTypeCodeInternal", ves_icall_type_GetTypeCodeInternal},
        {"IsArrayImpl", ves_icall_Type_IsArrayImpl},
        {"IsInstanceOfType", ves_icall_type_IsInstanceOfType},
+       {"MakeGenericType", ves_icall_Type_MakeGenericType},
        {"MakePointerType", ves_icall_Type_MakePointerType},
        {"get_IsGenericInstance", ves_icall_Type_get_IsGenericInstance},
        {"get_IsGenericType", ves_icall_Type_get_IsGenericType},
index 93b57fe73b7054891637bc581427b544035801a0..7382dd73a942258243ab7c8c555f1612c83b63a8 100644 (file)
@@ -43,10 +43,133 @@ MonoDefaults mono_defaults;
  */
 static CRITICAL_SECTION loader_mutex;
 
+
+/*
+ * This TLS variable contains the last type load error encountered by the loader.
+ */
+guint32 loader_error_thread_id;
+
 void
 mono_loader_init ()
 {
        InitializeCriticalSection (&loader_mutex);
+
+       loader_error_thread_id = TlsAlloc ();
+}
+
+/*
+ * Handling of type load errors should be done as follows:
+ *
+ *   If something could not be loaded, the loader should call one of the
+ * mono_loader_set_error_XXX functions ()
+ * with the appropriate arguments, then return NULL to report the failure. The error 
+ * should be propagated until it reaches code which can throw managed exceptions. At that
+ * point, an exception should be thrown based on the information returned by
+ * mono_loader_get_error (). Then the error should be cleared by calling 
+ * mono_loader_clear_error ().
+ */
+
+static void
+set_loader_error (MonoLoaderError *error)
+{
+       TlsSetValue (loader_error_thread_id, error);
+}      
+
+/*
+ * mono_loader_set_error_type_load:
+ *
+ *   Set the loader error for this thread. CLASS_NAME and ASSEMBLY_NAME should be
+ * dynamically allocated strings whose ownership is passed to this function.
+ */
+void
+mono_loader_set_error_type_load (char *class_name, char *assembly_name)
+{
+       MonoLoaderError *error;
+
+       if (mono_loader_get_last_error ()) {
+               g_free (class_name);
+               g_free (assembly_name);
+               return;
+       }
+
+       error = g_new0 (MonoLoaderError, 1);
+       error->kind = MONO_LOADER_ERROR_TYPE;
+       error->class_name = class_name;
+       error->assembly_name = assembly_name;
+       
+       set_loader_error (error);
+}
+
+/*
+ * mono_loader_set_error_method_load:
+ *
+ *   Set the loader error for this thread. MEMBER_NAME should point to a string
+ * inside metadata.
+ */
+void
+mono_loader_set_error_method_load (MonoClass *klass, const char *member_name)
+{
+       MonoLoaderError *error;
+
+       /* FIXME: Store the signature as well */
+       if (mono_loader_get_last_error ())
+               return;
+
+       error = g_new0 (MonoLoaderError, 1);
+       error->kind = MONO_LOADER_ERROR_METHOD;
+       error->klass = klass;
+       error->member_name = member_name;
+       
+       set_loader_error (error);
+}
+
+/*
+ * mono_loader_set_error_field_load:
+ *
+ *   Set the loader error for this thread. MEMBER_NAME should point to a string
+ * inside metadata.
+ */
+void
+mono_loader_set_error_field_load (MonoClass *klass, const char *member_name)
+{
+       MonoLoaderError *error;
+
+       /* FIXME: Store the signature as well */
+       if (mono_loader_get_last_error ())
+               return;
+
+       error = g_new0 (MonoLoaderError, 1);
+       error->kind = MONO_LOADER_ERROR_FIELD;
+       error->klass = klass;
+       error->member_name = member_name;
+       
+       set_loader_error (error);
+}
+
+/*
+ * mono_loader_get_last_error:
+ *
+ *   Returns information about the last type load exception encountered by the loader, or
+ * NULL. After use, the exception should be cleared by calling mono_loader_clear_error.
+ */
+MonoLoaderError*
+mono_loader_get_last_error (void)
+{
+       return (MonoLoaderError*)TlsGetValue (loader_error_thread_id);
+}
+
+void
+mono_loader_clear_error (void)
+{
+       MonoLoaderError *ex = (MonoLoaderError*)TlsGetValue (loader_error_thread_id);
+
+       g_assert (ex);  
+
+       g_free (ex->class_name);
+       g_free (ex->assembly_name);
+       g_free (ex);
+
+       TlsSetValue (loader_error_thread_id, NULL);
 }
 
 static MonoClassField*
@@ -54,6 +177,7 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass,
                      MonoGenericContext *context)
 {
        MonoClass *klass;
+       MonoClassField *field;
        MonoTableInfo *tables = image->tables;
        guint32 cols[6];
        guint32 nindex, class;
@@ -89,7 +213,8 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass,
                mono_class_init (klass);
                if (retklass)
                        *retklass = klass;
-               return mono_class_get_field_from_name (klass, fname);
+               field = mono_class_get_field_from_name (klass, fname);
+               break;
        case MONO_MEMBERREF_PARENT_TYPESPEC: {
                /*guint32 bcols [MONO_TYPESPEC_SIZE];
                guint32 len;
@@ -108,12 +233,18 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass,
                mono_class_init (klass);
                if (retklass)
                        *retklass = klass;
-               return mono_class_get_field_from_name (klass, fname);
+               field = mono_class_get_field_from_name (klass, fname);
+               break;
        }
        default:
                g_warning ("field load from %x", class);
                return NULL;
        }
+
+       if (!field)
+               mono_loader_set_error_field_load (klass, fname);
+
+       return field;
 }
 
 MonoClassField*
@@ -154,7 +285,7 @@ mono_field_from_token (MonoImage *image, guint32 token, MonoClass **retklass,
        }
 
        mono_loader_lock ();
-       if (!field->parent->generic_class)
+       if (field && !field->parent->generic_class)
                g_hash_table_insert (image->field_cache, GUINT_TO_POINTER (token), field);
        mono_loader_unlock ();
        return field;
@@ -407,7 +538,7 @@ method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *contex
        case MONO_MEMBERREF_PARENT_TYPEREF:
                method = find_method (klass, NULL, mname, sig);
                if (!method)
-                       g_warning ("Missing method %s in assembly %s, type %s", mname, image->name, mono_class_get_name (klass));
+                       mono_loader_set_error_method_load (klass, mname);
                mono_metadata_free_method_signature (sig);
                break;
        case MONO_MEMBERREF_PARENT_TYPESPEC: {
index e89e3a04d72625bed567341f348b61ef4459416a..f819d8bb4d49cd7eac14baee7f6767667280187d 100644 (file)
@@ -949,8 +949,8 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
 {
        switch (conv) {
        case MONO_MARSHAL_CONV_BOOL_I4:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I4);
                mono_mb_emit_byte (mb, CEE_BRFALSE_S);
                mono_mb_emit_byte (mb, 3);
@@ -961,8 +961,8 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                mono_mb_emit_byte (mb, CEE_STIND_I1);
                break;
        case MONO_MARSHAL_CONV_BOOL_VARIANTBOOL:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I2);
                mono_mb_emit_byte (mb, CEE_BRFALSE_S);
                mono_mb_emit_byte (mb, 3);
@@ -988,18 +988,18 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                        esize = sizeof (gpointer);
 
                /* create a new array */
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
                mono_mb_emit_byte (mb, CEE_NEWARR);     
                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eclass));
                mono_mb_emit_byte (mb, CEE_STIND_I);
 
                /* copy the elements */
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icon (mb, G_STRUCT_OFFSET (MonoArray, vector));
                mono_mb_emit_byte (mb, CEE_ADD);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_icon (mb, mspec->data.array_data.num_elem * esize);
                mono_mb_emit_byte (mb, CEE_PREFIX1);
                mono_mb_emit_byte (mb, CEE_CPBLK);                      
@@ -1007,28 +1007,28 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                break;
        }
        case MONO_MARSHAL_CONV_STR_BYVALSTR: 
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_icall (mb, mono_string_new_wrapper);
                mono_mb_emit_byte (mb, CEE_STIND_I);            
                break;
        case MONO_MARSHAL_CONV_STR_BYVALWSTR:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_icall (mb, mono_string_from_utf16);
                mono_mb_emit_byte (mb, CEE_STIND_I);            
                break;          
        case MONO_MARSHAL_CONV_STR_LPTSTR:
        case MONO_MARSHAL_CONV_STR_LPSTR:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icall (mb, mono_string_new_wrapper);
                mono_mb_emit_byte (mb, CEE_STIND_I);            
                break;
        case MONO_MARSHAL_CONV_STR_LPWSTR:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icall (mb, mono_string_from_utf16);
                mono_mb_emit_byte (mb, CEE_STIND_I);
@@ -1041,21 +1041,21 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                dst_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
                
                /* *dst = new object */
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                mono_mb_emit_byte (mb, CEE_MONO_NEWOBJ);        
                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, klass));
                mono_mb_emit_byte (mb, CEE_STIND_I);
        
                /* save the old src pointer */
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_stloc (mb, src_var);
                /* save the old dst pointer */
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_stloc (mb, dst_var);
 
                /* dst = pointer to newly created object data */
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icon (mb, sizeof (MonoObject));
                mono_mb_emit_byte (mb, CEE_ADD);
@@ -1065,7 +1065,7 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                
                /* restore the old src pointer */
                mono_mb_emit_ldloc (mb, src_var);
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
                /* restore the old dst pointer */
                mono_mb_emit_ldloc (mb, dst_var);
                mono_mb_emit_byte (mb, CEE_STLOC_1);
@@ -1074,11 +1074,11 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
        case MONO_MARSHAL_CONV_DEL_FTN: {
                MonoClass *klass = mono_class_from_mono_type (type);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                mono_mb_emit_byte (mb, CEE_MONO_CLASSCONST);
                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, klass));
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icall (mb, mono_ftnptr_to_delegate);
                mono_mb_emit_byte (mb, CEE_STIND_I);
@@ -1154,14 +1154,14 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
 
        switch (conv) {
        case MONO_MARSHAL_CONV_BOOL_I4:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_U1);
                mono_mb_emit_byte (mb, CEE_STIND_I4);
                break;
        case MONO_MARSHAL_CONV_BOOL_VARIANTBOOL:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_U1);
                mono_mb_emit_byte (mb, CEE_NEG);
                mono_mb_emit_byte (mb, CEE_STIND_I2);
@@ -1175,17 +1175,17 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                int pos;
 
                /* free space if free == true */
-               mono_mb_emit_byte (mb, CEE_LDLOC_2);
+               mono_mb_emit_ldloc (mb, 2);
                mono_mb_emit_byte (mb, CEE_BRFALSE_S);
                pos = mb->pos;
                mono_mb_emit_byte (mb, 0);
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icall (mb, g_free);
                mono_mb_patch_addr_s (mb, pos, mb->pos - pos - 1);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icall (mb, conv_to_icall (conv));
                mono_mb_emit_byte (mb, CEE_STIND_I);    
@@ -1194,8 +1194,8 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
        case MONO_MARSHAL_CONV_ARRAY_SAVEARRAY:
        case MONO_MARSHAL_CONV_ARRAY_LPARRAY:
        case MONO_MARSHAL_CONV_DEL_FTN:
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
                mono_mb_emit_icall (mb, conv_to_icall (conv));
                mono_mb_emit_byte (mb, CEE_STIND_I);    
@@ -1205,8 +1205,8 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                if (!usize)
                        break;
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_1); /* dst */
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);    
+               mono_mb_emit_ldloc (mb, 1); /* dst */
+               mono_mb_emit_ldloc (mb, 0);     
                mono_mb_emit_byte (mb, CEE_LDIND_I); /* src String */
                mono_mb_emit_icon (mb, usize);
                mono_mb_emit_icall (mb, conv_to_icall (conv));
@@ -1230,14 +1230,14 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                if (!usize) 
                        break;
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);            
                mono_mb_emit_byte (mb, CEE_BRFALSE_S);
                pos = mb->pos;
                mono_mb_emit_byte (mb, 0);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);    
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);     
                mono_mb_emit_byte (mb, CEE_LDIND_I);    
                mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                mono_mb_emit_byte (mb, CEE_MONO_OBJADDR);
@@ -1255,31 +1255,31 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                src_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
                dst_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
                
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);            
                mono_mb_emit_byte (mb, CEE_BRFALSE_S);
                pos = mb->pos;
                mono_mb_emit_byte (mb, 0);
                
                /* save the old src pointer */
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_stloc (mb, src_var);
                /* save the old dst pointer */
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_stloc (mb, dst_var);
 
                /* src = pointer to object data */
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);            
                mono_mb_emit_icon (mb, sizeof (MonoObject));
                mono_mb_emit_byte (mb, CEE_ADD);
-               mono_mb_emit_byte (mb, CEE_STLOC_0); 
+               mono_mb_emit_stloc (mb, 0); 
 
                emit_struct_conv (mb, mono_class_from_mono_type (type), FALSE);
                
                /* restore the old src pointer */
                mono_mb_emit_ldloc (mb, src_var);
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
                /* restore the old dst pointer */
                mono_mb_emit_ldloc (mb, dst_var);
                mono_mb_emit_byte (mb, CEE_STLOC_1);
@@ -1314,8 +1314,8 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object)
        if (klass->blittable) {
                int msize = mono_class_value_size (klass, NULL);
                g_assert (msize == info->native_size);
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 1);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_icon (mb, msize);
                mono_mb_emit_byte (mb, CEE_PREFIX1);
                mono_mb_emit_byte (mb, CEE_CPBLK);
@@ -1357,8 +1357,8 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object)
 
                        if (ftype->byref || ftype->type == MONO_TYPE_I ||
                            ftype->type == MONO_TYPE_U) {
-                               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-                               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                               mono_mb_emit_ldloc (mb, 1);
+                               mono_mb_emit_ldloc (mb, 0);
                                mono_mb_emit_byte (mb, CEE_LDIND_I);
                                mono_mb_emit_byte (mb, CEE_STIND_I);
                                break;
@@ -1372,24 +1372,24 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object)
 #if SIZEOF_VOID_P == 4
                        case MONO_TYPE_PTR:
 #endif
-                               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-                               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                               mono_mb_emit_ldloc (mb, 1);
+                               mono_mb_emit_ldloc (mb, 0);
                                mono_mb_emit_byte (mb, CEE_LDIND_I4);
                                mono_mb_emit_byte (mb, CEE_STIND_I4);
                                break;
                        case MONO_TYPE_I1:
                        case MONO_TYPE_U1:
                        case MONO_TYPE_BOOLEAN:
-                               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-                               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                               mono_mb_emit_ldloc (mb, 1);
+                               mono_mb_emit_ldloc (mb, 0);
                                mono_mb_emit_byte (mb, CEE_LDIND_I1);
                                mono_mb_emit_byte (mb, CEE_STIND_I1);
                                break;
                        case MONO_TYPE_I2:
                        case MONO_TYPE_U2:
                        case MONO_TYPE_CHAR:
-                               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-                               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                               mono_mb_emit_ldloc (mb, 1);
+                               mono_mb_emit_ldloc (mb, 0);
                                mono_mb_emit_byte (mb, CEE_LDIND_I2);
                                mono_mb_emit_byte (mb, CEE_STIND_I2);
                                break;
@@ -1398,20 +1398,20 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object)
 #if SIZEOF_VOID_P == 8
                        case MONO_TYPE_PTR:
 #endif
-                               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-                               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                               mono_mb_emit_ldloc (mb, 1);
+                               mono_mb_emit_ldloc (mb, 0);
                                mono_mb_emit_byte (mb, CEE_LDIND_I8);
                                mono_mb_emit_byte (mb, CEE_STIND_I8);
                                break;
                        case MONO_TYPE_R4:
-                               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-                               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                               mono_mb_emit_ldloc (mb, 1);
+                               mono_mb_emit_ldloc (mb, 0);
                                mono_mb_emit_byte (mb, CEE_LDIND_R4);
                                mono_mb_emit_byte (mb, CEE_STIND_R4);
                                break;
                        case MONO_TYPE_R8:
-                               mono_mb_emit_byte (mb, CEE_LDLOC_1);
-                               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                               mono_mb_emit_ldloc (mb, 1);
+                               mono_mb_emit_ldloc (mb, 0);
                                mono_mb_emit_byte (mb, CEE_LDIND_R8);
                                mono_mb_emit_byte (mb, CEE_STIND_R8);
                                break;
@@ -4298,13 +4298,13 @@ emit_marshal_custom (EmitMarshalContext *m, int argnum, MonoType *t,
        case MARSHAL_ACTION_CONV_RESULT:
                loc1 = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
                        
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_3);
+               mono_mb_emit_ldloc (mb, 3);
                mono_mb_emit_stloc (mb, loc1);
 
                /* Check for null */
-               mono_mb_emit_byte (mb, CEE_LDLOC_3);
+               mono_mb_emit_ldloc (mb, 3);
                pos2 = mono_mb_emit_branch (mb, CEE_BRFALSE);
 
                mono_mb_emit_ldstr (mb, g_strdup (spec->data.custom_data.cookie));
@@ -4313,10 +4313,10 @@ emit_marshal_custom (EmitMarshalContext *m, int argnum, MonoType *t,
                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, get_instance));
                mono_mb_emit_byte (mb, CEE_DUP);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_3);
+               mono_mb_emit_ldloc (mb, 3);
                mono_mb_emit_byte (mb, CEE_CALLVIRT);
                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, marshal_native_to_managed));
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
 
                mono_mb_emit_ldloc (mb, loc1);
                mono_mb_emit_byte (mb, CEE_CALLVIRT);
@@ -4358,13 +4358,13 @@ emit_marshal_custom (EmitMarshalContext *m, int argnum, MonoType *t,
 
                loc1 = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
                        
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
                        
-               mono_mb_emit_byte (mb, CEE_LDLOC_3);
+               mono_mb_emit_ldloc (mb, 3);
                mono_mb_emit_stloc (mb, loc1);
 
                /* Check for null */
-               mono_mb_emit_byte (mb, CEE_LDLOC_3);
+               mono_mb_emit_ldloc (mb, 3);
                pos2 = mono_mb_emit_branch (mb, CEE_BRFALSE);
 
                mono_mb_emit_ldstr (mb, g_strdup (spec->data.custom_data.cookie));
@@ -4372,10 +4372,10 @@ emit_marshal_custom (EmitMarshalContext *m, int argnum, MonoType *t,
                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, get_instance));
                mono_mb_emit_byte (mb, CEE_DUP);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_3);
+               mono_mb_emit_ldloc (mb, 3);
                mono_mb_emit_byte (mb, CEE_CALLVIRT);
                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, marshal_managed_to_native));
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
 
                mono_mb_emit_ldloc (mb, loc1);
                mono_mb_emit_byte (mb, CEE_CALLVIRT);
@@ -4481,7 +4481,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                else
                        mono_mb_emit_ldarg_addr (mb, argnum);
                
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
                        
                /* allocate space for the native struct and
                 * store the address into local variable 1 (dest) */
@@ -4491,7 +4491,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                mono_mb_emit_stloc (mb, conv_arg);
 
                if (t->byref) {
-                       mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                       mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_byte (mb, CEE_BRFALSE);
                        pos = mb->pos;
                        mono_mb_emit_i4 (mb, 0);
@@ -4534,14 +4534,14 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_ldarg (mb, argnum);
                        mono_mb_emit_byte (mb, CEE_STLOC_1);
 
-                       mono_mb_emit_byte (mb, CEE_LDLOC_1);
+                       mono_mb_emit_ldloc (mb, 1);
                        mono_mb_emit_byte (mb, CEE_BRFALSE);
                        pos = mb->pos;
                        mono_mb_emit_i4 (mb, 0);
 
                        /* src = tmp_locals [i] */
                        mono_mb_emit_ldloc (mb, conv_arg);
-                       mono_mb_emit_byte (mb, CEE_STLOC_0);
+                       mono_mb_emit_stloc (mb, 0);
 
                        /* emit valuetype conversion code */
                        emit_struct_conv (mb, klass, TRUE);
@@ -4556,14 +4556,14 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
        case MARSHAL_ACTION_CONV_RESULT:
                if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
                        klass->blittable) {
-                       mono_mb_emit_byte (mb, CEE_STLOC_3);
+                       mono_mb_emit_stloc (mb, 3);
                        break;
                }
                /* load pointer to returned value type */
                mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                mono_mb_emit_byte (mb, CEE_MONO_VTADDR);
                /* store the address of the source into local variable 0 */
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
                /* set dst_ptr */
                mono_mb_emit_ldloc_addr (mb, 3);
                mono_mb_emit_byte (mb, CEE_STLOC_1);
@@ -4588,10 +4588,10 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_ldarg (mb, argnum);
                else
                        mono_mb_emit_ldarg_addr (mb, argnum);
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
 
                if (t->byref) {
-                       mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                       mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_byte (mb, CEE_BRFALSE);
                        pos = mb->pos;
                        mono_mb_emit_i4 (mb, 0);
@@ -4619,7 +4619,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
 
                /* Set src */
                mono_mb_emit_ldloc_addr (mb, conv_arg);
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
 
                /* Set dest */
                mono_mb_emit_ldarg (mb, argnum);
@@ -4634,7 +4634,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
        case MARSHAL_ACTION_MANAGED_CONV_RESULT:
                if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
                        klass->blittable || klass->enumtype) {
-                       mono_mb_emit_byte (mb, CEE_STLOC_3);
+                       mono_mb_emit_stloc (mb, 3);
                        m->retobj_var = 0;
                        break;
                }
@@ -4644,7 +4644,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                mono_mb_emit_byte (mb, CEE_MONO_VTADDR);
                        
                /* store the address of the source into local variable 0 */
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
                /* allocate space for the native struct and
                 * store the address into dst_ptr */
                m->retobj_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
@@ -4654,7 +4654,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                mono_mb_emit_byte (mb, CEE_CONV_I);
                mono_mb_emit_icall (mb, mono_marshal_alloc);
                mono_mb_emit_byte (mb, CEE_STLOC_1);
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_stloc (mb, m->retobj_var);
 
                /* emit valuetype conversion code */
@@ -4722,7 +4722,7 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t,
                break;
 
        case MARSHAL_ACTION_CONV_RESULT:
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
                                
                conv = mono_marshal_get_ptr_to_string_conv (m->piinfo, spec, &need_free);
                if (conv == -1) {
@@ -4731,12 +4731,12 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t,
                        break;
                }
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_icall (mb, conv_to_icall (conv));
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
 
                /* free the string */
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_icall (mb, g_free);
                break;
 
@@ -4763,7 +4763,7 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t,
 
        case MARSHAL_ACTION_MANAGED_CONV_RESULT:
                mono_mb_emit_icall (mb, conv_to_icall (MONO_MARSHAL_CONV_STR_LPSTR));
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
                break;
 
        default:
@@ -4840,8 +4840,8 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        }
                                
                        /* store the address of the source into local variable 0 */
-                       mono_mb_emit_byte (mb, CEE_STLOC_0);
-                       mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                       mono_mb_emit_stloc (mb, 0);
+                       mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_byte (mb, CEE_BRFALSE);
                        pos = mb->pos;
                        mono_mb_emit_i4 (mb, 0);
@@ -4860,12 +4860,12 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        }
 
                        /* set the src_ptr */
-                       mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                       mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                        mono_mb_emit_byte (mb, CEE_MONO_OBJADDR);
                        mono_mb_emit_icon (mb, sizeof (MonoObject));
                        mono_mb_emit_byte (mb, CEE_ADD);
-                       mono_mb_emit_byte (mb, CEE_STLOC_0);
+                       mono_mb_emit_stloc (mb, 0);
 
                        /* set dst_ptr */
                        mono_mb_emit_ldloc (mb, conv_arg);
@@ -4922,20 +4922,20 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
 
                mono_mb_emit_byte (mb, CEE_STLOC_1);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_byte (mb, CEE_BRFALSE);
                pos = mb->pos;
                mono_mb_emit_i4 (mb, 0);
 
                if (t->byref || (t->attrs & PARAM_ATTRIBUTE_OUT)) {
-                       mono_mb_emit_byte (mb, CEE_LDLOC_1);
+                       mono_mb_emit_ldloc (mb, 1);
                        mono_mb_emit_icon (mb, sizeof (MonoObject));
                        mono_mb_emit_byte (mb, CEE_ADD);
                        mono_mb_emit_byte (mb, CEE_STLOC_1);
                        
                        /* src = tmp_locals [i] */
                        mono_mb_emit_ldloc (mb, conv_arg);
-                       mono_mb_emit_byte (mb, CEE_STLOC_0);
+                       mono_mb_emit_stloc (mb, 0);
 
                        /* emit valuetype conversion code */
                        emit_struct_conv (mb, t->data.klass, TRUE);
@@ -4976,26 +4976,26 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
        case MARSHAL_ACTION_CONV_RESULT:
                if (klass->delegate) {
                        g_assert (!t->byref);
-                       mono_mb_emit_byte (mb, CEE_STLOC_0);
+                       mono_mb_emit_stloc (mb, 0);
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                        mono_mb_emit_byte (mb, CEE_MONO_CLASSCONST);
                        mono_mb_emit_i4 (mb, mono_mb_add_data (mb, klass));
-                       mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                       mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_icall (mb, conv_to_icall (MONO_MARSHAL_CONV_FTN_DEL));
-                       mono_mb_emit_byte (mb, CEE_STLOC_3);
+                       mono_mb_emit_stloc (mb, 3);
                } else {
                        /* set src */
-                       mono_mb_emit_byte (mb, CEE_STLOC_0);
+                       mono_mb_emit_stloc (mb, 0);
        
                        /* Make a copy since emit_conv modifies local 0 */
                        loc = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
-                       mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                       mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_stloc (mb, loc);
        
                        mono_mb_emit_byte (mb, CEE_LDNULL);
-                       mono_mb_emit_byte (mb, CEE_STLOC_3);
+                       mono_mb_emit_stloc (mb, 3);
        
-                       mono_mb_emit_byte (mb, CEE_LDLOC_0);
+                       mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_byte (mb, CEE_BRFALSE);
                        pos = mb->pos;
                        mono_mb_emit_i4 (mb, 0);
@@ -5005,11 +5005,11 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                        mono_mb_emit_byte (mb, CEE_MONO_NEWOBJ);        
                        mono_mb_emit_i4 (mb, mono_mb_add_data (mb, klass));
-                       mono_mb_emit_byte (mb, CEE_STLOC_3);
+                       mono_mb_emit_stloc (mb, 3);
                                        
                        /* set dst  */
        
-                       mono_mb_emit_byte (mb, CEE_LDLOC_3);
+                       mono_mb_emit_ldloc (mb, 3);
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                        mono_mb_emit_byte (mb, CEE_MONO_OBJADDR);
                        mono_mb_emit_icon (mb, sizeof (MonoObject));
@@ -5071,12 +5071,12 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_byte (mb, CEE_LDIND_I);
                }                               
 
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
 
                mono_mb_emit_byte (mb, CEE_LDC_I4_0);
                mono_mb_emit_stloc (mb, conv_arg);
 
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_BRFALSE);
                pos = mb->pos;
                mono_mb_emit_i4 (mb, 0);
@@ -5116,7 +5116,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                mono_mb_emit_byte (mb, CEE_MONO_OBJADDR);
                mono_mb_emit_icon (mb, sizeof (MonoObject));
                mono_mb_emit_byte (mb, CEE_ADD);
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
 
                /* Allocate and set dest */
                mono_mb_emit_icon (mb, mono_class_native_size (klass, NULL));
@@ -5126,7 +5126,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
 
                /* Update argument pointer */
                mono_mb_emit_ldarg (mb, argnum);
-               mono_mb_emit_byte (mb, CEE_LDLOC_1);
+               mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_byte (mb, CEE_STIND_I);
                
                /* emit valuetype conversion code */
@@ -5138,7 +5138,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
        case MARSHAL_ACTION_MANAGED_CONV_RESULT:
                if (klass->delegate) {
                        mono_mb_emit_icall (mb, conv_to_icall (MONO_MARSHAL_CONV_DEL_FTN));
-                       mono_mb_emit_byte (mb, CEE_STLOC_3);
+                       mono_mb_emit_stloc (mb, 3);
                        break;
                }
 
@@ -5148,23 +5148,23 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        break;
                }
 
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
                /* Check for null */
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                pos = mono_mb_emit_branch (mb, CEE_BRTRUE);
                mono_mb_emit_byte (mb, CEE_LDNULL);
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
                pos2 = mono_mb_emit_branch (mb, CEE_BR);
 
                mono_mb_patch_addr (mb, pos, mb->pos - (pos + 4));
 
                /* Set src */
-               mono_mb_emit_byte (mb, CEE_LDLOC_0);
+               mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                mono_mb_emit_byte (mb, CEE_MONO_OBJADDR);
                mono_mb_emit_icon (mb, sizeof (MonoObject));
                mono_mb_emit_byte (mb, CEE_ADD);
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
 
                /* Allocate and set dest */
                mono_mb_emit_icon (mb, mono_class_native_size (klass, NULL));
@@ -5172,7 +5172,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                mono_mb_emit_icall (mb, mono_marshal_alloc);
                mono_mb_emit_byte (mb, CEE_DUP);
                mono_mb_emit_byte (mb, CEE_STLOC_1);
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
 
                emit_struct_conv (mb, klass, FALSE);
 
@@ -5308,7 +5308,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                                mono_mb_emit_ldloc (mb, index_var);
                                mono_mb_emit_byte (mb, CEE_LDELEMA);
                                mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass));
-                               mono_mb_emit_byte (mb, CEE_STLOC_0);
+                               mono_mb_emit_stloc (mb, 0);
 
                                /* set dst_ptr */
                                mono_mb_emit_ldloc (mb, dest_ptr);
@@ -5425,7 +5425,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                                if (need_convert) {
                                        /* set the src_ptr */
                                        mono_mb_emit_ldloc (mb, src_ptr);
-                                       mono_mb_emit_byte (mb, CEE_STLOC_0);
+                                       mono_mb_emit_stloc (mb, 0);
 
                                        /* set dst_ptr */
                                        mono_mb_emit_ldarg (mb, argnum);
@@ -5462,7 +5462,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
 
        case MARSHAL_ACTION_CONV_RESULT:
                /* fixme: we need conversions here */
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
                break;
 
        case MARSHAL_ACTION_MANAGED_CONV_IN: {
@@ -5765,6 +5765,101 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
 
                break;
        }
+       case MARSHAL_ACTION_MANAGED_CONV_RESULT: {
+               MonoClass *eklass;
+               guint32 label1, label2, label3;
+               int index_var, src, dest, esize;
+               MonoMarshalConv conv = -1;
+               gboolean is_string = FALSE;
+               
+               g_assert (!t->byref);
+
+               eklass = klass->element_class;
+
+               mono_marshal_load_type_info (eklass);
+
+               if (eklass == mono_defaults.string_class) {
+                       is_string = TRUE;
+                       conv = mono_marshal_get_string_to_ptr_conv (m->piinfo, spec);
+               }
+               else {
+                       g_assert_not_reached ();
+               }
+
+               if (is_string)
+                       esize = sizeof (gpointer);
+               else
+                       esize = mono_class_native_size (eklass, NULL);
+
+               src = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
+               dest = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
+                       
+               mono_mb_emit_stloc (mb, src);
+               mono_mb_emit_ldloc (mb, src);
+               mono_mb_emit_stloc (mb, 3);
+
+               /* Check for null */
+               mono_mb_emit_ldloc (mb, src);
+               label1 = mono_mb_emit_branch (mb, CEE_BRFALSE);
+
+               /* Allocate native array */
+               mono_mb_emit_icon (mb, esize);
+               mono_mb_emit_ldloc (mb, src);
+               mono_mb_emit_byte (mb, CEE_LDLEN);
+
+               if (eklass == mono_defaults.string_class) {
+                       /* Make the array bigger for the terminating null */
+                       mono_mb_emit_byte (mb, CEE_LDC_I4_1);
+                       mono_mb_emit_byte (mb, CEE_ADD);
+               }
+               mono_mb_emit_byte (mb, CEE_MUL);
+               mono_mb_emit_icall (mb, mono_marshal_alloc);
+               mono_mb_emit_stloc (mb, dest);
+               mono_mb_emit_ldloc (mb, dest);
+               mono_mb_emit_stloc (mb, 3);
+
+               /* Emit marshalling loop */
+               index_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
+               mono_mb_emit_byte (mb, CEE_LDC_I4_0);
+               mono_mb_emit_stloc (mb, index_var);
+               label2 = mb->pos;
+               mono_mb_emit_ldloc (mb, index_var);
+               mono_mb_emit_ldloc (mb, src);
+               mono_mb_emit_byte (mb, CEE_LDLEN);
+               label3 = mono_mb_emit_branch (mb, CEE_BGE);
+
+               /* Emit marshalling code */
+               if (is_string) {
+                       g_assert (conv != -1);
+
+                       /* dest */
+                       mono_mb_emit_ldloc (mb, dest);
+
+                       /* src */
+                       mono_mb_emit_ldloc (mb, src);
+                       mono_mb_emit_ldloc (mb, index_var);
+
+                       mono_mb_emit_byte (mb, CEE_LDELEM_REF);
+
+                       mono_mb_emit_icall (mb, conv_to_icall (conv));
+                       mono_mb_emit_byte (mb, CEE_STIND_I);
+               }
+               else {
+                       char *msg = g_strdup ("Marshalling of non-string arrays to managed code is not implemented.");
+                       mono_mb_emit_exception_marshal_directive (mb, msg);
+                       return conv_arg;
+               }
+
+               mono_mb_emit_add_to_local (mb, index_var, 1);
+               mono_mb_emit_add_to_local (mb, dest, esize);
+
+               mono_mb_emit_byte (mb, CEE_BR);
+               mono_mb_emit_i4 (mb, label2 - (mb->pos + 4));
+
+               mono_mb_patch_addr (mb, label3, mb->pos - (label3 + 4));
+               mono_mb_patch_addr (mb, label1, mb->pos - (label1 + 4));
+               break;
+       }
        default:
                g_assert_not_reached ();
        }
@@ -5815,7 +5910,7 @@ emit_marshal_boolean (EmitMarshalContext *m, int argnum, MonoType *t,
 
        case MARSHAL_ACTION_CONV_RESULT:
                /* maybe we need to make sure that it fits within 8 bits */
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
                break;
 
        default:
@@ -5913,7 +6008,7 @@ mono_marshal_emit_native_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *si
 
        /* delete_old = FALSE */
        mono_mb_emit_icon (mb, 0);
-       mono_mb_emit_byte (mb, CEE_STLOC_2);
+       mono_mb_emit_stloc (mb, 2);
 
        if (!MONO_TYPE_IS_VOID(sig->ret)) {
                /* allocate local 3 to store the return value */
@@ -6045,7 +6140,7 @@ mono_marshal_emit_native_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *si
                        case MONO_TYPE_I8:
                        case MONO_TYPE_U8:
                                /* no conversions necessary */
-                               mono_mb_emit_byte (mb, CEE_STLOC_3);
+                               mono_mb_emit_stloc (mb, 3);
                                break;
                        case MONO_TYPE_VALUETYPE:
                                klass = sig->ret->data.klass;
@@ -6065,7 +6160,7 @@ mono_marshal_emit_native_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *si
                                break;
                        case MONO_TYPE_CHAR:
                                /* fixme: we need conversions here */
-                               mono_mb_emit_byte (mb, CEE_STLOC_3);
+                               mono_mb_emit_stloc (mb, 3);
                                break;
                        case MONO_TYPE_TYPEDBYREF:
                        case MONO_TYPE_FNPTR:
@@ -6075,7 +6170,7 @@ mono_marshal_emit_native_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *si
                        }
                }
        } else {
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
        }
 
        /* 
@@ -6116,7 +6211,7 @@ mono_marshal_emit_native_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *si
        }
 
        if (!MONO_TYPE_IS_VOID(sig->ret))
-               mono_mb_emit_byte (mb, CEE_LDLOC_3);
+               mono_mb_emit_ldloc (mb, 3);
 
        mono_mb_emit_byte (mb, CEE_RET);
 }
@@ -6319,7 +6414,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
        }
 
        mono_mb_emit_icon (mb, 0);
-       mono_mb_emit_byte (mb, CEE_STLOC_2);
+       mono_mb_emit_stloc (mb, 2);
 
        /* we copy the signature, so that we can modify it */
        csig = mono_metadata_signature_dup (sig);
@@ -6459,7 +6554,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
                case MONO_TYPE_I8:
                case MONO_TYPE_U8:
                case MONO_TYPE_OBJECT:
-                       mono_mb_emit_byte (mb, CEE_STLOC_3);
+                       mono_mb_emit_stloc (mb, 3);
                        break;
                case MONO_TYPE_STRING:
                        csig->ret = &mono_defaults.int_class->byval_arg;
@@ -6467,6 +6562,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
                        break;
                case MONO_TYPE_VALUETYPE:
                case MONO_TYPE_CLASS:
+               case MONO_TYPE_SZARRAY:
                        emit_marshal (&m, 0, sig->ret, mspecs [0], 0, NULL, MARSHAL_ACTION_MANAGED_CONV_RESULT);
                        break;
                default:
@@ -6474,7 +6570,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
                        g_assert_not_reached ();
                }
        } else {
-               mono_mb_emit_byte (mb, CEE_STLOC_3);
+               mono_mb_emit_stloc (mb, 3);
        }
 
        /* Convert byref arguments back */
@@ -6513,7 +6609,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
        }
        else {
                if (!MONO_TYPE_IS_VOID(sig->ret))
-                       mono_mb_emit_byte (mb, CEE_LDLOC_3);
+                       mono_mb_emit_ldloc (mb, 3);
                mono_mb_emit_byte (mb, CEE_RET);
        }
 
@@ -6867,12 +6963,12 @@ mono_marshal_get_struct_to_ptr (MonoClass *klass)
                /* allocate local 2 (boolean) delete_old */
                mono_mb_add_local (mb, &mono_defaults.boolean_class->byval_arg);
                mono_mb_emit_byte (mb, CEE_LDARG_2);
-               mono_mb_emit_byte (mb, CEE_STLOC_2);
+               mono_mb_emit_stloc (mb, 2);
 
                /* initialize src_ptr to point to the start of object data */
                mono_mb_emit_byte (mb, CEE_LDARG_0);
                mono_mb_emit_ldflda (mb, sizeof (MonoObject));
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
 
                /* initialize dst_ptr */
                mono_mb_emit_byte (mb, CEE_LDARG_1);
@@ -6940,7 +7036,7 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)
                
                /* initialize src_ptr to point to the start of object data */
                mono_mb_emit_byte (mb, CEE_LDARG_0);
-               mono_mb_emit_byte (mb, CEE_STLOC_0);
+               mono_mb_emit_stloc (mb, 0);
 
                /* initialize dst_ptr */
                mono_mb_emit_byte (mb, CEE_LDARG_1);
@@ -7727,8 +7823,12 @@ ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString
 
        if (string == NULL)
                return NULL;
-       else
-               return g_memdup (mono_string_chars (string), mono_string_length (string)*2);
+       else {
+               gunichar2 *res = g_malloc (mono_string_length (string) * 2);
+               memcpy (res, mono_string_chars (string), mono_string_length (string) * 2);
+               res [mono_string_length (string)] = 0;
+               return res;
+       }
 }
 
 static void
index 8f4f873b41919546facb9b5aa745f31c5cb55983..9e604cc2ff624a76e40b13bc90efb803368d9d16 100644 (file)
@@ -259,11 +259,12 @@ guint mono_aligned_addr_hash (gconstpointer ptr);
 const char *   mono_meta_table_name              (int table);
 void           mono_metadata_compute_table_bases (MonoImage *meta);
 
-MonoClass**
+gboolean
 mono_metadata_interfaces_from_typedef_full  (MonoImage             *image,
-                                            guint32                table_index,
-                                            guint                 *count,
-                                            MonoGenericContext    *context);
+                                                                                        guint32                table_index,
+                                                                                        MonoClass           ***interfaces,
+                                                                                        guint                 *count,
+                                                                                        MonoGenericContext    *context);
 
 MonoArrayType *
 mono_metadata_parse_array_full              (MonoImage             *image,
index c6f19d5a1c8bee100095faf962e87ba3b1215443..a9a46b3cc027719c6d9dac6478226ca037101537 100644 (file)
@@ -2432,33 +2432,36 @@ mono_metadata_typedef_from_method (MonoImage *meta, guint32 index)
 }
 
 /*
- * mono_metadata_interfaces_from_typedef:
+ * mono_metadata_interfaces_from_typedef_full:
  * @meta: metadata context
  * @index: typedef token
  * 
- * Returns: and array of interfaces that the @index typedef token implements.
- * The number of elemnts in the array is returned in @count.
+ * The array of interfaces that the @index typedef token implements is returned in
+ * @interfaces. The number of elemnts in the array is returned in @count.
+ *
+ * Returns: TRUE on success, FALSE on failure.
  */
-MonoClass**
-mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, guint *count, MonoGenericContext *context)
+gboolean
+mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, MonoClass ***interfaces, guint *count, MonoGenericContext *context)
 {
        MonoTableInfo *tdef = &meta->tables [MONO_TABLE_INTERFACEIMPL];
        locator_t loc;
        guint32 start, i;
        guint32 cols [MONO_INTERFACEIMPL_SIZE];
        MonoClass **result;
-       
+
+       *interfaces = NULL;
        *count = 0;
 
        if (!tdef->base)
-               return NULL;
+               return TRUE;
 
        loc.idx = mono_metadata_token_index (index);
        loc.col_idx = MONO_INTERFACEIMPL_CLASS;
        loc.t = tdef;
 
        if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
-               return NULL;
+               return TRUE;
 
        start = loc.result;
        /*
@@ -2482,13 +2485,21 @@ mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, guin
                *count = ++i;
                ++start;
        }
-       return result;
+       *interfaces = result;
+       return TRUE;
 }
 
 MonoClass**
 mono_metadata_interfaces_from_typedef (MonoImage *meta, guint32 index, guint *count)
 {
-       return mono_metadata_interfaces_from_typedef_full (meta, index, count, NULL);
+       MonoClass **interfaces;
+       gboolean rv;
+
+    rv = mono_metadata_interfaces_from_typedef_full (meta, index, &interfaces, count, NULL);
+       if (rv)
+               return interfaces;
+       else
+               return NULL;
 }
 
 /*
@@ -3777,8 +3788,16 @@ method_from_method_def_or_ref (MonoImage *m, guint32 tok, MonoGenericContext *co
        return NULL;
 }
 
-MonoMethod**
-mono_class_get_overrides_full (MonoImage *image, guint32 type_token, gint32 *num_overrides,
+/*
+ * mono_class_get_overrides_full:
+ *
+ *   Return the method overrides belonging to class @type_token in @overrides, and
+ * the number of overrides in @num_overrides.
+ *
+ * Returns: TRUE on success, FALSE on failure.
+ */
+gboolean
+mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides,
                               MonoGenericContext *generic_context)
 {
        locator_t loc;
@@ -3788,18 +3807,19 @@ mono_class_get_overrides_full (MonoImage *image, guint32 type_token, gint32 *num
        guint32 cols [MONO_METHODIMPL_SIZE];
        MonoMethod **result;
 
+       *overrides = NULL;
        if (num_overrides)
                *num_overrides = 0;
 
        if (!tdef->base)
-               return NULL;
+               return TRUE;
 
        loc.t = tdef;
        loc.col_idx = MONO_METHODIMPL_CLASS;
        loc.idx = mono_metadata_token_index (type_token);
 
        if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
-               return NULL;
+               return TRUE;
 
        start = loc.result;
        end = start + 1;
@@ -3828,9 +3848,10 @@ mono_class_get_overrides_full (MonoImage *image, guint32 type_token, gint32 *num
                        image, cols [MONO_METHODIMPL_BODY], generic_context);
        }
 
+       *overrides = result;
        if (num_overrides)
                *num_overrides = num;
-       return result;
+       return TRUE;
 }
 
 /**
@@ -3849,8 +3870,8 @@ mono_guid_to_string (const guint8 *guid)
                                guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
 }
 
-static MonoClass**
-get_constraints (MonoImage *image, int owner, MonoGenericContext *context)
+static gboolean
+get_constraints (MonoImage *image, int owner, MonoClass ***constraints, MonoGenericContext *context)
 {
        MonoTableInfo *tdef  = &image->tables [MONO_TABLE_GENERICPARAMCONSTRAINT];
        guint32 cols [MONO_GENPARCONSTRAINT_SIZE];
@@ -3858,7 +3879,7 @@ get_constraints (MonoImage *image, int owner, MonoGenericContext *context)
        MonoClass *klass, **res;
        GList *cons = NULL, *tmp;
        
-
+       *constraints = NULL;
        found = 0;
        for (i = 0; i < tdef->rows; ++i) {
                mono_metadata_decode_row (tdef, i, cols, MONO_GENPARCONSTRAINT_SIZE);
@@ -3874,13 +3895,14 @@ get_constraints (MonoImage *image, int owner, MonoGenericContext *context)
                }
        }
        if (!found)
-               return NULL;
+               return TRUE;
        res = g_new0 (MonoClass*, found + 1);
        for (i = 0, tmp = cons; i < found; ++i, tmp = tmp->next) {
                res [i] = tmp->data;
        }
        g_list_free (cons);
-       return res;
+       *constraints = res;
+       return TRUE;
 }
 
 gboolean
@@ -3969,7 +3991,7 @@ mono_metadata_load_generic_params (MonoImage *image, guint32 token, MonoGenericC
        container->context.container = container;
 
        for (i = 0; i < n; i++)
-               params [i].constraints = get_constraints (image, last_num + i + 1, &container->context);
+               get_constraints (image, last_num + i + 1, &params [i].constraints, &container->context);
 
        return container;
 }
index 71376acad5a755ad7d3baeb34c479d2995bcaf16..2af08acb134ea99b69dd89d3a93e8118c8a14136 100644 (file)
@@ -136,61 +136,6 @@ mono_debugger_start_add_type (MonoDebugHandle *symfile, MonoClass *klass)
        must_reload_symtabs = TRUE;
 }
 
-MonoReflectionMethod *
-ves_icall_MonoDebugger_GetMethod (MonoReflectionAssembly *assembly, guint32 token)
-{
-       MonoMethod *method;
-
-       method = mono_get_method (mono_assembly_get_image (assembly->assembly), token, NULL);
-
-       return mono_method_get_object (mono_domain_get (), method, NULL);
-}
-
-int
-ves_icall_MonoDebugger_GetMethodToken (MonoReflectionAssembly *assembly, MonoReflectionMethod *method)
-{
-       return method->method->token;
-}
-
-MonoReflectionType *
-ves_icall_MonoDebugger_GetType (MonoReflectionAssembly *assembly, guint32 token)
-{
-       MonoClass *klass;
-
-       klass = mono_class_get (mono_assembly_get_image (assembly->assembly), token);
-       if (!klass) {
-               g_warning (G_STRLOC ": %x", token);
-               return NULL;
-       }
-
-       return mono_type_get_object (mono_domain_get (), &klass->byval_arg);
-}
-
-MonoReflectionType *
-ves_icall_MonoDebugger_GetLocalTypeFromSignature (MonoReflectionAssembly *assembly, MonoArray *signature)
-{
-       MonoDomain *domain; 
-       MonoImage *image;
-       MonoType *type;
-       const char *ptr;
-       int len = 0;
-
-       MONO_CHECK_ARG_NULL (assembly);
-       MONO_CHECK_ARG_NULL (signature);
-
-       domain = mono_domain_get();
-       image = mono_assembly_get_image (assembly->assembly);
-
-       ptr = mono_array_addr (signature, char, 0);
-       g_assert (*ptr++ == 0x07);
-       len = mono_metadata_decode_value (ptr, &ptr);
-       g_assert (len == 1);
-
-       type = mono_metadata_parse_type (image, MONO_PARSE_LOCAL, 0, ptr, &ptr);
-
-       return mono_type_get_object (domain, type);
-}
-
 void
 mono_debugger_event (MonoDebuggerEvent event, guint64 data, guint64 arg)
 {
index 8d2052b4ecd909bc7577d5791536f9cc8eef022e..d4a596bfb5e4bd285f6f510d561546deb402ff24 100644 (file)
@@ -104,19 +104,6 @@ gboolean        mono_debugger_throw_exception             (gpointer addr, gpoint
 void *
 mono_vtable_get_static_field_data (MonoVTable *vt);
 
-
-MonoReflectionMethod *
-ves_icall_MonoDebugger_GetMethod (MonoReflectionAssembly *assembly, guint32 token);
-
-int
-ves_icall_MonoDebugger_GetMethodToken (MonoReflectionAssembly *assembly, MonoReflectionMethod *method);
-
-MonoReflectionType *
-ves_icall_MonoDebugger_GetLocalTypeFromSignature (MonoReflectionAssembly *assembly, MonoArray *signature);
-
-MonoReflectionType *
-ves_icall_MonoDebugger_GetType (MonoReflectionAssembly *assembly, guint32 token);
-
 gchar *
 mono_debugger_check_runtime_version (const char *filename);
 
index f93cdbffbae7c145563612bc495c2452fd21567b..66cb69e5e104047c3ba5e820be82c320e4da1d62 100644 (file)
@@ -448,6 +448,9 @@ mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDoma
        MonoDebugMethodInfo *minfo;
        MethodHashEntry *hash;
 
+       if (method->is_inflated)
+               return NULL;
+
        if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
            (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
            (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
index eee7e6c1de36397fb09c3fade70390a7c453365d..f700ada879b57f2ea8883405bb6ae5d666300f0d 100644 (file)
@@ -1383,7 +1383,10 @@ handle_enum:
                        goto handle_enum;
                } else {
                        int size;
-                       size = mono_class_value_size (type->data.klass, NULL);
+                       if (type->type == MONO_TYPE_GENERICINST)
+                               size = mono_class_value_size (type->data.generic_class->container_class, NULL);
+                       else
+                               size = mono_class_value_size (type->data.klass, NULL);
                        if (value == NULL)
                                memset (dest, 0, size);
                        else
index 70a28aaf528ea71f3cc342af534507a606506d67..5f5d06930be1de80270bb365cdb918431c8585b3 100644 (file)
@@ -770,7 +770,7 @@ encode_locals (MonoDynamicImage *assembly, MonoReflectionILGen *ilgen)
        char *b = blob_size;
        int i;
 
-       size = 10 + nl * 30;
+       size = 50 + nl * 30;
        p = buf = g_malloc (size);
        table = &assembly->tables [MONO_TABLE_STANDALONESIG];
        idx = table->next_idx ++;
@@ -5766,14 +5766,13 @@ get_default_param_value_blobs (MonoMethod *method, char **blobs, guint32 *types)
        if (!methodsig->param_count)
                return;
 
-       if (klass->generic_class) {
-               return; /* FIXME - ??? */
-       }
-
        mono_class_init (klass);
 
        if (klass->image->dynamic) {
-               MonoReflectionMethodAux *aux = g_hash_table_lookup (((MonoDynamicImage*)method->klass->image)->method_aux_hash, method);
+               MonoReflectionMethodAux *aux;
+               if (method->is_inflated)
+                       method = ((MonoMethodInflated*)method)->declaring;
+               aux = g_hash_table_lookup (((MonoDynamicImage*)method->klass->image)->method_aux_hash, method);
                if (aux && aux->param_defaults) {
                        memcpy (blobs, &(aux->param_defaults [1]), methodsig->param_count * sizeof (char*));
                        memcpy (types, &(aux->param_default_types [1]), methodsig->param_count * sizeof (guint32));
@@ -6999,6 +6998,33 @@ mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo)
        return result;
 }
 
+MonoArray*
+mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_klass)
+{
+       MonoArray *result;
+       MonoObject *attr;
+       MonoClass *klass;
+       int i, n;
+
+       n = 0;
+       for (i = 0; i < cinfo->num_attrs; ++i) {
+               if (mono_class_has_parent (cinfo->attrs [i].ctor->klass, attr_klass))
+                       n ++;
+       }
+
+       klass = mono_class_from_name (mono_defaults.corlib, "System", "Attribute");
+       result = mono_array_new (mono_domain_get (), klass, n);
+       n = 0;
+       for (i = 0; i < cinfo->num_attrs; ++i) {
+               if (mono_class_has_parent (cinfo->attrs [i].ctor->klass, attr_klass)) {
+                       attr = create_custom_attr (cinfo->image, cinfo->attrs [i].ctor, cinfo->attrs [i].data, cinfo->attrs [i].data_size);
+                       mono_array_set (result, gpointer, n, attr);
+                       n ++;
+               }
+       }
+       return result;
+}
+
 MonoArray*
 mono_custom_attrs_data_construct (MonoCustomAttrInfo *cinfo)
 {
@@ -7317,21 +7343,25 @@ mono_reflection_get_custom_attrs_info (MonoObject *obj)
 }
 
 /*
- * mono_reflection_get_custom_attrs:
+ * mono_reflection_get_custom_attrs_by_type:
  * @obj: a reflection object handle
  *
  * Return an array with all the custom attributes defined of the
- * reflection handle @obj. The objects are fully build.
+ * reflection handle @obj. If @attr_klass is non-NULL, only custom attributes 
+ * of that type are returned. The objects are fully build.
  */
 MonoArray*
-mono_reflection_get_custom_attrs (MonoObject *obj)
+mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass)
 {
        MonoArray *result;
        MonoCustomAttrInfo *cinfo;
 
        cinfo = mono_reflection_get_custom_attrs_info (obj);
        if (cinfo) {
-               result = mono_custom_attrs_construct (cinfo);
+               if (attr_klass)
+                       result = mono_custom_attrs_construct_by_type (cinfo, attr_klass);
+               else
+                       result = mono_custom_attrs_construct (cinfo);
                if (!cinfo->cached)
                        mono_custom_attrs_free (cinfo);
        } else {
@@ -7343,6 +7373,19 @@ mono_reflection_get_custom_attrs (MonoObject *obj)
        return result;
 }
 
+/*
+ * mono_reflection_get_custom_attrs:
+ * @obj: a reflection object handle
+ *
+ * Return an array with all the custom attributes defined of the
+ * reflection handle @obj. The objects are fully build.
+ */
+MonoArray*
+mono_reflection_get_custom_attrs (MonoObject *obj)
+{
+       return mono_reflection_get_custom_attrs_by_type (obj, NULL);
+}
+
 /*
  * mono_reflection_get_custom_attrs_data:
  * @obj: a reflection obj handle
@@ -8687,6 +8730,10 @@ dup_type (const MonoType *original)
        r->byref = original->byref;
        if (original->type == MONO_TYPE_PTR)
                r->data.type = dup_type (original->data.type);
+       else if (original->type == MONO_TYPE_ARRAY)
+               r->data.array = mono_dup_array_type (original->data.array);
+       else if (original->type == MONO_TYPE_FNPTR)
+               r->data.method = mono_metadata_signature_deep_dup (original->data.method);
        mono_stats.generics_metadata_size += sizeof (MonoType);
        return r;
 }
@@ -9330,7 +9377,7 @@ mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig)
 
        MONO_ARCH_SAVE_REGS;
 
-       p = buf = g_malloc (size = 10 + na * 10);
+       p = buf = g_malloc (size = 50 + na * 50);
 
        mono_metadata_encode_value (0x07, p, &p);
        mono_metadata_encode_value (na, p, &p);
@@ -9404,7 +9451,7 @@ mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod *mb)
                                               mono_array_get (mb->refs, MonoObject*, i), &handle_class);
                if (!ref) {
                        g_free (rmb.refs);
-                       mono_raise_exception (mono_get_exception_type_load (NULL));
+                       mono_raise_exception (mono_get_exception_type_load (NULL, NULL));
                        return;
                }
                rmb.refs [i] = ref;
index cf5ee0c428119300f96333e95d8a6320222e7a2b..cf942d6599b60a7f06900278457be630778320ad 100644 (file)
@@ -67,11 +67,13 @@ MonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoM
 MonoObject* mono_get_dbnull_object (MonoDomain *domain);
 
 MonoArray*  mono_reflection_get_custom_attrs (MonoObject *obj);
+MonoArray*  mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass);
 MonoArray*  mono_reflection_get_custom_attrs_data (MonoObject *obj);
 MonoArray*  mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);
 
 MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj);
 MonoArray*  mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo);
+MonoArray*  mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_klass);
 MonoArray*  mono_custom_attrs_data_construct (MonoCustomAttrInfo *cinfo);
 MonoCustomAttrInfo* mono_custom_attrs_from_index    (MonoImage *image, guint32 idx);
 MonoCustomAttrInfo* mono_custom_attrs_from_method   (MonoMethod *method);
index 9b76c939a70a8befa8d61e3202722fdb150f87bb..a2382ac49dfe76ad84a9cf20400472ec88292dfe 100644 (file)
@@ -47,7 +47,7 @@ mono_security_manager_get_methods (void)
        g_assert (secman.demandunmanaged);
 
        secman.inheritancedemand = mono_class_get_method_from_name (secman.securitymanager,
-               "InheritanceDemand", 2);        
+               "InheritanceDemand", 3);        
        g_assert (secman.inheritancedemand);
 
        secman.inheritsecurityexception = mono_class_get_method_from_name (secman.securitymanager,
@@ -89,10 +89,11 @@ mono_secman_inheritance_check (MonoClass *klass, MonoDeclSecurityActions *demand
        MonoAssembly *assembly = mono_image_get_assembly (klass->image);
        MonoReflectionAssembly *refass = mono_assembly_get_object (domain, assembly);
        MonoObject *res;
-       gpointer args [2];
+       gpointer args [3];
 
-       args [0] = refass;
-       args [1] = demands;
+       args [0] = domain->domain;
+       args [1] = refass;
+       args [2] = demands;
 
        res = mono_runtime_invoke (secman->inheritancedemand, NULL, args, NULL);
        return (*(MonoBoolean *) mono_object_unbox (res));
index 0973f5049ab87cf51bfffbe09e576e1e8e99c199..c2e32acf6892e1bd668db27ee08a26dc16dcaf8d 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "object.h"
 #include "metadata-internals.h"
+#include "domain-internals.h"
 #include "tokentype.h"
 #include "threads.h"
 #include "marshal.h"
index c43c658516452f90700dc26c4f4a8d0d80141a68..d77878b4e3ce38c9ba0fb19b1b05583c467cedc9 100644 (file)
@@ -106,5 +106,6 @@ void ves_icall_System_Threading_Thread_VolatileWrite4 (void *ptr, gint32);
 void ves_icall_System_Threading_Thread_VolatileWrite8 (void *ptr, gint64);
 void ves_icall_System_Threading_Thread_VolatileWriteIntPtr (void *ptr, void *);
 
+void ves_icall_System_Threading_Thread_MemoryBarrier (void);
 
 #endif /* _MONO_METADATA_THREADS_TYPES_H_ */
index 256b96ce470d86f7aa4130a15c66dc0b5844f767..48384353a5801064db99eafdb8289ddbf2d2faf7 100644 (file)
@@ -471,7 +471,6 @@ HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this,
 {
        guint32 (*start_func)(void *);
        struct StartInfo *start_info;
-       MonoMethod *im;
        HANDLE thread;
        gsize tid;
        
@@ -1301,6 +1300,13 @@ ves_icall_System_Threading_Interlocked_Read_Long (gint64 *location)
 #endif
 }
 
+void
+ves_icall_System_Threading_Thread_MemoryBarrier (void)
+{
+       /* Should be implemented as a JIT intrinsic */
+       mono_raise_exception (mono_get_exception_not_implemented (NULL));
+}
+
 void
 ves_icall_System_Threading_Thread_ClrState (MonoThread* this, guint32 state)
 {
index 86f063c22776c05a007149253538e24028b0856c..3d76dadbf5a01345161b7e1e4631ba6512634c0f 100644 (file)
@@ -1,3 +1,168 @@
+2005-09-16  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini-ia64.h: Make register masks 64 bit. Don't treat argument
+       registers as global registers.
+
+       * inssel-ia64.brg (stmt): Remove OP_OUTARG_REG () rules which are no 
+       longer needed with the new register allocator.
+
+       * mini-ia64.c: Use OP_MOVE instead of OP_SETREG for reg-reg moves.
+
+       * cpu-ia64.md: Remove unused opcodes.
+       
+       * regalloc.c mini-codegen.c: Make register masks 64 bit on ia64.
+       
+2005-09-16  Zoltan Varga  <vargaz@freemail.hu>
+
+       * cpu-amd64.md: Remove unused opcodes.
+
+       * inssel-amd64.brg: Remove OP_OUTARG_REG () rules which are no longer
+       needed with the new register allocator.
+
+       * inssel-amd64.brg mini-amd64.c: Use OP_MOVE instead of OP_SETREG for
+       reg-reg moves.
+
+2005-09-16  Raja R Harinath  <rharinath@novell.com>
+
+       * Makefile.am (check-local): Don't invoke semdel-wrapper.
+
+2005-09-16  Martin Baulig  <martin@ximian.com>
+
+       * exceptions-amd64.c
+       (throw_exception): Don't call mono_debugger_throw_exception() if
+       we're a rethrow - see the FIXME in the code.
+
+2005-09-15  Geoff Norton  <gnorton@customerdna.com>
+
+       * mini.c (mono_init_exceptions): This only works on some architectures.
+       
+2005-09-15  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini.c (mono_method_to_ir): Add OP_LMUL imm -> OP_LMUL_IMM conversion
+       on ia64.
+
+       * inssel-long.brg mini-ia64.c: Add OP_LMUL_IMM rules.
+
+       * mini-ia64.h mini-ia64.c: Remove the altstack support code which is
+       now in mini-exceptions.c.
+
+2005-09-15  Zoltan Varga  <vargaz@freemail.hu>
+
+       * mini-amd64.h mini-am64.c: Remove the altstack support code which is
+       now in mini-exceptions.c.
+
+2005-09-15  Zoltan Varga  <vargaz@gmail.com>
+
+       * exceptions-x86.c: Applied patch from Patrik Torstensson 
+       <patrik.torstensson@gmail.com>. Add stack overflow handling support for win32.
+
+       * mini-exceptions.c mini-x86.c mini.c: Move the altstack setup/teardown
+       code into mini-exceptions.c. Add some assertions to it.
+
+2005-09-12  Zoltan Varga  <vargaz@gmail.com>
+
+       * aot.c (emit_section_change): Applied patch from "The Software Team" 
+       (<software@solmersa.com>). Fix as errors on windows.
+
+2005-09-11  Zoltan Varga  <vargaz@freemail.hu>
+
+       * tramp-amd64.c (mono_arch_create_trampoline_code): Fix saving of
+       method info into the LMF.
+
+2005-09-11  Zoltan Varga  <vargaz@gmail.com>
+       
+       * mini-ia64.c: Add proper unwind info for method epilogs.
+
+       * exceptions-ia64.c: Add some code to help debugging.
+       
+       * mini-ia64.c mini-ia64.h: Add sigaltstack support.
+
+       * mini-exceptions.c: Fix warning.
+
+2005-09-11  Zoltan Varga  <vargaz@freemail.hu>
+
+       * mini.c: Really fix build.
+
+       * mini-x86.c mini-amd64.c: Fix build.
+
+2005-09-11  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini-ia64.c inssel-ia64.brg: Add InterlockedExchange instrinsics.
+
+       * mini-ops.h cpu-ia64.md inssel-ia64.brg mini-ia64.c: Implement
+       some Interlocked methods as intrinsics.
+
+       * mini.c (mini_get_inst_for_method): Call arch_get_inst_for_method
+       for Thread methods as well.
+
+       * mini-ops.h: Add OP_MEMORY_BARRIER opcode.
+
+       * inssel.brg: Add rule for OP_MEMORY_BARRIER.
+
+       * mini-ia64.c mini-x86.c mini-amd64.c 
+       cpu-ia64.md cpu-pentium.md cpu-amd64.md: Add implementation of 
+       OP_MEMORY_BARRIER.
+       
+       * mini.c (mono_init_exceptions): Fix build breakage.
+
+2005-09-10  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini-ia64.c exceptions-ia64.c tramp-ia64.c: Remove 'manual' emitting
+       of instructions. Use the new ia64_unw_op macros for emitting unwind
+       info.
+
+       * mini.c (mono_init_exceptions): Initialize exception handling
+       related trampolines at startup.
+
+Fri Sep 9 19:30:37 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * cpu-arm.md, mini-arm.c: fix for dynamic code (Gtk# apps).
+
+2005-09-09  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini.c: Handle type loading errors gracefully during compilation and
+       throw the appropriate exception.
+
+Fri Sep 9 09:49:14 CEST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * ldscript.mono, Makefile.am: use anonymous versions in the ldscript
+       for the mono binary.
+
+2005-09-09  Martin Baulig  <martin@ximian.com>
+
+       * mini.c (mono_method_to_ir): Comment out the G_BREAKPOINT()'s for
+       the release.
+
+Thu Sep 8 14:53:45 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * mini-arm.h: use emulation for conv.r.un for the release.
+
+Thu Sep 8 11:28:45 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * mini-arm.c, objects.cs: more fixes and tests for them.
+
+Wed Sep 7 17:14:26 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * mini-arm.c: align structures to at least 4 bytes to be able
+       to keep our current optimized memcpy.
+
+Tue Sep 6 22:51:08 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * mini-arm.c, cpu-arm.md, inssel-arm.brg: bugfixes.
+
+2005-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * mini.c: ignore SIGPIPE.
+
+2005-09-04  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini-ia64.c (mono_arch_lowering_pass): Convert 'and_imm 255' to zext1.
+
+       * mini-ia64.h mini-ia64.c: Add some minor optimizations.
+
+2005-09-02  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini.h: Add prototype for mono_allocate_stack_slots_full.
 
 Thu Sep 1 21:05:26 BST 2005 Paolo Molaro <lupus@ximian.com>
 
index 15c9c66b1dde64ed1ab9b7378f4839a1efa69c2e..ad0be3f8805171f43a38f6547c7d9ff9d1672fc6 100644 (file)
@@ -53,8 +53,10 @@ genmdesc_CFLAGS = $(AM_CFLAGS)
 
 if NO_VERSION_SCRIPT
 monoldflags=
+monobinldflags=
 else
 monoldflags=-Wl,-version-script=$(srcdir)/ldscript
+monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono
 endif
 
 if PLATFORM_WIN32
@@ -91,7 +93,7 @@ mono_LDADD = \
        $(ICU_LIBS)
 
 mono_LDFLAGS = \
-       $(static_flags) -export-dynamic $(monoldflags)
+       $(static_flags) -export-dynamic $(monobinldflags)
 
 genmdesc_SOURCES = \
        mini.h          \
@@ -368,9 +370,7 @@ stat3: mono bench.exe
 docu: mini.sgm
        docbook2txt mini.sgm
 
-check-local:
-       ok=:; $(MAKE) rcheck || ok=false; \
-       $(top_builddir)/runtime/semdel-wrapper || :; $$ok
+check-local: rcheck
 
 clean-local:
        rm -f mono a.out gmon.out *.o test.exe
@@ -382,7 +382,7 @@ BUILT_SOURCES= inssel.c inssel.h $(arch_built)
 endif
 
 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
-EXTRA_DIST = $(common_BURGSRC) jit-icalls.c cprop.c TestDriver.cs ldscript $(test_sources) \
+EXTRA_DIST = $(common_BURGSRC) jit-icalls.c cprop.c TestDriver.cs ldscript ldscript.mono $(test_sources) \
        inssel-long.brg inssel-long32.brg \
        $(x86_sources) inssel-x86.brg cpu-pentium.md \
        $(amd64_sources) inssel-amd64.brg cpu-amd64.md \
index c35d5b30b9ac166eee2e58b52e868498f2a0aef4..6ebe7b65b6230fabd153bbbceb32450970454606 100644 (file)
@@ -1484,7 +1484,7 @@ mono_aot_is_got_entry (guint8 *code, guint8 *addr)
 static void
 emit_section_change (FILE *fp, const char *section_name, int subsection_index)
 {
-#if defined(sparc)
+#if defined(sparc) || defined(PLATFORM_WIN32)
        /* For solaris as, GNU as should accept the same */
        fprintf (fp, ".section \"%s\"\n", section_name);
 #elif defined(__ppc__) && defined(__MACH__)
index 9daceebf8d8c086b50c35ea8e14bedd8a7c5b752..a108f835f1c09d8395086461f94fc1233dc447d2 100644 (file)
@@ -11,7 +11,6 @@
 # src1:register       describes the first source register of an instruction
 # src2:register       describes the second source register of an instruction
 #
-# register may have the following values:
 #      i  integer register
 #      b  base register (used in address references)
 #      f  floating point register
@@ -32,7 +31,6 @@
 #
 # clob:spec          describe if the instruction clobbers registers or has special needs
 #
-# spec can be one of the following characters:
 #      c  clobbers caller-save registers
 #      1  clobbers the first source register
 #      a  EAX is clobbered
@@ -42,7 +40,6 @@
 #
 # flags:spec        describe if the instruction uses or sets the flags (unused)
 #
-# spec can be one of the following chars:
 #      s  sets the flags
 #       u  uses the flags
 #       m  uses and modifies the flags
 #
 # See the code in mini-x86.c for more details on how the specifiers are used.
 #
-nop:
 break: len:2
 jmp: len:42
-br.s:
-brfalse.s:
-brtrue.s:
 br: len:6
-brfalse:
-brtrue:
 beq: len:8
 bge: len:8
 bgt: len:8
@@ -75,23 +66,19 @@ bge.un: len:8
 bgt.un: len:8
 ble.un: len:8
 blt.un: len:8
-switch:
+label:
 ldind.i1: dest:i len:8
 ldind.u1: dest:i len:8
 ldind.i2: dest:i len:8
 ldind.u2: dest:i len:8
 ldind.i4: dest:i len:9
 ldind.u4: dest:i len:8
-ldind.i8:
 ldind.i: dest:i len:8
-ldind.r4:
-ldind.r8:
 ldind.ref: dest:i len:8
 stind.ref: src1:b src2:i
 stind.i1: src1:b src2:i
 stind.i2: src1:b src2:i
 stind.i4: src1:b src2:i
-stind.i8:
 stind.r4: dest:f src1:b
 stind.r8: dest:f src1:b
 add: dest:i src1:i src2:i len:3 clob:1
@@ -117,141 +104,35 @@ conv.r4: dest:f src1:i len:9
 conv.r8: dest:f src1:i len:9
 conv.u4: dest:i src1:i len:3
 conv.u8: dest:i src1:i len:3
-callvirt:
-cpobj:
-ldobj:
-ldstr:
-castclass:
-isinst:
 conv.r.un: dest:f src1:i len:8
-unbox:
 throw: src1:i len:18
 op_rethrow: src1:i len:18
-ldfld:
-ldflda:
-stfld:
-ldsfld:
-ldsflda:
-stsfld:
-stobj:
-conv.ovf.i1.un:
-conv.ovf.i2.un:
 conv.ovf.i4.un: dest:i src1:i len:16
-conv.ovf.i8.un:
-conv.ovf.u1.un:
-conv.ovf.u2.un:
 conv.ovf.u4.un: 
-conv.ovf.u8.un:
-conv.ovf.i.un:
-conv.ovf.u.un:
-box:
-newarr:
-ldlen:
-ldelema:
-ldelem.i1:
-ldelem.u1:
-ldelem.i2:
-ldelem.u2:
-ldelem.i4:
-ldelem.u4:
-ldelem.i8:
-ldelem.i:
-ldelem.r4:
-ldelem.r8:
-ldelem.ref:
-stelem.i:
-stelem.i1:
-stelem.i2:
-stelem.i4:
-stelem.i8:
-stelem.r4:
-stelem.r8:
-stelem.ref:
-conv.ovf.i1:
-conv.ovf.u1:
-conv.ovf.i2:
-conv.ovf.u2:
-conv.ovf.i4:
 conv.ovf.u4: dest:i src1:i len:15
-conv.ovf.i8:
-conv.ovf.u8:
-refanyval:
 ckfinite: dest:f src1:f len:43
-mkrefany:
-ldtoken:
 conv.u2: dest:i src1:i len:4
 conv.u1: dest:i src1:i len:4
 conv.i: dest:i src1:i len:4
-conv.ovf.i:
-conv.ovf.u:
-add.ovf:
-add.ovf.un:
 mul.ovf: dest:i src1:i src2:i clob:1 len:10
 # this opcode is handled specially in the code generator
 mul.ovf.un: dest:i src1:i src2:i len:18
-sub.ovf:
-sub.ovf.un:
-endfinally:
-leave:
-leave.s:
-stind.i:
 conv.u: dest:i src1:i len:4
-prefix7:
-prefix6:
-prefix5:
-prefix4:
-prefix3:
-prefix2:
-prefix1:
-prefixref:
-arglist:
 ceq: dest:c len:8
 cgt: dest:c len:8
 cgt.un: dest:c len:8
 clt: dest:c len:8
 clt.un: dest:c len:8
-ldftn:
-ldvirtftn:
-ldarg:
-ldarga:
-starg:
-ldloc:
-ldloca:
-stloc:
 localloc: dest:i src1:i len:84
-endfilter:
-unaligned.:
-volatile.:
-tail.:
-initobj:
-cpblk:
-initblk:
-sizeof:
-refanytype:
-illegal:
-endmac:
-mono_objaddr:
-mono_ldptr:
-mono_vtaddr:
-mono_newobj:
-mono_retobj:
-load:
-ldaddr:
-store:
-phi:
-rename:
 compare: src1:i src2:i len:3
 lcompare: src1:i src2:i len:3
 icompare: src1:i src2:i len:3
 compare_imm: src1:i len:13
 icompare_imm: src1:i len:8
 fcompare: src1:f src2:f clob:a len:13
-local:
-arg:
 oparglist: src1:b len:11
 outarg: src1:i len:2
 outarg_imm: len:6
-retarg:
 setret: dest:a src1:i len:3
 setlret: dest:i src1:i src2:i len:5
 checkthis: src1:b len:5
@@ -271,15 +152,10 @@ vcall_reg: src1:i len:64 clob:c
 vcall_membase: src1:b len:64 clob:c
 call_reg: dest:a src1:i len:64 clob:c
 call_membase: dest:a src1:b len:64 clob:c
-trap:
 iconst: dest:i len:10
 i8const: dest:i len:18
 r4const: dest:f len:13
 r8const: dest:f len:9
-regvar:
-reg:
-regoffset:
-label:
 store_membase_imm: dest:b len:15
 store_membase_reg: dest:b src1:i len:9
 storei8_membase_reg: dest:b src1:i len:9
@@ -306,7 +182,6 @@ loadr8_spill_membase: src1:b len:9
 loadu4_mem: dest:i len:10
 amd64_loadi8_memindex: dest:i src1:i src2:i len:10
 move: dest:i src1:i len:4
-setreg: dest:i src1:i len:4
 add_imm: dest:i src1:i len:8 clob:1
 sub_imm: dest:i src1:i len:8 clob:1
 mul_imm: dest:i src1:i len:8
@@ -339,81 +214,24 @@ cond_exc_c: len:8
 cond_exc_nc: len:8
 cond_exc_iov: len:8
 cond_exc_ic: len:8
-long_add:
-long_sub:
 long_mul: dest:i src1:i src2:i clob:1 len:4
 long_mul_imm: dest:i src1:i src2:i clob:1 len:8
 long_div: dest:a src1:a src2:i len:16 clob:d
 long_div_un: dest:a src1:a src2:i len:16 clob:d
 long_rem: dest:d src1:a src2:i len:16 clob:a
 long_rem_un: dest:d src1:a src2:i len:16 clob:a
-long_and:
-long_or:
-long_xor:
 long_shl: dest:i src1:i src2:s clob:1 len:31
 long_shr: dest:i src1:i src2:s clob:1 len:32
 long_shr_un: dest:i src1:i src2:s clob:1 len:32
-long_neg:
-long_not:
-long_conv_to_i1:
-long_conv_to_i2:
-long_conv_to_i4:
-long_conv_to_i8:
 long_conv_to_r4: dest:f src1:i len:8
 long_conv_to_r8: dest:f src1:i len:8
-long_conv_to_u4:
-long_conv_to_u8:
-long_conv_to_u2:
-long_conv_to_u1:
-long_conv_to_i:
 long_conv_to_ovf_i: dest:i src1:i src2:i len:40
-long_conv_to_ovf_u:
-long_add_ovf:
-long_add_ovf_un:
 long_mul_ovf: dest:i src1:i src2:i clob:1 len:16
 long_mul_ovf_un: dest:i src1:i src2:i len:22
-long_sub_ovf:
-long_sub_ovf_un:
-long_conv_to_ovf_i1_un:
-long_conv_to_ovf_i2_un:
-long_conv_to_ovf_i4_un:
-long_conv_to_ovf_i8_un:
-long_conv_to_ovf_u1_un:
-long_conv_to_ovf_u2_un:
-long_conv_to_ovf_u4_un:
-long_conv_to_ovf_u8_un:
-long_conv_to_ovf_i_un:
-long_conv_to_ovf_u_un:
-long_conv_to_ovf_i1:
-long_conv_to_ovf_u1:
-long_conv_to_ovf_i2:
-long_conv_to_ovf_u2:
-long_conv_to_ovf_i4:
-long_conv_to_ovf_u4:
-long_conv_to_ovf_i8:
-long_conv_to_ovf_u8:
-long_ceq:
-long_cgt:
-long_cgt_un:
-long_clt:
-long_clt_un:
 long_conv_to_r_un: dest:f src1:i src2:i len:48 
-long_conv_to_u:
 long_shr_imm: dest:i src1:i clob:1 len:11
 long_shr_un_imm: dest:i src1:i clob:1 len:11
 long_shl_imm: dest:i src1:i clob:1 len:11
-long_add_imm:
-long_sub_imm:
-long_beq:
-long_bne_un:
-long_blt:
-long_blt_un:
-long_bgt:
-long_btg_un:
-long_bge:
-long_bge_un:
-long_ble:
-long_ble_un:
 float_beq: len:13
 float_bne_un: len:18
 float_blt: len:13
@@ -437,8 +255,6 @@ float_conv_to_i1: dest:i src1:f len:49
 float_conv_to_i2: dest:i src1:f len:49
 float_conv_to_i4: dest:i src1:f len:49
 float_conv_to_i8: dest:i src1:f len:49
-float_conv_to_r4:
-float_conv_to_r8:
 float_conv_to_u4: dest:i src1:f len:49
 float_conv_to_u8: dest:i src1:f len:49
 float_conv_to_u2: dest:i src1:f len:49
@@ -446,30 +262,7 @@ float_conv_to_u1: dest:i src1:f len:49
 float_conv_to_i: dest:i src1:f len:49
 float_conv_to_ovf_i: dest:a src1:f len:40
 float_conv_to_ovd_u: dest:a src1:f len:40
-float_add_ovf:
-float_add_ovf_un:
 float_mul_ovf: 
-float_mul_ovf_un:
-float_sub_ovf:
-float_sub_ovf_un:
-float_conv_to_ovf_i1_un:
-float_conv_to_ovf_i2_un:
-float_conv_to_ovf_i4_un:
-float_conv_to_ovf_i8_un:
-float_conv_to_ovf_u1_un:
-float_conv_to_ovf_u2_un:
-float_conv_to_ovf_u4_un:
-float_conv_to_ovf_u8_un:
-float_conv_to_ovf_i_un:
-float_conv_to_ovf_u_un:
-float_conv_to_ovf_i1:
-float_conv_to_ovf_u1:
-float_conv_to_ovf_i2:
-float_conv_to_ovf_u2:
-float_conv_to_ovf_i4:
-float_conv_to_ovf_u4:
-float_conv_to_ovf_i8:
-float_conv_to_ovf_u8:
 float_ceq: dest:i src1:f src2:f len:35
 float_cgt: dest:i src1:f src2:f len:35
 float_cgt_un: dest:i src1:f src2:f len:48
@@ -521,6 +314,7 @@ atomic_exchange_i4: src1:b src2:i dest:i len:32
 atomic_add_i8: src1:b src2:i dest:i len:32
 atomic_add_new_i8: src1:b src2:i dest:i len:32
 atomic_exchange_i8: src1:b src2:i dest:i len:32
+memory_barrier: len:16
 adc: dest:i src1:i src2:i len:3 clob:1
 addcc: dest:i src1:i src2:i len:3 clob:1
 subcc: dest:i src1:i src2:i len:3 clob:1
index c47b9cce8f2b899b20d16a4f3f1577eb1f22fa96..8cabd657439aa1e23458fbc35725b2a940b22b7d 100644 (file)
@@ -84,7 +84,7 @@ ldc.r8:
 dup:
 pop:
 jmp: len:92
-call: dest:a clob:c len:16
+call: dest:a clob:c len:20
 calli:
 ret:
 br.s:
@@ -162,7 +162,7 @@ ldstr:
 newobj:
 castclass:
 isinst:
-conv.r.un: dest:f src1:i len:48
+conv.r.un: dest:f src1:i len:56
 unbox:
 throw: src1:i len:20
 op_rethrow: src1:i len:20
@@ -234,7 +234,7 @@ add_ovf_carry: dest:i src1:i src2:i len:16
 sub_ovf_carry: dest:i src1:i src2:i len:16
 add_ovf_un_carry: dest:i src1:i src2:i len:16
 sub_ovf_un_carry: dest:i src1:i src2:i len:16
-start_handler: len:12
+start_handler: len:20
 endfinally: len:20
 leave:
 leave.s:
@@ -301,16 +301,16 @@ setreg: dest:i src1:i len:4 clob:r
 setregimm: dest:i len:16 clob:r
 setfreg: dest:f src1:f len:4 clob:r
 checkthis: src1:b len:4
-voidcall: len:16 clob:c
+voidcall: len:20 clob:c
 voidcall_reg: src1:i len:8 clob:c
 voidcall_membase: src1:b len:12 clob:c
-fcall: dest:f len:16 clob:c
+fcall: dest:f len:20 clob:c
 fcall_reg: dest:f src1:i len:8 clob:c
 fcall_membase: dest:f src1:b len:12 clob:c
-lcall: dest:l len:16 clob:c
+lcall: dest:l len:20 clob:c
 lcall_reg: dest:l src1:i len:8 clob:c
 lcall_membase: dest:l src1:b len:12 clob:c
-vcall: len:16 clob:c
+vcall: len:20 clob:c
 vcall_reg: src1:i len:8 clob:c
 vcall_membase: src1:b len:12 clob:c
 call_reg: dest:a src1:i len:8 clob:c
@@ -325,13 +325,13 @@ reg:
 regoffset:
 label:
 store_membase_imm: dest:b len:20
-store_membase_reg: dest:b src1:i len:12
+store_membase_reg: dest:b src1:i len:20
 storei1_membase_imm: dest:b len:20
 storei1_membase_reg: dest:b src1:i len:12
 storei2_membase_imm: dest:b len:20
 storei2_membase_reg: dest:b src1:i len:12
 storei4_membase_imm: dest:b len:20
-storei4_membase_reg: dest:b src1:i len:12
+storei4_membase_reg: dest:b src1:i len:20
 storei8_membase_imm: dest:b 
 storei8_membase_reg: dest:b src1:i 
 storer4_membase_reg: dest:b src1:f len:12
@@ -340,7 +340,7 @@ store_memindex: dest:b src1:i src2:i len:4
 storei1_memindex: dest:b src1:i src2:i len:4
 storei2_memindex: dest:b src1:i src2:i len:4
 storei4_memindex: dest:b src1:i src2:i len:4
-load_membase: dest:i src1:b len:12
+load_membase: dest:i src1:b len:20
 loadi1_membase: dest:i src1:b len:4
 loadu1_membase: dest:i src1:b len:4
 loadi2_membase: dest:i src1:b len:4
index 33910a535fffcea46198926e714d7d63bb46aea7..0c7871ba5db0ab32c491ccc8faacf49286977e25 100644 (file)
@@ -4,15 +4,9 @@
 # since there are no short branches.
 #
 
-nop:
 break: len:48
 jmp: len:48
-br.s:
-brfalse.s:
-brtrue.s:
 br: len:48
-brfalse:
-brtrue:
 beq: len:48
 bge: len:48
 bgt: len:48
@@ -23,7 +17,7 @@ bge.un: len:48
 bgt.un: len:48
 ble.un: len:48
 blt.un: len:48
-switch:
+label:
 add: dest:i src1:i src2:i len:48
 sub: dest:i src1:i src2:i len:48
 mul: dest:i src1:i src2:i len:48
@@ -47,139 +41,35 @@ conv.r4: dest:f src1:i len:112
 conv.r8: dest:f src1:i len:112
 conv.u4: dest:i src1:i len:112
 conv.u8: dest:i src1:i len:112
-callvirt:
-cpobj:
-ldobj:
-ldstr:
-castclass:
-isinst:
 conv.r.un: dest:f src1:i len:48
-unbox:
 throw: src1:i len:96
 op_rethrow: src1:i len:48
-ldfld:
-ldflda:
-stfld:
-ldsfld:
-ldsflda:
-stsfld:
-stobj:
-conv.ovf.i1.un:
-conv.ovf.i2.un:
 conv.ovf.i4.un: dest:i src1:i len:96
-conv.ovf.i8.un:
-conv.ovf.u1.un:
-conv.ovf.u2.un:
 conv.ovf.u4.un: 
-conv.ovf.u8.un:
-conv.ovf.i.un:
-conv.ovf.u.un:
-box:
-newarr:
-ldlen:
-ldelema:
-ldelem.i1:
-ldelem.u1:
-ldelem.i2:
-ldelem.u2:
-ldelem.i4:
-ldelem.u4:
-ldelem.i8:
-ldelem.i:
-ldelem.r4:
-ldelem.r8:
-ldelem.ref:
-stelem.i:
-stelem.i1:
-stelem.i2:
-stelem.i4:
-stelem.i8:
-stelem.r4:
-stelem.r8:
-stelem.ref:
-conv.ovf.i1:
-conv.ovf.u1:
-conv.ovf.i2:
-conv.ovf.u2:
-conv.ovf.i4:
 conv.ovf.u4: dest:i src1:i len:48
-conv.ovf.i8:
-conv.ovf.u8:
-refanyval:
 ckfinite: dest:f src1:f len:48
-mkrefany:
-ldtoken:
 conv.u2: dest:i src1:i len:48
 conv.u1: dest:i src1:i len:48
 conv.i: dest:i src1:i len:48
-conv.ovf.i:
-conv.ovf.u:
-add.ovf:
-add.ovf.un:
 mul.ovf: dest:i src1:i src2:i len:48
 # this opcode is handled specially in the code generator
 mul.ovf.un: dest:i src1:i src2:i len:48
-sub.ovf:
-sub.ovf.un:
-leave:
-leave.s:
-stind.i:
 conv.u: dest:i src1:i len:48
-prefix7:
-prefix6:
-prefix5:
-prefix4:
-prefix3:
-prefix2:
-prefix1:
-prefixref:
-arglist:
 ceq: dest:c len:48
 cgt: dest:c len:48
 cgt.un: dest:c len:48
 clt: dest:c len:48
 clt.un: dest:c len:48
-ldftn:
-ldvirtftn:
-ldarg:
-ldarga:
-starg:
-ldloc:
-ldloca:
-stloc:
 localloc: dest:i src1:i len:92
-unaligned.:
-volatile.:
-tail.:
-initobj:
-cpblk:
-initblk:
-sizeof:
-refanytype:
-illegal:
-endmac:
-mono_objaddr:
-mono_ldptr:
-mono_vtaddr:
-mono_newobj:
-mono_retobj:
-load:
-ldaddr:
-store:
-phi:
-rename:
 compare: src1:i src2:i len:48
 lcompare: src1:i src2:i len:48
 icompare: src1:i src2:i len:48
 compare_imm: src1:i len:48
 icompare_imm: src1:i len:48
 fcompare: src1:f src2:f clob:a len:48
-local:
-arg:
 oparglist: src1:b len:48
 outarg: src1:i len:48
 outarg_imm: len:48
-retarg:
 setret: dest:r src1:i len:48
 setlret: dest:r src1:i src2:i len:48
 checkthis: src1:b len:48
@@ -202,7 +92,6 @@ iconst: dest:i len:48
 i8const: dest:i len:48
 r4const: dest:f len:48
 r8const: dest:f len:48
-label:
 store_membase_imm: dest:b len:48
 store_membase_reg: dest:b src1:i len:48
 storei8_membase_reg: dest:b src1:i len:48
@@ -228,7 +117,6 @@ loadr8_membase: dest:f src1:b len:48
 loadr8_spill_membase: src1:b len:48
 loadu4_mem: dest:i len:48
 move: dest:i src1:i len:48
-setreg: dest:i src1:i len:48
 add_imm: dest:i src1:i len:48
 sub_imm: dest:i src1:i len:48
 mul_imm: dest:i src1:i len:48
@@ -275,26 +163,10 @@ long_conv_to_r8: dest:f src1:i len:48
 long_conv_to_ovf_i: dest:i src1:i src2:i len:48
 long_mul_ovf: dest:i src1:i src2:i len:48
 long_mul_ovf_un: dest:i src1:i src2:i len:48
-long_ceq:
-long_cgt:
-long_cgt_un:
-long_clt:
-long_clt_un:
 long_conv_to_r_un: dest:f src1:i src2:i len:48 
-long_conv_to_u:
 long_shr_imm: dest:i src1:i len:48
 long_shr_un_imm: dest:i src1:i len:48
 long_shl_imm: dest:i src1:i len:48
-long_beq:
-long_bne_un:
-long_blt:
-long_blt_un:
-long_bgt:
-long_btg_un:
-long_bge:
-long_bge_un:
-long_ble:
-long_ble_un:
 float_beq: len:48
 float_bne_un: len:48
 float_blt: len:48
@@ -327,30 +199,7 @@ float_conv_to_u1: dest:i src1:f len:112
 float_conv_to_i: dest:i src1:f len:112
 float_conv_to_ovf_i: dest:a src1:f len:112
 float_conv_to_ovd_u: dest:a src1:f len:112
-float_add_ovf:
-float_add_ovf_un:
 float_mul_ovf: 
-float_mul_ovf_un:
-float_sub_ovf:
-float_sub_ovf_un:
-float_conv_to_ovf_i1_un:
-float_conv_to_ovf_i2_un:
-float_conv_to_ovf_i4_un:
-float_conv_to_ovf_i8_un:
-float_conv_to_ovf_u1_un:
-float_conv_to_ovf_u2_un:
-float_conv_to_ovf_u4_un:
-float_conv_to_ovf_u8_un:
-float_conv_to_ovf_i_un:
-float_conv_to_ovf_u_un:
-float_conv_to_ovf_i1:
-float_conv_to_ovf_u1:
-float_conv_to_ovf_i2:
-float_conv_to_ovf_u2:
-float_conv_to_ovf_i4:
-float_conv_to_ovf_u4:
-float_conv_to_ovf_i8:
-float_conv_to_ovf_u8:
 float_ceq: dest:i src1:f src2:f len:48
 float_cgt: dest:i src1:f src2:f len:48
 float_cgt_un: dest:i src1:f src2:f len:48
@@ -370,12 +219,15 @@ endfinally: len:96
 endfilter: len:96
 aot_const: dest:i len:48
 tls_get: dest:i len:48
+ia64_fetchadd4_imm: dest:i src1:b len:48
+ia64_fetchadd8_imm: dest:i src1:b len:48
 atomic_add_i4: src1:b src2:i dest:i len:48
 atomic_add_new_i4: src1:b src2:i dest:i len:48
 atomic_exchange_i4: src1:b src2:i dest:i len:48
 atomic_add_i8: src1:b src2:i dest:i len:48
 atomic_add_new_i8: src1:b src2:i dest:i len:48
 atomic_exchange_i8: src1:b src2:i dest:i len:48
+memory_barrier: len:48
 adc: dest:i src1:i src2:i len:48
 addcc: dest:i src1:i src2:i len:48
 subcc: dest:i src1:i src2:i len:48
index e89c0d55faf8a6a4590acebd7b20e897d5b40a23..e80e89149edb2e46b6a18877c0c80ec834ff8275 100644 (file)
@@ -573,3 +573,5 @@ tls_get: dest:i len:20
 atomic_add_i4: src1:b src2:i dest:i len:16
 atomic_add_new_i4: src1:b src2:i dest:i len:16
 atomic_exchange_i4: src1:b src2:i dest:i len:24
+memory_barrier: len:16
+
index 947aaacf09ab6f570376784cdccc5c88f16398e9..6262536d81d3d7d5841f4ac26b31e630d49de1ee 100644 (file)
@@ -264,12 +264,23 @@ throw_exception (MonoObject *exc, guint64 rip, guint64 rsp,
        ctx.r14 = r14;
        ctx.r15 = r15;
 
-       if (mono_debugger_throw_exception ((gpointer)(rip - 8), (gpointer)rsp, exc)) {
+       if (!rethrow && mono_debugger_throw_exception ((gpointer)(rip - 8), (gpointer)rsp, exc)) {
                /*
                 * The debugger wants us to stop on the `throw' instruction.
                 * By the time we get here, it already inserted a breakpoint on
                 * eip - 8 (which is the address of the `mov %r15,%rdi ; callq throw').
                 */
+
+               /* FIXME FIXME
+                *
+                * In case of a rethrow, the JIT is emitting code like this:
+                *
+                *    mov    0xffffffffffffffd0(%rbp),%rax'
+                *    mov    %rax,%rdi
+                *    callq  throw
+                *
+                * Here, restore_context() wouldn't restore the %rax register correctly.
+                */
                ctx.rip = rip - 8;
                ctx.rsp = rsp + 8;
                restore_context (&ctx);
index 3d2db50505783a3810d6142288a0c5e5a6237c9c..326520187d26db10bed250e15c0eb5937fae9fb0 100644 (file)
 #define GP_SCRATCH_REG 31
 #define GP_SCRATCH_REG2 30
 
+static void
+print_ctx (MonoContext *ctx)
+{
+       char name[256];
+       unw_word_t off, ip, sp;
+       unw_proc_info_t pi;
+       int res;
+
+       unw_get_proc_name (&ctx->cursor, name, 256, &off);
+       unw_get_proc_info(&ctx->cursor, &pi);
+       res = unw_get_reg (&ctx->cursor, UNW_IA64_IP, &ip);
+       g_assert (res == 0);
+       res = unw_get_reg (&ctx->cursor, UNW_IA64_SP, &sp);
+       g_assert (res == 0);
+
+       printf ("%s:%lx [%lx-%lx] SP: %lx\n", name, ip - pi.start_ip, pi.start_ip, pi.end_ip, sp);
+}
+
 static gpointer
 ia64_create_ftnptr (gpointer ptr)
 {
@@ -56,6 +74,10 @@ static void
 restore_context (MonoContext *ctx)
 {
        int res;
+       unw_word_t ip;
+
+       res = unw_get_reg (&ctx->cursor, UNW_IA64_IP, &ip);
+       g_assert (res == 0);
 
        /* Set this to 0 to tell OP_START_HANDLER that it doesn't have to set the frame pointer */
        res = unw_set_reg (&ctx->cursor, UNW_IA64_GR + 15, 0);
@@ -78,15 +100,16 @@ mono_arch_get_restore_context (void)
 static gpointer
 get_real_call_filter (void)
 {
-       static guint8 *start;
-       static gboolean inited = FALSE;
+       static gpointer filter;
+       guint8 *start;
+       gboolean inited = FALSE;
        Ia64CodegenState code;
-       int i, in0, local0, out0, nout;
+       int in0, local0, out0, nout;
        unw_dyn_info_t *di;
-       unw_dyn_region_info_t *r_pro;
+       unw_dyn_region_info_t *r_pro, *r_body, *r_epilog;
 
        if (inited)
-               return start;
+               return filter;
 
        start = mono_global_codeman_reserve (1024);
 
@@ -115,18 +138,14 @@ get_real_call_filter (void)
 
        ia64_codegen_set_one_ins_per_bundle (code, TRUE);
 
+       ia64_unw_save_reg (code, UNW_IA64_AR_PFS, UNW_IA64_GR + local0 + 0);
        ia64_alloc (code, local0 + 0, local0 - in0, out0 - local0, nout, 0);
+       ia64_unw_save_reg (code, UNW_IA64_RP, UNW_IA64_GR + local0 + 1);
        ia64_mov_from_br (code, local0 + 1, IA64_B0);
 
-       r_pro = g_malloc0 (_U_dyn_region_info_size (2));
-       r_pro->op_count = 2;
-       r_pro->insn_count = 6;
-       i = 0;
-       _U_dyn_op_save_reg (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 2,
-                                               /* reg=*/ UNW_IA64_AR_PFS, /* dst=*/ UNW_IA64_GR + local0 + 0);
-       _U_dyn_op_save_reg (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 5,
-                                               /* reg=*/ UNW_IA64_RP, /* dst=*/ UNW_IA64_GR + local0 + 1);
-       g_assert ((unsigned) i <= r_pro->op_count);     
+       ia64_begin_bundle (code);
+
+       r_pro = mono_ia64_create_unwind_region (&code);
 
        /* Frame pointer */
        ia64_mov (code, IA64_R15, in0 + 0);
@@ -143,6 +162,8 @@ get_real_call_filter (void)
        /* R8 contains the result of the filter */
        /* R9 contains the saved apr_pfs value */
 
+       /* FIXME: Add unwind info for this */
+
        /* The filter returns using br_cond_reg, so have to do another return */
        ia64_mov_to_ar_i (code, IA64_PFS, IA64_R9);
        ia64_mov_from_ip (code, GP_SCRATCH_REG);        
@@ -150,10 +171,20 @@ get_real_call_filter (void)
        ia64_mov_to_br (code, IA64_B0, GP_SCRATCH_REG);
        ia64_br_ret_reg (code, IA64_B0);
 
+       ia64_begin_bundle (code);
+
+       r_body = mono_ia64_create_unwind_region (&code);
+       r_pro->next = r_body;
+
        ia64_mov_to_ar_i (code, IA64_PFS, local0 + 0);
        ia64_mov_ret_to_br (code, IA64_B0, local0 + 1);
        ia64_br_ret_reg (code, IA64_B0);
 
+       ia64_begin_bundle (code);
+
+       r_epilog = mono_ia64_create_unwind_region (&code);
+       r_body->next = r_epilog;
+
        ia64_codegen_set_one_ins_per_bundle (code, FALSE);
 
        ia64_codegen_close (code);
@@ -168,22 +199,24 @@ get_real_call_filter (void)
        di->gp = 0;
        di->format = UNW_INFO_FORMAT_DYNAMIC;
        di->u.pi.name_ptr = (unw_word_t)"throw_trampoline";
-       di->u.pi.regions = r_pro;
+       di->u.pi.regions = r_body;
 
        _U_dyn_register (di);
 
-       return ia64_create_ftnptr (start);
+    filter = ia64_create_ftnptr (start);
+
+       inited = TRUE;
+
+       return filter;
 }
 
 static int
 call_filter (MonoContext *ctx, gpointer ip)
 {
-       static int (*filter) (MonoContext *, gpointer) = NULL;
+       int (*filter) (MonoContext *, gpointer);
        gpointer fp = MONO_CONTEXT_GET_BP (ctx);
 
-       /* FIXME: thread safety */
-       if (!filter)
-               filter = get_real_call_filter ();
+       filter = get_real_call_filter ();
 
        return filter (fp, ip);
 }
@@ -198,6 +231,9 @@ call_filter (MonoContext *ctx, gpointer ip)
 gpointer
 mono_arch_get_call_filter (void)
 {
+       /* Initialize the real filter non-lazily */
+       get_real_call_filter ();
+
        return call_filter;
 }
 
@@ -207,7 +243,7 @@ throw_exception (MonoObject *exc, guint64 rethrow)
        unw_context_t unw_ctx;
        MonoContext ctx;
        MonoJitInfo *ji;
-       unw_word_t ip;
+       unw_word_t ip, sp;
        int res;
 
        if (mono_object_isinst (exc, mono_defaults.exception_class)) {
@@ -230,8 +266,13 @@ throw_exception (MonoObject *exc, guint64 rethrow)
                res = unw_get_reg (&ctx.cursor, UNW_IA64_IP, &ip);
                g_assert (res == 0);
 
+               res = unw_get_reg (&ctx.cursor, UNW_IA64_SP, &sp);
+               g_assert (res == 0);
+
                ji = mono_jit_info_table_find (mono_domain_get (), (gpointer)ip);
 
+               //printf ("UN: %s %lx %lx\n", ji ? ji->method->name : "", ip, sp);
+
                if (ji)
                        break;
 
@@ -534,9 +575,13 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInf
        }
 
        if (ji) {
+               //print_ctx (new_ctx);
+
                err = unw_step (&new_ctx->cursor);
                g_assert (err >= 0);
 
+               //print_ctx (new_ctx);
+
                return ji;
        }
        else
index c0699aa167917d7374296e600a9cb50a23838be3..5c5ccc29a2be580fafa352cb598c680f47365860 100644 (file)
@@ -30,6 +30,8 @@
 #endif 
 
 #ifdef PLATFORM_WIN32
+static void (*restore_stack) (void *);
+
 static MonoW32ExceptionHandler fpe_handler;
 static MonoW32ExceptionHandler ill_handler;
 static MonoW32ExceptionHandler segv_handler;
@@ -39,6 +41,122 @@ static LPTOP_LEVEL_EXCEPTION_FILTER old_handler;
 #define W32_SEH_HANDLE_EX(_ex) \
        if (_ex##_handler) _ex##_handler((int)sctx)
 
+/*
+ * mono_win32_get_handle_stackoverflow (void):
+ *
+ * Returns a pointer to a method which restores the current context stack
+ * and calls handle_exceptions, when done restores the original stack.
+ */
+static gpointer
+mono_win32_get_handle_stackoverflow (void)
+{
+       static guint8 *start = NULL;
+       guint8 *code;
+
+       if (start)
+               return start;
+
+       /* restore_contect (void *sigctx) */
+       start = code = mono_global_codeman_reserve (128);
+
+       /* load context into ebx */
+       x86_mov_reg_membase (code, X86_EBX, X86_ESP, 4, 4);
+
+       /* move current stack into edi for later restore */
+       x86_mov_reg_reg (code, X86_EDI, X86_ESP, 4);
+
+       /* use the new freed stack from sigcontext */
+       x86_mov_reg_membase (code, X86_ESP, X86_EBX,  G_STRUCT_OFFSET (struct sigcontext, esp), 4);
+
+       /* get the current domain */
+       x86_call_code (code, mono_domain_get);
+
+       /* get stack overflow exception from domain object */
+       x86_mov_reg_membase (code, X86_EAX, X86_EAX, G_STRUCT_OFFSET (MonoDomain, stack_overflow_ex), 4);
+
+       /* call mono_arch_handle_exception (sctx, stack_overflow_exception_obj, FALSE) */
+       x86_push_imm (code, 0);
+       x86_push_reg (code, X86_EAX);
+       x86_push_reg (code, X86_EBX);
+       x86_call_code (code, mono_arch_handle_exception);
+
+       /* restore the SEH handler stack */
+       x86_mov_reg_reg (code, X86_ESP, X86_EDI, 4);
+
+       /* return */
+       x86_ret (code);
+
+       return start;
+}
+
+/* Special hack to workaround the fact that the
+ * when the SEH handler is called the stack is
+ * to small to recover.
+ *
+ * Stack walking part of this method is from mono_handle_exception
+ *
+ * The idea is simple; 
+ *  - walk the stack to free some space (64k)
+ *  - set esp to new stack location
+ *  - call mono_arch_handle_exception with stack overflow exception
+ *  - set esp to SEH handlers stack
+ *  - done
+ */
+static void 
+win32_handle_stack_overflow (EXCEPTION_POINTERS* ep, struct sigcontext *sctx) 
+{
+    SYSTEM_INFO si;
+    DWORD page_size;
+       MonoDomain *domain = mono_domain_get ();
+       MonoJitInfo *ji, rji;
+       MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
+       MonoLMF *lmf = jit_tls->lmf;            
+       MonoContext initial_ctx;
+       MonoContext ctx;
+       guint32 free_stack = 0;
+
+       /* convert sigcontext to MonoContext (due to reuse of stack walking helpers */
+       mono_arch_sigctx_to_monoctx (sctx, &ctx);
+       
+       /* get our os page size */
+    GetSystemInfo(&si);
+       page_size = si.dwPageSize;
+
+       /* Let's walk the stack to recover
+        * the needed stack space (if possible)
+        */
+       memset (&rji, 0, sizeof (rji));
+
+       initial_ctx = ctx;
+       free_stack = (guint8*)(MONO_CONTEXT_GET_BP (&ctx)) - (guint8*)(MONO_CONTEXT_GET_BP (&initial_ctx));
+
+       /* try to free 64kb from our stack */
+       do {
+               MonoContext new_ctx;
+
+               ji = mono_arch_find_jit_info (domain, jit_tls, &rji, &rji, &ctx, &new_ctx, NULL, &lmf, NULL, NULL);
+               if (!ji) {
+                       g_warning ("Exception inside function without unwind info");
+                       g_assert_not_reached ();
+               }
+
+               if (ji != (gpointer)-1) {
+                       free_stack = (guint8*)(MONO_CONTEXT_GET_BP (&ctx)) - (guint8*)(MONO_CONTEXT_GET_BP (&initial_ctx));
+               }
+
+               /* todo: we should call abort if ji is -1 */
+               ctx = new_ctx;
+       } while (free_stack < 64 * 1024 && ji != (gpointer) -1);
+
+       /* convert into sigcontext to be used in mono_arch_handle_exception */
+       mono_arch_monoctx_to_sigctx (&ctx, sctx);
+
+       /* todo: install new stack-guard page */
+
+       /* use the new stack and call mono_arch_handle_exception () */
+       restore_stack (sctx);
+}
+
 /*
  * Unhandled Exception Filter
  * Top-level per-process exception handler.
@@ -68,6 +186,9 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep)
        sctx->eip = ctx->Eip;
 
        switch (er->ExceptionCode) {
+       case EXCEPTION_STACK_OVERFLOW:
+               win32_handle_stack_overflow (ep, sctx);
+               break;
        case EXCEPTION_ACCESS_VIOLATION:
                W32_SEH_HANDLE_EX(segv);
                break;
@@ -102,6 +223,10 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep)
 
 void win32_seh_init()
 {
+       /* install restore stack helper */
+       if (!restore_stack)
+               restore_stack = mono_win32_get_handle_stackoverflow ();
+
        old_handler = SetUnhandledExceptionFilter(seh_handler);
 }
 
index c47838e5e45e7397bc695067cc0a49013ef9baf3..64fc7dcd3acac6f046cc84cfe6adccbecbef204f 100644 (file)
@@ -204,7 +204,7 @@ stmt: OP_OUTARG (reg) {
 stmt: OP_OUTARG_REG (reg) {    
        MonoCallInst *call = (MonoCallInst*)tree->inst_right;
 
-       tree->opcode = OP_SETREG;
+       tree->opcode = OP_MOVE;
        tree->sreg1 = state->left->reg1;
        tree->dreg = mono_regstate_next_int (s->rs);
        mono_bblock_add_inst (s->cbb, tree);
@@ -212,53 +212,6 @@ stmt: OP_OUTARG_REG (reg) {
        mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
 }
 
-stmt: OP_OUTARG_REG (CEE_LDIND_I (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_REF (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I1 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U1 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I2 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U2 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I4 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U4 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I8 (base)) {
-       MonoCallInst *call = (MonoCallInst*)tree->inst_right;
-       guint32 dreg;
-       MonoInst *base = state->left->left->tree;
-
-       dreg = mono_regstate_next_int (s->rs);
-       MONO_EMIT_LOAD_MEMBASE_OP (s, tree, ldind_to_load_membase (state->left->tree->opcode),
-                                       dreg, base->inst_basereg, base->inst_offset);
-
-       mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
-}
-
-stmt: OP_OUTARG_REG (OP_I8CONST),
-stmt: OP_OUTARG_REG (OP_ICONST) {      
-       MonoCallInst *call = (MonoCallInst*)tree->inst_right;
-
-       tree->opcode = OP_ICONST;
-       tree->inst_c0 = state->left->tree->inst_c0;
-       tree->dreg = mono_regstate_next_int (s->rs);
-       mono_bblock_add_inst (s->cbb, tree);
-
-       mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
-}
-
-stmt: OP_OUTARG_REG (CEE_LDIND_I (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I8 (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I4 (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U4 (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_REF (OP_REGVAR)) {      
-       MonoCallInst *call = (MonoCallInst*)tree->inst_right;
-
-       tree->opcode = OP_SETREG;
-       tree->sreg1 = state->left->left->tree->dreg;
-       tree->dreg = mono_regstate_next_int (s->rs);
-       mono_bblock_add_inst (s->cbb, tree);
-
-       mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
-}
-
 # we need to reduce this code duplication with some burg syntax extension
 stmt: OP_OUTARG (CEE_LDIND_REF (OP_REGVAR)) {
        tree->opcode = OP_X86_PUSH;
index a17c46a124482c8f3999904b6c8e9934a6dbde3f..8f22fae267203fd4594fafb9dd37d6db98912240 100644 (file)
@@ -277,7 +277,7 @@ stmt: OP_OUTARG_VT (CEE_LDOBJ (base)) {
                tmpr = mono_regstate_next_int (s->rs);
                dreg = mono_regstate_next_int (s->rs);
                MONO_EMIT_NEW_LOAD_MEMBASE (s, tmpr, vt->inst_basereg, soffset);
-               MONO_EMIT_NEW_UNALU (s, OP_SETREG, start_reg + i, tmpr);
+               MONO_EMIT_NEW_UNALU (s, OP_SETREG, dreg, tmpr);
                mono_call_inst_add_outarg_reg (call, dreg, start_reg + i, FALSE);
                soffset += sizeof (gpointer);
        }
index 4ba649a2fa137552f80f548e657837d61f8f7b28..69fa21f81f2e5a61b8dc4ae269269a990e713017 100644 (file)
@@ -138,55 +138,6 @@ stmt: OP_OUTARG_REG (reg) {
        mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
 }
 
-stmt: OP_OUTARG_REG (CEE_LDIND_I (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_REF (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I1 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U1 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I2 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U2 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I4 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U4 (base)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I8 (base)) {
-       /* FIXME: Move this to inssel.brg or inssel-long.brg */
-       MonoCallInst *call = (MonoCallInst*)tree->inst_right;
-       guint32 dreg;
-       MonoInst *base = state->left->left->tree;
-
-       dreg = mono_regstate_next_int (s->rs);
-       MONO_EMIT_LOAD_MEMBASE_OP (s, tree, ldind_to_load_membase (state->left->tree->opcode),
-                                       dreg, base->inst_basereg, base->inst_offset);
-
-       mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
-}
-
-stmt: OP_OUTARG_REG (OP_I8CONST),
-stmt: OP_OUTARG_REG (OP_ICONST) {
-       /* FIXME: Move this to inssel.brg or inssel-long.brg */
-       MonoCallInst *call = (MonoCallInst*)tree->inst_right;
-
-       tree->opcode = OP_ICONST;
-       tree->inst_c0 = state->left->tree->inst_c0;
-       tree->dreg = mono_regstate_next_int (s->rs);
-       mono_bblock_add_inst (s->cbb, tree);
-
-       mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
-}
-
-stmt: OP_OUTARG_REG (CEE_LDIND_I (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I8 (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_I4 (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_U4 (OP_REGVAR)),
-stmt: OP_OUTARG_REG (CEE_LDIND_REF (OP_REGVAR)) {      
-       MonoCallInst *call = (MonoCallInst*)tree->inst_right;
-
-       tree->opcode = OP_MOVE;
-       tree->sreg1 = state->left->left->tree->dreg;
-       tree->dreg = mono_regstate_next_int (s->rs);
-       mono_bblock_add_inst (s->cbb, tree);
-
-       mono_call_inst_add_outarg_reg (call, tree->dreg, tree->unused, FALSE);
-}
-
 stmt: OP_OUTARG_FREG (freg) {
        MonoCallInst *call = (MonoCallInst*)tree->inst_right;
 
@@ -294,6 +245,28 @@ reg: CEE_LDIND_U4 (OP_REGVAR) "0" {
        tree->dreg = state->reg1;
 }
 
+reg: OP_ATOMIC_ADD_NEW_I4 (base, OP_ICONST),
+reg: OP_ATOMIC_ADD_NEW_I8 (base, OP_ICONST) {
+       tree->opcode = tree->opcode == OP_ATOMIC_ADD_NEW_I4 ? OP_IA64_FETCHADD4_IMM : OP_IA64_FETCHADD8_IMM;
+       tree->dreg = state->reg1;
+       tree->inst_imm = state->right->tree->inst_imm;
+       tree->inst_basereg = state->left->tree->inst_basereg; 
+       tree->inst_offset = state->left->tree->inst_offset; 
+    
+       mono_bblock_add_inst (s->cbb, tree);
+}
+
+reg: OP_ATOMIC_EXCHANGE_I4 (base, reg),
+reg: OP_ATOMIC_EXCHANGE_I8 (base, reg) {
+       tree->opcode = tree->opcode;
+       tree->dreg = state->reg1;
+       tree->sreg2 = state->right->reg1;
+       tree->inst_basereg = state->left->tree->inst_basereg; 
+       tree->inst_offset = state->left->tree->inst_offset; 
+    
+       mono_bblock_add_inst (s->cbb, tree);
+}
+
 # Optimized memset implementation
 stmt: OP_MEMSET (base) "0" {
        int dest_reg, dest_reg2, val_reg, unit, align;
index b9184835f25641963d75b141436fa31e11316f9d..9f774f8ac07130dd1e5b9d712c1844c939469b14 100644 (file)
@@ -664,6 +664,12 @@ reg: OP_IMUL_IMM (reg) {
        mono_bblock_add_inst (s->cbb, tree);
 }
 
+reg: OP_LMUL_IMM (reg) {
+       tree->sreg1 = state->left->reg1;
+       tree->dreg = state->reg1;
+       mono_bblock_add_inst (s->cbb, tree);
+}
+
 c32flags: OP_COMPARE (reg, reg) {
        tree->opcode = OP_ICOMPARE;
        tree->sreg1 = state->left->reg1;
index 9aff26163d02990441a23fba6eafaded58109eac..ab1ac2a9514e127d07710878501147e0107d37e9 100644 (file)
@@ -408,6 +408,10 @@ stmt: OP_DUMMY_STORE {
 stmt: OP_NOT_REACHED {
 }
 
+stmt: OP_MEMORY_BARRIER {
+       mono_bblock_add_inst (s->cbb, tree);
+}
+
 #
 # load/store operations
 #
diff --git a/mono/mini/ldscript.mono b/mono/mini/ldscript.mono
new file mode 100644 (file)
index 0000000..fce0f85
--- /dev/null
@@ -0,0 +1,10 @@
+{
+      global: 
+              mono_*;
+              GC_push_all_stack;
+              GC_start_blocking;
+              GC_end_blocking;
+              gc_thread_vtable;
+      local:
+              *;
+};
index 0a1d80ff7c1d0a4a95b7d369d5cf4064173f5e69..1fc3db7e8f27fab3953cbb55d285d51908d07560 100644 (file)
@@ -13,8 +13,6 @@
 #include "mini.h"
 #include <string.h>
 #include <math.h>
-#include <unistd.h>
-#include <sys/mman.h>
 
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/debug-helpers.h>
@@ -47,8 +45,6 @@ static const char*const * ins_spec = amd64_desc;
 #define CALLCONV_IS_STDCALL(call_conv) ((call_conv) == MONO_CALL_STDCALL)
 #endif
 
-#define SIGNAL_STACK_SIZE (64 * 1024)
-
 #define ARGS_OFFSET 16
 #define GP_SCRATCH_REG AMD64_R11
 
@@ -1335,7 +1331,7 @@ emit_call (MonoCompile *cfg, guint8 *code, guint32 patch_type, gconstpointer dat
 }
 
 /* FIXME: Add more instructions */
-#define INST_IGNORES_CFLAGS(ins) (((ins)->opcode == CEE_BR) || ((ins)->opcode == OP_STORE_MEMBASE_IMM) || ((ins)->opcode == OP_STOREI8_MEMBASE_REG) || ((ins)->opcode == OP_MOVE) || ((ins)->opcode == OP_SETREG) || ((ins)->opcode == OP_ICONST) || ((ins)->opcode == OP_I8CONST) || ((ins)->opcode == OP_LOAD_MEMBASE))
+#define INST_IGNORES_CFLAGS(ins) (((ins)->opcode == CEE_BR) || ((ins)->opcode == OP_STORE_MEMBASE_IMM) || ((ins)->opcode == OP_STOREI8_MEMBASE_REG) || ((ins)->opcode == OP_MOVE) || ((ins)->opcode == OP_ICONST) || ((ins)->opcode == OP_I8CONST) || ((ins)->opcode == OP_LOAD_MEMBASE))
 
 static void
 peephole_pass (MonoCompile *cfg, MonoBasicBlock *bb)
@@ -1526,7 +1522,6 @@ peephole_pass (MonoCompile *cfg, MonoBasicBlock *bb)
                case CEE_CONV_I4:
                case CEE_CONV_U4:
                case OP_MOVE:
-               case OP_SETREG:
                        /*
                         * Removes:
                         *
@@ -2529,7 +2524,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case CEE_CONV_I4:
                case CEE_CONV_U4:
                case OP_MOVE:
-               case OP_SETREG:
                        amd64_mov_reg_reg (code, ins->dreg, ins->sreg1, sizeof (gpointer));
                        break;
                case OP_AMD64_SET_XMMREG_R4: {
@@ -3548,6 +3542,10 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        amd64_mov_reg_mem (code, ins->dreg, ins->inst_offset, 8);
                        break;
                }
+               case OP_MEMORY_BARRIER: {
+                       /* Not needed on amd64 */
+                       break;
+               }
                case OP_ATOMIC_ADD_I4:
                case OP_ATOMIC_ADD_I8: {
                        int dreg = ins->dreg;
@@ -4541,66 +4539,6 @@ mono_arch_get_delegate_method_ptr_addr (guint8* code, gpointer *regs)
 
 static gboolean tls_offset_inited = FALSE;
 
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-
-static void
-setup_stack (MonoJitTlsData *tls)
-{
-       pthread_t self = pthread_self();
-       pthread_attr_t attr;
-       size_t stsize = 0;
-       struct sigaltstack sa;
-       guint8 *staddr = NULL;
-       guint8 *current = (guint8*)&staddr;
-
-       if (mono_running_on_valgrind ())
-               return;
-
-       /* Determine stack boundaries */
-#ifdef HAVE_PTHREAD_GETATTR_NP
-       pthread_getattr_np( self, &attr );
-#else
-#ifdef HAVE_PTHREAD_ATTR_GET_NP
-       pthread_attr_get_np( self, &attr );
-#elif defined(sun)
-       pthread_attr_init( &attr );
-       pthread_attr_getstacksize( &attr, &stsize );
-#else
-#error "Not implemented"
-#endif
-#endif
-#ifndef sun
-       pthread_attr_getstack( &attr, (void**)&staddr, &stsize );
-#endif
-
-       g_assert (staddr);
-
-       g_assert ((current > staddr) && (current < staddr + stsize));
-
-       tls->end_of_stack = staddr + stsize;
-
-       /*
-        * threads created by nptl does not seem to have a guard page, and
-        * since the main thread is not created by us, we can't even set one.
-        * Increasing stsize fools the SIGSEGV signal handler into thinking this
-        * is a stack overflow exception.
-        */
-       tls->stack_size = stsize + getpagesize ();
-
-       /* Setup an alternate signal stack */
-       tls->signal_stack = mmap (0, SIGNAL_STACK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-       tls->signal_stack_size = SIGNAL_STACK_SIZE;
-
-       g_assert (tls->signal_stack);
-
-       sa.ss_sp = tls->signal_stack;
-       sa.ss_size = SIGNAL_STACK_SIZE;
-       sa.ss_flags = SS_ONSTACK;
-       sigaltstack (&sa, NULL);
-}
-
-#endif
-
 void
 mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
 {
@@ -4611,26 +4549,11 @@ mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
                lmf_tls_offset = mono_get_lmf_tls_offset ();
                thread_tls_offset = mono_thread_get_tls_offset ();
        }               
-
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-       setup_stack (tls);
-#endif
 }
 
 void
 mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
 {
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-       struct sigaltstack sa;
-
-       sa.ss_sp = tls->signal_stack;
-       sa.ss_size = SIGNAL_STACK_SIZE;
-       sa.ss_flags = SS_DISABLE;
-       sigaltstack  (&sa, NULL);
-
-       if (tls->signal_stack)
-               munmap (tls->signal_stack, SIGNAL_STACK_SIZE);
-#endif
 }
 
 void
@@ -4657,7 +4580,7 @@ mono_arch_emit_this_vret_args (MonoCompile *cfg, MonoCallInst *inst, int this_re
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUB_IMM, X86_ESP, X86_ESP, 8);
                }
                else {
-                       MONO_INST_NEW (cfg, vtarg, OP_SETREG);
+                       MONO_INST_NEW (cfg, vtarg, OP_MOVE);
                        vtarg->sreg1 = vt_reg;
                        vtarg->dreg = mono_regstate_next_int (cfg->rs);
                        mono_bblock_add_inst (cfg->cbb, vtarg);
@@ -4673,7 +4596,7 @@ mono_arch_emit_this_vret_args (MonoCompile *cfg, MonoCallInst *inst, int this_re
        /* add the this argument */
        if (this_reg != -1) {
                MonoInst *this;
-               MONO_INST_NEW (cfg, this, OP_SETREG);
+               MONO_INST_NEW (cfg, this, OP_MOVE);
                this->type = this_type;
                this->sreg1 = this_reg;
                this->dreg = mono_regstate_next_int (cfg->rs);
@@ -4720,6 +4643,9 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethod
                        ins->inst_i1 = args [1];
                }
 #endif
+       } else if (cmethod->klass == mono_defaults.thread_class &&
+                          strcmp (cmethod->name, "MemoryBarrier") == 0) {
+               MONO_INST_NEW (cfg, ins, OP_MEMORY_BARRIER);
        } else if(cmethod->klass->image == mono_defaults.corlib &&
                           (strcmp (cmethod->klass->name_space, "System.Threading") == 0) &&
                           (strcmp (cmethod->klass->name, "Interlocked") == 0)) {
index 0db239c695ddc087656ad3b45cececfca6c12bcb..1ad76d0d27b0bdfc50071f77496387213b51b580 100644 (file)
@@ -73,6 +73,8 @@ struct sigcontext {
 };
 #endif  // sun, Solaris x86
 
+#define MONO_ARCH_SIGNAL_STACK_SIZE (64 * 1024)
+
 #define MONO_MAX_IREGS 16
 
 #define MONO_MAX_FREGS AMD64_XMM_NREG
index 9fbbc12a0649b6bd233543b4c24797750927e48f..8e3c470f7e4f9421e7d4661334b0a694ccdf9bdb 100644 (file)
@@ -638,6 +638,11 @@ mono_arch_allocate_vars (MonoCompile *m)
                else
                        size = mono_type_size (inst->inst_vtype, &align);
 
+               /* FIXME: if a structure is misaligned, our memcpy doesn't work,
+                * since it loads/stores misaligned words, which don't do the right thing.
+                */
+               if (align < 4 && size >= 4)
+                       align = 4;
                offset += align - 1;
                offset &= ~(align - 1);
                inst->inst_offset = offset;
@@ -669,6 +674,11 @@ mono_arch_allocate_vars (MonoCompile *m)
                        inst->opcode = OP_REGOFFSET;
                        inst->inst_basereg = frame_reg;
                        size = mono_type_size (sig->params [i], &align);
+                       /* FIXME: if a structure is misaligned, our memcpy doesn't work,
+                        * since it loads/stores misaligned words, which don't do the right thing.
+                        */
+                       if (align < 4 && size >= 4)
+                               align = 4;
                        offset += align - 1;
                        offset &= ~(align - 1);
                        inst->inst_offset = offset;
@@ -1564,6 +1574,21 @@ arm_patch (guchar *code, const guchar *target)
                /* branch and exchange: the address is constructed in a reg */
                g_assert_not_reached ();
        } else {
+               guint32 ccode [3];
+               guint32 *tmp = ccode;
+               ARM_LDR_IMM (tmp, ARMREG_IP, ARMREG_PC, 0);
+               ARM_MOV_REG_REG (tmp, ARMREG_LR, ARMREG_PC);
+               ARM_MOV_REG_REG (tmp, ARMREG_PC, ARMREG_IP);
+               if (ins == ccode [2]) {
+                       tmp = (guint32*)code;
+                       tmp [-1] = (guint32)target;
+                       return;
+               }
+               if (ins == ccode [0]) {
+                       tmp = (guint32*)code;
+                       tmp [2] = (guint32)target;
+                       return;
+               }
                g_assert_not_reached ();
        }
 //     g_print ("patched with 0x%08x\n", ins);
@@ -1597,6 +1622,14 @@ guint8*
 mono_arm_emit_load_imm (guint8 *code, int dreg, guint32 val)
 {
        int imm8, rot_amount;
+#if 0
+       ARM_LDR_IMM (code, dreg, ARMREG_PC, 0);
+       /* skip the constant pool */
+       ARM_B (code, 0);
+       *(int*)code = val;
+       code += 4;
+       return code;
+#endif
        if ((imm8 = mono_arm_is_rotated_imm8 (val, &rot_amount)) >= 0) {
                ARM_MOV_REG_IMM (code, dreg, imm8, rot_amount);
        } else if ((imm8 = mono_arm_is_rotated_imm8 (~val, &rot_amount)) >= 0) {
@@ -1751,16 +1784,19 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        ARM_LDR_REG_REG (code, ins->dreg, ins->inst_basereg, ins->sreg2);
                        break;
                case OP_LOADI1_MEMINDEX:
-                       ARM_LDRSB_REG_REG (code, ins->dreg, ins->inst_basereg, ins->sreg2);
+                       /* note: the args are reversed in the macro */
+                       ARM_LDRSB_REG_REG (code, ins->inst_basereg, ins->dreg, ins->sreg2);
                        break;
                case OP_LOADU1_MEMINDEX:
                        ARM_LDRB_REG_REG (code, ins->dreg, ins->inst_basereg, ins->sreg2);
                        break;
                case OP_LOADI2_MEMINDEX:
-                       ARM_LDRSH_REG_REG (code, ins->inst_basereg, ins->sreg2, ins->dreg);
+                       /* note: the args are reversed in the macro */
+                       ARM_LDRSH_REG_REG (code, ins->inst_basereg, ins->dreg, ins->sreg2);
                        break;
                case OP_LOADU2_MEMINDEX:
-                       ARM_LDRH_REG_REG (code, ins->inst_basereg, ins->sreg2, ins->dreg);
+                       /* note: the args are reversed in the macro */
+                       ARM_LDRH_REG_REG (code, ins->inst_basereg, ins->dreg, ins->sreg2);
                        break;
                case OP_LOAD_MEMBASE:
                case OP_LOADI4_MEMBASE:
@@ -1947,16 +1983,19 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        ARM_SHL_REG (code, ins->dreg, ins->sreg1, ins->sreg2);
                        break;
                case OP_SHL_IMM:
-                       ARM_SHL_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
+                       if (ins->inst_imm)
+                               ARM_SHL_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
                        break;
                case CEE_SHR:
                        ARM_SAR_REG (code, ins->dreg, ins->sreg1, ins->sreg2);
                        break;
                case OP_SHR_IMM:
-                       ARM_SAR_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
+                       if (ins->inst_imm)
+                               ARM_SAR_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
                        break;
                case OP_SHR_UN_IMM:
-                       ARM_SHR_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
+                       if (ins->inst_imm)
+                               ARM_SHR_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
                        break;
                case CEE_SHR_UN:
                        ARM_SHR_REG (code, ins->dreg, ins->sreg1, ins->sreg2);
@@ -2320,12 +2359,13 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        /* save the temp register */
                        ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 8);
                        ARM_STFD (code, tmpreg, ARMREG_SP, 0);
-                       ARM_LDFD (code, tmpreg, ARMREG_PC, 4);
+                       ARM_LDFD (code, tmpreg, ARMREG_PC, 12);
                        ARM_FPA_ADFD (code, ins->dreg, ins->dreg, tmpreg);
                        ARM_LDFD (code, tmpreg, ARMREG_SP, 0);
                        ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 8);
                        /* skip the constant pool */
-                       ARM_B (code, 4);
+                       ARM_B (code, 8);
+                       code += 4;
                        *(int*)code = 0x41f00000;
                        code += 4;
                        *(int*)code = 0;
index f43a291d057a5026f8f7c3eb7cce09ae60745e53..a70a97d8836b7fdadef3ebe8071607a3d05cd9cc 100644 (file)
@@ -87,6 +87,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_EMULATE_LCONV_TO_R8_UN 1
 #define MONO_ARCH_EMULATE_FREM 1
 #define MONO_ARCH_EMULATE_DIV 1
+#define MONO_ARCH_EMULATE_CONV_R8_UN 1
 //#define MONO_ARCH_BIGMUL_INTRINS 1
 
 #define ARM_FIRST_ARG_REG 0
index 7a88c7f6b371573abc558b333790a213836c9f14..3be880fa8b36e058ec92add8fc51ff202574d7b2 100644 (file)
@@ -177,12 +177,14 @@ create_spilled_load_float (MonoCompile *cfg, int spill, int reg, MonoInst *ins)
        return load;
 }
 
+#define regmask(reg) (((regmask_t)1) << (reg))
+
 #define is_hard_ireg(r) ((r) >= 0 && (r) < MONO_MAX_IREGS)
 #define is_hard_freg(r) ((r) >= 0 && (r) < MONO_MAX_FREGS)
-#define is_global_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_SAVED_REGS & (1 << (r))))
-#define is_local_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_REGS & (1 << (r))))
-#define is_global_freg(r) (is_hard_freg ((r)) && (MONO_ARCH_CALLEE_SAVED_FREGS & (1 << (r))))
-#define is_local_freg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_FREGS & (1 << (r))))
+#define is_global_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_SAVED_REGS & (regmask (r))))
+#define is_local_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_REGS & (regmask (r))))
+#define is_global_freg(r) (is_hard_freg ((r)) && (MONO_ARCH_CALLEE_SAVED_FREGS & (regmask (r))))
+#define is_local_freg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_FREGS & (regmask (r))))
 #define ireg_is_freeable(r) is_local_ireg ((r))
 #define freg_is_freeable(r) is_hard_freg ((r))
 
@@ -199,7 +201,12 @@ create_spilled_load_float (MonoCompile *cfg, int spill, int reg, MonoInst *ins)
 #define dreg_is_fp(ins)  (ins_spec [(ins)->opcode] [MONO_INST_DEST] == 'f')
 #endif
 
-#define regpair_reg2_mask(desc,hreg1) ((MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1) != -1) ? (1 << MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1)) : MONO_ARCH_CALLEE_REGS)
+#define regpair_reg2_mask(desc,hreg1) ((MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1) != -1) ? (regmask (MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1))) : MONO_ARCH_CALLEE_REGS)
+
+#ifdef MONO_ARCH_IS_GLOBAL_IREG
+#undef is_global_ireg
+#define is_global_ireg(reg) MONO_ARCH_IS_GLOBAL_IREG ((reg))
+#endif
 
 typedef struct {
        int born_in;
@@ -207,7 +214,7 @@ typedef struct {
        int last_use;
        int prev_use;
        int flags;              /* used to track fp spill/load */
-       guint32 preferred_mask; /* the hreg where the register should be allocated, or 0 */
+       regmask_t preferred_mask; /* the hreg where the register should be allocated, or 0 */
 } RegTrack;
 
 static void
@@ -342,16 +349,16 @@ get_register_force_spilling (MonoCompile *cfg, InstList *item, MonoInst *ins, in
        ins->next = load;
        DEBUG (g_print ("SPILLED LOAD (%d at 0x%08lx(%%ebp)) R%d (freed %s)\n", spill, (long)load->inst_offset, i, mono_regname_full (sel, fp)));
        if (fp)
-               i = mono_regstate_alloc_float (cfg->rs, 1 << sel);
+               i = mono_regstate_alloc_float (cfg->rs, regmask (sel));
        else
-               i = mono_regstate_alloc_int (cfg->rs, 1 << sel);
+               i = mono_regstate_alloc_int (cfg->rs, regmask (sel));
        g_assert (i == sel);
 
        return sel;
 }
 
 static int
-get_register_spilling (MonoCompile *cfg, InstList *item, MonoInst *ins, guint32 regmask, int reg, gboolean fp)
+get_register_spilling (MonoCompile *cfg, InstList *item, MonoInst *ins, regmask_t regmask, int reg, gboolean fp)
 {
        MonoInst *load;
        int i, sel, spill;
@@ -366,34 +373,34 @@ get_register_spilling (MonoCompile *cfg, InstList *item, MonoInst *ins, guint32
                symbolic = cfg->rs->isymbolic;
        }
 
-       DEBUG (g_print ("\tstart regmask to assign R%d: 0x%08x (R%d <- R%d R%d)\n", reg, regmask, ins->dreg, ins->sreg1, ins->sreg2));
+       DEBUG (g_print ("\tstart regmask to assign R%d: 0x%08lx (R%d <- R%d R%d)\n", reg, (guint64)regmask, ins->dreg, ins->sreg1, ins->sreg2));
        /* exclude the registers in the current instruction */
        if ((sreg1_is_fp (ins) == fp) && (reg != ins->sreg1) && (reg_is_freeable (ins->sreg1, fp) || (is_soft_reg (ins->sreg1, fp) && rassign (cfg, ins->sreg1, fp) >= 0))) {
                if (is_soft_reg (ins->sreg1, fp))
-                       regmask &= ~ (1 << rassign (cfg, ins->sreg1, fp));
+                       regmask &= ~ (regmask (rassign (cfg, ins->sreg1, fp)));
                else
-                       regmask &= ~ (1 << ins->sreg1);
+                       regmask &= ~ (regmask (ins->sreg1));
                DEBUG (g_print ("\t\texcluding sreg1 %s\n", mono_regname_full (ins->sreg1, fp)));
        }
        if ((sreg2_is_fp (ins) == fp) && (reg != ins->sreg2) && (reg_is_freeable (ins->sreg2, fp) || (is_soft_reg (ins->sreg2, fp) && rassign (cfg, ins->sreg2, fp) >= 0))) {
                if (is_soft_reg (ins->sreg2, fp))
-                       regmask &= ~ (1 << rassign (cfg, ins->sreg2, fp));
+                       regmask &= ~ (regmask (rassign (cfg, ins->sreg2, fp)));
                else
-                       regmask &= ~ (1 << ins->sreg2);
+                       regmask &= ~ (regmask (ins->sreg2));
                DEBUG (g_print ("\t\texcluding sreg2 %s %d\n", mono_regname_full (ins->sreg2, fp), ins->sreg2));
        }
        if ((dreg_is_fp (ins) == fp) && (reg != ins->dreg) && reg_is_freeable (ins->dreg, fp)) {
-               regmask &= ~ (1 << ins->dreg);
+               regmask &= ~ (regmask (ins->dreg));
                DEBUG (g_print ("\t\texcluding dreg %s\n", mono_regname_full (ins->dreg, fp)));
        }
 
-       DEBUG (g_print ("\t\tavailable regmask: 0x%08x\n", regmask));
+       DEBUG (g_print ("\t\tavailable regmask: 0x%08lx\n", (guint64)regmask));
        g_assert (regmask); /* need at least a register we can free */
        sel = -1;
        /* we should track prev_use and spill the register that's farther */
        if (fp) {
                for (i = 0; i < MONO_MAX_FREGS; ++i) {
-                       if (regmask & (1 << i)) {
+                       if (regmask & (regmask (i))) {
                                sel = i;
                                DEBUG (g_print ("\t\tselected register %s has assignment %d\n", mono_arch_fregname (sel), cfg->rs->fsymbolic [sel]));
                                break;
@@ -407,7 +414,7 @@ get_register_spilling (MonoCompile *cfg, InstList *item, MonoInst *ins, guint32
        }
        else {
                for (i = 0; i < MONO_MAX_IREGS; ++i) {
-                       if (regmask & (1 << i)) {
+                       if (regmask & (regmask (i))) {
                                sel = i;
                                DEBUG (g_print ("\t\tselected register %s has assignment %d\n", mono_arch_regname (sel), cfg->rs->isymbolic [sel]));
                                break;
@@ -433,9 +440,9 @@ get_register_spilling (MonoCompile *cfg, InstList *item, MonoInst *ins, guint32
        ins->next = load;
        DEBUG (g_print ("\tSPILLED LOAD (%d at 0x%08lx(%%ebp)) R%d (freed %s)\n", spill, (long)load->inst_offset, i, mono_regname_full (sel, fp)));
        if (fp)
-               i = mono_regstate_alloc_float (cfg->rs, 1 << sel);
+               i = mono_regstate_alloc_float (cfg->rs, regmask (sel));
        else
-               i = mono_regstate_alloc_int (cfg->rs, 1 << sel);
+               i = mono_regstate_alloc_int (cfg->rs, regmask (sel));
        g_assert (i == sel);
        
        return sel;
@@ -444,7 +451,7 @@ get_register_spilling (MonoCompile *cfg, InstList *item, MonoInst *ins, guint32
 static void
 free_up_ireg (MonoCompile *cfg, InstList *item, MonoInst *ins, int hreg)
 {
-       if (!(cfg->rs->ifree_mask & (1 << hreg))) {
+       if (!(cfg->rs->ifree_mask & (regmask (hreg)))) {
                DEBUG (g_print ("\tforced spill of R%d\n", cfg->rs->isymbolic [hreg]));
                get_register_force_spilling (cfg, item, ins, cfg->rs->isymbolic [hreg], FALSE);
                mono_regstate_free_int (cfg->rs, hreg);
@@ -455,14 +462,14 @@ static void
 free_up_reg (MonoCompile *cfg, InstList *item, MonoInst *ins, int hreg, gboolean fp)
 {
        if (fp) {
-               if (!(cfg->rs->ffree_mask & (1 << hreg))) {
+               if (!(cfg->rs->ffree_mask & (regmask (hreg)))) {
                        DEBUG (g_print ("\tforced spill of R%d\n", cfg->rs->isymbolic [hreg]));
                        get_register_force_spilling (cfg, item, ins, cfg->rs->isymbolic [hreg], fp);
                        mono_regstate_free_float (cfg->rs, hreg);
                }
        }
        else {
-               if (!(cfg->rs->ifree_mask & (1 << hreg))) {
+               if (!(cfg->rs->ifree_mask & (regmask (hreg)))) {
                        DEBUG (g_print ("\tforced spill of R%d\n", cfg->rs->isymbolic [hreg]));
                        get_register_force_spilling (cfg, item, ins, cfg->rs->isymbolic [hreg], fp);
                        mono_regstate_free_int (cfg->rs, hreg);
@@ -531,13 +538,13 @@ insert_before_ins (MonoInst *ins, InstList *item, MonoInst* to_insert)
 
 /* flags used in reginfo->flags */
 enum {
-       MONO_FP_NEEDS_LOAD_SPILL        = 1 << 0,
-       MONO_FP_NEEDS_SPILL                     = 1 << 1,
-       MONO_FP_NEEDS_LOAD                      = 1 << 2
+       MONO_FP_NEEDS_LOAD_SPILL        = regmask (0),
+       MONO_FP_NEEDS_SPILL                     = regmask (1),
+       MONO_FP_NEEDS_LOAD                      = regmask (2)
 };
 
 static int
-alloc_int_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, guint32 dest_mask, int sym_reg, RegTrack *info)
+alloc_int_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, regmask_t dest_mask, int sym_reg, RegTrack *info)
 {
        int val;
 
@@ -557,7 +564,7 @@ alloc_int_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, guint32 dest_mask
 }
 
 static int
-alloc_float_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, guint32 dest_mask, int sym_reg)
+alloc_float_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, regmask_t dest_mask, int sym_reg)
 {
        int val;
 
@@ -571,7 +578,7 @@ alloc_float_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, guint32 dest_ma
 }
 
 static int
-alloc_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, guint32 dest_mask, int sym_reg, RegTrack *info, gboolean fp)
+alloc_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, regmask_t dest_mask, int sym_reg, RegTrack *info, gboolean fp)
 {
        if (fp)
                return alloc_float_reg (cfg, tmp, ins, dest_mask, sym_reg);
@@ -580,7 +587,7 @@ alloc_reg (MonoCompile *cfg, InstList *tmp, MonoInst *ins, guint32 dest_mask, in
 }
 
 static inline void
-assign_reg (MonoRegState *rs, int reg, int hreg, gboolean fp)
+assign_reg (MonoCompile *cfg, MonoRegState *rs, int reg, int hreg, gboolean fp)
 {
        if (fp) {
                g_assert (reg >= MONO_MAX_FREGS);
@@ -589,7 +596,7 @@ assign_reg (MonoRegState *rs, int reg, int hreg, gboolean fp)
 
                rs->fassign [reg] = hreg;
                rs->fsymbolic [hreg] = reg;
-               rs->ffree_mask &= ~ (1 << hreg);
+               rs->ffree_mask &= ~ (regmask (hreg));
        }
        else {
                g_assert (reg >= MONO_MAX_IREGS);
@@ -598,14 +605,14 @@ assign_reg (MonoRegState *rs, int reg, int hreg, gboolean fp)
 
                rs->iassign [reg] = hreg;
                rs->isymbolic [hreg] = reg;
-               rs->ifree_mask &= ~ (1 << hreg);
+               rs->ifree_mask &= ~ (regmask (hreg));
        }
 }
 
 static inline void
-assign_ireg (MonoRegState *rs, int reg, int hreg)
+assign_ireg (MonoCompile *cfg, MonoRegState *rs, int reg, int hreg)
 {
-       assign_reg (rs, reg, hreg, FALSE);
+       assign_reg (cfg, rs, reg, hreg, FALSE);
 }
 
 /*
@@ -641,7 +648,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
        rs->ffree_mask = MONO_ARCH_CALLEE_FREGS;
 
        if (use_fpstack)
-               rs->ffree_mask = 0xff & ~(1 << MONO_ARCH_FPSTACK_SIZE);
+               rs->ffree_mask = 0xff & ~(regmask (MONO_ARCH_FPSTACK_SIZE));
 
        ins = bb->code;
 
@@ -753,7 +760,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
 
                        dest_dreg = MONO_ARCH_INST_FIXED_REG (spec [MONO_INST_DEST]);
                        if (dest_dreg != -1)
-                               reginfod [ins->dreg].preferred_mask = (1 << dest_dreg);
+                               reginfod [ins->dreg].preferred_mask = (regmask (dest_dreg));
 
                        if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_DEST])) {
                                /* The virtual register is allocated sequentially */
@@ -824,7 +831,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                int prev_dreg, prev_sreg1, prev_sreg2, clob_dreg;
                int dest_dreg, dest_sreg1, dest_sreg2, clob_reg;
                int dreg_high, sreg1_high;
-               guint32 dreg_mask, sreg1_mask, sreg2_mask, mask;
+               regmask_t dreg_mask, sreg1_mask, sreg2_mask, mask;
                const unsigned char *ip;
                --i;
                ins = tmp->data;
@@ -926,7 +933,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                 * TRACK FIXED SREG2
                 */
                if (dest_sreg2 != -1) {
-                       if (rs->ifree_mask & (1 << dest_sreg2)) {
+                       if (rs->ifree_mask & (regmask (dest_sreg2))) {
                                if (is_global_ireg (ins->sreg2)) {
                                        /* Argument already in hard reg, need to copy */
                                        MonoInst *copy = create_copy_ins (cfg, dest_sreg2, ins->sreg2, NULL, ip, FALSE);
@@ -934,13 +941,13 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                }
                                else {
                                        DEBUG (g_print ("\tshortcut assignment of R%d to %s\n", ins->sreg2, mono_arch_regname (dest_sreg2)));
-                                       assign_ireg (rs, ins->sreg2, dest_sreg2);
+                                       assign_ireg (cfg, rs, ins->sreg2, dest_sreg2);
                                }
                        } else {
                                int need_spill = TRUE;
 
-                               dreg_mask &= ~ (1 << dest_sreg2);
-                               sreg1_mask &= ~ (1 << dest_sreg2);
+                               dreg_mask &= ~ (regmask (dest_sreg2));
+                               sreg1_mask &= ~ (regmask (dest_sreg2));
 
                                /* 
                                 * First check if dreg is assigned to dest_sreg2, since we
@@ -959,7 +966,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        DEBUG (g_print ("\tchanging dreg R%d to %s from %s\n", ins->dreg, mono_arch_regname (new_dest), mono_arch_regname (dest_sreg2)));
 
                                        prev_dreg = ins->dreg;
-                                       assign_ireg (rs, ins->dreg, new_dest);
+                                       assign_ireg (cfg, rs, ins->dreg, new_dest);
                                        clob_dreg = ins->dreg;
                                        create_copy_ins (cfg, dest_sreg2, new_dest, ins, ip, FALSE);
                                        need_spill = FALSE;
@@ -989,7 +996,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
 
                                if (!is_global_ireg (ins->sreg2))
                                        /* force-set sreg2 */
-                                       assign_ireg (rs, ins->sreg2, dest_sreg2);
+                                       assign_ireg (cfg, rs, ins->sreg2, dest_sreg2);
                        }
                        ins->sreg2 = dest_sreg2;
                }
@@ -1007,9 +1014,9 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                         * avoid allocating sreg1/sreg2 to the same reg.
                         */
                        if (dest_sreg1 != -1)
-                               dreg_mask &= ~ (1 << dest_sreg1);
+                               dreg_mask &= ~ (regmask (dest_sreg1));
                        if (dest_sreg2 != -1)
-                               dreg_mask &= ~ (1 << dest_sreg2);
+                               dreg_mask &= ~ (regmask (dest_sreg2));
                }
 
                /*
@@ -1036,7 +1043,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
 
                if ((!fp || (fp && !use_fpstack)) && (is_soft_reg (ins->dreg, fp))) {
                        if (dest_dreg != -1)
-                               dreg_mask = (1 << dest_dreg);
+                               dreg_mask = (regmask (dest_dreg));
 
                        val = rassign (cfg, ins->dreg, fp);
 
@@ -1047,7 +1054,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        spill = -val -1;
                                }
                                val = alloc_reg (cfg, tmp, ins, dreg_mask, ins->dreg, &reginfo [ins->dreg], fp);
-                               assign_reg (rs, ins->dreg, val, fp);
+                               assign_reg (cfg, rs, ins->dreg, val, fp);
                                if (spill)
                                        create_spilled_store (cfg, spill, val, prev_dreg, ins, fp);
                        }
@@ -1078,7 +1085,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        create_spilled_store (cfg, spill, val, reg2, ins, fp);
                        }
                        else {
-                               if (! (mask & (1 << val))) {
+                               if (! (mask & (regmask (val)))) {
                                        val = mono_regstate_alloc_int (rs, mask);
                                        if (val < 0)
                                                val = get_register_spilling (cfg, tmp, ins, mask, reg2, fp);
@@ -1091,7 +1098,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                        }                                       
 
                        DEBUG (g_print ("\tassigned dreg-high %s to dest R%d\n", mono_arch_regname (val), reg2));
-                       assign_reg (rs, reg2, val, fp);
+                       assign_reg (cfg, rs, reg2, val, fp);
 
                        dreg_high = val;
                        ins->unused = val;
@@ -1137,14 +1144,14 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                         * The dest reg is read by the instruction, not written, so
                         * avoid allocating sreg1/sreg2 to the same reg.
                         */
-                       sreg1_mask &= ~ (1 << ins->dreg);
-                       sreg2_mask &= ~ (1 << ins->dreg);
+                       sreg1_mask &= ~ (regmask (ins->dreg));
+                       sreg2_mask &= ~ (regmask (ins->dreg));
                }
 
                /*
                 * TRACK CLOBBERING
                 */
-               if ((clob_reg != -1) && (!(rs->ifree_mask & (1 << clob_reg)))) {
+               if ((clob_reg != -1) && (!(rs->ifree_mask & (regmask (clob_reg))))) {
                        DEBUG (g_print ("\tforced spill of clobbered reg R%d\n", rs->isymbolic [clob_reg]));
                        get_register_force_spilling (cfg, tmp, ins, rs->isymbolic [clob_reg], FALSE);
                        mono_regstate_free_int (rs, clob_reg);
@@ -1171,7 +1178,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                dreg2 = -1;
 
                        for (j = 0; j < MONO_MAX_IREGS; ++j) {
-                               s = 1 << j;
+                               s = regmask (j);
                                if ((clob_mask & s) && !(rs->ifree_mask & s) && (j != ins->sreg1) && (j != dreg) && (j != dreg2)) {
                                        get_register_force_spilling (cfg, tmp, ins, rs->isymbolic [j], FALSE);
                                        mono_regstate_free_int (rs, j);
@@ -1186,7 +1193,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        dreg = -1;
 
                                for (j = 0; j < MONO_MAX_FREGS; ++j) {
-                                       s = 1 << j;
+                                       s = regmask (j);
                                        if ((clob_mask & s) && !(rs->ffree_mask & s) && (j != ins->sreg1) && (j != dreg)) {
                                                get_register_force_spilling (cfg, tmp, ins, rs->fsymbolic [j], TRUE);
                                                mono_regstate_free_float (rs, j);
@@ -1222,9 +1229,9 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        hreg = regpair >> 24;
                                        reg = regpair & 0xffffff;
 
-                                       assign_reg (rs, reg, hreg, FALSE);
+                                       assign_reg (cfg, rs, reg, hreg, FALSE);
 
-                                       sreg1_mask &= ~(1 << hreg);
+                                       sreg1_mask &= ~(regmask (hreg));
 
                                        DEBUG (g_print ("\tassigned arg reg %s to R%d\n", mono_arch_regname (hreg), reg));
 
@@ -1243,7 +1250,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        hreg = regpair >> 24;
                                        reg = regpair & 0xffffff;
 
-                                       assign_reg (rs, reg, hreg, TRUE);
+                                       assign_reg (cfg, rs, reg, hreg, TRUE);
 
                                        DEBUG (g_print ("\tassigned arg reg %s to R%d\n", mono_arch_fregname (hreg), reg));
 
@@ -1265,16 +1272,16 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                /* To simplify things, we allocate the same regpair to sreg1 and dreg */
                                if (dest_sreg1 != -1)
                                        g_assert (dest_sreg1 == ins->dreg);
-                               val = mono_regstate_alloc_int (rs, 1 << ins->dreg);
+                               val = mono_regstate_alloc_int (rs, regmask (ins->dreg));
                                g_assert (val >= 0);
-                               assign_reg (rs, ins->sreg1, val, fp);
+                               assign_reg (cfg, rs, ins->sreg1, val, fp);
 
                                DEBUG (g_print ("\tassigned sreg1-low %s to R%d\n", mono_regname_full (val, fp), ins->sreg1));
 
-                               g_assert ((1 << dreg_high) & regpair_reg2_mask (spec [MONO_INST_SRC1], ins->dreg));
-                               val = mono_regstate_alloc_int (rs, 1 << dreg_high);
+                               g_assert ((regmask (dreg_high)) & regpair_reg2_mask (spec [MONO_INST_SRC1], ins->dreg));
+                               val = mono_regstate_alloc_int (rs, regmask (dreg_high));
                                g_assert (val >= 0);
-                               assign_reg (rs, ins->sreg1 + 1, val, fp);
+                               assign_reg (cfg, rs, ins->sreg1 + 1, val, fp);
 
                                DEBUG (g_print ("\tassigned sreg1-high %s to R%d\n", mono_regname_full (val, fp), ins->sreg1 + 1));
 
@@ -1283,9 +1290,9 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                        }
 
                        if (dest_sreg1 != -1) {
-                               sreg1_mask = 1 << dest_sreg1;
+                               sreg1_mask = regmask (dest_sreg1);
 
-                               if (!(rs->ifree_mask & (1 << dest_sreg1))) {
+                               if (!(rs->ifree_mask & (regmask (dest_sreg1)))) {
                                        DEBUG (g_print ("\tforced spill of R%d\n", rs->isymbolic [dest_sreg1]));
                                        get_register_force_spilling (cfg, tmp, ins, rs->isymbolic [dest_sreg1], FALSE);
                                        mono_regstate_free_int (rs, dest_sreg1);
@@ -1308,16 +1315,16 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                                spill = -val -1;
                                        }
 
-                                       if (((ins->opcode == OP_MOVE) || (ins->opcode == OP_SETREG)) && !spill && !fp && (!is_global_ireg (ins->dreg) && (rs->ifree_mask & (1 << ins->dreg)))) {
+                                       if (((ins->opcode == OP_MOVE) || (ins->opcode == OP_SETREG)) && !spill && !fp && (!is_global_ireg (ins->dreg) && (rs->ifree_mask & (regmask (ins->dreg))))) {
                                                /* 
                                                 * Allocate the same hreg to sreg1 as well so the 
                                                 * peephole can get rid of the move.
                                                 */
-                                               sreg1_mask = 1 << ins->dreg;
+                                               sreg1_mask = regmask (ins->dreg);
                                        }
 
                                        val = alloc_reg (cfg, tmp, ins, sreg1_mask, ins->sreg1, &reginfo [ins->sreg1], fp);
-                                       assign_reg (rs, ins->sreg1, val, fp);
+                                       assign_reg (cfg, rs, ins->sreg1, val, fp);
                                        DEBUG (g_print ("\tassigned sreg1 %s to R%d\n", mono_regname_full (val, fp), ins->sreg1));
 
                                        if (spill) {
@@ -1338,7 +1345,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                        else {
                                prev_sreg1 = -1;
                        }
-                       sreg2_mask &= ~(1 << ins->sreg1);
+                       sreg2_mask &= ~(regmask (ins->sreg1));
                }
 
                /* Handle the case when sreg1 is a regpair but dreg is not */
@@ -1363,7 +1370,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        g_assert_not_reached ();
                        }
                        else {
-                               if (! (mask & (1 << val))) {
+                               if (! (mask & (regmask (val)))) {
                                        /* The vreg is already allocated to a wrong hreg */
                                        /* FIXME: */
                                        g_assert_not_reached ();
@@ -1382,7 +1389,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
 
                        sreg1_high = val;
                        DEBUG (g_print ("\tassigned sreg1 hreg %s to dest R%d\n", mono_arch_regname (val), reg2));
-                       assign_reg (rs, reg2, val, fp);
+                       assign_reg (cfg, rs, reg2, val, fp);
                }
 
                /* Handle dreg==sreg1 */
@@ -1433,10 +1440,10 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                         * Need to prevent sreg2 to be allocated to sreg1, since that
                         * would screw up the previous copy.
                         */
-                       sreg2_mask &= ~ (1 << ins->sreg1);
+                       sreg2_mask &= ~ (regmask (ins->sreg1));
                        /* we set sreg1 to dest as well */
                        prev_sreg1 = ins->sreg1 = ins->dreg;
-                       sreg2_mask &= ~ (1 << ins->dreg);
+                       sreg2_mask &= ~ (regmask (ins->dreg));
                }
 
                /*
@@ -1455,7 +1462,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                                        spill = -val -1;
                                }
                                val = alloc_reg (cfg, tmp, ins, sreg2_mask, ins->sreg2, &reginfo [ins->sreg2], fp);
-                               assign_reg (rs, ins->sreg2, val, fp);
+                               assign_reg (cfg, rs, ins->sreg2, val, fp);
                                DEBUG (g_print ("\tassigned sreg2 %s to R%d\n", mono_regname_full (val, fp), ins->sreg2));
                                if (spill)
                                        create_spilled_store (cfg, spill, val, prev_sreg2, ins, fp);
index f18bb462182e51c03a45c683f05e291671350c43..bc14aac53aefd31b2dd132be3e4fcbd42e8a6e1d 100644 (file)
 
 #include "mini.h"
 
+#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
+#include <unistd.h>
+#include <sys/mman.h>
+#endif
+
 #define IS_ON_SIGALTSTACK(jit_tls) ((jit_tls) && ((guint8*)&(jit_tls) > (guint8*)(jit_tls)->signal_stack) && ((guint8*)&(jit_tls) < ((guint8*)(jit_tls)->signal_stack + (jit_tls)->signal_stack_size)))
 
 #ifndef MONO_ARCH_CONTEXT_DEF
@@ -699,7 +704,7 @@ mono_handle_exception (MonoContext *ctx, gpointer obj, gpointer original_ip, gbo
                                                if ((ei->flags == MONO_EXCEPTION_CLAUSE_NONE) || (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER)) {
                                                        /* store the exception object in cfg->excvar */
                                                        g_assert (ei->exvar_offset);
-                                                       *((gpointer *)((char *)MONO_CONTEXT_GET_BP (ctx) + ei->exvar_offset)) = obj;
+                                                       *((gpointer *)(gpointer)((char *)MONO_CONTEXT_GET_BP (ctx) + ei->exvar_offset)) = obj;
                                                }
 
                                                if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) {
@@ -758,9 +763,11 @@ mono_handle_exception (MonoContext *ctx, gpointer obj, gpointer original_ip, gbo
 
                                if (IS_ON_SIGALTSTACK (jit_tls)) {
                                        /* Switch back to normal stack */
-                                       if (stack_overflow)
+                                       if (stack_overflow) {
                                                /* Free up some stack space */
                                                MONO_CONTEXT_SET_SP (&initial_ctx, (gssize)(MONO_CONTEXT_GET_SP (&initial_ctx)) + (64 * 1024));
+                                               g_assert ((gssize)MONO_CONTEXT_GET_SP (&initial_ctx) < (gssize)jit_tls->end_of_stack);
+                                       }
                                        MONO_CONTEXT_SET_IP (&initial_ctx, (gssize)jit_tls->abort_func);
                                        restore_context (&initial_ctx);
                                }
@@ -785,3 +792,78 @@ mono_handle_exception (MonoContext *ctx, gpointer obj, gpointer original_ip, gbo
 }
 #endif /* CUSTOM_EXECPTION_HANDLING */
 
+#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
+
+void
+mono_setup_altstack (MonoJitTlsData *tls)
+{
+       pthread_t self = pthread_self();
+       pthread_attr_t attr;
+       size_t stsize = 0;
+       struct sigaltstack sa;
+       guint8 *staddr = NULL;
+       guint8 *current = (guint8*)&staddr;
+
+       if (mono_running_on_valgrind ())
+               return;
+
+       /* Determine stack boundaries */
+       pthread_attr_init( &attr );
+#ifdef HAVE_PTHREAD_GETATTR_NP
+       pthread_getattr_np( self, &attr );
+#else
+#ifdef HAVE_PTHREAD_ATTR_GET_NP
+       pthread_attr_get_np( self, &attr );
+#elif defined(sun)
+       pthread_attr_getstacksize( &attr, &stsize );
+#else
+#error "Not implemented"
+#endif
+#endif
+#ifndef sun
+       pthread_attr_getstack( &attr, (void**)&staddr, &stsize );
+#endif
+
+       g_assert (staddr);
+
+       g_assert ((current > staddr) && (current < staddr + stsize));
+
+       tls->end_of_stack = staddr + stsize;
+
+       /*
+        * threads created by nptl does not seem to have a guard page, and
+        * since the main thread is not created by us, we can't even set one.
+        * Increasing stsize fools the SIGSEGV signal handler into thinking this
+        * is a stack overflow exception.
+        */
+       tls->stack_size = stsize + getpagesize ();
+
+       /* Setup an alternate signal stack */
+       tls->signal_stack = mmap (0, MONO_ARCH_SIGNAL_STACK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+       tls->signal_stack_size = MONO_ARCH_SIGNAL_STACK_SIZE;
+
+       g_assert (tls->signal_stack);
+
+       sa.ss_sp = tls->signal_stack;
+       sa.ss_size = MONO_ARCH_SIGNAL_STACK_SIZE;
+       sa.ss_flags = SS_ONSTACK;
+       sigaltstack (&sa, NULL);
+}
+
+void
+mono_free_altstack (MonoJitTlsData *tls)
+{
+       struct sigaltstack sa;
+       int err;
+
+       sa.ss_sp = tls->signal_stack;
+       sa.ss_size = MONO_ARCH_SIGNAL_STACK_SIZE;
+       sa.ss_flags = SS_DISABLE;
+       err = sigaltstack  (&sa, NULL);
+       g_assert (err == 0);
+
+       if (tls->signal_stack)
+               munmap (tls->signal_stack, MONO_ARCH_SIGNAL_STACK_SIZE);
+}
+
+#endif /* MONO_ARCH_SIGSEGV_ON_ALTSTACK */
index 09daee08499a28371ae72c0f1f8de3a8d9645f6b..09b1227834301f9c6d5d1a4af24f6061aa6c82dd 100644 (file)
@@ -54,8 +54,6 @@ static const char*const * ins_spec = ia64_desc;
  * ia64_codegen_set_one_ins_per_bundle () at those places.
  */
 
-#define SIGNAL_STACK_SIZE (64 * 1024)
-
 #define ARGS_OFFSET 16
 
 #define GP_SCRATCH_REG 31
@@ -589,6 +587,7 @@ is_regsize_var (MonoType *t) {
        case MONO_TYPE_U:
        case MONO_TYPE_PTR:
        case MONO_TYPE_FNPTR:
+       case MONO_TYPE_BOOLEAN:
                return TRUE;
        case MONO_TYPE_OBJECT:
        case MONO_TYPE_STRING:
@@ -682,7 +681,7 @@ mono_ia64_alloc_stacked_registers (MonoCompile *cfg)
 
        cfg->arch.reg_in0 = 32;
        cfg->arch.reg_local0 = cfg->arch.reg_in0 + cinfo->reg_usage + reserved_regs;
-       cfg->arch.reg_out0 = cfg->arch.reg_local0 + 8;
+       cfg->arch.reg_out0 = cfg->arch.reg_local0 + 16;
 
        cfg->arch.reg_saved_ar_pfs = cfg->arch.reg_local0 - 1;
        cfg->arch.reg_saved_b0 = cfg->arch.reg_local0 - 2;
@@ -1233,7 +1232,6 @@ peephole_pass (MonoCompile *cfg, MonoBasicBlock *bb)
                switch (ins->opcode) {
                case OP_MOVE:
                case OP_FMOVE:
-               case OP_SETREG:
                        /*
                         * Removes:
                         *
@@ -1592,6 +1590,29 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb)
                                temp2->dreg = mono_regstate_next_int (cfg->rs);
                        }
 
+                       ins->inst_offset = 0;
+                       ins->inst_basereg = temp2->dreg;
+                       break;
+               case OP_IA64_FETCHADD4_IMM:
+               case OP_IA64_FETCHADD8_IMM:
+               case OP_ATOMIC_EXCHANGE_I4:
+               case OP_ATOMIC_EXCHANGE_I8:
+                       /* There are no membase instructions on ia64 */
+                       if (ia64_is_imm14 (ins->inst_offset)) {
+                               NEW_INS (cfg, temp2, OP_ADD_IMM);
+                               temp2->sreg1 = ins->inst_basereg;
+                               temp2->inst_imm = ins->inst_offset;
+                               temp2->dreg = mono_regstate_next_int (cfg->rs);
+                       }
+                       else {
+                               NEW_INS (cfg, temp, OP_I8CONST);
+                               temp->inst_c0 = ins->inst_offset;
+                               temp->dreg = mono_regstate_next_int (cfg->rs);
+                               NEW_INS (cfg, temp2, CEE_ADD);
+                               temp2->sreg1 = ins->inst_basereg;
+                               temp2->sreg2 = temp->dreg;
+                               temp2->dreg = mono_regstate_next_int (cfg->rs);
+                       }
                        ins->inst_offset = 0;
                        ins->inst_basereg = temp2->dreg;
                        break;
@@ -1612,6 +1633,11 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb)
                        gboolean is_imm = FALSE;
                        gboolean switched = FALSE;
 
+                       if (ins->opcode == OP_AND_IMM && ins->inst_imm == 255) {
+                               ins->opcode = OP_ZEXT_I1;
+                               break;
+                       }
+
                        switch (ins->opcode) {
                        case OP_ADD_IMM:
                        case OP_IADD_IMM:
@@ -1883,10 +1909,11 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb)
                        break;
                }
                case OP_MUL_IMM:
+               case OP_LMUL_IMM:
                case OP_IMUL_IMM: {
                        int i, sum_reg;
                        gboolean found = FALSE;
-                       int shl_op = ins->opcode == OP_MUL_IMM ? OP_SHL_IMM : OP_ISHL_IMM;
+                       int shl_op = ins->opcode == OP_IMUL_IMM ? OP_ISHL_IMM : OP_SHL_IMM;
 
                        /* First the easy cases */
                        if (ins->inst_imm == 1) {
@@ -2697,8 +2724,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        ia64_br_cond_pred (code, 6, 0);
                        break;
                case OP_IA64_CSET:
-                       /* FIXME: Do this with one instruction ? */
-                       ia64_mov (code, ins->dreg, IA64_R0);
+                       ia64_mov_pred (code, 7, ins->dreg, IA64_R0);
+                       ia64_no_stop (code);
                        ia64_add1_pred (code, 6, ins->dreg, IA64_R0, IA64_R0);
                        break;
                case CEE_CONV_I1:
@@ -2962,10 +2989,15 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
 
                        break;
                }
+               case CEE_BREAK:
+                       code = emit_call (cfg, code, MONO_PATCH_INFO_ABS, mono_arch_break);
+                       break;
 
                case OP_LOCALLOC: {
                        gint32 abi_offset;
 
+                       /* FIXME: Sigaltstack support */
+
                        /* keep alignment */
                        ia64_adds_imm (code, GP_SCRATCH_REG, MONO_ARCH_FRAME_ALIGNMENT - 1, ins->sreg1);
                        ia64_movl (code, GP_SCRATCH_REG2, ~(MONO_ARCH_FRAME_ALIGNMENT - 1));
@@ -3007,6 +3039,28 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        ia64_ld8 (code, ins->dreg, ins->dreg);
                        break;
 
+                       /* Synchronization */
+               case OP_MEMORY_BARRIER:
+                       ia64_mf (code);
+                       break;
+               case OP_IA64_FETCHADD4_IMM:
+                       g_assert (ins->inst_offset == 0);
+                       ia64_fetchadd4_acq_hint (code, ins->dreg, ins->inst_basereg, ins->inst_imm, 0);
+                       ia64_adds_imm (code, ins->dreg, ins->inst_imm, ins->dreg);
+                       break;
+               case OP_IA64_FETCHADD8_IMM:
+                       g_assert (ins->inst_offset == 0);
+                       ia64_fetchadd8_acq_hint (code, ins->dreg, ins->inst_basereg, ins->inst_imm, 0);
+                       ia64_adds_imm (code, ins->dreg, ins->inst_imm, ins->dreg);
+                       break;
+               case OP_ATOMIC_EXCHANGE_I4:
+                       ia64_xchg4_hint (code, ins->dreg, ins->inst_basereg, ins->sreg2, 0);
+                       ia64_sxt4 (code, ins->dreg, ins->dreg);
+                       break;
+               case OP_ATOMIC_EXCHANGE_I8:
+                       ia64_xchg8_hint (code, ins->dreg, ins->inst_basereg, ins->sreg2, 0);
+                       break;
+
                        /* Exception handling */
                case OP_CALL_HANDLER:
                        /*
@@ -3224,57 +3278,21 @@ static guint64 nops_for_ins_types [6] = {
 #endif
 
 static void
-ia64_emit_bundle_manual (Ia64CodegenState *code)
-{
-       int j, ins_type, template;
-
-       if (code->nins == 0)
-               return;
-
-       g_assert (code->nins == 3 || ((code->nins == 2) && code->itypes [1] == IA64_INS_TYPE_LX));
-
-       /* Verify template is correct */
-       template = code->template;
-       for (j = 0; j < 3; ++j) {
-               if (code->stops [j])
-                       g_assert (stops_in_template [template]);
-
-               ins_type = ins_types_in_template [template][j];
-               switch (code->itypes [j]) {
-               case IA64_INS_TYPE_A:
-                       g_assert ((ins_type == IA64_INS_TYPE_I) || (ins_type == IA64_INS_TYPE_M));
-                       break;
-               case IA64_INS_TYPE_LX:
-                       g_assert (j == 1);
-                       g_assert (ins_type == IA64_INS_TYPE_LX);
-                       j ++;
-                       break;
-               default:
-                       g_assert (ins_type == code->itypes [j]);
-               }
-       }
-
-       ia64_emit_bundle_template (code, template, code->instructions [0], code->instructions [1], code->instructions [2]);
-       code->template = 0;
-       code->nins = 0;
-       code->dep_info_pos = 0;
-}
-
-static void
-ia64_analyze_deps (Ia64CodegenState *code, int *deps_start)
+ia64_analyze_deps (Ia64CodegenState *code, int *deps_start, int *stops)
 {
        int i, pos, ins_index, current_deps_start, current_ins_start, reg;
        guint8 *deps = code->dep_info;
-       gboolean need_stop;
+       gboolean need_stop, no_stop;
 
        for (i = 0; i < code->nins; ++i)
-               code->stops [i] = FALSE;
+               stops [i] = FALSE;
        
        ins_index = 0;
        current_deps_start = 0;
        current_ins_start = 0;
        deps_start [ins_index] = current_ins_start;
        pos = 0;
+       no_stop = FALSE;
        DEBUG_INS_SCHED (printf ("BEGIN.\n"));
        while (pos < code->dep_info_pos) {
                need_stop = FALSE;
@@ -3283,6 +3301,7 @@ ia64_analyze_deps (Ia64CodegenState *code, int *deps_start)
                        ins_index ++;
                        current_ins_start = pos + 2;
                        deps_start [ins_index] = current_ins_start;
+                       no_stop = FALSE;
                        DEBUG_INS_SCHED (printf ("(%d) END INS.\n", ins_index - 1));
                        break;
                case IA64_NONE:
@@ -3308,7 +3327,7 @@ ia64_analyze_deps (Ia64CodegenState *code, int *deps_start)
 
                        DEBUG_INS_SCHED (printf ("READ PR: %d\n", reg));
                        for (i = current_deps_start; i < current_ins_start; i += 2)
-                               if (deps [i] == IA64_WRITE_PR && deps [i + 1] == reg)
+                               if (((deps [i] == IA64_WRITE_PR) || (deps [i] == IA64_WRITE_PR_FLOAT)) && deps [i + 1] == reg)
                                        need_stop = TRUE;
                        break;
                case IA64_READ_PR_BRANCH:
@@ -3390,14 +3409,22 @@ ia64_analyze_deps (Ia64CodegenState *code, int *deps_start)
                                if (deps [i] == IA64_WRITE_AR && deps [i + 1] == reg)
                                        need_stop = TRUE;
                        break;
+               case IA64_NO_STOP:
+                       /* 
+                        * Explicitly indicate that a stop is not required. Useful for
+                        * example when two predicated instructions with negated predicates
+                        * write the same registers.
+                        */
+                       no_stop = TRUE;
+                       break;
                default:
                        g_assert_not_reached ();
                }
                pos += 2;
 
-               if (need_stop) {
+               if (need_stop && !no_stop) {
                        g_assert (ins_index > 0);
-                       code->stops [ins_index - 1] = 1;
+                       stops [ins_index - 1] = 1;
 
                        DEBUG_INS_SCHED (printf ("STOP\n"));
                        current_deps_start = current_ins_start;
@@ -3410,14 +3437,14 @@ ia64_analyze_deps (Ia64CodegenState *code, int *deps_start)
 
        if (code->nins > 0) {
                /* No dependency info for the last instruction */
-               code->stops [code->nins - 1] = 1;
+               stops [code->nins - 1] = 1;
        }
 
        deps_start [code->nins] = code->dep_info_pos;
 }
 
 static void
-ia64_real_emit_bundle (Ia64CodegenState *code, int *deps_start, int n, guint64 template, guint64 ins1, guint64 ins2, guint64 ins3, guint8 nops)
+ia64_real_emit_bundle (Ia64CodegenState *code, int *deps_start, int *stops, int n, guint64 template, guint64 ins1, guint64 ins2, guint64 ins3, guint8 nops)
 {
        g_assert (n <= code->nins);
        int stop_pos, i, deps_to_shift, dep_shift;
@@ -3456,6 +3483,30 @@ ia64_real_emit_bundle (Ia64CodegenState *code, int *deps_start, int n, guint64 t
        for (i = 0; i < code->nins + 1 - n; ++i)
                deps_start [i] = deps_start [n + i] - dep_shift;
 
+       /* Determine the exact positions of instructions with unwind ops */
+       if (code->unw_op_count) {
+               int ins_pos [16];
+               int curr_ins, curr_ins_pos;
+
+               curr_ins = 0;
+               curr_ins_pos = ((code->buf - code->region_start - 16) / 16) * 3;
+               for (i = 0; i < 3; ++i) {
+                       if (! (nops & (1 << i))) {
+                               ins_pos [curr_ins] = curr_ins_pos + i;
+                               curr_ins ++;
+                       }
+               }
+
+               for (i = code->unw_op_pos; i < code->unw_op_count; ++i) {
+                       if (code->unw_ops_pos [i] < n) {
+                               code->unw_ops [i].when = ins_pos [code->unw_ops_pos [i]];
+                               //printf ("UNW-OP: %d -> %d\n", code->unw_ops_pos [i], code->unw_ops [i].when);
+                       }
+               }
+               if (code->unw_op_pos < code->unw_op_count)
+                       code->unw_op_pos += n;
+       }
+
        if (n == code->nins) {
                code->template = 0;
                code->nins = 0;
@@ -3463,7 +3514,7 @@ ia64_real_emit_bundle (Ia64CodegenState *code, int *deps_start, int n, guint64 t
        else {
                memcpy (&code->instructions [0], &code->instructions [n], (code->nins - n) * sizeof (guint64));
                memcpy (&code->itypes [0], &code->itypes [n], (code->nins - n) * sizeof (int));
-               memcpy (&code->stops [0], &code->stops [n], (code->nins - n) * sizeof (int));
+               memcpy (&stops [0], &stops [n], (code->nins - n) * sizeof (int));
                code->nins -= n;
        }
 }
@@ -3473,26 +3524,21 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
 {
        int i, ins_type, template, nins_to_emit;
        int deps_start [16];
+       int stops [16];
        gboolean found;
 
-       if (!code->automatic) {
-               ia64_emit_bundle_manual (code);
-               return;
-       }
-
        /*
         * We implement a simple scheduler which tries to put three instructions 
         * per bundle, then two, then one.
         */
-
-       ia64_analyze_deps (code, deps_start);
+       ia64_analyze_deps (code, deps_start, stops);
 
        if ((code->nins >= 3) && !code->one_ins_per_bundle) {
                /* Find a suitable template */
                for (template = 0; template < 32; ++template) {
-                       if (stops_in_template [template][0] != code->stops [0] ||
-                               stops_in_template [template][1] != code->stops [1] ||
-                               stops_in_template [template][2] != code->stops [2])
+                       if (stops_in_template [template][0] != stops [0] ||
+                               stops_in_template [template][1] != stops [1] ||
+                               stops_in_template [template][2] != stops [2])
                                continue;
 
                        found = TRUE;
@@ -3512,7 +3558,7 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
                                found = debug_ins_sched ();
 
                        if (found) {
-                               ia64_real_emit_bundle (code, deps_start, 3, template, code->instructions [0], code->instructions [1], code->instructions [2], 0);
+                               ia64_real_emit_bundle (code, deps_start, stops, 3, template, code->instructions [0], code->instructions [1], code->instructions [2], 0);
                                break;
                        }
                }
@@ -3526,9 +3572,9 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
        if ((code->nins >= 2) && !code->one_ins_per_bundle) {
                /* Try a nop at the end */
                for (template = 0; template < 32; ++template) {
-                       if (stops_in_template [template][0] != code->stops [0] ||
-                               ((stops_in_template [template][1] != code->stops [1]) &&
-                                (stops_in_template [template][2] != code->stops [1])))
+                       if (stops_in_template [template][0] != stops [0] ||
+                               ((stops_in_template [template][1] != stops [1]) &&
+                                (stops_in_template [template][2] != stops [1])))
                                 
                                continue;
 
@@ -3539,7 +3585,7 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
                        if (!debug_ins_sched ())
                                continue;
 
-                       ia64_real_emit_bundle (code, deps_start, 2, template, code->instructions [0], code->instructions [1], nops_for_ins_types [ins_types_in_template [template][2]], 1 << 2);
+                       ia64_real_emit_bundle (code, deps_start, stops, 2, template, code->instructions [0], code->instructions [1], nops_for_ins_types [ins_types_in_template [template][2]], 1 << 2);
                        break;
                }
        }
@@ -3551,9 +3597,9 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
        if ((code->nins >= 2) && !code->one_ins_per_bundle) {
                /* Try a nop in the middle */
                for (template = 0; template < 32; ++template) {
-                       if (((stops_in_template [template][0] != code->stops [0]) &&
-                                (stops_in_template [template][1] != code->stops [0])) ||
-                               stops_in_template [template][2] != code->stops [1])
+                       if (((stops_in_template [template][0] != stops [0]) &&
+                                (stops_in_template [template][1] != stops [0])) ||
+                               stops_in_template [template][2] != stops [1])
                                continue;
 
                        if (!ITYPE_MATCH (ins_types_in_template [template][0], code->itypes [0]) ||
@@ -3563,7 +3609,7 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
                        if (!debug_ins_sched ())
                                continue;
 
-                       ia64_real_emit_bundle (code, deps_start, 2, template, code->instructions [0], nops_for_ins_types [ins_types_in_template [template][1]], code->instructions [1], 1 << 1);
+                       ia64_real_emit_bundle (code, deps_start, stops, 2, template, code->instructions [0], nops_for_ins_types [ins_types_in_template [template][1]], code->instructions [1], 1 << 1);
                        break;
                }
        }
@@ -3571,8 +3617,8 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
        if ((code->nins >= 2) && flush && !code->one_ins_per_bundle) {
                /* Try a nop at the beginning */
                for (template = 0; template < 32; ++template) {
-                       if ((stops_in_template [template][1] != code->stops [0]) ||
-                               (stops_in_template [template][2] != code->stops [1]))
+                       if ((stops_in_template [template][1] != stops [0]) ||
+                               (stops_in_template [template][2] != stops [1]))
                                continue;
 
                        if (!ITYPE_MATCH (ins_types_in_template [template][1], code->itypes [0]) ||
@@ -3582,7 +3628,7 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
                        if (!debug_ins_sched ())
                                continue;
 
-                       ia64_real_emit_bundle (code, deps_start, 2, template, nops_for_ins_types [ins_types_in_template [template][0]], code->instructions [0], code->instructions [1], 1 << 0);
+                       ia64_real_emit_bundle (code, deps_start, stops, 2, template, nops_for_ins_types [ins_types_in_template [template][0]], code->instructions [0], code->instructions [1], 1 << 0);
                        break;
                }
        }
@@ -3598,43 +3644,43 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
 
        while (nins_to_emit > 0) {
                if (!debug_ins_sched ())
-                       code->stops [0] = 1;
+                       stops [0] = 1;
                switch (code->itypes [0]) {
                case IA64_INS_TYPE_A:
-                       if (code->stops [0])
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MIIS, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
+                       if (stops [0])
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MIIS, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
                        else
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MII, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MII, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
                        break;
                case IA64_INS_TYPE_I:
-                       if (code->stops [0])
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MIIS, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
+                       if (stops [0])
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MIIS, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
                        else
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MII, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MII, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
                        break;
                case IA64_INS_TYPE_M:
-                       if (code->stops [0])
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MIIS, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
+                       if (stops [0])
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MIIS, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
                        else
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MII, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MII, code->instructions [0], IA64_NOP_I, IA64_NOP_I, 0);
                        break;
                case IA64_INS_TYPE_B:
-                       if (code->stops [0])
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MIBS, IA64_NOP_M, IA64_NOP_I, code->instructions [0], 0);
+                       if (stops [0])
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MIBS, IA64_NOP_M, IA64_NOP_I, code->instructions [0], 0);
                        else
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MIB, IA64_NOP_M, IA64_NOP_I, code->instructions [0], 0);
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MIB, IA64_NOP_M, IA64_NOP_I, code->instructions [0], 0);
                        break;
                case IA64_INS_TYPE_F:
-                       if (code->stops [0])
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MFIS, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
+                       if (stops [0])
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MFIS, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
                        else
-                               ia64_real_emit_bundle (code, deps_start, 1, IA64_TEMPLATE_MFI, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
+                               ia64_real_emit_bundle (code, deps_start, stops, 1, IA64_TEMPLATE_MFI, IA64_NOP_M, code->instructions [0], IA64_NOP_I, 0);
                        break;
                case IA64_INS_TYPE_LX:
-                       if (code->stops [0] || code->stops [1])
-                               ia64_real_emit_bundle (code, deps_start, 2, IA64_TEMPLATE_MLXS, IA64_NOP_M, code->instructions [0], code->instructions [1], 0);
+                       if (stops [0] || stops [1])
+                               ia64_real_emit_bundle (code, deps_start, stops, 2, IA64_TEMPLATE_MLXS, IA64_NOP_M, code->instructions [0], code->instructions [1], 0);
                        else
-                               ia64_real_emit_bundle (code, deps_start, 2, IA64_TEMPLATE_MLX, IA64_NOP_M, code->instructions [0], code->instructions [1], 0);
+                               ia64_real_emit_bundle (code, deps_start, stops, 2, IA64_TEMPLATE_MLX, IA64_NOP_M, code->instructions [0], code->instructions [1], 0);
                        nins_to_emit --;
                        break;
                default:
@@ -3644,6 +3690,22 @@ ia64_emit_bundle (Ia64CodegenState *code, gboolean flush)
        }
 }
 
+unw_dyn_region_info_t*
+mono_ia64_create_unwind_region (Ia64CodegenState *code)
+{
+       unw_dyn_region_info_t *r;
+
+       g_assert (code->nins == 0);
+       r = g_malloc0 (_U_dyn_region_info_size (code->unw_op_count));
+       memcpy (&r->op, &code->unw_ops, sizeof (unw_dyn_op_t) * code->unw_op_count);
+       r->op_count = code->unw_op_count;
+       r->insn_count = ((code->buf - code->region_start) >> 4) * 3;
+       code->unw_op_count = 0;
+       code->unw_op_pos = 0;
+       code->region_start = code->buf;
+
+       return r;
+}
 
 static void 
 ia64_patch (unsigned char* code, gpointer target)
@@ -3783,8 +3845,6 @@ mono_arch_emit_prolog (MonoCompile *cfg)
        int alloc_size, pos, i;
        Ia64CodegenState code;
        CallInfo *cinfo;
-       unw_dyn_region_info_t *r_pro;
-       int unw_op_count;
        
        sig = mono_method_signature (method);
        pos = 0;
@@ -3801,7 +3861,6 @@ mono_arch_emit_prolog (MonoCompile *cfg)
        cfg->native_code = g_malloc (cfg->code_size);
 
        ia64_codegen_init (code, cfg->native_code);
-       ia64_codegen_set_automatic (code, FALSE);
 
        alloc_size = ALIGN_TO (cfg->stack_offset, MONO_ARCH_FRAME_ALIGNMENT);
        if (cfg->param_area)
@@ -3825,63 +3884,51 @@ mono_arch_emit_prolog (MonoCompile *cfg)
 
        alloc_size -= pos;
 
-       /* Initialize unwind info */
-       r_pro = g_malloc0 (_U_dyn_region_info_size (3));
-       unw_op_count = 0;
-
-       ia64_begin_bundle_template (code, IA64_TEMPLATE_MIIS);
+       ia64_unw_save_reg (code, UNW_IA64_AR_PFS, UNW_IA64_GR + cfg->arch.reg_saved_ar_pfs);
        ia64_alloc (code, cfg->arch.reg_saved_ar_pfs, cfg->arch.reg_local0 - cfg->arch.reg_in0, cfg->arch.reg_out0 - cfg->arch.reg_local0, cfg->arch.n_out_regs, 0);
+       ia64_unw_save_reg (code, UNW_IA64_RP, UNW_IA64_GR + cfg->arch.reg_saved_b0);
        ia64_mov_from_br (code, cfg->arch.reg_saved_b0, IA64_B0);
 
-       _U_dyn_op_save_reg (&r_pro->op[unw_op_count++], _U_QP_TRUE, /* when=*/ 0,
-                                               /* reg=*/ UNW_IA64_AR_PFS, /* dst=*/ UNW_IA64_GR + cfg->arch.reg_saved_ar_pfs);
-       _U_dyn_op_save_reg (&r_pro->op[unw_op_count++], _U_QP_TRUE, /* when=*/ 1,
-                                               /* reg=*/ UNW_IA64_RP, /* dst=*/ UNW_IA64_GR + cfg->arch.reg_saved_b0);
-
        if ((alloc_size || cinfo->stack_usage) && !cfg->arch.omit_fp) {
+               ia64_unw_save_reg (code, UNW_IA64_SP, UNW_IA64_GR + cfg->frame_reg);
                ia64_mov (code, cfg->frame_reg, IA64_SP);
-               _U_dyn_op_save_reg (&r_pro->op[unw_op_count++], _U_QP_TRUE, /* when=*/ 2,
-                                                       /* reg=*/ UNW_IA64_SP, /* dst=*/ UNW_IA64_GR + cfg->frame_reg);
        }
-       else {
-               if (cfg->arch.omit_fp && alloc_size && ia64_is_imm14 (-alloc_size)) {
-                       /* FIXME: Add unwind info */
-                       ia64_adds_imm (code, IA64_SP, (-alloc_size), IA64_SP);
-               }
-               else
-                       ia64_nop_i (code, 0);
-       }
-       ia64_stop (code);
-       ia64_begin_bundle (code);
-
-       /* Finish unwind info */
-       r_pro->op_count = unw_op_count;
-       r_pro->insn_count = (code.buf - cfg->native_code) >> 4;
-
-       cfg->arch.r_pro = r_pro;
-
-       ia64_codegen_set_automatic (code, TRUE);
 
        if (alloc_size) {
-               /* See mono_emit_stack_alloc */
-#if defined(MONO_ARCH_SIGSEGV_ON_ALTSTACK)
-               NOT_IMPLEMENTED;
-#else
+               int pagesize = getpagesize ();
 
+#if defined(MONO_ARCH_SIGSEGV_ON_ALTSTACK)
+               if (alloc_size >= pagesize) {
+                       gint32 remaining_size = alloc_size;
+
+                       /* Generate stack touching code */
+                       ia64_mov (code, GP_SCRATCH_REG, IA64_SP);                       
+                       while (remaining_size >= pagesize) {
+                               ia64_movl (code, GP_SCRATCH_REG2, pagesize);
+                               ia64_sub (code, GP_SCRATCH_REG, GP_SCRATCH_REG, GP_SCRATCH_REG2);
+                               ia64_ld8 (code, GP_SCRATCH_REG2, GP_SCRATCH_REG);
+                               remaining_size -= pagesize;
+                       }
+               }
+#endif
                if (ia64_is_imm14 (-alloc_size)) {
                        if (cfg->arch.omit_fp)
-                               /* Already done */
-                               ;
-                       else
-                               ia64_adds_imm (code, IA64_SP, (-alloc_size), IA64_SP);
+                               ia64_unw_add (code, UNW_IA64_SP, (-alloc_size));
+                       ia64_adds_imm (code, IA64_SP, (-alloc_size), IA64_SP);
                }
                else {
-                       ia64_movl (code, GP_SCRATCH_REG, -alloc_size); ia64_stop (code);
+                       ia64_movl (code, GP_SCRATCH_REG, -alloc_size);
+                       if (cfg->arch.omit_fp)
+                               ia64_unw_add (code, UNW_IA64_SP, (-alloc_size));
                        ia64_add (code, IA64_SP, GP_SCRATCH_REG, IA64_SP);
                }
-#endif
        }
 
+       ia64_begin_bundle (code);
+
+       /* Initialize unwind info */
+       cfg->arch.r_pro = mono_ia64_create_unwind_region (&code);
+
        if (sig->ret->type != MONO_TYPE_VOID) {
                if ((cinfo->ret.storage == ArgInIReg) && (cfg->ret->opcode != OP_REGVAR)) {
                        /* Save volatile arguments to the stack */
@@ -3979,6 +4026,9 @@ mono_arch_emit_prolog (MonoCompile *cfg)
                /* No LMF on IA64 */
        }
 
+       if (strstr (cfg->method->name, "end_invoke_int_IAsyncResult"))
+               code = emit_call (cfg, code, MONO_PATCH_INFO_ABS, mono_arch_break);
+
        ia64_codegen_close (code);
 
        g_free (cinfo);
@@ -4065,43 +4115,37 @@ mono_arch_emit_epilog (MonoCompile *cfg)
        g_free (cinfo);
 
        ia64_begin_bundle (code);
-       ia64_codegen_set_automatic (code, FALSE);
-
-       if (cfg->arch.stack_alloc_size && cfg->arch.omit_fp && !ia64_is_imm14 (cfg->arch.stack_alloc_size)) {
-               ia64_begin_bundle_template (code, IA64_TEMPLATE_MLXS);
-               ia64_nop_m (code, 0);
-               ia64_movl (code, GP_SCRATCH_REG, cfg->arch.stack_alloc_size);
-               ia64_stop (code);
-               ia64_begin_bundle (code);
-       }
 
-       ia64_begin_bundle_template (code, IA64_TEMPLATE_MII);
+       code.region_start = cfg->native_code;
+
+       /* Label the unwind state at the start of the exception throwing region */
+       //ia64_unw_label_state (code, 1234);
+
        if (cfg->arch.stack_alloc_size) {
                if (cfg->arch.omit_fp) {
-                       if (ia64_is_imm14 (cfg->arch.stack_alloc_size))
+                       if (ia64_is_imm14 (cfg->arch.stack_alloc_size)) {
+                               ia64_unw_pop_frames (code, 1);
                                ia64_adds_imm (code, IA64_SP, (cfg->arch.stack_alloc_size), IA64_SP);
-                       else
+                       } else {
+                               ia64_movl (code, GP_SCRATCH_REG, cfg->arch.stack_alloc_size);
+                               ia64_unw_pop_frames (code, 1);
                                ia64_add (code, IA64_SP, GP_SCRATCH_REG, IA64_SP);
+                       }
                }
-               else
+               else {
+                       ia64_unw_pop_frames (code, 1);
                        ia64_mov (code, IA64_SP, cfg->arch.reg_saved_sp);
+               }
        }
-       else
-               /* FIXME: Optimize this away */
-               ia64_nop_m (code, 0);
        ia64_mov_to_ar_i (code, IA64_PFS, cfg->arch.reg_saved_ar_pfs);
        ia64_mov_ret_to_br (code, IA64_B0, cfg->arch.reg_saved_b0);
-       ia64_begin_bundle (code);
-
-       ia64_begin_bundle_template (code, IA64_TEMPLATE_BBBS);
        ia64_br_ret_reg (code, IA64_B0);
-       ia64_nop_b (code, 0);
-       ia64_nop_b (code, 0); ia64_stop (code);
-       ia64_begin_bundle (code);
 
-       ia64_codegen_set_automatic (code, TRUE);
        ia64_codegen_close (code);
 
+       cfg->arch.r_epilog = mono_ia64_create_unwind_region (&code);
+       cfg->arch.r_pro->next = cfg->arch.r_epilog;
+
        cfg->code_len = code.buf - cfg->native_code;
 
        g_assert (cfg->code_len < cfg->code_size);
@@ -4114,6 +4158,8 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
        int nthrows;
        Ia64CodegenState code;
        gboolean empty = TRUE;
+       //unw_dyn_region_info_t *r_exceptions;
+
        /*
        MonoClass *exc_classes [16];
        guint8 *exc_throw_start [16], *exc_throw_end [16];
@@ -4130,6 +4176,9 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
                        code_size += 4 + 7; /* sizeof (float) + alignment */
        }
 
+       if (code_size == 0)
+               return;
+
        while (cfg->code_len + code_size > (cfg->code_size - 16)) {
                cfg->code_size *= 2;
                cfg->native_code = g_realloc (cfg->native_code, cfg->code_size);
@@ -4138,6 +4187,9 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
 
        ia64_codegen_init (code, cfg->native_code + cfg->code_len);
 
+       /* The unwind state here is the same as before the epilog */
+       //ia64_unw_copy_state (code, 1234);
+
        /* add code to raise exceptions */
        /* FIXME: Optimize this */
        nthrows = 0;
@@ -4190,6 +4242,10 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
 
        ia64_codegen_close (code);
 
+       /* FIXME: */
+       //r_exceptions = mono_ia64_create_unwind_region (&code);
+       //cfg->arch.r_epilog = r_exceptions;
+
        cfg->code_len = code.buf - cfg->native_code;
 
        g_assert (cfg->code_len < cfg->code_size);
@@ -4218,38 +4274,42 @@ mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean ena
 
                stack_area = ALIGN_TO (n * 8, 16);
 
-               ia64_movl (code, GP_SCRATCH_REG, stack_area);
+               if (n) {
+                       ia64_movl (code, GP_SCRATCH_REG, stack_area);
 
-               ia64_sub (code, IA64_SP, IA64_SP, GP_SCRATCH_REG);
+                       ia64_sub (code, IA64_SP, IA64_SP, GP_SCRATCH_REG);
 
-               /* FIXME: Allocate out registers */
+                       /* FIXME: Allocate out registers */
 
-               ia64_mov (code, cfg->arch.reg_out0 + 1, IA64_SP);
+                       ia64_mov (code, cfg->arch.reg_out0 + 1, IA64_SP);
 
-               /* Required by the ABI */
-               ia64_adds_imm (code, IA64_SP, -16, IA64_SP);
+                       /* Required by the ABI */
+                       ia64_adds_imm (code, IA64_SP, -16, IA64_SP);
 
-               add_patch_info (cfg, code, MONO_PATCH_INFO_METHODCONST, cfg->method);
-               ia64_movl (code, cfg->arch.reg_out0 + 0, 0);
+                       add_patch_info (cfg, code, MONO_PATCH_INFO_METHODCONST, cfg->method);
+                       ia64_movl (code, cfg->arch.reg_out0 + 0, 0);
 
-               /* Save arguments to the stack */
-               for (i = 0; i < n; ++i) {
-                       ins = cfg->varinfo [i];
+                       /* Save arguments to the stack */
+                       for (i = 0; i < n; ++i) {
+                               ins = cfg->varinfo [i];
 
-                       if (ins->opcode == OP_REGVAR) {
-                               ia64_movl (code, GP_SCRATCH_REG, (i * 8));
-                               ia64_add (code, GP_SCRATCH_REG, cfg->arch.reg_out0 + 1, GP_SCRATCH_REG);
-                               ia64_st8 (code, GP_SCRATCH_REG, ins->dreg);
-                       }
-                       else {
-                               ia64_movl (code, GP_SCRATCH_REG, ins->inst_offset);
-                               ia64_add (code, GP_SCRATCH_REG, ins->inst_basereg, GP_SCRATCH_REG);
-                               ia64_ld8 (code, GP_SCRATCH_REG2, GP_SCRATCH_REG);
-                               ia64_movl (code, GP_SCRATCH_REG, (i * 8));                              
-                               ia64_add (code, GP_SCRATCH_REG, cfg->arch.reg_out0 + 1, GP_SCRATCH_REG);
-                               ia64_st8 (code, GP_SCRATCH_REG, GP_SCRATCH_REG2);
+                               if (ins->opcode == OP_REGVAR) {
+                                       ia64_movl (code, GP_SCRATCH_REG, (i * 8));
+                                       ia64_add (code, GP_SCRATCH_REG, cfg->arch.reg_out0 + 1, GP_SCRATCH_REG);
+                                       ia64_st8 (code, GP_SCRATCH_REG, ins->dreg);
+                               }
+                               else {
+                                       ia64_movl (code, GP_SCRATCH_REG, ins->inst_offset);
+                                       ia64_add (code, GP_SCRATCH_REG, ins->inst_basereg, GP_SCRATCH_REG);
+                                       ia64_ld8 (code, GP_SCRATCH_REG2, GP_SCRATCH_REG);
+                                       ia64_movl (code, GP_SCRATCH_REG, (i * 8));                              
+                                       ia64_add (code, GP_SCRATCH_REG, cfg->arch.reg_out0 + 1, GP_SCRATCH_REG);
+                                       ia64_st8 (code, GP_SCRATCH_REG, GP_SCRATCH_REG2);
+                               }
                        }
                }
+               else
+                       ia64_mov (code, cfg->arch.reg_out0 + 1, IA64_R0);
        }
        else
                ia64_mov (code, cfg->arch.reg_out0 + 1, IA64_R0);
@@ -4259,7 +4319,7 @@ mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean ena
 
        code = emit_call (cfg, code, MONO_PATCH_INFO_ABS, (gpointer)func);
 
-       if (enable_arguments) {
+       if (enable_arguments && stack_area) {
                ia64_movl (code, GP_SCRATCH_REG, stack_area);
 
                ia64_add (code, IA64_SP, IA64_SP, GP_SCRATCH_REG);
@@ -4356,6 +4416,18 @@ mono_arch_save_unwind_info (MonoCompile *cfg)
        di->u.pi.regions = cfg->arch.r_pro;
 
        _U_dyn_register (di);
+
+       /*
+       {
+               unw_dyn_region_info_t *region = di->u.pi.regions;
+
+               printf ("Unwind info for method %s:\n", mono_method_full_name (cfg->method, TRUE));
+               while (region) {
+                       printf ("    [Region: %d]\n", region->insn_count);
+                       region = region->next;
+               }
+       }
+       */
 }
 
 void
@@ -4488,16 +4560,6 @@ mono_arch_get_delegate_method_ptr_addr (guint8* code, gpointer *regs)
 
 static gboolean tls_offset_inited = FALSE;
 
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-
-static void
-setup_stack (MonoJitTlsData *tls)
-{
-       NOT_IMPLEMENTED;
-}
-
-#endif
-
 void
 mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
 {
@@ -4507,26 +4569,11 @@ mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
                appdomain_tls_offset = mono_domain_get_tls_offset ();
                thread_tls_offset = mono_thread_get_tls_offset ();
        }               
-
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-       setup_stack (tls);
-#endif
 }
 
 void
 mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
 {
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-       struct sigaltstack sa;
-
-       sa.ss_sp = tls->signal_stack;
-       sa.ss_size = SIGNAL_STACK_SIZE;
-       sa.ss_flags = SS_DISABLE;
-       sigaltstack  (&sa, NULL);
-
-       if (tls->signal_stack)
-               munmap (tls->signal_stack, SIGNAL_STACK_SIZE);
-#endif
 }
 
 void
@@ -4582,39 +4629,9 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethod
 {
        MonoInst *ins = NULL;
 
-       /* FIXME: */
-       return NULL;
-
-       if (cmethod->klass == mono_defaults.math_class) {
-               if (strcmp (cmethod->name, "Sin") == 0) {
-                       MONO_INST_NEW (cfg, ins, OP_SIN);
-                       ins->inst_i0 = args [0];
-               } else if (strcmp (cmethod->name, "Cos") == 0) {
-                       MONO_INST_NEW (cfg, ins, OP_COS);
-                       ins->inst_i0 = args [0];
-               } else if (strcmp (cmethod->name, "Tan") == 0) {
-                               return ins;
-                       MONO_INST_NEW (cfg, ins, OP_TAN);
-                       ins->inst_i0 = args [0];
-               } else if (strcmp (cmethod->name, "Atan") == 0) {
-                               return ins;
-                       MONO_INST_NEW (cfg, ins, OP_ATAN);
-                       ins->inst_i0 = args [0];
-               } else if (strcmp (cmethod->name, "Sqrt") == 0) {
-                       MONO_INST_NEW (cfg, ins, OP_SQRT);
-                       ins->inst_i0 = args [0];
-               } else if (strcmp (cmethod->name, "Abs") == 0 && fsig->params [0]->type == MONO_TYPE_R8) {
-                       MONO_INST_NEW (cfg, ins, OP_ABS);
-                       ins->inst_i0 = args [0];
-               }
-#if 0
-               /* OP_FREM is not IEEE compatible */
-               else if (strcmp (cmethod->name, "IEEERemainder") == 0) {
-                       MONO_INST_NEW (cfg, ins, OP_FREM);
-                       ins->inst_i0 = args [0];
-                       ins->inst_i1 = args [1];
-               }
-#endif
+       if (cmethod->klass == mono_defaults.thread_class &&
+               strcmp (cmethod->name, "MemoryBarrier") == 0) {
+               MONO_INST_NEW (cfg, ins, OP_MEMORY_BARRIER);
        } else if(cmethod->klass->image == mono_defaults.corlib &&
                           (strcmp (cmethod->klass->name_space, "System.Threading") == 0) &&
                           (strcmp (cmethod->klass->name, "Interlocked") == 0)) {
@@ -4631,7 +4648,7 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethod
                                g_assert_not_reached ();
                        MONO_INST_NEW (cfg, ins, opcode);
                        MONO_INST_NEW (cfg, ins_iconst, OP_ICONST);
-                       ins_iconst->inst_c0 = 1;
+                       ins_iconst->inst_imm = 1;
 
                        ins->inst_i0 = args [0];
                        ins->inst_i1 = ins_iconst;
@@ -4647,24 +4664,11 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethod
                                g_assert_not_reached ();
                        MONO_INST_NEW (cfg, ins, opcode);
                        MONO_INST_NEW (cfg, ins_iconst, OP_ICONST);
-                       ins_iconst->inst_c0 = -1;
+                       ins_iconst->inst_imm = -1;
 
                        ins->inst_i0 = args [0];
                        ins->inst_i1 = ins_iconst;
-               } else if (strcmp (cmethod->name, "Add") == 0) {
-                       guint32 opcode;
-
-                       if (fsig->params [0]->type == MONO_TYPE_I4)
-                               opcode = OP_ATOMIC_ADD_I4;
-                       else if (fsig->params [0]->type == MONO_TYPE_I8)
-                               opcode = OP_ATOMIC_ADD_I8;
-                       else
-                               g_assert_not_reached ();
-                       
-                       MONO_INST_NEW (cfg, ins, opcode);
-
-                       ins->inst_i0 = args [0];
-                       ins->inst_i1 = args [1];
+                       /* FIXME: */
                } else if (strcmp (cmethod->name, "Exchange") == 0) {
                        guint32 opcode;
 
@@ -4686,11 +4690,6 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethod
                        MONO_INST_NEW (cfg, ins, CEE_LDIND_I8);
                        ins->inst_i0 = args [0];
                }
-
-               /* 
-                * Can't implement CompareExchange methods this way since they have
-                * three arguments.
-                */
        }
 
        return ins;
index f7e95044532c7a485a9ea8e6d53c9d05fd1f585d..ee8879ccbda17c114c1003de0200e6f503e4c18b 100644 (file)
@@ -3,9 +3,6 @@
 
 #include <glib.h>
 
-#define UNW_LOCAL_ONLY
-#include <libunwind.h>
-
 #include <mono/arch/ia64/ia64-codegen.h>
 
 /* FIXME: regset -> 128 bits ! */
 #define MONO_ARCH_HAS_XP_LOCAL_REGALLOC
 
 /* r8..r11, r14..r29 */
-#define MONO_ARCH_CALLEE_REGS (0x700UL | 0x3fffc000UL)
+#define MONO_ARCH_CALLEE_REGS ((regmask_t)(0x700UL) | (regmask_t)(0x3fffc000UL))
 
 /* f6..f15, f33..f127 */
 /* FIXME: Use the upper 64 bits as well */
-#define MONO_ARCH_CALLEE_FREGS (0xfffffffe00000000UL | (0x3ffUL << 6))
+#define MONO_ARCH_CALLEE_FREGS ((regmask_t)(0xfffffffe00000000UL) | ((regmask_t)(0x3ffUL) << 6))
 
 #define MONO_ARCH_CALLEE_SAVED_REGS ~(MONO_ARCH_CALLEE_REGS)
 
@@ -37,6 +34,8 @@
 #define MONO_ARCH_INST_IS_REGPAIR(desc) FALSE
 #define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) (-1)
 
+#define MONO_ARCH_IS_GLOBAL_IREG(reg) (is_hard_ireg (reg) && ((reg) >= cfg->arch.reg_local0) && ((reg) < cfg->arch.reg_out0))
+
 #define MONO_ARCH_FRAME_ALIGNMENT 16
 
 #define MONO_ARCH_CODE_ALIGNMENT 16
@@ -44,6 +43,8 @@
 #define MONO_ARCH_RETREG1 IA64_R8
 #define MONO_ARCH_FRETREG1 8
 
+#define MONO_ARCH_SIGNAL_STACK_SIZE SIGSTKSZ
+
 struct MonoLMF {
        guint64    ebp;
 };
@@ -66,10 +67,11 @@ typedef struct MonoCompileArch {
        gint32 reg_saved_return_val;
        guint32 prolog_end_offset, epilog_begin_offset, epilog_end_offset;
        void *ret_var_addr_local;
-       unw_dyn_region_info_t *r_pro;
+       unw_dyn_region_info_t *r_pro, *r_epilog;
        void *last_bb;
        Ia64CodegenState code;
        gboolean omit_fp;
+       GHashTable *branch_targets;
 } MonoCompileArch;
 
 static inline unw_word_t
@@ -151,10 +153,10 @@ mono_ia64_context_get_fp (MonoContext *ctx)
 #define MONO_ARCH_USE_SIGACTION 1
 
 #ifdef HAVE_WORKING_SIGALTSTACK
-/* FIXME: */
-//#define MONO_ARCH_SIGSEGV_ON_ALTSTACK
+#define MONO_ARCH_SIGSEGV_ON_ALTSTACK
 #endif
 
+unw_dyn_region_info_t* mono_ia64_create_unwind_region (Ia64CodegenState *code);
 
 #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS 1
 #define MONO_ARCH_NO_EMULATE_MUL_IMM 1
index e521a48ca0951706c84066664fd46f7035feca2e..7bb66befb8557a1df750e72d9a0b21f4402e7f2a 100644 (file)
@@ -465,6 +465,7 @@ MINI_OP(OP_ATOMIC_ADD_NEW_I8, "atomic_add_new_i8")
 MINI_OP(OP_ATOMIC_ADD_IMM_I8, "atomic_add_imm_i8")
 MINI_OP(OP_ATOMIC_ADD_IMM_NEW_I8, "atomic_add_imm_new_i8")
 MINI_OP(OP_ATOMIC_EXCHANGE_I8, "atomic_exchange_i8")
+MINI_OP(OP_MEMORY_BARRIER, "memory_barrier")
 
 /* x86 specific */
 MINI_OP(OP_X86_TEST_NULL,          "x86_test_null")
@@ -641,3 +642,5 @@ MINI_OP(OP_IA64_LOADU4_MEMBASE_INC,"ia64_loadu4_membase_inc")
 MINI_OP(OP_IA64_LOADI8_MEMBASE_INC,"ia64_loadi8_membase_inc")
 MINI_OP(OP_IA64_LOADR4_MEMBASE_INC,"ia64_loadr4_membase_inc")
 MINI_OP(OP_IA64_LOADR8_MEMBASE_INC,"ia64_loadr8_membase_inc")
+MINI_OP(OP_IA64_FETCHADD4_IMM,   "ia64_fetchadd4_imm")
+MINI_OP(OP_IA64_FETCHADD8_IMM,   "ia64_fetchadd8_imm")
index b847659773cf0dc7f3798df395b5e98175ca83c2..96a1e181cc7b6b95fb33200e1376ee112285dff1 100644 (file)
 #include <string.h>
 #include <math.h>
 
-#ifndef PLATFORM_WIN32
-#include <unistd.h>
-#include <sys/mman.h>
-#endif
-
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/threads.h>
@@ -42,8 +37,6 @@ static gint thread_tls_offset = -1;
 #define CALLCONV_IS_STDCALL(sig) (((sig)->call_convention) == MONO_CALL_STDCALL)
 #endif
 
-#define SIGNAL_STACK_SIZE (64 * 1024)
-
 #define NOT_IMPLEMENTED g_assert_not_reached ()
 
 const char*
@@ -2928,6 +2921,10 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        code = emit_tls_get (code, ins->dreg, ins->inst_offset);
                        break;
                }
+               case OP_MEMORY_BARRIER: {
+                       /* Not needed on x86 */
+                       break;
+               }
                case OP_ATOMIC_ADD_I4: {
                        int dreg = ins->dreg;
 
@@ -3579,66 +3576,6 @@ mono_arch_flush_register_windows (void)
 {
 }
 
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-
-static void
-setup_stack (MonoJitTlsData *tls)
-{
-       pthread_t self = pthread_self();
-       pthread_attr_t attr;
-       size_t stsize = 0;
-       struct sigaltstack sa;
-       guint8 *staddr = NULL;
-       guint8 *current = (guint8*)&staddr;
-
-       if (mono_running_on_valgrind ())
-               return;
-
-       /* Determine stack boundaries */
-       pthread_attr_init( &attr );
-#ifdef HAVE_PTHREAD_GETATTR_NP
-       pthread_getattr_np( self, &attr );
-#else
-#ifdef HAVE_PTHREAD_ATTR_GET_NP
-       pthread_attr_get_np( self, &attr );
-#elif defined(sun)
-       pthread_attr_getstacksize( &attr, &stsize );
-#else
-#error "Not implemented"
-#endif
-#endif
-#ifndef sun
-       pthread_attr_getstack( &attr, (void**)&staddr, &stsize );
-#endif
-
-       g_assert (staddr);
-
-       g_assert ((current > staddr) && (current < staddr + stsize));
-
-       tls->end_of_stack = staddr + stsize;
-
-       /*
-        * threads created by nptl does not seem to have a guard page, and
-        * since the main thread is not created by us, we can't even set one.
-        * Increasing stsize fools the SIGSEGV signal handler into thinking this
-        * is a stack overflow exception.
-        */
-       tls->stack_size = stsize + getpagesize ();
-
-       /* Setup an alternate signal stack */
-       tls->signal_stack = mmap (0, SIGNAL_STACK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-       tls->signal_stack_size = SIGNAL_STACK_SIZE;
-
-       g_assert (tls->signal_stack);
-
-       sa.ss_sp = tls->signal_stack;
-       sa.ss_size = SIGNAL_STACK_SIZE;
-       sa.ss_flags = SS_ONSTACK;
-       sigaltstack (&sa, NULL);
-}
-
-#endif
-
 /*
  * Support for fast access to the thread-local lmf structure using the GS
  * segment register on NPTL + kernel 2.6.x.
@@ -3675,26 +3612,11 @@ mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
 #endif
                }
        }               
-
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-       setup_stack (tls);
-#endif
 }
 
 void
 mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
 {
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-       struct sigaltstack sa;
-
-       sa.ss_sp = tls->signal_stack;
-       sa.ss_size = SIGNAL_STACK_SIZE;
-       sa.ss_flags = SS_DISABLE;
-       sigaltstack  (&sa, NULL);
-
-       if (tls->signal_stack)
-               munmap (tls->signal_stack, SIGNAL_STACK_SIZE);
-#endif
 }
 
 void
@@ -3772,6 +3694,9 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethod
                        ins->inst_i1 = args [1];
                }
 #endif
+       } else if (cmethod->klass == mono_defaults.thread_class &&
+                          strcmp (cmethod->name, "MemoryBarrier") == 0) {
+               MONO_INST_NEW (cfg, ins, OP_MEMORY_BARRIER);
        } else if(cmethod->klass->image == mono_defaults.corlib &&
                           (strcmp (cmethod->klass->name_space, "System.Threading") == 0) &&
                           (strcmp (cmethod->klass->name, "Interlocked") == 0)) {
index 9cf13018f5df89973b983535717e83270f579a19..680197f2f09252670de1c7e65caac75ef9edf88f 100644 (file)
@@ -93,6 +93,8 @@ struct sigcontext {
 #endif /* HAVE_WORKING_SIGALTSTACK */
 #endif /* !PLATFORM_WIN32 */
 
+#define MONO_ARCH_SIGNAL_STACK_SIZE (64 * 1024)
+
 /* Enables OP_LSHL, OP_LSHL_IMM, OP_LSHR, OP_LSHR_IMM, OP_LSHR_UN, OP_LSHR_UN_IMM */
 #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS
 
index 323b8995a9ec60d87b0e2789ebc8dce1cc20a2bd..407b52b9c00f0600015c97e91ee232e017d9a84a 100644 (file)
@@ -48,6 +48,7 @@
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/monitor.h>
 #include <mono/metadata/security-manager.h>
+#include <mono/metadata/threads-types.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/os/gc_wrapper.h>
@@ -2800,6 +2801,38 @@ mono_find_jit_opcode_emulation (int opcode)
                return NULL;
 }
 
+static MonoException*
+mini_loader_error_to_exception (MonoLoaderError *error)
+{
+       MonoException *ex = NULL;
+
+       switch (error->kind) {
+       case MONO_LOADER_ERROR_TYPE: {
+               MonoString *class_name = mono_string_new (mono_domain_get (), error->class_name);
+               
+               ex = mono_get_exception_type_load (class_name, error->assembly_name);
+               break;
+       }
+       case MONO_LOADER_ERROR_METHOD:
+       case MONO_LOADER_ERROR_FIELD: {
+               char *class_name;
+               
+               class_name = g_strdup_printf ("%s%s%s", error->klass->name_space, *error->klass->name_space ? "." : "", error->klass->name);
+
+               if (error->kind == MONO_LOADER_ERROR_METHOD)
+                       ex = mono_get_exception_missing_method (class_name, error->member_name);
+               else
+                       ex = mono_get_exception_missing_field (class_name, error->member_name);
+               g_free (class_name);
+               break;
+       }
+       default:
+               g_assert_not_reached ();
+       }
+
+       return ex;
+}
+
 static MonoInst*
 mini_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
 {
@@ -2866,7 +2899,6 @@ mini_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSigna
        } else if (cmethod->klass == mono_defaults.thread_class) {
                if (strcmp (cmethod->name, "get_CurrentThread") == 0 && (ins = mono_arch_get_thread_intrinsic (cfg)))
                        return ins;
-               return NULL;
        }
 
        return mono_arch_get_inst_for_method (cfg, cmethod, fsig, args);
@@ -3153,12 +3185,26 @@ mini_get_method (MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericCont
 
        method = mono_get_method_full (m->klass->image, token, klass, context);
 
-       if (method->is_inflated)
+       if (method && method->is_inflated)
                method = mono_get_inflated_method (method);
 
        return method;
 }
 
+static inline MonoClass*
+mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
+{
+       MonoClass *klass;
+
+       if (method->wrapper_type != MONO_WRAPPER_NONE)
+               klass = mono_method_get_wrapper_data (method, token);
+       else
+               klass = mono_class_get_full (method->klass->image, token, context);
+       if (klass)
+               mono_class_init (klass);
+       return klass;
+}
+
 static
 void check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *callee, MonoBasicBlock *bblock, unsigned char *ip)
 {
@@ -3809,6 +3855,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        /* FIXME: check the signature matches */
                        cmethod = mini_get_method (method, token, NULL, generic_context);
 
+                       if (!cmethod)
+                               goto load_error;
+
                        if (mono_use_security_manager) {
                                check_linkdemand (cfg, method, cmethod, bblock, ip);
                        }
@@ -3850,7 +3899,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        cmethod = mini_get_method (method, token, NULL, generic_context);
                                }
 
-                               g_assert (cmethod);
+                               if (!cmethod)
+                                       goto load_error;
 
                                if (!virtual && (cmethod->flags & METHOD_ATTRIBUTE_ABSTRACT))
                                        /* MS.NET seems to silently convert this to a callvirt */
@@ -3895,7 +3945,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        }
 
                        if (cmethod && cmethod->klass->generic_container) {
-                               G_BREAKPOINT ();
+                               // G_BREAKPOINT ();
                                goto unverified;
                        }
 
@@ -3943,7 +3993,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        }
 
                        if (*ip != CEE_CALLI && check_call_signature (cfg, fsig, sp)) {
-                               G_BREAKPOINT ();
+                               // G_BREAKPOINT ();
                                goto unverified;
                        }
 
@@ -4428,6 +4478,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        ins->opcode = OP_IMUL_IMM;
                                        ins->inst_imm = ins->inst_right->inst_c0;
                                        break;
+                               case OP_LMUL:
+                                       ins->opcode = OP_LMUL_IMM;
+                                       ins->inst_imm = ins->inst_right->inst_c0;
+                                       break;
                                default:
                                        g_assert_not_reached ();
                                }
@@ -4543,12 +4597,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_OPSIZE (5);
                        CHECK_STACK (2);
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
                        sp -= 2;
                        if (MONO_TYPE_IS_REFERENCE (&klass->byval_arg)) {
                                MonoInst *store, *load;
@@ -4596,12 +4647,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_STACK (1);
                        --sp;
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
                        if (MONO_TYPE_IS_REFERENCE (&klass->byval_arg)) {
                                MONO_INST_NEW (cfg, ins, CEE_LDIND_REF);
                                ins->cil_code = ip;
@@ -4747,6 +4795,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
                        cmethod = mini_get_method (method, token, NULL, generic_context);
+                       if (!cmethod)
+                               goto load_error;
                        fsig = mono_method_get_signature (cmethod, image, token);
 
                        mono_class_init (cmethod->klass);
@@ -4849,11 +4899,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        --sp;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
 
                        /* Needed by the code generated in inssel.brg */
                        mono_get_got_var (cfg);
@@ -4907,11 +4955,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        --sp;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else 
-                               klass = mono_class_get_full (image, token, generic_context);
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
 
                        if (MONO_TYPE_IS_REFERENCE (&klass->byval_arg)) {
                                /* CASTCLASS */
@@ -5003,11 +5049,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        --sp;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else 
-                               klass = mono_class_get_full (image, token, generic_context);
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
 
                        /* Needed by the code generated in inssel.brg */
                        mono_get_got_var (cfg);
@@ -5034,11 +5078,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        --sp;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
 
                        /* Needed by the code generated in inssel.brg */
                        mono_get_got_var (cfg);
@@ -5122,6 +5164,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
                        field = mono_field_from_token (image, token, &klass, generic_context);
+                       if (!field)
+                               goto load_error;
                        mono_class_init (klass);
 
                        foffset = klass->valuetype? field->offset - sizeof (MonoObject): field->offset;
@@ -5264,6 +5308,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        token = read32 (ip + 1);
 
                        field = mono_field_from_token (image, token, &klass, generic_context);
+                       if (!field)
+                               goto load_error;
                        mono_class_init (klass);
 
                        g_assert (!(field->type->attrs & FIELD_ATTRIBUTE_LITERAL));
@@ -5439,11 +5485,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        sp -= 2;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
                        n = mono_type_to_stind (&klass->byval_arg);
                        if (n == CEE_STOBJ) {
                                handle_stobj (cfg, bblock, sp [0], sp [1], ip, klass, FALSE, FALSE);
@@ -5468,11 +5512,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        val = *sp;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
 
                        if (MONO_TYPE_IS_REFERENCE (&klass->byval_arg)) {
                                *sp++ = val;
@@ -5503,12 +5545,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        /* Ditto */
                        mono_get_got_var (cfg);
 
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       mono_class_init (klass);
+                       klass = mini_get_class (method, token, generic_context);
+                       if (!klass)
+                               goto load_error;
                        ins->inst_newa_class = klass;
                        ins->inst_newa_len = *sp;
                        ins->type = STACK_OBJ;
@@ -5545,11 +5584,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        sp -= 2;
                        CHECK_OPSIZE (5);
 
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass*)mono_method_get_wrapper_data (method, read32 (ip + 1));
-                       else
-                               klass = mono_class_get_full (image, read32 (ip + 1), generic_context);
-                       
+                       klass = mini_get_class (method, read32 (ip + 1), generic_context);
+                       if (!klass)
+                               goto load_error;                        
                        /* we need to make sure that this array is exactly the type it needs
                         * to be for correctness. the wrappers are lax with their usage
                         * so we need to ignore them here
@@ -5577,6 +5614,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
                        klass = mono_class_get_full (image, token, generic_context);
+                       if (!klass)
+                               goto load_error;
                        mono_class_init (klass);
                        NEW_LDELEMA (cfg, load, sp, klass);
                        load->cil_code = ip;
@@ -5658,6 +5697,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
                        klass = mono_class_get_full (image, token, generic_context);
+                       if (!klass)
+                               goto load_error;
                        mono_class_init (klass);
                        if (MONO_TYPE_IS_REFERENCE (&klass->byval_arg)) {
                                MonoMethod* helper = mono_marshal_get_stelemref ();
@@ -5748,6 +5789,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        --sp;
                        CHECK_OPSIZE (5);
                        klass = mono_class_get_full (image, read32 (ip + 1), generic_context);
+                       if (!klass)
+                               goto load_error;
                        mono_class_init (klass);
                        ins->type = STACK_MP;
                        ins->inst_left = *sp;
@@ -5765,6 +5808,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        --sp;
                        CHECK_OPSIZE (5);
                        klass = mono_class_get_full (image, read32 (ip + 1), generic_context);
+                       if (!klass)
+                               goto load_error;
                        mono_class_init (klass);
                        ins->cil_code = ip;
 
@@ -5797,6 +5842,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        else {
                                handle = mono_ldtoken (image, n, &handle_class, generic_context);
                        }
+                       if (!handle)
+                               goto load_error;
                        mono_class_init (handle_class);
 
                        if (cfg->opt & MONO_OPT_SHARED) {
@@ -6212,7 +6259,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                CHECK_OPSIZE (6);
                                n = read32 (ip + 2);
                                cmethod = mini_get_method (method, n, NULL, generic_context);
-
+                               if (!cmethod)
+                                       goto load_error;
                                mono_class_init (cmethod->klass);
 
                                if (mono_use_security_manager) {
@@ -6241,7 +6289,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                CHECK_OPSIZE (6);
                                n = read32 (ip + 2);
                                cmethod = mini_get_method (method, n, NULL, generic_context);
-
+                               if (!cmethod)
+                                       goto load_error;
                                mono_class_init (cmethod->klass);
 
                                if (mono_use_security_manager) {
@@ -6413,10 +6462,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                --sp;
                                CHECK_OPSIZE (6);
                                token = read32 (ip + 2);
-                               if (method->wrapper_type != MONO_WRAPPER_NONE)
-                                       klass = mono_method_get_wrapper_data (method, token);
-                               else
-                                       klass = mono_class_get_full (image, token, generic_context);
+                               klass = mini_get_class (method, token, generic_context);
+                               if (!klass)
+                                       goto load_error;
                                if (MONO_TYPE_IS_REFERENCE (&klass->byval_arg)) {
                                        MonoInst *store, *load;
                                        NEW_PCONST (cfg, load, NULL);
@@ -6439,6 +6487,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                CHECK_OPSIZE (6);
                                token = read32 (ip + 2);
                                constrained_call = mono_class_get_full (image, token, generic_context);
+                               if (!constrained_call)
+                                       goto load_error;
                                ip += 6;
                                break;
                        case CEE_CPBLK:
@@ -6517,9 +6567,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        MonoType *type = mono_type_create_from_typespec (image, token);
                                        token = mono_type_size (type, &align);
                                } else {
-                                       MonoClass *szclass = mono_class_get_full (image, token, generic_context);
-                                       mono_class_init (szclass);
-                                       token = mono_class_value_size (szclass, &align);
+                                       MonoClass *klass = mono_class_get_full (image, token, generic_context);
+                                       if (!klass)
+                                               goto load_error;
+                                       mono_class_init (klass);
+                                       token = mono_class_value_size (klass, &align);
                                }
                                NEW_ICONST (cfg, ins, token);
                                ins->cil_code = ip;
@@ -6656,6 +6708,13 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
        dont_inline = g_list_remove (dont_inline, method);
        return -1;
 
+ load_error:
+       if (cfg->method != method)
+               g_hash_table_destroy (bbhash);
+       g_slist_free (class_inits);
+       dont_inline = g_list_remove (dont_inline, method);
+       return -1;
+
  unverified:
        if (cfg->method != method) 
                g_hash_table_destroy (bbhash);
@@ -6849,6 +6908,17 @@ mono_init_trampolines (void)
 #endif
 }
 
+static void
+mono_init_exceptions (void)
+{
+#ifndef CUSTOM_EXCEPTION_HANDLING
+       mono_arch_get_restore_context ();
+       mono_arch_get_call_filter ();
+       mono_arch_get_throw_exception ();
+       mono_arch_get_rethrow_exception ();
+#endif
+}
+
 guint8 *
 mono_get_trampoline_code (MonoTrampolineType tramp_type)
 {
@@ -7543,6 +7613,10 @@ setup_jit_tls_data (gpointer stack_start, gpointer abort_func)
 
        mono_arch_setup_jit_tls_data (jit_tls);
 
+#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
+       mono_setup_altstack (jit_tls);
+#endif
+
        return jit_tls;
 }
 
@@ -7589,6 +7663,10 @@ mini_thread_cleanup (MonoThread *thread)
                g_free (jit_tls->first_lmf);
                g_free (jit_tls);
                thread->jit_data = NULL;
+
+#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
+               mono_free_altstack (jit_tls);
+#endif
        }
 }
 
@@ -9058,11 +9136,16 @@ MonoCompile*
 mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, gboolean run_cctors, gboolean compile_aot, int parts)
 {
        MonoMethodHeader *header = mono_method_get_header (method);
-       guint8 *ip = (guint8 *)header->code;
+       guint8 *ip;
        MonoCompile *cfg;
        MonoJitInfo *jinfo;
        int dfn = 0, i, code_size_ratio;
 
+       if (!header)
+               return NULL;
+
+       ip = (guint8 *)header->code;
+
        mono_jit_stats.methods_compiled++;
        if (mono_profiler_get_events () & MONO_PROFILE_JIT_COMPILATION)
                mono_profiler_method_jit (method);
@@ -9452,6 +9535,19 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain)
 
        cfg = mini_method_compile (method, opt, target_domain, TRUE, FALSE, 0);
 
+       if (!cfg) {
+               /* Throw a type load exception if needed */
+               MonoLoaderError *error = mono_loader_get_last_error ();
+
+               if (error) {
+                       MonoException *ex = mini_loader_error_to_exception (error);
+                       mono_loader_clear_error ();
+                       mono_raise_exception (ex);
+               }
+               else
+                       g_assert_not_reached ();
+       }
+
        mono_domain_lock (target_domain);
 
        /* Check if some other thread already did the job. In this case, we can
@@ -9860,6 +9956,7 @@ mono_runtime_install_handlers (void)
                add_signal_handler (SIGUSR2, sigusr2_signal_handler);
 
        add_signal_handler (mono_thread_get_abort_signal (), sigusr1_signal_handler);
+       signal (SIGPIPE, SIG_IGN);
 
        /* catch SIGSEGV */
 #ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
@@ -10027,6 +10124,8 @@ mini_init (const char *filename)
 
        mono_init_trampolines ();
 
+       mono_init_exceptions ();
+
        if (!g_thread_supported ())
                g_thread_init (NULL);
 
index 2d5c47003cde3dd85c6c17e598fadbf65ccf82a0..2ac0e254941dcc0df96f710dba799360e9035614 100644 (file)
@@ -844,6 +844,7 @@ void              mono_class_init_trampoline (gssize *regs, guint8 *code, MonoVT
 gboolean          mono_running_on_valgrind (void);
 void*             mono_global_codeman_reserve (int size);
 const char       *mono_regname_full (int reg, gboolean fp);
+gint32*           mono_allocate_stack_slots_full (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align);
 gint32*           mono_allocate_stack_slots (MonoCompile *cfg, guint32 *stack_size, guint32 *stack_align);
 void              mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb);
 
@@ -924,6 +925,8 @@ gpointer mono_arch_create_specific_trampoline   (gpointer arg1, MonoTrampolineTy
 gboolean mono_handle_exception                  (MonoContext *ctx, gpointer obj,
                                                 gpointer original_ip, gboolean test_only);
 void      mono_jit_walk_stack                   (MonoStackWalk func, gboolean do_il_offset, gpointer user_data);
+void     mono_setup_altstack                    (MonoJitTlsData *tls);
+void     mono_free_altstack                     (MonoJitTlsData *tls);
 
 /* the new function to do stack walks */
 typedef gboolean (*MonoStackFrameWalk)          (MonoDomain *domain, MonoContext *ctx, MonoJitInfo *ji, gpointer data);
index 42c5aa89e12b6fe7a3f342fadec06dd65e1c504b..6ba1203055eb6d4646e33c66b796631c85a32b10 100644 (file)
@@ -76,8 +76,11 @@ class Sample {
 [StructLayout ( LayoutKind.Explicit )]
 struct StructWithBigOffsets {
                [ FieldOffset(10000) ] public byte b;
+               [ FieldOffset(10001) ] public sbyte sb;
                [ FieldOffset(11000) ] public short s;
+               [ FieldOffset(11002) ] public ushort us;
                [ FieldOffset(12000) ] public uint i;
+               [ FieldOffset(12004) ] public int si;
                [ FieldOffset(13000) ] public long l;
                [ FieldOffset(14000) ] public float f;
                [ FieldOffset(15000) ] public double d;
@@ -290,15 +293,21 @@ class Tests {
                StructWithBigOffsets s2 = new StructWithBigOffsets ();
 
                s.b = 0xde;
+               s.sb = 0xe;
                s.s = 0x12de;
+               s.us = 0x12da;
                s.i = 0xdeadbeef;
+               s.si = 0xcafe;
                s.l = 0xcafebabe;
                s.f = 3.14F;
                s.d = 3.14;
 
                s2.b = s.b;
+               s2.sb = s.sb;
                s2.s = s.s;
+               s2.us = s.us;
                s2.i = s.i;
+               s2.si = s.si;
                s2.l = s.l;
                s2.f = s.f;
                s2.d = s.d;
@@ -315,6 +324,12 @@ class Tests {
                        return 5;
                if (s2.d != 3.14)
                        return 6;
+               if (s2.sb != 0xe)
+                       return 7;
+               if (s2.us != 0x12da)
+                       return 9;
+               if (s2.si != 0xcafe)
+                       return 10;
 
                return 0;
        }
index 708af1db4370dd25c3f6d634201e229e9c15ccdd..3a0676407a1d725ec9630a44b4d6f06aef393bfd 100644 (file)
@@ -60,8 +60,8 @@ mono_regstate_alloc_int (MonoRegState *rs, regmask_t allow)
        int i;
        regmask_t mask = allow & rs->ifree_mask;
        for (i = 0; i < MONO_MAX_IREGS; ++i) {
-               if (mask & (1 << i)) {
-                       rs->ifree_mask &= ~ (1 << i);
+               if (mask & ((regmask_t)1 << i)) {
+                       rs->ifree_mask &= ~ ((regmask_t)1 << i);
                        rs->max_ireg = MAX (rs->max_ireg, i);
                        return i;
                }
@@ -73,7 +73,7 @@ void
 mono_regstate_free_int (MonoRegState *rs, int reg)
 {
        if (reg >= 0) {
-               rs->ifree_mask |= 1 << reg;
+               rs->ifree_mask |= (regmask_t)1 << reg;
                rs->isymbolic [reg] = 0;
        }
 }
@@ -84,8 +84,8 @@ mono_regstate_alloc_float (MonoRegState *rs, regmask_t allow)
        int i;
        regmask_t mask = allow & rs->ffree_mask;
        for (i = 0; i < MONO_MAX_FREGS; ++i) {
-               if (mask & (1 << i)) {
-                       rs->ffree_mask &= ~ (1 << i);
+               if (mask & ((regmask_t)1 << i)) {
+                       rs->ffree_mask &= ~ ((regmask_t)1 << i);
                        return i;
                }
        }
@@ -96,7 +96,7 @@ void
 mono_regstate_free_float (MonoRegState *rs, int reg)
 {
        if (reg >= 0) {
-               rs->ffree_mask |= 1 << reg;
+               rs->ffree_mask |= (regmask_t)1 << reg;
                rs->fsymbolic [reg] = 0;
        }
 }
index 802ba82bb7356cb9bde7b0ca11e9264eb186eca2..02f10e630e9b66d1871e04b39a3b4c9e39d52a2f 100644 (file)
@@ -235,10 +235,7 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type)
        /* Save fp */
        amd64_mov_membase_reg (code, AMD64_RBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, ebp), AMD64_RBP, 8);
        /* Save method */
-       if (tramp_type == MONO_TRAMPOLINE_GENERIC)
-               amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, method_offset, 8);
-       else
-               amd64_mov_reg_imm (code, AMD64_R11, 0);
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, method_offset, 8);
        amd64_mov_membase_reg (code, AMD64_RBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, method), AMD64_R11, 8);
        /* Save callee saved regs */
        amd64_mov_membase_reg (code, AMD64_RBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, rbx), AMD64_RBX, 8);
index fd7e42d22a28cfc71105fc864635cf7b33b0f26e..4356e2502c40178f62e9e9a615ca41878d7d8e98 100644 (file)
@@ -230,7 +230,9 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type)
         * 16 locals
         * 4 output (number of parameters passed to trampoline)
         */
+       ia64_unw_save_reg (code, UNW_IA64_AR_PFS, UNW_IA64_GR + l5);
        ia64_alloc (code, l5, local0 - in0, out0 - local0, 4, 0);
+       ia64_unw_save_reg (code, UNW_IA64_SP, UNW_IA64_GR + l8);
        ia64_mov (code, l8, IA64_SP);
        ia64_adds_imm (code, IA64_SP, (-framesize), IA64_SP);
 
@@ -240,22 +242,12 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type)
        ia64_mov (code, l6, GP_SCRATCH_REG);
 
        /* Save the calling address */
+       ia64_unw_save_reg (code, UNW_IA64_RP, UNW_IA64_GR + local0 + 7);
        ia64_mov_from_br (code, l7, IA64_B0);
 
-       /* FIXME: Emit prolog/epilog manually */
-
        /* Create unwind info for the prolog */
-       r_pro = g_malloc0 (_U_dyn_region_info_size (3));
-       r_pro->op_count = 3;
-       r_pro->insn_count = 16;
-       i = 0;
-       _U_dyn_op_save_reg (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 2,
-                                               /* reg=*/ UNW_IA64_AR_PFS, /* dst=*/ UNW_IA64_GR + local0 + 5);
-       _U_dyn_op_save_reg (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 5,
-                                               /* reg=*/ UNW_IA64_SP, /* dst=*/ UNW_IA64_GR + local0 + 8);
-       _U_dyn_op_save_reg (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 14,
-                                               /* reg=*/ UNW_IA64_RP, /* dst=*/ UNW_IA64_GR + local0 + 7);
-       g_assert ((unsigned) i <= r_pro->op_count);     
+       ia64_begin_bundle (code);
+       r_pro = mono_ia64_create_unwind_region (&code);
 
        /* Save registers */
        /* Not needed for jump trampolines */
index 04babfb69530a0eda753cc5faf428a5a667700c4..b801f531bfe9ccb01d8e149173e87c85ab73aeda 100644 (file)
@@ -1,3 +1,31 @@
+2005-09-19  Zoltan Varga  <vargaz@gmail.com>
+
+       * custom-attr.cs: Add tests for bug #76062.
+
+       * test-driver Makefile.am: Fix detection of disabled tests.
+
+2005-09-16  Raja R Harinath  <rharinath@novell.com>
+
+       * Makefile.am (check-local): Don't invoke semdel-wrapper.
+
+2005-09-13  Raja R Harinath  <rharinath@novell.com>
+
+       * Makefile.am (test-type-load): Refer to source files using $(srcdir).
+       (EXTRA_DIST): Add sources from 'test-type-load'.
+
+2005-09-12  Zoltan Varga  <vargaz@gmail.com>
+
+       * pinvoke3.cs libtest.c: Add test for returning null arrays from delegates.
+
+       * pinvoke3.cs libtest.c: Add tests for bug #76063.
+
+2005-09-09  Zoltan Varga  <vargaz@gmail.com>
+
+       * load-exceptions.cs t-missing.cs load-missing.il: New files. Tests
+       for handling type load exceptions.
+
+       * Makefile.am: Add type loading tests.
+
 2005-08-27  Zoltan Varga  <vargaz@gmail.com>
 
        * libtest.c (mono_test_empty_struct): Work around bug in intel icc.
index e45043c8c4db8d0afa10eece4717a65ac23916f8..fc1593f08e8f9992c667fa291e1c0e5645659053 100644 (file)
@@ -1,6 +1,4 @@
-check-local:
-       ok=:; $(MAKE) test || ok=false; \
-       $(top_builddir)/runtime/semdel-wrapper || :; $$ok
+check-local: test
 
 TEST_PROG = ../interpreter/mint
 JITTEST_PROG = ../mini/mono
@@ -216,8 +214,8 @@ PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-ex
 endif
 
 DISABLED_TESTS=                        \
-       delegate-async-exception.cs     \
-       delegate-delegate-exception.cs  \
+       delegate-async-exception.exe    \
+       delegate-delegate-exception.exe \
        $(PLATFORM_DISABLED_TESTS)
 
 # These only compile with MS CSC
@@ -252,7 +250,7 @@ EXTRA_DIST=test-driver $(TEST_CS_SRC) $(TEST_IL_SRC) $(BENCHSRC) $(STRESS_TESTS_
 %.exe: %.cs TestDriver.dll
        $(CSC) -r:TestDriver.dll -out:$@ $<
 
-test:  testjit testbundle
+test:  testjit testbundle test-type-load
 
 TestDriver.dll:
        $(CSC) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs
@@ -383,6 +381,14 @@ testbundle: console.exe
        $(with_mono_path) ./a.out
        - rm -rf a.out
 
+EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
+test-type-load: TestDriver.dll
+       $(ILASM) /dll /output:load-missing.dll $(srcdir)/load-missing.il
+       $(CSC) /target:library /out:t.dll /d:FOUND $(srcdir)/t-missing.cs
+       $(CSC) /r:TestDriver.dll /r:load-missing.dll /r:t.dll /out:load-exceptions.exe $(srcdir)/load-exceptions.cs
+       $(CSC) /target:library /out:t.dll $(srcdir)/t-missing.cs
+       $(RUNTIME) load-exceptions.exe
+
 noinst_LTLIBRARIES = libtest.la
 
 INCLUDES = $(GLIB_CFLAGS)
index 7e8d50dd41d7a743a52d2b898e48f0469755f2a0..79b5fdf4bf38adc3ffd56486286b33e976f4fd5a 100644 (file)
@@ -32,6 +32,20 @@ namespace Test {
 
                public char[] Prop2;
        }
+
+       class XAttribute : Attribute {
+               public XAttribute () 
+               {
+                       throw new Exception ("X");
+               }
+       }
+
+       class ZAttribute : Attribute {
+       }
+
+       [X, Z, Serializable]
+       class Y {
+       }
                        
        [My("testclass")]
        [My2("testclass", 22)]
@@ -61,6 +75,24 @@ namespace Test {
                                        }
                                }
                        }
+
+                       //
+                       // Test that requesting a specific custom attributes does not
+                       // create all the others
+                       //
+
+                       typeof (Y).IsDefined (typeof (ZAttribute), true);
+                       typeof (Y).IsDefined (typeof (XAttribute), true);
+
+                       typeof (Y).GetCustomAttributes (typeof (ZAttribute), true);
+
+                       try {
+                               typeof (Y).GetCustomAttributes (true);
+                               return 4;
+                       }
+                       catch {
+                       }
+
                        return 0;
                }
        }
index 442039c6b2753945e0250254bd2047e0243c1e9a..f607730063f16acab18741f200ba27a0f119fffa 100644 (file)
@@ -1743,3 +1743,24 @@ mono_test_marshal_cdecl_delegate (CdeclDelegate del)
 
        return 0;
 }
+
+typedef char** (*ReturnStringArrayDelegate) (int i);
+
+STDCALL int
+mono_test_marshal_return_string_array_delegate (ReturnStringArrayDelegate d)
+{
+       char **arr = d (2);
+       int res;
+
+       if (arr == NULL)
+               return 3;
+
+       if (strcmp (arr [0], "ABC") || strcmp (arr [1], "DEF"))
+               res = 1;
+       else
+               res = 0;
+
+       marshal_free (arr);
+
+       return res;
+}
diff --git a/mono/tests/load-exceptions.cs b/mono/tests/load-exceptions.cs
new file mode 100644 (file)
index 0000000..b84c7b4
--- /dev/null
@@ -0,0 +1,219 @@
+//
+// load-exceptions.cs: Tests for loading missing types/methods/fields from IL
+//
+
+using System;
+
+class Miss1 : Missing.Foo1 {
+}
+
+public class Tests : LoadMissing {
+
+       public delegate void TestDel ();
+
+       internal static int check_type_load (TestDel d) {
+               try {
+                       d ();
+               }
+               catch (TypeLoadException ex) {
+                       //Console.WriteLine (ex.TypeName);
+                       //Console.WriteLine (ex);
+                       return 0;
+               }
+
+               return 1;
+       }
+
+       internal static int check_missing_method (TestDel d) {
+               try {
+                       d ();
+               }
+               catch (MissingMethodException ex) {
+                       //Console.WriteLine (ex);
+                       return 0;
+               }
+
+               return 1;
+       }
+
+       internal static int check_missing_field (TestDel d) {
+               try {
+                       d ();
+               }
+               catch (MissingFieldException ex) {
+                       //Console.WriteLine (ex);
+                       return 0;
+               }
+
+               return 1;
+       }
+
+       //
+       // Base instructions
+       //
+
+       public static int test_0_call () {
+               return check_missing_method (new TestDel (missing_call));
+       }
+
+       public static int test_0_jmp () {
+               return check_missing_method (new TestDel (missing_jmp));
+       }
+
+       public static int test_0_ldftn () {
+               return check_missing_method (new TestDel (missing_ldftn));
+       }
+
+       //
+       // Object model instructions
+       //
+
+       public static int test_0_box () {
+               // Thrown earlier
+               return 0;
+       }
+
+       public static int test_0_callvirt () {
+               return check_missing_method (new TestDel (missing_callvirt));
+       }
+
+       public static int test_0_castclass () {
+               return check_type_load (new TestDel (missing_castclass));
+       }
+
+       public static int test_0_cpobj () {
+               return check_type_load (new TestDel (missing_cpobj));
+       }
+
+       public static int test_0_initobj () {
+               return check_type_load (new TestDel (missing_initobj));
+       }
+
+       public static int test_0_isinst () {
+               return check_type_load (new TestDel (missing_isinst));
+       }
+
+       public static int test_0_ldelem () {
+               // Thrown earlier
+               return 0;
+       }
+
+       public static int test_0_ldelema () {
+               // Thrown earlier
+               return 0;
+       }
+
+       public static int test_0_ldfld () {
+               return check_missing_field (new TestDel (missing_ldfld));
+       }               
+
+       public static int test_0_ldflda () {
+               return check_missing_field (new TestDel (missing_ldflda));
+       }               
+
+       public static int test_0_ldobj () {
+               // Thrown earlier
+               return 0;
+       }
+
+       public static int test_0_ldsfld () {
+               return check_missing_field (new TestDel (missing_ldsfld));
+       }               
+
+       public static int test_0_ldsflda () {
+               return check_missing_field (new TestDel (missing_ldsflda));
+       }               
+
+       public static int test_0_ldtoken_type () {
+               return check_type_load (new TestDel (missing_ldtoken_type));
+       }
+
+       public static int test_0_ldtoken_method () {
+               return check_missing_method (new TestDel (missing_ldtoken_method));
+       }
+
+       public static int test_0_ldtoken_field () {
+               return check_missing_field (new TestDel (missing_ldtoken_field));
+       }
+
+       public static int test_0_ldvirtftn () {
+               return check_missing_method (new TestDel (missing_ldvirtftn));
+       }
+
+       public static int test_0_mkrefany () {
+               // Thrown earlier
+               return 0;
+       }
+
+       public static int test_0_newarr () {
+               return check_type_load (new TestDel (missing_newarr));
+       }               
+
+       public static int test_0_newobj () {
+               return check_missing_method (new TestDel (missing_newobj));
+       }               
+
+       public static int test_0_refanyval () {
+               return check_type_load (new TestDel (missing_refanyval));
+       }
+
+       public static int test_0_sizeof () {
+               return check_type_load (new TestDel (missing_sizeof));
+       }
+
+       public static int test_0_stelem () {
+               // Thrown earlier
+               return 0;
+       }
+
+       public static int test_0_stfld () {
+               return check_missing_field (new TestDel (missing_stfld));
+       }
+
+       public static int test_0_stobj () {
+               // Thrown earlier
+               return 0;
+       }
+
+       public static int test_0_stsfld () {
+               return check_missing_field (new TestDel (missing_stsfld));
+       }
+
+       public static int test_0_unbox () {
+               return check_type_load (new TestDel (missing_unbox));
+       }
+
+       public static int test_0_unbox_any () {
+               return check_type_load (new TestDel (missing_unbox_any));
+       }
+
+       //
+       // Missing classes referenced from metadata
+       //
+
+       // FIXME: These do not work yet
+#if FALSE
+       public static int test_0_missing_local () {
+               try {
+                       missing_local ();
+               }
+               catch (TypeLoadException ex) {
+               }
+
+               /* MS.NET doesn't throw an exception if a local is not found */
+               return 0;
+       }
+
+       public static void missing_parent () {
+               new Miss1 ();
+       }
+
+       public static int test_0_missing_parent () {
+               return check_type_load (new TestDel (missing_parent));
+       }
+#endif
+
+       public static int Main () {
+               return TestDriver.RunTests (typeof (Tests));
+       }
+}
diff --git a/mono/tests/load-missing.il b/mono/tests/load-missing.il
new file mode 100644 (file)
index 0000000..a505a85
--- /dev/null
@@ -0,0 +1,473 @@
+//\r
+// load-missing.il: Helper class used by load-exceptions.cs\r
+//\r
+\r
+.assembly extern mscorlib\r
+{\r
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )\r
+  .ver 2:0:0:0\r
+}\r
+.assembly extern t\r
+{\r
+  .ver 0:0:0:0\r
+}\r
+\r
+.assembly 'load-missing'\r
+{\r
+  .hash algorithm 0x00008004\r
+  .ver 0:0:0:0\r
+}\r
+.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) \r
+.imagebase 0x00400000\r
+.file alignment 0x00000200\r
+.subsystem 0x0003       // WINDOWS_CUI\r
+.corflags 0x00000001    //  ILONLY\r
+// Image base: 0x03310000\r
+\r
+  .class auto ansi sealed public EmptyDelegate\r
+         extends [mscorlib]System.MulticastDelegate\r
+  {\r
+    .method public hidebysig specialname rtspecialname \r
+            instance void  .ctor(object 'object',\r
+                                 native int 'method') runtime managed\r
+    {\r
+    }\r
+\r
+    .method public hidebysig newslot virtual \r
+            instance void  Invoke() runtime managed\r
+    {\r
+    }\r
+\r
+    .method public hidebysig newslot virtual \r
+            instance class [mscorlib]System.IAsyncResult \r
+            BeginInvoke(class [mscorlib]System.AsyncCallback callback,\r
+                        object 'object') runtime managed\r
+    {\r
+    }\r
+\r
+    .method public hidebysig newslot virtual \r
+            instance void  EndInvoke(class [mscorlib]System.IAsyncResult result) runtime managed\r
+    {\r
+    }\r
+\r
+  }\r
+\r
+.class public auto ansi beforefieldinit LoadMissing\r
+       extends [mscorlib]System.Object\r
+{\r
+\r
+  .method public hidebysig static void  missing_class() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (class [t]Missing.Foo1 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo1::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_method() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (class [t]Missing.Foo2 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo2::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  callvirt   instance void [t]Missing.Foo2::missing()\r
+    IL_000d:  nop\r
+    IL_000e:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ctor() cil managed\r
+  {\r
+   \r
+    .maxstack  2\r
+    .locals init (class [t]Missing.Foo2 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  ldc.i4.5\r
+    IL_0002:  newobj     instance void [t]Missing.Foo2::.ctor(int32)\r
+    IL_0007:  stloc.0\r
+    IL_0008:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_call() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (class [t]Missing.Foo2 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo2::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  callvirt   instance void [t]Missing.Foo2::missing()\r
+    IL_000d:  nop\r
+    IL_000e:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_jmp() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (class [t]Missing.Foo2 V_0)\r
+\r
+       jmp void [t]Missing.Foo2::static_missing ()\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldftn() cil managed\r
+  {\r
+   \r
+    .maxstack  3\r
+    .locals init (class [t]Missing.Foo2 V_0,\r
+             class EmptyDelegate V_1)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo2::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  ldftn      instance void [t]Missing.Foo2::missing()\r
+    IL_000e:  newobj     instance void EmptyDelegate::.ctor(object,\r
+                                                            native int)\r
+    IL_0013:  stloc.1\r
+    IL_0014:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_callvirt() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (class [t]Missing.Foo5 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo5::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  callvirt   instance void [t]Missing.Foo5::missing_virtual()\r
+    IL_000d:  nop\r
+    IL_000e:  ret\r
+  }\r
+\r
+  .method public hidebysig static object \r
+          missing_castclass_helper(object o) cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (object V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  ldarg.0\r
+    IL_0002:  castclass  [t]Missing.Foo1\r
+    IL_0007:  stloc.0\r
+    IL_0008:  br.s       IL_000a\r
+\r
+    IL_000a:  ldloc.0\r
+    IL_000b:  ret\r
+  }\r
+\r
+  .method public hidebysig static void\r
+          missing_castclass() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (object V_0)\r
+\r
+               ldnull\r
+       call       object LoadMissing::missing_castclass_helper(object)\r
+               pop\r
+               ret\r
+  }\r
+\r
+       .method public hidebysig static void\r
+                                       missing_cpobj () cil managed\r
+       {\r
+               .maxstack 8\r
+               .locals init (object v_0, object v_1)\r
+\r
+               ldloca v_0\r
+               ldloca v_1\r
+               cpobj [t]Missing.Foo1\r
+               ret\r
+       }\r
+\r
+       .method public hidebysig static void\r
+                                       missing_initobj () cil managed\r
+       {\r
+               .maxstack 8\r
+               .locals init (object v_0)\r
+\r
+               ldloca v_0\r
+               initobj [t]Missing.Foo1\r
+               ret\r
+       }\r
+\r
+  .method public hidebysig static bool  missing_isinst_helper(object o) cil managed\r
+  {\r
+   \r
+    .maxstack  2\r
+    .locals init (bool V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  ldarg.0\r
+    IL_0002:  isinst     [t]Missing.Foo1\r
+    IL_0007:  ldnull\r
+    IL_0008:  cgt.un\r
+    IL_000a:  stloc.0\r
+    IL_000b:  br.s       IL_000d\r
+\r
+    IL_000d:  ldloc.0\r
+    IL_000e:  ret\r
+  }\r
+\r
+  .method public hidebysig static void\r
+          missing_isinst() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (object V_0)\r
+\r
+               ldnull\r
+       call       bool LoadMissing::missing_isinst_helper(object)\r
+               pop\r
+               ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldfld() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (class [t]Missing.Foo4 V_0,\r
+             int32 V_1)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo4::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  ldfld     int32 [t]Missing.Foo4::i\r
+    IL_000d:  stloc.1\r
+    IL_000e:  nop\r
+    IL_000f:  nop\r
+    IL_0013:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldflda() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (class [t]Missing.Foo4 V_0,\r
+             int32& pinned V_1)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo4::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  ldflda     int32 [t]Missing.Foo4::i\r
+    IL_000d:  stloc.1\r
+    IL_000e:  nop\r
+    IL_000f:  nop\r
+    IL_0010:  ldc.i4.0\r
+    IL_0011:  conv.u\r
+    IL_0012:  stloc.1\r
+    IL_0013:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldsfld() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (int32 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  ldsfld    int32 [t]Missing.Foo3::i\r
+    IL_0006:  stloc.0\r
+    IL_0007:  nop\r
+    IL_0008:  nop\r
+    IL_0009:  ldc.i4.0\r
+    IL_000a:  conv.u\r
+    IL_000b:  stloc.0\r
+    IL_000c:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldsflda() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (int32& pinned V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  ldsflda    int32 [t]Missing.Foo3::i\r
+    IL_0006:  stloc.0\r
+    IL_0007:  nop\r
+    IL_0008:  nop\r
+    IL_0009:  ldc.i4.0\r
+    IL_000a:  conv.u\r
+    IL_000b:  stloc.0\r
+    IL_000c:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldtoken_type() cil managed\r
+  {\r
+   \r
+    .maxstack  8\r
+    IL_0000:  nop\r
+    IL_0001:  ldtoken    [t]Missing.Foo1\r
+    IL_0006:  call       class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)\r
+    IL_000b:  call       void [mscorlib]System.Console::WriteLine(object)\r
+    IL_0010:  nop\r
+    IL_0011:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldtoken_method() cil managed\r
+  {\r
+   \r
+    .maxstack  8\r
+    IL_0000:  nop\r
+    IL_0008:  ldtoken method instance void [t]Missing.Foo2::missing()\r
+    IL_0010:  pop\r
+    IL_0011:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldtoken_field() cil managed\r
+  {\r
+   \r
+    .maxstack  8\r
+    IL_0000:  nop\r
+    IL_0008:  ldtoken field int32 [t]Missing.Foo4::i\r
+    IL_0010:  pop\r
+    IL_0011:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_ldvirtftn() cil managed\r
+  {\r
+   \r
+    .maxstack  3\r
+    .locals init (class [t]Missing.Foo5 V_0,\r
+             class EmptyDelegate V_1)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo5::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  dup\r
+    IL_0009:  ldvirtftn  instance void [t]Missing.Foo5::missing_virtual()\r
+    IL_000f:  newobj     instance void EmptyDelegate::.ctor(object,\r
+                                                            native int)\r
+    IL_0014:  stloc.1\r
+    IL_0015:  ret\r
+  }\r
+\r
+  .method public hidebysig static object missing_newarr_helper() cil managed\r
+  {\r
+   \r
+    .maxstack  1\r
+    .locals init (object V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  ldc.i4.s   10\r
+    IL_0003:  newarr     [t]Missing.Foo1\r
+    IL_0008:  stloc.0\r
+    IL_0009:  br.s       IL_000b\r
+\r
+    IL_000b:  ldloc.0\r
+    IL_000c:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_newarr() cil managed\r
+  {\r
+   \r
+    .maxstack  8\r
+    IL_0000:  nop\r
+    IL_0001:  call       object LoadMissing::missing_newarr_helper()\r
+    IL_0006:  pop\r
+    IL_0007:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_newobj() cil managed\r
+  {\r
+   \r
+    .maxstack  2\r
+    .locals init (class [t]Missing.Foo2 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  ldc.i4.5\r
+    IL_0002:  newobj     instance void [t]Missing.Foo2::.ctor(int32)\r
+    IL_0007:  stloc.0\r
+    IL_0008:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_refanyval() cil managed\r
+  {\r
+   \r
+    .maxstack  2\r
+    .locals init (int32 v_0)\r
+\r
+               ldloca v_0\r
+               mkrefany int32\r
+               refanyval [t]Missing.Foo1\r
+               pop\r
+               ret\r
+       }\r
+\r
+  .method public hidebysig static void  missing_sizeof() cil managed\r
+  {\r
+   \r
+    .maxstack  8\r
+    IL_0000:  nop\r
+    IL_0001:  sizeof    [t]Missing.Foo1\r
+    IL_0010:  pop\r
+    IL_0011:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_stfld() cil managed\r
+  {\r
+   \r
+    .maxstack  2\r
+    .locals init (class [t]Missing.Foo4 V_0)\r
+    IL_0000:  nop\r
+    IL_0001:  newobj     instance void [t]Missing.Foo4::.ctor()\r
+    IL_0006:  stloc.0\r
+    IL_0007:  ldloc.0\r
+    IL_0008:  ldc.i4.5\r
+    IL_0009:  stfld      int32 [t]Missing.Foo4::i\r
+    IL_000e:  ret\r
+  }\r
+\r
+  .method public hidebysig static void  missing_stsfld() cil managed\r
+  {\r
+   \r
+    .maxstack  8\r
+    IL_0000:  nop\r
+    IL_0001:  ldc.i4.5\r
+    IL_0002:  stsfld     int32 [t]Missing.Foo3::i\r
+    IL_0007:  ret\r
+  }\r
+\r
+  .method public hidebysig static void missing_unbox () cil managed\r
+  {\r
+         .maxstack 8\r
+       \r
+         ldnull\r
+      unbox [t]Missing.Foo6\r
+      pop\r
+      ret\r
+  }    \r
+\r
+  .method public hidebysig static void missing_unbox_any () cil managed\r
+  {\r
+         .maxstack 8\r
+       \r
+               ldnull\r
+      unbox.any [t]Missing.Foo6\r
+      pop\r
+      ret\r
+  }    \r
+\r
+       .method public hidebysig static void missing_local () cil managed\r
+       {\r
+               .maxstack 8\r
+               .locals init (class [t]Missing.Foo1 v_0)\r
+\r
+               ret\r
+       }       \r
+\r
+  .method public hidebysig specialname rtspecialname \r
+          instance void  .ctor() cil managed\r
+  {\r
+   \r
+    .maxstack  8\r
+    IL_0000:  ldarg.0\r
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()\r
+    IL_0006:  ret\r
+  }\r
+\r
+}\r
index a55e9a571583731bf0cf1676378cc526e691c688..e706bbafce69f92d643c07a4ed3a21585c407afb 100644 (file)
@@ -848,4 +848,33 @@ public class Tests {
                return mono_test_marshal_out_string_array_delegate (arr, 2, new ArrayDelegate10 (array_delegate10));
        }
 
+       /*
+        * Returning string arrays
+        */
+       public delegate string[] ReturnArrayDelegate (int i);
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_return_string_array_delegate")]
+       public static extern int mono_test_marshal_return_string_array_delegate (ReturnArrayDelegate d);
+
+       public static String[] return_array_delegate (int i) {
+               String[] arr = new String [2];
+
+               arr [0] = "ABC";
+               arr [1] = "DEF";
+
+               return arr;
+       }
+
+       public static String[] return_array_delegate_null (int i) {
+               return null;
+       }
+
+       public static int test_0_marshal_return_string_array_delegate () {      
+               return mono_test_marshal_return_string_array_delegate (new ReturnArrayDelegate (return_array_delegate));
+       }
+
+       public static int test_3_marshal_return_string_array_delegate_null () { 
+               return mono_test_marshal_return_string_array_delegate (new ReturnArrayDelegate (return_array_delegate_null));
+       }
+
 }
diff --git a/mono/tests/t-missing.cs b/mono/tests/t-missing.cs
new file mode 100644 (file)
index 0000000..bbb25bf
--- /dev/null
@@ -0,0 +1,51 @@
+using System;
+
+namespace Missing {
+
+#if FOUND
+public class Foo1 {
+}
+#endif
+
+public class Foo2 {
+
+       public Foo2 () {
+       }
+
+#if FOUND
+       public Foo2 (int i) {
+       }
+
+       public void missing () {
+       }
+
+       public static void static_missing () {
+       }
+#endif
+}
+
+public class Foo3 {
+#if FOUND
+       public static int i;
+#endif
+}
+
+public class Foo4 {
+#if FOUND
+       public int i;
+#endif
+}
+
+public class Foo5 {
+#if FOUND
+       public virtual void missing_virtual () {
+       }
+#endif
+}
+
+#if FOUND
+public struct Foo6 {
+}
+#endif 
+
+}
index b1fc9262f63ef6ada9a94538efe5ec079486c70b..f6aad02ca4afbc8bc3cc3f641ec17d4a768fd07c 100755 (executable)
@@ -12,9 +12,11 @@ $output =~ s/\.exe$/.output/;
 $| = 0;
 print "Testing $test... ";
 
-if (index ($disabled_tests, $test) >= 0) {
-       print "disabled.\n";
-       exit (0);
+foreach $disabled (split (/ /, $disabled_tests)) {
+       if ($disabled eq $test) {
+               print "disabled.\n";
+               exit (0);
+       }
 }
 
 my $res = system("$interpreter @ARGV $test 2>$stderr 1>$stdout");
index e7cb438cc2753fc4e821642ac6afad7391cb37b0..7507ad025563b5b2505f9259572477259b354f7b 100644 (file)
@@ -1,3 +1,13 @@
+2005-09-12  Zoltan Varga  <vargaz@freemail.hu>
+
+       * mono-compiler.h (MONO_THREAD_VAR_OFFSET): Fix compilation on amd64
+       with recent binutils.
+
+Wed Sep 7 21:23:18 BST 2005 Paolo Molaro <lupus@ximian.com>
+
+       * mono-codeman.c: ensure we have enough room for thunks
+       with large allocations.
+
 2005-08-27  Zoltan Varga  <vargaz@gmail.com>
 
        * mono-compiler.h (MONO_THREAD_VAR_OFFSET): Disable this when using
index ff0feeb2de658f1337e146958aacb411b9b21f8d..d3e38c3acf7f481624466fa6e2f6c869d96b8384 100644 (file)
@@ -209,10 +209,9 @@ new_codechunk (int dynamic, int size)
        bsize += MIN_ALIGN -1;
        bsize &= ~ (MIN_ALIGN - 1);
        if (chunk_size - size < bsize) {
-               if (dynamic)
-                       chunk_size = size + bsize;
-               else
-                       chunk_size += pagesize;
+               chunk_size = size + bsize;
+               chunk_size += pagesize - 1;
+               chunk_size &= ~ (pagesize - 1);
        }
 #endif
 
@@ -333,8 +332,9 @@ mono_code_manager_reserve (MonoCodeManager *cman, int size)
                return NULL;
        chunk->next = cman->current;
        cman->current = chunk;
+       ptr = chunk->data + chunk->pos;
        chunk->pos += size;
-       return chunk->data;
+       return ptr;
 }
 
 /* 
index 83eff70ed05479a5d3a3b4cca6766d0f2b99fbce..0248f44f9b6098b817a15f384fec2d928324d91e 100644 (file)
@@ -27,7 +27,7 @@
 #if defined(PIC)
 #define MONO_THREAD_VAR_OFFSET(var,offset) (offset) = -1
 #else
-#define MONO_THREAD_VAR_OFFSET(var,offset) __asm ("jmp 1f; .section writetext, \"awx\"; 1: movl $" #var "@TPOFF, %0; jmp 2f; .previous; 2:" : "=r" (offset));
+#define MONO_THREAD_VAR_OFFSET(var,offset) do { guint64 foo;  __asm ("jmp 1f; .section writetext, \"awx\"; 1: movq $" #var "@TPOFF, %0; jmp 2f; .previous; 2:" : "=a" (foo)); offset = foo; } while (0);
 #endif
 #elif defined(__ia64__) && !defined(__INTEL_COMPILER)
 #define MONO_THREAD_VAR_OFFSET(var,offset) __asm ("addl %0 = @tprel(" #var "#), r0 ;;\n" : "=r" (offset));
index c807bf32b01de78955c05ce7223dcb9ec6ef32ec..457c7f9fda9c667fef5e031be77206dce9de519f 100644 (file)
@@ -19,10 +19,7 @@ SUPPORT_FILES = $(symlinks) mono-wrapper wrapper-config
 # The write check is to foil 'make distcheck'
 all-local: $(SUPPORT_FILES)
        if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
-       d=`pwd`; ok=:; \
-       ( cd $(mcs_topdir) && \
-         $(MAKE) PROFILES='$(build_profiles)' all-profiles ) || ok=false; \
-       ./semdel-wrapper || :; $$ok
+       cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' all-profiles
 
 if INSTALL_2_0
 build_profiles = default net_2_0
@@ -35,10 +32,7 @@ install: install-exec install-data
 
 # override automake
 install-exec: $(SUPPORT_FILES)
-       d=`pwd`; ok=:; \
-       ( cd $(mcs_topdir) && \
-         $(MAKE) PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles ) || ok=false; \
-       ./semdel-wrapper || :; $$ok
+       cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
 
 # override automake
 install-data:
@@ -46,14 +40,11 @@ install-data:
 
 # override automake
 uninstall:
-       d=`pwd`; ok=:; \
-       ( cd $(mcs_topdir) && \
-         $(MAKE) PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles ) || ok=false; \
-       ./semdel-wrapper || :; $$ok
+       cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
 
 ## semdel-wrapper will probably not delete the semaphore if someone is crazy enough to do a 'make -j distclean' :-)
 clean-local:
-       d=`pwd`; cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' clean-profiles
+       cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' clean-profiles
        -./semdel-wrapper
        -rm -fr $(etctmp) $(tmpinst) .wapi
 
@@ -71,14 +62,11 @@ test_select = ONLY_CENTUM_TESTS=yes
 endif
 
 mcs-do-test-profiles:
-       d=`pwd`; ok=:; \
-       ( cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' test-profiles ) || ok=false; \
-       ./semdel-wrapper || :; $$ok
+       cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' test-profiles
 
 mcs-do-run-test-profiles: test-support-files
-       d=`pwd`; ok=:; PATH=$$d/$(tmpinst)/bin:$$PATH ; export PATH ; \
-       ( cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' run-test-profiles ) || ok=false; \
-       ./semdel-wrapper || :; rm -fr $(tmpinst); $$ok
+       d=`cd $(tmpinst) && pwd`; PATH=$$d/bin:$$PATH ; export PATH ; \
+       cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' run-test-profiles
 
 if PLATFORM_WIN32
 cur_dir_cmd = cygpath -w -a .
@@ -99,7 +87,7 @@ mcs-compileall: mono-wrapper wrapper-config
            else \
              echo $$i verification failed; ok=false; \
            fi; done; done; \
-       ./semdel-wrapper || :; $$ok
+       $$ok
 
 check-local: mcs-compileall mcs-do-test-profiles
        $(MAKE) $(test_select) mcs-do-run-test-profiles